|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; `' i, p0 Q* d) L% v- [code]EDMA sample test application9 i. P$ @! T: c/ H
- /*/ |. H, [: Y: j: c, Q# Q
- * edma_test.c
8 b3 |, u+ j* I t3 z. A3 O - *
) z: [+ d! I2 V" e6 {: s - * brief EDMA3 Test Application
! p3 _; i @, e9 O - *
/ z6 G6 W* e) V7 v - * This file contains EDMA3 Test code.
4 x0 u& W* M% L. F7 T2 @ - *
' o$ d" L0 ~/ F: ~( j! d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 x. z D* r! q" p D' Z: x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 c! k8 k& g8 I( I( W9 B - * TO CHANGE.
" i4 |8 d7 M7 ^/ x# Q P - *
0 M# Z! V9 D U+ ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% m5 R" A% s5 |" o, B( a - *
( V3 D. V U+ i1 w6 E) k1 R( S- J - * This program is free software; you can redistribute it and/or
4 L7 R. U' k( I" h! V - * modify it under the terms of the GNU General Public License as7 e3 n" N* V6 E: w9 x4 j3 P3 H) f
- * published by the Free Software Foundation version 2.
6 I; l. M! _2 g - */ Q3 b5 d2 u6 L/ C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ @& w) N7 g* r" I/ n+ W
- * kind, whether express or implied; without even the implied warranty' @" Y; {, o$ I' U/ k6 m2 K5 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the P( \2 o* W1 M) t: `( B
- * GNU General Public License for more details.+ e# f7 l3 F4 ~7 z* i z5 I
- */
& N- s' {4 S, {; Z% S* k
0 @: \3 R( o/ l- #include <linux/module.h>
/ ]" E( }$ y/ a - #include <linux/init.h>
5 F/ {5 ?9 Y$ t# }8 v - #include <linux/errno.h>& v: }. Q% x4 L0 Y! L: w
- #include <linux/types.h>
5 z4 T# x0 ~+ h* @ - #include <linux/interrupt.h>- P5 ^, [- i) x2 v3 j
- #include <asm/io.h>
; ~# p7 U7 ^8 D0 A/ F6 l - #include <linux/moduleparam.h>
3 N0 G% _* C" M4 L - #include <linux/sysctl.h>
# K- a0 O+ ^, v5 ^ - #include <linux/mm.h>9 i m6 v8 B C9 p
- #include <linux/dma-mapping.h>6 |! L, B8 B) ~3 N! s* u
2 \8 l. s* Y1 K$ e2 R, j5 U$ n. E- #include <mach/memory.h>
6 B7 G; M+ D$ x2 I2 X - #include <mach/hardware.h>
' C7 Z/ F4 }; D' G2 |- G! @. T - #include <mach/irqs.h>: F( r1 s$ |; k, x: W
- #include <asm/hardware/edma.h>5 v2 k" U1 Y- t1 l
- . `/ Y. V! M) a1 g3 b# g
- #undef EDMA3_DEBUG8 A1 I- m- v# L+ o
- /*#define EDMA3_DEBUG*/, G- ~ Y& N! N2 V1 ^6 x6 X+ q' c
- ; q( R( a: K# i) g& T- P2 X
- #ifdef EDMA3_DEBUG2 ^: T& n& I- c/ |7 c. w4 U5 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; _: h% T7 A; w. w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): d; N1 t* U. r2 q) V4 b+ n. L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) }' F4 M" ^" B" w& x
- #else1 R8 q$ L( u7 V8 M8 S
- #define DMA_PRINTK( x... )
- T9 q! R3 I- }! R3 I3 v - #define DMA_FN_IN
3 Z4 b! j2 |0 L" A - #define DMA_FN_OUT! j; |0 s* O. M J P
- #endif6 L7 e2 Y2 E& B, S9 j8 @$ r; @' Y( H
- 5 F- V0 O; n5 m. C! Z# L- ?, Q; F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 ~; k5 g1 t$ Y$ c$ H
- #define STATIC_SHIFT 3
4 e$ w6 k$ ]+ d9 y - #define TCINTEN_SHIFT 20
2 v8 Q; ?+ @. e4 \ - #define ITCINTEN_SHIFT 21
9 u, q* K! g6 o& C# \$ K. a - #define TCCHEN_SHIFT 228 g2 o' J8 W7 X
- #define ITCCHEN_SHIFT 23
2 ^/ T C8 S+ R, T$ r0 L8 _% c
1 H* M% N9 F8 |5 T; y! ]- static volatile int irqraised1 = 0;, q/ E/ H" D0 \7 R2 `6 t, V
- static volatile int irqraised2 = 0;
0 z1 A8 G! {5 p; P _+ u# p5 T5 l - 7 G& X0 s/ P1 z" J$ E6 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ `( | I: g) V4 ?0 ?3 p+ u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. T: k7 X2 @0 t6 a# Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a/ d, K! F+ y L+ b0 \- r
- ! m; w2 `. T: m+ j' l
- dma_addr_t dmaphyssrc1 = 0;! k. Y3 U8 i6 m
- dma_addr_t dmaphyssrc2 = 0;
# h* S' k' ~0 W. \8 } \ - dma_addr_t dmaphysdest1 = 0;
+ C' q$ l1 O9 F, g9 z" \ - dma_addr_t dmaphysdest2 = 0;. |: k H' H# ~0 u g' d
' I1 a! ^4 L4 }* J. u2 L1 A; Q- char *dmabufsrc1 = NULL;" {, z3 e/ O V N, V
- char *dmabufsrc2 = NULL;
7 Y. ~# L/ q# @ - char *dmabufdest1 = NULL;
; i5 T" B" v- G& }4 ~% v( w - char *dmabufdest2 = NULL;7 Q4 A' o/ Y# m; S: h
1 N4 ~9 U' S4 ?4 Y) ~& K$ X- static int acnt = 512;
# ?/ t/ f3 U" @ - static int bcnt = 8;. P) ~" J, H7 m& j- y2 l
- static int ccnt = 8;
5 ?6 [. }/ X: |( {1 m - 2 t1 K, u2 b7 z$ K C
- module_param(acnt, int, S_IRUGO);% o( a# {$ {5 j& i& o' b! P( R
- module_param(bcnt, int, S_IRUGO);0 w: d$ G7 ] r9 X- F5 N- O; p
- module_param(ccnt, int, S_IRUGO);
复制代码 ) B+ z P( N' A$ w4 J$ z
: c# L6 ?, i; ~3 E2 s: x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 \- J! O; _6 q; I; s$ T2 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 v3 m; f1 Z& [' e; r1 X1 A a3 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& b/ Q! |& }% [7 t- ], Q. v
; f* g) A7 K/ [" @ b* G
4 q4 r8 F! |1 B+ v |
|