|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; O' o) K0 m. {
- [code]EDMA sample test application$ Q5 o6 s8 p8 q) u ?
- /*! E2 |: g! o: O) V8 D( U1 C
- * edma_test.c
+ P0 t2 {8 x: \# O5 L9 w9 [ - * y, O( [. p0 Z5 F
- * brief EDMA3 Test Application3 S; s, V7 {% A/ D5 T
- *9 q- ^! O8 O9 |7 ^: D! B2 b
- * This file contains EDMA3 Test code.
( M; v( j# l7 d/ E - *6 Z0 o# ~) b% @% p# g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- U M8 h- _9 X! [4 Y) u5 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 u9 ^% H1 j! P. f( @ - * TO CHANGE.
- t, E, o6 z% O& V - *: d3 d* Z" N8 F5 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! D h7 ]1 c; c - *
5 O, ~, k F- |. W0 ~ - * This program is free software; you can redistribute it and/or+ u5 L) Q6 o9 w- n2 h9 i
- * modify it under the terms of the GNU General Public License as+ i$ [( w! {' e9 M9 q
- * published by the Free Software Foundation version 2.
7 Q$ H# U! V) X& A m - *
% D) `; T( e) M6 E3 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) C) S- v1 E" W: o6 J
- * kind, whether express or implied; without even the implied warranty
( v: g! G1 H6 i; D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 q- h2 T$ h$ K' d# E. q
- * GNU General Public License for more details.
! M, s' V/ Y( ^6 D - */1 o* ]) y$ s! U% c
" g: ^, z, b( T) \- #include <linux/module.h>
4 ?0 \, L6 A# o1 t - #include <linux/init.h>
6 [; \. B. T8 {7 U* O4 O2 S, G - #include <linux/errno.h>
1 w' u6 `( q5 p - #include <linux/types.h>
$ ], N+ K% c' n1 w! ^4 { - #include <linux/interrupt.h>
5 k& v# H" t2 q- V% n - #include <asm/io.h>0 z% o/ W3 f& v Z8 |1 g4 U
- #include <linux/moduleparam.h>1 j4 k, D+ x- o
- #include <linux/sysctl.h>
9 g: G1 N6 f; e2 G' F0 Z - #include <linux/mm.h>: W% a( J$ K1 h8 Q- A. T0 |- F) C
- #include <linux/dma-mapping.h>! U/ z# m2 |: Z `5 Z- o
- 1 ?+ J" n4 A3 E5 |' r; k: b
- #include <mach/memory.h>
( X7 _) S. J4 k! m" E - #include <mach/hardware.h>" e! q! ~: y5 a8 n
- #include <mach/irqs.h>
/ |/ n) K% R4 z: t1 g" N& \5 s, h - #include <asm/hardware/edma.h>
( G$ B9 G8 ~+ P( c2 E8 j
1 H$ B' g& e/ U! a5 D- #undef EDMA3_DEBUG
9 t' L' S5 W% [ O; ? - /*#define EDMA3_DEBUG*// ] ~" z: i& `( q1 J- X# b8 O
# f1 N, P6 p( {& J6 v% l1 ]' v5 N- #ifdef EDMA3_DEBUG
8 V S* E! O8 ?6 w$ K0 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' S% [# y" g# i% ~) E2 N8 t! [7 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 x* r- j8 U0 k. d6 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ B1 F3 O5 N. s e) t s - #else
# ~' C2 [9 g1 A# s0 w H - #define DMA_PRINTK( x... )
0 o& E9 A, _% J: g) i% W - #define DMA_FN_IN
/ q8 Y6 z) R" E# k6 s# z9 n - #define DMA_FN_OUT$ C1 K; T8 p7 ]. E' w7 H2 [
- #endif9 ]( e8 f' z0 b/ y1 M8 Q
- # e* ]2 m; U0 d! Z/ F6 c+ b3 V1 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! L4 H$ k' m: s
- #define STATIC_SHIFT 3
) F! K4 D* F) |$ x& E( t; o - #define TCINTEN_SHIFT 20
. Q0 T0 v+ Z4 H/ x! M( n5 v5 I - #define ITCINTEN_SHIFT 21
) A, B. C |6 j- C2 k7 J; M - #define TCCHEN_SHIFT 22
/ e! |& r" h/ I5 K - #define ITCCHEN_SHIFT 235 _. Y+ g) `3 x5 O- s) e
- " G9 u6 v& H3 W. a% ?4 c; [
- static volatile int irqraised1 = 0;
- w7 a L- |4 e* W - static volatile int irqraised2 = 0;9 e+ t2 Q. S# ^" i6 M
1 z/ h, f6 ^) f' e" c( r, D( G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ]8 u/ `# ^% }& O6 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x$ }. U4 f" {5 _( W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l. ^1 i H5 `3 ^0 a7 {
- $ ?5 l$ a9 W' G5 H, }2 v
- dma_addr_t dmaphyssrc1 = 0;+ B" J A$ F' {# u
- dma_addr_t dmaphyssrc2 = 0;' R' }( H9 J" @$ F% Z
- dma_addr_t dmaphysdest1 = 0;
- S' o$ u! ?4 r: D, v' s" [6 F - dma_addr_t dmaphysdest2 = 0;9 v' L! j5 Z$ Q; I6 b7 O
- 1 U; o8 N9 ~( \6 c1 E7 h
- char *dmabufsrc1 = NULL;
1 [# f! f; y: {9 d - char *dmabufsrc2 = NULL;8 @; P4 m9 R% L# X9 M$ N' M1 i
- char *dmabufdest1 = NULL;
9 u. u+ `$ b# Y5 w; F: N - char *dmabufdest2 = NULL;% Z" \& D0 m" P9 _/ {* h
. |1 K1 v2 W5 v( b5 N& H- static int acnt = 512;1 k' ]2 T) Z5 o
- static int bcnt = 8;
0 l: }% u) H1 W6 W: ?" \! Q' ~1 J3 y - static int ccnt = 8;
6 F! ^* V. u4 n6 C7 J# _- L% y2 P - % C9 p4 p' S- z: b! A+ ?
- module_param(acnt, int, S_IRUGO);9 H: Q. Z+ t$ u0 w6 \1 H; L
- module_param(bcnt, int, S_IRUGO);
% V. j1 Y9 D: M - module_param(ccnt, int, S_IRUGO);
复制代码
" f/ I) _- P" Z0 @0 v9 R
7 Y" v% P6 X- t* W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 X! w3 s) S O& v0 i3 ?3 M
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 _! I) E @' W* L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T: V! b$ P+ R9 o" u: z; Y# K8 {/ S) J2 X3 h
" V& h4 u2 t6 J! U; ?- v, Z
|
|