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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 u9 o- C" F2 U! m
  1. [code]EDMA sample test application) ]5 n! j5 K$ |# l# T& Z* \
  2. /*  U1 a: R/ a: U7 k0 N0 t
  3. * edma_test.c0 N; ]3 J3 z; V/ S7 g# \" E
  4. *
    " D$ J0 H) s' g, X) i
  5. * brief  EDMA3 Test Application
    " Q' N2 J7 g1 G9 H; `/ j
  6. *
    ) B1 {. `9 i1 l
  7. *   This file contains EDMA3 Test code.
    + E) l( x9 y" Q8 O
  8. *
    0 h0 V7 G6 X4 j4 P) M/ z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& p6 ^, X& A& h+ A. v, g' ^. [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) W3 g: u: ?7 f, q
  11. *         TO CHANGE.
    : z8 Q, W: k6 A! V- G
  12. *" ?; E$ _. y( K: }5 p. n" h' W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' z( n% v3 i0 X, r$ o
  14. *
    1 T7 g+ t  }7 D) r
  15. * This program is free software; you can redistribute it and/or0 ~3 J: Q/ w% ^3 e
  16. * modify it under the terms of the GNU General Public License as2 T5 w1 C" i, G
  17. * published by the Free Software Foundation version 2.; E9 P1 o& a( z. U: N! o
  18. *
    1 I% m+ E0 [$ l$ s1 U& x  a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 M! o  y/ u: e+ E: ~! R' h6 `
  20. * kind, whether express or implied; without even the implied warranty
    - s7 P6 {/ D3 C+ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ E' d) q( V  L
  22. * GNU General Public License for more details.
    - W2 A- v! D5 L
  23. */
    5 p5 W9 V% z% |9 P$ K

  24. & i5 a4 n2 m8 {( V. m4 j3 h  w- U
  25. #include <linux/module.h>. ^7 G" O+ [0 j
  26. #include <linux/init.h>
    6 b. t6 m0 D$ Y) K8 @# P
  27. #include <linux/errno.h>, V9 \& i+ |5 B* s5 [; s& w, M! \; E
  28. #include <linux/types.h>* B# W5 @+ w+ e5 K
  29. #include <linux/interrupt.h>9 {1 G( u/ e0 e( Q! M
  30. #include <asm/io.h>
    , d3 A& g2 t3 G6 @3 }& S& {
  31. #include <linux/moduleparam.h>
    3 h# o0 g3 Q  Y
  32. #include <linux/sysctl.h>; v$ Z3 V% d3 a  E
  33. #include <linux/mm.h>! I, P! U; k$ j7 ^
  34. #include <linux/dma-mapping.h>! V% ?1 f2 W0 x9 \

  35. / G( ^8 c! A  I! p1 t9 V/ [
  36. #include <mach/memory.h>- X  ~3 K+ a" R& y  J9 s
  37. #include <mach/hardware.h>
    - V* i3 D- k" `" s* P% h& B  m. _9 q
  38. #include <mach/irqs.h>
    5 @( `, \) t( c# f5 w8 ^
  39. #include <asm/hardware/edma.h>
    % k, C! {/ n3 y& t) Z% G1 R
  40.   Z  q1 e* n3 f( L$ C
  41. #undef EDMA3_DEBUG
    4 Y7 v& p' |  h
  42. /*#define EDMA3_DEBUG*/
    8 J6 u, c3 j, R7 h

  43. ; ~1 k; w, k' K) f$ C3 t6 E
  44. #ifdef EDMA3_DEBUG3 m/ O" F+ ~3 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' H' \+ O0 T& A& J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); o1 Y( R$ @$ b) |0 J! B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & u6 P" b3 W9 x7 L4 S: ]
  48. #else
    ' V! y" o4 g6 f" k& ^
  49. #define DMA_PRINTK( x... )
    5 X; U1 r3 R* |6 v  r
  50. #define DMA_FN_IN/ ~5 S3 N) ^; ]. |/ M" y
  51. #define DMA_FN_OUT
    % I* V6 F7 O2 q
  52. #endif
    1 R) N5 L- @- }# E1 z6 i0 n2 m) g" K
  53. * I( C9 a7 r" q) K( u- r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % _$ O' |, a* }* n, l+ b) v
  55. #define STATIC_SHIFT                3
    9 I, \% Z. d& [. Q
  56. #define TCINTEN_SHIFT               20
    6 j* e$ b) q" n! ^% s
  57. #define ITCINTEN_SHIFT              21
    ' Z1 M# B; N& x1 \" v
  58. #define TCCHEN_SHIFT                22
    2 a7 F+ a& e( {9 R+ K% t2 X( I4 M
  59. #define ITCCHEN_SHIFT               23- p; M4 Q: a! ^3 d, |9 q

  60. 2 l- D& t* L  ^! P; ?+ ]6 H! [) O
  61. static volatile int irqraised1 = 0;
    ) R% y0 K7 N& I
  62. static volatile int irqraised2 = 0;( {$ U+ \8 E. Z/ J/ l( T

  63. 9 F4 o1 ^/ f$ G% J: d3 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * i' p0 I8 k' _# W; n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ^, P3 E+ V) i9 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q% `. W: H" ?7 q8 K; K3 l
  67. : s* F' R. e/ I8 Z% f
  68. dma_addr_t dmaphyssrc1 = 0;
    5 w' q+ V% \# u' V. l: S
  69. dma_addr_t dmaphyssrc2 = 0;
    - f0 v" B6 ~- R8 F- n3 J; I* }
  70. dma_addr_t dmaphysdest1 = 0;# B7 M- D6 r) g0 C) d
  71. dma_addr_t dmaphysdest2 = 0;! Q  \9 e& F; ?( W  i' H0 n

  72. 6 a# y4 |, ^( V# Y2 R# Y3 P
  73. char *dmabufsrc1 = NULL;
    4 g, M2 w9 E+ L
  74. char *dmabufsrc2 = NULL;
    4 {: F3 c: j& {
  75. char *dmabufdest1 = NULL;9 v  d1 _" V; Q6 B, T- w5 w
  76. char *dmabufdest2 = NULL;1 A2 m- R/ _! j" L) `/ q- \

  77. " ?# F/ |+ h6 a% \8 d/ T6 m
  78. static int acnt = 512;
    $ @+ R  w2 C2 ^9 Q0 i2 ~
  79. static int bcnt = 8;, u( ?/ Z/ A5 j% L8 j5 H9 }. R4 a
  80. static int ccnt = 8;
    2 ~' c% E& X  U& a- c  W
  81. 5 T& W) \# S! S! K$ T7 I9 k/ c4 f. o
  82. module_param(acnt, int, S_IRUGO);# K! w* f6 o( G- p& ]
  83. module_param(bcnt, int, S_IRUGO);
    + ]3 R' E  A6 l9 u: |1 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% [# Z& n% H5 M2 K0 ~  _/ [& V: ^6 B1 g+ |) |) e# I' k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* x) {4 c) S/ Z0 H. ^0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 b' \) v! `, V5 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ K! y+ h! H4 c( ], ^# `3 a# n5 f! U! m6 o8 z* D
5 I/ V7 V5 ~2 E6 e( I& `8 r5 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-30 11:53 , Processed in 0.040265 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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