|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d. ^- g( {( _0 h- [code]EDMA sample test application2 l: e- _7 J# Z8 S6 G4 D+ c# U* e2 b
- /*
. R$ N9 J7 H Y, w( ^4 d - * edma_test.c
& m* v5 k3 G, }* {. e4 v' x- y# a$ @ - */ y4 P1 i+ A% H
- * brief EDMA3 Test Application
5 {& I/ ~+ b. {! Q, p9 L2 R - *
3 ]2 f8 R; c# ] - * This file contains EDMA3 Test code.. ~6 U7 q" L5 p; ^* s6 E
- *1 D4 X/ M# F: S4 [( R) H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 g( L+ N) s4 m5 @9 h% P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 J, L% R5 ]+ Z - * TO CHANGE.5 O4 F9 p( H" ?* F
- *1 z- b5 K3 `1 {( _/ O) b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 j3 Y; x5 R5 t0 x j2 p
- *" H, L/ r* y* |
- * This program is free software; you can redistribute it and/or& @$ C, q6 a- z; @# D, z6 r5 a
- * modify it under the terms of the GNU General Public License as
) g! s$ v2 r1 \5 M4 c+ { - * published by the Free Software Foundation version 2.! {; k9 u# d, G- h9 b$ F
- *$ H; j% C8 G+ X5 q" C" t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 l. r, ?( y2 |) H+ o% n) p - * kind, whether express or implied; without even the implied warranty. ~' W: @2 ^7 n2 v7 [) o6 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ~4 x' K/ b* t1 p5 l
- * GNU General Public License for more details.
7 ^ X6 b+ ^1 r2 l# E - */3 ?' j9 m! D3 P
- . ~6 l7 U6 H) p7 `& Q# t4 k! }
- #include <linux/module.h>
/ V9 \7 M3 c) F4 K! K8 i4 u2 | - #include <linux/init.h>: @; h1 J7 m# U6 F6 G' ~! e5 y
- #include <linux/errno.h>
3 Y' m Y/ V3 _7 J6 K. v) k3 @ - #include <linux/types.h>" B \& Z; o1 B" L3 ?& Q* m: a
- #include <linux/interrupt.h>
7 |4 V" |- ~, ]- L: b& M: _) T - #include <asm/io.h>1 r# o) Y/ u4 A' ^" N
- #include <linux/moduleparam.h>
: C x7 C& Y; x" c; P, }) E - #include <linux/sysctl.h>! H8 d- y } R& f
- #include <linux/mm.h>
3 X: l2 H# C1 H0 Q - #include <linux/dma-mapping.h>
! j0 E* F5 r! R) D3 J) e$ T/ n - ' |# n+ E8 M2 S- P
- #include <mach/memory.h>) H; R5 |0 q7 z! j( r
- #include <mach/hardware.h>- g* G0 g1 U- y0 B7 I; f: f
- #include <mach/irqs.h>
! t$ o1 @; n- D) X* z - #include <asm/hardware/edma.h>
( ?' F7 f0 _8 B( V9 M2 c0 _
/ x( Z- j# c. x) P# U- #undef EDMA3_DEBUG$ |" @5 ^4 ?- h( b Y8 W$ Y8 ~& x
- /*#define EDMA3_DEBUG*/) P5 M4 l* ]6 A: ?+ d! a
5 g1 y8 }* Q; g) E; P- #ifdef EDMA3_DEBUG
: f9 S; r% ?* H" K! v! m3 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ e5 i, _) u+ m3 T, ^" g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 D+ ~4 v0 y1 b- t' w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 D" f. n3 R3 O6 p6 k. w; | - #else
6 \* ?2 q. m; }2 B0 z8 D- p$ d - #define DMA_PRINTK( x... )$ x! f0 Y& D+ F: V+ i7 I' _
- #define DMA_FN_IN0 N4 M" ?& ?% f+ r
- #define DMA_FN_OUT3 _" E' V2 v2 J) Z
- #endif8 u& F3 f& Z; f& Y$ e
% @5 F% _7 d) P1 a/ r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* h' ^8 G. A) J4 u/ |
- #define STATIC_SHIFT 3# r9 L* h1 O9 H$ J6 C" j
- #define TCINTEN_SHIFT 20! ?8 G1 h6 e2 N C
- #define ITCINTEN_SHIFT 215 G! E y. L, `- Z) Z( J9 u
- #define TCCHEN_SHIFT 22
% r- I8 l9 C! v! V3 t5 t - #define ITCCHEN_SHIFT 23
^3 Y8 }& T) k |0 |# s - 6 m" \) P. s9 i o( V
- static volatile int irqraised1 = 0;
6 m* k1 @$ `! o. E, s1 Z - static volatile int irqraised2 = 0;( K* ~* H' F1 N7 D" e5 y0 N! V* I \- w
6 w8 _+ G% {$ g8 |: x" g; h( \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' _( D& M I! W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 I c5 {7 y7 P) X( R2 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ E* Q5 E1 |3 _7 w/ O7 l& O2 R - . y6 L. |' \ {+ b! @" C0 `8 [
- dma_addr_t dmaphyssrc1 = 0;1 ~/ y3 i: g( n4 `5 y
- dma_addr_t dmaphyssrc2 = 0;. ^4 C; b% v g; |9 L2 @
- dma_addr_t dmaphysdest1 = 0;6 B% z% e& M# J
- dma_addr_t dmaphysdest2 = 0;( U1 `9 W3 r, O) R5 e" K1 N
) A' B9 c$ E/ |$ H1 p' i- char *dmabufsrc1 = NULL;6 [% a- T. F# Q- q& ~ P' n, c
- char *dmabufsrc2 = NULL;
" ], h+ G) H! J. f/ N- ~ - char *dmabufdest1 = NULL;. h+ k! u/ y" l
- char *dmabufdest2 = NULL;
1 |* \$ V/ [- L: r - ! x& j+ |9 j: C v5 A$ ?, ?; o9 L
- static int acnt = 512;* V/ k6 n" S+ Q2 ?
- static int bcnt = 8;
: S, M1 X/ }1 ?$ Q# ^0 N - static int ccnt = 8;0 R) S! K& t2 ]0 D
, a% Y; R9 P% e0 ?- module_param(acnt, int, S_IRUGO);
% G4 J% b8 y4 d y0 A - module_param(bcnt, int, S_IRUGO);
$ _6 L" v1 n" @( `6 A7 x - module_param(ccnt, int, S_IRUGO);
复制代码 - |0 F. m' p4 Z$ y5 A' k
; x9 U9 M; |6 ~. b) Y4 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# D- s# f, ?# `. A" {/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 L H9 P! w, k5 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 h% | e" u, e6 p) w+ o8 i
( H* [" k4 K' \, n/ y# \. ^
% S( ^2 f& {% L+ N4 B+ O" X, r |
|