|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : c6 d# P# ~* B$ |
- [code]EDMA sample test application/ s3 g/ Z7 v6 l( Q5 C; f [, b6 f
- /*
4 a1 R, k+ H& Q" d+ N/ j' O - * edma_test.c
1 ?$ ?0 c8 M( z* x% W - *
8 k& p+ e$ n) X2 `3 X5 A - * brief EDMA3 Test Application& m, U, Y7 a! \& O. [8 l
- *
1 v! b6 H6 d D - * This file contains EDMA3 Test code.( S2 y# |: V2 P* ^0 a' e1 i2 M! H
- *& ~, T5 Y9 _/ b& o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 x. e0 R% V: Y. o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ E0 v" s1 E$ G2 Z
- * TO CHANGE.
5 p9 d, M$ }- W3 u - *
1 O" P0 C1 M5 c7 p1 x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 V; o+ S% s. {% a+ t; f
- *1 Q8 @! m% O5 y' u( D6 W
- * This program is free software; you can redistribute it and/or
; f2 \7 n7 b# y3 k% q {5 a% W - * modify it under the terms of the GNU General Public License as% ~9 e* Q* T3 R2 ~
- * published by the Free Software Foundation version 2." `9 a# G2 ?! @" v8 D
- *
$ G" X c. Y: Z7 {7 h) C F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- W7 a" ?. X1 {8 J2 N
- * kind, whether express or implied; without even the implied warranty
( I3 u- r$ S' Q0 _7 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' n2 z& w; S- }2 O# z - * GNU General Public License for more details.5 W( P8 C3 g- N
- */
& T' V: Y, f8 Q! A- @. e - 3 @, ]* f* i5 e; [2 n8 c
- #include <linux/module.h>7 n& N( l! Y& X2 p% z" W
- #include <linux/init.h>1 w4 \4 [# Y9 h$ M
- #include <linux/errno.h>, i, b" [( n$ ~- m. g
- #include <linux/types.h>6 @* z3 {1 y; r* }: J5 s7 g
- #include <linux/interrupt.h>
1 ]- G5 ]; M! L. d( h X - #include <asm/io.h>
. O5 s f" Q# h4 p- T# g z C ~ - #include <linux/moduleparam.h>
/ c; p1 O, C# |. E; T - #include <linux/sysctl.h>, _1 O' K* D; S5 i. L
- #include <linux/mm.h>7 g0 v- c9 o! \$ |. J# M
- #include <linux/dma-mapping.h>/ m7 ?% X1 i+ I d
- + x/ G L/ X5 N
- #include <mach/memory.h>6 @ V3 i; _2 ~1 n
- #include <mach/hardware.h>
7 X' a# p/ C/ N' m+ \- l2 F3 ? - #include <mach/irqs.h>
% X; {* |' j @) w - #include <asm/hardware/edma.h>
" t8 }/ T ?( `" ?9 @ - & Q. l0 \+ g: Q5 C V
- #undef EDMA3_DEBUG# e8 A; o) n1 J0 h
- /*#define EDMA3_DEBUG*/4 T; J% J& \1 @, Z J9 ~
- 4 [) L& f5 M& n% j+ F
- #ifdef EDMA3_DEBUG
, H' y" z+ V! h$ I( ?+ L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) H Q: k. m* H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ]( q: n( d+ `# ^4 Z' P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( D( r. r, F3 b5 r- [' ^
- #else
, h( q2 A( k3 t1 L) d- a - #define DMA_PRINTK( x... )1 M3 O7 T6 J9 {. \& y2 `) y$ W) @2 k
- #define DMA_FN_IN
1 \. L3 z9 D# q$ y5 z - #define DMA_FN_OUT
3 o( E$ ?" I/ M: E0 c - #endif
5 K& o" v# a8 ], C) `% ]5 H- | - ; D1 w- K7 Y3 o% v" z4 \ E2 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 m1 H: i# a2 c* k7 l - #define STATIC_SHIFT 3
# X! Z0 ^& z" C/ k" _9 l" n* i - #define TCINTEN_SHIFT 20/ E+ _2 Q/ F* `' d7 @7 j
- #define ITCINTEN_SHIFT 21
6 G( y" \2 P; y - #define TCCHEN_SHIFT 22
; J( p. G1 ], } t* E& C) O - #define ITCCHEN_SHIFT 231 y& T( B; x0 Y* {
- 5 ~7 M1 R7 b7 v" z1 I0 H' z, c
- static volatile int irqraised1 = 0;. G5 ?& ]0 ?9 Q3 B0 v6 U9 h6 ^
- static volatile int irqraised2 = 0;0 a8 x3 j6 a1 n) y, K6 c% }
- ) g& h( P2 a, ^- }( I# A& k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?; ?$ c" n4 Z2 @& C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 M5 a/ ^6 v4 x2 k# n/ S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q! V: R7 w5 D
- Q2 v7 }1 s4 D: w6 h
- dma_addr_t dmaphyssrc1 = 0;
& E* t. p+ F, Z: j! R& Y3 X - dma_addr_t dmaphyssrc2 = 0;+ n: ?# F( t! t% e7 n8 `3 j: z
- dma_addr_t dmaphysdest1 = 0; D {( U! _1 Z' k1 ~, \
- dma_addr_t dmaphysdest2 = 0;) O3 ~, k0 a+ o2 B# ^+ Z& i0 c+ b$ O5 Q
- + t: M! Z/ N- U. D b
- char *dmabufsrc1 = NULL;+ w& d$ D/ q3 W6 ?4 |% R4 l e
- char *dmabufsrc2 = NULL;+ P4 Z$ d* N: f) s3 s: X
- char *dmabufdest1 = NULL;/ |3 q" ^( l* X) ]4 i( A1 W# {% H
- char *dmabufdest2 = NULL;4 b' `* k& |5 F" V( p
6 w; G. [2 A9 T- static int acnt = 512;/ k- A5 ?. p( G" y$ `& z% |3 X
- static int bcnt = 8;# t8 i, X- C: w1 f9 X, e7 v
- static int ccnt = 8;
# r ~0 V8 v" |$ P - ; X$ ^ \% Z) q$ y" @
- module_param(acnt, int, S_IRUGO);$ {. l+ {9 W( I; k0 C
- module_param(bcnt, int, S_IRUGO);
& @6 Q3 D2 E4 m, t - module_param(ccnt, int, S_IRUGO);
复制代码 & ?+ K6 J# [* @: p* }7 @3 D
6 _ p3 E' z9 O$ @$ a! Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 b# N7 G n" m/ @# W. U: e
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 i2 G- K, a' y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; o+ m7 M: s* S
# ]7 h- t: ?, T, O3 K
4 @: u! V' I$ j7 l } |
|