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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 S1 [# y  R; z
  1. [code]EDMA sample test application
    ' A9 n2 N/ h1 S8 k: L  S1 P3 \
  2. /*. I% i6 x$ z- h! t
  3. * edma_test.c2 D, m1 J5 y; c
  4. */ ]! a  U- f# E9 }8 e( l, R
  5. * brief  EDMA3 Test Application
    : @: P6 `8 t) F# ?5 N
  6. *
      V6 B/ c: t) u" i; [( L" C
  7. *   This file contains EDMA3 Test code.
    + f( B& C+ t0 G, m
  8. *
    * Q- Q0 B* \1 x; F) k( ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! _' s9 r3 Q/ U( f0 m, U& T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 M6 D# }- Y& I" u
  11. *         TO CHANGE.
      y( @4 k/ e0 A" U' v4 E& {
  12. *
    $ _+ A4 h' |* Y: B4 H7 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' @; B3 k& l8 P1 z6 e8 W' W& {
  14. *3 O! F7 G4 g) ?! d* }' r# g6 e
  15. * This program is free software; you can redistribute it and/or- |7 e" n- {: I( |( O
  16. * modify it under the terms of the GNU General Public License as
    % l; G% j! s8 L. P$ ]# q. ?
  17. * published by the Free Software Foundation version 2.
    " p* j+ q/ O0 V) K3 |5 [  z, h7 Y
  18. *  a) L- E1 X. |9 ^5 t+ P/ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      F2 y. B' B+ I) {$ y
  20. * kind, whether express or implied; without even the implied warranty
    " t( n( i$ {, }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. h7 s, j% p8 w
  22. * GNU General Public License for more details.
    - J' M! q- v# v5 X
  23. */
    , U) k' }( X1 d- l0 a9 _8 B3 O' ?
  24. * e/ [' b. O( u3 R% _: d5 Q
  25. #include <linux/module.h>/ d6 H& M! E: b! W8 `- o
  26. #include <linux/init.h>
    6 T5 d" M, @5 {7 y) \( L
  27. #include <linux/errno.h>
    - q5 e: h, A* v2 Q& l0 Y
  28. #include <linux/types.h>
    / M7 i% X/ c. N% Y: Y! a* q
  29. #include <linux/interrupt.h>
    ( T: X+ ~7 X/ R  y
  30. #include <asm/io.h>; p0 T' [" P% o- R* ~( F
  31. #include <linux/moduleparam.h>, \6 V7 a; z3 D) o; P  f
  32. #include <linux/sysctl.h>) P* U4 X! b. k& r1 R
  33. #include <linux/mm.h>8 h) w0 O. L& w% K
  34. #include <linux/dma-mapping.h>5 Z$ n' V& n" P4 \
  35. : X7 O$ J8 n& w! O. `9 n( d
  36. #include <mach/memory.h>
    ' Q6 K/ h% o/ l2 U9 W# D$ s; a) N
  37. #include <mach/hardware.h>
    1 ^6 j8 p9 \- h* x5 Q8 e
  38. #include <mach/irqs.h>
    ! E; |8 ~+ G+ S7 O
  39. #include <asm/hardware/edma.h>
    - x; o! ^+ F2 k+ N7 O
  40. 1 Y/ a( Q! H; x# }
  41. #undef EDMA3_DEBUG: ?) \2 ?4 m- W
  42. /*#define EDMA3_DEBUG*/
    7 t, ~/ c! R2 w  Z% k0 D+ r

  43. - L/ X: X. N0 Q! f
  44. #ifdef EDMA3_DEBUG, N7 g0 D: x" J4 ~" v1 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ c0 w  v% F$ e- {9 R: U/ b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Z* H7 [2 ~+ N7 s% d6 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 G( v. \6 B1 E- [0 d
  48. #else" ^* J  Y9 c# ~- F# e7 \
  49. #define DMA_PRINTK( x... )$ r: u2 L8 t" ]) {! v2 q
  50. #define DMA_FN_IN; ^! B- d3 ]5 m5 _  l
  51. #define DMA_FN_OUT
    & H9 d3 ^6 Y( T5 S
  52. #endif
    + \# ]+ |4 q3 M4 a6 M
  53. ' j/ L; j3 ?, B" M+ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( D% E4 [1 N( n; p, x
  55. #define STATIC_SHIFT                3
    4 [0 _: h  b) N+ e0 [1 w8 a
  56. #define TCINTEN_SHIFT               20
    0 Z1 v* ]  [$ c
  57. #define ITCINTEN_SHIFT              21
    4 p; n* s$ b7 T
  58. #define TCCHEN_SHIFT                22
    $ j; j% H8 F; @% z% t5 _
  59. #define ITCCHEN_SHIFT               23
    + q3 k$ l6 ^! g

  60. 0 ~, T: @+ ~( ?5 a$ Z" V2 U* v
  61. static volatile int irqraised1 = 0;$ o% O* K' n+ k  @4 }# `) g, D
  62. static volatile int irqraised2 = 0;
    : i) U2 F7 h. a
  63. - x) {( E* e1 X8 H# b* O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 o% a9 }3 q, _0 b( Z' {2 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , p" Z8 n( J3 k" S* c. ^( \5 g& |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y) L# ]1 c7 y3 \4 H

  67. % m+ G1 U8 P3 m7 }
  68. dma_addr_t dmaphyssrc1 = 0;
      B- I- ^' ]3 l9 V, ~0 k
  69. dma_addr_t dmaphyssrc2 = 0;
    * C+ `, O& Z( f
  70. dma_addr_t dmaphysdest1 = 0;
    # ^$ x- @( M7 k! Y# ]
  71. dma_addr_t dmaphysdest2 = 0;
    . P, U/ g/ {9 d2 R& p: I9 w
  72. , V" P  ~7 J. y& l' u
  73. char *dmabufsrc1 = NULL;
    / I8 l4 j5 E+ q
  74. char *dmabufsrc2 = NULL;/ ]' q  y  y4 ^
  75. char *dmabufdest1 = NULL;- ?+ }0 H- Z) [) h; i2 u
  76. char *dmabufdest2 = NULL;
    ! K$ N+ V3 x0 u$ k
  77. 3 N! M2 v& Q& J; k. M5 b' L* s
  78. static int acnt = 512;
    " j* s( f) y/ }3 H2 u
  79. static int bcnt = 8;
    : E+ r7 H7 C& z
  80. static int ccnt = 8;
    4 j' H9 ~' ]. V1 z9 E* N
  81. ( y4 g( Y1 E' u/ C% N9 }
  82. module_param(acnt, int, S_IRUGO);
    2 g! ^% C9 w% P
  83. module_param(bcnt, int, S_IRUGO);: s! ]5 Y9 R- a! V- _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 K8 ^4 U; h1 K

/ u, `+ j1 U+ b" ^2 j' m& T/ Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 ^2 f. j  W( e1 m; X; garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 g& z5 |; w# a& Y5 [% \# r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 y4 V; ?* }# E2 z( S7 ^
9 D4 |/ y( a( e' D3 v3 M: [, c: [) Y3 A3 ?2 l9 w; N  Y; j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 04:58 , Processed in 0.039845 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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