|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 @, w% y- n: M* q2 S- [code]EDMA sample test application
8 N$ n e! c. U5 _. l - /*
0 J6 J9 p" w% w+ |$ S - * edma_test.c- h& V1 ?( z' b8 p& J9 }+ z
- *- Z: |: l, `( M( j
- * brief EDMA3 Test Application+ v8 @0 w6 O4 ?/ ]9 u2 F
- *$ K' e/ K l8 j' n
- * This file contains EDMA3 Test code.
; f1 j$ o5 c- l( x8 ~& V% x9 d - *7 u! f l6 ?# r" ?4 R4 h1 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 _1 |1 G0 |9 f# m; D$ R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, _8 l) ]% w- L) a% R/ {6 a - * TO CHANGE.% V( V1 b3 W( ?8 ] r
- *
+ k3 s+ I% Y; D6 \( U9 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ _5 ?) A7 B3 v - ** [* @9 E+ v1 [4 w# W0 A
- * This program is free software; you can redistribute it and/or+ v. V1 f# n9 C5 A
- * modify it under the terms of the GNU General Public License as
( _5 k, B$ l( j4 d& M% u/ e - * published by the Free Software Foundation version 2.! ]1 G- \3 s8 J, e3 R0 N# X
- *$ y* ]; D( a( G& L* H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ V) T- L4 @7 O - * kind, whether express or implied; without even the implied warranty
* W3 A; E- a* O/ X( e$ j$ X& V+ N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: m- ^! I- A5 w# P - * GNU General Public License for more details.( e; g( S( N4 Z$ i X4 J3 ~0 Q
- */
/ p" c- l) G8 G1 Y - : [2 l9 [. u6 Z) V# i$ `
- #include <linux/module.h> l+ b2 k# z' ]3 d
- #include <linux/init.h>" [+ f- N! B+ E; ^3 V% a* [1 j
- #include <linux/errno.h>+ Z: D4 `' ~$ T: v2 }9 ]. b
- #include <linux/types.h>8 |8 O0 R! k8 A, I+ G# ~1 C! }6 w
- #include <linux/interrupt.h>5 w7 Y9 e( P/ r
- #include <asm/io.h>0 E r: H, ]( q: w9 x
- #include <linux/moduleparam.h>0 x! V7 w& ?2 P0 J/ X4 e$ r; [: s
- #include <linux/sysctl.h>* I( B3 h7 a- f) t
- #include <linux/mm.h>
3 a# s1 _8 L" k8 J - #include <linux/dma-mapping.h>
6 U" \9 I7 B. M) I/ U
& m5 `. M6 n: Y- #include <mach/memory.h>" ~/ I' c# K" s, f
- #include <mach/hardware.h>
& K& D( @: t0 N+ o9 z" `7 m% o; I - #include <mach/irqs.h>" V" s K& M5 y8 z/ _
- #include <asm/hardware/edma.h>
0 }, O% O e# T4 f7 E1 M' p0 \ - 2 ]6 @ \' s6 M* {! l- F6 q4 Q: s
- #undef EDMA3_DEBUG
) ? w( i! Y5 O! \9 c - /*#define EDMA3_DEBUG*// H3 S& ~" z& s0 L
9 @8 R9 h L5 `, P- #ifdef EDMA3_DEBUG
) p! H& G3 B; O1 u: c7 k5 J2 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 z; X% s% l$ W# z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! H; q; H! n7 R, U' R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- X) X+ }+ @" u) `+ Y5 l: X - #else
' M! k( R/ x* }% q$ h6 E+ b3 _+ q - #define DMA_PRINTK( x... )
9 `% O0 Z) P5 S6 \* U. l# p4 |5 n - #define DMA_FN_IN
% `. Q* Y1 T3 i4 h, b7 }3 d - #define DMA_FN_OUT3 ? J L, E$ a+ J" T2 j
- #endif+ S; o7 x! b( Q
( C& {4 F9 C2 j' j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. Q) R _6 f: h8 C9 r - #define STATIC_SHIFT 3
4 C" w# n" P5 f' E& o; Z - #define TCINTEN_SHIFT 20
U& B1 }% O1 f2 y% [1 B - #define ITCINTEN_SHIFT 21( X( q& O/ o; z' M. t/ N* f
- #define TCCHEN_SHIFT 22
0 |; N7 [' Y( i0 _6 l/ E - #define ITCCHEN_SHIFT 23
, r, I" D5 d' s6 a) k E* E
1 _) x, \' H( }- static volatile int irqraised1 = 0;+ I+ T( @7 q! C+ }6 G1 u
- static volatile int irqraised2 = 0;
2 m5 B9 W6 ]9 C - $ |$ Q7 O$ Y3 R- {- ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 M9 c; o/ s+ V3 Y9 y& n* w, } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l# O+ Q! X4 c. Z$ X3 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ~! u$ v* H [! s) D" r0 ^
% y8 C' ~1 g! F+ n# B2 K2 \& M- dma_addr_t dmaphyssrc1 = 0;2 @4 R1 j3 _, ]# K
- dma_addr_t dmaphyssrc2 = 0;/ j" y1 ?! k1 ]- t1 A& Z! f
- dma_addr_t dmaphysdest1 = 0;8 a0 G3 [8 K Q8 U: J: l& F! C, g; w
- dma_addr_t dmaphysdest2 = 0;: p5 G) J" @5 M% b
1 X0 _2 z0 I$ I- e D0 K; B/ j- char *dmabufsrc1 = NULL;
5 Y$ [/ q) D+ J$ C U - char *dmabufsrc2 = NULL;% M! e/ W2 |1 ]) A3 L
- char *dmabufdest1 = NULL;& `& K: `6 y% Z& U0 c" b/ E
- char *dmabufdest2 = NULL;! |) m+ q# S1 t, }$ m x
2 M4 h8 R1 T$ n% j- static int acnt = 512;7 M! o! |( f" x1 F- {5 [0 _# `
- static int bcnt = 8;
1 j) E w5 x O! ? - static int ccnt = 8;
% k9 t( B3 K J0 X - ' s% X f9 z2 e# j
- module_param(acnt, int, S_IRUGO);
# ?9 V) ^- T: ]- I - module_param(bcnt, int, S_IRUGO);0 s$ q( v) q/ J
- module_param(ccnt, int, S_IRUGO);
复制代码 & J+ Z0 ]1 [2 D4 y# U0 o5 T
$ o B4 T1 \7 t2 I m4 `0 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% y) A6 d0 J/ H w' Z! warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( R* E5 g+ T4 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X. B* v5 R" S- e
. J6 ?- z8 c% g0 V$ t! g0 }9 I/ b8 n# Z, s) z% u8 H
|
|