|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . S( i5 D; ^$ Q1 a" X _) P
- [code]EDMA sample test application' E5 V5 G$ m; c/ @4 ~1 V$ l
- /*
6 q; P6 _" q" t( b: P4 E - * edma_test.c
+ C" r- Z- \/ v! K/ w- y7 H - *
1 Y+ j5 B; r0 k, {7 A - * brief EDMA3 Test Application4 U5 Z9 s* c, |
- * I$ G/ j( _- K' s' Y& M
- * This file contains EDMA3 Test code.0 }1 e& z5 z4 n1 }* ~
- *
' n; N9 Y* ?* I1 x3 f6 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! f% {+ t* l" g. ~8 c) Z3 t! E2 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ J6 t' ~3 e# V9 C) O - * TO CHANGE.. O- y2 \! N. [3 f! T! a4 x
- *' i7 r* `' w! |9 i& m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ P4 |" {+ z2 l3 A! b2 o; J% a' I
- *4 N/ O; Y: g# u* G' j0 Q. }
- * This program is free software; you can redistribute it and/or6 |+ r7 t* H: q9 u# s) `3 q
- * modify it under the terms of the GNU General Public License as
7 ]9 v% [6 R! g' d8 ]& m - * published by the Free Software Foundation version 2.- w0 Y% O8 w4 k# ]
- *
" B5 h, [2 @# R6 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 r& A6 a5 s6 J. o' C - * kind, whether express or implied; without even the implied warranty
1 A7 `' V6 P0 c5 u. F/ V! P# M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 [0 n- A+ |8 N/ `6 S. G
- * GNU General Public License for more details.
/ s' c6 L# m# n. a# k: n" R# j6 C - */
% K; g2 Q( a" I5 O5 {( h
2 ^8 o" x" m4 K7 A0 x6 s- #include <linux/module.h>
/ E7 S6 [6 S6 A) {8 z- A- ] - #include <linux/init.h>
2 A6 y& O: |* z - #include <linux/errno.h>
( O8 B2 c0 @5 m4 P - #include <linux/types.h>9 x% b7 H3 |# h, P% I/ ^: }
- #include <linux/interrupt.h>
7 `% B3 W1 G1 T6 Q1 ^4 D; T% C - #include <asm/io.h>
& n& M7 a% ]( \& P# n - #include <linux/moduleparam.h>% Q$ q. N- o7 ?) K4 y
- #include <linux/sysctl.h>
7 s# ?6 {! ^1 |6 Q& W - #include <linux/mm.h>: F, z+ A: X' c6 p& U/ M! `, D
- #include <linux/dma-mapping.h>, M! X, Z+ l: [) |
- 2 E, I& Z6 h7 R' r5 k! O
- #include <mach/memory.h>
; f8 d% K6 _6 P8 |- q; ], o - #include <mach/hardware.h>$ s- Q2 e3 ]* x; O+ n
- #include <mach/irqs.h>, C% n, {' T! Q( W
- #include <asm/hardware/edma.h>
3 y2 M- z, G( \) t! ?4 k/ W* x0 } - 8 t8 k$ r8 Y' e
- #undef EDMA3_DEBUG
; j [$ u/ Q% i" s2 p - /*#define EDMA3_DEBUG*/4 {0 ~( z5 C A* y# G. ]
- - @7 x+ d4 w4 C& j2 c4 `
- #ifdef EDMA3_DEBUG
+ s; y; k1 A/ G. p4 S9 D" Q, S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* C1 H. u! U/ t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ @9 ^( j. r+ m \7 q0 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- R$ i! G& y1 @; x7 E" a+ X# { - #else
6 F8 j! i+ f$ w0 X) p - #define DMA_PRINTK( x... )
; s% D4 q5 W4 F# V+ ~1 F - #define DMA_FN_IN' z* F& Z. [4 F0 P Q3 x! r; U
- #define DMA_FN_OUT
* |+ A- Y# B9 C' G5 G2 q9 x - #endif
: ?' y# R; H/ N1 \9 v
0 h5 E4 e- A2 N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
M( G# c( L p+ Q ]" {9 ^) X - #define STATIC_SHIFT 33 u, R0 W+ f2 J& U4 M1 B8 Z
- #define TCINTEN_SHIFT 20: r) A- o5 s; W+ Q! i) E2 Q
- #define ITCINTEN_SHIFT 21
, {5 X! O2 O7 E9 [/ E - #define TCCHEN_SHIFT 22
! y9 z1 b& m2 x4 t! ` - #define ITCCHEN_SHIFT 23
+ M1 ?+ m/ q0 q& {3 }* R - " P8 \9 l+ l c0 l' J( D
- static volatile int irqraised1 = 0;
+ O; O5 L% x) | - static volatile int irqraised2 = 0;1 C5 f% \7 y& J% w+ ^ ~
- 7 N! \6 d5 a/ A1 h9 R- T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H4 _. u7 b: R8 k& s/ D) q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `6 y. |- |3 c7 D: y4 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 @4 C1 n1 V& j: D, _6 S
4 [* t, Q: |" X; ?* R- dma_addr_t dmaphyssrc1 = 0;0 s- j6 ]' f% Z8 T3 M( }
- dma_addr_t dmaphyssrc2 = 0;3 H/ _2 h+ F8 B5 E: D) s' C& P
- dma_addr_t dmaphysdest1 = 0;
( E7 o, v# @ O8 L- |5 q" H s - dma_addr_t dmaphysdest2 = 0;
* z5 T0 |5 V& [7 n0 k% W- Q - ! Q& _* I' ^( J- g! E( k4 I
- char *dmabufsrc1 = NULL;
; @+ Z. G$ G# P" y# I# L - char *dmabufsrc2 = NULL;7 N9 J5 P) y- w. U, j7 V
- char *dmabufdest1 = NULL;2 V/ _0 A+ x5 ?' r6 V
- char *dmabufdest2 = NULL;
6 t) H( W! T% D5 M. Q3 O4 M3 a: _3 k - % K& ]+ Z% R" `4 B. j/ v! k
- static int acnt = 512;
% R2 q( [1 Z3 R' p8 B - static int bcnt = 8;
: ?: c" \( z$ n7 \ - static int ccnt = 8;
. F e2 _$ y+ A' C7 b v1 Q - & g3 g2 M/ H2 u: g3 q: w% t6 f
- module_param(acnt, int, S_IRUGO);
; `1 M* W* o: S7 M. K/ T' c, }% z4 s - module_param(bcnt, int, S_IRUGO);- D8 p) f; P$ F- |& t
- module_param(ccnt, int, S_IRUGO);
复制代码 * L( e4 L' r( v" `& ^5 I9 e
" g B0 v4 {- ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* T8 \/ n. Y! q/ }( u3 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. @+ l3 D7 R7 V. j9 s, Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% r3 ^7 ~% z8 s* @8 G+ f: l h1 ?. `8 c0 d3 b3 ~
1 U1 K9 k5 {5 l4 g |
|