|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' C& P5 [% s9 k" Q+ c5 S$ q) p0 h# f' x
- [code]EDMA sample test application
- p7 c/ x& g# ~- o: d6 s - /*
; V$ ?4 B7 K; E7 C - * edma_test.c
7 |- X+ d. Z8 }% z U# s% F8 u - *
w7 A. u3 \: C1 R9 M - * brief EDMA3 Test Application
2 w5 M1 I$ Y1 E" Y$ u/ j - *
" Q0 R0 R6 h8 Z( W) z7 K m - * This file contains EDMA3 Test code.0 V- t" C& h" |3 X8 |
- *
+ B$ O/ t; f5 c3 c# T4 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( K7 } ~8 _$ U W1 F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 b9 r2 T4 A! h
- * TO CHANGE.
0 R" z9 N) J1 H5 }- z6 e6 n4 ?% n - *$ c( _' `# i( _1 n8 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 Q9 @& [! E' c* P8 x - *
1 p- h. D3 F5 u - * This program is free software; you can redistribute it and/or
# D6 d/ h6 w5 K6 g) T1 t6 \ - * modify it under the terms of the GNU General Public License as
K, W- P+ ]& w2 f/ W - * published by the Free Software Foundation version 2.; E7 K* [/ `3 O& x
- *5 D p6 c1 a! s# n5 t" v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( E9 V' G7 `) Y F: p
- * kind, whether express or implied; without even the implied warranty
2 q% V; w! Y) k; V! C: G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" b# ~; I* `1 L# F# i8 u3 ?. `
- * GNU General Public License for more details.# Q! N3 O D! M8 f; n
- */. w" S( [# S$ t p
- 5 \/ Q( h- X/ a7 c
- #include <linux/module.h>- T8 E d8 N- F% I. a) u
- #include <linux/init.h>
q* y' x; _# J3 T0 ?! q - #include <linux/errno.h>5 `' C! e) M5 E. u
- #include <linux/types.h>
7 y$ C( ^) v: x" Y* W+ \4 F - #include <linux/interrupt.h>
3 \4 a$ b- ~2 N - #include <asm/io.h>
+ J: S' }! d, r' y$ |1 N9 e9 \9 V - #include <linux/moduleparam.h>
& g A \8 L* o& j/ U - #include <linux/sysctl.h>
4 ~: K$ a/ S2 M/ v2 M, w6 A - #include <linux/mm.h>
3 [) _: X: e* }3 h - #include <linux/dma-mapping.h>
: ]% x$ w9 X$ z4 }" `" f - 2 X( f9 e8 A3 r3 U" I
- #include <mach/memory.h>
# ~8 M) t- F6 B - #include <mach/hardware.h>! N8 m6 r j' B& G* I- ^9 T* n
- #include <mach/irqs.h>
. }7 x3 o. K& b - #include <asm/hardware/edma.h>
( \/ Q! t! K6 H, O - . V4 O4 ]2 \0 [7 E
- #undef EDMA3_DEBUG: o' `! _% p. H
- /*#define EDMA3_DEBUG*/
6 |9 l) G' G5 S4 |+ l9 Z* z, b - 4 C( E7 W8 B; K, H8 n( k5 O
- #ifdef EDMA3_DEBUG
! `7 z5 N$ f) I7 _: M0 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 U& M! _: i% a h6 b7 o% { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L4 O4 e! f& y. ]7 A6 p0 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 A b; l3 \* c& Q
- #else
6 J; q4 X$ {* |( I% M" d - #define DMA_PRINTK( x... )% c& @4 a' R+ {$ r$ N% @
- #define DMA_FN_IN. j6 o- s: F4 q
- #define DMA_FN_OUT5 T0 w5 j. m2 D6 f. _9 S! ?
- #endif/ Y# x! [4 ~7 f
- - X. G7 ?7 T( |2 ~3 b( O- i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& C, t+ F+ g3 C; Q4 A) A# l - #define STATIC_SHIFT 3 a5 J( s$ a' T2 S- L1 D$ Z
- #define TCINTEN_SHIFT 20/ w2 u2 q" T. i$ Z3 X
- #define ITCINTEN_SHIFT 21 R& B6 d. ?2 p! \& T+ R' [1 N1 @
- #define TCCHEN_SHIFT 22: \1 K" |! B' D1 a( W# X
- #define ITCCHEN_SHIFT 23! A. Q! D4 g% v7 D! d) R
- ! [5 W/ S7 `+ W9 g7 j
- static volatile int irqraised1 = 0;4 T4 E+ f# D; @
- static volatile int irqraised2 = 0;
- l. |3 @. T o7 {0 B0 m. S - 3 B0 U5 z/ y* T" ^$ d" D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# R' T4 H, [4 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U# X! Z! j% C, P7 N0 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d. {2 n; _" T& ^
- 3 j/ K+ u0 R2 q% j. f
- dma_addr_t dmaphyssrc1 = 0;- V- n/ n6 \2 z
- dma_addr_t dmaphyssrc2 = 0;; a6 a0 r6 L. ^- B
- dma_addr_t dmaphysdest1 = 0;) D }3 E# _( N6 \1 ]6 I
- dma_addr_t dmaphysdest2 = 0;3 C5 D" G, t3 m
- 3 o* I3 @ w* ^6 K7 N. o( C: T
- char *dmabufsrc1 = NULL;. U7 Y' q5 z5 t; R) R8 r; W' s, a+ D
- char *dmabufsrc2 = NULL;
6 c; Y& ^1 |( }6 K1 m - char *dmabufdest1 = NULL;3 A: D: f n( G& x o4 j
- char *dmabufdest2 = NULL;7 G* r) m2 `& Z
- 6 w8 D; {: b: a
- static int acnt = 512;
) v- k% A X _ c3 m - static int bcnt = 8;
$ Z+ I) d/ r' g, S! | - static int ccnt = 8;
( w7 r; W# t( a# u. P; X - 6 i# Q9 J+ ^! Y: o& B
- module_param(acnt, int, S_IRUGO);$ d! W q% b% ^
- module_param(bcnt, int, S_IRUGO);
3 d& f) v3 F6 ?5 w) s+ X" [ - module_param(ccnt, int, S_IRUGO);
复制代码
# O. n: r9 O) N/ E6 o8 O+ N( {( K+ u F& n, b$ `! Y! C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# U) A# x- |3 {- o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; F- t! \/ D" p/ Q5 q1 K* k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |: x0 l. p, o: @* f6 s
) W3 ?! N* X2 p$ V4 y0 m; q
( t0 _+ w/ Y" e& S( u+ L" X6 X% `& u
|
|