|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 T/ ^" z% {. v( l" s/ e! Q
- [code]EDMA sample test application2 h9 ~, f: o$ D, o+ |
- /*
# L( V' J. \* U3 j0 j' A - * edma_test.c
/ U5 y" b5 i, l. X4 F/ J- T# K) | - *
6 F! e1 y5 X$ r; C7 N! e; F - * brief EDMA3 Test Application
: d4 H0 {, l# C# d6 v2 s" b6 }/ e6 o - *. ~8 X" j$ v3 Y$ I
- * This file contains EDMA3 Test code.
+ ]& H% ~! Q6 [/ v. E - *9 ?, w/ W z9 X2 P+ ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 P1 r, M7 U9 Q# Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ C& K4 x) k( V% y - * TO CHANGE./ Z/ Q5 G* J3 P( r- [, ]5 r! j
- *' u0 ~9 @3 F; L1 r) [' l- O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; d. P8 N: [: @; H
- *
( m1 X$ V1 h/ P. L - * This program is free software; you can redistribute it and/or
" b8 |% i# J' b# v$ E - * modify it under the terms of the GNU General Public License as! X: m% {4 r! O4 `) ?! g' J1 o
- * published by the Free Software Foundation version 2." }3 T$ R, |4 ]* N; z9 X
- *; ~, |3 S) x: R6 y- O V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) L* J8 A7 ?4 P v6 ~ - * kind, whether express or implied; without even the implied warranty6 I2 O2 D" I) m. I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, O, R; S7 i' P+ z' v% o
- * GNU General Public License for more details.# v" N! R6 ]; _
- */ h9 \7 `. a: S, S s j" m; b
6 L/ v) M% ^/ _% r- #include <linux/module.h>
8 r5 M* Y5 S# R& t" \ - #include <linux/init.h>) C" ?7 \& ]6 K* b) M3 U J- Q( l
- #include <linux/errno.h>' c# H* ^- O! V- r; {
- #include <linux/types.h>
" z+ m+ J1 x( ?( s0 ]: Y - #include <linux/interrupt.h>
9 U3 [4 X0 i5 o' }9 U, i - #include <asm/io.h>
5 X8 I/ S+ X1 p$ B - #include <linux/moduleparam.h>
, |! H% F: j5 | - #include <linux/sysctl.h>& d6 y* ~. ]! T
- #include <linux/mm.h>: n: M5 P9 ?; i* e" r! [
- #include <linux/dma-mapping.h>' E+ Z6 m* T, R' ?2 W7 u% n) ]: N
: d) ^& L1 I: x' t- #include <mach/memory.h>- S$ E' P4 r- L& [3 ?8 t9 Y M
- #include <mach/hardware.h>5 k2 j: F- B) X$ g) @6 [' h
- #include <mach/irqs.h>3 o( Y) M" W' ]! C
- #include <asm/hardware/edma.h>2 d) C5 N' d0 I5 I
" ~* @6 @! U, K3 F- V" t- #undef EDMA3_DEBUG9 C0 v1 N0 @: h) C
- /*#define EDMA3_DEBUG*/4 Q) V* W- D9 u
- + P b1 h# n( J1 F
- #ifdef EDMA3_DEBUG
! r- U2 b; M) w; q' h5 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 G: Z- d; m1 K9 Q- l" o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& `+ ?( O9 \: h( O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# n/ W+ x; X+ O" @/ i
- #else
" y0 K% Y1 t+ m n4 j7 B - #define DMA_PRINTK( x... )2 E* c6 }% |" A; g& e
- #define DMA_FN_IN
1 c% A& i9 L; N/ U$ I$ ? - #define DMA_FN_OUT
, r3 ?4 h* j- W$ O* ` - #endif
( u4 _. w0 j+ J' I* Y - 8 K7 T# K' y) [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- c9 P6 z# |' Y* J/ U( ^7 R - #define STATIC_SHIFT 3
) S/ E* K% w2 |, K( T' u6 ~ - #define TCINTEN_SHIFT 20
8 x% c5 k8 c9 { - #define ITCINTEN_SHIFT 21
5 G& v' Y& l _9 F; q - #define TCCHEN_SHIFT 22
- h8 V$ |6 H% i+ g0 N - #define ITCCHEN_SHIFT 23
! }1 r. W$ {8 u) o
' i+ |. e$ ?8 P: F$ S J- static volatile int irqraised1 = 0;
# d/ c% |2 l! V- q6 y - static volatile int irqraised2 = 0;% I5 Z0 V& h: i5 q% L
. {3 y n7 |# b" C: ^3 O7 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j0 ^* p& S9 ], B: G# w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?+ d; ^7 S5 E9 P, g* Q4 m" i" z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# e6 j2 P5 p4 D
9 f* ~# c! J% H2 J0 x! o- dma_addr_t dmaphyssrc1 = 0; U' C' i6 [+ d/ ]
- dma_addr_t dmaphyssrc2 = 0;
+ u; [, I+ U9 l( ? - dma_addr_t dmaphysdest1 = 0;; f9 n8 J! g" l
- dma_addr_t dmaphysdest2 = 0;
) l& X- p( ^7 D2 v$ g
* H0 Q0 u* Z9 e& V! T. ~" R- char *dmabufsrc1 = NULL;
+ H$ \# G8 w! f2 p - char *dmabufsrc2 = NULL;+ d: z% O h2 U- X# h
- char *dmabufdest1 = NULL;
8 z) `% i' M0 d - char *dmabufdest2 = NULL;
6 P4 e; j$ s: h, N" h s - 3 c5 D( U: k$ |! n/ h
- static int acnt = 512;% B- @; y! M5 j! f6 D: o
- static int bcnt = 8;
2 k; Q3 v$ G2 S' e1 D2 ~/ j - static int ccnt = 8;
% j6 g: k3 {0 F" g5 Q! [! V+ h
+ a+ M& u# e, ]* I, K- module_param(acnt, int, S_IRUGO);7 R$ h, _3 m- O
- module_param(bcnt, int, S_IRUGO);
+ d! l+ E- V) E! h: K9 B T$ }* O - module_param(ccnt, int, S_IRUGO);
复制代码
5 u* k$ v8 o' M8 T Y+ q% c5 ~5 i% r7 \- w" w& o1 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
\3 {: P5 m2 X1 v# R7 w" @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' {3 l( g/ A2 |/ `( _# V4 j' b3 k$ f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) W, z' r; l( O- @" r3 ~* ?8 N7 Y4 H7 o% C
3 y1 j' m9 X3 S8 t9 ^& z |
|