|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( D% a" M* r* g5 o- [code]EDMA sample test application. k9 b' H, p0 u
- /*: w4 }+ Q( w$ i
- * edma_test.c
* }5 e* q! W' Y# o - *
! K- G5 c, {0 x# B - * brief EDMA3 Test Application
0 ?& j$ N. G; d" W1 L* | - *
- e. H, f0 O2 [/ J+ P4 ^2 k - * This file contains EDMA3 Test code.
( Y8 }# o9 U- T1 x; i" Y' g, Q& z - *
. U" f! F: N$ @* F2 R: k* ? `4 f; X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ o, _% q" ?7 ~. m/ l0 T8 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) F; D, p0 M) t; g V3 o! b) l% R4 J1 { - * TO CHANGE.
, u! Z0 s9 S8 V9 o9 R - *4 x7 o n+ M# t9 J2 b) b; w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# q5 a6 x/ U7 Z9 W2 u
- *
) h* D: ~, T7 o. X5 d% J$ l; X3 Y& ^5 j - * This program is free software; you can redistribute it and/or8 `% B- O7 X( e% v$ P& b
- * modify it under the terms of the GNU General Public License as& w* |* @8 K4 I( ]- M; h
- * published by the Free Software Foundation version 2.
9 F; S& n0 q# S! [ - *
: p# w! e W/ B7 Q! y- g0 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; z+ }9 _. D6 l0 K' b - * kind, whether express or implied; without even the implied warranty/ f& n# U2 A. Q' O# }: Y {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" U& Y/ y: ?+ X7 m2 W e, h+ U - * GNU General Public License for more details.
o% P: S: G- ?8 k; [ - */
; m) X. I! h, C3 t' y1 r4 \# L
4 U P9 r6 Q7 @) c E- #include <linux/module.h>
5 Y- u) x& Z2 h3 B- X - #include <linux/init.h>
( b+ M. K% r6 T o5 U0 {5 P/ \ - #include <linux/errno.h>8 f% ]4 S. e: N4 f- R* A# |
- #include <linux/types.h>
# N) _/ x! D5 F9 T - #include <linux/interrupt.h>
; c/ e" x4 e5 P9 n0 ~ H - #include <asm/io.h>
* N0 [) K2 M+ V6 Q# U5 z# A1 R - #include <linux/moduleparam.h>/ ~) {6 D! h$ \, k
- #include <linux/sysctl.h>0 f3 I7 I9 T/ t
- #include <linux/mm.h>
8 v8 |) u8 i Z% t* `: E; ? - #include <linux/dma-mapping.h>
/ Z6 X, ]: T3 ? t. I9 D3 c. u - 0 n; h1 C+ ?3 Z- L& ^/ t
- #include <mach/memory.h>
9 @8 _& f+ a+ U" R1 N6 @- S6 t - #include <mach/hardware.h>
! W/ x) w, ~2 a- U& W+ |' f6 r& o( q - #include <mach/irqs.h>
: O" j! y: c1 W% w; b' P/ B# q% E. a - #include <asm/hardware/edma.h>
W* ]2 B( X2 O( R* S6 t0 ~, t6 w" v
7 z( D) v$ N: {5 j) e- b0 A3 i- #undef EDMA3_DEBUG
: O$ b+ _2 D" j- u - /*#define EDMA3_DEBUG*/+ y) ]8 R3 ^1 r# s
$ Q% P/ P5 I9 a% `- #ifdef EDMA3_DEBUG" Y9 s. @" X" ?7 i8 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% i+ l& @; O1 C& R- T) v( a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ V" O8 F# l. a/ s7 r& {! T, B: J7 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 K; Q/ a: L a/ z. v9 e& n6 O - #else1 L) j: W0 x1 p1 E6 `
- #define DMA_PRINTK( x... )/ o% X1 N# F( K; G; _
- #define DMA_FN_IN" M: L/ L3 _! ]! ~0 r* V8 G: m
- #define DMA_FN_OUT
# t" I s. F1 C; C8 s1 p5 u - #endif7 U) ~" [6 n4 f" |% S$ \6 ~
- $ S( b1 j4 u2 K. S8 Y6 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 L" F" W- ?$ @0 N) R7 i( [/ j( s7 o
- #define STATIC_SHIFT 3
, Q: Y# }0 h: V! r - #define TCINTEN_SHIFT 20
& B3 T5 h5 ~9 K! ]8 y O% a5 P Z7 w - #define ITCINTEN_SHIFT 21
3 T0 e7 Y+ a+ a5 B5 J- j - #define TCCHEN_SHIFT 22
x% M) [ [+ ? - #define ITCCHEN_SHIFT 23
* K; \( J" |' w - 4 b; x( A* C" @+ G
- static volatile int irqraised1 = 0;
8 ~: u8 b- h$ X- i8 R& O - static volatile int irqraised2 = 0;
9 }% e7 g6 Q3 k* j
9 s1 `# G; z" R0 | L- J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# U/ I" d' |! F/ f) x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y7 Y% ^0 a5 d- j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A0 {+ Q3 H# E
! c [& ~, b) b0 I W# O- dma_addr_t dmaphyssrc1 = 0;' ~" J5 y6 R5 m( S' \( t$ b7 V
- dma_addr_t dmaphyssrc2 = 0;3 V4 q, Q" v$ Z
- dma_addr_t dmaphysdest1 = 0;
- s4 ^3 p4 q) p% g' u5 | - dma_addr_t dmaphysdest2 = 0;( H8 q+ b2 d8 _" g! d
- * O7 W ~; e( d# w
- char *dmabufsrc1 = NULL;$ P: d5 r a1 Y7 F+ D( z
- char *dmabufsrc2 = NULL;4 @3 d$ w* \ e2 C
- char *dmabufdest1 = NULL;
) _: a6 b% I9 `- t! }( _ - char *dmabufdest2 = NULL;
2 v! d1 g E# D& @3 F - * d# O( `# K, R' ~
- static int acnt = 512;
9 x7 L! F: W+ J4 D4 B o. h& c - static int bcnt = 8;
1 V3 ^% C3 m. `2 y - static int ccnt = 8;
; e2 D0 g( F; g! j - 0 F( L% d- G# i+ P$ v
- module_param(acnt, int, S_IRUGO);
3 J' i; Y G) N; C* b, c5 S" y" w - module_param(bcnt, int, S_IRUGO);
3 R& {0 U7 Q4 k2 n - module_param(ccnt, int, S_IRUGO);
复制代码 & z0 [$ L+ s& t: P: `: ~* P; _
$ K: [5 J5 B: U" e, R+ X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 w7 c1 w6 r! \" k9 ~6 v% [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( x1 a J b* O4 n" f% D. o8 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! e8 h4 W# x: w4 c6 M
5 Z; V7 @3 A' y# j2 ^; L& z0 {- J/ V; Y6 X: `+ X% |7 @' Y
|
|