|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% u3 c$ w. a2 o& z& _; I2 S8 a9 p- [code]EDMA sample test application- L% n! M1 ]; B6 F/ ]! @/ t
- /*+ L1 }# ^( a, s2 y
- * edma_test.c: M1 T7 n! [, h! l
- *% V# {# g7 p. `0 ]- M
- * brief EDMA3 Test Application
& ]1 x, `" [* d7 X - *$ D" r2 @5 A) r0 h# f
- * This file contains EDMA3 Test code.
2 Z0 [1 A( v& d8 C - *
2 o+ f0 E1 e' Q& x2 w) f4 C/ B5 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& C6 E% d- L, T. z ~& D& z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 F8 h; X3 U6 ]% n+ J - * TO CHANGE.% l9 i4 E' d! \
- *
- c9 O ^% ?& a( j$ Q9 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 R' l" j4 A/ h" Q
- *
L4 S' T, V. D - * This program is free software; you can redistribute it and/or
7 W |0 T7 l; M - * modify it under the terms of the GNU General Public License as
$ t1 j$ `+ R$ O+ i& C6 [4 U - * published by the Free Software Foundation version 2.
# A: u) J; }! [; H* Q - *
* Z: G8 _: X0 U" [5 e5 m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
v. ~; _. v i4 S) P. a7 Z- k - * kind, whether express or implied; without even the implied warranty% @2 v" G1 {5 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; B8 }) G% @ n! R' H W - * GNU General Public License for more details.
: p- C" B- n8 U7 s+ L2 x - */
( B3 r5 h) g1 O5 N
9 v; [! @" q D. ~4 P! n _- #include <linux/module.h>" U) v) `* ?7 U& q
- #include <linux/init.h>( L+ F/ @( U. H
- #include <linux/errno.h>' O7 k# a/ m t: Q# m7 N
- #include <linux/types.h># D2 d4 v5 i$ E5 m+ O# Q4 G
- #include <linux/interrupt.h>4 |& D6 G. f& J2 _6 f8 |6 V& d( U
- #include <asm/io.h>
4 J0 _6 e( X. t" `# j& t- P - #include <linux/moduleparam.h>
& S1 k, E1 x8 o. U J - #include <linux/sysctl.h>
1 B; q; S2 p, {& V. b9 w, b - #include <linux/mm.h>
% ?3 Z0 Y6 v6 J2 M) B- ? - #include <linux/dma-mapping.h>! a5 V# G8 Y7 M! L" S$ u9 \
5 Y, z! M/ v8 Z$ c3 `0 M- @; m- #include <mach/memory.h>
7 `; E C% c b9 a+ a6 F, R - #include <mach/hardware.h>
5 C( Z7 u" [. P' R - #include <mach/irqs.h>4 O* D0 A& v! u& }; U* M
- #include <asm/hardware/edma.h>: K. \+ c2 g+ M/ T% x! s. b
- % p! u. n1 d8 I d
- #undef EDMA3_DEBUG+ O/ K8 r: _# O* c* _
- /*#define EDMA3_DEBUG*/( C) A, W: Q7 L3 L2 p6 J0 d+ W
- 0 `& n+ _' r( Y J8 p! Y4 s0 G, z/ L
- #ifdef EDMA3_DEBUG
% Q% ?/ W$ _- o' ~1 ?& G0 d1 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 A( j( a& N; {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' `; x: M9 V- D0 {) B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# z- x- j) E v" W! E" V - #else% \, i1 }" ]; ?5 w/ c
- #define DMA_PRINTK( x... )
) l, b# a( S2 p! v' M/ g# e - #define DMA_FN_IN
$ F. p$ X. P' ^; q5 V - #define DMA_FN_OUT
% m: l: ?7 w: T5 E - #endif' ~7 M5 H t0 A% T+ g
+ f7 A4 k3 t% ^0 u8 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 w6 i. E9 h& {1 ]0 M
- #define STATIC_SHIFT 3 Y8 D) R% W* z2 X8 k. f2 i; M
- #define TCINTEN_SHIFT 20+ Z" A: h8 ^; A8 g: y* y2 O* u0 ?# t
- #define ITCINTEN_SHIFT 21 S% [( @/ ?! V& s
- #define TCCHEN_SHIFT 225 n8 l% X% y4 Q7 j3 {* q/ b3 j3 h
- #define ITCCHEN_SHIFT 239 e& B: B; x/ v& `4 Y1 {
- 5 ]$ G6 z0 R& P& ]
- static volatile int irqraised1 = 0;
* H6 r3 `: o6 G, F. E) |0 F" r3 n - static volatile int irqraised2 = 0;5 C$ J+ B% z4 s0 k% Y2 m
- $ [! D) v) H/ q! _& e+ s2 N6 z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 e& R/ o ~. m9 F0 J) ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); y( _/ I2 a! V0 y* X, o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 w+ w) T/ a9 u. k
4 e: q6 |, ~' ? Y0 `% ~( @- dma_addr_t dmaphyssrc1 = 0;) [& L5 E% k/ J$ W3 S5 b
- dma_addr_t dmaphyssrc2 = 0;
2 a" {0 I4 L. s l* B# X% B - dma_addr_t dmaphysdest1 = 0;0 S& R) g* ?5 d
- dma_addr_t dmaphysdest2 = 0;
- v9 H! {- ^9 _- l - ) c0 L* U7 z2 F. D J- \
- char *dmabufsrc1 = NULL; x4 i. b) H& H4 j+ h! F- v. k
- char *dmabufsrc2 = NULL;7 P0 f& E. Z, K" c
- char *dmabufdest1 = NULL;" b. Q, p! {, Z+ K( l) F$ L
- char *dmabufdest2 = NULL;
( E; l# u: H+ c% t* t$ q
8 L* D8 j2 V7 d5 V% Y5 n6 m- static int acnt = 512;7 P& f$ m( P8 ]3 ^0 K
- static int bcnt = 8;4 [$ J f3 M* m2 _/ a
- static int ccnt = 8;( L. ^. F+ C! M% A$ S
- 3 r- {) y1 i& @
- module_param(acnt, int, S_IRUGO);# z& n4 K/ D6 d* p8 E: F" \
- module_param(bcnt, int, S_IRUGO);
1 y+ z$ p) Q" j% F/ H+ | - module_param(ccnt, int, S_IRUGO);
复制代码 - b4 r9 @+ c, |) z$ C! w! ~- C6 z [ x
) V, A9 L w( ~4 P4 z! Z+ ]& A$ c( ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~0 X4 x+ h' i
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 g6 }$ Y4 e- J# m0 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ B& z2 Y, C9 W9 \' D0 B
9 T( i9 n: E+ u% j, N. B
7 ^# n) b, u1 p& J* @- j- u |
|