OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10158|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 {6 i2 q) N9 Q& x. D6 b+ m
  1. [code]EDMA sample test application- J4 k0 }- Z: f
  2. /*
    & f% L6 y  s  R- J0 k; n2 F
  3. * edma_test.c
    # p2 h/ D2 P2 ^& S) S$ m
  4. *0 a2 I) m* d4 z! c; R
  5. * brief  EDMA3 Test Application8 P9 D  q; g1 z) h; \
  6. *
    ! M- S$ Z+ g+ _% C, X
  7. *   This file contains EDMA3 Test code.
    $ U5 a  m" H4 }0 y: w1 l# }9 k5 \/ X
  8. *9 y$ |1 U. }! M! z! W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & D, x7 b0 D6 W4 H6 o( T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a4 ]* f- \" n  p3 R
  11. *         TO CHANGE.
    ) R3 y% p7 P$ U- L1 C
  12. *9 a1 y3 o5 ]( @' I, M0 r/ w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' `2 r* C. T& }- }* h! O
  14. *
    % C! g) d, s# L8 f* V/ n$ ^% I3 ?
  15. * This program is free software; you can redistribute it and/or
      J5 e- B* A/ k' k0 x* X1 n5 }
  16. * modify it under the terms of the GNU General Public License as
    6 u8 Y) x. ?# i6 o
  17. * published by the Free Software Foundation version 2.* s9 ~+ J! a; T6 V
  18. *
    7 }  ?6 n7 }9 V. x9 q# C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # R3 K1 `: ?4 C& }6 `3 A
  20. * kind, whether express or implied; without even the implied warranty
    7 p% L. q, e5 V$ Q& [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! e, e1 K. |  V6 m
  22. * GNU General Public License for more details./ E6 r/ f* ?  g0 G' `8 _: b$ E/ I
  23. */
    6 s. {3 d6 d; k5 y7 S) }) L
  24. 0 i( T  j2 \  F$ h
  25. #include <linux/module.h>
    6 x' _+ N, ]; G, R* Y$ x# f. p
  26. #include <linux/init.h>
    6 r; O- M. g  \" y' g: P! ]5 {
  27. #include <linux/errno.h>& V; R" i6 v9 N7 Q
  28. #include <linux/types.h>
    $ D/ U* ?6 @7 d$ x$ t
  29. #include <linux/interrupt.h>
    - I# |, ~; h8 o) Z
  30. #include <asm/io.h>
    8 Z1 ~% ]% j9 u+ q
  31. #include <linux/moduleparam.h>3 z, S/ C) d% |* L" \
  32. #include <linux/sysctl.h>7 g# J+ V- e( I5 C9 ?' ?0 v1 G
  33. #include <linux/mm.h># h% L" u% c  c/ l0 x
  34. #include <linux/dma-mapping.h>
    * u7 L6 M- }6 A- s3 H' ^

  35. , O" H7 I; H3 F. ^8 u8 K- L& @5 o- y
  36. #include <mach/memory.h>3 c" m& w+ `2 r7 q9 B9 I$ V6 k
  37. #include <mach/hardware.h>! f  _- U8 c4 h4 j) j4 F
  38. #include <mach/irqs.h>
    , z3 l, K5 ~, I1 _
  39. #include <asm/hardware/edma.h>8 W2 Q0 F/ c% U. J5 w# B

  40. 7 K9 I8 X+ w. t" n5 \4 T
  41. #undef EDMA3_DEBUG
    * A7 t9 L7 N9 j1 ?# l# K# n
  42. /*#define EDMA3_DEBUG*/$ R9 S3 R/ G1 \: G/ \, e: D9 Z! K

  43. $ s+ ^: e% E+ K. E
  44. #ifdef EDMA3_DEBUG" s9 X2 q5 {- ]9 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 P  F% J, ~( ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * p' ?. J, G+ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ h- m7 w+ ?: Q8 E
  48. #else$ m7 q/ l- N& r7 D9 j
  49. #define DMA_PRINTK( x... )
    6 v/ k* a& Q' C; T
  50. #define DMA_FN_IN
    5 U7 [/ @3 I0 o+ C3 w
  51. #define DMA_FN_OUT
    ) g4 J; ?5 l# \1 \+ z% H, R- e
  52. #endif
    1 B# m$ n: q% W) c

  53. ( T2 J( u0 M- f  S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! p+ P$ u3 z% @: F
  55. #define STATIC_SHIFT                3
    0 B1 q. ]3 \6 W- g, V5 O5 ?
  56. #define TCINTEN_SHIFT               20. F" f+ O, t$ N4 A; m5 c) t* |! u
  57. #define ITCINTEN_SHIFT              21
    * E1 g5 d# a+ t3 }# e1 l3 B1 z
  58. #define TCCHEN_SHIFT                22
    0 ^- G+ X. @: O- t& w
  59. #define ITCCHEN_SHIFT               23
    8 u/ ^9 U7 |- p# {: B$ ^
  60. 2 L* [* C3 I% z! o4 d- K( U
  61. static volatile int irqraised1 = 0;. j& H( m1 t8 c! G! G6 t
  62. static volatile int irqraised2 = 0;& A. `7 }5 {) k3 f' i3 N
  63. + M/ y: ?. z  n6 P1 [3 h" |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 D' y2 K  Y# ~% R& F: E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ]3 r/ [9 o, D7 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z1 i" c+ I+ P  J

  67. + h; k, l7 [; V+ O$ k6 {! {
  68. dma_addr_t dmaphyssrc1 = 0;
    $ b* E0 s% t3 |" u4 ~6 d
  69. dma_addr_t dmaphyssrc2 = 0;# D! S) H1 i  n9 v9 N2 D
  70. dma_addr_t dmaphysdest1 = 0;1 v7 w' S  M4 i
  71. dma_addr_t dmaphysdest2 = 0;
    - J  V$ P% O/ w9 ]: c8 j9 _

  72.   c- y/ |7 Y. _. b2 ^5 Y2 _/ B! Z% q
  73. char *dmabufsrc1 = NULL;4 k) J' a: Y% N3 o6 U
  74. char *dmabufsrc2 = NULL;
    $ k6 r. t) h' G- {; I- C
  75. char *dmabufdest1 = NULL;
    $ E5 f) {% W  \4 G7 J
  76. char *dmabufdest2 = NULL;8 _% P, U1 t# B7 f  ?
  77. , C! J6 g+ _5 U- w. ?
  78. static int acnt = 512;
    - N' x0 h. n8 u1 Q9 \$ e9 v: s
  79. static int bcnt = 8;
    8 E& _1 z- F% ?! \% |
  80. static int ccnt = 8;
    ; O' ]6 i" Q+ p. G3 }7 F

  81. ; i$ `. l7 }5 ]8 M1 y2 ~
  82. module_param(acnt, int, S_IRUGO);
    , c, f) f! z8 N3 A5 k' q1 l
  83. module_param(bcnt, int, S_IRUGO);
    , Z2 ]; X" S$ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 w) `. N' R  }+ _7 g9 S5 c8 Y- O2 m9 H0 w! C% Y4 A8 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! @- M" C! N  rarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ A0 t; h( c. ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" N8 F+ X& I1 B6 o/ X( w
+ F! v0 E9 _; P& a+ o# L% P2 Q

# H! v" m/ e# H4 T* S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-17 20:43 , Processed in 0.047166 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表