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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ M6 q9 k8 j9 z7 G# \) `' k
  1. [code]EDMA sample test application2 T: A$ \4 |" `- |8 W( B
  2. /*( v( e( b8 f1 \) G6 j; @
  3. * edma_test.c3 V+ R! u( V' R! |
  4. *
    9 m$ w* A" T9 q( G/ l
  5. * brief  EDMA3 Test Application
    ! F! Y0 @8 M: u
  6. *
    7 B0 {9 i* i( B" D& O
  7. *   This file contains EDMA3 Test code.4 n$ }' W3 u$ q4 a
  8. *
    / H, A1 S8 F' m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  P1 f; w/ y& |9 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) E! t' f' Z/ ]+ n% G7 ?) u- T' M
  11. *         TO CHANGE.8 v1 Y2 F9 s: S* I
  12. *  t, Y6 g1 n3 `5 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / D- L0 E1 l4 _) b
  14. *( i! ]! O$ l8 r* f3 b
  15. * This program is free software; you can redistribute it and/or
    - ^, U% z3 ^6 I" q$ s- ^- Z" n, G
  16. * modify it under the terms of the GNU General Public License as
    & W/ b! _+ p% k( Z
  17. * published by the Free Software Foundation version 2.4 R/ q, @. F6 p8 \% F
  18. *8 v+ Z8 P2 T9 V# t" D( k, B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : \/ Z' E: X1 F0 x, ]
  20. * kind, whether express or implied; without even the implied warranty) \' ^) k+ \* U. K7 A( c. P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 N0 @5 P6 K- v0 d# ~+ ]+ ~
  22. * GNU General Public License for more details.0 _, I" Z( W% s( ^
  23. */1 V6 T( B- ~$ E* m/ Y1 i2 [2 G, ?

  24. ; u; G8 p9 B9 q; R
  25. #include <linux/module.h>, G, h5 \3 S6 B6 i0 G! F- Q
  26. #include <linux/init.h>
    : e6 w8 t' |; B4 }7 e4 t6 C- u% }3 l9 B
  27. #include <linux/errno.h>3 b- W$ d! S3 |) G8 J; J
  28. #include <linux/types.h>7 J' c2 ^  n- T0 j- e
  29. #include <linux/interrupt.h>7 d+ s5 X9 [( ^1 [' A
  30. #include <asm/io.h>& q$ d, |! Y7 S
  31. #include <linux/moduleparam.h>
    $ `1 f6 Y1 \% w4 C* O/ {
  32. #include <linux/sysctl.h>
    5 u. N1 A9 r7 c, t
  33. #include <linux/mm.h>2 B0 s" [9 Y- w7 h' W
  34. #include <linux/dma-mapping.h>, H" O0 {2 _0 y! r& _

  35. & Y6 {$ d5 F  j0 \  ?
  36. #include <mach/memory.h>
      c, V& b7 e5 R7 S
  37. #include <mach/hardware.h>; M) ~: O/ Z: W) G) ~
  38. #include <mach/irqs.h>- ~+ D- G: o# I; B9 U
  39. #include <asm/hardware/edma.h>( L; R( G. }/ c/ j: q
  40. . h% Y' f. M2 q; f. L
  41. #undef EDMA3_DEBUG
    8 R5 m2 G4 u. {7 g0 {
  42. /*#define EDMA3_DEBUG*/& g! I- g: E  ], D  J! x5 k: a

  43. $ K3 y; u! O7 {$ E
  44. #ifdef EDMA3_DEBUG4 w1 `3 G& D5 q! ]; F- |7 E' r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ o2 z7 g% t! y# W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( q  V7 @' W. y/ x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N3 ?7 b. @. J7 J6 B3 q$ p
  48. #else
    * w- y( j- `! e% x. s9 O2 q
  49. #define DMA_PRINTK( x... )* `! l) Z" O, t% n9 M/ H
  50. #define DMA_FN_IN  m! X# H8 G7 ?5 V2 m' ~' L" y
  51. #define DMA_FN_OUT
    / v$ N3 {) w9 a
  52. #endif/ u9 L; _1 H+ C( `8 i2 \/ H; X

  53. 0 a) d1 @$ S8 t0 d/ e# b2 \& O' E5 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ }+ L8 L5 U/ N/ b, k! }
  55. #define STATIC_SHIFT                3  L. I2 j6 G* C
  56. #define TCINTEN_SHIFT               20
    + w+ ~* h: {8 m" c5 W3 K4 a8 c
  57. #define ITCINTEN_SHIFT              21! ^6 Z6 ?/ [8 X( k2 Q7 l% G
  58. #define TCCHEN_SHIFT                22; \/ h$ z7 G- k; W# ]$ ]$ w& X: b$ m
  59. #define ITCCHEN_SHIFT               23
    & d6 W, z; X0 \/ R1 s

  60. ) y6 O. `9 v$ v( \4 h! t. E
  61. static volatile int irqraised1 = 0;
    $ L- a* G2 z: x3 F, T
  62. static volatile int irqraised2 = 0;+ s; d4 D5 r$ C$ c1 x7 G2 h

  63. , k2 i5 ~9 j/ I; O* h' ^! B& i0 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 C0 k. a1 T+ V% }  W6 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U5 @6 O& l* r. ~0 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o0 j( D+ `- B4 Q& z2 w1 Z! v: X

  67. 5 H% K- A) R) R0 R+ v, A
  68. dma_addr_t dmaphyssrc1 = 0;
    ) _6 w* ^" g, B) `' f3 z6 I+ O
  69. dma_addr_t dmaphyssrc2 = 0;2 w2 @" ?: q8 j% ]" [' x; W
  70. dma_addr_t dmaphysdest1 = 0;
    , S# L& ~" w, K9 ]* }
  71. dma_addr_t dmaphysdest2 = 0;
    , T* [6 W6 D# ^

  72. 4 ?# V8 i/ u5 g' p0 ^: L
  73. char *dmabufsrc1 = NULL;2 i- @+ t, D4 Z
  74. char *dmabufsrc2 = NULL;
    % u- W' k0 Z6 {7 h' p) \
  75. char *dmabufdest1 = NULL;7 O/ }1 r5 d* |5 h
  76. char *dmabufdest2 = NULL;
    $ _) W4 M1 [+ Q. g, G* t8 n6 B

  77. ( M) C8 L% b; _" Z# Q8 g9 {5 ~3 X
  78. static int acnt = 512;
    ) {: C, P$ h2 D% w& f4 {: M
  79. static int bcnt = 8;
    * V; t+ ]7 F$ H+ ]' I3 m, O
  80. static int ccnt = 8;/ o  o+ F3 k: X5 L3 O3 Z

  81. ( c' @7 q/ k8 p4 d* W% z' d" B
  82. module_param(acnt, int, S_IRUGO);& \, p' \4 t, b8 |2 V, c. d
  83. module_param(bcnt, int, S_IRUGO);
    - b4 f, R3 k1 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 ]" O0 t! ]) N- S: j
2 R5 a9 t, r& S) u' |* L/ h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k+ t( r; }) ~. m: H6 G8 O% m% oarm-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  j' }, V6 k' r1 l" L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ?/ v5 O1 b& {; B: Q' y) C9 n

7 a! k) r6 p8 a1 |3 i/ O
3 \5 W/ y( V7 q, b: z& K+ E0 X8 U3 [1 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-20 22:51 , Processed in 0.039934 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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