|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 y5 H. c& Y L- _/ W: k* o
- [code]EDMA sample test application$ O K5 ^* S: c# l. x
- /*
3 H9 `1 c3 f# ^& G - * edma_test.c! V, z7 j2 H8 W& M
- *1 \' w; \4 G+ A& J0 A2 C/ H6 ^
- * brief EDMA3 Test Application
! f* S8 |- P2 {* p& j - *
7 @7 U- n: n/ { - * This file contains EDMA3 Test code.6 ~3 J9 }6 V+ u1 G" X4 K2 K
- *# e- d. I) c/ T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' K) N, {4 g8 h( g) Y( `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, t3 E: d1 D6 ]# @' t - * TO CHANGE.0 D- @: H$ s) v2 D
- *
4 B' d4 V" w4 N: I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 F/ v) ^/ X( T2 z" y4 f" ?
- *. A0 u4 {3 c2 G: y4 `
- * This program is free software; you can redistribute it and/or& I3 u% A+ R3 F( X
- * modify it under the terms of the GNU General Public License as5 Y5 M: j* N: M) ?: V; L
- * published by the Free Software Foundation version 2.
m! [, s( j' A' B0 o; d+ \ - *' S9 i/ P5 w/ G% ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: U7 ~- e; y; H) f% \ - * kind, whether express or implied; without even the implied warranty* l6 L7 R( L: s% i( [7 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" q. o X& u) g5 H4 X$ t* d - * GNU General Public License for more details.7 t7 A5 n# K( O% F
- */
( V3 x% z9 J. V6 \ - 8 S6 R! [* B% ~. ~ \" x5 h; q
- #include <linux/module.h>% B- g7 q: `0 h5 W
- #include <linux/init.h>
`+ K t2 H- j9 E3 e% H) \ - #include <linux/errno.h>
" a _1 J: K: L6 h% \ - #include <linux/types.h>
( t! G. [) G9 Y# U# W - #include <linux/interrupt.h>3 b. A U) S1 b2 j6 Z
- #include <asm/io.h>
, N+ y9 p: s% K& h; w) { - #include <linux/moduleparam.h>: ~9 J+ x! S. @1 \2 u+ l
- #include <linux/sysctl.h>4 p* w0 X% n0 _, z0 h/ `! t
- #include <linux/mm.h>
$ ?8 E; e& [* a' K - #include <linux/dma-mapping.h>8 \2 t. w3 |& }6 L
- |( a9 c1 w2 T" H$ b; B" `- #include <mach/memory.h>
2 t% v/ w& N8 d - #include <mach/hardware.h>: T! V9 Y0 W2 u0 X' U* U8 N
- #include <mach/irqs.h>* q" ^0 U7 [$ Q6 M H+ n' ^
- #include <asm/hardware/edma.h>
) d* I8 M# v% O- B& y - 9 V7 B3 z4 i+ @( K: R3 B6 z
- #undef EDMA3_DEBUG
! E# |: L/ A& Q( m - /*#define EDMA3_DEBUG*/
0 ]* M1 `0 |+ D3 M' B$ o2 P4 | - ! F/ b. R6 s. F* y
- #ifdef EDMA3_DEBUG
2 U2 y8 x# d$ E6 z( j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! b9 N# C8 t! r5 U z: }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, }1 e7 B' p( ^8 j& ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- u. o4 X* M% Z
- #else
: m; W4 ^$ s! X9 D3 V4 v - #define DMA_PRINTK( x... )0 O) Q5 I/ B9 J2 i0 ?1 O; S
- #define DMA_FN_IN
( P9 _% S& l/ b3 D9 p - #define DMA_FN_OUT* D. m, \& W I i" p6 f% i" k
- #endif; w& J% n7 J o# J, q3 ~
' C) M s% E. i, ]8 J( z2 A0 }" V0 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 Q# ?$ @/ S Z( o5 O) j
- #define STATIC_SHIFT 3. N7 B1 y+ T; V) p' D/ J' W+ R
- #define TCINTEN_SHIFT 205 w, M( K: S# G/ L! Q5 l
- #define ITCINTEN_SHIFT 21
' D- | ?- G! O4 W; O - #define TCCHEN_SHIFT 224 n4 k4 Z2 z3 ] N i* e
- #define ITCCHEN_SHIFT 23
" [" m' [% k9 W) q9 c" H6 X8 B/ r
3 O; r' c6 t0 \- static volatile int irqraised1 = 0;
* K0 V& |. P( ~% V# p5 S# z - static volatile int irqraised2 = 0;- O) J0 D, D1 K: }
- + h O1 C/ x4 C& M& [; q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e* T+ C8 e! j4 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% f' V( k9 r) m! T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); K G4 X( q) o! T
& c: C& L# {/ v+ p: D ?. V/ p- dma_addr_t dmaphyssrc1 = 0;- v. o9 h2 }% N& y( m# ]* d
- dma_addr_t dmaphyssrc2 = 0;
7 E" }4 o7 Q2 D& L - dma_addr_t dmaphysdest1 = 0;1 O4 q( j2 J4 }1 R' b4 s W
- dma_addr_t dmaphysdest2 = 0; r' L/ K* ]' n5 r
- 5 K- e0 n+ H7 s
- char *dmabufsrc1 = NULL;
" h) T7 ]/ Z$ o+ s7 A0 d - char *dmabufsrc2 = NULL;
+ Y. a1 Q( |- g3 [ k - char *dmabufdest1 = NULL;
+ ?7 ^" X" V# h. x9 j6 b3 s - char *dmabufdest2 = NULL;# ^: J3 r7 ^' C; m
: Z. ^* o4 I2 I+ N4 }- static int acnt = 512;
n2 L. h: d3 _8 y3 t* r) M$ S - static int bcnt = 8; ~; d6 q" }- C* E. O
- static int ccnt = 8;
* k! c7 C% }% {& F+ H& I0 c
+ J4 v4 {- h5 ?/ Z; \ k- module_param(acnt, int, S_IRUGO);
; A I7 K, l( Z/ f - module_param(bcnt, int, S_IRUGO);
6 _! ~ x) u7 s& ~9 E3 f - module_param(ccnt, int, S_IRUGO);
复制代码 7 I# r9 b" a3 U U5 C! Y' Q
+ k& f" D0 |1 V. }" i; _! T9 G" p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 w, B9 ^: M, D4 I) Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 `1 H$ D$ e$ c5 S; C6 U' I0 ~" J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 c2 v) J4 }; c( G, a) e% ^2 A1 J, O8 s3 G/ p
9 f3 p! L: |: G% C) \8 z
|
|