|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
c+ _( e" H7 a) `% m- [code]EDMA sample test application
8 a; u7 o& `4 D. O4 {" \7 p V4 b - /*
9 C2 Y K3 B4 L# N - * edma_test.c
`# ^1 `; S% y$ Y9 M P1 Q - *
- z; r; l- V3 L" s - * brief EDMA3 Test Application4 m: f6 |2 c9 f( A' K8 }
- *
+ [& W" ], _' y' h. d) a - * This file contains EDMA3 Test code.
% d7 u1 Y: [. X6 ?4 Y- {! Z - *, Y" e; g: | f! \. Y6 u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 q7 h* S* q. P2 }5 Z/ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, d! O/ P3 }0 [3 R - * TO CHANGE.
' `9 F( ?- S; M: o - *
# Q7 ^* W. F# E# R0 ?9 Z; b4 ]( _: { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Z* K; a6 U3 G
- *
5 L. G4 B' j* Z - * This program is free software; you can redistribute it and/or
1 n7 n! U& A6 D* G% z% O& a+ Q - * modify it under the terms of the GNU General Public License as
' g7 S c. e* w9 d: | - * published by the Free Software Foundation version 2.
1 E& t# c- U) b$ ^ - *
+ A, x# F' @4 g$ [/ A- _ F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% V6 |) z. Y( y( E# z9 s
- * kind, whether express or implied; without even the implied warranty4 k+ |: Q1 h+ {2 j. ]6 W( V6 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 L# Q8 U! P; N2 R
- * GNU General Public License for more details.
2 [( F) r3 l* L0 b- z - */
$ ?8 W/ x% W1 o' a$ R V. F
% S( w8 x9 Y+ P! \& s! L1 C- #include <linux/module.h>
* [; X$ D1 Y ?5 \, m1 { D7 k( e+ k - #include <linux/init.h>; _/ L( \8 Y5 e1 V# m) s
- #include <linux/errno.h>
5 H! A' f6 V& p+ H - #include <linux/types.h>
4 g9 J4 y0 n# e* |" N! |! k - #include <linux/interrupt.h>; `& U+ ^2 g- g+ Y5 k% S) O3 `
- #include <asm/io.h>
1 v4 W. s8 h; E9 k6 h! i7 X- | - #include <linux/moduleparam.h>
& p4 Y( W: k4 P$ q7 Q - #include <linux/sysctl.h>
& ]2 @! X0 w( E ~! K$ }( g - #include <linux/mm.h>
0 [% H4 E$ b5 Y. a - #include <linux/dma-mapping.h>
0 i1 U" T! I* Q5 ^- x5 x
" ]& r: C+ [, L- #include <mach/memory.h>. |% X8 w* d' _% v1 Y; }! k
- #include <mach/hardware.h>. {1 f8 T. q8 ^) L" ?" w
- #include <mach/irqs.h>
: ~( Z0 | Z0 Z8 `) T - #include <asm/hardware/edma.h>
+ {9 c' h1 H, s' J - ; ~) Z3 E% n% `" M9 \; Z6 P& u" a# g
- #undef EDMA3_DEBUG! e( w( ]! o4 b
- /*#define EDMA3_DEBUG*/
% T. G$ ~0 Q9 v: S9 m4 c" T - 3 n" I c, l5 D+ V& Y3 Y' n3 C
- #ifdef EDMA3_DEBUG
7 l! v/ S. ^' l# W) L, i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( T9 g* I9 Q3 c5 q M! k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), P: d! E0 Z. I1 b% _+ z$ ^* ^: n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 H: H" Q3 |. g) N9 B) k - #else2 I0 K; a& j0 R6 w- m/ W# E
- #define DMA_PRINTK( x... )6 {4 D% z* l/ f1 e2 \% W
- #define DMA_FN_IN
$ k7 d7 a S0 p6 H6 H - #define DMA_FN_OUT. y% c8 b5 f8 `2 q. a' [
- #endif
) v; }0 ?! \& S9 y0 G9 ` - % T* S. a; p: m+ p, K4 o& |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 P$ y( i& x, y. \8 g+ f- j/ L' u* @
- #define STATIC_SHIFT 3. `2 O% s$ l! k6 l& G# N+ [. r
- #define TCINTEN_SHIFT 20; L8 @6 ^- o7 K& J
- #define ITCINTEN_SHIFT 21
1 l- R( }$ b& b: t - #define TCCHEN_SHIFT 22, D$ M9 z- o0 v/ {5 s3 [
- #define ITCCHEN_SHIFT 23; @# ?9 ~0 y% x7 k- l
- ' y v* c/ B2 B. W: C. B
- static volatile int irqraised1 = 0; t u6 Y e, d! Y
- static volatile int irqraised2 = 0;1 b z8 `1 N; ?
- $ ^: `( u: o; _9 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# }6 a2 ~9 O9 l6 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }: [( O7 A4 b8 i# y* f. N( S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 c Z" I5 \ u- H
- ( t/ T( S6 s+ C' u7 V
- dma_addr_t dmaphyssrc1 = 0;+ ^' |! W* X3 w2 f+ v$ ^
- dma_addr_t dmaphyssrc2 = 0;! Q/ D3 s% d4 E; J3 ]& }
- dma_addr_t dmaphysdest1 = 0;
0 W+ J! G, @% ~4 B - dma_addr_t dmaphysdest2 = 0;0 O; R( v% I& S$ L! z
( K) v/ J; ?& ]/ J- char *dmabufsrc1 = NULL;
4 z# z4 o8 v% ]0 p' H - char *dmabufsrc2 = NULL;( e6 V7 s- q: p
- char *dmabufdest1 = NULL;8 c0 [, u# u* ?+ o7 y+ ~
- char *dmabufdest2 = NULL;
0 S6 n* |1 K3 \1 O# b `
. L8 `$ u" |' ~, B( y/ ]- static int acnt = 512;* I4 d \7 a0 z9 l( M
- static int bcnt = 8;4 _5 w: _3 u; v* v
- static int ccnt = 8;
3 M8 v6 \5 u/ g( X/ P# x$ H1 ]
' e% p# z, y0 Y% g6 \& v- module_param(acnt, int, S_IRUGO);
% D% j3 R& O! a - module_param(bcnt, int, S_IRUGO);
U& D3 H* ^9 `6 [ - module_param(ccnt, int, S_IRUGO);
复制代码 " ^& s3 R8 Z' l
$ C* t+ [$ W Y& Y) h& b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ F3 _+ @! }0 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 x& l* O o- \) j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, C+ t1 Y+ X/ ^0 b. p" U$ H
0 N' [$ n" ^! e# X* h& Q) y5 N7 u: j$ o
|
|