|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 n$ L P, h2 D: T! h: P5 a
- [code]EDMA sample test application
0 N! a3 P/ v5 o4 Y1 E( h - /*
. Q! Q; n+ m1 A1 ?1 k5 D( w - * edma_test.c$ R) w. K: i& D9 E) i
- *
, U8 T0 k$ g% }: G& `9 d - * brief EDMA3 Test Application
% j* j8 V# k, {1 w0 E - *
: c* P4 t$ S, U; B$ A- \7 U. h% l - * This file contains EDMA3 Test code.
& ?/ L4 }, F( J7 r- G' [ - *
& q& b8 z; Z) }' ]" {( m# i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: m# i1 p- u4 T! ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& `/ h9 ?1 b; G7 @8 u* L1 ? - * TO CHANGE.
- O, q& ?' D- V! R Q - *$ v& C/ ]- ~, Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 e5 B' Z X: v/ w" W - *, d( E0 Z* C: f0 X% D! U8 Z
- * This program is free software; you can redistribute it and/or
; ?/ s6 ~ M0 m% m6 _ - * modify it under the terms of the GNU General Public License as
, O4 m% k) B( \! h& g* B, d* A( S - * published by the Free Software Foundation version 2.
8 t$ i B5 m+ ]/ ? - *
' i1 @# S+ A6 x* \5 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ f3 D2 ]+ D5 G6 o
- * kind, whether express or implied; without even the implied warranty" g4 C( y1 a# r# i! Z9 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 [; P" }2 z9 D V8 C# J9 V
- * GNU General Public License for more details.
; h6 p6 N: l5 \; P - */
% T; I4 j' j0 [- Z, o/ v
' Y8 ~* U0 D0 q: ?5 L3 o- #include <linux/module.h>
$ c; K3 y8 i3 Q - #include <linux/init.h>
% c! r/ H2 b! o6 J2 K9 n - #include <linux/errno.h>( q$ g9 m) S/ ^( p( c- j
- #include <linux/types.h>3 I* r: b7 ~7 E, O4 s
- #include <linux/interrupt.h>
$ M* Y8 H/ l4 K - #include <asm/io.h> l% ^$ c3 }" G4 {! F: F
- #include <linux/moduleparam.h>4 y; _8 Z- b9 G
- #include <linux/sysctl.h>3 n# h- P! ^# w) H# e9 ^
- #include <linux/mm.h>6 o2 m2 z! y' W2 k) O! W
- #include <linux/dma-mapping.h>: d. S0 ]# P6 J5 @5 V, f- W
- X6 ?+ R6 u5 t, `
- #include <mach/memory.h>/ C$ w6 @0 ~1 e$ B2 a) u/ c
- #include <mach/hardware.h>6 N, E5 x' @- |" H/ ]/ v. I
- #include <mach/irqs.h>2 A1 z) L1 u; m+ v. }8 g3 [4 r- o
- #include <asm/hardware/edma.h>
4 x6 [1 N, ? u2 W% P- R - % l4 F6 M6 L: h9 C5 R7 ^
- #undef EDMA3_DEBUG* {5 B& V3 Q4 |' f: e, ^
- /*#define EDMA3_DEBUG*/
8 w8 c* y- k: d% o# @ - % m# q3 y, p* x5 D. q8 Y: X. o
- #ifdef EDMA3_DEBUG+ @& d: S! ^: Z% l, G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: _- _8 |4 K: o- ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ^- G( J" e. m& q) L2 |. O! e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 {. y$ N2 g9 L
- #else! E6 `9 c# q+ N: Z4 O7 D {/ S2 q
- #define DMA_PRINTK( x... )
8 D5 `3 Y( f" U+ I0 E. y - #define DMA_FN_IN
! f1 R9 {- w! ~& F% M( w3 x5 ~ - #define DMA_FN_OUT/ P0 H! p6 |$ w% D7 ^
- #endif9 o* \, N6 f$ v: Q
- ( K2 c1 U/ `* [- ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
u( c5 K8 Y( |; f. x4 h - #define STATIC_SHIFT 38 ?6 Q( e. P, X4 Q
- #define TCINTEN_SHIFT 20
* q3 } P9 X) q( O - #define ITCINTEN_SHIFT 211 _4 h; a) X) Y, U! g
- #define TCCHEN_SHIFT 22
& N8 o' n1 e, \% W2 e7 j - #define ITCCHEN_SHIFT 23
, C5 ~/ Q3 T2 F+ C& L8 q
; D( ]% }* v4 ]* J3 J- static volatile int irqraised1 = 0;
. C/ c- S/ A p' G - static volatile int irqraised2 = 0;
$ l" V- S- k! M; b
8 y+ Y W, r/ Z' B! T5 [# {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, [# ~0 a8 J4 \) F+ s6 W2 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ?% ~' N6 a; k" |7 B8 H2 a2 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 o- e8 }9 Z3 D - " S% P+ l' d) z8 z: c2 R) b
- dma_addr_t dmaphyssrc1 = 0;
; i+ ]! L, n/ O0 N/ E: Q/ _ - dma_addr_t dmaphyssrc2 = 0;: v# L$ I7 Q( e: @1 K- t7 s
- dma_addr_t dmaphysdest1 = 0;
( a5 }# z# A# D6 E+ ?! C0 b) p - dma_addr_t dmaphysdest2 = 0;
/ W& [5 T3 u) Y/ e6 v6 \
% k+ Q' e6 ~& o: T% T- ^6 o- char *dmabufsrc1 = NULL;
! e. y; v1 P- N - char *dmabufsrc2 = NULL;
) I- ?* D7 P0 H - char *dmabufdest1 = NULL; f4 m& m2 H; M+ E
- char *dmabufdest2 = NULL;8 O7 W$ c- c d4 }# A
- ' ^' _2 e3 b" w' @! E# D! s
- static int acnt = 512;8 o6 R/ t6 j. s! }; V0 P! J
- static int bcnt = 8;
. t' I$ N1 x% O/ ^ - static int ccnt = 8;
H0 X: i R8 E# c; V- p6 J
5 x8 c- K3 x6 R- module_param(acnt, int, S_IRUGO);4 l5 b+ Q, _+ ^8 h
- module_param(bcnt, int, S_IRUGO);$ Z- h" ]5 U7 g2 E' P" a
- module_param(ccnt, int, S_IRUGO);
复制代码
: O7 ~2 M/ H+ {+ n; a; o; N/ G/ E, s7 q7 g l; ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, f# f% D R& A8 a' ~. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! z. s5 Q2 N( a* `7 }3 s9 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 O6 |! k4 f" v. ]0 n( P5 ~ L' L2 v/ I
8 L; y7 f1 p% C. x0 i
|
|