|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; l/ }8 h% H0 @2 B8 d! X
- [code]EDMA sample test application
" x! y! C% o) W7 A# q5 Y - /*. v; W/ S$ m- i$ z8 A3 \
- * edma_test.c, w& L; p: v- M h
- *
3 ~' a/ v3 _0 w! m/ ] - * brief EDMA3 Test Application; ?+ t: y9 P& e# M
- *
# X1 |3 E- Q9 C* m4 u% | - * This file contains EDMA3 Test code." k$ V( J: H0 A# C4 N
- *
$ r6 Q( R) ~1 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& q, ~; O' m. o i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- L6 Z6 k! z: }4 z7 P; V* G& b3 g - * TO CHANGE.1 C# \+ [1 U/ n
- *) ~/ ]8 ~+ w7 _. }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- c) r2 j- g$ y0 v! n, @( V! U# H - *. k `9 g; |% a, [
- * This program is free software; you can redistribute it and/or( W4 f4 v* C* R$ N$ ~7 j
- * modify it under the terms of the GNU General Public License as, j7 x" l+ B& D) m3 r8 H
- * published by the Free Software Foundation version 2.% ~; p* j9 N" N" s, @7 k
- *
4 I$ [( A3 n; ~" K, t6 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, P' r: V* W( J, x! N; ]* X& f
- * kind, whether express or implied; without even the implied warranty) O9 ]5 H' g$ p' F, _# @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% r5 ~3 a7 Z* U% a - * GNU General Public License for more details.
- F. Z8 e& a% Z P, B, m - */6 l; M; I' F8 a% z& g( F4 U
- 6 W8 x; z9 \ s( O
- #include <linux/module.h>( t5 L% b" o( A' u
- #include <linux/init.h>9 I; t6 B8 O1 B) U' u& y1 q
- #include <linux/errno.h>
! y4 S/ M' \+ k) g! H7 `+ t# g - #include <linux/types.h>
1 e# ~: v6 k Z - #include <linux/interrupt.h>
3 p0 g2 d+ d! S2 n l( O - #include <asm/io.h>; Z V! A# [& J6 u1 D
- #include <linux/moduleparam.h>
- v' U* @3 D. M& |4 l# H$ Q$ r r - #include <linux/sysctl.h>- g" v/ u$ X' L+ m
- #include <linux/mm.h>' |! K# R2 G$ P" I' p/ X! ^2 ?. H
- #include <linux/dma-mapping.h>, h$ X) Z% F$ I; B1 W2 h
, M W$ p) n2 k0 |$ E- #include <mach/memory.h>
; [7 o; d4 U; P# I; o - #include <mach/hardware.h>
1 S4 b" s* p; H8 v - #include <mach/irqs.h>4 p6 ? {( h$ d+ @$ z/ l/ W0 F0 S1 c* ]1 b
- #include <asm/hardware/edma.h>
( i/ t0 Q7 Z- r4 t4 D( Z: j
- M9 U) q# B( b* V( p- #undef EDMA3_DEBUG
! x2 V6 G! d& }( ]; X8 l0 F: ~ - /*#define EDMA3_DEBUG*/
* G( K; Z- o/ z! B! K& p8 A
# W% W7 I" z6 Y/ T- p: h( H# L1 N- #ifdef EDMA3_DEBUG
9 h7 W, |% I+ Z8 b$ i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& n; O1 j7 ~. ^! ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ?. L0 U9 i6 E/ ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' l0 m$ L# m6 u1 d. Y& H
- #else4 w+ G" f/ Q V& ~* }7 X
- #define DMA_PRINTK( x... )
8 J( q/ ?% p; E+ ~! l6 G5 d - #define DMA_FN_IN- Q* C. r; A. ]% r9 ]- p
- #define DMA_FN_OUT
" b+ d7 T( v2 j5 ~ - #endif
% A' f$ S8 x8 o
9 A( D- [9 `2 C5 ?6 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 a+ x( E1 E* X" v# B
- #define STATIC_SHIFT 3
: V8 _; @6 ?4 ^' f7 N5 V - #define TCINTEN_SHIFT 205 K9 Q4 n- s7 E
- #define ITCINTEN_SHIFT 21! c/ B( V6 R; |( d
- #define TCCHEN_SHIFT 22
4 L4 ]+ ]% s+ O3 x; h9 U0 o( [ - #define ITCCHEN_SHIFT 23/ s8 w: r8 ^0 O) K# J
9 M5 \& f+ i5 f% d- static volatile int irqraised1 = 0;
( ? U, z+ b9 @! n5 ` - static volatile int irqraised2 = 0;
/ \! N" i# Y* A6 N6 t& j% t - F, |4 V# U" d: o* Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O' Z2 m$ n' p' u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% H1 V0 [7 I6 L \# f% J2 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n) U3 V1 l& F$ s2 i' j# t
4 I( \/ [$ Q% } n& F& O4 @- dma_addr_t dmaphyssrc1 = 0;- r* } z) J' X3 O! ]
- dma_addr_t dmaphyssrc2 = 0;$ l. a, N) m$ H6 Q1 J# n% r H
- dma_addr_t dmaphysdest1 = 0;5 [* Z. T9 _0 c5 G
- dma_addr_t dmaphysdest2 = 0;
& E; o/ n4 d) X3 a5 b
3 W! b, \2 _/ U9 O f; ^; [, [- char *dmabufsrc1 = NULL;% V2 n9 j5 U* F E6 u* Y3 X& L
- char *dmabufsrc2 = NULL;+ w: Q, |, y6 l
- char *dmabufdest1 = NULL;) ~4 R/ |! N7 o1 C& m6 M
- char *dmabufdest2 = NULL;
_( }" a2 j3 J
- e8 _# O j' E2 Z3 B. @$ P5 i- static int acnt = 512;
8 T2 E) f" |8 i$ n! y1 S+ L$ | - static int bcnt = 8;
6 _' k7 Y K; f' G( Q - static int ccnt = 8;; c! x4 o2 O+ b( m' S5 g
- ; B5 }: l7 |# P9 x
- module_param(acnt, int, S_IRUGO); f W$ _8 N! D3 [ r6 B5 u% x' p
- module_param(bcnt, int, S_IRUGO);
8 o0 r6 G& H$ o* F* `6 y - module_param(ccnt, int, S_IRUGO);
复制代码
3 F( I$ k. u( `! S7 X B2 t1 D/ [* H' @- ~9 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 m: A0 W+ e: Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' }: G+ Y! s4 ^$ N+ X2 Q& U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* k6 z& G4 w0 w0 O) {9 ~1 Z
, k1 r; b' H+ ?2 e3 Q0 h0 x8 U9 J% J0 f0 P6 F6 T
|
|