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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 K4 f6 v1 j; ?$ x0 t9 F  N
  1. [code]EDMA sample test application9 K2 t. V1 W4 N7 ?& t
  2. /*. N$ G, b, d/ R5 H% _4 n* i9 o* x- X
  3. * edma_test.c0 B* _  o: f, T7 M- r1 B+ c# I' e9 l3 v3 \
  4. *# f3 {( N2 ~# M' q% {: E
  5. * brief  EDMA3 Test Application
    7 R4 L' u! A% k2 {
  6. *
    . [7 l& L& o  H( x+ i/ G& F% E
  7. *   This file contains EDMA3 Test code.
    & P7 g& W* t; x' O
  8. ** s" H; z) {+ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 p7 o, T  P" ]7 E" J, l! W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# A) a4 i) ~/ B. D4 I" ~) N
  11. *         TO CHANGE.7 `- Z+ ]. @9 ]& Z: t$ b
  12. *
    0 [+ s7 n+ q9 ^8 [, i8 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 E# U  F# o( u& ], p( w! d: v
  14. *' z, G0 `! _; d: a
  15. * This program is free software; you can redistribute it and/or' l$ y3 S) L( g7 n7 l3 ?
  16. * modify it under the terms of the GNU General Public License as! j' \0 Z& h" I2 Z# V& w  a" f
  17. * published by the Free Software Foundation version 2.
    / O( G# ?. v/ K( E6 ?
  18. *
    & n2 }( P" r7 |( z4 i% k7 L8 \$ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * A5 N$ d2 x: H; C/ T& L
  20. * kind, whether express or implied; without even the implied warranty
    * M) r# c& N; W4 S; o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; T1 P4 a3 y4 R! A9 _) E
  22. * GNU General Public License for more details.9 g" d9 w' d7 a" ~: ?% H
  23. */
    7 ?% o; D/ R1 g' C% h; z- X

  24. , z1 ?- }9 I3 u, K
  25. #include <linux/module.h>
    7 `" M1 J/ m4 d* M( Q/ ~% m( ~& X% J
  26. #include <linux/init.h>4 k% d' N' L; S
  27. #include <linux/errno.h>; j4 C% j  d: }# p/ W
  28. #include <linux/types.h>
    . B  |0 N: k0 B- w
  29. #include <linux/interrupt.h>
    " y/ g: Q6 K$ I( {2 {" B" g2 ^
  30. #include <asm/io.h>$ [, V& j" f, ]) _8 a
  31. #include <linux/moduleparam.h>$ w1 x) W; s# F
  32. #include <linux/sysctl.h>
    ; Q' S# J; u! S) X
  33. #include <linux/mm.h>0 s( R+ P; V- `) K+ Y2 X' x
  34. #include <linux/dma-mapping.h>
    + b  f9 n1 t. H: T

  35. , v) C% _$ e5 T+ G
  36. #include <mach/memory.h>
      A) U- u6 Z( P/ H
  37. #include <mach/hardware.h>- T+ [# D( d8 |0 P, K, V
  38. #include <mach/irqs.h>
    5 e$ G+ d* K) t: H3 K
  39. #include <asm/hardware/edma.h>5 G9 g' {. W- _* ^
  40. $ f" m4 `! r. Q; g
  41. #undef EDMA3_DEBUG
    , R7 N: V% P3 j' W
  42. /*#define EDMA3_DEBUG*/  U* L0 u2 z4 _4 s

  43. , T  }" |2 k$ ~" X) Q
  44. #ifdef EDMA3_DEBUG
    ' J9 N6 t2 L1 M/ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 }' N  Y  x& v, y" |. z& q& d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " [- y" ]$ A3 ?6 g( [1 |" H- [" Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  u% v  y, N) i1 d* N  S* H
  48. #else
    & X  A/ b, E/ {5 ?: q. |6 _
  49. #define DMA_PRINTK( x... )
    ( [: y% ~4 j5 j. v
  50. #define DMA_FN_IN
    ; k9 N* [0 F# V3 V$ V
  51. #define DMA_FN_OUT5 q7 w* L5 E- Z* e  d
  52. #endif
    5 f' C) u/ _0 ]9 H2 i5 f

  53. $ m; s" K% D; O$ Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . {4 E% B; W8 R) r
  55. #define STATIC_SHIFT                3
    7 r3 c) t8 j9 v. e% Q2 H9 T$ c
  56. #define TCINTEN_SHIFT               20
    " p. o8 l* R" s, w: F0 E
  57. #define ITCINTEN_SHIFT              213 W7 H( t2 K. z& g3 X: F2 e" R
  58. #define TCCHEN_SHIFT                22
    . p0 Y1 [8 _5 Z7 J& o
  59. #define ITCCHEN_SHIFT               232 x" q, h4 X, u6 z- U% Y) Q$ N/ V! V

  60. , q- [1 Z5 W2 D& o( W! B2 W' q  P
  61. static volatile int irqraised1 = 0;
    ( C! p5 P3 a2 o. v; U( [
  62. static volatile int irqraised2 = 0;
    ' A) N' ]" m1 G+ {
  63. % X: Q$ u' ]3 d$ g2 j1 J, L& @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , a* E5 j7 V. \# P; d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S% e! q% b4 R$ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 s$ L+ K1 M& Q2 q9 q7 `0 k  h

  67. 9 N* z8 E6 {) m& F
  68. dma_addr_t dmaphyssrc1 = 0;1 s+ w& H1 N& Z; s! A* g! E
  69. dma_addr_t dmaphyssrc2 = 0;
    1 y, ]7 A3 }. g' J
  70. dma_addr_t dmaphysdest1 = 0;
    8 a9 K& ^' g' t
  71. dma_addr_t dmaphysdest2 = 0;  ]' A! g% j8 X! \3 h# J/ G
  72. " n' d3 q% @/ h* X/ p. A
  73. char *dmabufsrc1 = NULL;+ B/ x% L% w3 l# t; ?; U+ r
  74. char *dmabufsrc2 = NULL;4 i) S7 }' ~2 n- b
  75. char *dmabufdest1 = NULL;% j" l6 ?: a6 D; Q2 ?. g  J" T$ w
  76. char *dmabufdest2 = NULL;$ d- R0 n( ?* r  n

  77. ( W; ?0 E$ k/ ]8 X8 k1 j
  78. static int acnt = 512;0 K8 A# E* z' Q( L. _1 I+ c/ j
  79. static int bcnt = 8;
      A; }, t- B7 [1 \8 H
  80. static int ccnt = 8;, H( p& \0 y% j" q  ^
  81. 8 W" w% n  j( e; H6 ^
  82. module_param(acnt, int, S_IRUGO);" r0 ~8 ]" y3 b& }& `' P' a
  83. module_param(bcnt, int, S_IRUGO);4 F, ~* p2 c( }0 S! ~' O& `) @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ H6 j5 ]6 z6 D% r' x' v1 D
6 W7 ?2 b/ F3 ?( Q+ ^3 ]( t, b! @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# n6 x' [! a, zarm-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 ?! c. }, Y! f7 j1 C- t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; H% y* R1 ]7 j! ]+ e: J
! U# v# ?7 t  P! j# {
/ j3 E% B  D7 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 23:55 , Processed in 0.041939 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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