|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % J: e" `! \% K1 J; Z
- [code]EDMA sample test application
2 I% Z; v, f% X1 U7 s( Q2 T - /*% l1 K+ a4 R0 c: V1 \. M5 e1 r
- * edma_test.c# B6 m5 b: }! H+ }, D
- *# D- X' L% a; D) _8 o( N
- * brief EDMA3 Test Application4 g- X( V/ M& Z5 T5 X
- *' G" q3 W; [9 {9 O
- * This file contains EDMA3 Test code.0 t9 J8 w" A) z# O- o# D( u/ I
- *
0 W( N- \* F7 o3 x* a* T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 J0 H$ N& @ Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 o! v9 x" W# T3 I9 e+ B - * TO CHANGE.
w: p# E7 L! b5 R7 x# h, C8 e - *% Q6 f/ y4 v- F, _) Q1 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 `2 e; R5 M$ q+ Q# [
- *
% ]- V. ^. R8 E; G' A - * This program is free software; you can redistribute it and/or, R" i* v9 w. l5 |7 h
- * modify it under the terms of the GNU General Public License as
2 o( n+ T2 k& L$ t6 X - * published by the Free Software Foundation version 2.
4 A9 A* g7 S1 W - *+ j8 ~! Z4 Q p6 W/ R: W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 A( `- V0 ]# G - * kind, whether express or implied; without even the implied warranty
# @( k/ f4 c$ T" J X, p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" W! k, Y: Z! `: p _5 Y5 u - * GNU General Public License for more details.9 h& r& z" b6 ~: s! Y: a
- */
3 w! Q. R) `) O6 _0 B - & F5 Y. U7 v; g% F) \5 k' p
- #include <linux/module.h>$ f' O/ j& c! R& s# A
- #include <linux/init.h>1 o. {! J- v5 G, {
- #include <linux/errno.h>, o, S; z6 F" s$ o& L6 q
- #include <linux/types.h>. ?8 _. N9 Y; G
- #include <linux/interrupt.h>" p& v. e5 h; o/ \
- #include <asm/io.h>8 T$ ?/ y" K" e
- #include <linux/moduleparam.h>' i b1 @& @9 R% j& P9 I0 ^6 H9 H% x. C
- #include <linux/sysctl.h>
1 n0 i! p8 r6 t! J5 I4 z - #include <linux/mm.h>7 O1 a5 `( d. U! |2 l! J
- #include <linux/dma-mapping.h> _ c$ F& J! j+ }& x8 Q
- ( l: G# F" Z- a% r$ ?
- #include <mach/memory.h>! ]) c k9 P; P! M2 T
- #include <mach/hardware.h>" ^+ p& r6 G+ v" s, O4 i# [4 {
- #include <mach/irqs.h>
5 J- v5 F( A+ q- e. v - #include <asm/hardware/edma.h>
% s3 m: H- w7 U - ! V; B/ S) y. i1 t
- #undef EDMA3_DEBUG) `( t0 v7 z/ W1 P7 e8 \
- /*#define EDMA3_DEBUG*/3 Z; u/ T' g- W* _1 l
' r1 B+ z" }7 {& p: Z- #ifdef EDMA3_DEBUG) f' Y: _, R" f7 K5 ^0 ?8 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 ]! F4 X( @) Y; t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 B: q% ~! }" Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 k: ?4 i; Q2 H- A8 W - #else o+ D9 F' _3 O5 a7 [: n9 v) [
- #define DMA_PRINTK( x... )5 H& d @$ Z5 `! V4 l
- #define DMA_FN_IN- b8 \: n+ |9 T8 r$ R6 \6 S
- #define DMA_FN_OUT. [' i# l: q* \' n: p' q
- #endif! t8 W! F2 I3 X. A6 d4 V
8 w( f0 K' }2 N0 k2 Q& b' q1 E( b v& d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% Y6 T3 k8 Q3 O# u2 G) _9 N# s - #define STATIC_SHIFT 3, [( r, k0 G5 o* {" x$ l2 T
- #define TCINTEN_SHIFT 20) A' R4 z T; C/ F" C
- #define ITCINTEN_SHIFT 21
6 Q, V5 _7 T' Z7 p6 _" p - #define TCCHEN_SHIFT 22* m. S+ A4 w1 ]1 ]' v
- #define ITCCHEN_SHIFT 23
, P1 [5 {, V7 E: ^; H/ t* T1 x7 t! Z( ? - 2 U2 ]7 v( q+ z+ k/ p
- static volatile int irqraised1 = 0;
. S: i: e1 ]5 }+ d% q - static volatile int irqraised2 = 0;
3 m) b- }" _7 P! d: D
2 o1 r2 H5 V) v3 {% H7 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
i6 F, D N9 Z ?. C2 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ^+ P7 K' z6 v' S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 w9 G7 M0 I$ K( ] u - & @" c% s9 c0 \7 _- j" f' ]
- dma_addr_t dmaphyssrc1 = 0;
0 ?# A. q0 r" ]% n/ J; W - dma_addr_t dmaphyssrc2 = 0;8 V. F0 G2 {6 x- P; \& U1 M9 O5 @
- dma_addr_t dmaphysdest1 = 0;" c6 v0 Y8 p" {
- dma_addr_t dmaphysdest2 = 0;4 q. `: N0 }1 H; b& z7 A, | L
% \+ [5 J7 `, K8 r& x- char *dmabufsrc1 = NULL;
2 l& \* J0 Y+ D/ D - char *dmabufsrc2 = NULL;
) g' ^4 E. S+ ^7 S$ {# [9 e/ T - char *dmabufdest1 = NULL;% q+ R& Q. {* O. R" m6 p
- char *dmabufdest2 = NULL;5 g2 L) z9 h2 z4 e8 l) p8 i; q- z5 E, H7 p
. |: u, l' C0 u% n" Q3 Z' u- static int acnt = 512;
9 i% o6 ?( P7 `7 p9 d0 l - static int bcnt = 8;" }. M) N) \. ~/ h) }' _4 u
- static int ccnt = 8;
4 n5 m. L/ J1 G& B8 r - & r& c4 M* J# {2 x+ l, z; T7 h) ?
- module_param(acnt, int, S_IRUGO);
! a' n# P% T9 V5 T7 i - module_param(bcnt, int, S_IRUGO);
]: g+ v9 _( H2 p% P - module_param(ccnt, int, S_IRUGO);
复制代码 & G* b) e) E+ s) }6 E
& c8 Q. Y" o0 f9 N) s4 ~$ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% z( V) `$ g* D8 P! ~. z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 |3 t" E0 I3 }' { T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ O# ~, ~, Y0 d
1 @+ D7 r7 I, u N1 E) E
3 A* }, X2 C0 }( e p0 _ |
|