|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* n/ [1 ?, w* z& _. h- [code]EDMA sample test application& ~9 Z- g' f% W) i" k- n
- /*
, D: @) l# [2 Y6 o6 O4 g - * edma_test.c# N9 a9 A, A1 t
- *
C5 W" F+ \6 H( p) g- y3 s& W - * brief EDMA3 Test Application
1 L6 m% I- Q4 ^$ q. b% a - *
9 h; h: e9 @2 _! ~1 |# w - * This file contains EDMA3 Test code.& z2 d& m- x6 Z
- *3 C, J _6 d! k& X8 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ? p- e: O, F- G8 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) U5 B$ N1 P& z$ I
- * TO CHANGE.
8 E3 @9 V) z# H) u3 o8 r - *
+ D. k# ]% L$ n4 g4 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ d- o8 s5 {; ^- P" q
- *# u# R. N8 m0 K e
- * This program is free software; you can redistribute it and/or
; O6 f& L7 j$ ~' { - * modify it under the terms of the GNU General Public License as s7 e4 K4 U0 }# l6 T
- * published by the Free Software Foundation version 2.
% n3 x/ Q7 c1 @1 k, s- }9 V - *. Z4 x5 G# e: J$ o" x& S& ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) I8 y Q& N0 G7 U
- * kind, whether express or implied; without even the implied warranty- R8 d; S+ d( a. s! M* P/ R8 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 @+ \+ v1 q) p* x - * GNU General Public License for more details.
0 E7 S- A1 s% b' }) s3 K9 u$ p+ Y8 P - *// y( x$ j4 \1 C
- 8 b6 O; d; H2 Y& h. u
- #include <linux/module.h>
8 w8 B- K3 k6 a, e: c* D - #include <linux/init.h>) }& b, Y' t+ c. M
- #include <linux/errno.h>( e- a' M/ Z8 g! v' r3 N4 E, r
- #include <linux/types.h>
" s5 M, ]: R8 l# X8 u - #include <linux/interrupt.h>
6 p0 w/ ]0 t {# l. t+ G. q - #include <asm/io.h>6 O9 }9 i3 |& {, b' [, ?
- #include <linux/moduleparam.h>
% O% E a! `6 }# ~2 F4 B - #include <linux/sysctl.h>1 w& |' ~0 Q% z5 E1 Z
- #include <linux/mm.h>) `& o, @0 o# m
- #include <linux/dma-mapping.h>+ y# O3 F6 i- `5 c5 p4 S( j
* e2 K& T5 J# J3 d% Y- #include <mach/memory.h>; [ \1 E1 V+ {1 O9 W* L- Q
- #include <mach/hardware.h>
* N& f( Q& h( h- E4 ? - #include <mach/irqs.h>
8 U3 H4 N: f! r S! I - #include <asm/hardware/edma.h>( Y) v, {" G. k
- " d/ M! R; R& l* }$ k% i
- #undef EDMA3_DEBUG
! t" b5 Q! \( V- o) k8 H8 k2 @: B* } - /*#define EDMA3_DEBUG*/
( p9 B6 h/ {$ @/ X
' v, m$ F7 p" Y( r6 c" D) o- #ifdef EDMA3_DEBUG3 h5 K+ f( j) c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% d6 c. h2 z- s5 |* u- b n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) P3 g( O& p+ C' U# O+ P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 b* g* k. X2 a& S8 m - #else
8 M2 V# n% g! m, [* d9 i/ P - #define DMA_PRINTK( x... )
# F X, s* j: B) P8 o1 K - #define DMA_FN_IN
4 j, j" ~. v7 P$ b - #define DMA_FN_OUT
& q/ J: m( H2 Z7 m8 ?, I - #endif8 U3 c6 \' l- u( T
- % Q6 M" G! }$ ], R9 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 F. g2 s# w5 {( O: j' ]6 }3 k5 u - #define STATIC_SHIFT 3
# z( w5 _" P6 V/ Q - #define TCINTEN_SHIFT 20# j5 E, s/ V& m3 H) R, W! f
- #define ITCINTEN_SHIFT 21) A" ~' y2 X/ P/ S4 A, b g
- #define TCCHEN_SHIFT 22
% {% E9 H4 t* L4 ^9 z7 J8 [) h - #define ITCCHEN_SHIFT 23/ P; ]* J/ @& y7 _0 G
- $ Y W- r# X, D& N1 X0 Z z
- static volatile int irqraised1 = 0;
8 {' _9 \* z8 p0 d7 y6 U1 b - static volatile int irqraised2 = 0;$ K4 y! u9 h5 O6 T% _2 V% u
- ! C4 H- M( n1 E2 [. X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" U: h* \2 @* G* Z' m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n0 C, _1 L0 c% E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: b3 ^* m& v) ?. D - 0 Z- M" N; I, i; n- |
- dma_addr_t dmaphyssrc1 = 0;
0 Q& b5 ~4 g( O2 V - dma_addr_t dmaphyssrc2 = 0;# c6 z# {9 }, Y8 @' L2 y
- dma_addr_t dmaphysdest1 = 0;
/ |: z0 i# v# V8 Y" U - dma_addr_t dmaphysdest2 = 0;$ ]- ~# Z$ K' Z/ ]. L
6 J6 f1 T: P6 K; j$ K3 @) B5 r- char *dmabufsrc1 = NULL;
+ B2 `" v/ A9 R( G0 \$ b - char *dmabufsrc2 = NULL;! [6 C$ P: S( U* x9 T
- char *dmabufdest1 = NULL;( Y. J O& O5 y+ B# g" H& F2 x1 p: Q7 f
- char *dmabufdest2 = NULL;
6 H; y' Y2 y. ] - ( p+ K) x2 \6 g6 A% C/ u( `
- static int acnt = 512;
$ p# h: d5 o( [7 s* G - static int bcnt = 8;* ~$ ^+ Z4 S; z
- static int ccnt = 8;
: Q2 y5 D5 R G' r' I
: D& ^! ?- t7 S o: ?+ w- module_param(acnt, int, S_IRUGO);7 b7 P/ k* J+ H3 Q5 a
- module_param(bcnt, int, S_IRUGO);
; U, S( o! U% Q. b0 W: K$ s - module_param(ccnt, int, S_IRUGO);
复制代码 8 z. o2 y' s- e W" j
2 T8 s6 h( s0 f0 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 w$ y- J' E3 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 l: e: G0 U" r6 c) J1 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* z, G2 C' X3 N0 }0 |' S% Z2 S- W) U% W6 D
( D. c8 j% x$ I. I* I |
|