|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - f2 d$ `) Y5 ]* ]0 j0 M9 y
- [code]EDMA sample test application
9 E0 _# w* C/ x% }0 f0 y9 ` - /*" @( l& E5 X3 l5 E) |
- * edma_test.c
) `- `: V3 M3 Q) c2 i/ t+ Q - *
' \& q, b- |4 C6 n! N5 {* \6 _ - * brief EDMA3 Test Application+ _& E1 }* F6 ~9 s" F+ F. \
- *% u+ z; A2 F# }/ C& g+ b
- * This file contains EDMA3 Test code.3 @0 _5 c+ t+ i V. i5 A* w& b
- *. Z' H; w3 [4 R; M: ?9 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 g2 O! d5 z. F! K3 F) f+ S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( t6 y4 n9 W6 M9 N1 l
- * TO CHANGE." s( b1 c+ K! ~5 K
- *# |8 B6 l( d4 B8 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |- _' w3 U7 _" v6 n; G
- *
3 p: z. y: r+ u) e! J" V/ I - * This program is free software; you can redistribute it and/or
* ?, e5 C a% s - * modify it under the terms of the GNU General Public License as
1 a5 C" k2 }# S, n7 W3 Z6 H - * published by the Free Software Foundation version 2.
0 P" ]5 y) k$ | - *% H, y4 b. L% |* p4 Y3 l1 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 y* k9 N/ L2 Y+ q0 p* l( J; j - * kind, whether express or implied; without even the implied warranty. m; W) s! }# U! P: H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 |0 \$ d1 }. `6 D4 Z& d - * GNU General Public License for more details.. X6 o9 O( E4 D/ ?6 B0 } ?6 |( F S
- */
6 P* {- A0 a5 D/ o
; I& M' T e C: M: [- a+ g- #include <linux/module.h>" M3 P; b9 S+ i
- #include <linux/init.h>2 f1 B! `, i) G7 ^$ p
- #include <linux/errno.h>1 W# p* G# q- y S
- #include <linux/types.h>- T" k1 W: r' c
- #include <linux/interrupt.h>) |$ `" @3 G. }' P* F
- #include <asm/io.h># y# Y7 s" {% [
- #include <linux/moduleparam.h>
- P9 A4 {" r" B - #include <linux/sysctl.h>
) Z# H% x. A+ x6 M - #include <linux/mm.h>5 {4 {6 f; y. X: X7 b
- #include <linux/dma-mapping.h>: G! p3 t- E- S* g, U1 ~
- # ]7 \0 `2 m6 p% _+ @* O/ P
- #include <mach/memory.h>
" z* i* u/ R9 J0 F8 c - #include <mach/hardware.h>
( _/ u2 A! X' A, w& |2 p+ Y1 a2 |8 S - #include <mach/irqs.h>
5 a2 e2 E1 U0 l8 |) Y7 m - #include <asm/hardware/edma.h>/ ^0 ^) F' ?* F i8 d! w
- 5 D1 i+ } S* m
- #undef EDMA3_DEBUG- g& s' J2 C% C1 \% x
- /*#define EDMA3_DEBUG*/# @& e7 Y5 R& N! e+ G1 `$ P
- 7 n: h, a- H# Q! D! h$ U8 j$ W
- #ifdef EDMA3_DEBUG
" N" ~; A1 I+ }1 w% d! n( Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* ~+ P( l6 T7 ~" p/ S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( i o% X$ y" A: H1 ~! u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* W" ?$ I+ l. J - #else' i/ c. G8 }7 A1 e! ?! g
- #define DMA_PRINTK( x... )
4 _) E7 W1 P& A" @+ D' f5 O - #define DMA_FN_IN# Z& k: Q# n8 J/ t4 x: J
- #define DMA_FN_OUT8 C1 h# K- U) J: s. L
- #endif+ B3 @2 H# U0 V; X p# a
+ M- U0 S$ B, z$ l, `, M/ ^/ @& c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* N2 K/ M6 Z. l2 z$ H - #define STATIC_SHIFT 32 K5 b. Q" v$ L) R) B# I
- #define TCINTEN_SHIFT 20
( r3 l9 d6 p2 _+ j3 B - #define ITCINTEN_SHIFT 214 N$ {. `6 v7 h9 {- b
- #define TCCHEN_SHIFT 220 a" z% E$ U Q
- #define ITCCHEN_SHIFT 237 l+ L3 ] Y% V1 ~6 Y4 B9 A
; Y6 W, P& N H( u- L. `- static volatile int irqraised1 = 0;
1 F& \) A" J+ U$ m - static volatile int irqraised2 = 0;
6 j0 J' |: i+ ^* g' {
6 y9 U$ j9 L4 j4 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x2 I$ D- j, F; S; I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( f, n) S! ^2 Y2 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ?8 q8 e5 @1 p% G7 I% C2 L - & o% o( H" h9 Y# _
- dma_addr_t dmaphyssrc1 = 0;
* v' e0 D7 X) v3 p% A w+ q4 V - dma_addr_t dmaphyssrc2 = 0;5 M; S% b: K+ R! w! p
- dma_addr_t dmaphysdest1 = 0;
B+ D5 l2 }+ N; Y6 D - dma_addr_t dmaphysdest2 = 0;
; J Z, n4 Y6 F- C; {4 h2 a
5 m1 M7 Z" P- N, p" i1 i- char *dmabufsrc1 = NULL;
; z9 U5 R2 a6 Y* z - char *dmabufsrc2 = NULL;
% y+ ~; A9 X8 D: @7 {, p' a - char *dmabufdest1 = NULL;
2 R0 N# }( ]8 ~ - char *dmabufdest2 = NULL;+ u) R0 a: _4 O) _5 W
- . {" w( }( A" M3 _/ u3 o9 O$ V
- static int acnt = 512;
& C5 A5 [: y l# D; M - static int bcnt = 8;
4 c& g, C- [4 r/ C! o - static int ccnt = 8;
9 V) g$ j" Z+ N
+ V; e: k0 b! `2 i1 e4 `- module_param(acnt, int, S_IRUGO);2 m% w/ U& H; d7 d4 n$ X( i
- module_param(bcnt, int, S_IRUGO);
5 _; P# R2 |3 Z, a; W, {/ Q$ c - module_param(ccnt, int, S_IRUGO);
复制代码
9 U' f7 ~$ y7 d y9 w
5 H& z) V; l( o8 d- U1 z9 _" o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |9 ~. `: ?+ M! m( }5 }' v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
R- Q; X- S3 Z5 C# n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, \2 W. o& S) x- o% _
: g7 d/ K% Y& i( J/ \- p6 z* x8 b1 ]3 ^/ D9 L. X$ m6 j' B
|
|