|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . ]( Q7 k" a9 P8 e
- [code]EDMA sample test application; d! ~8 t* o: G4 O" ?! r
- /*# ^- a* M- s3 h- ]8 U
- * edma_test.c# W. P i" X! x2 E
- *$ _6 Q0 c8 x! b4 y A$ ?
- * brief EDMA3 Test Application" A9 m& `+ T& a. m- u
- *3 g/ W4 Q( w4 ]% I% i) I2 w
- * This file contains EDMA3 Test code.
1 U/ E' r: G! F }$ P1 L- ?! j - *
) _0 A1 O( v+ D1 W4 C$ y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 p1 `9 ?# d$ Z0 x9 N6 d4 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 @" d" l/ j5 ]( ~
- * TO CHANGE.
& q# ~ f8 f) N3 @ - *% Y4 e8 o7 T3 v8 |, t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 c4 K8 h" M+ a- E5 a
- *
& k3 }) h g6 ^: ~+ m2 S - * This program is free software; you can redistribute it and/or* W+ _1 {% d8 p+ ~& W/ ?& `9 [
- * modify it under the terms of the GNU General Public License as
) e7 [% ?, ]. j. `2 ]- \* f - * published by the Free Software Foundation version 2.
: y/ u; H$ a' h. v - *
% V, ]! X& Y0 s+ P* ]8 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 `0 F8 N1 H, T O: A" j( A9 N( G
- * kind, whether express or implied; without even the implied warranty0 c, l: z# m% ?- z- d* ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, z" j& I, D2 q4 s. u# R9 k( t - * GNU General Public License for more details./ ?0 ]3 m, }4 M6 F% i) n
- */
. u+ Q. Y X3 V) q - ! y( u6 N8 R+ q
- #include <linux/module.h>: F. w" N8 j) s
- #include <linux/init.h>
! S) H% n2 Z# J9 ^& W - #include <linux/errno.h>
- a) B8 P! p& G4 o) K- t - #include <linux/types.h>: u" [1 g8 i' b, D. o
- #include <linux/interrupt.h>
1 i7 z4 l$ w: N) s3 p$ L1 A - #include <asm/io.h>" a( Y& D' t% D6 m
- #include <linux/moduleparam.h>3 P, T. L4 K4 j1 Z; l8 H
- #include <linux/sysctl.h>
9 B# A V9 W! o8 d# D p' `2 a5 l - #include <linux/mm.h>
1 ]6 ]0 r! k) y! } - #include <linux/dma-mapping.h>
* y" {) A6 x6 U. w! ?2 ] - 8 _/ D( _. J4 v, i
- #include <mach/memory.h>
) ]# e9 e/ T i' R - #include <mach/hardware.h>/ H2 @% Z, B) |+ P+ |' H8 A
- #include <mach/irqs.h>
) H( U, S. u5 l3 L+ k) j% h, Q - #include <asm/hardware/edma.h>
9 q7 i& r0 x v9 o) ~, R - 1 ]1 Q8 H s o5 x/ a, H
- #undef EDMA3_DEBUG4 a$ q" O/ m5 X3 }1 p8 v* ]7 x1 Y: C/ {
- /*#define EDMA3_DEBUG*/
# b) c4 |' \, g6 f - # [7 e$ |; {+ c! q. {; O ]
- #ifdef EDMA3_DEBUG. a7 I, z% W F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 w) [3 n6 V0 e) _. K+ A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- i. e6 A+ N; n0 `4 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 b$ f2 T4 c1 y% s' ^5 h! @ - #else8 A6 G& p) ^3 d& ]6 K; `! F6 I a
- #define DMA_PRINTK( x... )
5 h( p3 \" q H) X; u8 K* n6 I$ C3 r) S - #define DMA_FN_IN
* L9 G4 R! t5 r/ ^4 e r" n6 R3 j8 ^ - #define DMA_FN_OUT
! v3 ^# {6 D) B+ I - #endif: ~8 p- J; o* ]# z, u# y; k
. C/ o5 ?7 \) J8 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, r4 p( M& B3 M - #define STATIC_SHIFT 3
: @: ]0 r2 S1 |0 X; ^2 Y - #define TCINTEN_SHIFT 203 v- v( Q& ]/ |) Y
- #define ITCINTEN_SHIFT 210 G u! U, f x# M2 E
- #define TCCHEN_SHIFT 22
- s% w3 [4 |8 E - #define ITCCHEN_SHIFT 23
3 }. d( k& N% ^% w - ) n2 _ E% q9 J- K
- static volatile int irqraised1 = 0;* @8 ^4 Y! d; O0 y
- static volatile int irqraised2 = 0;
8 r0 E+ G4 h+ d: B: q' R; T; U! p+ Y - v8 y. `% G3 R+ ~2 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: q7 k2 s% s4 O' q; s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 H2 F; U* U4 X8 X: f& A$ P$ o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \, o$ O( c+ I! \
- 9 ]# I% h9 _8 I
- dma_addr_t dmaphyssrc1 = 0;' \: E! E5 a: Q( f: S% v
- dma_addr_t dmaphyssrc2 = 0; {3 i7 u7 M! _6 O
- dma_addr_t dmaphysdest1 = 0; D7 S4 x4 R4 Z- U
- dma_addr_t dmaphysdest2 = 0;$ X7 K* |# p! T8 B3 o" r
: ]* x5 l- q7 o0 i- char *dmabufsrc1 = NULL;" m" O, C9 ~: ]7 Q$ d
- char *dmabufsrc2 = NULL;2 g" ? U) D8 l6 z
- char *dmabufdest1 = NULL;
7 n' b/ L8 X2 g: w( t0 s - char *dmabufdest2 = NULL;
) x+ ^ v& i4 T( F% d1 N8 ]
; A( K0 K' B, N- static int acnt = 512;
# e% _$ e! r7 o6 d/ s3 y, i - static int bcnt = 8;
0 K. M5 K8 a. n/ i# M3 Z( O; k - static int ccnt = 8;
: U/ e/ M9 N/ E* k$ e2 R
/ b3 b( C- A6 _" g- module_param(acnt, int, S_IRUGO);) b* p2 `6 c$ [8 W
- module_param(bcnt, int, S_IRUGO);
8 x" k f- M- Q - module_param(ccnt, int, S_IRUGO);
复制代码
+ I3 H$ M/ H& b' ~
! z( t. I' v ^& k9 n! E/ ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" g& u0 ^5 C: w9 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
q' b- m* R) x' c' W$ t- B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 i3 X" f$ l' W0 N/ H% k
/ R, _3 F) E% c
}5 @% Z/ R/ Q, C' | |
|