|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : N- C8 X( H+ b1 Y# o
- [code]EDMA sample test application( l! D6 ^8 J% @0 w2 V# x/ m& i$ ]
- /*4 \$ u( h0 G( K/ L8 b
- * edma_test.c
& u$ o. L" j h! q - */ _& ?+ O" M5 \: f
- * brief EDMA3 Test Application
" P7 L, }! `# p8 O1 w - *
$ e* X+ Z2 C4 G: d - * This file contains EDMA3 Test code.
* V2 y; z' a5 {2 `' k2 \$ i" Q6 [ - *2 R& f& s9 J; A5 \- f2 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 O/ t* P* {8 G) O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
x$ ~0 e2 t- ]) r' v - * TO CHANGE.
7 l& ? I1 N: I - *) W9 K6 F/ V) @( Y g$ l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; [% F) x7 L$ D
- *
& v; P* t+ K. Z& D( \1 P2 Z - * This program is free software; you can redistribute it and/or
1 o2 e+ k# |5 W - * modify it under the terms of the GNU General Public License as' Y( f: c. \) I% e( z4 p9 ?
- * published by the Free Software Foundation version 2.2 y! s) r0 ?* s$ g, q
- *
( a8 j$ {/ z0 |3 U6 B+ Z6 P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ B7 Y0 a# c V7 i - * kind, whether express or implied; without even the implied warranty
0 J7 A4 e+ g8 d( Z7 a( _, y# N2 |( l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 G4 P; _7 [7 j
- * GNU General Public License for more details.
3 Y* o% D: i* ?$ k: t# q7 x5 y# t( p - */
: n- }3 @: d9 ~0 k% s& @ y - * B6 E8 {# ]4 M+ }
- #include <linux/module.h>, t: R) y0 A1 e" K
- #include <linux/init.h>& z$ ?+ I6 T0 d _ O( o8 O
- #include <linux/errno.h>" _8 y4 I! m/ m5 m7 I. K* w/ {
- #include <linux/types.h>8 h/ G* p2 r( B
- #include <linux/interrupt.h>
. f3 n% |; q" W' Q7 [* p - #include <asm/io.h>
& |( Q, P* K F R4 \' }% I8 K/ q) c, j- v - #include <linux/moduleparam.h>
! ~- P8 h g6 G1 S1 g% V; W: R. _! P - #include <linux/sysctl.h>4 e# i2 B- E0 p- y, Q% I
- #include <linux/mm.h>3 w/ d+ N9 e% E t8 `& Z$ v5 Z
- #include <linux/dma-mapping.h>, F) f! s, q: _% h4 V, G
- 9 G7 F8 }( Z5 `' P
- #include <mach/memory.h>! Y1 M$ |. E( P
- #include <mach/hardware.h>4 w# B& Q# S& K, [8 i' M* U4 X
- #include <mach/irqs.h>5 R) z- D8 @5 g& P
- #include <asm/hardware/edma.h>
* y! O6 C8 ^; _, G5 M
& R& o1 l0 F5 X" p8 @- #undef EDMA3_DEBUG3 J. G# n$ [, b& T, P
- /*#define EDMA3_DEBUG*/9 z0 o2 Z5 }3 {3 k7 R# d; i
- 4 }, z( M+ A# b5 }+ g) M- |
- #ifdef EDMA3_DEBUG
5 g" D3 Y5 i! O+ y, c2 C% _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% e) _& B( k- m2 w8 x2 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- Y' N& j' i. }1 j( C; G; H7 v2 N$ e9 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) Y' n. n1 [: D! _% [ - #else
% m$ i5 @1 j) y9 D0 K% | - #define DMA_PRINTK( x... )7 r7 t3 Y! [! X" o) M5 Y
- #define DMA_FN_IN7 C# I) O0 v& @# B+ F9 X- s
- #define DMA_FN_OUT
7 s( K0 v' F4 }" ]/ ~4 n9 i% I - #endif5 @9 g# g; Y6 }5 y" X5 i
2 I1 h: k, s% P/ `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) N% `5 o x1 p( H" h- l
- #define STATIC_SHIFT 3
4 ^5 v- `" q+ d) G4 Y' m - #define TCINTEN_SHIFT 20
+ h( m! k2 y, U; I. I, g; d - #define ITCINTEN_SHIFT 21
0 T! b( ^ V& h - #define TCCHEN_SHIFT 22
( Q3 N1 n& D: z5 H2 p% c& Z - #define ITCCHEN_SHIFT 23$ d6 P0 m4 E; w. S9 }
- 6 R% r+ g- ~6 R& K
- static volatile int irqraised1 = 0;. Y! ?' Q2 Z( }' C
- static volatile int irqraised2 = 0;! a% b, k; N$ E4 K/ I1 o
- 1 h9 @2 \, W2 {) B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. R! [ e/ n! H1 \$ m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" h: @- p, |6 Z4 \% I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [; n% \* f! `1 s4 m
- ! N1 E: L" G: \+ |; R6 |; g
- dma_addr_t dmaphyssrc1 = 0;( K& M8 z! n% K$ r5 n0 W+ ^, h
- dma_addr_t dmaphyssrc2 = 0;
# p/ O p+ B5 ?9 \& b0 p: x - dma_addr_t dmaphysdest1 = 0;! A. P' X8 w) ` E! G8 ?" h0 g! R) T
- dma_addr_t dmaphysdest2 = 0;* I2 k" ?0 {% Y9 Q
4 Y: x q; {+ J6 n' ]2 |' f: k& z- char *dmabufsrc1 = NULL;9 O1 K0 w* x" @1 Y. V! H
- char *dmabufsrc2 = NULL;
$ G$ c0 I, g; r+ Y. B$ @ - char *dmabufdest1 = NULL;
7 o8 x. U* v1 S( p/ R - char *dmabufdest2 = NULL;3 D k- d" d& b6 A; c& W2 _
- : z3 S2 U. d4 t7 W/ `0 }
- static int acnt = 512;& l H6 Z: d+ p- f( M5 p7 }2 h
- static int bcnt = 8;, R9 d* b4 i a# Y: T
- static int ccnt = 8;( H0 J# a& J% V
1 x2 h, e" v4 a; Y, Z- module_param(acnt, int, S_IRUGO);
$ s8 D9 I4 p2 Q5 ?# X( Z) d - module_param(bcnt, int, S_IRUGO);3 E6 V+ ` u, r7 D5 S
- module_param(ccnt, int, S_IRUGO);
复制代码
: J9 y& C2 ~1 A) l+ D8 P, Y- J) F1 _8 U- |6 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 V) j, Q7 `: {! x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 X0 U5 M# n/ z1 ~. j! W0 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 O0 W" ~9 P2 @9 l3 u4 J$ J0 \1 T9 w% Q9 l B( f8 t
% E3 j7 X [: k) E$ {4 D8 G |
|