|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " U z: k, K/ [' |
- [code]EDMA sample test application
: N8 P: i$ I: `7 v( M2 G& l7 z - /*
# f& c+ D, a" V- S - * edma_test.c7 Z- S% }$ w- x) _& j- `0 [$ m2 Z2 l
- *% H; W) T$ Y/ [3 p+ O
- * brief EDMA3 Test Application
2 @! m" F2 F9 A$ S3 K - *
* D. E3 U" F8 E7 h/ V8 S - * This file contains EDMA3 Test code.9 B# `; H9 \6 c0 \% F2 M
- *
, c- G" y; e" _; l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Q' ~1 D+ y/ Y4 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 M9 K0 u" E7 s
- * TO CHANGE." ]& Q1 I- f& O6 j, J6 o
- *) D3 l C$ B( L$ Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( k) r2 t) j: y7 i' C# `/ E
- *% X) r4 J1 m7 D" k, N
- * This program is free software; you can redistribute it and/or
' J# K9 x, P2 r. _ - * modify it under the terms of the GNU General Public License as
: J( X; Q$ [8 f3 a! O3 q1 m: v. O4 ~ - * published by the Free Software Foundation version 2.8 j! x( v9 N& l& X6 i
- *% X9 R J7 _. O- Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 |7 ~' Y7 w6 a) C - * kind, whether express or implied; without even the implied warranty
- S- g& }% f6 H1 ?( [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 u+ ~# w6 c% {" @$ t
- * GNU General Public License for more details.
! ~" [6 ^. ~2 L% q - */0 N3 H, z i. l) v4 [( x7 w/ _% R
- % p& }! E. T- g8 {/ I7 c
- #include <linux/module.h>
6 S1 m; g5 Z$ n `3 z - #include <linux/init.h>- i9 J9 T: N/ s% X2 c
- #include <linux/errno.h>
# V4 _* n/ e& N! x - #include <linux/types.h>
2 T) V- F' s( G. ~, A: L: T - #include <linux/interrupt.h>: m7 p3 v0 |, z$ D
- #include <asm/io.h>
! c4 B: P) T1 }0 c3 o: { - #include <linux/moduleparam.h>8 z4 f8 t* ?% w# b0 n5 l; k
- #include <linux/sysctl.h>
* D% Y; x! s+ ?5 M+ h - #include <linux/mm.h>
8 W3 T& ]; L. w( F7 l$ P - #include <linux/dma-mapping.h>
, g, l2 O {' S# `' f - ; s% U" W" q9 ?
- #include <mach/memory.h>
/ ~# Y7 H: [6 S9 _ Y% w - #include <mach/hardware.h>1 p& @9 s( ~! A& {
- #include <mach/irqs.h>( N3 Q! |$ q# a
- #include <asm/hardware/edma.h>
/ e3 l2 G% c2 Z& I$ _, `0 I6 @ - 7 Y; P( O7 Y6 r# q6 q6 Q* k
- #undef EDMA3_DEBUG- M( t2 Y" u& z3 m1 }$ |
- /*#define EDMA3_DEBUG*/
( J; X/ V) u; @6 o [' f- c - 2 ^# H& P3 k9 b5 Y! z$ a8 J R- Y
- #ifdef EDMA3_DEBUG
7 h; H5 j( \/ k' f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% E$ P4 H" d0 G \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) ^3 ?+ S3 X6 y! H# q' u& l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( C9 o, V& S8 s; r, r - #else4 ?! ` X4 w, l: V3 g; r' X/ e
- #define DMA_PRINTK( x... )& A. V. k$ k# U9 X7 I
- #define DMA_FN_IN. E$ b1 p0 r! D8 |* m" F4 d' D
- #define DMA_FN_OUT
8 _1 l9 n, A3 S g6 V* O8 b - #endif# o! k, t/ z' T7 p3 G
5 v: m" t$ d& J% V3 F& G2 Y( k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ S6 h2 y3 ^ E - #define STATIC_SHIFT 3
6 {& u9 K. x+ z/ ^( w; u - #define TCINTEN_SHIFT 20
4 h/ j" A8 K8 z# d2 d - #define ITCINTEN_SHIFT 219 f% i" A) |: J& L8 ^# f0 s
- #define TCCHEN_SHIFT 22
* Q$ \ A0 z+ K) M - #define ITCCHEN_SHIFT 23
t& h8 G+ @& j( { - , V; p+ m% m* }9 H( w- E; F0 F U
- static volatile int irqraised1 = 0;& Y! d& l4 Q' H$ ]0 H, J
- static volatile int irqraised2 = 0;
9 A, s. ^! M" Q( p6 ^2 Y* M f. F - E7 e8 P/ [; O" i5 [6 u6 |$ U' f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 _( y5 ]5 J: a1 ~1 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T8 Z; u v) c% u! s5 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" H! l6 |+ s6 o) c- F. T - ) E7 p$ E3 W ]
- dma_addr_t dmaphyssrc1 = 0;, M4 @! g' v4 N1 E+ \
- dma_addr_t dmaphyssrc2 = 0;" Q7 n. a# @, b
- dma_addr_t dmaphysdest1 = 0;
8 j6 E( m8 b& ?7 w- m* l - dma_addr_t dmaphysdest2 = 0;
. r* M- J4 b# x# K6 B4 } - * _# V' E2 H$ F+ B
- char *dmabufsrc1 = NULL;% S; s' g( T" m) }0 e3 O. h
- char *dmabufsrc2 = NULL;& v0 ~; V! {. K) S5 r$ _. S' ~
- char *dmabufdest1 = NULL;
- b' `6 C1 U c1 R7 x7 J - char *dmabufdest2 = NULL;, U" L N, }; a
- # ]5 j! O. f/ y9 O' f1 G% v( V
- static int acnt = 512;
4 s( @5 e9 P; b0 z# m - static int bcnt = 8;+ P: d: Y8 i& ^8 n' G
- static int ccnt = 8;# S, x1 `4 y, v& l
) B j% ~, Q" n; d9 N* a3 d- module_param(acnt, int, S_IRUGO);; ^' |* \ \% I- H
- module_param(bcnt, int, S_IRUGO);3 t: {1 B& A, K
- module_param(ccnt, int, S_IRUGO);
复制代码 : |* X% R/ l1 e0 f/ ?
5 c* C* P. Q" h3 `7 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o' U, M- ]+ [5 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 u8 _! {# V, q! y2 b) D7 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, A5 `6 L% f0 t2 L
& h7 T7 W1 S) s% c- [9 b% E9 G
0 \* E* X' m0 M* W; B I
|
|