|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : T: A0 }: e" L& D; h5 j
- [code]EDMA sample test application9 D. z# H6 o; g; B$ o- p7 P
- /*% Q1 a9 w1 `( V' C$ P" f
- * edma_test.c# G( C2 x: m) S5 w9 [- V" w) j8 O
- *
, ~9 p& H. p1 ^9 E$ X9 M - * brief EDMA3 Test Application
D# [6 V6 r: T" s. } - *: I2 q& f" h# v" r0 |, ?
- * This file contains EDMA3 Test code.0 u( _. W; z/ @; ?" Y# N. @
- *3 ]7 W9 a& H4 l1 y1 \: k+ u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 c8 r4 N7 S. i; I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Z7 z# e- I3 F6 I. m; N, y" n
- * TO CHANGE.; B5 |! r& J" n' O/ Y c) `8 t3 P
- *) I5 Z6 H' c2 r8 t: H5 ?6 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, l% Z5 z0 m) d+ |+ G2 F. J# U0 _
- *
; o: g. G6 n8 K, n+ O- P - * This program is free software; you can redistribute it and/or& X- `, E! T% B3 |3 P' B
- * modify it under the terms of the GNU General Public License as
! d) _4 Q8 G1 W' i' k - * published by the Free Software Foundation version 2.# P9 m+ G4 X8 R3 W7 u
- *3 l5 s3 ^3 V; L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ Z, ?# G/ m# _8 ]# o/ d5 ` - * kind, whether express or implied; without even the implied warranty) c" }' k' X7 C# _! ?' E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* s9 u7 r6 @* m' m9 }1 ~+ Y1 w
- * GNU General Public License for more details.
# e3 }$ }5 ?8 C' K' X3 f% Y# f6 \ - */0 d9 }, I3 G; F; I* Y1 N8 T9 Z
- 9 L* y( b+ Z2 C
- #include <linux/module.h>6 j: b( G" R6 y
- #include <linux/init.h>
# A7 Z! \7 W) }; ~: @' `8 l8 Z - #include <linux/errno.h>
( R2 A$ @- h1 b+ x - #include <linux/types.h>
5 x. t8 C% N" ^ - #include <linux/interrupt.h>6 f& y- Y. k) R9 n" ^% O7 V) M
- #include <asm/io.h>) m! `: \9 x0 {4 x2 D$ E2 n
- #include <linux/moduleparam.h>
( S- Z3 b- }, w2 a, {) S) {: D - #include <linux/sysctl.h>
# m/ S& @* f7 o. w$ J - #include <linux/mm.h>! r0 B, |4 [- W) f5 J; h- z/ N5 O6 g
- #include <linux/dma-mapping.h>% y- W8 u+ }: j: ~
/ Y8 q& F. }5 T% {/ U- #include <mach/memory.h>! ]: m- a# G) J9 c' R
- #include <mach/hardware.h>
& _' p2 c' f' S! t+ j! p4 r - #include <mach/irqs.h>
+ Z/ y7 _# d5 p# D - #include <asm/hardware/edma.h>
- ?+ o8 Q4 T0 X8 {. ?% ?8 U* E! L - , f( ?0 R% W8 y! J6 G5 j" R8 L% d8 t k
- #undef EDMA3_DEBUG" t+ o0 ~. c* h& j
- /*#define EDMA3_DEBUG*/
}' } `2 M S f8 w
G _0 H. H/ G) s. G7 H- #ifdef EDMA3_DEBUG
& E% Q* J5 `; i C' b2 f, Z) c- B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A$ S; v( j8 n1 l. ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& a3 s! Y) B g8 b6 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- W1 D- a% ~$ [ - #else7 h8 @" T3 x1 C& b
- #define DMA_PRINTK( x... )
% _/ s/ |2 z" i: q$ F& u# i - #define DMA_FN_IN! L9 W5 V8 X" g# O; S" u
- #define DMA_FN_OUT
: c' Y. I' y( h9 ]% ?+ a V! E - #endif" H1 w+ }1 W/ S: }. h* T9 s5 A
- ! Y* y& b( w! H7 t5 O. e2 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): q3 F- N- \! {: D+ P7 B% @9 ]4 H% R
- #define STATIC_SHIFT 37 C( c3 j: d S9 K+ w2 D. j
- #define TCINTEN_SHIFT 20. B) G9 J: j# ]7 e3 m: N
- #define ITCINTEN_SHIFT 213 E: r& w7 _% s, o6 F
- #define TCCHEN_SHIFT 22
; i: {8 e+ {2 J, e/ D - #define ITCCHEN_SHIFT 23
# V+ U8 h- b8 \6 R' q$ v - ' P% K* ]) v2 j( l# z
- static volatile int irqraised1 = 0;+ h; z+ s" a. Z+ k
- static volatile int irqraised2 = 0;; \: L5 S8 `+ i. g$ V" l4 X2 o
7 K: D# X8 R5 b5 L4 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 b) o8 w+ ]. y& ^" y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N6 d3 _3 j* N, L# |) b% @: m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& H' A# g" c1 \" P$ m: V9 z# \, G/ k. z - $ i( C$ K, A" s
- dma_addr_t dmaphyssrc1 = 0;- ^0 e. p8 Y% ]
- dma_addr_t dmaphyssrc2 = 0;$ |* E/ f$ n/ ~, I6 |: T
- dma_addr_t dmaphysdest1 = 0;+ t& f/ A2 n7 J* r6 Y
- dma_addr_t dmaphysdest2 = 0;
+ B# _/ L1 I: [, j5 T, s8 b0 ~: b
* y6 k! g. S* \" F# v8 L/ b- char *dmabufsrc1 = NULL;8 x& @* P( w0 i- h
- char *dmabufsrc2 = NULL;, i$ G3 z/ B! d, U) H# _
- char *dmabufdest1 = NULL;
+ [8 N( t; @: m3 m5 U7 d - char *dmabufdest2 = NULL;
+ X: `8 t/ m6 i, G: J - * [7 i% T0 u* F6 c: M c$ c
- static int acnt = 512;
- o; G1 v3 x& Y( L; ~# A% }/ C3 H- _- y1 c - static int bcnt = 8;* p7 m2 ~# R" \( i3 l* E& P" I
- static int ccnt = 8;$ G a# m) b5 J( b$ B+ B
: t2 M4 ]4 x" F: T: ~- module_param(acnt, int, S_IRUGO);
8 a4 t, S6 }6 t. F+ e7 c% O - module_param(bcnt, int, S_IRUGO);
! `) h9 @9 m) }% G7 ` - module_param(ccnt, int, S_IRUGO);
复制代码 1 j# r9 C9 d/ g
1 O5 l* h! l3 m; T9 @; z1 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ~, U# o$ m9 @/ [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ P' r n# ^' v- k! I; |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* v- `6 a9 W: ^ p$ ]
, Y+ K( U1 ?7 b5 i! r, ~- p; `% ]/ S6 Z, J3 c8 K, J' w/ B
|
|