|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ T" ^( u+ @; Q) ]& h" N2 G, k ^
- [code]EDMA sample test application
' `5 I {3 C% w- H - /*
, Q& @/ b' U- n - * edma_test.c5 i+ J' v' G* O+ n! Q0 W
- *
5 }4 r; X7 O* n8 ^! V - * brief EDMA3 Test Application
( A( }4 [2 H' `* Z$ W - *
9 U) ~) B% z! ?, U, W - * This file contains EDMA3 Test code.1 l2 M" f6 Q( H' I: W: g2 c0 A2 Y
- *8 [0 b/ D% Z0 H; [$ j9 w. x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" |, ` I/ Y6 \5 I2 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, Z6 y+ E2 f+ m/ Z* l - * TO CHANGE.
$ ~" U3 k3 [' w4 K- B+ c# C! x% }( [" E - *$ M0 E6 H2 P* Q* m2 `4 T7 ]' m v# W$ d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# }' X8 n/ F: V% t: C
- ** h L+ J9 q% ]8 \* r
- * This program is free software; you can redistribute it and/or
% [/ N6 ]! |$ ^6 B+ w5 a6 ^- z - * modify it under the terms of the GNU General Public License as
- q3 }' E& N8 m V! o' Z - * published by the Free Software Foundation version 2. s4 ~ X1 V6 L
- *
. S5 _% g/ I2 N; C1 x7 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 h0 Z0 D' H) U" H4 u0 { - * kind, whether express or implied; without even the implied warranty
$ C# q. Y2 i. [/ F% }6 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 b% r# r& q* B# B2 f/ f - * GNU General Public License for more details.5 ?' _: ]5 b2 a# t( z+ {/ r
- */" A+ G$ p; p: Z5 L/ s
- * P' ]. C5 E, p( a1 ~+ ^) O
- #include <linux/module.h>" f0 y1 r# \3 y
- #include <linux/init.h>
& e& Y( e5 m9 l. N$ t( Q6 D - #include <linux/errno.h>
3 l0 F% D- J/ m/ O; t/ w* [ - #include <linux/types.h>
1 @- [0 s4 P: g0 V6 T. Z - #include <linux/interrupt.h>
, u" `7 g5 a: X) V* @ - #include <asm/io.h>7 n/ k y3 f' c' Z9 b2 A
- #include <linux/moduleparam.h>
! N5 n* {- I9 P ~* q% U5 M6 A - #include <linux/sysctl.h>+ A* z8 o$ [* R! f. n6 H% u3 `
- #include <linux/mm.h>: Z0 E2 ^+ x! x' ^5 c7 ]' s2 a
- #include <linux/dma-mapping.h>
: t5 R$ \% s+ ?+ {4 v0 W- m9 B
. M0 r; U/ J: C' ]- #include <mach/memory.h>+ u8 C+ f( o2 _# e3 Y/ G3 L& k9 p. K
- #include <mach/hardware.h>' X& L0 A0 V! {2 L9 L) s
- #include <mach/irqs.h>2 t- e6 O. q8 @+ L0 j% `
- #include <asm/hardware/edma.h>
& G; {2 L+ t- j7 v" S5 ^
4 s" `) K, O, `, v+ I' V8 o- #undef EDMA3_DEBUG9 k+ R* }+ n$ l* f1 J) k
- /*#define EDMA3_DEBUG*/
$ ^- N* `& [; E+ t+ `
' g" j7 c9 V N; K2 U) {" q- #ifdef EDMA3_DEBUG
/ t& P3 J0 ?5 O8 r# W! f2 H9 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 `" ?# a4 o( ~6 E* D0 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 k X5 J# Z F! ]0 F( n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). w# [4 E/ H6 W! l/ b6 o, x" q2 X8 }
- #else( Z" d7 v* z( L1 B
- #define DMA_PRINTK( x... )
( W. `, | z3 Y% h1 S, Y - #define DMA_FN_IN
! u2 F2 V$ J4 G - #define DMA_FN_OUT
! o7 m1 q# A* W6 i - #endif
3 N* u' c( s. R1 y8 ?# h8 [ - $ \* |! W3 ^* I+ R5 t& _8 P1 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% j5 {- ?5 X# c# s. I
- #define STATIC_SHIFT 3$ Z, u. b4 j6 o
- #define TCINTEN_SHIFT 20; c, O- Z' c( @) R, c3 A
- #define ITCINTEN_SHIFT 21
! ]" Z9 ^# s5 e7 q9 Y - #define TCCHEN_SHIFT 227 P/ e+ P! Q8 T% L
- #define ITCCHEN_SHIFT 23( J' R: h M4 B' H
; j) m6 d, d! r# ^$ s' s- static volatile int irqraised1 = 0;
& ^% ^& M( w/ y/ m; X& l/ f& N - static volatile int irqraised2 = 0;
& \+ p( ?, |. T) Z: }% R
- H' V8 Y+ `$ g% a8 n& d5 R: u9 h/ r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 g, H; ]3 k3 `1 F: I8 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( \4 ^% O4 j) z" A. J: D6 m( [2 |/ R X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
f; A! S* g0 R0 r8 v+ n: Y - , \+ I! R# F/ v, i6 I+ p: B, T
- dma_addr_t dmaphyssrc1 = 0;1 n& D+ F1 b- j% U
- dma_addr_t dmaphyssrc2 = 0; ^# p* C$ X3 V$ l0 g$ J
- dma_addr_t dmaphysdest1 = 0;
% b, g3 Z- @3 S: o' V, G: _ - dma_addr_t dmaphysdest2 = 0;% m4 q% i$ J; ?
" }! } ~3 b7 w1 S# q+ } s9 A& `- char *dmabufsrc1 = NULL;
* w3 Z7 ]7 K3 m - char *dmabufsrc2 = NULL;
5 h# K) z# j# [9 ?( ]% Y) ^ P# x; g& O - char *dmabufdest1 = NULL;
: l: a+ Y' P/ X - char *dmabufdest2 = NULL;# ^2 e3 E4 W2 T. s ]+ z, V. P
& b7 D3 ?$ E- T9 y2 s- h: J/ A- static int acnt = 512; [+ D V( Y! c* W3 G. u" h
- static int bcnt = 8;# W4 }# u0 B2 a5 H- r
- static int ccnt = 8;4 Q( f I$ {0 o/ W& ]
- - g" b/ `# i6 t/ M& X
- module_param(acnt, int, S_IRUGO);
9 ?( w |- I8 C# \; d - module_param(bcnt, int, S_IRUGO);
$ N. Q" } o# i9 L - module_param(ccnt, int, S_IRUGO);
复制代码
2 n' ~/ y. x' x( R
/ q# R6 `& q4 p0 X2 U! `% a) t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ `7 F. C p! o3 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" K2 b3 u0 N9 K& O7 r$ _2 V1 Z0 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& O5 u# m2 Y$ d# l Q, s9 C' W
; d9 i& v. v5 a
6 E2 D: o! L+ E* p1 ^2 x: J |
|