|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# a; @3 ]1 E7 v9 k0 v- [code]EDMA sample test application6 a; y% S5 A% S& j) W% D
- /*
+ p S8 o, @5 @% ~) M - * edma_test.c1 [ L7 t5 O! Q1 Z" R
- *7 `% I3 p4 r" r' l# U" T( k/ z& c& e
- * brief EDMA3 Test Application
, r! N; z* a5 | V; z2 ~3 m - *
9 b, ^3 C. E) C" V - * This file contains EDMA3 Test code.
' _9 A" a) }5 a& {; @ - *5 ]- c& ]; [* T* `8 S# P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 x9 W2 Z9 r4 q6 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& x( f5 ?4 B: R; i8 D' d7 K5 p
- * TO CHANGE.
/ y( h/ Q' ~4 m6 z - *9 ]/ v8 [/ J7 v' J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ j; C" x% K7 N- D, e6 N - *0 g7 ?( D2 l, L* S* [; F
- * This program is free software; you can redistribute it and/or6 s1 h* s1 u: h. y( A
- * modify it under the terms of the GNU General Public License as
2 ]+ ^+ A; ?' O: [) N$ F - * published by the Free Software Foundation version 2.
8 M' w+ ~4 f ?; H5 T9 ]! V" C - *
. P- f3 ^7 b4 U! E# g6 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 [1 ?- \ U$ D0 d* H - * kind, whether express or implied; without even the implied warranty& M2 V M1 [* p: ?6 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& x9 K$ q P8 ~9 j2 r* ~7 |, S - * GNU General Public License for more details." ~% G$ ~; M4 L' c1 W
- */5 {7 E/ g- Z% W' i) s9 H( o
- 6 b2 n. @ C- F; i0 P) Z
- #include <linux/module.h>! ?0 D& U" O N" K: B( X
- #include <linux/init.h>
, ~5 A( {, d; _8 d. i! `+ e - #include <linux/errno.h>
+ Q6 J: S- G5 W! K5 P7 g% b+ M - #include <linux/types.h>
0 p3 y' j. y1 r( ~ - #include <linux/interrupt.h>
! c2 N! H% z9 W$ a0 Q8 ` - #include <asm/io.h>
+ S5 h8 ]$ \9 ], c5 ~6 J- S! _ - #include <linux/moduleparam.h>
$ b0 r/ ^) T, K6 n( W - #include <linux/sysctl.h>
' s+ E+ v9 L6 V - #include <linux/mm.h>7 f* g* X% f9 z2 q" Y2 s' N
- #include <linux/dma-mapping.h>0 |3 C1 c0 z b
& r ?0 G. v& f6 {5 {5 n- #include <mach/memory.h>6 a1 ^* l1 l6 F$ P% h- f
- #include <mach/hardware.h> o3 e/ L9 R' M, E& l5 m
- #include <mach/irqs.h>, e' X, M# e% A1 o
- #include <asm/hardware/edma.h># F/ r/ N2 v* j8 X
3 }" r. @( A+ x, Y! X' p- #undef EDMA3_DEBUG& n4 C$ t! @2 K# A2 |
- /*#define EDMA3_DEBUG*/8 V" c; z/ C9 x0 s# H
* m1 b. F' U+ y! H- #ifdef EDMA3_DEBUG4 P x! L) w/ [$ X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ Q5 l/ K& y2 {4 m3 M2 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" S3 A: \7 i" z! Y& S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- v, V8 C4 K1 ]1 ~) h2 p2 x" n - #else6 G2 `- ^. Z1 i+ x( d7 C0 ?
- #define DMA_PRINTK( x... )
: w3 _( s) V) s/ G- Y7 q - #define DMA_FN_IN5 }0 n0 d5 N1 b
- #define DMA_FN_OUT
0 a2 Y# ~* R4 F) n8 m1 s - #endif
& Z, P) c/ E9 v. d8 v
: [5 m1 S& u. u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; ]( X$ Q8 x4 s' k3 l - #define STATIC_SHIFT 3% T: ]' Z% X3 m- b) {) B. |
- #define TCINTEN_SHIFT 209 {3 X2 ^1 E) j. P
- #define ITCINTEN_SHIFT 21. R+ H% d8 c* J. K' v+ |) Z
- #define TCCHEN_SHIFT 22' L$ R2 D8 _( x
- #define ITCCHEN_SHIFT 23
6 @% s) d& Q! C0 @4 D
% x! B& U3 ?- a: g6 `- static volatile int irqraised1 = 0;
7 l; p- u' d5 {- K+ a& N! w% _ - static volatile int irqraised2 = 0;
+ W& G+ i0 n8 z/ b+ Q - 3 K" j$ X8 {2 X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: _9 H+ O. V: k; i% H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! I& i F. H! f+ l# A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 R& K# [( t/ C! n) S/ I) b! |* L) {
' F: Z% q/ ^- T) m2 Q- dma_addr_t dmaphyssrc1 = 0;
1 w& j7 N# V) @: C - dma_addr_t dmaphyssrc2 = 0;) [- P! q' o$ G* [' h* {3 S
- dma_addr_t dmaphysdest1 = 0;0 a8 @/ w- Q7 w# F' T& t- J
- dma_addr_t dmaphysdest2 = 0;
, C( B" Y: w: N% ^) R
: \# l5 P/ R0 N3 Q- char *dmabufsrc1 = NULL;
/ ^6 K3 w: t) R3 Q- S0 J8 I - char *dmabufsrc2 = NULL;* ^, u5 S9 n+ y8 ^1 T' R O
- char *dmabufdest1 = NULL;& y2 X, O9 a' V" x6 H5 X3 }
- char *dmabufdest2 = NULL;
" l2 _& P3 z9 C6 j8 W( |
' z" v5 h9 w2 @- static int acnt = 512;
9 h/ d; e8 z% \8 E - static int bcnt = 8;0 a% h; b: E J" B0 C
- static int ccnt = 8;
4 @7 \0 X4 i; p& G0 h
6 j5 D# l6 L+ v- module_param(acnt, int, S_IRUGO);
" |! r0 A: f! p( h# }* [ - module_param(bcnt, int, S_IRUGO);7 V6 i, s- l' s. O
- module_param(ccnt, int, S_IRUGO);
复制代码
. o4 r( N! N4 ?/ L; S) R4 u. x4 \
0 H9 s3 H) Y# P" A6 s$ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
f5 b3 k1 o- H$ r5 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* n- x' m& |# l* m4 D, i$ o4 V+ [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. z- @7 a% I8 r3 P3 d
; P+ e% |( F& H+ }6 Z6 q
/ O1 \( J6 b: z |
|