|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - M$ m* z8 x W. O \
- [code]EDMA sample test application
" H* Z( x" t9 ^. p$ ~! Y0 e - /*
& }! G+ m g$ M: l/ Y - * edma_test.c
$ z9 U' z o4 p! {; [+ W - *
; ?2 S6 @% F1 d3 J! H7 C1 R! B+ } - * brief EDMA3 Test Application
( q1 p7 x' y) l" { H9 K - *
; P$ n2 A* v d) i( o7 [ - * This file contains EDMA3 Test code.9 S- V' Q6 T* b6 S3 b, z6 o
- *6 O3 G1 m! x& a, ` t- X9 a* I) l, _! r9 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! Q, A& }6 U$ ]4 g1 J8 ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; Q* Y! }2 ~0 }: A - * TO CHANGE.
4 R) ~. U4 i% f3 n - *
, ~# ~% c. n+ t# \5 n$ I) Q$ K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 {3 t9 W/ ~3 o; G! S8 S - */ Q& E" |7 J9 U, F& H* l- F
- * This program is free software; you can redistribute it and/or8 h$ k/ f6 h8 y, W/ ^0 P/ |+ e# d
- * modify it under the terms of the GNU General Public License as' K! h! t0 @5 n3 N. Y4 ?7 n; k
- * published by the Free Software Foundation version 2.
$ }* G4 E U W - *$ S6 S9 I' `$ d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 y9 ?! W3 a5 O: N1 ?4 K2 v
- * kind, whether express or implied; without even the implied warranty
) R# r( ?$ q, _; H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& k l3 y/ \* i! j/ O - * GNU General Public License for more details.
7 C1 N4 `& K5 Y" `: J! j - */. K, [; n+ o! I I( m
. D6 @) V! M: ^' C& i) x7 u- #include <linux/module.h>6 F& d! [1 S- o% X
- #include <linux/init.h>5 s4 a! B8 K8 d' B
- #include <linux/errno.h>% \. t. b9 r+ O, V+ k
- #include <linux/types.h>
: q1 d6 Q" L B4 M- Q/ u - #include <linux/interrupt.h>: ?+ @( d& ^4 t, ~
- #include <asm/io.h>
& W2 {$ P+ W4 q - #include <linux/moduleparam.h>
' z' @: V2 J' M( s3 u4 w - #include <linux/sysctl.h>
: r! R1 C9 i( i: }: }4 \5 K& T - #include <linux/mm.h>
) ~ e0 b" ?3 ]! \/ z$ G - #include <linux/dma-mapping.h>- w' c0 X! a6 B$ b( L5 l
5 A8 _% O8 M8 ?* ~$ z3 q- #include <mach/memory.h>0 U/ Z' j& D3 z' \, h' D/ x9 T# S/ g
- #include <mach/hardware.h>* {5 I5 Q5 a' t2 O2 E4 ^: f
- #include <mach/irqs.h>0 P& k1 B6 K' V- e
- #include <asm/hardware/edma.h># l4 L$ b% f, v* _3 F
- / p5 o2 K) d; w; A! u
- #undef EDMA3_DEBUG
$ o" f( g& a2 O# [2 `' t - /*#define EDMA3_DEBUG*/$ j, ]4 ]$ J& a. ~/ z" [* I- s# t
- 5 N- m2 e6 L$ D# f' [7 K
- #ifdef EDMA3_DEBUG
* j) Y+ f. k- ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): L7 M E; g* c* C- S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, ~) q( x4 J. f. |0 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- n7 L }0 E. t# z - #else
) V5 d7 P/ s! d0 E+ I; c% t+ j, s5 O! d - #define DMA_PRINTK( x... )5 M- B/ K- i# r5 p
- #define DMA_FN_IN( T* ~/ V5 f0 X$ {% O5 |
- #define DMA_FN_OUT6 w, y/ S/ k% W* c$ h* d; ~$ D
- #endif9 u) p5 s& m: g# g4 N7 x9 N
; C* ]3 L5 r9 A/ X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( [& r. ]# A$ n3 f4 C" Y& X5 K - #define STATIC_SHIFT 3
2 p+ u& T( M* [! ~" v6 ` - #define TCINTEN_SHIFT 207 [& E& B3 _! L
- #define ITCINTEN_SHIFT 21
' w7 j9 [) Z2 O% e5 |, G* \ - #define TCCHEN_SHIFT 22
1 |2 D3 n: d) ]! W" E- o5 [ - #define ITCCHEN_SHIFT 23: _5 O5 X: F2 g
- ; |/ z H% [# ]& ~
- static volatile int irqraised1 = 0;
% h8 k B1 C& |8 A4 T+ b! G - static volatile int irqraised2 = 0;
A4 u2 l0 J( x, F, ?. G0 X - 4 f) \3 V; q0 S& T" V7 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I `5 q& [+ s& v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S' Y; _/ f) L: y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ w [2 c; \" A
( ^+ R2 Y1 U: X7 W% v- dma_addr_t dmaphyssrc1 = 0;
# |" t6 `7 E8 _! V/ x5 c- j - dma_addr_t dmaphyssrc2 = 0;! ^6 Q+ j" D* K2 ?4 a2 g$ f- B
- dma_addr_t dmaphysdest1 = 0; V q* [4 r T2 z3 o7 }
- dma_addr_t dmaphysdest2 = 0;
9 A; {4 I+ V7 G w# T9 c. z& a$ ^ - 3 K; o0 W) C) e( U- i, g
- char *dmabufsrc1 = NULL;) Q* r! o1 ?/ \
- char *dmabufsrc2 = NULL;
& |5 a+ p6 U3 g' J - char *dmabufdest1 = NULL;. i6 C* w0 F m
- char *dmabufdest2 = NULL;
2 k) L- [. S- |; I" L
: H5 p$ Z5 o( W }. I- static int acnt = 512;
+ J: `; M; X2 ]' m& C - static int bcnt = 8;
0 u- A' _+ _* [9 j# X - static int ccnt = 8;) f# v+ z. E) O7 g8 Q: c
- & _2 s. L0 U/ \. K2 s
- module_param(acnt, int, S_IRUGO);# }% R, ]. ]$ n* @* m) \. ?' G- B
- module_param(bcnt, int, S_IRUGO);" P' U3 @5 y( ?7 ?/ ^
- module_param(ccnt, int, S_IRUGO);
复制代码
: n- c- ?, a9 W1 t1 T& G( G, K) m) Q1 m; D: y4 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( v+ B+ K: C9 X. y3 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 E" V1 g* M( i4 G& u7 w& | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( l9 i( V' a5 V, L3 H
3 O- p, i) H) q6 S! q2 R& g. |
. Z. ~ t- i" E* i+ {5 n |
|