|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 O6 C4 @3 N9 s) ]3 d0 W7 _- [code]EDMA sample test application: G; \8 s: t7 g: \/ A3 b% `. w8 R
- /*2 o8 {0 l6 u* E' U
- * edma_test.c
. T. k: r2 ]# Q4 B5 S. [/ a9 _; x - *
+ Q/ T/ U6 A. v - * brief EDMA3 Test Application. `- K6 H |6 Q! O* P1 T
- *
6 @! E9 Z. M% Y3 P, u( R - * This file contains EDMA3 Test code.
4 Y" L1 S8 o9 I - *
; j9 O K1 ]& N% ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# Z3 k3 D0 }) ?, J* x: P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- l6 t' y, k+ F* |3 d0 ? C. d) s* e' _
- * TO CHANGE.
# p8 _" J9 c9 \% ? h - *
( \4 B8 @7 L' W* T0 b' Y% V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 E2 _1 W5 R+ i# F. t; C9 M
- *0 B- ^: U1 b, V) s
- * This program is free software; you can redistribute it and/or: I5 O6 `+ R# i1 f
- * modify it under the terms of the GNU General Public License as
2 x) O* Q3 z8 ^5 g - * published by the Free Software Foundation version 2.
# \4 c- h0 y6 N: Y n - *- j! f8 _- y+ L2 K( Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ z+ L t0 l/ [ - * kind, whether express or implied; without even the implied warranty7 ?. Z* n8 {0 P1 H% \5 r( u" I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) y& P# C5 @( N8 P: U9 W, G* O
- * GNU General Public License for more details.( Q9 t9 E1 z: z: i: t) l- k! J
- */
! O1 R& C9 V8 G% Q - ( K8 a8 |7 S+ V& u; l; D, \
- #include <linux/module.h>9 A: h- ~6 C0 n8 z$ O' e( c
- #include <linux/init.h>+ Z& `. d! {4 Q8 }+ k
- #include <linux/errno.h>
$ k+ O# h# v6 ?6 `* b' p3 | - #include <linux/types.h> O: R* p7 p2 }. v8 X0 R0 c$ T
- #include <linux/interrupt.h>
& l; k# r: R' {8 N) h - #include <asm/io.h>6 O9 }6 Z$ U& G3 A2 i9 u9 W& E3 G
- #include <linux/moduleparam.h>
( w/ k0 o% [, B2 f0 s4 p8 L5 e - #include <linux/sysctl.h>$ j4 k4 y' @; _. i+ J* H9 b& n* Y
- #include <linux/mm.h>' V+ D# [7 [3 n# O+ m4 H. e
- #include <linux/dma-mapping.h>
2 v9 L7 G/ ~ L% L7 |- A - 2 E* ?0 i: p z
- #include <mach/memory.h>
3 w7 z- j3 O, O/ f* H6 ? - #include <mach/hardware.h>7 n& D7 w$ P1 S, Z6 O* V
- #include <mach/irqs.h>" y9 L% w5 H* L) a8 x! J1 f
- #include <asm/hardware/edma.h>6 F; M- a* {% Q$ d* C
5 c+ S' w$ {* u b4 H- #undef EDMA3_DEBUG; p) ] M$ X" |" l& G2 I
- /*#define EDMA3_DEBUG*// N/ U8 W& Z& K$ |7 S! ?
- , {$ x& v5 p% W# U, L3 @: t f
- #ifdef EDMA3_DEBUG
( R7 [$ e/ t1 _2 Y: c/ S% s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. U5 T( C. b& z+ O* D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ _. T0 q6 W" _9 { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( o$ l1 v% m% \% X6 V' }- f. z
- #else% b: e9 D1 Q' P: ~! N
- #define DMA_PRINTK( x... )
$ Q) M' g6 L: m - #define DMA_FN_IN
2 k7 M$ j" l4 }2 v0 c - #define DMA_FN_OUT* _) p/ k$ i( J6 C
- #endif
7 O0 p0 }9 T! A! R6 M - 4 H* d( `( j3 ^4 G( q# Z# d" t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 L' a- v( z @* y& p0 G - #define STATIC_SHIFT 35 j; O; ^7 q# I. `$ |. n$ T
- #define TCINTEN_SHIFT 205 x4 z4 w" I0 L8 R" u
- #define ITCINTEN_SHIFT 21
9 ?9 P0 r0 L$ C( k) }" G, h* R- { - #define TCCHEN_SHIFT 22
9 S6 j" V' ?; ?8 ? - #define ITCCHEN_SHIFT 23& k K3 P& }0 z& p6 m2 x$ Y1 o' j
8 c$ i2 G* N7 Q6 {8 Y- static volatile int irqraised1 = 0;/ Z$ x0 W8 m4 c* @& V; H6 v# E3 }% f
- static volatile int irqraised2 = 0;
0 ^# P/ M2 s$ g4 [4 u
: Q: i: ~+ f u* b4 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: G8 y' q- z' g7 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Z% ]* g9 @: T {$ s) ~8 V9 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; b4 b/ [: ~' y9 _ - 6 f1 A- X5 ^& W; `. z8 e0 F
- dma_addr_t dmaphyssrc1 = 0;$ u" @+ A+ c6 d& t
- dma_addr_t dmaphyssrc2 = 0;8 d" [9 f9 h/ b# I
- dma_addr_t dmaphysdest1 = 0;- Y- v: S2 t2 |) n- T% n
- dma_addr_t dmaphysdest2 = 0;2 L$ ?8 R( t) c- u
" ~) R% \& l* c5 W# G- char *dmabufsrc1 = NULL; w% u) `$ U0 Y7 w1 {
- char *dmabufsrc2 = NULL;
$ Y, l' `" n+ d# B4 q8 t% J# ~ - char *dmabufdest1 = NULL;5 D' s4 R" C; \
- char *dmabufdest2 = NULL;
4 G; [- y% v9 O7 @( ?
2 `6 H, Y; i/ Z' E- static int acnt = 512;
0 q" h; j+ w# k: F2 ?3 ?; B8 K1 O: G1 j - static int bcnt = 8;, b) P% y7 A, d- X" F1 w
- static int ccnt = 8;
* b1 S) M1 m' z2 j; U; f! D
/ I" C" `3 B N9 v* [% i2 v- module_param(acnt, int, S_IRUGO);; }8 Y8 W4 O2 H$ w, K1 ?; k; G
- module_param(bcnt, int, S_IRUGO);
3 a$ ?' Z% j( j8 d; D - module_param(ccnt, int, S_IRUGO);
复制代码
. J5 Y+ V5 s+ M+ b8 w' W
2 U+ F$ L6 h. g# k- J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 d% {1 b# d; Q* H0 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( K$ ^4 e& v% E2 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- G9 O0 r9 j: R7 S4 F6 ~/ b0 @, Z# G* t8 Y
5 p- Z% c& C) H1 _ |
|