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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - L) A2 l% p0 f
  1. [code]EDMA sample test application
    ' w. G. L8 L8 x8 T
  2. /*# m6 f2 b% _. O! ^; I$ i1 U0 u
  3. * edma_test.c
    6 R% w7 _8 H4 b: N* G
  4. *6 N3 D  e) _9 z+ n
  5. * brief  EDMA3 Test Application3 W1 q0 v1 Z4 E9 F
  6. *1 G! a  _& N8 m: x3 G) q3 q/ K- E
  7. *   This file contains EDMA3 Test code.9 M, u: K$ b/ V' X, q8 S
  8. *  Q3 m* o/ O( c) B- E1 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% E: E; L0 j% R4 G, {; F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 t. |& L% `* a
  11. *         TO CHANGE.3 h7 [/ G3 y, K
  12. *6 V* G+ i7 Z/ k3 T' _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & K: A/ H5 Z" }. |: J6 j( E
  14. *0 U8 J, Q) ?1 v/ \3 [' z1 \
  15. * This program is free software; you can redistribute it and/or! v. V  Y: Y7 _' e, I
  16. * modify it under the terms of the GNU General Public License as
      ^, A. Z, h6 s* F2 M
  17. * published by the Free Software Foundation version 2.& z5 y) r+ G& f" w# ]/ @/ U  X
  18. *
    / ^* G* |1 u* g8 {# M" }0 j8 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % j# I) `$ c. E9 @) X
  20. * kind, whether express or implied; without even the implied warranty
    9 m% ]! {/ R" v( m' O' d, y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * b( S0 h  Q* w- S3 c+ H+ z" a
  22. * GNU General Public License for more details.9 a6 Y$ P& f- Z0 H
  23. */$ |, v1 D$ g$ u4 E8 A
  24. 9 ^# I; h$ E4 I6 x/ j1 c
  25. #include <linux/module.h>, R) z& v# W1 H9 Q
  26. #include <linux/init.h>( `1 G5 h% p6 o5 J
  27. #include <linux/errno.h>
    ) d" M; C* @, X; u+ ~4 I
  28. #include <linux/types.h>1 C9 U9 y3 Z2 Y+ a" C$ K
  29. #include <linux/interrupt.h>$ [) d* Y, E5 N* @* U
  30. #include <asm/io.h>( b* c8 T% w, T: M6 S& p
  31. #include <linux/moduleparam.h>! F% q( q* L8 K+ p1 U
  32. #include <linux/sysctl.h>3 U4 Z6 C; o3 [  U# M. O8 @( G' [2 Z" ?
  33. #include <linux/mm.h>: {, n: W2 T! j" {8 ^- J# D* I
  34. #include <linux/dma-mapping.h>
    * G1 z3 _! ^2 S) Z, I! Z

  35. 4 X0 O6 x7 W  s; s( s
  36. #include <mach/memory.h>! ]6 Q/ N. H7 a
  37. #include <mach/hardware.h>  }7 n( r( n. \) b
  38. #include <mach/irqs.h>
    : @( z2 J/ @3 ~1 O6 Z1 o
  39. #include <asm/hardware/edma.h>
    , X3 f; \& j7 }. J
  40. 2 o  K7 T( A$ p  x
  41. #undef EDMA3_DEBUG
    6 B5 I0 G, K# Y, X2 d# Z
  42. /*#define EDMA3_DEBUG*/
    - l* ]" V1 c' C9 r

  43. ! U9 |4 l2 @$ O: L1 ?- G1 y$ U
  44. #ifdef EDMA3_DEBUG% g4 y0 Z# |4 j2 c& R; Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 O/ i9 b# h( ^7 g7 L" S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). k  B) N) ?  e5 z) B% `' q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * G1 N# T+ U& ~% C8 n/ a: V3 B! r
  48. #else
      D0 o% _7 T% g- Z1 O& X; o- L
  49. #define DMA_PRINTK( x... )
    1 U, l+ M3 g5 a! T1 Z; u% {
  50. #define DMA_FN_IN( g% Z2 h: V& F% R: J3 B
  51. #define DMA_FN_OUT4 ?3 P' A# _1 P* f% ^& m; Z8 b
  52. #endif, Y# O& _5 n1 D& Q$ X: D3 s+ V

  53. 3 `! O! P9 K, }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), Q! K1 e" Y  d* y6 U5 g4 G
  55. #define STATIC_SHIFT                3# S+ I4 N9 n9 T( U7 Y
  56. #define TCINTEN_SHIFT               202 [- _9 d- |# c# U  }0 c
  57. #define ITCINTEN_SHIFT              21
    $ Z9 r7 c7 w; O8 H) W" _& S
  58. #define TCCHEN_SHIFT                22% H, R! L' D, h, p, l+ c/ g
  59. #define ITCCHEN_SHIFT               23: A2 E9 m2 j+ p# m1 D& Y. O% \

  60. 5 l4 l' y$ v& l/ u% s# q
  61. static volatile int irqraised1 = 0;' v1 ]1 C6 n# p2 j
  62. static volatile int irqraised2 = 0;# ]0 l( b% G* K- S7 i1 q. D# \* s" N
  63. + E) H0 b; O1 h* k" Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) }5 m+ W# {* B, e3 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - m9 X, ?. z, P3 r0 r: g1 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 @0 v2 j- ]3 y; p2 w0 R+ L. B2 e

  67. $ E. n& {, d* Q& s: A
  68. dma_addr_t dmaphyssrc1 = 0;
    7 A7 |* z! k5 s  C* g
  69. dma_addr_t dmaphyssrc2 = 0;3 ~/ K8 y; L, J) i; X0 ?; }
  70. dma_addr_t dmaphysdest1 = 0;3 R) V6 B/ c$ I" \8 |1 _
  71. dma_addr_t dmaphysdest2 = 0;9 ?; ^' A1 G& t  ?$ |# y5 \& ?3 T
  72. 4 \& r' a  l; r0 ^8 C* O. J" O! o
  73. char *dmabufsrc1 = NULL;
    ( a4 L6 F4 \: k" U4 X3 {7 a; n
  74. char *dmabufsrc2 = NULL;9 n5 |: V8 z" N1 R
  75. char *dmabufdest1 = NULL;
    + d7 a; W7 Z5 [8 ~% E% M
  76. char *dmabufdest2 = NULL;$ S: E& b1 V) m& C3 N3 I- Z# ~7 `# G
  77. $ F# `+ t2 q- X; {+ K* i) o
  78. static int acnt = 512;" u; k& R! d0 c: N1 V# W& R
  79. static int bcnt = 8;8 H, I7 D7 @* `% ]
  80. static int ccnt = 8;9 C1 {8 l$ v4 ^# L5 ~8 y8 n) f
  81. 0 N  x1 c! t8 m7 r
  82. module_param(acnt, int, S_IRUGO);4 m/ ^4 O% n0 R. A9 u
  83. module_param(bcnt, int, S_IRUGO);+ x6 n/ u  u& t7 m# O$ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 A# u: i( }1 I. N( g

8 ?& y7 C$ |2 Q% w+ c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ M: n" b& A8 r# ~) X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: {1 j' Y3 J) ?' M+ j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 u$ n7 g, ~9 R) S

8 K6 x7 ^# J6 m/ K6 V! R0 ~& J7 m6 s) ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-10 13:34 , Processed in 0.039983 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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