|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 N$ ^! n& a( r% j; U- [code]EDMA sample test application, Z, O* J9 }+ f& {
- /*
/ w7 G1 X8 L& J% e$ a8 `% o% f - * edma_test.c% C0 k6 T" p0 u7 G6 W1 l$ K
- *9 @0 q& T0 @' Y4 t# x0 N" ~
- * brief EDMA3 Test Application' ?2 V+ W; w$ `
- *
( b, y9 `/ ~8 K% e1 x7 e4 O) u4 P - * This file contains EDMA3 Test code.5 b% H% }* a$ m
- *
* |4 B# ? A: {& O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. W. u5 l8 p8 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& i* M+ D; V& ]% W3 s
- * TO CHANGE.
2 n, a P5 ]! k' P. J( A0 H8 \" [ - *; c* `$ D1 |3 m. [- {" }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: I8 ]9 m' k0 Z; q& N* z9 [ - *
6 b) q& n# P& P' W+ q9 E$ V! G3 Z - * This program is free software; you can redistribute it and/or
- e3 H! N% J2 n. Y$ p! b - * modify it under the terms of the GNU General Public License as% S# j; ~1 Y2 |: Y. n" Z
- * published by the Free Software Foundation version 2.2 }: L7 r2 D& w. q5 L8 u& z
- *
4 o7 B8 f/ K* z8 w. k1 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 x( Z; |% ]/ H- Z5 j2 y0 U. a - * kind, whether express or implied; without even the implied warranty
/ S7 k. f2 V/ N+ X: |$ M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& o3 P; m4 N. R' |6 q* z% b) d - * GNU General Public License for more details.2 Y1 n) T+ U, O5 A# ?
- */1 R9 h+ Y# s5 r
- # B! K: W$ R" `. \5 `) G
- #include <linux/module.h>
' T+ C4 d8 X4 Z7 r; ]- O - #include <linux/init.h>* }; l7 W2 \6 ^4 r0 g" O) u
- #include <linux/errno.h>
* e) ?/ j4 A2 f' l) i) P - #include <linux/types.h>
$ h Y, j$ K0 w - #include <linux/interrupt.h>
; F( Z; G4 z6 d - #include <asm/io.h>
: z' W9 E6 l2 R5 O8 t - #include <linux/moduleparam.h>7 P5 }! k6 v* J- ~/ k
- #include <linux/sysctl.h>
! h& s/ J9 g' h1 o- b5 F5 o; ~ f - #include <linux/mm.h>, d6 n* K$ M! g
- #include <linux/dma-mapping.h>
% r3 w. a; h, {6 W8 E
% }3 C, r+ p; ~; |- #include <mach/memory.h>
' Q5 y3 _& M- u h# b4 R) H8 R - #include <mach/hardware.h>" [6 v U& [: s. J" U6 U
- #include <mach/irqs.h>5 O: s+ }9 V; s' y
- #include <asm/hardware/edma.h>; O8 m; K: V: q g0 ~& K
- & _- G4 O8 g$ D' O+ ~% _
- #undef EDMA3_DEBUG* ^1 y3 u( e- [$ W* {
- /*#define EDMA3_DEBUG*/
0 Y" ^7 V* h: i) J$ K
$ q9 N& ?5 z& m7 B% s5 Y- #ifdef EDMA3_DEBUG+ i' S7 @; B1 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 X1 b- k7 C. k* K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# k+ S( u6 [5 H7 i# K. L" T, E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ ~$ D+ t, E* b - #else/ G6 j9 c, A1 l# G' a! A/ g
- #define DMA_PRINTK( x... )
+ d/ U: w; Z/ U# t4 Z - #define DMA_FN_IN% H* h" _. B+ `7 p+ ~. c
- #define DMA_FN_OUT
3 n3 n c4 c" L( m4 V1 Z - #endif
: W5 q% Z( N9 q" q. c: N6 x - % ^' S8 x4 k* s& N9 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& L3 S1 W: a) S4 V& j8 ?* Y, y% D1 h
- #define STATIC_SHIFT 3
3 `3 r( O1 J6 c- X+ f5 Z - #define TCINTEN_SHIFT 203 Y8 D% S+ ^- f- r8 l% _
- #define ITCINTEN_SHIFT 21
0 B8 w* I. V! d7 a - #define TCCHEN_SHIFT 22
$ }6 `% q9 M" R9 T) z: S0 z1 Y# C& h - #define ITCCHEN_SHIFT 238 l# P) F) |) c
0 E* p, I7 M6 H7 s: v( A3 A) U- static volatile int irqraised1 = 0;, l! z9 ?# x/ o3 @* H
- static volatile int irqraised2 = 0;6 n H+ a( w" S: p3 |
- % g1 d) Z) d. |; X/ E- |* k3 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ?0 t1 c9 G( K" \: F; e$ O3 K, e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- l2 {% H! Q4 \( S6 f7 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d4 o! b1 j* u+ @& z: D
; B+ Q" ]8 L% K7 I7 g- dma_addr_t dmaphyssrc1 = 0;1 i% x* D$ Y* l) h2 D0 d/ H$ w
- dma_addr_t dmaphyssrc2 = 0;! K q5 s* L% I. D; V, y! A5 U
- dma_addr_t dmaphysdest1 = 0;
- R: D, C9 T. b9 c }- ~% I - dma_addr_t dmaphysdest2 = 0;+ g5 h" }2 D' x5 h0 e
- # e9 V* L- O6 {8 ]$ E' M
- char *dmabufsrc1 = NULL;
/ G9 ~- V, i. R! b) b - char *dmabufsrc2 = NULL;6 X' T: I$ M" n2 K) t2 Z; \
- char *dmabufdest1 = NULL;0 J# N! H- {3 d8 G% ?
- char *dmabufdest2 = NULL;
. D0 F5 t% Z4 v8 C; O5 j
) \2 v6 |' x1 z( v- t& ?6 C6 D- static int acnt = 512;: Q* _' |/ Z, T6 {" Z
- static int bcnt = 8;
. k4 J% j$ F* Z, ]+ F& T) W' d - static int ccnt = 8;2 E. Q, m, V' x4 `9 Q; k
- * ~' Z/ P$ n( Q2 m* g
- module_param(acnt, int, S_IRUGO);& g' u5 \' {/ q- G
- module_param(bcnt, int, S_IRUGO); v" V" T& y) O4 s
- module_param(ccnt, int, S_IRUGO);
复制代码 + J' o8 M. F/ @5 \) ?' q
5 S, N9 G, u$ P( r# t) s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 h# s5 \# i) U" |( U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 L3 M- x& K) n9 q& e+ { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 m5 c3 T5 z4 W/ u# @- p
1 p L5 L* {' C7 @
2 b4 |# @+ w6 w" T+ R0 q2 }
|
|