|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( Z$ x* d% _' V2 I- n- [code]EDMA sample test application Y8 r6 A' X( ~4 S1 Y% O- r* K
- /*2 K, p$ }3 F0 {+ F4 q
- * edma_test.c/ _" F4 |; }# T. i* x" o
- *! b% G. n6 C; O
- * brief EDMA3 Test Application
2 r0 @1 N0 T3 z! T. i% } O - *. a9 H( @9 }1 E& `) L ?0 X
- * This file contains EDMA3 Test code.4 u( d+ X# w" }% \
- *0 l/ Z, z. n* p" ?9 h: J8 T8 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE A4 Y/ K3 o- M: p2 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ |5 K# M3 X$ D/ V - * TO CHANGE./ K; {, a" g1 S5 Y6 p r
- *
) P8 |/ y3 i; a6 h: \$ t6 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ A4 B3 n* F5 |) G4 K/ k( k - *1 ~; F; ~# k, Y3 G1 V
- * This program is free software; you can redistribute it and/or* a# O' L9 y y: C6 `
- * modify it under the terms of the GNU General Public License as' V" q8 U% X' ^2 E. G! j- r
- * published by the Free Software Foundation version 2.
' x. w# u+ M5 f5 u( P, _( i3 h0 ` - *
* d9 E) u& }' V6 O6 n j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# U0 `+ R- o: i1 g - * kind, whether express or implied; without even the implied warranty# q: ]3 h$ G' j8 b& y' M! `- o8 W1 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 U- ^1 G4 Y3 } - * GNU General Public License for more details.2 H! d4 _* W: s& J- @. n2 D) K: k
- */# `1 X% V" s0 ~
- % Z$ O- B8 s3 P" w
- #include <linux/module.h>) m* P: v; t0 J. Z0 ]
- #include <linux/init.h>
; N1 E# E* I+ w3 l( M9 @6 w. Y - #include <linux/errno.h>
5 _$ }: k* q# c& ^ - #include <linux/types.h>4 Q* a* r& N' c
- #include <linux/interrupt.h>
L* M: q/ o! C0 M# { - #include <asm/io.h>
; E, R7 P2 C) d2 {0 J7 T% m; T1 s - #include <linux/moduleparam.h>5 F: s' Z" F0 w3 N
- #include <linux/sysctl.h>
% z1 Z% m0 x }4 `# @/ q" z - #include <linux/mm.h>& a0 t Y# S' T) z7 N+ M
- #include <linux/dma-mapping.h>
! e# |) a# j9 g- g - 6 U z; O/ B# B5 I& l
- #include <mach/memory.h>. _7 t7 M# N) M: @: ^, i
- #include <mach/hardware.h>- F+ A, F/ l2 N9 a* D! r2 \
- #include <mach/irqs.h>5 j) l$ u: I3 h' g* A
- #include <asm/hardware/edma.h>
# I4 v; h1 P! {$ F; v8 w* |; U - - t+ Z; g. @# q+ b
- #undef EDMA3_DEBUG- H" Z. G- k6 A& l5 v
- /*#define EDMA3_DEBUG*/
2 a/ q7 O6 ~5 r. C& ^ - * H$ Z& `7 S& T6 |' j; ^" H$ K" t
- #ifdef EDMA3_DEBUG
: T4 ]1 t, v3 s# X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 y" ^' s, S* r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) Y) D4 A& h; X5 s5 t7 W: i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 p1 V: G0 n; W# s
- #else
# P6 ]% X+ a: W! J! x* r' C- e Z; ~ - #define DMA_PRINTK( x... )/ b% ~: ?# A! A5 q8 O- \
- #define DMA_FN_IN/ a! \6 Y6 R* c" \: j9 e H! p
- #define DMA_FN_OUT0 }9 j! G4 ?. o G& \
- #endif
9 n0 J; M2 y7 F! G/ K& b$ z# c) B
* r! O+ h* U. ^# \/ _1 M4 \+ K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' x6 w1 O. E9 {
- #define STATIC_SHIFT 35 x$ \5 t' a' l* W
- #define TCINTEN_SHIFT 20# E4 c, S. |. z1 u( v
- #define ITCINTEN_SHIFT 21 v$ h3 p0 X: ]( ^
- #define TCCHEN_SHIFT 22
1 B, }9 V/ B9 R6 Z, v - #define ITCCHEN_SHIFT 23
# s6 K1 A4 x7 N4 ~: T# t2 H$ r - 6 y/ w( G; [6 m$ K
- static volatile int irqraised1 = 0;" J0 v; q- U8 R f* w2 q+ ^5 I0 e1 {
- static volatile int irqraised2 = 0;
8 J3 c' ]. ?4 ~9 t# C: j - 8 l# t: B' {3 g& L% K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 C# _! y& M* m4 c3 h, E5 g( D% I: P7 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P5 Y2 F, X/ e) }5 `0 `3 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A+ ?; [! `8 z
- 3 L2 {" e0 J: y6 E
- dma_addr_t dmaphyssrc1 = 0;
0 o+ R, n& h) H' x, q1 Y& V - dma_addr_t dmaphyssrc2 = 0;
! M- w: f8 A; ^! C8 C2 F - dma_addr_t dmaphysdest1 = 0;
. t& U; r, r" f1 n5 ]2 w - dma_addr_t dmaphysdest2 = 0;
& M/ ~* W$ P) ]" n0 f0 P, D
! h; z) O! X# p% G: U- char *dmabufsrc1 = NULL;3 h% [! x8 y- V( g4 E, W
- char *dmabufsrc2 = NULL;
2 `, d) q5 j0 e- N" d* C - char *dmabufdest1 = NULL;
8 f e/ J6 D% @ - char *dmabufdest2 = NULL;# j) M( l1 D* v* {/ W% ?
8 N8 |- w8 q: x9 }. [5 F; q& Q- static int acnt = 512; @8 y, ]1 ] q$ p5 Z" f8 c/ i1 X
- static int bcnt = 8;
3 ^/ E- n6 T: ~! Z& k. g$ v - static int ccnt = 8;9 `9 {# h0 m! x! x7 }0 p
- ; ?* g E4 Y, l& r+ X: A0 F
- module_param(acnt, int, S_IRUGO);
8 l0 T9 S4 X8 G6 E& J5 r* T; K - module_param(bcnt, int, S_IRUGO);
( Y" O$ {2 P1 v" m* ^ - module_param(ccnt, int, S_IRUGO);
复制代码
$ Y$ J/ P/ F& H t
# i& w2 ~3 ^0 j3 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& L6 U$ \9 z+ p3 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ h- Q( C% r% s4 X0 A/ K$ u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 {1 Y1 V" \ ]2 M, S$ c0 _4 D2 m4 G
& G# g, Q6 _, {7 c
|
|