|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 o" x* C* G/ G9 t
- [code]EDMA sample test application1 K- J* H# N5 I5 M8 x
- /*
( W, B6 u( }- I0 D- F. D/ } E - * edma_test.c
+ ?- R, L2 q7 [) Q1 D. Z& @0 ] d& G - *
: {6 N: l/ t9 \1 z* C( d' w8 @ - * brief EDMA3 Test Application) l$ D1 U# l2 i, c: }9 s! ]% j0 ?
- *6 f) t$ W. a+ S* H
- * This file contains EDMA3 Test code.
' h2 R! S; @9 b/ \- V - *
0 v: p+ @0 J2 y: m+ k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 ]% m) D5 t& l, I- }: F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 C; d7 M( V# o1 \6 ?# B/ r - * TO CHANGE.+ K0 B7 Z6 K1 l7 l3 q
- */ P% o; s8 L4 v: c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 A t+ a) G* e2 C - *
& F) M0 Q) Q# ^3 y0 L - * This program is free software; you can redistribute it and/or
" V x8 h# j3 s- v - * modify it under the terms of the GNU General Public License as+ r- p6 m2 a8 l1 k* T% U5 @7 c7 u
- * published by the Free Software Foundation version 2.6 ~6 [) v8 ]% B, E4 e" M
- *8 ?$ {( r2 Z; k, W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ `; ^/ d" i1 o, k% {5 z+ `( i
- * kind, whether express or implied; without even the implied warranty
{2 b9 y3 w4 ~ N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ O7 |" O; E3 [* C" o( t
- * GNU General Public License for more details., G3 A2 j" F) H7 E$ B D3 K( B' m
- *// ?7 ?$ D2 R1 T" J1 S6 I
! u0 y' I; ? w7 K+ R. F+ B- #include <linux/module.h>" b0 \- S. {) a9 V9 M8 E
- #include <linux/init.h>
! O( O O+ k3 k1 o$ t! G7 G, @9 T - #include <linux/errno.h>
" I( z" q3 ?8 R+ v0 _! I H4 D* Y - #include <linux/types.h>
) M: o7 t/ D0 s: w8 w9 r9 N `0 Z - #include <linux/interrupt.h>
4 ?4 b" ?) N8 G( ]( i - #include <asm/io.h>
6 J2 }5 O0 N# y, t2 G - #include <linux/moduleparam.h>
S; k6 T! B$ v/ g z5 @ - #include <linux/sysctl.h>; z/ e) E+ u0 R3 V$ e- p
- #include <linux/mm.h>, `9 R3 b( N& O3 }/ x
- #include <linux/dma-mapping.h>7 a- U- T) [! j6 t' F
- : ^& H4 ] g, P. x6 p
- #include <mach/memory.h>
% z5 }. `/ V2 j, q) O* W9 G - #include <mach/hardware.h>& L# l- m8 g$ g( ?& t# l1 e7 p; ?
- #include <mach/irqs.h>7 Z/ n4 {/ q) v- r# L) {
- #include <asm/hardware/edma.h>* f6 q" x" O+ q* F, | V
- 5 \- u2 [: p- B. Z9 l' c* S0 J& Z
- #undef EDMA3_DEBUG
* H4 u# P8 v, `' j; W6 V - /*#define EDMA3_DEBUG*/
" n* g( w2 C$ @+ F9 p: j9 l - % L/ K3 P7 X; h$ d g/ f5 C
- #ifdef EDMA3_DEBUG! C+ o6 a0 { h' N" T) J$ i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) m9 a9 O2 ?5 Q& l; n: [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# i! Q# o, l; x' K: p4 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 n% t( [+ u% A% E0 Q - #else1 g- g, f5 [) x3 L6 d& g
- #define DMA_PRINTK( x... )
( i2 @$ {3 y4 [$ } - #define DMA_FN_IN
: N) }9 Q! X, K W+ n - #define DMA_FN_OUT
: l0 ^* B$ |) V; H3 Z2 ]9 M6 K0 i - #endif
; l0 A% w/ c- O4 u4 f8 |. r# k: D
! f+ y: x; @+ \- `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 g+ @% Y; r+ U" q1 w3 W - #define STATIC_SHIFT 34 z3 F* ]* ?$ v$ H3 z2 t8 c5 O; D
- #define TCINTEN_SHIFT 20
+ }5 }( J2 y, Q) |1 ~ - #define ITCINTEN_SHIFT 21
: k' e; Z7 m4 ]2 q6 D( Q; f - #define TCCHEN_SHIFT 22
- B9 K% f: P- C [/ x+ b - #define ITCCHEN_SHIFT 23
4 g* u7 ~: O- ] - $ K6 e' t7 U T% o- P& y
- static volatile int irqraised1 = 0;* g) M6 O* g1 E
- static volatile int irqraised2 = 0;% F1 u, N6 K' S* C* a7 Y
2 i5 s. [ D' c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ D F, z0 s1 }& d' I8 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ^; O2 p, l! T6 ` o7 w; v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* m6 ?* U% u2 ` - ! i5 B5 i- O7 ?
- dma_addr_t dmaphyssrc1 = 0;& G8 e4 d0 F' `) ]
- dma_addr_t dmaphyssrc2 = 0;3 J2 i N* o2 B$ A) |6 V. E% M
- dma_addr_t dmaphysdest1 = 0;
4 N: q4 V! b0 W1 I' B2 k" { - dma_addr_t dmaphysdest2 = 0;! @7 h" ~% P G/ v# H
- # _+ w9 [0 Z1 c/ n
- char *dmabufsrc1 = NULL;3 f: O& w6 X0 K- H
- char *dmabufsrc2 = NULL;
# v/ S+ N5 x; t3 [0 |" E - char *dmabufdest1 = NULL;
" a7 ~" w) D: Z8 F2 B5 ?6 f - char *dmabufdest2 = NULL;
: I. ?) e" t* ]6 _ - : t, J1 B8 z3 X( R5 O0 w
- static int acnt = 512;
; v" b. T7 ~. h( W2 [ - static int bcnt = 8;
/ M4 l) E% G+ |" A) S6 h$ s - static int ccnt = 8;
5 j" b( x- M/ |
7 q: a4 _; X2 o4 F2 g. t- module_param(acnt, int, S_IRUGO);8 r/ d$ C$ X# ~1 b
- module_param(bcnt, int, S_IRUGO);
7 ? \9 \& Y, Q' y4 t5 e: a - module_param(ccnt, int, S_IRUGO);
复制代码
! m; N9 E( v2 A/ O' u
( ]7 F8 W' r3 t$ N. d7 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 J" \% ^& @ n8 y/ T* M4 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 `: N5 x$ ?: O* r/ u# A6 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: O$ E+ F( g9 l* f+ Y% f6 X7 {6 z
+ y& X1 m8 Z3 B8 z p! D3 c* E' Z% `4 I7 J- L! j& M9 M
|
|