|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 i5 N% O( X+ ]( G. b! A: _2 D
- [code]EDMA sample test application
+ D2 ~6 o N U* J4 A - /*0 N/ b q# u0 e6 S" @% A/ o$ X a8 h# W
- * edma_test.c
: x0 ^8 Y1 w( j9 U, M" p- } - *8 j9 z r. p C9 j1 w' c3 S
- * brief EDMA3 Test Application5 F6 R4 W$ ^. l L
- *
& _. _1 W& j$ Z' i. ]; V0 m0 @ - * This file contains EDMA3 Test code.
3 ~" X! B% g; H8 R9 z" E) a - *
4 h. V- w0 f2 L8 F6 Y z. \) U3 F/ Q4 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 P2 g a* g& B4 ]. B0 ~# S# @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: F- w$ j1 @! k& s3 L8 R0 { - * TO CHANGE.4 J i0 j0 C! y
- *
$ n& N3 O- X8 P3 |) J9 y! o; P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 K7 N# k. M8 c - *% ^( q+ F; w+ a
- * This program is free software; you can redistribute it and/or% C+ r$ z S! k5 L
- * modify it under the terms of the GNU General Public License as: L5 Q5 y% E( w7 I+ G/ [ O8 H
- * published by the Free Software Foundation version 2.
5 o4 Y) X* l% G) w- H3 _. w3 |4 d - *7 p0 \1 l# V7 r# k: B9 I, Q7 j/ H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" G; s$ S# y- g% X7 b0 G, X
- * kind, whether express or implied; without even the implied warranty
1 |5 q; F* ]1 W- O) H5 E- _% ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# a6 D# [% K) S; d6 G
- * GNU General Public License for more details.
* H: Q6 W- U+ d4 \ - */# i, p3 W& j9 e
- & w& ^' x; E& Y. Q
- #include <linux/module.h>
7 k* c/ i) ~3 r, O( B! E; Q - #include <linux/init.h>! g& k- F( v2 [) n+ _; Y
- #include <linux/errno.h>! G, g. f5 J( j+ k$ n/ h
- #include <linux/types.h>
1 Y1 j' `! v/ T. K" A* c) ~: \ - #include <linux/interrupt.h>
/ C y/ Z2 O/ _( Q, k1 h8 P - #include <asm/io.h>
; t8 X) y/ F! z4 ^$ a" G - #include <linux/moduleparam.h>
. m& D+ \( i3 e. [3 r9 A. \, T5 g& F - #include <linux/sysctl.h>6 v0 V6 p3 P# F$ ]- z3 l Y5 d
- #include <linux/mm.h> U0 ^$ h" U, [
- #include <linux/dma-mapping.h>
" c5 Z5 O' {3 a" v5 H
# a5 S8 e1 } H; }* i. x; ?- #include <mach/memory.h>
3 X( e# u+ |! x0 [ A# w* x7 J - #include <mach/hardware.h>
- e. W% \, E* o) M; S2 P, ^$ p- ~ - #include <mach/irqs.h>' Q" T- Z/ E I' f
- #include <asm/hardware/edma.h>2 e7 r& g9 o9 x! N; ~
- ) b6 U7 ^8 `+ D$ C3 Q' [! l
- #undef EDMA3_DEBUG
, L6 l( e' B4 ?, H- q - /*#define EDMA3_DEBUG*/
* x7 {. j' g! Q6 U* e8 v9 X
. O- k# B, P0 \, X- #ifdef EDMA3_DEBUG
. O+ U, {. u; m! r. w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 @- {) }8 Y4 C- Z" ]1 f) f# t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) S I8 k; b' H! D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 s0 I5 o1 V4 J* e3 d7 V; a% I - #else7 G: F9 ?2 z7 G+ Y$ ~ j* w
- #define DMA_PRINTK( x... )# w! Q; A; b& v4 d# v$ d) m6 E
- #define DMA_FN_IN
! G& v, d; \; o# z" @ - #define DMA_FN_OUT: M Y9 \/ _; J: d
- #endif6 S4 Z* q. s; @( ` s
" u, X* \" w) n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 F0 ^5 [! t% H y) E" H$ x - #define STATIC_SHIFT 3, W! ^0 z+ k% V1 j+ h2 \9 u+ v1 {! q
- #define TCINTEN_SHIFT 202 S7 P5 p+ ]* m
- #define ITCINTEN_SHIFT 21
6 ^6 v) C) ]3 z4 }, o B - #define TCCHEN_SHIFT 22
' y V' c7 S& z& W& D5 E - #define ITCCHEN_SHIFT 23
5 i' U6 x+ A: h/ [. F ]3 Z9 G - 0 a2 ~; |/ o: ?# n! m
- static volatile int irqraised1 = 0;' v0 E7 V( L4 K1 v9 k* k2 l6 [8 {
- static volatile int irqraised2 = 0;$ [, N' y" Q4 S- g
3 g- v4 J. M3 d' c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. \0 T2 |& v2 z! W* d; D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 p" A0 C$ S: \. _7 @2 K# c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 J- F Z' a0 y r; a - 2 q6 a8 O. K4 t2 m3 B
- dma_addr_t dmaphyssrc1 = 0;7 L$ [- a E1 C' M
- dma_addr_t dmaphyssrc2 = 0;+ `' }' o' E/ A! `/ n
- dma_addr_t dmaphysdest1 = 0;6 I1 M" {& |2 l4 u0 t0 o% V
- dma_addr_t dmaphysdest2 = 0;
) ^$ {' ?5 {' ?! Y; Y - ( `6 O! ?- W4 g: S* A" Q4 w# m. h
- char *dmabufsrc1 = NULL;
- [) S3 E1 V2 u* r - char *dmabufsrc2 = NULL;, W5 @8 D7 h2 C3 r& A) V& J
- char *dmabufdest1 = NULL;
" R# [0 G8 A9 j$ [2 x; X - char *dmabufdest2 = NULL;
2 d! x1 ?; i8 o: W
- X/ ~- H1 e" }- static int acnt = 512;
& @3 }- b" ]/ {! z - static int bcnt = 8;
! d: O$ r! ]! b) q4 _7 ~. P5 h6 _& V# ^ - static int ccnt = 8;
# `, N* q6 c* | - " Y- | U3 v& E# v$ d: P% J
- module_param(acnt, int, S_IRUGO);( H# G' }. g' p! c
- module_param(bcnt, int, S_IRUGO);
6 W1 R& S/ J! Y5 I0 W" ?$ t: T1 K' y - module_param(ccnt, int, S_IRUGO);
复制代码 " o$ G' B+ g' a
% i& y. C* l* }- g# i& D% O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ e2 q) e; P6 N" R! k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ^) u5 R: s$ l" W; N, `. w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 {3 h. j( e& @( F( `4 |! T
' }' q( k9 Y3 T. M7 N: K
7 G6 ~. q W2 c) w4 ~1 D, w |
|