|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ b$ f# {/ k# N& K* ]! r! {
- [code]EDMA sample test application
% m, E$ m) j, C$ C. `: ]: e, S - /*
) m$ }5 B! ^1 G& I - * edma_test.c
4 J) f. q5 R' \ - *: u. H; p1 h2 w. W% x
- * brief EDMA3 Test Application
" Z& f2 J1 f& w: ?5 H - *
: q) S; E' f8 G3 n& C7 U - * This file contains EDMA3 Test code.
, d& Q! Y8 ?# S9 X - *8 I/ G% ?# C/ }6 v+ }: j2 l" l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% b4 L8 J" a; j) I9 X" Z+ S, z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, g2 }" ]+ Z9 [, M, L - * TO CHANGE.
8 {: ^5 } q. q Z - *# i; I1 h D1 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 O/ r) K0 L; @- p
- *. U- j8 r! \: g6 E8 q& h
- * This program is free software; you can redistribute it and/or
' j# g% g& e; V5 C C9 C( E - * modify it under the terms of the GNU General Public License as
; y! C* [, o0 e! T - * published by the Free Software Foundation version 2.
$ _$ b. b- Y) j, V - *1 L% @/ y, R5 r; X+ w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ~. C& t! \7 d3 R7 @/ T
- * kind, whether express or implied; without even the implied warranty
- d5 z2 G2 v( ?3 \) E/ b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ d/ m& q: S& j7 m
- * GNU General Public License for more details.
1 J7 ?- B. o/ I& `/ E, `3 w& b# w - */; v: }7 T! T3 d& j- V5 k
6 q) E) \) I }( T- #include <linux/module.h>
" M y; m+ Z( l4 `3 w! ~ - #include <linux/init.h> o% ?2 q n8 W. l, K. Y+ X
- #include <linux/errno.h>
: t! w+ X* V# o' k2 g - #include <linux/types.h>
w: v! S$ a, o - #include <linux/interrupt.h>
8 _7 O2 M$ M( }' l1 @2 r. I; E - #include <asm/io.h>5 p |, F: `4 P d' }
- #include <linux/moduleparam.h>; O# a. h( h3 w8 z6 |" N
- #include <linux/sysctl.h>
- h+ e- {" l! I- K) ~9 a$ G/ D) P - #include <linux/mm.h>
% {% @5 k: y' C# P* w# N - #include <linux/dma-mapping.h>
3 D8 ^4 n- D& Z - }- [! m" I# N; Y& n
- #include <mach/memory.h>
: i Q+ i; E; n/ M; [ - #include <mach/hardware.h>
, i/ W% c9 D5 E7 m+ E* f3 @' X9 q - #include <mach/irqs.h>7 m& F. s& ?! O d
- #include <asm/hardware/edma.h>/ _4 B5 ]& S2 s7 U1 D/ K4 M
- 0 C8 V1 N: t0 A0 I: X3 y
- #undef EDMA3_DEBUG( y8 X' a/ R/ z4 E! X: Q% i
- /*#define EDMA3_DEBUG*/
, d x% x+ ?$ ?- g* j3 V7 U4 A+ M
4 n- h1 z- `) L$ k! u6 x- #ifdef EDMA3_DEBUG
6 B" s$ r9 n6 B; C* [8 U1 Y7 ^% v6 |6 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 |) I* r# Q) h5 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) e5 T$ b# q" D* _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 S% y3 b4 h& ?) ~ - #else
* ?5 i# h0 _) U1 T - #define DMA_PRINTK( x... )
) F% r7 K1 h# s2 V3 W - #define DMA_FN_IN% k h) q1 _7 I5 J0 y+ i: R# z7 i5 ?
- #define DMA_FN_OUT8 }& X6 ~% J6 Q
- #endif
; j7 x% f2 ~2 I. y - i" @8 T- T2 p6 R' T7 x( w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 K. x4 W8 {4 U3 O$ j
- #define STATIC_SHIFT 3* _9 [1 }; }& T& Z" u# U/ ~# S1 j
- #define TCINTEN_SHIFT 20' B, T0 B# E5 g
- #define ITCINTEN_SHIFT 21- ?" r; n" N1 x
- #define TCCHEN_SHIFT 22 T0 i$ L/ \- p2 @4 N% F- b0 k2 b
- #define ITCCHEN_SHIFT 23
" [& n7 T- \ v. S* e! k; V
/ C# ^! X5 m& q0 I) E# V9 l6 T- static volatile int irqraised1 = 0;
. J0 z, n# o1 w9 `" a - static volatile int irqraised2 = 0;# q2 |: D4 W5 F8 z0 v" W
1 D5 h6 H5 D! { Y0 V$ |: d. s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l& P1 R2 @6 B, i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* H/ K) l5 P) J% Z- E" c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ u9 j- l. G. D
* z6 ]% r- Z! f- q/ V- g' D- dma_addr_t dmaphyssrc1 = 0;! X9 y2 g4 B6 C
- dma_addr_t dmaphyssrc2 = 0;
" ]7 `5 ~, t1 J: H0 t8 @ - dma_addr_t dmaphysdest1 = 0; Z9 P) m% h* C4 ^4 l0 e1 z
- dma_addr_t dmaphysdest2 = 0;, N! e w+ g. R) Q+ \& r/ E
9 G6 S5 s; m5 j. E9 X" w" u- char *dmabufsrc1 = NULL;
0 u+ J: n+ k, R! k5 ] - char *dmabufsrc2 = NULL;) L/ \4 ~2 `& g; j" m$ y+ g% ~0 L. f
- char *dmabufdest1 = NULL;
; K; t: {9 o0 J7 u, l( v/ }* w- K - char *dmabufdest2 = NULL;
+ [3 F6 S) U0 P% S. N - * I8 [4 N x7 B8 ]- X( Q
- static int acnt = 512;: S% C& k7 _: q8 O* ?
- static int bcnt = 8;6 O" w0 p2 U& M
- static int ccnt = 8;0 X. C: Z1 ]" t
, b) {0 d& J9 k ^ B0 }0 O" t- module_param(acnt, int, S_IRUGO);; v9 j$ Z9 \0 V, Q3 J
- module_param(bcnt, int, S_IRUGO);# I3 N& q0 T0 X$ k
- module_param(ccnt, int, S_IRUGO);
复制代码 ) m) m# d% f% l+ }; V1 J- }
$ V& k$ U! I3 ]! t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ z5 D0 \7 [/ A: c, W9 p% ]9 X8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' l0 M; n' ~2 G" g% ^- x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# M9 I# u0 @- k& l
7 V0 Q P4 T) f/ w# K# x( ?4 d( g6 u1 `3 p
|
|