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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 j: \2 ~. P" s: ?8 Q2 Y( f! k" a* Z2 B
  1. [code]EDMA sample test application& ~  w, W0 e% p% i) V( [
  2. /*6 b3 Q- F- ~3 R* j
  3. * edma_test.c- \" c9 O, I  f) a7 [
  4. *3 C7 ]' i9 B* M% r& T& o7 E; P
  5. * brief  EDMA3 Test Application
    + e9 @2 S$ B6 V! f1 _! D
  6. *# {+ P4 \2 Y' |% t+ h2 l
  7. *   This file contains EDMA3 Test code.0 o! R+ p' i* m9 \1 g4 y
  8. *
    0 \( @) {1 f. {. P4 N9 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % M% s1 _9 u( r) X  P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! G) S4 \& X+ Z& R+ r7 K4 m: g& X
  11. *         TO CHANGE.; y$ \+ o  ~) r) p- w& {& d
  12. *" K' V$ p. x7 s5 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 X+ f5 z& [( y: K* p6 l5 M
  14. *! r8 _6 Z! w& Z' z' d+ D1 c2 v
  15. * This program is free software; you can redistribute it and/or$ R8 W: G  u% b3 ^- q& S
  16. * modify it under the terms of the GNU General Public License as: S0 R% K0 x4 r! J) `: v' _* w
  17. * published by the Free Software Foundation version 2./ s9 E: N; R  s9 W
  18. *5 M0 ~1 F7 c2 T; `* m2 I' @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 m; \! H1 g8 I! }* o6 S2 \8 |3 w
  20. * kind, whether express or implied; without even the implied warranty
    ! P0 F  u0 K, ?6 R' t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( i  _2 e$ U* S% f9 |9 O
  22. * GNU General Public License for more details.# @- c0 J& x0 ~+ |: F
  23. */
    " x, K. Y! Q- N6 d
  24. $ c5 z5 g# ]: I5 O
  25. #include <linux/module.h>& }. x8 j; k7 r) E' w- \: z
  26. #include <linux/init.h>
    : S  p( C* K+ U1 r
  27. #include <linux/errno.h>
    ! f/ n, m7 l# L/ g
  28. #include <linux/types.h>
    4 ]: c) p) L( z( x5 I) t; n% d
  29. #include <linux/interrupt.h>
    , K- u" T* u7 q5 ?7 w* @
  30. #include <asm/io.h>
    $ d+ r2 u7 I& o8 l" x
  31. #include <linux/moduleparam.h>
    $ ?- n! j5 A  |+ v! Z1 @# E) W" N6 ^
  32. #include <linux/sysctl.h>
    - g5 J( v( G( k" e, |2 T6 e: z( T
  33. #include <linux/mm.h>
    # M% ^4 J. i: Z0 S) v7 s. L
  34. #include <linux/dma-mapping.h>
    0 ~4 c% V! o4 O" o

  35. & _! i+ c% i# w/ A
  36. #include <mach/memory.h>
    / [8 O: l8 R1 e% q% B5 S
  37. #include <mach/hardware.h>
    6 }+ x! s( }' q; d1 s7 V
  38. #include <mach/irqs.h>- N) O3 M$ F, h, l4 b8 E8 G
  39. #include <asm/hardware/edma.h>* O& N: {4 i$ ~
  40. 8 j" K: U4 c* v( Y& P
  41. #undef EDMA3_DEBUG" V& ?, j  ~8 o* q: q4 ~8 v  `2 W9 V
  42. /*#define EDMA3_DEBUG*/0 Y; J0 P9 E1 m; |* Z2 ^" x

  43. 3 N" M4 n( ~  A9 O" V2 }
  44. #ifdef EDMA3_DEBUG" I5 {% G1 b2 e! @$ G/ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # a) a6 m5 S% y6 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + l& T6 @( F9 e1 M5 n& {) r3 j% Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # f: y. z: f8 n# w! g0 V. k
  48. #else0 @4 Q# h( F- g1 `3 M- ]2 [. i/ p
  49. #define DMA_PRINTK( x... )  Y( y! e  o1 D3 U+ F0 L, T
  50. #define DMA_FN_IN
    : [$ L7 Y! U3 a5 D* M* n/ [( |
  51. #define DMA_FN_OUT
    - U5 b- H. U7 _7 N4 E2 K1 o
  52. #endif7 U( @5 D( k4 c% C/ ~  F

  53. 1 o9 t/ g: @* W( q; U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 @1 _3 L5 B8 t- H: O, ?
  55. #define STATIC_SHIFT                3
    * U9 H& m0 j+ r
  56. #define TCINTEN_SHIFT               20
    . t4 F1 X  ?# n* W3 P
  57. #define ITCINTEN_SHIFT              21
    6 u8 b1 @) x( V! p9 V
  58. #define TCCHEN_SHIFT                22
    8 A' I, }1 D* I0 j
  59. #define ITCCHEN_SHIFT               23+ O% T8 V$ U1 e& ^+ |

  60. + n6 O/ V2 Z1 E* c7 M& c2 ^
  61. static volatile int irqraised1 = 0;" t% \% @- i) C0 P2 g$ l; M
  62. static volatile int irqraised2 = 0;
    + v0 j4 W# D: ]" n' v9 ~

  63. " E! c5 Z6 e) O6 W+ p" b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . o" K. l7 N9 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ?7 j7 F. l& L3 g$ P+ q) Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 U8 k3 I5 Y' p( V& [

  67. " ~+ h$ D7 n, J0 @7 u8 j
  68. dma_addr_t dmaphyssrc1 = 0;
      A4 q$ O$ v' }: X! c5 l  ^$ i
  69. dma_addr_t dmaphyssrc2 = 0;
      R* r% f' ]5 R" o- M1 Q
  70. dma_addr_t dmaphysdest1 = 0;1 {/ i/ h8 |, C% s9 C+ _
  71. dma_addr_t dmaphysdest2 = 0;
    & ^' H' a+ \2 B+ t7 `) H5 A/ d

  72. 9 ]( t; n& j; H
  73. char *dmabufsrc1 = NULL;
    0 E( w2 K+ h' m8 u, |
  74. char *dmabufsrc2 = NULL;  _3 T3 E; X% I$ e
  75. char *dmabufdest1 = NULL;6 Y* H# d9 q+ `, t* o' D3 C
  76. char *dmabufdest2 = NULL;
    & S/ w) ~; a! ~7 Q

  77. + C+ m* n* \8 Z( ?% o" ]0 V1 \
  78. static int acnt = 512;  M% A. ?" _+ v4 n( C* @/ y, S! i
  79. static int bcnt = 8;
    ! }0 S: J7 `6 h, L. }+ h( c( C- C
  80. static int ccnt = 8;
    + B9 V  |! N9 l: q8 ]

  81. 9 Q. \/ [, W) X' _
  82. module_param(acnt, int, S_IRUGO);) F+ ?* }% ]) L+ e  T
  83. module_param(bcnt, int, S_IRUGO);
    : S/ M: B- O: b5 K* n  k1 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 y! i# {! Z* A* q3 c. d
' |) G$ T; i! q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) a* T5 n) z9 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( r( T2 \4 p, V$ C; O, z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; X( _( w/ |4 Y; j; d. J- s+ {6 p# f  _! x

/ x# w* W1 e3 f8 S- f& u2 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-13 16:57 , Processed in 0.041474 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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