|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# p% i. c' C" m- a$ ~- [code]EDMA sample test application
6 w2 t, B3 H( K/ Z7 k - /*2 ?. e4 h* }8 X w0 x
- * edma_test.c
9 `3 ~+ ]( x4 E4 Z$ w5 f - *7 P# Q5 ? k4 ?, ?- m
- * brief EDMA3 Test Application
; Z# q; [/ ~& `5 M' z( T* D8 ` - *
! p" g6 @7 D- `1 v& ~+ T" h - * This file contains EDMA3 Test code.* z x4 W7 {# b4 g* R, I+ \
- *
9 z( X& W2 L/ d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: t7 ?/ _3 w" R! _9 {; y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 @9 Z9 w/ g3 T! T. _: p - * TO CHANGE.- |* h( m$ k$ e1 x
- *
6 W r& f Y) C5 Z) K7 K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 _5 c9 g0 }# R) v+ S8 z6 s
- *2 ]3 z1 O2 W6 k% ]; y* e
- * This program is free software; you can redistribute it and/or
1 c# A9 P; R3 `0 p* }5 a0 b* A; n/ Y - * modify it under the terms of the GNU General Public License as
7 h' _3 _" A# E! [ - * published by the Free Software Foundation version 2.2 T% }" z' a& g
- *
- q/ x' `# w% @7 [, t+ f$ r- | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. M" n, r5 j4 j3 p9 h) N
- * kind, whether express or implied; without even the implied warranty! Z( _$ F' a7 o1 f# X) c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; v+ |- z- u' S' O9 D7 V, ~! G! K - * GNU General Public License for more details.0 A# s- z( X, U& N
- */
7 C& X1 s. G5 }* M4 V ^, s - 1 R! L; v. J) z1 C- y' n& A# F
- #include <linux/module.h>
3 f4 P% @, ?9 E! S* g - #include <linux/init.h>$ m0 ]# L* m, N7 e3 W9 {
- #include <linux/errno.h>
2 v" V6 ~, m A O0 v" g5 l - #include <linux/types.h>! ^7 {7 r+ o" a
- #include <linux/interrupt.h>% w: Z9 z1 D" C4 n; i- E( u
- #include <asm/io.h>& k, W9 ~& K/ s. J s
- #include <linux/moduleparam.h>
$ H1 C, j. _/ x! T) @$ t8 n - #include <linux/sysctl.h>' B: @, J% q8 ?5 O8 ?( [2 s% V
- #include <linux/mm.h>9 q5 v% Q n* g2 b! U$ d) s0 x
- #include <linux/dma-mapping.h> _7 l8 J n! S! P$ i7 Y$ b
- 3 h. Q2 A# |, d! H
- #include <mach/memory.h>8 G( ^+ z, F1 _7 d. N
- #include <mach/hardware.h>$ ^) ^! e% O/ n8 K0 d
- #include <mach/irqs.h>% _. Z, w# L5 x! }9 m
- #include <asm/hardware/edma.h>2 i: O5 v# u: a+ _2 K9 b/ p
9 V P0 |" N2 V/ I- #undef EDMA3_DEBUG9 a9 m C. {2 L* F: p$ S
- /*#define EDMA3_DEBUG*/& t7 @* C/ ~: b& k1 Y! j7 \5 C7 c
- % ^' Y& t% H/ B& F7 A
- #ifdef EDMA3_DEBUG8 n" q0 Q7 c H: Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" T( ^8 v, ^$ ~3 T4 s& N" W6 W5 h/ [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 w5 P" s: m+ M* \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 e; w W0 [5 `2 G9 Z - #else
! L! b! V) T+ L { - #define DMA_PRINTK( x... ) D) h$ _) d( x1 a& i8 p
- #define DMA_FN_IN7 Y4 k4 ]+ A6 R% E
- #define DMA_FN_OUT% h$ Q+ U9 `+ o% }8 n- y" l% w
- #endif
% P$ Q4 O# \/ l2 l& x0 b% r" l/ C
$ e6 U' L% z; |8 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 s* ^5 K$ \; m- x" [. v - #define STATIC_SHIFT 3
0 `9 P% x) O+ ]6 @- u - #define TCINTEN_SHIFT 20! [% i% H+ j* O; t
- #define ITCINTEN_SHIFT 21
# [, T7 w+ @9 l& J d - #define TCCHEN_SHIFT 22
) G7 p9 A' b) y# s/ ^, m6 P! } - #define ITCCHEN_SHIFT 23
) L( y! f8 w8 e2 U
8 T5 U# p& M& n' q, {" v8 f- static volatile int irqraised1 = 0;
/ J6 E% I) J# e - static volatile int irqraised2 = 0;
. M. d2 [: x+ a9 V3 U - * @% z+ h4 z3 R1 k1 n1 N0 z8 c: N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 G- S9 o7 j, U( k/ h! [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 |% r& o5 H3 i% J2 O# }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G2 R- H4 ~5 D
b _( o7 e1 G+ h3 s- Y- dma_addr_t dmaphyssrc1 = 0;
4 l" j' ]/ H2 b% ]# o - dma_addr_t dmaphyssrc2 = 0;( R" |8 A! x7 h0 X1 v
- dma_addr_t dmaphysdest1 = 0;
) L' x0 E! U. P. k1 x - dma_addr_t dmaphysdest2 = 0;, k# m% @) e4 h, u# N% p& ^$ @
- 8 J0 T4 u' C9 z: K/ t" d
- char *dmabufsrc1 = NULL;- C2 J5 w3 K1 u- n8 B! [ J) ^ \
- char *dmabufsrc2 = NULL;
1 D4 i. o1 E- _ {" b& f - char *dmabufdest1 = NULL;+ w5 L0 q- L2 [3 Q
- char *dmabufdest2 = NULL;) B- H7 I+ T( |, z& r& N0 T! q
# j) Q! v! W- I/ I9 ?/ W: u9 o- static int acnt = 512;7 K; ^: P. z/ R' @8 q# c. x
- static int bcnt = 8;; a3 y6 G3 i* n: R5 t' x/ v. }
- static int ccnt = 8;0 w- B& t) w: [0 U! y. i8 N! `
- 0 Z" {$ V1 { T- e; W6 _4 g2 O% K
- module_param(acnt, int, S_IRUGO);
L0 Z( o' G E3 v - module_param(bcnt, int, S_IRUGO);
a: Y& _' {, D% B - module_param(ccnt, int, S_IRUGO);
复制代码
+ Z, q9 f0 N9 P( p1 `/ ]% C ]9 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 e5 r4 U, _ L- M- N1 e" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 N& \9 s( o \% D. z4 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 |* \2 o* R7 X5 t& V/ W
" Z: i2 L9 `) L& E. A- V+ V
. s5 H! E* X! Q) n1 {, c
|
|