|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 L M6 H) ]& B6 k/ Y! g& h- [code]EDMA sample test application$ I$ U) \2 w. T2 I6 f( `8 A
- /** S1 w5 G" f. \4 O
- * edma_test.c
$ o5 @+ c! H3 z - *7 |- y% s7 u# [! X1 I% b! u' h
- * brief EDMA3 Test Application/ B0 w3 p) H8 t: Q$ x
- *, K- k& V* s6 b3 \9 k; a, S5 X
- * This file contains EDMA3 Test code.
; n1 k) G6 u2 {0 p! d. h6 \ - *. U0 i* C* c* X; I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& X- J% [5 u# C/ f/ P$ y4 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 N! z3 _/ H2 Y* O8 N! Y; N0 V5 K - * TO CHANGE.' d% n) \3 k/ e D7 k, b `
- *
- @' v9 p' P/ j9 K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' S( _/ Z/ k% J# \0 g - *' D* j ^& R, |5 C( q2 P6 D/ K: e
- * This program is free software; you can redistribute it and/or
2 g8 C v5 v; f' t - * modify it under the terms of the GNU General Public License as' ]/ t% ]7 X3 m$ `
- * published by the Free Software Foundation version 2.
4 L/ w- E/ h+ n! }( n) y - *5 J& N2 r$ ]3 @* `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ }/ ]+ j! @" d v5 R
- * kind, whether express or implied; without even the implied warranty+ C2 Y/ r* C8 [- c- U$ m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( a1 B. G4 ?4 S- k - * GNU General Public License for more details.( g" p, o( x" M) _# m6 Z
- */! P/ u7 C" W: _ u* j$ ^
- 4 d8 ~0 Y4 f$ P3 V5 W/ X
- #include <linux/module.h>; V. J# M+ K6 B
- #include <linux/init.h>& ^9 B# D8 i$ k3 H* z& N2 v
- #include <linux/errno.h>5 U; a/ Y. J. Q8 X! I3 I1 K
- #include <linux/types.h>/ x7 ^. A% w; S8 _! o
- #include <linux/interrupt.h>( N4 z D3 A( } \2 X
- #include <asm/io.h>( ]+ {! j# Q/ @' S+ O: M
- #include <linux/moduleparam.h>; {/ J" D) l# j, Y7 Z
- #include <linux/sysctl.h>
2 ]5 j. e0 S3 x! ], n: `& D - #include <linux/mm.h>* U8 f( ?- U3 ^: m9 m3 K' b( @
- #include <linux/dma-mapping.h>/ D0 ^3 w. P6 ]/ _/ r# m' G
7 I/ l" m& v3 g' k3 f- l7 _1 ^" d- #include <mach/memory.h>
/ c: q2 v$ g' u - #include <mach/hardware.h>' `0 c! P, c, n' r P) B. P0 @4 L3 w
- #include <mach/irqs.h>
2 G/ p! x, h; s2 S# g& y - #include <asm/hardware/edma.h>
, b* r8 s! [* R) _8 m* w
% t2 W+ ]) {0 X0 m9 g- #undef EDMA3_DEBUG
# a8 b o1 k: F: a3 ]2 @ - /*#define EDMA3_DEBUG*/
' U( ^3 a+ e5 b$ P/ N- | - : t+ y5 t0 n7 u, h; o/ e" o
- #ifdef EDMA3_DEBUG8 F' h+ U) f6 f0 L9 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ a# b1 W. o) Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 \$ g- d6 q& e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 L1 Y% p9 ^' t/ K8 `" O - #else
; Y; s& _6 W( Y/ Z0 | - #define DMA_PRINTK( x... )) i% }3 t; W0 K- c
- #define DMA_FN_IN+ f, x/ E- |0 @4 y$ H' Z2 ^
- #define DMA_FN_OUT7 c8 P: C7 X3 c3 v* _
- #endif* }, M% Q( O+ x, h4 j5 F3 t' z
- ) m8 t( Q5 O+ a w" V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( q. e# `* H) n& {! a& M - #define STATIC_SHIFT 3; \/ P* ?) {. w6 Q5 ~; k& L
- #define TCINTEN_SHIFT 20
7 k/ D( h, s' ?3 q - #define ITCINTEN_SHIFT 210 w# E f* ~+ ]3 e
- #define TCCHEN_SHIFT 22
" \7 V$ K( H& q3 ~0 H - #define ITCCHEN_SHIFT 23
, `, Y( p& L9 _6 t# c/ F2 t' V - " R) \ L# O: {' [1 l, u7 A: h
- static volatile int irqraised1 = 0;
8 j) u8 q% y6 I0 c5 }3 c - static volatile int irqraised2 = 0;2 d) i% W, J- G$ G3 V3 @
' u6 N1 H& }$ X9 I) b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]4 k) b7 n/ Z- @) n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X7 a1 B4 Z* A3 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M- a& V7 N" h1 J2 s9 V0 t
* M) u$ X; @" Z7 K- dma_addr_t dmaphyssrc1 = 0;
3 o) x. ~# P) q0 [: U* H% F$ O. \ - dma_addr_t dmaphyssrc2 = 0;) u2 M5 Y# g5 G; C9 A# z4 j/ ~
- dma_addr_t dmaphysdest1 = 0;
" O/ ^# F- B- p. W& ?" t P5 o - dma_addr_t dmaphysdest2 = 0;: x' T6 q1 y: U
6 n" G5 N7 G7 Q* s: ]+ R {- char *dmabufsrc1 = NULL;7 m8 J$ a. ~7 s3 d2 v! x. K6 e
- char *dmabufsrc2 = NULL;
6 j4 H9 ^: {3 {$ Q - char *dmabufdest1 = NULL;
6 y) Y" J% f ~ p$ n3 p4 s - char *dmabufdest2 = NULL;
7 Z7 y6 u! ^* B
3 ], q6 \! V1 M; h' n+ ]- static int acnt = 512;
: B3 z7 K" |* ^, v( q; Y% L - static int bcnt = 8;2 p; U# {* R& ]: L- N; i* J
- static int ccnt = 8;7 w* Y W5 `1 l8 w1 \% `
/ \; H0 L: ?$ D: `" m5 P- module_param(acnt, int, S_IRUGO);
+ `' z# `9 _: A" n- ? - module_param(bcnt, int, S_IRUGO);7 D0 }$ b4 g+ T: K Z/ R- q
- module_param(ccnt, int, S_IRUGO);
复制代码
! y4 b7 M1 H* s- Q* j2 b: `, @7 F$ B1 D1 D/ R: `+ U" U. |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 S/ L; v8 Y9 [2 o5 Q" f5 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 O% o& C: b+ w, i& W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 x+ Q3 D0 H3 ~) Z: C# S& r
' q/ @5 S9 r' S5 j& J; v$ r
* ~+ C N" P! Z- Z |
|