|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - q+ N# n. R7 Y* A3 S
- [code]EDMA sample test application/ S8 b7 p; M' X# J0 s
- /*1 ?* Q1 v! o9 W- K4 u3 h
- * edma_test.c
$ Y; s$ I9 H Y" t( X" A - *4 P; O+ X7 r- ~2 b& l
- * brief EDMA3 Test Application, y0 ?, [" q+ @" e1 y. Z
- */ L* e8 D1 \( _
- * This file contains EDMA3 Test code.
# a- b+ c- J( R) M& K - *0 t; a9 y3 R6 }& x5 J* K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ Z9 W, q5 F( Q& y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 H1 m* l% v. w+ n& G
- * TO CHANGE.
; d# ]( {- X& J7 [1 d6 J& C - *+ X2 R! |3 i& D3 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 b6 _6 }. p* S0 q. U& R - *
+ j7 `/ `5 b+ B1 V) [! U - * This program is free software; you can redistribute it and/or* ?' P3 K* N3 W$ i0 h% z
- * modify it under the terms of the GNU General Public License as2 J& n. b, n1 S$ |% G
- * published by the Free Software Foundation version 2.+ {* V) q1 L7 O
- *, J5 ~, Q8 G1 m! @6 p4 Q! {. p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ b9 }- s' u& G( Z
- * kind, whether express or implied; without even the implied warranty
2 z& E/ ^. p' c5 V+ @$ a1 W; Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* t1 X* o3 Z1 Y) u - * GNU General Public License for more details.* o# y; U0 j/ i& P- D
- */5 |9 d+ @! G& [5 G* [
- 0 f7 N4 M0 u8 |' ~1 S! o
- #include <linux/module.h>
! Z# z: y, W+ i9 P - #include <linux/init.h>/ p2 h6 G) T. W0 Z1 A* O
- #include <linux/errno.h>
" o' r9 T/ ?. p J6 X - #include <linux/types.h>
5 Z; f( B' y o9 [5 [7 [6 ~ - #include <linux/interrupt.h>
1 r3 \* Y* K B0 N" v3 k - #include <asm/io.h>! Q2 U9 N6 \- [* H; @
- #include <linux/moduleparam.h>0 b0 I$ S* h7 N6 _& |$ z# z
- #include <linux/sysctl.h>/ k8 D3 h" Q- h% f" Z2 d
- #include <linux/mm.h>
, W% }/ H5 C& E% z - #include <linux/dma-mapping.h>7 p0 ]3 d' v/ h8 o
7 i% c8 B! j8 Y- #include <mach/memory.h> F! r4 P$ M9 ]1 U
- #include <mach/hardware.h>
" K' i1 q% {6 ^; X - #include <mach/irqs.h>* V- s1 H! ~, L* M
- #include <asm/hardware/edma.h>
1 M _' f9 b4 C; ~1 b - : o1 X( x) i9 D% v; X/ b
- #undef EDMA3_DEBUG
1 h. l' F$ k3 B2 h7 x - /*#define EDMA3_DEBUG*/ \+ L- M7 q' u' C
- $ [, g. N: c9 i8 V7 r
- #ifdef EDMA3_DEBUG
% O G1 V* _9 X- B; y+ C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- [5 ]8 y4 H( r) S8 n9 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
E9 T; Q/ X. @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! l8 J1 }0 R `
- #else" ~! ^! |, T$ U( S# n
- #define DMA_PRINTK( x... )
) b& Y- @1 D- g8 k& R3 v( ?7 c* v - #define DMA_FN_IN! s6 Z& s: l) N* `3 q( M
- #define DMA_FN_OUT
c! X: Z: X# l5 u3 S - #endif8 y1 t1 I* e" b/ v& ~# ?5 E9 Q
- " U' B6 h' ^5 j) `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& C# l! E' `3 r _3 T, m1 A/ |9 h
- #define STATIC_SHIFT 3
9 ]6 @& `1 K' B9 V% @1 Q8 m - #define TCINTEN_SHIFT 20
: c* r9 h! A6 v+ M. n - #define ITCINTEN_SHIFT 21
2 l3 O6 G3 _6 }; `! U - #define TCCHEN_SHIFT 221 d0 x& i) ~6 j- G9 v
- #define ITCCHEN_SHIFT 23+ O& F# V; @ h
- ' P7 S& n w5 ^, Y1 X
- static volatile int irqraised1 = 0;
9 _0 v {. Q/ M8 m- c5 T& b- z - static volatile int irqraised2 = 0;" d) ^. u! H% K6 ?4 n U
R2 q/ X# B5 `0 q+ K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |* U1 g& e' F8 @, P: b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. {* m0 G1 H, c8 B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E" C; d# [; c1 ~+ u, O
; i; C$ U9 C3 ?- dma_addr_t dmaphyssrc1 = 0;
\3 h; S1 h* {: B9 Q P - dma_addr_t dmaphyssrc2 = 0;7 |0 d% E/ _: e; C
- dma_addr_t dmaphysdest1 = 0;
4 h$ l+ R' C3 f/ A# F - dma_addr_t dmaphysdest2 = 0;( B2 v( q8 m* q; L: C9 Z8 ^% }5 v
- 9 \$ M8 G% J6 | Z! c2 Z9 h
- char *dmabufsrc1 = NULL;
" P3 j1 _" v: h I: x - char *dmabufsrc2 = NULL;
* P V+ Y" I+ k: ]" V p - char *dmabufdest1 = NULL;- _7 }- e8 B, @" G( v' j
- char *dmabufdest2 = NULL;
! ?8 E4 O4 e: i) f4 C. M3 w$ |+ w) t2 R
8 S" [( b) Q8 E- static int acnt = 512;
# S) B; @ a+ g/ r1 c" z: ~! P! g - static int bcnt = 8;# S) z3 @, [0 @4 @
- static int ccnt = 8;
+ H3 z" d& ~0 `. J" F - $ R, ^3 U; n! I7 F$ J
- module_param(acnt, int, S_IRUGO);' L2 z. l$ B( L8 I$ @
- module_param(bcnt, int, S_IRUGO);9 A+ B6 h! T9 S9 f) d" I' D* T
- module_param(ccnt, int, S_IRUGO);
复制代码 ) _; q2 f: F& A8 H5 e
3 S. n# T! m J8 \' ^9 x& a: s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 q, s3 h. w; {0 P) o% S) p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: v& `! h' }4 S7 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 z3 p9 S$ v9 ^; n) M3 `8 }
/ @0 W8 m% g1 A: I
* ?1 }8 b7 _+ q+ g
|
|