|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 s+ @+ E4 |8 A3 A; u2 d" E. W
- [code]EDMA sample test application
1 _6 G1 B1 P! D/ O4 q - /*& e) ~4 g9 l; h6 t8 s9 Q5 T
- * edma_test.c) {1 w( I2 X4 t& D1 m
- *- Q6 h9 v+ I: A
- * brief EDMA3 Test Application2 [5 e& l% d {
- *
1 L1 r$ u" ]. o6 Q7 p - * This file contains EDMA3 Test code.
2 V; z' u1 \' L: F - *
! q* L6 B; `, L7 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" b- @' M2 |. Q2 u2 h# u/ _0 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ V) C$ _7 s( T+ G
- * TO CHANGE.! P3 ~, ]5 B$ H6 G( i% q
- * ~% `# x( a; _- a' t" O, O7 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 j' }/ ]2 y+ F% _7 T3 P
- *
1 b! i# {( u9 e - * This program is free software; you can redistribute it and/or
4 I% a/ P! |8 |9 ?% _' X - * modify it under the terms of the GNU General Public License as, w y. J& b- s& J4 d; Q' X
- * published by the Free Software Foundation version 2.
! t5 l! p! E& p; p/ Y4 |4 I( d6 `7 z - ** R. c; n1 M2 y$ S$ p. L/ \$ @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' ^! y+ q( p+ k# B9 ~; t3 } - * kind, whether express or implied; without even the implied warranty% a( b; R8 B5 M. }( ^8 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' C' e+ w b& ?0 V& P
- * GNU General Public License for more details.
$ V/ K6 `) b3 V% N! f; ] - */* R3 t8 g& J8 [! S
- 7 K7 Q( `; n4 w% a
- #include <linux/module.h># K% T! G5 H9 c% d$ [( l) K
- #include <linux/init.h>9 \; m& V9 \& q! T4 j5 G0 a9 u
- #include <linux/errno.h>0 {9 E9 K' `* @8 }2 Q
- #include <linux/types.h>( d7 n! v: y% c$ x
- #include <linux/interrupt.h>
9 D$ p. @1 \+ b+ G0 [ - #include <asm/io.h>
$ P. g3 J$ _7 f( }) y0 w - #include <linux/moduleparam.h>
& g" M; E% l8 \' Q - #include <linux/sysctl.h>! W9 O- h0 q' o% ^
- #include <linux/mm.h>+ p8 V7 x, c* Z
- #include <linux/dma-mapping.h>
7 \: _* [3 r% Z3 S6 q+ y0 U
1 n! N0 I5 S& C6 k, f- #include <mach/memory.h>2 f( c/ H, {, l3 i
- #include <mach/hardware.h>
. ] r% X& Y2 U1 f' w - #include <mach/irqs.h>8 q$ Y# @ f9 w- X
- #include <asm/hardware/edma.h>
. j2 ^# a) p t$ J7 t+ j4 f6 z - : t# \) G% G& b( c1 M' ^# E
- #undef EDMA3_DEBUG
$ N7 \' U9 M4 a% Z - /*#define EDMA3_DEBUG*/
$ ]) K8 [/ {* G [
' V/ t" k: E* T% p2 p- a- #ifdef EDMA3_DEBUG
6 o: B, j$ s& P1 g/ h0 s% S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) `, H0 q3 s/ f, \8 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( j8 J6 W# ]/ G/ a1 c: l) d$ M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) w+ P9 L \9 f" N1 V9 E4 z$ F - #else4 l- Q3 l1 c1 r4 W1 W6 m! F
- #define DMA_PRINTK( x... )
3 ]; X8 L7 _2 E5 b$ p" d* |; B - #define DMA_FN_IN
. L4 G) k" A8 O. Q - #define DMA_FN_OUT" z6 r4 P& F2 D+ o' W4 W
- #endif& r$ Y+ j. S8 T. O$ v" I+ G; {
8 A" ?+ j& _! j. w) ]# Q% E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ H7 ]- V9 v, ]% m, D+ v9 | - #define STATIC_SHIFT 3* s' F( J* ]2 `( D
- #define TCINTEN_SHIFT 20
% i7 R ]4 A8 ~4 L; O - #define ITCINTEN_SHIFT 21. a0 a9 s z# X$ \- s- A; q% q0 `! S
- #define TCCHEN_SHIFT 22
& F: D# H' A" Y& o* W9 } - #define ITCCHEN_SHIFT 23
& ?) `; v8 Y" k h - ) k$ F2 J% S# e" D2 o
- static volatile int irqraised1 = 0;
( [: w7 K! d6 u) q# D$ R - static volatile int irqraised2 = 0;, g Q: i+ X/ r( K, N
9 q$ [* G$ g* U9 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W0 a H/ B4 T: {7 c) O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 h. U( j. x Q# o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 _; z9 N) ~% b
- 1 W' N: k6 b0 f' ]1 f3 ?
- dma_addr_t dmaphyssrc1 = 0;) ~0 ?. R; G1 X% C
- dma_addr_t dmaphyssrc2 = 0;6 n% B7 ]( f4 |& u
- dma_addr_t dmaphysdest1 = 0;: @: a4 \- @ w3 X; b! g9 L& ~
- dma_addr_t dmaphysdest2 = 0;
, t4 N8 O9 J2 _; | - 3 r; N) D# s, w
- char *dmabufsrc1 = NULL;% m9 A* s+ B9 p9 K2 r
- char *dmabufsrc2 = NULL;
+ Q' U1 [7 {6 ]5 C z& S+ e+ f - char *dmabufdest1 = NULL;9 ^6 H! ^$ s5 P( C! c/ d
- char *dmabufdest2 = NULL;- Z4 d6 _. N/ ?' I% I0 E9 G0 r. c. V
- 2 z7 I: I6 `" _
- static int acnt = 512;
- o. ]1 i r+ X" ^% J - static int bcnt = 8;
6 W% z9 v z5 A, a8 u5 A% o - static int ccnt = 8;
3 U% D' u/ i% d" i5 \& u( r
( ]: I) L) `. i% g( n& X1 I- module_param(acnt, int, S_IRUGO);
t& J; V4 m! E$ V; n; x! O - module_param(bcnt, int, S_IRUGO); p1 |, Q9 u1 _+ w/ J8 Z% U
- module_param(ccnt, int, S_IRUGO);
复制代码 ' I! I# \, Q& X5 T+ b. s' a3 ^: I0 \
( t J, G2 W% f: N3 v, Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, I% z+ @ p) `3 u& F" Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, k7 l7 v! Y7 E9 l$ K0 n, o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( w! \9 @$ t P" @) p. z- z# @4 ?9 T
6 b$ b4 o( |, G/ \
|
|