|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' [5 n, O) q& v; m4 V* C: j& K
- [code]EDMA sample test application8 N8 n, M; l4 L
- /*
7 @& X4 C6 {; I5 S( q* i4 @9 E; F- I3 \ - * edma_test.c8 L0 V) ]. j9 L
- *2 Y: p, D4 T) K1 Q, d0 [
- * brief EDMA3 Test Application
5 n+ s, R: Q. K5 i6 g |- [' b) @ - *; M* I( m5 Y7 `
- * This file contains EDMA3 Test code.$ v6 v4 `% }! K/ l; n1 i8 Q& V9 C$ f
- *
/ B; x" R7 M, H' L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) w7 m4 z3 H; g4 V: A( o/ J3 q: U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 }: S K# ^) k7 o
- * TO CHANGE.
+ F/ U2 U1 R: A# k - *
9 |; y9 p, V& ~9 }' N6 L. U+ p6 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 G1 }# q) E# i& O, D
- *; B' I+ f& x& f: F" e1 l; F4 y
- * This program is free software; you can redistribute it and/or
) r- R, o. r$ w7 O. k- U - * modify it under the terms of the GNU General Public License as
5 A5 m) j$ R2 k0 U - * published by the Free Software Foundation version 2.
/ _. ?. H$ r* w, N( f& \ e+ `% l - *
2 u; }. s2 V6 @2 G7 B! r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& W2 _6 D% ?2 S! U" F. V
- * kind, whether express or implied; without even the implied warranty
) h7 n2 P* h2 h6 O2 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, d$ a/ t2 [3 M* H2 t - * GNU General Public License for more details.
( K0 b: I; r P5 }, b; n - */3 E- H0 A9 b) m. z% F6 b& a
' J6 T( ?$ `" C4 w- #include <linux/module.h>* H/ p5 n* e% a, L$ ~% G
- #include <linux/init.h>' I1 W, d9 x7 C1 {+ I1 T& b
- #include <linux/errno.h>
2 \' {/ p( b0 f& U - #include <linux/types.h>
2 R- l |0 X B" q4 W - #include <linux/interrupt.h>- c, H* w/ ~% H/ Y( z% h) M5 E
- #include <asm/io.h>$ ~ t7 E+ G: y) Q {
- #include <linux/moduleparam.h>
' x3 _7 D' s0 z. z% F, } - #include <linux/sysctl.h>6 {) n+ u; S" L9 I
- #include <linux/mm.h>
0 T( A: ^5 z. t" M7 w3 l% y# K - #include <linux/dma-mapping.h>
2 r4 r1 P( _( K" w - ' k9 F6 p0 E* H( C% Q# i1 n
- #include <mach/memory.h>
% G- T# V8 _* e2 N+ i; V - #include <mach/hardware.h>. R; Y, Q0 ^( A3 p
- #include <mach/irqs.h>+ i+ X }+ C) s2 ~" e) p# a
- #include <asm/hardware/edma.h>
/ c# q* w6 B; x$ v, ~* _% i0 G7 K
1 W7 t/ j0 W$ A. Y! g0 \. H& S! N. i- #undef EDMA3_DEBUG
7 J0 P. @7 N! I. e; E% h - /*#define EDMA3_DEBUG*/
! X" D# i) V' t9 A5 X- \
& k& Y+ `- z" P1 s* Z6 `9 G- #ifdef EDMA3_DEBUG* Y8 z* a8 ^9 b$ x/ [# P3 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- G5 ?" f4 ` m# k2 P/ s# f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); X4 c# s* `: h. X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 a) e( ?/ x K3 o) x
- #else
5 y" L$ o* C# E/ q - #define DMA_PRINTK( x... )
* A& e. Y6 D' c" F: z5 v - #define DMA_FN_IN
' U; b% i$ C4 H4 d+ h1 v - #define DMA_FN_OUT
3 v3 `" R8 X* s - #endif9 j5 B5 {: \% T( S' ]: p1 T
' l( l' u A5 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768); ^$ `" l3 v) |% L s; `/ ]
- #define STATIC_SHIFT 32 _6 Q8 `/ Y* i) z: E# P- P) A
- #define TCINTEN_SHIFT 20
8 y$ ?2 w# {) M7 J! h2 {5 {/ l - #define ITCINTEN_SHIFT 21
9 b( l& p4 | t$ l; K( O6 p: [ - #define TCCHEN_SHIFT 228 ~2 c: q0 c' |* \0 \, u
- #define ITCCHEN_SHIFT 23
, `/ j; y7 ]7 a9 `2 {& s* T
0 z7 m1 ~! P/ p5 I" t" N. T6 ?- static volatile int irqraised1 = 0; s+ ]- H3 Y2 ]3 V
- static volatile int irqraised2 = 0;* w7 G5 p d* E3 s" C q
0 G N- Q0 v( a* a* [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J- m" F4 ?) ]" Q S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o; U' O$ y! b) w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
i% j# X7 \4 X; K8 ]6 |) V
* \9 z. ^/ R: o, U- dma_addr_t dmaphyssrc1 = 0;7 e: r9 S. _2 h
- dma_addr_t dmaphyssrc2 = 0;! J/ F4 L7 n& w! \. T3 W
- dma_addr_t dmaphysdest1 = 0;2 p9 ], ^; X+ n5 o: ]: Z) L, W
- dma_addr_t dmaphysdest2 = 0;
( Y" P4 Q8 |0 t
, l$ ?2 n1 y3 H3 U/ h- char *dmabufsrc1 = NULL;
5 E9 j1 }5 F0 [- q1 C: o8 H - char *dmabufsrc2 = NULL;
0 m4 v3 A z0 i# ]4 k9 n - char *dmabufdest1 = NULL;3 G6 w; t+ p# B& u2 R5 J
- char *dmabufdest2 = NULL;
5 T ~& w( F1 ~" c6 ^ - r( l2 k! u7 k0 B/ f
- static int acnt = 512;5 J+ h8 S7 w. k* Y. Y& X: W& ^( P% E
- static int bcnt = 8;, U+ v8 _: `2 [
- static int ccnt = 8;& e4 r, X5 y! a. j. H+ H8 h0 i
' D% A# s3 @1 O- module_param(acnt, int, S_IRUGO);/ j* _0 @; t2 s! o# D, y
- module_param(bcnt, int, S_IRUGO);& o# E- ^8 R) \ m
- module_param(ccnt, int, S_IRUGO);
复制代码
$ P; l% }2 L* f+ L
0 k* w, F& t# r1 a3 X7 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 Y8 F/ l1 R4 f" f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- f) l: f) B i7 ]. d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& d! o- @6 k: U* H4 ^2 l9 B+ z
* E- q8 s# ^! F* L& e4 N0 y+ g
& }8 X) R. S w( t6 g |
|