OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 u6 G5 C% E4 b, }
  1. [code]EDMA sample test application/ ]' y4 |1 s1 y
  2. /*
    , K9 x6 ^% B4 l6 H% L' |
  3. * edma_test.c5 x5 v/ T% i7 t5 K
  4. *
    3 Y) w4 Y9 U; A: }% A
  5. * brief  EDMA3 Test Application/ N! [% z: N- C1 o! k! p
  6. *% N. \" h0 g- @. L% Y/ C
  7. *   This file contains EDMA3 Test code.' C; r. y6 W0 y& p* o8 D
  8. *; H0 j' e: `6 J8 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / _- F- ~; P: T0 e$ h) \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ |" R, b0 C  E+ n% B/ N8 {" u+ d
  11. *         TO CHANGE.4 L( H7 t& j& T" x; M8 ?
  12. *, c) E! y1 p3 b. h9 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' A$ X2 }5 x# {4 `
  14. *) l$ E( R1 c& Q# |0 x
  15. * This program is free software; you can redistribute it and/or
    1 u" T6 g) Y* B8 X7 d
  16. * modify it under the terms of the GNU General Public License as! X" w2 R* p; \! S
  17. * published by the Free Software Foundation version 2." X& I" ^4 W- T/ t' S) Z
  18. *
    4 l; v1 v) x. o4 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ U2 W$ `( o  |4 f' t0 p* d9 J( ~# a
  20. * kind, whether express or implied; without even the implied warranty3 X, n# P4 ^3 f7 d" f2 S1 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + o& P% ~  c+ A, j5 b0 Y, E
  22. * GNU General Public License for more details.
    ( c; Y$ g# Z$ D4 o$ p8 k/ m+ R
  23. */
    / n8 I. c. W. e! f5 b9 U$ u7 x* {" [

  24.   A* t' L" }& }# N" y8 ]9 ~# Y
  25. #include <linux/module.h>
    3 \' g" l3 J8 E9 y, y
  26. #include <linux/init.h>
    ) j1 J8 w( I6 h# ]  u6 L2 b, P
  27. #include <linux/errno.h>; Q5 y$ Z8 A/ i
  28. #include <linux/types.h>9 X, m% a5 v5 [6 I
  29. #include <linux/interrupt.h>* c8 K/ j" }  O4 n' K
  30. #include <asm/io.h>. v3 k2 X$ |4 b4 h" K7 @8 l# E) i
  31. #include <linux/moduleparam.h>
    % Z3 `. G0 K& N. s
  32. #include <linux/sysctl.h>, n1 J+ D. l* M0 k7 D
  33. #include <linux/mm.h>
    ( P( b' W  K& Q. o: A
  34. #include <linux/dma-mapping.h>
    ) I4 j+ `2 D" c1 S. n  ]
  35. - {; n$ ?/ j8 ?
  36. #include <mach/memory.h>! k' m. o3 ~# [* Q6 J2 p( P
  37. #include <mach/hardware.h>/ E; _5 J+ L1 `& o5 X: q
  38. #include <mach/irqs.h>
    $ j- V) h3 i3 }: e% e
  39. #include <asm/hardware/edma.h>8 ^) }5 F) p9 E3 z
  40. . H; i& @$ d; N- w
  41. #undef EDMA3_DEBUG
    1 O5 V' M+ m" d( T4 ^6 h
  42. /*#define EDMA3_DEBUG*/
    : {' b& s7 Q) v. P
  43. & E7 Q9 `7 x: ?
  44. #ifdef EDMA3_DEBUG
    ; O" B5 @8 o/ w( [7 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 x" D/ |7 C3 g6 I* s  i4 g/ q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" H1 w$ U3 v. [) d1 W0 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & Z4 Q' m* D! A9 e8 n$ g5 l
  48. #else
    2 j9 x2 f" n) ]' [+ _
  49. #define DMA_PRINTK( x... )
    . ?+ w$ e' A4 I, J8 \8 X
  50. #define DMA_FN_IN- ?+ {& I% r( @: a4 W: B
  51. #define DMA_FN_OUT2 e0 a; S8 c  j* Q
  52. #endif
    * ~0 b4 [# f/ v

  53. ) v: g0 `, w* q7 t+ ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & i1 b- q& j. O- s( e) r3 H
  55. #define STATIC_SHIFT                3
    2 }5 J# k0 k* P: u- \! q
  56. #define TCINTEN_SHIFT               20
    : f$ Y1 ]: [( D1 ~
  57. #define ITCINTEN_SHIFT              21& w! L* p/ l1 E# b, _& ]6 I8 K
  58. #define TCCHEN_SHIFT                22: c: J+ B4 W8 q
  59. #define ITCCHEN_SHIFT               23, K0 {! u2 ^2 N# ^  ?2 p; ~# V. I3 W; [

  60. 6 E+ E& h5 P  r" v3 w! p6 D7 @' T5 W: Y" N
  61. static volatile int irqraised1 = 0;7 d" q/ o8 I. r& F% K
  62. static volatile int irqraised2 = 0;0 x2 ]" f$ E. L0 F/ F- w, q

  63. ' G+ \4 p: E+ \6 g, h$ P$ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 e8 F% p3 f7 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 M& k' g: b/ W) }; S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. G9 Z2 \2 `6 r3 d4 l) Z

  67. % @3 S1 `4 q6 E& c
  68. dma_addr_t dmaphyssrc1 = 0;: c: x2 v& J4 C: {( G8 g
  69. dma_addr_t dmaphyssrc2 = 0;  j4 z  P" ~! M+ j7 G& D
  70. dma_addr_t dmaphysdest1 = 0;2 d! d+ p; U1 V6 s3 q' Y% ]
  71. dma_addr_t dmaphysdest2 = 0;- t" }  `0 m  ^% V( |
  72. ' k+ x0 E1 u6 R8 k4 |6 Q/ o! R
  73. char *dmabufsrc1 = NULL;( }/ P4 z" S8 D' a* D5 o
  74. char *dmabufsrc2 = NULL;
    - X% v' W* U4 q7 |) o  p6 g4 A
  75. char *dmabufdest1 = NULL;
    3 n& h- b+ X/ C; {! ^" J$ h
  76. char *dmabufdest2 = NULL;- H8 t; v8 I8 u! w3 Z' w
  77. $ j; N) H+ G: a  K1 R
  78. static int acnt = 512;
    7 U9 }* l8 t' j1 t
  79. static int bcnt = 8;1 m# L9 I  X9 D* _; D2 u
  80. static int ccnt = 8;
      a; D; y: b7 `6 m/ \# B9 f
  81. : G7 b5 v4 v8 \5 N' u7 K4 s
  82. module_param(acnt, int, S_IRUGO);
    7 D( w& E$ M- Z( |
  83. module_param(bcnt, int, S_IRUGO);+ a4 p  e' J0 ~! a& ^$ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# w( k+ R6 @% m9 z
0 `0 U& u0 V! D5 }$ L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' d+ q, M& i" J! ?- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ c; t' X# }/ c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) b, m( L; r, f8 n
) b( L5 C, S" Y' I

( }% Q3 ~1 t, m$ s# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 11:12 , Processed in 0.037655 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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