|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! @ a2 C/ ]# W2 w" {0 k* x6 j" f; @
- [code]EDMA sample test application# z4 {7 k6 ^2 N+ f
- /** i, s* p) G+ q" |5 D' d; i
- * edma_test.c# X X: p$ \; q2 s2 i) m
- *. n) X+ k c- C" ?% ?' ~& ~% @# x
- * brief EDMA3 Test Application5 D, b! w5 L- H4 v+ J9 |( ~
- *
2 p, u; e, s2 s" T( t - * This file contains EDMA3 Test code.
( |9 e; D* w/ J9 K6 k - *2 p& q* k* }4 c( a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ W8 n1 S$ d& {9 h) | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# w0 I' x" {$ h V# o; }; M
- * TO CHANGE.
8 x) f( \: q5 `7 |' c - *
& O1 \2 ^3 Z9 z/ L& z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, F; ]2 J2 y w O( f8 E x - *
2 _9 O' o( @0 P5 i7 c3 s - * This program is free software; you can redistribute it and/or& P6 D' N) h$ M! H; v
- * modify it under the terms of the GNU General Public License as) s& e4 j( B& O5 l# @
- * published by the Free Software Foundation version 2.
& D+ X9 S9 p! z$ t - *
# h7 I" I- k9 j8 i C! c7 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 W) @5 ^2 }$ k- f - * kind, whether express or implied; without even the implied warranty
; T2 g! R3 G8 q# V. b& n* T J9 b8 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 }0 N8 e7 v) ?$ G" D4 ~ - * GNU General Public License for more details.
3 k% m. g" `7 g; X' V2 ^3 A - */
# g$ ?# j, h) C3 `4 ~2 E - & j% E3 `# y5 ^. a8 Y3 L
- #include <linux/module.h>$ C7 Y2 H" j) _
- #include <linux/init.h>
- j A6 o( R, T" F2 A$ G1 u - #include <linux/errno.h>( A i, f0 p4 o) |1 r2 b
- #include <linux/types.h>" Y" Q1 {3 w' F1 u
- #include <linux/interrupt.h>
; r" c1 D1 p3 ] - #include <asm/io.h>
+ Q6 f S- p. [: F# v) j - #include <linux/moduleparam.h>* ?2 G" ^0 l: u* r6 A
- #include <linux/sysctl.h>
}8 S# y; d6 ^- ~ - #include <linux/mm.h>1 T/ ^, B$ ^2 h& T& ]
- #include <linux/dma-mapping.h>6 T- [: g* F, {# Y! x* M7 f# G+ D
& t7 c4 l; h3 ~8 b8 U/ W6 b, x- #include <mach/memory.h>
6 a# Z# e' I8 ~; Q" m* H) _ - #include <mach/hardware.h>; N+ l/ {& v9 j9 l! z, ~8 M
- #include <mach/irqs.h>
7 g0 I, G6 X [ - #include <asm/hardware/edma.h>3 N* K6 G6 t3 O$ d C
- 6 y& C) Q& F/ x3 l; w2 D v
- #undef EDMA3_DEBUG' P' x" O K: k2 c6 u" }
- /*#define EDMA3_DEBUG*/
9 s( j9 @( ^3 h( A5 U - ; ?) X [. f+ `
- #ifdef EDMA3_DEBUG5 i. v4 ~ _9 w# M1 l" Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( s" ?8 t- W& E; J( i' J6 k ~8 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 {. B' v3 g, t. C" ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ o" l- _- c# c. s - #else5 q9 T% P9 E4 L4 @/ B% W
- #define DMA_PRINTK( x... )
9 a$ U$ I+ G& p' G3 D* i" T - #define DMA_FN_IN& a% k q, L; ]; F( m( a& M) n5 e
- #define DMA_FN_OUT# G8 X6 b6 j ^! i& l
- #endif" @& h, F6 j3 L8 \9 x5 `' @) T, y8 e% G
- % \; B) b% T9 k/ m# E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" \: ?! u4 h& i! H, ~ - #define STATIC_SHIFT 3* [, W5 B; {9 f0 n
- #define TCINTEN_SHIFT 20
4 ~0 H7 o! ]) Z+ o - #define ITCINTEN_SHIFT 213 T2 |. D1 |# g! h4 R
- #define TCCHEN_SHIFT 22
1 t; b+ `7 u0 X( v4 u - #define ITCCHEN_SHIFT 23& E2 h3 E" p; ^( L! f3 P
- 2 v! O& a0 r5 t6 c
- static volatile int irqraised1 = 0;
' n9 P( Y7 g i s8 E7 h x+ j9 A - static volatile int irqraised2 = 0; u- I2 O5 y6 B/ T0 h
& T3 W' ~5 ? ^6 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k7 ]" C/ p( {+ y/ D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T$ t9 F* Y4 p/ m4 S' ^. v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 r6 U3 c" ~& N/ d! u8 X F
- " P7 Z5 ~# a ~' s
- dma_addr_t dmaphyssrc1 = 0;8 Y1 c1 E0 c t- h, S5 ]
- dma_addr_t dmaphyssrc2 = 0;
B, |7 ~( k g - dma_addr_t dmaphysdest1 = 0;
2 b! Z% @2 n0 Z9 K% o - dma_addr_t dmaphysdest2 = 0;
! A, u/ ^" I/ e% ] - 4 K% N7 k9 F2 X( U2 p; f/ w. ]
- char *dmabufsrc1 = NULL;
3 M+ ?: h# _- _& H - char *dmabufsrc2 = NULL;8 E! O7 E, b8 z- e) o2 B d6 E
- char *dmabufdest1 = NULL;# D: E) R- H; L( k' Y
- char *dmabufdest2 = NULL;- X5 J2 V, R8 x+ L3 _$ L) d
- 2 W% c! F$ j& M- s7 R% K" `
- static int acnt = 512;+ f6 H( n8 t/ k; Q+ q) ?
- static int bcnt = 8;7 O! i& [; ?) Q' W
- static int ccnt = 8;" p& Y/ ]* @& k
- - M( e+ W6 \3 Q3 y. A
- module_param(acnt, int, S_IRUGO);
/ {5 J3 S* W7 S; c - module_param(bcnt, int, S_IRUGO);
) v6 I( v3 z( ]$ d6 t' i- F - module_param(ccnt, int, S_IRUGO);
复制代码 2 F G6 N5 E- \
" r G' n A1 y2 I/ Q6 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% v. X8 u4 S9 A. [, ~$ ^5 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% }( G7 f5 I# y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% S% z, Z2 J7 D8 j
+ H" p9 K7 u, l: c `1 `2 l; J5 Q ], O
|
|