|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! S3 {1 Y' Z9 v' ], J
- [code]EDMA sample test application# _3 l3 W+ x: C! C' a
- /*/ D. \2 p' D4 T( i0 j
- * edma_test.c9 s8 s. O+ Y3 U
- *
# T( L. \5 c! {, X; G: G - * brief EDMA3 Test Application$ L% [0 f% M* C$ W0 n( b
- *
. S, d" _; @) p$ s c8 [; ` - * This file contains EDMA3 Test code.
, W( U9 s3 D, z' M$ O+ B" p - *
% T1 ^/ C# _/ L! X* X; z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" [' W4 m! E1 a, F7 q) }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% s* @4 L6 ~9 U& J' ?( u
- * TO CHANGE.4 J \7 y0 ^" x# Z1 `' v
- *+ M" X, p, } `! W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ z- d$ T3 E, Z8 h( o+ r. l; r - *5 o3 v7 R/ Q( c% Y9 I' s' q
- * This program is free software; you can redistribute it and/or
% _6 c% G6 ^1 p" O& a5 s; L, V - * modify it under the terms of the GNU General Public License as
9 K/ C8 k& B: ~8 |5 } - * published by the Free Software Foundation version 2.3 }9 P' K a$ \) J3 `+ I
- *
* u9 l4 Z& h4 D6 \" Z9 I' x$ Q+ C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. o( ]" B1 ^* N0 b: }7 V% Y
- * kind, whether express or implied; without even the implied warranty
7 s% O8 c6 N( t% P2 K E9 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ W" u1 [$ P0 E, f0 m& U* \
- * GNU General Public License for more details.; h5 Q* k' }; ~ k: c; u
- */ M8 o0 @! n8 U& a, L' c
6 z& B- J, r8 V/ U1 n- #include <linux/module.h>
- f4 w3 e; e) z - #include <linux/init.h>
8 D& H$ r1 z ^ e" L1 h5 | - #include <linux/errno.h>
0 u5 L. u+ h T - #include <linux/types.h>; c) G/ Q3 h- w5 r! m
- #include <linux/interrupt.h>
# p4 ]- E: N- ?( d1 {" I a( R - #include <asm/io.h>8 F# ]7 c) g8 T1 E: x0 x
- #include <linux/moduleparam.h>
6 U, S0 i; Z0 U+ I, N2 ~ - #include <linux/sysctl.h>7 u6 v3 F; Y0 w0 p0 C* c4 m
- #include <linux/mm.h>
4 \! ]$ @7 T+ C) `) g - #include <linux/dma-mapping.h>7 l3 s* p1 z5 e T9 R+ s
- , G. |4 A& Q2 ~
- #include <mach/memory.h>
5 r/ x/ O% P, ^5 Z- v9 H6 e2 z) f - #include <mach/hardware.h>9 v4 X" f8 G' I/ M8 r- g3 N3 l
- #include <mach/irqs.h>
8 a+ l; R% t/ ? - #include <asm/hardware/edma.h>
: d; n' Y% z, ]3 R
. ~& a8 Y; i3 v, a" P. G( W8 D+ b- #undef EDMA3_DEBUG0 @8 S* z4 {! p: J
- /*#define EDMA3_DEBUG*/
1 l; M9 @5 V6 j/ X; B! d& X - % G, y- N t% b* s7 S
- #ifdef EDMA3_DEBUG( w" c/ K0 g8 l, b3 ]$ ^- P O/ e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ ? M$ U+ B- P1 K; o: y# J" F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 w0 F9 K2 n. G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 a# A8 c! `, U: v! k - #else% {* {) J: K5 ^( I" P
- #define DMA_PRINTK( x... )& v$ T, U6 {4 i) f* `
- #define DMA_FN_IN! j( I9 l0 q1 j; q+ @/ z+ A# b+ Z
- #define DMA_FN_OUT
9 @& v u6 b# O1 s# s - #endif
4 ~* ^/ [ E' t
/ d% @+ C7 P+ b, ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 S0 Z U' [+ o) ?1 T7 r$ f - #define STATIC_SHIFT 3- h3 m- M+ H+ l3 b r3 r6 H7 K% k* b- ]
- #define TCINTEN_SHIFT 20
8 {4 X% P9 g1 P) E0 f. ?, w, N) l- K - #define ITCINTEN_SHIFT 21
" l# L/ o, U, T0 l* a' Q - #define TCCHEN_SHIFT 22- H1 e5 K$ O1 F4 f0 L6 U) E" I
- #define ITCCHEN_SHIFT 23
$ {: _& X8 R) ` - ) P0 V7 a1 z* X, a
- static volatile int irqraised1 = 0;
' ~) [3 p! `8 x; w4 D# u& b$ ~ - static volatile int irqraised2 = 0;
[" U& W( @& r - 2 g0 m% d4 }. s. _, q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g) W8 m9 r% V# A2 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; }: f" f( x0 ?% ~& F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) C g4 S0 U- h. |! F. V
; j: [! `& l/ V' N- dma_addr_t dmaphyssrc1 = 0;. s# p% V( y6 b" f1 @9 ]; G; e( I& c
- dma_addr_t dmaphyssrc2 = 0;
; Q4 l) l$ S4 R( F6 W - dma_addr_t dmaphysdest1 = 0;3 |4 O% O: t, v2 r z7 n
- dma_addr_t dmaphysdest2 = 0;& R5 H) ^% w* A+ y5 Y1 I) A
T$ ~ i4 h v( b. e' H; {- char *dmabufsrc1 = NULL;
$ \: W' ?" [$ _2 g& A% K* A - char *dmabufsrc2 = NULL;
% i7 I/ m% p- W3 s - char *dmabufdest1 = NULL;
- p2 H0 \( {: l) K3 ]' | - char *dmabufdest2 = NULL;
( h3 _$ K; S. y+ Y' X- e
4 r1 q/ w2 M. S8 D, P0 \- static int acnt = 512;! o# T& M: X; y: B* I" R( r0 b6 Q
- static int bcnt = 8;& P0 ~3 S! S7 m& f
- static int ccnt = 8;
5 [+ U. ^1 }0 T - ) W' Q* L4 o3 C9 N
- module_param(acnt, int, S_IRUGO);
+ H% x2 r/ `& c2 e% |3 j; g ^ - module_param(bcnt, int, S_IRUGO);
: u% t- a# e6 `4 I9 c - module_param(ccnt, int, S_IRUGO);
复制代码 : K, z8 E5 K/ P7 y$ T$ R
" i2 j( W3 W4 s0 R3 Y6 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% R1 y! w1 O' X% F7 D. F6 D8 s& y9 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 W' l. I1 o& W* ?6 r8 q5 d* Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; J* n& ], R1 a8 j; I$ V- M; N9 Q, t, S: A3 i
/ N+ _1 H3 Y8 B6 n4 |) p! {$ O
|
|