|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; }. F$ g# U" C5 n
- [code]EDMA sample test application8 P7 u& n( p7 O6 Q
- /*) d7 A% |) l8 H2 S
- * edma_test.c
1 R' v9 Q* ?8 M" X- G" D$ o - *3 I# Q i* L$ w: o; D T
- * brief EDMA3 Test Application
* f8 Y2 p# O8 I - *: N1 d0 d3 A& `8 B% k
- * This file contains EDMA3 Test code.$ Q1 T% a0 C, M2 `8 [5 T2 v
- ** q, W' F4 ?* S" A0 g- B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE {9 w! r4 {7 f8 k4 V4 C8 A5 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 e7 _3 [: Q! k- _/ P - * TO CHANGE.
u7 \* H- p. O" U - *% ^. N7 a" \* g9 b4 f: l0 P8 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Z4 x3 o, V6 ^5 O+ ?
- *
0 K3 [- n& {, E# b4 X, K - * This program is free software; you can redistribute it and/or
$ m5 E3 \1 a( [& I$ l - * modify it under the terms of the GNU General Public License as3 W, v3 t s; X, j0 b% K
- * published by the Free Software Foundation version 2.6 W. x0 q, Q; g
- *0 q. _. C% u5 e ]5 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ t( U H; d! L& J - * kind, whether express or implied; without even the implied warranty
- k8 R+ a1 X- @, q$ ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Z5 r% ]/ \4 f! f' J& S - * GNU General Public License for more details./ C! D7 L& r0 X: U6 H) U" ^
- */1 l+ h1 m: H$ J
- # M. s/ x" {) W1 k& j4 O
- #include <linux/module.h>
( K$ _/ N+ h: [1 G - #include <linux/init.h>
- m! O4 p0 m3 e- k! \ - #include <linux/errno.h>5 E# W6 J |+ j. e9 i3 {
- #include <linux/types.h>
/ v) q2 g8 x+ b9 R! B - #include <linux/interrupt.h>
+ h# Q8 t E0 B/ R5 E* b - #include <asm/io.h># X9 d7 b' D4 `, [5 a
- #include <linux/moduleparam.h>/ u- d% Z$ V& t8 a' i6 Z
- #include <linux/sysctl.h>
# i. T: f5 F5 g - #include <linux/mm.h>5 y7 k- Q% ^. C7 d) \) Q
- #include <linux/dma-mapping.h>4 E0 q. Z2 o! W# ~ p& b7 @+ d, D
- # X# F" k; ^5 B! E$ B1 j; }
- #include <mach/memory.h>
6 c1 t. B5 H2 f3 R9 u" n - #include <mach/hardware.h>
; A( O, p$ V+ P4 Z - #include <mach/irqs.h>
" E' w y9 N: C5 W) O4 z) M6 |% I - #include <asm/hardware/edma.h>; e& t' o8 c+ V) j! {3 E
6 A, m; A5 Q" d8 @# J1 E- #undef EDMA3_DEBUG
x& [ t( }! P/ u( ? - /*#define EDMA3_DEBUG*/7 s. {. o- }, H4 Y4 s( W0 `
% _& X: {1 a- U) B* I6 K- #ifdef EDMA3_DEBUG. p$ B! }( d% N6 y3 q Z# l( ?$ l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 p7 T; t5 }; G" l7 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 }3 o; j ~4 i9 V% l+ n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ~" y4 v# J9 |; z5 z* ~8 A - #else
$ n- f* J" g& \3 I - #define DMA_PRINTK( x... )/ Y% v0 _( k/ t( @3 d1 q# q
- #define DMA_FN_IN6 l) @. F h; O7 [6 U0 d
- #define DMA_FN_OUT
3 _% m) Z8 k+ X$ i - #endif
j0 ]# C6 ]' n/ l9 y, X$ q |( [ - * v, E. a6 @) H( s# r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 v. \9 H. z* t8 f- {
- #define STATIC_SHIFT 3
" h* X# b1 i1 G w Z - #define TCINTEN_SHIFT 20
& j% @$ m- J, c( P% y# R! g - #define ITCINTEN_SHIFT 21, P% K7 q$ z# N
- #define TCCHEN_SHIFT 22
! b1 p3 |9 a- ^6 A# |# G - #define ITCCHEN_SHIFT 23: B0 |0 ]: y- a9 q8 {( E9 W
3 ^: w2 q( X+ j6 O( L0 G9 p- static volatile int irqraised1 = 0;% _" V* A3 C- U* y% S
- static volatile int irqraised2 = 0;
+ _* R9 g5 E/ r5 V0 f' {; g
Q4 I( w, }3 B* q- h3 p, s( |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 N2 s: @ U# w# S4 z) X. B/ E1 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N6 s, T8 E+ c3 c g( D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P' c, e% G- V+ A8 P$ _
- # j/ ]0 X) s+ u' X
- dma_addr_t dmaphyssrc1 = 0;
+ ?' t/ W( x G6 e& r* Q - dma_addr_t dmaphyssrc2 = 0;
6 C5 g/ E: V& H; Y - dma_addr_t dmaphysdest1 = 0;* X2 H1 g; @- @0 h
- dma_addr_t dmaphysdest2 = 0;. S, F) H. M6 S2 U3 p4 v
6 i8 i& `% A+ |1 R2 {2 A$ M8 d- char *dmabufsrc1 = NULL;3 V+ L/ U) q3 ^
- char *dmabufsrc2 = NULL;
; Y z3 K3 p* [0 F) R- D - char *dmabufdest1 = NULL;4 q a, d3 y) }9 \, v4 ~
- char *dmabufdest2 = NULL;# w; h7 k; d. G5 r) u S8 b
- , j" O7 h6 v9 [' \. k" z
- static int acnt = 512;
! \* s8 H' }0 x - static int bcnt = 8;
2 o* S; S! V T! B; q* W4 |) N. R9 a - static int ccnt = 8;2 r# C& @% k2 c( c, q
- + T6 [2 {% R2 u( X. J2 @. r' K
- module_param(acnt, int, S_IRUGO);7 `2 P0 w) i/ L
- module_param(bcnt, int, S_IRUGO);+ W! ]0 i" u" \ C( G, l# d
- module_param(ccnt, int, S_IRUGO);
复制代码
1 h6 A& H# U6 ]0 C: v+ n0 c1 S; J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 Q# X" y: n2 W- `# s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 v, O/ X& p6 ? P# m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) t% s2 W9 m4 v7 E
( i9 V& @! e$ e
4 g+ t1 c! v/ M, q+ V! ]9 }; U- u) ]- D5 i |
|