|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p4 T b3 C ^' `" r ^0 U
- [code]EDMA sample test application. h b0 ~! y( @
- /*7 r: J. [! _) E- E! h/ v
- * edma_test.c
/ Q0 ]: I9 n" x+ W3 l - *$ v& W' W. z$ S) m7 n
- * brief EDMA3 Test Application
0 `4 J. F" k. d" N6 K8 X1 C - *
: E; }+ Q7 k, W; q3 p( f - * This file contains EDMA3 Test code.
( x8 R6 T$ B6 z( @, t- z - *0 E+ }# g6 Z% I5 L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 H" Q2 n& w8 t" n. i$ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- |; Z& Z0 M% t" e0 C - * TO CHANGE.
% c/ z6 c* H5 k& l6 P# L& B2 u u/ U, V - *' d6 M- @9 K1 x* U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 ]- l2 i) m1 e, u) P' x( L. W6 c - *
0 z" s9 t: }0 M$ E' {' Z6 e - * This program is free software; you can redistribute it and/or
: b" E1 s/ t# A% [( d - * modify it under the terms of the GNU General Public License as
( D) m1 W% ^3 D! ]3 U6 F% k - * published by the Free Software Foundation version 2.: a9 {' ?0 W+ u# p) ]
- *
4 ~5 Y& z' o5 _& M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Y5 w% }0 j: n- f. P) u
- * kind, whether express or implied; without even the implied warranty: m* |0 N, b$ @8 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 Y( W- z5 y$ B - * GNU General Public License for more details.
5 |; E$ e4 e1 W! K - */
* j3 p$ \1 ]; {- c2 J
0 p J! _/ C! Z# V; }- #include <linux/module.h>
7 m, A8 {8 ?0 p# ]) h* e - #include <linux/init.h>
& R/ b# @$ C+ B. f5 `( q P - #include <linux/errno.h>/ e1 p3 r6 |9 }9 p8 X7 m3 k, S
- #include <linux/types.h>
8 ^. T) Q- m& i3 ?: L$ Z/ V - #include <linux/interrupt.h>
\; H- a" f/ @, ^& ~) s |! ~ - #include <asm/io.h>; u" ~: I! Y" ?& L
- #include <linux/moduleparam.h>& T5 x, u4 x3 J
- #include <linux/sysctl.h>) F9 |5 L( v6 a4 A$ Z6 \5 d0 F
- #include <linux/mm.h>+ F% J/ v, F9 C* R4 J
- #include <linux/dma-mapping.h>
+ g/ R! c) Z5 C
; F% S: _ q. n* h: o+ [2 }- #include <mach/memory.h>
1 S% J% n; f$ X* d9 l( @ - #include <mach/hardware.h>; o( I# M1 k6 o* ]5 H& k0 n
- #include <mach/irqs.h>
0 q5 W# h, n% h* {1 r2 ?: O - #include <asm/hardware/edma.h>8 \% L# g5 |: W0 q9 u/ P
- 5 Z J3 Z9 ]# d9 Q# k
- #undef EDMA3_DEBUG
$ u( ^: P9 E& T: u( ] - /*#define EDMA3_DEBUG*/
1 j4 @( e. p# L6 \ - 3 ]3 Q7 G' K- R6 r
- #ifdef EDMA3_DEBUG/ I! b4 ^5 y1 ]5 T& x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Y2 n: Y/ s7 A* _3 |3 }/ }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( t* h) F- Y! ~! v! V" _8 @% R; B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 `# I0 I) M% \4 D - #else
0 ~) _6 [+ K P9 {& ` - #define DMA_PRINTK( x... )' Z: O5 O2 Z( z: Q: m C2 S- ]
- #define DMA_FN_IN
, u- V8 ?: y4 _$ N7 Y - #define DMA_FN_OUT* B) Z; R% S; C+ t8 _8 y
- #endif
! } w+ U i2 T
- m$ M+ \( D I9 ]; d. `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) B3 c* I& l; \, w
- #define STATIC_SHIFT 3
3 Q7 A5 P" N6 S9 c& r; Z( t9 f - #define TCINTEN_SHIFT 20
4 m$ J; A1 A3 A: ~, z0 Z - #define ITCINTEN_SHIFT 21* S5 P' N* D5 w2 {" c S$ |9 L
- #define TCCHEN_SHIFT 224 a4 q% F# _- s0 ~
- #define ITCCHEN_SHIFT 236 r! s1 G/ @. J4 N
- / g& T5 Q2 M; r# e |# |
- static volatile int irqraised1 = 0;
/ [+ b% l @2 z - static volatile int irqraised2 = 0;9 x% b: [$ w) o3 V5 H& h8 {. V
7 N% N, [2 h! a+ ^: n% c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u' ]2 y$ @; |$ X' B* {; ?+ J( a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j& n) F' c: l( X4 ^3 k& |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }: I" `( A" z- |8 U4 p, N
- , E3 H$ i- b K+ ^" A/ n9 j
- dma_addr_t dmaphyssrc1 = 0;) m- g* u5 q( u3 V, h
- dma_addr_t dmaphyssrc2 = 0;5 T0 T$ `7 ]# v& ^
- dma_addr_t dmaphysdest1 = 0;. g: i: J4 a2 t7 v
- dma_addr_t dmaphysdest2 = 0;- n" ~+ \1 c; i% L
, w6 k! N& k9 p" g- char *dmabufsrc1 = NULL;
3 a% M2 n( \3 j" n - char *dmabufsrc2 = NULL;
2 p4 o4 R3 m. D' s! S - char *dmabufdest1 = NULL;
6 `: T7 E/ ?: J1 f0 m - char *dmabufdest2 = NULL;
5 H# w* }0 [$ q4 g1 { - 6 V7 j0 b2 d9 n# Z
- static int acnt = 512;
( a: T, V1 y8 S9 B: `9 T - static int bcnt = 8;) D3 Y; T8 y. w" [5 S# ]. n( C9 L" E
- static int ccnt = 8;
" {* H; I; t0 X2 ^- b% \) Z - , a; @4 ]4 ~ [2 R+ R& D$ l: t
- module_param(acnt, int, S_IRUGO);4 c- |8 u7 \! ^. @0 {
- module_param(bcnt, int, S_IRUGO);& ~5 V' d( D6 k1 Y# X+ W, i
- module_param(ccnt, int, S_IRUGO);
复制代码 ' B5 C t# t( Z4 g
, y. T- w7 f# |$ D1 X) r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' z, Z& o5 @) O8 D I4 J1 T; farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X8 b$ \; ~/ \/ ?0 {" w/ S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* Z6 n# V" M/ a
: ?, O8 k. e& M X
0 Z! L" k- t$ Y' c6 ? |
|