|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" m4 V0 s, G7 M& Z9 g- [code]EDMA sample test application- D* r$ t3 k% l' a6 V
- /*
( p1 e2 T; R# o( ^' [/ j1 f - * edma_test.c$ j! N0 L, U! v* s) ~4 j* w
- *: c9 n# e6 y$ @* @8 E; y1 c
- * brief EDMA3 Test Application/ O) ]0 C' u) P; v# n- i: X
- *
. m& G$ a/ W: C - * This file contains EDMA3 Test code.; X- p3 m0 |" U) c1 K4 \( t E
- *
- ]/ T3 t5 K! Z. ~0 ^( [- W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 T; Y' Z# B+ V) ]2 X( t1 B& W0 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 e% r, Q6 [1 q# ]3 ]
- * TO CHANGE.3 X) X( u7 K& H+ i! T
- *
4 @/ I' L1 {* v$ X: ^' Q/ {3 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# e* q3 y9 q; o
- *! Z5 l& O% [# d1 N* V
- * This program is free software; you can redistribute it and/or4 H; i9 k) K5 z$ G
- * modify it under the terms of the GNU General Public License as
! B7 T$ @0 }6 e" y$ Q; t - * published by the Free Software Foundation version 2.
: v# s2 [; m- ]/ r, h$ ?; }# _0 V - *
* U T0 f; R# N4 \2 k5 G+ R/ M# E8 W! v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 i- J. o2 g( t1 h. Y1 T* |
- * kind, whether express or implied; without even the implied warranty/ U! b( C" o7 f- B: E% l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 r2 U8 _8 O' c
- * GNU General Public License for more details.4 @3 D+ k+ ]9 [2 `
- */: E" f% J( @. K2 U. {
9 \& N* u. X |9 O+ i/ _- #include <linux/module.h>, K, Y3 b. e( S3 @+ ?. w Q6 `
- #include <linux/init.h>% q( b; e3 u, @$ `5 S
- #include <linux/errno.h>
4 ^9 N* O6 i0 W( \/ Z( ^0 X - #include <linux/types.h>
9 n: g0 x; z1 i' c \# P& W - #include <linux/interrupt.h>
7 ?. H' ]2 Q" p6 i' m2 r, C - #include <asm/io.h>9 @6 [0 w o$ J
- #include <linux/moduleparam.h>% ]% Z% d' k6 n v4 @2 n [# z
- #include <linux/sysctl.h>
6 y# r( |& t6 C' q# q2 ]( X - #include <linux/mm.h>3 S% q& G& d( c2 c
- #include <linux/dma-mapping.h>
" S8 b$ a3 a: }
6 ]6 e$ i# f. Q( H' Z0 Z' B- #include <mach/memory.h>
/ Y) U$ b8 M: ?) y9 u8 @ T - #include <mach/hardware.h>7 Z8 e( T. L7 a, U$ `
- #include <mach/irqs.h>, J! J' o5 I- N+ o) w, {: v" h+ ~8 o
- #include <asm/hardware/edma.h>' [8 [& |6 L' t; D9 [
Q9 A0 T/ W) _3 Z% ^3 R- #undef EDMA3_DEBUG! H1 N( y2 [# U' z
- /*#define EDMA3_DEBUG*/1 A, c0 H- L9 A0 t& t
- - c7 q: I3 T4 t+ a' \4 U
- #ifdef EDMA3_DEBUG* i! F' H- ^; J M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f5 @4 M0 B+ J! h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' A) D8 K- M0 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( P; w" H; g- S3 J, A+ n, }
- #else
" V+ d7 q% r9 m9 Q) Z5 _ - #define DMA_PRINTK( x... )
3 |& F& Z* L. I* R/ \. d - #define DMA_FN_IN
0 Q" |( `. E4 J. x - #define DMA_FN_OUT5 G% V# ^4 N' a8 n2 K, \3 W
- #endif
! @. ~3 A, J' x; F y2 f# n3 { - 9 w$ I" v. y9 V, L% |2 L* r$ F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 a6 m Y- W ^; J# a - #define STATIC_SHIFT 39 j: @. `7 ]# U Q
- #define TCINTEN_SHIFT 20/ e/ B" u4 H9 y) u. h" r/ f
- #define ITCINTEN_SHIFT 21
$ r9 D9 N. W0 R! X1 k - #define TCCHEN_SHIFT 22
1 W& m; Q% S! P6 a - #define ITCCHEN_SHIFT 23* l% I) ~+ S5 {/ c! J" [
- 8 ^8 U' b# r* F5 h. x7 n# x% H; E
- static volatile int irqraised1 = 0;
) H- y5 a1 p1 q% p4 A - static volatile int irqraised2 = 0;5 L0 b1 m" B8 w4 f
" {8 g6 I1 T7 l% E( R4 K( J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z' Z' {: f8 Q5 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! B- ]4 m# |" M4 ~& M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: J4 E: B2 W3 d$ z) D6 l% u
. H! `- c3 y9 `1 s7 T m$ o; h- dma_addr_t dmaphyssrc1 = 0;
& U: v- f5 ]1 ?& S7 _' {! q. o - dma_addr_t dmaphyssrc2 = 0;3 _6 J! h7 U; F0 j' H
- dma_addr_t dmaphysdest1 = 0;
( \4 N8 m/ E1 B6 k' O6 W - dma_addr_t dmaphysdest2 = 0;8 W, |# ^( i* ]2 w3 o: T
}, i+ q( V8 o O5 v \- char *dmabufsrc1 = NULL;
* D( `' O/ {$ H1 `2 I - char *dmabufsrc2 = NULL;. N& u* s: z3 `. b! m3 C4 R* D
- char *dmabufdest1 = NULL;% O4 A+ v/ c5 p
- char *dmabufdest2 = NULL;
$ E& ^4 L3 D0 _6 }
# }% L3 j( M, K* k5 [# T- static int acnt = 512;+ n% G, M2 R0 a8 D) V
- static int bcnt = 8;, B. X* r0 ^6 M) Y3 f
- static int ccnt = 8;
9 t! C) N6 S6 i W$ `6 h - 9 B/ @3 w( d* Z- n2 w" W( T
- module_param(acnt, int, S_IRUGO);
* M% `. B$ {2 w - module_param(bcnt, int, S_IRUGO);
: O3 B, ]( x* M/ a8 ~0 @ - module_param(ccnt, int, S_IRUGO);
复制代码 : t. J6 o% c/ A, E3 S4 h
2 S7 l( c2 n$ C! _7 [0 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ }6 p4 f: [+ t' jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# N- F# ]6 i% B( r. I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 s6 o. E2 a, _- K- x: s7 ]6 Z0 L1 c5 {& k8 N- R
* B# _$ u) @1 p- ? a
|
|