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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) X( k' c3 U6 j% n( I- O9 z
  1. [code]EDMA sample test application
    " q; ^3 [& x/ W7 z- b
  2. /*0 M& n4 ?: O. b6 F
  3. * edma_test.c$ |, S- f1 E3 @; g* Z5 L  J9 E
  4. *# X/ F0 T! r  y, E) q4 Z
  5. * brief  EDMA3 Test Application* A# V6 `1 d2 l, K1 Y
  6. *
    + g1 E" g+ |9 W
  7. *   This file contains EDMA3 Test code.
    7 K8 J" }4 j- @9 }* A* ~
  8. *. Q& |3 k; X2 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- h  \! h, }6 C" y; C! E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& `2 @/ L2 G2 ]( E* v  S  N% G* p0 S
  11. *         TO CHANGE.
    * ~+ ]  j& x0 F( F; `5 P3 I
  12. *
    , T$ f5 b: X& w2 |- N$ I3 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 s$ e2 Z! n7 s6 G: j
  14. *8 t% a% \* L4 N" T
  15. * This program is free software; you can redistribute it and/or- G; t; }9 h. I* H6 V5 u8 |" ~6 ?
  16. * modify it under the terms of the GNU General Public License as
    6 {. U7 A6 W( @/ ~3 o
  17. * published by the Free Software Foundation version 2.. P: [7 s$ {6 V8 l
  18. *# M  ~, `6 F7 E0 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  G: J2 J. k/ r
  20. * kind, whether express or implied; without even the implied warranty
    - d# I3 w( ?  m) U9 a+ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- y, y, u* S5 I. @: \
  22. * GNU General Public License for more details.: D) O& o, j  o/ u- `
  23. */* g, M5 m8 T6 k! l
  24. 0 D( C4 }+ T: }" H6 |. S# U
  25. #include <linux/module.h>8 C8 M" m+ ^6 ~4 x3 `1 J$ t# `' c
  26. #include <linux/init.h>
    3 K% A2 t  l+ S* }9 B4 j: O6 G3 d5 f
  27. #include <linux/errno.h>
    1 P) q4 {( A/ b
  28. #include <linux/types.h>; y% w6 w  k: H# h" J' J+ ?
  29. #include <linux/interrupt.h>
    8 }$ P& q3 i" \# ]
  30. #include <asm/io.h>
    ; @7 i% K& O9 f' a; ~( C% [
  31. #include <linux/moduleparam.h>/ q! A4 I$ V  Z3 o* f( \
  32. #include <linux/sysctl.h>
    $ U. o& j+ i! j/ u$ u/ R4 m
  33. #include <linux/mm.h>
    " p% B2 l# I- {+ B4 z2 m
  34. #include <linux/dma-mapping.h>
    1 m3 c- \5 I8 h/ F; s: d
  35. & j. X, v4 b" a( }2 [# J
  36. #include <mach/memory.h>+ _" W; `% ?8 Y3 j
  37. #include <mach/hardware.h>0 m: [/ s! P# p& ]- b4 }9 d/ i3 b2 A
  38. #include <mach/irqs.h>
    ) o+ W* o9 @; s, y. g
  39. #include <asm/hardware/edma.h>
    , e2 B' f) z; g+ N, B
  40. 3 [/ n+ U8 d+ x  t" Z2 i5 Z
  41. #undef EDMA3_DEBUG
    9 t8 g$ Y6 D% k  r; ~
  42. /*#define EDMA3_DEBUG*/& I& C  {/ ]7 W) U. l: ~' t6 |

  43. + i8 d7 \$ @% Q5 \* V
  44. #ifdef EDMA3_DEBUG5 C# r  D3 }" ^' o- C- |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , A5 D6 j! ?3 s5 H* j1 M7 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 V% G( @8 s# I5 _3 [' d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      G9 m1 K! t5 F; x
  48. #else
    4 H4 f* V8 v2 ]& P
  49. #define DMA_PRINTK( x... )! Q! ?" K; l, k. u% [
  50. #define DMA_FN_IN
    4 A4 q# p1 s$ p4 F
  51. #define DMA_FN_OUT( F# q1 n: ^9 O9 I2 V" I
  52. #endif
    2 g3 Y- [  Q: u% w  b" A+ |

  53. # z  [2 ?0 r2 l3 O) z% |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! B: r2 _9 I" Q- I: I+ p
  55. #define STATIC_SHIFT                36 g: a' L- U6 ^" |) l7 G% I
  56. #define TCINTEN_SHIFT               20( e, ?' ^3 |# F
  57. #define ITCINTEN_SHIFT              21
    & A% m% c* _. W9 U
  58. #define TCCHEN_SHIFT                22
    , t- c% m+ e- t% C2 R7 @0 s
  59. #define ITCCHEN_SHIFT               23' M) O. A6 i0 g" i! u
  60. # @4 V& T/ w4 \! n9 W6 A" G, c
  61. static volatile int irqraised1 = 0;# j/ N- @+ P7 X* _1 z, ?8 e
  62. static volatile int irqraised2 = 0;, D" F& t" i  `9 b

  63. 5 T1 \3 O+ `1 y3 a: z' Y; o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! D* N! o: l5 N1 s4 L2 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Q8 J% c4 y' i' g8 z( i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / r9 L: i, x* s

  67. 2 ]8 I7 A2 y1 A5 @0 H9 m+ ?2 }
  68. dma_addr_t dmaphyssrc1 = 0;
    ( N% \- p# `4 x$ b. ^6 n5 G
  69. dma_addr_t dmaphyssrc2 = 0;
    2 D! p" a' f* m9 |8 U. }
  70. dma_addr_t dmaphysdest1 = 0;
    ) F) V) U- @1 j$ g; v
  71. dma_addr_t dmaphysdest2 = 0;
    ( K/ W5 X' ]/ |0 [0 N
  72. 7 n7 B4 W6 Q8 r" }9 {0 z
  73. char *dmabufsrc1 = NULL;% V, R& c- V6 l# W) x: D
  74. char *dmabufsrc2 = NULL;! D! }- v8 r$ |, I; `; U
  75. char *dmabufdest1 = NULL;
    4 B  s0 b9 ~' k8 c# W
  76. char *dmabufdest2 = NULL;
    2 o0 u5 p+ K1 c3 Y. v' P
  77. ! Z: t8 K* K( Z$ @; F
  78. static int acnt = 512;: h. ?4 p) u. ^8 ?
  79. static int bcnt = 8;
    / S$ J3 `. [8 F
  80. static int ccnt = 8;
    9 x" G3 M% u  W: }! K% \8 x
  81. . C/ f( s9 _2 j7 X1 ^2 H6 y1 ]) z
  82. module_param(acnt, int, S_IRUGO);! j$ M8 j7 e+ f
  83. module_param(bcnt, int, S_IRUGO);
    5 g& l. E! m( v. o1 |  Y; |# V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  A) y. V4 ?) q7 w: W  f- }) V' K

/ `+ d& B+ Z4 d/ I8 |; q  K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 x) r" Z% C* S% O$ N7 S( A
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 O+ g& d1 I& x" i' K% l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ k9 D9 n! L: s* g1 O" `' m/ {  t" x) Y' H3 X2 T0 s/ W' k+ c, R
  J3 _& l; N- t# T( a/ h2 E8 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 03:48 , Processed in 0.040736 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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