|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 w8 e! A# \$ K
- [code]EDMA sample test application0 t @, a% S) H0 e. `% k
- /*
+ t' m1 Z/ u5 f9 @1 E: ^* T+ m7 y - * edma_test.c
; j3 I# B% d- j8 s: P - *
! C8 D! Q" y8 a* V0 z3 l - * brief EDMA3 Test Application( B% E" N: R) a9 o
- *; Z5 q$ |' A W
- * This file contains EDMA3 Test code.5 I8 F& Q7 ` E$ L
- *
$ t. d& K* a6 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; T. ~. |, T! s. `* m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& H2 x6 U: j1 u' c# a7 x
- * TO CHANGE.) E$ f7 v6 x; W. N
- *' W2 Y5 U U7 ?& _4 j/ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* v8 C k: t7 [* h9 K3 P: G& j - *
$ c* i6 y% M* R. G5 l- b3 Q) } - * This program is free software; you can redistribute it and/or
7 b. W+ i% }7 Y - * modify it under the terms of the GNU General Public License as2 E( n1 R# z5 O( L+ S0 v
- * published by the Free Software Foundation version 2.
1 d8 F. @# i2 s! H# L - *
. ~0 P% a4 j" Q8 t0 u+ C( o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 ]5 N4 w- S0 [& C. k) _ - * kind, whether express or implied; without even the implied warranty0 \$ l6 E( }/ q) r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 S$ O) p: X% Y7 t
- * GNU General Public License for more details.
+ g& q8 U& C: T# V% d6 x( p- Y - */
2 `9 a4 j, |9 R) D* s: q% o - + R" R& `9 U3 q9 ~
- #include <linux/module.h>& D; \* g& I$ z: S
- #include <linux/init.h>
' \* w2 n# \/ n9 o - #include <linux/errno.h>
, {! ? O# C/ ?8 E; [/ [ - #include <linux/types.h>
+ l2 \9 o* ~! C3 D E z - #include <linux/interrupt.h>
0 M8 t+ \1 z f- r% q - #include <asm/io.h>7 J2 W7 l8 m, y+ Z0 _8 O" B
- #include <linux/moduleparam.h>0 d) k* p. v! o9 `1 O9 S5 t
- #include <linux/sysctl.h>+ ^0 G. H$ s8 ~- I# N' u
- #include <linux/mm.h>, E1 I. X" v- M/ T6 S4 ?% ]
- #include <linux/dma-mapping.h>
) I5 H4 y+ d! g0 d* w - * x; ]0 |4 S8 m* d, {
- #include <mach/memory.h>8 K! A" ]9 W- L
- #include <mach/hardware.h>& n) O, [/ l$ m3 G# |6 q9 _7 x
- #include <mach/irqs.h>
, P* y9 e9 @9 w t5 a1 Y - #include <asm/hardware/edma.h>
, G0 D+ T; _4 z4 Z; @4 l2 S7 X0 Z
- e0 o6 F2 w1 c. G. M- #undef EDMA3_DEBUG) V. S% R( G: x. {" h' A. h
- /*#define EDMA3_DEBUG*/) s2 ]/ K5 |) Q; v: Y+ y4 N
- 8 q* ^0 _6 a5 E q( m( n$ X
- #ifdef EDMA3_DEBUG
% u9 S$ P7 [) x! _ i8 R R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' u3 }$ Y1 S8 U, _! |' c, V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( E3 M5 f* C0 Q+ Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 _1 a+ J9 ~+ ^" ^/ {) z; Q. l+ \
- #else+ f8 ^9 S3 T( I c
- #define DMA_PRINTK( x... )) w4 {) H# B7 i# Y
- #define DMA_FN_IN' O! [; n4 e# @5 \! y
- #define DMA_FN_OUT
e$ B3 E; E; O) q" A& m9 I% N: S - #endif
8 w4 z" O1 ]/ l+ b* S! ^ - 7 n" W; K j4 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 D# Q" A( a$ p$ z# k! j( X# O - #define STATIC_SHIFT 3
" o$ W& i6 h% ]% A' Q - #define TCINTEN_SHIFT 20 X! V; l) ]9 z$ J! {6 @
- #define ITCINTEN_SHIFT 21 t: a& i6 m$ R" ~% X! M _
- #define TCCHEN_SHIFT 22
" K( ]1 Y3 ]( m0 X: q - #define ITCCHEN_SHIFT 23
v% r% N- ^% ~% O - 3 A& L/ Q2 @: z5 F
- static volatile int irqraised1 = 0;$ Z/ x( A0 W: r# v
- static volatile int irqraised2 = 0;
/ [$ o: i1 c2 v9 f% A7 H
7 ^; M! Z& P N7 L5 l+ p1 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ?0 [8 f% h2 L( W1 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* K( H( V: R& Q+ o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& [9 c; X. i8 @. A1 b* v
6 t; _; o# @" L- dma_addr_t dmaphyssrc1 = 0;( @5 x$ j8 P( @: c; Q
- dma_addr_t dmaphyssrc2 = 0;
v- H K% [8 U3 ^1 S% ]1 a, r - dma_addr_t dmaphysdest1 = 0;
) q9 N( ]) K. Z3 @: p - dma_addr_t dmaphysdest2 = 0;" B+ H! X! ~8 J' V0 O
- ' @6 F8 M+ D& k% N4 [- _" K
- char *dmabufsrc1 = NULL;& ]( M6 h' n3 c1 Y0 }
- char *dmabufsrc2 = NULL;
6 Y* p6 Y: P$ z5 q# q0 F! t - char *dmabufdest1 = NULL;
( W% H! {$ r) l+ D4 W - char *dmabufdest2 = NULL;0 X" s0 e2 X! z
- . {0 @2 r( T2 c m
- static int acnt = 512;
4 O$ @8 J4 {$ S: [( ~, |& D - static int bcnt = 8;* w7 o( \; k) h# B0 h8 T
- static int ccnt = 8;8 B) @4 Z* r% R P
- # N0 W" |$ x5 Q! e) J- g
- module_param(acnt, int, S_IRUGO);: T$ j! R. w3 ] f. _- p6 F; l" h% G
- module_param(bcnt, int, S_IRUGO);$ M% ^+ I) q r
- module_param(ccnt, int, S_IRUGO);
复制代码 ' \# G, O4 b% y$ E! `+ u2 r( Z$ W
3 e) }9 m" V- h! t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! a7 @# v* d! r) Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 p. Y# F0 Q E3 a/ S) F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 f5 F% R: w9 i! ]1 d
' T; {, n: D8 ^: J' s Q: m7 D
# U$ p+ x4 Y6 |2 e6 x5 W0 k/ j |
|