|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, E& l' Y, p& l0 H/ Q3 c- [code]EDMA sample test application$ ^ P5 S" i5 c5 D' N8 E D' \
- /*
1 D8 c, f% ?- Q: U: C& H2 Q - * edma_test.c
- H* q2 }0 H0 z( i* j9 n8 J0 G, ?& [) _% O - *
/ G% b3 f* G, I) w4 V( l; e - * brief EDMA3 Test Application: O) t( f7 j$ o' E: {! F. C
- *
& t! L$ ^1 d) e3 q+ ~" b1 R - * This file contains EDMA3 Test code.' m3 |0 `+ f+ x, _' w
- *" J7 A3 L% a' O# A z) f. `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% N& z( E" x) H: N/ H3 S( F2 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Y6 z5 O7 n7 d0 ~# e
- * TO CHANGE." Z1 Y) @& s" H
- *
6 e6 |# `; X( ~" o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ v/ M( J9 ]+ U! V8 A$ f" C6 i8 t - *
8 a7 I" Z1 `' ~$ D" I- ? - * This program is free software; you can redistribute it and/or9 u8 H& w6 o0 `. ~ `
- * modify it under the terms of the GNU General Public License as
3 X; ]* N. X! d& r9 \) P8 b - * published by the Free Software Foundation version 2.
5 L: L/ c6 t/ ?# S6 w) n% [. y - *
6 D3 x! B- P: F" N5 ~; M% a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! O- |, G" Y! b) `6 |9 n& i, U
- * kind, whether express or implied; without even the implied warranty# F2 {* I, z1 ^. c6 p0 C1 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, o& ^# Q2 m" D- Q7 T. a
- * GNU General Public License for more details.9 G8 P9 `: r7 [$ x
- */9 v" N% r+ Z+ N: V: ~1 |0 i
- - c* u) Z8 G8 |4 l
- #include <linux/module.h>
1 O' m* O, K; p - #include <linux/init.h>" \7 @. i( s0 D% U
- #include <linux/errno.h>
# [# N% `: ~6 D- c - #include <linux/types.h>; @( B- N. V; E
- #include <linux/interrupt.h>3 C6 |; G8 z) V0 y: n& w
- #include <asm/io.h>
6 C3 ?9 g$ e7 c; I( L% r - #include <linux/moduleparam.h>
, l, E( r; h4 R# D) _: p; \ - #include <linux/sysctl.h>
: [3 {& v$ A2 ^: \4 D/ s - #include <linux/mm.h>
& `" @" a$ S4 B: W - #include <linux/dma-mapping.h>5 c1 H: Y: C4 _! k2 z. u
- 8 T/ E8 _5 j% u( {. ] r& ~$ i
- #include <mach/memory.h>
9 j' n: I+ |6 j: F. l% H2 ^ - #include <mach/hardware.h>5 z, u0 z6 q, z4 o( Q5 j
- #include <mach/irqs.h>* z- D2 Q' i* J) ^, N! C& |8 @
- #include <asm/hardware/edma.h>! O- ~2 r! q5 J: J
/ z) O( D" L, c- m' ~7 P$ \- #undef EDMA3_DEBUG
* j3 f4 w `) r% g0 [ - /*#define EDMA3_DEBUG*/
4 g) g7 Y9 ]2 v! y; y - S6 {% L' d0 H$ [5 u/ r
- #ifdef EDMA3_DEBUG7 A) X' t* c% J0 b* c) M8 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 g3 S, g! \: I% _" e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; A: X& }8 q: z% }7 V% C* e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% [3 x* B3 z, n - #else
& ~- m( t5 H! A* {- H - #define DMA_PRINTK( x... ). R5 ?3 R' M3 m. E8 ~3 b
- #define DMA_FN_IN
" u# Y6 T# }3 x/ T9 j - #define DMA_FN_OUT
1 C$ D2 O0 k0 ~; t/ Z6 D4 ~ - #endif
6 U6 a0 G( s, c u, X9 q1 ?- y - 5 C( T$ p+ ?6 V$ J2 P% r2 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, ?5 }7 b' ?; ^ m/ X - #define STATIC_SHIFT 3. r! s- ^4 w; V8 Q
- #define TCINTEN_SHIFT 20. n% ]: Z2 y' i+ k$ k& M9 n: V/ ]2 J
- #define ITCINTEN_SHIFT 21* G, P0 {3 _9 M, a# h% H/ k
- #define TCCHEN_SHIFT 22
5 Z% |3 q( I4 i9 b - #define ITCCHEN_SHIFT 23" H$ k+ G: @/ n8 h( O
, r; j6 S& P5 r" }7 i" j' b- static volatile int irqraised1 = 0;& M8 F# C9 U2 ?
- static volatile int irqraised2 = 0;) k: i" Q* y$ f' V( J) o2 G( @( R2 d
8 {. X; f8 s3 W7 J5 h! w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O2 G1 g1 V, c# z9 R3 D6 p6 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ?6 f- S# W! z. y8 B3 @& M) z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 I4 ]% ]0 i( O- h0 r P, l
C8 w0 d: P" {4 j- dma_addr_t dmaphyssrc1 = 0;
& ?' L, k6 C7 w, L( [2 G3 ?) i9 g/ s - dma_addr_t dmaphyssrc2 = 0;
/ v" s% H1 e0 {- m3 b: ` - dma_addr_t dmaphysdest1 = 0;
4 L' W% h& d9 K: x; @ - dma_addr_t dmaphysdest2 = 0;2 p/ _- j/ m6 a) l& a
* N5 n4 }: C% J0 B+ ~# x+ r, C# q) v- char *dmabufsrc1 = NULL;' n) a% I0 U/ M) U
- char *dmabufsrc2 = NULL;
: I8 ~6 r0 ]% u Z y - char *dmabufdest1 = NULL;, g& k8 n2 c c) n2 R
- char *dmabufdest2 = NULL;8 e) _% H6 a4 U! _
; o1 @) t( P5 d- o0 t$ j- static int acnt = 512;1 Z8 w- N0 } ~+ A2 F; N
- static int bcnt = 8;5 O2 s% E; S* a2 P, Z" f
- static int ccnt = 8;
' L7 l" F. M0 c - ' _% c2 y( a8 L: m) o) T% Y
- module_param(acnt, int, S_IRUGO);
# ?2 X( D4 M+ ? k6 g8 j& \. ? - module_param(bcnt, int, S_IRUGO);
4 A: _$ z, F" Z - module_param(ccnt, int, S_IRUGO);
复制代码 4 x( Q3 z0 G' e
( ~3 E& r% ^. q- Z# r( @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 A8 I0 K5 O" b: P6 C Barm-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) z' G& \$ M# F$ d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 z: F i) z! j1 a2 w- d: I5 \
- _& A; R! ~! Z* O* c
( F5 n6 p* J$ s0 J: s1 S# U |
|