|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, t+ w: \4 g9 x3 B1 a; g- [code]EDMA sample test application
; i" e% T" Y4 O2 q4 \7 R - /*0 ?+ k; I; U& H8 q6 v5 b
- * edma_test.c" D* U3 R1 N& K7 R; g& j
- *7 G- a9 i$ r% s; C" W
- * brief EDMA3 Test Application5 Y' ^0 U [* [$ u6 O
- *
+ e- p4 U: a+ i7 J/ a: D - * This file contains EDMA3 Test code.
0 k0 p$ r- U% |6 K- G. M( j7 p w - *
: |7 ~# O5 F7 B- Z, l5 Y5 `1 O4 n/ i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 @- y Z: Z$ U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 {( @3 c: p# a- m
- * TO CHANGE.6 b4 N; N1 `' {# Z3 d5 ^
- *+ k! Y) o# E/ ~. t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* p. j2 S1 f) v4 {
- *; S( h6 e. G7 j5 u: i1 i
- * This program is free software; you can redistribute it and/or
& w1 b5 H2 |! b - * modify it under the terms of the GNU General Public License as
. y' M. ^: J: s0 f - * published by the Free Software Foundation version 2.
1 _0 A; s# S: R: z - *3 d2 }: y* H0 i' V0 l5 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 g" o" S% t" h0 v
- * kind, whether express or implied; without even the implied warranty
/ o6 \& x, e& G% K( w" R. G& D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 w _9 z1 C$ h5 I" D3 Y
- * GNU General Public License for more details.
; P# C5 g5 V# X2 {0 x" N - */
$ U5 K }5 G# C; r9 `( i3 E6 U0 B( t7 l
0 T0 Q9 z0 J/ H: p8 |! v- #include <linux/module.h>
; ^: j' w5 y# } b% L* W3 ~- J - #include <linux/init.h>
) C" E0 @0 Q1 i - #include <linux/errno.h>! | o: q2 g+ `8 q2 t1 T$ w
- #include <linux/types.h>
# M. N" j1 P, y" t5 [ - #include <linux/interrupt.h>
6 Q$ C" T) N1 d x$ q - #include <asm/io.h>6 l1 n9 D5 k. Q" n5 |* A" z
- #include <linux/moduleparam.h>: N `' R4 C2 r& ^8 ^; @1 b. h1 ?
- #include <linux/sysctl.h>0 Y4 y9 |, ^9 z3 g
- #include <linux/mm.h>: c& b( k, S3 x7 r
- #include <linux/dma-mapping.h>5 J0 B3 l h, y$ ~+ ]. m- A
- - M( T! W0 Z7 [9 S1 \+ i4 L/ ]
- #include <mach/memory.h># d B. U+ a# [! Z' r- Z
- #include <mach/hardware.h>
- ?9 Y6 O1 H7 t) u - #include <mach/irqs.h>/ Y6 L5 L. P# G' b! c; g; u
- #include <asm/hardware/edma.h>& D6 {9 A& a; u# d% W- }
1 n+ [$ s. O! r: f+ B; w/ ?7 s6 l- #undef EDMA3_DEBUG
% ^! B$ _; L% K9 f - /*#define EDMA3_DEBUG*/0 S" r6 b0 [+ F) L
- . s& ]- `' Y5 d$ v$ }
- #ifdef EDMA3_DEBUG% I1 _. [: |& n/ t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- Q7 M, L1 Y4 d) \7 c: n" S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' ?% L1 B: U& ~0 t3 P" K/ v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- b( O$ r& t+ \, y& Z, \
- #else/ Q" F! e- S9 s8 `% [! h' V
- #define DMA_PRINTK( x... )& l$ q) a! B7 u+ z8 w
- #define DMA_FN_IN8 w. X6 f: u ^& ]: P
- #define DMA_FN_OUT
3 k, g4 P' u: e6 S - #endif
# R6 Q5 H; k2 x2 C
7 q: D3 C7 |. _: ^4 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ m, h; \1 L, |+ `; s
- #define STATIC_SHIFT 3
6 R8 G, V9 x1 M) G - #define TCINTEN_SHIFT 20( t* @' {3 M$ h9 I/ T+ j
- #define ITCINTEN_SHIFT 21
3 a. V* Z5 p I( }0 N - #define TCCHEN_SHIFT 22# M# T- {, v6 o8 {" m, d
- #define ITCCHEN_SHIFT 23/ o: S" x4 _, S3 S5 y) F
- ! U. u8 u: {5 C9 [7 N+ F$ f
- static volatile int irqraised1 = 0;
: }) Q5 m( m5 \% k: I - static volatile int irqraised2 = 0;7 J2 z8 u7 Z9 `: ^/ i
- ( V: g' r1 v; P7 }; V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" z2 U3 J% t* Y5 K! }9 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 f' b& `5 ]( S! K9 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 p' E1 Z/ W8 V
- + g$ g9 O: j% m2 @1 I
- dma_addr_t dmaphyssrc1 = 0;8 B' v( N8 ?; `2 Z' A
- dma_addr_t dmaphyssrc2 = 0;# i. G% ]* j6 e
- dma_addr_t dmaphysdest1 = 0; S* @# U. i# N% g# X8 _7 g
- dma_addr_t dmaphysdest2 = 0;% }+ h& l$ r! O t7 ]+ q) A) q4 W2 e6 n
9 U4 |" ?1 ]1 }5 i- J+ s, i$ d- char *dmabufsrc1 = NULL;
: C* C3 V" y: g; C - char *dmabufsrc2 = NULL;
4 _3 @- _5 C) i3 O4 A1 \ - char *dmabufdest1 = NULL;; ~4 ]# \2 t0 v$ L
- char *dmabufdest2 = NULL; D( ~1 W$ |" L' ^ n
0 r9 f# ?) o6 p D3 |+ y6 J( p- static int acnt = 512;# P3 V7 C" U# {4 w* ]8 S
- static int bcnt = 8;: F* ]+ G5 n0 g J& C. ^' ]
- static int ccnt = 8;- ?9 D. J" f: w, `0 }! |; l
- , R& b. N$ A" G! F! |' R5 M
- module_param(acnt, int, S_IRUGO);
' s+ r/ E* ?4 _' H6 j) i# ^/ Y - module_param(bcnt, int, S_IRUGO);3 V3 ~; [7 _5 Q" U
- module_param(ccnt, int, S_IRUGO);
复制代码
. t( I, H- x: E' m1 s# H# y* j8 L5 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" R. ]) o. U5 J( L9 Q1 y9 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' M3 A3 @( k5 V l& l% Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ i! s% o( t6 K+ r
; b2 [: ~- j" f& c! `9 V$ X
) A+ v2 M0 C8 w
|
|