|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ S% i5 P+ q% a% ~- [code]EDMA sample test application4 s( l, h" T) p7 x0 c( E
- /*
* k4 m& L- \" ]+ ~- C! j7 Y# a* _ - * edma_test.c
( L: |, c) u$ ?+ T/ _& P - *- s, r2 I2 m' Z" D3 {+ B9 `5 s6 R
- * brief EDMA3 Test Application' W$ d+ {# O% z/ ]) v) `, D
- *
) N$ ~- h5 d" N: ~4 k, S - * This file contains EDMA3 Test code.
L& a+ N6 ]# H9 O0 \: R - *
$ t' k* x% n9 j" H% _! q% C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 k% s( O8 f3 C0 P: L9 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: l( k3 b9 a8 G, D - * TO CHANGE.
+ e- l# e0 X$ L O/ I! V4 g1 R - *- ?3 f0 h& [2 L* |4 c1 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: u* z; ^8 Z5 l2 y' i - *
& @; X! O* Y/ r" I0 n - * This program is free software; you can redistribute it and/or- W0 o( ]7 c! r' K$ {8 {8 X
- * modify it under the terms of the GNU General Public License as
# V8 e( c! ^8 Z6 K3 W5 w( h - * published by the Free Software Foundation version 2.
5 p8 {( U# ^; U( m# u - *4 t" ]5 T& n {2 m0 V3 K& _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' K' a2 _3 K0 j0 J2 o& Q: U% o/ A
- * kind, whether express or implied; without even the implied warranty
; ^ X7 z. P: s2 I* C% l X+ h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, |0 ]& a3 y4 ^! i. d% V - * GNU General Public License for more details.
8 h# a F4 z4 t; h" ?. O - */
+ ]7 @6 P/ \0 j( V: s# ]/ K - 6 G/ E- O, ], N' g. ], D
- #include <linux/module.h>
) G& r d4 L- j' \; T - #include <linux/init.h>
* ^( x* M2 J/ s - #include <linux/errno.h>. S$ _5 o4 k! d: W. |% E
- #include <linux/types.h>! h3 _% {6 t2 X( F. j
- #include <linux/interrupt.h>. L2 a1 |$ w* T7 g; H7 Y, n
- #include <asm/io.h>3 }. w+ F3 S( I; U. ]. d
- #include <linux/moduleparam.h>
& l2 T; b0 m" c - #include <linux/sysctl.h>3 x; s1 y* m9 F: Q* [
- #include <linux/mm.h>0 |( H/ W! o& ?) s
- #include <linux/dma-mapping.h>1 }" ^" |) d# t$ H" E
6 ]1 i2 m' q9 O" c6 C# x t- u9 s- #include <mach/memory.h>
6 g1 n6 H; v) X# p) p+ j - #include <mach/hardware.h>6 l. x4 d- i8 D: ]( c: r- q
- #include <mach/irqs.h>' i/ x0 i4 p; u1 P7 W0 z
- #include <asm/hardware/edma.h>2 w- R: H4 m2 F
/ s) s, B9 \+ u0 E- #undef EDMA3_DEBUG
3 e0 A6 p+ F* D% L - /*#define EDMA3_DEBUG*/0 _0 a7 \# P# ?
- % l: W6 U+ ^+ I; T5 }* N$ {6 w
- #ifdef EDMA3_DEBUG" s/ |, W' t! w1 V* [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" T' F( N8 k9 K, L, T0 h4 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 N1 u l" d* s$ o3 A4 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ^2 I1 m M+ B& q) }$ Y - #else
" X4 y, X! p9 ^7 [* l( G4 h - #define DMA_PRINTK( x... ) e6 Z) z6 C/ h5 M/ T% s G
- #define DMA_FN_IN0 Z2 r0 D" P0 w1 Q8 l
- #define DMA_FN_OUT" M0 Q! a M0 V) }7 y
- #endif3 F8 H+ M3 C8 a3 l# X
- % K0 Y0 c$ F$ u2 w- M$ H% {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 B# Q0 Y0 _# Q, t9 a5 M) H - #define STATIC_SHIFT 3) V6 A' t; n7 y" X9 R/ N0 j
- #define TCINTEN_SHIFT 202 _/ U5 _7 f: D* y
- #define ITCINTEN_SHIFT 21
+ p% ?1 Q- W1 U# N - #define TCCHEN_SHIFT 22 G& p6 d: j* E4 w( A: _. v! c% g
- #define ITCCHEN_SHIFT 23/ b& `0 h7 ?- @
) D- p5 J3 a* J, Z: @- static volatile int irqraised1 = 0;" R' L% m4 {9 O; Z+ f1 } a8 s. f
- static volatile int irqraised2 = 0;* i f; b2 |# z" P7 ]4 k/ l
3 E: n, n: _) ~5 G+ W) K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ~- F& R' L, [. E. B) F- T3 ?5 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 U. K: t: o/ w3 S% X2 y1 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 H2 |, A: E2 y - ! H& r* S% m5 B7 y: c) H
- dma_addr_t dmaphyssrc1 = 0;
5 Z4 @' _; K5 B% W* e! E - dma_addr_t dmaphyssrc2 = 0;# ~" a; u# a" S4 m9 }6 k
- dma_addr_t dmaphysdest1 = 0;6 T- a, Q6 E- t5 J, k$ s
- dma_addr_t dmaphysdest2 = 0;
! I) K4 |: n$ e$ [/ ?: P - / _6 T' v1 ?2 a( V8 {
- char *dmabufsrc1 = NULL;7 u; `8 n$ ?: B4 u
- char *dmabufsrc2 = NULL;$ n) d( N8 q: S% L% m/ L
- char *dmabufdest1 = NULL;9 X7 C& m& [/ l
- char *dmabufdest2 = NULL;# |9 h9 \, A, p' n( G
- ( O% h$ a; U, k8 [0 _" \
- static int acnt = 512;
# U: Z! H/ b+ J - static int bcnt = 8;
2 t* ^& l5 Z( x6 w, ~- w4 } - static int ccnt = 8;
# x2 X) R1 \1 `/ ?0 |3 n# u( y
1 p! Q) b; z' P2 b5 o- C+ E- B- module_param(acnt, int, S_IRUGO);) D0 f* H' @- t, B( |9 z3 _0 H
- module_param(bcnt, int, S_IRUGO);
5 w0 P5 A' [5 F/ `, J t6 ` - module_param(ccnt, int, S_IRUGO);
复制代码
7 E# `, n4 m- I5 p8 E3 ^
, _- k, H2 Y) z' \1 p; |. t/ h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 l2 Z- A7 L' z& @: c7 ]8 n/ {9 c6 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 n! T1 g0 h; ^8 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( V8 r3 \( j# M0 ]5 H/ R3 T& M- x Y
9 x9 J# Z# V/ k6 ?! Q$ ^2 M- `
" ]7 x7 h& u9 R- ?
|
|