|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 F+ v+ u, S" y. m6 R# f, R# t. r- [code]EDMA sample test application0 o* D! g/ A/ M- i! t
- /*
5 S' \' M- ~1 d2 _- u - * edma_test.c* Y7 s2 p4 @. W* d7 T6 L( y9 F
- *- V+ ~, n; h. Q( K
- * brief EDMA3 Test Application" v- {) H5 m. c- j, t7 _' e
- *8 Y. j& F- X1 |9 D) s1 z- T
- * This file contains EDMA3 Test code.8 l9 l" {% |5 V: O
- *% @- K- |, S& w% O0 _8 f e5 r6 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; p) |/ x& W; M; v4 B N0 ~3 K$ m: v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S& D s- q. v# Q% E
- * TO CHANGE.+ F( T, j, D0 `' E) o0 P: H
- *
4 q2 x( h; O" ]( ]. _" s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; h! y7 J& |8 l
- *2 r2 m: l& l ^' f
- * This program is free software; you can redistribute it and/or
* y: \- Q4 c- h. G5 ^5 L - * modify it under the terms of the GNU General Public License as3 F4 {( j" z; f' T- \$ f" R; ?
- * published by the Free Software Foundation version 2.. K$ Q6 k8 e; C/ i J4 v# ^
- *
( p6 r2 l5 C* a) e6 ]+ g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 V2 z& V6 d Q% f' d8 p; P - * kind, whether express or implied; without even the implied warranty4 Z; S1 m7 C- _; n/ p+ M5 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 c( z/ w0 b, K- A) j - * GNU General Public License for more details., R' G* ~; f% p
- */+ Z- u8 |2 v8 p8 h6 b8 T
- 8 X% m/ ~2 d/ e+ @& u* w
- #include <linux/module.h>
% o0 x" r/ C. {: `% S5 X) y2 @ - #include <linux/init.h>
& `5 M( u4 C) ]! M0 l G7 U2 i - #include <linux/errno.h>9 j. B1 ?" @1 ^ ]& b% P3 ]
- #include <linux/types.h>1 f2 h/ M9 a& j: G9 v
- #include <linux/interrupt.h>: K0 `) Q5 P W
- #include <asm/io.h>
2 p% |; P3 \2 C* | - #include <linux/moduleparam.h>: _. U* }+ r% v1 T
- #include <linux/sysctl.h>
T8 d! |9 S7 c2 S - #include <linux/mm.h>
3 u; U B+ n1 s! Q - #include <linux/dma-mapping.h>
0 Q& I1 |' \! q2 X4 v# p, ?
9 l9 D1 w4 c I( M: e |3 i- #include <mach/memory.h>
5 _- {' o# H8 t" U5 ~( Z - #include <mach/hardware.h>
* J1 v( R V% Z$ e5 p: o- C! q* j* { - #include <mach/irqs.h>
9 W" l) @/ M( Y, H - #include <asm/hardware/edma.h>) }/ b- n* a, N* ^: U3 w$ j7 a! Z: }
- 3 K& k5 }5 j" C
- #undef EDMA3_DEBUG/ R' t( G6 l9 S3 N, ?- q Q+ j
- /*#define EDMA3_DEBUG*/( v o f( S: t* f/ h' k6 {
- 1 K, T8 J# g. m6 H; s
- #ifdef EDMA3_DEBUG
8 e1 ?8 t& v/ s A7 i! y4 y" F" m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! e! H+ d) r; M9 _# n" l4 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 g% K' t* v+ U8 @4 }) g: q$ O" l& F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ~7 F e7 I7 f9 N( V0 L" f
- #else( ?6 @& Y, O" S+ ?
- #define DMA_PRINTK( x... )
9 n$ K' f( k- U' m; `; x - #define DMA_FN_IN0 I; S" Z' T, a" m0 _# Q0 h" T
- #define DMA_FN_OUT5 d* o5 E/ D1 L
- #endif2 y' ?; r0 L+ I. t( C1 p- U9 C
- ; c) }2 ]7 I3 e) c5 V. U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 |$ B. k0 k; P$ H, b - #define STATIC_SHIFT 3
# Z. {) p. Q* n& T - #define TCINTEN_SHIFT 20
, H3 `7 X9 w$ I3 b0 r* @3 n7 _ - #define ITCINTEN_SHIFT 21
; d& r# J+ _1 T2 z - #define TCCHEN_SHIFT 22 i; U0 T% h2 T! h. B- ^
- #define ITCCHEN_SHIFT 23
7 C/ Y; }% y# @0 d$ O. i; b - 3 A) V3 L* D! o
- static volatile int irqraised1 = 0;: o. h) L; Z# D" x& O+ n5 F- M
- static volatile int irqraised2 = 0;
* S4 G/ Z+ E4 }' `5 | - - }+ Z. z- w, ~/ v: l* v4 d. H- c, h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F' z6 J2 k. A+ t. ^, e) T) d2 ]( u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Q- L9 E+ C3 ~, x/ P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ d0 d! d/ K8 r; w. j Y - + N' g; D3 a6 V0 d. O: Q
- dma_addr_t dmaphyssrc1 = 0;
6 w( s; T4 F3 |# q. T- ] - dma_addr_t dmaphyssrc2 = 0;
) l2 r+ N0 W* @5 H1 S - dma_addr_t dmaphysdest1 = 0;7 @$ H5 o8 L9 N r2 h0 b
- dma_addr_t dmaphysdest2 = 0;
/ s' X( k! X: b8 M. d - @1 y7 w- T" i1 d, t+ M' e Q" l' D
- char *dmabufsrc1 = NULL;
\- ~2 [7 {( D2 { V! E - char *dmabufsrc2 = NULL;) B7 t: D5 ] O3 I
- char *dmabufdest1 = NULL;2 `) Y( G* \6 |
- char *dmabufdest2 = NULL;9 P& i7 O9 R9 V- k
- ; f, S0 q- p6 l0 @% o6 f& q
- static int acnt = 512;
. D$ l- R7 g! L* Z- r, j - static int bcnt = 8;/ S. y3 L3 {; w. e: V; B* G
- static int ccnt = 8;* j- R$ S( s! M+ y8 Y: W3 a4 E
* q- e" F* n5 o- module_param(acnt, int, S_IRUGO);, { n& E& C2 `- O5 m/ a
- module_param(bcnt, int, S_IRUGO);( A7 ~' S+ `% b- i
- module_param(ccnt, int, S_IRUGO);
复制代码
% i2 e5 C0 z/ r& ^
/ [' s" X! j1 D! V: i2 }6 | n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* F* h) C! E- Q3 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; y7 {- @' E1 c( _# Y* ]- P- f5 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- x. w4 U, U( I! p) z5 W* c
7 o" O7 X8 w' B/ Y& G
) i0 u) n* [. K |
|