|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( V& s/ U( y9 n1 d1 \9 e5 J" j- [code]EDMA sample test application7 |3 I" e/ O" m) k' H4 F9 Z
- /*' i5 y$ j0 m9 `* P& m8 D6 ^
- * edma_test.c4 ?$ S% H) `. D9 z% Z
- *; Q* c! S/ L! ^/ o- r2 v
- * brief EDMA3 Test Application7 h: {( B% m/ g; m& C
- *) Q; n2 ^/ ]. p' T- M
- * This file contains EDMA3 Test code.& o) n1 y! W% y3 `
- *
; S( o3 z6 l$ o: f# |) Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 {: s- w- I/ d9 K7 P. Z. B9 S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 D; r+ G, `2 a' {' x# _ - * TO CHANGE.) z# w+ t4 l" o! R, T
- *5 h+ V: `2 w$ @$ I5 h2 x# A" S' i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: d. B( Z1 D2 U& C+ Q2 w
- *
- u5 ^( E2 D) U/ G3 X1 n* i - * This program is free software; you can redistribute it and/or$ N% D1 g" y! @5 @: F
- * modify it under the terms of the GNU General Public License as
1 f3 X6 o: k5 U - * published by the Free Software Foundation version 2.9 ]" j+ h5 t& ?$ u2 H% y
- *
8 N" a+ i" U& A; i" k" g3 | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* e4 c4 n6 z$ J5 L
- * kind, whether express or implied; without even the implied warranty9 R( p& i2 s% E# b4 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! F$ h9 `( O$ y+ G$ c+ ^
- * GNU General Public License for more details.
, W9 y4 A/ _5 j( V/ N( }3 F( _ - */
4 d7 ]! K" ^+ m7 E: z1 [
3 \: d9 h! U7 @% u- #include <linux/module.h>, D) S4 w( W+ X4 R' n& ^
- #include <linux/init.h>
' [& t9 B5 Z8 ] - #include <linux/errno.h>- A# @( v' U" a+ v9 V8 Q! ]0 s
- #include <linux/types.h>! c4 H7 ]. k: B$ z$ s, ~
- #include <linux/interrupt.h>
: `9 Q. e5 q1 T4 v: T& e: F$ ` - #include <asm/io.h>4 F) J# f: Y& E; `# C
- #include <linux/moduleparam.h>) C- V0 e# x# M; v; D \( |
- #include <linux/sysctl.h>
% F( K& p r; d4 j - #include <linux/mm.h>
$ f9 o0 {# I3 v - #include <linux/dma-mapping.h>% e7 j* x L2 U. j D2 t
6 C% x8 h6 i' k# w- #include <mach/memory.h>8 a# u1 l3 _% C& d; X7 J, r
- #include <mach/hardware.h>; j) ^ ?, [2 q& W
- #include <mach/irqs.h>, S3 E$ d# Q5 S+ c& C' f) ]
- #include <asm/hardware/edma.h>
, c0 v3 |6 b) n! l X7 L - 1 E" V8 ~5 M0 ?7 Q+ s3 U6 p
- #undef EDMA3_DEBUG
! ]* r- s. N( s& b9 u* q- d - /*#define EDMA3_DEBUG*/ v! J' n- T$ `/ g% b3 H) [$ g0 W
- 9 N% R- N9 D7 t6 B; E; S
- #ifdef EDMA3_DEBUG( F$ v1 @# z& }/ F5 P5 M) w7 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- c& p; o& V' T8 H' B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" q0 p* Q- ^" i) k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 l* s4 [; E/ g+ V* A. h/ v/ p
- #else) h! D0 Z @9 y( R+ |/ B
- #define DMA_PRINTK( x... )
/ c% e5 H# ^+ [* d% W9 q - #define DMA_FN_IN' ]9 s1 x3 U3 [. @
- #define DMA_FN_OUT
' t& X7 S5 l V% N: Q - #endif6 |- j2 Q& B2 Z% N! o {
- + s; G6 I7 T% F2 ^8 V. q6 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): a+ ]' ~; o' t0 g
- #define STATIC_SHIFT 3. j& c; \4 v# ~$ p2 X$ F
- #define TCINTEN_SHIFT 20
: T5 J- Q; s+ O9 U* u - #define ITCINTEN_SHIFT 21
; z& k* `8 ]5 b: V. y3 y - #define TCCHEN_SHIFT 22* [0 s, M" r- S. k. i/ Y0 ~
- #define ITCCHEN_SHIFT 23
! L. t1 g ~& g' J - ! R0 ~( {0 F/ W
- static volatile int irqraised1 = 0;/ [, t. ?7 @* A6 w% { G& s. e% a
- static volatile int irqraised2 = 0;2 H2 g0 C3 G4 a2 N; h' U2 ?
: E# m0 e; Q, J* t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
d1 {! O, k# G; O8 o2 u. a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t, U* H# [0 ~8 O U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u a' l8 u2 a) R* Z6 t
1 q3 c0 R: V( {- dma_addr_t dmaphyssrc1 = 0;
% D- a9 K5 B8 |' {& Q - dma_addr_t dmaphyssrc2 = 0;1 }; E1 q& w2 r) i, p) M8 [' _* ?
- dma_addr_t dmaphysdest1 = 0;* f9 D& K, D0 g8 b( G& x9 O. }
- dma_addr_t dmaphysdest2 = 0;
9 Z: D% F. n6 \3 F C y& h - + j% h; J, u0 I1 u' M% e s' P! V: \
- char *dmabufsrc1 = NULL;: {; w" T+ ^$ H& h; \' x
- char *dmabufsrc2 = NULL;
6 ^ c1 e! ~6 p( j& T9 j" z. g - char *dmabufdest1 = NULL;4 {6 j* }9 | _
- char *dmabufdest2 = NULL;+ n% b/ d9 ^2 \3 |: g, ^2 ?. O
& K% f$ P- J1 b' q$ @+ A% |- static int acnt = 512;
4 A5 M' g3 {9 f - static int bcnt = 8;$ f- x9 R6 L H1 l) Q- j
- static int ccnt = 8;
% J5 m* b5 K9 Q: ^' z8 M$ i
0 Y% y# L4 Q8 Y4 R$ D0 h- module_param(acnt, int, S_IRUGO);2 T3 w. Y/ q4 J: o* v
- module_param(bcnt, int, S_IRUGO);
4 w$ ]' y% h5 V! Q8 X% _2 u, N - module_param(ccnt, int, S_IRUGO);
复制代码 $ L! N5 P5 w7 i! `4 X1 G/ M) u: O( H% P
" r8 y0 m' S4 D. J( l7 W0 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; V" i, L$ k2 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 i: g: }, `+ R+ @( f s. X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" e% h, @6 _5 d$ Z
% K. o! t, d* }( O! O
! K) }& f6 \, r: m5 k# j |
|