|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - f9 b: \) T. u" d" Y+ m8 a
- [code]EDMA sample test application( j& w# X0 Z: e
- /*7 A& F2 N0 c5 W# x# A( _, _# @
- * edma_test.c* C* R+ s" O k: x% J
- *
* l6 E3 H5 N% k( h1 F" {0 K - * brief EDMA3 Test Application0 Y7 h0 n) D* j- Q G
- *
( D3 B l. ?, K% g: k* ~2 Y - * This file contains EDMA3 Test code.' w" V5 k- C: |5 V& V( }
- *) g {- ]( i% p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~" { k7 E) ]" D3 D: }1 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% c7 ?) x* u; e! s7 f# f2 ]4 U - * TO CHANGE.
& M* ?, l& f5 I9 v% C - *2 s2 C/ C( {. f, ~) }3 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 m9 z- D( L" Z) e+ {0 @) m5 c - *. W! [8 i+ p; |; R0 e
- * This program is free software; you can redistribute it and/or3 q" p$ X0 A. Y4 N B
- * modify it under the terms of the GNU General Public License as- z' {' m" S' z
- * published by the Free Software Foundation version 2.' ] h" Z, j+ P2 s, W* i
- *9 a7 g! t; }; p* o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 o; I8 h7 e }; ?
- * kind, whether express or implied; without even the implied warranty
( z5 w2 M. A6 i' t, k2 g. }4 F1 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 @1 \9 K- e' |. J
- * GNU General Public License for more details.
) Z9 |+ \* f: E+ @ - */. ~2 y- G) P+ @, y3 p3 e
- 0 H+ p: h3 i. O2 o1 n
- #include <linux/module.h>& x8 j) Z2 `2 Y F2 q6 e* [# e" \
- #include <linux/init.h>2 |0 C$ @- o8 H
- #include <linux/errno.h>
1 \: T0 h) Z0 f9 s - #include <linux/types.h>9 I2 `8 Y' |7 A, H7 |& m+ O
- #include <linux/interrupt.h>5 E v0 h" Z# h6 g u3 W* i
- #include <asm/io.h>, l' y; d. y" G' s
- #include <linux/moduleparam.h>. G k- Q, [$ Y* `+ F! P0 B
- #include <linux/sysctl.h>1 Q2 u9 G+ I$ Q1 Q: |# M2 }$ ^
- #include <linux/mm.h>2 w) z6 s: r% { e& f4 C' x
- #include <linux/dma-mapping.h>' z5 U6 y! X4 x) F0 z& l
- 3 {6 h$ A: U& ?
- #include <mach/memory.h>7 B) d9 o: t* u9 K- {
- #include <mach/hardware.h>4 Q; p* w. O9 {6 @5 C
- #include <mach/irqs.h>
! Z: n* l2 p% F - #include <asm/hardware/edma.h>
. d Q. g1 E1 B" [ - . p9 _$ d0 d* Z$ @; _9 c, J" w
- #undef EDMA3_DEBUG
3 F# [" J; K6 e' Y2 y6 t! e% l - /*#define EDMA3_DEBUG*/
; e" H2 ~+ E0 k
5 a, T! ~) b, q% G% [( O/ Y. @- #ifdef EDMA3_DEBUG
8 ]; Q' N$ k; A3 s* L4 [* `! J4 J0 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: i% m0 ~; n0 F5 S( a. Y: G4 m4 P W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 k3 q" y$ N$ I6 k8 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# a, A; y% A9 z2 [- ` - #else
3 X E3 |! I7 r& b; Z; Y | - #define DMA_PRINTK( x... )
/ V' s8 F- a4 e# v8 [ - #define DMA_FN_IN
; \4 K8 S2 [5 `; s9 k3 E$ D& g - #define DMA_FN_OUT
$ k& W' H) M. y - #endif O2 I0 _( O* }& t; C2 Z
5 }, B' x" n/ W+ _$ k" ^ N. ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- H- X. j+ X3 o& ^" b
- #define STATIC_SHIFT 3
$ P) t1 e' G$ N7 ? - #define TCINTEN_SHIFT 20
7 f0 g* y" @% H; u; I1 j2 N - #define ITCINTEN_SHIFT 21* l0 @# y% o% ?
- #define TCCHEN_SHIFT 22; X& T% C- Z2 p u; y" \0 J; o: a9 d
- #define ITCCHEN_SHIFT 23& @0 s3 T: @9 C: [. Z& T8 C0 x
- $ K' Z$ r$ E0 l4 U) j' u' l
- static volatile int irqraised1 = 0;/ e; l. Z( u( n% F+ w4 b6 O
- static volatile int irqraised2 = 0;
5 c& i$ h" _& i. W8 D
7 I: F6 M* ~+ Q4 c6 Y8 `; H/ |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ u* w. J. F" T0 p0 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A9 \1 P1 N1 Q' m/ ^3 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ?3 Q' a2 v ]: N6 o - 8 J8 ~' R. k* `5 M- c+ O! r
- dma_addr_t dmaphyssrc1 = 0;
3 c8 Q0 d9 h( B6 z" _! X - dma_addr_t dmaphyssrc2 = 0;$ u( H: q+ v1 O
- dma_addr_t dmaphysdest1 = 0;) T" m5 ] ?; x/ @' }$ Q
- dma_addr_t dmaphysdest2 = 0;
& H7 d: r; y: @& ?+ h% U
" F; ?( p; l( {4 T- char *dmabufsrc1 = NULL;
6 b' b4 K4 t& B# A# T - char *dmabufsrc2 = NULL;
" F- l7 L" v& a* W - char *dmabufdest1 = NULL;# }+ |! {5 J$ y& E* ?
- char *dmabufdest2 = NULL;
* u* ?( D" b0 w a) q0 s - 8 l1 c% B: f: g Q' @. \: c3 ?) _
- static int acnt = 512;
: u S; w3 }. ]# @: O ] - static int bcnt = 8;2 O% P* g) M) c
- static int ccnt = 8;7 s2 P7 a* E# x# G
, @$ V% ~1 \/ I% k7 R7 m- module_param(acnt, int, S_IRUGO);
; R+ b6 Y& C1 I5 y# | - module_param(bcnt, int, S_IRUGO);% j( o' q, A3 r6 ^
- module_param(ccnt, int, S_IRUGO);
复制代码 , W/ X9 H; D0 G: e2 S- B( s. V
- l" H/ w$ r1 y, G8 j1 R( p ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! k( `: Y; |! p9 [2 v0 }7 |' B: g6 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' g) W/ u6 n9 s: R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i1 E9 q, N4 n" |3 p" [) V3 t
% `% V3 @5 w% R( A" ~, p+ b" {/ H" i( p; f% a" j q+ X# c/ e
|
|