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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - T: A. n: l- n4 t) @
  1. [code]EDMA sample test application
    5 }, t) y# ~' [. `* z+ j
  2. /*
    $ X3 V3 ?5 h5 R; t# O2 F* e1 R4 f
  3. * edma_test.c
    - t$ T) M: T2 _" t' [. P* \
  4. *1 o$ |3 @) `! i# z( R& A
  5. * brief  EDMA3 Test Application
    - y/ |$ x6 z7 t/ n' S! j' `8 g  R
  6. *
    5 Z6 {, @( R6 n, M. O
  7. *   This file contains EDMA3 Test code.
    * f6 f- O# Z2 a8 v3 e% v4 E) V- b, T
  8. *1 A  f+ @  W# p0 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, y9 U% Y7 m4 Y- b+ z# ?3 G) G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 c7 _0 U/ L& U6 H7 V- A0 b
  11. *         TO CHANGE.
    / W* @9 h7 X7 {  T. d: @' m4 T) p, X
  12. *
    " a* w' t$ g2 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ h* U( C# d5 g7 q5 K
  14. *
    ) I5 D( L6 L& Z6 W9 M5 I
  15. * This program is free software; you can redistribute it and/or+ _$ t5 E% }7 v( R/ v
  16. * modify it under the terms of the GNU General Public License as1 p! H! R5 K! {$ m9 @
  17. * published by the Free Software Foundation version 2." C, O& t  H0 Y0 v0 |, {1 U; Y
  18. *, T0 ^6 h* R, _+ s) e+ m# S) a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( O; E5 E1 W* u& r) i
  20. * kind, whether express or implied; without even the implied warranty# T1 l& `2 T% H( r+ ]0 j+ b: V- p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 e( }( C" |; t$ S, @
  22. * GNU General Public License for more details., O, @! X4 A( g( \* n2 Y
  23. */! \* H" B6 E# h
  24. 4 Q2 k' Q, I4 Y1 n9 Y& U1 \
  25. #include <linux/module.h>& R' T" E1 d. Y2 @
  26. #include <linux/init.h>
    4 P! F2 F1 @6 {
  27. #include <linux/errno.h>; o* m, u3 L7 `) o+ e
  28. #include <linux/types.h>$ m" v0 A" `. D, r! P9 _: H
  29. #include <linux/interrupt.h>& u" Q8 V. K) }/ i0 \7 V' j
  30. #include <asm/io.h>; k% [, k: U- K
  31. #include <linux/moduleparam.h>
    " c, |1 e! d  G/ L; R$ D
  32. #include <linux/sysctl.h>- _0 [1 h6 d9 l3 V, h
  33. #include <linux/mm.h>, N% P- ?% F/ I9 k3 x& e
  34. #include <linux/dma-mapping.h>
    & w* N7 {; a' R7 [, P

  35. % B8 H/ Y+ R* C& a
  36. #include <mach/memory.h>  a  D3 H3 j3 a, b# F9 R
  37. #include <mach/hardware.h>7 K: V, P* r* l1 U* T
  38. #include <mach/irqs.h>
    6 H- E% |$ l% H  x/ B
  39. #include <asm/hardware/edma.h>! e& I, R/ I* s$ y2 g9 p& y+ \! H( h
  40. 4 x1 ?0 }- `5 P
  41. #undef EDMA3_DEBUG+ ~: _5 r: D; U! e
  42. /*#define EDMA3_DEBUG*// l- i9 a  `5 s3 o- h+ w* v

  43. 8 d. d! ^  x9 Q, U/ [6 F: P
  44. #ifdef EDMA3_DEBUG
    * u$ u* s* h/ J2 w5 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 V. t& P9 L. V: ?# Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 |, @* z. X3 d: e# ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" H+ U( X8 t; a' |/ j
  48. #else
    3 {( Q1 P! @5 _
  49. #define DMA_PRINTK( x... )/ M% u/ o1 V0 ?5 @$ q
  50. #define DMA_FN_IN. j8 a2 z) f3 d( Q5 c# ^
  51. #define DMA_FN_OUT
    3 t. u$ [9 }. x2 |# \. G, P
  52. #endif
    1 R7 x5 ^' B8 R
  53. : d0 N$ ^: M# q( b7 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ \% D7 ?! Q  E( {' U! d
  55. #define STATIC_SHIFT                31 |2 A- ^- E6 M4 b. Y
  56. #define TCINTEN_SHIFT               20  d% N$ s1 l- D
  57. #define ITCINTEN_SHIFT              21
    , V+ [: K8 @% E* ^' v
  58. #define TCCHEN_SHIFT                220 l9 v! g: f  ?- Z. V
  59. #define ITCCHEN_SHIFT               23  ]- X/ O4 F0 {
  60. 0 u* A# i& h% F) j7 p/ `
  61. static volatile int irqraised1 = 0;
      w; p& O+ y1 n2 Y) p
  62. static volatile int irqraised2 = 0;+ `# l/ y" r) q( n4 |6 v

  63. ) ?- w% X& @$ ^& N6 ^( T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e) E1 ]# [: n- d9 V7 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 `; U* n* c7 k/ ~- ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' E" X+ v8 s  Z% ^$ Z( O" m
  67. 7 u3 S8 A* B7 q2 ]7 c
  68. dma_addr_t dmaphyssrc1 = 0;
    % l4 D. a; }% \& f& b
  69. dma_addr_t dmaphyssrc2 = 0;- F0 `9 f2 D# Y; C
  70. dma_addr_t dmaphysdest1 = 0;
    7 y  U8 a  f$ `5 d7 C
  71. dma_addr_t dmaphysdest2 = 0;
    5 r  C- [7 z3 A; {" J

  72. # t8 A7 F. V0 {3 x7 ~- F
  73. char *dmabufsrc1 = NULL;
    5 \5 g% i! a; k6 U, I! Y4 x
  74. char *dmabufsrc2 = NULL;
    " L! H( f' T: i2 h0 |. f; e; p
  75. char *dmabufdest1 = NULL;
    + Z* ^2 E6 M8 W# z
  76. char *dmabufdest2 = NULL;$ j* R" ]3 @9 f' C: I

  77. " u3 c( ~2 F7 h
  78. static int acnt = 512;
    5 c2 ]2 A2 R, x% P" j
  79. static int bcnt = 8;& u6 r5 C3 S, w! U/ Q8 t
  80. static int ccnt = 8;! J( ^) a( C$ c3 _: p2 F8 n
  81. 6 ^! G* T3 `6 k* z  @$ V8 A
  82. module_param(acnt, int, S_IRUGO);
    9 O" k3 \* k% J' W/ E
  83. module_param(bcnt, int, S_IRUGO);
    : W. Q8 \1 V8 O1 M) W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' n6 f4 X. m9 `5 m, M  k# L3 e( W
. U; s/ ?* W. T" @) x1 I4 |2 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 L) `7 [- `$ w6 \/ s4 ^( darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ c. c# i- U6 @; c* n5 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" G, ^, U* ]  _/ h& A) V) p1 R: \

. Y% l6 z3 {* a8 o5 ]5 j  ]
+ b" b5 P5 X0 v- D& l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 17:06 , Processed in 0.036614 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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