|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # N9 H- ?: _0 _- J. o7 ~ \- T' L& [! a( S
- [code]EDMA sample test application
' s+ n) i/ O ?4 r, }/ ^2 i - /*
+ I- m* e* B. h - * edma_test.c
$ b9 m5 \$ {9 I- u - *
0 @7 B$ X' k) q B* A$ |, w - * brief EDMA3 Test Application
7 b# U8 q0 E. {1 S2 N+ u - *6 N; O) U; n9 P9 Y, [$ @; o) t
- * This file contains EDMA3 Test code.! C% }: ~8 k( O" G) N, Z3 B% J) B
- *: y4 k. ?' |$ W" W; _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% L+ @; d+ P# r- [4 a# m& ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& D" j% N) o8 `% V5 }
- * TO CHANGE.5 M1 e) { Y% u8 |) q+ n
- *
# u2 ^! T6 s' A& S* u6 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! x$ P [( k8 B
- *( {( R- v, A4 D- e' Z
- * This program is free software; you can redistribute it and/or
: n/ p. R* c# ]6 Z1 R - * modify it under the terms of the GNU General Public License as0 x, p* D: N+ G/ K g5 U
- * published by the Free Software Foundation version 2.' A1 n9 v' ~! f$ \
- *
! a* Y) H T% `; E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 t; J2 O3 _. q& |8 ]8 \
- * kind, whether express or implied; without even the implied warranty" P& u# N7 l! |, g% u- p# Z5 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 i6 z6 f5 a# M# v- O4 u - * GNU General Public License for more details.
2 T; Z: p$ [7 n" K! s" c - */
( K- f4 g# {8 s. ~ } - $ J! i+ _8 g$ X% ~
- #include <linux/module.h>
% F, w5 c, K2 {/ G# r - #include <linux/init.h>$ e) S' d. H; q0 A: ~- l+ J( r
- #include <linux/errno.h>
& {# ` {# ~0 H, F" r7 b' q) K - #include <linux/types.h>
3 `/ W. I: Q* h. L+ I3 `3 A - #include <linux/interrupt.h>
6 a" W7 |1 w$ C# x" L/ p( \; B$ v - #include <asm/io.h>
+ ?% R/ h. _9 d - #include <linux/moduleparam.h>* }' D% n7 _+ C* m4 q/ j! J/ _
- #include <linux/sysctl.h>
* U: ^0 e5 Z& |' ^9 { - #include <linux/mm.h>$ \" J2 Y, u& X5 W$ b+ _
- #include <linux/dma-mapping.h>
7 @# Y( ^- L3 I7 a
- ^3 Z1 ^9 F( p% r: d- #include <mach/memory.h>
' P Y5 ^" w. S8 G* r3 L5 y# r - #include <mach/hardware.h>, g _* F1 Y3 w8 `7 X& i) N" \5 t
- #include <mach/irqs.h>' _6 [5 w7 z: V9 A
- #include <asm/hardware/edma.h>
7 B0 s2 Z C! M, ~; x' g
9 n6 d! A9 h1 P- #undef EDMA3_DEBUG
" B4 V# Z+ V: i - /*#define EDMA3_DEBUG*/1 `- \! W5 s w7 E: N# x$ n' J* m* [
- " K8 x, u6 ?' N
- #ifdef EDMA3_DEBUG
, ~8 ]# K; ]3 D+ B! T2 q2 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ^# q3 `* F3 o, W* x5 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): @! R+ Y( k/ Z4 b+ g% M) f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% U! N& O7 I5 }+ c: Y
- #else7 G5 S( I. \" L# z! T* w+ P
- #define DMA_PRINTK( x... ). q. p9 C4 D1 O& a
- #define DMA_FN_IN1 j& ^1 N7 j- k2 R* M" X
- #define DMA_FN_OUT
1 N8 x5 R$ i0 x7 i/ j - #endif
9 {* U+ I9 J+ d3 w D& Q" ] - : Z6 ~/ h% P P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 v& {3 z+ n8 K0 E2 `8 r! Y1 p - #define STATIC_SHIFT 3* \2 w2 O% g$ L( r8 v# g
- #define TCINTEN_SHIFT 20
- v f0 d" Z% ]1 d3 }! T - #define ITCINTEN_SHIFT 21) f3 {+ S/ A1 u9 h# h; Z1 s |
- #define TCCHEN_SHIFT 22
5 T/ n% L& k$ n1 C- M* D3 Q8 K: H - #define ITCCHEN_SHIFT 23
Y* U+ X' }/ b- W7 d: @: Z
$ ]0 u0 I( s& S6 e8 c- o2 V- F S- static volatile int irqraised1 = 0;
$ V8 U) j o& i) e* N h - static volatile int irqraised2 = 0;
8 s: {+ {! O$ A3 m3 {7 u - 4 X! W: |! S/ x. v- W: D! h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?6 [$ e$ G, u+ V7 F3 b3 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( \; s _& H w- c' k- R% r' x5 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y9 X+ d0 A3 c
+ Z; H1 x. c! U* \- dma_addr_t dmaphyssrc1 = 0;9 t; d& J' ~( P9 F+ _
- dma_addr_t dmaphyssrc2 = 0;% ^5 J! ^" c( _$ U( X, {
- dma_addr_t dmaphysdest1 = 0;& w ^5 Y1 K1 B& p' p4 P- s7 e l" Z
- dma_addr_t dmaphysdest2 = 0;% a: V6 }3 H# b5 g* M
I* e; U; u4 N$ G) g- char *dmabufsrc1 = NULL;
" E& }" _% k& {2 D5 r& P- m - char *dmabufsrc2 = NULL;
$ V w% P4 N% l/ _1 G# h - char *dmabufdest1 = NULL;
* n" `) C! r$ ?2 G3 N - char *dmabufdest2 = NULL;. R% }" o1 i" y% z: K' O
6 {& L" n5 I( j9 W3 L2 d! w0 |9 c- static int acnt = 512;1 @! H6 K$ X3 A B! h
- static int bcnt = 8;
& b- B: d5 u# M! i! C \ - static int ccnt = 8;) O1 a. a7 C! J$ ]
3 N! e# z( B- x; G- module_param(acnt, int, S_IRUGO);
7 C: e* P4 d7 |- J! ? - module_param(bcnt, int, S_IRUGO);$ c1 d6 Q6 r+ }2 q- q1 P
- module_param(ccnt, int, S_IRUGO);
复制代码 / i3 U1 o: D5 T0 Z
% b/ V/ z0 {8 n4 ]* u% ?# @/ n. s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T- W* c. }$ i+ H# [5 H3 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: }( R! p: g6 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 E5 h- C8 s/ X" k6 c0 }& u
! G, _5 m: l9 @3 V& F
7 l8 x2 m. s9 j6 r0 O |
|