|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# Y0 J+ }" x( \9 @' ~8 h; q( r- [code]EDMA sample test application# C4 @/ a, J) M
- /*
* T* k4 H8 t* [: W! K. L) ] - * edma_test.c
" o; f+ p! [' A4 d ? - *+ L) u, F3 J) B5 y2 e
- * brief EDMA3 Test Application' U! N1 q2 {$ f3 k$ C/ H3 u: i
- *
& F; q5 p7 R- K+ t7 ]: X8 J - * This file contains EDMA3 Test code.
6 M2 X7 |1 A/ _# t3 _ - *. Y9 j! f" [+ U: i2 e, g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE @3 \2 r! P- c8 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# [' l; g) V, {0 M$ N$ n2 h4 u - * TO CHANGE.3 r1 C: y. U& `7 P! W- {; ?8 G6 p3 }
- *7 t3 h) S) I7 [: G% f* z/ T6 w" A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Q' N0 V' j+ z" a7 o
- *
, H$ I# Y* u( L5 F. Z7 w - * This program is free software; you can redistribute it and/or
: L+ Y8 t- E; K0 A4 w" |5 ~ - * modify it under the terms of the GNU General Public License as
- T# {+ _5 T4 W+ N3 b% l - * published by the Free Software Foundation version 2.
. o2 ~: B, Z( n8 h5 l/ g - *5 I, Q$ }# T6 Q( ~. Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" P! l: R1 Y2 b% B0 O( T1 N - * kind, whether express or implied; without even the implied warranty; t# @/ \" ^7 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ N2 z* q4 j( a; c9 W7 F/ |- e - * GNU General Public License for more details.
r; R9 I& s4 H t - */1 z- c6 ^2 u1 L+ {( c$ H% {
) f; w, o" P7 f$ I- #include <linux/module.h>
& h- N2 ^# w' d8 @1 | - #include <linux/init.h>5 ?2 ?) W; o% H, c
- #include <linux/errno.h>
: A) c# H& \+ G( d - #include <linux/types.h>' Y: E4 o' Y( M; o: g; j0 y
- #include <linux/interrupt.h>
! a2 S" x9 N t! Y# q - #include <asm/io.h>* E0 N% C( U/ ?' }* H; m/ U; s) S2 ^
- #include <linux/moduleparam.h>
2 d6 ?# D$ c$ n) V - #include <linux/sysctl.h>6 Z( A: N& g [9 V8 }9 m; w
- #include <linux/mm.h>2 B3 n t: l2 p5 U/ Q4 P- P
- #include <linux/dma-mapping.h>
4 G0 F" H3 P7 o; G7 y8 \- s - # k' Q5 |- J) f- L' V6 P% O
- #include <mach/memory.h>5 g% P9 F2 w9 t) O1 ?9 i
- #include <mach/hardware.h>
2 q( j% t, q7 x/ f1 \) u6 e2 ^9 e - #include <mach/irqs.h>
6 J+ f# o& D# W; M6 P - #include <asm/hardware/edma.h>: o& m) G" ?0 W+ q& L2 ^2 l! W
- ; z" Y9 ?( B: \( E# T
- #undef EDMA3_DEBUG
& O. S: @. a2 h0 W - /*#define EDMA3_DEBUG*/1 o- e& e4 _3 H& |; W7 ?2 ~
- v$ i# M! x' u! }. M' h- #ifdef EDMA3_DEBUG, x9 J3 T9 k% O# y% I2 f8 }* U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f5 Y' I" ~$ W/ Q' O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 S' A5 r* C# Q0 U% \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 }- a8 V( I- J. q! u# O4 E1 J( a
- #else6 J( @1 R/ L- r5 \/ Y# ]* T+ r5 n
- #define DMA_PRINTK( x... )
$ T! C. e6 E4 n - #define DMA_FN_IN
3 i9 \' {9 q G2 j x) w6 B7 x - #define DMA_FN_OUT/ V9 E+ N/ S+ K1 I/ r
- #endif
/ n9 G# [- ~) a) Z% k0 h! k
1 q) e- c0 m R( V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 p. {) {/ I) v! W# T
- #define STATIC_SHIFT 3# ~5 V8 B% }) e1 }; e3 N
- #define TCINTEN_SHIFT 20" d. |" d0 s" {$ T) c# x
- #define ITCINTEN_SHIFT 215 Z8 Y$ @1 E$ C
- #define TCCHEN_SHIFT 223 U' A7 b! l& A0 F( p3 _" F# o. d: L
- #define ITCCHEN_SHIFT 23
" z' c; R# C/ Z+ g0 ?" T9 i# S
* D* u" p z. e }" i4 R9 V! b- static volatile int irqraised1 = 0;
@% y" K7 [! @ - static volatile int irqraised2 = 0;
" V4 ^' G3 o# f( F0 Q
1 _5 k/ ]/ W( }2 i# t. L3 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J6 @9 B1 n+ G- }" V6 Y7 r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# b9 H8 V& l7 }5 H' V2 ~) h' u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B( x } t( i0 M! [
3 Z* I( ~& Z3 L- dma_addr_t dmaphyssrc1 = 0;3 U( N4 X) W- V. ]4 }
- dma_addr_t dmaphyssrc2 = 0;! E1 w9 n9 v' ^
- dma_addr_t dmaphysdest1 = 0;: V; m, ^ i, v: S' q+ i8 ]% D" @
- dma_addr_t dmaphysdest2 = 0;) q' `& ?1 a" [7 C
- 6 k7 W; E; l+ l; `8 {
- char *dmabufsrc1 = NULL; m) ~8 b; ^. Z8 |" e
- char *dmabufsrc2 = NULL;
. S6 L! L- j; s- n; B2 ~7 _6 S - char *dmabufdest1 = NULL;
0 g8 t, t+ i; s: \/ `( s p( }2 u - char *dmabufdest2 = NULL;3 X; |; `& u5 B6 Q
- 3 ~, f& B0 L) W& c9 C6 Y) W
- static int acnt = 512;
0 C6 {) d* B. v* {2 ^ - static int bcnt = 8;6 r+ W/ h: X2 t3 y- N
- static int ccnt = 8;$ T+ \! I1 k! Y8 J, z: T0 V
- 9 J3 f$ t; `* r; [ K
- module_param(acnt, int, S_IRUGO);/ H- h( J; v& i
- module_param(bcnt, int, S_IRUGO);7 ]9 J V) ]4 J$ v; \2 A5 q
- module_param(ccnt, int, S_IRUGO);
复制代码 0 E, S. h1 i8 l' C
" i: w; [. @- J2 L7 P# e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 C/ W, C* a7 I" j# {) W4 ]% m% \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; R. M/ j+ G2 s1 M2 n+ ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G& u- `* a, Z( F X0 L1 Z
( \6 p: n. y& J7 \$ ~
; ~- M/ N. r2 E8 L |
|