|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. b1 I, t5 I7 u$ p- [code]EDMA sample test application2 f4 h9 J$ @: X' d, c
- /*
5 G$ j) W- |- b# J4 G - * edma_test.c
; A' N! I- Y% l0 B5 A% L: \# T' k - *
, i1 Q; j O0 ^9 o) G1 A5 V1 K - * brief EDMA3 Test Application# [* S" C$ [6 \1 f
- *" D8 g0 e9 B" `2 [2 V
- * This file contains EDMA3 Test code.( i+ ]' ^/ R2 ]( f8 i2 V
- *3 v$ ^1 c6 V; e0 a7 z1 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 W9 @0 x! X! n$ w6 W7 e# m' i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; t" n3 x) V# [5 f1 k7 e
- * TO CHANGE.9 L! V9 y+ K- i% p: X
- *0 I( C5 K* r4 [! D; B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 r; P' o F) w9 H9 A9 U - *
8 t: A u; Z: }" X7 c n9 l% I - * This program is free software; you can redistribute it and/or2 d1 s- h7 [6 o
- * modify it under the terms of the GNU General Public License as
1 d9 o; U) E$ T# U9 N( X/ Z; T - * published by the Free Software Foundation version 2.
% i5 t u) Q# J6 Z - ** |) @7 ^" K* n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ z4 ~$ m" ?- H# S E- ~ - * kind, whether express or implied; without even the implied warranty) D2 N% G" c+ P, S+ L; B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 [( x9 @ P* q r9 Y$ x
- * GNU General Public License for more details.- m3 n) K) i& q7 Z/ V @
- */" l+ Q2 ?) G. ]* [# Z: i
- 3 v1 Q* k; G# n5 L/ B
- #include <linux/module.h>
) J. k1 z2 |/ A& T% O% w T# N% b - #include <linux/init.h>
% T, w$ [4 B1 F9 r4 t/ `) j# K - #include <linux/errno.h>% [# ~& S* m e! a! M$ [
- #include <linux/types.h>3 J5 d7 V; b) @
- #include <linux/interrupt.h>
7 L) q0 X7 G* C& W2 o - #include <asm/io.h>3 v- t8 I4 ~; p6 }( g2 F
- #include <linux/moduleparam.h>- y* Z; {+ Y% M( j3 S6 A& v
- #include <linux/sysctl.h>: B7 W+ r: {7 y9 I
- #include <linux/mm.h>
2 [& n; j1 `3 G- e) Y/ z. W - #include <linux/dma-mapping.h>& r ]3 }0 E" d) f8 ^- Z0 e4 r
- 2 ?) F2 M% W% Z$ l0 L6 l8 E
- #include <mach/memory.h>
}! h' [9 i2 n h5 K3 m - #include <mach/hardware.h>
2 i1 m. s, \8 r9 V - #include <mach/irqs.h>: K7 x! V/ o' s
- #include <asm/hardware/edma.h>
7 k" ^7 T0 J! g: D - ! j2 f, {, R8 T4 h' j" Q
- #undef EDMA3_DEBUG
5 j5 K+ q# Z. g/ W7 P L - /*#define EDMA3_DEBUG*/- ?( M# O1 H8 I+ j3 n+ y' X
+ s! X5 H+ n7 ]0 d- #ifdef EDMA3_DEBUG
% ]4 O3 P3 u1 B9 L9 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 p8 M9 u' y$ M$ m) f7 c3 m8 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 I- x |* h& ~& G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# w" Y$ \1 C0 \0 L
- #else
* p' A5 a4 O0 r+ I: }. P - #define DMA_PRINTK( x... )' T# u& j4 f9 p. L4 q1 p! J
- #define DMA_FN_IN& @) r9 j, q$ T5 |3 ?0 c2 k% ]8 W. ]
- #define DMA_FN_OUT
$ n) d8 _, J2 ]1 N7 t. h - #endif2 z; |0 |" j6 k, O2 {" m& s
" z* P$ J0 P8 V+ V% o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ Z# f/ j+ U, p: a1 W/ ]
- #define STATIC_SHIFT 3: F8 p2 I# J7 M1 r
- #define TCINTEN_SHIFT 20
1 P( V, j0 m* Z" T& e! a) n - #define ITCINTEN_SHIFT 21
J x2 f* ~! G4 ~3 U2 `6 x - #define TCCHEN_SHIFT 225 [ g* u9 z4 f8 ^+ h7 d" I
- #define ITCCHEN_SHIFT 234 W# p- f/ K9 _: y
- , Q7 \4 I9 L& m$ Z& H9 l. D$ e
- static volatile int irqraised1 = 0;# O: N) p- O! _/ V3 N0 C
- static volatile int irqraised2 = 0;
/ _) ?/ V! [: p# u - $ s0 b; _8 }3 N& Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E/ O4 |! M5 M5 H' p- U; @% ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p, k: }- h9 T! d2 l* R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ m8 |9 g4 N- D9 F& X( I0 P4 u' V - ! _; W! b* f- h. s5 W% r1 \* i
- dma_addr_t dmaphyssrc1 = 0;4 i" V8 J0 X6 P: ^: \' }3 o
- dma_addr_t dmaphyssrc2 = 0;# i: R3 N! b% N9 O5 ?
- dma_addr_t dmaphysdest1 = 0;6 v3 y: \% R2 a, z; Z# Q8 ^
- dma_addr_t dmaphysdest2 = 0;# d5 U% j) W7 {+ S3 B& _
+ e6 b2 L* ?" U3 W- char *dmabufsrc1 = NULL;
% \( M2 H5 F- A - char *dmabufsrc2 = NULL;/ Z* A) K: E% G4 j! c5 S* X
- char *dmabufdest1 = NULL;
% L7 m* F, w0 t0 p: p4 c% b - char *dmabufdest2 = NULL; C: H( }. z: T, t: D
- 1 B# F& ]( |: o$ b
- static int acnt = 512;
. k# d* `+ K c+ D, U) @ - static int bcnt = 8;/ z l# f0 E% d7 v1 S% q8 W0 S
- static int ccnt = 8;3 l( ]7 M! v1 X8 ?; n2 U/ Q( Q
' {7 _2 H/ O$ t- module_param(acnt, int, S_IRUGO);
3 L- m3 g" B6 u - module_param(bcnt, int, S_IRUGO);
8 F8 L3 M1 ~& C( V6 d; m" N - module_param(ccnt, int, S_IRUGO);
复制代码 : H3 p9 |7 V1 E
$ a" w" |. M! E* s" O. y, x7 j- p! A" O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 h! t& P- a# c+ u3 \2 z7 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& s q! ^/ m! x. x# F! R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 j5 k8 t) x$ o
" Z" h9 g2 t5 F. E8 b9 s9 e/ C6 ~' ]) z
|
|