|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b% @" v2 e% x
- [code]EDMA sample test application
3 z+ j7 k( T; ]6 A" G& ^1 N - /*
8 A) {- m- ]# D4 b( h2 r - * edma_test.c% i5 w4 {7 |7 W% n) a, ?: A* v
- *4 d% Q# _( }% N6 T) ^9 j
- * brief EDMA3 Test Application
1 t8 g: J! i2 O# H9 m - *
! e K* \7 I; f* i# s9 g; B. M - * This file contains EDMA3 Test code.( v- | ]* u$ P
- *
: y$ x" e; C9 Q' E% I0 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ^$ T/ R2 u# n, I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& H: g- J: B- I/ {' b - * TO CHANGE.$ g$ ?& v# `6 K+ g* L/ u
- *
4 t' r% Q/ q, ~* I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, L, Z* }& ]' i
- *: {* S) N7 c( n6 `$ D( N5 A0 M
- * This program is free software; you can redistribute it and/or) s8 E4 s+ O3 e5 G1 t+ t3 R
- * modify it under the terms of the GNU General Public License as
7 `4 a* o ]5 i9 W5 c# C - * published by the Free Software Foundation version 2.
- B) ]' r# v3 N+ o - *
( z" p3 \! V+ M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% {- k3 x6 O8 X! [4 ` - * kind, whether express or implied; without even the implied warranty6 |0 p3 R! y* m7 }3 h) t. f0 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 I- ~: ?5 V1 U0 w( y: L# I
- * GNU General Public License for more details.
1 Z1 W" T1 _' f) Y$ t. l - */
! s8 B9 B/ }: j t
1 \# t% l4 q$ f- #include <linux/module.h>% x, ~+ Q$ T4 s' d3 T
- #include <linux/init.h>
+ Z+ m' D. G# {% Y - #include <linux/errno.h>9 ^4 _1 x6 W: w6 f: X
- #include <linux/types.h>6 Q* A0 o- P5 ?: F1 c
- #include <linux/interrupt.h>( J$ {+ F6 p3 K$ p; I1 W/ \$ t( r1 ~
- #include <asm/io.h>; c5 L, x K' M' t( i. [8 r
- #include <linux/moduleparam.h>; Z4 B/ @3 ^% H
- #include <linux/sysctl.h>! c0 @ _: g# w. @2 t
- #include <linux/mm.h>
! B( G' z& L0 G4 k3 K - #include <linux/dma-mapping.h>4 ^1 [+ S0 d0 g" p5 @+ G
' n2 A8 y4 e: D" ~! N7 b- #include <mach/memory.h>
5 E: E0 ]* `+ F5 r - #include <mach/hardware.h>$ B5 r& l/ {% k8 r- b0 V2 ?
- #include <mach/irqs.h>
5 X7 N9 U& u# n) ?5 N, j! \. b; ? - #include <asm/hardware/edma.h>
0 E+ {) r* C% J, l
+ U% M2 A: Z6 y: b3 }3 @- #undef EDMA3_DEBUG
; C @$ ^( ~$ T9 R - /*#define EDMA3_DEBUG*/
# h# ?' F$ q7 Y" h, Z
9 ?/ l3 w+ O: L- q- #ifdef EDMA3_DEBUG
" W2 \' x* k8 e# Z0 B- N: D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): {* [; x* _" j% }! t: |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): |- \8 O5 c6 J2 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) {) x- K( Y+ O2 y2 Q2 F5 B/ Y# @
- #else
7 i$ ^1 X6 B. V8 _. I - #define DMA_PRINTK( x... )! V$ J9 m" Q9 A+ G+ s7 G
- #define DMA_FN_IN" T( F `5 h* Z: s
- #define DMA_FN_OUT
. [: J/ W. F+ N: {: m7 N - #endif
) o) N7 @5 l1 w# L- d - 3 X) L& v1 j0 x1 Y7 W" t+ Z% x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); P- U7 \% p5 L
- #define STATIC_SHIFT 37 U; l. V- z8 |) ]: s
- #define TCINTEN_SHIFT 20* Y( H9 m6 s7 j
- #define ITCINTEN_SHIFT 21- ~6 P# r' g! X/ r- h3 `" ?' m
- #define TCCHEN_SHIFT 22 W: R9 @ U; p& I7 V
- #define ITCCHEN_SHIFT 23
; {6 r! q' b( [; d; y/ z3 k; Z% ^/ ~( R
: h, H1 n$ P& W" W8 e. {- static volatile int irqraised1 = 0;
. Q7 F2 \- j5 ]& o$ k" c& A - static volatile int irqraised2 = 0;9 z& W, V f, p
- 9 {+ a x) S3 m8 k6 w1 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 g9 B }6 w/ d* l( U2 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( w A3 g. e- h$ Z! T( j" z, p: G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ~. ^5 S' L, }% l
- : k, a8 {; |7 R w* Q
- dma_addr_t dmaphyssrc1 = 0;5 d8 C2 l' q- d% _/ I; E: |0 x! Q, h* P
- dma_addr_t dmaphyssrc2 = 0;
: X" E. X/ s1 A& m! ?8 z' p( t( Q* W - dma_addr_t dmaphysdest1 = 0;
. s# ^/ ~) I/ {* B - dma_addr_t dmaphysdest2 = 0;, x8 p5 x2 Y, N" t% h6 `1 G
- 1 o( t3 W- O3 }# t) W3 [
- char *dmabufsrc1 = NULL;2 @) Y. c3 o/ O8 x
- char *dmabufsrc2 = NULL;6 e/ D; d- |2 p
- char *dmabufdest1 = NULL;
5 I0 {$ o* n$ P# r) b - char *dmabufdest2 = NULL;* a$ X B' S+ c8 ?; }5 O
- ; i+ U6 C% O( i& x0 Y% S4 d1 s
- static int acnt = 512;
2 g8 C+ M% v8 B$ T V* w - static int bcnt = 8;+ a9 J8 W! N- m
- static int ccnt = 8;) ^8 \6 O& b/ a2 @ m; B5 a" t
- 0 j6 t" S h4 h( H3 n. g3 Y
- module_param(acnt, int, S_IRUGO);+ g% p( O2 n$ ~7 F6 c X9 ?# H
- module_param(bcnt, int, S_IRUGO);
. ^# \: O5 K1 Z% r' X0 e - module_param(ccnt, int, S_IRUGO);
复制代码
' v4 o) k4 t+ z3 z8 f1 T! k6 Z
J9 T+ {6 M/ G% n5 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- H. U, i8 p8 ?) [( p% p
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' w; L% t2 N5 Y8 J1 T2 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Q3 x; K* M2 v
b( x" H2 L4 v' }* w+ q
( w, h& t7 F0 c) ~. N9 u/ @8 _ |
|