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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , D3 ]! e4 L& `# B
  1. [code]EDMA sample test application
    ! G/ G5 s1 O0 w2 I3 \
  2. /*; J8 L% U6 D7 G$ }" m
  3. * edma_test.c3 I' {9 o2 w- h- d2 d2 B, P' R% ^3 o+ ~
  4. *
    . {; P: n: v' [6 W" x! t0 G" E/ K! o
  5. * brief  EDMA3 Test Application% L- _8 k9 s4 {3 G7 K
  6. *
    $ z& x: f2 h  {/ M& N
  7. *   This file contains EDMA3 Test code.
    * {" O5 b  z+ ]0 n5 U# J
  8. *
    ; C% W( @2 D5 @, ^+ d! C! {  o1 C9 X* i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - L; d# d+ M0 ~* H4 P2 P! c/ e+ q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / y! U5 X: a0 [  [" u8 ~( S
  11. *         TO CHANGE.1 _- J/ U9 E% W/ ]
  12. *
    4 h, ~0 i. A  R& k' L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & n+ t# E/ \: r, D# l, w9 X+ u
  14. *
    3 B3 o. `6 o& ?; S
  15. * This program is free software; you can redistribute it and/or7 `, z  j: u3 X8 H1 B0 T9 x
  16. * modify it under the terms of the GNU General Public License as0 z+ y4 Z6 o8 V; x! S- |* [
  17. * published by the Free Software Foundation version 2.! |1 {6 Y+ ]' T, ]4 {+ ?
  18. *
    # s/ a$ L. R, D6 C/ I0 d) R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( b7 R* y7 T2 Z' {- F# D9 g) F2 H, N
  20. * kind, whether express or implied; without even the implied warranty
    , e8 D+ J% z& p  j- g0 V" K: \/ G) z+ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 q2 l5 J9 Z0 g/ L7 O8 ]
  22. * GNU General Public License for more details.
    8 @5 k6 X: r9 f& M) Y- _* e$ J
  23. */
    6 h( B7 a2 c& G8 V" `2 s
  24. + D7 e5 x' S1 O# A
  25. #include <linux/module.h>& d, W& v/ A0 d9 [. P! l4 i) o
  26. #include <linux/init.h>
    . ?' m' y+ c& Q& ]% r6 z; b1 `, e
  27. #include <linux/errno.h>' U$ j3 i% n" c0 @9 K& H/ J
  28. #include <linux/types.h>
    / h" t6 v7 K& P! N
  29. #include <linux/interrupt.h>, z0 J5 s) G2 k9 E% Y) L
  30. #include <asm/io.h>" K9 [' _: U* W8 N; i9 m) `
  31. #include <linux/moduleparam.h>6 j$ Y1 }9 ]  q; R2 N
  32. #include <linux/sysctl.h>& f0 E8 v; H/ o+ L# e3 ~
  33. #include <linux/mm.h>0 L" L5 a' P1 H. W/ A
  34. #include <linux/dma-mapping.h>- C3 ~' g3 _% S6 c6 j  R8 l* D  x
  35. & g  ^( l& B  G2 [" s
  36. #include <mach/memory.h>
    0 C& ~0 w0 u7 z6 X$ T
  37. #include <mach/hardware.h>
    ( P2 n9 Z; O: D* D) A$ `
  38. #include <mach/irqs.h>" ~/ n' l# i" [- l5 w6 V4 k+ r
  39. #include <asm/hardware/edma.h>
    " C# n( T; }' `4 x1 R

  40. ( t  Q3 U2 `& ]' r, D2 ^" \
  41. #undef EDMA3_DEBUG
    7 o0 B" ]( M( B" ~% f
  42. /*#define EDMA3_DEBUG*/
    . ?. L" j  @( l4 u7 D
  43. 8 x* `0 m& C$ S& ?8 F- [; e% Y" F
  44. #ifdef EDMA3_DEBUG5 A6 _* S9 I: J4 C# x. {9 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % {3 r! {3 T6 s1 A& j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). {, o0 h' a# j4 d: H5 T0 R& I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # g8 w7 P$ u6 q5 m5 r9 k
  48. #else  v0 `- O* Q. i9 Q
  49. #define DMA_PRINTK( x... )) S7 ~* Q9 |$ W) d+ G  |  A6 m: e' l
  50. #define DMA_FN_IN  n/ ?* r1 U$ w4 ^* ^+ C
  51. #define DMA_FN_OUT
    : s7 q" b2 U5 s) R2 ^
  52. #endif
    ( j9 \1 y. V4 v" s0 x: u

  53. ( J7 o/ w5 S7 h7 A# P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), k* p! t0 q  D. @8 l% l
  55. #define STATIC_SHIFT                3  ]* F; x) L. S# J$ P2 f! f
  56. #define TCINTEN_SHIFT               20/ y/ V& }, j1 s  g( U
  57. #define ITCINTEN_SHIFT              21
    , O$ L9 t* \) M& E: ?; [: T
  58. #define TCCHEN_SHIFT                22
    9 U0 e' L! X4 {, f- ~( l
  59. #define ITCCHEN_SHIFT               232 C, A. I; R: G3 A

  60. " Q* R/ |; ~& s' b3 k5 X; X, M
  61. static volatile int irqraised1 = 0;* ?2 {( Q" ]& t
  62. static volatile int irqraised2 = 0;
    , z. A* ?* _( i* ?& p
  63. & h) O) u( r6 e) u- A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K& G1 E5 t' V' I: q" q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 B9 l9 M0 T+ @  g4 c' G$ M$ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , P4 {) m- r4 z& R3 j( m
  67. ( V3 @! P1 R/ e; ?( Q- a, {
  68. dma_addr_t dmaphyssrc1 = 0;2 A2 T: n& I( {8 N4 [
  69. dma_addr_t dmaphyssrc2 = 0;! N9 A( g" P4 x# {' Q% D3 H
  70. dma_addr_t dmaphysdest1 = 0;
    ( `5 f' u! a0 ~
  71. dma_addr_t dmaphysdest2 = 0;
    * c0 {' m9 R2 k* B2 k7 i- Z7 T
  72. / p! J8 l5 J2 [8 Q7 R9 @' ^
  73. char *dmabufsrc1 = NULL;
    9 E1 w2 {( ?2 n( h" u. _0 @# c9 \) x
  74. char *dmabufsrc2 = NULL;
    ) C/ x+ _9 }- O3 m% B; B
  75. char *dmabufdest1 = NULL;
    # o  `3 W: t  A& D  J# j- I
  76. char *dmabufdest2 = NULL;  s" A6 |* z0 i1 z

  77. , S0 j: ^- n4 X6 W8 f3 c
  78. static int acnt = 512;' r  o: l, @, S( ^+ C$ F. ?
  79. static int bcnt = 8;
    ; y9 E$ H" w( J; B8 n9 Y8 X1 W
  80. static int ccnt = 8;7 n( Q9 i  W: H/ s( `7 [
  81. " w( }, j- Y5 |! Q" L
  82. module_param(acnt, int, S_IRUGO);6 B1 _1 W% |* T+ m& ]1 m# m1 u
  83. module_param(bcnt, int, S_IRUGO);
    1 A: l1 _0 Z9 S; l# k  o& X; g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" J+ Q- E7 I. p. H' J$ v
7 G- u% p" j. a" V; L* J5 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Z+ T4 u8 g( @, h6 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- V/ w+ f: y; O4 d( b" u3 M9 N* S5 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 X$ H* s7 A3 h1 b: s; X0 W+ C
2 h- _9 F# P/ p& ?* ?) G# N% S, T0 a' M5 }, i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 08:24 , Processed in 0.040407 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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