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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 @* F+ ~  H6 C4 ]8 E
  1. [code]EDMA sample test application* ^8 [) |5 a* N+ u/ Z
  2. /*
    + y7 s# C. n( o) ?' J7 ?
  3. * edma_test.c
    0 ?0 x8 D" r) G7 W$ e
  4. *3 J8 P1 }: {, y! E( W8 s2 ?! f4 |
  5. * brief  EDMA3 Test Application
    - O; D( L9 u' z" a0 Q, x
  6. *
      z$ t& y4 v- d0 a
  7. *   This file contains EDMA3 Test code.
    $ E- ?$ W- ^9 ]. ~% g
  8. *
    * N+ Z. `# q4 C% }" U2 o9 w/ P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 _- b% T/ N! e3 t! Y2 P8 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: V/ r6 d5 t. C7 e4 _
  11. *         TO CHANGE.% g; T( B9 `( b) _
  12. *8 P! o3 X. l) N1 a, [2 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * A: r$ m( H( b# t
  14. *. [2 o" l3 r& ]
  15. * This program is free software; you can redistribute it and/or' J1 s; u( s0 Z2 V  }: T3 I* `. ~
  16. * modify it under the terms of the GNU General Public License as
    * [" v/ Y: t" ^% m! h. r6 b
  17. * published by the Free Software Foundation version 2.% v+ y: ]' J1 L0 p6 Y
  18. *
    0 X1 N5 h% D1 L2 w. u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 B! U0 P" O" l" N2 z% r: f6 G
  20. * kind, whether express or implied; without even the implied warranty* |; q2 t9 `) q6 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 e1 \) l! _! |, T7 N- k
  22. * GNU General Public License for more details.# G& o5 q! h6 \# D7 g
  23. */( L  s! C9 L7 @3 Q0 j5 ]1 ]
  24. 9 K& Q/ ?2 F$ g$ x3 o
  25. #include <linux/module.h>
    ( P6 n+ Y0 ~0 d! `
  26. #include <linux/init.h>0 K' E  l/ I) P0 G! i% B
  27. #include <linux/errno.h>" a) ^. s* k+ p4 C: D4 F2 b4 V
  28. #include <linux/types.h>
    3 x% ^1 \3 c, Y: I3 J, f/ n
  29. #include <linux/interrupt.h>
    5 ]$ p7 t+ U# I
  30. #include <asm/io.h>- l6 x2 V, T) E" K9 b1 L
  31. #include <linux/moduleparam.h>
    * f: M7 G. M% U% S2 H) h$ I
  32. #include <linux/sysctl.h>* m# t0 z) |% c! K" J7 ?+ Z
  33. #include <linux/mm.h>
    9 f. u1 P1 K+ ~7 R
  34. #include <linux/dma-mapping.h>7 U3 a$ J/ ]. P; @4 Z: i! C+ d0 P  v
  35. * _6 g/ }  Z# t( A6 \
  36. #include <mach/memory.h>
    # ?. v  j, e  X
  37. #include <mach/hardware.h>
    ) B3 g+ `" \  u# k
  38. #include <mach/irqs.h>
    7 Y6 K: a& ~4 U! ^, m) H- S
  39. #include <asm/hardware/edma.h>: k4 {! X  O" y& w0 d& g4 j; Z( j
  40. * H; N: C: @# t2 s; V
  41. #undef EDMA3_DEBUG3 g9 v6 o4 V, B: K$ S' O: p$ l# f
  42. /*#define EDMA3_DEBUG*/0 O( A2 b( u7 q8 L- z7 d
  43. 6 |! R  e4 W% }9 T, B' g
  44. #ifdef EDMA3_DEBUG  C; i* v) f4 f+ i. p# L' z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      T" P- a6 ]2 i/ s, P2 F* z/ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' I; O# ~* }1 G9 o2 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 @- k8 R! L8 X0 \5 {* t1 B
  48. #else
    " r0 X5 U9 I5 w' ], B! r
  49. #define DMA_PRINTK( x... )
    ( L6 O! L1 u$ I& B8 \( U
  50. #define DMA_FN_IN
    1 L2 U4 J; u, V7 w3 V
  51. #define DMA_FN_OUT
    . z, K0 c6 m  T$ s! t; |8 q% \9 S
  52. #endif! c! h* R  i; D8 H6 F) y9 x

  53. ; ]! b& Y7 p  K7 Y' U4 O# x; S9 J0 [' m. |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# \) f0 }/ w8 g: W
  55. #define STATIC_SHIFT                37 g9 H  l% _% A7 s
  56. #define TCINTEN_SHIFT               20
    * z+ f5 B- k3 a( j
  57. #define ITCINTEN_SHIFT              21* \5 u' M8 Y1 C( x. O
  58. #define TCCHEN_SHIFT                22
    ( t7 @( M' X4 z! |6 r+ P
  59. #define ITCCHEN_SHIFT               23
    4 i8 C( M6 A; x" `. Q8 o& S. L* P
  60. ! x& C3 u) M0 l2 W! N6 r- K
  61. static volatile int irqraised1 = 0;$ X. _, ?0 R5 b, j
  62. static volatile int irqraised2 = 0;
    % j2 T4 `9 K; B$ }1 D* l

  63. 1 H! V; @: j# l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 K9 \: c! ^1 L7 {( f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & z. I8 [5 u* X- ]7 s9 Z2 @! h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % T: V- V, H. M: w  F3 g% r1 j

  67. 9 k9 r. _9 L8 s0 _* s
  68. dma_addr_t dmaphyssrc1 = 0;
      {3 {# W0 H/ z  n3 M( o  m6 n
  69. dma_addr_t dmaphyssrc2 = 0;+ z8 Q" o. Y3 l2 }
  70. dma_addr_t dmaphysdest1 = 0;
    2 y9 s$ r& `. R( S  g
  71. dma_addr_t dmaphysdest2 = 0;
    / x7 W/ z4 W; Q5 x
  72. ! m/ r. _3 ]0 ?+ B
  73. char *dmabufsrc1 = NULL;! k$ o" t( F! f, y+ y$ J; @
  74. char *dmabufsrc2 = NULL;/ z) \/ D$ ~) b3 _) U; {1 T! [
  75. char *dmabufdest1 = NULL;0 Z. d( r% r: q7 m5 Z
  76. char *dmabufdest2 = NULL;7 P- b/ h4 A( K6 q  _5 m8 M

  77. 9 {. f7 Z0 G- W0 q/ c# Y
  78. static int acnt = 512;# W' _9 E, _8 u" P" Y9 R
  79. static int bcnt = 8;
    / l# j% s  l# T; W4 a5 Z
  80. static int ccnt = 8;  @7 R$ v2 [8 J8 E

  81. , Y7 v& N1 M# ~$ s1 x$ F
  82. module_param(acnt, int, S_IRUGO);
    + D( A% M* `' \/ `
  83. module_param(bcnt, int, S_IRUGO);3 R9 y: }- e) l/ |, ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( Q8 o- H4 |3 b8 Z, \/ K3 m2 i; K/ ~4 A. E8 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 _/ u1 V3 V" M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% l. p0 L  R7 d* B  J* D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ~! e/ I* G4 ^6 X. S7 g% J
* {5 D% b5 t. ?/ ~+ r0 W2 S' ]- s; K$ i! s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 03:07 , Processed in 0.037988 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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