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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( ?& a! h  V' n" K- F/ u! I
  1. [code]EDMA sample test application$ W7 F8 f" [- m' Z  c
  2. /*
    % S0 B' W' ]; c( O
  3. * edma_test.c* {% |% a( K5 r: {
  4. *
    ) U8 V8 P3 Y' S; }8 A
  5. * brief  EDMA3 Test Application
    3 |5 p# W' ^8 X2 f* e& Q
  6. *
    , |$ ]; L# M1 y2 U1 N4 `, E! S
  7. *   This file contains EDMA3 Test code.
    & {4 j& p  U( t* ~
  8. *: y7 L$ B: }& n% V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      c5 I. h: u5 l& Q: G- K! C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 C/ w# {5 L: {
  11. *         TO CHANGE.2 r( R2 f% R) r. S6 J/ w& f3 {# j
  12. *  V) @1 G: G9 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( p' d! F7 S. Y) P
  14. *
    * }; K& |' h. J+ ~% _$ K
  15. * This program is free software; you can redistribute it and/or9 e) w" K( E* Q
  16. * modify it under the terms of the GNU General Public License as
    , r5 t( k* W3 u7 m  t
  17. * published by the Free Software Foundation version 2.
    0 O; u" j4 A* ?& M
  18. *
    - M4 p! `: F0 h# r1 p3 r0 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 W3 c: b3 A8 L- o
  20. * kind, whether express or implied; without even the implied warranty
    & P" S* g" ]- F. W8 r9 {: Z5 P0 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' q3 l. {# g8 v  O
  22. * GNU General Public License for more details.
    , e; z; l5 r( g* ?/ h: d
  23. */
    + }) {% U; p$ h( }

  24. 2 x/ s7 v& S9 O3 v9 H4 c1 x) a
  25. #include <linux/module.h>$ ~1 s: c; _" R& ^2 r& t
  26. #include <linux/init.h>8 ~3 J7 d1 D/ I4 Q, n/ h
  27. #include <linux/errno.h>
    6 v& x3 d, F% O0 j6 X6 q3 t6 N  j
  28. #include <linux/types.h>
      H/ G( h/ k$ o9 R- z2 B) C
  29. #include <linux/interrupt.h>
    # O$ \. S) a5 x& M% U7 w5 J
  30. #include <asm/io.h>
      R2 c2 y4 p5 M' F
  31. #include <linux/moduleparam.h>
    : f$ |+ w& Y' j3 [1 u7 Q
  32. #include <linux/sysctl.h>$ W, Y& F3 P+ p
  33. #include <linux/mm.h>: }, q  q' W2 q' n# c( K+ N) c
  34. #include <linux/dma-mapping.h>
    # V' u) ^( F4 r7 ?8 Y6 V2 I
  35. # y7 Z4 ~) K: _0 s. |* x
  36. #include <mach/memory.h>4 s& M/ c' P% p
  37. #include <mach/hardware.h>
    ' e$ R& b0 a1 ]& h1 Q( w
  38. #include <mach/irqs.h>
    $ H1 A# S0 w* G: b$ L4 N
  39. #include <asm/hardware/edma.h>7 E: X4 C; h& K
  40. - K8 a( R" h( R: ~' j1 z8 ^& |
  41. #undef EDMA3_DEBUG/ w; l1 E( H- h1 v9 t6 @: i
  42. /*#define EDMA3_DEBUG*/
    & y6 H' D4 T9 E- H) l
  43. & ?& p6 x! D. n% ^
  44. #ifdef EDMA3_DEBUG7 o0 \: \2 t5 C- m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ i, m" j! D+ V% F; x( y5 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " K- t1 `+ k% u8 F, O6 Z, A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , z  ^5 G$ [* x4 B
  48. #else
      ?# g/ ^2 O; y5 o6 q  J( v% T
  49. #define DMA_PRINTK( x... )4 d/ r+ M* H5 O" m4 _
  50. #define DMA_FN_IN
    ; J5 }/ a$ i% B* w- c% |* k+ H* |
  51. #define DMA_FN_OUT# \1 Y4 i: X6 ?6 @  E
  52. #endif6 ?  Z! y/ ^% i! U

  53. 3 }" X) z4 y$ }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + G+ M3 u6 B9 Y
  55. #define STATIC_SHIFT                3
    / k# }) {' Z  s2 ^' b- p5 k' F
  56. #define TCINTEN_SHIFT               20
    2 T1 s" \' g" b
  57. #define ITCINTEN_SHIFT              21
    & r  E4 \7 s" d5 ]( e
  58. #define TCCHEN_SHIFT                22
    & C( W( g, a0 ^  @
  59. #define ITCCHEN_SHIFT               23
    " t1 y, v. N0 n; p
  60. ! f* [; \8 O( E  ?9 g% R. D: e$ E& N
  61. static volatile int irqraised1 = 0;
    5 j" ]! _7 R0 Y- P. ?
  62. static volatile int irqraised2 = 0;2 t7 [/ {* I0 A# m- G
  63. 1 f2 }( H) \3 F5 k; y" C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q( F8 o/ v) A" Z" i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 `) O% i! T7 b3 \+ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ M# C. L, b' a7 y! K

  67. , B  n5 S% v8 @! a
  68. dma_addr_t dmaphyssrc1 = 0;
    ; _3 v- W8 j0 L  q6 R5 z+ Z% r, C1 c
  69. dma_addr_t dmaphyssrc2 = 0;
    . C' U' y: @( _/ D3 ^) a: j
  70. dma_addr_t dmaphysdest1 = 0;
    & y- E  D) k9 l4 r4 R
  71. dma_addr_t dmaphysdest2 = 0;
    3 |6 S/ {& s3 J5 x+ I9 j% d" r
  72. 6 V1 ]: x( E$ m2 s, A! C, m
  73. char *dmabufsrc1 = NULL;# P9 q4 X9 F+ m) c
  74. char *dmabufsrc2 = NULL;0 Q3 @7 ]! H( D+ b& K9 J
  75. char *dmabufdest1 = NULL;
    # O9 n- i& a/ Q) j: F7 r, [
  76. char *dmabufdest2 = NULL;
      D# s( J, ^9 P# k

  77. / w* [6 Q/ R3 d4 a8 i! Z  G. F
  78. static int acnt = 512;4 o* V; l0 t6 A9 o) W& O
  79. static int bcnt = 8;
    * ]8 j: v: N" S# M+ @' G7 u. N
  80. static int ccnt = 8;) |6 G. k' c' ~
  81. 7 @0 b& X" M; @5 J
  82. module_param(acnt, int, S_IRUGO);
    . V6 g" _$ R6 N1 k9 p! d
  83. module_param(bcnt, int, S_IRUGO);: c* L/ q& N! }* K5 T3 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) z2 [: G2 I: X) Q4 Z/ S1 N' N+ N% i' ?4 y4 `$ a7 |  o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 V4 ?0 G9 [. t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ]- ^* m" D! {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ q: U: k0 A" }& o7 _; x7 F

- t7 b3 g0 I8 E( N" V$ d9 a* Q- H4 ^( M! x, I8 o- P& j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 11:46 , Processed in 0.048039 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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