|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ X3 x' w, z5 o& a- [code]EDMA sample test application$ O5 V: w3 \' |/ S
- /*
" t+ o! J8 j. d - * edma_test.c) P; F- Z( o3 O& X( e6 t
- *
% H; W6 N' t6 j% q9 D; {5 R - * brief EDMA3 Test Application2 g, Y' A( m" {5 i7 K
- *4 q& S7 c( g* o1 w$ X, z
- * This file contains EDMA3 Test code.. c) n, V( ?3 H3 _) Z2 N
- *4 k% d- C8 a, p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" Y! m1 k; ], Y+ A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! _" M: M$ C+ \, ~3 y
- * TO CHANGE.0 M5 v* J$ ]) [; N+ y3 @7 X
- *. i5 L9 H$ }( l1 ^/ _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 h/ `7 ] e0 r - *5 R# @) j5 ^8 G& v' B
- * This program is free software; you can redistribute it and/or" h& a1 g O9 k) G/ B
- * modify it under the terms of the GNU General Public License as& g5 p/ F! s2 ^1 K/ P
- * published by the Free Software Foundation version 2.- k0 G# a Z8 [2 p# n
- *& R1 S0 |0 {: r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! E' x0 `1 v9 [+ ?* N
- * kind, whether express or implied; without even the implied warranty' P E5 m8 |/ t* b4 ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 I' n( E$ }( P( o
- * GNU General Public License for more details.
& a6 v7 a5 K2 S - */; }8 q: y) W' I7 ]& @3 e0 B9 ]
4 s3 s& t, K/ ~: p- #include <linux/module.h>
( |- o# ~! ~' U2 c - #include <linux/init.h>5 _! { S: ^* ^1 m. {
- #include <linux/errno.h>
9 }7 c7 g3 v% q9 G1 e - #include <linux/types.h>1 g1 @+ Z# c% s E8 K
- #include <linux/interrupt.h>: n D+ g Y" s+ q# A
- #include <asm/io.h>* a- x! H+ y8 k* w
- #include <linux/moduleparam.h>8 `9 {9 x4 l' T5 [$ B$ v- ~
- #include <linux/sysctl.h>
+ [: L" T7 m8 T; l- { - #include <linux/mm.h>
" s" g2 W- R) x- a/ x - #include <linux/dma-mapping.h>, z' l5 ^6 O0 B+ C/ i
; \& m1 `% @& d% J! j& W- #include <mach/memory.h> N: E! P$ n5 S% @+ z: N7 j
- #include <mach/hardware.h>
; c, e8 i* S5 @0 E2 s5 O y4 y6 X$ r - #include <mach/irqs.h>, O, r! ]* J" T& r
- #include <asm/hardware/edma.h>) s. J$ q4 h, H+ w
& N' M4 b; O! b- #undef EDMA3_DEBUG
' \ n6 ]3 n0 v' D% }& ]: O- H - /*#define EDMA3_DEBUG*/- f4 y' z# k2 ]* y) l- {9 O
- , {3 T* Y1 Y9 b# Q. X; p; e4 S3 \
- #ifdef EDMA3_DEBUG- Q, |( Q4 Z8 ~1 s& G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ v8 B* \9 B* V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( v; ?( r! b) B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 v) }* j+ E: d9 B1 D - #else$ b; d% d- }6 j' M7 I& u
- #define DMA_PRINTK( x... )- Z3 Y4 X( B) X$ U4 c
- #define DMA_FN_IN
& h8 k7 |, K4 s5 l2 [% J: x - #define DMA_FN_OUT
0 y' M, U. y; w& a; N) ?9 u - #endif8 @8 b9 u( i$ z3 M5 ^. c
( i) m! `; A3 I& C6 S+ F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 k- A$ w- X3 r& o3 M - #define STATIC_SHIFT 34 h) r! X2 x6 t4 A e$ M
- #define TCINTEN_SHIFT 207 R" V' e$ G5 z
- #define ITCINTEN_SHIFT 21
, p) O; U/ T/ ?# \' n - #define TCCHEN_SHIFT 22
, ~% k% h2 k* D1 X x% l - #define ITCCHEN_SHIFT 23
, v" m' B) H( f, \ - ' P: A% Y8 U$ J4 ]) j
- static volatile int irqraised1 = 0;& c. V$ m8 V l6 S0 v- V, y$ F# T4 L$ C
- static volatile int irqraised2 = 0;, s) o6 }5 n" t
- % y9 l; E" J) l6 e ^8 H0 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 Q7 V5 J& j* u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ P8 m0 W1 p. V7 m1 A) b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, P1 a( c- t# d: z+ a
; V' |6 p T- i/ c, V# e% I4 R9 ?- dma_addr_t dmaphyssrc1 = 0;4 z* a, B0 B4 N8 l+ G7 `7 F& N
- dma_addr_t dmaphyssrc2 = 0;
) C F4 B7 s' d$ d' K1 N: p - dma_addr_t dmaphysdest1 = 0;7 S% }( x' j6 }! I
- dma_addr_t dmaphysdest2 = 0;0 u) h# n- k4 ~8 ~
- 3 @0 m2 x4 L. q) O7 v3 h
- char *dmabufsrc1 = NULL;
- K+ z: M# Z. c- N i8 ]; i - char *dmabufsrc2 = NULL;% l; c1 m/ s m4 r: v
- char *dmabufdest1 = NULL;) @9 w# L5 ^9 Z% h# e. f5 a* S
- char *dmabufdest2 = NULL;3 ~ r4 [4 t8 s
- ; \& O* p2 {1 N2 Z9 @. X2 V" B
- static int acnt = 512;0 P* T8 a( k+ a7 |5 N
- static int bcnt = 8;/ a/ t9 q3 M4 y! m" a
- static int ccnt = 8;
( Q* T4 u+ X% O! _, L9 A2 W: o - . k* K5 ~0 _+ d0 j$ }& S6 |
- module_param(acnt, int, S_IRUGO);4 C2 g+ r3 ^5 M) d0 K* q
- module_param(bcnt, int, S_IRUGO);
3 X3 K7 T% ^9 u2 j - module_param(ccnt, int, S_IRUGO);
复制代码 . G2 f0 `7 E) ~8 m2 p, j; c' c) a0 v$ u
5 @% P1 r, \7 A, G- g# z3 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ?5 t( I; W) p5 w# E& darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 m0 _, \8 k U5 p3 r, H6 w6 k& K, I: @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) r# y* S o8 ?' Y/ p( }; z
) j' Q$ _5 y+ Y9 q( R' \$ t) c2 W
, T0 _2 ]9 O( {3 ^1 D' \3 x
|
|