|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
T: T# z% b S9 }$ V7 |& U- [code]EDMA sample test application, X3 o( O. C, \, N, o5 j9 g
- /*
3 B- h% m! L6 R' B6 W - * edma_test.c
7 N) F2 l3 T* o. @$ H; O' [$ k$ ] - *
3 T8 C, V1 F5 b0 P9 ~% M" S - * brief EDMA3 Test Application. e6 l" |. L7 p( n( T
- *; E4 f6 ?/ j- Q+ F
- * This file contains EDMA3 Test code.
- I5 b" `( D# V U: f7 | - * c; R, P' Z6 g% z5 B$ k3 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( |8 H4 D$ V& o8 n5 S; r. ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 Q6 D+ A: C! J) U - * TO CHANGE.' B7 {( [" w) k; z& ^
- *( F, T& ~' a0 ]) v+ F) S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( Y. _5 _) l3 C& p; F k - *
- P. N' d! ]6 ~0 a3 G& b% A' @ - * This program is free software; you can redistribute it and/or
5 w) h0 N; B+ C/ ^1 ?; X - * modify it under the terms of the GNU General Public License as, c1 q/ j8 E/ J
- * published by the Free Software Foundation version 2.
1 p+ Z' C. G' w! N# N - *
0 \1 a' _6 M$ Y+ c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 S8 a1 c! r3 \$ d- r - * kind, whether express or implied; without even the implied warranty/ K% d; f( u: W* C4 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 L/ N# x' p7 X! ?; r# q - * GNU General Public License for more details.
0 \. f1 `# g& ~ - */8 S# ?! V4 C* B
- / @+ g1 H- m# M
- #include <linux/module.h>3 }9 J# L* r: ^# v2 ?& w% i: x
- #include <linux/init.h>" ^1 e+ }' j4 N$ ?
- #include <linux/errno.h>) Y o9 A5 _6 X& g6 C
- #include <linux/types.h>
# l& I2 I: Y' z: u! H - #include <linux/interrupt.h>! k( V0 A1 I- u
- #include <asm/io.h>/ |; f4 r2 y5 D0 E# j6 k2 ~* z
- #include <linux/moduleparam.h>
- M% s2 J& F! q/ i/ O$ j7 e - #include <linux/sysctl.h>5 L/ `3 o; F/ |+ z& k" X
- #include <linux/mm.h>
$ ]! l. }- @/ h - #include <linux/dma-mapping.h>
% E5 i- R5 Y+ H: a* Z4 L5 N - , k0 h5 g' O0 K$ [5 U
- #include <mach/memory.h># H* m. z1 r, C+ B& y2 L/ M
- #include <mach/hardware.h>
; Q$ u V& \( X9 y; U* I* G - #include <mach/irqs.h>
4 j5 ?; I2 X8 S4 H1 I, ~ - #include <asm/hardware/edma.h>
' H' J3 G) ], E, y3 e9 l& L
% u+ M: Z) n! B+ ~! Q N, }- #undef EDMA3_DEBUG
, T0 d/ _6 K* U8 Q$ O - /*#define EDMA3_DEBUG*/
! X& m4 T. z4 w/ K! q8 g
& h* z/ p) q: c5 ~' L- #ifdef EDMA3_DEBUG$ m6 ?2 O7 u6 {2 e M7 l# ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ o% H. k; I4 d. D4 q3 I* z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ f9 Q9 s( A9 g, |0 d" K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# F0 N' C3 M4 V4 x/ U% `1 O
- #else& U( Y; O( j- |+ t4 a4 ?' q& i
- #define DMA_PRINTK( x... )1 |1 k- P; s: A" K& D
- #define DMA_FN_IN' ]4 ^; V5 L) q2 `' n
- #define DMA_FN_OUT# C' b& }7 s: p% }
- #endif
$ b' E8 B1 I, o, \2 T* s; @8 j& [4 h
! }0 p+ B A$ D# ?8 m8 b {% M7 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' R: U- e1 e" \( U" t
- #define STATIC_SHIFT 3
. H! R* m& ]# l! g0 A/ ^ - #define TCINTEN_SHIFT 20
6 f$ p9 Q2 H9 h% y6 d, B - #define ITCINTEN_SHIFT 21
, t8 B. p2 L2 | - #define TCCHEN_SHIFT 22
6 F5 P; c! l9 o8 c e) t - #define ITCCHEN_SHIFT 23: S+ ~. y8 a( [) r9 z* @/ l n
) J( e) x$ P' J- static volatile int irqraised1 = 0;
/ n+ B' d7 ]$ v+ g! q - static volatile int irqraised2 = 0;: D( m& a1 u" T( @! I9 [
- , S2 M% {* v; E4 N/ z& x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ p. I& N2 ] q2 ]! H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* T7 K# B6 t, q' z) I( c- U2 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
W+ l5 u" | K
% C* S' Z# \$ F0 L6 {9 v- dma_addr_t dmaphyssrc1 = 0;
; |5 R9 }5 j3 F0 X1 ?$ V0 b - dma_addr_t dmaphyssrc2 = 0;
6 Y+ T: V! o7 X0 j/ U3 _ - dma_addr_t dmaphysdest1 = 0;
- v' W; P# r! R% a: f+ N% g' H) ^ - dma_addr_t dmaphysdest2 = 0;# n z! _: @. t' F$ E% X# H
, Z {; U i- v w. W- char *dmabufsrc1 = NULL;7 k( H d) x3 V i& j( u, p$ s
- char *dmabufsrc2 = NULL;
, U: |+ ^: y& I - char *dmabufdest1 = NULL;5 c# c$ O# l' N0 ?! \, z7 b
- char *dmabufdest2 = NULL;$ E% O! a! U9 t! m3 e
v0 i% @: B d( ]! X: b$ s- static int acnt = 512;
9 L6 R5 q$ T, e6 w - static int bcnt = 8;9 x4 ?3 \3 p' X, i5 i- R
- static int ccnt = 8;4 i6 l1 e* r! {) @% s
, |& E# A5 V$ T. A- f9 m- module_param(acnt, int, S_IRUGO);
, T9 A( I" |$ e& M - module_param(bcnt, int, S_IRUGO);: j! ^8 R. P3 r( _# U' G& Q5 X6 R
- module_param(ccnt, int, S_IRUGO);
复制代码 + [2 Y* t$ Q, @% u1 Y' D
* E0 _5 ?4 s0 ^+ Y6 D i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) B- S( o9 g$ W! S {) v# V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( f# h1 F! A- G$ T" T; A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# p& f4 Y: h( E- ^' \( \, _/ _ Z" D2 s7 g; g4 E. Z
( U+ i1 T" ~- O$ a+ ` |
|