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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( W+ i$ L7 Y7 F
  1. [code]EDMA sample test application( l3 R3 K1 d; Q
  2. /*
      [; t4 ?: L. I
  3. * edma_test.c3 C- S+ x( v) A1 f& O0 ?
  4. *" q, h$ v3 r7 e% t" i. o9 E
  5. * brief  EDMA3 Test Application2 Y: o0 u! w: _, y; m
  6. *
    & W3 ~# J4 G# k( Y% A
  7. *   This file contains EDMA3 Test code.3 u7 p0 j% q5 F- q3 X! q& I: }# I
  8. *6 b. Q4 {$ ~2 ]5 R" F5 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; j+ k& c  ~' `, g, x. n9 i1 T3 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* {- e; [" z" Q, v- m( J5 S
  11. *         TO CHANGE.
    ; y8 T: b" f' [, p9 L
  12. *% m4 t8 l% n. F/ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 {5 r  Z; \* Q1 n4 H& N
  14. *1 U7 S5 F- R/ K2 s
  15. * This program is free software; you can redistribute it and/or
    6 d% e! j0 w  d( P: d
  16. * modify it under the terms of the GNU General Public License as* ]( i- c5 O& ~2 {% r
  17. * published by the Free Software Foundation version 2.) H" b1 o: w" d
  18. *, M0 H/ w5 Y0 Z+ w: h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 m4 i0 s1 @- h9 ?, f0 V6 s1 z
  20. * kind, whether express or implied; without even the implied warranty0 r5 S/ d1 U. ]/ J( V  i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ L/ q/ ~8 M! E4 D% d) w* X: O) A8 ]
  22. * GNU General Public License for more details.7 G5 \, E% D7 i; q" b
  23. *// F; y; h8 d$ h9 L3 Q7 T) X1 {

  24. 5 M7 F) c- i  k9 m
  25. #include <linux/module.h>
    : \' d3 ~2 m0 F+ E
  26. #include <linux/init.h>
    0 X  }' O; K& p0 U8 q
  27. #include <linux/errno.h>. c4 f, o5 Z5 o8 U5 T9 s( g* R
  28. #include <linux/types.h>
    : T: n. F. B# m$ Y" b$ H5 O0 \3 J
  29. #include <linux/interrupt.h>$ Z4 I, ]" ?6 c9 H
  30. #include <asm/io.h>, ~& S# y0 c- C" G
  31. #include <linux/moduleparam.h>' n4 @% `2 H% ]7 c0 q/ R
  32. #include <linux/sysctl.h>
    ! Y, w4 F5 I: j' i' |/ q! X
  33. #include <linux/mm.h>
    ' b& ]( ~1 C+ n0 }% D
  34. #include <linux/dma-mapping.h>
    0 A  [0 p* Y( @, z6 G

  35. * ^4 N5 [/ c8 G: F7 `
  36. #include <mach/memory.h>& m9 {! B; G" v/ R3 o: \* z
  37. #include <mach/hardware.h>- C# y0 V+ H& ^, ?% l. o- T
  38. #include <mach/irqs.h>  G! `+ ~$ ~% l4 d3 F
  39. #include <asm/hardware/edma.h>
    0 H7 S8 P+ x( {2 z8 D
  40. . Y! p  E4 s& |% E: Y
  41. #undef EDMA3_DEBUG- c0 \; F6 U% l4 n" G6 z; B% L; ^
  42. /*#define EDMA3_DEBUG*/
    8 \5 ?$ L$ Y; O* z
  43. 1 j" `( B( s- `
  44. #ifdef EDMA3_DEBUG
      V  [5 b( ]* @: n. O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & q2 Y7 \9 ]5 V* E" @& O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  o: o/ u, P2 {6 m0 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 {' F: x2 c: H
  48. #else
    + U  U( W3 R* N* r, q/ |
  49. #define DMA_PRINTK( x... )- I: V& e5 E! ~1 A' c
  50. #define DMA_FN_IN5 Y+ V( X: j; q$ K/ z
  51. #define DMA_FN_OUT
    7 u: r& W4 @/ i1 b& Z, q( _
  52. #endif7 F. J/ b7 c1 \
  53. ! R- M: C+ O2 s0 }! a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( c6 M" J' [& S( Y& c6 F5 S
  55. #define STATIC_SHIFT                32 X, K8 v1 {8 m6 _% U
  56. #define TCINTEN_SHIFT               207 U: G, f; y+ K! E1 S4 k8 k; v' a
  57. #define ITCINTEN_SHIFT              217 w. ]0 N. R6 G$ a! D
  58. #define TCCHEN_SHIFT                22
    , ?; I: F9 m2 O: w% @8 ]' x
  59. #define ITCCHEN_SHIFT               23
    6 \! D& O7 y' z' `* u& ~

  60. + j# u0 G+ L% M+ `- b# ]  |
  61. static volatile int irqraised1 = 0;# P9 g! {5 Y. q- I2 o$ @7 h
  62. static volatile int irqraised2 = 0;4 Y: b8 f* G. ]$ j* [( }+ ^

  63. $ V7 ?- E' D. B  B& ^+ f5 i+ j8 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: a: M  E7 L- K/ O7 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / V' h9 }* g3 ~0 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e* O1 ~. O3 T* ^* q/ `
  67. ! F3 h' \' ]' x0 k
  68. dma_addr_t dmaphyssrc1 = 0;
    - p$ Q- v- _! Y( ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ( w8 m( a' e4 t# u  D
  70. dma_addr_t dmaphysdest1 = 0;
    % }/ }3 |, j# ]* s3 w9 ^. L! R! Q
  71. dma_addr_t dmaphysdest2 = 0;) q; b6 m$ ?4 z% P* r

  72. - j$ e* C7 {$ {, c$ V- X
  73. char *dmabufsrc1 = NULL;
    + Q, Q4 ~' d$ `. K% e; O
  74. char *dmabufsrc2 = NULL;
    6 Z3 K0 }# s$ \3 j" ^5 y# c
  75. char *dmabufdest1 = NULL;
    4 A/ m: S3 e2 X. {
  76. char *dmabufdest2 = NULL;
    - r2 }4 y5 n: v
  77.   `7 n' `6 r1 W; E7 X; J  E
  78. static int acnt = 512;
    1 q$ ^- s( d3 v& V# {# ]8 b8 {6 P% i
  79. static int bcnt = 8;
    # q5 }" }6 x5 Y/ P
  80. static int ccnt = 8;% L5 m1 d) H5 R$ X
  81. 2 F0 B4 f  s8 h
  82. module_param(acnt, int, S_IRUGO);
    0 b! y( C- E  }
  83. module_param(bcnt, int, S_IRUGO);
    2 k) z  K/ C) y, g. G$ \( a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 J1 c2 ]" Q0 K( ]: a3 X2 G/ [' e' k8 O. C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( I. A  f$ _. r2 n/ F* H+ ~% qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ D6 v% \( G/ Q" t: d7 L, G) s$ m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 `0 e) T" ^, T: ?/ f+ M. o3 a/ p; L
6 H* T$ U* x5 y: P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 15:33 , Processed in 0.039353 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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