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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ~$ D4 E: i# E
  1. [code]EDMA sample test application
    + n. Z7 D, t) c
  2. /*
    * V  D2 {2 s) U. \  z
  3. * edma_test.c
    3 R1 T! u2 D2 `* V7 j; Z
  4. *
    . F/ _7 b! a" S* p! O; s2 n& m/ ]6 ~: [
  5. * brief  EDMA3 Test Application: j6 ^7 k$ J7 x
  6. *
    / v. X  b  \4 P; `
  7. *   This file contains EDMA3 Test code.% Q7 f/ W5 V! ^: U' B
  8. *
    8 W# u2 j; ]+ M& s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Y3 X: U0 n! ?1 l' X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % y/ A% _2 I* c: V+ E: a' c8 {' W
  11. *         TO CHANGE.8 l% P3 G1 r4 I0 C
  12. *0 M# L. b0 O7 k4 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 G- }* c) J) _# r* F* @1 I
  14. *
    & u% P* v+ p7 l% [) k
  15. * This program is free software; you can redistribute it and/or
    & j: p% q6 e& l) e
  16. * modify it under the terms of the GNU General Public License as) s1 |- U3 N1 {2 v0 c
  17. * published by the Free Software Foundation version 2.
    3 {. i6 b- u: L" y8 \: A
  18. *% \' h; s& Z7 n  {2 ]; X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Q% d& B7 \6 p" f
  20. * kind, whether express or implied; without even the implied warranty0 E8 \. ~  Q( C- c* w! A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) a( q* {- E0 d& c2 `
  22. * GNU General Public License for more details., \( {! I2 l) v2 x7 q
  23. */
    6 k, ?" R: V% a2 N5 |

  24. # E4 F' Z, W- }: U5 }% r) f
  25. #include <linux/module.h>
    , U+ M4 e; ?, ~
  26. #include <linux/init.h>0 @$ C' `! Z/ c& n. _6 Q
  27. #include <linux/errno.h>3 u6 s4 @: d5 z
  28. #include <linux/types.h>
    $ z: A: p) a. k1 _: M/ c% I5 r
  29. #include <linux/interrupt.h>
    0 J1 u1 Z! z/ Z5 c1 o
  30. #include <asm/io.h>; k) L" [. d7 m
  31. #include <linux/moduleparam.h>5 }9 X) ~% a2 A; {; {- z5 R
  32. #include <linux/sysctl.h>
    5 T5 }+ D' e* u8 C
  33. #include <linux/mm.h>4 |5 |( Z! Q( ]; I9 l
  34. #include <linux/dma-mapping.h>  O6 i% i- n' C/ r+ X

  35. 9 N$ L  Y2 |6 M9 Y! j* @- z
  36. #include <mach/memory.h>/ m. T/ }( a" g; z# W3 X" Q# W" [8 c
  37. #include <mach/hardware.h>; s9 |( J$ a. |/ n( t0 I
  38. #include <mach/irqs.h>! D% d: Z1 T+ y0 c+ R+ X/ Z5 S8 L
  39. #include <asm/hardware/edma.h>% u" T- e  e; p( a
  40. - t( f: o: y) B% f) j8 j2 s1 l
  41. #undef EDMA3_DEBUG( s1 M8 ?5 X8 F. }% u5 f
  42. /*#define EDMA3_DEBUG*/) e  g2 P7 B. Z" c9 S6 I$ C

  43. ; D0 t2 J$ \5 x
  44. #ifdef EDMA3_DEBUG8 l! e1 s/ p  H- _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). r0 _* y: P$ ~. ]0 P! u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , a( [$ I4 [# W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # c5 {6 c; P$ N2 Z5 t
  48. #else4 j9 g" }& n3 o
  49. #define DMA_PRINTK( x... ): B) u( n! |* I. J( u
  50. #define DMA_FN_IN1 H- l2 C3 B; v8 n* p- F
  51. #define DMA_FN_OUT1 f' U9 [0 c. p+ I9 k* [3 m* ]
  52. #endif- h- L( S2 w* ]
  53. , ^9 P* |/ W% r! Q9 A# e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * G  M: L3 d' m# O2 E- B1 P; t
  55. #define STATIC_SHIFT                3" {1 `1 k- x* `# S. E7 _
  56. #define TCINTEN_SHIFT               20  {" a* I. D! ~) e7 O% i7 h0 A
  57. #define ITCINTEN_SHIFT              219 J2 x- U+ A: V6 E3 v; G% N: ^1 ]# G
  58. #define TCCHEN_SHIFT                22
    . }8 f6 }0 u$ V% C9 t# Q
  59. #define ITCCHEN_SHIFT               23( B* j+ {- F( Q. X
  60. 1 [' r7 O& {/ `& c$ a0 _) a; z7 n
  61. static volatile int irqraised1 = 0;8 A! _% ]# c7 g
  62. static volatile int irqraised2 = 0;5 [! n2 a; X4 R0 e

  63. 5 N& B. R. e6 s/ m- X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; o$ u; {1 w8 B0 K; q) o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* D( T5 B3 O2 G% `8 v: ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ k5 B9 Q* Y- R% Q  L

  67. 3 I$ k& ~  p% F
  68. dma_addr_t dmaphyssrc1 = 0;6 ~" j) @; x) a0 e# l8 d
  69. dma_addr_t dmaphyssrc2 = 0;
    : Q; i% S: w4 i$ D( H5 m
  70. dma_addr_t dmaphysdest1 = 0;6 Q( h* |  |. ^
  71. dma_addr_t dmaphysdest2 = 0;
    3 |* r8 D0 N! |" u
  72. 5 N. s5 M0 {% {* {% k% E. X
  73. char *dmabufsrc1 = NULL;, X" x5 z8 B7 i0 w& V( v# ?: f
  74. char *dmabufsrc2 = NULL;+ c3 R! a/ I4 I1 U& h
  75. char *dmabufdest1 = NULL;2 o2 w+ @8 }+ M- A
  76. char *dmabufdest2 = NULL;
    - \' ]6 K" W1 t

  77. 1 P4 @' G! M* ~0 O2 w
  78. static int acnt = 512;
    9 H0 N: }- @9 G
  79. static int bcnt = 8;
    ) g2 ~- s8 K$ l8 E$ U
  80. static int ccnt = 8;
    ! ~, [& g/ |* p; |5 b

  81. . X% ^8 ?+ u) Q# w$ a! t
  82. module_param(acnt, int, S_IRUGO);& {* u. p/ r' K( B4 d
  83. module_param(bcnt, int, S_IRUGO);
    5 O( ?5 i9 o- K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, \$ @2 Z) q2 w
$ o, f$ u5 R0 M( {$ m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 |. y6 T8 w. D6 P, Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 F9 z* u+ Y) X' W0 i# `: N% V( x4 }# f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- R$ S1 F9 A  M2 Z  q3 `, \/ {, U
5 k4 `* ?% v8 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-17 06:57 , Processed in 0.039911 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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