|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ^5 w' R' q% L7 t# I& P- [code]EDMA sample test application' h, Z6 _% B b7 d
- /*
- a, I0 \) w" P1 g; X8 g - * edma_test.c
; N0 O( \9 d" H - ** ^7 E7 y* C) V% C" u: \1 g' T
- * brief EDMA3 Test Application! D4 @, `' D4 n ^' Q. R
- *" u: c* X/ `- S& j( j* Q
- * This file contains EDMA3 Test code.
, j& k9 z2 Q; z w q2 X - *
" n; ]) W$ H) P: M* `- Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; D4 y" o! {( r6 b1 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; X4 U- x0 @ ?! e - * TO CHANGE.3 y5 [& n: F6 F$ E6 |* I1 r* k5 D
- *
) N5 N) o: T5 q0 c, V) ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ^9 @7 A- d' D
- *! x! s$ X9 s' I4 m; p0 u
- * This program is free software; you can redistribute it and/or3 K& c, v4 b4 J6 _9 z$ D* P
- * modify it under the terms of the GNU General Public License as; U' F& x. n: Q2 `: ^( f) E
- * published by the Free Software Foundation version 2.
6 }: h. r! s! P* o - *, d/ e' T- O3 l2 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 [% Y) h) X. J: I. \& T& Z
- * kind, whether express or implied; without even the implied warranty
- i8 F) @5 ]0 v( ]3 f- K2 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& m- R ]# ?% w( B - * GNU General Public License for more details.) ^, G( |& z5 D4 q, W2 s
- */
0 E+ e+ I1 x* O( `. ~1 F$ Y+ {* L
; S9 L4 \/ w4 n* [# c, C; i3 `- #include <linux/module.h>" v+ f8 Z; N" M% M* z! a
- #include <linux/init.h># x" N8 H7 y. o
- #include <linux/errno.h>
6 i: v" D. @+ F# l) G- ], r - #include <linux/types.h>! }$ G9 v" e m9 _
- #include <linux/interrupt.h>
( b4 |, W; g5 ^1 O - #include <asm/io.h>
`1 L# f+ z/ f& R5 b# Z) S/ L$ u0 ~ - #include <linux/moduleparam.h>
( Z- n+ q+ K! Q! l! r, o) @; K) \8 y) ]* ?: U - #include <linux/sysctl.h>
3 x7 J* h$ C$ L4 Q8 G J - #include <linux/mm.h>
% @0 ?, @, C2 [, E4 A" P( Q9 ~ - #include <linux/dma-mapping.h>
6 z& T8 } _9 @9 v- b% o - 4 v, Z5 `! H; i- {* I I& d
- #include <mach/memory.h>
) B( b+ Z* ]" h6 i - #include <mach/hardware.h># d4 I8 Z0 Q6 D; Y% }7 Z
- #include <mach/irqs.h>& z! w5 E# {0 d9 b& a$ H/ [
- #include <asm/hardware/edma.h>) Y' F, j9 T' E# N5 h6 ~
" G1 f6 q( c+ `& i- #undef EDMA3_DEBUG4 Q1 z& y+ b5 x/ k9 K1 \8 |
- /*#define EDMA3_DEBUG*/# h s* }7 R5 \: L- G% M% c5 _/ d
) Z2 b. T" K, R- #ifdef EDMA3_DEBUG! t, c! a5 R: P, i" j( s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- X* j* j. b1 i! t9 R/ e( T) u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ O$ x W" _5 ?( ~, C/ Z( t/ g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 h: x6 u' f! o+ O# w1 H- Y) L! n6 f7 i
- #else+ i; ?& d' m9 Q& s. y. R: s# A8 s
- #define DMA_PRINTK( x... ). {* R; l2 T; R. o
- #define DMA_FN_IN+ I; C. C/ ~3 M: A( X
- #define DMA_FN_OUT
( M; q9 S) E' i; k% H - #endif! W8 i5 _. e/ O. C; e' c
- ! D8 R; y9 E# u, s8 [/ J- h, s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( ]9 X- W: q1 t0 m* v( j+ W5 g3 d
- #define STATIC_SHIFT 3: F E \/ J- v
- #define TCINTEN_SHIFT 20
! p$ z7 ]# K0 ]* G# x9 ?, T - #define ITCINTEN_SHIFT 21% U, k/ Z9 e9 T5 I- @4 e
- #define TCCHEN_SHIFT 22
/ ]% l: i( U y - #define ITCCHEN_SHIFT 23
7 i5 r' s; ` P- ^$ \5 w - ! u J6 F1 I- j' M
- static volatile int irqraised1 = 0;
8 b) V1 d+ F, ?; O' A# c9 l+ l - static volatile int irqraised2 = 0;
2 Y2 i9 c* }$ ^( I4 d - ; R' v! ?5 h" o9 Y! y5 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k/ V4 Z& M |2 d/ d0 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k) t7 t8 ?/ d- D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T+ o2 C0 S' n
. i0 b5 O3 f; `! j- w- ]- dma_addr_t dmaphyssrc1 = 0;" p4 i# V, l7 G. D
- dma_addr_t dmaphyssrc2 = 0;
; O7 o. ^; T' r9 s7 v' Q1 u - dma_addr_t dmaphysdest1 = 0;
! O2 N+ ^6 a, I1 E; S - dma_addr_t dmaphysdest2 = 0;& u! q" q+ J4 y& o1 X
- O0 k6 i8 w. u3 T3 A6 s8 r
- char *dmabufsrc1 = NULL;9 r' }% c. F2 j4 r
- char *dmabufsrc2 = NULL;. f8 n; }! R; x+ l
- char *dmabufdest1 = NULL;0 f1 ?5 R( m) x! k
- char *dmabufdest2 = NULL;$ K% h0 q& H4 `3 b0 t X/ D
- " y$ N+ R+ F( @( j X2 b& ]
- static int acnt = 512; m- r; i" ^2 Q
- static int bcnt = 8;8 Q3 T% O7 [9 s4 P4 o1 _
- static int ccnt = 8;% Q) Q! `* G. H2 B3 C
- 4 g* D) A! r3 |( |& }9 ?
- module_param(acnt, int, S_IRUGO);
; w Z# X# @3 z) ]# m - module_param(bcnt, int, S_IRUGO);! o# ]+ M& s0 a1 X8 z
- module_param(ccnt, int, S_IRUGO);
复制代码 " _( T" H7 \, o; s! l/ D6 y
* E# t9 V' f5 }$ U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 C5 R+ D/ z; H W! A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 t) c6 W! v% t2 D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ ~6 y4 A' |7 n$ s& Y7 q
9 [8 w! }5 V: ~5 P/ j) x! k- Q0 G) Y" R; ]
|
|