|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a$ Y9 c7 G: S+ S7 ?6 _- [code]EDMA sample test application& K8 O; p" t" M# }
- /*
# U6 E2 W, B- `" K& D - * edma_test.c5 X: _ _$ ~: g. X. D7 r
- *, M4 m& X4 M* R: q
- * brief EDMA3 Test Application
7 ?4 D$ L& H9 i/ k - ** T$ t2 f+ f+ ?3 m% y. J7 f
- * This file contains EDMA3 Test code.* _; k6 L% j% }) t. a6 D
- *$ M7 Z, r+ \* L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 r( P/ T& d4 w# N0 t$ A3 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! j. g) `$ @( p) a( M" l
- * TO CHANGE.
, L% ~5 H) V; G2 r; k- ^8 ? - *4 H5 s; b- E+ e+ f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 M/ F5 p+ L5 J1 s7 Z# K
- *
7 o( C9 G- ]! D; L' e" o- N - * This program is free software; you can redistribute it and/or
U5 { W; a8 b$ h - * modify it under the terms of the GNU General Public License as
8 _7 f7 f( B3 v) r0 O5 u. D' u- h - * published by the Free Software Foundation version 2.' R \+ z, x# t# `) O# r7 c4 {
- *
+ J* M+ g7 `8 W( V/ q+ A# e0 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 y2 a% m& C$ o0 _
- * kind, whether express or implied; without even the implied warranty4 i7 j' O+ t% y- c: V- }& G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: i" q+ C1 [ ~
- * GNU General Public License for more details.
+ d* q, B. H& I - */. b7 ~' j" P' g6 V: q
- S4 T- q1 `, ~' {/ A) P
- #include <linux/module.h>( c& _) x B% z
- #include <linux/init.h>
9 ^$ p! J/ l2 `9 e# l# e - #include <linux/errno.h>
$ _' F$ v: K4 K& ^/ Z - #include <linux/types.h>
& I, Q- I( g1 P# T1 G, P& C# z& p - #include <linux/interrupt.h>
# k0 f! @, M* N. K; J6 H - #include <asm/io.h>
$ W; k- N- }/ W1 m7 S - #include <linux/moduleparam.h>6 @2 V) }! y9 K) \9 ]
- #include <linux/sysctl.h>
- f! O( ?& L Y - #include <linux/mm.h>
4 m& v- z1 k2 V8 F5 y - #include <linux/dma-mapping.h>0 x$ x0 k3 f5 k
- 6 o1 m( a& X% n. |& x) G
- #include <mach/memory.h>
6 D; Y3 B# i; T) V2 R. O+ O - #include <mach/hardware.h>' J9 w0 s; _! j% ~! o( ^. F% P
- #include <mach/irqs.h>) h( H5 }- P9 n; g# n4 Y# \
- #include <asm/hardware/edma.h>, M% m9 `, F- h: l! \9 @0 G8 }
. i* ]5 V3 g; }- #undef EDMA3_DEBUG
( g9 O o" Y/ }% x" S3 c; ]$ n0 x - /*#define EDMA3_DEBUG*/
0 Z; L3 r1 Z _ S! v - - J6 h, w2 D9 @! R
- #ifdef EDMA3_DEBUG0 k8 y7 B* [- Q4 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# _! z M, P% z2 f& A0 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; h# ?2 T* j. w7 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& \8 u* @, P* ^, b8 d
- #else$ H/ r+ k, Z+ {3 T4 ?5 X
- #define DMA_PRINTK( x... )' t$ U( Y( T- i7 R' w& {
- #define DMA_FN_IN% K& z. R! L. y2 d0 A
- #define DMA_FN_OUT) [5 p/ o# y N% H3 t& y
- #endif
2 W: L" ?4 E- Q6 I( L* C% b$ P - $ A$ y9 n% ~ Z9 G2 F9 p' t2 i$ ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! l. f8 S6 ^; _) l- q( v" ?
- #define STATIC_SHIFT 3
5 X. f8 K5 b! X/ I* C - #define TCINTEN_SHIFT 20" [& }; `. y& s6 `: K
- #define ITCINTEN_SHIFT 21, D) B0 O# h% j! m
- #define TCCHEN_SHIFT 22* T3 i* v+ L. n
- #define ITCCHEN_SHIFT 237 S' i# s( V% G
- 2 \6 q( Z" S* ~5 o7 u
- static volatile int irqraised1 = 0;
3 `6 l6 I! A/ c( \ - static volatile int irqraised2 = 0;
" u- ]) p9 l. i M - % o: H% r" V4 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 a+ x) G' W4 e0 J9 B, P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) T% k4 S: ^3 A7 g% y* B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
Q0 u: v1 v* F! X, ]9 v+ G7 W - H; C7 D. j- E y- u& j0 r* w
- dma_addr_t dmaphyssrc1 = 0;5 @" s% ]& w, O1 |8 m, D3 B0 u4 L
- dma_addr_t dmaphyssrc2 = 0;
0 Y3 t. t% T) g& p6 |( f7 G( J - dma_addr_t dmaphysdest1 = 0;
8 F5 r0 J8 ^$ G8 ^ - dma_addr_t dmaphysdest2 = 0;
; X! S0 @2 K& \, x, @8 k( E7 r - ; U- W% R0 l) e7 ^1 O+ ?, p
- char *dmabufsrc1 = NULL;
1 V6 X! c( R. C* W' H; V+ e- Z' r: b2 ^ - char *dmabufsrc2 = NULL;% u2 }9 m6 U& _4 B. Q; L
- char *dmabufdest1 = NULL;
5 X% R8 f, Q$ l1 ?* k - char *dmabufdest2 = NULL;
6 C3 X6 C5 P2 J. [" I3 K - + f& e! g& x5 t I1 j3 X
- static int acnt = 512;
& |1 [- T* v5 i6 _3 F1 d* F - static int bcnt = 8;0 s2 Z+ f+ s% E Z) n7 w
- static int ccnt = 8;$ W; _8 l; z. N* R) G/ P4 F# v
- U5 M' ^/ w& h1 G# V
- module_param(acnt, int, S_IRUGO);7 r u1 m( Q* v9 C" w, W/ O
- module_param(bcnt, int, S_IRUGO);1 y! L' s. m5 H
- module_param(ccnt, int, S_IRUGO);
复制代码
+ w# h4 ^) v7 v8 I4 Q( P, z. i/ f% U( X8 W. |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 |( H! H+ I' H9 s. n0 U1 l9 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 v" j& |; B+ w1 z9 d; O, L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; _8 Q3 S: R' l) O, ?2 k
2 J: y" m/ x' l! M8 V% P8 F! [/ c$ u" U% c- d9 T
|
|