|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 y. a) P, b0 z/ ?5 \* C O
- [code]EDMA sample test application X- c! r( f7 u: P
- /*& w0 B( C8 }$ i( Z
- * edma_test.c
6 }3 z- R! i% N% b' _4 i' Y) |. T+ a7 B - *2 l6 H i; n9 c& ^" E9 H
- * brief EDMA3 Test Application
0 ^9 m) q% Y0 [' H1 @8 ~* [: ? - *0 u# g- v9 {. k4 A1 \* w
- * This file contains EDMA3 Test code.
; n, P( t! l, v6 `+ k, P - *; W) T! e! k u+ \, T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 P0 ]$ A, ~. i/ @+ F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: H" w$ w# x( z# H* h3 p: {4 H - * TO CHANGE.
1 V% [1 n/ y% d2 m+ } x& W8 n - *5 o5 @4 |' u t4 l( _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 U: H& h( D5 a2 M
- *
2 P: m8 L$ r ?- e - * This program is free software; you can redistribute it and/or
1 E8 L, H" v/ B+ M5 ]- ~, Z - * modify it under the terms of the GNU General Public License as G& P1 m! ?0 h9 r" Q- `
- * published by the Free Software Foundation version 2.
- A9 Y6 u0 B! F8 p$ h4 U - *
* P4 a; D p$ n: s$ p, O. } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; B9 c3 A* C6 K5 G( M+ J- h - * kind, whether express or implied; without even the implied warranty6 @* l L) i" X( [* h8 ]6 ]% u# V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 a4 y4 N5 ? A - * GNU General Public License for more details.0 }( k9 f: e* Y. e
- */3 ]( t8 V% ~9 r2 i' k
- 8 ?- T* Q. w: u' _7 Q+ h6 W( ~1 ~
- #include <linux/module.h>
+ ]+ c! B& f2 L+ B6 q7 X9 y - #include <linux/init.h>
3 F5 L( i8 J3 ~2 \0 L - #include <linux/errno.h>
- E6 Q8 q a1 m - #include <linux/types.h>
) g. r* F4 |& |: W/ [! P - #include <linux/interrupt.h>( A. @ b5 O' M% B4 e. K& ~
- #include <asm/io.h>
; i! s, g/ f' \. l/ | - #include <linux/moduleparam.h>+ A& z! M/ \: O8 k
- #include <linux/sysctl.h> | _0 Q# p3 i2 g9 l
- #include <linux/mm.h>! W) R1 n3 Z `7 b
- #include <linux/dma-mapping.h>3 |* Q) q+ {- y# D/ ^; i! ^9 |8 W
, U* D- y2 v: v6 o- #include <mach/memory.h>
) x* ^4 D% y( y4 q9 l0 h9 V; w: ^ - #include <mach/hardware.h>
! E% K: V8 L- ]3 { - #include <mach/irqs.h>
1 ?0 W7 @7 Z6 L' P - #include <asm/hardware/edma.h>7 w5 Y, ]5 F f$ a
- h- G' p- i [" y6 U2 r
- #undef EDMA3_DEBUG
0 v. }+ B( b3 ]( s* P) }/ J - /*#define EDMA3_DEBUG*/; [) r( r1 j% S S$ J; G+ T
- + s3 m+ s& j- @2 ]+ Q2 b- P0 S
- #ifdef EDMA3_DEBUG- \' W! w9 k: L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 u( x8 R# C+ S3 i6 W# b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" Z$ w1 m" b6 W! d$ [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 A, {; _$ U4 \$ R( ?3 Q
- #else4 j( {" b l+ z0 B/ o
- #define DMA_PRINTK( x... )* C$ q }* u! J2 |
- #define DMA_FN_IN9 Q: _$ {$ T; c
- #define DMA_FN_OUT( }( t7 ?' q9 V
- #endif
/ G, S6 T$ X% H% d% b - 5 q9 E2 {: K- i) y5 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# r* {5 g# j; L$ ?9 o
- #define STATIC_SHIFT 3
) S0 h3 e# i, M6 h+ L0 p. G5 g - #define TCINTEN_SHIFT 20
/ t4 e9 \5 T0 J- c5 a% u7 I" W. ^, ] - #define ITCINTEN_SHIFT 21
' U) ~4 T [1 i% u/ e2 q - #define TCCHEN_SHIFT 22
1 q6 ~$ _; ?- Z5 k - #define ITCCHEN_SHIFT 23: j% D% ~' E+ a3 ?- i/ e& Y
& ]+ p; ]5 _. G& j- d- static volatile int irqraised1 = 0;
( N! u" b5 w _& V - static volatile int irqraised2 = 0;# {% P4 d# l, b3 s1 }
. s% U0 f% A! \+ J: c1 Q- B0 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- m/ j& k x4 O$ U. q6 |- z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ]6 D. ?( o1 j: B' T0 f2 Z$ G2 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ~8 ?" p; d4 |9 B3 @ - * {. B2 e( i& x. Y( i
- dma_addr_t dmaphyssrc1 = 0;
4 M& V: {6 ^4 F! h0 a - dma_addr_t dmaphyssrc2 = 0;
) a% S* X1 e6 N. G9 B* a - dma_addr_t dmaphysdest1 = 0;
% i/ b! a5 _8 L, ~7 } - dma_addr_t dmaphysdest2 = 0;0 {7 L. S5 t- t, S6 S( V
- 1 a2 A: S& Z7 ~! p
- char *dmabufsrc1 = NULL;
% ^& v% D2 x$ ?6 I& m2 j9 a - char *dmabufsrc2 = NULL;6 u1 R4 z0 @, V# E( m
- char *dmabufdest1 = NULL;; Q( P7 S3 L5 d
- char *dmabufdest2 = NULL; N% X1 e7 b; t7 \* W x( q
% m; O" P+ {5 P. | y2 k- static int acnt = 512;
6 ~9 H- e' Q( s( H6 y3 t; \, Q( j* m - static int bcnt = 8;
* H* k( x: @& d/ b - static int ccnt = 8;
0 b2 l" Q9 l1 `; t* k0 ]
) u( ?4 ]: O" J4 q- v- module_param(acnt, int, S_IRUGO);
& A/ P' @/ z+ W* q* e - module_param(bcnt, int, S_IRUGO);
: D, m8 b0 O) w% [: F1 |. ?1 E0 H - module_param(ccnt, int, S_IRUGO);
复制代码
) ]. ~" N; v, u% S/ ~; S8 v
5 G! A3 i3 E0 U1 ~2 i y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 r' @6 s9 O. |1 J& L, `6 E* I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* P7 @/ r& K+ M1 J* w. f9 K8 D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 |9 T* W; }7 X+ k0 T/ ^
3 l, a8 \8 d: K) w5 B
1 `0 G8 f( b# c9 A
|
|