|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 s/ Y" S5 x( I2 A) f$ c
- [code]EDMA sample test application
$ {; v# Q& F$ b- x5 G - /*$ w" S! E: v8 ` _& a
- * edma_test.c
7 u' [( `0 a N( |4 J. d - *
- X7 ]0 k; o8 X$ D - * brief EDMA3 Test Application/ p+ |' C6 n" S+ h( j( |
- *' W( s9 o4 @5 } Q1 z
- * This file contains EDMA3 Test code.6 ?+ O" q/ ~/ c- e z' N; C5 J7 }
- *' X: `9 `+ Q0 ?8 t# s) D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) b! O- W( m) W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; X" p0 Z; X: A6 b, M v" L - * TO CHANGE.2 K7 ], _" i; c x& W% P
- *
7 f! \$ q) G) i2 _# I6 w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 z Y0 ^3 b# |; m - *& Y" K8 r1 g- n1 q* X7 K5 [
- * This program is free software; you can redistribute it and/or7 t9 V; v. }8 V$ Q3 e) W2 [: ^& B
- * modify it under the terms of the GNU General Public License as
1 y2 I/ B: c S p1 m- V - * published by the Free Software Foundation version 2.
8 R/ i% N F) g5 c. Y - *
0 h6 I- Z# x Z& A" v; t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% T; l) }7 c5 G- I/ ~. p
- * kind, whether express or implied; without even the implied warranty
$ W5 e/ L3 u N( |3 K0 k; ^( P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. e3 z5 h8 F, v$ }+ B
- * GNU General Public License for more details.
, d' h% ]* @: A4 O8 U% E. E8 } - */+ ] c( J' n. a, K
- # w4 Q0 N) c; u
- #include <linux/module.h>
, O. V3 V% c( o7 Y* {1 ] - #include <linux/init.h>
8 M2 v0 c6 `" c" x6 d, ]3 Y - #include <linux/errno.h>8 _; e# D0 d! y9 g, |6 P1 k$ p- c
- #include <linux/types.h>
/ i9 U2 `9 B. |+ B, j1 n - #include <linux/interrupt.h>
j$ E- H# c! @* `/ e - #include <asm/io.h>
+ K, q: ]+ B4 D, O" V6 { w - #include <linux/moduleparam.h>5 t+ ~/ F6 {2 L6 X( A
- #include <linux/sysctl.h>2 n) b( Y H6 F
- #include <linux/mm.h>: A) }' R9 x5 q( g# B
- #include <linux/dma-mapping.h>& w+ x" `' L+ `# _4 _/ g
- 1 b2 x1 v' `2 w1 J
- #include <mach/memory.h>- o% N% B& ^. p: @4 Y
- #include <mach/hardware.h>- ?( d, E$ K# h y7 z7 ^4 d( {
- #include <mach/irqs.h>, o8 g7 s% e8 H! ~# h* V
- #include <asm/hardware/edma.h>- C. i/ V. I/ ]
- / e7 `( o4 j! }+ M* ]5 H2 t: y
- #undef EDMA3_DEBUG
0 F& Z0 B2 W/ V4 _& r" J4 { - /*#define EDMA3_DEBUG*/: b+ h9 B5 k! W6 a# a6 _) [& ~- `
" H) L7 y% S: K/ D- #ifdef EDMA3_DEBUG/ ?, J$ Y6 e' [" }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. d& I: j6 U' [4 M* R, O7 t; ~8 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ o: }" F( p: r4 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( f" B* a& I0 u$ B
- #else
& `- U7 i* n& f, p; [5 A% E - #define DMA_PRINTK( x... )
! X ?- J8 i9 D! ^! I - #define DMA_FN_IN, t) ~- T1 }! N$ W3 ^* |0 T3 a
- #define DMA_FN_OUT
) ?9 e6 Z: `& K4 } - #endif
7 D+ f4 @: i) P
6 I( L: U/ B* V% _, m7 M0 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768); h9 @, Y* _7 @" Y9 i' R
- #define STATIC_SHIFT 31 R2 t& ~& b- d" K2 V: {& K
- #define TCINTEN_SHIFT 20
% O! c# C0 k+ p: k* S! a' U - #define ITCINTEN_SHIFT 21
" J3 K: B/ h5 u* ~# [ - #define TCCHEN_SHIFT 22: y, |, H" a1 t/ O, Q1 X
- #define ITCCHEN_SHIFT 23+ p) ^" } R. m
' f6 s, _: H) C1 p' ~0 C' Q B' E- static volatile int irqraised1 = 0;' z; T) Q* Q( k# B6 v& `# N
- static volatile int irqraised2 = 0;, _/ I+ A, ^ D& u$ Z" C
- , s2 E* E' H- S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h1 ^9 a% O/ ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); X J1 p9 w; g; Y3 A9 ?: O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 E4 k9 X6 c2 K. O/ R
- ' A; L% X" A# q& y/ g
- dma_addr_t dmaphyssrc1 = 0;
6 S/ \4 f" e% {% ^ - dma_addr_t dmaphyssrc2 = 0;
0 O6 X) p$ N3 M - dma_addr_t dmaphysdest1 = 0;9 x, V/ |0 ~5 S0 `# G
- dma_addr_t dmaphysdest2 = 0;2 W, y, G( ~* T
- 1 N& d4 ?% M4 n( N% o9 U" _0 `2 i
- char *dmabufsrc1 = NULL;
( F# R- d! Q7 l0 D0 v4 u$ r - char *dmabufsrc2 = NULL;% [7 C/ B' q z; `, r2 y% M. W
- char *dmabufdest1 = NULL;3 M1 _9 ^) _' m$ V
- char *dmabufdest2 = NULL;
3 l* r5 \4 H1 x
/ ?6 [* O6 S, u4 F8 L9 i& z0 ~- static int acnt = 512;& {8 Q0 J, }3 A1 m
- static int bcnt = 8;
! [9 k2 N: X) N5 q: N - static int ccnt = 8;- W2 @# G- j+ n/ Q2 u `
- 8 i" W1 v* R. P) S
- module_param(acnt, int, S_IRUGO);( d( o: W, e# m& v: \+ @
- module_param(bcnt, int, S_IRUGO);: j9 q8 x' I9 L2 @( v
- module_param(ccnt, int, S_IRUGO);
复制代码 / t' X/ l9 a% K0 D4 A
6 L& {0 L1 @# c+ T+ m/ d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& c. r4 F B1 \$ K. _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 s# {* Q" L2 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" M3 U& x: w1 w; C' p0 J s C# B# u! M6 S
" |8 w3 z. R- N1 z$ r |
|