|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 Z( X/ s' k" w% D: f9 ^
- [code]EDMA sample test application/ q5 x7 u+ m7 B" \' C0 x% c2 I
- /*9 e$ H5 z* R- P( B* b
- * edma_test.c
. n- I! u: p4 ]8 s2 E7 Q9 O" `1 F - *
6 ~" }) S7 r8 D* G5 w; Z - * brief EDMA3 Test Application4 z" D. L$ H! t: ^
- *
" Z! O, ]/ U4 `7 {9 s - * This file contains EDMA3 Test code.
7 O0 q* N( N2 m; @9 q0 E O - *5 O& k! F! u- Q m) l$ J1 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ]# x) C+ e7 Q2 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 y. r8 B% x! J* ?! y - * TO CHANGE.
6 X8 N! t4 h5 p+ n - *
1 W. X5 A6 X1 j% g2 M1 k( ^$ W4 c5 {7 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" U, Q0 q1 T0 S) E" M1 B2 @
- *
( j' ]: P3 Z7 D- e# c - * This program is free software; you can redistribute it and/or
& ? N( s4 F" X. z/ l - * modify it under the terms of the GNU General Public License as
4 t# J6 p2 r! ?* T - * published by the Free Software Foundation version 2.9 N/ Z9 |5 d2 w/ ^2 t) S+ I
- *3 w& |* ^* R$ {" [$ J1 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 b& h u5 m( |7 j3 Y$ K - * kind, whether express or implied; without even the implied warranty
8 h, ~ |( ^0 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ v( @- f: o! _' ~
- * GNU General Public License for more details. f' d2 O- j; A2 `! K5 s, S1 ~) D
- */) s. R' W/ S2 P/ G Y
- , [' c0 `7 s0 p4 Z# u* U/ z; S0 W+ s; ~
- #include <linux/module.h>
# |5 W6 b y3 r& C, } q& v( Y - #include <linux/init.h>
" T+ i, i, k, }; K4 A; o# X - #include <linux/errno.h>0 w- R9 r& u% @ X+ t7 A
- #include <linux/types.h>! X" b1 \4 `: {3 n/ ~: X* E
- #include <linux/interrupt.h>
; g6 m! B8 G4 g0 o5 o6 h - #include <asm/io.h>
$ E* e4 z- j9 b# K3 ~: |: S( i - #include <linux/moduleparam.h>2 k" ]# |8 r; K0 T( m
- #include <linux/sysctl.h>5 ]! v) M4 C0 l9 z( E" |. u9 @
- #include <linux/mm.h>1 U9 n' Z: e( V" I& U7 k; Q7 p
- #include <linux/dma-mapping.h>
. W4 M/ {$ y( e - . t0 f/ E$ ] N" v: G
- #include <mach/memory.h>
" d8 A; s# _! K- d1 _! a W - #include <mach/hardware.h>
6 t! `8 ?8 B p - #include <mach/irqs.h>
}5 `( I H9 s' ^* B4 j - #include <asm/hardware/edma.h>+ d$ R4 L4 Q! ] X e
- 7 [# c/ H/ R3 M$ t5 K
- #undef EDMA3_DEBUG+ _( f% `' d9 k& M( ~8 M
- /*#define EDMA3_DEBUG*/- s8 t' \: d7 H! Z( M7 F4 q
- 7 ?3 `/ h" T9 f, H
- #ifdef EDMA3_DEBUG) D3 L0 f! a" R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# O' m2 G6 V; U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& D s! o$ U* s' y' O6 O1 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, P0 f/ {$ [+ r% L6 i( P8 U$ ~ - #else
) l7 }2 L* v1 | N" u - #define DMA_PRINTK( x... )% I1 |& }9 R+ f
- #define DMA_FN_IN# ]2 g& ^/ Z1 l1 `( b( @
- #define DMA_FN_OUT
2 ~6 e3 M# ^+ e% ?1 R2 Y - #endif4 B: H0 I2 m @0 W" {
- 0 a* M4 Y7 i! u+ X8 I! d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), P6 p, ^2 J# s7 M
- #define STATIC_SHIFT 3
8 ?$ r( A7 s1 @" {# ^3 |+ E ]1 f - #define TCINTEN_SHIFT 20
) Y2 i2 E: V* R$ e( m4 b; t: Z Z: E - #define ITCINTEN_SHIFT 21
3 t7 ~$ C" U& h2 @: z, e! } - #define TCCHEN_SHIFT 22& G O7 U& E+ A( y+ K- L" T( c
- #define ITCCHEN_SHIFT 23
! @) k+ z/ l2 U% w - 0 M" C3 R! o6 ]) ^
- static volatile int irqraised1 = 0;7 B8 m" [( z1 K: D
- static volatile int irqraised2 = 0;4 w! b% W' ^: v% D# {' X1 a1 y
- ( N. Q: O2 Z3 K" e! U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z5 [2 Q5 ?8 c9 g3 B$ Y3 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" M! J, H. j" s" }5 R9 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 o6 N9 E- Z" G- t3 l+ h* x8 h% a0 r - - v( I5 M% F' i- G2 T: S4 U
- dma_addr_t dmaphyssrc1 = 0;
. t7 k7 W- |% m, m4 ^6 A& k/ D% ^ - dma_addr_t dmaphyssrc2 = 0;
* @1 Q& P& H9 Z) Z - dma_addr_t dmaphysdest1 = 0;( T8 [5 g/ V* j0 f. R- q
- dma_addr_t dmaphysdest2 = 0;3 s$ _7 @" ` g w0 p3 `
8 V* U. B6 I$ U5 l1 t( e. n& _, W$ F3 G- char *dmabufsrc1 = NULL;2 R8 N# O$ R5 a' q3 g9 Z
- char *dmabufsrc2 = NULL;
! {* w" L4 v& U; |9 K% y# o! L - char *dmabufdest1 = NULL;
+ n7 }; t) h+ G+ y - char *dmabufdest2 = NULL;
2 m3 M3 V- {* ~" T% Y+ x- q+ ?. N - , j/ r2 N/ k$ I+ }1 M/ ^5 _3 H* V
- static int acnt = 512;# L; `" t) V0 Z
- static int bcnt = 8;
' y s* j* k% [8 d. k0 i% T% w* M - static int ccnt = 8;' w/ t: b0 U' V% z7 N
, z, l; G) x F6 Z6 }/ |- module_param(acnt, int, S_IRUGO);
6 D' j% k4 S1 c% P' J5 h. w - module_param(bcnt, int, S_IRUGO);
6 J* x1 u* K d3 @8 G - module_param(ccnt, int, S_IRUGO);
复制代码 ) |& c- Y) s7 E' l3 E
: {, v+ c9 W0 t& C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 C3 u, T d# V+ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% l# c |8 X, J: M+ r" x8 K7 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; h& p' d1 e6 v7 } y2 K+ c3 b6 `) E& O/ `9 n
b# l# X, w9 ~' j |
|