|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & t3 }0 t& a5 I) z4 U: s: b4 e
- [code]EDMA sample test application& Q/ A x3 o0 ^, z% Y1 H v" A
- /*$ }; D- a4 y8 f Y3 r# Y' e/ {! @/ e
- * edma_test.c
8 G6 U0 z- j1 { - *& B2 ~# q: `9 t/ W8 `7 M4 y
- * brief EDMA3 Test Application) }! Y* B) m& u9 T5 \4 \
- *
. m/ s/ W6 F1 }9 M% L* ` - * This file contains EDMA3 Test code.9 i) H" d" i0 g/ i) e/ Z# K
- *1 W5 i8 O" H5 j: I6 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 d5 j9 r- d+ B2 `4 M- C$ p) n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! F1 b5 w! n7 m% q( G" c - * TO CHANGE.
1 k r }$ Z6 n' U1 p2 s3 r - *
2 j5 |( f8 C; a7 }$ ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ {* j. P- c+ J3 G
- *
& v& Y4 p. k9 D; d2 F7 j - * This program is free software; you can redistribute it and/or
+ s) D3 b3 [1 P - * modify it under the terms of the GNU General Public License as% Y. c3 {4 y8 Q# `% J
- * published by the Free Software Foundation version 2.
1 a* ^/ q& X) U2 V5 J - *
* |4 G0 o) b' V7 C; ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# ^' E# k2 k& Y1 t% ?+ Z5 z - * kind, whether express or implied; without even the implied warranty! f$ E0 A9 `' U% ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 k! H7 Y$ C7 a, d" K
- * GNU General Public License for more details.
4 A Z# |* N: ]8 |: i# C - */
8 W0 P2 j1 R, r! f6 M: L- V, G% G9 X - & q" [, r' P7 t
- #include <linux/module.h>- V3 R: u0 k: b# ^% V. b
- #include <linux/init.h>( y F, M3 H8 g8 r$ a
- #include <linux/errno.h>0 k( S8 U/ C0 v2 `; q0 |% ~
- #include <linux/types.h>
" ~! X5 [7 Y# S6 }) Y - #include <linux/interrupt.h>, s+ B, X) k7 j- \+ |- T
- #include <asm/io.h> |% ^. P* _( V+ b
- #include <linux/moduleparam.h>
7 m* c% ~- ]5 w' F. b - #include <linux/sysctl.h>
' y, X1 \9 C! K8 X - #include <linux/mm.h>2 L/ X! w( q0 W) Y
- #include <linux/dma-mapping.h>4 h% l3 d: v; n- y& m8 o
3 g8 Y( |4 N) O- #include <mach/memory.h>
h5 c, Z: ]6 F6 H/ ]. _ - #include <mach/hardware.h>
1 a/ ^4 {8 c% p- ]8 P1 J - #include <mach/irqs.h>5 n- r8 W Q( X0 w
- #include <asm/hardware/edma.h>
* y+ _0 C0 B, S R9 b X5 h9 \
% q( w H+ [3 K) z- #undef EDMA3_DEBUG' f! g! y+ r4 b3 J7 x/ C
- /*#define EDMA3_DEBUG*/
0 Y/ V2 b1 l7 |; A( b- P* _) V - / j2 I7 M& j5 \5 i h
- #ifdef EDMA3_DEBUG- d$ a' o: L2 r q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" O8 v, u2 S5 U3 b/ `% U" L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 V5 @2 e" n, L i" z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f6 A8 L* I$ {2 j% ~. u
- #else
- u/ s/ { d* \! M/ ^ - #define DMA_PRINTK( x... )
2 m9 W* q" B& d+ }7 P - #define DMA_FN_IN
/ x' C# T( X% ]3 d( k& r - #define DMA_FN_OUT& k: s) H7 \$ ~! v2 j
- #endif
& p2 g8 \) q% L7 o8 f, b4 u. A; N
5 n H1 b/ k& ?4 f% w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 [. O% `/ p2 e% {, Q3 X
- #define STATIC_SHIFT 3( B( p& {( F1 }! R8 R9 u( K7 h
- #define TCINTEN_SHIFT 20+ Q8 Z( P4 N" Z
- #define ITCINTEN_SHIFT 21
! s$ M, O0 {% l- ~; X- j - #define TCCHEN_SHIFT 22+ v0 Z- `0 p& R5 { x9 H! t
- #define ITCCHEN_SHIFT 23) X7 u+ x+ y) } i% @8 P r: A
- 3 w+ b5 {# t9 U7 \# u4 G D
- static volatile int irqraised1 = 0;3 N3 H; ?# D9 h; O1 e3 F
- static volatile int irqraised2 = 0;+ w2 s* m6 U9 |, k- J& a M- q
- : y' l) u4 S& u6 R% a t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& i% B6 d. v" E4 Y. u9 T. s, P8 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d) A7 M6 x' ?! d0 A: n" u' V4 s. f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' Z e, v( q! R; C I$ l8 a
. o" n, N6 S1 |# a& P# n! t. u- dma_addr_t dmaphyssrc1 = 0;9 H) e+ D3 G s1 \4 e N
- dma_addr_t dmaphyssrc2 = 0;- ]' h" o J: B2 p# S& F; |
- dma_addr_t dmaphysdest1 = 0;
$ l9 y" S0 N2 P% o; ^! B. ^6 N - dma_addr_t dmaphysdest2 = 0;
1 ` s2 b4 Q; D% R+ i: R - 9 }7 ~! ?' ?) ?3 [1 p, O
- char *dmabufsrc1 = NULL;" M8 i6 t3 m; a
- char *dmabufsrc2 = NULL;& P% _2 u2 G, ^4 s
- char *dmabufdest1 = NULL;9 q) s" o* G$ ^
- char *dmabufdest2 = NULL;
. Z4 y$ E1 J/ G& _$ f
) B4 ?7 w5 M* l2 w* a- static int acnt = 512;
! S H& k7 E6 d - static int bcnt = 8;
& t! ~2 w; w6 i! [ - static int ccnt = 8;
O5 F$ w, {8 E8 J0 I
/ b$ k+ N; K3 I; H, S, _- module_param(acnt, int, S_IRUGO);
4 ~& e+ I/ g# ^' V/ }0 d - module_param(bcnt, int, S_IRUGO);
, _4 G9 C) c- D - module_param(ccnt, int, S_IRUGO);
复制代码
) a( c6 G% b% n- d5 x/ i
5 K3 @0 ^. l1 q* S8 ]" n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ N: _1 p6 o; ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' u1 {8 r: T }3 ~) j& C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* a( w( y% [7 ~8 Q% Q
, B( L3 n1 ~+ i5 A* c& j' K1 p* H9 W6 e: L" ?4 ~9 v: r: }
|
|