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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 R0 d4 X& S8 U! [( }# v4 L  d
  1. [code]EDMA sample test application0 H+ k# a5 s7 L+ S6 m
  2. /*
    * M- |) P/ E1 V1 \5 z3 E9 L
  3. * edma_test.c
    : E+ X* K, g4 G/ [' s
  4. *5 d' A# T  C, P5 I# A: U" Y
  5. * brief  EDMA3 Test Application8 _1 q7 F) p( [) g: M; K) u
  6. *$ U) f! C2 I: s, g  U& I. p
  7. *   This file contains EDMA3 Test code.# a8 c  D) _  l9 h- F! e
  8. *! ?4 @7 w! h+ [* N7 _# x* {% r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) h& _# H; H+ _% Y9 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ M& k1 d/ W* K  O
  11. *         TO CHANGE.
    / O) A4 y% N" U
  12. *
    + i; ^1 A" T) {' m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 D- G* @* _" o! c4 r
  14. *
    8 F7 {% v) E) z6 i* R
  15. * This program is free software; you can redistribute it and/or7 n9 u, v6 _3 V. C# ]! t
  16. * modify it under the terms of the GNU General Public License as9 k" _1 C3 n- c! ~! O, F
  17. * published by the Free Software Foundation version 2.
    % l' K, I' B# w! i# c" V' F
  18. *
    + J$ Y  u8 Q( ^3 C, Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - [$ w+ V; X0 F! P* g
  20. * kind, whether express or implied; without even the implied warranty# k! Y' O/ C* e) x0 d/ F1 h2 a1 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 X5 c! @) j; c
  22. * GNU General Public License for more details.
    : u' e9 L  ]+ ?5 h9 M
  23. */
    7 b# }( v/ j. `8 i4 M. N
  24. % m; g" _* ~! m8 t& D1 C' p% y& E
  25. #include <linux/module.h>3 K% T* u5 K9 I, e0 I
  26. #include <linux/init.h>$ M2 Z) `% g: W& y) m' t
  27. #include <linux/errno.h>
    " D+ {2 U; m. ?/ x
  28. #include <linux/types.h>3 l- V; N& P" r. F
  29. #include <linux/interrupt.h>. |* U4 @$ W- X; v+ B" q+ a
  30. #include <asm/io.h>6 ?. ^6 e; w, \9 \4 o$ s* t
  31. #include <linux/moduleparam.h>
    : `3 }( x8 J/ p5 X
  32. #include <linux/sysctl.h>) x, f7 }5 q, u' q
  33. #include <linux/mm.h>
    - e- K0 S# u/ |' |$ W+ \
  34. #include <linux/dma-mapping.h>/ c7 z; W0 [4 k; }- F
  35. + W+ w- A+ N% ]' {1 @3 Y
  36. #include <mach/memory.h>
    2 S& [' `. a. X4 u* h& w
  37. #include <mach/hardware.h>3 P: u* Q$ l$ _
  38. #include <mach/irqs.h>
    8 O& A/ j- ?) k) e
  39. #include <asm/hardware/edma.h>% b. `9 Q0 P* S. f% Q- f% E* a- Y

  40. 9 X  ~4 D; f: j+ R7 g$ S
  41. #undef EDMA3_DEBUG& Z1 \6 z  m6 d# u+ ~- z
  42. /*#define EDMA3_DEBUG*/5 U1 T% A7 g% H/ L$ e
  43. " P, |/ [/ q3 [6 L# T  L8 S
  44. #ifdef EDMA3_DEBUG
    9 k3 J: _% E* `6 S8 O9 j: L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  L4 X, m& E3 n4 U+ x- h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , T+ j1 N6 e; {* q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . P: i( {# o% B. ?$ h
  48. #else
    ) f/ o9 ~  s6 l$ w$ e4 @
  49. #define DMA_PRINTK( x... )  U/ h# r7 x& t3 g0 @* O
  50. #define DMA_FN_IN+ t7 n0 f! G3 E; S  E' ^
  51. #define DMA_FN_OUT( N8 I# B9 j& G* J. f9 J* P; f
  52. #endif  L7 F* H# E0 t" R. Q! g! j7 ]
  53.   {4 T2 b+ }- L. a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# @, G! t8 O/ E2 q
  55. #define STATIC_SHIFT                38 ]0 M) ?' L# I4 u
  56. #define TCINTEN_SHIFT               20
    2 {/ z& j; e/ _/ D2 x
  57. #define ITCINTEN_SHIFT              21$ x! D( X! ^: ~4 T2 U1 V0 P( N% l
  58. #define TCCHEN_SHIFT                22
    ' P$ X3 y$ C, c( Z3 S& V. L3 ^
  59. #define ITCCHEN_SHIFT               23& N% C; ?+ o; k& i7 l0 ^$ b6 }- _

  60. 3 X  j% h2 ]) T+ @/ o* ]
  61. static volatile int irqraised1 = 0;
    ; `% U8 r- Q; b8 M! u+ u- Q
  62. static volatile int irqraised2 = 0;4 O; r) F7 |, `7 ~% O5 U7 ]
  63. $ i* b. ]3 X- K" t, s' y, L9 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) E. K2 J2 F, v/ A  T: H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ P, r# A$ }) L8 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J2 M  W! G# w& `, a2 C- L

  67. 6 s8 K, ]7 ^$ {$ d' |# w8 L
  68. dma_addr_t dmaphyssrc1 = 0;
    5 u( X# W7 w2 Z3 n1 n1 B
  69. dma_addr_t dmaphyssrc2 = 0;5 k: U( }! h/ y
  70. dma_addr_t dmaphysdest1 = 0;4 }# R8 y. R, }, w; q7 E6 r. c, }
  71. dma_addr_t dmaphysdest2 = 0;/ V8 v0 `+ J7 N+ ]0 N

  72. 8 i5 o7 Z# P, t+ p- J" M
  73. char *dmabufsrc1 = NULL;
    ( U8 ~5 W* A8 p9 l4 V& ~; ^7 ~% |
  74. char *dmabufsrc2 = NULL;
    9 U) N% |8 s1 G4 v' F) h: E% ~
  75. char *dmabufdest1 = NULL;+ F; q0 D8 P3 l9 ^
  76. char *dmabufdest2 = NULL;
    9 Z5 @3 s! F! i% t
  77. ; v2 s- q* G5 G6 v; r8 _2 d
  78. static int acnt = 512;% m3 n/ \1 x. U: |% O- }  T7 S
  79. static int bcnt = 8;; [5 x: |5 @* G
  80. static int ccnt = 8;" c* q1 o) Q2 L8 n( T
  81. 5 u. k* O$ R1 j/ u7 K
  82. module_param(acnt, int, S_IRUGO);
    % z, ^4 ~! X; A9 H6 g- @# n
  83. module_param(bcnt, int, S_IRUGO);
    6 p/ h% _* @0 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) l+ \, q$ s9 W/ E+ _7 g) ^4 g5 y- s# P- [6 n: Z+ i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( @, |. n% F& s1 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" B/ |0 C, n0 N$ _0 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Y# a1 n. `9 `  i0 n
& H7 K6 v2 h* y
$ Z; I6 x# l7 [( S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 20:34 , Processed in 0.038256 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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