|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! w$ K6 V8 h4 V2 A2 H U! S7 f- [code]EDMA sample test application6 G) I. m6 l* f! ^/ _$ A
- /*
$ o9 O# }& X6 i+ @- r - * edma_test.c
0 Q/ `8 Z4 b: `4 P - *
5 y+ I& K6 P, M' [) M - * brief EDMA3 Test Application
* d* {2 J4 o) V# j9 Q% @" v! N - *
1 D6 e) Q. I$ W; _' L1 J2 n - * This file contains EDMA3 Test code.
# D# ^1 W' B- s% G, E - *
8 q8 s! W6 O4 x, W' n. J {* g: t( j( R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' \; c" ^+ n5 s$ F$ k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ e* A2 u N7 _$ u - * TO CHANGE.
# o! W3 o0 V/ `9 Z; h) G - *
- ~$ v' e2 b% h2 n. D$ @8 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# \. b; Y' H; D' k
- *. J+ Q9 ?3 Q' i# s; r
- * This program is free software; you can redistribute it and/or
0 h6 S ~4 Y* O6 j" ^$ x - * modify it under the terms of the GNU General Public License as
, p' [: k) A$ G# C) A - * published by the Free Software Foundation version 2.9 m1 J# B) O" M% ]
- *9 @* ]) }1 b0 V8 {6 g1 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
I: L2 V! W9 ~" q - * kind, whether express or implied; without even the implied warranty$ ]" T6 }" m- Q* x% K `) o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ L9 m n% F3 h9 d - * GNU General Public License for more details.
l' y4 q- G6 S8 H$ ^/ X - */
4 l+ w0 K" G% M5 R
! g7 o; \1 _, k4 ?: H0 m" e- @- #include <linux/module.h>+ B% W, B0 b: h1 A: K' v
- #include <linux/init.h>
( R2 e3 o$ X* E - #include <linux/errno.h>& w+ z# M i4 S9 _4 F5 l1 F
- #include <linux/types.h>2 T: C* o$ {( u( d; a/ E7 S
- #include <linux/interrupt.h>, y6 v% d5 @7 h7 U# h6 q$ b' p5 ~
- #include <asm/io.h>
, E$ P! h3 O' \7 | - #include <linux/moduleparam.h>9 J6 J; J# q5 X: d
- #include <linux/sysctl.h>" \7 {, E' j( g; Z$ Z) L
- #include <linux/mm.h>
. u3 v) @$ I. _( F F - #include <linux/dma-mapping.h>
2 e' Q- _# f7 [7 l: F
- a8 v9 E" O8 l+ U0 U& Y- #include <mach/memory.h>
' {" t6 g. ^0 u/ h% @ - #include <mach/hardware.h>
0 C' V! N2 u% k: Z - #include <mach/irqs.h>
8 N; y/ }0 I/ m, a) Y2 h3 c, C& R' s - #include <asm/hardware/edma.h>! K# s$ ] z) H/ U
5 v' z/ R. M4 |+ Q- #undef EDMA3_DEBUG5 n' p; n6 c5 C z# P) a2 M7 _' E
- /*#define EDMA3_DEBUG*/" M7 o6 L2 M o, [' q& }
4 N% N, O' `! m0 `- #ifdef EDMA3_DEBUG
; R; \& F/ c1 b. D# D# R! [) f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 _( S% z1 q; N& s* H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! X. s0 i9 ~+ Z1 b: e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ M. x" g4 v! C& T - #else5 M4 n k, u0 [. A. h/ W4 {4 Q
- #define DMA_PRINTK( x... )
5 p: T+ {" ~( b `3 y B; H2 ] - #define DMA_FN_IN9 F$ H- K7 a; _6 Q. L
- #define DMA_FN_OUT
8 g! i5 b8 P8 w5 `+ f2 Y - #endif
! k4 }0 h! Y- G; ~8 ^8 M
# ~& ?( u# K+ A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& c8 f, _1 N- x4 v& i- B
- #define STATIC_SHIFT 3& V% ~0 m+ e2 c8 o
- #define TCINTEN_SHIFT 20- C' S! r' g4 l' f. `5 C" M! y
- #define ITCINTEN_SHIFT 21
. e3 {7 y3 \8 d) f8 [ - #define TCCHEN_SHIFT 22
) z2 E. O& ~: s2 J& G, D9 F+ O - #define ITCCHEN_SHIFT 23
' |; D2 D+ P3 ~5 s: n0 X" t$ A - 4 P) e9 R; w) u& s5 M5 g
- static volatile int irqraised1 = 0;
* c3 o) d3 T4 G! e5 i - static volatile int irqraised2 = 0;8 w& v- G" j; e1 P0 X
, Q5 y7 d; v5 o. g# z9 l. H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); A H" m4 v/ h& }7 ]1 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?% O0 k% _# n: `5 r) a/ n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X5 x$ d$ z0 s
8 G8 G/ }0 |# _- dma_addr_t dmaphyssrc1 = 0;
- Z, G2 y- @; X - dma_addr_t dmaphyssrc2 = 0;: {5 ?" [! H: _) F/ \! U9 ~- c. ?
- dma_addr_t dmaphysdest1 = 0;
1 Y: t0 x, o" a3 L$ M - dma_addr_t dmaphysdest2 = 0;
|& U9 N! i$ K5 [1 _9 I' Q - ) w! P: o# ~0 R5 S# U5 ]
- char *dmabufsrc1 = NULL;
. D$ u4 E7 {) e. v! e - char *dmabufsrc2 = NULL;
3 {) b/ C& [1 d+ J( k& {0 t! c - char *dmabufdest1 = NULL;* c3 M B, _" G4 B0 z' `& \" S
- char *dmabufdest2 = NULL;
3 \# J& e/ d. \4 C+ g7 z+ g
: L) A! d3 q0 ?) v$ o- static int acnt = 512;4 E! W" `. q! E
- static int bcnt = 8;& ^: g( |0 {1 W! P
- static int ccnt = 8;9 ~. }2 s+ r& D+ D3 W
- 2 `* f2 H p, j" [3 z; n# `! h
- module_param(acnt, int, S_IRUGO);
6 c2 m+ ?* T4 e8 r - module_param(bcnt, int, S_IRUGO);
: X) f9 B- y' R! b5 @! i# F+ j+ } - module_param(ccnt, int, S_IRUGO);
复制代码
: i) ]9 o; T7 P
+ C5 A/ X' u; a7 a, a! @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; X" u9 n8 Y# O; z) |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 R2 Y5 ]) } W! k. ~4 |" L/ {6 W2 u3 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 k) p6 p& `3 s: A
" f7 c) r" J/ n: B* w0 H
3 g# G* ]( y! B* F/ V9 O7 I5 H+ u |
|