|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 p' d1 c! j) B7 j$ l
- [code]EDMA sample test application
7 v# ~% r" v: a& x/ Z - /*
8 [( u. G% @& Q0 y) h2 p, v - * edma_test.c
, }8 p) s# V5 E1 A# n$ V - *( `8 G0 {1 c% I! ~: O4 ^0 {
- * brief EDMA3 Test Application" M" J) V; m3 R$ w/ N% j8 Z2 I. f9 d
- *
: J7 n% ]0 @+ d0 C - * This file contains EDMA3 Test code.: P- V- s2 P. @7 w
- *
" \5 U6 p9 d# C7 T, L6 Y: E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 X- c& j# h: @; i0 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, X) d1 b- O' a/ D/ E! G - * TO CHANGE.7 F* N/ \" K4 G7 e0 N
- * X% V N' g7 L! w) f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t3 U* E7 g$ O" P5 v% N) y9 A: K% Q
- *" ?4 W5 e" x3 C! {3 D5 c& W3 S
- * This program is free software; you can redistribute it and/or
- t! {, v6 I i' U6 j: Z% n - * modify it under the terms of the GNU General Public License as
% l6 a ]# |. d2 j5 e+ C - * published by the Free Software Foundation version 2.
: n: V8 p H- ]) G+ u) z# [, d1 V - *
+ a/ [! [6 o1 ^9 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) i% `8 d! [1 j7 A+ J, R+ @. C - * kind, whether express or implied; without even the implied warranty
! F" d( B- G& |6 u6 u$ A2 u4 w( d* ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' a7 V% Q+ B" B1 _3 r
- * GNU General Public License for more details.4 y- }$ q9 v6 i$ Q
- */
# W: F5 r* @. q" D$ ~( {
$ V' A! [) R$ D; K# [. `1 y- #include <linux/module.h>% ~: E$ B% V( {! L" ^# G5 B
- #include <linux/init.h>! L: h! J6 x+ H1 ^
- #include <linux/errno.h> Q. j, n. N+ E6 {
- #include <linux/types.h>
% _: n, Q; h( E! k! T - #include <linux/interrupt.h>
2 b4 l) |! T8 H4 I, g1 D - #include <asm/io.h>1 H1 x& K) B$ b6 @ F
- #include <linux/moduleparam.h>1 E& ]( C7 \. }7 i- \" f
- #include <linux/sysctl.h>3 B L4 K0 f; {2 g9 T0 D* n9 |2 f
- #include <linux/mm.h>& ~7 n0 E+ N: I$ g# k
- #include <linux/dma-mapping.h>
3 V. H$ n, q1 i+ Y) w1 c - ! X" h m5 O( {: w2 H' U0 c* ?) l
- #include <mach/memory.h>
3 n, A# E0 m% {5 z - #include <mach/hardware.h>
% _+ [6 A+ A4 `6 z - #include <mach/irqs.h>2 ]! K6 S+ y v$ D% s. s2 W/ U
- #include <asm/hardware/edma.h>; r5 A8 ?; O9 e) o
' K, N( W- F6 U e- #undef EDMA3_DEBUG% q5 Q. y" a7 V5 k# ?
- /*#define EDMA3_DEBUG*/
7 G# t' u9 T6 O4 { - : h7 V" a( z) n
- #ifdef EDMA3_DEBUG3 ]% ~8 n4 t9 F" X' ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 @' h4 _+ `- D1 W( Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) T$ F+ x0 f3 A" x9 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% U& `( E- x( ^$ _) ^8 M - #else& {* I- ]( E4 V" ?5 o& C. p+ j" ~9 k
- #define DMA_PRINTK( x... )1 D8 P! Y v4 a0 I. G$ g
- #define DMA_FN_IN
( y* }3 r0 l U9 l5 C8 l1 [ - #define DMA_FN_OUT
" ~( b2 P& r2 ^9 X8 Q - #endif
- P: l2 P0 P: W) J4 S- G - $ t' f7 Y, e+ g& d' X5 J) x5 ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& F- c+ l% _- O+ j! }" F5 @* W$ [5 Y" Z - #define STATIC_SHIFT 34 B* G% t! y8 A! B
- #define TCINTEN_SHIFT 202 x7 @( g8 Z9 t q0 e5 x
- #define ITCINTEN_SHIFT 21) U# y) H0 e( _, t U# ]
- #define TCCHEN_SHIFT 22 O1 h! b8 H+ Z
- #define ITCCHEN_SHIFT 23( K, e, k( @$ @* R
: Y! J4 |) H! {, V! u- static volatile int irqraised1 = 0;
1 o$ X7 q% `" ?- V9 }3 U! { - static volatile int irqraised2 = 0;
+ \3 U2 J" L3 s& a. e
( K9 d3 M' R$ c. Y' w" ]6 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, C) u$ @1 c0 w, s6 H' ~5 a2 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 g8 ^1 l. d9 f! ]6 ^. \: ?2 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 T8 H8 m3 b4 v$ T - ( m: ?: O Z% E5 v6 |- }% L1 _/ j
- dma_addr_t dmaphyssrc1 = 0;# f8 s; _4 j9 R T9 f9 |8 y- o1 A X
- dma_addr_t dmaphyssrc2 = 0;& q- o# V. R0 E- |( M, c$ n/ G
- dma_addr_t dmaphysdest1 = 0;
' b4 S V- U+ W" y - dma_addr_t dmaphysdest2 = 0; v5 h6 i1 K8 l- H) j
- , ` V6 D4 P2 t3 c8 ~4 q( \
- char *dmabufsrc1 = NULL;9 z* [9 n" Y1 A' Z n
- char *dmabufsrc2 = NULL;& v) t1 O! R! \ K r. b/ g- r0 P
- char *dmabufdest1 = NULL;* n0 |% J# P4 D3 O; K6 r- N/ P1 [
- char *dmabufdest2 = NULL;
k# Q) N7 D, ]/ v) Y8 ] - , X0 @" q0 c3 }% c: b" B4 h
- static int acnt = 512;
% P |( s* P, d2 n2 W8 U2 R - static int bcnt = 8;3 w- L0 i, [% S/ H7 _% @1 o# i+ l
- static int ccnt = 8;- x3 F0 }% V; I: K" e
1 u& U; f* B ^$ ?+ ^+ V# W- module_param(acnt, int, S_IRUGO);5 Y8 }6 _! ~ U; P
- module_param(bcnt, int, S_IRUGO);
$ I+ J9 D/ a6 c( h( l8 ?5 f - module_param(ccnt, int, S_IRUGO);
复制代码
0 m- e# c9 J! ^& B8 i
s- r/ b6 ^+ n/ w$ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( h6 J9 O/ C B* k) S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?# v. n2 m5 Y. o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g1 B" g+ ^: n! L
% ~, o$ l9 ]" v/ J, `& m, c9 g# L: b% ^2 z) y7 {
|
|