|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ C9 w8 ` s) ~! r+ m( [' w
- [code]EDMA sample test application
$ m1 F5 R2 F c3 B0 A! k) K - /*
7 C0 o/ X, n1 C9 [. G& I - * edma_test.c9 n3 _- N6 \6 c ^
- *
[0 P, O4 R0 U' ` - * brief EDMA3 Test Application: G$ T3 i7 ~! _, L: Y! }
- *
3 W/ E* |6 q& `, N8 }! T - * This file contains EDMA3 Test code. P& }5 ~9 A, b
- *
& s! W k+ J) ~8 d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& P( G' X7 P# y7 M3 Y0 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 k2 X- Q6 H' q r
- * TO CHANGE.
# A0 @0 C$ M1 A5 J9 p" x - *
9 t4 p! T) A/ `( {7 [6 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! g+ D( J7 K3 Q; ~ - *4 X$ ^# \+ f1 c! d5 W# h
- * This program is free software; you can redistribute it and/or# V, G8 E/ w2 w6 X
- * modify it under the terms of the GNU General Public License as
* L7 B+ b: k. t& Y - * published by the Free Software Foundation version 2.
# c# o; L6 G, D" r) e B - *
7 F; d& D9 z3 F, v/ s5 N, y$ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 i( B5 r. \& M1 s
- * kind, whether express or implied; without even the implied warranty
' }7 j0 l! g8 P4 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: I4 p E4 V6 S/ A, z6 d
- * GNU General Public License for more details.
- C. [ x- d8 r- m9 c4 C - */) S! A& q+ Y! |
( t# z' H: m- D. f- #include <linux/module.h>
; F) j% X% x3 M2 x% X/ H, ~ - #include <linux/init.h>9 T- i5 f( K* T& }
- #include <linux/errno.h>8 T- L# ?, ^4 q& P5 ^. A+ o8 J
- #include <linux/types.h>3 H `/ _ M+ _
- #include <linux/interrupt.h>
4 c9 Z& Q1 U b - #include <asm/io.h>
6 R4 M3 T9 t0 a* S - #include <linux/moduleparam.h>
* p' {" L0 J. h% A; ?4 _ - #include <linux/sysctl.h>
3 _1 t) Q! J* _8 R* g - #include <linux/mm.h>& w! R* v: T4 Q. ?* N% x% V0 g2 I
- #include <linux/dma-mapping.h>
% P2 `; {6 c6 i6 e! _8 \6 ^" D' X
/ G$ b k) d8 {0 E( V- #include <mach/memory.h>) R$ H; p: x! z/ @" }6 [ G; e! i! v
- #include <mach/hardware.h>
' w' Z" C4 M+ q/ f - #include <mach/irqs.h>
) l' L, A4 n9 ]5 b5 J( q- g+ C: V - #include <asm/hardware/edma.h>: A( ~& D- |$ d5 r
0 h1 J8 ]4 f7 h+ A5 ], I9 u) T& j1 `7 b- #undef EDMA3_DEBUG% I& G8 E9 J$ e; P
- /*#define EDMA3_DEBUG*/7 S( q% a+ _0 I! T* s
- . M- @( K9 R$ F2 ?' U8 [ j9 g: b6 M
- #ifdef EDMA3_DEBUG( R, A# K' G" L0 S7 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), l+ c9 H/ C- s# P( v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 @5 e* S; W( {$ e1 v/ T' E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" T& P9 a' L5 Z$ X) }
- #else' a" G( Q' H9 ^8 C% z0 t6 i6 ]# L
- #define DMA_PRINTK( x... ). R6 l8 A$ c) H! f- \3 D
- #define DMA_FN_IN4 `4 U7 l9 J% n% n% n4 S) q
- #define DMA_FN_OUT
. |- l* f" R e/ | - #endif6 ], k B" x7 g) Z" o1 ~
- 5 H% f- B( H9 D% u7 R4 m6 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 ~2 q) h* v* W o8 @5 h9 s
- #define STATIC_SHIFT 3
) r5 L+ J) `" V" P - #define TCINTEN_SHIFT 209 p" f+ R/ O/ @" O% I0 t1 H
- #define ITCINTEN_SHIFT 21
0 ?. j3 U2 z! Z - #define TCCHEN_SHIFT 22% ^" t; Y* E; V( }9 d8 s+ |# \
- #define ITCCHEN_SHIFT 23
+ y- N# t( y6 Z - 5 {( M C' E) y# k; m3 P$ @# S6 O2 h
- static volatile int irqraised1 = 0;
% ~2 W4 e/ N$ n$ o9 L0 t' M - static volatile int irqraised2 = 0;2 ?; \. @; O7 D% }" a, ^) {
- 9 B: \% b( [1 c+ c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n5 P; r0 \/ Y4 r' m" s# m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- I6 L4 k2 r% o. q2 ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Z+ g5 M" Z8 E t) `
. b5 T" [ ^' M3 N2 r( a, d9 o- dma_addr_t dmaphyssrc1 = 0;
, N* w! i4 J% y* m - dma_addr_t dmaphyssrc2 = 0;
5 R& v4 l$ W! W, J# f - dma_addr_t dmaphysdest1 = 0;5 U$ F) N- t7 J/ ~
- dma_addr_t dmaphysdest2 = 0;
! r9 \7 W2 t( [" _2 O
2 S: ~, ^, X" @( l3 H9 O, s- char *dmabufsrc1 = NULL;4 Q7 b+ t: m" g0 V) d$ y
- char *dmabufsrc2 = NULL;2 r8 C; I( {! X. G2 x
- char *dmabufdest1 = NULL;# M. u7 {' W& O3 I: U
- char *dmabufdest2 = NULL;
( ?# X6 w: ~* q2 m( V& w8 R - 4 M |0 S3 i9 F1 Q
- static int acnt = 512;2 X1 n5 J0 W4 t- B3 |* I8 E
- static int bcnt = 8;
4 d! `4 d y A2 A/ U3 _2 H - static int ccnt = 8;* d D& h V* A6 M" ~2 D( X
- 4 @" A1 O, [% Q% M
- module_param(acnt, int, S_IRUGO);9 ]& {0 ^ }5 a% Y. F) T
- module_param(bcnt, int, S_IRUGO);2 z6 v& V% h6 n9 D& n) R8 z
- module_param(ccnt, int, S_IRUGO);
复制代码
2 R( p1 r* r5 H% P" q$ j9 I& J; c6 s2 b% A7 h$ f( \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 Y9 J' C1 N) u- n3 p8 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 v& R1 {+ o7 c. z& j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 s3 u; p% L5 T8 }5 V" k P8 P. s4 U
9 \, ^1 N7 o$ ]2 s: T/ m; j
|
|