|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& j: C+ C1 k) v4 T; m+ Z- [code]EDMA sample test application J& l' w4 [7 r9 S. x* \
- /*
4 \" {4 f0 |$ y4 r E+ n - * edma_test.c6 W" V: g2 |0 J
- *
; e8 m7 V6 V- n. k - * brief EDMA3 Test Application
7 w/ O5 ^: \, P9 u" G) j - *
0 t' N2 I$ Z+ s - * This file contains EDMA3 Test code.
9 m7 d5 j3 g6 `. M* |3 X# ~ - *7 \ P" o) O3 d$ m8 {; _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
x6 g6 Y7 A9 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- U9 z- o$ a9 Q& w$ q* Y - * TO CHANGE.- V1 e6 h) g* z" N# s# h
- *
* Y$ j) a2 a5 u5 x+ \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 s4 Q2 J2 T9 [2 v; z Y
- *9 n4 n, e6 D' t+ A8 [' d. G
- * This program is free software; you can redistribute it and/or
* g) N: X; \ j& o5 A - * modify it under the terms of the GNU General Public License as
; E, w' H" Y B- M. M# p7 Q' ` - * published by the Free Software Foundation version 2.. O: g# S2 ]1 h/ F& h$ w
- *
# O9 a; M3 u& v# @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ W+ o, {( v. m1 w
- * kind, whether express or implied; without even the implied warranty
% m/ |# U9 c; e$ V( X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 w7 c. d6 {8 Z# w/ m
- * GNU General Public License for more details.
! ?! [. L1 M. }, F' I - */$ r( Z% y8 x: j
5 b' d: d: V& ]9 Z) C7 P- ]- #include <linux/module.h>
" X- h( v# Z P+ f5 {6 _; C$ S - #include <linux/init.h>- O$ P5 n. [8 \5 a( {2 f% s2 o* C
- #include <linux/errno.h>
$ ^# }5 Y2 F" D' [! [2 u - #include <linux/types.h>; b4 N/ l* e6 \3 ?) P( P
- #include <linux/interrupt.h>
) k; C$ k8 \" p% x* r - #include <asm/io.h>) Z9 j: x1 ^; _
- #include <linux/moduleparam.h>
) Z1 r! v# _# \, Q/ e3 I" b5 y - #include <linux/sysctl.h>' p% W8 c+ v; W' y" Q, s
- #include <linux/mm.h>* v# V! R% Y2 p1 p
- #include <linux/dma-mapping.h> m2 J) F. l0 p' K$ x2 S/ H }# `
- 0 r( U4 s8 U4 B: w$ M
- #include <mach/memory.h>
) t, o6 a6 w) C2 ~2 ~; F1 J - #include <mach/hardware.h>
4 t& Z$ ?- h5 D$ Q# Z - #include <mach/irqs.h>' W0 J6 ^' f& k. o
- #include <asm/hardware/edma.h>
& Q+ }8 w) m3 } - 5 n$ q. A. S( C0 _
- #undef EDMA3_DEBUG
: j2 Z8 f2 K$ \( I - /*#define EDMA3_DEBUG*/
$ K- |% E+ W0 n G3 M
) C# f: p m5 u9 x$ G9 v- #ifdef EDMA3_DEBUG
/ q" ^5 P, m7 r2 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. Y7 O8 Y. u0 a+ P2 ^+ M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* U$ q3 V+ \6 U) ^4 D8 A( N% |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Y# x8 i" a) q. p
- #else
; Q4 ]& L4 r0 d9 _$ t; b% i - #define DMA_PRINTK( x... )# k5 I! C6 t4 e3 K
- #define DMA_FN_IN
* A* r" U6 A" Q6 R - #define DMA_FN_OUT1 o8 b% r2 z- ^+ o7 E! P
- #endif+ | b9 N/ |* t b+ e$ j/ t" J
" i. B: b" b* R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ T1 f& Z/ o5 n1 ?* | - #define STATIC_SHIFT 32 c# a# c% F# P$ _, C
- #define TCINTEN_SHIFT 20" ~. A" @" V% J
- #define ITCINTEN_SHIFT 21: f9 ?% v" U! {" O
- #define TCCHEN_SHIFT 22
, c9 ]( N" U" x* S' e4 W - #define ITCCHEN_SHIFT 23
( b0 O- _3 f4 W. J - 6 U3 f% f& Q0 \: D) _# m2 r
- static volatile int irqraised1 = 0;
% ?3 e6 B1 Y; |3 n& e - static volatile int irqraised2 = 0;0 P. o. t( q* Z. ^" F/ e1 u
- 4 G/ C* x0 x& y; B/ D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W$ v2 [" c0 G* h: X6 ~( L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z) A7 W3 `; Q3 E A7 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. I* C2 A7 P" ^* g5 {; B- S0 k. F
" G5 n! r; L" f$ l- dma_addr_t dmaphyssrc1 = 0;; e5 V; d+ h* q+ O- i& `
- dma_addr_t dmaphyssrc2 = 0;) H9 W# q' G9 i6 l
- dma_addr_t dmaphysdest1 = 0;
! _8 R T! \2 k# S4 k2 s5 x, v k, T9 Q - dma_addr_t dmaphysdest2 = 0;
' | d6 t1 Q3 P' ` - : N2 ?5 b/ ]$ C+ a* m
- char *dmabufsrc1 = NULL;# ~- ^, u# u! U1 l" v4 l
- char *dmabufsrc2 = NULL;) Z( T5 X1 B- a
- char *dmabufdest1 = NULL;, }% r2 G+ [4 {6 a5 h
- char *dmabufdest2 = NULL;! Z% W4 j. } N g
& z) e- L+ M9 c4 ^% S% O- static int acnt = 512;1 p$ e6 F0 K2 \# J
- static int bcnt = 8;
6 p6 c% O2 C( ], R$ v. ?/ R - static int ccnt = 8;, r- V7 {- S0 N) X4 \- A1 u
- ; K* s9 I g% ]& E, A: [9 g! E
- module_param(acnt, int, S_IRUGO);
% R6 E. j" ?6 p V0 ~ - module_param(bcnt, int, S_IRUGO);% X F4 {3 m. j* [
- module_param(ccnt, int, S_IRUGO);
复制代码
6 ~; A& k" T$ U
/ s5 {8 g$ q2 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 y4 h& F( s1 R- M& g& p1 M1 g
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 j% Q! A- V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" q' H0 p0 ?& t, P2 G
/ a7 `8 l' o2 k: _/ h
+ x/ ~. B4 R: r$ Z9 g- q |
|