|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d, X8 i; ?. _5 H9 W& L2 t- [code]EDMA sample test application
) N! s& W5 e4 S; a5 \) {+ r - /*/ z) p' G1 Y1 n/ ~3 s P2 f
- * edma_test.c4 W" D' G8 c6 V" [. i3 k7 J
- *
6 H! `' U) h4 D - * brief EDMA3 Test Application
# e( p( `; z+ R' W - *
" X( d6 p& e& k# L' X* R - * This file contains EDMA3 Test code.' S1 _3 V/ s. Y4 A/ u! `2 ~4 `
- *8 j8 k+ {+ u Y$ w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& A( B, h, v: a( q, `4 F. c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. V( T [( p# p6 Q1 D
- * TO CHANGE.! ?* r2 L& d/ f. }
- *
% z$ Y* }; {5 ~. D0 `# O' }: } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 W; [9 v, {( V. a# \ - *) s: X) \5 Z) u2 d9 {) R
- * This program is free software; you can redistribute it and/or
. c" d5 Y& o& ?/ O9 j+ s; ? - * modify it under the terms of the GNU General Public License as
4 g9 @# Q# M$ n% b" A - * published by the Free Software Foundation version 2.
v( Q! I2 F" E - *
9 j0 X! F. k; V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 q# N, B+ j# r/ ]" X# ` - * kind, whether express or implied; without even the implied warranty
0 [5 F% f1 \& J( B" s0 q4 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; S8 }* [- \: C& a6 F& R - * GNU General Public License for more details.! D4 J* ?& a( v8 Q+ u
- */, F$ q, l3 \1 k: `* e- m! t) d
5 a: a& E2 \, g7 K" n- #include <linux/module.h>, ?0 O+ ^! L) `3 X" X2 U$ t
- #include <linux/init.h>
' f# p' T6 r- Z9 w. N8 y - #include <linux/errno.h>5 d$ z6 s. v8 v% ]& ^
- #include <linux/types.h>
o/ S$ x8 G7 |4 z6 S# @) e3 ` - #include <linux/interrupt.h>/ b1 W9 j5 A7 t% o
- #include <asm/io.h>
* v" N7 z8 Q* H" N* s- s - #include <linux/moduleparam.h>7 n! @4 ~( ]; h0 [$ g2 I& z, q
- #include <linux/sysctl.h>
^. k7 y! X6 l1 f1 U1 S+ c( o" b - #include <linux/mm.h>
( D1 k# m7 @5 T0 e - #include <linux/dma-mapping.h>' E/ N v! y7 E3 t3 i! u
- 6 w) h" {5 U1 {$ E% S; ?3 J/ y
- #include <mach/memory.h>5 b2 g% u3 Z4 x! j8 @. C2 k
- #include <mach/hardware.h>& H5 ]2 p% B N+ ]+ e
- #include <mach/irqs.h>1 K# j! n$ Z+ P5 [( A4 U
- #include <asm/hardware/edma.h>
P( D. g' A' R8 [* ~ - 8 @ y J, j, {& L3 P- L
- #undef EDMA3_DEBUG# h1 ^$ c/ Z" m7 V
- /*#define EDMA3_DEBUG*/: F y2 x3 c) P: I, P$ `
- ( L2 `% ?$ z8 L7 i% b4 e
- #ifdef EDMA3_DEBUG
: S+ h' D' Y' T0 P) A% F, f' I8 p4 E' a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) b2 a" T7 u! P, c1 A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ l9 x( V4 K; F5 ?0 {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 O/ E- v+ A- S# P( a8 | - #else9 @+ t* ?7 @/ D6 E* H+ m
- #define DMA_PRINTK( x... )8 \2 N8 T6 C e: M( l7 W
- #define DMA_FN_IN9 d: m. j4 D+ w# ^' x
- #define DMA_FN_OUT
0 f' T$ e/ Z2 ?: i' j - #endif
: @- C8 Q) m6 E! g
6 }, W, ~& q, |4 E/ @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! `7 h/ Z& l7 L* N8 s - #define STATIC_SHIFT 3
6 ]: N3 o- y. F5 B7 Z& p6 L3 @ - #define TCINTEN_SHIFT 20
- G+ r3 T5 V9 g4 ~2 s" }& V - #define ITCINTEN_SHIFT 21
" x$ J: r+ q! d& D e2 j - #define TCCHEN_SHIFT 22. Q/ s& O5 y' j O2 v, m! Q
- #define ITCCHEN_SHIFT 23! A+ d4 k0 _% d/ L! U; p
5 C2 @; U; i$ }! S" C- static volatile int irqraised1 = 0;
) J; l4 `. V8 o1 N - static volatile int irqraised2 = 0;
! b* T1 E0 W3 k3 q0 u
6 D: D; P0 S" t3 s; S2 `3 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 V9 v5 B1 \# N L Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^3 a- z9 k- t0 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z; H! ^$ N1 O9 w; C
/ C$ q. @4 Z- \& m( S0 _" C [- dma_addr_t dmaphyssrc1 = 0;
' d% R( ^: W( q2 L4 `+ o - dma_addr_t dmaphyssrc2 = 0;
! A1 g/ }# s, R - dma_addr_t dmaphysdest1 = 0;0 A4 C. M! s( ^5 I
- dma_addr_t dmaphysdest2 = 0;& F$ o& n7 M3 j
- " H. U7 r/ ~4 z$ ?- j, h# d
- char *dmabufsrc1 = NULL; [& X. M G0 T9 Z& s5 o
- char *dmabufsrc2 = NULL;
$ t: e& B e7 a# h - char *dmabufdest1 = NULL;
$ p( r* `) ]9 p1 y8 v U - char *dmabufdest2 = NULL;
. b" N6 O; _7 e2 f" b4 p# M d - ; B9 J& J+ a3 x& e7 N( X
- static int acnt = 512;# a% i2 F3 S4 I- `
- static int bcnt = 8;1 |/ ^$ {( ]6 h: |8 n
- static int ccnt = 8;
" Z" G5 X" A3 o# Z2 q
* o4 n8 W3 ~" e0 x0 i- module_param(acnt, int, S_IRUGO);
# H4 w5 `* r9 T$ g/ S - module_param(bcnt, int, S_IRUGO);9 g1 j: o2 k+ b! X3 N
- module_param(ccnt, int, S_IRUGO);
复制代码 $ l! T2 L; v* u+ R
" M7 |) h: K; E6 \' G9 h+ |! [6 ~0 p8 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) _- w8 V5 K& Y; g' Q% S- P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: e+ N% l+ ^6 }4 V( V# L# I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) o( w+ y! @+ I
2 l9 I+ {% d: w) S7 e) ]1 R, U
/ v4 H* E: p U) N |
|