|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m; x: ^! W7 J0 v* T- [code]EDMA sample test application
; ?- T# M n% w/ Z% W: ]0 o - /*
! R( K1 d1 R* W4 A - * edma_test.c9 F$ `5 k7 N& S) y2 l) M
- *
" h4 r5 r- y1 @2 H6 ^; |9 l - * brief EDMA3 Test Application1 O1 f0 F' K2 S/ ^' F. d' i
- *, @' t& m m @# ?5 J) X7 D
- * This file contains EDMA3 Test code.: Z+ n C+ a& _# g4 r
- *
) L+ \+ _ z7 x- }$ G t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" ?* }( Y/ k5 Q: ~. T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 J5 c1 B9 Y! Z* z( H- }/ g7 k& h) F
- * TO CHANGE.. i3 ?0 s3 g4 p% t. v
- *4 e. H3 u9 D7 s2 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- }! a8 ]) M5 r" ]4 d; T
- *) |6 l/ k( h# |* m
- * This program is free software; you can redistribute it and/or
! ]% P3 O1 S+ ]% j - * modify it under the terms of the GNU General Public License as
2 a u$ q# k0 v7 p+ o7 Z4 G( A: a - * published by the Free Software Foundation version 2.
+ X% X& F/ o& q' V- t - *- G% }' G4 _1 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ?! J0 d$ b T4 P/ y( ] - * kind, whether express or implied; without even the implied warranty
# h6 h# j' Z7 V( V" P3 ?, ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 c: b P; H$ D" y - * GNU General Public License for more details.
3 F" b" c7 _' { - */
3 g7 J, I' w5 r+ k6 ~ - ' k+ T2 m7 w: t& F4 K- M. n
- #include <linux/module.h>1 n+ y3 M3 v5 J, J7 x- A
- #include <linux/init.h>
0 y% E$ E9 I& X4 u - #include <linux/errno.h>+ b% S, m9 o& Y" x4 T/ F. ]' X: v: a
- #include <linux/types.h>/ A( Y: e+ `: M, k9 q+ t) q
- #include <linux/interrupt.h>/ C, H) ?( S& v
- #include <asm/io.h> n- g$ h2 c4 n9 I. K
- #include <linux/moduleparam.h>
2 f) E2 b9 k2 g3 s2 a - #include <linux/sysctl.h>0 J5 s7 Z* a: ~& ^) U- z
- #include <linux/mm.h>/ a! w) Z+ j) V v5 l b7 n
- #include <linux/dma-mapping.h>
+ P5 B6 V- V( s2 _ - , p5 y# J6 n j1 Y& I/ C
- #include <mach/memory.h>- C% j8 q5 p$ G' l3 ^: Y" @& n7 o8 ?3 p
- #include <mach/hardware.h>: ]) y5 L# F6 A1 Q( k) `$ b
- #include <mach/irqs.h>
7 V& o& t) @5 |- k4 A6 e! B - #include <asm/hardware/edma.h>
2 d" V* B7 }/ B s
/ k2 M; w+ u0 I- #undef EDMA3_DEBUG
& N/ U9 n; ` w' z! F' i - /*#define EDMA3_DEBUG*/
) q0 P" s# l4 o9 Q& \; l - & U( D8 C9 ?- m( K4 X' \2 s2 v
- #ifdef EDMA3_DEBUG
( U% {# O8 y) X; \) o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
M, D+ E: t- W; P/ [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ X9 J1 ?. y, W( J- ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 c4 S3 K9 O5 S9 D* F6 x8 c$ c - #else' b+ ^2 x. X4 L$ x' R
- #define DMA_PRINTK( x... )) g$ b$ @% R/ X5 h# T
- #define DMA_FN_IN
7 p# h7 ?) r8 E% O/ S6 ^. k - #define DMA_FN_OUT
) Z3 l: R/ ]$ X! S' W5 A' F - #endif0 V, C& X5 A+ V
- ) u" S" B! T- q( ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 W1 K8 a3 b+ P7 h ~% v) s
- #define STATIC_SHIFT 3
3 u! N; K2 e/ y j' ]9 v - #define TCINTEN_SHIFT 205 z. N' I" k: S3 q; |% a
- #define ITCINTEN_SHIFT 21
6 i0 {& [& N# S/ a! e8 t - #define TCCHEN_SHIFT 22
0 Y# R! T) M# G2 v - #define ITCCHEN_SHIFT 232 L) ~5 O7 \7 m7 O+ n2 U! E
- , M+ G, s' I" ^$ q0 m3 h; ^4 m
- static volatile int irqraised1 = 0;
: L' [; m" A2 ?. A% `, }3 P) n - static volatile int irqraised2 = 0;
9 p3 H }; L$ O3 U! q
4 }6 j0 ^& J3 Q: K& Q2 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ~, i4 v! E6 X* P. R& s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ?* c% c$ A! E0 h& N G: j; ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' _4 _9 o/ s. F3 W( w# _6 ~
- # m) Y+ v* R1 h. T+ b
- dma_addr_t dmaphyssrc1 = 0;
% P: g9 O$ `3 S$ l3 O0 r - dma_addr_t dmaphyssrc2 = 0;5 a& C. D, R; e3 ^) k
- dma_addr_t dmaphysdest1 = 0;
. Q! Z: c. C1 o4 D' |7 k/ k - dma_addr_t dmaphysdest2 = 0;5 r2 j! | @( r# A5 z
- + ]" [8 C* c/ q4 A- p
- char *dmabufsrc1 = NULL;
# T( O! i5 u) n6 L) [ - char *dmabufsrc2 = NULL;
" x- x V- a y6 w0 v* E - char *dmabufdest1 = NULL;% e" O" d6 ^/ x7 Q6 u5 B; h
- char *dmabufdest2 = NULL;
$ x1 T* Z( t0 L ]7 u
m" a. Y1 @1 i; a8 ~$ N- static int acnt = 512;4 C1 A. R7 |9 N2 A( P* M& ]& c7 r
- static int bcnt = 8;
B6 [0 `# z4 Q4 k+ i) | - static int ccnt = 8;3 J& x4 Z) p3 {
- A% d6 m6 P5 E8 ~- module_param(acnt, int, S_IRUGO);$ t4 n, v( ~* [2 J5 A& Q2 b7 h
- module_param(bcnt, int, S_IRUGO);
7 y. X7 g3 Y9 O' W6 B: P - module_param(ccnt, int, S_IRUGO);
复制代码 # u. F; b& J" ]3 N8 v' {3 ^% g
+ \. l6 R2 Y7 k" K7 ^- n+ F+ g+ f- v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 l6 N: n7 [8 Q- m/ h) Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 j- m9 ~$ ?9 D s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( y- P$ w4 b, c4 }2 e4 x
$ I' N0 `' }. N/ c: j) E% x, Z7 D5 @ d" ?# n8 M
|
|