|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F7 d; z" P( d S% a# q. }
- [code]EDMA sample test application4 k* W/ A& @% D+ i1 Q) r
- /*8 R% ]" z! ]* L; E/ s' L/ w
- * edma_test.c1 c' t5 J! N% R$ @ r. `$ W, y
- *
* a6 \# K1 p. c" ~4 D - * brief EDMA3 Test Application
* w$ n5 x- x3 Z# [# `8 V0 |+ x - *
0 p( G0 g( h% S/ r1 | - * This file contains EDMA3 Test code.
7 r9 K0 j) [5 o1 t1 H - *
8 a V1 X. E- S4 |, _$ J$ x- v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ]3 U' L6 M; ~8 c( T, M$ A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B; X" q+ l7 a' e1 q
- * TO CHANGE.
( ^4 r, |" A7 P5 j+ W3 K4 l - *0 G# W) ?6 z* J* M' S& H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: X \- J8 k5 F6 C! R. }) Y
- *
9 [# n; v4 o. p z4 S3 e% t( j2 O - * This program is free software; you can redistribute it and/or! I& b, L( p( m2 U4 g3 a
- * modify it under the terms of the GNU General Public License as/ j T1 g3 }2 W' v! \
- * published by the Free Software Foundation version 2.. Z( k4 B, ~6 r3 t: N: [
- *: w( Z% y% Z+ R+ _. D2 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 g7 w( N7 L/ H2 ] - * kind, whether express or implied; without even the implied warranty
0 a' R' t8 ]" z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% ], Q c' w& ?4 B Y3 n1 y - * GNU General Public License for more details.
( S: j$ \5 C% p3 i. U - */
: ]4 C# e" d' k8 X$ l+ \
5 Z n: R1 |$ c! V8 x- {- #include <linux/module.h>
- _7 ^4 x: {0 A2 G) n. v - #include <linux/init.h>
, X" I, z+ J& g3 l - #include <linux/errno.h>5 v8 ?7 o; }6 q6 [8 p% b0 W8 T3 {+ U+ f
- #include <linux/types.h>- L3 Y: t8 k9 p) C8 Z
- #include <linux/interrupt.h>5 U3 M0 P0 }5 O! o$ o
- #include <asm/io.h>
& W7 I- P2 r) x" b% D - #include <linux/moduleparam.h>
' k3 B! } }" s4 [$ z; d - #include <linux/sysctl.h>, {% `6 f2 o% L0 N
- #include <linux/mm.h>
, o% E7 F( v8 k; G( i# ` - #include <linux/dma-mapping.h>
! J O4 ]0 v1 S" y
1 [5 @6 O' ?7 Z# J" _8 Z- #include <mach/memory.h>
/ C# L5 ?8 [5 v' ]0 q - #include <mach/hardware.h>
2 q& a1 _( a$ s+ S: @ H - #include <mach/irqs.h>; m0 @% h9 d6 f( a3 c9 t, q
- #include <asm/hardware/edma.h>
. s9 i7 r) h/ P( Z
! j9 | U; e' D6 O7 I, w- #undef EDMA3_DEBUG6 c6 p. O; f/ V# A
- /*#define EDMA3_DEBUG*/' m, I5 ?9 W" W+ D2 e
- ' }" m; s; @' u) |$ [9 e5 m# \" \. B
- #ifdef EDMA3_DEBUG* l: z/ Y" b' V2 \% d" H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- h4 ?- D6 j* X! j+ m- p8 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a9 x6 A: x6 K8 b8 v1 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 P: A! \, \8 c3 I- H
- #else
' W5 S# o4 w H6 ?) f - #define DMA_PRINTK( x... )3 [: s% e& p/ H. V1 M
- #define DMA_FN_IN
8 q; ?9 D% q, \3 h q% P7 k) v - #define DMA_FN_OUT
1 J$ Z. y; R w - #endif r) v8 U/ f; k1 l' x" }4 Q: q, g' K
E# c, a, D; x/ [1 _) R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 J3 W8 g9 _4 V" A - #define STATIC_SHIFT 3
9 ~6 t* K2 s" c5 X U - #define TCINTEN_SHIFT 20- _7 g6 O# U# H+ P- s) Z* O4 N# a
- #define ITCINTEN_SHIFT 21* d4 r* R" O* d+ g5 \1 g
- #define TCCHEN_SHIFT 224 A, _5 S# e& q& B X% k& I. x( Z% ^* u
- #define ITCCHEN_SHIFT 23
$ ?! x6 T- u1 H - 6 W8 v' |7 s2 u+ T
- static volatile int irqraised1 = 0;
3 v$ n2 S8 x' G9 D, ?/ i5 D - static volatile int irqraised2 = 0;5 J% k( u6 K+ A- @
- , `" \$ M5 X0 H8 _7 ]2 f# Y2 ~, V; \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~( p d8 ?. r \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 p, n0 b6 z( B( J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t. ?# y, y. r+ d
- : b& D5 J" J& J6 |
- dma_addr_t dmaphyssrc1 = 0;
' m& J: b8 P1 B - dma_addr_t dmaphyssrc2 = 0;
+ q0 u& S4 V0 U - dma_addr_t dmaphysdest1 = 0;
+ F$ F, k# v6 @/ M3 X- G - dma_addr_t dmaphysdest2 = 0;
- a& e; U3 X# t4 W
' u7 a1 W& A. @. k- char *dmabufsrc1 = NULL;
1 r' a0 d% s8 ` - char *dmabufsrc2 = NULL;4 S P+ @% T$ W3 V" ?; H* ?
- char *dmabufdest1 = NULL;* p7 ?2 j2 |/ K* `) \
- char *dmabufdest2 = NULL;
3 i) k& A4 I A, o5 b3 v( Q* |
2 |' T9 `7 L0 `. O0 Y7 o. o. e) s- static int acnt = 512;
) w0 \. y; R0 `6 E& U - static int bcnt = 8;
& ?; c' v* l, H - static int ccnt = 8;
# P4 S1 J0 e5 d1 c9 K - " x x& C8 H" T
- module_param(acnt, int, S_IRUGO);" o; o( X( \1 O% a; [
- module_param(bcnt, int, S_IRUGO);/ h+ Z$ c0 u) ~0 g
- module_param(ccnt, int, S_IRUGO);
复制代码
7 z: t0 D E' r1 b
( Z& C) S2 b7 Z$ Z. u# g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 |- N, u+ C' U1 D% v4 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 R( `; o" r& B( r; c2 P! ~* t$ y& o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! \* I5 f7 p- ~ ~6 S2 i- y
* Y" B/ ^! Y6 ^, i) r
. _& B; O0 y _" E |
|