|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& L: Y# J M! V( L) Y8 C! p9 M, k- [code]EDMA sample test application1 \$ J/ l* ]/ D, ?7 y# P! {' f
- /*
$ V8 D4 G& \4 C2 o5 Y5 ` - * edma_test.c
% C- n! S3 I( O/ d) m' P. q: z* | - *
' y% }% U- W3 J - * brief EDMA3 Test Application5 \7 P8 [8 E2 B
- *! [' ]/ l$ x; h
- * This file contains EDMA3 Test code.$ {- M: N. }7 C6 Q/ C/ R
- *
0 M8 x0 m+ `+ ^, \. | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ e/ ]+ H+ n0 O& e% ]0 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( m1 f% [& P- [9 q7 g- o" b5 U: g
- * TO CHANGE.
0 B! Q, Y* O& Q* a; I, u2 z - *- v0 F# I; F! S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) N' {4 R4 M+ z2 l" a' ~ d
- * w6 ?% q, t7 j1 b3 g+ q
- * This program is free software; you can redistribute it and/or0 W: ^ W9 d) s' H) \) \
- * modify it under the terms of the GNU General Public License as
3 f; I% {2 ~2 Y- N' }% M - * published by the Free Software Foundation version 2.3 m3 c9 z5 v9 I% C6 s
- *
. z& \: v, L! J& \) k5 [4 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" s8 y% W' |" o - * kind, whether express or implied; without even the implied warranty" x: N+ ]- K; R; R- W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 j+ M3 a# p) P" k; W5 R
- * GNU General Public License for more details.
% J% r) W: P0 } - */- n6 u# ^' a5 s. I8 L# x
0 `+ k6 y7 o8 \- #include <linux/module.h>. a2 e* a8 }! L! L: U6 H
- #include <linux/init.h>
% J# R& r1 V; @. w - #include <linux/errno.h>+ [2 ?5 q9 J3 y7 c7 n
- #include <linux/types.h>( \# r) N+ S! D$ r( Y
- #include <linux/interrupt.h>! ]/ F# C) R( V9 U3 C9 I
- #include <asm/io.h>
" T7 C9 i. u6 o0 v# W" v! [ - #include <linux/moduleparam.h>' N) d) [7 y) a8 t
- #include <linux/sysctl.h>
& {7 o2 g# a5 {$ A9 k- n# e( Z - #include <linux/mm.h>
3 {* W0 q" T. ^4 U+ j6 w - #include <linux/dma-mapping.h>
1 n: f) @6 d3 d' i* c i
0 o4 }; y2 b) ~ K8 o( c% p# R- #include <mach/memory.h>
2 e! }6 h: ?) |3 @ - #include <mach/hardware.h>
& p" m! n. A3 t9 ? - #include <mach/irqs.h>
r, d# j! z) } - #include <asm/hardware/edma.h>
' Y4 e/ b, V8 M) _) ~
5 S; F" D* H4 ~- k0 n+ s* v( d- #undef EDMA3_DEBUG% q- N$ m. |7 \$ G5 F; j/ p" p7 x
- /*#define EDMA3_DEBUG*/
; M5 `' o% o+ Q- W! G" n3 O
o; o) h0 e$ P$ L# M- #ifdef EDMA3_DEBUG
& x `0 O2 T9 U7 W! Y+ { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' X! e( E0 p. I% x$ h9 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 P5 {7 d0 o% u3 }6 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 S/ ^$ f. U' y
- #else( f; b3 |: ^; S+ i' _! y
- #define DMA_PRINTK( x... ); P' S9 g0 z- G
- #define DMA_FN_IN% u( K3 b4 e+ E" {3 h% @0 W/ {
- #define DMA_FN_OUT
9 ]4 F# G3 k5 U& V! C; w" R8 A P" W2 o8 n - #endif
$ q1 S* j5 C6 h* U - 5 g# q( [" B8 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; W7 p4 R/ s7 E- A3 [ - #define STATIC_SHIFT 39 |$ |" F( F7 H
- #define TCINTEN_SHIFT 205 T; ^; W1 F! G6 O& z0 D4 i: F
- #define ITCINTEN_SHIFT 21
- _# v7 f& p4 w9 m7 c L - #define TCCHEN_SHIFT 224 v0 q2 `/ L" H' @
- #define ITCCHEN_SHIFT 239 j1 _/ v" Q) O) { p3 X C7 U
* i$ j. |0 r1 N, r5 _; m3 h) q: i- static volatile int irqraised1 = 0;
: ^2 B0 R% J; u; [ - static volatile int irqraised2 = 0;
, L# g- t% S; D - 7 s) i* V. |8 W9 [ ~$ U3 l; y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X, V) h/ i$ H( \5 g; r2 _! H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 _3 _% o% M. [6 |. D0 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 R/ m! X5 ~' ?8 ]7 ]
- / a( ?. Z& t6 K+ [- P4 U6 l3 U
- dma_addr_t dmaphyssrc1 = 0;8 f- ]5 q7 K! e% j1 E/ w- m7 ^
- dma_addr_t dmaphyssrc2 = 0;0 T! S3 N. X5 e7 x& k4 G+ v5 f
- dma_addr_t dmaphysdest1 = 0;, d# m; O0 J1 |! G9 K
- dma_addr_t dmaphysdest2 = 0;( q/ |0 m! p' L/ }8 z+ ?/ {
+ @- J# L0 c6 D1 W* M- char *dmabufsrc1 = NULL;; v+ C/ b! ~7 |* Z; f: F
- char *dmabufsrc2 = NULL;3 I& k3 b! g0 h& r( P
- char *dmabufdest1 = NULL;
6 T8 p. S4 B* j1 ] - char *dmabufdest2 = NULL;
/ k2 T" v' }/ K/ j$ x - % m( b' T: r D- i" F- _
- static int acnt = 512;
0 L9 t$ E( B2 c2 ]" w: L: A - static int bcnt = 8;
4 Y8 S: Q0 s8 Y! J/ }, e! s - static int ccnt = 8;
' v! l( f' u# g& Q+ G8 c$ X
. j4 F3 I+ k- E1 P" ?5 j- module_param(acnt, int, S_IRUGO);4 o% \' v- p+ @! u0 v3 S5 X
- module_param(bcnt, int, S_IRUGO); L4 I6 e( J! `+ b% z
- module_param(ccnt, int, S_IRUGO);
复制代码 % ~' t, I& ~6 n2 w/ ]$ j
% {3 ?' ~7 e6 ^: J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% K' X; |0 f2 k' {, @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* W' Q6 m' [* m( m8 D5 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ]" ]* u9 Q0 ~9 ?7 V
: X m9 A% W3 t( g! m5 \
$ E+ \( I5 r, m; ?6 s+ { |
|