|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 U9 D/ F( b+ q% O: y
- [code]EDMA sample test application. L. Q/ X" B8 Y% S
- /*7 t' E( j X- P" O, K
- * edma_test.c: @; O- Q7 w0 a I2 d
- *
6 E6 ?; k+ ^. m+ [* t2 X7 U2 Q - * brief EDMA3 Test Application! q5 S" A" x) ?$ i& }# }- Z
- *# l- k! u+ x8 e4 h' L' Y: l
- * This file contains EDMA3 Test code.
1 a2 C+ ~7 Y" |- d. V5 [ - *: X4 K/ h$ @* ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 f0 Y: v& w: p* M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" M& s1 `0 A7 ~1 U$ n
- * TO CHANGE.
& s, L5 Q% `( d& g - *
0 _: y: K: o; D5 ~( b) v+ f5 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 F% }2 P. v/ z! X - *6 ` P0 y, u3 _" ]$ H
- * This program is free software; you can redistribute it and/or
3 ]( ?4 J7 N: M+ S7 U& T5 }5 P - * modify it under the terms of the GNU General Public License as
6 Y$ ?1 m/ x! @4 K8 v0 H - * published by the Free Software Foundation version 2.
6 O9 Z( i9 i: [& r) n. n: x3 U - *6 d2 r$ _6 j. G) J: {8 |# }! z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z! n7 v' }2 v5 @% t# i& r
- * kind, whether express or implied; without even the implied warranty
) }: o: @& ]4 n) L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. p; `& `' B- c0 ?$ s5 M
- * GNU General Public License for more details.- G9 h+ X$ T8 a% P- l
- */# G l0 e8 p' m0 c3 I I
% Y; V+ z1 A) m* F6 W- #include <linux/module.h>
, z; I( M# Q1 O4 m1 m+ ?6 d0 ~ - #include <linux/init.h>
( N4 P; p7 b* M/ m5 l' v - #include <linux/errno.h>
, E% _6 L, U5 A9 { - #include <linux/types.h>4 i/ L- U$ Y0 M' a" E" l
- #include <linux/interrupt.h>7 y* E/ `0 {. y. W( j5 H
- #include <asm/io.h>
7 @" U& }9 b, h) H9 s - #include <linux/moduleparam.h>
" N& \" J, S4 i9 h+ Y% B7 t! E - #include <linux/sysctl.h>
' |, w0 y, ?& }* L3 Q+ y% ] - #include <linux/mm.h>( W0 S( \! K' j' w
- #include <linux/dma-mapping.h>
7 V( q( @8 v. K% t/ U3 B - 0 A% ?4 L' m9 o
- #include <mach/memory.h>
9 C a- f* t* p* P7 V - #include <mach/hardware.h>
5 \' p- P1 m3 ]/ k+ u6 O7 v - #include <mach/irqs.h>
) {( _1 C! ?0 t9 } - #include <asm/hardware/edma.h>
& M1 h- V5 d+ D* f# r$ D" ^# S5 R
+ {! O; F) ]; u3 r1 E8 N8 }- #undef EDMA3_DEBUG1 b2 B# b, o8 u
- /*#define EDMA3_DEBUG*/& T0 F) T$ h: E; t* c: C
- 3 u3 ~, h, g2 l3 k z" k
- #ifdef EDMA3_DEBUG
) z, n5 m+ U1 i( ^8 w$ \4 q4 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# w" F B9 @/ B% L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" J: C+ X2 w+ C3 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' R9 E9 d" m1 V% n+ e( r - #else
/ |+ [4 ^( n7 {* {, w3 l4 [ - #define DMA_PRINTK( x... ). W3 i8 E3 G! y7 I" d
- #define DMA_FN_IN, i( z+ K" A r5 z. z' H
- #define DMA_FN_OUT" m) F6 ]* h/ J/ t% A, I
- #endif* s0 D1 N, V+ l2 k! f2 _; y
' {' B3 R; d _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" o4 j; I9 ~) w# N8 U - #define STATIC_SHIFT 3. ~( E$ r" Q' I9 F0 m% `
- #define TCINTEN_SHIFT 20
( J& K& z& t" F' o/ i/ x9 D! E - #define ITCINTEN_SHIFT 21; G% a4 i" f, R/ S* h. f
- #define TCCHEN_SHIFT 22
) W$ F. v# d6 N p8 R& B! n9 i - #define ITCCHEN_SHIFT 23
2 t" I8 Z4 ?+ p* r% O - , K$ e! b* v3 L" M( i( t
- static volatile int irqraised1 = 0;' H; E5 N2 ]0 l' v& v- v
- static volatile int irqraised2 = 0;, j7 S; S& s+ B' z( X4 q9 w" Y; d
, {0 H& d! F0 w1 ^7 f; s& I) E6 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 e( G% R( U& x5 K9 i5 p, u. g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ a' W, p9 Q. c. z" u- F. n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d$ k4 ?% O0 H: I" W - 3 g4 W) x5 q3 p9 S
- dma_addr_t dmaphyssrc1 = 0;
6 j: O+ M1 E( R6 z - dma_addr_t dmaphyssrc2 = 0;, n% t3 c9 E: `8 x/ ^' X
- dma_addr_t dmaphysdest1 = 0;
" W7 H, N$ m/ F: k - dma_addr_t dmaphysdest2 = 0;
1 o0 D% S# J. [- m4 `+ a$ Y( i0 Q - " `2 I4 S( W, c h: U: @
- char *dmabufsrc1 = NULL;
3 J+ O0 L9 H, B; i# I) o$ k - char *dmabufsrc2 = NULL;
! ^8 q# U" |0 |1 X7 p9 e - char *dmabufdest1 = NULL;) U0 k! c8 O5 H# B
- char *dmabufdest2 = NULL;
( c' _3 ?4 m# Z9 M& I; r, @: r - 0 I$ }; y0 @" J$ ~, a8 s3 e* Y
- static int acnt = 512;
4 f, Q, K$ p* b9 s% {# t - static int bcnt = 8;
+ D/ b6 H6 W& I8 `$ Y - static int ccnt = 8;
, m4 A4 K/ |7 |( ?
2 ?1 r2 w+ B% B5 s* f- module_param(acnt, int, S_IRUGO);8 M5 Y$ b# Y) A2 y' X- G9 q
- module_param(bcnt, int, S_IRUGO);
+ }$ S7 k' A. W - module_param(ccnt, int, S_IRUGO);
复制代码 * A5 @5 @) G4 V4 @
" X# J& V' b l; @4 d) t C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ u2 @; _( _; B7 e ]9 ]) y2 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) c! m. H0 g* T0 j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& o- ]/ ]- o: d( d: s1 l9 h( E: ]8 N) [
7 p+ I7 z2 S5 `2 p Z( N" N
|
|