|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I) Q- G3 m7 T% i8 c2 k- [code]EDMA sample test application1 x& o4 t* L9 A4 o. f
- /*8 U. n2 h+ K6 x: d% i1 x: R6 p8 i s
- * edma_test.c
3 U" t* i7 R( v" _ - *
) E1 B/ }0 d2 e2 f2 _3 H7 b - * brief EDMA3 Test Application
) Y9 k& `) B2 X o# y - *% w* t" A# n! i* h0 |' W/ y
- * This file contains EDMA3 Test code.# D8 v$ Y ~$ A
- *6 m$ x0 A" _$ w! g" U0 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 @) V8 o" W2 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 U3 w7 `5 l0 e) q- [/ Y. G - * TO CHANGE.
+ e4 M$ J9 V& c: i$ M, y - *
& V" P5 H) D5 i8 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: J6 ~" e' |$ z+ U% |
- *( P- M$ x' j2 d+ q+ u' d8 _
- * This program is free software; you can redistribute it and/or+ f- \. z9 O/ k
- * modify it under the terms of the GNU General Public License as
9 o5 ~& U& i! V' `* A- |( W - * published by the Free Software Foundation version 2.7 E) j% ]& n! J% |6 A9 k
- *0 X3 p, K/ W; V1 ^, d* Z. q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! ]8 _( X3 N/ E, [ @3 {. y8 H/ ~ - * kind, whether express or implied; without even the implied warranty1 l4 V0 c* N1 H9 T( Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the b6 Q9 k7 ]8 ^+ h
- * GNU General Public License for more details.4 j9 i- x8 t0 c4 T
- */
" U$ }$ I% g7 {# J) r
, p/ } [) l# x- y: { j; T7 n- #include <linux/module.h>! S% \. c2 B8 ^% K9 S1 n5 ~
- #include <linux/init.h>
9 I9 A. W% r; [0 A6 U8 P - #include <linux/errno.h>& R1 y. Q* y( a+ ~7 O$ Z" a. O
- #include <linux/types.h>: f# b1 F7 I) x3 d- W6 z1 A
- #include <linux/interrupt.h>$ ^) l- o+ e3 @2 `/ ^8 E/ P' P
- #include <asm/io.h># M b7 L n5 l
- #include <linux/moduleparam.h># T; H) l" d+ G( F9 t
- #include <linux/sysctl.h>
8 y5 o/ K+ p4 h: Y5 l5 V8 K2 G8 T+ v - #include <linux/mm.h>; Y5 B- ]; t. [7 m" J' B
- #include <linux/dma-mapping.h>, n$ @& T% Y+ O7 q, L& U
- # C- A. {# x, ?3 h/ m9 X! \
- #include <mach/memory.h>; J, N. ^5 v9 O/ \! O4 P
- #include <mach/hardware.h>9 R$ Q% D/ b7 a" J' M9 {; f2 B- q
- #include <mach/irqs.h>
0 l" @* P! D/ _% W. b6 H% e( p l - #include <asm/hardware/edma.h>3 c+ I9 L) e9 z% t8 Y5 S8 }
- 7 [- U3 A* J) V1 e% Z1 M0 r
- #undef EDMA3_DEBUG
7 `+ y/ H# c) Q+ D+ n, R) l4 ~ - /*#define EDMA3_DEBUG*/' S% q5 i m7 m5 g
& u2 }/ |: F( S% s7 r' `3 e, u- #ifdef EDMA3_DEBUG
( d' P- _# z, R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( n9 U: y# O/ }5 S: O% X1 W4 ^- t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ F9 }9 x! s% R+ m; i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 @1 D4 ?! J! F' {* s9 k* A4 D- K' h
- #else
4 @8 X4 V9 J% l s0 l7 o - #define DMA_PRINTK( x... )9 X* s, d& O0 a" Q0 R
- #define DMA_FN_IN
[& F. l3 m' P- R. L" s( V - #define DMA_FN_OUT' p9 ]& s8 m6 P* D2 C, ^
- #endif
+ b; k( r# T5 n. X' e
% H9 i7 N, O, y- P* S3 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! s) P _, N5 |* S0 x5 L - #define STATIC_SHIFT 3
8 e% j1 K) U5 `' P) {3 ~$ d& f - #define TCINTEN_SHIFT 20" {4 u! m7 f9 U: i& Q6 }5 J
- #define ITCINTEN_SHIFT 21
V0 ]( F1 I/ S" i; U - #define TCCHEN_SHIFT 225 x5 P2 f4 s* h% b; o0 u( a
- #define ITCCHEN_SHIFT 23
. O/ n* X% U3 h7 K3 F! t
- |9 \4 {" Y1 B" v( {3 @! d! S* R) v/ I" Y- static volatile int irqraised1 = 0;% I: I' Z$ E: {; V# X5 `
- static volatile int irqraised2 = 0;
9 @2 Y. N" ~) ^( X3 P. \8 Q8 I
& c! Q: n; A# Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 s6 z* q+ t$ A* r) b: q$ q. I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. h' D; n* a* a$ W; t' P9 e5 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 r. o% y- B# V/ _ - 0 ~+ j- V6 a/ z- e2 m. f
- dma_addr_t dmaphyssrc1 = 0;" I! u/ t/ I3 K; W2 \: |
- dma_addr_t dmaphyssrc2 = 0;+ Z5 I/ u: Z& {' e
- dma_addr_t dmaphysdest1 = 0;
# W6 U1 V4 e1 o3 o& }2 `6 b - dma_addr_t dmaphysdest2 = 0;/ s O/ I' K/ E4 `: w
7 Q0 K G9 @' Y9 a4 G- char *dmabufsrc1 = NULL;
+ G# z2 @6 H" ^$ ] - char *dmabufsrc2 = NULL;
4 P0 V' K% G. Q, y9 n - char *dmabufdest1 = NULL; ?4 w$ n: N+ u
- char *dmabufdest2 = NULL;( s- i+ K2 h3 Q; ?4 |1 G
- : {# S) G" t9 r$ O( l
- static int acnt = 512;6 I5 r; h# o: z% `: k
- static int bcnt = 8;
1 Z3 @3 Z( V s5 i* C o, i% N) ^ - static int ccnt = 8;0 C* v# z; D. t. _# Z1 l: u$ o# Y
- # G# d; R/ g6 L6 K0 t9 u q: V" B
- module_param(acnt, int, S_IRUGO);) D! m [9 K9 M
- module_param(bcnt, int, S_IRUGO);# |7 @, o% _0 x2 F
- module_param(ccnt, int, S_IRUGO);
复制代码
$ ~. A/ S* q- T& [0 e. l% }+ M5 _$ n( ~# e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Y- w! S7 X" X- \+ q6 B! X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: p4 ~2 X0 {3 [ u7 l* @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ a/ @, P, d, }0 g+ Z4 s+ {8 H- N
8 N+ o- k" s6 @/ e4 ? |
|