|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 l$ ^: q( u) C# z
- [code]EDMA sample test application
; w6 h' U5 i r+ U1 I P) i - /*
6 b1 A6 B$ x- b( _ o7 a1 s - * edma_test.c4 X0 Z7 J/ ]1 a5 O
- *5 H& |0 e1 g! W) X+ o. g- h
- * brief EDMA3 Test Application
7 @- W+ |6 x5 j2 F - *, ^9 k. q9 x$ n; I
- * This file contains EDMA3 Test code.
& a# {& w2 f. f; A - *
0 O! U: M: z7 P( ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. I& e) @6 p5 x- u1 n- y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 }/ Q* R, m7 B
- * TO CHANGE.
% G' G7 [6 o* S# [5 y& R4 D( y* l8 M+ L - *! F/ M9 x9 A; B- ^7 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 g' u, P+ @- r; C; B1 e# q v - *' h' r, \# J% c# H+ R) {
- * This program is free software; you can redistribute it and/or
$ a' _8 o9 a+ |" {+ ?" A& c H9 d6 Q - * modify it under the terms of the GNU General Public License as/ y4 D( l; P) A1 D P3 \
- * published by the Free Software Foundation version 2.6 A+ F; Q# a3 B2 m, e# m! X8 I/ Y
- *% x& p# T( c% I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# |5 A( ?$ v/ C9 H
- * kind, whether express or implied; without even the implied warranty& J0 X1 i4 F: y1 q8 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( x! m6 J: U2 y7 A1 R5 H - * GNU General Public License for more details.
" y, K% m6 w8 s5 h - */
/ O, F3 f& S3 b" ~7 V5 z8 |
0 u( [6 S6 ]; W! J+ C- #include <linux/module.h>
! R3 y6 E- L( k9 f+ k w - #include <linux/init.h>
% U( x; \- R6 A+ e - #include <linux/errno.h>
6 o" p9 Q0 `+ G% W - #include <linux/types.h>$ E/ t! a4 o7 ^( s: D) }1 P) f3 W
- #include <linux/interrupt.h>
) @, ^! u1 y, m5 r$ A - #include <asm/io.h>" ~$ n8 I" o: @( q3 Q2 \$ U `
- #include <linux/moduleparam.h>
: `% {* e7 _5 a$ z1 k) V/ r - #include <linux/sysctl.h>: D. N, q4 O$ p3 P6 S+ {# E
- #include <linux/mm.h>
4 _0 _4 g9 J. P( F k- Y - #include <linux/dma-mapping.h>" \ ]* [$ ~6 w% k1 C' t/ ?
- O" P5 ?7 k7 n; F; \0 H/ G- #include <mach/memory.h> E4 E3 A* l2 ~: V3 a5 R/ ~
- #include <mach/hardware.h>
1 [4 z5 B2 |) k! f0 x1 \) A - #include <mach/irqs.h>
: P6 l4 Y- u2 s; v4 A - #include <asm/hardware/edma.h>! [1 u: h8 F. ?( F8 E
- ( w$ E/ a7 |3 a- @' ~: ^
- #undef EDMA3_DEBUG7 |; _# _" m. o1 u s8 t
- /*#define EDMA3_DEBUG*/
; c2 s0 s6 ]: N S0 X: C
. m& y5 m$ k6 U/ H1 a2 z% D" O- #ifdef EDMA3_DEBUG
G( ^5 U. S: c! j# | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% J5 R6 F- [- w0 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 R& M4 o# L+ |# ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% @" t+ f6 p4 u: T \/ v2 C - #else- H0 D% D1 x: H$ }0 u- ^1 ~' g
- #define DMA_PRINTK( x... )% x6 R& Z8 N, ^7 \# y
- #define DMA_FN_IN7 e4 B& T9 M8 [/ r, x/ i: t
- #define DMA_FN_OUT' }9 F, Y+ X1 W$ J3 R* D
- #endif
* l+ F+ ?8 p7 E J: O - / Z! k e7 u( I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 T* d1 `; Q( |, L) ?; } - #define STATIC_SHIFT 3
6 k) |+ X6 m+ p* l - #define TCINTEN_SHIFT 20
: B- Q" ?0 u* R/ ~$ v4 I - #define ITCINTEN_SHIFT 21
% Q& a- S6 _: _0 a; ~) ] - #define TCCHEN_SHIFT 22
}& r+ n# _+ W, n/ X* T" j( N: _ - #define ITCCHEN_SHIFT 23
4 Z: k& `$ j+ X( ^# f" L8 u
, C0 K' O1 O$ h4 Q! {; d% x1 A- static volatile int irqraised1 = 0;
/ f% J; o+ Q7 U5 Q - static volatile int irqraised2 = 0;& \( d3 j& R4 ]% H& U+ ^/ P# J
4 k6 i! R" C( M, E! i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 X( T+ \$ U" h+ B7 O, Q$ R( w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g# [+ u! B' H+ V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 D4 f. d* \ @$ A5 F9 N7 i$ P
- ! _, B5 O C* k, G5 G+ N* Z5 R, I
- dma_addr_t dmaphyssrc1 = 0;, M) k. F! j4 d* h( x. p1 r4 |
- dma_addr_t dmaphyssrc2 = 0;6 c* a9 E# @ n3 a, G
- dma_addr_t dmaphysdest1 = 0;7 k" q8 @0 @8 B, w( ~
- dma_addr_t dmaphysdest2 = 0;
8 i0 N5 N b* z
6 }7 w3 c% Q. o z3 q3 ?9 i- char *dmabufsrc1 = NULL;; M: x$ R* z8 s! w" O" ~! _! V
- char *dmabufsrc2 = NULL;
1 b2 _: d1 v/ U - char *dmabufdest1 = NULL;! ?$ }* n% a8 F0 h* I4 @, [" m( C7 J
- char *dmabufdest2 = NULL;. t. q( ~2 f9 s/ s5 ~$ O0 f
! c; c+ {8 c7 K& W2 |2 w2 d- static int acnt = 512;) M; U0 J* _& Q) s/ z. A
- static int bcnt = 8;
5 ?! g; j: v. e$ K' D1 [$ k - static int ccnt = 8;7 U0 ~, x( v: a, l. C
+ i: x! V; H: r# x0 S$ N- module_param(acnt, int, S_IRUGO);
! o9 j/ M1 q2 f* E. P2 L: H - module_param(bcnt, int, S_IRUGO);8 G/ ~' R/ B4 |
- module_param(ccnt, int, S_IRUGO);
复制代码 2 N5 M7 a0 J+ B+ }2 n* C+ z
; c6 ~% A) u5 f2 _) X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" s/ ~0 R5 u. i" U- K
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 L% y0 o. Q/ ?8 B. I1 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" |& N% c& ]# X( X
4 x9 N. v3 S) N, n' Z
( h& M, m7 w/ w( k" X2 O1 d |
|