|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : S$ U4 e, L8 v; `8 q+ m
- [code]EDMA sample test application* G7 c+ B0 }" v
- /*2 p8 Z; S" X; y/ l) y9 G' @
- * edma_test.c* K2 {/ W8 v. L1 s# q( E3 h- x
- *
+ u0 {2 i! W5 K, [7 a0 D4 K. Z - * brief EDMA3 Test Application
: ?6 E+ B: p4 V, \9 U1 O - *! ]' P: D$ D/ t9 R
- * This file contains EDMA3 Test code.
- F0 w! G! g/ g; J5 o - *- n$ C/ A& w0 S1 {! i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& y. v! g2 o4 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" u' D% z$ D! A6 I5 t
- * TO CHANGE.
; _/ @; I0 v2 @3 g$ k5 a - *$ D/ T3 h. j, l5 ~& |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ _4 W1 J' A) v/ ~
- *
8 w% o: P A- y8 A - * This program is free software; you can redistribute it and/or: B7 m; C5 {* [1 {2 h
- * modify it under the terms of the GNU General Public License as, }4 n( s5 P2 e4 g( H6 ^3 b
- * published by the Free Software Foundation version 2.! h* {8 P, q2 T' V$ F
- *
$ L9 P8 `3 h* c- p9 b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 S* A7 y. L/ T( k2 e3 Z* b! ^: c
- * kind, whether express or implied; without even the implied warranty# ]3 C; p- H; ~8 I$ v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) f" Q; {; [& H! {% L0 o - * GNU General Public License for more details.
' [- E Q& [2 N. |* Z5 M4 i% x - */
4 K" T" a( {! W- g1 Y: ` - - {3 N5 g* F! q! [
- #include <linux/module.h>
; R: J; k. x) l* w: y9 `& R8 `/ @ - #include <linux/init.h>
" m7 X9 n E7 _5 k - #include <linux/errno.h>; Z/ B# [' y7 |' V+ J
- #include <linux/types.h>
! O& c- C( K' k6 N - #include <linux/interrupt.h>
, L L/ B1 q! R1 Y - #include <asm/io.h>; b: F5 S C" L* r. L/ b( f6 J
- #include <linux/moduleparam.h>( Q6 B8 B9 J! V; ?% E0 ~
- #include <linux/sysctl.h>2 W& X6 ?8 Z# I! x
- #include <linux/mm.h>" Y r% A% y0 O. E; a7 A
- #include <linux/dma-mapping.h>
* r/ k% Q$ E* p6 f - |0 ], O- m! G! N" N/ z
- #include <mach/memory.h>
' \' M& D1 J; o3 A - #include <mach/hardware.h>
% {* f% W7 Y1 a# F - #include <mach/irqs.h>
" [1 o' Z* V4 ^: ?' `( L - #include <asm/hardware/edma.h>6 n' ^; z. x3 B# Q0 ~0 X, q4 z9 H
- : B$ N4 m! \ n0 E/ Y7 i) J- S9 n8 z
- #undef EDMA3_DEBUG, w s# y; d6 _3 }( P8 r# K
- /*#define EDMA3_DEBUG*/
5 h Z( v; d) z3 P - $ U9 Q6 H& o3 u3 i( ~' Y7 E
- #ifdef EDMA3_DEBUG- b3 K& B6 V/ D! v' A0 N- N: k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' B( w: @# r' z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& \' i0 h. I! L0 M0 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! V2 S5 o( c2 F4 _* a
- #else+ E/ r2 ?& l Q: m
- #define DMA_PRINTK( x... )9 G: J+ [# [: B; O& B4 r
- #define DMA_FN_IN
+ {" f. ~$ a# @! {, } - #define DMA_FN_OUT4 x: ~# t% \* E0 u' K
- #endif
) l2 a0 R4 r4 v9 y Y+ Z' Z - 5 s! d2 Q: Z; {) o# T( s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# ~! y& L0 J9 V- C4 T6 C
- #define STATIC_SHIFT 3
) J! I/ Z& f9 O; L- ]# Q/ W - #define TCINTEN_SHIFT 20) J% r7 c2 p0 F; ]$ B( j% M5 b
- #define ITCINTEN_SHIFT 21% x. \0 ?, x) a
- #define TCCHEN_SHIFT 221 a* N4 R* Z; g- c; t) |$ }
- #define ITCCHEN_SHIFT 23* S u8 d' N9 _4 T; ^: ^
- , f& t/ A) P# e( S3 t
- static volatile int irqraised1 = 0;5 I) e' F3 C: g
- static volatile int irqraised2 = 0;1 A, q2 v( x; O
3 Z& d5 a* S% X# n0 ]* C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; @' p- a, w! p6 v( p6 p q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, u; X+ P1 L% R* o/ [/ H. x$ W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T3 Z$ e! J& I6 \ - % ]8 @9 E1 V6 X1 R8 O
- dma_addr_t dmaphyssrc1 = 0;/ H. {- M- b. r# s
- dma_addr_t dmaphyssrc2 = 0;
- i+ }) ~2 N. q - dma_addr_t dmaphysdest1 = 0;
( U% @$ ?7 \7 P0 P5 \ - dma_addr_t dmaphysdest2 = 0;! O) {. B3 G& y6 {# R1 f
5 \/ Z4 O( H' ?4 m; Z {- char *dmabufsrc1 = NULL;
|; b5 c! m5 p! m$ z' ? - char *dmabufsrc2 = NULL;
4 B) J* J( {; l% } - char *dmabufdest1 = NULL;: ~2 b; F8 }8 T' F2 q( p9 m1 ]8 x
- char *dmabufdest2 = NULL;7 c' Z. b. [ `. F" x- q. b3 t. `
- + E% V* k3 _) G! i2 f
- static int acnt = 512;
) S2 o v/ A6 [' }/ q - static int bcnt = 8;
$ s0 m& q' k% U/ n - static int ccnt = 8;
; p( h5 D8 z8 h. ^( _; M* C
0 Z' b( U4 t& l* ]* a8 V- module_param(acnt, int, S_IRUGO);
5 O% r: ^9 g- e4 a& J - module_param(bcnt, int, S_IRUGO);: W( a$ Y+ a- c& R, u. I6 U
- module_param(ccnt, int, S_IRUGO);
复制代码
" u" ?& x( ^) }1 V% h; J; [9 k5 R. ^; h2 z$ l/ R/ L. Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' J9 _+ d8 A5 I* harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" D$ t2 o: G. n% K8 q7 J& f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! V3 K0 M/ _8 ~$ G& V
/ ~. C& @6 Z2 e& A5 w
: }& O- l1 Y9 F
|
|