|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 M# m: F8 R6 d- o1 y) C* P
- [code]EDMA sample test application
" m9 Q4 {' Q' V3 b/ ~0 N Z0 [ - /*
+ @6 e. l- ?% o/ g& C/ R - * edma_test.c+ _$ L1 O7 o6 x( q H
- *; r) D( z1 c y$ G& s
- * brief EDMA3 Test Application6 F7 M* p; ~* y3 T( e, y" c
- *
$ t" U4 K! J: ]; @ c( f, D, w, { - * This file contains EDMA3 Test code.9 U/ x4 Q7 ~8 m7 ]
- *
( j+ l/ ?" U2 ]4 w, | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& c7 S3 i. A6 D+ |9 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 S5 `. y9 j4 o- O+ S( z$ K - * TO CHANGE.5 Q! D9 ` a5 A( R1 ^
- ** {/ c: X+ g) ]8 B# Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 A- s) e! ^* [+ X/ ], |
- *
( z9 v1 X/ B% W% C% c - * This program is free software; you can redistribute it and/or
; E+ H9 J: O4 ]: B& B8 L5 [$ s* o - * modify it under the terms of the GNU General Public License as6 @, K! _% u8 Y; |7 ^, x0 b
- * published by the Free Software Foundation version 2.' z* d) E: N3 @% g/ `! v5 a
- *
7 B6 a6 h) Y4 w; \0 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# R1 Y% `, b7 d - * kind, whether express or implied; without even the implied warranty
' ^ j( `1 E2 G: v9 P" c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 E: O* z. E7 J6 x! b& ?) ] - * GNU General Public License for more details.
2 E8 S6 R: l3 w2 ?0 R ~ - */% @ k: S. [( j' ?
- , u' a% y q9 ]( T0 Q9 g# V+ F
- #include <linux/module.h>
9 n9 K! q/ b/ m3 { - #include <linux/init.h>6 K. o' P" Q; L8 ~, @. K# z" j
- #include <linux/errno.h>
$ d: \7 w, G) N5 ^ - #include <linux/types.h>
: D0 L2 y) ?4 Q9 X3 S& W4 I - #include <linux/interrupt.h>9 D4 Z" z# {$ K$ F% u. t
- #include <asm/io.h>- M. @/ ?' t6 U5 `$ r! j
- #include <linux/moduleparam.h>: ]3 `5 k8 M; Y) q8 ?$ O7 |
- #include <linux/sysctl.h>9 Y, u" w8 Q, c1 i: ?% X! O- v/ z7 i
- #include <linux/mm.h>
2 L7 P+ o: D, h - #include <linux/dma-mapping.h>
( @( t1 f& r( t' ~ - ) A+ C# B: W6 a1 u, |
- #include <mach/memory.h>
, I# b. h; i' Q8 d2 v. M - #include <mach/hardware.h>
: M* y; ^ h0 r5 J6 ^; G# f - #include <mach/irqs.h>
: ?1 J% c8 b# m! _ - #include <asm/hardware/edma.h>
0 S+ p, M: A& |2 o' Y" O - & K% `* D: V/ \6 ?9 A, A4 }
- #undef EDMA3_DEBUG
; D; t+ }4 K$ ]0 ~ ~ - /*#define EDMA3_DEBUG*/) Y, W; _8 @/ s! h% Z4 g7 Z
- . P f/ }2 Q; h1 x& ~8 ~9 E2 `$ m
- #ifdef EDMA3_DEBUG& e! ?4 n. c4 t) @* |* ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% z0 y, {2 \7 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ~5 H' t! I$ b1 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% m& K) b9 \6 I* G- K4 e1 U$ v - #else
5 \# f4 }) B0 z; i6 A3 o9 ~( @ - #define DMA_PRINTK( x... )
% L/ R7 o7 I- m# H- A+ E' W - #define DMA_FN_IN. O- g% b! `+ |3 }" q, U6 ]2 q% N
- #define DMA_FN_OUT
' D$ C5 C7 O7 Q! o6 T. ]9 o& n - #endif r5 {- e* q4 Z
- f) R Q- Z3 g) g8 m0 f+ ]+ ?( u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' l: j! C' j! D( p5 D( v
- #define STATIC_SHIFT 3
: \' J9 k9 {) l3 A" ]* \ - #define TCINTEN_SHIFT 20
. p; s8 G* b4 A8 A - #define ITCINTEN_SHIFT 21
4 n [, g( B9 o" N' m, Z& L; y - #define TCCHEN_SHIFT 223 x: M4 C1 B; S: q
- #define ITCCHEN_SHIFT 235 O& w( S: q/ C5 P. \) J
- : d$ [9 h" R6 ^; j# n, @7 _
- static volatile int irqraised1 = 0;9 o0 u+ X" [, Q5 C, d
- static volatile int irqraised2 = 0;
, `0 O, T" k4 O - 9 ~3 L8 Y$ D; n! {1 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" F+ g$ N% v4 e) y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 _$ G/ B9 S' V: P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# C3 T9 @% C3 J( V
- 2 S; Z5 f! _& G: g7 ~# Q6 Y/ d2 o
- dma_addr_t dmaphyssrc1 = 0;1 S, U7 O6 |& D7 _- E
- dma_addr_t dmaphyssrc2 = 0;
- `3 w+ O; O0 S+ K - dma_addr_t dmaphysdest1 = 0;! b4 x0 J8 l" j6 t4 {& b
- dma_addr_t dmaphysdest2 = 0;
0 @. ]7 L/ ?6 ~ I& Q6 ^1 q - * o/ y2 F1 x$ m) @' p: {) t
- char *dmabufsrc1 = NULL;$ H; x0 ]' N* U
- char *dmabufsrc2 = NULL;
& B3 Y+ s- u9 Q$ W* k- m - char *dmabufdest1 = NULL;8 G" f1 ~* B: N
- char *dmabufdest2 = NULL;# `* x/ E! I% T2 r' v
- , z6 Q3 E- ~ ^
- static int acnt = 512;7 l9 @7 [5 t8 R" U
- static int bcnt = 8;
: H: Y6 x# D! d; P% ]8 Z - static int ccnt = 8;: b* Y0 t2 o! H8 |& e
- * F/ h2 {% u; A J( d
- module_param(acnt, int, S_IRUGO);4 r+ J; Z' ]* u T+ ]! }
- module_param(bcnt, int, S_IRUGO);
$ l& `/ G, ?& c# C$ E" @+ g - module_param(ccnt, int, S_IRUGO);
复制代码 * Q& z: e. f2 X2 z" u2 Z1 |; ?0 d
- `. [( X3 s! y% U' B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* U% O) @( n! w" p8 s9 G7 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Y) b2 F' Y5 D) s7 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 _* L' J5 k; g% T0 O( R$ f
. v6 o+ x& s ? k7 ?* p6 N1 u* _! X- b) b; X
|
|