|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # z v7 z e7 Y. m5 c0 ^* o) z
- [code]EDMA sample test application! f7 U, M! u8 S
- /*' ]$ W V u% @* o9 i8 M/ v
- * edma_test.c$ f4 s7 V; U3 x+ n2 _* F
- *
: h- n( d" D: i$ f - * brief EDMA3 Test Application
6 Z4 Q; |% Y# H# A, h - *' e ` A/ M" ^: `8 C% a
- * This file contains EDMA3 Test code.1 `& r2 l' Y; k( R) U
- *( f! R: `- ?" a# k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 I( c3 R D+ s6 d9 W. @5 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( L4 U/ `$ b: R% { - * TO CHANGE.: h3 X; Q: P* g N4 r, ^
- * k+ e% p- V# m; ]4 n3 W; w1 T; P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; a: E- p. }1 O. u/ k# K
- *2 K4 Z9 @0 d* j* ^9 Q1 Q f! H
- * This program is free software; you can redistribute it and/or9 I' M7 ?' q- V# @9 H# `( y5 W
- * modify it under the terms of the GNU General Public License as; E: U5 i Y$ @; J$ \/ V
- * published by the Free Software Foundation version 2.& t; H; {3 o7 h1 z
- *
4 a& A5 N0 }; |: T' y' E' `: P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 o+ u! d) f# V5 H, _+ ~. g) E
- * kind, whether express or implied; without even the implied warranty V9 H* L' R7 R0 O, [8 b, ?5 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' l5 A) }+ _ s - * GNU General Public License for more details.
& { P" R8 e. ? - */7 [9 j* z+ z X( w9 L) ~
- g" P( D$ e! w0 V- #include <linux/module.h>) P8 Y8 M$ `" C! {# C! `) T1 E! d
- #include <linux/init.h>; o; q6 z7 I/ b; ~* z
- #include <linux/errno.h>2 \9 f( R3 a) w
- #include <linux/types.h>
5 c! g. N0 U% Y6 r4 V - #include <linux/interrupt.h>
! T0 `. |+ F2 c ~ - #include <asm/io.h>
/ \' z5 t. W* y7 b0 @1 m - #include <linux/moduleparam.h>
0 }1 y) X; q1 W, @" l* i - #include <linux/sysctl.h> `0 j5 l' W I7 C) e
- #include <linux/mm.h>" p0 ` ]1 b5 G$ W% k/ ]' `6 r! o" q
- #include <linux/dma-mapping.h>; q" w8 g, k6 u. }, U/ N
1 @2 M0 g. V5 @" x2 `- #include <mach/memory.h>
5 m# y( w I! U, p - #include <mach/hardware.h>
2 p+ _" c6 T; w" M/ ?1 E6 _$ x - #include <mach/irqs.h>6 `# F6 j- c2 D* x+ Z
- #include <asm/hardware/edma.h>
2 {. n- g7 c+ `7 n9 Q( V) n; }' t! h
8 W( r4 N& i C6 w, g' a0 O) c( G- #undef EDMA3_DEBUG; Q/ a2 G S& y; q0 V$ x. n& j
- /*#define EDMA3_DEBUG*/
% U# k. @+ q- z9 c
0 x. Q9 J+ s2 s; R- #ifdef EDMA3_DEBUG
2 o. @8 f+ N3 d+ Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 P( _: {9 n/ W' ~8 F. @; y _- Q" { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ _! v Q' @% h& q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- w4 R+ V5 Y: a - #else
# k; x( m0 P+ B [7 Q8 @ - #define DMA_PRINTK( x... )* U) B% R4 x- ^
- #define DMA_FN_IN, d! W+ p5 h7 C- T& R M# h
- #define DMA_FN_OUT
2 a) ?1 x1 H! o, \; j' l1 X - #endif
8 q3 p6 D! V+ }3 V7 k3 D - 9 Y; [) X; e* Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 o& h; ]$ j2 @" K; r& d" S P& F
- #define STATIC_SHIFT 3
9 s7 T1 N" B: \+ S0 U8 W# z - #define TCINTEN_SHIFT 204 R3 L$ h; X# e! X
- #define ITCINTEN_SHIFT 21
' V+ X9 r$ u4 @. x" Y1 Z - #define TCCHEN_SHIFT 220 v* o+ V5 M* \/ ~1 ^# u
- #define ITCCHEN_SHIFT 235 ?" U& u% j3 s$ I" C
0 W" {2 x' Z. ~- static volatile int irqraised1 = 0;7 H/ M5 T1 C8 X2 L2 f1 |
- static volatile int irqraised2 = 0;* H& \: A, k' F4 k6 V( [1 j- K3 [
2 i" |( M) k; D u% ?# A+ z5 C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* O( Z2 X0 m Z) t1 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( K% g& r" \0 K9 _# v$ E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- |1 O r: x. c" F, T# p
: J2 X* m' }8 J9 ^/ \- dma_addr_t dmaphyssrc1 = 0;
' w w* s3 E& m0 [/ T" ?# ~( D" ]1 E - dma_addr_t dmaphyssrc2 = 0;% f" n* Y, `7 @5 u, a' M
- dma_addr_t dmaphysdest1 = 0;) m5 z1 [9 D/ W: _5 g
- dma_addr_t dmaphysdest2 = 0;5 ^) y4 _1 U; e: R; l% y1 v/ [% G
; h3 h2 t6 G$ A4 q: _- char *dmabufsrc1 = NULL;
8 J1 e6 e& g5 q$ v" B - char *dmabufsrc2 = NULL;
6 N. |4 r8 D2 a9 p" U' V - char *dmabufdest1 = NULL;8 Q. R7 l3 l; W4 D+ G4 \. {
- char *dmabufdest2 = NULL;1 c/ e2 ^# A8 j) q J
- . Q/ I, r6 z9 L: i& i4 ^5 ?
- static int acnt = 512;+ U0 t9 A+ S0 A5 T9 p
- static int bcnt = 8;
1 S2 t9 C3 \6 z+ K- _5 g - static int ccnt = 8;
. O7 _% V; X7 j& {+ z7 |( Z4 A
$ C) J r$ e1 G. T& A- module_param(acnt, int, S_IRUGO);
, T- |* C) \4 X- K/ c - module_param(bcnt, int, S_IRUGO);
- s5 Z. }3 g% T( l - module_param(ccnt, int, S_IRUGO);
复制代码
6 P" L/ {+ t; I: v' i3 _) P7 ?' s+ P; e2 N7 r7 U4 f0 H3 @, G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' S- n, O4 f5 D, M0 m! a' ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 _* d4 p1 O: [! l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" u' Y2 K5 I& g
/ x' C" z3 V- F2 g' J
: D. u1 V; c! ~& ~9 Z( O |
|