|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 {8 d' f: l& v; V5 o, M
- [code]EDMA sample test application
4 X% e+ Q7 S1 L - /*
) \5 F) e/ Q6 r+ M; t j - * edma_test.c
) } n0 T' q0 W' Q: A/ | - *
4 O, v+ d: x( r2 w' p0 n - * brief EDMA3 Test Application' [3 w! d7 I/ e! V) ~9 K! R2 @. k$ E# Y
- *
$ Y7 H- h8 d4 ~. H) Y - * This file contains EDMA3 Test code.) a) r- c* z" F; o$ _, k
- *. N2 f6 u5 J+ |( j P" K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% ?% q/ F- |" A2 m! k) [2 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 Y- d6 E% x8 ?/ {; W H* T - * TO CHANGE.6 e+ o/ N; j* N& ?3 U8 T
- *& M+ K' Q) E7 D2 i" P/ B+ h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 g+ J q' r& A' C! h - *) { d6 l: f; i Y
- * This program is free software; you can redistribute it and/or E+ e$ U" a! F ^7 F0 @' _% i
- * modify it under the terms of the GNU General Public License as
, h+ l2 @- W3 Z9 `* ~ - * published by the Free Software Foundation version 2.
! @' T1 ]6 T4 p8 u* ]3 c0 u8 C& } - ** o3 z, Z, A0 F7 m: X, ~6 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" p B) x/ u, P4 [, f/ E5 b
- * kind, whether express or implied; without even the implied warranty# R, Z7 k7 x& I6 W( e: S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! z% R% f* [ V; n - * GNU General Public License for more details.# U6 b6 i s3 {4 b; L
- */
1 |7 `! c6 j4 R- v9 W6 Z6 i
( v2 u6 x3 F$ Y [6 E& I: y- #include <linux/module.h>8 S! Y! j! |6 A% v. e4 @
- #include <linux/init.h>4 E, Y# }2 _- G; H
- #include <linux/errno.h>+ B! M/ A: m- H9 Z' d5 P
- #include <linux/types.h>
2 r8 A* e% B' I) A/ ~* L - #include <linux/interrupt.h>
& F! R4 l4 E0 `0 k4 V$ E4 I H - #include <asm/io.h>/ A q$ `3 _2 X* l; s
- #include <linux/moduleparam.h>; H5 z4 W* s9 R4 y: i
- #include <linux/sysctl.h>
1 @/ J4 t$ ~; N* f1 S% n - #include <linux/mm.h>) n% e3 H2 R* x/ u! Y; C: K$ u, t
- #include <linux/dma-mapping.h>
9 g V# t Y% J* }; R- n% h" S - Z# s$ b0 b% x, `5 g5 D% b
- #include <mach/memory.h>
. V6 u' C) r1 O/ r* b. D - #include <mach/hardware.h>8 l& F/ {: S7 y: w
- #include <mach/irqs.h>: X, j/ W1 s9 N7 x. K% I7 d
- #include <asm/hardware/edma.h>
: M4 ?- x( \! D
+ y& c5 e6 [( G6 O$ ^: w- #undef EDMA3_DEBUG/ M ]4 |8 X( @9 Z/ s$ G( ]5 j7 r
- /*#define EDMA3_DEBUG*/
* d' ]( ^8 L8 X1 ~
# Z. n& U5 v! H* H- #ifdef EDMA3_DEBUG$ p, D6 P. T9 u! g! o! r! [+ O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]% v$ A' Z( _0 E. }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" `& s5 M$ l/ X( Q# h/ y; ~+ _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q3 l( \1 }4 S# h. E
- #else% l) P) b4 O" C
- #define DMA_PRINTK( x... )
8 d* M% k; M3 X& ~$ Y - #define DMA_FN_IN
) H, H# I, Q! g$ S - #define DMA_FN_OUT
f1 [* n/ p7 A - #endif
+ u* f% }' m, t) G0 N: |
2 z0 i4 l1 d& x2 |) U0 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 w- h3 u5 x' a9 } - #define STATIC_SHIFT 3
9 ]7 a. m9 q. H9 h1 } - #define TCINTEN_SHIFT 20) P0 c1 K% G& V
- #define ITCINTEN_SHIFT 215 z0 `/ O4 B+ ]8 I3 O4 A# w
- #define TCCHEN_SHIFT 22, J: m( n2 O+ N* Z# E: k$ m- P
- #define ITCCHEN_SHIFT 23
# H/ i% @; o" j& ^5 c6 s3 }
7 X+ ^0 M. K6 d" x, F9 Z+ j- static volatile int irqraised1 = 0;
3 `- ^' l0 j7 D1 ]8 }& t - static volatile int irqraised2 = 0;9 H3 q* r1 q7 f. S% @
- ) t/ ` F* n: L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ G( h! D. S7 A% e" k' ?2 X" j3 {& U2 P+ l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K5 [% D4 L+ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ m/ S* k* r9 S5 Z
- 3 z; B6 A0 }; W$ {& b2 Y& L
- dma_addr_t dmaphyssrc1 = 0;7 }" |/ r" S5 n
- dma_addr_t dmaphyssrc2 = 0;& w0 ?5 ^# x& {. w I
- dma_addr_t dmaphysdest1 = 0;
7 Y& C4 \/ D, ?9 B/ e - dma_addr_t dmaphysdest2 = 0;
" h. c8 L7 O, v5 u6 X& x" s
. y/ z6 P! r& c% S; g8 i4 R$ g" J- char *dmabufsrc1 = NULL;
q1 m! G' {( d7 S - char *dmabufsrc2 = NULL;
" c) G- P( D, {% r - char *dmabufdest1 = NULL;6 x0 R: S: G* ?5 h
- char *dmabufdest2 = NULL;
/ K3 H4 A! q% m* y - * ?0 O$ v4 { @6 j5 \$ C( [
- static int acnt = 512;
. u* k- X$ T, G, G8 X - static int bcnt = 8; H0 \4 Q0 E2 _4 i% a
- static int ccnt = 8;' x/ M9 \4 v. ~( h6 d% e8 S }
- 4 e& @& J) |! i' k& |* [# ~
- module_param(acnt, int, S_IRUGO);
# [' \! `7 b8 c - module_param(bcnt, int, S_IRUGO);
, x7 w& p* Y% B0 n0 v3 V - module_param(ccnt, int, S_IRUGO);
复制代码 & H% V2 t ?6 T4 x5 U ^! Z
V- f, J; x6 V+ t2 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 w# P5 y+ T; b. d* B9 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( O" f* x N( b) `1 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( j0 f; ~4 B% S
- X) n6 x v6 y1 o: c0 C5 b% T0 h" Q" d6 {6 f- L
|
|