|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. n' L7 z5 \" j7 T% V- [code]EDMA sample test application' @ v" ]# Y, y7 c
- /*# g4 u; _! V: R! x* B2 D% L4 i I0 N
- * edma_test.c
8 a9 f$ w ^ f3 c - *$ b+ ?% I5 n' D/ F
- * brief EDMA3 Test Application
H" d+ c7 z/ w' i) J - *: U# }' I1 z+ k/ m8 F6 v% C
- * This file contains EDMA3 Test code.4 E1 Z4 Y. ?; `
- *
$ w/ M9 G8 `" L. A# D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* u1 V% @7 W. T) c3 r9 g4 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. m" E7 y# F" ?" O4 K6 a B# c L: S - * TO CHANGE.* O# {6 S p9 e/ E: p& Q
- *
- L d( z* u9 h, {# l3 y4 f1 m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ Q8 m7 B' G" \% f1 a$ K
- *9 }6 z9 d& U" x' K/ Q
- * This program is free software; you can redistribute it and/or: c- N4 ^0 D. e ^8 V; w; ?
- * modify it under the terms of the GNU General Public License as
$ t( v' _ a% e - * published by the Free Software Foundation version 2.3 y4 i g6 {. h- H7 v
- *
3 r) r3 j5 z6 z5 q4 i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 i0 [# \4 T- T6 \: S2 ^2 Q+ [6 O - * kind, whether express or implied; without even the implied warranty
: z( s! |, e! t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 l( n9 R; S& v1 J- A - * GNU General Public License for more details.
3 ~% M8 E0 E q# B8 z7 q! u - */* m2 `; H# o5 `
x# G4 i# z5 N5 t& S* @- #include <linux/module.h>; o) S* j: y4 K Z% r% W% S, ]
- #include <linux/init.h># r1 ]- v% C7 r3 S6 S
- #include <linux/errno.h>
$ q0 z) _0 w% i0 I# s c - #include <linux/types.h>* r8 J+ f; D# |" q" N. [' l% S
- #include <linux/interrupt.h>
Z- }# i3 x5 m0 Q - #include <asm/io.h>, W p( |( A3 X% w. e8 l3 Y
- #include <linux/moduleparam.h>& }7 J. h, {, K- H' q! X, }
- #include <linux/sysctl.h>
$ }; A4 U! r: W( w( ? - #include <linux/mm.h>
4 k& o2 B) Y3 ~5 T7 G - #include <linux/dma-mapping.h>- `$ A+ d7 `, p5 K
- * t0 [0 \2 c/ M4 [5 G. G% \
- #include <mach/memory.h>" d# `: ?* I) Q% Y- |2 M
- #include <mach/hardware.h>% D: F7 l( L; ~% J; B; _" X
- #include <mach/irqs.h>
* s0 v3 m1 Q" |: q/ x8 c8 j - #include <asm/hardware/edma.h>
0 v) J& t7 j1 L) ]6 X - 9 O1 o8 R" r* \% O) b, P: P
- #undef EDMA3_DEBUG! F5 g/ G" H0 c. x
- /*#define EDMA3_DEBUG*/
" Q L! F3 ?" u8 B - 9 D% _ R' D* j( J& a, ^
- #ifdef EDMA3_DEBUG$ J4 k' T8 X/ y# g @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 G ^1 d3 G. }# x& W! |- e5 H5 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" U' P8 ^9 f1 Y7 W; l0 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Z* ^" n% e9 A# c( l+ J% P
- #else# h5 f; f( E6 O
- #define DMA_PRINTK( x... )
( S% _3 D1 z( N# T# ] - #define DMA_FN_IN
$ s; n0 P" ?9 d) v - #define DMA_FN_OUT$ ~' z: G4 _+ T% z7 h; \+ L3 o- h* T
- #endif3 Q$ q6 N0 N: X* J, z8 Z
- ) X8 H5 n. o ]! U3 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 {9 M0 l( ^! l - #define STATIC_SHIFT 3
: d* t* V1 w; @% T' n! F! H8 V - #define TCINTEN_SHIFT 20* k* U& B* x9 `& {- V, I% m
- #define ITCINTEN_SHIFT 21; Q. q" {0 q4 r' Y& M" i8 |
- #define TCCHEN_SHIFT 22
5 j7 v c/ k& F - #define ITCCHEN_SHIFT 231 g" j$ j5 M% A8 [6 ]; E
7 `3 G; Q8 G$ D$ o- static volatile int irqraised1 = 0;
, Q! q: V2 `; b; ?3 _! q7 a - static volatile int irqraised2 = 0;
( J. A8 o1 ^+ n( x. A) O - , }2 D, V3 u$ f5 p- z# J' @; F2 j$ l3 n% k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) U9 H0 B" e( ^/ w6 d) c% g# \! n o) | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& f7 f& f3 C( u7 w) _2 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 m; p+ F+ q1 p! b1 y - 1 c; I! j& g4 Q8 g: [- ^
- dma_addr_t dmaphyssrc1 = 0;
& ]4 l5 B2 B) b' Q6 ~ - dma_addr_t dmaphyssrc2 = 0;9 ?* y) J4 z% G1 I" B2 a
- dma_addr_t dmaphysdest1 = 0;
& a9 I( }- U) a: o+ t; Y" L - dma_addr_t dmaphysdest2 = 0;: K# h, w* h- R) U
2 U0 h5 }# a* i- char *dmabufsrc1 = NULL;
4 A7 B3 n2 L) E9 V. r - char *dmabufsrc2 = NULL;8 L) i# m8 U/ K
- char *dmabufdest1 = NULL;3 N$ _; T/ y2 L
- char *dmabufdest2 = NULL;
! ]- h0 e: {+ S4 ]) N8 j' p/ q - K0 q/ V2 r+ i
- static int acnt = 512;
( @' N4 t6 U# Y- R0 X9 O7 n2 J - static int bcnt = 8;# A) ^9 K5 N" N' e+ r5 e; W+ Q& X
- static int ccnt = 8;
2 V6 G: h* |5 D! C b/ U+ N - * a- X7 J) A2 X# m) Z, P
- module_param(acnt, int, S_IRUGO);
! e6 r# y( S7 I& g7 t. ~ - module_param(bcnt, int, S_IRUGO);
5 [- u2 \1 D. e. t - module_param(ccnt, int, S_IRUGO);
复制代码 ! r$ J+ G1 E u% R" D8 x
3 C$ e" _: g" ^1 C: Y `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 w3 x9 j6 u+ j9 o- b: l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* i0 o; u& J* ?$ v6 {& i0 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; M' C. j1 Z a; C3 U% `' {; h4 |; N( N" I
$ C( ?" Z+ Z' t% V |
|