|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # A( |" R5 Q( h/ f0 Q; q; @& {5 p
- [code]EDMA sample test application
( b4 W. X: L6 E. q' ^ r6 c+ j1 B - /*: s8 {' R- K$ n* H' O K) Y
- * edma_test.c1 q. W5 `! k$ A: l& U* ^
- *
/ Y. A) \4 `* i' ?& u - * brief EDMA3 Test Application
$ @7 e: w* y; V9 x% W; J - *: J) t' A0 Q/ y- I9 |
- * This file contains EDMA3 Test code.
3 X8 l: K1 V2 |6 w - *
7 |$ ]' y( ]! Q( L6 y+ f/ g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ C. N. \( q: U! U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: W8 J2 z" o. F
- * TO CHANGE.
, O6 h- g3 [! K! Z! l' k! D - *9 } E: s# d5 z s% R) {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 `9 w& y8 P# w0 w5 @! ]
- *
+ s4 F. |3 f! F( _ - * This program is free software; you can redistribute it and/or- D, j4 R& C) {7 \7 i/ }' q
- * modify it under the terms of the GNU General Public License as+ A& A/ V3 V4 V
- * published by the Free Software Foundation version 2.
2 g: Q. `! H$ F1 g5 _' x9 H - *
# @1 V3 ?; d& x {1 c! D I! j' @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) U0 ~( v2 A9 @! X/ Z& }# F* `- M - * kind, whether express or implied; without even the implied warranty1 `: q& U' p' K- {! A1 _( M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; l/ C* Q! W4 L: m4 p! X! S
- * GNU General Public License for more details.
& l* F& k6 m- a8 j8 h3 ^ t, u - */
, `* i! E; K: x# B7 a$ j: q
6 y$ F" g" Y% ~/ p- #include <linux/module.h>
! k6 z+ U3 L( G4 H$ T. y% ] - #include <linux/init.h>
9 K& Y3 p6 O& D - #include <linux/errno.h>! v5 B: u0 S! D, J
- #include <linux/types.h>
+ {( ]; [! \2 W% h) K! S - #include <linux/interrupt.h>- k- u& b6 L5 ]4 `; L5 U
- #include <asm/io.h>, J( p* }& x- p A& J5 C4 ~
- #include <linux/moduleparam.h>3 d7 I: R% K% I3 z A# l- E& a, C
- #include <linux/sysctl.h>
5 Q, f; s0 {2 B5 l - #include <linux/mm.h>
- Q1 A9 x, b1 x( M% {: } y- s& c! c - #include <linux/dma-mapping.h>& s, n7 w/ V! T' H& |
# J$ G* x% @2 {- #include <mach/memory.h>6 J+ |5 V* D( b% B, ?& R
- #include <mach/hardware.h>7 k" {; U& E1 [+ Y) Z
- #include <mach/irqs.h>2 C1 _* M- ?1 v& R2 L
- #include <asm/hardware/edma.h>
* u4 [5 I5 G: q; `; j - 6 }/ y; R1 X6 E& ~: q# ]) K
- #undef EDMA3_DEBUG
6 X$ n' G' d& ^& v2 C - /*#define EDMA3_DEBUG*/
~3 I2 ^* y+ i8 z4 b D4 K1 f' r* c
2 S+ A% ^) c) t& U2 k. q% x- #ifdef EDMA3_DEBUG0 y) o5 t+ `$ u3 s* c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; i) s2 c1 b# h+ G: y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. h$ W( n, r% E9 g8 M) _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) B. {9 }( E# L" [5 a. F6 Y+ K
- #else
# Q( m* j. n( o2 X - #define DMA_PRINTK( x... ), Z3 a9 ~( A% E7 I7 W
- #define DMA_FN_IN
; b2 y* L# {8 N4 V6 f$ n; h% e: K - #define DMA_FN_OUT6 }0 N5 E; F) m' ~- ~% q
- #endif& p$ ]1 W& P. y
9 h' p. n' o C, [$ Q$ T) L: Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 I( e: M7 s1 r M5 g9 M
- #define STATIC_SHIFT 32 _& W* s" G' ^2 K% z$ [
- #define TCINTEN_SHIFT 20
. k& m+ P9 ]6 Z) j: p - #define ITCINTEN_SHIFT 21
3 @& P. g( p$ h0 h) q - #define TCCHEN_SHIFT 22
" K$ c7 y: M0 T) A' U - #define ITCCHEN_SHIFT 233 o, n3 T0 A* P4 ^3 G/ K: |
- ( r' d s" b6 }0 V; G
- static volatile int irqraised1 = 0;+ e5 g+ _ G6 z, r* F
- static volatile int irqraised2 = 0;7 c7 V" F% }4 G- l6 u1 e9 S
- G( V$ o0 m3 l, u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! t1 o8 ]6 I6 }2 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l" t0 T( V) M: Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 B8 f/ e7 w3 ~' V- M3 T - 4 {5 m* e" q% U! M& |
- dma_addr_t dmaphyssrc1 = 0;
# |! U& Y: F# i2 F2 |% k+ o% E+ I - dma_addr_t dmaphyssrc2 = 0;
6 |* l5 K5 M3 t7 u, @1 P - dma_addr_t dmaphysdest1 = 0;
; ^2 d6 j0 e6 g# Y - dma_addr_t dmaphysdest2 = 0;
& I0 i/ q6 n6 x1 Q - # i0 e9 ?* z5 u" `
- char *dmabufsrc1 = NULL;! d7 L$ h) g5 `
- char *dmabufsrc2 = NULL;. k0 B# \; m1 g1 ~4 i- Z
- char *dmabufdest1 = NULL;3 \" ~/ l+ u2 Q) L
- char *dmabufdest2 = NULL;5 _" j* {: J f
! \: ?" Q3 ~9 G- l, j6 {- static int acnt = 512;
& \0 a, |& d Z* o - static int bcnt = 8;/ U, u0 H& z. n" ^
- static int ccnt = 8;
% E& n. I& N9 O" e( ] - ( R& t/ x" W9 {2 n8 G
- module_param(acnt, int, S_IRUGO);" H% E3 k) G' y2 C1 ?1 \: X5 P5 @/ ~) s
- module_param(bcnt, int, S_IRUGO);% h" M' u3 s7 z/ L& N$ K9 p9 m, \
- module_param(ccnt, int, S_IRUGO);
复制代码
7 S7 V" k" @; Q2 T, c
; ]8 a! B8 E2 G1 h K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 S# f$ V5 n% l- J1 f( yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 }" K/ c5 z2 U- L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& l8 b: ^7 ?0 c7 Z0 r6 l& m1 p3 v) D
5 r3 x; a# H8 D) C
9 D* a3 U1 _( V* S! ]3 P; X |
|