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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 e# M; O$ Z# o( `, e8 R
  1. [code]EDMA sample test application
    ' E1 j8 i4 ~: A. W
  2. /*1 @% E1 d4 v, O7 h( y) b
  3. * edma_test.c
    1 O9 L1 c: e; q" l
  4. *+ e: _, |( c. x  c/ J
  5. * brief  EDMA3 Test Application
    / M- y1 O5 ?: \  i
  6. *
    & S- b: v: c3 Z) Q8 a
  7. *   This file contains EDMA3 Test code.
    + y8 v+ d1 [: S  ]$ K6 X* p
  8. *
    4 i9 b1 K0 g! S1 u( y2 ]7 c( V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 O! q% k5 [- x, q1 {/ L( \6 ^# h3 K4 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 M4 d* G( R& G9 ~  x$ @
  11. *         TO CHANGE.
    * P/ Y! ?' Y# a8 J3 x8 B
  12. *
    8 d1 W7 l1 w8 U- V% f! r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 U* r+ W) A: K( @* Q
  14. *+ m, @  R5 \( L& X$ R+ u. C
  15. * This program is free software; you can redistribute it and/or
    3 ~0 r4 b% G! Q6 Q; c8 m! v
  16. * modify it under the terms of the GNU General Public License as
    " c; u- q2 ]. f% n  M* }
  17. * published by the Free Software Foundation version 2.4 s4 I6 i8 K; c# R# h" k  {* M
  18. *- p4 j7 Y6 \2 O  Z" B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 y6 h7 H% \% }2 E( `
  20. * kind, whether express or implied; without even the implied warranty
    ; `5 F5 H9 v  y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & n+ D; J3 @$ F/ u' v( S: s
  22. * GNU General Public License for more details.' m; F! a  C& e! {7 o9 F
  23. */" `) G/ A) ?/ A2 B  }: ^; E

  24. / e/ r# D" `, ~% {" T
  25. #include <linux/module.h>/ W& o% i1 ?2 g
  26. #include <linux/init.h>- f' M+ A: T! i/ ~8 r, }
  27. #include <linux/errno.h>
    1 O8 z7 g2 q9 U) d
  28. #include <linux/types.h>8 [1 _9 F1 i$ Z& B4 {; X( L
  29. #include <linux/interrupt.h>$ q& n; Y6 \; e0 k: a' c5 F
  30. #include <asm/io.h>
    & ?0 I  L7 k/ n. Q9 M+ f/ w4 ^
  31. #include <linux/moduleparam.h>
    4 ~% @" z& f  s; H7 Z  ]
  32. #include <linux/sysctl.h>% b7 z* L/ K! R! Y* G  W
  33. #include <linux/mm.h>
    2 o6 o0 d7 h1 H0 B, Y
  34. #include <linux/dma-mapping.h>( e- O  J/ l0 \
  35. ' p8 q7 S7 d2 b0 N9 b1 i8 U2 {
  36. #include <mach/memory.h>
    ( o4 j7 Z. L, z- x+ \' h0 X
  37. #include <mach/hardware.h>: @8 z6 }- k) k+ X# O' @
  38. #include <mach/irqs.h>
    $ H0 t2 p; o8 u" r! ^) c( V
  39. #include <asm/hardware/edma.h>
    $ A, Y, n4 ]4 w. N. {* [

  40. 2 M, j5 A* F( U0 m/ V; ^
  41. #undef EDMA3_DEBUG
    * h3 @5 r6 M- @5 ^6 \8 }7 m0 L
  42. /*#define EDMA3_DEBUG*/
    ) O0 t2 p$ N* d

  43. 7 Z$ a& A- [1 b
  44. #ifdef EDMA3_DEBUG
    9 J; G2 C& C% u: c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( [7 J' m$ p  d* M% M: W+ o! a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 u. t, j; o3 I9 W5 y4 k1 s3 Y8 _2 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ H& l) [8 Z& q  @- U& j
  48. #else$ O, @- _$ x0 p' E$ x: y
  49. #define DMA_PRINTK( x... )
    - P" d, @7 H9 r9 V7 S' Q
  50. #define DMA_FN_IN
    2 S( }" P( z  Y' K2 g3 Y
  51. #define DMA_FN_OUT1 {. d6 k* _* a+ M
  52. #endif
    & B, }$ v0 d; f7 z# v
  53. " X  R; h  g$ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 X  A" O( o7 J$ d" j, O: o0 |+ W& t6 e
  55. #define STATIC_SHIFT                3
    ( r4 W: a& X. a* \# g: T# a4 C
  56. #define TCINTEN_SHIFT               20
    * d+ i5 M# {+ p6 o7 Z; g$ F1 i
  57. #define ITCINTEN_SHIFT              21
    - C! g6 V/ ^. Z: j" m; i( \. Z/ M" w
  58. #define TCCHEN_SHIFT                22
    & _# c" {/ w3 [. U) P  s
  59. #define ITCCHEN_SHIFT               23  Z* |% v8 q4 e, H% |% B5 J/ w

  60. 2 V) Y/ s" E$ s) [0 E6 b3 ?
  61. static volatile int irqraised1 = 0;: ]3 I/ {8 E2 o! I5 p
  62. static volatile int irqraised2 = 0;& I' T5 E' B! k% m7 P# |4 Z1 X
  63. # M( X5 d; D: W4 p6 J* @& r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `8 |8 a, i) {( g: d. F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : G/ @) S& |% ?0 O5 p3 j/ w6 |- [# K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! T# {" \2 k8 F8 ]# O. I$ |% Q! S
  67. + A. ?' o: H5 Y  \
  68. dma_addr_t dmaphyssrc1 = 0;( W  Z, L! t7 [5 `* w2 r$ I) Q4 \
  69. dma_addr_t dmaphyssrc2 = 0;# T0 E4 k9 i* n- p0 Q* l4 U
  70. dma_addr_t dmaphysdest1 = 0;
    3 W( A* ^- g& c+ E% o
  71. dma_addr_t dmaphysdest2 = 0;" C& j* Z& U; q9 G: ~3 x4 [6 o

  72. ; w5 {* t) D+ |
  73. char *dmabufsrc1 = NULL;
    . H2 r; T1 q5 n) ?! \$ H& F" V
  74. char *dmabufsrc2 = NULL;$ H8 G( J7 e) X8 b" Q& ?
  75. char *dmabufdest1 = NULL;. O. B0 g5 D2 g. e5 g
  76. char *dmabufdest2 = NULL;4 Y0 f% d: s, B  H) C* Q
  77.   D* r1 S/ r1 V
  78. static int acnt = 512;
    " o5 [! ]) c( l
  79. static int bcnt = 8;! x% Y4 |) `, n; K! ]6 u" k
  80. static int ccnt = 8;" Z0 z: v! R1 z' h; K

  81. 9 n  Q8 W6 \- z5 q2 H9 \9 ?
  82. module_param(acnt, int, S_IRUGO);
    6 _. i6 z  q$ ~
  83. module_param(bcnt, int, S_IRUGO);
    % ~1 s$ N# q2 Y. M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( H. k: C. Y3 I' C7 A
) I) y& E7 `. h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& M$ h  Y5 {( L& c7 J5 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: G- T) U( Y. H# f3 f4 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; _" _% e$ s+ |5 k; E- |$ L, }) m! y' M

6 t. R  H/ E$ a3 d4 l" N' X6 C6 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 22:07 , Processed in 0.038153 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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