|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( d' {# y1 g8 @& X, R3 j# z- [code]EDMA sample test application
* F! [# x& l- V* Y/ D - /*; e9 V1 m1 n8 U9 p. Z5 z: _4 R
- * edma_test.c
) K" A' l; j6 E - * n. a4 @9 _7 I
- * brief EDMA3 Test Application
; i/ z6 Z! v ~2 @4 t6 g - *
6 G9 [' U5 U, e- `; k - * This file contains EDMA3 Test code.
\' y% t1 K5 b! B- j& C1 ` - *
% ^, i) f- g/ U3 \% l2 }3 l' A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 q% s3 D i$ E9 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 E$ t" O. S8 @% ^9 D, x; S - * TO CHANGE.2 Y& ~) k( H0 `" w5 @
- *" K O- b# T, E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n2 Q* p/ w& q* C7 Z' V3 B
- *0 K3 z. {2 C ^. h4 U L
- * This program is free software; you can redistribute it and/or# h# N$ q2 q/ i3 Z1 E% w
- * modify it under the terms of the GNU General Public License as
1 e& u% x! n2 b% @& [* ` - * published by the Free Software Foundation version 2.
" D$ P4 l- j& `" N8 w - *' p, W+ P7 @. b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- Q1 D7 R. z- l9 I
- * kind, whether express or implied; without even the implied warranty
) d+ U2 K, W9 l6 v; }$ n% [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 w l3 t/ {' H
- * GNU General Public License for more details.
# A, B' s' }; X V - */+ D' j2 Q6 Q3 x# f
- ! W& ?7 t* _- g( W! l7 x
- #include <linux/module.h>4 p2 J3 v+ ]1 l, [+ V
- #include <linux/init.h>/ l% f3 s7 K* d* Q
- #include <linux/errno.h>: [' a, g0 g7 E9 o+ Y5 d
- #include <linux/types.h>( P ~8 z7 l5 w+ G' F5 K
- #include <linux/interrupt.h>$ C5 y6 y- F" S8 b' E9 O2 j
- #include <asm/io.h>: N. N8 i) x& i \8 I' ^
- #include <linux/moduleparam.h>& r& T0 T( i* }0 ?8 i
- #include <linux/sysctl.h>
! h/ k% E/ Y9 H7 t! D# b: n9 j" f - #include <linux/mm.h>
/ O* u _) H3 n$ g: u' ^ Q - #include <linux/dma-mapping.h>4 U5 A; P6 x* s# ]
% }7 l7 o) m. ?1 B0 _& N- #include <mach/memory.h>& Z, a% m- K: P( Q4 {$ H* O
- #include <mach/hardware.h>
5 w7 b* V4 T- {& x& H; s8 {' x - #include <mach/irqs.h>
' c9 o# E6 z3 T0 e; A$ L( D/ ] - #include <asm/hardware/edma.h>
" u4 }7 N y$ D$ M2 X& m4 M0 ?. P - U) g2 [* _, P. W& Y6 x
- #undef EDMA3_DEBUG
: R/ N7 O1 s" D2 G - /*#define EDMA3_DEBUG*/
" q/ M0 [* s" e% ^# Q) i2 y
9 r! C6 g9 ~% ]3 n- #ifdef EDMA3_DEBUG
. B/ E* f7 E/ w+ ` B) `' H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 r$ k. k8 n* l& l9 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ V6 N- V7 x' w3 k6 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% o; W7 _1 y/ q, X' P% x
- #else
( v4 ]( X; g$ k! H, m - #define DMA_PRINTK( x... )
+ K- P/ m. p4 J: | - #define DMA_FN_IN) K; t* ?$ I# c& w
- #define DMA_FN_OUT! w7 V. e% O- X+ |4 q
- #endif! p8 n. f8 |: O6 l
- ' N* k: ^1 s9 ]3 m7 r6 a( j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); u8 J5 H* v3 f Q
- #define STATIC_SHIFT 38 ?5 w t( f( h) y/ P$ y: C$ `( \
- #define TCINTEN_SHIFT 20; X) ~' j3 u1 Y
- #define ITCINTEN_SHIFT 21
8 S6 t7 E3 |* F2 G - #define TCCHEN_SHIFT 22
9 V- |9 u" m1 ~0 K" r. r - #define ITCCHEN_SHIFT 23
1 W1 f% Z0 t# V5 Y( `, G' i
; o: K; T+ `4 l. V- static volatile int irqraised1 = 0;+ q+ S5 L- Z# K" c7 m
- static volatile int irqraised2 = 0;
* s7 \4 |$ }; F6 Q - 0 s- n) b7 |% ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ~/ x: V9 R0 w: U( c+ M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G1 i/ R4 W$ O9 Z" u5 C: A7 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 K5 I- k& a7 z4 k
- . s; J/ j3 p" y5 `4 U& H
- dma_addr_t dmaphyssrc1 = 0;- m; y7 x& t5 M/ ]% X9 e7 D/ ]9 f! V
- dma_addr_t dmaphyssrc2 = 0;: _+ }9 J% f4 j# L, B6 P) A+ _5 W( H
- dma_addr_t dmaphysdest1 = 0;
: w- h* [0 |# J: h - dma_addr_t dmaphysdest2 = 0;; I* @1 f# N" }) a
- * j q; L! _6 X. t
- char *dmabufsrc1 = NULL;
. i @1 B3 \3 B1 z3 i/ e ~ - char *dmabufsrc2 = NULL;
! f; x7 N E& v& l - char *dmabufdest1 = NULL;
/ I: R3 h+ J& M/ r - char *dmabufdest2 = NULL;' i9 @- T) t" N) d8 \+ l
- 7 y1 e" J; `) K# v2 @
- static int acnt = 512;5 D1 Z6 e. ~6 W
- static int bcnt = 8;% g$ g0 @0 ?/ Q6 W1 l i8 Z
- static int ccnt = 8;
4 k% x- \* Z7 m0 R/ y0 V
+ j7 C1 C' L- p! w" q- module_param(acnt, int, S_IRUGO);$ G9 F) J/ ~* s
- module_param(bcnt, int, S_IRUGO);
6 ?" t+ w* j' u. i& h7 M - module_param(ccnt, int, S_IRUGO);
复制代码 $ p& z9 O5 X( E" u/ W+ l9 B( ^: `
1 d! {! O7 [ K8 `' C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 k9 W9 A g4 h8 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 e% l. {( U( S! q' }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 e8 i* C/ e) d h' \# T& \; c$ }
+ P7 T/ J9 f5 c2 T! I8 f
0 K2 l% r- G7 ]- _2 ? |
|