|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 |2 {6 F% }$ E% f; k
- [code]EDMA sample test application7 H9 S; v& J' M* j5 d/ _
- /*8 |* D- {: d7 f
- * edma_test.c7 K" P5 p+ }+ b N
- *
* X- ]+ o9 T- G. d- u - * brief EDMA3 Test Application
, p1 H0 Y4 I8 {' y - *
8 [& d6 ~* z4 ^ - * This file contains EDMA3 Test code.+ D6 n, J( p6 m( m( ~
- *
9 l6 C$ _& H2 f ~9 \/ u5 U/ m( @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
F4 ~! r; `! n1 g% ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 K9 a& M8 p# c4 @1 M4 q
- * TO CHANGE.6 I3 ?& f' [2 u* C; D% V
- *
! t: S9 b& s, ^ a( R8 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Y* V: E$ R2 U2 q& O7 a! ]
- *7 u! v) b9 g* X3 A7 g
- * This program is free software; you can redistribute it and/or' l! i5 x# |' v7 }9 f
- * modify it under the terms of the GNU General Public License as
( T* }7 Y% P* i( ` r - * published by the Free Software Foundation version 2.
, u( _9 w% B2 }) r: [ - *# b1 D6 V! q$ O) z% Z, D0 ^. e4 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 `( f) k9 Y7 P/ ^6 i! `+ a2 _1 C
- * kind, whether express or implied; without even the implied warranty
- N9 s# r9 x8 \ o$ B+ B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Q* v; P- ]$ x4 ^3 m2 v; k - * GNU General Public License for more details.
$ H% ^3 ]9 ?1 \; d - */+ ? S6 X" ?6 j$ s- l1 O- K7 r, Q. G
- / |( Q5 \. V. g
- #include <linux/module.h>
- f3 s; g p4 ^) S- ~ - #include <linux/init.h># q* `3 X! X! o: ]
- #include <linux/errno.h>
1 ^/ }! F1 S7 h. o - #include <linux/types.h>$ C3 S N1 U3 d5 ]2 ?. I6 H
- #include <linux/interrupt.h> q& v$ l! G1 j) |% u2 t/ C
- #include <asm/io.h>
% {) _) I* q6 ?2 y6 M) `7 ]1 q - #include <linux/moduleparam.h>
* @1 ^9 `# b" r' G9 I - #include <linux/sysctl.h>9 B+ l( ^) ^! c( |
- #include <linux/mm.h>
D/ U4 C" {0 S" n# N# z j/ z - #include <linux/dma-mapping.h>& r. y9 ^/ z H5 x
: u9 l3 x3 }: z: O! C) X2 |5 @- #include <mach/memory.h>4 ?2 c1 }2 b4 I
- #include <mach/hardware.h>
6 P2 ?- h5 r/ h3 }, W+ Q - #include <mach/irqs.h>9 K! T% Q9 D" W) R6 E
- #include <asm/hardware/edma.h>
- t/ O! @7 Q4 U I, X3 }7 Y6 R - . ]8 x1 E, |% C! f5 n& n; G+ X
- #undef EDMA3_DEBUG
+ @+ E2 R% d/ l" L" x4 P - /*#define EDMA3_DEBUG*/9 z/ L; V# @( O6 B
- . e5 G8 N" K5 B+ O- J2 _3 }
- #ifdef EDMA3_DEBUG
0 R- t" n; J) k# z+ G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! X" F; b; R8 b6 t6 h; k7 E6 ^$ q+ g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& m7 b4 G2 v' l m2 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 I; F3 w n& W - #else
( w' r5 f" }; K% V - #define DMA_PRINTK( x... )
/ T% t7 ^$ w7 T0 Q! Z0 e1 n2 b6 \ - #define DMA_FN_IN
5 c+ a% F+ B! S* h& [( O" {# B ? - #define DMA_FN_OUT
' s- a7 D. G j. d8 o - #endif& s4 @: [6 K2 [$ U- O) Z6 L
3 a% b' Q0 W' Z5 }0 H# j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; t( R* |" F8 Y2 D& p6 T - #define STATIC_SHIFT 3
2 H1 |7 o- }$ L) w - #define TCINTEN_SHIFT 20* u# ^2 ?4 R7 A" \! q, a
- #define ITCINTEN_SHIFT 21: z' _5 N0 C. o; Z. U, ?
- #define TCCHEN_SHIFT 22
6 }* S: C& b3 q% ^ - #define ITCCHEN_SHIFT 23( e7 ?* S E6 t* m* S1 u
- 5 o( K& Q4 r2 @3 Q
- static volatile int irqraised1 = 0;
, @, w% q U! Y0 ~# i - static volatile int irqraised2 = 0;* k& s* O1 U6 C
4 Q0 v+ d$ Y( G7 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ g1 ?: }+ h9 q& E6 b! V* ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( j% E1 D7 w7 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d7 ^: x0 _- f
. K9 i' |: Y- X6 ?1 r2 K9 }2 m: c- dma_addr_t dmaphyssrc1 = 0;
6 b( ]3 Z3 U: _4 ?/ j, V5 c9 I - dma_addr_t dmaphyssrc2 = 0;
: S9 l+ d* a, e - dma_addr_t dmaphysdest1 = 0;- L* D( r4 G6 @$ [ Z
- dma_addr_t dmaphysdest2 = 0;
; y. }% U1 M4 h; G5 c
3 z, r, m0 @) `8 D- char *dmabufsrc1 = NULL;3 L) V' E4 E0 X' ]4 U3 e
- char *dmabufsrc2 = NULL;
+ k1 p& z( R" k0 Z) e - char *dmabufdest1 = NULL;- B/ a& g% _$ L8 w) x
- char *dmabufdest2 = NULL;
" o5 _' W. h1 Y* g+ M1 R - ( g$ G$ X0 }7 @- V. K
- static int acnt = 512;
8 o& M" X- s9 k0 L" g+ j - static int bcnt = 8;
5 |' }: h( ]! ~# F9 _8 N- p& }8 s: A+ \ - static int ccnt = 8;( n6 ^6 f! z7 w& T7 z a- @
- j! I- w) n4 `% \1 W8 t. a4 {
- module_param(acnt, int, S_IRUGO);
' C/ _% J- Q# \4 h - module_param(bcnt, int, S_IRUGO);0 A, Q4 O( ?0 ~) R6 c7 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
( T- o* Z( G$ y
/ e1 Y, Q4 _8 \, H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( U; N3 u) b' w, _% ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 S7 O; A* z) Y& r6 R. Q# P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# g$ \; w. u3 {7 J5 n
1 m8 ?* g0 a/ B2 b
C/ X# ]. j/ b N% j# l |
|