|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , W' a# g( F$ |: t9 |# n3 s$ U9 W
- [code]EDMA sample test application' ~0 g, q. n' H- y, G
- /*
6 t) @" X# N) R }- d! s - * edma_test.c
" x( }' ~' s* J4 r# p( o( n - *+ {4 R# U$ |. l; f
- * brief EDMA3 Test Application- G) z: H$ f/ I1 q/ m1 |
- *: V/ W2 Y7 B0 @) r5 y2 y& ~* L
- * This file contains EDMA3 Test code.. g) L: |- h/ f9 H- D, E# S; h
- *7 Y) X+ i: U$ N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE t3 e5 b r8 \1 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, |. i( C( j, B6 N9 B' Z - * TO CHANGE.
, [9 Y: O! V6 b - *
2 G. a! }! G9 V- }6 `- H8 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 b {) x$ E! G# o$ [; l - *
9 M |* _( p; B1 h; B - * This program is free software; you can redistribute it and/or
/ I5 [7 e* }7 s. v o3 q( q - * modify it under the terms of the GNU General Public License as/ N9 O1 F; j1 K- o. ]8 U7 K( w
- * published by the Free Software Foundation version 2.! \. D# e# ]3 [2 d# N
- *
8 W" M$ m- ?* F" @7 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 w+ m4 c* C8 b. J2 b - * kind, whether express or implied; without even the implied warranty; G6 c/ r, l/ o" H' m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% ^+ [& i |, f1 l; U
- * GNU General Public License for more details.) ]5 z6 `) X+ z. j
- */. @% T( v6 ~# M; [8 x
- , z$ ~# J' h$ C
- #include <linux/module.h>
. o: a8 |+ Z( m& ~9 w, ^ V6 } - #include <linux/init.h>
% u1 ~3 [2 B7 Z8 _* B - #include <linux/errno.h>
, C. K+ b/ z+ l - #include <linux/types.h>
+ z! R9 B4 F* ]4 a4 ]$ Z - #include <linux/interrupt.h>
. K2 V1 U3 z! P4 x( X2 D - #include <asm/io.h>, c' h U U: i q+ m7 d
- #include <linux/moduleparam.h>
6 }* X" q4 e) z - #include <linux/sysctl.h>
8 Z5 g, g( U3 T3 n( v - #include <linux/mm.h>! b5 {" r5 i( y$ n4 ]9 q. R& Z0 g
- #include <linux/dma-mapping.h>
: O' `1 L C& _) }' a
0 h2 ]4 m. `8 d( e" z9 V! \- #include <mach/memory.h>. e& ^8 w5 U$ {5 G. W
- #include <mach/hardware.h>
4 Q* c- m6 j# D8 u" U - #include <mach/irqs.h>3 R, t5 C6 X: R3 U+ N* w
- #include <asm/hardware/edma.h>
3 y8 Y' }3 [& i, k1 \
* F% w0 c' D0 ]- q; N- #undef EDMA3_DEBUG7 I) l1 `/ B T7 f2 A
- /*#define EDMA3_DEBUG*/ J% O" k& u& s, y4 }3 x+ n
- ' E" i; C7 v3 \" t/ @/ u- ^2 a% C
- #ifdef EDMA3_DEBUG
/ [: O# I( Q2 K7 R! @" o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 u; w" G" a- f/ c& {! P% t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 e0 {7 r4 U/ b! z7 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) k9 f3 T9 ]1 b9 c' ^ - #else' ]' Z: b1 u5 A2 W% e0 q: @" p, }
- #define DMA_PRINTK( x... )
: O& C8 u6 n- b2 S3 R, ?& D; e: m - #define DMA_FN_IN+ u' P/ s; o/ }
- #define DMA_FN_OUT
8 ~8 s( M1 s/ I. E. b6 @ - #endif) F) [) u+ h3 _0 P8 y9 i
- ' ?! z! q: u4 y$ l3 E3 ]" r* y4 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): ~6 {( y. c8 C) N5 S" d
- #define STATIC_SHIFT 38 h& @2 e. K; J" }
- #define TCINTEN_SHIFT 20' @2 \+ W3 q4 s$ [, v
- #define ITCINTEN_SHIFT 211 S! j3 |, l( x5 l
- #define TCCHEN_SHIFT 22; g! o' V0 N% F+ O' I$ ?
- #define ITCCHEN_SHIFT 23# P2 t2 N/ _/ y) G
- - J+ l& _' C' t& X; S4 V9 Y( J
- static volatile int irqraised1 = 0;
0 V! u3 `4 C+ q3 `5 } - static volatile int irqraised2 = 0;9 p6 O/ M$ H) V5 }( V( Y% Q% r
- 7 q( V' j, c% E0 {$ c8 z2 B0 b0 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P2 I, y% d' r2 @' R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ V. o/ k8 p: \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y0 u( k2 ~0 ~( E
- 5 _( E0 P2 U/ a9 m2 [8 [
- dma_addr_t dmaphyssrc1 = 0;1 q' C. f: W5 I) d
- dma_addr_t dmaphyssrc2 = 0;" }8 O4 g( o3 j* Z( ~* k# B) p
- dma_addr_t dmaphysdest1 = 0;" r' @) q1 V8 F1 N/ i& x" P6 s
- dma_addr_t dmaphysdest2 = 0;. W L3 e( M, `7 P* L
- 9 ^$ F8 \4 b! [6 `' ^6 h
- char *dmabufsrc1 = NULL;
# Q5 j' M3 V5 C% A3 | - char *dmabufsrc2 = NULL;; J3 x! e: g0 M: u" a$ h
- char *dmabufdest1 = NULL;* D5 J) l/ r( a( b- }3 ]
- char *dmabufdest2 = NULL;
' g4 |* y9 c J+ R& p% G1 w: o
0 k7 v+ s, |+ m) ^# J- static int acnt = 512;
& s* h$ S+ x4 t) B& j# O" { - static int bcnt = 8;
' q' [+ k2 l' w# I+ Y' ~+ ] - static int ccnt = 8;4 |# c; X7 C5 |
+ i K! d! V1 u1 E5 H- module_param(acnt, int, S_IRUGO);
4 |; |3 W7 x, o: y - module_param(bcnt, int, S_IRUGO);- m, v" S/ X8 \1 O" a: Y4 @. x
- module_param(ccnt, int, S_IRUGO);
复制代码 ' {/ J+ v$ b5 o( Z; C1 `& n; l. A
+ V6 M) P M* c; V% s5 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Q5 p/ U$ ?4 G5 K, b& e
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 L; z6 {1 O6 }( I! G/ L4 Y$ g% Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' u9 y& A9 d# O( a3 \' B
) n( t0 k+ u8 k6 y( Y) }; [9 s- C
9 s' ~( @2 K4 j7 v/ ] |
|