|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 E T# c. f3 J/ d' X- F- [code]EDMA sample test application
( `3 Q9 U& ^" O" J# s5 P - /*
3 _% Z4 O) c% R/ E% y* T2 _ - * edma_test.c7 P( }. H% o6 ~2 I* Z: B
- *
7 {! Q" N8 R4 r$ i8 m) f - * brief EDMA3 Test Application% f5 [7 o! z; V+ Q$ r* q& V
- *) N% [0 X5 q- Q; g3 D( S+ P- R
- * This file contains EDMA3 Test code.6 B8 L& j" j! l' w' G7 _8 p' D: N/ [
- *
# ]7 ?( m) Q; n% ^, H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 i5 y8 D) f8 ?6 M. ^% D% M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a; i$ h N1 ]; F- ?- v: k4 p7 ~
- * TO CHANGE.& N3 F, e9 f" u9 z& n- s! `* D1 \
- *
& ]2 i+ O0 o8 y8 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, L# d8 D# O. I- g+ t' Z - *
: |9 _0 J8 M; N b7 s" P0 _4 f - * This program is free software; you can redistribute it and/or1 S$ A7 i' E- U6 O) ~
- * modify it under the terms of the GNU General Public License as
8 |& c; t9 b( { - * published by the Free Software Foundation version 2.7 X, l3 S/ d; X' t& H+ f" T
- *5 I' y4 H% T( Y2 [8 B2 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( d% L5 D" e& h7 I - * kind, whether express or implied; without even the implied warranty7 {0 q) i% z6 v+ Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 T; t. l( ~# u" R* b& @
- * GNU General Public License for more details.8 z! g A1 T3 K
- */
* w9 m: r4 C$ E% T9 r+ P, v, `
* b0 p2 }; ^- V' E. E9 d* V& I- #include <linux/module.h>7 C" B5 X2 o3 t2 Z: P: M* o L
- #include <linux/init.h>$ V! Y; m/ }; @" M
- #include <linux/errno.h>7 b( Y) T5 u ]$ \. g% G7 \ B9 I
- #include <linux/types.h>7 e6 c" B6 H5 ^$ B
- #include <linux/interrupt.h>
+ b1 ^) N G" r. X ?& c - #include <asm/io.h> O6 S, F1 e% U5 t
- #include <linux/moduleparam.h>8 T" c2 ?. K% Y( V" r
- #include <linux/sysctl.h>
# h1 x+ |: `! F. z; b - #include <linux/mm.h>
# H' [3 R. d6 O" i! W - #include <linux/dma-mapping.h>
1 U. I( F }% e' G6 u% d, { - 3 u3 L9 m. R) f
- #include <mach/memory.h>) q! A3 m# P+ j! o
- #include <mach/hardware.h>
4 E% h" p' h% X( w8 H - #include <mach/irqs.h>
% e* W: _( P# a$ O - #include <asm/hardware/edma.h>6 e! F* U+ `6 j5 x) s
- 6 b( D6 M' E8 ?8 [
- #undef EDMA3_DEBUG
0 C( o# F/ [7 Y9 h - /*#define EDMA3_DEBUG*/
5 Z ]8 z' c& j6 b# @! K - , z! ^5 Y; T9 j& u Y
- #ifdef EDMA3_DEBUG
" `' [6 }/ `% u+ D9 h( m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ]. Z, j5 i: e6 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! e" j" J7 s/ |1 ?$ l4 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): f& J& q6 h( A* G: w3 A
- #else
2 `" ]( O* {& a7 n: Z! r& m5 W# c- S - #define DMA_PRINTK( x... ) o& b$ C5 k( x6 m1 w; R. Z. |
- #define DMA_FN_IN7 L3 a- {3 _# k, w0 i
- #define DMA_FN_OUT% I, R; X% `9 F* ]! D
- #endif- J1 x; P( e8 x
- 7 M7 }$ o) A+ ?6 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 R/ _' f% R! q& Z1 Y* F
- #define STATIC_SHIFT 3+ p/ W" l; q% v. {) ]
- #define TCINTEN_SHIFT 20
. N; r9 S* h( D - #define ITCINTEN_SHIFT 21- j0 \3 o0 C+ l( P& [' d: o8 H& O
- #define TCCHEN_SHIFT 22
, Y" M8 @/ x5 w7 e8 V5 U9 [ - #define ITCCHEN_SHIFT 23# \+ k7 d6 \* b/ D1 a
- 3 O, u5 g+ C4 R/ ?7 _
- static volatile int irqraised1 = 0;- U4 ]! A# ?& E q
- static volatile int irqraised2 = 0;
( W: Y' U' S* I" c/ B3 P9 i& p
3 L, V6 Q3 Q$ E. a1 N8 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% v; K! ]: F& _2 Z0 p+ h5 h# B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% W( D& j; g& l$ N4 w! S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?1 K! Y3 o0 b4 v( d$ i - ) b& z+ z% D9 X& }# a: y4 i
- dma_addr_t dmaphyssrc1 = 0;
+ M- M9 W$ P( R5 _5 ^1 G - dma_addr_t dmaphyssrc2 = 0;+ ^0 q7 \) n: F3 \" K( n- a
- dma_addr_t dmaphysdest1 = 0;
7 L; x( F: M2 G3 K% K - dma_addr_t dmaphysdest2 = 0;
7 f+ Y% t& T! L1 h! Z
4 o% i6 C& H- [! U. V2 u s* [- char *dmabufsrc1 = NULL;
, `* S; R7 m' J# ^: o - char *dmabufsrc2 = NULL;
' }4 ]) `3 P' M - char *dmabufdest1 = NULL;7 m9 {3 R( J+ X% }
- char *dmabufdest2 = NULL;
( A1 ~8 {( `2 W! y$ A, C7 O/ ~- Z5 t5 F
/ N: w& `- l( I/ c/ q9 u- static int acnt = 512;2 l/ T/ u# r/ e% H9 {+ {
- static int bcnt = 8;3 D3 U2 D) ^& } b: t7 K
- static int ccnt = 8;) T R" c0 R) t8 J
- 1 d- ]7 d% N w: x2 _4 V
- module_param(acnt, int, S_IRUGO);
! W; Y4 Q) I! ]" X. B - module_param(bcnt, int, S_IRUGO);
: F$ x2 b' p& O/ w, I0 Z4 Z; C - module_param(ccnt, int, S_IRUGO);
复制代码
& Z3 t, A; ?5 {. k/ i4 V/ g4 G3 |
, X+ d* E3 X6 Z- U9 p' O# q8 N: C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Y D0 q( j/ ]8 a8 [# r! B% ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ a+ B% g% x5 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# s% }( s8 [; g+ D" m* U& G, R& s
- S( ^; t; V0 R( C4 x- B0 u
2 l0 E3 Z5 k4 ]9 r$ j) S |
|