|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 `, G# E0 P$ I) f- [code]EDMA sample test application
/ N) }/ J+ _1 o9 m - /*% o8 ^0 c: _6 a
- * edma_test.c+ N0 F# N/ S8 c' g/ S( ]- G' ? H
- *
* k1 J9 E4 B$ C9 W5 K0 x# b - * brief EDMA3 Test Application( G8 b& T5 F0 P" @; q1 e
- *1 w3 @; f8 w! Z# K |. G
- * This file contains EDMA3 Test code.
( ?2 C* z, T# ]3 o, i& Y - *
. ^# u) _: a" a% K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& t! {8 t6 j/ P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, i' \% `; a3 i! P# g- ` - * TO CHANGE.
$ r: P. t0 Y& ]9 ]$ C) V# ] - *6 R- x* Q7 x8 p0 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* b ~+ C$ \$ {6 i8 m8 M
- *
" N( z4 Q3 i& ?( U, o - * This program is free software; you can redistribute it and/or
. x* e# t) k8 D" I# q - * modify it under the terms of the GNU General Public License as. O3 j) p& A- D; I+ D/ U
- * published by the Free Software Foundation version 2., E( f7 D8 K3 [% E
- *5 K3 P, |: Z* p0 F" L+ Q/ M- x, U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; x. [3 R! C% j) S$ u( i: q - * kind, whether express or implied; without even the implied warranty l1 p' c( Z( S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) I: x V! W8 q. D8 q( }: U - * GNU General Public License for more details.
* [* X8 q3 {% c9 o% b - */$ g3 D& N' S% o3 U/ i" i9 L
) f/ {; u, O6 i; @- #include <linux/module.h>- s3 J& _, F! R9 L% D1 f& s+ o0 m
- #include <linux/init.h>/ l" Q$ d9 L* j+ B% q8 H
- #include <linux/errno.h>8 m' Z0 ?- l& |+ f3 c u
- #include <linux/types.h>
% h& `: l3 Z. H5 g - #include <linux/interrupt.h>7 [2 I% E/ J, e4 [( j5 K
- #include <asm/io.h>
3 |1 _( ~9 Z. q/ |8 v/ [ - #include <linux/moduleparam.h>
8 ?! B5 Z! ` q7 V+ c. i8 V- l" s' o - #include <linux/sysctl.h>
( P3 w* t, R- I x - #include <linux/mm.h>+ U; C2 S% U# {6 I
- #include <linux/dma-mapping.h>
7 {% T! f( l2 e" U5 v - ; Q; J3 P, M% e$ ?2 q8 ^% O$ Q
- #include <mach/memory.h>. l. P: s) J/ _% w% o
- #include <mach/hardware.h>
; M. k7 _( _6 R0 ~% S - #include <mach/irqs.h>
" s9 `6 F. Q8 t4 h/ S% A; v5 K4 @ - #include <asm/hardware/edma.h>
& z4 n6 Q8 g+ a R5 e" _0 S" \ - ; c6 g( k6 x0 y$ Q( |( k0 ?
- #undef EDMA3_DEBUG
. z5 m7 S* V9 y, I% j& C: P1 s - /*#define EDMA3_DEBUG*/4 p# g2 L% B2 ]' |1 O6 B/ z) C
- 7 c1 r4 M' L' I; {5 Z8 Y
- #ifdef EDMA3_DEBUG, a7 L, ?6 S. {' e5 Y2 E9 n$ b+ O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& g( ~' P0 U# _3 P( }, o# T0 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 q1 v$ J7 c& e& @6 X( o. T4 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): B# }% ]* Z$ U- x5 `5 K
- #else
1 x7 e! i7 d1 p1 X$ Z- P9 f$ ~) I - #define DMA_PRINTK( x... )! f" B8 ?0 C6 d
- #define DMA_FN_IN) _3 `1 a/ A1 k) y, n# P
- #define DMA_FN_OUT9 y; p, R1 m- C* K& b& M
- #endif
- j2 l" R+ ]& m6 `* C - % ~ t0 C G9 m0 L; i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 _2 D5 Z7 X7 E7 l9 ^, S
- #define STATIC_SHIFT 3
/ X2 R3 s/ ~4 I7 H4 } - #define TCINTEN_SHIFT 20% L5 y7 v- n; M3 O; ~
- #define ITCINTEN_SHIFT 21, K [. e$ ~7 [5 g) G% @
- #define TCCHEN_SHIFT 22
8 o( b; m: `- Q7 e+ ?0 n, j# g - #define ITCCHEN_SHIFT 23 p3 U! @- |- ?
D6 K8 u$ x* d+ D/ t- static volatile int irqraised1 = 0;
v, Q8 }: j, S4 y% o Q - static volatile int irqraised2 = 0;
- R( g/ `5 h- f9 }
6 m* }/ ?. e2 _2 e3 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 F+ u3 ?' H& V4 r: c$ T! x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 C2 e4 f8 \2 W4 T% y t5 K9 J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u6 T2 I# B7 e! t5 r; |
( ^. N. l) M: T, w/ y4 ?- dma_addr_t dmaphyssrc1 = 0;8 [5 N6 V& `" I, Q% @, r- |
- dma_addr_t dmaphyssrc2 = 0;5 k6 H- e; t3 [; j+ q
- dma_addr_t dmaphysdest1 = 0;
7 V: ^9 q+ @- q' ]# ?5 }# G9 H - dma_addr_t dmaphysdest2 = 0;5 ?! z2 z$ c7 Y( j0 X
* w: q- a4 ~& J- char *dmabufsrc1 = NULL;' T; v5 S* x; C; o
- char *dmabufsrc2 = NULL;
" Q' x6 A' F$ w6 R% E0 f: X# y) E - char *dmabufdest1 = NULL;
7 E4 R: W B/ l! Z+ x6 {# @8 d! \: K - char *dmabufdest2 = NULL;- E7 J4 y$ z& V8 q: ~
- 3 F, d9 b/ G4 Q
- static int acnt = 512;, z2 F/ N, o& Y" r! p |
- static int bcnt = 8;+ u2 q* X7 j# |. g
- static int ccnt = 8;
0 ^) Q1 w: r @& T4 {
/ @0 z/ U g/ a; t- s% c- module_param(acnt, int, S_IRUGO);' h0 u+ i9 r. @$ q
- module_param(bcnt, int, S_IRUGO);
" h2 R1 P1 b5 W( o( j" X6 s" W - module_param(ccnt, int, S_IRUGO);
复制代码
4 T/ \1 b* p& Q, w J- @7 e" Q `" N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 y8 W7 R0 }' y4 I) _) D u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 m4 H; r0 q7 U& r s* X" ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 W+ p7 Y }0 B, q& o
$ E0 X9 h. z3 Z! x. d
) D$ V+ x- p# l2 p- F, |8 ^ |
|