|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U6 h; z9 t: g/ V
- [code]EDMA sample test application
/ p8 x: q; n4 f: T% w - /*
0 l9 x1 [% ^! Q2 R4 ?: f& A# K8 c - * edma_test.c
5 Z; I3 G! V3 n4 q- ^! c - *
# p6 @# s6 b; l2 s" p - * brief EDMA3 Test Application6 J9 m, h' ?5 w9 m/ n
- *
" t0 W0 w. k+ O: l( P: M& ^8 k6 a - * This file contains EDMA3 Test code.9 o6 z+ w* q# }* W' h% Z* _- n2 A& U
- *& k. A: \( Y* j* ]9 Q( m1 ~4 ~; k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ x5 a! a# V6 r# U: K) w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 E' d z) c* E- A2 }0 j/ s8 | - * TO CHANGE.
5 S6 u+ S2 ?: B) W, _ - *5 i2 w4 ? H/ R( z m' I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# }! ?# Z9 k! B$ e' S - *2 O) z7 {, H9 ]9 R" m
- * This program is free software; you can redistribute it and/or- S- k$ ?: E; a& J) y
- * modify it under the terms of the GNU General Public License as. {; G; n# D5 w+ i7 M
- * published by the Free Software Foundation version 2.5 g2 n- k( o( g1 R! V7 ]
- *
( Y5 m# p4 f) i4 _' x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- h+ M% A+ q6 s
- * kind, whether express or implied; without even the implied warranty1 j1 [6 U N6 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 h7 B7 ]) z, a: u6 Z5 S: ? - * GNU General Public License for more details.1 z/ m& y _" n( I c' ~
- */
; f/ i3 Y) W `0 s3 ~ - n" W8 W8 s8 p' N
- #include <linux/module.h>
8 V" F+ P9 q: Q2 b4 z& _! k+ r - #include <linux/init.h>
. t+ _+ {5 e' ~1 z - #include <linux/errno.h>' M5 F2 k& i8 ~' d z
- #include <linux/types.h>
. m$ ~( j5 V, o7 W, q# z# n4 a4 s - #include <linux/interrupt.h>
& v) {+ G% B5 \1 F# ]' D1 I - #include <asm/io.h>
" e' q! X! G6 X' _$ n6 d. N - #include <linux/moduleparam.h>3 T: I" U. h( V8 g: Y$ c
- #include <linux/sysctl.h>
# [/ a2 C" c T5 e& J - #include <linux/mm.h>
, f4 Q$ I9 x5 q+ e; E - #include <linux/dma-mapping.h>
9 f& j9 s& X& w8 W1 f
8 \' k" m9 r6 c/ P- #include <mach/memory.h>
Z5 c( l: F" c - #include <mach/hardware.h>
$ Z+ E' m N! v2 f4 m* R [ x - #include <mach/irqs.h>
5 p( m/ S+ T& M( J) I - #include <asm/hardware/edma.h>
5 }6 E+ ^% B' m% H, J, k- B
6 C C' p; v5 _2 a! {$ Z- #undef EDMA3_DEBUG
+ b# I5 u" u0 ] - /*#define EDMA3_DEBUG*/
. @* [( y) N" k. T* b - " O, I, H: b5 i( D1 D
- #ifdef EDMA3_DEBUG
) q% U, M8 K/ ?2 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- E' O8 F8 R/ N/ u& R5 M, A8 A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* m& g& E% k, _4 Y/ F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, w% \0 z: D& G: I7 s6 w - #else) q. m# y* h- Q
- #define DMA_PRINTK( x... )
6 U/ b- {% o# b# x - #define DMA_FN_IN0 W5 O, n: M, k5 q; y9 J
- #define DMA_FN_OUT
" X2 K, N5 ^" T q! z( r2 M - #endif- W5 I( G0 N- l4 E+ y% w: @
- ! o3 c* ?% d0 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' ^+ g3 c, p/ U; Y, o+ D
- #define STATIC_SHIFT 31 r, I9 G9 {7 E% m" Z. y3 y- L
- #define TCINTEN_SHIFT 200 k: \4 V$ F6 i* z% S, y, G7 Q/ |
- #define ITCINTEN_SHIFT 21/ q9 N( }. X# W# [" e$ ^
- #define TCCHEN_SHIFT 22
# c& x6 b. I; B - #define ITCCHEN_SHIFT 23
5 E0 `1 T: }' t: m; U3 p
9 O5 E6 K- V( O: j- static volatile int irqraised1 = 0;
1 x" u7 H9 Q: _: g9 [, w - static volatile int irqraised2 = 0;
; [6 r) P* Z& X2 }0 q
, v( c, r$ l3 {, N: Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 `2 s# b+ Q8 ~ A2 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 m7 j' f, K% t# i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E9 I# T) c9 W. H# ^5 `5 z
' F' \ q/ M4 O1 g: U; q- dma_addr_t dmaphyssrc1 = 0;9 u- C) l' a; A) V2 o
- dma_addr_t dmaphyssrc2 = 0;
: t3 n+ @% F: F8 b. e0 e - dma_addr_t dmaphysdest1 = 0;
$ \ w, g3 q! i& A; F - dma_addr_t dmaphysdest2 = 0;) N: a, U5 c9 }; T+ B% p
; e* I4 ~+ r, D$ Q# }# a5 }2 n: w- char *dmabufsrc1 = NULL;3 B! j3 u. g& X$ W. L" X! n8 \
- char *dmabufsrc2 = NULL;+ K( ~* x/ M! `$ f, b d0 }( t
- char *dmabufdest1 = NULL;
( y# F/ j) y0 D% X - char *dmabufdest2 = NULL;5 [3 |8 a% t$ u0 P7 v* X
- 2 z3 M4 |5 `6 M6 s7 X7 f' |
- static int acnt = 512;
3 K9 W) O; p; w! H# Y& Y - static int bcnt = 8;( ]1 V7 a. U: m% h
- static int ccnt = 8;
: N7 D8 r1 r8 g% G% e" D+ J - 7 l) v: x0 J9 Q& g) ]
- module_param(acnt, int, S_IRUGO);0 Z' |" {2 q) A
- module_param(bcnt, int, S_IRUGO);& G$ ~' Y X) b5 X( r
- module_param(ccnt, int, S_IRUGO);
复制代码
, Y4 Q O; `( P; A. Q' N. E. ^: O% H. v6 C; m b, F4 t2 b/ k$ N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ G( @9 {/ b# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 F9 C5 Q5 H2 F" m1 ~; b- w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 z; c- c4 R. Q q& S+ ]
9 x' s6 N: d2 l7 N+ h9 a; N* f/ {/ I; f) p! h+ J: t, s k
|
|