|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
a6 I- R9 g f+ A# K- [code]EDMA sample test application2 W1 Y/ a* P7 e. l7 ~, `3 }) a" n
- /** V2 a6 n. k* Y' X0 c; ~$ ?& x
- * edma_test.c8 ^1 j; @/ x1 O+ ^) Q2 h
- *
K. g4 ?; Z. c9 H/ | - * brief EDMA3 Test Application
' M8 P% c9 z9 T3 y - *) W8 `. r8 Q$ M, e6 S% A: F
- * This file contains EDMA3 Test code.9 }; M) X) E- J/ {
- *
! \+ [4 @1 C: G/ T9 c4 D: H9 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 V* G& Y, {1 w8 Z) P" [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! ^$ u1 H5 g+ Q' e - * TO CHANGE.( R, q) p2 Z( f @6 _/ R$ |( t$ `
- *
# x$ z( \2 K) }7 Q8 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& n6 |8 N, K3 b$ i, f
- *% Y) {6 @6 y- M
- * This program is free software; you can redistribute it and/or: D$ ~8 r3 v' {4 e0 t9 V
- * modify it under the terms of the GNU General Public License as
# e3 L4 G7 j% ^0 R - * published by the Free Software Foundation version 2.
p: ~$ R( z& x3 C - *
" E4 H, C+ k% ?* r9 m8 d8 x9 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ [( _6 f$ ]3 Q" l& U9 T - * kind, whether express or implied; without even the implied warranty
* k6 ^$ u2 M( S _9 N5 u7 D( W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% ]/ Q0 m" t0 ?! V q - * GNU General Public License for more details.7 l4 K6 n, R" t4 G- v1 T2 Z
- */
2 [. @! f. T4 \% U) k. H$ m0 Q - 7 ]6 m: r# P% ~* C9 i' T4 s/ D5 U
- #include <linux/module.h># _8 w7 S2 B2 i1 L2 W
- #include <linux/init.h>+ \% @ [+ N5 ^+ g6 A
- #include <linux/errno.h>* {* @& t" a( d' {6 y
- #include <linux/types.h>- q& ] L6 C6 x
- #include <linux/interrupt.h>
6 |1 Y3 u b e$ P% {& P - #include <asm/io.h>
! s" N9 R' R; R c! a& @* u - #include <linux/moduleparam.h>
: d+ u& ?7 M' e9 v2 q - #include <linux/sysctl.h>
* ^4 D# L* y- n! h+ E6 W - #include <linux/mm.h>
) k/ G# T9 I1 ?/ {3 I; r) ^ - #include <linux/dma-mapping.h>$ j3 G2 k' z2 x$ c2 ]
- / C* V" S$ b$ Z v7 `; `
- #include <mach/memory.h>
: D# K ]3 \* L) `* ~ - #include <mach/hardware.h>7 R) `: A& J% {* a
- #include <mach/irqs.h>
}$ F+ F; J' Q: x! @/ a - #include <asm/hardware/edma.h>
W) M: V% T# a( f - B% Q0 Y; t' Q- D. N! f7 U+ e9 k K
- #undef EDMA3_DEBUG
( n: ^, b- n$ \' i% L* x2 ^ - /*#define EDMA3_DEBUG*/
5 Q, s- m- ]( C- ~$ [; z
/ A% f- Q( z9 ^3 \- #ifdef EDMA3_DEBUG3 H: D& ~& [9 C- W8 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) f% d! v6 F0 d$ X1 `9 ?% X- Q5 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 Y8 T5 z+ I% v' e3 p- r' t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% a E6 I: B9 E+ w - #else1 Q# b+ g# v }% n
- #define DMA_PRINTK( x... )
8 _" `2 M% z' Z8 g. M" Z - #define DMA_FN_IN
% Y+ }. A% L* T* A - #define DMA_FN_OUT) A( v$ }6 \( h7 E
- #endif' U; h5 }. e: f+ @8 s2 @& ]
- p! C3 T& b+ Y4 h8 z4 g7 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! V# z0 U, u9 K+ z; r
- #define STATIC_SHIFT 3: g' r6 W: W0 R; N4 ^! @# i
- #define TCINTEN_SHIFT 20
' T2 N1 P5 T" O8 b1 x+ T2 H0 Q - #define ITCINTEN_SHIFT 219 `, X1 o& e3 N h6 `0 j
- #define TCCHEN_SHIFT 22& x; M8 } l) r
- #define ITCCHEN_SHIFT 23+ O5 G6 i! I5 k; E9 r% M
0 W5 s8 X. o+ X0 F4 a- static volatile int irqraised1 = 0;; X. t, ~( Q1 F1 `6 g' a
- static volatile int irqraised2 = 0;
4 |& a' P1 X" a8 Q
" @2 ]. x3 u' y' i+ O( A+ B, o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( `+ S7 Q* s# ?. t9 B0 P/ _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ g+ g- B8 G5 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& P1 j2 b p7 J! C3 b$ T2 ^
( K: `3 M" I4 r% `2 O- dma_addr_t dmaphyssrc1 = 0;
6 B( v: U& w9 _0 K$ f' } - dma_addr_t dmaphyssrc2 = 0;
! z( X+ n( q8 U' t - dma_addr_t dmaphysdest1 = 0;2 v( R: T2 j9 j
- dma_addr_t dmaphysdest2 = 0;) z0 }5 z- e$ A( \* Z
- m* E# l- T& j5 L( s8 p- char *dmabufsrc1 = NULL;
* N) T$ J* a( \, K! z" F' g" ` - char *dmabufsrc2 = NULL;
0 {0 J* F+ d( D& ?6 Z - char *dmabufdest1 = NULL;
1 Q [: r1 b3 P7 d - char *dmabufdest2 = NULL;
8 `- c, ]/ L1 L/ ^6 _1 R - : T" B/ r8 z/ n
- static int acnt = 512;
: l$ J$ @8 K) i/ ^" _! r8 M - static int bcnt = 8;& G/ k/ v' K3 j8 M8 F/ I! Z
- static int ccnt = 8;3 p4 D$ n' u+ I" [9 w% m @/ \
- / W; @* {- v. w! E7 {
- module_param(acnt, int, S_IRUGO);
+ Z- c. f7 G' X6 p - module_param(bcnt, int, S_IRUGO); U+ i7 p6 g& h9 I
- module_param(ccnt, int, S_IRUGO);
复制代码
0 ^, L1 z0 [' U2 V1 ?* Q& [4 M9 q" |" ^8 H) N- _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J, X R+ ]& Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ e: l. p; c: \. s/ C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 Y7 U5 V) H. {$ |- d
, P+ \$ {6 L* n: P$ Z" K
2 M3 w/ }7 i* L, L; I9 p9 K |
|