|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 i: `$ q& a. }# ^/ d, P9 R4 l# ^. O8 w- [code]EDMA sample test application# W7 ^) S, O, F& q& |/ O
- /*
+ K3 f& o+ f# z; T5 t - * edma_test.c
# q2 i& e V) e - *
' [9 ~% V2 ^! r" e4 l5 D; m+ v2 f. { - * brief EDMA3 Test Application6 r7 F/ v- A; E; S( s
- *
5 c3 P3 F6 s3 u0 b - * This file contains EDMA3 Test code.
, m% a2 O6 Q+ ?& ` - *
+ S* }! I m% @! H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ x. e4 k: q( r" B; K% { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! j! y- o4 H& z) j' d4 ?" |& D
- * TO CHANGE.
1 [ d% C1 {$ Q - *) j: y. s. j. R9 _$ d/ I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; f4 X1 R4 f \/ @7 [7 z - *
+ i& P/ ?" `- S: U" O6 g - * This program is free software; you can redistribute it and/or
8 U* l9 h% w# z9 o8 k. H& P1 i - * modify it under the terms of the GNU General Public License as- E+ f" ~1 z& M& z& N, k! s1 N1 Q
- * published by the Free Software Foundation version 2.
3 n0 A8 V1 q4 o# q3 l - *
& N* m6 F' c- C$ T0 o7 n" e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 e7 W1 R5 _2 l! Q, A. w9 q4 P; H; f
- * kind, whether express or implied; without even the implied warranty
. v6 E6 E1 M6 p5 |* U a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" F% r+ F4 H" h: ]
- * GNU General Public License for more details.+ I: a% g9 n- a
- */$ A. b* A! ?6 O3 p
% K; W2 A" Q3 A7 l. c- #include <linux/module.h>
$ [3 r9 y3 j* |3 P7 d+ _- g6 Q+ Y - #include <linux/init.h>$ M1 M: s$ {3 r* N9 t7 ]/ H. U
- #include <linux/errno.h>! l7 P- T2 Y& ?. t2 _7 r6 ^3 B
- #include <linux/types.h>) D' c1 ?- T& f6 R
- #include <linux/interrupt.h>2 i( V) ^5 u5 q4 J1 y6 q
- #include <asm/io.h>2 e; y3 h; e8 g- H$ x9 d+ H
- #include <linux/moduleparam.h>, [ p) F1 N- z( M
- #include <linux/sysctl.h>
5 G. U6 G- _! `4 z% E1 X- Q - #include <linux/mm.h>
5 i' ^& q* U- x$ _ - #include <linux/dma-mapping.h>5 `1 N" l9 w3 [
- m. H+ K& E" Z+ _- #include <mach/memory.h>
5 l6 J4 _0 s- Z - #include <mach/hardware.h>8 z+ v: s8 m# M* g4 S* A' z
- #include <mach/irqs.h>
, l- l5 v3 p A5 U7 S' \ - #include <asm/hardware/edma.h>
- |9 ^$ K0 _1 r5 \ - ; J' Z8 O4 M3 B9 @
- #undef EDMA3_DEBUG
4 {$ q5 u, B* e1 g( u- P - /*#define EDMA3_DEBUG*/
5 p d' d4 S* @- Q3 V9 C% ~0 {& P
3 S. U! j9 ~7 q# I- #ifdef EDMA3_DEBUG( Z* n: c! E$ M! e5 A: D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( K/ b8 Y+ q- x x2 p& ^+ T5 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ ?) F- \8 `8 V5 [9 E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( a( h% }2 ]( @& ] - #else' N8 C# b' w) K' Z, j# f
- #define DMA_PRINTK( x... )( x8 O7 K- o* [2 J
- #define DMA_FN_IN2 e! ?& B& V7 Z$ A; p7 |
- #define DMA_FN_OUT
t) e. B" ^7 B5 T: c - #endif
& _& X5 p7 W* Q0 |
' E1 v3 L) M5 x9 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768). Z9 ?5 i5 l0 K2 D- W* J6 `; x; B
- #define STATIC_SHIFT 3
5 A6 e* Q/ r1 l - #define TCINTEN_SHIFT 20$ A7 d4 a# `/ D4 G
- #define ITCINTEN_SHIFT 21
8 R! ~9 J6 q; Z* I' o' B - #define TCCHEN_SHIFT 22 k5 i8 J0 a9 f3 {) y
- #define ITCCHEN_SHIFT 231 l$ d, g: }3 ]. `! |% ]
- ! H2 B4 k0 o; I n' S& M
- static volatile int irqraised1 = 0;
2 v9 [! `1 d. d) C1 m - static volatile int irqraised2 = 0;8 u' t- j J! l6 [9 R9 V% I
: p- ]3 J% f1 p& a" I, w8 G7 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) a* M- J+ X0 F& u7 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" h% ?& e- J# z5 n( ?" W8 s- X* D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% c/ T- j- F7 V7 h- s1 c" f
; H W: g0 f0 D- dma_addr_t dmaphyssrc1 = 0;
: U$ }; p& Y- z4 U6 H# l - dma_addr_t dmaphyssrc2 = 0;, a. p+ d6 @$ [* c& t# e8 y! V
- dma_addr_t dmaphysdest1 = 0;% u: r Z' Z5 k# a4 m- F: G6 ?; z
- dma_addr_t dmaphysdest2 = 0;/ c% N0 p% T2 N# I5 K' ]+ G
- : @: z- {1 }! {1 }
- char *dmabufsrc1 = NULL;
* C. a2 x, K, ~5 V - char *dmabufsrc2 = NULL;
' H0 e; i( ^( h% h - char *dmabufdest1 = NULL;
* @2 ?- G' }% M. C - char *dmabufdest2 = NULL;- U# x) H, `: o6 o6 s3 s6 }8 b6 T
- ' |; x# R; a7 m: T8 \( H
- static int acnt = 512;
0 d7 T& v V% Z9 ]7 t }' f4 |, o& ^& f - static int bcnt = 8;
9 A7 M/ |; r! E - static int ccnt = 8;9 y Z$ H9 g( ]+ Y C+ |& B( ^3 T
- . \8 N8 T) { K) ` b
- module_param(acnt, int, S_IRUGO);
+ g1 B* G3 |! q6 y! s. i8 T - module_param(bcnt, int, S_IRUGO);
: x( n1 G8 n r- }7 V1 E. T - module_param(ccnt, int, S_IRUGO);
复制代码
% j( J; i' x1 i) u7 Z# B2 i
) E% A O% |; f6 y b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U; R9 ~; o9 ]+ \# s: Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* |' }% B' M9 D" r7 A* c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Z) t; s: @" x$ C4 _ ?4 Y
& d- b* ?" b: @
# a8 k3 ~- O; \* q |
|