|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& s; d& s2 e* R/ ^5 G* S9 |: V( l- [code]EDMA sample test application
7 a% X, |9 K- `& J5 q$ a - /*4 a% O7 m4 o% c0 V
- * edma_test.c" C) }- u- ^' D9 r; h+ [
- *
# k) Y8 p" z, j; A0 B8 L - * brief EDMA3 Test Application
! T w3 S% [) u7 i2 T - *
- Y2 O1 G7 m! T/ F# t, } - * This file contains EDMA3 Test code.$ v: q* ^7 P1 q: l
- *# ^3 D+ S9 N, {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) G( r5 h) \0 U, F6 z' e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. A% M8 K% \* }& K3 p3 } - * TO CHANGE.- s: w/ V$ d& Y: S+ x, n
- *$ ?; `8 h! k2 y6 k6 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 l" m3 |7 w3 r0 H7 u - *
& V' ?9 f1 ?( e4 t9 j/ o - * This program is free software; you can redistribute it and/or6 a9 _, s; X; y
- * modify it under the terms of the GNU General Public License as& J' @; i, x0 c, x w' R
- * published by the Free Software Foundation version 2., M+ H# F& R# v% B! Y" ]) n# ^ I
- *
6 K/ ?4 V& C5 L& L% k. k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! A& O+ m) ^4 s4 V! r! b
- * kind, whether express or implied; without even the implied warranty: W( ~7 @+ R& b; d" [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# j: |9 N3 f( ]. ?: w* l# ^0 D' `! i
- * GNU General Public License for more details.& ~; `8 h1 F" v2 B
- */
+ [# C5 |, K' @) y* j
" k0 P' d1 W0 P% m* T' h, M" s: P! i* G- #include <linux/module.h>9 Q' G: P6 h( C0 O+ i% { I2 a
- #include <linux/init.h>
/ T/ g. I8 n1 M8 G' T: |. q, r* \, n - #include <linux/errno.h>4 q: s& C/ A/ \8 [( ]$ G9 Z
- #include <linux/types.h>
8 W) j, o% l, A2 X1 C - #include <linux/interrupt.h>; B% C6 f+ n: w" Q+ S A
- #include <asm/io.h>
/ U1 _# \4 ^7 R$ C% ]+ b - #include <linux/moduleparam.h>$ e: y. y6 W# z7 f' \( V! U
- #include <linux/sysctl.h>
: _* H9 n2 u, g6 }( ~ - #include <linux/mm.h>
6 w( o4 v+ B9 {; d% c# \ - #include <linux/dma-mapping.h>7 A/ {* u9 W! {! B
& P' d; `; a9 d! O& l" h- }$ ?: z- #include <mach/memory.h>+ P6 `- g5 H4 ~' Q
- #include <mach/hardware.h>4 b2 E8 O. }& U5 ^4 A0 S4 l
- #include <mach/irqs.h>
% n+ Q8 a0 R/ |6 R - #include <asm/hardware/edma.h>
6 _- W+ z! C; U& H7 I+ }7 A - 5 s1 d( q5 J# @
- #undef EDMA3_DEBUG
) o! I C. a/ b* L! q - /*#define EDMA3_DEBUG*/: ^1 r3 ~1 k' s- `8 |! j
% W8 T' r) V9 i- #ifdef EDMA3_DEBUG
, l9 ]+ T. L1 g& D2 f+ e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Z5 E1 M' F: H1 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); e) v9 U t$ `) B- g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 y! e' f" y8 b8 M, n% U% z4 G; _ - #else4 X, z! Y4 q1 g3 N; v: v. ?
- #define DMA_PRINTK( x... )! L/ R& m' L: {$ R7 q
- #define DMA_FN_IN
9 l7 M2 A* x0 B8 } - #define DMA_FN_OUT
/ v- U- v7 P0 `5 f - #endif, I% }* n: v: ~/ \8 e
1 K7 P7 z Z6 g( A- #define MAX_DMA_TRANSFER_IN_BYTES (32768); P+ j' ~, C6 \# \% D
- #define STATIC_SHIFT 3" }. U4 _" @- Y
- #define TCINTEN_SHIFT 20
% Z9 b7 m( q# e. @ - #define ITCINTEN_SHIFT 21
+ f. E: {) ?! O/ T& Z. ` - #define TCCHEN_SHIFT 22
4 D" T9 ?4 W( E0 {2 p - #define ITCCHEN_SHIFT 231 l' H; I2 V' p2 R4 f) l) P" j
8 c2 O3 J$ Z7 x! I- static volatile int irqraised1 = 0;) x! e# c+ H4 x' p- D$ D- a
- static volatile int irqraised2 = 0;
7 v$ I, N3 c" p* l# g6 _
& i6 S+ M9 e4 g7 E; L5 o0 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n% T4 u" z1 w2 _+ T- i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 f/ m) Q" T4 M4 |$ b- q- T( L9 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 h& U5 k- `# F6 L
9 @, S4 O; E! ?# ? S" `9 T- dma_addr_t dmaphyssrc1 = 0;
- h- j6 p' M% B. z! K0 c# s! c7 B - dma_addr_t dmaphyssrc2 = 0;( ]! ^9 S7 S2 t, Z1 @$ R& r& T
- dma_addr_t dmaphysdest1 = 0;
- E5 s3 l- S6 A( y - dma_addr_t dmaphysdest2 = 0;- ~& p1 K" ^- \& R Q1 P# h4 q
9 Y/ L7 C, V) \* |- char *dmabufsrc1 = NULL;/ o3 o% x; z! A. s- |5 k, b; T
- char *dmabufsrc2 = NULL;
d- x9 b$ ~% N m' _) ^: v - char *dmabufdest1 = NULL;
- g Q- b5 N) v2 {) \ - char *dmabufdest2 = NULL;: }# e% s8 }4 @' s( p6 X) P
8 B) E5 e) E6 m& D, a L- static int acnt = 512;
$ g+ a+ }4 ~" i4 e3 R* a" B - static int bcnt = 8;. V& s: e s/ U
- static int ccnt = 8;
6 m6 v9 q/ n' [6 P8 p3 J* D
8 [ P2 P* H9 y9 W+ l- module_param(acnt, int, S_IRUGO);
. r N+ J5 R( w @3 j5 N - module_param(bcnt, int, S_IRUGO);+ [. @$ c" A! D, Z! s
- module_param(ccnt, int, S_IRUGO);
复制代码 / p- `7 |, t/ @- Z" `* I: m# z5 h
" K- ]% x% X) @8 w3 s& @1 Y0 V6 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ k1 H' \' p" I9 U/ U) sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 M, U$ Q/ h6 ?. v/ S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 c3 }* E) u/ ^* M7 \0 q$ Q
1 ?9 @5 H% T( T8 m1 ?5 F5 l6 e8 I& ~
|
|