|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ u: m* C( p* U' L3 W( {# T
- [code]EDMA sample test application6 X: ]" r* S+ \# e/ w
- /*) k( ~8 e+ T7 y5 }
- * edma_test.c
- w0 r$ r+ k# }. L$ K: K" Y - *0 O( q1 n' v8 L6 S6 z2 h- J
- * brief EDMA3 Test Application
! v$ L( f; Y& H - *, m4 i$ U4 w" x9 n; k- e
- * This file contains EDMA3 Test code.
) t0 K8 I0 O0 X - * }% q1 @; e' W) @& r. T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 _+ Z& r( c$ d; c; W( O7 r: e! ?- t9 j, K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f; a7 i! L8 H/ t7 G& M2 |+ E
- * TO CHANGE.& w5 E3 i) X6 J5 p
- *
1 `6 J& k& T! E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 b }( D; |0 S0 A: Y5 E) E+ y
- *
8 [' h# N. R- }" g, E6 R7 u - * This program is free software; you can redistribute it and/or! c }3 @5 T1 I( L
- * modify it under the terms of the GNU General Public License as
9 O9 D, T2 h7 y8 D% T# B s/ z9 n - * published by the Free Software Foundation version 2.
( J( X: ?/ m8 P0 r) v - *
; Y. k# |* Q v* |/ x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 l m( X- V) L' q1 D
- * kind, whether express or implied; without even the implied warranty
2 n" V' L" U! M; X1 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ^4 Y0 h& f9 [
- * GNU General Public License for more details.5 _) {- }6 K: G1 e
- */
5 N1 [: f% U, J. o+ y" v$ @5 ~
% I9 n8 D2 q. {- #include <linux/module.h>; w0 F m- u9 K3 M. T
- #include <linux/init.h>& f* D9 F8 r, B1 m U2 w
- #include <linux/errno.h>
7 P: D6 B8 P) d# n - #include <linux/types.h>$ N1 @$ } i# Z9 O8 p/ i: w$ {; f
- #include <linux/interrupt.h>
' u% O- }6 J# \+ W3 t3 F9 P - #include <asm/io.h>
a: `: {' e2 v+ i3 J; q! z* T7 r - #include <linux/moduleparam.h>
% I) d, _; h& n# v+ Q - #include <linux/sysctl.h>
5 k- q; n5 _1 [# q - #include <linux/mm.h>
3 {+ L* H$ o" @! a% X - #include <linux/dma-mapping.h>8 S; n- B2 ]& b* {
2 V. N* ~1 f4 k- #include <mach/memory.h>
! h1 z) S$ b: A4 g7 Z - #include <mach/hardware.h>
1 W! f: B1 ^9 |( {! }7 e - #include <mach/irqs.h>
9 V! l" A* H' a" I7 }3 d3 |" q1 d - #include <asm/hardware/edma.h>3 q) \" C0 Q# ]: h3 D% @/ p8 \
- " z( ^* E$ [& ?$ o2 u- m4 d2 ~
- #undef EDMA3_DEBUG* t6 a7 k3 ~/ L6 G) w' Y5 {
- /*#define EDMA3_DEBUG*// w! I8 X' X; |# i3 u
- 9 x9 s3 H, N0 s3 G# C- S; C
- #ifdef EDMA3_DEBUG3 C" x/ i0 {% u: c9 \+ C4 o2 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( i5 h: o$ {: j- O1 h. e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) S- h+ c A2 A( r6 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% `! O ^ z# P: d+ Z# ^ i( ~: w
- #else' R5 M$ c/ i/ q7 @7 k
- #define DMA_PRINTK( x... )4 M% k) Z9 g( z2 |; W+ H+ D
- #define DMA_FN_IN
# | z& ~& K4 \ - #define DMA_FN_OUT2 r; X- e+ e: Y+ B3 M/ [
- #endif! u. ?( F% o8 l' P' P
- 0 Q( S0 O7 d' l, ]! n" \/ P* l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! h3 h) b; T/ Z& P6 \' u - #define STATIC_SHIFT 3/ O- g5 D9 y3 M5 \# Z
- #define TCINTEN_SHIFT 20- G6 c) E- v4 V: v$ D5 }0 |$ B5 u
- #define ITCINTEN_SHIFT 21$ U* i! U% A: z! R
- #define TCCHEN_SHIFT 22
; V" c/ y w1 f$ V6 E! J) a* a - #define ITCCHEN_SHIFT 23
/ n, E; {# f1 D/ |$ j
% A9 m, ~' E5 D4 b, M3 G* _- static volatile int irqraised1 = 0;
) r" }0 V5 Z9 K" h3 l - static volatile int irqraised2 = 0;6 K8 ^0 q8 R- W$ z) h. d
: M# I+ O7 C- w5 ]( b' D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 |+ y# B, |8 _: N7 @* Y& \+ O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 q+ y, K$ L' i: g E. [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q- F N9 _* a
- - S' q3 i- q, l6 u' t- v
- dma_addr_t dmaphyssrc1 = 0;
7 n+ A% s* d5 B$ N7 p5 Y" X: ~ - dma_addr_t dmaphyssrc2 = 0;3 v8 ?2 t8 Y! s$ _1 Y
- dma_addr_t dmaphysdest1 = 0;+ \% C% h% k* V8 e" l
- dma_addr_t dmaphysdest2 = 0;# w% m# M1 ^- f: s, o, L5 [. O' t
- 3 \2 _$ C! l1 s
- char *dmabufsrc1 = NULL;
6 A- V0 o1 g4 P3 J& d - char *dmabufsrc2 = NULL;, C+ j! U* | o4 j U: A
- char *dmabufdest1 = NULL;
+ k& I" P: q, |# M - char *dmabufdest2 = NULL;( e3 x5 u. t8 z& p( V, V$ a
- ! L/ Y9 r$ ^- O- d
- static int acnt = 512;
4 r7 a& k+ Z) [ - static int bcnt = 8;
+ p9 U5 W \2 ^( H/ Q. w5 F. t { - static int ccnt = 8;
: d$ _- H; w' p7 _
P8 O; V0 N4 `, I9 R2 f+ q: m0 c- module_param(acnt, int, S_IRUGO);
- F$ M& h0 V/ m2 h" | - module_param(bcnt, int, S_IRUGO);4 ~$ a8 \* D) U' s5 v
- module_param(ccnt, int, S_IRUGO);
复制代码 ' z6 o6 c4 M% K3 m1 O6 F4 S
& H/ n- b: N. L. B1 P# m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 u' T" K: d" N1 S" `$ ?. _1 D, @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! Q" N0 U) L6 D0 [2 i/ b, c- T* f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 e( X2 F* t# ^& C
& r, B' Y9 D- ^2 C5 j
" I5 N2 j/ f# b( }" `- H( R |
|