|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 u6 v1 f( C) \5 U% L
- [code]EDMA sample test application
- s# W0 w0 V3 b. d - /*9 O/ `8 R1 L4 n
- * edma_test.c. F1 `% B& c' h/ w8 ~
- *1 x6 \5 c/ g, k2 {2 |
- * brief EDMA3 Test Application
m2 ~+ k: i2 F ~+ y, V - *, R6 E6 O3 O9 B0 k) y: M k
- * This file contains EDMA3 Test code.
8 V: E4 G$ P; u( W$ n) z - *
* I4 C. w9 ~6 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ x- P% X- z& v" q9 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 l5 G3 c6 _: O; F& t7 G - * TO CHANGE.
) s$ _6 K+ q- Z0 U& P - *: }4 A4 V5 z7 K" c2 V. G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ y4 t) l4 e: ?" H) n. p. c% `
- *
/ {, G0 Z- P- f6 } - * This program is free software; you can redistribute it and/or
! u; r; _, o @9 z2 H: T - * modify it under the terms of the GNU General Public License as# \6 g& W. E2 O
- * published by the Free Software Foundation version 2.. d5 b+ T) y, V0 ~& \. h
- *; ~8 o4 N, F* B& A9 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: ^' Y! u8 {# L- p U0 b8 F7 ]3 W - * kind, whether express or implied; without even the implied warranty* d9 N9 W# J9 S/ s9 w! [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 P+ z9 ]* m5 A# k6 K+ C" F' L - * GNU General Public License for more details.( @" o! t2 H) o+ N0 e% h. D
- */
# t; d: @+ u. F N5 K - + O p1 [ k6 B+ f
- #include <linux/module.h>
/ c# g/ M/ H2 {) Z - #include <linux/init.h>& U: ~# \. w0 v
- #include <linux/errno.h>' R; V& J3 h/ g" Y6 D$ `
- #include <linux/types.h>
9 s3 N1 @4 W8 v0 l0 ?. `0 ?- k - #include <linux/interrupt.h>4 F+ g2 A. C& I
- #include <asm/io.h>
, e6 ?. S$ x- S% \: z# S - #include <linux/moduleparam.h>/ t: Y, O1 H# _! _
- #include <linux/sysctl.h>
9 e- {5 R: U3 ]& R - #include <linux/mm.h>
: \; h6 N; L& B- [ - #include <linux/dma-mapping.h>' U2 W# K6 t: L- o* U6 h
* X4 z& @2 p$ I* s5 d+ G( ^) h$ N4 f- #include <mach/memory.h>
2 D3 k U6 I J! b/ |* ` - #include <mach/hardware.h>0 P0 a I$ A7 f
- #include <mach/irqs.h>0 v, h5 g7 \2 M- m/ ]/ E7 q
- #include <asm/hardware/edma.h>: D2 k. R6 ^5 v
% `/ A% U" F+ E! D5 O# r' F: @- #undef EDMA3_DEBUG
3 \' z9 N1 F4 ?6 J0 C! v - /*#define EDMA3_DEBUG*/
9 o; J5 I; ?, _ U7 c" @# c8 A5 i - 5 ]( n% ? L5 s" s1 i' E
- #ifdef EDMA3_DEBUG
7 S' p) q2 x* C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; Y* M$ M: q2 t: {' _2 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ n7 ?: ^% s/ \2 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# s$ b' f3 x/ q( j4 t0 n G
- #else
1 |8 T7 h/ ?# b - #define DMA_PRINTK( x... )
" d2 k G+ z, K$ |' v" \" c - #define DMA_FN_IN7 R# b* w! Q$ {. Q2 o9 w
- #define DMA_FN_OUT
( }: Z. Q3 f; p: S- Z* t4 Y - #endif0 ^: D5 q# r9 w" l, r) Z
- ; _) |* j, m2 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( h$ ~, u+ a6 x2 t$ Y$ v- Y3 C
- #define STATIC_SHIFT 39 k' P) B- P7 \6 @+ S( b7 C. ~
- #define TCINTEN_SHIFT 20' c( x$ e. s- h- p! y
- #define ITCINTEN_SHIFT 21
& d6 c& L* v4 o, \8 M - #define TCCHEN_SHIFT 22
& Q4 p8 ~- b8 H) A. w - #define ITCCHEN_SHIFT 23
; [& Z$ n8 h7 u8 _ - . Y# w) }* y6 B' F
- static volatile int irqraised1 = 0;
* |& ~- h$ M3 T - static volatile int irqraised2 = 0;
/ n+ l0 T# _* i) D: y- a5 b
9 t" o* Y# R9 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t) R- q k* V* c7 \6 U- _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Y- f- S! }4 A& N( y+ i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% g* v6 d' g$ ~2 q/ I9 A4 }2 q
* F8 z9 f. e0 s" a8 x4 F- dma_addr_t dmaphyssrc1 = 0;
9 e' `/ P& m9 e3 L, b) i - dma_addr_t dmaphyssrc2 = 0;) x. A0 b! j1 Z
- dma_addr_t dmaphysdest1 = 0;& W2 U- k3 w2 o, i+ M+ S
- dma_addr_t dmaphysdest2 = 0;, F; ~* L) d/ Z' J3 ?9 X
- , V! {6 ?0 ?& a7 k
- char *dmabufsrc1 = NULL;
- d' n/ C$ r' u/ R0 y! Y& D - char *dmabufsrc2 = NULL;
3 @, o3 u( ]1 r8 [ - char *dmabufdest1 = NULL;2 i/ K5 @6 E: n8 E" x, y o
- char *dmabufdest2 = NULL;+ {! z& Y3 @7 v6 K* m4 L- N' [
- ) Y% P \5 V6 d
- static int acnt = 512;) e+ h1 l# Z* L1 \
- static int bcnt = 8;
+ D' e1 P" M0 O$ E1 ^. ~2 F - static int ccnt = 8;5 l& f0 f6 M( o+ q3 g
- 7 q6 ?3 V' a0 u% t, A
- module_param(acnt, int, S_IRUGO);
2 ]7 j1 _; n. w! V6 v$ @ M' M - module_param(bcnt, int, S_IRUGO);/ E6 |# g1 |: e/ i8 ]; b- E1 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 0 e/ j$ R4 L: \' C" B! P2 W
( K( j8 K; u& E2 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ^2 E! o `& q4 F) v# C2 x+ C- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* e; w4 H0 g4 L# Y, @4 m- B" ]' S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 W& t4 ]6 n0 _" q. I1 V: J
: t: N) M. E$ ^8 h% G9 q! C, h" T* ~, z% R4 @( `+ M
|
|