|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 m! N U- g7 S6 R- [code]EDMA sample test application
/ C$ _+ X3 l# o9 s# n4 p - /*
8 a% ?1 C6 D' ?: `/ z; Q - * edma_test.c+ N+ B+ V8 N) g: D
- *3 J7 ]! k' i* J+ f4 Y3 d4 ` |' U
- * brief EDMA3 Test Application; N X; T2 O1 B' ~# }- z
- *
( V# W8 f3 J3 |3 R4 Q1 U0 [ - * This file contains EDMA3 Test code.' r+ \( S: P- t; w
- *" k1 L9 a% ~3 f+ E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 b$ U; C) ^' O: Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 v0 i3 B% n9 u, A7 D
- * TO CHANGE.7 ^; l9 \( }. G& f( w& V, h
- *
& X; k; e* \& ]! ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( O$ D( b% S2 ^ j- V - *
1 M* l$ n. s) T r% D - * This program is free software; you can redistribute it and/or
! ^4 s* b# n( ^- E8 ^- w3 W/ }% b - * modify it under the terms of the GNU General Public License as7 n) l/ O0 V& z6 g
- * published by the Free Software Foundation version 2.
6 V9 u# |( L* J! w+ l; H w - *9 b0 H5 ]6 D3 x( ?/ [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 u+ ]2 `& s" i A: `' z: H - * kind, whether express or implied; without even the implied warranty/ r6 C3 ^* {. P& p( @" M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 _6 U. ^( s1 n4 p5 x. G - * GNU General Public License for more details." w5 ^" S0 u; V% U# r* \- q
- */% S6 K U. D8 D
- ! V" W9 R$ V' X" p l/ L
- #include <linux/module.h>) h1 ^8 c, I, S- ?
- #include <linux/init.h>
6 V7 d$ e: _8 R4 v" K" O - #include <linux/errno.h>
`$ U5 C1 j4 E - #include <linux/types.h>
2 Z! I- A( K8 V4 O; y - #include <linux/interrupt.h>
, R( S" J; T# ]. ^/ |! K! r) F- b - #include <asm/io.h>
; W* y& i* L9 s0 ^; `' i) s - #include <linux/moduleparam.h>
9 e5 T' q2 A( D8 B - #include <linux/sysctl.h>
- L ?( O$ n8 x- }7 G" C - #include <linux/mm.h>: F o) U- g. Y- V7 V8 G0 u
- #include <linux/dma-mapping.h>
& ]7 p) P; t& g& X; x; ], q - # }) ^# w1 O0 \$ h. U
- #include <mach/memory.h>$ S9 W# B0 r' j {7 S3 S
- #include <mach/hardware.h>! f' S% i4 F' c
- #include <mach/irqs.h>
' `* ~) d% E8 h; U/ Z - #include <asm/hardware/edma.h>1 c" }1 p O+ v- v9 s9 t
# K% ]3 t8 X2 t# w: a- #undef EDMA3_DEBUG
/ V0 B" l; ^" M" _ - /*#define EDMA3_DEBUG*/" \. @; P6 S3 \) h& U6 F9 c
- & G3 g% ]) K6 s1 n! G& t1 k
- #ifdef EDMA3_DEBUG% x! o1 ~" _6 V1 h9 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 G3 C1 i4 A A( P) \. I c6 d0 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( c/ p+ q3 v) A+ `! ?- [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 i# h; r4 x6 f# {7 t$ L& j" c
- #else" x. J: _$ H- l
- #define DMA_PRINTK( x... )
) b1 G6 p3 q! x i* Z! I- R6 m; o' O2 F: F - #define DMA_FN_IN
# K# x) N6 X- s/ | - #define DMA_FN_OUT
e/ b( z1 R: O2 J7 S9 r4 U6 E - #endif
6 l; v$ R. L. Y3 z2 c3 r" x - 7 ` t* `3 K3 T3 n' P& W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 n$ A/ z" N& H: J! G2 r
- #define STATIC_SHIFT 3( c6 d: f, K2 ]' G0 R
- #define TCINTEN_SHIFT 20
" j: C* d: ]9 Q4 ^5 C9 h5 K - #define ITCINTEN_SHIFT 21' X; M4 ?$ e! C; _6 x
- #define TCCHEN_SHIFT 22
4 j7 P' w6 a+ \# m5 ?$ o - #define ITCCHEN_SHIFT 23$ l1 y6 b8 _# ]' { p# r+ z; M: P" L- r
& e9 J8 I2 P, x- static volatile int irqraised1 = 0;0 n2 |0 T% Z& w7 D: f
- static volatile int irqraised2 = 0;
; i' U+ `$ D2 ~2 [2 V
k& E4 s. R5 |$ Z a6 W1 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R) k" J$ A& r0 q% S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% l9 A6 T: a3 C' r1 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" {; W0 J, r* I
5 E' [' v. Y$ g9 m0 A0 p* e& y: |- dma_addr_t dmaphyssrc1 = 0;
' T- U/ X7 j2 \' \' i - dma_addr_t dmaphyssrc2 = 0;6 G0 O V W; J. ~' E- q7 \9 r3 J
- dma_addr_t dmaphysdest1 = 0;1 L6 d+ G9 @* Y6 @6 s, G% W8 a$ L
- dma_addr_t dmaphysdest2 = 0;) G5 |- ^# c) }, W2 \' p* m- ]
- ' P4 ^$ c" J) f# V5 `1 m2 S r/ f
- char *dmabufsrc1 = NULL;: `' [$ \6 \3 O5 W) B* D* Z
- char *dmabufsrc2 = NULL;4 @1 @4 ~8 L3 D2 z6 j
- char *dmabufdest1 = NULL;- d7 D) z) F, N5 a* |6 ` q1 g
- char *dmabufdest2 = NULL;
1 r% I" q( v( }/ \1 J6 z D - + f" b; L4 P: X0 L
- static int acnt = 512;
. H2 R2 O! @3 ^* u4 a - static int bcnt = 8;
1 ?. [! O1 f3 T& y5 D - static int ccnt = 8;
( V3 k# K1 }+ j5 t ^: m - M2 k' C# C6 w' z( w
- module_param(acnt, int, S_IRUGO);" Q9 U7 g4 b( a, Q9 M
- module_param(bcnt, int, S_IRUGO);
& Y8 ^5 f' a4 b& T1 ^3 m+ Y - module_param(ccnt, int, S_IRUGO);
复制代码
' k- e6 _, u5 X) A7 l* a, o5 |* `# U+ R* G+ O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 L( l+ }1 o4 Z4 S9 r& h0 o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 J1 J4 d* [0 y; P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# ]& y; X+ U! y7 l! m
0 @( b& h, n" H9 c' D- ?& T5 Y' b3 N" R9 S+ N
|
|