|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" Q) L- a& V- |" _* A7 o }- [code]EDMA sample test application
- |* m$ d& w, I" k% W - /*7 v% y2 m8 Y0 b+ K
- * edma_test.c& ]) ?* X v o, K* E
- *
, M; V& J1 i# v( |! @ - * brief EDMA3 Test Application% ~, Q& c; W7 c# c( W: ]9 s& ^1 b* s( f5 t
- *9 v$ z& U4 v9 t7 i
- * This file contains EDMA3 Test code.
& T O5 o) a4 X3 v - *
! |+ j0 c" f; k; P4 l$ A1 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 I5 V; k B* {& \! G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" D! Q; C/ H; Z+ f6 l5 o; ` - * TO CHANGE.' y" Z! K2 s/ T3 ^$ g o
- *
. p6 Q/ _3 c5 m& ?) M$ r# E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, Z: I, h9 M' t o0 a1 D - *% l6 K* O( |/ ~
- * This program is free software; you can redistribute it and/or
" E/ L: y! e8 ?9 @6 F& g - * modify it under the terms of the GNU General Public License as
1 m$ t g' e0 x4 _ - * published by the Free Software Foundation version 2.
J# w7 V n7 ~ [& V4 t - *5 n' { y& \% y( X" P6 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* a) b1 k" ?& y! W5 K# J/ R" K
- * kind, whether express or implied; without even the implied warranty
/ k- _; G* I) g5 I' E+ \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 M% T4 C, E2 ~/ F9 [9 z* i5 W - * GNU General Public License for more details., F7 e5 M- P' R/ g2 H. O
- */
. ?$ L( m$ b& G, [% I [$ c5 J - ( j! A1 }$ [ ?& X" y; e
- #include <linux/module.h>$ U( [# E; L1 ~& U9 q
- #include <linux/init.h>8 x! Q8 T1 w. w& P e5 S7 T G5 p
- #include <linux/errno.h>
a# V% l. Y3 ]% e - #include <linux/types.h>
0 J. E6 R* b# j& W) J9 ~( b. R7 X - #include <linux/interrupt.h>
+ d c$ B% Q) |; f - #include <asm/io.h>% M+ e3 O, X1 M
- #include <linux/moduleparam.h>4 l ^0 {" n0 L, K5 L" ?0 b( n
- #include <linux/sysctl.h>
6 Z G# A& B0 D; Y - #include <linux/mm.h>
2 A% s! v3 W0 \2 e' m* F - #include <linux/dma-mapping.h>
% L: c0 o9 [( i& v7 z - 7 \, T, k2 ~( n; m
- #include <mach/memory.h>
, S) G6 j& g! ^$ }! H! r- j) z - #include <mach/hardware.h>
5 G/ p2 {. E) }$ `" h n/ x# J - #include <mach/irqs.h>
. x% ]8 h. h. K; |; B - #include <asm/hardware/edma.h>+ G: z2 {. O/ J! r7 l8 Y s! U
6 ~- L2 n: U, S- #undef EDMA3_DEBUG9 g$ w* |2 ~. c) C% d( C
- /*#define EDMA3_DEBUG*/) o0 w) r# S2 K
* z4 `! q- }8 n e- #ifdef EDMA3_DEBUG8 A% Q3 c/ @& r2 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& I$ X e! H: u3 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 t$ d `. t; o& F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) x1 j/ I7 i! [4 ~
- #else
% q( p6 R0 o9 O @: ]( C9 d - #define DMA_PRINTK( x... ), f2 W. k$ A7 `2 \
- #define DMA_FN_IN. D. u3 l! A/ C/ b* u
- #define DMA_FN_OUT
/ Z7 W. T: o9 L, x0 @ ] - #endif
3 C+ o) T" F# K
! V( t/ S) [1 R5 U; y- #define MAX_DMA_TRANSFER_IN_BYTES (32768), \% R! w. u" d) g
- #define STATIC_SHIFT 3
+ Z9 `2 x* Y7 T" O - #define TCINTEN_SHIFT 20$ T% m, }6 }8 O. L" Z t; q' q/ |. z; j& U
- #define ITCINTEN_SHIFT 21
" U0 [( T2 h& g( K - #define TCCHEN_SHIFT 220 s# x& S; e3 ?& F/ f- a
- #define ITCCHEN_SHIFT 23( k- n# ^+ N O8 d# m
- $ h! M( M6 x6 L/ ]2 Z" m& k' K
- static volatile int irqraised1 = 0; P3 b; e3 Q7 t7 E% S# K
- static volatile int irqraised2 = 0;
. M& e4 R0 l5 w6 n
6 I8 R) y+ Z: a; m" i2 m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f9 t' ?" `/ r' z6 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u( {1 |6 ~- J3 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 o/ y: q) h7 k8 Y - 3 _& O0 J7 g" f8 N5 }4 E$ S* t
- dma_addr_t dmaphyssrc1 = 0;! ~$ U. P) P% \+ m2 p
- dma_addr_t dmaphyssrc2 = 0;1 e$ N# ~. T& s/ x2 @$ j' z% s4 Q
- dma_addr_t dmaphysdest1 = 0;* }/ n' Z/ q. S
- dma_addr_t dmaphysdest2 = 0;1 ?& j' r8 K+ b L4 @& i
- 3 R) v- _7 c1 B9 H& k
- char *dmabufsrc1 = NULL;7 b; l" n. K: [/ P7 L; U! D
- char *dmabufsrc2 = NULL;
+ m2 W7 ~$ U1 J' t3 L3 b - char *dmabufdest1 = NULL;. l) R# R' N$ e& h9 \
- char *dmabufdest2 = NULL;
7 H, z% c$ H/ ]1 V: T3 J/ I: L8 J
: f, T% l4 f. Q l& B- static int acnt = 512;
( j+ W" J% e& _ - static int bcnt = 8;
; E+ v& g/ n) E [; c$ i! H - static int ccnt = 8;5 Z6 E4 k5 @7 s9 Z9 S
- ( D' n" ^$ m% ^! V1 F+ H0 y. K& k
- module_param(acnt, int, S_IRUGO);
. Z0 \0 |. J: r Y7 [ - module_param(bcnt, int, S_IRUGO);/ B% v- D3 B( g# j# g1 u; |
- module_param(ccnt, int, S_IRUGO);
复制代码 5 W' P- Y( Q! Z7 I7 V# C
7 ]) Z2 E% J3 j& i! P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) s. t" ~* D/ ?. h% @- }4 ~% H& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Z1 h2 F/ `# e3 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 b; x3 Z1 ~, ?/ X
$ c1 U1 l* E1 N6 g! y2 Q6 H5 y- \. f8 y0 G! J# M/ `
|
|