|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * N1 p8 i9 m; A- _5 j4 U+ N$ m1 D
- [code]EDMA sample test application- B& c8 k7 i9 a& v$ y9 E3 G. d& j* w
- /*
8 E! L- g }. `! m U2 E - * edma_test.c$ W7 P" T9 ]8 V6 L4 L/ U6 V7 d
- *) j. p U# m+ _- [( v# k/ w) i
- * brief EDMA3 Test Application! _* N* n- g- J
- *. y/ D5 p! m/ f* C8 s; x5 K. q
- * This file contains EDMA3 Test code.
7 Y) v) u2 @2 G - *
- F: n- w, x' P% [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 D8 L/ Q8 S- h9 ?- Q# @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# \( e7 K; v3 d; B: ]. V( Q - * TO CHANGE.
+ {! O$ d2 h$ R1 L: X - *" Q5 B. y G$ B$ `3 \# ~: X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 v8 @0 i* c5 R2 V* P6 Z8 U
- *
" M7 S- l& j9 ^+ Z0 V2 s+ h - * This program is free software; you can redistribute it and/or
. [) @' l. h4 u; s5 B. \; q# U - * modify it under the terms of the GNU General Public License as9 _4 L1 t, G3 m( Y( Z( S) X
- * published by the Free Software Foundation version 2.- G1 O1 o' T" }
- *
( c+ R# i, |7 h: X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 G, K7 y1 }( p$ G1 t" l
- * kind, whether express or implied; without even the implied warranty
, T( D# d' C. y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: D( r+ X& V2 q, o5 |5 y! `: E - * GNU General Public License for more details.
4 b0 h) v% Y9 ` - */
/ K7 d7 c0 w" X5 d9 I, w8 u
+ L6 h3 \7 u( I3 b5 I" |9 r- #include <linux/module.h>
2 y* v8 I q& A7 V - #include <linux/init.h>
0 O# V4 B: |+ _, C5 A - #include <linux/errno.h>
! _( h7 |0 N/ U% X% f) Y - #include <linux/types.h>
" R: D& N8 u' t, C5 q - #include <linux/interrupt.h>
, C9 f/ K! R1 Y2 T - #include <asm/io.h>
5 c' Y9 m, E( h5 m - #include <linux/moduleparam.h>- f- c2 x( i: p$ ?1 z4 G# ^1 H s
- #include <linux/sysctl.h>
, \) w2 {. k8 C' Z' z8 J - #include <linux/mm.h>9 u+ v9 I- u( b( T* G) @
- #include <linux/dma-mapping.h>
8 s/ J+ T4 V! \
- q% ]% h% F. y6 I$ D2 R! ]9 X- #include <mach/memory.h># E7 {% Q+ R$ B/ E2 |/ k% S) j& p
- #include <mach/hardware.h># W6 {9 o1 P. H: ^1 n# c
- #include <mach/irqs.h>
& O5 \" |! Y9 i7 P - #include <asm/hardware/edma.h> x( Z4 d _1 N9 t: c2 c/ R3 l
- 4 [. x1 [$ x5 z: F' \
- #undef EDMA3_DEBUG. U: B/ E- k Z/ X* m4 S, b! X
- /*#define EDMA3_DEBUG*/
: M+ s2 B7 J: {+ ]; U( |& r - - L+ X; X! U% ?3 m* R
- #ifdef EDMA3_DEBUG( |4 I+ J% p; |8 y* U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& }/ s( B$ Z% e- p1 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ W$ \) D/ z1 _& V/ ]% } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 {) `$ Q N. T3 z3 A) H+ w - #else; K& v0 i7 o8 Q
- #define DMA_PRINTK( x... )3 f7 {; K+ l0 Z* b7 K
- #define DMA_FN_IN* Z0 A' y6 S- I% ?+ D& n3 J
- #define DMA_FN_OUT d. {7 H& [9 s4 X' s* x
- #endif
2 D. l5 t9 U/ E; b# V - - {& t8 ^1 s. Y$ t( M: P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 W# Z6 j9 l- F( n; a - #define STATIC_SHIFT 3
6 g; m8 o, t9 \! K% ` - #define TCINTEN_SHIFT 20
5 \9 A$ R5 Q1 J: h! W+ F - #define ITCINTEN_SHIFT 215 z- d# N' D u' L3 v3 ^( U
- #define TCCHEN_SHIFT 22; H) w- q/ u7 X' U" j! Z
- #define ITCCHEN_SHIFT 238 x( S: R7 `9 y" c5 L6 y
- \6 P' K; a7 V" g8 U
- static volatile int irqraised1 = 0;& Q: p6 R5 q$ ]& a e$ ?
- static volatile int irqraised2 = 0;
* Q) o' n" k2 d5 I
- v& A k* ~: J! _* r4 M8 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 s5 T1 B; B) U' M) L9 k8 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. R* @. U1 o0 E1 E: F$ `( i$ a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" z8 }0 P, a! c! r - ) O. m# d0 j; e1 [, f8 ]6 U
- dma_addr_t dmaphyssrc1 = 0;
0 Q8 b0 B+ h b+ d - dma_addr_t dmaphyssrc2 = 0;! H: w/ D) G( b, E/ y
- dma_addr_t dmaphysdest1 = 0;
+ s k. J+ {6 t# k - dma_addr_t dmaphysdest2 = 0;9 I0 Z; z P$ y. c; H: Y
- ; F6 @( O! @5 ^ g
- char *dmabufsrc1 = NULL;
6 Q& O! x: {, O3 h1 ]" y+ ?4 G' _0 v - char *dmabufsrc2 = NULL;
9 z% N; N' i. }/ C8 M6 d% S8 J - char *dmabufdest1 = NULL;9 U! u% Q, K- v [
- char *dmabufdest2 = NULL;7 O$ j' O6 w% l: B( ^
- $ O1 w/ R# P, y4 i
- static int acnt = 512;
" H% S8 J9 N" @8 f- c - static int bcnt = 8;# a* W9 ?& g. `: \( n2 w
- static int ccnt = 8;7 P8 ?/ I8 d9 I2 i' v" `# M# S4 Q) @
- * o/ q. V( K1 E
- module_param(acnt, int, S_IRUGO);' ?$ `1 b4 c. o; t1 K& A3 m
- module_param(bcnt, int, S_IRUGO);, e& ~3 ^" b! P+ h; k/ K6 d
- module_param(ccnt, int, S_IRUGO);
复制代码
: I6 G! V( Z0 E6 [: s1 e0 Z/ W# T6 ^$ ]9 ~% `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" r& q g- D5 P# q+ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 P! e0 |9 s3 j) t& W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( }4 H& P, Q# E( }
8 Q R0 A6 }1 \; N% f; W$ [) ?& b
1 c; `% D0 I4 z y1 B2 M8 I |
|