|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" U8 |6 p8 C6 u0 u# y3 e* G) P( I- [code]EDMA sample test application
; o) j3 I3 K3 j$ Q2 ` - /*
( i% v! |& C8 e0 x- i7 ^3 X$ G - * edma_test.c
1 r# L0 n* B! I, S - *) \0 M \. U+ J% l
- * brief EDMA3 Test Application
* k9 k2 R, s$ T/ T& c& w$ k$ e$ [ - *# x4 z/ b0 Z. w( {8 q' b3 A
- * This file contains EDMA3 Test code.' Z" o5 U, s7 G p. A3 C# ~- a7 U
- *9 Y% T8 G- l& T8 \% g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ p. f7 U: S! Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 R" x2 q9 k7 Y' R
- * TO CHANGE.' u5 s: A/ b# F8 N
- *
9 Y0 y5 R B, Q: z6 z, b) e2 C Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! Y8 T( m l# P3 G+ y" o4 Q
- *
/ D# M8 A& z2 P - * This program is free software; you can redistribute it and/or
( i2 a( n, v3 H; J/ z8 c6 T4 w - * modify it under the terms of the GNU General Public License as7 K; C9 l7 A) G, A/ B
- * published by the Free Software Foundation version 2.' v% y8 N7 N) i6 \
- *
6 D" i- l) U+ h+ v. W# A7 W: x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 X* ^$ ~4 \" g x c - * kind, whether express or implied; without even the implied warranty
- Y1 V: _: r: a: H" T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# S5 \/ d' s( k! C' J" J8 }) M+ X
- * GNU General Public License for more details.
8 n8 @ ?6 a: t" L+ L& x0 P - */6 N% f+ ?! Q' Q1 c
# P& a9 m( H( E1 c* P& o- #include <linux/module.h>
' z! c+ B5 O% @0 _% O* O6 o: B# ? - #include <linux/init.h>$ J+ n# H' `" L4 a8 W9 l) b4 N0 u
- #include <linux/errno.h>
8 p0 r9 q3 p$ G& w8 C( `6 q4 | - #include <linux/types.h>
' \- p# u9 Q5 P - #include <linux/interrupt.h>
- m: ?4 m) c/ I3 z9 S7 C - #include <asm/io.h>
w. O. w4 S" B7 b: l2 r* r - #include <linux/moduleparam.h>- P4 N. R# ^0 M
- #include <linux/sysctl.h>
" v8 D. W! C4 Z7 e' \ - #include <linux/mm.h> Y6 w9 q3 p- a/ e: w: B* F
- #include <linux/dma-mapping.h>
3 {! k) M; `+ X$ i' F$ a
1 x \8 B" r3 h; z% P1 U+ l- #include <mach/memory.h>* P# z0 C' h5 p% Z& ]! E6 c
- #include <mach/hardware.h>
4 Q: t- w2 [$ s+ P0 C- o7 D/ i3 G - #include <mach/irqs.h>+ q5 k/ k/ X9 y% z) h* } }. T# D
- #include <asm/hardware/edma.h>
4 V8 S+ S8 X* h4 I" }6 o6 F% T! Y
( I2 M7 a1 O9 Z5 g7 X( r3 M! V- #undef EDMA3_DEBUG
4 i0 G7 G/ z: d6 a/ ^ - /*#define EDMA3_DEBUG*/8 a* t2 d( \: }9 Y V6 Q
y& m5 z+ m4 R5 R& `- #ifdef EDMA3_DEBUG
* N1 \3 O3 l3 H' J+ @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); H+ H1 F3 d! B" K* O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ E n- l. {% a( M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- q4 Y, v5 P! ?' A
- #else
3 _4 x- r9 K7 T- B - #define DMA_PRINTK( x... )
8 d' _# s: W7 c& |& p% J$ N - #define DMA_FN_IN9 `$ F/ s# L" n8 O, B
- #define DMA_FN_OUT
- J/ [/ G& j4 r2 v0 m - #endif
& E- j, b% o& R- B4 b( y0 x: G) e
" O6 \ g0 W# d, p' z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) g3 g7 Z- g- F3 C: ], i
- #define STATIC_SHIFT 3
; T, S7 L, w1 k6 B0 b: c: @2 ?- P - #define TCINTEN_SHIFT 20( g3 F* W' j6 _+ ?
- #define ITCINTEN_SHIFT 21
& I: C- @0 W/ O- B. j% |' Q& r - #define TCCHEN_SHIFT 225 A t) c3 L2 K7 h. F
- #define ITCCHEN_SHIFT 23+ Y% L3 c) L, t; g; ^
- ^) ]; H) v0 x. A) w) D
- static volatile int irqraised1 = 0;/ t! Z! x. W; s( S1 v$ o& O
- static volatile int irqraised2 = 0;7 B3 D+ `8 T5 g- E. p6 G
$ q8 u! x! b# Z3 ~% t$ t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X& c4 L! F4 e5 Z( j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 M0 c1 v6 d& e- F+ ~1 d+ z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ D! {! w" d: I3 i$ M* a; L8 g
% [5 K4 [) ~8 n7 y" B {: z- dma_addr_t dmaphyssrc1 = 0;, u6 A5 }/ B; c7 S
- dma_addr_t dmaphyssrc2 = 0;
; ]2 _6 n* i0 e" t4 z1 v: \ - dma_addr_t dmaphysdest1 = 0;1 j8 A6 s1 Z. a
- dma_addr_t dmaphysdest2 = 0;
8 W3 | Q8 l- b' @% E. |& f
, u- I6 |* f3 [- Q9 m- char *dmabufsrc1 = NULL;3 q5 X" X/ i' \, f
- char *dmabufsrc2 = NULL;
7 a+ F/ a! b) }( O) V' V' k c - char *dmabufdest1 = NULL;1 R- @ ~6 J2 P4 \: W; w
- char *dmabufdest2 = NULL;
3 F$ q& ~6 r7 r$ f7 ^4 }+ ?7 T1 y - ' U% z3 c9 W6 |* y- D9 i; _
- static int acnt = 512;$ }% {' P2 x5 w7 ]. I8 M/ ?. O; {# ^3 [
- static int bcnt = 8;
- a0 E9 `! y- i2 K, Z6 Y1 H' U - static int ccnt = 8;
4 A6 T5 s" n6 w0 S1 D) v7 q* S - , S/ M. s* D& y* ~4 K) \
- module_param(acnt, int, S_IRUGO);- m6 @3 Y! a7 a' R: {
- module_param(bcnt, int, S_IRUGO);; Y& B* t3 o/ d) R" W# j( t" h7 a) J
- module_param(ccnt, int, S_IRUGO);
复制代码 " @ ]; L' [. W3 j: p
1 N2 q6 X! O8 `, e) } U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 Z. M! d, w1 _& H0 H0 N( O4 @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 S. \* V3 C, S0 ^0 r3 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 U2 G6 Y$ @: Y$ V/ `# {7 M, v
0 M' ^, x1 }9 D. M& w2 s7 B# v% j9 Q& z- N {" T5 ~
|
|