|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) f3 x' [2 q7 T% ]1 E) p3 Y1 `' _/ ~' q7 j
- [code]EDMA sample test application" C: r# {2 j3 k
- /*: y: C* w+ F1 X K+ R, }
- * edma_test.c; T6 p) ?5 F4 |6 D) ]" {/ `
- *; }8 `( W# v/ r+ y
- * brief EDMA3 Test Application
' i3 T. p# h. d9 {1 |/ L5 j& N - *
9 U4 I1 e3 o* p6 J6 X0 e - * This file contains EDMA3 Test code.' u- d1 z8 N$ @' D/ U* ?
- *% p7 ]& y2 b' T$ n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ]+ r# G1 r% r' ]* G5 r/ s. P/ _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* X/ h3 e, H/ k- o d - * TO CHANGE.6 W, r _! R6 S3 `' T
- *
) U2 D& i; \* O/ | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. W! Y$ l% x! q6 g+ j
- *
( M) {1 U9 v/ B' V) p' |9 j, X. C - * This program is free software; you can redistribute it and/or
* E' A0 r4 l$ v; l6 g - * modify it under the terms of the GNU General Public License as
# B: t5 K; x1 y0 E6 ]- X& L - * published by the Free Software Foundation version 2.
8 E/ U3 q: g7 p' V& ]+ E" B' d - *
+ ~- n7 t9 b) \8 _. x* ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& I3 Z- f0 R$ @; _
- * kind, whether express or implied; without even the implied warranty
" P3 j0 o8 ^$ u. v6 P* q- S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 _. C8 u% I6 v
- * GNU General Public License for more details.
' p. v2 X+ `5 M6 X9 n - */2 ]8 h) R$ A9 }+ L9 K, K4 L% ]+ \
- 0 c+ y+ ~! p' V0 R* X2 e: L; Q. C
- #include <linux/module.h>+ |( N1 t* b% u1 X+ |$ A5 `
- #include <linux/init.h>( I/ C# f: d' A6 `* l
- #include <linux/errno.h>: j, j1 z8 j, I2 p( i9 g/ k
- #include <linux/types.h>
6 N# w7 k! o! `4 E6 r - #include <linux/interrupt.h>
9 h% V, D4 ~# N' {6 X. S) J* S - #include <asm/io.h>8 T3 Q1 j4 q" n) a
- #include <linux/moduleparam.h>
- G( K; X% U: p8 O - #include <linux/sysctl.h>
V$ ~' j$ s4 w1 a" L - #include <linux/mm.h>1 m! N- [# @+ x2 c; ]/ R& D
- #include <linux/dma-mapping.h>1 c+ m: R0 H; F& A$ i
- 8 B# W- B$ d/ d4 [# M) S
- #include <mach/memory.h>* ?+ ]) A j7 i" _) o
- #include <mach/hardware.h>
7 m5 R% t2 x% R - #include <mach/irqs.h>
% v- \( R- @" H1 Y2 z# H7 j - #include <asm/hardware/edma.h>
8 y$ R) \5 g- V, }1 f - # n; H( `5 w' p# v6 i% K% o
- #undef EDMA3_DEBUG" a% u8 A# V3 b/ @; k5 l
- /*#define EDMA3_DEBUG*/
) ]( g, a9 a9 A" \' A - " b3 A$ W* i7 T. x# c5 m5 s" ?( J
- #ifdef EDMA3_DEBUG
( S1 S" h# t& P! y; k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ T P d% D1 e& N" m0 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
C/ c1 r1 U1 k5 L" A/ ?' A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' [$ w% {& N1 B# v% G7 b
- #else
7 L% [5 I6 m# q: s% ` - #define DMA_PRINTK( x... )
2 |6 a9 O! |5 a. K9 I - #define DMA_FN_IN" U A5 L% j# n( P+ M6 P
- #define DMA_FN_OUT
' h8 w4 \2 |. _. F9 Y3 k - #endif
1 v0 f7 v8 ]6 u, |4 w9 t/ Q( J, v0 h - ' z) g/ g S: Q" j5 h8 Q8 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 U: t/ ~0 H1 W4 j/ D6 r; J - #define STATIC_SHIFT 3$ l6 f+ u3 p% D' b6 x! P: p
- #define TCINTEN_SHIFT 20$ n0 z' Z D2 g; v
- #define ITCINTEN_SHIFT 211 a# m1 y2 v1 O& {" u
- #define TCCHEN_SHIFT 22$ Q# w- P1 T9 t+ v5 n
- #define ITCCHEN_SHIFT 23
% s5 S. l8 Y K; c: s' G( \
6 A& t! V0 h; v6 T5 e8 |- static volatile int irqraised1 = 0;
- P# R u4 T. C% C, P - static volatile int irqraised2 = 0;) }0 W+ E) V$ }1 @9 V) \" R& ~
6 @. F+ u2 Y5 c- ?/ |/ T2 Z+ T0 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 [1 H, D C' r9 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ g% j; \" j. A. H( t G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o0 j* M' ~ ~! Z* I. ?
' F( w& r" H$ s7 i& |9 a2 K+ h! H# |- dma_addr_t dmaphyssrc1 = 0;
" _" B" o% k4 c/ H+ X2 S* V - dma_addr_t dmaphyssrc2 = 0;$ ?' {1 a& w/ p l/ r9 u$ e& V; \
- dma_addr_t dmaphysdest1 = 0;
6 c" u8 A. U9 |( }( @ - dma_addr_t dmaphysdest2 = 0;1 _% z' B* @- z- ~7 O C9 s0 w0 ^, G
- ! ]5 [6 x0 f* X$ l5 Z8 A
- char *dmabufsrc1 = NULL;
( u( |& S! q V$ L' | - char *dmabufsrc2 = NULL;3 ~' h+ B: \ E6 A
- char *dmabufdest1 = NULL;
( A* c# M, C" [+ s - char *dmabufdest2 = NULL;6 o: u+ j2 I# p
4 ~! f7 z& P/ e u$ W9 Y' \# J2 {- static int acnt = 512;
* `, n& S b7 P, K j/ y - static int bcnt = 8;
7 K# ~" ]7 x: Y: F/ u - static int ccnt = 8;
- N* O$ i# _) g - ' W' Y- ^. G9 ~" @
- module_param(acnt, int, S_IRUGO);1 L, V8 ]1 V T6 k( { p
- module_param(bcnt, int, S_IRUGO);* ?0 K, m n$ D. c
- module_param(ccnt, int, S_IRUGO);
复制代码 M K! m( H! M9 T9 V; G
8 ?2 ~" c- e% G' I4 Z; ^) r" z3 n7 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; a" i1 t, c- E; _ G5 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 G& [; O) @/ H# ]# f2 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( E! u4 L3 P" y
0 P4 I% b- @: R, s; j( Y* A4 d% g5 t: V( W( R) \
|
|