|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 g1 k# h5 o2 I2 |
- [code]EDMA sample test application5 x4 j+ V9 o2 U6 {! n4 J
- /*
2 \3 W; N% h" F0 Z: I8 k0 `: ~ - * edma_test.c+ F& |9 O' u: c: c# h6 ~$ y8 S3 S
- *
- ]0 K2 v5 k" n; k5 r - * brief EDMA3 Test Application! m& v2 Z$ m. _) Y: P2 R
- *
3 p( }* A; y, h: h- T - * This file contains EDMA3 Test code. w/ {/ K9 z! X; q, o: I
- *5 C& \( ~) N9 Q6 k; [$ f0 f" }& _: y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 w' {% n# ~4 i( m, h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
a; I7 @: f2 Q, Z! i2 ]5 H' u - * TO CHANGE.
. i: n7 r' V4 n+ W" v - *, j7 I3 A/ D& T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 Q2 q8 _, d' u9 \% T4 d - *
% l0 h5 P p) p: `1 l: @ - * This program is free software; you can redistribute it and/or
# n. m0 | ^: D. a - * modify it under the terms of the GNU General Public License as7 c: l4 k- i+ A8 T9 \. D
- * published by the Free Software Foundation version 2.3 s+ t6 P4 _& }
- *
]. B7 b6 ^5 B0 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" d7 R' O2 j: Z3 X* P# u - * kind, whether express or implied; without even the implied warranty8 z" f; S9 q9 q* P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ ~. g9 A; V: c! K3 \$ Q7 ^
- * GNU General Public License for more details.- X5 `6 R8 I' I, c* Q/ \& Z. v
- */8 m. j) b9 _1 ` q8 N$ b6 k2 [- M
/ R! k) X# D4 X2 Z4 {- #include <linux/module.h>! S7 O2 m3 r6 P: j. y+ P; B1 h; N
- #include <linux/init.h>
+ a6 e8 ]! }! \ - #include <linux/errno.h>
- M8 N: b' g( N1 i3 L( ]$ B - #include <linux/types.h>$ }: Y! {% I5 \$ a! z; S: j
- #include <linux/interrupt.h>" d) X8 o" t" k/ O( t
- #include <asm/io.h>0 ?# ~: o0 c* a8 F) p5 ?. _
- #include <linux/moduleparam.h>
# h- d" U J2 |) | - #include <linux/sysctl.h># N- m0 y/ B# i, A7 ~+ \; p1 O
- #include <linux/mm.h>( c' K3 B9 F* G" n
- #include <linux/dma-mapping.h>
" w `+ Q) K& Q
b1 M( ]. s7 b8 c6 Z- #include <mach/memory.h>
/ h8 a' e) }3 N5 g* |" l/ H - #include <mach/hardware.h>5 V! H& Z& {0 ~( {* e! z
- #include <mach/irqs.h>
- b1 c2 }1 ]( H# C* j& R# l7 z - #include <asm/hardware/edma.h>; N) s* [+ c) x7 g; e: n6 M" W
- 1 B k9 \0 m$ d D ^' \5 r4 u
- #undef EDMA3_DEBUG8 |3 C. T4 Z2 ?
- /*#define EDMA3_DEBUG*/ m' w2 N( R E$ Z
; X# f$ _% I& ` E$ h. g7 b- #ifdef EDMA3_DEBUG2 U2 x7 w9 h* n [$ u V, _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 \- @) ^5 ?. H& h2 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); X9 }9 ^% z1 W/ @7 f5 r0 a" Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: V0 L2 R$ B- i - #else" w$ r5 e% w* O3 N
- #define DMA_PRINTK( x... )/ b- N8 \ z$ ]
- #define DMA_FN_IN& F/ a' n( Z1 S, M) V' |
- #define DMA_FN_OUT
7 j! \* E+ U, l7 c2 I - #endif
& }+ d$ T( ^+ v3 A2 @0 L4 {! t- f3 a - : @7 q3 L: J0 ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ q9 N1 c- k; E' v8 L% Q" G0 W! c4 q
- #define STATIC_SHIFT 3+ e) k+ c- G5 k9 `+ n
- #define TCINTEN_SHIFT 20, ]: d" I% j5 }- }4 m* c& x9 ~9 q& U
- #define ITCINTEN_SHIFT 21
" u7 |1 r! d7 Q& G' G - #define TCCHEN_SHIFT 22% _5 X0 Q" b" C. ?* h, z V1 A
- #define ITCCHEN_SHIFT 235 V+ t# y4 W- ]( a5 o+ S
- `- f- q# r* K0 ]" ^
- static volatile int irqraised1 = 0;9 P. M, \4 S( J% J" k% b& U
- static volatile int irqraised2 = 0;
5 o2 y& S5 f7 D W6 }3 f - 6 h4 ?: R% y" a2 l7 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: i4 x6 f" q) T7 ^/ T- y/ e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! P; [' p* n0 p5 o# U$ p# W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 L/ F) h/ @8 I0 L$ H- V5 C7 Q0 L - " a2 r( R6 S V! J
- dma_addr_t dmaphyssrc1 = 0;+ m& x- x* f0 I' \7 m
- dma_addr_t dmaphyssrc2 = 0;6 j I( ]# i9 D2 ^
- dma_addr_t dmaphysdest1 = 0;# i' p4 M. l* R7 B4 F \3 T
- dma_addr_t dmaphysdest2 = 0;. Q: t; S7 z8 K1 E
3 M3 |1 e" d, s& z4 Q4 J" F- char *dmabufsrc1 = NULL;" N) h$ q; P; Y
- char *dmabufsrc2 = NULL;3 I' j* V' `, B K+ {
- char *dmabufdest1 = NULL;
$ Y' u8 G( x- [7 N! s5 r - char *dmabufdest2 = NULL;& h) X+ O! R1 u! G
, t$ ?- E8 o0 k9 @4 `! c9 D- static int acnt = 512;
: }3 u* H, H% d! L7 d - static int bcnt = 8;
1 I8 y' _# g) R% Y& }2 g) _ - static int ccnt = 8;
1 W+ ~8 n' b( o8 S& y# t! d3 q - * x5 p0 [# r! ~" r
- module_param(acnt, int, S_IRUGO);0 m- A. P% @: s' t1 s
- module_param(bcnt, int, S_IRUGO);
, m& M* @& p% q. v9 W& D - module_param(ccnt, int, S_IRUGO);
复制代码 6 E. O/ Q) Z N
f; Z% F x, j6 I/ J% d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 t) L: p2 f1 X r7 _. S5 M4 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ b. @" a$ o4 \! w% B/ l0 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 f9 ~* Y6 ]: a8 e8 d- K9 b3 |1 R
( ~0 _# L3 C) s3 }: x# v |
|