|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 g' ?- \- F6 J, K7 J
- [code]EDMA sample test application# U3 B& P: Q1 ?7 ^6 D; D
- /*
+ `2 ]) e4 S% A" w# c5 i - * edma_test.c
; N6 A; [ a8 D& W1 f - *
( ^/ d) Q) }3 P" m A - * brief EDMA3 Test Application
' j6 c4 b, `( Z - *0 ~9 D/ i0 R# @8 n) @& g
- * This file contains EDMA3 Test code.; R( v( U( U% W
- *
. I2 j# H' n: b0 k v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m- Q/ F+ ]! b, [9 \/ O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 l: }5 \1 ~9 s# e# B& @ - * TO CHANGE.
- j0 B" l" h4 O1 |, t7 U9 i+ J* c: P - *
: O5 @- }8 i* e% ?/ r. \( O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 I9 ?& ~& D! g! a) {
- *5 ?; m8 i3 l3 r/ _8 n T
- * This program is free software; you can redistribute it and/or
; }+ Z9 {* v/ \ - * modify it under the terms of the GNU General Public License as
1 Q" w6 ~3 C2 Q4 s - * published by the Free Software Foundation version 2.
! b6 C* [% i3 ^& b" W( K4 a1 _: s - *
% L6 t% ]% r) {, N4 D# ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ @& E [0 V5 k; @ - * kind, whether express or implied; without even the implied warranty
X6 R: u' U1 p1 N6 k% v# K" b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( |8 U9 E+ R7 r2 } - * GNU General Public License for more details.4 N- K, ]+ S0 d' O, N
- */
1 F2 K8 K: ^4 K4 u3 q; a3 v
) |2 E% ^8 Q2 o+ q( [- #include <linux/module.h>; b7 m" N: R" h4 G, F* f/ u
- #include <linux/init.h>
# b. `% e+ l7 u) W& N4 Z - #include <linux/errno.h>
8 U$ K: t' g! Z* t0 w - #include <linux/types.h>
/ g0 W+ N0 [/ t" U: n/ O+ ~1 V) h; V - #include <linux/interrupt.h>
8 k$ v- B. B. L) u* }( c- j) M - #include <asm/io.h>
: H* C' n7 J$ l; m* s! a9 A7 B - #include <linux/moduleparam.h>1 c6 E! T6 g- M
- #include <linux/sysctl.h>
) I1 C/ ]9 C- Z+ F - #include <linux/mm.h>
. y4 T' e6 g: D% L) E" s, F( d - #include <linux/dma-mapping.h>$ y) s* s: l1 {* _/ p
O. m( s* D% D: [) z5 q1 m- #include <mach/memory.h>5 A+ K/ Y; `5 P
- #include <mach/hardware.h>$ O$ a( W/ ?3 O
- #include <mach/irqs.h>
$ d7 x6 y) K: w& P; i" a - #include <asm/hardware/edma.h>
6 y) O% D1 d+ u' x; G- a - ( u9 |& `4 E9 {& d
- #undef EDMA3_DEBUG7 I5 C- {* l2 e( p- j# R& c( |
- /*#define EDMA3_DEBUG*/) v5 ^! i# t0 B* n Y4 p% J* |
- W! I# q) C/ T# J4 z/ t6 H- #ifdef EDMA3_DEBUG" m! Q. u6 V1 H% n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( c! Z! q4 r& W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& {& d) |7 h* [/ g F) |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% h. ^1 ~+ i* k1 ]) b) V - #else
# t% b% @( `) V - #define DMA_PRINTK( x... )+ \5 B. O* L1 ?! H: O2 W
- #define DMA_FN_IN
g8 n% n2 `& z( W/ m8 f% D - #define DMA_FN_OUT
5 W9 K( k b/ r - #endif( k, x# R$ x, D) P
7 F: g, \1 [' B& j P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ B0 Z8 U# q& A8 ?
- #define STATIC_SHIFT 3
( h- n9 ?. i5 r( O0 d( | d - #define TCINTEN_SHIFT 20
; A3 f" y: T$ A$ M4 I4 O - #define ITCINTEN_SHIFT 21
, q- `' z2 K. T* g1 o - #define TCCHEN_SHIFT 22
' X, C [& t: `8 g. Y, E' \ - #define ITCCHEN_SHIFT 23$ w; A; E0 i' Q/ \
- ! @! h+ @& x6 }- s' K1 x
- static volatile int irqraised1 = 0;
0 ^: q" U* E6 Z - static volatile int irqraised2 = 0;
- }/ s6 } G$ ~" P5 ] - ! p+ Q/ W: s+ u: x N6 E& [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 c8 R- _9 t" q2 e3 E+ i6 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T# k- D- o @ t6 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& u( E( B# P7 o* @" u/ P/ B& E
- ' X6 }. A( I# G8 \# K# z4 z
- dma_addr_t dmaphyssrc1 = 0;
9 B6 n4 x# g- J4 M+ S$ a - dma_addr_t dmaphyssrc2 = 0;
" Q/ [4 D+ i- {2 G+ Z% |! b( w* ` - dma_addr_t dmaphysdest1 = 0;
7 Y) Y3 [6 ^" o - dma_addr_t dmaphysdest2 = 0;8 W. g! ^; d$ ^8 r7 M, D' A
- ) q$ P2 g) n& O% O A) u2 y6 o
- char *dmabufsrc1 = NULL;
. r5 T+ a" }, C - char *dmabufsrc2 = NULL;+ w$ l g, \4 n; Z: W' h
- char *dmabufdest1 = NULL;
* A9 ?1 p0 Y: i' V - char *dmabufdest2 = NULL;$ C. ?6 E0 \, L% v: p; s9 b" r
% c: h8 Q& F, T- static int acnt = 512;9 f4 D- R) X# c" L4 y4 G1 ^+ H
- static int bcnt = 8;; f/ _ d, H& |9 t* L
- static int ccnt = 8;8 r3 ~7 M: c& r
. b2 [) F0 K6 O6 U6 L) a# g* Z; y- module_param(acnt, int, S_IRUGO);
, S% e1 a p# s, T( w - module_param(bcnt, int, S_IRUGO);
8 y6 l6 E- G( ^! A& c2 b C$ Y2 w - module_param(ccnt, int, S_IRUGO);
复制代码
8 e5 F# j6 a1 c* i! S% T* C/ E. t- S; j* V5 n4 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 G% G t+ P- d1 X1 L4 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 V9 j y9 {; t- N, {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! K3 N: C% b8 H; M: Z
0 _& [6 ~! S6 b5 Q' N( O, t
) J6 M$ D. g' J
|
|