|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # m( e$ L. P( ~. T
- [code]EDMA sample test application- L! s0 {. z2 j4 a
- /** K# z! O! o x% a- h
- * edma_test.c' ^# a) l3 d0 g0 {% t6 V' ]
- *
1 I% q1 N [( Z( W - * brief EDMA3 Test Application
) n& Z* y# Y8 j8 b+ D8 L - *4 c: T' J4 V% h! R1 D( _
- * This file contains EDMA3 Test code.+ L C' r9 S6 a/ ~7 r0 k& \( M- E
- *
2 Y- r5 R1 S# Q; e$ `2 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" P, n1 L. a7 r9 D0 I3 M$ M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) _+ c3 ?* ~ }" o* N9 ?7 f - * TO CHANGE.7 M; N* z9 v0 ^9 h5 ]2 j0 ?$ i
- *
# U5 H- u4 q$ N# }2 V9 J- m$ @& s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 X4 ~9 B/ C& r& u - *
; q6 i& ]1 o- C+ n! \( W) n - * This program is free software; you can redistribute it and/or' c& o# E! l1 J8 O! t( D$ s
- * modify it under the terms of the GNU General Public License as
! l' c _" u/ _5 @8 A - * published by the Free Software Foundation version 2.
* k9 J$ E% a* f" u+ S/ Y4 ^: b - *( K" o+ t" _* Q7 P; F, c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 G5 G% G- z& M3 z9 f9 Y
- * kind, whether express or implied; without even the implied warranty
% Y7 Q" v. H( a7 M6 U# ~9 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' @6 e0 ~/ u2 G; n( Y" Z- ?5 n
- * GNU General Public License for more details.
6 t& T! P+ O; f1 }; }3 j - */
( Y! X& K- c7 \" X6 K- m8 E. L - # ?1 S' w" g& f" c5 x M
- #include <linux/module.h>- Y1 x B0 J" o( a" ~3 \- m
- #include <linux/init.h>
* w* k) o, w( G. r- l - #include <linux/errno.h>( n6 D3 a& N$ W! e
- #include <linux/types.h>
7 w1 q/ g: Y3 ?. Z" u9 B. ? - #include <linux/interrupt.h>1 ~4 J/ k2 B8 K: y
- #include <asm/io.h>/ t. h+ C$ E9 p4 O: w
- #include <linux/moduleparam.h>$ t, m" n7 i5 C4 ^) Z% _
- #include <linux/sysctl.h>
+ L/ J" _ L H$ G- g - #include <linux/mm.h>
. G3 J& R% o" C% V - #include <linux/dma-mapping.h>
" ^# O# J) L; Q) T% I& ~. p8 y/ S
, T* X+ P+ e7 G4 h% ~8 o: \- #include <mach/memory.h>
3 w6 k% T5 w) i8 ^- B) N @1 H - #include <mach/hardware.h>6 m, K/ n+ K- f M4 q
- #include <mach/irqs.h>& R5 H: w7 x+ [; q
- #include <asm/hardware/edma.h>
5 ?' @; [1 {3 ~; c# [. \ - 6 v2 o7 m/ D% V& F* W; w; e% H) L1 m
- #undef EDMA3_DEBUG
' N' {8 U. P- H- N4 f - /*#define EDMA3_DEBUG*/
# c5 x; u+ j% a n0 ~
: W+ t! |9 P9 Z& d5 k$ D, o- #ifdef EDMA3_DEBUG. T& S$ p. A1 @% U; x+ x7 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 n* p5 ?$ ?3 Q$ p$ f# z" a0 z% Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# y; k+ c( c" _% A7 [4 ^! j- G2 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R+ u y$ W; p2 n
- #else
5 `; _ ^& y" b+ j - #define DMA_PRINTK( x... )4 L5 v6 v5 M& m7 g& u5 [7 \
- #define DMA_FN_IN
3 O) q- V/ W2 V - #define DMA_FN_OUT3 {- U0 g+ r" h) e: D
- #endif
* i! z8 r0 g u- n2 l( J
' U8 b: E, F" i8 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- t; s7 z* b+ P( z
- #define STATIC_SHIFT 3& h4 N4 U$ Z( a
- #define TCINTEN_SHIFT 20# b J1 h" W0 S0 \" Y- y
- #define ITCINTEN_SHIFT 21: J: j3 d z# M; U: f7 H) Z$ J
- #define TCCHEN_SHIFT 22
7 M' S' i7 Q9 O. r5 @1 e - #define ITCCHEN_SHIFT 23
* C7 C" B, Q. Q O- w
# R' d5 K- g% s/ j1 L" I- static volatile int irqraised1 = 0;
" i* D3 e7 f1 ~/ { - static volatile int irqraised2 = 0;3 z) V4 j7 m( p3 n9 I" _( x! O
4 C6 ?: [! R# [9 P& W% O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ o: q- C7 D/ x; z. x- y! ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- l' I( V+ k" ]4 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ^+ P9 w; w' W- v' c6 h+ i% o
, l9 n/ j9 {8 [' G- dma_addr_t dmaphyssrc1 = 0;
( }! M6 L# D5 g" w" y7 K - dma_addr_t dmaphyssrc2 = 0;% p! Z1 L4 z0 |( |. L. U
- dma_addr_t dmaphysdest1 = 0;
0 [/ x% R6 B( _* _ K - dma_addr_t dmaphysdest2 = 0;* c w; e! i7 a7 f8 q
- ) F4 M& }% B, l h. O
- char *dmabufsrc1 = NULL;7 f1 ?" e: z* K+ } _
- char *dmabufsrc2 = NULL;+ p* C* C7 @, d9 }3 w$ e
- char *dmabufdest1 = NULL;5 z% Y8 s b/ K/ z6 R, l
- char *dmabufdest2 = NULL;
" u# m) k2 o7 V& G
: v e! K. L6 @6 E$ h6 n1 |- static int acnt = 512;
( w y- K& { {% z1 N - static int bcnt = 8;
$ B% _6 E- _ k6 E - static int ccnt = 8;
% _! N3 U, U+ t, ?) P( r8 R- J
- A) H: x7 ]4 ?( k0 z- module_param(acnt, int, S_IRUGO);5 e; O2 h4 c. G1 Y1 L. K
- module_param(bcnt, int, S_IRUGO);
& ^9 B! z3 D6 [; {3 \. u* G F - module_param(ccnt, int, S_IRUGO);
复制代码
6 f# b- n* Q' r% m: Q1 w k+ f" P% o& u" d& k4 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 T4 n' _" {3 c- X( ^5 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; T4 G& @1 F( W4 s; }- T( ~* h5 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 K' I& d) ^8 ~+ ]1 {6 U1 G6 d6 F: r* F# ^; M3 i
. d# U: C ^" H4 l \ |
|