|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x, x' ]1 M5 J4 m
- [code]EDMA sample test application! B/ H! w+ k" h; A# I
- /*
4 v& Z5 ^6 a6 }1 I; o0 h' Q - * edma_test.c8 `" d# q6 E% j& H6 H. _6 Z
- *
" `2 b) B q3 N6 m* | - * brief EDMA3 Test Application
$ g+ a: B! v/ { - *
6 i6 H, q o6 `) u( b9 D - * This file contains EDMA3 Test code.
! R! }4 a; b% t5 m% m, v4 K - ** N6 G5 O" L0 F1 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- w( e. e$ Q i. v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- F! M( c% O F |" T
- * TO CHANGE.
3 A$ k. E; y4 f6 @, \# @7 M, }) M - *3 c3 f, \$ d4 Z( N! d0 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ n3 G8 z! `% N) o
- *, c/ V5 e( ~8 D6 Z! L
- * This program is free software; you can redistribute it and/or
5 H- |3 y, }4 m5 d) k - * modify it under the terms of the GNU General Public License as y& ]/ ^2 z) ] a
- * published by the Free Software Foundation version 2.0 E. h1 S5 P& O d) k, x, f7 v7 S
- * E3 B S1 w4 @! q" W$ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( M- E- C, W6 r" H1 D) S: G- v7 C! t - * kind, whether express or implied; without even the implied warranty! k' Q7 R1 u7 t$ B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* d; Q" E9 F7 ^# g7 [- x; w
- * GNU General Public License for more details.
+ g& k9 k7 c' G/ ?$ G3 N - */. L' G+ L. g& e+ \9 z7 G
- `" z3 k" L! d# u9 B6 [$ o1 X
- #include <linux/module.h>
7 F9 V2 S1 i( W - #include <linux/init.h>
" W$ k/ }- i( T; V' C9 I - #include <linux/errno.h>
) G3 M! n$ g1 j2 d9 _ - #include <linux/types.h>' L2 s6 z( G1 I- M
- #include <linux/interrupt.h># j2 `& h2 L% g3 {
- #include <asm/io.h>
X, C1 E1 v6 Q - #include <linux/moduleparam.h>( T, K5 l( K8 Y6 L
- #include <linux/sysctl.h>- o1 [" O. Z% E7 y3 _, C2 Z3 }
- #include <linux/mm.h>; M3 Z7 }. o6 }$ y2 h/ n
- #include <linux/dma-mapping.h>+ Y7 D5 n! \; u3 m- {1 W5 p% W
1 Z! m3 l& k/ \2 C- #include <mach/memory.h>1 F2 U" E- d8 @3 [" h
- #include <mach/hardware.h>
1 v3 s$ u6 g# x - #include <mach/irqs.h># G- B- b9 i. [ x M. W$ L
- #include <asm/hardware/edma.h>
* b! @ T1 Z( b% g# d# j$ Z) Z
) a' a) f0 b2 a5 L) N& [ b- #undef EDMA3_DEBUG- G) l) k4 X% s: E5 B. ]+ p
- /*#define EDMA3_DEBUG*/- b: t- W) E- d% ]& K" p, a* y
- 6 ?' f2 R5 F0 O% V
- #ifdef EDMA3_DEBUG
, y6 h# N* g8 N5 n. w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- g# B2 F$ C' |$ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): e, c8 d) p% f' b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 \' I+ H4 @* x) B% H' k0 C8 D - #else
+ ^8 q2 l3 `" g- d+ ^2 j1 e - #define DMA_PRINTK( x... )
+ g+ {4 \/ W" y [* h9 o! C& Y - #define DMA_FN_IN
$ @6 {" U: e( W, S b: g - #define DMA_FN_OUT
0 d0 s! J) e9 a+ Q$ ]" O1 D - #endif k, R; V7 g- g8 m8 u% I2 P
- 3 U/ x" x m9 i: R; H D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
S: e- h8 q7 } - #define STATIC_SHIFT 3
/ ]/ J @4 M7 t$ o; P Q z - #define TCINTEN_SHIFT 20
1 C/ K9 h% S# r - #define ITCINTEN_SHIFT 21
1 U. {$ j5 _+ x' f - #define TCCHEN_SHIFT 221 T" W2 [8 |) O# i) l1 m* y% n
- #define ITCCHEN_SHIFT 23
2 j& z; H* k: q9 T7 J! j - 8 `' i# B5 c6 v8 S
- static volatile int irqraised1 = 0;' x& I" R/ T% [
- static volatile int irqraised2 = 0;
' U: T; A( ]4 ]* I* l# e0 p - / b7 D: M7 ]$ Y6 w$ U4 Q3 k+ N4 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l8 K6 g) I6 N `& R2 N0 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 p+ ~! M3 n! Y6 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a+ q) T9 U: R Y4 g V5 q
( h: U L3 P9 u$ N. o; q. Q% s% G2 v- dma_addr_t dmaphyssrc1 = 0;+ {- |4 D$ L1 P6 \4 z
- dma_addr_t dmaphyssrc2 = 0;
5 g) L- Z+ O5 N- y - dma_addr_t dmaphysdest1 = 0;
f$ G: p/ s) ]/ B. f7 i% `: w1 B - dma_addr_t dmaphysdest2 = 0;7 @; e% b7 j6 {. m7 [9 W
- : @' g, m1 o2 j* a' E5 F) u
- char *dmabufsrc1 = NULL;0 a! Y* S) s9 Y7 f5 b
- char *dmabufsrc2 = NULL;
c7 s' p" I q. Q - char *dmabufdest1 = NULL;
2 K+ o5 k+ N; `3 {8 ?: v. } - char *dmabufdest2 = NULL;7 W- Z( }" K% g6 B
9 |8 [) B. n1 Y- static int acnt = 512;
8 x7 S% I1 _5 _ D* \ - static int bcnt = 8;
" t" d+ l+ D3 N% F8 Y' { - static int ccnt = 8;
( M' Z; E3 Y8 h5 `2 t; O$ R* D - 9 l4 S0 e1 h! T, N- H& t
- module_param(acnt, int, S_IRUGO);3 \- M- N1 X3 ~ d5 a% x
- module_param(bcnt, int, S_IRUGO);3 ~2 m. D1 l. ]7 {8 c
- module_param(ccnt, int, S_IRUGO);
复制代码
p B1 ^$ R' r U
* B6 U' [& L' Q& o- O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" S* E0 Z& _2 ]$ ] z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' K, q9 l0 u; l- I% D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 I+ v3 \9 I% G% N; g: Q/ L
+ J7 m* {+ _6 l, ?7 A- W) P
/ Z2 F# [7 ]8 y) z. R/ J8 S+ R |
|