OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 r% L9 I9 {- s' v
  1. [code]EDMA sample test application
    * G$ e$ c! J+ U+ j: [3 F
  2. /*
    3 m2 a; y2 N  J2 Y
  3. * edma_test.c* ?+ e/ D/ t! R; K8 o
  4. *; p6 ?! o! K/ n% Q! P
  5. * brief  EDMA3 Test Application
    * p  }- C: n" R$ G, q1 P% B
  6. *
    ! a9 V: Q+ |# ^# X
  7. *   This file contains EDMA3 Test code.
    # D0 O( |) z1 J/ i
  8. ** Z4 _1 Z9 J! e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      w; Z9 }  v9 U& ]# x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 H( u8 v) I5 j7 \/ x0 e
  11. *         TO CHANGE.
    ) Q, F5 U" S5 T
  12. *% ~# h7 o" d- ]7 j' b+ Y& i( z: {8 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " o/ j: M- [# _# q2 g- f* \
  14. *
    : ]' ^  L/ G! t
  15. * This program is free software; you can redistribute it and/or2 l) e: x0 a9 v; g' a: }
  16. * modify it under the terms of the GNU General Public License as
    0 n& E6 P) O# O1 O5 T7 z
  17. * published by the Free Software Foundation version 2.
    * s  B+ i/ y' b! `
  18. *) a7 ?5 P7 {4 q8 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : Y% J9 F; F1 y1 p4 y3 y% r
  20. * kind, whether express or implied; without even the implied warranty/ I% {& Z8 y7 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 ?% O0 f0 t2 f. |1 e0 `) G
  22. * GNU General Public License for more details.
    6 D2 p' g) w9 Z+ V( u
  23. */
    , ?% e) \' t8 P: Q
  24. - q- a  M  y& I. \% r
  25. #include <linux/module.h>$ C% w1 w2 y" t6 @: m+ G
  26. #include <linux/init.h>$ O- y) k9 e. H: D# C4 i
  27. #include <linux/errno.h>+ I0 M' m) ~# v( {
  28. #include <linux/types.h>
    3 _0 J7 n( j" X
  29. #include <linux/interrupt.h>7 m6 b. m5 \7 p6 f
  30. #include <asm/io.h>
    4 Q/ A0 i, q" D- H
  31. #include <linux/moduleparam.h>
    : W8 [% e& N( Z+ l' X
  32. #include <linux/sysctl.h>0 ~" F/ I, U; h& i4 ]
  33. #include <linux/mm.h>/ w# i- l$ _8 L- z2 ]9 `7 z5 g
  34. #include <linux/dma-mapping.h>
    0 W4 l$ b5 a4 I. T" G/ v

  35. / b: R! j- T6 T2 f1 O8 q& I
  36. #include <mach/memory.h>
    0 a) o3 K8 {$ \( t- D  g% h' d8 d
  37. #include <mach/hardware.h>
    2 W7 }7 H- R' Q2 u1 N1 A
  38. #include <mach/irqs.h>
    " F. v' a! G$ w
  39. #include <asm/hardware/edma.h>
    8 d5 d9 `1 W( E# I& n9 T
  40. % {- ]  c0 E( ~3 P# ]
  41. #undef EDMA3_DEBUG! `9 n$ }$ B, }/ ~8 b/ t
  42. /*#define EDMA3_DEBUG*/
    % O% ?' r, k( i
  43. 6 i3 b* s' z4 |- |
  44. #ifdef EDMA3_DEBUG7 |+ y, ~+ E9 R5 f; e* a  E" O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; i( }, A3 L: y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ]. `: l. |" `2 R0 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 i9 r( _; \7 |" \6 u- L! b% q
  48. #else
    # k. c) b0 q' r" v- Q( b
  49. #define DMA_PRINTK( x... )$ [+ E& D: i* L  I
  50. #define DMA_FN_IN
    # F( L& ?4 P# ], k2 x
  51. #define DMA_FN_OUT0 n+ ^- O+ y' R. b9 h( |$ C1 ?! [2 u
  52. #endif
    ) K7 A6 c# @) l& ~& m3 f: b

  53. 1 k# j. L- l8 t# Z, G# y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' D5 l4 S! Z" l9 x3 U2 d' [
  55. #define STATIC_SHIFT                3
    , L9 S3 F& H8 d& i& i
  56. #define TCINTEN_SHIFT               20
    9 A2 _9 ^) D( @% ~; I! u# ^# p+ p
  57. #define ITCINTEN_SHIFT              21
    & k4 F$ o2 j! f0 Y7 \( d
  58. #define TCCHEN_SHIFT                22
      @# Q" ~- R  w# `- \
  59. #define ITCCHEN_SHIFT               23
    ! A- @- g7 j- J6 s. [& ^
  60. , W; l0 ^. D( A" Z/ `
  61. static volatile int irqraised1 = 0;
    $ y/ W' j- ~$ J
  62. static volatile int irqraised2 = 0;
    % U9 E) V% t1 F& |3 Y

  63. ( i/ _- t3 n' I/ T& d* Y& D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Z; I: U3 p1 L, b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 g, b. Q8 X7 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' P, Y+ s; f5 l+ n3 F% l
  67. % H. B) ^, r) k, S/ Y, b
  68. dma_addr_t dmaphyssrc1 = 0;
    - s' \4 a' u# s$ p( f  K
  69. dma_addr_t dmaphyssrc2 = 0;4 r8 U6 Q: ?5 i0 b- e2 Q& q+ |5 S* t
  70. dma_addr_t dmaphysdest1 = 0;
    : f4 a9 E- d; U# m5 ]2 z. O, |, z. U
  71. dma_addr_t dmaphysdest2 = 0;& z0 f2 i/ b2 [$ ~
  72. 2 Q: c0 W/ b8 f2 ]9 {" d/ L
  73. char *dmabufsrc1 = NULL;
    6 ]6 M& D1 ]' }% H5 s% V6 P
  74. char *dmabufsrc2 = NULL;7 D) T% Z1 a0 O3 U, {# {, \7 m
  75. char *dmabufdest1 = NULL;
    ! p7 u( Q  N0 d" y' z2 u
  76. char *dmabufdest2 = NULL;' B7 A; i* Q7 J; Q+ p& N

  77. & Q$ K$ Z( n) a/ t* c" I1 v4 K
  78. static int acnt = 512;# s& N. `2 F$ G( Y
  79. static int bcnt = 8;
    5 ]1 _5 T; _% ?; w4 t5 K
  80. static int ccnt = 8;
    " I* G1 j9 H3 i* {
  81. . m/ H! i* y4 K9 _$ U) e" L! C! Y+ d5 D
  82. module_param(acnt, int, S_IRUGO);5 V1 V  e+ P- K8 ^1 p3 x4 h* N0 \
  83. module_param(bcnt, int, S_IRUGO);
    2 V; L, V: C6 y( h; F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ b4 C1 r: G$ L8 u
3 e) t$ W9 ~4 w2 W& I8 z0 @9 s3 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ n9 g* b* P' barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  \# E7 _9 W3 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! u( S) F" _3 t/ H- x+ l9 W) I, Q
& |' j: |0 W) C# ^

# e3 g' y9 A: M0 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 00:22 , Processed in 0.046194 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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