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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ B) @/ M8 I7 B6 e: I/ [* `0 W
  1. [code]EDMA sample test application
    - O% ]( b" y0 o- a* _* s2 K; X
  2. /*
    ! L0 n2 G$ u" V" a" ]% m7 l
  3. * edma_test.c  d: Y7 [. ~$ R# D% r
  4. *
    7 y( F# r4 M- P2 n
  5. * brief  EDMA3 Test Application9 X7 U- ?5 U/ W, T% B# b
  6. *. m4 r5 F* y! E) _7 t
  7. *   This file contains EDMA3 Test code.2 I/ e) v  B% l; J3 V! l, W
  8. *. t0 _3 N0 I+ n2 ~. K% X% D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      s0 \+ L! }7 f& I# V3 O' x, ?  Y+ @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " S5 w( u+ J2 i$ L
  11. *         TO CHANGE.
    , _5 t+ {$ K( n) x
  12. *' p; P# D3 `. u* @  f) Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 B: I+ t7 Z$ i7 i
  14. *
    , m' D8 S/ l! |( S" A4 \
  15. * This program is free software; you can redistribute it and/or; V2 s/ ]9 S/ P8 ~# X. _5 l& D
  16. * modify it under the terms of the GNU General Public License as
    7 K% i  Y& w: }% z
  17. * published by the Free Software Foundation version 2.
    $ I- `% T- K+ M0 j/ i! |
  18. *( y& O3 t1 F: s" [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) m# C% |; S. n7 S
  20. * kind, whether express or implied; without even the implied warranty* `  A& b$ w7 U* |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" n5 i; L) S3 T/ Q
  22. * GNU General Public License for more details.! ?3 N- R$ }% _
  23. */+ w& g/ t3 f: }1 z9 r

  24. 1 Q. Y) P0 o0 _' P3 G9 w
  25. #include <linux/module.h>
    ( |& T* P( z& p
  26. #include <linux/init.h>$ O" V; y% D% b1 m  T" B2 Q
  27. #include <linux/errno.h>6 n+ e9 M4 c& R$ \4 K% Y6 k9 o
  28. #include <linux/types.h>
    ( D2 I+ u8 G; k8 g. O; u
  29. #include <linux/interrupt.h>
    7 t/ J0 l$ B3 g, M5 G
  30. #include <asm/io.h>
    ' R+ t! E9 M  m) N3 h/ @* B
  31. #include <linux/moduleparam.h>
    + j( N1 u+ c# K( \% H: k
  32. #include <linux/sysctl.h>
    ' E" P0 l- |( G: Z9 C2 l5 V- z
  33. #include <linux/mm.h>
    , e4 l" `( b" M! Z) A2 g+ d
  34. #include <linux/dma-mapping.h>, e7 |9 p1 E! z9 [

  35. : A  S: H7 {0 n; [  L% N
  36. #include <mach/memory.h>
    : ?" I) q/ e1 D9 _' v/ Y
  37. #include <mach/hardware.h>& C/ j7 l" A2 T! Z0 Y
  38. #include <mach/irqs.h>" |3 ]; v8 I0 i3 j
  39. #include <asm/hardware/edma.h>1 a0 |( m4 ^  W5 s1 H0 P# A

  40. 5 k* o+ o/ l% W
  41. #undef EDMA3_DEBUG
    4 X2 L& X- o$ R: {$ X0 D) F
  42. /*#define EDMA3_DEBUG*/
    ( N+ \% N: u0 W

  43.   K$ y# e6 F* A; E6 O0 c: h8 c
  44. #ifdef EDMA3_DEBUG7 l; }2 C4 s% N  D5 B' s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 v6 b  J; u8 Y; i7 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 U: U2 x# {  t# {: Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Q9 [5 c9 L7 K
  48. #else
    ; T9 p7 Q8 O; I( @3 i/ U& Q% L
  49. #define DMA_PRINTK( x... )
    ! F# G7 q) |' g( ]
  50. #define DMA_FN_IN
    " T! n, m; l- e
  51. #define DMA_FN_OUT
    0 f" _% J4 |0 W; c! @# Q7 {3 J
  52. #endif
    " q0 q7 b$ G/ b# ~: }7 S: K
  53. 9 U5 K* F1 b, w; n9 e' N6 o5 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 S) ]; N4 N" r1 W  g" x
  55. #define STATIC_SHIFT                3
    " D& C! T$ f! M& W& L6 B* ~
  56. #define TCINTEN_SHIFT               20
    / c6 [$ K8 U$ T& i  O+ `. g
  57. #define ITCINTEN_SHIFT              21' b2 a) h" w( A1 `" r+ N
  58. #define TCCHEN_SHIFT                22
    + v1 |. Y* P6 m" S
  59. #define ITCCHEN_SHIFT               23
    . f' P( d- Y, |$ [1 r
  60. 7 {5 D$ ?; }: [
  61. static volatile int irqraised1 = 0;
    2 a6 y8 r  p, d8 w% S! F$ b8 l
  62. static volatile int irqraised2 = 0;% X; v3 U4 X+ k! [- s( {! Q' W0 T

  63. % @+ [: q2 [) c/ B. b2 g( f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ C* X, O$ W; }9 f; M' I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]2 I3 g/ v5 f! t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z, G4 M6 V/ `2 X2 {+ {

  67. ) m' D, X8 @& L* v; C
  68. dma_addr_t dmaphyssrc1 = 0;
    & c1 ^8 C. \8 z/ E  n
  69. dma_addr_t dmaphyssrc2 = 0;  b. w7 M0 m/ D$ y
  70. dma_addr_t dmaphysdest1 = 0;
    & h4 V) z6 L( S& f7 R7 {
  71. dma_addr_t dmaphysdest2 = 0;
    1 d) [5 c$ P3 ?- p7 b
  72. & M5 Q7 T# p3 ?9 K
  73. char *dmabufsrc1 = NULL;
    # ]% s4 o) o6 V- K/ X
  74. char *dmabufsrc2 = NULL;
    + P3 v5 }4 R" A
  75. char *dmabufdest1 = NULL;+ ]' U' f% x3 a% }
  76. char *dmabufdest2 = NULL;
    , o! X( S- q1 F6 F# j3 F: G' a0 k" H9 Q+ B

  77. + b6 E7 s/ M) @. F  Y6 M
  78. static int acnt = 512;/ A( i. x) b2 \1 L! L" ^
  79. static int bcnt = 8;
    ) p. t; F5 {: U3 M7 D
  80. static int ccnt = 8;
    & d  f5 E, d6 k( }

  81. / ^! ~1 v% k0 M$ S( h% N! d4 O- \
  82. module_param(acnt, int, S_IRUGO);" c' S& g7 P; s5 j2 q* l1 ^& A
  83. module_param(bcnt, int, S_IRUGO);
    & y2 d. U/ Q- _+ j) m# a& d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 T6 q& U# X% E4 f. V) k3 X3 y; `7 f( p7 Q9 \4 D+ F3 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& q$ z. U" J4 r- }  k% p2 e* \3 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 p* W) R7 a) e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* [* ~. M8 t9 L0 C3 O& m
, Y4 [7 _' E; |+ x0 H) ?  [7 _6 H: a9 x2 G2 `, w- s$ ?) p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-15 14:17 , Processed in 0.044770 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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