|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * a! z" _9 {; F5 z5 b
- [code]EDMA sample test application& b/ t4 q+ L$ `/ k7 }3 n0 L" W) p9 ~' z
- /*
4 r7 K- a6 E3 R) E - * edma_test.c
# G! e. F, x4 s; L) k - *5 c4 [) Y, a0 t* {* m( q/ B7 k
- * brief EDMA3 Test Application' p! a- ?+ |6 t2 p
- *
/ s* \' \* _; p1 ~9 j - * This file contains EDMA3 Test code.8 E. I( B, C$ Y5 {7 h) o
- *
5 H5 X2 L3 i' R' M8 z1 A, } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! b, e! }; Y* a; G O: f- \- g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 [4 v: E9 ` G6 E! i+ }: W - * TO CHANGE.
' Z9 u8 ^1 ~3 c - *
1 J7 m3 `' S4 O4 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 B5 Y. J' N& a& l
- *: ~) Q/ n5 H4 \+ g
- * This program is free software; you can redistribute it and/or4 o4 f d5 F% ]/ d$ O: M9 ?
- * modify it under the terms of the GNU General Public License as) T* z8 t4 O* J) m2 r- d
- * published by the Free Software Foundation version 2.
4 f" B1 W" U- m' Z: J( V b; R - *
- c. s$ ^& p2 _& o5 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 s ~* S$ _2 @1 u8 _* p
- * kind, whether express or implied; without even the implied warranty% Q8 L8 p$ \) s2 C" A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 ?0 C+ L4 k6 }1 ~( H+ o
- * GNU General Public License for more details.
* o7 S) X2 [* B! \+ z - */' L; I8 ~0 }. u
5 k9 v( l0 X% x5 }) [5 J- #include <linux/module.h>
+ b; f" f3 o) i8 Q5 [# D+ [ - #include <linux/init.h>
9 ^* V: T7 [$ {$ N( { - #include <linux/errno.h>8 A; `# R, P3 w+ Q% g
- #include <linux/types.h>
" j) [& ^; o1 ]9 B! O - #include <linux/interrupt.h>
$ b; x& a9 V9 r8 c) X7 g - #include <asm/io.h># |+ x8 W C& F0 I
- #include <linux/moduleparam.h>/ X& _2 }, ]/ S- i4 y
- #include <linux/sysctl.h>' s) i% J( d$ e* b! a1 B
- #include <linux/mm.h>" T6 }3 W) E- n
- #include <linux/dma-mapping.h>5 z6 F/ P: J. W$ A" q
- . `8 \/ @ A/ I
- #include <mach/memory.h>; F, K) D$ ^5 G. b( @9 w$ k( D
- #include <mach/hardware.h>* J% _1 O; |; s+ ^
- #include <mach/irqs.h>& y4 |8 N) |, E
- #include <asm/hardware/edma.h>
; `) O j( i2 Z+ `- `+ V: B - 9 S2 V: w. v8 @8 w9 l8 [1 g0 D" n
- #undef EDMA3_DEBUG
( y4 }$ A7 }3 P3 _( _ - /*#define EDMA3_DEBUG*/
) }+ P% S" h/ L) J' L
" j z' ?8 x8 J! Y7 W1 r7 ], N" S- #ifdef EDMA3_DEBUG- A1 T& f/ r8 d0 P9 k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# K* i$ Z6 S, [* b6 C+ r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 A$ k& L1 J: N# q+ v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" A6 G; Z& f& j- y [7 c/ } - #else" h \. A; l- ~ q8 U+ |
- #define DMA_PRINTK( x... )! v: ?, v$ x. X) G! d4 ]7 @/ N
- #define DMA_FN_IN! e4 M2 S+ V8 I
- #define DMA_FN_OUT: u% W2 u! g( E; i9 `1 a
- #endif: W7 ?( |; o# |% E2 M# V* v
6 Y- ^: O$ ]2 t: v, P. u; i+ Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 e4 [5 J0 |6 p& \/ r# j( p$ j - #define STATIC_SHIFT 3
' v6 ]: T9 w3 y6 L - #define TCINTEN_SHIFT 20
7 x( S; m' [% s! n9 E - #define ITCINTEN_SHIFT 21
2 I3 ?& x1 p1 D, i9 T - #define TCCHEN_SHIFT 229 C/ O. K" s6 B" H/ t% |( g- s4 F
- #define ITCCHEN_SHIFT 231 q2 H% T" |2 l1 Z
- * N( B& b0 K g6 u4 t+ v9 L
- static volatile int irqraised1 = 0;) H( O8 \# u9 F. ]! y, y
- static volatile int irqraised2 = 0;9 O4 L8 w+ n! E# t: z7 `
; ]& r2 ~; x: [& [2 k" r8 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); R/ @! z8 _3 t6 A" R& p/ A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n+ H G3 Z2 H7 Y4 C0 d t* p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ?+ ]/ A* Q n2 A
& @4 c( L' S* }: E: ?2 V- dma_addr_t dmaphyssrc1 = 0;5 B/ F0 s/ P# B/ d$ Y( f
- dma_addr_t dmaphyssrc2 = 0;
' |! o5 V+ ]/ u% ^* A - dma_addr_t dmaphysdest1 = 0;, C5 b, H" M- F
- dma_addr_t dmaphysdest2 = 0;7 X/ _1 E: j) g: O/ B# d- \
- : O n) s0 ^, w5 U
- char *dmabufsrc1 = NULL;
( i# _. P% E N - char *dmabufsrc2 = NULL;
, y1 M; y! K7 `( t+ A) ^+ V) e - char *dmabufdest1 = NULL;7 Y* L: V3 H; T
- char *dmabufdest2 = NULL;
! \3 O1 ? h6 g; `. Q9 y - 8 j8 I% D2 f5 I: M) z7 p, J- ~
- static int acnt = 512;
9 X# y8 o' w8 D! N - static int bcnt = 8;
& j2 q, n* n/ r% g! A; W - static int ccnt = 8;$ B1 [1 r; e8 O( ~* T$ d( Z+ Q
( h+ @$ A0 Y, _- module_param(acnt, int, S_IRUGO);5 |- N6 a* N1 t" S
- module_param(bcnt, int, S_IRUGO);
' g% e* }% r" j - module_param(ccnt, int, S_IRUGO);
复制代码
: K. S& f7 J( s7 H6 y; P2 q8 z
, H5 {9 ~4 C7 D0 T! i( F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' l* g* O3 V% p+ A$ S9 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 Y: Y8 Q$ K$ p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ h6 v m" j5 U& `' t$ n( Q6 F
( [2 a( J ~1 O# v& s" R: W
! e, |) u5 M7 u3 E4 b" w |
|