|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 D7 H6 z, s7 I8 `% ^
- [code]EDMA sample test application/ A3 {% s' r# P1 M9 j
- /*. y3 b2 w8 ?" u: N) k
- * edma_test.c. S4 }. G& e5 y: O8 R) q
- *
* g4 W$ W" W6 Z* I9 Z9 Y+ i* J: s - * brief EDMA3 Test Application. X; G- q: j0 M- o4 w
- *0 M. h% u/ r9 L7 ]
- * This file contains EDMA3 Test code.4 N p7 E7 X! D
- *
2 z. c* c! D7 S }6 v9 ]& ~/ ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ _$ ?. Y* O4 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 l* k8 v# }/ ?. l! T8 D( _5 s& a - * TO CHANGE.2 z; c; w5 }0 Y
- *5 x! q7 H3 \! |# N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" ]# [1 ?9 T( n - *
5 N6 ^3 C' a# Q% w - * This program is free software; you can redistribute it and/or
. A: ]6 e# j" z7 G0 a3 L( }- z Q - * modify it under the terms of the GNU General Public License as
; |2 w U7 I" O$ m( f- [ - * published by the Free Software Foundation version 2.2 E8 W: \/ B! z/ L ^9 D% l5 @
- *2 i2 Z) i% ^; t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; W% D- Y3 J* M- E3 I! P - * kind, whether express or implied; without even the implied warranty
6 L' Y2 S' [, t% `& t! H% b, Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% M* ?6 q e5 `4 _8 z - * GNU General Public License for more details.
. k9 b$ ?* @) K/ h - */
0 S. ]# n% e% B1 R9 M! @ - ; S" |# f- v! h6 f: n H7 t) \ \
- #include <linux/module.h>
, |* p' Y$ B; U# f# c) W5 G - #include <linux/init.h>
0 Z3 i! @1 [! l7 O; h2 C% \, | - #include <linux/errno.h>5 M% b! n# B* ^# B# K4 _, r
- #include <linux/types.h>* R, k. [+ b4 U' u
- #include <linux/interrupt.h>
, G4 m+ E' D# V+ T* h( O - #include <asm/io.h>
! S0 q" u% r" {2 M" \ - #include <linux/moduleparam.h>6 a+ o" J) q1 y( `: G7 x9 k
- #include <linux/sysctl.h>* O$ c: D7 x3 `
- #include <linux/mm.h>
% V0 s6 e7 j0 P* x( B, }1 c - #include <linux/dma-mapping.h>
. Q l) C# S$ r9 l- i
0 ^) A9 H0 Q8 ^) _2 d( I( ]& U- #include <mach/memory.h>+ ?7 S, I3 M. H: t# f
- #include <mach/hardware.h>
+ d) D6 ]8 [; P+ O/ K - #include <mach/irqs.h>
7 U; x% ~9 _2 m$ [' m: D - #include <asm/hardware/edma.h>( n; y8 j( b6 D5 c
- ; U+ J0 q% T- N/ F3 M
- #undef EDMA3_DEBUG0 }, z! Z/ r1 x* q! }
- /*#define EDMA3_DEBUG*/( X- K% d2 [; R4 V) E" m
% u: S0 i* v5 B8 A- E) R8 G- #ifdef EDMA3_DEBUG
' ^2 J% _: }4 L8 D c' e+ f7 a( _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' M, B5 L! E4 k9 q, {2 f* A: } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 `% Q7 m2 z; [* B7 F$ E+ T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) }0 P% g; H# n( r( j/ P: R
- #else
& i3 }* P: _2 c - #define DMA_PRINTK( x... )8 C4 [/ ~5 X( A
- #define DMA_FN_IN
) _) a! n5 h+ M$ b8 F6 I2 R - #define DMA_FN_OUT
) z8 |9 e9 y9 a6 J" J - #endif
9 e8 `! e+ [8 u& I. m! b
3 B4 i# N- V3 r1 r* R9 F) N( ^$ q/ G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 ?2 Z, Z" e; j- f2 K - #define STATIC_SHIFT 3
- P8 l6 T4 [: j - #define TCINTEN_SHIFT 20/ A4 r3 A- k4 R* a5 H8 e
- #define ITCINTEN_SHIFT 215 s& b* ?0 Z$ Z- \0 l9 z' k) e
- #define TCCHEN_SHIFT 22# q( l, t" }( d+ t; M! _
- #define ITCCHEN_SHIFT 23
E# } }( R; u
1 U! N1 B4 }5 ~$ W- static volatile int irqraised1 = 0;3 M+ [. E4 a! `* G
- static volatile int irqraised2 = 0;& }! Y5 F( n8 N/ M) P
- 1 X7 b% x3 S* u! U2 w l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- `2 V! U; Z4 |, P( L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]5 e+ ^+ }" a3 |0 O. v% d3 B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y+ @& P m' ]+ u* m
! Q8 y2 y2 R( K1 s8 j- dma_addr_t dmaphyssrc1 = 0;
/ \3 t/ J4 I5 \$ k$ H$ Q - dma_addr_t dmaphyssrc2 = 0;
" v6 s5 Y0 e" M4 ~$ q - dma_addr_t dmaphysdest1 = 0;0 _3 p. f3 Y; Y# h5 ^ v0 I
- dma_addr_t dmaphysdest2 = 0;+ X$ Y8 }( y4 ~3 J4 J
7 w! Q0 _, m, S% ?* X" B4 ?1 X- char *dmabufsrc1 = NULL;
. E* s/ _6 o4 P4 v1 c( X+ _ - char *dmabufsrc2 = NULL;
' {" f9 x2 ^# E% Y3 d e - char *dmabufdest1 = NULL;
3 e2 Y9 {7 \( t6 e/ ]( E/ o# ] - char *dmabufdest2 = NULL;
0 j5 q; {) w" m
1 P9 L2 n+ E, O; Y( F+ f* t- static int acnt = 512;
6 o1 [; z7 n4 I9 \, ]$ s - static int bcnt = 8;
! H; }7 C W( h) ~ - static int ccnt = 8;
! G9 P$ ]. {5 {0 W; n - 0 y( i& e' X: u- w
- module_param(acnt, int, S_IRUGO);( \+ t2 Y& d0 c
- module_param(bcnt, int, S_IRUGO);. T5 w2 M1 J0 d, M6 J! A" U
- module_param(ccnt, int, S_IRUGO);
复制代码
/ z6 c) \: W! u0 R% f1 N* D0 N4 n. A( s" A- F2 N0 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ O5 m0 D3 u$ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, S1 _% F# p: i% C% N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; ]* M' o' g: d/ \# p$ [% J S t
" H! r! q7 _& Z+ U( o }
6 ?' ?5 H9 Q, m7 F9 ]8 D- U7 Z9 \ N" x |
|