|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& }$ T4 F8 Y* U- [code]EDMA sample test application
0 S) Y2 H. T7 t' m( J( ` G/ p - /*$ O3 Q5 J' ]: l* C4 {4 R3 q4 M
- * edma_test.c: w P8 s: _# {, M
- *
' B: p) M2 f2 y6 \% i - * brief EDMA3 Test Application
D+ S, ? t. X) B5 R G7 A - *- p I8 N, |5 c. P' _" j1 N
- * This file contains EDMA3 Test code.# e$ q+ C1 j9 {$ w1 F( {2 ]
- *
; Q" R- I5 i) i3 j8 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 j; ?" L' M6 ]1 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; B0 B+ V& c( Y9 X) V6 S8 }' G - * TO CHANGE.) p2 H& X$ E8 _7 O
- *
" n& J1 E2 u, ~; D) e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) d2 z0 i( N# D; I/ ? - *! F5 ^0 y. D. L" \2 b4 ?
- * This program is free software; you can redistribute it and/or
, H% p6 }, \: a9 K. [ - * modify it under the terms of the GNU General Public License as
8 F1 i7 m! _# y! _ - * published by the Free Software Foundation version 2.7 `; n3 l) I! C7 p- u5 {7 D7 X
- *' G* v6 R1 ?6 l% l0 p% y' e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 Z/ X" ^6 |8 O" n; ^5 L - * kind, whether express or implied; without even the implied warranty) s8 G1 b) w7 j6 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 U, N, H8 g. c. ^/ I1 Y
- * GNU General Public License for more details.
: Y. m a" H4 b0 i - */1 b: \1 {) b3 H8 i0 u" T5 ~; J
- ' `+ X2 I ^4 w3 F3 |
- #include <linux/module.h> a% o! }* n* \7 s
- #include <linux/init.h>9 |8 M4 {3 |! }
- #include <linux/errno.h>
& K& I7 L H- d. h - #include <linux/types.h>, }3 n: r3 V3 `! w T' H2 Q
- #include <linux/interrupt.h>1 `, t4 |. }4 ^: i
- #include <asm/io.h>1 \" Z8 u4 s" J/ M3 I, o
- #include <linux/moduleparam.h>; w: T* J8 s9 z# p
- #include <linux/sysctl.h>
* Q5 [% T- ]% N7 e) N" @ - #include <linux/mm.h>
* R5 D9 C* Q2 Y5 a* ?, Q# a: B - #include <linux/dma-mapping.h>
% n0 G& T a! W - 8 C. ~" D$ p: Q/ Z* g
- #include <mach/memory.h>
" ~+ F8 c+ u. l: d% I - #include <mach/hardware.h>
3 f/ H3 s/ t" {3 h - #include <mach/irqs.h>. i2 R" U: @0 | |' q0 \# C
- #include <asm/hardware/edma.h>
6 i% Q p% O; l5 d
/ z1 H( x. P& }7 J; ^0 @- #undef EDMA3_DEBUG5 [+ C1 b& z8 {; @$ c8 ^
- /*#define EDMA3_DEBUG*/
0 F) S6 K: q# D$ W; l
' w' g% n! w: l8 n0 f/ p+ v- #ifdef EDMA3_DEBUG
3 { M' P- s" ~; g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( A% {4 r X- L( r6 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 q' d9 }6 N4 k9 v5 {' X9 u* @: Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 h% s0 U1 Y6 ^! w6 c4 O. V) \ - #else: X# f" s( d. k" [
- #define DMA_PRINTK( x... )$ z, O! H' ^$ _( x0 j. i
- #define DMA_FN_IN
& O: O& W' t" \* f$ m8 {3 p* ? - #define DMA_FN_OUT
: }# H2 g6 `' b7 g# g8 D. ~ - #endif3 g) G z4 ^- \; u
/ |2 p: [- t8 a# p$ p! J( q- Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; }2 L% l$ F# i2 ?$ {: J2 K3 G9 i - #define STATIC_SHIFT 39 E$ v9 R# K$ }6 C x
- #define TCINTEN_SHIFT 20
& l5 B" P ]0 T' R0 _0 a/ s - #define ITCINTEN_SHIFT 218 `3 d9 a/ a7 n; Z
- #define TCCHEN_SHIFT 22
! |2 B& e/ U; a: X+ T - #define ITCCHEN_SHIFT 236 i7 j* S0 O5 S0 [) m# ~9 C
- 4 Q! y5 S! K0 Y6 |" C! i0 K
- static volatile int irqraised1 = 0;
* P: n% E9 n% C: u9 v" @ - static volatile int irqraised2 = 0;- @6 ]4 e# S* @/ |7 \5 \
- 3 |" O6 a) Z- m' B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' [- \* L M) z9 c4 }# Q; ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 @" C, I5 O$ m) W ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M% g( a% N( n) ~0 \
/ h6 D$ k: M8 K7 L. W m7 v% y# h- dma_addr_t dmaphyssrc1 = 0;
" k: ~" b1 }( n! e3 R2 b: p - dma_addr_t dmaphyssrc2 = 0;9 F9 @, T- T x- x
- dma_addr_t dmaphysdest1 = 0;6 E0 ]4 U) v4 y
- dma_addr_t dmaphysdest2 = 0;* N- s6 ]! B9 N: f; }
6 i+ E+ K6 {3 O% ?, i- char *dmabufsrc1 = NULL;" }7 Q. ]1 {1 q) G8 n2 q7 T6 e4 i
- char *dmabufsrc2 = NULL;
" W( j1 G1 E( L8 e4 e - char *dmabufdest1 = NULL;1 D& O4 r3 Y$ j" f
- char *dmabufdest2 = NULL;
& k. m: v$ p. T9 I
: ~1 U* T) n+ B% e- static int acnt = 512;9 ]- V% F! y& M6 j; C. @
- static int bcnt = 8;
c+ d! t- X, C* D9 R% `/ X - static int ccnt = 8;/ H0 U+ y9 C) f4 |/ A+ B
- . D: P* w& k0 _; V
- module_param(acnt, int, S_IRUGO);
( R6 L0 n3 g/ [, j' J - module_param(bcnt, int, S_IRUGO);
& U7 z6 h3 X. \5 U7 U. u9 o! u - module_param(ccnt, int, S_IRUGO);
复制代码
) n, R/ u2 s: t" E; J# S
" X% {8 p# J0 u) N* w/ m) l9 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; \1 S. h7 q; j/ K2 x; V2 C$ Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& _2 O( {& V3 o3 S: o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. X+ X6 ^) A$ d9 b1 z
! ^$ u8 |6 _: W/ E J- n& {3 f, W @0 v7 _
|
|