|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; W8 y$ u5 I- n# X8 a% u% e" f- [code]EDMA sample test application9 D" y9 y- d J; g! I% Y; K( P
- /*
2 |. t% C6 z( N7 M. X3 {, @ - * edma_test.c* g) z) i; ?3 R. I& @5 P
- *4 c+ Q5 C* k q; Z1 Z5 a3 G( D& A9 |
- * brief EDMA3 Test Application. {) E5 d; @& i% o v: \
- *% q& S1 @2 i+ a2 v
- * This file contains EDMA3 Test code.6 k# @* F5 ]6 m8 L7 G4 l
- *& S, C. T4 c( h8 X! W0 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. r' x' Z/ c+ u- k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* m3 X c3 y- o9 t( V# ~+ p - * TO CHANGE.
* M/ L. d: `9 p$ T' Y5 ^ - *
& W5 M! q! ~& R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! }& O, ^& v- a# H9 R6 L6 ? - *
/ ?5 f& z6 Z& m - * This program is free software; you can redistribute it and/or6 ^. B, Y- g q$ E
- * modify it under the terms of the GNU General Public License as
5 U9 N1 u# u4 c. X. k+ _6 O8 o5 H u! w - * published by the Free Software Foundation version 2.9 M0 w ]+ u1 }3 [7 [' @$ @' [+ j
- *4 i& d$ |' ~; l5 y8 A5 Z3 V+ Q) j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 U6 |6 b$ @2 v J5 P1 _+ Q
- * kind, whether express or implied; without even the implied warranty/ x3 c) X; n* v2 n4 L0 r2 W! ]5 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: ~% a2 l0 E% o3 K$ ^1 L; | - * GNU General Public License for more details.
4 X; J" C3 p3 S6 ~6 H* c: R6 F" v - */
4 l) f- D4 @ a0 q, e
+ h& I1 O' [$ D' S( _; F- #include <linux/module.h>
: P% q/ B. W6 k Y0 W - #include <linux/init.h>
$ G3 p& m9 {9 k$ z. u4 Y3 s K# ]: H I - #include <linux/errno.h>3 Q% s+ v/ C, i4 X/ }0 y
- #include <linux/types.h>1 q/ |8 X6 _/ `
- #include <linux/interrupt.h>
+ L& U1 |+ J% z& P U* X - #include <asm/io.h>
3 b$ x: T: H; q3 X$ J2 z- Z - #include <linux/moduleparam.h>3 s" V3 ?3 ` A3 A2 w d
- #include <linux/sysctl.h>
9 G9 t0 Q9 W' b! R - #include <linux/mm.h>7 w4 M9 `: G0 ~- G% W0 t* ?
- #include <linux/dma-mapping.h>1 o6 P) Q( ^2 J+ D+ a/ Q/ O! W7 w/ p
- . d* C. f, R4 S1 ?" V
- #include <mach/memory.h>
1 G# T9 a& y [ - #include <mach/hardware.h>
' y- p# ^2 w5 P& N+ K. V - #include <mach/irqs.h>
3 r2 [/ }5 H0 F3 Y, Q( x; f/ B. i - #include <asm/hardware/edma.h>
0 r/ \& B% ~2 r7 p4 w: c; t4 C - " Q$ P" P% O5 o2 ^& b
- #undef EDMA3_DEBUG( j9 {* `; S' v1 x! e O, |; t4 r6 e
- /*#define EDMA3_DEBUG*/0 k- P, @4 E# h7 a
- 9 e& f! G: \. n% H( Q- {6 q
- #ifdef EDMA3_DEBUG
5 F- j5 p0 p7 q* Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( w' a$ e7 e9 ^: C6 N7 j! u1 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, c" S5 X* k3 U* N" S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 w; T9 G* s' r p S H4 p - #else
7 @6 t% _' G/ n" K/ p t - #define DMA_PRINTK( x... )5 g: n% `3 z& e. X. b8 c3 g& A
- #define DMA_FN_IN
& G9 H: g. U% Q- k% b - #define DMA_FN_OUT
4 n' j2 Z8 z6 l% T- ]$ x8 [* P - #endif& t9 d7 N2 @0 L0 q) Z7 R% l
" N# W/ f- }% |5 m2 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768): u( `, l }" Q$ J' ^
- #define STATIC_SHIFT 3( H" H6 G6 g8 e( k: @$ y/ Z* h, I7 U
- #define TCINTEN_SHIFT 20
; L- c7 I+ T+ n - #define ITCINTEN_SHIFT 219 m- l' L# ?, P5 x, q0 M' f
- #define TCCHEN_SHIFT 22! s P4 G0 V# z _! S- |
- #define ITCCHEN_SHIFT 235 ]3 w* I1 w8 j3 Z- D- G
- 9 S- D$ K7 v: V' }+ v2 E
- static volatile int irqraised1 = 0;
/ \. ]' ~$ t) B$ x0 G f+ K! O - static volatile int irqraised2 = 0;1 V q- B/ m. `% {
. d4 ^5 g" O, `+ Q4 ^5 {* q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& A; E) T0 X4 T! ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 g. @' p1 Q- `! a4 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v1 C5 t& R- p7 E! R' D/ ~0 |% O5 ~
- / U; N1 B0 c. }
- dma_addr_t dmaphyssrc1 = 0;
7 _2 |0 v+ D- G" s - dma_addr_t dmaphyssrc2 = 0;. ~; Q1 e- N# Z) L7 @' L* J, q1 ^
- dma_addr_t dmaphysdest1 = 0;
/ x q# a. @% x6 ]4 X W - dma_addr_t dmaphysdest2 = 0;6 ^* E2 X% {8 U# f3 I) |4 ^
- ; R0 q& k7 w2 s! H% q8 X
- char *dmabufsrc1 = NULL;
/ a0 I+ T. c. p7 s. R - char *dmabufsrc2 = NULL;
# A; a* O. l. s: O - char *dmabufdest1 = NULL;1 k1 C3 |: G6 c0 U @5 c
- char *dmabufdest2 = NULL; h- D3 {9 q, E5 x! T4 {1 Z
- 7 I" E9 M1 J1 ~1 n; `2 Q1 Q2 ?
- static int acnt = 512;
, N/ ]) Z/ ^. q# m0 T - static int bcnt = 8;
9 X! a$ |/ S( ^, ?( Y# d - static int ccnt = 8;. Q0 Z5 Y- h7 ]" E; J: ^
- 3 u2 }8 m0 n) h& p0 ^) H
- module_param(acnt, int, S_IRUGO);5 h. f( A, k6 K. w
- module_param(bcnt, int, S_IRUGO);
- q/ K' J/ D- M - module_param(ccnt, int, S_IRUGO);
复制代码
+ j. c1 X6 R: i! Z4 u6 c/ X7 O6 e- R! |, G9 V" z( ?" @/ A9 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% k( [8 X( i' L- Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# r3 `6 ^/ F2 I+ [+ E. ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 j* X P. F. }$ h. f; M" e' K; i7 m" `6 X4 u2 R
2 U. Q% }' ~7 K! L( @ |
|