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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# B* z' P6 A$ D! O: h
  1. [code]EDMA sample test application' |7 q4 `' b" o$ ~% F
  2. /*- A0 X7 s4 ?3 {4 b& a
  3. * edma_test.c
    4 k0 F* W" x1 {$ a/ R4 @
  4. *
    # N- M3 ]; a) B8 l% J' ?+ I
  5. * brief  EDMA3 Test Application' G8 ]6 y0 c/ C2 e
  6. *  G3 m" j. R! b1 N
  7. *   This file contains EDMA3 Test code.
    : W( ]4 y4 Y; w# v3 o& o# d5 b
  8. *
    9 k2 }0 y: T7 O* K2 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! q6 Q( w5 R/ i" y3 I( j  Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 {# ~' D( P/ |* Y
  11. *         TO CHANGE.
    0 E/ G, V9 H+ R$ ~
  12. *" {, v3 ]  k& i" n: I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ ]  y, F/ R& J) r9 E; E; d" E4 w
  14. *
    + ?5 \# q* d* d
  15. * This program is free software; you can redistribute it and/or/ S% [# |8 p4 j6 B
  16. * modify it under the terms of the GNU General Public License as0 |0 m( e( ^8 G) j& [7 L% U
  17. * published by the Free Software Foundation version 2.4 o( n* {- g; Y: M
  18. *) C$ j9 p, I- Y1 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% L9 j0 T7 v7 e0 E9 }
  20. * kind, whether express or implied; without even the implied warranty) v7 z, M. T8 O  f5 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. _  K+ p2 u; b! `
  22. * GNU General Public License for more details.
    , l) H% w6 F- f& f
  23. */
    / _6 \- S- I" n2 n0 {
  24. % Q& O0 Z% q3 A6 N' ~
  25. #include <linux/module.h>
    # c2 D* X9 [& Y6 q: u
  26. #include <linux/init.h>) I; T1 Y. {, u" c& E
  27. #include <linux/errno.h>
    9 A6 j8 q+ l- A: c$ ~. f
  28. #include <linux/types.h>. z6 e4 ~; @& k
  29. #include <linux/interrupt.h>
    9 F; o  s3 U* N, Y- D& x
  30. #include <asm/io.h>, K0 |- s  r, X& {4 N/ r/ r4 _
  31. #include <linux/moduleparam.h>
    4 G* z/ K8 Y( f) X6 e5 p5 V
  32. #include <linux/sysctl.h>, [$ k5 g8 p% g! v
  33. #include <linux/mm.h>' l- E8 s' q8 b: H
  34. #include <linux/dma-mapping.h>
    # J# S$ H& P1 C4 F* K4 a! _5 J
  35. 7 j4 ]: X, c& d& K
  36. #include <mach/memory.h>. O9 }2 r( ?/ o
  37. #include <mach/hardware.h>
    / H0 t( p; p) g, N! g. t
  38. #include <mach/irqs.h>( c! P- Z: ^; i
  39. #include <asm/hardware/edma.h>
    8 I6 E* c) u/ b5 ]: c8 J
  40. 5 y+ r- s; ~9 l( V
  41. #undef EDMA3_DEBUG3 L/ U# u/ A. l/ H. [/ Z: x
  42. /*#define EDMA3_DEBUG*/
    3 k( T& q5 W9 b0 k) N# C

  43. ( p& {* {7 d/ X0 k, h) v8 Z
  44. #ifdef EDMA3_DEBUG
    0 L& w4 `( k$ f+ Q) ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [! m% P, h5 d$ n1 A9 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- \, J0 B2 W. b* N  z) M' L) [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 y2 q% i5 U7 M% U
  48. #else4 J$ {) [2 K& [5 }5 }
  49. #define DMA_PRINTK( x... )
    - \7 x8 ]( o/ _1 N: P' D
  50. #define DMA_FN_IN1 i# n& H9 b0 Q
  51. #define DMA_FN_OUT2 ]$ t9 C* F, g' W6 O0 @: e6 D; C: ^: Y
  52. #endif
    ) |  i2 A8 d$ g  k: K+ a
  53. * l4 S' E7 M+ Q6 P7 d) f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : H; A6 @; K* O# |! l
  55. #define STATIC_SHIFT                3- W+ `1 i- J9 d: w7 f( F
  56. #define TCINTEN_SHIFT               20+ r+ F+ h: n, M" |0 N
  57. #define ITCINTEN_SHIFT              21
    * C2 W( p, `' ^7 L% Z' e8 c. g
  58. #define TCCHEN_SHIFT                22' U; A* Z0 V' T" h& m* n
  59. #define ITCCHEN_SHIFT               23- G  f1 N# |8 X/ r/ G  A7 Q! k! V! N7 D
  60. / K) q9 I$ K3 S7 l) M: x  T+ L
  61. static volatile int irqraised1 = 0;$ ^9 K& N; s" Y3 K
  62. static volatile int irqraised2 = 0;
    2 }; F9 Y( ?, @# m$ H: j
  63. ! h* g2 [0 p# X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a2 @6 S1 e: e, c; }8 ^( T5 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x3 y: j3 y- t& U" F9 D- H( U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; }5 m6 K  h& G, s0 A

  67. 3 O/ C; i2 r5 @$ ^% [8 f3 j9 y+ ^3 v
  68. dma_addr_t dmaphyssrc1 = 0;7 A$ }7 Y* k# q
  69. dma_addr_t dmaphyssrc2 = 0;: U* U1 F) f: _# ^! _1 O
  70. dma_addr_t dmaphysdest1 = 0;
    . @7 ]7 ^' F; V8 B
  71. dma_addr_t dmaphysdest2 = 0;
    ) O. ~4 A. p/ L6 L
  72. : T* d0 V; S2 y5 x+ |( H5 H5 f
  73. char *dmabufsrc1 = NULL;
    + r/ A( Q( T6 a# M8 Q8 X- k
  74. char *dmabufsrc2 = NULL;
    1 Y  G, \" Y  Y+ W8 J
  75. char *dmabufdest1 = NULL;
    5 Z" a: U( B; s, }# j
  76. char *dmabufdest2 = NULL;* J% l% [3 S$ {) ]* K6 v

  77. 4 f4 G' y! B! T3 p2 M) Q' y
  78. static int acnt = 512;1 P& m, I$ O/ q; }
  79. static int bcnt = 8;" o+ j! [3 S( J
  80. static int ccnt = 8;
    + U, B6 }! l4 l1 d* G# k) V1 b
  81. . r: Q4 Z: }3 D6 ]# _$ R8 I, M
  82. module_param(acnt, int, S_IRUGO);
    ( c, r/ k6 G# D4 f6 l' i) S
  83. module_param(bcnt, int, S_IRUGO);
    , ~# j* t  a9 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  r7 K& u1 t; s" K* o) E7 C
0 M! o& P$ R5 L* C0 T0 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ z6 j& g) c) G2 W. O7 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ M" e/ v' L3 ?# W+ y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 f$ O' Q3 j2 ?. V  r
; i; j9 g. \" s. I. k) w
) g# J" x" \0 o1 E4 y2 q# H3 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 20:24 , Processed in 0.038915 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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