|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ]4 @ o1 h& l! \+ ^- [code]EDMA sample test application9 i! Q5 u$ U4 c
- /*
1 D* ^3 }4 x! w - * edma_test.c% {1 g# `. d% H1 r1 Z# t
- *5 w/ W: u5 ~5 x1 M
- * brief EDMA3 Test Application
8 N4 c6 f s) g" P# y - *
% }/ W! n# O5 L! q- z - * This file contains EDMA3 Test code.' c* [ ^& V% M" T, P: [4 Z
- *
$ `1 E8 o) X9 t& P4 \; b4 [/ f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 ^/ H" m# F8 q# e4 J7 e$ G: i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! l# j* n$ @/ i9 o% `, C - * TO CHANGE. P4 g$ z& L7 O+ }
- *
. x% l R8 x/ d) O% {% n: s. Q+ H7 g& p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, m. {3 e( s) S
- *" y4 A1 x# T {* `0 C0 j7 P' E
- * This program is free software; you can redistribute it and/or
) i; Q; n! D$ F$ n - * modify it under the terms of the GNU General Public License as
+ A4 {6 ], T9 p' h/ w y - * published by the Free Software Foundation version 2.
- X7 S2 l) d3 c" ^1 @% c - *
6 K% f0 J1 w8 ]* M( P; N6 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ]' q6 S' y' Y y4 D8 u. {
- * kind, whether express or implied; without even the implied warranty0 v8 b# |% l1 K" e; H& A$ Q. x# ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) Y4 O, q( V8 ]3 _8 x, \ - * GNU General Public License for more details.* r8 p2 f1 ]( S) a" ?6 R* R
- */
4 M/ e$ p: W. ?2 D6 D
) d) W$ \+ ]+ [& p- #include <linux/module.h>
' M+ k. b% ~" Y+ \' c - #include <linux/init.h>! x7 s; M& z _3 o) f9 W
- #include <linux/errno.h>
0 h" { C0 @' S2 u# | - #include <linux/types.h>
% Y4 q2 b2 P! s% s - #include <linux/interrupt.h>) @) d; i& ` ^/ e) m/ @
- #include <asm/io.h>9 ^1 e2 z4 l) R+ n
- #include <linux/moduleparam.h>/ ?6 N( n9 {* L: @7 ~; r
- #include <linux/sysctl.h>
# B% s( G+ M( B* U9 H - #include <linux/mm.h>1 l: i9 a" g4 a0 M
- #include <linux/dma-mapping.h>( q* |$ Y6 V+ Z# R4 R0 @0 S
- ; U- L- N- ` N# @4 ^/ T) F
- #include <mach/memory.h>1 g/ a- n% E/ G8 p- z$ w3 H
- #include <mach/hardware.h>
8 X" j' m& c6 B7 H9 }- p: ]. h$ z - #include <mach/irqs.h>; d( Y; V9 f" |
- #include <asm/hardware/edma.h>
8 @8 O$ a3 Z0 t7 ?
4 a# r' n9 O; g+ h+ |- #undef EDMA3_DEBUG$ _ V. P' C' ?' e
- /*#define EDMA3_DEBUG*/
; N/ |9 C4 o$ k% Y - ) f) A, e% C: e6 s
- #ifdef EDMA3_DEBUG
4 Y# {( h& s; m) ]6 {0 V* | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 |+ v. c: S: P1 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ~( `% v, N5 D6 b! |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 d8 P! k. _' I6 Q, n - #else. O! o& a3 {: h2 p% I9 L
- #define DMA_PRINTK( x... )
8 S, O5 m5 Q% Y - #define DMA_FN_IN
" H; C% x5 ~- b3 ~ - #define DMA_FN_OUT
' e* y. Y) U$ {# [% g6 ? - #endif
( ]7 g; L7 ? W L1 P9 l
5 U1 ]9 d2 K# [ E. q, r8 @ X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 H4 N0 @$ d1 Q" ~ [+ v8 l
- #define STATIC_SHIFT 3
" B1 ^! o" V8 E+ L - #define TCINTEN_SHIFT 20
* P; ~% w7 m. K4 P. P - #define ITCINTEN_SHIFT 212 A0 @- F. T# a# h' x. Y" M
- #define TCCHEN_SHIFT 22
4 r0 _6 P- t5 V: @6 { w - #define ITCCHEN_SHIFT 23
) ]3 J( g3 j3 e
5 F- {) S6 A) [3 Y2 z- static volatile int irqraised1 = 0;
+ _3 W3 G" ^9 ~ v( |6 ~& q$ I - static volatile int irqraised2 = 0;: Y' ~3 j# U. T- g! i7 T! w
* N5 K7 c6 K4 }! N6 x* d" E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 R% J1 o: z2 `- _ W0 P2 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ A1 w. H0 B% j! H0 l' U# \, r8 j8 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d) U+ l: k, K) V$ k
- * c4 b& U8 f6 k0 F4 U
- dma_addr_t dmaphyssrc1 = 0;
' b5 K: T/ L/ a0 s y+ } - dma_addr_t dmaphyssrc2 = 0;
0 z @8 M Z1 ~: y2 `0 S6 X$ ]0 { - dma_addr_t dmaphysdest1 = 0;
# c$ C; U5 Y' K& T+ s* m6 M - dma_addr_t dmaphysdest2 = 0;4 E2 Q. m% g) E' l+ X
, f0 l* l* T! r. Q! |# x- char *dmabufsrc1 = NULL;
5 C' m$ ?$ ^- l8 } - char *dmabufsrc2 = NULL;+ r6 h9 h) f9 h+ E
- char *dmabufdest1 = NULL;$ w$ W% Q" y. N# s- |, X1 O
- char *dmabufdest2 = NULL;# g' {) [6 |) M/ v- K: t& x0 P# Z
- D% J+ E. P2 k, O" _- static int acnt = 512;
3 F0 x/ o$ Y( v; d7 b+ q# I( t - static int bcnt = 8; s( h6 s# \! W$ E
- static int ccnt = 8;% [& v& z% w' O9 I& p) Y8 w! B
4 R7 v* b- E! z( h1 P- module_param(acnt, int, S_IRUGO);* c& ]7 l4 R- c5 t3 ?
- module_param(bcnt, int, S_IRUGO);8 l3 ]% _" t# ]. ?$ [' A
- module_param(ccnt, int, S_IRUGO);
复制代码
$ f+ d- r; h$ y# H" L# V5 Q
, S) o! |" N- g- J6 d3 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. M8 z( V; K6 n# earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& N/ h. v: n( {( X% O/ s& s# E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 { C+ p5 n o$ p0 \
( z, m5 g' r& _" j* |6 d& k$ c5 D
! K8 Y0 [9 {7 u4 O0 W4 S
|
|