|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Y' u2 N3 \0 v9 `. g" e- [code]EDMA sample test application$ S; t( t; T3 K C; v# `$ D
- /*0 @2 i' C- f3 E7 i/ _7 h
- * edma_test.c
. \( F/ \8 e8 c- Z0 J+ H' h% R - *
# i1 v3 J" d- S - * brief EDMA3 Test Application7 Y* o. n* \, e5 ?, ^& D/ a
- *
0 j+ s9 ^. Q4 J, q# v - * This file contains EDMA3 Test code." s7 n! T/ ^% ^+ y! j
- *
- i3 L3 O" f. }0 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 J4 K; u) E; A4 T6 H( P- m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 \. i& I* G" W' G# c& v - * TO CHANGE.* V8 c% V, P2 a1 n% X, q% T8 X
- *7 S: k$ S7 _" g1 Z. N- z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 N& s% l$ q( ^3 y4 Y
- *
6 }: ^, n; a" R2 q) T: b4 K& q6 b - * This program is free software; you can redistribute it and/or0 j/ O( d% P* A
- * modify it under the terms of the GNU General Public License as
% b; m) P+ z7 A7 k - * published by the Free Software Foundation version 2.9 E' n$ W: C' D( b
- *
' s. [; R2 G* A; r; N m( u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ?! |+ ?" ~$ ]5 T( O% P$ `
- * kind, whether express or implied; without even the implied warranty
/ b1 r9 V$ F3 o e% u" a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! R- j! Q3 t) q% Z" X" C - * GNU General Public License for more details.
0 _0 s) \) O6 A! O, V: [ - */! \: W( Y( K5 o% O& ~; W
- 1 P, H+ ]; {, }9 e
- #include <linux/module.h>) m8 v/ {' R8 A% ?
- #include <linux/init.h>
- _' d2 C2 j( v6 V' S - #include <linux/errno.h>2 j$ I+ U( m I& K1 S# M0 B4 @. X
- #include <linux/types.h>
2 E/ G# y \0 E) _) ]: g! C - #include <linux/interrupt.h>
) @. M7 a* j) I5 U - #include <asm/io.h>
! b" l. ?1 C* S5 e T, v8 c - #include <linux/moduleparam.h># p/ n. p4 i# b# L3 L3 E, k
- #include <linux/sysctl.h>2 d' F( E* h6 O+ I* S, U
- #include <linux/mm.h>$ n7 V4 k5 {4 \& a3 G
- #include <linux/dma-mapping.h>& J9 {; E9 P2 B9 U# C- ^4 F5 d
+ G z0 B0 v1 r8 p- #include <mach/memory.h># Q. E& _/ K2 j$ w
- #include <mach/hardware.h>( S. V' I7 ]" Z1 Y f) u5 Q
- #include <mach/irqs.h># L& H' a9 v0 Y
- #include <asm/hardware/edma.h>
" A. o0 t7 i Z# G- u
, |3 `# v( s" }7 J$ K- #undef EDMA3_DEBUG2 o; X! {6 i( F+ w" B) w
- /*#define EDMA3_DEBUG*/
6 N S+ [, ~6 K: f - ( y3 m$ p( n& t$ x8 o
- #ifdef EDMA3_DEBUG; s' e3 c) ?! B) I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 G8 s+ P7 j- b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 K/ Z: t, Q% y: J ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ l) L; h' I3 @& Y( t - #else5 A% j0 d1 V* B8 j* J
- #define DMA_PRINTK( x... )1 w" j. S& S- S4 G9 I8 @7 |
- #define DMA_FN_IN
E. |# L; }& ? - #define DMA_FN_OUT! D$ F( z- i* U5 a4 Q5 W/ v
- #endif) m1 V' s- G2 ?4 b/ I( R7 s
- . H v: U2 ?7 x- Q5 H8 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 w/ Y) b9 w6 J& e4 x0 e1 K
- #define STATIC_SHIFT 3
6 E, H3 s( \9 v' C- l5 n; l/ B4 F - #define TCINTEN_SHIFT 20
: s' V* w, v9 o3 f3 L/ ? - #define ITCINTEN_SHIFT 21& W/ i3 I$ S# y
- #define TCCHEN_SHIFT 22
6 Z4 q: O0 d5 M: l4 l - #define ITCCHEN_SHIFT 23# m5 v* i1 S, W0 i+ t- Y
- ; L! n4 N9 J' V, v. a/ F
- static volatile int irqraised1 = 0;
! ? Q7 n5 t; `' q$ M - static volatile int irqraised2 = 0; g2 Y7 H' \ E# ~, ^/ G, n
3 O8 Z: |) ~# d- V, u8 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) s2 _9 T# S4 j$ \ w- i! ?; z, s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' m% J/ U3 K% n$ Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @* h( O t# `6 T3 ?
- 1 K5 J$ P4 |+ K. ~& J$ }
- dma_addr_t dmaphyssrc1 = 0;
! D9 }6 n" j6 ~- } - dma_addr_t dmaphyssrc2 = 0;! Y) |* B, _4 R0 a$ w* K% [
- dma_addr_t dmaphysdest1 = 0;6 A5 K8 v( g9 B3 J+ E" R/ x- b
- dma_addr_t dmaphysdest2 = 0;
" i. b- n& l4 _3 a5 E9 a
, i1 u% l% {! Y( r$ j- char *dmabufsrc1 = NULL;
) j$ B6 C2 U6 ~( e7 p/ N% |* { - char *dmabufsrc2 = NULL; S2 n& ~1 L6 P) X" q
- char *dmabufdest1 = NULL;" M9 p8 U H' O
- char *dmabufdest2 = NULL;
: l$ [0 ]( l) p% x3 v - 7 ^/ f/ I( l" E
- static int acnt = 512;: r$ r, r' y9 l$ t& q% I N
- static int bcnt = 8;
o1 x6 f8 ^6 o. F2 p4 | - static int ccnt = 8;
! K2 v' l* }/ V' V
7 s: N, K4 h! G- module_param(acnt, int, S_IRUGO);7 G$ J2 p, ^/ Y' `4 p& t: z+ o
- module_param(bcnt, int, S_IRUGO);) l, ~4 q8 N5 S' J! S
- module_param(ccnt, int, S_IRUGO);
复制代码 3 _- h S1 S/ `' m- x
( M0 P8 W* H2 C) b o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* a% e% T0 Y9 J9 z2 Carm-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 D1 E& l) z1 q1 F3 W& w: @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, W5 u; l M- ^) o6 _/ [
9 C2 v4 v. ^, w) o( S# l9 g0 f9 o
: h5 {/ I( e! Q1 ^
|
|