|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % g! s; k' W/ f* B
- [code]EDMA sample test application
9 m% l' F; f! t, q4 Z5 n, \& l5 I - /*, C' _& ` w3 Z$ F
- * edma_test.c" T" j$ ~* `' h( b0 U" e! R/ d+ R
- *
f' L3 H3 {* D b. B - * brief EDMA3 Test Application& z u H. I* L; x4 g2 Y
- *
5 W' r w2 \. e0 V; k8 X# M - * This file contains EDMA3 Test code.
, Q3 |% v7 }4 e9 j - *
, i, m1 q9 G: Q: t& [2 a* a' V, f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ S( ~9 I$ }7 M8 c$ U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% L: ]: s+ n3 }/ x1 F - * TO CHANGE." A3 l: x' F% s, u6 r2 f) n
- *; Z; J3 q" u) j! C7 Q5 k9 t; {" } M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 s2 c% {# s9 j: n4 X/ r4 T# S
- */ E9 C6 u6 Z: C. r
- * This program is free software; you can redistribute it and/or
$ F7 ?' v) f0 G# c5 Z( D- d - * modify it under the terms of the GNU General Public License as
4 \% m% {( d) g8 J1 U - * published by the Free Software Foundation version 2.
' O6 X" @9 X7 R9 E - *, n1 s. W1 g9 U% e8 w- y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any L( I- g/ x6 d4 L$ F
- * kind, whether express or implied; without even the implied warranty
, y7 {- Y" m0 {3 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 {. y. L' h! p2 \ N0 K4 n
- * GNU General Public License for more details.; l, D5 [5 \- j. L% k/ t
- */7 ^7 X, E g# n# I" m
" \- A- D" V# ~. ]- #include <linux/module.h>
& @. w" v/ g, Z% n$ ?9 x; Q - #include <linux/init.h>- p6 A- j: X0 K2 D q v% m0 L/ j
- #include <linux/errno.h>7 N8 w7 |! x" @8 s# r
- #include <linux/types.h>: |' `6 M1 ^" q' O# w/ [6 v" e! K
- #include <linux/interrupt.h>" K) E0 o4 o* e c" U0 Y! j5 w: ^8 u( n
- #include <asm/io.h>5 d! r( ^. t+ H! F/ l: j
- #include <linux/moduleparam.h>
: i' N, Q4 t; `7 s' r - #include <linux/sysctl.h>
# s5 J* }+ c5 U' ] - #include <linux/mm.h>( ]) p7 V% w, u M
- #include <linux/dma-mapping.h>
2 d/ P) }2 o( j. f V u
# {, z* m2 ?9 a' W4 M' B$ F- #include <mach/memory.h>6 k. T5 C' [; l( F( P
- #include <mach/hardware.h>
4 U2 q0 I# \, A - #include <mach/irqs.h>( m- Z6 v2 k8 L2 w; C9 e2 b# y7 V
- #include <asm/hardware/edma.h>
, V' V5 g! `' }+ \2 n3 b8 S2 Y: { - + s4 i! J# ~) X0 r1 h! N# c8 @0 F1 g
- #undef EDMA3_DEBUG8 C" ]5 q0 ^, q; U i1 \
- /*#define EDMA3_DEBUG*/: ], E5 r8 V; ~6 B
* N# D+ E6 W9 y* l4 Y5 L- #ifdef EDMA3_DEBUG6 R& D% l) K. \. a& X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) D: f- S4 v7 e# u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. [: ~% E! |) j& a) m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! b; w# d. H& ?& l1 h) ~9 u& e) c
- #else" Z" e+ U4 c1 c' ~) J2 F u( _, ` X+ \
- #define DMA_PRINTK( x... )9 `5 d2 ^+ R$ T1 [
- #define DMA_FN_IN, W( w! \; m7 s5 ?- X) o, r
- #define DMA_FN_OUT
# b, o+ z, q9 I/ ~! W0 ]/ F3 l; S - #endif
6 T5 u2 h) B' U9 a" I
% }: s+ t- g- t5 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 n: w: @! B: K" L& o
- #define STATIC_SHIFT 3
; S! n9 `7 P7 m! n. V* J - #define TCINTEN_SHIFT 20
! y* n% c4 W4 K5 D& @ - #define ITCINTEN_SHIFT 213 p1 f1 e6 l* E$ R/ Q1 U, [
- #define TCCHEN_SHIFT 22) B* z8 c/ V, y7 k
- #define ITCCHEN_SHIFT 231 d q, V0 d0 ?3 N$ Z
) Z, k/ j: K$ M( c7 B- static volatile int irqraised1 = 0;
/ c; Y; }' j8 }3 z" A: q, d9 g- c - static volatile int irqraised2 = 0;
+ y* t# Y) R( o0 q* S, J! l - , R- X$ G3 E y7 B% {5 ^$ }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ?- z$ C4 g+ x; p1 |: R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 D- }& O8 L9 J9 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) S& X6 c7 E4 f4 T9 T - * C# B) @' ?. u
- dma_addr_t dmaphyssrc1 = 0;! K4 h2 q% X2 [2 W
- dma_addr_t dmaphyssrc2 = 0;/ d3 N8 ~/ P) c3 h
- dma_addr_t dmaphysdest1 = 0;# c) T, m9 R Q
- dma_addr_t dmaphysdest2 = 0;
0 C! X X o6 C& y" z6 [ - $ R+ ]# Q7 ^3 v
- char *dmabufsrc1 = NULL;8 l" | t+ r% L% i; _" h
- char *dmabufsrc2 = NULL;5 |/ h; _! a( T! P6 r6 `
- char *dmabufdest1 = NULL;
/ m$ \ W- Y2 p+ l - char *dmabufdest2 = NULL;
5 y+ X. f7 B# B5 ~ - - ?1 J" W" F6 h/ E) }+ h1 `- J; d; p( I
- static int acnt = 512;
0 }9 r) V2 L, O - static int bcnt = 8;
6 y6 w% u/ u' n+ s0 J - static int ccnt = 8;! D5 r/ U1 K3 b! \
- ! G3 k% ]3 I! a1 g5 [4 a. Z
- module_param(acnt, int, S_IRUGO);/ f K8 M" N: q: ~* x' v
- module_param(bcnt, int, S_IRUGO);- Y1 N4 _0 C i: r1 p
- module_param(ccnt, int, S_IRUGO);
复制代码 0 g+ D- i; j& P/ w/ l8 A
6 b! m; o% i4 P) q! s# p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) T4 F* P) E, B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 c" P% [1 f z+ u" v) g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ M& Q4 h4 F1 m/ y
2 Y% E1 C/ x x2 Z( w
: Y9 E8 F, |6 y: r
|
|