|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 F5 y. g" v0 C! X' x
- [code]EDMA sample test application" P( J7 K. w! s1 h
- /*
/ Q; F: i% |3 V7 s, k0 Q0 _. ~ - * edma_test.c
" s3 p& B( T0 S - *
; G1 F- d0 u1 | - * brief EDMA3 Test Application. B/ j! y0 O) V
- *5 E9 R! k" z* }9 O% E& I; e& R
- * This file contains EDMA3 Test code.
5 B, O+ e2 |) H* S. O - *: V7 @% o" ]; |* F- _' k2 p: X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 u! c U0 T8 }4 U1 y9 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& p' h& t: ~! C
- * TO CHANGE.8 ]: y S4 `7 U+ l
- *- |2 H; j! G* j) h: ^1 k# S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
a# w. r, A& [; Q# t - *
+ ^8 p$ l+ A) B2 `, r - * This program is free software; you can redistribute it and/or! W7 `- ?1 Y! O. \- o- u, X/ B
- * modify it under the terms of the GNU General Public License as
& ^5 \9 Z% `& |" h- y - * published by the Free Software Foundation version 2.5 P& H6 s7 O& k+ D- H
- *! b- W/ r% Z" S( a6 X4 X* X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ l8 v2 I7 s! I G6 `. _/ U
- * kind, whether express or implied; without even the implied warranty- O2 x5 L" g$ U3 O s7 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 M, X' a/ f4 J- P# E3 H7 d1 {. x
- * GNU General Public License for more details.
" W; D- c4 P; r6 m4 ~ - */
7 W+ H b1 C; ~. a - % Y0 F+ j1 S( g8 ]* \3 Y6 H
- #include <linux/module.h>+ f) n1 ^1 d8 b1 @; K# H
- #include <linux/init.h>
& s3 z% R$ R& k- ?3 j1 h) s# n8 m - #include <linux/errno.h>
! g# H7 @" I6 h - #include <linux/types.h>
# K& ]2 N0 H+ e/ {1 e. c - #include <linux/interrupt.h>
: B# g0 w, \! |( R0 ] - #include <asm/io.h>7 K1 x x( p# M1 Q- K# A4 y
- #include <linux/moduleparam.h>
2 `# b5 O9 i6 {0 v: y" X; H) d - #include <linux/sysctl.h>* s* K5 I, x3 J/ g8 {9 X& u
- #include <linux/mm.h>
8 E, \7 Y, y: Y8 `$ Q - #include <linux/dma-mapping.h>' o* I0 s: h; \* ]; m, l0 |
- % A" i) I4 X, n
- #include <mach/memory.h>" N0 H3 k1 E& L |0 g5 K
- #include <mach/hardware.h>$ O$ w h, M8 K1 n; b9 U, [, k
- #include <mach/irqs.h>* \- s% ^, V- O3 b6 d
- #include <asm/hardware/edma.h>
1 I N# V7 S8 P& j5 M% G/ B* h. d q
' S# N1 n* o7 m# S1 w% G- #undef EDMA3_DEBUG8 R1 G7 M) Z$ V+ J, V" D
- /*#define EDMA3_DEBUG*/! Y8 I: l9 m. t$ I& [6 r, L4 l& J
# {( t S6 b% L9 U! V- #ifdef EDMA3_DEBUG
2 s! B/ p- n8 G, ~8 X) j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 U: _( C- {4 P g. G! j: x2 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); P( Q0 b. C: g/ F X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* O6 n8 G" G3 K- g( R# \
- #else
9 C) g( L" R" C: A. ~. E" {. _& ]7 y - #define DMA_PRINTK( x... )
' F- [0 K V# S F2 m4 G - #define DMA_FN_IN4 J# K6 I9 `+ W' v0 r
- #define DMA_FN_OUT
C/ v8 V. [% G2 G6 ~ - #endif
/ S1 ~3 g( {& z* Q% F
7 O& o# X- J, B4 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) V3 h7 I. P- m0 P - #define STATIC_SHIFT 3- k1 o# ^% _. F& p/ U. l
- #define TCINTEN_SHIFT 202 e7 @" X! D* ?5 t* ?
- #define ITCINTEN_SHIFT 21& H1 T: Q& t+ U7 K3 ]$ j
- #define TCCHEN_SHIFT 22
. Y8 i( r/ u* x7 m c - #define ITCCHEN_SHIFT 23
- [; D0 q: y5 y( w0 l - / x1 d6 \4 m' y5 L9 W4 B) v* n
- static volatile int irqraised1 = 0;
3 j0 y0 G9 i) h& \' f - static volatile int irqraised2 = 0;2 M- F) D5 W2 A. t( Y( N/ e5 h
- d' ]; S8 U* v. z1 u. p2 p i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" O7 C! t" w. D# [/ ?$ {" n) f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& b( d- y8 C" Z9 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, W/ v, }; O, [% h, l0 R. b. X - , [- _3 o! E' \- s, O/ t
- dma_addr_t dmaphyssrc1 = 0;
$ w' e; W! C9 _ - dma_addr_t dmaphyssrc2 = 0;
1 Q' D) T/ u& k4 J1 ^ - dma_addr_t dmaphysdest1 = 0;
3 x/ A, t6 V# a) p7 v+ }6 G - dma_addr_t dmaphysdest2 = 0;
# N3 u# g* M2 v3 h
9 s" X- l0 C9 B& }( `6 H d6 E( A4 f- char *dmabufsrc1 = NULL;$ R- _6 k1 u9 _( N4 O8 x$ f
- char *dmabufsrc2 = NULL;
0 e8 |( _8 f/ g - char *dmabufdest1 = NULL;
, z3 \7 g, ^ x G) ] - char *dmabufdest2 = NULL;; v: P5 }2 ?9 D2 a3 d& {
9 y# |3 E1 R% u9 p( w& N6 ^6 m1 M" f- static int acnt = 512;
* F2 x, [. U- s - static int bcnt = 8;
' i$ N z5 ]7 j- m% X1 d - static int ccnt = 8;
# A1 }+ m: D t7 g. o# g4 A% T - % X( C( ~! r/ z; t6 o1 L' _. O
- module_param(acnt, int, S_IRUGO);! w* I% O7 k, z3 F- z, }9 B
- module_param(bcnt, int, S_IRUGO);
6 i: j+ U' U: N/ |6 r) B/ | - module_param(ccnt, int, S_IRUGO);
复制代码 # s6 \* p! ]3 [! R5 q: s
( j9 z4 D) f/ E& A5 J& V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r( a0 X; {3 ^5 c3 q" Y) Q+ ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ i" ^+ p; v' g: w3 q' Z" V; D4 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" T6 `" U( v2 g( a
# Q$ x% f. n: n5 }4 R% ^2 h/ T
& z6 w# {! n# t# w, i* Y- p |
|