|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 A% A) U7 d( u# z! [. a) _
- [code]EDMA sample test application+ n" q/ p# }) o) H' b$ F7 R
- /*3 u1 U% |& [" X9 e& [8 [
- * edma_test.c9 D' N1 T3 W0 l# t
- *
; i: b v* Y, E& b1 i7 Y - * brief EDMA3 Test Application
$ t- q' H5 { U$ }$ |! _: Q: J - *
& ?, \0 r3 K( b! v4 Q6 n k9 Z+ O - * This file contains EDMA3 Test code., G( s+ A* p4 m; c$ v- b6 x }0 A
- *
+ _* v2 F9 V, L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ]2 }+ n2 y( L2 p* M/ {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 z% S0 i! v. }' x6 N - * TO CHANGE.# u( Q2 r/ P: c( j& @. Z( K( w7 a
- *+ q1 H; R* a. t, |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. r' |" }3 @+ g& a# g% j
- *
2 \2 L/ }0 [0 b - * This program is free software; you can redistribute it and/or
4 n; w. \4 _- V9 y5 N - * modify it under the terms of the GNU General Public License as" f$ d+ N0 l* A; `% k( k
- * published by the Free Software Foundation version 2.
! V) g- `: {: u; r& A) [9 n4 ~ - *) U7 m( S6 K7 r+ k1 ?! v8 a% ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( ~$ a# r1 G' u0 o - * kind, whether express or implied; without even the implied warranty: s' y) s8 v( ?& J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( i" H" C9 T5 O3 N- g) S* |. t - * GNU General Public License for more details.
7 L9 X* M F3 D' C6 z3 u- L - */
. s/ J7 Z7 v" U( x" B; V - : J1 ]8 p1 e& z- z& \
- #include <linux/module.h>+ [7 q+ S1 P8 T2 E7 v' P, t1 t
- #include <linux/init.h>- W! v7 \. o" [# A/ [7 m* L; Y
- #include <linux/errno.h>
0 L- e3 p7 F9 j+ g - #include <linux/types.h>/ X4 z$ k2 L$ f- Y& R
- #include <linux/interrupt.h>+ S" T% [) c7 Q! c0 ]7 b" H
- #include <asm/io.h>
3 M. A) V! {* f. r* K - #include <linux/moduleparam.h>% P W$ r0 M$ X# X2 O. K. b
- #include <linux/sysctl.h>
2 o8 J6 q* m% m% W/ G - #include <linux/mm.h>, z* T3 ]' |7 C) R+ C
- #include <linux/dma-mapping.h>+ x1 D% ^3 r2 K. q) i* F
- - N% z% |5 z7 }+ x- A q$ I
- #include <mach/memory.h>
2 M! w' K1 v: J [ - #include <mach/hardware.h>+ B! [) v( }4 w
- #include <mach/irqs.h>* b* ?# ~% ~$ @8 B
- #include <asm/hardware/edma.h>- m' _7 N- ?, t7 F6 m/ ]: N
3 X; H1 c) q$ J* a; w- #undef EDMA3_DEBUG
' S8 e# z7 `! X" Y" n3 y - /*#define EDMA3_DEBUG*/
& h9 [% r g$ n' B* R+ l6 @! C' V& E - ) l! X8 |0 _! Y) }. m2 r* I
- #ifdef EDMA3_DEBUG
, O, {4 R& B1 w8 b$ m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, N7 d# w' S' @3 \" g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" R& f% {8 q% q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
k# u3 X/ g' }' }9 F - #else
2 B6 [# T. h/ T* r% x; Z1 ] - #define DMA_PRINTK( x... )
2 k( v! D8 q6 J. c% Q4 i% G - #define DMA_FN_IN' A; ^/ q5 R1 g8 n e+ ^* x' [
- #define DMA_FN_OUT9 k% U6 M4 _/ t6 t/ a0 D
- #endif* b1 v- ]4 F& X
% z8 C4 u, @1 Y# F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 t4 E: H: e, B9 J - #define STATIC_SHIFT 3
" `2 m7 Y) R, g/ h6 X% r; l - #define TCINTEN_SHIFT 20
' o' m$ B$ S% p! G2 b - #define ITCINTEN_SHIFT 21$ d: ^% J0 b5 n
- #define TCCHEN_SHIFT 22
5 y# i) q) p; { - #define ITCCHEN_SHIFT 23
. E- ~) ~9 d3 W0 U8 E3 w - ! y! G2 o! ~# C' ]6 |2 M0 R
- static volatile int irqraised1 = 0;
' [" F! K4 v9 [: Z - static volatile int irqraised2 = 0;
' X& p* [/ e6 h$ Z- g" t
* ]0 R& y& v9 z; y& l/ ^* J- m( C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y+ S1 R" r3 Z/ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; e7 M! _" ~- l2 u6 j3 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h0 N/ [ B4 Q3 h4 y
- . }3 ^7 H7 n% T, `/ p
- dma_addr_t dmaphyssrc1 = 0;! ^( [2 i5 \- o) c( t7 b' @
- dma_addr_t dmaphyssrc2 = 0;) b& n: K$ Q: o |& B4 A* E5 K- ?
- dma_addr_t dmaphysdest1 = 0;
" L# C& ~# H9 E# I - dma_addr_t dmaphysdest2 = 0;: j$ e$ v) @$ ?; L( V
2 O1 H% K1 P; w m; T' w7 b- char *dmabufsrc1 = NULL;- g7 o" z7 z5 `2 E; o6 l0 p
- char *dmabufsrc2 = NULL;' O6 [& g/ R" \- m" D- `% P0 e ?
- char *dmabufdest1 = NULL;% A4 M! Z4 P: s( g5 P- h. F
- char *dmabufdest2 = NULL;
3 o) X$ c( g2 N* n9 B f' D
' n K6 X, D( w- static int acnt = 512;
W3 e3 @: K3 w7 g - static int bcnt = 8;
; u: g# q! }" C7 V; u+ D8 I+ F - static int ccnt = 8;
3 {% {0 _. l5 K4 `
5 Y" m h8 _" G/ i x S- module_param(acnt, int, S_IRUGO);
0 M+ U8 l- N4 X - module_param(bcnt, int, S_IRUGO);. x, r) j2 x& Z
- module_param(ccnt, int, S_IRUGO);
复制代码 6 O6 ~6 _* Q7 l3 \# _/ D9 f$ ^8 O
9 } c1 M5 W* ?8 ?! Q7 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% S. S, o4 @7 T, b7 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; q3 g N' d" s0 _8 Q. q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 s( R+ m( P8 w6 E* e' l0 Y2 D% [2 B( s' \# w
. z/ R" }6 x) f8 Q |
|