|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 ]! u" K* u6 G, f% h( e- [code]EDMA sample test application( y$ @2 K& k1 V6 |; y! y. h( I5 v
- /*
( X. N/ ^" ?+ [6 `( d: {0 Y2 B - * edma_test.c0 F/ W" Y2 c6 M- v j; s- T |
- *
) m4 N4 q4 P/ |0 d8 c- Y4 N - * brief EDMA3 Test Application
+ _' k( A3 h5 T - *' L( V6 o" _" \ V, f
- * This file contains EDMA3 Test code.0 C0 j- X, a. _% [
- *
) a8 N. _3 ^( Y: a4 X& L4 }! o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% D4 e @; X4 t/ G" b1 ]5 S: _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: U2 N+ _$ i, U% O3 F n. q9 W/ ?
- * TO CHANGE.0 {/ m) G. k) o2 Y
- *
& j0 e5 [5 T7 M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% x! ]. s) V- B' `1 a# \
- *# w+ M& Z; a- h3 v
- * This program is free software; you can redistribute it and/or0 z( t- {1 A, [) Q& I( h
- * modify it under the terms of the GNU General Public License as- g% I! Q0 D' @: K0 b
- * published by the Free Software Foundation version 2.
+ a% ]4 q9 h. u% X/ C- d - *: _" @8 R' U* l% e: w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w0 I* I* x2 O- z% z, r
- * kind, whether express or implied; without even the implied warranty) v0 Y& v1 b3 S; c! m" X% p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 G2 d. D" V/ d2 G& H7 K - * GNU General Public License for more details.
0 v9 C: ?3 n/ }& w b6 A: q - */
" s* h9 c/ H- _6 W. Y9 F2 ] - - d& T" P9 a: g* b
- #include <linux/module.h>8 |" H: W7 O0 x- u/ r
- #include <linux/init.h>: L9 ~ {5 G- |
- #include <linux/errno.h>3 f+ e' |1 V( L+ s6 g1 I5 J
- #include <linux/types.h>1 W" N; y: i: j8 e3 h, w% @3 m
- #include <linux/interrupt.h>
2 f1 j& ^. G/ H7 v2 O9 a% M! q - #include <asm/io.h>
/ y5 i. O% o" ` t - #include <linux/moduleparam.h>
7 v9 a, i W) ?5 X - #include <linux/sysctl.h>
; N! S# J( V* n( t8 p - #include <linux/mm.h>) ^4 t. y; V1 z! x$ ~5 G/ L! k
- #include <linux/dma-mapping.h>
( e1 b; {7 ?3 e0 j - / K4 a$ R1 U0 H
- #include <mach/memory.h>
& [; G& P" Q- ^# G. S- s - #include <mach/hardware.h>2 V" V2 E H1 K c% S% M+ j
- #include <mach/irqs.h>% x9 _0 o0 C. q- d( l( @
- #include <asm/hardware/edma.h>, v0 I0 E; ?% O6 {$ r* f
+ x L' S1 [+ f: v* S- #undef EDMA3_DEBUG
6 u2 a* r, Z; G- H8 {* m8 ~& S' j - /*#define EDMA3_DEBUG*/
$ T* c# T0 G. h4 b" P8 h' ~ - , u+ D# R; `( G4 Q; R& D9 y! o
- #ifdef EDMA3_DEBUG/ F2 ]( a9 f8 {6 b- c7 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 d; p) d/ C M' V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 w5 |! V8 G H0 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 m: j0 ~, d) @/ i - #else
7 j3 b# u# P% G7 h# V0 Z0 M& m - #define DMA_PRINTK( x... )6 @6 y6 }& X+ ]
- #define DMA_FN_IN0 G7 d% W$ M- c0 n; ~( s m, m
- #define DMA_FN_OUT
- ?2 I6 D! ^' r: g3 H m6 f - #endif
9 w, A' K& x5 Z* w7 { - : r6 B* A0 F2 u. {$ t$ v; z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 s! W% F5 m) p9 H5 E; ~ - #define STATIC_SHIFT 3
3 A$ g# D# g! A$ _6 V3 Y& E - #define TCINTEN_SHIFT 202 a1 g6 d0 k- I5 V+ I _$ {5 ^
- #define ITCINTEN_SHIFT 214 G& ?- q* f" X4 c( H
- #define TCCHEN_SHIFT 22
# @- Q' b) }( e; F2 J - #define ITCCHEN_SHIFT 23; o& z* f% s( W( X
- - l- `3 N, C- j, _8 g2 q3 ]
- static volatile int irqraised1 = 0;1 j+ Y; J( r( D- e j0 }
- static volatile int irqraised2 = 0;
+ z; _1 ~- O$ j* O, H4 s
1 @# X% D6 u0 K) ]8 t% J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w) R# P* r9 U- C/ Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' o. \9 z2 S2 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q" |1 V3 A. i
- p' I* k% s i- dma_addr_t dmaphyssrc1 = 0;
U6 n0 B' s6 H& `- H" R" O7 n - dma_addr_t dmaphyssrc2 = 0;
+ C- S: s8 _, u2 a) |$ f - dma_addr_t dmaphysdest1 = 0;
$ O4 a. m& D5 H) F9 a. d - dma_addr_t dmaphysdest2 = 0;
# B7 a K7 ]9 j9 v; l. l% u, W! K - & V# U# S6 l; ]7 p! _" [
- char *dmabufsrc1 = NULL;) u a1 ?" W; r7 {
- char *dmabufsrc2 = NULL;; J) _" a+ l( F! M, `
- char *dmabufdest1 = NULL;
+ J3 K+ }. A. p& I% W2 l1 |% x - char *dmabufdest2 = NULL;
$ h0 M5 P- ?' n6 a) R% q: M
- t: ]" I2 n1 t! W, x) ?- static int acnt = 512;
' \1 c. q# {, m$ A7 R - static int bcnt = 8;* W% ` i c3 k3 p% o) [
- static int ccnt = 8;0 C8 d/ u- \3 D& G
- 2 V7 I+ L0 s5 N- T+ [
- module_param(acnt, int, S_IRUGO); z' i' C! n6 ~) p- o1 f
- module_param(bcnt, int, S_IRUGO);! E- H3 I" q3 k: P
- module_param(ccnt, int, S_IRUGO);
复制代码 4 P5 m3 s2 R6 J( A( r0 \
5 ~9 i8 J: }5 k: t4 ~# s2 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, o: g; H8 `" g" v" I4 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! b# I3 x( I) Q4 ~4 h1 d9 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; y9 W' x; \* Z$ @& X( ^$ ~. s) L& [# W! \$ c
6 U7 W8 Z8 n) d: w3 t! [ |
|