|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ ^. |* t: M3 X' s* m% d- W, M
- [code]EDMA sample test application
7 v4 r0 j j$ d/ a& l - /*; ~" w/ h( l, x& Y- X1 N5 ~1 ]7 e
- * edma_test.c
6 s4 |" k% g, S- S ]& P1 ]3 K - *
6 d- R! w2 w1 t, b& A7 a8 K, u3 N - * brief EDMA3 Test Application- o/ C% E4 S8 l* `1 b
- *
$ P1 A7 b K' ]2 D& f1 u7 k - * This file contains EDMA3 Test code.
7 W( |& F$ w- h7 P- g# F - *5 q* a( J" Q& [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ e+ n2 F; l& i/ u$ V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 X+ `; Y2 n) S. q% f - * TO CHANGE.
* l, x- x$ Z* @% a8 J: U* D - *
: L5 u2 f, L- [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ J$ J# R! w/ m3 ~# Q
- *
/ h: Z+ P( z7 t+ C2 K6 ^$ ] - * This program is free software; you can redistribute it and/or) ~. a# r! C% H
- * modify it under the terms of the GNU General Public License as
0 Q6 t0 C5 r# V: o* o - * published by the Free Software Foundation version 2.1 V) y# w% C; P: S& w* y- [
- *5 A& p2 F% l7 `0 l/ w$ w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; _8 R8 G& d' ]" q- \2 G
- * kind, whether express or implied; without even the implied warranty. u" b& X+ `* s) l. U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \4 j) H8 ? `* s: l. J( \
- * GNU General Public License for more details.
, E3 O3 g* h y/ D7 h& k! V2 z - */
) Q) |! h7 R& N0 ]! J+ k - , b# a3 H8 g# T7 a3 L
- #include <linux/module.h>$ ?+ p" W8 o6 x6 F$ `3 C
- #include <linux/init.h>5 G: ^. W3 D1 o. q
- #include <linux/errno.h>
4 o' a# v( _6 t& f1 a0 ]7 [% ^ - #include <linux/types.h>
+ z% l8 O" c- N5 b0 d0 O& U1 _% X b - #include <linux/interrupt.h>
! O5 f! D8 c/ R l2 h# I - #include <asm/io.h>! i3 o% b) M6 o5 x, N& Q! u! p
- #include <linux/moduleparam.h>
. e' u& z8 v" \ - #include <linux/sysctl.h>3 }, L3 V- {- R% h r1 a+ s
- #include <linux/mm.h>0 m2 N- k, m! @; g6 f0 S( a
- #include <linux/dma-mapping.h>
3 N& B- l+ t& [! A! D# z
* a4 y T- t+ ?% \9 y; G- #include <mach/memory.h>
/ R+ y- _3 ~( l3 N - #include <mach/hardware.h>" r4 E# ~$ }# p$ t2 E: L
- #include <mach/irqs.h>
; `( M. ?# B1 s7 u6 H( G% S/ c - #include <asm/hardware/edma.h>, Z" L3 G, Q: M# h+ \
- 3 R/ B& J8 T3 ^1 a
- #undef EDMA3_DEBUG- i+ Y+ t+ Z' Q
- /*#define EDMA3_DEBUG*/
; E5 X, n( r' G4 s) [ - 1 H% _+ K1 z |6 o8 d" A7 I
- #ifdef EDMA3_DEBUG9 ~) @/ s' g3 w# `$ J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; B! j/ V8 A; i% b# C0 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N* K9 a' G# V/ g |, ], ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ N/ Q9 L% S+ K- D! O2 \6 c - #else6 X+ [. l( R7 F( z
- #define DMA_PRINTK( x... )
0 ?: b/ _% H8 n i - #define DMA_FN_IN- Q. w% d; c8 G
- #define DMA_FN_OUT: x# Q; r/ M1 A
- #endif# m1 {, Q5 R% d# r7 `- P
; z* v6 W, E/ B3 D: B( p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% }8 X7 h+ v/ ]8 h: A1 a
- #define STATIC_SHIFT 3
" \* i8 W' C* [# F: y/ E1 J6 w - #define TCINTEN_SHIFT 203 Q) j Q o* Q1 A( v( b
- #define ITCINTEN_SHIFT 218 r. [2 }( z7 |$ X7 q, z) z
- #define TCCHEN_SHIFT 22/ C! m, S9 I' W0 j' Z; @- Y0 V
- #define ITCCHEN_SHIFT 23
$ S+ b$ f& I" e p" |/ H
Q7 J! a) Q& i4 h- static volatile int irqraised1 = 0;
8 C5 P A3 I3 {, ^ - static volatile int irqraised2 = 0;% b& [2 [6 U* Q% `% B, S; `
% @! v* X: s$ Z1 _7 y0 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ {- g/ d( K$ x, R9 |% y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. O. F4 j u) o. B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& @, n3 G. O+ U9 b7 c/ B; S) X* x% x - % b+ v, e/ p3 [+ q
- dma_addr_t dmaphyssrc1 = 0;. |3 O- k2 Z% r* e9 h
- dma_addr_t dmaphyssrc2 = 0;
. N8 o* Q; W; B6 B" Y2 z5 m2 Q - dma_addr_t dmaphysdest1 = 0;$ c* u: T. W/ U. {
- dma_addr_t dmaphysdest2 = 0;
/ G. Y/ @& ~/ P - ) e) \! P3 P% |2 D$ ?
- char *dmabufsrc1 = NULL;
. B+ d1 q- T3 }0 [. z - char *dmabufsrc2 = NULL;
: e9 |4 a4 A/ O& u# J9 p - char *dmabufdest1 = NULL;
) {, M& ^0 ]5 R. o: u0 J: k - char *dmabufdest2 = NULL;
0 Y O; ^. y" }% s2 L1 n - * M; z" H) ^) V- K+ V2 Z4 E
- static int acnt = 512;
" N) `6 [6 H N; m. z* B - static int bcnt = 8;3 {0 x# H, t) V& D* c, j5 s" }) I
- static int ccnt = 8;4 X9 b% p {; T7 j+ H+ G) I# Y5 R
- # ]( ~4 M( w8 `
- module_param(acnt, int, S_IRUGO);
$ k" i3 `+ I; { - module_param(bcnt, int, S_IRUGO);
% S0 A, n% N! x( S - module_param(ccnt, int, S_IRUGO);
复制代码
& Y Q% R7 E ]* }) D! d& T' P- |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 \) b/ S* W' [ T6 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; Z' \4 ^+ v+ x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. r5 S6 y, p5 d- u
; d/ d5 ~# R2 Y8 {$ J% _- k
% M# x1 \8 b1 h5 y; A0 d1 G/ K( l$ O |
|