|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : K7 u% U% \; z+ ^
- [code]EDMA sample test application, F8 n1 }! h: \2 N: g$ S/ I- E
- /*
9 a& r6 F& y# m2 z4 A# n - * edma_test.c
: L3 {% R8 }5 R1 @# L: f - *
# X$ _3 h9 l: T% @- X5 n5 M% a - * brief EDMA3 Test Application
/ h# e% B7 b8 s3 |, X$ U4 R - *
9 ^' M1 Q3 n* }8 [) L2 m - * This file contains EDMA3 Test code.- }3 X( T% i+ [& J* W6 V1 U
- *1 O* H+ H/ s: S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, C, K/ e! z8 F- R. N: t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# I$ N. k5 j) O+ N( H$ i! L - * TO CHANGE.
( s* d; w- t& e* O - *, G6 [; D: @( \$ T2 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 `2 C+ A9 z0 H" c5 E a; B - *0 O) ]6 r$ D' x/ E6 l" e [
- * This program is free software; you can redistribute it and/or
% l, J. z' H4 q4 B, S& x - * modify it under the terms of the GNU General Public License as. Q, i! S' O% S J7 \2 [. z* Z
- * published by the Free Software Foundation version 2.
( b8 g! G, X: `% O3 V - *' }4 q7 r. \$ x* X+ C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' x" M% T, e5 _( J2 ^
- * kind, whether express or implied; without even the implied warranty
/ Z7 O: {- D! z( g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# W% R) q2 `% ~# ~+ ~* J6 _
- * GNU General Public License for more details.; }. d( G0 h" G3 I0 |/ c; w4 t q
- */0 N3 t" r6 O9 P5 d: `/ ~" o. e
- 7 h; o1 o8 Q6 K
- #include <linux/module.h>
9 ?, Z/ F3 q3 n1 J l( g - #include <linux/init.h>; {6 x( F4 \- d5 v2 a
- #include <linux/errno.h>
9 l3 g6 ]* z0 Y5 i& U - #include <linux/types.h>" }9 D& U' i' I
- #include <linux/interrupt.h>
7 N- c7 {# R* V( A! l- C - #include <asm/io.h>
$ l$ G) T5 z# q2 w - #include <linux/moduleparam.h>$ m$ y4 G( H# c6 x: T7 h" ?9 u
- #include <linux/sysctl.h>% u* n3 l. V: D' }, |7 ?
- #include <linux/mm.h>
6 o) q5 [4 t Z V- Y% n - #include <linux/dma-mapping.h>
0 L6 M0 c% W. b# q) m6 G& ^
3 }9 `& [$ P5 [- f( i3 h2 Y) E- #include <mach/memory.h>
! C8 J4 d3 B! b0 [, C0 q - #include <mach/hardware.h>
/ v8 y; v& b6 h - #include <mach/irqs.h>) @" K( E3 R! n# ^ h% }, H+ s5 @
- #include <asm/hardware/edma.h>
5 K# `& {5 Z5 ^9 M3 x7 ~* ?+ h
- `4 F% l. }" m* X- #undef EDMA3_DEBUG
: j, ?5 Y% {( L8 A, S- s - /*#define EDMA3_DEBUG*/6 c, L* @. A3 z" I0 }
- $ A& _) }: E0 r3 U" V
- #ifdef EDMA3_DEBUG5 B3 U$ J" N. Y$ D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ R. d# ]* z) Z$ S+ b8 C( Q2 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 m+ _% ~* N7 Z) b' X. T% F8 c) N: L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f7 V1 |. g9 G7 ~
- #else$ G% `5 @$ T ^2 }' {
- #define DMA_PRINTK( x... )
1 C/ `6 P$ P7 F - #define DMA_FN_IN
1 o, q9 B3 i. S: f( K7 w - #define DMA_FN_OUT4 ~5 `% _3 }+ c( d& H0 j1 Z
- #endif0 @4 A2 f1 U: x# t* ]
- b6 @3 \6 y: t* \3 S% i- #define MAX_DMA_TRANSFER_IN_BYTES (32768): ~9 h7 {/ O7 |5 J+ a
- #define STATIC_SHIFT 3
u6 J* U4 M9 \& X- y1 e5 ]6 ]2 p - #define TCINTEN_SHIFT 20
" l( o4 \$ ^/ C7 v6 R6 } - #define ITCINTEN_SHIFT 21
& ^0 f, C. p+ x# l* J/ I" ~7 P! t - #define TCCHEN_SHIFT 22
/ C9 Y5 T1 `2 B% G - #define ITCCHEN_SHIFT 230 ~2 ^- ~+ q0 n$ Y. r4 \* u5 l% ?7 V+ \
- 7 { f( y4 V( U9 v7 {; W% S
- static volatile int irqraised1 = 0;8 I. w$ j# I- ^2 m4 l
- static volatile int irqraised2 = 0;
; {1 }7 z, O! Q, t: j$ s - : B# O( ^* _; M& ]. ?* g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. z B8 Z& w K9 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 o p9 @" K( Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L: S- d, [9 k- O6 N
" w4 \( _! S7 I& g; h. {- dma_addr_t dmaphyssrc1 = 0;
$ L& ~. F8 _9 t4 l$ i/ C" R - dma_addr_t dmaphyssrc2 = 0;6 j& P2 L8 z- t k# U
- dma_addr_t dmaphysdest1 = 0;
1 q+ R |3 }6 F4 ^, v" m# G$ X - dma_addr_t dmaphysdest2 = 0;3 ~+ D) Y E N( ^
- + C( v+ ?9 I( `& w- M% D
- char *dmabufsrc1 = NULL;
! M8 \6 k W( P - char *dmabufsrc2 = NULL;
' Z. c2 a2 U+ p) M e - char *dmabufdest1 = NULL;
/ {2 ], o+ d/ j - char *dmabufdest2 = NULL;
( J5 }7 n/ O! a
( b c/ h! Z5 H! N0 v- static int acnt = 512;
; r$ a7 S9 p2 ]7 A - static int bcnt = 8;
" D1 x5 }5 Y' I0 k9 E - static int ccnt = 8;3 y. I# c+ @& j$ j! V
- 6 c( Z z9 g' ]. ?: F( p
- module_param(acnt, int, S_IRUGO);
" o/ e* K: a" J0 A5 `* K( Z/ K - module_param(bcnt, int, S_IRUGO);
3 Q0 g. C4 |% Z, Z7 |7 M$ K3 i/ L - module_param(ccnt, int, S_IRUGO);
复制代码 1 F" o$ `7 W( J6 [
% E2 k S# o7 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( O: {$ R$ i5 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ J" ~/ r+ Z- T( _& X" W4 r/ C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ N- E* x G. a& W3 K! ], z; A, d! o+ p* A; T1 Q
3 Y" s% X! N- _4 R% H0 x
|
|