|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 H9 h# k) [0 N! f2 C: ^7 o
- [code]EDMA sample test application
% H! U( B3 t' B/ L; t6 B( k5 c5 l - /*
7 s# t/ ^: p& a! _/ S - * edma_test.c
- E5 X( P, C) x, _. j d! } - *
3 P s a; }- g' v6 P - * brief EDMA3 Test Application" X! i" i* d8 @: D* ~. B
- *
$ M. e0 Q# }4 f- D; M/ h3 ? - * This file contains EDMA3 Test code.& n# b% c4 r/ a; N4 b1 E5 M- i
- *6 k" [) {' g) t7 U. G) E q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z! x5 R! W3 ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: f4 O# G% _6 j/ _1 m
- * TO CHANGE.
& K) z Q: \) x - *) n$ N0 q7 @: q; u2 X. [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 a9 E% M* u: S: e" m7 Y - *
0 D, n/ @4 G9 h U - * This program is free software; you can redistribute it and/or
* f2 h1 m9 D0 U2 ~& v - * modify it under the terms of the GNU General Public License as
/ i! v4 R0 l$ P7 n5 q - * published by the Free Software Foundation version 2.
" f3 x2 O# g8 J/ Y4 T+ `' n - *& f/ `5 D0 M/ f Q* |7 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 V- c/ R! v+ a" T: c
- * kind, whether express or implied; without even the implied warranty
( B: P# p' v3 p3 \7 x3 _% `9 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' v& P6 i& p( H( u% |; ` - * GNU General Public License for more details.
! ?* s5 J# g# U4 [( E9 E$ |. t - */
( ]6 D" H& A% F9 H$ Z" V# T$ I# V! j
- _0 h4 x! z( M" O' u- #include <linux/module.h>) e1 z. \( Q+ n. N2 Z
- #include <linux/init.h>
( @( `, x; H. B" Y+ S/ B - #include <linux/errno.h>5 H5 @0 K0 O( T. j& a4 B
- #include <linux/types.h>1 _5 J4 j1 j4 r4 B" }- p% `4 ~0 O
- #include <linux/interrupt.h>) @ b1 K+ \7 i/ v( H
- #include <asm/io.h>% q; Q5 D, g% E; ]! E3 T
- #include <linux/moduleparam.h>
2 W( R" Z( y0 K$ g S, k - #include <linux/sysctl.h>8 p ^) f6 _4 b, Q% Z1 H
- #include <linux/mm.h>
# V1 r+ f! N1 O! X$ c - #include <linux/dma-mapping.h>! s9 J2 S! D( h9 A+ U
% ]( d/ _$ V) B* B- ~' b- #include <mach/memory.h>4 g# o) b) m; \, Y
- #include <mach/hardware.h>8 W3 r: @+ F6 z
- #include <mach/irqs.h>: B+ B) `; @( |1 e( |8 ~) B
- #include <asm/hardware/edma.h>
* U- S# I: H) s - 6 M% g5 z' u6 _: f
- #undef EDMA3_DEBUG' ]. V5 J2 G! K( s0 K; e/ s
- /*#define EDMA3_DEBUG*/
1 T. q! {7 O1 C, F2 I4 e9 X5 k - 1 i9 X! S( x8 p9 @
- #ifdef EDMA3_DEBUG, m/ _, t% D/ b; t8 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 c2 z5 v; H$ s1 l2 n. R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) [( l2 C, g" F ]1 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R7 u) S! K9 u! J/ t8 \ w
- #else
0 [2 W& _- D, G' X# V5 |1 ^ - #define DMA_PRINTK( x... )2 a1 |; l2 W2 A' Y: V
- #define DMA_FN_IN
. a' t/ ?9 a; C7 E( R - #define DMA_FN_OUT9 \, T& N7 Q8 V. C. Z5 |
- #endif8 c* l$ Y9 g$ V, L( @: l
- $ i1 i& O0 A: @" S+ q% q% Q0 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
w3 w/ Q7 j8 U X" S8 N# r6 z - #define STATIC_SHIFT 3
* C( D' H6 s3 Z: A9 S - #define TCINTEN_SHIFT 20
. o6 P6 F! H6 z% ~" W: H - #define ITCINTEN_SHIFT 219 M. q) m J+ i6 X8 Z+ F
- #define TCCHEN_SHIFT 22) _: O3 _4 j. @3 ]( S! m6 T p; r
- #define ITCCHEN_SHIFT 231 |. D* _# {8 N2 _2 r* i
" U. z7 f( Q/ c% S/ l5 S- static volatile int irqraised1 = 0;7 A. W) o# U; I8 h' d2 [
- static volatile int irqraised2 = 0;# A4 e5 z" v) `
4 q1 I" W! X9 q, T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ^" K# n; W* ~$ t7 w7 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 t: p, V4 T; Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ?5 ~5 _# t# \( j7 y z - . \3 `( D% X8 r& A" J5 p* z
- dma_addr_t dmaphyssrc1 = 0;2 `5 S! V! q f: R: B
- dma_addr_t dmaphyssrc2 = 0;3 I1 X2 V' b1 q; O# ]
- dma_addr_t dmaphysdest1 = 0;
5 ]8 i" ?1 f. b$ _2 d - dma_addr_t dmaphysdest2 = 0;
; J# J U F. W - K* O6 c c$ P' Q9 M
- char *dmabufsrc1 = NULL;
7 q1 K0 \8 G! H5 L4 U: C* z+ Z - char *dmabufsrc2 = NULL;
: [0 p) z$ U. X" [; B - char *dmabufdest1 = NULL; `$ s' U- X' E3 D j' l2 t
- char *dmabufdest2 = NULL;
2 P( B2 R8 h" A - ]. A( f3 p7 k5 q6 X
- static int acnt = 512;
. a0 y% @+ w h' e - static int bcnt = 8;
8 e; [! j" Z1 m, R# P+ {/ N; h - static int ccnt = 8;
5 P) |2 l T) p8 Y6 y9 A - - A" ~0 \* _, Y9 p
- module_param(acnt, int, S_IRUGO);
& ]. w( ]& C7 h( Q - module_param(bcnt, int, S_IRUGO);
- H( l/ H2 Z5 M' i: H2 P- d: j" O8 o - module_param(ccnt, int, S_IRUGO);
复制代码 ( A9 ~! d ^% H+ i' ]( H
! X8 x$ X5 M7 g& [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( z$ ^% A* J2 w+ v) [) carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- v- T' `$ `( V6 V; Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 b. F9 \' L. P" e$ U2 l2 [# j$ c8 c1 `# Z8 T
9 u; B5 v5 | H% H6 A1 W b$ ~6 U. }& F4 \0 t% |' g
|
|