|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 x7 T- {' Y8 J% e3 q, c8 j- [code]EDMA sample test application/ P; s! Z8 D) f
- /*
! N6 K( N9 p9 y& {5 ] - * edma_test.c
m% r0 j" I; E$ u# ?' B - *: y }: E% r6 A! B! B z
- * brief EDMA3 Test Application* ^* y7 w# i. H$ b! s
- *
0 Z0 b) p8 j. K; D - * This file contains EDMA3 Test code.
9 m+ h o/ A5 C! Z8 O% J. U8 ] - *
: q0 x& [% f( D$ `5 F$ ?; z" o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 D$ g8 a! D8 ~3 q* h1 E: |& f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- _( w P$ v7 s/ F! n( P7 M - * TO CHANGE.% y( a/ l* s# b$ ~/ s$ [
- *6 H4 r* v5 |- O" a! I" x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! y8 g8 c; [+ W) b) X
- *
' D& d. X3 S+ M - * This program is free software; you can redistribute it and/or
# D, j2 c5 H0 o* F - * modify it under the terms of the GNU General Public License as
* | P- d# U# c, z7 z4 @0 M) ` - * published by the Free Software Foundation version 2.
8 u6 b6 A4 m: _6 G8 Y) W - *
+ U$ l+ D$ d9 c' x+ _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 w9 B& N+ t; i0 h2 [
- * kind, whether express or implied; without even the implied warranty
( K/ v0 U C# M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 f, b; {& F4 D" {% n. t. v3 N4 a - * GNU General Public License for more details.0 S: B- C0 C9 e9 `. n0 r1 H7 K/ N
- */
4 k' x+ y1 }5 J2 g5 ?, `/ u1 X
0 T0 o; V) y- M ]7 M! a- #include <linux/module.h>8 H. ?$ w- T$ P; z1 N! e* a
- #include <linux/init.h>
b' g; Z* b+ h3 `/ t7 e - #include <linux/errno.h>
3 T1 Y$ u: m1 ~( [ - #include <linux/types.h>
2 |7 ~6 C: a4 k; M9 Z. C - #include <linux/interrupt.h>
M2 t# Y* _3 f1 I5 N; _ - #include <asm/io.h>. G- k; ` O6 _7 Y5 F3 U! A
- #include <linux/moduleparam.h>) H# Q- w( B# Z2 e0 O
- #include <linux/sysctl.h>) G' j+ q) l; ~6 D$ ]
- #include <linux/mm.h>
) G7 z1 g; ]+ y6 w: c9 t - #include <linux/dma-mapping.h>$ }9 N5 Q. C9 w* s
- : j/ D2 o* m. |" b! |+ y
- #include <mach/memory.h>
* o* h; v5 Q/ @2 x/ } - #include <mach/hardware.h># R! h S( H8 U) ^6 I/ E
- #include <mach/irqs.h>
2 M# u( n( @. F* s# L( W7 R& y - #include <asm/hardware/edma.h># M, p( T7 d# ~
- 4 R" i6 x! [ O8 F: `
- #undef EDMA3_DEBUG
# o1 ]% K3 v# n+ h5 C [1 C - /*#define EDMA3_DEBUG*/$ s5 m: T9 u( B4 _
5 P! \% y9 r. g1 w* G4 f- #ifdef EDMA3_DEBUG# t, Q' ]# C3 h2 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; G4 F% G {9 }7 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( J; D: ]( G- o; F$ \/ t6 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ v7 H* ]( ?% q6 D1 \& a - #else' ~! r3 _- U! ]6 M* Z( H
- #define DMA_PRINTK( x... )
3 P1 v4 `" C4 T2 w+ ?+ ~4 W - #define DMA_FN_IN% ]. e1 F& i0 Y& l* ^1 \$ i* l
- #define DMA_FN_OUT, q0 }' A1 _( G8 d7 G5 C
- #endif
: |- ]0 F# s- ^5 F+ _1 F
/ y/ y" Z0 o- d$ `' n0 Q% v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 R5 z. |, Q7 f: o& N
- #define STATIC_SHIFT 3+ k3 z2 p4 Q2 U+ |+ Y, f8 z
- #define TCINTEN_SHIFT 20
% }) a& U2 q2 `1 u& p6 h8 {1 r - #define ITCINTEN_SHIFT 21
, d1 r7 A- @7 _- Z& ? - #define TCCHEN_SHIFT 22
0 P0 }: y. E- Y9 I - #define ITCCHEN_SHIFT 23$ V* c8 O5 Y `; P' j
- 2 x% s( M" f s$ z. Z
- static volatile int irqraised1 = 0;
+ ~& u0 t: W+ a: ?2 L - static volatile int irqraised2 = 0;
! W3 J3 w: e: Z+ n7 ?/ v - 6 X" [) `. k/ v$ i, ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& j$ `) Z9 N; g( ?1 ~/ P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& I4 Y) O) I7 s; B! g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z, j, U* y' O
# ^0 I2 u% z: ^! p- dma_addr_t dmaphyssrc1 = 0;
1 j( p4 p: S8 r9 y5 B/ n - dma_addr_t dmaphyssrc2 = 0;5 H# [1 b, R3 S
- dma_addr_t dmaphysdest1 = 0;# Z* @5 c, Q9 ]) Q# N
- dma_addr_t dmaphysdest2 = 0;
3 p' P5 y' d e( ^/ p4 y - ; ?3 i* ?" @' b* j4 p! I0 t% y8 J* O
- char *dmabufsrc1 = NULL;
! c% ?; g% u/ Y) [! H- | - char *dmabufsrc2 = NULL;& I" b7 U, G+ e$ \8 l; b. d
- char *dmabufdest1 = NULL;
3 z% k' N" ?2 O3 a - char *dmabufdest2 = NULL;
1 N; q4 f1 ^0 M% O4 G# e6 D' d: ?6 y
% B# P, V1 B6 a4 B4 \8 m; g- static int acnt = 512;; w: I( G2 [8 n x$ h& X! B. g
- static int bcnt = 8;
# Y: j E- L9 c1 C1 p/ Y6 Y - static int ccnt = 8;
4 J$ J9 n' x6 Z: V$ a
7 m8 O( h& y$ m L4 y) w9 ^5 Z- module_param(acnt, int, S_IRUGO);( w9 U; K: G- O7 A1 ^
- module_param(bcnt, int, S_IRUGO);
9 i! v6 [$ K& G1 ?) P- Z - module_param(ccnt, int, S_IRUGO);
复制代码 0 a' k1 L0 r& i' E! j8 } L7 O
g% X+ j0 z, q; v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [: v- D. N& S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ E, e/ P+ f1 ]1 K5 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 [1 j2 \; c, [* u0 ^' B
7 M2 v, K0 f8 Z( P/ v; G6 w5 P: g
5 F. }; F* Z4 V |
|