|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 S( w8 Y, [; n! a/ R P- [code]EDMA sample test application
5 g, C; [& c \0 i - /*
. y" \% P' R$ G4 M1 o3 E% F4 Z - * edma_test.c1 ~+ @) {/ }& `4 i
- *
7 g" f3 p. t# r2 P$ c% S - * brief EDMA3 Test Application9 Y) c) _- N l
- *$ N. E0 ?5 g: P2 ^
- * This file contains EDMA3 Test code.
" G1 G% ]2 a* Y6 N2 V& U, Z% e - *
6 g9 ?. [( ~; C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ S* T p8 x- O" l0 E: E- j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B7 i( W. u" w2 }# B
- * TO CHANGE.
' |4 A9 W- D$ G: a3 s - *4 V: Q" X# b3 a( |# D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 P# ^4 `; V" Z2 p5 `5 N8 B# Z5 [( @ - *
( R0 A8 w A0 M* s' S - * This program is free software; you can redistribute it and/or
8 H/ M' Q0 _) {6 b& ?+ u - * modify it under the terms of the GNU General Public License as
1 K6 e" s- _) l1 g5 V7 q# f - * published by the Free Software Foundation version 2. J& ^1 i- r* h+ @/ _" s
- *
; A$ f% w8 S% W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 i* o' |; S9 f - * kind, whether express or implied; without even the implied warranty
8 n0 v4 G5 j# Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* [- ^# X, H: @9 e- Y - * GNU General Public License for more details.
0 f) n6 W U; F9 ^5 ?' {5 E - */* |3 [+ S, ^8 s1 f; C. D. U
- : q: _9 u* h( ~" I
- #include <linux/module.h>; O9 M3 g( l7 ?# e" u) V
- #include <linux/init.h>
2 ~2 `& S9 ^. i% F7 R. a B - #include <linux/errno.h>" d3 q/ B8 r( g# p4 o7 Z
- #include <linux/types.h>3 p X7 \' m* F* e" \1 @- X
- #include <linux/interrupt.h>
' t- O+ o1 E% @7 ] - #include <asm/io.h>/ n. f' P6 X/ m' T6 U3 n
- #include <linux/moduleparam.h>
4 \" @& [ P2 Q1 q - #include <linux/sysctl.h>
# J8 j# x8 M' y* a' } - #include <linux/mm.h>
5 @# l/ _3 G4 ]# I# @% R - #include <linux/dma-mapping.h>1 |- P8 |, ]" M
' v7 d$ w+ D9 J' D; v2 v# `8 j- #include <mach/memory.h>9 e) @# R1 g5 D+ K& M5 ^. b" n
- #include <mach/hardware.h>) ~! B1 p5 Q6 k+ _% k
- #include <mach/irqs.h>
0 A! w8 W) _. p: w8 i - #include <asm/hardware/edma.h>- R. A; I0 E( s+ B7 h
- : l G/ w _- J. _3 l: @6 U
- #undef EDMA3_DEBUG0 W" l) t: ]: Z2 w; ^7 m
- /*#define EDMA3_DEBUG*/
# t) p$ {" A" i' n& f3 E: b - / a1 i( b# W3 E2 s2 ^( C
- #ifdef EDMA3_DEBUG6 j; d1 k: O( j. ^; s+ X) u' J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 i* ~8 t. \3 K4 W9 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) W I9 c* E* N+ B' M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 W) f" {. I7 I1 V
- #else7 F9 A' _# `1 R2 W% V' `. h
- #define DMA_PRINTK( x... )8 z& h( z7 K; z; O# B2 L
- #define DMA_FN_IN, m: Q7 o, C9 E; Q7 S2 J& K) ], ?' a
- #define DMA_FN_OUT
' q; I0 H4 R! D" \( ^ - #endif
4 Y0 C& g; O1 f! k. w& ~3 ]
0 m- U3 S' ?3 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* ?# o* U+ ?5 o w1 }, e! h - #define STATIC_SHIFT 3; v1 w% K ~; K
- #define TCINTEN_SHIFT 20
1 K* M" _% X8 @/ u - #define ITCINTEN_SHIFT 217 X( H/ ?: [; t0 |
- #define TCCHEN_SHIFT 22
( |' r# X) l0 r4 f" b - #define ITCCHEN_SHIFT 23
, ]5 Q8 _. T, f2 P( K( w. B - 5 b7 W! P, O1 n; t2 X- g
- static volatile int irqraised1 = 0;
9 Z9 r( N" J; E. ] k - static volatile int irqraised2 = 0;, x4 x- b" _: Y3 y* {5 ^
+ x8 y2 D) e1 L7 ]4 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# }5 i l9 ^. E2 g) {' s2 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~* `+ K' V1 C+ `; C. O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
g- k8 x& z2 u5 P% _
" \4 H' {9 k4 k- i ]0 X Z R- dma_addr_t dmaphyssrc1 = 0; i) g; l# O" ?9 E ]7 i
- dma_addr_t dmaphyssrc2 = 0;6 {; _2 Z+ T* {0 s/ R
- dma_addr_t dmaphysdest1 = 0;, x7 b, B" `6 A% F; v5 O7 m" _
- dma_addr_t dmaphysdest2 = 0;
; b5 ~+ }# @% u+ X. i
) p$ O% n( e8 s6 }3 n& s5 [3 u7 ^- char *dmabufsrc1 = NULL;
6 _) i* i0 x+ R; b1 } - char *dmabufsrc2 = NULL;( m* R/ d) `; j$ h- g
- char *dmabufdest1 = NULL;
0 r. D% t, t& s, r - char *dmabufdest2 = NULL;9 m3 x, a6 U/ b! D5 d) P- V& d
( D- P0 z% x* u% L: Z4 s5 j- static int acnt = 512;
. u- \) E% e' d3 u7 H - static int bcnt = 8;2 R' \2 p2 q* ~# g1 Z" H
- static int ccnt = 8;+ ]) Q7 ~6 d- `& @- ]& _2 j. p
2 L, |( Z& h4 g& P- module_param(acnt, int, S_IRUGO);
7 k& i5 Q8 Z9 \$ y3 ?/ ]7 G! u6 Z - module_param(bcnt, int, S_IRUGO);8 n4 F6 `2 L9 `! u2 i
- module_param(ccnt, int, S_IRUGO);
复制代码
! h3 o+ h7 I' n3 m( J4 R$ h
- P" [- a& _0 X% k0 r* s4 F% s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 D& g* _/ y5 Q5 x# W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 _" \- E& | ?6 z+ q" t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ z' O' e7 N- Q/ \) s: \
A; v& }( ?4 H" Y& L
) L/ _1 U& T" a2 P* l |
|