|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ?8 w& t: U' l0 \1 c- [code]EDMA sample test application4 {7 S' S" [& _1 F5 z7 `6 o
- /*: L6 s6 b" I1 \& ~! c
- * edma_test.c
4 H8 d( x. a5 d$ I - *. Z5 u/ T0 d" Q( j, I! i
- * brief EDMA3 Test Application7 ^% a! }! }8 h/ @- C; F
- *' g7 l# H5 _# S2 R/ B( l4 L
- * This file contains EDMA3 Test code.
+ H* T5 m% S# `# \ A - *+ n1 w% P7 R9 H3 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ?2 Z/ ^3 f4 H% ?( \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 q% L, x B' N
- * TO CHANGE., Y6 d+ E8 M3 U/ l$ ^% Y4 m
- *: Y( m- ~* {% h6 Z9 f' b) C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) U% q2 T& }4 ]% \. p% t, { - *
# Q0 g4 { E: K a- k2 H3 p4 e5 K - * This program is free software; you can redistribute it and/or) A9 H+ b' v0 [: [8 P
- * modify it under the terms of the GNU General Public License as
0 [# B6 P6 h: ]$ W/ Z( U: N) F" ~ - * published by the Free Software Foundation version 2.
) B% M2 I4 n7 ]* u0 I3 \ - *4 h% ~6 w% ^2 p$ W e. B7 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& P5 M3 K: d& A - * kind, whether express or implied; without even the implied warranty
' T+ ?) {1 b. |3 B3 m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) `9 T+ w4 P1 R9 t( S9 m3 B; B - * GNU General Public License for more details.
& \ @) ^. D0 N/ X M - */
|4 u) d F" H6 o
' I- K( i- v0 _" [4 g5 N4 j% x- #include <linux/module.h>
! G) P& g6 B% l. ^8 J - #include <linux/init.h>
! }$ S7 O! E) G% U2 Q d - #include <linux/errno.h>2 k! t; C9 B! R. {# ?
- #include <linux/types.h>( [2 X2 {! c3 Q0 g
- #include <linux/interrupt.h>
: k& o- V& f4 g2 T" \( @/ Y* ] - #include <asm/io.h>
5 e5 A, y! H4 Q# o9 ?( f - #include <linux/moduleparam.h>
' Z3 }6 e: G+ q# K( m9 s$ f - #include <linux/sysctl.h>
: @) y# a% g! S' B8 m! o- X - #include <linux/mm.h>0 N8 k/ T: Z0 P% o& w4 Y0 q& T
- #include <linux/dma-mapping.h>9 z3 r& a# }' L/ @2 b* H; g Y$ t
5 i4 {/ }9 _) u5 t# D- #include <mach/memory.h>1 f- V' C1 U/ D8 m1 Z+ s' j
- #include <mach/hardware.h>
: X8 s5 d5 L W* M/ T6 S - #include <mach/irqs.h>( F P9 }' }/ P' s
- #include <asm/hardware/edma.h>; S, C: X) t C5 R) F
9 b. s# U, D* C$ U: d8 [1 U- #undef EDMA3_DEBUG
; j& W3 p, `* e1 V- A* k, o - /*#define EDMA3_DEBUG*/
0 W3 J* P* ?6 q: r9 F+ U0 W
, w9 ?7 v H9 C* J1 n7 y. T- #ifdef EDMA3_DEBUG+ ?( z, ?: B% k! P# a( i. w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# |5 I' }" O& s, a8 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) |( x- C1 O m7 l& f$ {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) b8 t# z/ S$ A! k - #else3 w; k( P5 ^& O( L0 ~
- #define DMA_PRINTK( x... ) o, d8 V. D" t2 e" ] { H. F
- #define DMA_FN_IN
/ r+ f0 v) z' s+ r0 L - #define DMA_FN_OUT
2 c% u/ }/ Z$ G+ R: R2 }- J - #endif' f1 b( Z ^3 f8 R: V
" g9 q9 W1 n0 [; D8 F% y2 A2 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. @4 I/ b7 w# D; R" f - #define STATIC_SHIFT 3- B3 n8 d% [: Z A6 t v( z4 g( _4 f2 G
- #define TCINTEN_SHIFT 20. K1 e1 L% Q, y7 r5 h
- #define ITCINTEN_SHIFT 215 a0 d0 V1 y5 w F- X
- #define TCCHEN_SHIFT 22$ f8 q. D6 s6 q6 G
- #define ITCCHEN_SHIFT 23
5 g, O" ^0 t- [; I) Y
& Z! V8 g5 \$ ]2 f. u) G% `4 _- static volatile int irqraised1 = 0;
; S" M2 ?* H7 i( v - static volatile int irqraised2 = 0;; e- ^7 r9 }+ Q/ P4 a `
- ( R: G* K! }+ F$ i- {( D0 A/ J+ @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Q1 b5 e5 u( G* A: S, ] [& H, r& \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E" a9 x/ G4 Z( Z7 |' p* L/ a6 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ]% B. b3 A+ s& w8 d J* o
% u# Y6 C8 S" o# K- dma_addr_t dmaphyssrc1 = 0;
, z Z2 W) W j7 G - dma_addr_t dmaphyssrc2 = 0;3 K: N" r0 y& f' M+ [. ^9 M
- dma_addr_t dmaphysdest1 = 0;
8 ~3 H/ X- c3 m# {* X - dma_addr_t dmaphysdest2 = 0;
! I" |& {3 `# l& o$ U+ [ - ) N P' ~! g9 C5 X% B# X8 w
- char *dmabufsrc1 = NULL;4 k* N0 \2 i! n" U
- char *dmabufsrc2 = NULL;/ m& G2 a7 G8 N8 ~! B
- char *dmabufdest1 = NULL;
- B' M2 J# r4 A; P7 H* t* ` - char *dmabufdest2 = NULL;
6 o3 k7 {: n$ }* B( C: [ - 2 v- T1 ?2 ^. v9 v* n
- static int acnt = 512;
+ {, a/ U8 p3 W3 l; c) r' h - static int bcnt = 8;
0 P. r7 R5 w# u- ], V! |# Z - static int ccnt = 8;
- k# o$ N/ r, Y" t+ R! V6 e. r - 3 ]4 W& ]- P% e! \" `$ N
- module_param(acnt, int, S_IRUGO);
1 U) P. a/ }; b3 }% D - module_param(bcnt, int, S_IRUGO);5 {0 g2 Q+ j. D; t
- module_param(ccnt, int, S_IRUGO);
复制代码 - A. k4 n- j6 p0 o2 j
- x* c7 x' D% r) `3 S5 X$ { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( T' q& k! z7 y$ P4 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# n. R) t% s2 J0 [$ A- _, Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' `% k+ J H( A7 i- M* o* r# H) z
: G7 K3 [' @ x+ L3 M8 I
|
|