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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( E- `2 x$ }- v. K2 V+ `
  1. [code]EDMA sample test application
    + I7 E2 o) c' N' I& g, w% @
  2. /*
    # E- w4 M0 K9 Y7 [6 B# P, S) J
  3. * edma_test.c
    * ?( Y* p, S% L, e0 H: @/ O
  4. *
    / u  L, J; O# \/ l! q$ ~* Z
  5. * brief  EDMA3 Test Application" R, r: t/ \3 J. T; C, M; x
  6. *
    . s$ ^6 f8 Q3 J- Y  Y! F* }
  7. *   This file contains EDMA3 Test code.. x9 k' K0 q, c' c7 N1 v+ x# {
  8. *' [& t+ K- Y7 n% _3 {7 `3 F2 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: P& b0 u( G3 g. ~, [1 E3 j" \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 [1 R* ]) [- }% e; O4 l
  11. *         TO CHANGE.
    - c. E; \, L0 ^
  12. *0 p; L; h* Z/ i4 P6 w; k, ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " n: U+ c7 T4 F% R! P* `) o
  14. *
    & Z" D0 }! n; e) @. I
  15. * This program is free software; you can redistribute it and/or
    & _: x7 L3 u5 N. O+ H' x
  16. * modify it under the terms of the GNU General Public License as
    3 {& V1 ^3 B0 t1 t
  17. * published by the Free Software Foundation version 2.
    8 a$ `6 B& e$ _2 l
  18. *
    2 P/ |8 w, `  Y: _) _- q2 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, {* I9 c/ F* J/ t+ v" ~1 b/ O
  20. * kind, whether express or implied; without even the implied warranty
    / _; q  S, f9 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ n* r+ x* r7 E! G
  22. * GNU General Public License for more details.  [. I& _0 d* d. I; `1 Q
  23. */
    7 J/ l. P( l* D
  24. 1 o0 ~5 S( _$ k. n$ b# f
  25. #include <linux/module.h>
    ) P- h: I- |& X6 o6 S9 a
  26. #include <linux/init.h>
    0 K$ Y4 P4 Y% |" A$ P; c4 }8 u: T
  27. #include <linux/errno.h># X" Y2 z" B; l- ?
  28. #include <linux/types.h>' A: A5 y# ], D* y" `
  29. #include <linux/interrupt.h>
    ! a: o$ \$ s1 B0 S; {
  30. #include <asm/io.h>
    ! p' S- G$ f: B. m
  31. #include <linux/moduleparam.h>
    ( g; e4 j- }0 Q' d) d
  32. #include <linux/sysctl.h>
    / y' J; V; }- z5 ^  g) B
  33. #include <linux/mm.h>
    : l" j3 ~4 }  z+ `; {: O
  34. #include <linux/dma-mapping.h>
    " k2 G5 O+ ^; n6 g

  35. ) u' c5 d/ C% z) C7 C
  36. #include <mach/memory.h>
    / {6 b; p* [+ q- x+ D, ]/ [5 w3 ^
  37. #include <mach/hardware.h>
    # s# D" a/ X2 G  D% o9 n
  38. #include <mach/irqs.h>  ^4 `% D; i0 D# _) w
  39. #include <asm/hardware/edma.h>
    3 `8 X; }2 U6 h7 ]+ T9 M6 P

  40. ; z" v% o" {+ ~+ ~3 b# I9 z- r
  41. #undef EDMA3_DEBUG: A3 q5 Y( X' l9 B2 I
  42. /*#define EDMA3_DEBUG*/- {: b# ^! }4 h5 I' s/ F
  43. % {; j6 Q7 z! u* p; Y! b* [
  44. #ifdef EDMA3_DEBUG( ^* z: _5 ?( n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) b8 r2 S! i0 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 F* g. s& `& e* f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" {0 @% s( {' t6 h1 h1 s  r7 b
  48. #else
    / \: i/ L* i1 w2 ~% X
  49. #define DMA_PRINTK( x... )
    & f: K" \% V1 v6 \$ [- T
  50. #define DMA_FN_IN
    * g1 L7 [/ L! J
  51. #define DMA_FN_OUT7 t- ?. A. M! f9 E- t
  52. #endif
    + i5 I& N) J3 m& i8 W( k3 T
  53. * ^9 T. C9 @6 h( P( ?. T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 R3 i2 H1 U2 _& z
  55. #define STATIC_SHIFT                3
    % o7 I4 P, T6 Z6 l4 y+ U
  56. #define TCINTEN_SHIFT               200 V' L0 |, _+ c) ]2 @
  57. #define ITCINTEN_SHIFT              21) e5 @0 {3 r% C8 o5 X0 E2 T' c
  58. #define TCCHEN_SHIFT                22
      }/ |6 E- ]$ Y. V  Z! s9 r/ f
  59. #define ITCCHEN_SHIFT               23( K6 G# }' v; P0 A7 y
  60.   e' [( F, J; P( ^
  61. static volatile int irqraised1 = 0;
    % V; K: e$ S8 z( V) y3 t
  62. static volatile int irqraised2 = 0;+ S( H* l6 Z- g$ T/ _

  63. " T  g0 g0 B) p6 h# |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " F4 `7 }% p3 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q& b' N0 m$ Q8 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W& f" n# U# L; g9 ^: {
  67. ( r* g- p/ z# {' U  X' ~( N3 q9 f
  68. dma_addr_t dmaphyssrc1 = 0;- N0 n" v/ O6 n6 X
  69. dma_addr_t dmaphyssrc2 = 0;5 p4 k& a5 [4 h# g5 p( _! {
  70. dma_addr_t dmaphysdest1 = 0;
    2 E, r5 d/ P) E5 {4 I# i
  71. dma_addr_t dmaphysdest2 = 0;
    ; k& I! R; G& g' v, S0 ?- s
  72. - z0 ]; I2 f: \* z' c$ G
  73. char *dmabufsrc1 = NULL;* n7 F7 r- E/ s: u. D
  74. char *dmabufsrc2 = NULL;
    8 V& G8 [+ P9 |7 V) }: P
  75. char *dmabufdest1 = NULL;/ P+ e" U& @( W0 ]3 h0 ]
  76. char *dmabufdest2 = NULL;/ r5 s' B9 Z; R& Z7 c
  77. 9 y4 Q+ H  y$ L+ j, B
  78. static int acnt = 512;
    6 F& A2 t  s4 |6 W
  79. static int bcnt = 8;
    , r3 N# b7 K1 J9 A  b& I
  80. static int ccnt = 8;3 w% [2 z* m+ C6 t7 |

  81. ! f2 G+ q% ]+ x& R
  82. module_param(acnt, int, S_IRUGO);
    " d# a6 w- i: L3 M7 w
  83. module_param(bcnt, int, S_IRUGO);
    ! x, k1 k8 I6 h+ o  X( c$ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& M" A5 {" k* X, y8 @
( A2 B# e+ Z7 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 {. J% ~( m7 r, y( y6 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 M- K: O4 @# f3 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  ]7 _+ U) T) u
4 V9 d: A4 x: Y7 F/ r8 s

5 w! U) p+ `: k; ?( h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 10:58 , Processed in 0.036217 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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