|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 q2 M9 @% o) G( K X
- [code]EDMA sample test application
9 i% O8 p# p/ t2 C. e# x - /*
% i& I: l: O+ b: k# {3 | - * edma_test.c
) C' l0 Y8 x0 c' W7 s - *
' |: r' Q; v+ Y+ L' k2 P% v - * brief EDMA3 Test Application+ Z; P. U/ O4 L" R
- *
; i0 v5 X4 Y" s I! c. Q D - * This file contains EDMA3 Test code.
+ s8 S% K6 b1 ?( H7 } - *4 G- j g1 Z6 d% u% _5 {$ B' |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& O. C8 Y5 q% s1 d4 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; [ }6 |* l2 m' A4 I# R! {4 p: I - * TO CHANGE.$ k7 S; |2 L ~) g9 M8 G
- *- b* [0 d* P* U8 M: ]8 F$ y! l2 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 E8 E2 _7 y" W6 Z: e: r7 H - *
9 [9 {+ m3 K z" S$ d - * This program is free software; you can redistribute it and/or
9 U* a, I7 O( {2 R- v* q - * modify it under the terms of the GNU General Public License as w' D- _% K4 w7 Y
- * published by the Free Software Foundation version 2.
: s0 \: b' J5 S - *
6 J5 e& W& K- ]$ z0 u U2 U6 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
T% N9 U9 M& K* S: i+ \$ R - * kind, whether express or implied; without even the implied warranty
6 [7 j" e; q4 q1 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the _! r2 m% t9 d
- * GNU General Public License for more details.
% K2 ?' V$ B$ w/ u6 o! c - */
/ y' H& X, m* l# K' [
" X; h4 X0 ?9 Z7 N- u o, J ^- #include <linux/module.h>- O( f! C0 T9 a4 W
- #include <linux/init.h>
. a! I* L0 }6 ~- E# j( B! { - #include <linux/errno.h>) w# m- M4 i; c9 K
- #include <linux/types.h>1 E1 [+ b, ^# b% W" |4 K$ j
- #include <linux/interrupt.h>5 A$ F7 |2 k- p J: S4 M: @
- #include <asm/io.h>
6 f( s6 u' n( V0 X$ w7 w( { - #include <linux/moduleparam.h>" \9 c' {3 x4 U1 V. r& J% I
- #include <linux/sysctl.h>
3 c; h3 g( r3 G8 n' B3 r - #include <linux/mm.h>
^9 `. }6 l! [: k; m% ]5 e7 ~$ Q - #include <linux/dma-mapping.h>
" O5 ]" t5 [& m6 d - & R& |, x2 Y0 f( o P
- #include <mach/memory.h>
% }8 J2 f6 F& I# e' R - #include <mach/hardware.h>
: c* q5 }8 O/ F; I0 g g - #include <mach/irqs.h>* c8 o* z# {- e. E
- #include <asm/hardware/edma.h>* S6 k8 C' e3 Y k9 E8 W8 K" c; ]
$ u7 d% Y* w' C2 _; u1 z- #undef EDMA3_DEBUG
+ Y( x: m8 g% J. w9 X* l - /*#define EDMA3_DEBUG*/
* R1 d. @6 a. N0 q' I, J1 h+ v! b - ; r! F& V. b: R; I; W( |
- #ifdef EDMA3_DEBUG
1 D: `" \; x. u- } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ y7 c0 n0 Z; p: j2 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 @; t6 u% o6 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! o* Q {0 g0 o: R' o' U( l' Z
- #else+ u1 v5 W2 r( A$ }
- #define DMA_PRINTK( x... )
, Z1 u9 a# D1 o2 K' q4 ?' i - #define DMA_FN_IN
8 l* ?, p7 A* x- M" F- T/ L: ?2 O - #define DMA_FN_OUT1 R$ ^( W+ f( R b7 I9 @
- #endif$ d' u; c: G5 a n
- , B, e( J) S4 }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 G. M4 N7 n/ g! E* N - #define STATIC_SHIFT 3' Y+ [5 B( f& p. W' a8 V6 i q
- #define TCINTEN_SHIFT 20
0 o2 f( ~$ M. ?" C+ g - #define ITCINTEN_SHIFT 21
( z8 ]! B X7 q+ s. H: [1 t3 i - #define TCCHEN_SHIFT 22
+ S% E3 }3 H& W) W6 j' [ - #define ITCCHEN_SHIFT 232 u t, T$ D8 Z5 {5 G7 | N
4 p4 U9 R4 g& K1 Y- static volatile int irqraised1 = 0;
+ ~$ [. U, h$ n0 B9 W9 D - static volatile int irqraised2 = 0;9 U. _/ O; b6 ^0 W, z8 k, G
7 |$ e& Q0 R* F" p+ N0 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% @3 I# B+ H$ \ R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `2 T; U+ h, D) p2 |: U1 }) P" `2 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% _$ x4 q( f) F% m7 d
) t* P2 c0 K- N* Y! k- dma_addr_t dmaphyssrc1 = 0;; i) t0 \+ ?) X) U: I
- dma_addr_t dmaphyssrc2 = 0;
" V5 O7 {' L1 a' O7 J+ j - dma_addr_t dmaphysdest1 = 0;
( E' `; ^3 ^0 Z1 N) W5 L" | - dma_addr_t dmaphysdest2 = 0;1 a6 ^. |1 L6 ~- r2 Z/ K2 ]
; U* m+ ]5 a6 ~2 P+ y- char *dmabufsrc1 = NULL;2 M6 U+ [+ H v+ u5 x B9 \* A. t
- char *dmabufsrc2 = NULL;, a. `3 w/ Z: S, E; O
- char *dmabufdest1 = NULL;
& K# H) F6 Z4 L - char *dmabufdest2 = NULL;4 B) N4 N) Q) `. L3 R3 ~% b4 B
3 ]- Z7 i, y9 u2 ^0 [5 t1 E4 L7 \- static int acnt = 512;
6 a3 s6 Y4 q- K7 Z) t) } - static int bcnt = 8;: S/ G0 O1 ]( U# u! f. ~6 b
- static int ccnt = 8;
" w4 @% m4 T7 i$ _6 Q- ~
7 s% f1 E# g0 ^' }- module_param(acnt, int, S_IRUGO);
' I! j2 z. w- `0 Y7 S - module_param(bcnt, int, S_IRUGO);
8 G+ C; }2 A# l) Z - module_param(ccnt, int, S_IRUGO);
复制代码
. s( F1 ?3 [, S8 d n7 N, y/ C* i" T
n* _ X9 O9 N( \1 Q# P) D' H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" r0 T) e+ M+ ?7 m$ yarm-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$ S# x2 s6 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* v$ X1 p9 l, L. y9 u: a! f7 X: Y! @7 `3 S7 h6 Q7 Z" D
, @/ l; ?" r! d
|
|