|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % @ E9 b- G% Y5 B E9 f' [
- [code]EDMA sample test application1 [: [" Y7 i1 r7 w% O& N# P
- /*
" H" v* n: w1 h' j6 w% Q - * edma_test.c |! G2 F5 E5 } }! o& p
- *( B5 M+ N# f* J) N' r5 ]( y' o+ ?
- * brief EDMA3 Test Application8 N$ e2 i4 ` u
- *2 T4 A* R6 I% A2 I4 J
- * This file contains EDMA3 Test code.
% b$ \: s3 A9 A - *
" ^9 @" t S8 s0 `2 g8 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 U' m) h. P( `$ F1 x5 j$ X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& U6 k! h; |0 d7 x2 F- b - * TO CHANGE.
# r8 E# |: M4 y3 `! g( N - *
3 b- f. F. m) l: ]6 _7 c9 f/ D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ]; ]9 _) @' X) ^, u- x- n* g
- *
. ?! u" o9 D5 ^( D u+ v/ r# K- \ - * This program is free software; you can redistribute it and/or
% [! d: \% K' Y7 ~4 r% \% G - * modify it under the terms of the GNU General Public License as
! I6 n* Z& e0 s9 W. O - * published by the Free Software Foundation version 2./ [. X* o. z: E
- *
* Y5 @ U L/ o. i8 B6 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 P& M0 H; L b; q
- * kind, whether express or implied; without even the implied warranty
( ^+ L) q9 _ M$ R! |3 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 x, T. U- ~; `( x+ G# J" V, m - * GNU General Public License for more details.
* D/ z4 q, d9 d - */
# \/ l' X8 J% J3 {% f* f$ ?! B - 8 p4 w" y- M* D1 ?! s, A
- #include <linux/module.h>
# c5 I6 ]; J. O$ O6 c1 t% ?, E - #include <linux/init.h>, ?$ ]+ w0 H+ S+ s
- #include <linux/errno.h>
( ]8 e( k9 B) Z - #include <linux/types.h>+ c. X8 k% s9 o9 k, Q
- #include <linux/interrupt.h># K2 T r1 ^: w9 O
- #include <asm/io.h>
+ |+ @. F: L/ B% V# ` - #include <linux/moduleparam.h> h4 V4 L: @$ P! U1 ?6 L* C, @+ K
- #include <linux/sysctl.h>
. `- Z3 \# A. O% n6 p - #include <linux/mm.h>! c" q: y. M) h# B
- #include <linux/dma-mapping.h>
) D# w5 [: p& U% Y1 c4 U4 { - ! ^7 q+ X! j# f- R
- #include <mach/memory.h>
8 L5 K. \8 b C6 W - #include <mach/hardware.h>
# `& u4 J9 O8 }: R - #include <mach/irqs.h>0 a6 Z' g2 J" _: G
- #include <asm/hardware/edma.h>
, F4 d* r7 R6 n$ `: h9 i
+ ~# w$ A% n3 q* @+ o$ @ B! ~1 P! H: R- #undef EDMA3_DEBUG
9 }5 c8 R* p4 ^! i4 { - /*#define EDMA3_DEBUG*/
/ L/ ? G9 Q$ U0 e0 S# | - Q; H1 |3 {8 [& u2 L" x! c
- #ifdef EDMA3_DEBUG
4 ]" h% o( i* N/ q, b& ~$ o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. j1 k5 x3 R; p( @* e. f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: C4 S9 b4 w# \( a6 U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 P) `" h+ v3 o! X3 \* E3 [
- #else& a( @) S5 t$ f" P4 a! D% G% d
- #define DMA_PRINTK( x... )
5 P' I1 F4 Y! [) [* K, I5 e$ ^' P5 } - #define DMA_FN_IN
+ ^2 f5 j3 w [. j) J7 D1 k) m - #define DMA_FN_OUT
1 p8 U' x. g* A$ R - #endif
% _1 L) ?" Z/ T3 l4 `+ L( X& Y2 _( C3 J - ' x' s$ W) ~; c) R! V9 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 m. i; D8 C6 x6 c: W6 L2 B. J
- #define STATIC_SHIFT 3
/ d* \# |3 N0 v( j1 W- |! s( g - #define TCINTEN_SHIFT 20
0 p6 k7 z: m% h X1 {/ ]) k8 M" Y! p; J. a - #define ITCINTEN_SHIFT 21
* _! {0 ^% b$ H3 {* a0 q* n, t - #define TCCHEN_SHIFT 222 J- }- f- O! x* B* M
- #define ITCCHEN_SHIFT 23
' ^3 v) X- s! o, r8 E! i - + u/ x- q# P' ^' @9 |, ` [
- static volatile int irqraised1 = 0;
/ z% ^' k5 h/ l1 J# v1 r8 b9 G - static volatile int irqraised2 = 0;$ J' F' n+ J1 V5 ]. C5 j- R
- & Q& s/ V- ~( B4 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, |. \# i. W' v* p0 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z" g( C; P( ~4 Y9 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 p4 P7 K* q5 e! |) z* ?8 |' S
- . W1 U1 ^# C& X! o4 v
- dma_addr_t dmaphyssrc1 = 0;0 V: K4 q/ Y2 |+ t( {
- dma_addr_t dmaphyssrc2 = 0;
4 c: s' N$ y% W) ?3 w - dma_addr_t dmaphysdest1 = 0;
! z- `# i, n& k! \ - dma_addr_t dmaphysdest2 = 0;6 E, x/ A% ^( l
- / ?6 @* q/ p6 r: B/ x/ W/ v" _
- char *dmabufsrc1 = NULL;
2 e9 G7 N2 O y K - char *dmabufsrc2 = NULL;# |" g% D8 W, k7 o- \0 S6 t
- char *dmabufdest1 = NULL;& \ z9 {" m: k
- char *dmabufdest2 = NULL;
% d9 a, m5 B/ B/ X
% V2 }, i8 Y \, ^0 [$ D- static int acnt = 512;
^9 {, o2 l' o3 @4 ]9 R - static int bcnt = 8;
3 \( k) H2 p4 l8 y3 j" F5 t$ b - static int ccnt = 8;) ]* j7 }( E$ d
- * A. T% H' h/ Q- ]/ w3 T( [" ~
- module_param(acnt, int, S_IRUGO);- R h7 h9 |7 O1 K
- module_param(bcnt, int, S_IRUGO);
+ U0 V; e) u3 o9 w3 _ - module_param(ccnt, int, S_IRUGO);
复制代码 - q( n1 H" m$ v) q
$ f F9 b! {5 ?1 G% @+ e# E1 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d1 A0 f, |+ W% a) j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 H' U% a8 f1 S* r4 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ L; }7 s9 a/ U8 y! r
4 Q9 g+ f, ]1 X& f; G7 }$ S3 d' m W% Z, S
|
|