|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( F+ P% d* h. a' R) g
- [code]EDMA sample test application0 K8 w: u7 Y% k" i
- /*
2 N; |( G$ ^7 Z/ U9 I - * edma_test.c: Q; a8 }" e2 n+ K* \
- *
8 F/ Y }9 M5 \+ | - * brief EDMA3 Test Application6 J* Y4 l! A/ g0 b$ c8 a
- *+ S) d- F+ Q# z, Z, r
- * This file contains EDMA3 Test code.
% Z* j7 j( v+ {6 _3 c - *3 V& m- L: b, A w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 x$ C! D! T! t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 S/ K6 r" V4 q
- * TO CHANGE.
- H4 C* E$ ^/ ~1 e5 u - *) J6 `" ?' k2 n+ z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ~" c0 L6 t9 n+ x1 p
- *4 F0 X1 k6 f. p
- * This program is free software; you can redistribute it and/or
6 ^# a5 B2 y* d( h - * modify it under the terms of the GNU General Public License as* _+ {8 c+ E; t) l6 R/ h: P
- * published by the Free Software Foundation version 2.: z( `) D; s8 `, O" p
- *
+ _) [, S) p# G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. V* c8 f3 _5 V0 C
- * kind, whether express or implied; without even the implied warranty
6 t/ W |' e9 S7 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 U5 a& V( u# b) d1 h6 N, {- c6 R% n
- * GNU General Public License for more details.9 {9 _' S! ~; x" P
- */+ b/ F" d, r" T( }# R- r9 B. A
- " r. ]! c) s6 u2 Q' t
- #include <linux/module.h>
" i+ V% L- n) n% y+ C - #include <linux/init.h>
' Y+ r7 |1 w9 i9 t* J7 ?+ E% n - #include <linux/errno.h>) R) C6 i8 n4 I: ~! C) N
- #include <linux/types.h>" Q4 o- W3 n7 V8 F* h' k
- #include <linux/interrupt.h>7 T9 Y6 X/ d+ E) K$ b0 b/ A
- #include <asm/io.h>
Q1 T+ `$ l$ J# t; ~, ^% J - #include <linux/moduleparam.h>
* U4 J. I5 l! n2 @; D( v - #include <linux/sysctl.h>
1 k7 `# i( o& e! E& M - #include <linux/mm.h>
. N6 e6 ^2 @+ m8 K0 x+ S6 U" H8 r' g - #include <linux/dma-mapping.h>
* G9 N; _0 n6 o/ m+ `
/ P- M, }' p% t- #include <mach/memory.h>3 }% C9 j' }3 O" s2 @
- #include <mach/hardware.h> S( `6 t3 X$ _) w+ n/ e# F- V
- #include <mach/irqs.h>
2 D% N: O$ Z/ W8 I9 j. `5 V! a) ~ - #include <asm/hardware/edma.h>
5 t- z& [" s6 G6 ~+ s6 H
$ Z p1 ~$ m2 [$ C+ U4 K7 S- #undef EDMA3_DEBUG$ v% K N! E/ `% t
- /*#define EDMA3_DEBUG*/. `5 I/ N; h2 I$ j
: c0 q1 l; f$ ?/ V- #ifdef EDMA3_DEBUG
; z6 _* h; U- Y# K- m% J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. J, _" g8 h2 a" {! f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* }* H. c9 d3 `' _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. w: K3 A. i& O# [6 n/ l& x - #else( W6 R, n7 N, R0 q& P
- #define DMA_PRINTK( x... )
7 l- b9 b1 p+ B: h9 Y) Z - #define DMA_FN_IN
9 ?, a; [8 _7 |9 c4 k4 Q - #define DMA_FN_OUT
, }6 S- f0 o. c; N1 G - #endif7 {3 d1 h x2 v$ |% F I! A* w
- 5 a0 @ N5 j N) b) B" B: s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), ?( R2 ?3 u. x5 M5 ?4 D4 _
- #define STATIC_SHIFT 38 A7 Y* R+ N$ q. V
- #define TCINTEN_SHIFT 20( v: F5 Z" B, ]1 D, h. R/ q
- #define ITCINTEN_SHIFT 21- b& q$ G% }1 I4 m& s3 v6 l
- #define TCCHEN_SHIFT 22
5 w" u( b3 u' Z - #define ITCCHEN_SHIFT 23
& m0 f A1 {0 z% D
- k* a# |* V4 Y/ I9 {7 q- static volatile int irqraised1 = 0;% ?' r( |, p$ V" x) g7 Q
- static volatile int irqraised2 = 0;
6 }$ i' @/ f- [ K9 v; }
5 I/ c) ] D n. b( }/ G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" h8 m! q8 O5 C9 w* n* z$ l2 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: M; B" \ t* i, I, a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 h! X' ^; o* f6 _/ d& ^ - % Q- |6 l5 }# c. T! U; c
- dma_addr_t dmaphyssrc1 = 0;/ ]2 u* a9 m- v% x
- dma_addr_t dmaphyssrc2 = 0;8 E# s& ?# X! A: l2 {
- dma_addr_t dmaphysdest1 = 0;% w) f; v8 M- q% v9 g I9 f' l
- dma_addr_t dmaphysdest2 = 0;
- `6 o3 B0 g+ ]
" P% ^0 C% Y( `$ P# D' K" w) c `( y- char *dmabufsrc1 = NULL;: e1 K: x( L% x/ e. p% f4 F
- char *dmabufsrc2 = NULL;4 V# l; P5 a' V5 [1 x2 x
- char *dmabufdest1 = NULL;/ F a7 W' s: n$ s8 R0 ~
- char *dmabufdest2 = NULL;" |& u' _: `, n$ N! G
- 0 E, t. R1 h% y5 I. A9 x
- static int acnt = 512;
! W3 y, u) r1 a2 I" A# b* N h - static int bcnt = 8;
/ A! i& f. r5 w0 L; T. S - static int ccnt = 8;* w8 }; e4 Q# K3 c
& S S' T3 f3 g0 o- P- module_param(acnt, int, S_IRUGO);6 l0 {, F4 _! i
- module_param(bcnt, int, S_IRUGO);( P N# p# e% p6 w& e+ a4 ~
- module_param(ccnt, int, S_IRUGO);
复制代码 7 x: B N6 V* p$ x3 f5 O: [$ \
( G* }4 _, Z( ]! i$ C) | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% V1 H+ }5 @" T5 ]5 S* L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) f( ]& S4 t( Y, Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% _0 Z0 u5 W2 p( ]/ n
! p. g7 X# N0 X$ x$ g% s% N
) V/ c- H& ]8 t& }( G1 u# {; Y |
|