|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - w! Y2 {. r! u B" k4 A
- [code]EDMA sample test application
3 L% b2 w4 R4 R" y+ @ - /*0 J: }9 {# _3 R% R$ O" h
- * edma_test.c1 v9 g! X$ W/ s( U# G6 v
- *
' C( j6 x9 s' ]; g4 _5 J% D2 D* p - * brief EDMA3 Test Application+ L3 m; ?# a. N/ r0 A' D, X
- *
. X8 B( {) t0 H7 I" w8 _: ]; s - * This file contains EDMA3 Test code.
4 C/ t1 O2 C4 v9 [& V - *
0 i" r: K8 Q/ p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ w; A) t; Z3 _) r8 [! A$ v- f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! W7 s* W5 B' E& ^ - * TO CHANGE.
& \7 n! z+ u! z" \3 M - *
+ w. L/ g4 L f' i+ y: A5 I0 c' A& } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ {3 Z% S, d# S) V6 [! m
- *
# g3 n# g* b! l6 A6 `* @+ |" B - * This program is free software; you can redistribute it and/or `* O4 Z* a, K D
- * modify it under the terms of the GNU General Public License as
1 N+ T# z" k! p( w - * published by the Free Software Foundation version 2., U) E% E/ h# B
- ** l5 X* s% R8 Q2 P) X7 O- N) s# S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 @+ i$ B+ C! X: d - * kind, whether express or implied; without even the implied warranty
% V/ A- M- F4 w! ~. ?3 c: F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: b o" x$ ]$ X1 t
- * GNU General Public License for more details.
; ~- P4 q! A) F; x+ ~% t - */* I( P6 r5 q" c) K7 N
- * }, ^* o2 \3 |9 j6 L8 o
- #include <linux/module.h>6 s c: g8 T8 H1 T
- #include <linux/init.h>
: k' ^/ @+ V; c7 @* h9 t. Q6 ` - #include <linux/errno.h>
$ C& Z, G6 ^ k5 l0 }4 F% ?# X& r - #include <linux/types.h>
1 L+ G: m8 }7 P) {6 t% W4 M - #include <linux/interrupt.h>
# b5 p2 W- }: g - #include <asm/io.h>& P) a9 I3 q9 [6 g8 F
- #include <linux/moduleparam.h>
8 J% \: ?* c7 O - #include <linux/sysctl.h>
. Z/ i0 J r7 c1 }, n8 c - #include <linux/mm.h>4 l/ g: A- }( x" M
- #include <linux/dma-mapping.h>! S" b0 U; f" B W! C, g
- + L2 h z. E+ ~/ Z, A- `9 b
- #include <mach/memory.h>
2 U" m# o$ l N - #include <mach/hardware.h>0 c: r( I8 D! C6 X& j7 \
- #include <mach/irqs.h># l- l5 Z) y7 g0 l( P5 ~- S V& M
- #include <asm/hardware/edma.h>" X+ \: L% Z; h' `8 a$ V$ P8 o& P
- ( y% F: b% \. F& S$ t' l$ s
- #undef EDMA3_DEBUG+ _% {9 b s! [6 ^9 R* K5 @; L& l
- /*#define EDMA3_DEBUG*/: c+ ?. L: d: V
- * h: v# @4 x C+ w" N
- #ifdef EDMA3_DEBUG( X2 T( E1 x% x, Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 @8 M* l+ K4 M* u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" `! X+ q' j' ~, A9 P. [" G- v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 i+ k: M5 m( K1 x
- #else
1 Y' g n4 [0 J- S- m; X% ]$ F5 T - #define DMA_PRINTK( x... )& f* d! q( s- B, D
- #define DMA_FN_IN* X6 H& Q, j* b2 I j6 u0 n+ }( f
- #define DMA_FN_OUT
. S0 r9 U$ ]1 |" F - #endif
& E% X; h4 \. u* M - ; J. h0 l' N, Q. f, q; v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( ]+ p3 [2 ?$ y" P |" k+ g* | - #define STATIC_SHIFT 3& |- G! q. h8 D; ?/ E8 b
- #define TCINTEN_SHIFT 209 x! m+ O) g( |( f
- #define ITCINTEN_SHIFT 21
+ G; I6 T- ]% M# f( V; o - #define TCCHEN_SHIFT 22# k3 A, O. @, I1 c- M
- #define ITCCHEN_SHIFT 23
0 c7 g+ y+ A" ?1 i0 B9 i, y - # B0 [4 d% K( a- y7 D. a
- static volatile int irqraised1 = 0;
' o% B3 g# [+ S! g - static volatile int irqraised2 = 0;
6 F. N# O9 |' s - ; m4 S C: ^8 X. |" W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! f ?* W: p8 R2 f( \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, X' j5 ]: d$ ?1 |$ L) O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" g8 e1 F- g+ F% f9 L
8 t$ ^0 ?) V: j Q0 R% d' c0 O- dma_addr_t dmaphyssrc1 = 0;
, e! t3 D( ?3 g8 [4 \; ^ - dma_addr_t dmaphyssrc2 = 0;( q: X7 n# q4 ?3 N) t
- dma_addr_t dmaphysdest1 = 0;
, O7 S5 Y7 d3 e1 m" Z2 A8 Z: N) I - dma_addr_t dmaphysdest2 = 0;
3 R/ B+ v0 i- _0 s1 f5 C( ?8 k' G - + e# ?; e( @" s$ v
- char *dmabufsrc1 = NULL;4 I/ K* O |1 r8 c; X6 c2 E
- char *dmabufsrc2 = NULL; m" [# T' {' u* o
- char *dmabufdest1 = NULL;
% T' C/ F1 J' y; a" y2 v9 w - char *dmabufdest2 = NULL;4 m- u! N7 N' F0 p, `0 R* ]) w
, }8 I2 T/ M5 l; D$ H" m- static int acnt = 512;
: p# a ^7 x5 J/ w6 e9 T0 o# }2 z _ - static int bcnt = 8;2 f f4 ~* v( `: ~! {& D+ b* M+ @
- static int ccnt = 8;8 o4 }3 P. A% r: U: P# ^
- 5 }+ |6 U) z' @: b
- module_param(acnt, int, S_IRUGO);8 n; \- k4 \2 ]9 u; w$ w$ L5 \
- module_param(bcnt, int, S_IRUGO);
6 Z$ l R& W7 p+ u$ F, x - module_param(ccnt, int, S_IRUGO);
复制代码 * j6 ]% m# l! o: _1 t; |3 n
% B% ~4 m8 ^9 |- Q' z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 e3 D0 }: x. E3 G) P* Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 Y1 h/ I7 s n6 y3 J/ d2 h8 o6 M9 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) U3 Q7 {$ t) a
: l: R* r1 M o: V, @6 J
9 k. s( G. v+ p' X4 V
|
|