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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 e8 O) W. i. j& f. u2 F% r1 K
  1. [code]EDMA sample test application
      d2 C1 Y5 @) |* ~* T/ \) Z3 A
  2. /*
    6 t* {  R/ W/ `7 V9 Z! R  o
  3. * edma_test.c
    9 W1 k: C& o. y. t, F- _- V/ k
  4. *
    9 D8 H3 e1 g5 G* ?
  5. * brief  EDMA3 Test Application
    ( A/ A6 d3 N/ t/ m
  6. *" F; G# Y2 Y% n( R' V
  7. *   This file contains EDMA3 Test code.  N% g" `: L6 _' Y# U4 Z
  8. *
    $ S* h/ W, X3 I7 h/ h2 G/ c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 L; C2 t2 ?! N" i- O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' b, C+ ^2 n) L- w# C
  11. *         TO CHANGE.
    , g6 o# x% a" ?
  12. *
    * f8 j" y2 M0 z/ j0 B1 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + p, R1 ?4 Q" @
  14. *+ I0 E$ X+ Y8 w
  15. * This program is free software; you can redistribute it and/or
    4 C: _4 c" g' a9 Q: I* s9 T+ Q
  16. * modify it under the terms of the GNU General Public License as7 J% ]. C/ `3 n& T
  17. * published by the Free Software Foundation version 2.
    $ B! J2 }' c/ B0 E: w7 B: S
  18. *& D( S' O1 }" }/ ~* f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& V: F  v& m& P& l8 C
  20. * kind, whether express or implied; without even the implied warranty# _* A2 l8 Q9 {, q+ Q/ m6 {$ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& z# j; N- _: g# C% ?5 f6 e0 O( v# z
  22. * GNU General Public License for more details.
    & B( e0 w9 p6 e* {5 H( L
  23. */( Q1 _. X) m( y, g
  24. + `$ U+ n, a7 K2 f) q. G" O+ y
  25. #include <linux/module.h>5 ]) a5 Q* O* C. z6 f
  26. #include <linux/init.h>
    ! U* i+ j0 A) d: I6 D4 F4 M
  27. #include <linux/errno.h>4 i) J0 J) b9 ]/ y) H& g7 X. U
  28. #include <linux/types.h>$ {; a' y* g7 m0 k/ ^( B# |4 ^
  29. #include <linux/interrupt.h>! R" ^; E0 @$ m. `6 o
  30. #include <asm/io.h>
    + o; {2 ~  J4 Z5 q/ ?; L, s
  31. #include <linux/moduleparam.h>
    * P( r. w% P7 A$ w5 a, `' y& k
  32. #include <linux/sysctl.h>
    5 x- N! r+ z1 u
  33. #include <linux/mm.h>
    ! y3 X3 r8 ~0 v% o0 u
  34. #include <linux/dma-mapping.h>
    ! R) o$ W$ N% J, p  \
  35. 9 `$ @2 @+ m8 ]( T* g
  36. #include <mach/memory.h>
    + V6 n6 F9 V" r2 s- {& j
  37. #include <mach/hardware.h>
    % d) I6 V- Z2 J5 E
  38. #include <mach/irqs.h>9 N2 W( i! S9 m3 c9 S
  39. #include <asm/hardware/edma.h>
    # K1 X$ k" z. Q/ U. _# o
  40. . D2 R* p3 _' t( b
  41. #undef EDMA3_DEBUG
    9 S% Z1 U, _' s$ P
  42. /*#define EDMA3_DEBUG*/
    5 S. ~: f* Y7 `+ J5 `

  43. * M$ g) E9 f' W5 q& t$ X: |
  44. #ifdef EDMA3_DEBUG6 Q8 U+ ]- a, h: a" ]* w# R8 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f) E4 ^7 s* k  _7 D0 `' c: d: \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 v8 C  `- e  l- c8 X4 X6 w3 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G' ?! D; z, W9 Q/ d
  48. #else: H; R9 P7 W  H+ \. \6 f8 ]
  49. #define DMA_PRINTK( x... )
    0 H# r0 k2 \# P
  50. #define DMA_FN_IN5 O5 A9 L' P9 C1 F% ]
  51. #define DMA_FN_OUT
    / }4 D7 t7 U+ c8 E& l* y
  52. #endif. o& Z% Q9 f8 s  a' G

  53. ) e4 U0 j/ x# j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ e5 a8 h" E; C7 @, j2 n
  55. #define STATIC_SHIFT                31 ~& H9 v/ G6 S# p& q
  56. #define TCINTEN_SHIFT               20, c: n! q6 {: C. i5 W
  57. #define ITCINTEN_SHIFT              21  l, p( G; e" m+ d
  58. #define TCCHEN_SHIFT                22% n9 q' y0 c/ R: w' s
  59. #define ITCCHEN_SHIFT               23
    0 Z7 F) o" ^- ?/ {
  60. " [( w. d$ X) G7 T2 c$ K6 F
  61. static volatile int irqraised1 = 0;
    % S" z6 G3 S6 ?( y% S. [9 ]; s( z
  62. static volatile int irqraised2 = 0;. U" N4 h( g$ ~& L( y

  63. 3 C% {3 g" L- C+ t% T; m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ P# T* U9 C" |& |3 j; \) e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & P' h& N% h9 m2 D9 k( o% H( A* O3 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |* c- y% x! |

  67. ( [& x* g  x( W
  68. dma_addr_t dmaphyssrc1 = 0;5 s& I4 @4 Q, l- ~. X
  69. dma_addr_t dmaphyssrc2 = 0;! D2 a5 e: J. p) e/ v
  70. dma_addr_t dmaphysdest1 = 0;
    ) Y0 Q( P. D! i9 ~( ~. W
  71. dma_addr_t dmaphysdest2 = 0;) |- c' I1 m" M2 H0 x8 ^, J

  72. . r( r9 t; r9 \: y& h1 u: o7 \
  73. char *dmabufsrc1 = NULL;
    $ |/ A8 @" n5 y* C
  74. char *dmabufsrc2 = NULL;
    # R4 q7 x: M8 A4 U
  75. char *dmabufdest1 = NULL;; v" ?" h6 y! {+ k! }" R8 `" K" U
  76. char *dmabufdest2 = NULL;
    2 G7 e4 @9 t/ `( g

  77. 0 A  g6 q4 I- V# m
  78. static int acnt = 512;
    ( `7 }5 l) P( D( R$ x4 o
  79. static int bcnt = 8;
    , K) `! r' V* ?- j. K7 l3 v' Y
  80. static int ccnt = 8;
    $ ?: |. y8 o% p6 K# S: Y- N

  81. 4 F& a" e" N: x, _4 q- k/ J
  82. module_param(acnt, int, S_IRUGO);# ~1 X+ q, J5 Z6 e' Y
  83. module_param(bcnt, int, S_IRUGO);
    # {8 C/ G# M! b: ]* H1 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: a+ d. s0 |& ~2 s7 P
0 z" X4 ~! e4 i9 A( A% G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* f1 L0 o4 P9 C* r0 R# C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 |' T/ }1 ^0 @6 e* I; r( M" |: |- A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' u& Q2 [8 ]8 B4 k' ?/ _
. d- t) q* m2 U. Y  g1 z. R
* a# w8 j8 J) @1 M4 K* Y3 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 06:36 , Processed in 0.040108 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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