|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 i5 E2 `9 M. C7 y5 ?& ?3 Q
- [code]EDMA sample test application# c Q! z5 I" |% J, x& R0 P( Z: Z
- /*
8 R$ t' Q! E. F' p. T+ ^7 v - * edma_test.c
! E4 i+ i* M+ Z+ i$ ^ - *
2 w$ ~# }& L1 s* Y# ~ - * brief EDMA3 Test Application
8 k8 W' d: ]; Y4 k' C2 }) K - *
% _5 B: E2 s4 ?0 y - * This file contains EDMA3 Test code.; s# u) b0 H9 ^! x
- *
! t( Z4 M1 C, e2 n( O" w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! f3 s, j2 B+ @; s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) T- e: |+ n& l& a. ^ - * TO CHANGE.% S1 i: A$ w: Z; e
- *# s$ |# b5 o" h6 K8 w5 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* t% Y* F: w& C& u6 X* z; ~: `2 z - *( k2 r9 a4 {0 T; w( E" a0 K
- * This program is free software; you can redistribute it and/or/ j0 K6 b' j- | ~3 I
- * modify it under the terms of the GNU General Public License as! {; i) y. v a. p- \
- * published by the Free Software Foundation version 2.
- v2 g# Z9 N \* I: f" y - *9 v8 d1 n' X3 d- Q: q$ h& t4 E( ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 E% R$ X. Q/ C/ n. H: \ - * kind, whether express or implied; without even the implied warranty
. w& H8 B1 b4 B2 o- E3 f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ L+ p8 ^7 M$ O
- * GNU General Public License for more details.: U5 q8 J& _" |8 j
- */
i- \9 x( Z D9 V8 v& l N! \5 @7 X
! s% Y2 W/ W6 |3 k0 f- C5 ^ l- #include <linux/module.h>& D" z$ x/ X+ X* L2 h
- #include <linux/init.h>
, E& `. q5 A2 s8 s$ J( v0 U# N - #include <linux/errno.h>
4 V( ^9 u3 Q- M - #include <linux/types.h>
, j/ ^% G! j$ o9 F- }, T - #include <linux/interrupt.h>
+ l1 @9 A* b q - #include <asm/io.h>( V4 b i/ L& r
- #include <linux/moduleparam.h>
* x" ?9 R! _, U3 D - #include <linux/sysctl.h>5 Z/ ^0 [1 i) l* T7 R9 b! O+ t% K
- #include <linux/mm.h>3 u, b5 Z/ [0 |. A# ~" U
- #include <linux/dma-mapping.h>
- k/ H- p4 N% F0 J. T. ?
. `: X/ ?/ A& O' \- #include <mach/memory.h>
0 |3 K6 i& Q+ y- V - #include <mach/hardware.h> W( B4 H, w3 s5 `* P' S! I
- #include <mach/irqs.h>; x! ]( J5 \% j) u& f* w& t
- #include <asm/hardware/edma.h>
: S1 f+ Q+ f) S" Q1 ^3 { - " u$ H3 _( p$ a5 X0 S4 h# v
- #undef EDMA3_DEBUG+ n6 `! M2 d2 ?- s6 Y9 _# T
- /*#define EDMA3_DEBUG*/9 ^) l+ O6 B/ N$ e; L T5 ]
+ }( B! a8 q2 |9 }- #ifdef EDMA3_DEBUG9 d1 a5 W& D* F7 ^) m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b. R- M; e6 t% g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 [2 y a1 v. v5 B9 { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; F2 m! l4 [4 y1 `) g - #else
# E) z/ n7 p5 r8 K - #define DMA_PRINTK( x... ). c0 y& O& W [$ i Q7 i
- #define DMA_FN_IN) |% y/ d! W/ D6 F
- #define DMA_FN_OUT8 |8 R6 D! s1 a
- #endif
0 h" J5 u C' K: q
8 h, }3 f, r, @# ^& l4 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& p% u, ^7 |6 K/ J - #define STATIC_SHIFT 3
% h3 f2 d# q. b! s- x - #define TCINTEN_SHIFT 20
" C8 x* K# N+ s- y7 B" a: G" a - #define ITCINTEN_SHIFT 21
& q3 w$ s! A( A5 a3 f; E! i - #define TCCHEN_SHIFT 223 G2 c$ B: F0 ?9 X& D2 y; l: Z) i
- #define ITCCHEN_SHIFT 23( c8 \$ h, o C* n- L, [; I
, z5 {6 W5 L3 k; w( {! P- static volatile int irqraised1 = 0;* p3 K# I/ \ x" T% p
- static volatile int irqraised2 = 0;
3 t1 _5 z& q) b8 Q- r0 Q
/ U& G& b: `+ A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Y, J2 N: I7 J6 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }: c: U& ]+ V8 T3 S& s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; `4 G r6 ~( r. N, Y3 Y5 Z4 z
) i4 b( t M; _9 ?% u; u- dma_addr_t dmaphyssrc1 = 0;
; {) E1 X d& V+ \6 M - dma_addr_t dmaphyssrc2 = 0;( s% S z/ a1 m o
- dma_addr_t dmaphysdest1 = 0;9 V6 m0 |* }6 X) m, p
- dma_addr_t dmaphysdest2 = 0;
7 i0 w2 Z* ?$ O V3 _5 F5 a. q; l2 R
. D* i6 G0 N& a6 R" c- char *dmabufsrc1 = NULL;8 M1 d( _ A+ ?% |: N* ~3 y
- char *dmabufsrc2 = NULL;3 `7 R( n' G8 \! A- r3 ?" S9 c
- char *dmabufdest1 = NULL;
( q( o' X; @4 y - char *dmabufdest2 = NULL;
% x: L4 M; _1 q* f" i - 1 |! {. @) n; G$ r: r
- static int acnt = 512;
% X: M# {5 @5 o3 U) X- M! w2 n8 D - static int bcnt = 8;% {, j; Z( W) J$ a2 V' G
- static int ccnt = 8;
- h3 J* x$ j& U* y - ( _" T1 s' t8 q
- module_param(acnt, int, S_IRUGO); Z+ S9 g: M2 n# M3 S# l% X5 i
- module_param(bcnt, int, S_IRUGO);' H( `; o& B$ Q3 P7 A: ~
- module_param(ccnt, int, S_IRUGO);
复制代码 # ^( |# T+ }. c9 R
, y& R$ ]$ q3 o% F2 U( Z% P7 r( s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ H, @. p! z7 c3 a1 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% m f3 _7 Y7 S5 ~$ w5 j& ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 p# \1 ~& l6 l' ?- \# C. V
2 b& @5 C6 v* ^- g
; L8 t3 h* t( z; A |
|