|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ^! R0 k" u- p/ F2 }
- [code]EDMA sample test application( W. d" m0 ]9 S2 m( ^
- /*
) S/ @* i/ v! v - * edma_test.c5 K0 L2 V5 J+ G0 D
- *
& m( ]% C5 y' z9 R c; Y. P# _2 G# v - * brief EDMA3 Test Application1 S. ]. O/ M. R1 v8 T. D
- *, I0 B+ |; J2 ?3 `5 z8 H; ~, \4 q% X
- * This file contains EDMA3 Test code.
& I. v7 x0 D( \. G - *. x( b. h; T i3 ]! U, L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% t4 l& R2 c8 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ G" R# o' [9 A; w - * TO CHANGE.; a4 [8 X& u [+ [4 W
- *
3 X) \* X( A+ {, ]# ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f2 }5 ?" H1 q4 a' P8 t3 a5 i
- *
) } m# t3 d: ^* V1 i' F - * This program is free software; you can redistribute it and/or
" i# I% `1 X" l$ s* x - * modify it under the terms of the GNU General Public License as
0 x3 h( C: y9 B9 |" b - * published by the Free Software Foundation version 2.0 Y% N' g( }% [) `- z7 Q0 a( z
- *
0 D. x$ a+ y1 }" z: g4 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- W2 R; w6 O( g - * kind, whether express or implied; without even the implied warranty, u6 Q8 K/ X5 K6 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 n6 z' i: I( v* ]* ` - * GNU General Public License for more details.
( U3 e, m$ q1 f- F0 W3 @ - */
' l5 b4 Y1 k8 A' q$ k' | - ) g5 e- T9 o1 o! U% @
- #include <linux/module.h>6 v# U5 M" |3 a" A7 n0 v [
- #include <linux/init.h>0 H& y4 t8 a5 |" J5 M: ]
- #include <linux/errno.h>" {6 u( o8 w2 A# _. [) P
- #include <linux/types.h>% Q, X! i, a7 K. A- ?; _- R2 t: G) S
- #include <linux/interrupt.h>( Q/ J: c3 x+ F4 m
- #include <asm/io.h>- x8 k) f6 g) t" A0 f) R8 f
- #include <linux/moduleparam.h>
^4 V( p0 l" h) n5 o5 U - #include <linux/sysctl.h>- Z9 P7 K" `0 t+ g. q( X% m
- #include <linux/mm.h>
! B$ Q( M% p( J2 ^8 Y - #include <linux/dma-mapping.h>
" w/ ]! w' R. d' a0 j6 g4 J - 2 ]# Z/ H6 R3 z8 K
- #include <mach/memory.h>/ g& Y$ w$ @+ R7 a* W/ x
- #include <mach/hardware.h>* v; ^; {3 T2 m2 B& L
- #include <mach/irqs.h>
# D, e( u# z. y! ~ - #include <asm/hardware/edma.h>) Q# L0 z; I& c
- + Q+ o- \/ E' L/ G& A' s- C6 h; j
- #undef EDMA3_DEBUG
) H9 d5 q* }$ _" T: j F7 v9 q - /*#define EDMA3_DEBUG*/
1 M" j, ^0 ^/ B" O' o5 e ^8 N - , ^% F- }, ]/ D; _9 ~& S: B
- #ifdef EDMA3_DEBUG3 v3 `( ^+ b+ N( j* }4 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' A. |) [& b) j/ s- H: u. q& F1 ^& r5 x" {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ h3 A; ~, o4 h4 A; _0 |9 K6 u2 O7 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 N' B' I. L3 U - #else
' T9 Q& E i7 k4 G y) R$ D9 }4 h - #define DMA_PRINTK( x... )6 ?5 ^! W$ a8 v- J, e2 H
- #define DMA_FN_IN
( r w# i; n9 q6 x) W( E A5 U - #define DMA_FN_OUT: [9 [( c* x" C {
- #endif
6 @3 D% l2 S! j5 S3 }- g
, i, z3 Z5 a0 [" v7 h" s6 s- D5 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# h, y# ?7 d( }1 G$ V
- #define STATIC_SHIFT 3# P" Y9 @ q% K& `9 ~
- #define TCINTEN_SHIFT 20
# k- N- y% @0 ]7 w, G: S - #define ITCINTEN_SHIFT 210 `: H6 p2 g# R2 X: x, N) C
- #define TCCHEN_SHIFT 22
5 e) [% H# f" k# `, A' D5 Q1 \" W; c - #define ITCCHEN_SHIFT 23
( G* {! }$ v2 q' E
6 P- a; S- x" Y+ y% k" w C: d- static volatile int irqraised1 = 0;
1 p8 j+ R# Z" j! k% V - static volatile int irqraised2 = 0;
8 p& T( @+ h6 {3 F# _7 n0 K2 g - , Y J1 }7 L A5 K* m6 t* o. \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Z( z0 J9 c: j" m, G% U. X3 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; a5 e! k3 L, P C3 `# p$ O2 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u7 j* y: B, F: Y! a' \/ f
- 4 h7 ?" x* U \0 k' n3 |0 }* e+ x
- dma_addr_t dmaphyssrc1 = 0;
5 q* T, x4 h# {2 T. _ - dma_addr_t dmaphyssrc2 = 0;8 Y2 x3 q: s) [! C2 v' x
- dma_addr_t dmaphysdest1 = 0;- g3 E! h( W5 a! p1 v& i
- dma_addr_t dmaphysdest2 = 0;8 J# w7 I1 ~, K! ^1 T2 j3 O1 l
! }: Q! l( E, m, C8 z* r& \- char *dmabufsrc1 = NULL;) m ?4 E9 h' H4 E7 N% m3 P
- char *dmabufsrc2 = NULL;
/ q2 g9 [- c2 C" E, f4 } - char *dmabufdest1 = NULL;
5 i, D( j, ?7 J - char *dmabufdest2 = NULL;
0 p, w( v* B( A% f6 k
. W. K! f; J7 |$ }1 K- static int acnt = 512;
; p* m: ?4 |/ X - static int bcnt = 8;
- S5 r/ S& {; _+ M$ s6 Q. p) B# b - static int ccnt = 8;
, G1 J( S+ _* H6 r# [: H
+ z( X8 X3 D, H- module_param(acnt, int, S_IRUGO);5 U4 a, K/ B7 L) @5 b% \; ?! l1 d
- module_param(bcnt, int, S_IRUGO);: t& [2 J! U. w9 d: m% X0 x4 _- G/ `; r
- module_param(ccnt, int, S_IRUGO);
复制代码 . y: i8 t) |) \& U' @
0 Q8 \7 M( k H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% l3 P3 P) s/ J7 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, ^" |- y; K a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L) M1 J1 e* {8 r3 A9 F. p
% B4 r3 v w) T; Y( Y9 T
6 v4 J* W' W: v( }, l+ e$ N |
|