|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' `% `/ m/ G* G, U+ _3 K6 G. F- [code]EDMA sample test application. Y/ ]8 i5 x6 c
- /* D7 d5 |3 [$ |5 n9 T2 Z
- * edma_test.c
* f. A K2 f$ h0 o/ U - *
i, _1 N1 T" C8 {+ i - * brief EDMA3 Test Application: M H9 J+ e5 A* K
- ** `! A M0 P. i7 z6 s
- * This file contains EDMA3 Test code.8 l4 X- g* T4 ^; ]
- *) d7 `( Y8 o: C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 F/ W. L/ }+ w8 _3 g, A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. B/ c9 U4 {' E$ R3 {' v - * TO CHANGE.5 ^. y5 m' E+ S/ v
- *
) Q/ i _9 v) m; H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, j2 y7 `* j, m5 ^, p, o0 c9 G0 R - *
5 Q. O3 V9 S7 n" h% [! v% L4 f - * This program is free software; you can redistribute it and/or
/ G/ n& [# y: ^% t7 p - * modify it under the terms of the GNU General Public License as% ^, P( X: t0 u* o
- * published by the Free Software Foundation version 2.3 A7 w; w: y |. c# L
- *1 @# u& s: }' k0 ~, D$ G( {0 n$ n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 {& s% R+ v. o! k% e0 N8 O - * kind, whether express or implied; without even the implied warranty7 c: d- C" z7 P( s6 f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 `: ? m l Q- s0 s$ N& H( y, {
- * GNU General Public License for more details.
5 q) k7 r) \/ g2 |& y7 a - */. K# t) i/ `6 Z# j4 b
- G# m( f3 ]9 a9 [
- #include <linux/module.h>
# f1 B1 D% d+ p! j# x - #include <linux/init.h>3 s3 X4 V/ D& N, \/ m
- #include <linux/errno.h>" ]# e8 U+ T! j- T! W
- #include <linux/types.h>- ~0 H. O* _* L, Y% _7 f
- #include <linux/interrupt.h>2 K2 D) O- S! _8 Z: D. v
- #include <asm/io.h>
. S/ o6 a! b0 Y# r) j* h - #include <linux/moduleparam.h>! t# i3 @+ B( w& s( O
- #include <linux/sysctl.h>. C. a) x; v; t1 b& U3 B
- #include <linux/mm.h>1 s5 Y% g# P% _/ T+ F! v V" A
- #include <linux/dma-mapping.h>+ C# L& Q5 G2 N+ V5 {) t# M
- O. [. [* r7 d8 x- #include <mach/memory.h>6 m/ ^, s+ {7 _5 E& n
- #include <mach/hardware.h>
8 k/ h. F% w7 O0 A2 E) M - #include <mach/irqs.h>8 |$ x! o- U: c9 s; i6 O) c( f
- #include <asm/hardware/edma.h>! g* u" } K2 ~3 H% ~
6 `" |; f9 U, J( n7 t- F- #undef EDMA3_DEBUG
& B5 o& ^- C' w' `$ M/ P - /*#define EDMA3_DEBUG*/! P0 y) ~ ^" @+ [3 J
- 2 {. q# Z$ }( Z9 @8 z; k
- #ifdef EDMA3_DEBUG
8 z7 h$ T+ P% y1 M! o9 A& T! r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ B" Y" r5 N/ z `! P& @3 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% p7 @# J; \, n C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 m1 c( p" V; q" P
- #else" I" K8 F/ i! s0 [+ m4 q" i. e% u
- #define DMA_PRINTK( x... )
1 g. e% @% N, W2 o9 [, ~ - #define DMA_FN_IN
. j* [% u/ [# j5 Z$ f" @ - #define DMA_FN_OUT' y# q6 x0 Z& u' g! o: e# \% E9 J. p
- #endif
5 r% P) ^( s. v; x! V/ h
! T" J& h$ \, B0 d X) P) L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% D: R/ R* |2 q X% v
- #define STATIC_SHIFT 3
7 H: s7 j" K ?/ W9 s - #define TCINTEN_SHIFT 20
0 e' X l& V' `* q- Z4 Z - #define ITCINTEN_SHIFT 214 b) m' d0 K) c
- #define TCCHEN_SHIFT 22
4 ]' ^6 b# ~4 Y# l. P5 q5 J - #define ITCCHEN_SHIFT 23
0 L! q0 n4 x( g1 P - 9 g' _2 j. ~5 V+ t6 M
- static volatile int irqraised1 = 0;4 C* u! @ v0 c! s3 ]$ M
- static volatile int irqraised2 = 0;
5 T4 l; A1 G) C/ L& m" c8 P* u6 F
* f1 A% Z9 ]8 _! B. O9 W2 \( D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a0 t9 j6 E: A0 K! n0 P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; x+ c5 d8 G4 x' G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 G" K3 N. G2 m V& r6 s5 E8 U - 3 m4 w( ]1 ~9 s8 D, _" }. z
- dma_addr_t dmaphyssrc1 = 0;) E9 M, U& H2 t
- dma_addr_t dmaphyssrc2 = 0;
. {' {! K; w9 I( q& | - dma_addr_t dmaphysdest1 = 0;
( `) m7 n4 o4 z8 d - dma_addr_t dmaphysdest2 = 0;
; b3 z4 S! {! R7 A E1 v; U - & K/ ?( ?* b8 A! k" J8 K7 l! g5 I
- char *dmabufsrc1 = NULL;: h& B3 J' A; B7 u
- char *dmabufsrc2 = NULL;
( k# x- c. A: P1 H, B - char *dmabufdest1 = NULL;( [: C/ `: a& \$ [& t; g) P- l
- char *dmabufdest2 = NULL;. U r2 v0 v; e1 u) v6 H# ]
- 9 L( @0 K* C0 C6 m2 t
- static int acnt = 512;
3 L$ e1 }* i+ g0 w - static int bcnt = 8;
) W, E5 I( K. z+ Y3 M* ?' u6 E - static int ccnt = 8;% Z! S7 |& l& Y! ]
- * Z1 h+ B( U! l( m4 m3 t0 T) O* d4 C
- module_param(acnt, int, S_IRUGO);; f$ N: ^- z5 Y5 z0 W$ G
- module_param(bcnt, int, S_IRUGO);
; z: _' B6 e/ a5 U5 U - module_param(ccnt, int, S_IRUGO);
复制代码
/ S- ?" @; f9 I B" `, B
7 d! I' c1 K0 K5 A! _, P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 o& S, g) O" w! N. sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 l$ L' Q: V& U; B" N; l! p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: N! _9 a8 h! d5 g( W; X) }
# ^1 L) \1 }: z: ?( n& G/ e' w( D% w6 Z8 V% }/ A
|
|