|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a# \( n" U. T- [code]EDMA sample test application
7 b7 i6 ^7 f+ H! A3 `8 J - /*3 B7 |- U/ {; Q, u
- * edma_test.c
( L' y; e5 y- y# v, E - *: \. ~# d- F. N/ I K4 g
- * brief EDMA3 Test Application
/ |3 K1 c& u" K* o0 d - *: M6 Y! T$ [7 t
- * This file contains EDMA3 Test code.- [2 A1 W5 D8 }* c
- *, b) r- M$ F9 R+ r9 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 x. d# B7 |% _- e6 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& D, r. s4 S7 n2 }( \2 w" {5 [4 D - * TO CHANGE.9 Z8 g7 W, I7 t& W) z0 N1 A# p; V
- *
. ^# Y5 j! o3 E" A1 X* y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% l# `+ s7 q0 o& j f( K - *
1 J# V- N Y. M' r - * This program is free software; you can redistribute it and/or! ]( _3 e0 F. }9 w, b8 x
- * modify it under the terms of the GNU General Public License as$ K8 T( s! Q! ~6 }# I
- * published by the Free Software Foundation version 2.
( y `3 m' b# f) b - *2 X2 _; J4 Q; w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 |- p& g3 t/ v' a1 P3 q3 F - * kind, whether express or implied; without even the implied warranty
' M4 h6 K; }( d3 e% i/ c6 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 k5 H, H' @& T2 ?# M: }% h - * GNU General Public License for more details.
( d& K6 m! H" u; X4 T0 ^ - */* K0 y/ |% ]; n; K# e. T) W
- ' z9 C! o5 c+ l8 N6 Y
- #include <linux/module.h>7 _+ Q+ {, v. @) z4 P% I. s
- #include <linux/init.h>
9 R5 F4 s) j" L/ g- i - #include <linux/errno.h>; [( a9 P$ `) q, _2 C+ F0 w7 S
- #include <linux/types.h>& ]8 {% U" P, q
- #include <linux/interrupt.h>8 ]1 h4 q1 `: Y/ e0 U. J( a
- #include <asm/io.h>7 z4 u; @0 o& u6 k6 J: J1 P5 ?
- #include <linux/moduleparam.h>
2 k$ E# k2 L* W7 I3 ^- N4 L - #include <linux/sysctl.h>( q u. W0 N3 i
- #include <linux/mm.h>
8 A# d8 S: j8 `# ? - #include <linux/dma-mapping.h>% i, O. _& M$ ^2 D1 ^; `2 U8 r$ Z
- / X, N& x" {/ S6 @' _; w
- #include <mach/memory.h>/ w1 J* |8 a/ }- D- J% q
- #include <mach/hardware.h>* A# B D k! G9 M e2 s
- #include <mach/irqs.h>+ s2 L6 @% K% r
- #include <asm/hardware/edma.h>
' E% }5 w: l8 R" n; W! b/ T1 c G
* m" o r! U3 [+ n: |. [. r% V- #undef EDMA3_DEBUG0 F: Z% I$ x+ l' f( Y4 J
- /*#define EDMA3_DEBUG*/
2 r }' `6 ?; F. Y* E
" b2 }/ j9 _ ~- #ifdef EDMA3_DEBUG: v$ V- H h4 g9 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ b) ~1 l' o7 h& E* f w2 G; t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 S+ A# G5 p) R0 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- q: W& u0 z4 y+ m( G - #else8 V `% {2 @* `# A3 s( `
- #define DMA_PRINTK( x... ). ?1 K2 n. }8 |) e( T7 U( J
- #define DMA_FN_IN
0 O9 R' T. U$ \$ p" P: H& { - #define DMA_FN_OUT
; E& b& T0 y" f- }5 O7 h; u - #endif
! X C* n% o: B/ |) e" E
4 V) h5 T+ m: b! ?# |( `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 }0 D, c1 S7 M3 v/ j - #define STATIC_SHIFT 34 i- U( l, n) n5 v
- #define TCINTEN_SHIFT 20
* s& ^* J% Y' C; [7 r7 P - #define ITCINTEN_SHIFT 21
) w4 Y" B) a V% D/ U; ^7 U - #define TCCHEN_SHIFT 22- c/ k& V7 o! @5 a W
- #define ITCCHEN_SHIFT 23& q2 P7 C. |6 i7 T2 c% o
' a: B: V; A4 m4 R# Y- static volatile int irqraised1 = 0;
. C( U: D, G$ I% _. w/ V: M2 Y - static volatile int irqraised2 = 0;4 Q7 o3 ~# R- D3 \1 `
- 5 r0 D% K5 V! n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; [# O& S D3 X% f2 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' V" }2 ^' w$ r) u# x1 r! g% `$ G& g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 W! y {4 {( \8 G+ Q7 U
- ) g. b8 W, k$ r4 b$ }4 L _5 g
- dma_addr_t dmaphyssrc1 = 0;
0 ?! z# ^5 {0 R$ H4 E5 _$ X: n - dma_addr_t dmaphyssrc2 = 0;; j, }* a: y# {* {" K0 E8 P
- dma_addr_t dmaphysdest1 = 0;
# G% C+ v# R+ e& C - dma_addr_t dmaphysdest2 = 0;3 E5 [8 [# V: V' s, U
; Q6 d6 G7 X3 }' ?) R* b- char *dmabufsrc1 = NULL;! ~7 ?* W7 s) d6 H3 K( E4 A/ `
- char *dmabufsrc2 = NULL;
- K# K, i8 ^7 X - char *dmabufdest1 = NULL;
0 |1 T1 n2 f6 J( B" U Y0 p/ t - char *dmabufdest2 = NULL;
2 Q- L c$ E j2 ^6 ~. H - 7 V% h3 ]+ d# p! f
- static int acnt = 512;
, s8 j2 A" E4 D; f: O5 J7 L5 i( F - static int bcnt = 8;0 l# S% }* W% m3 X0 w& ?9 Y& x r" {
- static int ccnt = 8;
7 s1 @# [8 S% [, M3 M' K, O
^5 n* R7 Z/ `1 y6 a- module_param(acnt, int, S_IRUGO);
3 |& D; B0 p( ~8 B/ {# G! h2 O! ^, ` - module_param(bcnt, int, S_IRUGO);' q i" f% `' \- E# \- I4 [
- module_param(ccnt, int, S_IRUGO);
复制代码
; B7 Z i8 F6 t
3 ^, d, [7 { _* ]$ d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# z8 W. ~! ?+ n# h' ]; Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% {% P0 n% h. S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( ?" Z3 w! p' j& W
, { o3 P0 M5 v c( m$ G2 W" |
9 t9 N9 N v7 }6 y/ Y( v3 H
|
|