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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Z% H  z0 w, W6 }% ^
  1. [code]EDMA sample test application) B, M: v7 z1 r( s
  2. /*
      u3 @$ G# V. B5 H0 D  ?" o
  3. * edma_test.c7 L( `' u1 g- {& r- R$ p
  4. *, }  k  `$ x9 h; Z
  5. * brief  EDMA3 Test Application2 z0 e( Z3 K; D$ r$ R7 y
  6. *4 v4 N$ J# Y9 q1 d6 ]
  7. *   This file contains EDMA3 Test code.9 ~! k3 }* ~4 C. S, r1 N$ F$ Y
  8. *; i* l  ^8 x5 z% d$ b4 k: l/ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + ~& {! a/ p  H& H# \1 g, _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 y! h& s( O3 c3 q9 Y0 Z
  11. *         TO CHANGE.& b( I, w. p; {
  12. *7 ~2 o" x+ L* j& }2 Q" k: a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) I7 u2 Q! D6 Q- w
  14. *9 R' \! q& w5 E( u
  15. * This program is free software; you can redistribute it and/or
    : [6 V& S# J- x* C  d/ I
  16. * modify it under the terms of the GNU General Public License as& ]- s+ J: j5 P
  17. * published by the Free Software Foundation version 2." z/ G6 W& F9 K+ V
  18. *
    " r6 K, ?4 |' x2 U& F0 j% H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! }8 F% z3 ^' G6 S% m# g! x
  20. * kind, whether express or implied; without even the implied warranty
    , p- f; _, R. f1 ]/ v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  ]$ X$ X1 Y2 a, Y- C- {
  22. * GNU General Public License for more details.& F) d0 @/ ?1 Q  C, F
  23. */2 O# v9 Y, m( `$ z6 J  I3 V1 E

  24. 2 |  p/ v1 F$ v8 {
  25. #include <linux/module.h>8 B# }# d3 m7 k3 Z" A2 s! i& E
  26. #include <linux/init.h># L' d2 A3 c+ {$ \9 f3 m+ S
  27. #include <linux/errno.h>
    : j- G' Y5 z) Q4 Y" }
  28. #include <linux/types.h>; R0 R* e/ X2 h
  29. #include <linux/interrupt.h>
    - M: D/ C2 j" C4 h' m
  30. #include <asm/io.h>
    , l) }( C3 e, ^: `1 w
  31. #include <linux/moduleparam.h>& T/ f" ]  [* e
  32. #include <linux/sysctl.h>, z$ o: Z2 l' }% q1 ~
  33. #include <linux/mm.h>
    7 K& r( p' L, O, b! i
  34. #include <linux/dma-mapping.h>+ m7 h1 {5 X2 x
  35. 9 R. b) _6 Z+ H$ K  i- x
  36. #include <mach/memory.h>  i" c2 p% ?. M; `4 H$ I2 K* f
  37. #include <mach/hardware.h>' Z% C/ ]3 y2 J! y( X0 C# f
  38. #include <mach/irqs.h>9 g0 T3 W! M/ W* J: ]
  39. #include <asm/hardware/edma.h>
    2 }* ?- n, o6 s- k* v+ }3 g
  40. " {! [& j# s2 ^0 k( b4 W8 A
  41. #undef EDMA3_DEBUG/ z/ q6 ?7 v! \7 O
  42. /*#define EDMA3_DEBUG*/1 L/ B+ M& m/ J3 Z

  43. 5 d' n2 l/ h9 T& h9 U
  44. #ifdef EDMA3_DEBUG
    * e: `/ l! ~% V  R2 I. J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ a6 w& b5 }' r  \% ^1 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) q. G* w  ?  p/ w, m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 w, f4 H/ l3 a
  48. #else
    ' M6 p$ z$ U0 n& d
  49. #define DMA_PRINTK( x... )
    ! x% e4 R4 I* {6 s
  50. #define DMA_FN_IN; ]3 c8 u) f" a" w6 y
  51. #define DMA_FN_OUT$ n+ a0 C* n' o$ s: o$ Z7 C: P
  52. #endif* o# ]& g' n% }) S2 r' A0 v

  53. 1 ^4 `: k- e0 ?5 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! n1 c9 Y5 A3 H2 K9 G/ a1 b5 s
  55. #define STATIC_SHIFT                3
    7 L+ g8 T/ s$ R7 D* B
  56. #define TCINTEN_SHIFT               20
    + A4 k2 K" E( X6 z2 h" u- F
  57. #define ITCINTEN_SHIFT              21
    , h8 K  b# s% O! f
  58. #define TCCHEN_SHIFT                22
    0 C4 y6 ~& X4 E; ]$ R
  59. #define ITCCHEN_SHIFT               23, r- e9 u9 l8 a4 _1 K8 Z  n" v0 q, g7 R

  60. ( y3 }+ {! O" ]9 I, e: H: P4 a
  61. static volatile int irqraised1 = 0;
    ' X$ p  V4 C) P
  62. static volatile int irqraised2 = 0;
    & j) c* R/ p" ~% S7 W1 V  ?
  63. * Y" B, N2 x' }9 c! F- o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P/ d' N& P5 S7 s. u/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _2 i/ p: N* i) f, Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B+ O4 M* W* N4 u4 H3 _+ T
  67. % k- K* R9 T9 X' C
  68. dma_addr_t dmaphyssrc1 = 0;
    $ E  }! r" s8 V8 W0 X- h" x
  69. dma_addr_t dmaphyssrc2 = 0;. i5 m% D' h+ F- j
  70. dma_addr_t dmaphysdest1 = 0;
    - v" u& z5 P% U$ n" B
  71. dma_addr_t dmaphysdest2 = 0;
    + C0 }$ N" {4 @7 s) b

  72. + g( V: ~8 U& M
  73. char *dmabufsrc1 = NULL;6 V7 ?; A: W9 T; E! V
  74. char *dmabufsrc2 = NULL;2 M9 P9 J' M1 y0 ]* ?" _$ B" F
  75. char *dmabufdest1 = NULL;* B8 i6 k: \3 u% S. P: c& a3 N; U* y
  76. char *dmabufdest2 = NULL;
    * z/ w1 n# w" X* I  r' c& U

  77. 3 k. C; r3 {: K) W5 N% Q
  78. static int acnt = 512;
    4 {! O; n7 K' d& e
  79. static int bcnt = 8;
    $ d# {0 F3 y+ P  S  ~. B. f0 c
  80. static int ccnt = 8;& W" a+ ^+ w: @2 w0 a2 A; C7 U% l7 l
  81. ' p& ]6 b( |2 a. r# ?* F
  82. module_param(acnt, int, S_IRUGO);
    7 \8 \( ?5 f6 x) D8 ?. g9 h( q
  83. module_param(bcnt, int, S_IRUGO);
    - ~  x5 L  k/ W: X% m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' u' [. T7 u  U' d
0 L& b, v4 x( ]$ P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 W% R/ U$ V* E2 N" Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 P8 U5 ^* b5 r/ l; h) E( z5 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ f' F' o, U+ q! t2 j, t, W) j. ?9 C, j7 @* r. W: ~
9 ^4 [5 N/ ^+ r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 22:53 , Processed in 0.037440 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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