|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 ?, S- _- f4 L* b) V @" x
- [code]EDMA sample test application
8 w4 q c2 g4 t% w; S - /*
e& d- s& G: y2 o - * edma_test.c4 f: ]* p. O$ ^ ~7 C/ z
- *- O0 A r# o/ ?6 p
- * brief EDMA3 Test Application
( b; ~6 p: r: p# X1 b - *
8 r9 c+ { P7 G& X - * This file contains EDMA3 Test code.4 }: S1 Y( x& J' F' w
- *
3 H! ]" ]6 _7 {% X3 c4 R/ j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' H; ^0 [; _) v: W" h. D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 O- |1 O8 y) o) v' w4 r5 z
- * TO CHANGE.
1 V+ ]" I4 v9 f9 Z' C! a - *9 ~, S- \5 j! c ^- F5 a; w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# ` ?8 j1 w5 k: X/ a1 K% Z1 c' V - *
( R' q* N2 s+ a( ^$ d1 A; q' R1 N - * This program is free software; you can redistribute it and/or
; l9 \" O# Q* l! n- M6 Q - * modify it under the terms of the GNU General Public License as3 S7 u3 u, L$ a- q( I- F# O E
- * published by the Free Software Foundation version 2.
" m8 E# [8 A/ n4 w4 k9 C/ ^ - *
4 A: l1 o$ K) |- q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 {, h+ P( F& a, i. ]4 m0 p5 `- K - * kind, whether express or implied; without even the implied warranty& m- }: H4 Q8 r3 u. F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. C% F' w- R* w! T c- s) Y
- * GNU General Public License for more details.
; k* K5 ]! X9 O2 v5 p. W - */$ r( E% e+ m7 _( a8 X& d, S! V
- 7 R! K: ]) Q- K& K y
- #include <linux/module.h>
G3 W& e& e+ T4 D. F - #include <linux/init.h>
6 F' c6 \5 g# y$ t4 Q+ u w - #include <linux/errno.h>) O E1 ^3 j9 V* Y H+ }
- #include <linux/types.h>0 a9 o8 B' Y* \5 Y3 y. h- z, P( h
- #include <linux/interrupt.h>
$ c$ M8 y& p4 d - #include <asm/io.h> r# w. f/ g! g4 S( P/ U
- #include <linux/moduleparam.h>
) r4 C6 ?3 N6 u' |* z. J - #include <linux/sysctl.h>
2 s+ R' H1 h, J" E4 S" I T - #include <linux/mm.h>$ o5 y# A9 v1 K7 d2 W8 y; O) t
- #include <linux/dma-mapping.h>' C" j" D' `& t, q5 v# k3 I' |
5 j( k; w8 ^! h" P- #include <mach/memory.h># E E/ T* u: c
- #include <mach/hardware.h>4 s! f7 F, \& n4 U" |1 L5 C
- #include <mach/irqs.h>: i0 R9 k) E( [: M# \; [# R
- #include <asm/hardware/edma.h>7 \. v$ i* z+ t
- / n# E/ h# X& v1 h5 J
- #undef EDMA3_DEBUG4 P# f( Q* S# C5 p
- /*#define EDMA3_DEBUG*/6 ?1 V6 ^8 l2 M% s; F& `" v( @( Q
- ! i8 a; J1 G6 G2 g& u" R4 A
- #ifdef EDMA3_DEBUG9 u2 `& r! g/ P- J$ _- u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! l/ U3 `, E4 G; ]6 D( Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( M" L* Q5 q) s) ^ H6 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. F/ z# Z5 }2 A! d - #else
3 t1 n2 f* ]4 U5 ?! M - #define DMA_PRINTK( x... )
. g; e2 H0 d# K* o9 x' s - #define DMA_FN_IN, o2 Q0 s) A, ~% x, x3 E! W" ~
- #define DMA_FN_OUT' X& \. l& G( D% i( J
- #endif' g3 s/ O3 @) [; r3 m2 U
- 6 o# F# {% H; w/ P6 D0 [* Z$ Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 E$ _( j( o( c$ M
- #define STATIC_SHIFT 3/ e0 B) W9 d8 C% y+ p0 n$ r) K5 n
- #define TCINTEN_SHIFT 20
0 X7 C& Q% l5 U$ U$ M - #define ITCINTEN_SHIFT 210 N- X/ U( a; g
- #define TCCHEN_SHIFT 22
( p, A# ?* Q' z& a* p - #define ITCCHEN_SHIFT 23
" q* }; P- n: t5 i# z% Y0 _ - y" Y+ N$ d" T6 ^. {5 ~9 h
- static volatile int irqraised1 = 0;0 q# Q" ~* h; Y
- static volatile int irqraised2 = 0;
4 z( n: v3 | |+ C# ]; |
- v- `1 n5 N F* ?4 _7 A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 d8 k) d3 F7 J7 \: @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ~2 Y6 `- L# c. k! u3 ~+ l0 X/ z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ H8 S$ S& g" n5 w8 g' Q w" J! u5 @ - % ]! g& R$ ]% H- k( Q. X
- dma_addr_t dmaphyssrc1 = 0;
9 y/ F& E# `3 y; e5 T. W- n - dma_addr_t dmaphyssrc2 = 0;) d5 V7 @* B1 m1 ^
- dma_addr_t dmaphysdest1 = 0;# q0 o& b! m v3 [/ i
- dma_addr_t dmaphysdest2 = 0;$ M. c" T! |# q! l$ E" F- Q
- 2 y# m! K9 ?* V, Z# R
- char *dmabufsrc1 = NULL;
+ S% z4 l0 `+ l/ Q9 Q* ] - char *dmabufsrc2 = NULL;
+ l8 o( Y. V! Y6 O7 F4 g - char *dmabufdest1 = NULL;
- w9 k, D8 f) v' L3 D a$ H ^ - char *dmabufdest2 = NULL;
; A8 ]3 I# c. f1 j% ] - # o" N% Q8 J% B/ u
- static int acnt = 512;9 A& y0 V4 c- S: b( J
- static int bcnt = 8;
& ~* C d. m; H$ B3 o+ ^7 g - static int ccnt = 8;8 A8 E# S0 x7 F1 r
! S% m9 y8 |; n% V" V2 t4 u8 b- module_param(acnt, int, S_IRUGO);$ C. }- j2 l7 b
- module_param(bcnt, int, S_IRUGO);
" A- Z8 u% w) }. ?" j - module_param(ccnt, int, S_IRUGO);
复制代码
E' @% c$ {/ |5 k0 i6 D$ _$ k6 ]3 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: d" m9 |; t% w2 a& ? Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 \) ~/ K* M+ w) z4 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i; E3 Q' ]7 O8 b, w* Z. s7 u9 i' t4 e
! {+ R% V5 U, ?) R9 e4 S- ? |
|