|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % @' l' g: f+ Y* K) e
- [code]EDMA sample test application
* \# J) |9 y! D+ }& d, K - /*
" }. M3 ~! d0 n% N3 c6 s4 D - * edma_test.c
. g. i- f' }, j3 Y - *# S- s. h6 E, v! g- C3 b
- * brief EDMA3 Test Application
2 a& s4 V2 C7 N/ { - *' t# s) b9 C1 d; m! z, M
- * This file contains EDMA3 Test code.. t# t# ?& z. m6 @
- * j) w* Q, \2 [, E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- A1 r" U% H: v' G x6 r- c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! D) s0 \# N6 r/ p& j2 D! J9 U
- * TO CHANGE.0 }3 y1 W1 `/ T4 v
- *- P: `4 F3 q* {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 C& ^: j4 |4 [% F" g" l( X
- *
+ p8 t A- t8 m. s o" ~3 w' _3 s; u - * This program is free software; you can redistribute it and/or
' C- O5 |3 R6 ?4 P/ P# M - * modify it under the terms of the GNU General Public License as, m m, c: O$ k
- * published by the Free Software Foundation version 2.
5 K- L' n1 ]: R) Q - *: X2 k& W) u" a3 \# k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 }( |9 w8 u8 H( \ - * kind, whether express or implied; without even the implied warranty& i% H% ~* ~" r8 Q( d' B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" P0 G- N3 A0 S' f# K - * GNU General Public License for more details.
7 }5 p# D9 p' Y( q# J6 ^ - */, M# W# @$ y/ a7 {
- 4 C0 e$ m; J8 w k9 ?/ |4 _: N
- #include <linux/module.h>2 z# }7 A9 _0 r: q3 K1 D$ J" ?3 @
- #include <linux/init.h>$ J! x. p/ K) o. O( }- v' e
- #include <linux/errno.h>
% t) d+ y. X3 q" w' L - #include <linux/types.h>
7 W5 B* S u5 R! Y7 d# J - #include <linux/interrupt.h>" h) S, t6 R5 p, }: L* z$ \8 [
- #include <asm/io.h>
: x! p8 H' B0 k u - #include <linux/moduleparam.h>7 t. J+ v1 V" t5 n$ C
- #include <linux/sysctl.h>9 r/ N) z: e: ~; F5 g5 G
- #include <linux/mm.h>6 e9 ^% Q/ }- q$ j
- #include <linux/dma-mapping.h>2 b9 ]4 Q7 a6 y- G* u* g
* u4 `% u3 V! V7 W& [- #include <mach/memory.h>. r& F" I5 G* [" d% V3 A
- #include <mach/hardware.h>
( k! I% P4 h6 i/ \& s% d P - #include <mach/irqs.h> `" B: \1 p! X5 u
- #include <asm/hardware/edma.h>0 t0 d1 e9 R( \- R" t+ Z: h
- * s# E) G5 v! K0 k
- #undef EDMA3_DEBUG) F7 C' v7 S2 y! O
- /*#define EDMA3_DEBUG*/
, e9 q% m- L* D, p
! r& {( a, ?* X1 ~: `. o- #ifdef EDMA3_DEBUG7 Y( c) H g& l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 e: `" o7 B2 ^) T1 n1 H' u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 a& ^+ N& w$ t: C$ }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- e& `1 C) x$ F/ p# O
- #else
$ J' M9 t+ ^5 d b4 A% n7 l: g) O - #define DMA_PRINTK( x... )
( f. ^5 r& a; g. P - #define DMA_FN_IN
& S+ d- s3 W I5 T& e4 a8 I - #define DMA_FN_OUT
' v" v* D8 x( f: g$ A8 j( Q* a - #endif$ ~0 o1 S* m2 ?
& {+ }5 ]9 ~% V4 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ i0 K$ Z8 F. \ - #define STATIC_SHIFT 3" D: x" H9 B! |1 l _ w
- #define TCINTEN_SHIFT 20- c2 P U, u" W0 `! H
- #define ITCINTEN_SHIFT 21- ?$ V+ J1 n# S2 C. Z1 O
- #define TCCHEN_SHIFT 22& y n6 h! y- s& C3 a9 c( K: h/ h
- #define ITCCHEN_SHIFT 23
# ~8 o4 @+ g& Q+ N9 f5 O
: K. S" ?% d( J0 ?5 D- static volatile int irqraised1 = 0;
2 B- d) P1 V; Q/ _; a# p - static volatile int irqraised2 = 0;' A, G2 @) L; O6 y$ f. b. I: u/ p
- * k1 B; _7 S" X2 q+ F7 u u0 p- J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! H" S: Q/ J2 d2 C$ n$ R7 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
^% i; u2 [% B/ z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; V9 ~% f5 B' g+ L/ D
8 _( b# T! c# N- dma_addr_t dmaphyssrc1 = 0;$ o% O* @! U; F: J
- dma_addr_t dmaphyssrc2 = 0;: l! i1 o7 ^. a' }5 G) I
- dma_addr_t dmaphysdest1 = 0;, t* ]8 x3 @: J
- dma_addr_t dmaphysdest2 = 0;% X: N- J1 ~: c# T2 d4 @
- . A' ?- G5 W( C" B% D0 h2 ^
- char *dmabufsrc1 = NULL;
& x$ ~. l. G5 n' _+ D; j1 h - char *dmabufsrc2 = NULL;
/ ]7 ~4 }# F% O% x2 F0 Z - char *dmabufdest1 = NULL;' A" T) f$ o1 _/ A% B
- char *dmabufdest2 = NULL;+ w. B; B2 V4 d# C$ b2 M
; V- Y% ?. m' ~7 \, f1 k- static int acnt = 512;
# h. R: a4 h% A' a1 L - static int bcnt = 8;) U/ {: l5 ]$ b, b8 Y/ h
- static int ccnt = 8;
9 H0 Y: ~, z/ n* Q9 ~; m4 w" J) \/ E - ; \* s5 {, P% g) o* ^6 ~
- module_param(acnt, int, S_IRUGO);, }3 j/ p; @" D
- module_param(bcnt, int, S_IRUGO);9 S: Q' ~) c! A% {2 \ E/ h6 {
- module_param(ccnt, int, S_IRUGO);
复制代码 3 V4 L* V: B3 b1 M4 o+ Q% }2 z
4 p1 J4 h* g$ y' D/ S2 Q6 c6 h) C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' @# a% j% @" u( O- |% V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 `' g, j- F' e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 L: E/ x* z, P
5 d8 d. V: U( F/ o( M# R* s3 c/ W' y5 ]; H: G
|
|