|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' z7 u" T! U7 q$ C; ^
- [code]EDMA sample test application
6 t" L( X. Z1 _. L, d - /*
! k: K/ v% V! |( s, ] - * edma_test.c" L8 F- T; @% L: {
- *$ @2 }9 S$ e; ^5 I' L5 ]+ r
- * brief EDMA3 Test Application; C" _6 G; L5 c
- * |" @! q. i1 D8 e- V2 m, E
- * This file contains EDMA3 Test code.* L8 a6 r1 v. q. c3 G3 [9 l
- *# Y0 z) l, M# C8 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% j/ v6 v9 B( x# i5 O9 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f8 S! M6 E. ^% |, e
- * TO CHANGE.- S7 D, D7 A) t
- *
, s9 R4 T0 w# d' X- A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) U1 f( q& G" `1 |% U( F: f* G9 { - *8 M8 d* A" H0 g1 f7 k2 c
- * This program is free software; you can redistribute it and/or
8 C" o1 m8 W- E n6 Q4 ~ - * modify it under the terms of the GNU General Public License as
) @! e) R2 A% b - * published by the Free Software Foundation version 2.. k9 P1 |, t4 l" P& V' J
- *; o+ w% c; k* |( _- u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 T( X% E3 x2 d - * kind, whether express or implied; without even the implied warranty
( F; w% `3 u2 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 s5 h! c6 A$ K6 u
- * GNU General Public License for more details.
" {: }, p* e3 B% g+ [ - */
/ O( y7 B8 B; e" F" E - : a3 V$ K9 }( \* P0 C# m/ ]
- #include <linux/module.h>
" M9 ]' ?. B) j1 I; r - #include <linux/init.h>
! L* S2 X4 u- s. @4 S* E8 f - #include <linux/errno.h>" F& M: F$ r h* ~# i# }, Q/ Z
- #include <linux/types.h>
% T' m+ p0 U- _1 n4 s0 q - #include <linux/interrupt.h>9 i2 j1 M7 z5 T6 Z3 r! h
- #include <asm/io.h>: c3 { X! [0 q9 J+ `9 J$ X+ R) w
- #include <linux/moduleparam.h># R/ H+ _; f! Y6 c8 B; ?1 D
- #include <linux/sysctl.h>3 s7 J6 G6 V$ N- z) U" z) J* u
- #include <linux/mm.h>% r& S6 T( T7 X5 B5 r$ B
- #include <linux/dma-mapping.h>
$ C7 f' L$ p0 C3 U+ h+ D
- b6 F2 M# ^4 @% n- #include <mach/memory.h>
, t1 p9 m# l |5 ]) ^- e* k0 Q/ B - #include <mach/hardware.h>
7 H7 ?, S3 D* X3 O - #include <mach/irqs.h>
2 O$ Z1 [2 p5 L% e, F2 {+ R - #include <asm/hardware/edma.h>
$ f0 {$ t8 ^% p* c1 Z& h
6 J2 ?" B' F& I4 B- #undef EDMA3_DEBUG
6 f+ w: ~+ t2 h& q; G0 F9 a1 c3 T - /*#define EDMA3_DEBUG*/( D/ S4 Z C' E) n
- 2 @/ F( D5 o- P
- #ifdef EDMA3_DEBUG3 i4 ^. [/ d' X( R9 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- u& H n2 Z0 `/ t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 f9 A7 V" ?$ }' G& ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). O! L& T1 e2 h% j- u& r. _, R
- #else
# p4 T& E; b& ?" f \ - #define DMA_PRINTK( x... ): A* M% w+ s& C, x
- #define DMA_FN_IN" z& k$ l+ N! Z( C
- #define DMA_FN_OUT2 a3 ^. Y0 W6 @9 Q( P' [# b
- #endif
4 d- m' R# }5 s; c) k
# H- c Z# H' t. D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ H7 x. _# b9 e6 M* F" |. e - #define STATIC_SHIFT 3; { M- Z/ [ W+ N; \
- #define TCINTEN_SHIFT 20
, q# j; C3 K9 {+ a - #define ITCINTEN_SHIFT 21
5 t; k# Q" o( Q- J# `6 ? - #define TCCHEN_SHIFT 221 G, C6 D( j* [
- #define ITCCHEN_SHIFT 23
& V( g; h( \ T+ K7 h - ) Q- ^/ e6 w* c
- static volatile int irqraised1 = 0;) l! W+ z. _) E W. \; t2 J4 G! F4 F
- static volatile int irqraised2 = 0;% z( [7 ~/ u9 b( M% O; ?) I3 \
1 B( W5 ~9 e& h0 I7 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E+ e/ F. h3 W# G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" i8 @7 X6 D n7 G& J. W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* t, s- q# V8 z* h
3 g* D# D, E0 u% H- dma_addr_t dmaphyssrc1 = 0;
# @, |' y1 t, _; ^$ _$ I - dma_addr_t dmaphyssrc2 = 0;/ u1 R& g ?1 H2 p6 N% j* t
- dma_addr_t dmaphysdest1 = 0;
% i# T" k$ K. {& l - dma_addr_t dmaphysdest2 = 0;& B8 `+ J/ P3 p7 A# f
- ' z6 P+ U; y1 Q3 Q0 ]5 V! V3 E
- char *dmabufsrc1 = NULL;& N: R2 L% L; ^; I
- char *dmabufsrc2 = NULL;5 f/ y7 `4 L% C+ P6 y
- char *dmabufdest1 = NULL;
3 w: W' A% S# |+ Y8 ] - char *dmabufdest2 = NULL;
4 \% ~% O+ S+ k3 u - 6 \$ N# m! l1 O6 s
- static int acnt = 512; I% t" A1 N) i$ x$ M5 ]( z
- static int bcnt = 8;
# v" f0 Z- ]) N. c5 J4 A+ J& g - static int ccnt = 8;
; \9 L0 [2 w( u. _. m" {
) @' x1 d5 N& c' A- module_param(acnt, int, S_IRUGO);
' Z% \1 O! P8 S - module_param(bcnt, int, S_IRUGO);+ R8 B' D, j; Q$ Q# J
- module_param(ccnt, int, S_IRUGO);
复制代码 3 R" v/ {' D, I
) D4 \8 i7 b) {9 v0 o; z( v) G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ~2 V: Z9 I' M7 f: W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 `. C% Z8 {" p. F! @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 H% g, b+ e. u# C
7 S9 x3 C4 |9 G/ i# {% I6 T
4 B& }( w- r; F- X |
|