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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 G, m( A  ~2 u3 H- D7 p
  1. [code]EDMA sample test application% |0 u$ ]4 _; P2 Q
  2. /*6 D* `" ]- j/ T7 _' U
  3. * edma_test.c
    # x% q! y5 r; l: P
  4. *4 N! u1 X+ L/ `* Z
  5. * brief  EDMA3 Test Application
    ( z9 b; K7 q6 v( o, N
  6. *$ K4 ?6 U/ T( F7 I4 [  m* a0 t. O
  7. *   This file contains EDMA3 Test code.
    . J' }' N$ x5 h! R5 o2 H
  8. *
      Z/ O  N' Q) }: f0 `% u7 u: x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ K& L! G2 N! A3 S* G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # S$ P+ A) f. |/ }4 B1 a, @
  11. *         TO CHANGE.9 R; Z+ y$ q9 l/ \
  12. *! M6 @! t0 a. ?% `/ D* N/ R3 q6 Y( P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 r  H4 I4 w+ F  x+ y
  14. *+ m4 X5 N6 ^- \2 o, p' ]  T; h+ g
  15. * This program is free software; you can redistribute it and/or
    # y+ ^# f# o5 h" q. U: z, {7 K3 T* s
  16. * modify it under the terms of the GNU General Public License as
    2 @' c( Y0 t! U" ~; J# w
  17. * published by the Free Software Foundation version 2.
    ) ]; s! V% j9 l. h- I/ H; Q
  18. *
    # r4 B  C4 Q# N. F2 K: ]  L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & |: \+ G7 W: I2 s  R+ _3 \' x
  20. * kind, whether express or implied; without even the implied warranty6 h" O5 Y5 G7 Z1 D( i, ^, n2 J# g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  N2 _2 f$ x" Q( J4 \4 m
  22. * GNU General Public License for more details.
    : ]6 g, W  `  x. n' I' |8 h, p& u
  23. */
    : V/ M8 l! V$ N$ G
  24. 8 ?# b0 U& C3 ]5 Y/ ?2 l
  25. #include <linux/module.h>5 i1 |, t; v) e* @
  26. #include <linux/init.h>0 {6 z/ m3 H) U+ Q6 G3 L! M
  27. #include <linux/errno.h>
    + M/ v. I  F1 ?; L
  28. #include <linux/types.h>
    ) b1 Q! \7 [( h7 K; c1 B  W
  29. #include <linux/interrupt.h>
    ) H% ?* V; E& W3 k) i( E3 c- u
  30. #include <asm/io.h>* p1 ~" X) P3 V' x! O$ u' S
  31. #include <linux/moduleparam.h>
    ' L" }" E" }0 F4 v# L- t4 s3 _
  32. #include <linux/sysctl.h>
    4 |, j  a1 `& d$ Z/ @# t, P0 w1 Z8 X
  33. #include <linux/mm.h>" g0 D9 a. c/ e2 l3 m% S
  34. #include <linux/dma-mapping.h>
    + ?- ~$ d, Y: u- q4 Q/ e: y

  35. " [% J2 `; n1 v/ g% F) e6 @3 i
  36. #include <mach/memory.h>. N& V) b9 h. }% v$ F" ^2 z) P
  37. #include <mach/hardware.h>9 j4 `1 D! `% W7 E6 r
  38. #include <mach/irqs.h>
    9 g' q7 Y3 h, S! j9 ~* w
  39. #include <asm/hardware/edma.h>
    5 ?9 t+ o; H4 N6 X0 [: H! S9 X
  40.   l+ V1 C0 |! X4 H5 m% c
  41. #undef EDMA3_DEBUG7 m/ c. N) F% O
  42. /*#define EDMA3_DEBUG*/
    . `4 U& E1 O- ^1 ]& S6 S

  43. , A* _/ t+ `# Q+ O
  44. #ifdef EDMA3_DEBUG
    ; Y* o5 _. A' z9 |/ {7 s. v7 @0 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # U! a; G9 \& ^7 R* w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 @0 ]7 \8 j' v( O* l& l, [5 h" @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : p# c1 k  U7 l( C$ A( H3 F! D' P# ~
  48. #else/ Z9 t( g+ ^2 A, U/ S8 s
  49. #define DMA_PRINTK( x... )7 Q# D& S4 `7 s
  50. #define DMA_FN_IN. w' J& m5 p* Z; w, }: P
  51. #define DMA_FN_OUT
    2 i+ C( K3 }; x9 n+ K& r
  52. #endif
    : y( K$ t$ A: w& w; x

  53. 7 Z+ t& z6 C" n% x1 V" _# G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& f; |& [* Q$ v( N# D  ?
  55. #define STATIC_SHIFT                3
    4 w6 Q* Y/ P; O% k
  56. #define TCINTEN_SHIFT               20' m- l0 O- i) N. H2 n8 j+ q
  57. #define ITCINTEN_SHIFT              217 a, @  F: E7 A# l" ~& B
  58. #define TCCHEN_SHIFT                22" K0 p! o; d1 O- m, E: K) K: T4 T
  59. #define ITCCHEN_SHIFT               23
      [. N7 y; j* \, P; R* m/ f+ c

  60. 1 ?$ E5 l% o) W/ c# ]" J9 B, I6 u
  61. static volatile int irqraised1 = 0;
      S( z5 H# ~- a. }" E
  62. static volatile int irqraised2 = 0;
    5 d4 J  |) U) K0 ]$ k4 r% o& G3 ^
  63. 4 ^4 p4 {5 X. ]9 _8 R! ?0 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' W$ D" V/ m: Q3 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S0 v, l: }; W$ a) c1 q4 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: r  B, X. _2 Y/ d3 i

  67. , y% V0 L. K0 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    6 ~  w2 c  I0 v- X0 K+ m( O
  69. dma_addr_t dmaphyssrc2 = 0;
    % z6 L* Q4 `" P# g% a& ?
  70. dma_addr_t dmaphysdest1 = 0;5 |9 }4 k  e: G. k/ w1 p! H
  71. dma_addr_t dmaphysdest2 = 0;
    4 m' O1 y0 ]3 P6 a
  72. 2 S5 E8 |: O4 j1 D* ~
  73. char *dmabufsrc1 = NULL;# b- S6 [2 f% n+ e; m' H$ f
  74. char *dmabufsrc2 = NULL;
    % H" O  S8 T7 a$ s* o) g/ T6 v% \
  75. char *dmabufdest1 = NULL;
    3 y5 X& O! [  f2 J9 w8 M8 _5 R* I
  76. char *dmabufdest2 = NULL;" d; i3 F# x/ v2 M
  77. ( e2 K# q  M8 a7 J7 k: H9 p
  78. static int acnt = 512;" J! Z5 O8 C; r# D; l! l
  79. static int bcnt = 8;
    0 \4 x) r' \; F2 ^; s' k
  80. static int ccnt = 8;) W, b# W2 d4 h/ Y/ [0 ^) P
  81. ! n; e* H8 C5 s2 V- h
  82. module_param(acnt, int, S_IRUGO);
    5 n6 O: T4 Z4 m( ]+ B
  83. module_param(bcnt, int, S_IRUGO);) b, y2 c+ U6 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 X! W; d9 W0 f/ j- X, D- I* g5 j7 A+ ~  S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W/ O+ u8 q. m/ T$ J3 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! h: j0 r" F1 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 q* b2 X/ Q) |( y6 A

5 F4 P2 t7 q1 }2 c/ c+ D  Y, X  k7 ~2 B! T/ b7 }$ ^& k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 03:35 , Processed in 0.039467 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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