|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ r! i, J, x L; `) G- [code]EDMA sample test application6 f: v( O" W" a& a- `0 U: I' Z
- /*
7 s% p3 X! ~" f6 R# u0 C2 o - * edma_test.c
2 C: H3 j; M( Z3 o; I3 b5 a! \7 j, Z - *
9 F% u( r" \& c - * brief EDMA3 Test Application
9 Z5 k8 k2 R+ k k) l) i4 i* R; N - *
6 X% m% J h: d: F9 H$ W - * This file contains EDMA3 Test code.
8 q" I/ W6 b0 }5 ]: x; o+ z- z$ E - *8 G7 z% ~: q, e) O# [8 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 G& _# p: _+ X3 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 V: G% F, P9 Q% ~, I - * TO CHANGE.
$ j. n% N* V# x9 y5 f# N3 K - *6 c7 `; m9 ^, `; r. B* H4 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 }# _% h. l. \, T - *) T9 a+ _0 }% [) A
- * This program is free software; you can redistribute it and/or
4 ^1 ^8 l# E( ^; `1 Z - * modify it under the terms of the GNU General Public License as
3 G6 E. M9 P* i! k9 k - * published by the Free Software Foundation version 2.
$ J: |1 z7 h' Y9 i. Z - *5 Z7 S$ V$ [1 g0 E& {7 P. I/ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- C) z7 _) ]8 W% n0 B - * kind, whether express or implied; without even the implied warranty) b' D5 {& b! K' s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 {) |; M. e) V% n
- * GNU General Public License for more details.8 y8 t6 m' I, R8 ^1 @
- */
! i1 l% t0 G4 n; y
1 v: |: D8 z" I9 k0 G- #include <linux/module.h>! j6 j' _4 U7 _$ y
- #include <linux/init.h>
+ J4 {. ~8 A+ p- \ - #include <linux/errno.h>
" i0 S" S) d- {3 ?4 F5 v - #include <linux/types.h>
+ ? w( [3 Q" D$ J7 I6 k5 Y - #include <linux/interrupt.h>
5 I) w, p6 c- }& B6 \( [; X9 [ - #include <asm/io.h>+ F' f" C! n5 o6 d, f7 y2 n/ z9 B
- #include <linux/moduleparam.h>
5 R* t8 F+ v7 U4 N/ Z$ u - #include <linux/sysctl.h>
4 i! X8 ]2 K5 O5 ^ - #include <linux/mm.h> s8 X5 ?' g8 \' X* u/ v3 P* T* G% R
- #include <linux/dma-mapping.h>+ {9 f% g3 y9 [4 G
`# g" m5 O7 _" L# w% o2 h9 X" L- #include <mach/memory.h>5 J* j- R4 Z" ~$ Y% O$ u
- #include <mach/hardware.h>
" w1 r4 k. R" m7 {0 ^ - #include <mach/irqs.h>* r' z! B5 H/ o' N7 e/ n
- #include <asm/hardware/edma.h>
2 f8 a0 d+ |3 ^6 ^; e
# k* q. I2 j# [# P2 C- k- #undef EDMA3_DEBUG$ C& m# Q3 ?: m. h1 m
- /*#define EDMA3_DEBUG*/7 h+ p3 W7 F F( i" X
# O; w# g1 }* f# f0 ?. S6 A- #ifdef EDMA3_DEBUG
' D" e( S# H+ i- C- r2 o- G3 _8 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 f2 z1 ^( A+ Z# O; C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! a: \9 H1 `3 b' J) ]5 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; t5 ?0 H4 i3 L$ I( a+ e. y& t$ b3 V - #else
" t& {/ z7 D+ { - #define DMA_PRINTK( x... )7 v# H$ l% e7 a c$ C' c
- #define DMA_FN_IN& d8 b+ m- J' B5 f& d i6 d
- #define DMA_FN_OUT, E. e0 ]' Z1 z1 x" Y9 [! n
- #endif
. V- n s. ?- o3 J. @. I
5 o" L; Q; h3 ?% X* \& V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! ~+ |( a( t! P. p+ z2 y& f - #define STATIC_SHIFT 3
+ f v1 u' ~, V2 l2 Z - #define TCINTEN_SHIFT 203 @. U" {( l4 p+ B
- #define ITCINTEN_SHIFT 219 P. R+ m! y- a' c
- #define TCCHEN_SHIFT 228 ^: k! P* E- G8 N2 o! Z+ O
- #define ITCCHEN_SHIFT 23
8 B% r* A0 R8 V, x( `8 S* v
. J% d( [( N" U3 E) R/ }" y' I- static volatile int irqraised1 = 0;& B3 y0 w4 y' q" F0 ?' f
- static volatile int irqraised2 = 0;
4 _3 p5 l. W' f, ~* d" z! _6 k: a - ! l$ A# B6 y \, U1 E; { Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b. \. }' P6 v& y5 v1 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! \: |, A( r8 _# e# F' h" {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 i+ k! ?. u: m3 o
" b; [* @5 ^' m0 L1 ~- dma_addr_t dmaphyssrc1 = 0;! v$ `7 I: E- K3 f
- dma_addr_t dmaphyssrc2 = 0;" C7 i4 P. }& n1 G/ A& m5 j
- dma_addr_t dmaphysdest1 = 0;
+ k" ]6 _: ?7 E: P( O7 N - dma_addr_t dmaphysdest2 = 0;9 J8 ]' k1 R2 | |' n+ y; W& _
9 c" J( f0 ?& t* m) O2 y& y- char *dmabufsrc1 = NULL;
& w7 N0 v- o5 E8 V ?% b* c% { - char *dmabufsrc2 = NULL;
9 P2 n7 Q) b# \& W* K - char *dmabufdest1 = NULL;6 P, c3 o$ A/ ?
- char *dmabufdest2 = NULL;8 q! ~ G! [' T* k# m0 m4 B
- $ x0 ~ ^0 M) m6 j
- static int acnt = 512;
* g3 C& k t+ _ f3 L8 Y* t - static int bcnt = 8;
8 o9 R" \# c3 | Q6 V" x" V0 g, K - static int ccnt = 8;1 ]9 s( z' p0 w* C& @& M( w3 z. n! ]
- 3 X* }" k& ~: L' N k3 Y. n
- module_param(acnt, int, S_IRUGO);# H. |+ Y6 X( ~! }
- module_param(bcnt, int, S_IRUGO);
2 M% m! `) ~( o0 T0 k - module_param(ccnt, int, S_IRUGO);
复制代码 ( f" \7 l8 {4 H4 n
# @# g+ L1 ~& M! W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* I" x9 e5 t9 E. B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; |; k6 V4 s" h6 D. @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Y7 J J5 H% _# K2 D( n8 [
% V8 v' z9 W Q
9 ?0 A- u% h& X* l% z& i. S' ~! C c% e |
|