|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / T5 C$ ~- H/ k. T
- [code]EDMA sample test application
' _" I& P8 C# r n5 O$ F/ b - /*
9 h$ [# E% B/ t- Y, Z - * edma_test.c% p+ X: k5 d2 k2 _4 H& p" j
- *. |# C# e5 I. f9 i) M) E
- * brief EDMA3 Test Application
: J! Y' {: ~( m8 n* o& o - *; t! p2 V- V% G5 N8 \; v" m
- * This file contains EDMA3 Test code.- F- k) Q8 N9 |. O3 a8 f, E
- *
+ R% X8 C: l) A8 F+ D9 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' s+ a" R3 {$ e' a; q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( m' @& C; G2 I; a: F5 f - * TO CHANGE.
5 `2 c! R6 p! C7 a$ m - *+ Q6 K6 y; A! _5 c2 |' F' M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ U3 C/ O% ?( \+ b2 R( U - *
) T3 P. o! j; F% {+ j2 E' i; J - * This program is free software; you can redistribute it and/or
) w/ {2 T0 K! k+ e4 x; M( y! z) X - * modify it under the terms of the GNU General Public License as: Y; ~8 b3 R' Q& }( z2 m, P
- * published by the Free Software Foundation version 2.% h( ?6 @3 h0 x j0 N! S6 }
- *
1 j0 v) a$ Y7 h/ s9 O8 @: ]' l5 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 T. R2 k& W4 k0 C( ^9 R" j) H9 x - * kind, whether express or implied; without even the implied warranty+ V) F; p6 S1 C' N7 s0 S m! m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 H5 I+ j+ b+ L7 w ^/ H4 }) b9 H - * GNU General Public License for more details.2 W" o) |7 m7 a5 L" v& t" m
- */$ J, f/ i# `6 I
5 S: A2 \$ A5 ^- ]* R9 H0 T5 X: `- #include <linux/module.h>
3 N% W* H% ^; e, o - #include <linux/init.h>% u6 I5 l3 g5 H
- #include <linux/errno.h>$ X- v" B1 `. I ?
- #include <linux/types.h>! u! Z3 r( m% l9 o: C
- #include <linux/interrupt.h>; g6 Q7 y# D+ L x1 G" I1 P
- #include <asm/io.h>3 t) N t! R; ]: H% Y
- #include <linux/moduleparam.h>
* n P0 q/ S- y s' _6 Q7 f - #include <linux/sysctl.h>2 b8 y; X# f5 e- C% r
- #include <linux/mm.h>
9 t0 v5 {4 B c3 u9 m - #include <linux/dma-mapping.h>+ F1 p! k' a; w8 L1 T# x
5 A! M+ S& f/ \$ d# s- #include <mach/memory.h>
( Y% L9 L: m7 j- T - #include <mach/hardware.h>
, x/ g, G- G# m# k - #include <mach/irqs.h>
. B! C( S. t( T" w3 | - #include <asm/hardware/edma.h>
^ R( _ C4 \6 i. g& c1 t
3 ~2 _; ]1 ~3 ?9 K- #undef EDMA3_DEBUG
" j D4 K$ l# R/ o5 U - /*#define EDMA3_DEBUG*/( H5 \" D: W$ t4 U. _: A
- ' N( s' e* o2 K, p
- #ifdef EDMA3_DEBUG
8 ?; v; [& P3 {! J/ x0 T* ]9 X7 Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# G! w- W2 N7 s' @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* A- g8 Z# ]5 R6 `0 M5 L0 I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 k5 u, G. e' b- o( i7 u
- #else2 d( J% L, u) }1 I$ j7 Y# d
- #define DMA_PRINTK( x... )
5 I$ y$ C( u+ z8 A& ]: s - #define DMA_FN_IN9 ]4 b( V |9 U4 o0 s* N' b6 h* @
- #define DMA_FN_OUT
! ~6 {; {6 _" q& q3 t$ n Z - #endif( N3 |0 \3 A) B3 s) c5 ^ `
- / A( F5 O2 g3 L& S5 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 F# B, H, S+ x4 ]2 v8 M/ _; x
- #define STATIC_SHIFT 3! N- ]0 K, p# E* Y$ s( v; z
- #define TCINTEN_SHIFT 20
4 Y2 N; h( U. o7 \ - #define ITCINTEN_SHIFT 21
8 O9 N" O' A6 V - #define TCCHEN_SHIFT 220 E2 d' A+ P0 c4 a
- #define ITCCHEN_SHIFT 23* L! z3 k( m I
- : Q) c+ v) c8 P* |! u
- static volatile int irqraised1 = 0;4 R. N: i7 @8 z! V+ \/ D5 G
- static volatile int irqraised2 = 0;
& p8 O4 m* Y, x% v Y
8 d- z: I/ `9 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ v) Y. F3 r" | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 B' A$ e6 `1 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 g7 E9 c$ n' }) W, e
0 s$ _. z0 M2 e$ z- dma_addr_t dmaphyssrc1 = 0;8 H5 g3 O, z O2 h9 U4 q/ Y% q/ T e" r p
- dma_addr_t dmaphyssrc2 = 0;
* O" h5 s7 X4 b. v - dma_addr_t dmaphysdest1 = 0;% U5 J+ J2 p b6 U, t. b2 A7 h
- dma_addr_t dmaphysdest2 = 0;4 {0 F+ w' y, T5 i1 j7 C/ {
1 m2 i* Z f# j' L- char *dmabufsrc1 = NULL;
3 q1 ~- U) v* _# a - char *dmabufsrc2 = NULL; p8 F8 ?+ D* u0 w: _4 y
- char *dmabufdest1 = NULL;
4 j' c( t6 R$ U- J - char *dmabufdest2 = NULL;
# N( t" @. W5 D }- I/ ^, R* `* R - 6 v) y; ?- V7 X) T! ^/ B
- static int acnt = 512;
- R: o1 ?; g! Z# t% t - static int bcnt = 8;
& Y1 f$ \ d* J4 W# l5 I8 I - static int ccnt = 8;# b# N& O- ?- L2 h' H: G2 m
- ( ?! e- @ j2 \/ Y) S
- module_param(acnt, int, S_IRUGO);, R# g8 ^. `$ X8 {9 v
- module_param(bcnt, int, S_IRUGO);3 F& `0 O- Z7 P5 Z9 z+ u# }
- module_param(ccnt, int, S_IRUGO);
复制代码 : n# L- e. S; \) `0 } n
# j- I! W- u. U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 x$ y" c6 `9 C# E5 g- t- m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 a( r. F' w" o% T1 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 d! t3 D8 s2 z) E5 h# K# i$ T2 \: M
6 x/ D, I2 e! W W& @
5 i- D$ t3 z' l/ T/ `3 D2 z, @3 D5 r
|
|