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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   J$ {; x/ x' }1 p0 k
  1. [code]EDMA sample test application
    ; g( e7 m% M. e; R
  2. /*5 f6 A- W9 f* @4 B( ~
  3. * edma_test.c4 `7 J: R* Q% R( X& `! r
  4. *& M  k% _' z2 j2 [
  5. * brief  EDMA3 Test Application+ i  B- _! s' {4 v
  6. *
    9 S  o  |* z2 ~, k% d
  7. *   This file contains EDMA3 Test code./ R7 f" ~* p+ X! T+ i8 W
  8. *
    ; W# f/ x2 q5 b/ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 y  F8 m, ~4 f$ o( |" R4 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 T& J1 L5 s' t2 ]5 L- j; g$ s
  11. *         TO CHANGE.
    8 B( c0 Y9 r( m* @4 \
  12. *0 |% x  g  g# q2 W, b2 K, H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 v4 q) l4 _6 ]' H7 E  o# G% d
  14. *& I) Z! a8 r# _3 }
  15. * This program is free software; you can redistribute it and/or
    1 z8 R/ U! B- y; \1 X" ~9 C
  16. * modify it under the terms of the GNU General Public License as
    ) i" m5 y  q9 O5 g$ g
  17. * published by the Free Software Foundation version 2.+ |* r: p9 I% x
  18. *
    6 u2 w+ i& L: o. a( C2 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 I5 [2 q' |1 L5 H
  20. * kind, whether express or implied; without even the implied warranty
    & B( _; h$ E$ V# m' R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + q" L) @% P) b
  22. * GNU General Public License for more details.
    0 E+ w1 t5 Q+ {! S( C! q+ p* T
  23. */" P0 c8 K2 S% G9 i5 s; j6 Q
  24. / R) Z/ h- d" t1 k1 V1 n( @
  25. #include <linux/module.h>
    3 L  l5 r4 L" d' u/ q2 Y$ I
  26. #include <linux/init.h>. Q/ M$ n7 K1 i& j6 a9 i( U
  27. #include <linux/errno.h>6 Z' i! P9 H5 W! o
  28. #include <linux/types.h>( V, p1 Q; H# g0 \
  29. #include <linux/interrupt.h>& p3 C! q% I: d; ?
  30. #include <asm/io.h>, U) l8 o" S  N+ O, c
  31. #include <linux/moduleparam.h>- {2 _- O3 d) _" X/ P1 K
  32. #include <linux/sysctl.h>
    % S8 O% Y& s3 t& M1 R4 O9 o
  33. #include <linux/mm.h>$ P, {, V+ m) q3 P
  34. #include <linux/dma-mapping.h>5 U  c: R2 O+ ^( t4 j  m  B$ o
  35. - p3 m. R4 o) o, A3 Y" A. G1 F
  36. #include <mach/memory.h>' y# X8 |' H. _+ L
  37. #include <mach/hardware.h>) A) i5 p" `1 [) \$ n
  38. #include <mach/irqs.h>% j- \2 a$ g. \
  39. #include <asm/hardware/edma.h>; _7 m% m7 y6 Z4 g0 m. K# [
  40. & j7 t  u5 _0 j( q
  41. #undef EDMA3_DEBUG
    & O3 b2 L  ~( a( ^) K0 k" O/ d1 k) ?
  42. /*#define EDMA3_DEBUG*/! ?/ e+ A* d0 y$ c0 r/ q

  43. + \% Q5 _: D( ~
  44. #ifdef EDMA3_DEBUG
    ) @: D# [( y- T9 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; C6 p; g  B( p- W4 ]2 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 i9 a2 d9 N; ]" ?  a" u; ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      J5 |) i* W4 w* S& f. m& p
  48. #else
    4 a  K- v0 v7 u6 I
  49. #define DMA_PRINTK( x... )
    , P6 P( s: P' Y5 I5 i
  50. #define DMA_FN_IN. S5 U% v/ i3 Q2 {6 M, h9 b
  51. #define DMA_FN_OUT- _+ I- Z1 r9 e7 [: G
  52. #endif
    $ h, ~1 a8 p. L' j' v: H4 s
  53.   ?6 d) F! D) a5 p; s: ~4 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( F' ]6 A" Z5 s  Z# H% b
  55. #define STATIC_SHIFT                3
    9 o: ^4 x8 l  F0 Y9 L
  56. #define TCINTEN_SHIFT               20* D2 ?, T+ z3 h5 O  k8 c% `* ~
  57. #define ITCINTEN_SHIFT              21
    $ t8 {% I( C5 Y9 w# f) O5 N
  58. #define TCCHEN_SHIFT                22
    * o4 o3 d  J6 l( j$ a, S
  59. #define ITCCHEN_SHIFT               23
    9 ]* m' H& W4 r. q

  60. ( K1 Z6 M2 J+ I/ |. p& E7 f
  61. static volatile int irqraised1 = 0;
    , W' F+ c* G( R) @& J5 V+ i
  62. static volatile int irqraised2 = 0;
      q( O3 K: v* D, `$ j& d+ j

  63. 6 ~1 u" i2 s0 Q  s% ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . k: i. }6 ~8 |8 z8 a: ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' F/ O2 l" n% ], b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Y- H! E5 E7 G/ v' M. X

  67. 6 V7 X0 U/ N0 u* j
  68. dma_addr_t dmaphyssrc1 = 0;* Z- T+ E8 e$ `5 U& W" p
  69. dma_addr_t dmaphyssrc2 = 0;
    " F* Z9 d2 ~7 ~4 }" d' b
  70. dma_addr_t dmaphysdest1 = 0;# u# c1 |: y% _- q: M7 n1 Q
  71. dma_addr_t dmaphysdest2 = 0;  n* {3 [& e& P; Q, G

  72. ; D" f) _" G' C
  73. char *dmabufsrc1 = NULL;
    9 d) y, V. F" x" a1 s
  74. char *dmabufsrc2 = NULL;3 J  X* o8 a) m( v
  75. char *dmabufdest1 = NULL;- b2 j, z/ X* e8 F" |. O) B, s
  76. char *dmabufdest2 = NULL;
    ; h/ G! \+ a+ n

  77. 6 t: L* I8 D/ n2 n, A, q* z4 }
  78. static int acnt = 512;4 T! c3 r) O7 N
  79. static int bcnt = 8;
    ( [& J( e. w" D+ j4 G( Y
  80. static int ccnt = 8;6 F1 r1 G* ]; m- y5 Z
  81. 5 u% i9 D. h7 r! X
  82. module_param(acnt, int, S_IRUGO);
    * U* _6 R2 d$ }% j
  83. module_param(bcnt, int, S_IRUGO);1 E& c# x# k) h+ r8 c& g; o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 h$ g, C7 B6 U! q

1 [6 N! g" y7 D: T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ t3 s" ?; R7 C1 P) g# x2 j2 |# C8 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 l" y5 P( n$ g! Z; O3 `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 {) g% t& v0 S5 q

8 n, N, L- f4 s/ A- Z5 O  F& B5 U# H0 p# h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 17:10 , Processed in 0.038898 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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