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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, B( i' H5 c$ ~* R
  1. [code]EDMA sample test application' ^$ [3 j2 U* a7 q3 ?
  2. /*8 h3 I/ p) X* n) H# Z9 a& ]8 x
  3. * edma_test.c! T4 B+ W: x% m. ^2 }' Q
  4. *& c$ A1 \. Z8 o  `1 V3 _4 R  U# e
  5. * brief  EDMA3 Test Application
    6 N  X- q% n" \, t
  6. ** G* H4 u+ ~& S
  7. *   This file contains EDMA3 Test code.
    * X$ h2 {9 G- E+ i; c
  8. *
    * b4 `& {, [, U3 g7 F% d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ t+ ~! Z& a+ \7 o; ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : {, s7 r: T5 S  y4 ~% o3 Y
  11. *         TO CHANGE.
    4 n& ?9 j( ]) n, D
  12. ** }( Y& \4 q% a+ a. K! u% v: P6 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* O/ X: `& L) t: O# ^! ^# w1 V* K' j
  14. *
    / N: o/ E9 _0 v$ d% E) l" N
  15. * This program is free software; you can redistribute it and/or1 e( u" R/ |: Q. D2 @/ V7 u* g
  16. * modify it under the terms of the GNU General Public License as
    & t: g% Z, ]9 X1 M9 q: Q& u1 ?
  17. * published by the Free Software Foundation version 2.
    + Z- U- R9 N+ O) Z  V2 \  {
  18. *0 `. @; K3 {5 \8 w* C: p+ q9 e" P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      W# ?0 ~* ]  D) b3 A/ ~
  20. * kind, whether express or implied; without even the implied warranty
    / F7 X2 c' N; R) X  j* z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ j) a+ `- s. X) X
  22. * GNU General Public License for more details.8 W+ _. e9 S7 s2 q
  23. */
    $ @. N- K8 Q4 }+ |% j# o3 \

  24. : F; t; ?1 q7 Q3 D4 n5 s* m; r
  25. #include <linux/module.h>
    % `: D( G4 R' Y0 m
  26. #include <linux/init.h>
    9 Q' |! A( T. s* V. H; N" y
  27. #include <linux/errno.h>
    ( r% N( P) @6 C6 h5 q; q6 n
  28. #include <linux/types.h>
    2 N8 e: \- T: o
  29. #include <linux/interrupt.h>0 ?/ P9 d7 ^% Q. ^
  30. #include <asm/io.h>% Q' }- k  k1 f+ B+ Z7 Z9 L
  31. #include <linux/moduleparam.h>4 |/ j$ S1 K% o# w& |
  32. #include <linux/sysctl.h>
    % P4 ?# C* P+ t
  33. #include <linux/mm.h>2 y; _1 _0 E3 \# B. z9 |7 `
  34. #include <linux/dma-mapping.h>: f! q8 p4 g! y. r5 j
  35. # p' Q' ~" w$ Y0 @! {+ Y
  36. #include <mach/memory.h>
    6 ^8 _5 x/ ]% p  z. O
  37. #include <mach/hardware.h>: r3 p! q/ ], q( m  E$ j
  38. #include <mach/irqs.h>
    ( _' |$ O+ F; x" _' I' l
  39. #include <asm/hardware/edma.h>
    / n- U0 @) q" \7 |# K- V
  40. 0 Q% n" f0 K4 P7 c* ^% p
  41. #undef EDMA3_DEBUG
    ; h1 Q* \% Z8 M: Q' a, ?5 X9 j, ?
  42. /*#define EDMA3_DEBUG*/: M( I9 _' o* ~

  43. / v# i8 g( b5 ?  a' Y: p
  44. #ifdef EDMA3_DEBUG
    ) m+ {2 W0 y, B* a: h) o- J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 _' j5 ~+ j0 Q! R! i" G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ?# k! \) L. ]+ B) F2 t3 o8 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 Q2 i+ ?/ n' }) u, c. U5 T
  48. #else* ]1 }0 Y3 `$ d, }. G; z- u
  49. #define DMA_PRINTK( x... )
    + w% c/ p9 V  k$ ]5 F/ I# Q
  50. #define DMA_FN_IN, F4 w* w8 J. y+ _3 z0 q, x8 E
  51. #define DMA_FN_OUT
    8 X! l, D" C( C& A- N2 ~7 i. K
  52. #endif) j& D0 _8 \& N  `% K

  53. 6 K7 T0 J+ L8 a7 _" D" k: u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , }' ~+ f7 f" ^) r
  55. #define STATIC_SHIFT                35 l9 R/ s  O2 s. j& k' j- G) P
  56. #define TCINTEN_SHIFT               20
    / r: f' v1 B0 Z- f6 F
  57. #define ITCINTEN_SHIFT              21. B  B, g4 o& w. f
  58. #define TCCHEN_SHIFT                22: m* ?3 o" u$ f
  59. #define ITCCHEN_SHIFT               238 x2 r/ [, Y+ ^. K3 u
  60. # N0 s) j; A2 w  q" ~' y. ^6 P$ f  p3 D
  61. static volatile int irqraised1 = 0;3 \+ R( @& @+ {  T% l* l. W! v
  62. static volatile int irqraised2 = 0;
    : k" |' ^9 \, ^5 K3 E

  63. 5 T3 b  ~0 B3 W2 \$ W+ |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : D1 R; w  S, m: p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z% x) x3 I/ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) W2 t* B. ^+ ?0 s- I( ?  q& b
  67. 2 A5 E. n: @, l+ i; Z% w8 F: y2 k
  68. dma_addr_t dmaphyssrc1 = 0;, J1 C" |3 C+ O6 b" p) Y, P
  69. dma_addr_t dmaphyssrc2 = 0;" m0 j4 d. p. G! N! Y
  70. dma_addr_t dmaphysdest1 = 0;1 @% e& Y/ c" l1 a5 {& O* d
  71. dma_addr_t dmaphysdest2 = 0;
    7 p/ O" B  h, B: x0 j
  72. - u" y4 I/ V6 w$ Y/ m& w
  73. char *dmabufsrc1 = NULL;
    & N0 T" w. ?+ p: I
  74. char *dmabufsrc2 = NULL;+ h, X, w7 a* z- e6 Q8 V
  75. char *dmabufdest1 = NULL;' A5 k- t- W, I* o7 k$ Z0 }
  76. char *dmabufdest2 = NULL;8 {$ x! h2 F2 t' }, i

  77. 7 r! y# P/ E  I% |3 Z" G
  78. static int acnt = 512;* x7 f7 R' n0 o. j8 o
  79. static int bcnt = 8;: B" z) U8 F7 Q' w5 y( C7 A
  80. static int ccnt = 8;
    & F0 G; n" i; s8 h- I8 ]! u) q

  81. ! n9 k* X, {9 ]; \+ I: N
  82. module_param(acnt, int, S_IRUGO);# A: g$ r4 e6 v8 X5 @
  83. module_param(bcnt, int, S_IRUGO);
    ! a7 }" X7 A) c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. x2 d; Q9 n& s& `
2 y$ |6 o9 D% O  V  t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, x6 w5 x9 u' v8 r8 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ N5 u9 j  I; p) Y3 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ [' ~# |% ^5 V( v# T3 X* P
) `0 A. Q  `9 D$ N

# ^2 c& R7 E. s8 P( o* \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 19:44 , Processed in 0.041266 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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