|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / f( g" _" i2 \0 j: Y
- [code]EDMA sample test application
* M! V" j Z9 v5 Q - /*+ T3 y5 A, e+ h
- * edma_test.c
% B, ^) A. O1 }- B2 d0 u - *) z0 ]- S) d) |( v
- * brief EDMA3 Test Application
3 K" N% i$ e/ c5 \& d# M" }+ e5 ~0 { - *9 |4 E! Z! x0 C- J) u+ W
- * This file contains EDMA3 Test code.; K3 [4 }2 ~0 k5 Y! d6 V
- *
* b& e; e5 o' o* f! I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 _ a8 f. S* L- `( S' ]% e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ o; ^$ U: S3 S g8 | - * TO CHANGE.
6 s* {* s3 _! L' ~6 K' V; b+ ] - *
1 A/ T/ A; u# a7 N) ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 G) ]" E+ x! e% l - *
- @& d8 F% h' O$ L - * This program is free software; you can redistribute it and/or8 y! v& \: y' e" `7 C
- * modify it under the terms of the GNU General Public License as+ K* P9 b/ u3 O, N2 {% q- n
- * published by the Free Software Foundation version 2.5 u; Y4 E2 `0 W
- *& [& o) K. o. f F4 A+ Z7 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ ^7 X' R" ~7 M( ?* U' v
- * kind, whether express or implied; without even the implied warranty
+ x h* I: s- z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% O' H$ l t! M( G( j - * GNU General Public License for more details.
8 ?; c# H( E1 u5 r+ \' E | - */; G0 f8 X9 c1 Q4 b$ R& |
- ; n2 \7 w q/ D" Y3 _0 E& Y& Y
- #include <linux/module.h>
+ Z( m! Z' p/ m" ^ - #include <linux/init.h>6 `3 I* t) S- ^
- #include <linux/errno.h>1 I6 u) y. X+ [3 G5 B0 Y0 k: N, ~
- #include <linux/types.h>
5 {4 e9 R: w. h% U - #include <linux/interrupt.h>
" U5 s; R0 A4 E& Q/ o+ K - #include <asm/io.h>
2 q0 L3 N0 q9 x, q - #include <linux/moduleparam.h>
% N8 H( Z- o4 m1 N4 L7 _" } - #include <linux/sysctl.h>9 [! s9 x! `5 X* k- g4 }4 y6 y: e
- #include <linux/mm.h>
* X5 Z3 ?7 X* J7 o) B - #include <linux/dma-mapping.h>
. y7 ^1 l. S% k- }" G2 l
+ @ T- y* Q, _4 E7 [- #include <mach/memory.h>9 f! }7 z) q7 y+ |2 W
- #include <mach/hardware.h>
" j/ J3 o9 `9 A5 X7 r - #include <mach/irqs.h>
4 J3 ?% D% [" d4 U% T. Z - #include <asm/hardware/edma.h>
* p+ q3 n6 ]+ Y8 _) \. J# x8 Z" }) L
, u3 s: G+ f9 H5 u p5 p" X- #undef EDMA3_DEBUG
& t ^) }& E. k3 b, D( w. s4 c - /*#define EDMA3_DEBUG*/
! {9 k \, p9 S4 ^$ v- H+ G8 L - 9 r" \( g8 ^. @$ m8 `& R
- #ifdef EDMA3_DEBUG$ M" o# Z6 z9 N/ d) t& Z, B% K' e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- N: R* U+ X5 ]8 s9 W; v) g* } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- V" O b) K, v. m1 P% X; [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ?7 W5 Q4 ~1 r! c2 S
- #else
. E" h- o8 I& f5 [2 O/ B - #define DMA_PRINTK( x... )5 ?3 h X5 G% t* n
- #define DMA_FN_IN- T$ o, K) Y7 r3 G
- #define DMA_FN_OUT7 Z( p. d6 g) E: {6 e" }+ ]/ |
- #endif. [8 q7 I( T! L5 J5 Q4 \. G
' Y% ]$ z" F1 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* A0 B! s, a* v$ m0 L% P- M8 L! \ - #define STATIC_SHIFT 3
/ O4 g3 H4 E5 x9 N, w( l - #define TCINTEN_SHIFT 20
- T( I: r/ s& p: p) S; X) V - #define ITCINTEN_SHIFT 21
2 U& v9 _& v' ~. P9 ? - #define TCCHEN_SHIFT 227 D/ C6 I4 U# L( K0 Z# T
- #define ITCCHEN_SHIFT 23
7 v% H4 U2 d( Z+ t/ \6 ^
% p+ S# k0 v8 L( m# q; \7 q; E, K; D- static volatile int irqraised1 = 0;
# V% o5 ?- N( Q2 m+ y - static volatile int irqraised2 = 0;9 `* N- d0 u4 X5 l0 h
) W \: g# a3 S. B- ~4 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 z) q% v8 k8 O) }( P* y% L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 n, O' ~3 b, l' Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) `: c9 d- W0 b; ?
, u0 t# E6 ?8 t5 Q; G7 `; m& d; J- dma_addr_t dmaphyssrc1 = 0;% b9 j$ l, c Y4 i# m% C/ `
- dma_addr_t dmaphyssrc2 = 0;
7 o4 H! y, l8 C8 L' a3 \ - dma_addr_t dmaphysdest1 = 0;
& W7 x5 }4 D! K/ d: { - dma_addr_t dmaphysdest2 = 0;" F' H" S( \+ e- h3 t/ v+ p
- / g/ ]- U0 S" `5 p( c
- char *dmabufsrc1 = NULL;4 b$ W2 Z5 S/ S6 _8 n6 E
- char *dmabufsrc2 = NULL;- h6 P% e7 }& S9 W; s+ v& p
- char *dmabufdest1 = NULL;# k. Y$ h c4 R+ W# c8 y
- char *dmabufdest2 = NULL;
* h: n8 ^2 @' {( e) G
8 d+ `1 t/ k/ ~6 C* v3 T- static int acnt = 512;& _: Q8 u6 p* \3 g+ \
- static int bcnt = 8;! K0 G. J& y Z& L" p! O5 T; k% ~
- static int ccnt = 8;! K: K* F$ @# H9 t3 K
5 x# [% i$ L3 {9 f- module_param(acnt, int, S_IRUGO);
' u; k! u, X {2 g, B - module_param(bcnt, int, S_IRUGO);8 u0 A6 W; l4 \$ |) w3 Z" u
- module_param(ccnt, int, S_IRUGO);
复制代码
( M# x% f+ q) y. t9 C. ]- ]
$ P: U, Z! T7 d( D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, z+ ]: j$ J7 v' x1 U$ D! \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' a/ N" q: S |3 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 I' X, K; ]- v. x* E- |2 [' A8 f' _
" I: I% B7 i# k0 g( ]# a6 m) P4 ?: i8 d
& o: r; Q: w* P
|
|