|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 N: J- L: c* L! b4 {2 b7 {/ w- [code]EDMA sample test application2 r3 U$ ~% V# h. B
- /*, F. r `% }( t. a% H
- * edma_test.c2 k9 v6 m% j" u/ t( A
- *
; H3 Q" O* L2 N1 V' x9 \( E" [ - * brief EDMA3 Test Application+ l- T# l6 ~+ |$ Q, r8 i
- *
+ N1 m+ B, v( h* |3 K - * This file contains EDMA3 Test code.
$ x- }! Y; M9 @6 p1 c* g - *
7 @0 d: G2 h5 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* O& K0 \8 M4 t4 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" ]# H4 a t2 p8 `7 o - * TO CHANGE.
9 r$ g9 i* s8 u8 f$ Q" K - *
7 h C$ M! u6 J; ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! C! r9 G/ z* J+ V - *& d i6 ]! b' f; i5 i1 a
- * This program is free software; you can redistribute it and/or
5 F) _1 O# n, S1 |2 @* _ - * modify it under the terms of the GNU General Public License as
$ a& n7 [5 c+ c( {7 X - * published by the Free Software Foundation version 2.3 Z: P( `+ f2 h2 u
- ** c6 W5 o) n9 F1 n4 c9 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ k* w+ n7 E6 g3 t; ?( O! e
- * kind, whether express or implied; without even the implied warranty
( R* |8 R2 B7 z' D* A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 p3 y) f% h, D, L - * GNU General Public License for more details." w _' a3 q, _' r
- */
, m: _& U y# o) E* r& Y
7 n0 S# d5 B2 Y+ p. N/ \ \- C- #include <linux/module.h>2 ^) G2 k8 e; V% W
- #include <linux/init.h>
% H6 W3 v! R6 F2 ` - #include <linux/errno.h>( }: |2 v" [" f
- #include <linux/types.h># c0 {" X$ J, ?/ i/ N1 D9 K6 D
- #include <linux/interrupt.h>& {! V: k# i9 ~6 R% H, l
- #include <asm/io.h>& o4 m) J' `$ m4 c
- #include <linux/moduleparam.h>
& T# i9 v# t9 M y - #include <linux/sysctl.h>
" Y1 s8 v& s3 ?. p; A - #include <linux/mm.h>
& Z# ?' K5 `$ m& c3 Z - #include <linux/dma-mapping.h>. p; g$ ]/ t% A
- 5 X- T' T# G) u& B$ Q e* N2 g
- #include <mach/memory.h>
" N0 `* o* Q# a/ l. X - #include <mach/hardware.h>, {) a& b9 w: B$ U) n1 S
- #include <mach/irqs.h>, o( X7 D+ ]$ _
- #include <asm/hardware/edma.h>. v Z! U. L" V
6 H( z3 O C8 |& m! W- i* _- #undef EDMA3_DEBUG& C/ e1 k# O. U3 }; I
- /*#define EDMA3_DEBUG*/
2 _( R- j2 ]2 B4 F - ) Q6 A: K4 D) |% m* v
- #ifdef EDMA3_DEBUG
' M, g0 T! T9 ]$ N" ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& A# k" ^9 m' f( s# p1 F/ P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# \/ [& ]/ S, x/ P6 m8 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ n( R5 g% o2 C - #else
& x" }9 y) z0 K - #define DMA_PRINTK( x... ): n+ a1 j: c" K$ |" T0 p
- #define DMA_FN_IN
0 v% X \& t# B; r - #define DMA_FN_OUT! k5 G5 h# |+ e0 j0 l. M
- #endif( j! R% d( Q' c
- 2 b: F r0 C6 S0 s/ I1 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- b" j! \+ R2 O8 w" @4 ` - #define STATIC_SHIFT 3
4 ?! R3 c' N8 G - #define TCINTEN_SHIFT 20. T/ {$ L; B! V# O% L2 }2 J
- #define ITCINTEN_SHIFT 21: p- C& U m# K" R: L! r
- #define TCCHEN_SHIFT 22; Q8 O9 n( w+ Q( A% i+ G4 U5 l" ~
- #define ITCCHEN_SHIFT 23& k! f K3 Y- }6 n7 h! x
8 o: t' X0 N: g& w- static volatile int irqraised1 = 0;
/ n. ~* y9 M; r2 j% _ - static volatile int irqraised2 = 0;8 c3 @3 X5 K0 M$ e$ B6 b; x5 V
w$ D/ Z7 X" h) P: J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: E2 A w; ?+ m) ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" K$ U' V7 Q5 T3 V' [& Q3 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d0 ~. @ Q$ O/ N$ i
- 4 f# @' {4 q" i! k, ^1 Y7 _
- dma_addr_t dmaphyssrc1 = 0;5 t* s) G$ O9 R$ T3 ~) w
- dma_addr_t dmaphyssrc2 = 0;
# M; s: V- b% I3 j4 X7 ]" R - dma_addr_t dmaphysdest1 = 0;+ n, f6 D6 [0 j& P' f Q6 G' {
- dma_addr_t dmaphysdest2 = 0;% v1 R, m' [. t8 A3 }1 f
8 P+ q3 k$ {% Z/ M- C5 G- char *dmabufsrc1 = NULL;" b: c1 |% m; m5 \& }
- char *dmabufsrc2 = NULL;+ \, a8 @/ `8 c+ g1 x. A! {
- char *dmabufdest1 = NULL;9 c9 ^$ u+ ]* Q
- char *dmabufdest2 = NULL;
1 v- @( Q7 Z/ c3 n% J7 \
8 |. W K$ A4 p4 @5 G: F- static int acnt = 512;& m# Y1 x8 ^6 y/ q' ?
- static int bcnt = 8;
2 H) T1 z8 d1 r& s0 f' r9 c - static int ccnt = 8;' @; E. [2 {5 T4 M8 n- _
6 u8 L% w i2 h3 ]- module_param(acnt, int, S_IRUGO);2 `- u6 s7 N ~5 }( J
- module_param(bcnt, int, S_IRUGO);" V9 a5 L* K( ?2 |) a7 l9 i/ U" C1 K
- module_param(ccnt, int, S_IRUGO);
复制代码
" i# N$ o4 F+ I- p% V4 e. z! z5 h( D' l( }% i2 P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; \0 R& q" @$ f8 {5 T+ }- d1 n( ?" ^3 ~; D! O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! _, A( P, _7 \9 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; n+ M6 h* i5 N! X- f1 q
% \7 V; K3 i) f% r' l& N8 A9 r' M5 w9 {' @* _7 F* p" o
|
|