|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' K7 S P& b" w6 h4 V4 r+ X
- [code]EDMA sample test application
8 U' R# P4 N; I: l& D& b, P - /** r$ X1 `" I% p$ b7 Q1 |
- * edma_test.c
0 _3 G3 J Y2 }3 {6 d - *# T1 _+ R% F8 F" b1 e \
- * brief EDMA3 Test Application
. K* U1 Y0 y2 j( M+ B - *. ^! H0 a) b7 _6 i$ K1 z
- * This file contains EDMA3 Test code.! |/ j ^" H1 T
- *7 w% r: r9 L; l) Z7 K" }! Z) L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& m$ e. |! a c) @# u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( p, l# b; c2 d' U# q3 m) k: C, M0 p" C { - * TO CHANGE.0 g; j+ j0 z: x x9 f
- *
# f0 _+ ~. I- F* U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 A$ R. p ?' y/ J" } - *; t6 M# Y6 g: L+ |: z( q' d8 T
- * This program is free software; you can redistribute it and/or' {" S, {/ t/ i$ G6 `
- * modify it under the terms of the GNU General Public License as
0 x# t- ]0 A( Z1 q& ` - * published by the Free Software Foundation version 2., w9 y4 n$ u F c& r
- *
1 c9 H. {6 N8 J1 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" |( L% h4 m7 x: d3 W' u7 d8 ?$ F
- * kind, whether express or implied; without even the implied warranty
/ [/ w6 Z. t" R. y. l. z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: J7 a3 O, b; \! e0 h4 g! s - * GNU General Public License for more details.3 B( v' @0 m, k9 R+ H
- */
G6 p w# {# W8 O0 L
6 a* a& L* }- Z- #include <linux/module.h>
* u) l* L" s4 a* v" @* B- Y - #include <linux/init.h>( l ~6 I# A# f) b; U( N
- #include <linux/errno.h>' v! q- G) y* b5 O7 ]
- #include <linux/types.h>
7 K, |7 M- E( b/ Y; Z0 _ - #include <linux/interrupt.h>
( S% B& e3 u0 x. v8 e - #include <asm/io.h>
2 G( ^5 P, I3 `; ?" y0 L4 s Y - #include <linux/moduleparam.h>
1 q* m# {6 i) X4 u8 H - #include <linux/sysctl.h>
* D- r7 L: |8 Y/ ~6 w( \9 G - #include <linux/mm.h>
! t* w. Q2 `+ {: [4 [) X - #include <linux/dma-mapping.h>! k" Z& t$ a) I
0 _: G$ i! l3 u! U# }6 {- #include <mach/memory.h>
3 l6 C, z6 Q: k" i9 A( E - #include <mach/hardware.h>2 A6 ]9 V' _0 B/ M: X- @8 |
- #include <mach/irqs.h>& @: d1 S! ]" p) J, @2 y
- #include <asm/hardware/edma.h>
# U5 q: A6 W% @! P$ A3 z4 F - 4 I6 @4 s, S- f7 P' G
- #undef EDMA3_DEBUG
0 E- ~7 `* a4 l. @ - /*#define EDMA3_DEBUG*/- K B* S$ v% b% m4 T
. K& W# |# ^( C$ u- #ifdef EDMA3_DEBUG4 E: Q0 g$ L% t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
[ z: f6 w4 y4 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. L) ~' o' [. d# x% N% p/ H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; H, C5 y N) |6 f8 Z+ q9 p7 b, L: Q4 y/ o - #else- L7 t( E1 W1 y. V
- #define DMA_PRINTK( x... )
2 T; ?$ \* H1 ?2 M# a1 i - #define DMA_FN_IN
; M; _0 P" X; Z+ n - #define DMA_FN_OUT
8 v! C; U1 H9 T, M! ]/ w5 Z - #endif
( j7 |1 C3 s1 e% \; L4 w, `3 ^- y - 8 c7 l( L% j3 f- h+ W/ Q: F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 |0 n7 g6 b8 b% B" s - #define STATIC_SHIFT 34 X G) X$ X( g8 W
- #define TCINTEN_SHIFT 20
, N* B k1 Q$ q4 p8 w; Q; G& M - #define ITCINTEN_SHIFT 21) s. z7 ~" i, K7 {2 G* m. r
- #define TCCHEN_SHIFT 22
1 @/ U7 R F) H o- A% p/ P - #define ITCCHEN_SHIFT 23" q! g& O) Y2 R: s4 Y' F, g
3 ~* y4 u! B( i# ?7 T3 O- static volatile int irqraised1 = 0;
0 y" u1 c% h+ ? u - static volatile int irqraised2 = 0;2 m6 N# d8 t. ]6 c) G3 w
( ^, ~0 T/ Y! _) |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& }9 P. D- P& T% i) L8 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ^; _" O& g3 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V1 s: c8 v; I: |4 h
- G7 z4 {( P5 a9 w: J3 _
- dma_addr_t dmaphyssrc1 = 0;6 Z$ r4 l3 [- c' Z+ P3 U
- dma_addr_t dmaphyssrc2 = 0;
, |7 \8 A/ T: P; M @( V - dma_addr_t dmaphysdest1 = 0;/ o! @. V& B g: T/ N+ D- M
- dma_addr_t dmaphysdest2 = 0;% l! e. H+ c( C% D
- o% q1 j* [6 {: _. a; x4 g% c, b, ~* U
- char *dmabufsrc1 = NULL;
8 g( O& N: w+ `# Y4 U8 _ - char *dmabufsrc2 = NULL;
* ~' w" h2 x- O. H) `! X- { - char *dmabufdest1 = NULL;; b+ \2 s$ s9 e s& N) |, [% u
- char *dmabufdest2 = NULL;
, n N @2 l/ {$ v s& k
2 j$ \* }3 `& k, h9 H% f: r' R- static int acnt = 512;
1 E* Y8 W a/ K9 m - static int bcnt = 8;& L. Q" X/ S5 D" J4 |/ X
- static int ccnt = 8;
$ F; ~# ^6 ^2 N6 `
& @ ~$ c7 L9 e, D5 U9 }- module_param(acnt, int, S_IRUGO);, ?0 h0 C! a+ Q& D" ^, c
- module_param(bcnt, int, S_IRUGO);
) q A) J E! B9 x6 l D - module_param(ccnt, int, S_IRUGO);
复制代码 " K8 n' {% E4 ]7 o' _
3 W, n, B$ A2 |2 t9 ^5 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! n3 z' v- g9 W1 b* s2 a8 Sarm-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 O0 t& q o/ F+ r8 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s2 `- z: Q0 y7 N9 F: R
, Q6 B! z1 O6 o/ t# L P6 P5 L R; Q7 b6 a( I
|
|