|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ ^ E. i6 d3 s" s7 N) |% m# G- [code]EDMA sample test application
7 S" {, a1 p/ y4 t - /*" A& E- U2 B& k( g3 P; d% M- f
- * edma_test.c! A( K$ }4 [, o% n. x
- *
: G1 S/ M+ z/ B - * brief EDMA3 Test Application
1 v* M( X; J0 P. O, v - *( C9 n) S7 b3 h$ C/ c) Q
- * This file contains EDMA3 Test code.
2 j4 Q0 o# F6 `4 }! T - *
: k# a" Z8 n& ^. K* m# e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 U2 k7 \/ Y1 G5 _ u" d5 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 ^4 Q" j' c8 l' v6 ]' X: R - * TO CHANGE.
9 b; f. e; ^( J) o. u0 s - *
1 k9 d, j8 C) A0 j; ~' I! F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. x. c+ A& D) C6 _' K X* }
- *0 G9 `, D, B! m7 h0 c6 Q* E: }" z. _" W
- * This program is free software; you can redistribute it and/or
; b7 a2 `' f) h) D" O - * modify it under the terms of the GNU General Public License as( _6 O: `- j* C& u9 I2 n' n
- * published by the Free Software Foundation version 2.
# f2 |7 w1 K7 l. a: V+ A+ R; D - *7 s }# K( I" |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 u3 @- i) D; j6 z9 i3 }* L
- * kind, whether express or implied; without even the implied warranty
4 }) g4 M' \$ s* ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 r- v) j0 I; Q - * GNU General Public License for more details.. x7 d) b) Q0 T/ E! A
- */
: w: Q# V1 Z$ G7 Y
8 r% a3 Y0 k7 X: r4 P- #include <linux/module.h>7 ]8 C5 K7 s4 _) \- a" D
- #include <linux/init.h>
8 J8 n3 ^& C3 ~* F: r- A/ N7 V5 w - #include <linux/errno.h>
: y" {3 ]8 p/ G6 v - #include <linux/types.h>
& R1 K' ]! }. o: o: W+ |/ b - #include <linux/interrupt.h>
$ `/ e1 D% Q+ {! x) V1 n; T' M - #include <asm/io.h>2 f7 @& R& |0 `! C: ~ J+ q
- #include <linux/moduleparam.h>) c& s+ O4 I2 F/ x+ a$ _& n
- #include <linux/sysctl.h>% w6 r: ~- K8 v& W" ]- F1 y
- #include <linux/mm.h>2 S1 D! h2 m9 u# i7 d& x, P
- #include <linux/dma-mapping.h>
9 H9 ~" s: g0 F Z
6 W! L/ g6 C3 _" o( J3 Y4 x- #include <mach/memory.h>! e: H! S: u2 d+ T+ _' k& _7 p
- #include <mach/hardware.h>
$ a8 b/ X0 b6 J [+ p0 r - #include <mach/irqs.h>
/ e | Y8 r' g; W( ~% K - #include <asm/hardware/edma.h>
, ^# d. O$ Q& l. y9 Z3 A - 9 \0 \! T7 c A4 L
- #undef EDMA3_DEBUG
; X0 ~5 F7 F/ m* V+ `5 b - /*#define EDMA3_DEBUG*/
2 k8 {* U- `0 D3 J0 B
3 |4 C: u7 `0 H7 o; ^# \' K" m- #ifdef EDMA3_DEBUG
2 n/ i$ H: n/ s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 q) ?* P; w4 {( N5 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( n# T( A3 Y7 P, y/ A5 g6 S) {9 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ o$ d, G ]1 } V: u3 z1 t - #else
0 ~7 R1 }( V4 s - #define DMA_PRINTK( x... )$ Y% b/ H5 ~2 c: N c/ ?
- #define DMA_FN_IN
! f' k4 h6 [: U0 f, ` - #define DMA_FN_OUT: p" q% j+ _# ]6 M$ }
- #endif O8 j4 Q' u. B: g' w3 _. d
- ) ]* X! ]6 Y. |* `9 s2 V8 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 E5 ~: @ }2 u4 o8 w
- #define STATIC_SHIFT 37 Q/ V) c5 v" g3 H5 B: H8 @
- #define TCINTEN_SHIFT 20; }' j6 D) b! M: ]# T
- #define ITCINTEN_SHIFT 21# w: H8 g$ ^. u5 N9 t5 ^* N! m: i4 q
- #define TCCHEN_SHIFT 223 s: t t' ]- G% V
- #define ITCCHEN_SHIFT 23
_$ h- i. }# S5 E7 s - 7 j3 v! [! Z( o& h
- static volatile int irqraised1 = 0;# V. B2 |9 ?7 L- G/ U3 j$ [' s7 I
- static volatile int irqraised2 = 0;1 l9 Z# i, f- O: X
6 K( P$ n0 t/ y- q" f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l. q8 }# V2 g0 y/ `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; M8 g C0 H: S1 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ~2 F6 r! ^$ [) n8 b- m# z - 4 Y# U/ K9 S2 w3 a& ]
- dma_addr_t dmaphyssrc1 = 0;0 k2 t+ A9 T8 I' i2 j4 Y
- dma_addr_t dmaphyssrc2 = 0;& \4 i2 u4 A J6 R
- dma_addr_t dmaphysdest1 = 0;
4 ^4 t% N0 M& J3 Z/ `4 G* b8 m - dma_addr_t dmaphysdest2 = 0;: H0 O5 U: ]! O- {
- $ L2 a' C; k' E. i9 E: ^
- char *dmabufsrc1 = NULL;1 s v8 |! h) J% E9 y4 ?3 H; J+ l
- char *dmabufsrc2 = NULL;
4 k. ?% X7 J8 p/ v' Q4 c8 z: ` - char *dmabufdest1 = NULL;
& }" }) E% C) | - char *dmabufdest2 = NULL;5 t6 Q% j( f7 Z, e3 m0 w# p# F& R- U
- 7 H( u6 j8 M7 w" Z( \% F
- static int acnt = 512;2 D4 L {4 C; m `" f" Z
- static int bcnt = 8;, q4 \3 Q1 f" A
- static int ccnt = 8;
/ G( |6 ?. }0 K0 C& E/ x E
L0 }" ? ?) |% v$ J& K* y, f; P- module_param(acnt, int, S_IRUGO);" o# F: Y3 L _$ ~/ a* `
- module_param(bcnt, int, S_IRUGO);- s* p7 e( K7 | Q% G) T
- module_param(ccnt, int, S_IRUGO);
复制代码 0 F: @' T* g" ~$ p M
, U( B' w3 w, }' f! I2 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N8 a& [. ^# r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: k3 v. J/ z# A% ?. q5 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j* k7 I2 |( J( w/ U* U' ^0 \. T# \9 c" ^
8 p% R Z' T0 x! c2 @3 \: s
|
|