|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 H' w. Q, q! |% @. t: R5 H- M- [code]EDMA sample test application( |' P. C! P n$ C$ Q
- /*
. J5 H3 W7 L+ I: c6 X* W - * edma_test.c
8 R+ N- J1 C/ }6 s$ a# `' l - *
. D+ }9 A& \3 F8 i; U/ K7 X$ X8 W - * brief EDMA3 Test Application
) d# z# H6 g. n' w - *
/ R' n- k5 z# Z - * This file contains EDMA3 Test code.
. N0 v* l) p+ s7 J9 x+ | - *
1 ?$ o! R L+ N4 g" [* z# ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 G4 E$ b0 t& U- o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" k* c. ^) H- d& k4 d& \
- * TO CHANGE.# G& P" D7 e. H
- *+ R' q* P d! Y* d# Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 x; ]- r* c9 t$ p9 m
- *5 [# \" y" u) t3 o
- * This program is free software; you can redistribute it and/or& ?/ ~& v7 @8 _+ r
- * modify it under the terms of the GNU General Public License as
O3 ]5 V# P9 n8 D% F+ r7 ^ - * published by the Free Software Foundation version 2.3 H5 K! v0 I! ]( F
- *# G+ ?+ e( h/ l. V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 ]4 |* {: t$ ~4 [ U$ c
- * kind, whether express or implied; without even the implied warranty# @8 M) |8 p' @, i( x6 ]3 ^. k) s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- F T" P/ P. H/ ]4 g7 ^8 q9 v( D - * GNU General Public License for more details.
, A9 V0 a8 D5 A0 @7 @8 p! U! t- z* v - */, O0 B" d6 \( d0 S' w- G7 Z* z
- 0 B: U# ~ r& n( a g" ]0 p$ k4 G
- #include <linux/module.h>( \) o2 r0 N% Y
- #include <linux/init.h>: p1 B' |- o% @5 o5 X$ s$ z( ~
- #include <linux/errno.h>
- y, z/ E# m& q( I' P5 d7 f3 D2 z - #include <linux/types.h>
. }! h% q- C! d* a - #include <linux/interrupt.h>, K0 O: C. b& w
- #include <asm/io.h>2 O" ?2 x1 a1 X# b. h6 y+ h
- #include <linux/moduleparam.h>) k6 i& a9 J$ a2 Z: |( G; B
- #include <linux/sysctl.h>, o5 l2 g2 U, a2 u
- #include <linux/mm.h>$ m- t2 k& B# _4 e* X
- #include <linux/dma-mapping.h>
( [" \- H/ g' y" z+ U
5 N+ C% X( v5 ~' @7 s- #include <mach/memory.h>
4 }) L `/ {+ s# d6 t; B: t/ n - #include <mach/hardware.h>
0 X7 {+ \* Q5 o - #include <mach/irqs.h>
% R5 T [# v4 o4 T7 ^( U - #include <asm/hardware/edma.h>
! j+ r& z. \; y5 c" W {# q - : v, V0 k( C! D- Y) R0 `- n# p% A
- #undef EDMA3_DEBUG3 A! D: v t4 ^" k
- /*#define EDMA3_DEBUG*/
* ?+ p6 i5 G# G3 V$ g% l
, o- W. V6 @7 t) {, p- #ifdef EDMA3_DEBUG
& o0 S$ n. g& |% F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& m) @2 Y3 x( _( }, S! D; D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ O$ t1 s8 T: x7 c+ J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 r: W& d8 Y: o) } - #else9 z+ \( r) ^1 q7 C. n7 u" P6 Q$ S
- #define DMA_PRINTK( x... )
% C4 E r* ^; e, _3 \* j0 T - #define DMA_FN_IN) k& Z6 [5 D% q/ }( v: `
- #define DMA_FN_OUT
( e- J' B h4 p1 h4 Q/ l( | - #endif
# `- p, g' F7 V) f - 7 \6 K/ p6 A6 u* ` y* p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ K' s: P' y& r6 O) S
- #define STATIC_SHIFT 3
" l; }; ~/ x2 O( D0 z! u6 c2 X - #define TCINTEN_SHIFT 20
4 W: G- ]$ _1 Z' w - #define ITCINTEN_SHIFT 21
5 e. z, F& |5 q o, r7 x1 M1 t/ M - #define TCCHEN_SHIFT 22
' V& _( Q1 V7 N" a( } - #define ITCCHEN_SHIFT 23
" i! q: e; ]2 R* X5 k/ o
6 z& q! n6 Y/ T1 J3 c- static volatile int irqraised1 = 0;
' M7 ^3 T# F3 o B3 u - static volatile int irqraised2 = 0;
' \ C; {* [" Y
- G1 N. J4 t+ W; M$ C8 N6 H$ h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W% L/ B8 |" s4 x+ U8 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z& X0 G8 M- t8 |& i& L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ D) z/ E3 g* B( g0 V) |
/ h' m5 ^3 o2 V \3 y. D8 u0 c! W- dma_addr_t dmaphyssrc1 = 0;
1 F5 a: F, M' p$ l - dma_addr_t dmaphyssrc2 = 0;7 o% K1 H0 g$ Z' V1 i
- dma_addr_t dmaphysdest1 = 0;
/ G; f8 I& d6 j d! }- B - dma_addr_t dmaphysdest2 = 0;: ~' f$ l# p8 E: m
7 k0 e" c6 F! q( O- char *dmabufsrc1 = NULL;" B# p3 D ?$ N1 c5 y
- char *dmabufsrc2 = NULL;
" _$ U2 ?- b4 u2 z6 ~, K0 v$ K - char *dmabufdest1 = NULL;
- A4 ]1 I+ r, v) J" c - char *dmabufdest2 = NULL;
4 {3 h9 l3 T: }
1 l( Y, W5 H e1 V- static int acnt = 512;
9 g8 T; d8 n( f3 h! z a: r0 p - static int bcnt = 8;8 {% M" A) } P
- static int ccnt = 8;6 f4 p1 c3 J0 I5 Y1 d; P$ D
- 9 Y# ]$ W/ @" | P
- module_param(acnt, int, S_IRUGO);
Y: f% u, v7 Z+ t: `3 G - module_param(bcnt, int, S_IRUGO);
, U- G [7 N# I - module_param(ccnt, int, S_IRUGO);
复制代码 / D' M' G6 _$ u: \4 V
' ~* b/ O( l1 h' J/ U7 ?# W' S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' w9 e$ d4 a% [( X* P' d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 z7 U8 j* y) v* o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ^9 Y6 E9 n. y0 P! T# d) M) w' V
; [% l# v8 x0 ]2 }
8 s6 O& z1 q& }: r |
|