|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - c' d2 Y2 [* c5 Z3 m
- [code]EDMA sample test application
, W' _! {" M% Q2 a - /*9 u3 t' t7 g8 _
- * edma_test.c5 q( P( I9 f3 `( H. ^% `8 ?5 w: ]
- *
" O9 \" s+ V, x9 }2 J - * brief EDMA3 Test Application0 ?+ l8 G/ V+ p
- *
+ u* @1 f% O2 G6 \ - * This file contains EDMA3 Test code.# Z7 d* g/ W- A/ [$ w5 y6 j' o% q
- *5 e3 _9 c# T7 P4 I$ J% I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* R6 j. \8 d: `8 ~% J. U% O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, a, D. D7 `! S0 t
- * TO CHANGE.) g! Q+ F, T" O
- *
( Z" X' U6 z: w7 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# a# }& K1 `( t. C' q" X
- *0 w5 K( c) j6 b2 h
- * This program is free software; you can redistribute it and/or6 P% z O. A. p- i% F8 m
- * modify it under the terms of the GNU General Public License as
: i* C U/ G( c! {% m6 r4 N - * published by the Free Software Foundation version 2.
- ~! R& V3 D& | - * c6 D' m5 L" ?' |3 \, u: O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ V& y% {' M' o0 G - * kind, whether express or implied; without even the implied warranty; l3 {% D/ @0 A+ u$ I2 _( i$ ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; Z8 C% n, M% L0 r) H1 \) K+ A - * GNU General Public License for more details.9 C0 M# q; I5 I+ V
- */$ B$ e) X5 g( o' Y
* Z3 z0 o# r( |) v. o5 n5 I- #include <linux/module.h>
% C! h( i9 X: t# J" O# z7 }' ? - #include <linux/init.h>
- v. J2 Q t; {( r, _ x& ~; C - #include <linux/errno.h>) x0 A3 W7 M' B2 P$ O7 T' f2 t
- #include <linux/types.h>7 ?7 j h8 R! |* I0 W
- #include <linux/interrupt.h>
+ t$ T) h; n+ ~6 D6 J8 j0 c - #include <asm/io.h>1 R( L' |5 E! N1 Y1 c, T- n
- #include <linux/moduleparam.h>
, U% k# r# w+ }6 h- E2 ^/ D - #include <linux/sysctl.h>, m: A$ \2 C. v, b' R- W: J# \
- #include <linux/mm.h>2 m0 D) |; m7 g- ?. ^3 t8 R/ N
- #include <linux/dma-mapping.h>7 W3 a. P% R: c
- 3 D. Y( g7 m+ Q
- #include <mach/memory.h>3 I$ h0 ]6 r! O
- #include <mach/hardware.h>
: y8 O* e, C5 r' P! u u - #include <mach/irqs.h>% q. Q8 }3 z( q, q+ i* [
- #include <asm/hardware/edma.h>
) {4 K' B/ u0 d* X( O' `) E
" E' C( \; p5 O- #undef EDMA3_DEBUG
- W# l. C6 {& W% P, y. o - /*#define EDMA3_DEBUG*/$ ~8 O/ ? V6 p, w% u
- $ ^# R5 G$ H! `3 ^
- #ifdef EDMA3_DEBUG
' R& @! \. I2 \# O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* q2 M: A: `- m8 s! h/ V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# p, [% L0 [+ Q2 f$ h, S1 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( D" v2 ^& ^ j1 H5 @0 x - #else
) C- a' G% p9 Y - #define DMA_PRINTK( x... )
: x2 n* t9 n2 o. z$ W; _6 o# s - #define DMA_FN_IN
7 n; M; Z$ D% a' P+ a. u! v- N - #define DMA_FN_OUT0 x+ s8 ?5 e/ d! y0 X- G; a1 G( i
- #endif
* n4 Y$ H& n; W; o. o! R) B - ) C) y- E- }* V. E5 w7 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 E$ T0 p" T# E5 w5 B
- #define STATIC_SHIFT 37 K* m' p& _. ^$ F
- #define TCINTEN_SHIFT 208 }2 O0 G4 }+ [4 Z
- #define ITCINTEN_SHIFT 21+ G/ t8 I/ K" v0 T% s5 L [
- #define TCCHEN_SHIFT 22/ |) D- a! q5 X2 O6 Y: s6 c$ i
- #define ITCCHEN_SHIFT 231 e3 D1 \9 w; Q+ R7 ^6 Z. k
- 3 V- Y$ V) T2 M/ C, a3 J1 u, f' X
- static volatile int irqraised1 = 0;9 Z4 }3 ^8 ]' j- }# q# B
- static volatile int irqraised2 = 0;
: C, Q% D% L1 y( |) Y - 4 D0 k/ |5 I% Q" Q7 \ q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Q# d; n1 z- V8 K+ I; Y5 U& N; y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! q* ]5 w; u1 ]5 \" ]6 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: g1 h& @1 k1 C# E
1 a2 f% m0 {; W0 \" I- dma_addr_t dmaphyssrc1 = 0;0 V& x+ S: u& H, j
- dma_addr_t dmaphyssrc2 = 0;
4 [ x2 S% `. _6 C( r - dma_addr_t dmaphysdest1 = 0; j2 X# c* p& U2 e& D) z
- dma_addr_t dmaphysdest2 = 0;2 p( C6 Z, {! r
- ) w5 T. c3 |" N: W
- char *dmabufsrc1 = NULL;9 k+ [: I, H, ?, g5 n D$ d8 p A
- char *dmabufsrc2 = NULL;! z/ R, I( O- A
- char *dmabufdest1 = NULL;
7 s0 E( D, |/ M [) @$ z r - char *dmabufdest2 = NULL;
7 @6 s0 Y. [( u t: M Y$ w - 9 ^7 Q8 K% D' F1 ^+ W# Z
- static int acnt = 512;
& ?& F6 D7 [! c( C* o$ w - static int bcnt = 8;
) v& b' ? s4 ]1 }+ r5 b, ^: ? - static int ccnt = 8;1 j5 e( B7 G1 c# ?% I8 e
" K; |, ^ w) r" }% _- module_param(acnt, int, S_IRUGO);- ~+ _; M/ E& W& i5 k
- module_param(bcnt, int, S_IRUGO);( t, i; t9 `$ E7 _
- module_param(ccnt, int, S_IRUGO);
复制代码 6 l4 X6 E. x+ h4 `. u
/ o) a2 ~. r; g9 b( E* M5 P1 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) C% f b7 g }; |: y$ P7 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ y3 h2 ]0 J9 z0 Z8 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 H) Z4 ]8 a m4 l$ [0 z8 e9 q- I' M4 x. T1 r$ L
" |: Y6 _ w' v) l$ ^ |
|