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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 J+ c0 R" x2 S
  1. [code]EDMA sample test application) a: A' r5 k- h. G, ~& \# F) D
  2. /*4 k1 b3 E$ p1 W( ]0 Q2 F
  3. * edma_test.c
    ! K, g9 ^3 _" T, E' L
  4. *
    3 r; L6 D5 b5 D- {4 }5 N
  5. * brief  EDMA3 Test Application' A" C  ^0 `  @* H7 X5 k4 r9 F
  6. *
    ) D; b$ q9 Z! R9 A4 b
  7. *   This file contains EDMA3 Test code.6 a1 B. r( x4 x. d) T4 ?& _
  8. *
    - v0 `9 V6 }: w1 b  n0 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & B9 z& u9 f. ]+ T$ K4 N  w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 [  ]" K- D, n, F7 C7 [8 K# S
  11. *         TO CHANGE.: P) Y2 P  X1 G% E- u) m+ r/ w
  12. *
    * K7 N5 J5 P7 ]* m5 G4 V' X8 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & F1 g2 v( K+ w9 r; T0 x7 B0 u4 a
  14. *, T  w! P' q8 J( Q& c' d
  15. * This program is free software; you can redistribute it and/or
    1 Z: J' `+ ?) `8 y; |) _
  16. * modify it under the terms of the GNU General Public License as3 K# ]# R& v' l; k" S6 Q7 s* q
  17. * published by the Free Software Foundation version 2.9 i, j  `/ F- m4 t" J! k
  18. *% k, H0 n7 l- l* T; G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  j* {. ^' I/ @5 C! ^" q( n
  20. * kind, whether express or implied; without even the implied warranty+ \7 N* v7 K- |' Y* o7 U& c. z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . W5 I' O8 ^+ L! Q: F  Y
  22. * GNU General Public License for more details.2 v. p+ b3 l' e! K3 Z: P. t* S% s9 U
  23. */& m  S$ g: [, G

  24.   c1 x, |; ^1 o& g( g1 h: d, I
  25. #include <linux/module.h>
    ) S1 m4 q# |* E0 p0 C
  26. #include <linux/init.h>
    $ e; r/ _9 `% z: x
  27. #include <linux/errno.h>( d, W: [# W- M- K* V
  28. #include <linux/types.h>* M3 b: q! K1 ~" N0 q4 A( |
  29. #include <linux/interrupt.h>7 w' P' m' r+ l% C8 n
  30. #include <asm/io.h>
    " Q- S% z  q/ h7 q; n2 E) V
  31. #include <linux/moduleparam.h>
    / u5 v# O8 @( _8 A
  32. #include <linux/sysctl.h>
    8 L* O9 s$ O3 ^: v
  33. #include <linux/mm.h>- s$ _. z) ]3 l' ]. `9 |
  34. #include <linux/dma-mapping.h>7 x* v+ u  `: N% I2 H

  35. - \+ b( p& }( f$ q5 g8 V
  36. #include <mach/memory.h>
    ! O6 ]" q7 L+ S5 I: G. G# s
  37. #include <mach/hardware.h>
    1 |$ e8 K7 Z: m9 _) f2 L! j4 _
  38. #include <mach/irqs.h>4 |# a! ^# _9 t  j* I
  39. #include <asm/hardware/edma.h>
    : q* E" I- k' Y) s4 w# O( ~' ?0 v
  40. : l4 L- m/ C% Z3 R% k4 ^- S# U  T
  41. #undef EDMA3_DEBUG* G( `# q) P& |( ?/ t0 G
  42. /*#define EDMA3_DEBUG*/  z# I. G& p* K' ?

  43. : W+ C- w; ~5 f  r* E; Q
  44. #ifdef EDMA3_DEBUG
    - d6 F! a9 p9 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ G' B9 `; C( N( F8 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* G! V/ a$ q- N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! g9 E; Y0 M8 P* o" E
  48. #else: y* o/ O/ m" b( o0 W7 q
  49. #define DMA_PRINTK( x... )
    8 y1 l8 ]7 L4 Z( m$ j
  50. #define DMA_FN_IN
    ( Q. Q5 w8 |$ ^9 _' T. I
  51. #define DMA_FN_OUT  o3 l# \0 R& K2 b
  52. #endif- A! {% z% U9 H' L5 `

  53. % P, }% J  k4 n4 S, ~. {  q. R3 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & y8 {+ {8 O9 m' M% `% t6 W
  55. #define STATIC_SHIFT                3/ p, o& G+ r& f# G8 Y& k: p
  56. #define TCINTEN_SHIFT               202 x* x7 u2 S2 A8 w. k# }
  57. #define ITCINTEN_SHIFT              217 R  U5 a& x$ m% G4 I
  58. #define TCCHEN_SHIFT                22' ~$ I! Z5 Q, z. L/ Q9 |9 w1 F
  59. #define ITCCHEN_SHIFT               235 y5 [1 K- y! r8 @1 d: h6 A

  60. - y1 m$ O  _0 E
  61. static volatile int irqraised1 = 0;
    / v" i- @# h7 M' r, |" q8 A& O2 o  m
  62. static volatile int irqraised2 = 0;
    1 B( U' G* N: c' [- V! w, T2 _5 O
  63. & u& d, v4 ~6 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P: K- l0 e+ M. C8 a9 _: _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' G6 J& H- s( y0 _/ ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & @& y2 z* f. X2 {. L. P
  67. % U5 C7 G+ _; K& U
  68. dma_addr_t dmaphyssrc1 = 0;1 w! i5 i$ |7 `( R" S
  69. dma_addr_t dmaphyssrc2 = 0;
    9 K$ d) g: e7 ^0 l6 v# z
  70. dma_addr_t dmaphysdest1 = 0;
    ! o4 |' g3 q4 K& f( e1 n+ D4 T* m
  71. dma_addr_t dmaphysdest2 = 0;  p! {9 v% H. c

  72. . P) X/ W' L* W
  73. char *dmabufsrc1 = NULL;, J; t* Q: }# U0 I" J4 M
  74. char *dmabufsrc2 = NULL;
    ' B8 C* g$ T2 O& _' ~) K* h
  75. char *dmabufdest1 = NULL;
    : Z7 a6 A) T5 v1 J) u$ V
  76. char *dmabufdest2 = NULL;# F0 l5 d/ M' b+ y6 U8 \
  77. 8 u9 ]& O% u) r% G% R
  78. static int acnt = 512;
    * m3 F- K  u! q0 _5 {
  79. static int bcnt = 8;- R+ N- F8 r0 q- N: B
  80. static int ccnt = 8;
    ' U3 q3 m* r6 ^' g+ L4 C; {
  81. . @/ v& T; N/ y
  82. module_param(acnt, int, S_IRUGO);: o- d& q* R/ g# {# M. a- f* U8 \
  83. module_param(bcnt, int, S_IRUGO);( L" ?) W+ W& R( r) \' p* g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. Z/ N  l) h  D9 _: x. J

3 p6 t, y9 C0 N$ O3 P5 x4 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& R2 k- x! O$ X: V3 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  k5 w. l( S/ g4 ^+ f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 t, y/ }: p9 a3 ?0 X' z; x1 |* @
4 p" R3 c9 ?, e+ p+ R3 m9 a

. s$ E. \) |) Q1 E) ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 05:04 , Processed in 0.042214 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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