|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 W& b( ^" A( I% x" S2 z" i- [code]EDMA sample test application- ?6 `8 v# H+ ~! j: A+ g4 M% I
- /*
$ E% v* Q- f- e7 i* b' B - * edma_test.c
5 N6 X% P5 s6 U - *; O j/ k8 O* I8 W, E5 P
- * brief EDMA3 Test Application7 l0 {! b( C7 f( S J
- *
, ?; Q$ s8 i) P3 Y+ v1 N; r - * This file contains EDMA3 Test code.
+ J' \. m1 V/ O9 N+ ? - *. z. [+ r! n3 N: ]! \3 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 W, a( k5 o+ J/ s0 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( [8 N( S- V+ [) A* {/ o - * TO CHANGE.
# i& K, c- L; @0 B9 f+ d" O, X" { - *: a; [1 e$ A; m& G' s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 _4 l1 s0 i4 a! n
- *5 Q. {+ @$ g' Z* c) @! H
- * This program is free software; you can redistribute it and/or
" q" I# Z+ v$ V+ V" s: S - * modify it under the terms of the GNU General Public License as
1 {* B# @. p) \9 {5 S; n0 A. e1 _ - * published by the Free Software Foundation version 2.
, G) G3 }! J& b3 n- I - *
, T) T8 j; ]0 g, ]: G5 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' B5 j: p; w' I- q8 k
- * kind, whether express or implied; without even the implied warranty, A: U8 g4 d* F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' K0 i- j: Q" T$ |
- * GNU General Public License for more details.
5 Y* U! a. g! B) a - */7 F! Z% ?' }: s# y
- " v% S( C& p" h( |0 }
- #include <linux/module.h>9 F B) o1 Y4 L+ S1 z
- #include <linux/init.h>
3 m2 i' I, [; i( ]" ~- a6 \) E ]3 u - #include <linux/errno.h>
( J. t; q4 Q- z - #include <linux/types.h>: I0 E3 Y7 j7 U7 _ M9 S' v
- #include <linux/interrupt.h>% D8 t% l4 D- n2 [
- #include <asm/io.h>
% [' P- ?' M' N8 T$ b" y/ F/ _; [ - #include <linux/moduleparam.h>
( R" T' Z8 C7 d6 A - #include <linux/sysctl.h>
* l. ~% [0 M1 P3 |9 c- P - #include <linux/mm.h>6 ]+ s G/ f( }. a. l% p$ ?
- #include <linux/dma-mapping.h>: b* m5 X; O1 y3 ]) o
- . R- }. I ^/ I8 R2 M5 |" t7 @% `3 ^
- #include <mach/memory.h>8 @! l, _' h& T8 x0 h3 a
- #include <mach/hardware.h>
a5 J& G: k' {$ F - #include <mach/irqs.h>8 ^5 ]' f6 T/ y' ?' P6 O
- #include <asm/hardware/edma.h>
0 ?/ L+ P1 \# f. g2 _" U
: n& B8 E6 M+ d+ f R- #undef EDMA3_DEBUG5 o/ D' D6 T& c
- /*#define EDMA3_DEBUG*/% J2 }) v- j9 O4 \! h
! `# @7 b% k, ^, G* @- #ifdef EDMA3_DEBUG4 \+ u# j; G& c( x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' |/ z8 a6 {. m, |* Q7 ^& [, z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* F" N% l1 J6 B" n6 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 u$ h6 }1 ?2 |, z
- #else5 S3 e" S3 d' r$ w. C8 Q
- #define DMA_PRINTK( x... )
X" F: L4 V* ~4 f& M0 p - #define DMA_FN_IN/ y6 v( y7 p: j7 i }+ s
- #define DMA_FN_OUT
7 c3 m- y/ Q( { - #endif
3 I- n! Z+ ?6 ^* w3 O - \: U, t, p+ ?/ r0 g+ |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 i. O# m; R" A, ]3 m
- #define STATIC_SHIFT 3
" j+ c3 ]5 H0 }% a5 |6 h - #define TCINTEN_SHIFT 206 w8 C( ~& o/ C, T- K, Q; R
- #define ITCINTEN_SHIFT 21, n: O" @" ~" ^ @' I8 c
- #define TCCHEN_SHIFT 22
. V' c! A+ ^$ A& D; s& h! I - #define ITCCHEN_SHIFT 23( x: z( E9 E- R9 F: s
- " Q8 M" m6 t0 k, Y4 B0 B
- static volatile int irqraised1 = 0;$ K9 Z1 A; J) h F: \
- static volatile int irqraised2 = 0;
|' f) D! W9 j8 M5 p - 7 r/ D: S, W0 J4 \* d6 R% s7 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 q( y" v( }. s1 e' C1 N2 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 f: E1 X5 k4 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% v3 z5 ?2 S; n, e8 {+ o
' w; i/ X# X" i7 m- dma_addr_t dmaphyssrc1 = 0;
g) q0 D. X! n4 [6 z$ Q - dma_addr_t dmaphyssrc2 = 0;( {, L4 w$ y5 \$ L1 F0 i
- dma_addr_t dmaphysdest1 = 0;& p: d1 I$ e" b% q- A% D4 c& ^
- dma_addr_t dmaphysdest2 = 0;+ j5 y# C: u: X L4 k
E- l4 ]! y( ~- a- char *dmabufsrc1 = NULL;
5 j$ f* A& t7 e4 z - char *dmabufsrc2 = NULL;; D9 U9 v; A& i6 i0 n- O
- char *dmabufdest1 = NULL;2 ~$ X$ o7 l. Z4 f8 B4 f
- char *dmabufdest2 = NULL;
( E9 n6 q% E# e+ _) T# W
5 J Z5 i4 x2 ?. l) M. r" l7 @" s- static int acnt = 512;
) y, D P# n3 V - static int bcnt = 8;( R) v) G/ w2 G) ?! \
- static int ccnt = 8;- f6 r3 i3 y2 P p! F& z- V9 H% ?" J
- 3 J; e' o1 @( h9 w: T* p6 O/ w
- module_param(acnt, int, S_IRUGO);
, b$ D. J) J- b1 u - module_param(bcnt, int, S_IRUGO);# P+ S) B; u( T
- module_param(ccnt, int, S_IRUGO);
复制代码 0 g7 P, S# H6 X, R
+ b3 ^( F" O4 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* L* A1 k+ @4 H, t- ~/ ]( Iarm-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 W1 j8 p- I4 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" D- j- V! t5 H: J( b. [9 C7 v) O! ]+ G4 X$ `5 g
3 b* Q) Z/ u0 d
|
|