|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 [9 B) h) P8 Q
- [code]EDMA sample test application* }- ~8 u' m' W5 F& h! H
- /*& {* F. R* [7 x" a, D. d, z, o$ A- k, B
- * edma_test.c' p& C; Z2 z+ z( _1 t
- *
" D$ P6 T2 G# n1 U9 K% c" } - * brief EDMA3 Test Application
' ~5 G$ j5 ^" a' P1 A0 u" j5 ` - *% e% o* D" Q8 ^
- * This file contains EDMA3 Test code.5 x" C# r" }0 I9 e* P! z/ Y0 H
- *7 w+ o% f! I* f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ i- f, m3 k; U( S. o, x5 Z1 `' H3 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 t: ?! m1 Y+ g: ^: P - * TO CHANGE.
" w7 y2 J+ y1 r& m% @* y" ~' U" g - *
7 p8 G: j- k; ~* {* {1 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 z: ]) E( R% D& u1 y1 a+ a- [
- *
) W5 m& ~. Y1 f - * This program is free software; you can redistribute it and/or
1 Q% {$ W2 n# c' r& Z: s - * modify it under the terms of the GNU General Public License as
4 M7 _' ?1 h. L8 _8 {4 d - * published by the Free Software Foundation version 2.
) l' P* u i: [/ ?. q( J4 f' U - *7 u( l8 B$ g- m0 C$ A5 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: ^) u' ~$ k$ U) y3 p - * kind, whether express or implied; without even the implied warranty! \% E( M1 [8 M$ R8 p/ t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ v% }* L" U$ H# p/ M8 K
- * GNU General Public License for more details.0 W, p4 g2 p1 U' L% r9 R
- */. N. p6 y& l8 f5 ^/ y7 x5 P" B2 P0 G
( t! p( p9 A% X! v4 W1 v- #include <linux/module.h>1 d( @ S! m* l k6 L" k6 R; @
- #include <linux/init.h>
( Y" c9 P& O& Y - #include <linux/errno.h>
6 E5 Q4 m" j2 O! {" w- } - #include <linux/types.h>3 K9 S" f4 q1 D+ i8 J7 F
- #include <linux/interrupt.h>
2 L( v/ c9 \! n0 \9 b2 W - #include <asm/io.h>- x2 \% ~& o+ B, Z0 Q
- #include <linux/moduleparam.h>
7 ?4 c! |0 ^% b9 z+ ~1 e( S - #include <linux/sysctl.h>4 G8 W& ?5 K$ R" Z
- #include <linux/mm.h>
& \) t9 {# g6 @7 T1 `/ Z - #include <linux/dma-mapping.h>/ @4 @; K$ [( h1 B, u
- 2 Z; N+ G2 D V
- #include <mach/memory.h>+ Y: q: b6 o1 Q. [
- #include <mach/hardware.h>
J% X- F, ^; Z4 M5 \: j - #include <mach/irqs.h>+ R0 U; Q, i% P5 ?
- #include <asm/hardware/edma.h>' }4 c* D% ^5 U( z5 y m) W1 z
6 t; h4 m& X1 L! M5 ^# U. v s- #undef EDMA3_DEBUG% q/ C7 i0 @' d" ]8 Z1 w6 a% c/ K. F
- /*#define EDMA3_DEBUG*/8 H7 e$ l5 E* n2 h) |
- + s( K+ }1 Q' z4 W
- #ifdef EDMA3_DEBUG6 a% W" |4 s- y1 D5 f2 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 h: O6 M6 m: _8 E( `; N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" q1 a8 n0 d% `2 a. |9 @, P8 l6 W5 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: I! A6 @- S; {6 U6 z& J! ~ - #else; B" N: f1 H: B9 h5 I, d
- #define DMA_PRINTK( x... )! Y. v9 ]8 H4 T& B4 B* D6 n( G
- #define DMA_FN_IN3 h9 F" I$ l3 {2 F5 z3 |2 S
- #define DMA_FN_OUT
- n6 I3 Q; \; T8 d - #endif! R( M/ ?. x# d: x$ j' K+ _9 K
- 9 Y% D0 r: Z! ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 B8 ^# N0 s/ f- p N* S) A - #define STATIC_SHIFT 3
' _5 i9 r3 [* Q1 Y' c - #define TCINTEN_SHIFT 20
+ C6 b1 E+ p" v Q2 A - #define ITCINTEN_SHIFT 21
& ?' \/ q) k+ w4 z" e, c - #define TCCHEN_SHIFT 226 f1 k% \; Y" ~ u$ w) C! [/ I( p
- #define ITCCHEN_SHIFT 234 M4 B$ j+ o% ]4 F, D9 P
- * N1 `# b8 O( V4 w$ \( \! [/ v
- static volatile int irqraised1 = 0;
$ Z5 t. T" F" V2 _" B - static volatile int irqraised2 = 0;
" f- X# P- j% ~
& F2 x2 D9 W8 C I' n: h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Z9 b& F- Y) v/ w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 \% ~# K3 T) x* c3 }9 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ F( L# s' K4 V, y
4 S7 O" j# S; j8 }+ s- dma_addr_t dmaphyssrc1 = 0;+ M3 R6 K* E% S0 V( D9 `& Q
- dma_addr_t dmaphyssrc2 = 0;
( O* h' d" V( F4 Q3 b - dma_addr_t dmaphysdest1 = 0;- X. W% `. y. U0 ?3 Y
- dma_addr_t dmaphysdest2 = 0;2 @! r& b& \6 t+ I. {. q1 F) b6 Y
6 z6 c; G3 I8 b1 u8 z1 \- char *dmabufsrc1 = NULL;
% Z: [( A( S6 e3 g. k+ e - char *dmabufsrc2 = NULL;" d6 l9 \/ H4 k* S a% I
- char *dmabufdest1 = NULL;
9 f, Q; e: D m1 T; s! @ - char *dmabufdest2 = NULL;
- y, W# C4 k' M& H6 l - . Y; l# Y# a, G" U& f! n$ a6 y/ P
- static int acnt = 512; |) A$ B. T) V! V+ g) }
- static int bcnt = 8;
( ]8 p% e! C7 L$ o7 s# Z2 a- g - static int ccnt = 8;
; p, x" O3 c) c" K! j
1 M" _6 S. M; S% I- module_param(acnt, int, S_IRUGO);7 H/ e8 j8 e8 V3 |: ^
- module_param(bcnt, int, S_IRUGO);
& W3 P& V2 w' S$ s3 k; N4 I4 ^ - module_param(ccnt, int, S_IRUGO);
复制代码 r I+ S W% B0 N1 t
- M+ I4 b0 e- b( O: Q+ _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 J: q4 c" \" zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 b7 z A2 D8 b" ^8 ?0 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; M; \" L1 n4 A# m
6 |. m3 U1 l }9 w" Q7 A- t: z2 z# ^+ t5 A
|
|