|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 m# E, @, @ E9 }- x- [code]EDMA sample test application0 X8 Q- V, u1 x, x6 _) x
- /*
$ B% q: g' s: y* s9 [$ n' t - * edma_test.c
; \2 g, ]7 P3 j) N9 v: |. W - *' A4 x2 L! b( G) s5 K
- * brief EDMA3 Test Application& n2 a6 f( W. f1 @! |
- *7 R; ~2 _( W) g/ `7 l
- * This file contains EDMA3 Test code.
7 T9 i# i1 C, \& {1 F- O' H# } - * i+ _ t1 G9 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! ]: `+ q" @2 J5 n) u7 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 a1 D6 G2 J. i - * TO CHANGE.: O' `: q: |! A8 d) K" e( O+ |
- *
! q! e4 @/ b& d$ H, R0 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( j) z' h; Z6 k! G" Q - * E5 L1 [2 E" Y+ M
- * This program is free software; you can redistribute it and/or9 ~6 e8 _' \3 q! b$ L ^! d, Z3 B
- * modify it under the terms of the GNU General Public License as
- ]; K, F6 H7 Y; ]- @ - * published by the Free Software Foundation version 2.% _: l' w: \" h" s6 ^
- *
, D+ S0 ^2 h6 G" e- u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 p7 X0 I. B- P - * kind, whether express or implied; without even the implied warranty9 T' `$ u1 z) t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; ^5 v( c' |" M: `2 @ - * GNU General Public License for more details.) w/ J5 |# n, c# o3 z
- */' T: I$ I8 i/ T H- p
$ Z' A, Y$ g( Y% ], u" Y) @' J3 L3 e- #include <linux/module.h>4 ~! H& Z% r5 m9 `+ o6 p
- #include <linux/init.h>
. V1 F( \# V- v$ w - #include <linux/errno.h> n% G7 H7 I( z4 J6 \7 {! U/ u
- #include <linux/types.h>
6 U0 c0 D# T' h- N - #include <linux/interrupt.h> O L3 p2 j4 W# M
- #include <asm/io.h>* s" ?) j4 a; N! I3 Q
- #include <linux/moduleparam.h>9 z: i2 c$ f7 g
- #include <linux/sysctl.h>5 W: _( u' t- a7 Z6 l ~
- #include <linux/mm.h>
q3 I, T2 H9 P" g - #include <linux/dma-mapping.h>" U/ j0 |* f! A
- 7 P, ]% g( u* v W( b5 N
- #include <mach/memory.h>
7 B# ^& ? i; o. P, u: S5 ]' d/ b - #include <mach/hardware.h>
) S" o% ~5 p2 F - #include <mach/irqs.h>- ?8 G2 n5 `9 k0 J# S
- #include <asm/hardware/edma.h>
, j' H* f2 C1 \8 f
1 }; V4 u' V% ~4 w" U- #undef EDMA3_DEBUG* Y) m1 @7 I9 P' r5 j
- /*#define EDMA3_DEBUG*/7 C) [7 m! m) P$ ~3 R0 k% ^
) }( a7 {* M9 [5 Y. C8 n' B- #ifdef EDMA3_DEBUG
, |/ Z, z0 ~9 D+ Z) O8 v* ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 q% Q5 T; ?. ^, M) d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, H9 _! N- |" A6 Q! h5 k- s, h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ P# o( n; j: Y* l' J: J/ I% P
- #else
- v: Y& o4 S- r: o0 y* r - #define DMA_PRINTK( x... )
4 x/ z! q8 M" \3 l F - #define DMA_FN_IN
! w: @, D5 S8 v( X7 R - #define DMA_FN_OUT
4 P. @6 p% Z9 I0 Q - #endif
b# y( R- |% o' A - - ~* J3 |5 b3 b" b$ f+ o* R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 G) e1 z) e! u: K6 `# R" o( V! f* p - #define STATIC_SHIFT 3. Y Z# R9 Q3 C2 E* a
- #define TCINTEN_SHIFT 20
; W& ?5 s3 F5 d! z7 t1 } - #define ITCINTEN_SHIFT 216 a2 H5 Z$ g d
- #define TCCHEN_SHIFT 22, j h* r1 @6 a& V
- #define ITCCHEN_SHIFT 23 Q& N# \9 h. w/ w1 ^: P1 n2 p- E
- " G. F: }/ v$ Z" r: r# t8 G
- static volatile int irqraised1 = 0;
8 `/ f0 b8 [! I4 w - static volatile int irqraised2 = 0;
! B; ^0 I4 ~$ c, R0 U/ H# c
, J' L4 e Y% c3 }2 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); O4 B& q E2 P5 u: @$ {" u3 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* n& {1 j" J5 e/ p( o9 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# l* P) y9 L4 x5 m7 a6 V
" ?6 t* F6 `% q# x m- dma_addr_t dmaphyssrc1 = 0;. f# f0 K4 f9 b& F5 l9 Q4 }! ]
- dma_addr_t dmaphyssrc2 = 0;
2 y. a7 ?* S9 `4 w# a - dma_addr_t dmaphysdest1 = 0;5 m; c+ ^8 l7 X: P9 K8 J" T
- dma_addr_t dmaphysdest2 = 0;
- J1 T( a8 |0 P: _( g. u
, c' p4 m( G. ]- char *dmabufsrc1 = NULL;
3 P* A" M& t5 Z - char *dmabufsrc2 = NULL;6 c; b1 F$ a" h2 d' y, h
- char *dmabufdest1 = NULL;
: k P7 B; h } y }$ ]! A - char *dmabufdest2 = NULL;
& l! {2 r+ g0 ^6 u9 S
. W* ^5 n( Z6 @8 P2 K' A$ ]- static int acnt = 512;( w3 b6 V4 s. O7 c: l
- static int bcnt = 8;$ X1 x( b4 v. p! `$ `/ i
- static int ccnt = 8;
/ g/ b) ]. ?. ~9 P" u - ( U2 u; b7 W1 H, D7 v$ }. h
- module_param(acnt, int, S_IRUGO);. k. U$ D6 m( s' ]
- module_param(bcnt, int, S_IRUGO);) @8 |/ x' o! M# ~0 J' K! j1 H
- module_param(ccnt, int, S_IRUGO);
复制代码
9 Y0 j" o9 e4 n; Q1 I; ]- c+ H& W8 P H2 `) v/ L+ M9 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 V% D3 w6 y4 g' E. S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ I0 i% }, z: a2 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* p4 j, O7 k. p5 h) o* N+ }; g! y3 t
* B( g, m5 N% P2 Q- \% y$ n
|
|