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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , L& f7 V  V+ W3 ^" ^$ K$ h
  1. [code]EDMA sample test application
    $ r! t0 W5 k: l
  2. /*
    & [$ i2 Y! L: {+ i- x; l
  3. * edma_test.c
    ' w7 `* a( K. L( O' c
  4. *
    / [+ A1 q2 {! U/ x! Y2 N) w
  5. * brief  EDMA3 Test Application8 y9 \. P/ G& o
  6. */ d' }6 S7 u, }6 Y3 U# |7 p. I& I
  7. *   This file contains EDMA3 Test code.3 W( H- Q: a% d7 \5 T2 l# V
  8. *
    8 {: _' W" U# o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / f7 i  X; B8 i, U  X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 L. e3 |/ N* v$ P" q5 L
  11. *         TO CHANGE.& M& Q" ~$ G% ]/ i% r& Y
  12. *
    ; ~  {9 G) E9 k8 l1 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % d6 C# K4 Z9 U: g2 q
  14. *
    ' B2 e/ Z/ G+ P/ \% }- _# y* c
  15. * This program is free software; you can redistribute it and/or% W7 G; V4 k+ b
  16. * modify it under the terms of the GNU General Public License as) `( v+ H9 G' Y( c6 K) H
  17. * published by the Free Software Foundation version 2., q, d% M( b& `; Z, a5 R+ A
  18. *
    0 ~3 W: E4 g2 a. E3 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) B  X, e2 x  s: R! i
  20. * kind, whether express or implied; without even the implied warranty
    0 W0 @2 d' B$ m: m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 Z+ i) }2 i2 ]6 f
  22. * GNU General Public License for more details.
    / o& p+ h$ \# f6 h$ x9 v
  23. */
    " q1 ~3 }6 A; w$ _% ?  h8 T. a

  24. ( ^, Z! Z, Y/ J7 D9 h( w
  25. #include <linux/module.h>
    * j0 r2 {* h& i! E; I. @
  26. #include <linux/init.h>; M; t: @1 u0 ^. e, ~7 r1 R, n5 O
  27. #include <linux/errno.h>
    % h# y! Q8 {4 b. }! p5 Q
  28. #include <linux/types.h>
      M/ [7 J& D) [/ L
  29. #include <linux/interrupt.h>$ g' T0 f* |" q. m/ e1 p8 X
  30. #include <asm/io.h>
    $ V: q$ u! l% D$ E5 L
  31. #include <linux/moduleparam.h>, [! I5 Y2 Y8 T1 d2 N9 w( p
  32. #include <linux/sysctl.h>0 j$ A2 e3 l. p  ]
  33. #include <linux/mm.h>! d. o4 W2 i* m) A  i# I' z
  34. #include <linux/dma-mapping.h>: g  @& n; x% |1 N7 t

  35. 5 s2 D8 h1 [+ I% b5 n
  36. #include <mach/memory.h>
    ! q& B: u' h2 x( s& ^7 j
  37. #include <mach/hardware.h>
    . T8 Z4 r$ t1 C7 T
  38. #include <mach/irqs.h>
    - _1 T3 x  k2 e* W( x
  39. #include <asm/hardware/edma.h>
    6 r5 g: X! n8 h* W( p. ]
  40.   f2 q- q( e; K9 b# `; E; F
  41. #undef EDMA3_DEBUG7 L+ X, [6 Z1 m7 x# S2 a: i
  42. /*#define EDMA3_DEBUG*/
    0 Z+ ]' y' m- s( a  z: M. f; S

  43. % ~. q' Y; |- p; W$ I, H
  44. #ifdef EDMA3_DEBUG; w: q" d8 _: e, l2 V7 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- i8 C2 `+ d7 c* x) H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' d2 I5 x3 g  Y$ k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 t! K* T) j6 h
  48. #else
    ; [4 x& L* r  i
  49. #define DMA_PRINTK( x... )
    ) j# n, u! \5 q
  50. #define DMA_FN_IN
    , j1 C" |3 T( x7 W
  51. #define DMA_FN_OUT9 w3 I$ u% Y5 ?' O5 Z, R( j' Y2 n
  52. #endif
    1 ~% c2 |3 X$ {+ {  @6 }! V3 z
  53. 6 _; p" Q2 X1 f3 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( x% O2 y+ V9 v4 k' F6 V  E6 x, ?/ C
  55. #define STATIC_SHIFT                3# ~" z' s2 l9 f8 M( i
  56. #define TCINTEN_SHIFT               20* g5 F- k- y* V$ {1 D. h( v
  57. #define ITCINTEN_SHIFT              21
    ; u! R2 x) ~3 Q' F
  58. #define TCCHEN_SHIFT                220 {9 q# K0 Q$ a( K( F
  59. #define ITCCHEN_SHIFT               23
    0 Y5 l& w+ f/ f

  60. ; t( K& B1 y3 B0 w: m8 _# ?5 K
  61. static volatile int irqraised1 = 0;
    : {& i5 a9 R$ p9 E: P2 e) D9 v6 S
  62. static volatile int irqraised2 = 0;
      B/ o6 T' X; C/ C$ c

  63. ' I1 u9 a' u4 ~6 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ^/ D- E/ `% L1 ?( b' Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 o1 i$ i2 z" z7 S+ _0 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * d& A  `: K- Y* d& |4 v3 v

  67. % Q7 u$ \' n! _' T& ]
  68. dma_addr_t dmaphyssrc1 = 0;( S" D; a# A( C
  69. dma_addr_t dmaphyssrc2 = 0;( T& n1 Q2 F& e- W1 H7 ?
  70. dma_addr_t dmaphysdest1 = 0;" D( O1 S( S0 P: J4 {
  71. dma_addr_t dmaphysdest2 = 0;
    . Y; d1 E7 D& ]" h! `. [
  72. ' r) {3 x' Q4 u# M
  73. char *dmabufsrc1 = NULL;; k0 p5 u8 |9 x
  74. char *dmabufsrc2 = NULL;. S. H8 w7 }1 F) \1 D: ^& Q) K
  75. char *dmabufdest1 = NULL;* L+ d# G$ n" D0 l0 s" E; v  [8 h
  76. char *dmabufdest2 = NULL;
    7 I9 y+ V4 n. c! e: {

  77. 1 X! x8 }- D2 Y: W5 N
  78. static int acnt = 512;, A7 n$ E( N" I+ G; R# L
  79. static int bcnt = 8;
    1 n% O* _& P1 s" {5 k
  80. static int ccnt = 8;
    * h6 |3 a# \& Y
  81. + y- {' c8 b6 e2 [! V
  82. module_param(acnt, int, S_IRUGO);/ j  o  u# V$ `9 C$ r
  83. module_param(bcnt, int, S_IRUGO);
    6 m" j9 m' E+ {, }, j3 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# @. l3 U: }, G* }! n
+ f6 I& K. p/ u2 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I/ O% q! w+ B, _" q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: M5 X; n/ k0 [2 l; W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. {3 Z0 |! X/ _0 x1 z1 }8 C) O$ g: _0 j2 w
! ~5 Z6 `/ ^) }# C# G# p) X! Z8 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 18:58 , Processed in 0.040096 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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