|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- j8 w$ h9 }+ m* P! ^* |( T C- v- [code]EDMA sample test application
/ y5 s7 M4 d) `4 |# ]( f& a - /*% W6 ?" k7 o. f( W/ j$ C" m: D* Z. P3 w
- * edma_test.c5 ]% }, g- T) x d: y/ L
- *+ f& a) }: f6 R1 k
- * brief EDMA3 Test Application
/ H0 ~/ _ o4 z& u2 }, P - *+ W5 b6 I; L2 T5 Q7 P& Y: J
- * This file contains EDMA3 Test code.! d0 h8 N" [* k- W2 e; i; U
- *
; g" E# g: {1 H- }- c# K9 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" P- q) Q% {4 U, j/ q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) b* @7 Z1 X2 ?$ p, A; O - * TO CHANGE., q; X1 [. @& W9 s! s
- *
+ q0 v* ]6 d1 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" n5 d1 o; [( F; c8 }# A' `
- *& K/ _# L5 p7 {/ b! Z9 C
- * This program is free software; you can redistribute it and/or8 F: E _. p8 x$ m2 u
- * modify it under the terms of the GNU General Public License as
% F5 F) E, D" L% ] - * published by the Free Software Foundation version 2.
9 `7 x7 k6 j1 b" O: e { - *2 z: f- ~" @! S# l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 x' n3 L$ w" g! P - * kind, whether express or implied; without even the implied warranty3 z$ ]' Y" W0 E6 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 E! H+ n( e9 O
- * GNU General Public License for more details.# r, o* S2 o% @$ g
- */1 Z6 N4 \& [( a _* [" `* K: j
- ' G1 M2 i d! h4 x# ~0 B" _- ~6 G5 x
- #include <linux/module.h>
5 z" ] D% P: s8 Q/ {% w$ _ - #include <linux/init.h>9 k# ?4 X# l0 e. a8 M4 U2 \- N
- #include <linux/errno.h>
9 y2 G3 G9 o% c - #include <linux/types.h>
5 ]" A, Q! j& q; x5 b$ j& x - #include <linux/interrupt.h>8 c8 z8 S9 S9 F5 r
- #include <asm/io.h>5 K/ ]3 |& r( F+ B4 B
- #include <linux/moduleparam.h>
' k0 p: p4 @6 M, c- l - #include <linux/sysctl.h>
) O' D% ~# M, s. w, z" n6 p( Z - #include <linux/mm.h>* X0 T m+ E9 s! x% D, q
- #include <linux/dma-mapping.h>$ ~& U* B$ X! |" V+ m5 I( w$ y+ b# V
) h- Q7 _3 W9 ]& g6 R& B. S: e- #include <mach/memory.h>
4 l/ D# g7 V, R" p; U - #include <mach/hardware.h>
4 B% j( g3 c& h V7 o* @ - #include <mach/irqs.h>
( s; y# V& j: ?) [; W( I5 t - #include <asm/hardware/edma.h>) K, z# ^3 ^$ o
- 0 H9 m9 m5 m/ E7 W1 L2 K
- #undef EDMA3_DEBUG' q% Z! a. f; h8 D0 r5 j7 A
- /*#define EDMA3_DEBUG*/
& j% ~1 {9 z! {4 j& I* w' I - & R$ y: t3 u) c1 |
- #ifdef EDMA3_DEBUG
- f& _7 s$ \% c# K. B9 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% z* Z6 H: }2 R( u r: m' r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& l. @0 f, l k8 P7 y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 }: f7 a1 Z" A- i: S- |! T% i$ j% z
- #else
1 ^& @4 p8 [9 g - #define DMA_PRINTK( x... )# |/ \) k5 ^* C) R
- #define DMA_FN_IN
3 Z. O7 C8 F5 M! G/ s - #define DMA_FN_OUT) {/ U5 H" Z# H4 I) [
- #endif' p; t2 h" _$ A3 x T" Q
- 4 D# u h0 s! B/ H: \$ I2 j: U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- @, y4 l. D+ \7 t2 D
- #define STATIC_SHIFT 3* N- l5 N( w$ S3 L0 u4 E6 T
- #define TCINTEN_SHIFT 20/ y$ c; r2 V3 n0 e6 M2 w5 k! e. q
- #define ITCINTEN_SHIFT 21
" u, p# U6 r0 R& q - #define TCCHEN_SHIFT 22
& z) I" T6 |8 A& m* {( w+ { - #define ITCCHEN_SHIFT 23
7 B A4 x! T7 [+ m
q6 I/ _) q' x4 [6 O y& m# o- static volatile int irqraised1 = 0;" X: {* `* j a+ Z0 T( d7 P& W4 R
- static volatile int irqraised2 = 0;
' n5 Y+ A- C0 n% ~/ H1 V - . v2 @1 D1 [, k; p% F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- g+ b& Y7 `5 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 h' Y$ W; X w5 E, ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# i' h5 t" D) L* p1 d ~8 X - ; l% ~4 m* y% ~. F) j
- dma_addr_t dmaphyssrc1 = 0;6 ^; |: @: \ T: G }
- dma_addr_t dmaphyssrc2 = 0;
5 P9 v, U+ W7 p" C; m - dma_addr_t dmaphysdest1 = 0;
: x( E* ~% U- R/ a9 K6 A/ v* d - dma_addr_t dmaphysdest2 = 0;
7 e, l) y, K5 H/ T/ V - ( H. v4 U/ G) J: j/ q5 j7 U' D
- char *dmabufsrc1 = NULL;
1 }5 z+ J* I0 i; O4 M! ` - char *dmabufsrc2 = NULL;. t2 ^. t+ w; ~% Z* x4 u% [
- char *dmabufdest1 = NULL;
/ l, z8 m; G0 u - char *dmabufdest2 = NULL;
% l7 R. ?+ t9 q - , b' w: P( S/ q5 u: P
- static int acnt = 512;
) g4 |' W1 ^# `' k! K, l1 N; f0 T - static int bcnt = 8;
, ~+ o2 C @1 k; G/ y - static int ccnt = 8; ~) ^- s4 t6 n: H$ k2 L7 {( h4 t
- e# M. F- L( w8 {# c8 i
- module_param(acnt, int, S_IRUGO);3 U! a% K6 J; a5 K
- module_param(bcnt, int, S_IRUGO);
3 ^0 N5 t" J# D+ |( U/ g7 f - module_param(ccnt, int, S_IRUGO);
复制代码
0 b v% x$ o9 \8 i o; e1 A' s+ L" o. R3 v* V& j, S5 L7 {3 ?9 @# K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 |. l; d! L5 `! M( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 v: ^) B$ I! O3 _$ }5 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 U+ ]( { r: N$ S* k, c* v2 O
) d7 f" e7 D1 ]& ]$ ]" z5 B' {% L
8 ], U9 {5 G) w1 N
|
|