|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ P1 f' h0 J. H1 d- [code]EDMA sample test application
) J& u) Z' Q: G, G) r! b3 [ - /*
7 W; }' g( H7 I - * edma_test.c
1 Q1 M% c% k+ i u9 A, P5 D - *
6 Y9 @/ T. v2 Z& L4 L& g9 B - * brief EDMA3 Test Application$ X" x5 _2 d2 Q. ~, q5 D
- ** h" U( f4 H0 a" S
- * This file contains EDMA3 Test code.
+ e: f0 {! N. F# B4 E1 u - *
; G" {% V3 v8 y( T- s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 V/ E( T0 }; _; J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. g3 B# ]4 P8 p% N' E5 {: M+ H+ @4 S
- * TO CHANGE.9 z# X8 |" J D. A0 u
- *% _) [2 T8 F& T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: |8 h1 G& {& x% q' Z* x
- *9 T: J8 K: I* }% {' H+ {# V; D. u
- * This program is free software; you can redistribute it and/or
; ~0 `0 X& m3 h9 c - * modify it under the terms of the GNU General Public License as t6 h% W8 \$ f4 Q" d, ?
- * published by the Free Software Foundation version 2.
- o9 ~) Q7 o2 |: m7 S+ S6 N - *
9 F2 c+ P$ b. p! |4 \$ e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O$ ?' e' t% z6 X0 ^7 B" n8 A
- * kind, whether express or implied; without even the implied warranty
# I2 ~ D. [1 k. Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' J3 }; q+ d6 ` T% t - * GNU General Public License for more details.* P; i# t8 f/ @8 S/ c8 H a
- */
6 s$ ?" m) _4 J& M4 n4 H - 1 r% k7 c; K. D X9 ~
- #include <linux/module.h>
1 N9 V* J5 p/ R0 [! w- }7 A - #include <linux/init.h>
; [9 f+ k+ f7 c - #include <linux/errno.h>
- F1 c. ^$ X$ E+ h - #include <linux/types.h>. s/ Z K( [: @& [
- #include <linux/interrupt.h>
/ Q' f. l' X: p: G6 K - #include <asm/io.h>
+ t0 a: v3 G N& S+ x' ^8 D - #include <linux/moduleparam.h>" X( l" f" W) d! ^: y
- #include <linux/sysctl.h>
' ?7 y. t( A2 {% O1 o - #include <linux/mm.h>7 k! d# S9 ?6 [! b( @4 @
- #include <linux/dma-mapping.h>. m. F$ J4 z% i/ V% s. B) |
# |0 x; t) ^, n; r) i [- #include <mach/memory.h>
* d( g/ C# c: \" a+ w - #include <mach/hardware.h>9 F2 H1 K3 F2 P5 {
- #include <mach/irqs.h>. F) k% R# Y" q
- #include <asm/hardware/edma.h>
, ~2 x6 z6 k( B5 }* F9 ]5 F# @ - ( m, ~ T% b6 }5 g3 m+ x* C( m
- #undef EDMA3_DEBUG
) a; Z& y. [) x! g# `( x - /*#define EDMA3_DEBUG*/
( K( u2 }& q& k& Y" b9 Q+ e6 N; W
( F/ _9 T" E4 N# z' F) u3 W8 W- #ifdef EDMA3_DEBUG8 J# ~. D, Z# j8 v, M; H, U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% Z" D9 w: W+ B6 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" k: X p7 V8 z: i& W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 b! B6 _: f1 X* O# c" T9 y
- #else
8 j' d1 O. r6 N6 `; J7 _, S E - #define DMA_PRINTK( x... )% \3 F7 A8 x5 e. D6 x! T& c' W4 K3 w
- #define DMA_FN_IN) J& c% A) e% C, v) ]& Y
- #define DMA_FN_OUT
: H, {$ q. Q% ?: }- N6 j ~0 j - #endif- t! m. F& u# Z4 V
8 A2 L) w: g# B% a% n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 Q+ |/ Z3 O* N' [. f
- #define STATIC_SHIFT 3* m, X9 M" b2 q
- #define TCINTEN_SHIFT 20* p1 M( K* x1 e0 b$ Q& j+ l! z
- #define ITCINTEN_SHIFT 21 b+ ~2 F: j G/ W F3 k) Z* U/ ]
- #define TCCHEN_SHIFT 22* a$ s6 j0 \) P2 g. l0 o# _6 {
- #define ITCCHEN_SHIFT 23
( a* ~! d' }8 z0 L# U( Y u
. l. x) T2 R$ P6 ` c5 N- static volatile int irqraised1 = 0;
, t s2 y* n0 ?3 H: T. s - static volatile int irqraised2 = 0;/ Z1 s' Z! z: d/ o, a& {
+ o* b" k; l" L" H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y9 k# f8 L: K7 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ?" x6 [5 j7 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! e# j' ~$ S6 \3 s5 n - # a: ]3 w+ k: o4 M8 \. J
- dma_addr_t dmaphyssrc1 = 0;8 J% I @/ q/ Q4 p
- dma_addr_t dmaphyssrc2 = 0;3 z6 I: i |, [2 Z: a" q
- dma_addr_t dmaphysdest1 = 0;
, \- y( Z" u4 _ - dma_addr_t dmaphysdest2 = 0;
7 A. E9 H/ Q9 o9 M( r6 P/ e0 U6 I
6 V1 z- r! [- a0 ?- char *dmabufsrc1 = NULL;
1 ^# H: b2 R) g$ g7 a - char *dmabufsrc2 = NULL;
# `3 y4 b# `1 B. H0 w - char *dmabufdest1 = NULL;
$ M/ m5 O7 r- m+ e7 B! P* N8 q8 \( c - char *dmabufdest2 = NULL;/ r( o! a4 }# _- h. {
; a, r% j: z, t# b/ U2 x/ w! c8 b- static int acnt = 512;8 i% ^5 I6 N& z; e& P- {
- static int bcnt = 8;+ S" {5 K- b) c7 T! Y
- static int ccnt = 8;
, P# j6 Z% [) w+ ?, V - 5 d/ }% H: s+ [$ t+ F# E' @! D3 g
- module_param(acnt, int, S_IRUGO);5 Q6 w) a. S" C3 g/ s# H- s3 h8 F
- module_param(bcnt, int, S_IRUGO);
3 J( l9 B8 @, I/ |: }" `0 T - module_param(ccnt, int, S_IRUGO);
复制代码 ( U4 ^: t7 k- `* k
; c- }) ]& V8 C, G# L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! G7 `6 {, K. ]' H% x& }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 p6 f3 Q; Q9 k5 _7 n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" T) K. C: Z) _. \' L9 Z2 A* T
. ^) J1 w/ w% F& x9 t/ ^( V w) H7 Z) V, {/ n
|
|