|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 j6 ]7 v7 Q: |0 X" w" S
- [code]EDMA sample test application' X( t8 w2 J/ j5 _4 j+ F
- /*
7 [; N, y( r4 Q+ |( A( | - * edma_test.c
+ O4 b6 Q% `! {5 C" U - *
6 m. k9 Y& T8 V& B$ G - * brief EDMA3 Test Application
% V0 `& p, i! f* V$ n6 f - ** d. C6 T- I# h8 \1 [$ H
- * This file contains EDMA3 Test code.- K; u$ }& ^# V6 P
- ** S9 T4 J! U4 h2 t, z- k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 ~$ ?* j, j; A5 X4 g% b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ]8 _9 x; j& W
- * TO CHANGE.
0 K E/ `. \& n( o - *
' ~- J8 X" D5 g0 G* l2 ?1 B( A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" ~& Q3 B8 t$ i" y2 O" {9 D - ** E( t: l( p0 |' F% Z, o8 |
- * This program is free software; you can redistribute it and/or
# Q" B" F6 i3 p0 A - * modify it under the terms of the GNU General Public License as
0 r+ j! ^# l) x7 [9 r- t - * published by the Free Software Foundation version 2.
k: i: c2 }* [0 I: Y# Y9 D - *
& m+ P0 x/ u, _2 d; D! L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! r) ^. I; x H3 B# N4 l- s0 z0 a - * kind, whether express or implied; without even the implied warranty
& u9 w) g! S# z5 `7 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- }* n+ Z# j8 R) N. g' S9 A- K
- * GNU General Public License for more details.
( b. T" J4 y' i2 W1 O - */: ?6 ~. t) [5 x6 f5 S8 G. F
- : f* T5 L+ c7 w& R3 | J$ ]
- #include <linux/module.h>
1 Q: H3 y. K* f - #include <linux/init.h>
3 S. F7 g3 A+ ?* y - #include <linux/errno.h>/ M" B* t( @8 Z8 n+ Y
- #include <linux/types.h>2 B& h# Z/ j2 V; ?" K
- #include <linux/interrupt.h>" S5 \) A7 ~( w
- #include <asm/io.h>& _5 C2 c4 A5 ^# k# d* }
- #include <linux/moduleparam.h>. J; @5 F6 L7 r* E3 ]8 o( |' D+ ?
- #include <linux/sysctl.h>
( F z# m# ~/ _7 p+ s* v - #include <linux/mm.h>, D2 c, O* q3 _8 z- \ Q/ h
- #include <linux/dma-mapping.h>
3 E! X5 X% n4 [0 ]3 [& d8 Z9 K
9 l3 ^( \, L( i( l/ g) A, O- #include <mach/memory.h>% p& V- A& S. d- U$ D
- #include <mach/hardware.h>
. Q9 B3 a0 [' T8 P V- ? - #include <mach/irqs.h>) h7 \- l4 ^/ A* z* p. i3 s4 ~; {
- #include <asm/hardware/edma.h>
8 Y) a- e8 Y; j* b) @$ S
! t: `) S9 J" V+ L" h7 \/ [( L- #undef EDMA3_DEBUG1 s- N; E# [, j+ n- t; B. }
- /*#define EDMA3_DEBUG*/4 O: V% {% J7 f3 }3 J) r
2 O$ N7 |3 i8 s E( y: T- #ifdef EDMA3_DEBUG
- d# y0 s( l! X- z% C8 e8 }7 _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! S# p" u2 L$ L: T& |5 i, F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" y3 J; [6 y1 l4 Z% T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 N0 `$ Y+ V, X - #else
) t6 s6 r2 k0 m8 K" P) W - #define DMA_PRINTK( x... )( o5 T& t& [" H8 z1 X
- #define DMA_FN_IN: [$ ~8 F3 E- {$ |1 Q
- #define DMA_FN_OUT7 m, W1 s5 n0 C. c) d. c6 Q
- #endif
' y: l) s0 z: r/ i - : B7 L4 V: G# g# p2 n7 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 y8 F% J0 n7 ^: W+ K( \. \
- #define STATIC_SHIFT 3# [# d( N ] A/ E0 i
- #define TCINTEN_SHIFT 20# @4 c: n% U$ d" C. s% f# l
- #define ITCINTEN_SHIFT 21
" p, E/ U8 z! `; g& F( m( j - #define TCCHEN_SHIFT 22- [8 k: C+ g/ B5 K- M
- #define ITCCHEN_SHIFT 233 Q) k' y p- h) ~% R
- ! u8 k0 O4 G$ B! g
- static volatile int irqraised1 = 0;
3 s* e/ x! M8 f, K$ o - static volatile int irqraised2 = 0;) {1 S( ]1 y# s# k7 @
- ( \( P2 M9 v( r- w# i9 ^6 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V2 B% V; `1 _& l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j& H3 }. `4 Q3 J* @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m$ D4 A6 f) {! s& i; t9 q
; N/ `/ V: r V$ ?- dma_addr_t dmaphyssrc1 = 0;; s& A* ?3 Q" p$ O
- dma_addr_t dmaphyssrc2 = 0;
: e0 r, G+ N. B. i - dma_addr_t dmaphysdest1 = 0;
h2 y- G ^$ P& y - dma_addr_t dmaphysdest2 = 0;/ P: p8 ?/ q' S5 d+ j9 h
- 3 a% z" ?* C$ L) ~7 m
- char *dmabufsrc1 = NULL;0 a9 J" Z4 F+ Z* G4 A* P* d7 B
- char *dmabufsrc2 = NULL;
. s6 t$ l# Z* |' H$ c% Q; u - char *dmabufdest1 = NULL;
% o6 W" m2 O. V! S. n) l - char *dmabufdest2 = NULL;
7 H4 |7 ^( w- A
7 u* ]0 D* S# |1 C/ A4 f& U3 S ]- static int acnt = 512;* ` Y' Y! L5 p' p( j! j6 ]* n6 U
- static int bcnt = 8;4 n s3 {9 ^/ b Z- n1 q
- static int ccnt = 8;& [; h5 F+ N* ~$ p0 u
6 V, o# w# p1 f; z. A- module_param(acnt, int, S_IRUGO);9 _8 ]7 K1 n6 U b0 j9 t8 T9 t0 k9 P
- module_param(bcnt, int, S_IRUGO);
' X0 H' F3 p# b' b - module_param(ccnt, int, S_IRUGO);
复制代码
6 G- ~! ^7 n! G. D7 T# O' R! f! N% N, H0 f- G6 R5 l) \9 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 J1 K6 Q6 k( t$ m9 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* z- I0 V& Y9 Y3 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 B$ s# n# ?3 S3 C6 t0 T3 U; q! p
; M% z8 j! p! @8 {9 [9 R' I5 M; T9 M+ n' P+ P
|
|