|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; _" [" g: u5 c" t9 o0 u
- [code]EDMA sample test application
7 B3 x( m! p4 I/ {% f - /*( d# k- Z( D1 r) n U! I" F
- * edma_test.c' `, ?4 x( k; X& L4 H; c
- *4 W: M3 Y3 Z& ~& E; D
- * brief EDMA3 Test Application( s0 e. U' P' Q* C5 u
- *2 f& T" e# b, O% {6 D) U+ {
- * This file contains EDMA3 Test code.
* E' h/ f* }$ T4 s - *
" B# H0 C+ @; A( i& D- P- F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- \$ H+ a4 A7 ?3 b1 V) b6 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 y! Y+ _# E7 c3 P
- * TO CHANGE.6 q/ N& f/ P( z0 [9 ^& q: p; [
- *
; R8 o _; V$ r4 w' X a& l# l9 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% E3 e- Q. t/ F! y) Z4 R
- *
7 o6 V8 S) z- D2 q% Y# R - * This program is free software; you can redistribute it and/or( j( V0 m3 K+ p4 \3 m: ?
- * modify it under the terms of the GNU General Public License as
+ n3 o- Q# C) Q- w6 {' v; i' A) Z - * published by the Free Software Foundation version 2.
% N; j. J, x1 E; r - *
& U7 z* {4 Z( ]! L6 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 ~6 B9 L y @" T% } - * kind, whether express or implied; without even the implied warranty
5 s' W) ]0 I; }1 v5 N4 `" T' Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ o6 V# }) U- e; S
- * GNU General Public License for more details.8 S! o" S/ Y) k4 j, T
- */
- l( j$ A- k- N: Z4 }% B - 3 n) O+ N. h- U9 m8 c/ e$ E
- #include <linux/module.h>
7 a! }8 g! m+ H3 @" I - #include <linux/init.h>0 X9 d2 F9 _5 X
- #include <linux/errno.h>
# N1 m. U9 f- d, V - #include <linux/types.h>
1 t4 L; b# C+ w1 S) B( b" g - #include <linux/interrupt.h>9 D& Q1 t- `1 L( Q0 U7 G' A
- #include <asm/io.h>
& A& ~+ w" g3 v2 [ i, O2 P - #include <linux/moduleparam.h>, |: G; _6 r9 ?( Q" q* r1 `
- #include <linux/sysctl.h>$ g: k: w" O! A4 u1 r
- #include <linux/mm.h>
4 D, w1 |3 F8 v6 C - #include <linux/dma-mapping.h>
8 x6 x# L: e2 F1 l y: X - + R; V! G1 M/ y& u% p1 A
- #include <mach/memory.h>( H; R+ J) _9 U
- #include <mach/hardware.h>
1 R% {( y1 |# o6 f; `" l( J: Y& v - #include <mach/irqs.h>
( j5 G$ q o7 K8 Z! n - #include <asm/hardware/edma.h>
7 c+ [+ u! a! `7 N- ?& l. T1 t
% {6 V: L+ ?$ U- #undef EDMA3_DEBUG
, k: |5 _5 f3 Q, D+ I1 B- `3 t/ ] - /*#define EDMA3_DEBUG*/
. ^+ v/ m0 H q0 W
' n4 B) d9 I3 _. Z' D" a0 V- #ifdef EDMA3_DEBUG
( r: o2 s* r# j2 q" U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 F* P8 `; `0 Z0 \- [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 Z( T: W# Y+ ^0 B5 ~; W& F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 O, e8 `7 d' p/ z2 N4 V
- #else
( H$ x- K+ S6 B! } - #define DMA_PRINTK( x... )
) R; f- ?* X7 J6 n9 |0 c - #define DMA_FN_IN: e% \+ B7 w% g6 ]
- #define DMA_FN_OUT* x7 K$ F% h* `; a* Z) g$ F
- #endif3 I# q9 _* l8 Q- I: B
- - i9 y! h7 {/ H# ~9 Y2 @' x: Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ ~7 X) t1 f. j8 {, L( C - #define STATIC_SHIFT 3 u: c, W' I; B. j3 ~
- #define TCINTEN_SHIFT 20
" ]6 ]' W; r3 Y) z( J4 ]2 q) F* E - #define ITCINTEN_SHIFT 21
7 N. t7 V$ N6 w6 x) }" Z - #define TCCHEN_SHIFT 22
6 M- l2 ] L4 S! j# ?+ w - #define ITCCHEN_SHIFT 23
% I: a+ U/ ]2 z. ^) T/ | - ; n U m$ y' p
- static volatile int irqraised1 = 0;' |5 ?# f) O" W' | i
- static volatile int irqraised2 = 0;
/ [5 @5 ^$ I4 C- k5 B" B! t/ W - . J+ a" A# [7 |- [( [, T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 K" L$ a* U% n8 p& v, c0 r3 e) | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T; r: @9 ^2 x- G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Z/ j2 C) ]) X, X' F' o, E: x" t& Z
0 p4 u3 F+ b, m7 Q6 H$ x: `# D- dma_addr_t dmaphyssrc1 = 0;
O3 Z3 N3 h1 o. L: @3 ` - dma_addr_t dmaphyssrc2 = 0;
: [4 W3 {- C# z* ~! A8 Z - dma_addr_t dmaphysdest1 = 0;
- z0 _; A5 Z4 m- G9 i. ` - dma_addr_t dmaphysdest2 = 0;4 O! B# k6 I O& {
& s( R2 ?/ g" n( r" k' r. W- char *dmabufsrc1 = NULL;: ]+ P" P+ X7 g1 s+ u! A& H
- char *dmabufsrc2 = NULL;8 u" A! o7 Q& f+ x
- char *dmabufdest1 = NULL;' `* ^" C+ [! C8 Q
- char *dmabufdest2 = NULL;) l6 T r) p) i# b( o
6 j* x( ~7 v& m8 N; y) U7 T- static int acnt = 512;
* u' R9 A( P! m& h6 y8 J - static int bcnt = 8;
' {5 K. L2 c! D2 F9 T3 E - static int ccnt = 8;( K: L! H$ b8 |
2 U( ]. j0 T( c5 G9 l* J: [ Q- module_param(acnt, int, S_IRUGO);- O+ \) {- m5 `: |) \. \
- module_param(bcnt, int, S_IRUGO);- U* J5 a/ F: \3 t( {- j
- module_param(ccnt, int, S_IRUGO);
复制代码
' F+ f/ R5 L* d U' B8 d
! \6 K9 w* j/ a0 G9 b5 {# V+ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Y9 m5 R3 h1 t& t8 s) A/ C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 o5 G( Y, |! |, L( e2 s6 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& n' s3 w5 S; K' P
* r8 a# U0 C# M: a& V
) \3 J/ f/ _4 K2 d+ _, [7 J |
|