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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % f: {& Z; R* [7 }6 `! E  d: H
  1. [code]EDMA sample test application
    " s. H8 L) A; v  Y4 y
  2. /*
    " ]8 K9 U- T7 {1 f
  3. * edma_test.c
    7 k) `# ]+ ?! Y1 N& [2 B
  4. *+ u8 D9 Z. O( N2 l/ n2 K
  5. * brief  EDMA3 Test Application7 s: a  P! y3 T3 T
  6. *4 u  U, @& t" C9 R& B! h/ R5 Q8 g$ h
  7. *   This file contains EDMA3 Test code., F; U& W" c2 S& f8 ?& H0 N
  8. *
    ! E0 y( ^! `9 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 b7 j7 o- _$ |" c  e% ?$ X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 ]- P  U: @/ w7 ]" |
  11. *         TO CHANGE.& j8 \2 H" w$ @; }4 U8 T
  12. *
    5 F1 x* }4 D9 N# S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 X  X4 h( t9 D
  14. *7 k& }9 t2 B: {/ g$ r6 F. X6 t
  15. * This program is free software; you can redistribute it and/or$ T0 E$ v  q8 v) ]6 d+ x+ A/ ^1 i
  16. * modify it under the terms of the GNU General Public License as1 K. G- b2 U- B- d/ S
  17. * published by the Free Software Foundation version 2.) J+ c, X* Q# u9 E4 q% G
  18. *% o3 }3 P( F& _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # Y9 |, U1 K7 s0 T  Z% P' V
  20. * kind, whether express or implied; without even the implied warranty
    / O: d+ A9 [9 P" Z9 b0 C( Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) U0 C8 U( W2 {  g* `# _
  22. * GNU General Public License for more details.
    $ b+ O/ ]2 K5 X8 j# b: y4 U! Y) k
  23. */
      \  I! ], ]8 C( v

  24. 6 i- ]9 l, x  y- K& B
  25. #include <linux/module.h>
    + o7 Y. x) W! W# m" p% k
  26. #include <linux/init.h>' d/ n6 C5 `0 u9 L' {8 ~
  27. #include <linux/errno.h>1 Y5 M( Z. T4 j2 i& Q
  28. #include <linux/types.h>4 b4 D( x$ J. Z0 w- S+ Y
  29. #include <linux/interrupt.h>
    1 h) y. U  v* `9 B+ C7 {; h
  30. #include <asm/io.h>. u0 |) G7 Z" k
  31. #include <linux/moduleparam.h>
    * u+ x) y" r, ]: q# P
  32. #include <linux/sysctl.h>
    . [+ H# ]! E+ `! W
  33. #include <linux/mm.h>
    , ^) C: i! u  _! X( r9 E
  34. #include <linux/dma-mapping.h>+ M1 l9 D1 X' V2 W* N  l7 {% ]

  35. 2 _- B* ?1 M) Y, y! {+ B- a; ?2 H
  36. #include <mach/memory.h>( J* t  A) n+ f  f% f
  37. #include <mach/hardware.h>
    * h4 a( j' b; w: v: Z; p
  38. #include <mach/irqs.h>
    5 m& L+ S& K& v: a
  39. #include <asm/hardware/edma.h>
    6 A  q) ~) v7 F+ F8 l; E# f* }
  40. 5 h7 s9 f  b7 D# x' O8 w% W/ g
  41. #undef EDMA3_DEBUG
    + v! [( h$ `, f+ s1 E
  42. /*#define EDMA3_DEBUG*/0 e, w5 o- S: o9 y+ B+ Q
  43. : W/ s7 ?' [- u7 z1 c, c9 _
  44. #ifdef EDMA3_DEBUG4 _2 P' l, `5 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' c+ B' x8 T6 e9 k1 j0 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 c" N9 G1 s$ w+ a) W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S) F; [9 m( B! f, X- x/ |
  48. #else
    , U' }% K& u) f) K
  49. #define DMA_PRINTK( x... )+ e, j3 F8 h: r7 ^
  50. #define DMA_FN_IN
      `, |/ o7 t: t7 d1 P( @" `" l
  51. #define DMA_FN_OUT5 Z: ]% p/ w' ?& h
  52. #endif
    " k, u- L) K! ?

  53. ' U2 h4 ], P' L+ i" @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ B) Z1 {+ g& ^# ^6 p# h9 g. Z* I  u
  55. #define STATIC_SHIFT                3$ a' a6 O1 [3 k' b; J; a4 s: \
  56. #define TCINTEN_SHIFT               20
    : Y! e4 l; q4 j8 _* `
  57. #define ITCINTEN_SHIFT              21
    7 j/ K$ Y: u1 R: d& n
  58. #define TCCHEN_SHIFT                22
    + d7 C4 @. E) t/ ~$ L/ k) K
  59. #define ITCCHEN_SHIFT               23
    - ^( M7 h; ?" s3 r) l$ m
  60. : m2 V1 |6 w8 B0 k2 T& F5 Y
  61. static volatile int irqraised1 = 0;: _) C* O8 P9 Z7 L# P: Q
  62. static volatile int irqraised2 = 0;
    1 J" F) r7 X# O* b
  63.   p& L1 K; }0 f$ u4 A2 @  ^" G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + L! ~0 C: S2 `3 J" ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( n5 ^7 i' L# j& v. f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H/ j8 L# k; [0 i+ x4 k8 X3 K; c3 v
  67. * F0 @1 g- c5 ~' u! Q# F" Q
  68. dma_addr_t dmaphyssrc1 = 0;  i+ ^$ N$ ~8 G( ~
  69. dma_addr_t dmaphyssrc2 = 0;+ t4 ?: A3 D& c9 h4 c6 s' p" j
  70. dma_addr_t dmaphysdest1 = 0;
    1 Z- q0 i- E5 @6 {/ G2 ?! M/ {* K- o
  71. dma_addr_t dmaphysdest2 = 0;6 r- ^' P: R1 a& O& b' Z) _

  72. # c1 ]1 ?. [2 ]& C) a. p2 V
  73. char *dmabufsrc1 = NULL;3 a8 W6 Z; c$ a" k# [/ J& J8 n$ w
  74. char *dmabufsrc2 = NULL;
    / `! n9 m3 v& m$ {# H$ G
  75. char *dmabufdest1 = NULL;
    . N+ m9 H) B. f+ l
  76. char *dmabufdest2 = NULL;/ f! g, _* c1 g
  77. % z" W7 {; P3 j& a) q0 K
  78. static int acnt = 512;
    ! I& l" f7 a. z" n7 S
  79. static int bcnt = 8;
    2 n6 j3 C9 b7 B4 \" |
  80. static int ccnt = 8;) P$ @/ D/ ?' f

  81. . P0 z$ i3 ]6 W* Z+ ]: z+ V
  82. module_param(acnt, int, S_IRUGO);0 L+ S1 V6 _* t5 C7 N% }. U  e
  83. module_param(bcnt, int, S_IRUGO);
    9 ~$ L# [2 g8 @5 Z+ Q; Q6 Q/ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 L. J) O* C/ [4 z! ^2 C- P9 W

: j4 I, v; b; j" b: V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: B) ^0 }* j" c. W+ ~" P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; c3 c2 X: V1 v) |! k% E: c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) T$ B! V# ^# b% X) U+ y& P# k( v7 t

$ R/ f6 T3 ~3 m$ I0 W! \- i) i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-7 17:09 , Processed in 0.043769 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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