|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 O& @& D/ h$ Z( g# G- [code]EDMA sample test application
! u1 }. U5 [; J# g( D ^: d - /*
6 d( O) ~3 A' ~+ C0 |# f - * edma_test.c
?7 ]+ L/ A8 ?% B+ R" j0 [( q A, `" a - *% t6 v( w: G6 [1 v/ U
- * brief EDMA3 Test Application
: Z& g1 _$ M5 Y1 t9 c* [ - *$ ?. e# K; [: b7 n- i
- * This file contains EDMA3 Test code.. O I) }% ~0 X3 _# _/ z+ n8 M
- *3 Z4 p- a$ s- m9 v) x6 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# J) p3 x7 @7 C6 x, \7 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* V5 W7 T$ ~5 p" ?2 z/ J& h" \ - * TO CHANGE.
, v m; f, E% S$ c) e# k- f! [/ G - *8 ?% R+ C$ r* g, }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: M% A* i4 P# k; T$ e; Z; ^. k - *
" i; T3 Y- g% {7 [! N7 x - * This program is free software; you can redistribute it and/or# N+ l+ c- l6 l1 R3 I. }! a* }( G% h
- * modify it under the terms of the GNU General Public License as4 S& [+ p1 a2 Q3 X) T
- * published by the Free Software Foundation version 2./ ~) c3 c$ [7 b: i6 e4 ?0 @1 {
- *
7 r7 E( r9 f7 L/ E! Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Q/ Z3 E1 M) Z' a: D+ ]4 M% C
- * kind, whether express or implied; without even the implied warranty; ]1 U6 }6 d' I2 L1 Y6 ]2 J3 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
F3 G4 J+ b$ [' O - * GNU General Public License for more details.
4 j' m7 r% G& P/ e - */
4 B$ C1 a; `' E4 ] - ( N" F; f4 n; S+ d
- #include <linux/module.h>- a4 c7 _+ [' F" b# O+ y& _0 Q
- #include <linux/init.h>" w. O( k/ P/ A M' W
- #include <linux/errno.h>+ G9 T9 N. l. Z
- #include <linux/types.h>: u7 z1 t+ P; ^7 C Z. P. g+ h0 o6 K
- #include <linux/interrupt.h> o: ^* i' P# v( E+ W
- #include <asm/io.h>
# a' e7 _3 l( k6 o( p1 U2 J - #include <linux/moduleparam.h>& ]& n: E4 h: o9 l ]9 u, x. e- R
- #include <linux/sysctl.h>2 `- ?" F4 @: I. b* g
- #include <linux/mm.h>
1 S+ e) @$ \! {. z - #include <linux/dma-mapping.h> k+ x! ?1 T# L! W! A6 S# G: g; D: c
6 R& s# D0 q+ P. I; d- #include <mach/memory.h>
5 S: O" h% b/ q- t9 }( @$ r7 h% L. n - #include <mach/hardware.h>
. `) o- i- k# ]$ o- c - #include <mach/irqs.h>
0 B( X* z" O! X6 h' y; | - #include <asm/hardware/edma.h>5 D9 F: w5 O) Y4 v9 u
# T" |# O( g" k* p! X0 v- #undef EDMA3_DEBUG
% d ~/ t) N! L& u; F! p3 P8 d$ k - /*#define EDMA3_DEBUG*/ D9 q& M, w- j4 P3 x! }
( J: @! m% u5 _9 G' T- #ifdef EDMA3_DEBUG( A Y9 J4 M# @3 }+ S, j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' h4 p/ R* N0 S" E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- K: ^% m3 l$ F) r* K. f( q9 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* _" _( h9 d% @' p8 t3 T+ G( a
- #else
1 G1 B3 y4 W$ w# x" S; z - #define DMA_PRINTK( x... )) H$ v- s- j2 E1 t, G
- #define DMA_FN_IN, |" H# @. O' s7 s; H
- #define DMA_FN_OUT
, O- b! e# v# i1 I - #endif
) S9 j& n/ r, t* w5 Z2 p$ K- [ - - U2 S. P' ?6 E" j; o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): k& H9 f( |+ D) k
- #define STATIC_SHIFT 3, E+ v; K8 H L1 E) Y
- #define TCINTEN_SHIFT 201 L/ i/ v9 k% S7 e* ^
- #define ITCINTEN_SHIFT 21
$ \, H) u5 b% Q- n - #define TCCHEN_SHIFT 22
) U, z* d9 F+ Z2 x- }* S' ^; N* f! z - #define ITCCHEN_SHIFT 23
1 i: r( d6 m5 a
. u/ j# X" i) x9 p- static volatile int irqraised1 = 0;* E4 d* p1 z( W- g/ }5 ]
- static volatile int irqraised2 = 0;9 O/ P! ?7 _. j8 h5 D/ W
/ d! O8 l( x! R! l9 p, h+ k4 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Y0 \0 y6 a" V' e! \( T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R$ [! H4 Y3 R* Z- C7 Q/ p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 R5 \- v# j5 W9 q: \$ b0 F - 5 h0 B, m0 p4 v0 X
- dma_addr_t dmaphyssrc1 = 0;
6 E, d' Z; c- n H! H( K" { - dma_addr_t dmaphyssrc2 = 0;. e m+ S) {( o. q
- dma_addr_t dmaphysdest1 = 0;: R( d1 X X6 g1 y* D& g* d# j6 s
- dma_addr_t dmaphysdest2 = 0;
+ z/ h$ _2 Q2 ]: q# c
, [# P* R2 x8 v2 ?" }; z- ?( Q- char *dmabufsrc1 = NULL;
! y+ |: e) q* R- u# A% _# G) t) H - char *dmabufsrc2 = NULL;
& ]1 K: Y$ c9 t - char *dmabufdest1 = NULL;
R! S7 L6 ?2 ~ a - char *dmabufdest2 = NULL;
$ ?: `& H( ~. t H; M1 p - , l2 { O/ T7 d6 }5 k) c
- static int acnt = 512;+ A# p g9 P% { ?
- static int bcnt = 8;
; j; Z: j& a% S3 l; [ - static int ccnt = 8;
! B$ ?6 M" j, s9 j W, T* t j - 4 ~9 B+ k$ B0 ^3 T4 G
- module_param(acnt, int, S_IRUGO);" s" @3 w: e1 |8 V0 w
- module_param(bcnt, int, S_IRUGO);
) q& K, l" R* i4 m - module_param(ccnt, int, S_IRUGO);
复制代码 ) J$ @, K' F. P6 a H
! J/ Y Z1 d; ]- `! F# E% X' L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R6 r" z, g9 v
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 n" b i* M! h2 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: G# `2 L' @, l& E n
- h/ A8 B8 y' w! l) u/ G: G4 }; X; F+ B9 f6 }
|
|