|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % ?. f2 X5 e$ k1 A" h7 S2 V
- [code]EDMA sample test application
2 C: |% {4 @# Y - /*
# G$ m. _& Q* q6 ^; U5 } - * edma_test.c
6 M3 W! ~4 [. ~% m; g - *# p0 B/ \# L4 q
- * brief EDMA3 Test Application
2 D H1 m8 ]+ }3 f - *
; K; ]3 e6 d8 l! D$ B - * This file contains EDMA3 Test code.; N' n4 ]" V( w: @+ J
- *
, N6 }5 v9 ~" h7 h3 U6 ?% D/ y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- E7 K" z+ @+ l/ Q0 w3 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& l* s# K, y7 }/ S - * TO CHANGE.
3 h) g/ _8 [3 q2 \) b; l; `+ t6 n - *% a4 _2 k( A4 ]/ g. [1 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ L) m5 b( a* t$ s. l- ?
- *
* j) b4 f. B4 w- T* m - * This program is free software; you can redistribute it and/or
2 u. H- G, q; C4 M$ I - * modify it under the terms of the GNU General Public License as. I7 l0 \. Y8 W$ A; G2 z0 t( }
- * published by the Free Software Foundation version 2.: p, E# F4 {" `& o, B1 q7 ^0 x# k) p
- *" I N1 ~8 e/ { K* i( U( x7 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- k( f; I4 W9 m+ `& d4 `8 ] - * kind, whether express or implied; without even the implied warranty# E+ G3 h& d6 k4 B2 q9 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& M5 h( g6 `: \. Y, w - * GNU General Public License for more details.% d$ w/ V5 a# L7 N4 I z) Z( {
- */
- }/ \8 K: g2 N- Z
4 \( C3 \) }+ u- #include <linux/module.h>
: t- Y. s5 l4 Y4 d5 l6 ?3 D# R+ H8 S - #include <linux/init.h>% y& F* B7 J% c# B1 r
- #include <linux/errno.h>
5 t* E% S: _7 X! ~% k* Q - #include <linux/types.h>- z$ t$ U- U& @3 _ v
- #include <linux/interrupt.h>
' \ b0 P5 q# i8 d% b& e7 ~ - #include <asm/io.h>& m5 Q/ d$ d0 }* E- P1 ]
- #include <linux/moduleparam.h>
! P9 ~0 B! d2 Q' |0 W; y - #include <linux/sysctl.h>
6 W. k0 W/ q1 k( ? - #include <linux/mm.h>
6 J' B+ _! j* h' E3 T - #include <linux/dma-mapping.h>7 `5 _3 Z. [$ C) R( j
' V3 k7 M7 k. x+ B3 Q% _- #include <mach/memory.h>9 D2 M, S4 B6 b9 R1 r; M! j, w
- #include <mach/hardware.h>6 J" e9 S4 [" L6 \1 I/ @, B
- #include <mach/irqs.h>9 }' Q' v: G+ E d
- #include <asm/hardware/edma.h>
, p- p* l w5 a" W$ J; x* l; ^- T6 ~
5 [0 Q. E- Q+ ` H+ E8 V8 z+ c- #undef EDMA3_DEBUG
: j5 R5 [; ] i$ u/ i - /*#define EDMA3_DEBUG*/
* z4 N1 D, D) _8 V" z
5 P% Y* E$ y# i+ W* l- #ifdef EDMA3_DEBUG: N2 o2 g; J: K! {8 N: U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, B6 E0 |* M s9 S+ M9 C& S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ]6 V' B, ~; b4 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); H. ?8 z9 N' g P4 c$ n( F# _! G
- #else
: N% A) K% [( ?( {1 y3 E; m% o - #define DMA_PRINTK( x... )
% o: D* H+ h. k* X: V0 Z+ e - #define DMA_FN_IN
+ d+ s0 j( G6 y - #define DMA_FN_OUT
2 o0 y+ |6 n# {6 S! J - #endif4 p, y) L4 {0 A: S
- ' S/ `- H- I( N! Y! J. K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ {. P# q. S2 q6 {6 w. `
- #define STATIC_SHIFT 3
9 p- H4 [9 ^9 q$ j - #define TCINTEN_SHIFT 20
0 G3 m9 q( E1 T0 w3 F0 @) S% } - #define ITCINTEN_SHIFT 21' l8 S1 b( C9 L$ ] U$ Z
- #define TCCHEN_SHIFT 22
* S: [8 K* ?; T' Q: T - #define ITCCHEN_SHIFT 23
8 J9 ?% D. {8 w/ _: E) `
% ]. A3 E- D8 {) j- static volatile int irqraised1 = 0;
$ z7 T: B5 I7 L% S6 L - static volatile int irqraised2 = 0;& f8 t5 X! z3 C( a* T* o
- & X) F* J, L) ]3 m7 D) T2 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) t/ F: w0 ]+ N. p& r" _, @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# [. I: }1 ^3 V. H" h* O/ ] S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A3 u& i( J8 S1 g
- # r' |! [9 ^9 D5 y: r/ U) g
- dma_addr_t dmaphyssrc1 = 0;3 d9 o5 f4 q. w9 w* y o
- dma_addr_t dmaphyssrc2 = 0; ]- Y d; b/ E P* i; G
- dma_addr_t dmaphysdest1 = 0;
# k# j r- `$ ]+ O: q - dma_addr_t dmaphysdest2 = 0;9 S8 x2 y; s" v
0 k% W( A- _' k6 z- char *dmabufsrc1 = NULL;
& n* s+ Q r: r1 L/ [ - char *dmabufsrc2 = NULL;3 |6 i9 G6 h: K0 |: @, S" Z3 {
- char *dmabufdest1 = NULL;) B' p, a9 X) D( } r" I. z C
- char *dmabufdest2 = NULL;
7 p* X6 c: p- W& j - " R) F9 s9 j! c. M/ }! A! H
- static int acnt = 512;
- N+ [* q8 H- U5 K! w - static int bcnt = 8;# l. h7 P* \" G, ^: i, {
- static int ccnt = 8;# K* g8 Y; A" Y, |1 M3 q& {! ?$ R
- , \( L3 _: \- @5 J/ H
- module_param(acnt, int, S_IRUGO);/ G4 ^2 Z: u b4 {) d) ]
- module_param(bcnt, int, S_IRUGO);
* S" k- F+ o! s$ q - module_param(ccnt, int, S_IRUGO);
复制代码
$ |7 ^( S. X+ k1 F3 z/ O0 P1 | g' z8 i" H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! ?& i% k& l% S7 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ^+ M- U6 U6 W" R' k1 a* R% O. ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 Z7 h. @/ @. F3 I R( p3 t( s
/ @" T8 |& F5 L$ ?" G: K7 [7 d$ p/ F7 ]! W7 p9 P
|
|