|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. x+ N4 I7 ]5 r) X. _4 g7 C; i- [code]EDMA sample test application! d) y0 ^8 B, {- r9 H: U
- /*
8 {5 L3 x9 Y. P& p& Z% q" } - * edma_test.c
3 Q8 [* m7 x4 ]3 P - *
B% h8 E- e X, L - * brief EDMA3 Test Application
" [6 q7 d9 ]* R, K- q) h2 a$ m0 W - *
' ]& g+ P6 X4 ~ - * This file contains EDMA3 Test code.
( t! o1 A5 Z5 T( o" a% N- q - *
/ a6 i3 B9 Z( L; l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% |% f' G6 ^" v- q* O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ^0 L! o6 t3 Y* ?! r; M* q
- * TO CHANGE.
$ b( n( |, G# }% T1 y9 r - *
6 [7 \$ o" p2 d7 [8 t% c0 x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 n5 J/ Y& q8 t) V
- */ X6 a8 B4 Y( @: \6 ]: K* m
- * This program is free software; you can redistribute it and/or, ?. F; o4 Y) S) N% C% h
- * modify it under the terms of the GNU General Public License as6 U" r: w6 y! e
- * published by the Free Software Foundation version 2. \* P2 v$ B/ _/ [1 |) X4 s
- *
2 _3 a6 O b4 [) A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ^' F/ z2 n5 j& o$ G
- * kind, whether express or implied; without even the implied warranty
+ r2 F! p% _7 D ^& m8 ^& T2 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ l6 Q/ A I& i# @ - * GNU General Public License for more details.0 G# L' _( _7 p0 _) c6 \; e
- */
) N7 z% b# M/ c8 g" [1 N" k9 w - 3 G ]) T {# t+ S4 {
- #include <linux/module.h>8 w6 R4 ]$ K7 o/ c
- #include <linux/init.h>
: h! m) x9 n7 L" x1 z - #include <linux/errno.h>
& K& O' B% F+ I& z - #include <linux/types.h>
! D1 W* L3 T( @4 Q - #include <linux/interrupt.h>6 C" i) E9 z3 W0 U# K
- #include <asm/io.h>7 G8 @0 f+ }7 D3 X
- #include <linux/moduleparam.h>$ O5 B' M V" `
- #include <linux/sysctl.h>! D: k$ I [0 }, z& A6 ]) W
- #include <linux/mm.h>, i* L; A. Z; r5 y0 J
- #include <linux/dma-mapping.h>
4 {; ^2 W: t/ L# F
+ P* \0 f, G( E6 O- #include <mach/memory.h>5 p8 U1 {8 b3 E/ E" ?( o( N I
- #include <mach/hardware.h>5 m, W& j+ l+ K9 F" D; L
- #include <mach/irqs.h> a; b+ L+ Y0 B/ V( ^* C
- #include <asm/hardware/edma.h> g. U$ `1 w; w) y9 a
# e1 M }/ I, I& p, f- #undef EDMA3_DEBUG4 F3 h' Y# J: x# n" m
- /*#define EDMA3_DEBUG*/
. ]/ q% j+ a P5 o# W6 T* c
5 p- I/ j7 p4 O$ {; h6 C- #ifdef EDMA3_DEBUG' h/ F- x8 L' |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 V6 p: b* `& g# P1 x: _: H$ O# m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ~$ C& }9 p- T) D: F+ L1 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 r- x- @( e9 n6 E$ j - #else- l5 H8 M- n& ?$ j e. s+ w
- #define DMA_PRINTK( x... )
& M% _+ w- z9 [) G0 k- R0 k - #define DMA_FN_IN
4 m d9 { b; K7 Q! h+ K1 b - #define DMA_FN_OUT
- M; h j: x; E - #endif D2 f# w" X3 d3 K
- & H# w( V1 y' W8 W9 G2 a! h) i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- z) K: ]; {! n, \) f7 o - #define STATIC_SHIFT 3* n1 A u2 C! s8 |8 z6 W
- #define TCINTEN_SHIFT 20) R3 g) @! i. t: ^' e. k ^3 x2 f
- #define ITCINTEN_SHIFT 21
q a! V$ Y6 f7 C - #define TCCHEN_SHIFT 22
" Q& X' f+ {; ?0 R, d - #define ITCCHEN_SHIFT 23
l: J9 X" L( B I' r - 8 y2 q! ?! B0 y$ Q
- static volatile int irqraised1 = 0;
8 v; \1 Z+ [+ x' J5 \* w - static volatile int irqraised2 = 0;$ R4 E" O) I3 a7 Q5 g d" ^9 q
- * D/ R) y, z* y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ~* t" M! @: F# k) ?7 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# i/ ~0 ]) O) W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 t2 l6 L# |' v+ @1 N
- v& q) g, h3 F/ g5 j! F- dma_addr_t dmaphyssrc1 = 0;4 J' N7 O1 {" K) R" w$ s" Q+ x
- dma_addr_t dmaphyssrc2 = 0;
$ \+ U& Z4 n/ `+ W9 i& O5 j - dma_addr_t dmaphysdest1 = 0;- X8 X* r! O7 ^, h
- dma_addr_t dmaphysdest2 = 0;
" ^4 [1 V% c1 w+ v- e - 1 T# b3 y( o, A1 e* X4 W
- char *dmabufsrc1 = NULL;
' T( y. P0 U" p! K - char *dmabufsrc2 = NULL;
2 b# c! t6 i. [ - char *dmabufdest1 = NULL;: ?7 P# p+ s( i, O; z0 h
- char *dmabufdest2 = NULL;
~% G7 J* t( n l - # d1 ~( k, O# X% F* |3 x6 t# B
- static int acnt = 512;
% y5 n) y( x) O( S( ~4 F - static int bcnt = 8;
# S+ \, e1 N* ^/ q3 R' a5 F - static int ccnt = 8;
* f% l' A- s$ H7 y- r* p - 9 l- s% E: J7 q( `* R! P' x3 H
- module_param(acnt, int, S_IRUGO);
# Z4 H7 e2 K/ g - module_param(bcnt, int, S_IRUGO);# b! b7 z- L8 b0 |5 |+ N
- module_param(ccnt, int, S_IRUGO);
复制代码
& @. Y2 H/ B, W* R z; M, h8 I+ w {; B& c/ K+ ^4 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ~* }6 o8 e; s( H6 X, Q7 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 v6 r, v0 X8 b- ]' x$ A- Y% p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 [$ }/ Z" Q7 w7 J1 a
& p1 [0 @% x$ e' i9 f. i' j4 v: L: l8 x3 u5 [% j% A* W+ ]
|
|