|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 @% m. k/ O6 X3 ]& f
- [code]EDMA sample test application8 n& w2 A) L' Y2 Z
- /*
" D o5 z; O& j H0 l - * edma_test.c
- z1 } P. i/ u. P* g8 V' {& e - *7 o' w) ]' R8 v7 T3 f# ?9 z+ j3 V
- * brief EDMA3 Test Application
) ~" V: Z# w* A8 G- r/ r0 m6 g% A - *
; Q& f7 S* j @& }; q. x2 z( r3 s+ G - * This file contains EDMA3 Test code.9 v* R% @ Q, ?: J) Z) }- i
- *
( H1 ?+ M7 v- M* h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
a. H/ f8 t* s* ~4 v6 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; ^( I" C4 a h: u4 [2 D: H - * TO CHANGE.
G1 V" x6 Q" f( S' D) n# _ - *
+ S; e" M" ?4 W4 t ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& N* J" P+ R6 {/ c1 [) Z - *
5 D3 p" {( C" L4 U2 ~ - * This program is free software; you can redistribute it and/or
) }- c& T/ }) i - * modify it under the terms of the GNU General Public License as
; C. o" ~1 ]! o. {) Y5 l" q/ i, n - * published by the Free Software Foundation version 2.
' J( X2 z( |. y& n - *+ V8 d0 b% d* A" ]7 ~7 U4 l1 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; B* A" g/ Q8 _0 G - * kind, whether express or implied; without even the implied warranty' k9 n6 j5 w$ D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ M+ T+ H6 ]8 S4 y9 ^$ i - * GNU General Public License for more details.) t0 m; Y( h2 q. h4 F( ?; n3 [, f# ]% P1 `
- */
4 T, Y0 A7 t8 T: z1 G1 s
0 j% j$ r. P& J7 h$ g; ?9 Y4 `& l- #include <linux/module.h># ]. _: S- X) P! E
- #include <linux/init.h>
$ p7 ?& a- V3 m - #include <linux/errno.h>
) u1 c. B4 A9 j' V- k8 \0 e- n - #include <linux/types.h>
! m/ j o) I5 f9 Q6 i4 ]: f - #include <linux/interrupt.h>
. G, l+ z2 F, p; Z9 M7 f - #include <asm/io.h>- k" @6 R" h: R. \- S$ k. N' K
- #include <linux/moduleparam.h>
. S+ ^' g6 `5 t! D8 X, O% Z+ } - #include <linux/sysctl.h>
% C6 [/ \, r, |3 a - #include <linux/mm.h>8 O/ a* x o) m4 s( w+ k
- #include <linux/dma-mapping.h>
$ D2 {& M1 C r/ @( t
2 B" T% t+ ^, @3 n1 f0 l- #include <mach/memory.h>
/ N' H n, i+ j8 \0 ?. \ - #include <mach/hardware.h>8 O% K1 X# I1 R: S
- #include <mach/irqs.h>5 a0 I# N Q; Z3 C) l6 A4 \
- #include <asm/hardware/edma.h>
' Q& ], R& h) [; u9 t P/ N0 N) {
5 _: {2 m6 G+ h) f( p2 ^% _& ]+ j5 s& E- #undef EDMA3_DEBUG
& N S3 I& ~& Q2 Z5 B( V - /*#define EDMA3_DEBUG*/
: R3 l1 f" [& H7 j- @
5 J, m/ D% ^, ]" K5 h- #ifdef EDMA3_DEBUG8 B/ y, L% m2 {$ n0 E0 d: n4 K4 ~) O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 T7 f( \0 J) `1 |; ~9 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: H: `, `. `8 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ X( T% H1 {. O5 |+ h* s - #else
]- R; x) W3 E: } - #define DMA_PRINTK( x... )
/ X2 d/ v1 x# m; o - #define DMA_FN_IN
9 W1 O1 H' s2 c3 G1 G: \ - #define DMA_FN_OUT
1 V: K2 U+ [! f' A4 r8 L6 r - #endif
3 z4 E1 B* n; O: ?9 \) h
) r" z, ~/ g% |8 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 {+ W5 O7 ?9 p; s* C- f - #define STATIC_SHIFT 3
' r$ b0 I0 J* b' R$ L& c3 I6 x - #define TCINTEN_SHIFT 20
, s1 f! Z/ q; r8 C, G - #define ITCINTEN_SHIFT 21
8 k5 U8 d# d' k; Y7 \ y - #define TCCHEN_SHIFT 22
& p! e- C, O/ C0 o - #define ITCCHEN_SHIFT 236 K! F; o( m, z" W" d; X
- ( W a; T& N5 C0 C2 v6 W& o
- static volatile int irqraised1 = 0;
" Z$ H, l( Y2 R! Z" y8 A - static volatile int irqraised2 = 0;5 |' j L s0 a. f8 x
; ~* D0 i6 K: O' t s6 @ u! `5 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 r6 o- F: n, V/ T$ \5 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~7 ]! }2 E' u/ u9 O* x7 Q/ @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; g/ ^' U7 c" J! z
# [" q7 L/ x9 w# H- dma_addr_t dmaphyssrc1 = 0;
0 Z! K/ B9 Z5 Q! T: f3 W - dma_addr_t dmaphyssrc2 = 0;
4 |# l% C/ X" D" _ - dma_addr_t dmaphysdest1 = 0;
' h# P$ f) \/ S* q8 D) ], O5 y - dma_addr_t dmaphysdest2 = 0;" T0 e! u) q$ A) w( f
5 H: |# H% m0 _6 C' o* E) R" v1 a- char *dmabufsrc1 = NULL;
* @2 s9 a6 {' @5 }" D9 I - char *dmabufsrc2 = NULL;
4 S8 W3 p* M$ \# R( h. y - char *dmabufdest1 = NULL;
9 {& j P- {9 ^7 Q; I$ N, j4 Y7 A3 R - char *dmabufdest2 = NULL;6 T7 A- E* n+ |) I
- C- B: L( v9 w9 L3 Z6 T' _
- static int acnt = 512;
8 F& v# E& F) x& f - static int bcnt = 8;; ~" x, [( r6 M& r' G6 A
- static int ccnt = 8;
4 Q' f2 D. \4 ]9 k" h& P - 5 ]) o2 {# l* P% V5 T
- module_param(acnt, int, S_IRUGO);+ t" [: i& _) n! A- E& Y
- module_param(bcnt, int, S_IRUGO);: G7 ~* c7 h7 I; o, L
- module_param(ccnt, int, S_IRUGO);
复制代码
! _% j3 R4 F0 [8 s" ^5 d
# ]: m8 \# b6 v* R, D6 g$ f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 [3 t! O! o. k7 r* L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ]/ g. G* ]; M( f* \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& w; `! k7 U1 f
0 m7 Y( J3 S& B" r5 a: w! e/ x0 H
' k( b1 [. i/ N6 V, U; q W* D |
|