|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ]) e6 K' o6 ?
- [code]EDMA sample test application1 i7 D* G, P d6 r
- /*
6 g6 Z0 `9 s- }1 S+ t# v" o - * edma_test.c3 |9 g' c R4 n( e
- *
5 ]4 Y7 Q( V9 T% \# I# g - * brief EDMA3 Test Application
# Q+ K8 `$ I* `) C, _5 W& }' f; ~ - *
, W; W3 F3 k. d) W - * This file contains EDMA3 Test code.
3 k" J4 g- m% Y+ g! p( @ - *
6 R5 O9 @# J% k0 _( _2 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) }2 [3 f" N! r5 L: ]3 Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' F0 {: k) o8 W( ` b1 \% K/ g* w - * TO CHANGE.& X5 h. v/ \4 q& u! a( C J
- *$ S2 N- T# u6 Z$ G/ _+ H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( e5 C2 F) U; g0 Q( `- J- H
- *
9 Q: Q, J3 B- w# T i! } - * This program is free software; you can redistribute it and/or5 Y% y% L% b/ ]( v
- * modify it under the terms of the GNU General Public License as" O/ z3 o% c# r X7 W$ P$ b
- * published by the Free Software Foundation version 2.
/ E; c. L. ~$ T9 ]" j- k9 o8 { - *
/ j+ @0 a$ k: p- V* ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
}, ]) s' G6 b+ P - * kind, whether express or implied; without even the implied warranty( O; _% l$ F: g" y+ c- e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! {) z6 g. }9 {+ G. u
- * GNU General Public License for more details.
0 z) w0 w; g$ S: w/ P9 X* ]% R( t$ Z - */
: G* A, D! l! i4 j/ ^
6 s2 s; z. u a- #include <linux/module.h>6 H- l" X' G7 p0 L
- #include <linux/init.h>$ f' U C1 {* {/ ?
- #include <linux/errno.h>
$ |3 s @7 o; T7 e - #include <linux/types.h>: ?; J7 _/ x4 _( ~
- #include <linux/interrupt.h>
" P7 [9 g# Y* Y# J: J - #include <asm/io.h>4 @/ P1 j8 U3 R0 J9 i
- #include <linux/moduleparam.h>
8 T- ^; s' l. u0 I# n - #include <linux/sysctl.h>
; O) D* b |* Y* H - #include <linux/mm.h>
: _ @1 D# o6 j* [& ~8 D - #include <linux/dma-mapping.h>: v! S2 ?/ A6 A: _ Y) o ~1 b
/ K7 |" T! G" Q4 m& A- #include <mach/memory.h>+ f& q; ^! c- c
- #include <mach/hardware.h>
7 o# b Z& W0 _/ z - #include <mach/irqs.h>
" _9 q/ s% f" k% i6 z3 ~+ s - #include <asm/hardware/edma.h>; n3 g; Q, M0 O$ }9 @% a, F5 C
- / q% `' K& p) m9 s. Z
- #undef EDMA3_DEBUG+ M9 Q/ ^4 O9 R" V) ]
- /*#define EDMA3_DEBUG*/
1 z5 I0 h3 } N" m - ( F* e8 ?$ _; B5 }1 b g0 ]5 }0 M, ^
- #ifdef EDMA3_DEBUG
9 E# u' f9 s M& a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). t; K) X1 _7 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ `2 T0 U& H$ M' ? E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. _+ v7 u! [! s6 Q5 p5 N - #else
. `4 Y. l; V& M* b4 u7 q& R# R - #define DMA_PRINTK( x... )
5 ~9 z7 A4 G/ S; ~ - #define DMA_FN_IN- Z3 l: E- s+ u; X, o( V4 y g! {
- #define DMA_FN_OUT+ I4 _- n& o+ `# T0 ], T+ I% X3 l+ P% U
- #endif8 K; ^; O& N" z9 n8 S
- 9 Z$ C- J8 F% h2 W2 Q" R" G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), t/ j% \- v% I1 C( W
- #define STATIC_SHIFT 34 z9 M5 X7 r; @8 c2 X1 r
- #define TCINTEN_SHIFT 20, B0 b/ u `- W* E
- #define ITCINTEN_SHIFT 21
8 ~3 M. L' g/ @% G" J# K9 n4 m. R; L - #define TCCHEN_SHIFT 22/ r0 O1 q* h6 \( u$ }6 P7 X
- #define ITCCHEN_SHIFT 23
( [, A Y3 g6 o1 p+ }- l! P2 _
3 Z: X( }6 u/ N; @7 |/ f s) a1 J" F- static volatile int irqraised1 = 0;
8 r2 L+ u1 s% A- H/ S8 D - static volatile int irqraised2 = 0;
& k5 j6 M6 h' w& d+ D. h - / f% ^9 @. [2 f) M" @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! v9 E* T) X) R, t+ a; G3 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( C9 @1 Q6 O( r% }1 u" M3 \+ p+ k) R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R; a5 E5 Y0 k6 q# `
- 2 l; ?5 O, Q$ Z5 x" r/ s
- dma_addr_t dmaphyssrc1 = 0;) ^4 Z1 \; D; e, @
- dma_addr_t dmaphyssrc2 = 0;
8 K) Y" q6 u& `6 |8 k - dma_addr_t dmaphysdest1 = 0;
/ Z& E$ n4 ^2 ~/ T# Y' V z& s# ~ - dma_addr_t dmaphysdest2 = 0;
/ k3 E$ v2 A$ j4 ], b8 R7 b* }6 `
) j0 i" O$ G4 U! {7 g3 I" n* ^# W: h- char *dmabufsrc1 = NULL;7 |1 @6 \% F) y# U. p6 o: v' `
- char *dmabufsrc2 = NULL;
3 t7 E6 c" C- k/ A - char *dmabufdest1 = NULL;
4 Z4 e9 e' u% h4 Y8 ~ - char *dmabufdest2 = NULL;
) |2 p: i9 @: k3 D, ]. ~/ v - 6 M2 N. m* E5 s0 g- L; `7 ~ v* s
- static int acnt = 512;
" o# {% k6 }: l3 k - static int bcnt = 8;3 m- U1 p) a5 F/ H2 l+ f5 p5 [' C
- static int ccnt = 8;
9 j+ y! o! T$ b - $ l4 i2 V9 H$ E- Y5 x5 ?% @
- module_param(acnt, int, S_IRUGO);! \0 d2 o8 t$ L2 z
- module_param(bcnt, int, S_IRUGO);* P9 `. z" Y1 d0 e( C9 M8 ^, f
- module_param(ccnt, int, S_IRUGO);
复制代码
, k* A8 L4 c" _* m
. V: c2 _) k F8 J$ k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" O+ {4 H0 i# m1 w/ l2 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 v* `& G1 V$ C* F0 v" g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ S/ s2 d8 a: F# n
4 F+ P$ N- r" D+ x
5 _. T( x! _6 S$ V. K4 Z$ I |
|