|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- e* I) s3 l4 G/ R# a4 X- [code]EDMA sample test application
. \2 {& Y0 }, _$ ? K - /*2 X& }5 O6 `- |1 C7 R( P o
- * edma_test.c
5 F$ y2 W# K2 @7 ]2 M - *
# s9 o% Z. c' k4 d' P2 H! P - * brief EDMA3 Test Application7 @6 \' v2 p5 c4 ~0 u- d
- *" s) I1 r' u4 E* L& K
- * This file contains EDMA3 Test code.4 h5 \5 S( e& H1 A" j6 o* h
- ** R( V) M! F0 H* p/ f1 x, W1 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 u) Z' M: \) N. X& q; Y h/ X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: |) ^7 ~; T# r2 ^' X* n, L; _ - * TO CHANGE.9 J. b! D8 j/ Q5 n4 V l6 X
- *
G1 A6 x+ e C+ q1 o$ E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: o! @$ k- Q# c: x! C - *5 t) n9 G: M; o0 m+ S- A
- * This program is free software; you can redistribute it and/or4 Q+ `# w5 }% s6 {. I% K
- * modify it under the terms of the GNU General Public License as3 p7 \- j* Z+ |) Q( V
- * published by the Free Software Foundation version 2.
6 E5 l+ N5 B' e! s - *- |! D: p2 p% A/ l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- X; W& ^2 j% l- g' R, H
- * kind, whether express or implied; without even the implied warranty
* e. D6 G+ y, V/ X* f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 T- t2 Y8 U+ C) U7 K* K: g& l/ O - * GNU General Public License for more details.! I" S2 \* r# G) W" Q
- */
6 }4 A" \' j+ j; {, T/ M: b2 W& n
, y3 N. Z! m6 W& i: N! ` _- #include <linux/module.h>
2 T# L- y+ i! r/ P6 ?% K - #include <linux/init.h>
6 t R1 A2 y/ e6 E- Q9 B/ {+ ~( W - #include <linux/errno.h>
6 c) v/ A2 D2 V: f; k! h - #include <linux/types.h>3 J1 l( u: i" v* n6 ~
- #include <linux/interrupt.h>
" v9 M6 I. @% l6 E' T" x( s - #include <asm/io.h>+ {$ g0 S7 [, o o* D L! q/ \6 \2 ]
- #include <linux/moduleparam.h>
, W1 M; {' w" D- a% n# n2 s: m - #include <linux/sysctl.h>5 ]- J# Q/ U: G: b5 `) Q+ _0 X
- #include <linux/mm.h>( [) V& ~! r" Z7 l) W( v( K. Y6 N
- #include <linux/dma-mapping.h>- ^; o6 r# E. _: \
- ' O0 y+ |" r& l" j# C; @, i
- #include <mach/memory.h>
* ^. V+ w' _- J+ q. j - #include <mach/hardware.h>1 i7 G1 \' M$ @8 i$ h
- #include <mach/irqs.h>
1 `( p5 A' \9 I - #include <asm/hardware/edma.h>3 L# J& P7 B0 c" j
% ]& \. q- B. J, `- #undef EDMA3_DEBUG. r. h' g# C- R, V, N* I
- /*#define EDMA3_DEBUG*/4 A# s5 K; \* C: A( I
- * k+ O8 p/ q* W$ [+ c, c( o9 d
- #ifdef EDMA3_DEBUG* x. d9 n8 j2 b* |9 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* c. l% R5 P$ z) [# T8 t5 a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 D" z& R# N! e! I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: R" \+ J9 W: W( j - #else
D5 O& W# U, Q0 R- U! B - #define DMA_PRINTK( x... )
9 t8 q a) y; ], u - #define DMA_FN_IN9 k4 W7 Q1 \* g% C4 r
- #define DMA_FN_OUT
# h# D6 T5 Z% B! @ - #endif
# F# t. u/ P" B4 S) R
) Y" @* p$ W6 M' u' p/ b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* N# W; z* w o2 b, x - #define STATIC_SHIFT 30 r- Y+ @; b8 B1 p2 B/ X5 m
- #define TCINTEN_SHIFT 20
1 f, i$ c0 w7 _* s2 x ?2 P- ~ - #define ITCINTEN_SHIFT 21
& k. i: R1 ^) B5 A% q8 t9 F - #define TCCHEN_SHIFT 22( D: P# w* n/ _# X# u$ L
- #define ITCCHEN_SHIFT 23
" R0 x1 c# ^6 i' R4 C" { - * v2 G) _ X" w* i
- static volatile int irqraised1 = 0;* r0 t" |" o% m' A. Z0 I4 `; I( e
- static volatile int irqraised2 = 0;* z0 C; Q0 n, D% x
/ B ]2 [, f% Y7 a/ r+ C& u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% {- h# A1 E9 f: m9 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; q/ ?+ m& S9 N, ?1 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 v4 G; u6 k% B7 o
# j8 C+ c( G# s# ~- dma_addr_t dmaphyssrc1 = 0;# A& a. `" E3 F( r" R
- dma_addr_t dmaphyssrc2 = 0;
* W# n9 F. L% t7 S. H2 `; @; d - dma_addr_t dmaphysdest1 = 0;
+ K* |. q) _: b. ?7 S - dma_addr_t dmaphysdest2 = 0;
% ], [; S& K" q' n* B - % I3 V& E+ K' e
- char *dmabufsrc1 = NULL;6 v/ w- t; q7 O% E
- char *dmabufsrc2 = NULL;; j: f3 V& r0 a0 L) {. y8 C7 b
- char *dmabufdest1 = NULL;
| j' \0 O, ~) r: x - char *dmabufdest2 = NULL;' }1 Y1 U# x# u7 I1 J) z
- # D2 X/ L6 E) }% l
- static int acnt = 512;4 a& V. }( X* o* M9 O* }
- static int bcnt = 8;) O' l; F2 O% ]+ M9 M
- static int ccnt = 8;
! A3 G4 q5 _" [- c" f
# Z! P. n" g" k- q- module_param(acnt, int, S_IRUGO);) A `1 s/ ]2 b& o1 \; N! F$ V, b1 Y
- module_param(bcnt, int, S_IRUGO);' Y& H5 [- M. P8 r( s2 ?
- module_param(ccnt, int, S_IRUGO);
复制代码
/ T% v' J* N) { _* U% L' t/ p# T U% C' C8 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 b$ J; K- p: u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 V! A5 M& v/ n! J+ N2 G$ g6 r' D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# o# _5 q$ n2 v" P+ v) \4 @9 N
7 u+ o/ O4 g/ \
|, A0 K0 Q4 Q, t0 H. p. \ |
|