|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 x8 ]! H1 Q) [6 C# E# W( L! U- [code]EDMA sample test application1 K$ m4 Y' R( U, @; Q0 I8 ]( G
- /*/ @. Q1 G# |+ a# b
- * edma_test.c8 |. V+ K9 c0 W# t; u5 {
- *
# y2 H$ ], X5 {1 G. F1 I - * brief EDMA3 Test Application5 r- R* X' j7 Y. ~- x
- *+ V& H, p; ~6 l3 L/ E" W% Q
- * This file contains EDMA3 Test code.2 T1 y5 s8 N s X2 `
- *9 y* F* W+ j! m' c1 z) W) j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: [" l" J/ j1 @7 X* z# W' u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& V5 v R. g! |4 i2 a - * TO CHANGE.# h" Z. F0 x% F) E! g( R- [# X+ ?: i
- *, g! M! b+ h- R% F, n2 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' e; x/ f- |- X9 Y! ?/ }2 w% s7 |' s - *
; y7 ^5 E5 M1 b/ k6 J9 k - * This program is free software; you can redistribute it and/or
, t% t2 m/ p5 k# ~' a - * modify it under the terms of the GNU General Public License as9 V6 q% y) j( |7 ?
- * published by the Free Software Foundation version 2.
- E' s/ f( K* T/ P. y/ A1 o( ] - ** Y; S- n, Y2 y, w! A. r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 o' h$ j( N# l8 u; x# P( | - * kind, whether express or implied; without even the implied warranty1 \4 P" c8 e" p1 q4 _1 t' O6 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the p8 \7 m; O& Q8 h, p8 Y( `- c, m( a
- * GNU General Public License for more details.- J$ P8 s% s" w0 F, o! D
- */
# k( d: g" Z# x+ Q; I
" }& ], }8 G, a! {( o) K- h7 P9 }- #include <linux/module.h>
; L' B* O$ J3 U6 }" @ - #include <linux/init.h>$ `0 W B/ i4 `0 @; C
- #include <linux/errno.h>. k" I1 p: J- y2 K' S3 w
- #include <linux/types.h>5 E. a3 I% z* a
- #include <linux/interrupt.h>
1 @3 G* g0 ?0 C) u: ?" N; S - #include <asm/io.h>
) Y c- s+ w1 e8 @1 v( } - #include <linux/moduleparam.h>/ @; ]* S- b$ B1 j( l
- #include <linux/sysctl.h>! ?0 G% c6 j! l, h
- #include <linux/mm.h>/ N) r- `9 ]2 N6 j E
- #include <linux/dma-mapping.h>1 `. c0 {9 c8 i( \; @4 l
# N+ X) i/ n( j- #include <mach/memory.h>" a/ y+ A4 V3 S5 o
- #include <mach/hardware.h>
2 u, w- b6 h6 v - #include <mach/irqs.h>
6 G6 \# }" U, R, } Z) p' A" h - #include <asm/hardware/edma.h>
5 Y% Y8 C1 ^; t; G; l2 e, I
! z7 u" v/ H5 w7 O& p- #undef EDMA3_DEBUG
! H* r9 h+ e" }, L' a5 `: h) @; R% r - /*#define EDMA3_DEBUG*/: G% V, Z/ V; f; B1 }, g7 m
- ( ]3 _0 @7 H! W! {! ^* F& z
- #ifdef EDMA3_DEBUG
! n4 C) f5 @3 d1 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 W- _ J% {( n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 K1 W i1 {' `; `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% T L: t5 h3 x! M$ u# V! m( G - #else! O4 g3 V' O) K4 r2 k! q# {' Y
- #define DMA_PRINTK( x... ), b5 e2 a# Z8 G: T& D5 o3 L$ ^9 s9 L
- #define DMA_FN_IN/ [: G# H- l) H) C
- #define DMA_FN_OUT
) w5 Z: `6 B; J# |! H- F$ b4 _8 `; n - #endif
0 N+ k5 X8 A9 l, I& N
$ }: o4 ~; N" `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 [6 v: {4 f& E2 s; w, }3 Z - #define STATIC_SHIFT 3
7 ?: g& x% F; l - #define TCINTEN_SHIFT 20
% J7 b: B9 ]0 t* ~. }9 p9 H, A - #define ITCINTEN_SHIFT 21, r, W }% d- `2 a
- #define TCCHEN_SHIFT 22
5 V, l0 X$ z1 ?( ?! Y# G8 w; J) R9 W - #define ITCCHEN_SHIFT 23: q% F: ^! ^1 e4 U H% b
- 3 ` n! A: B! s
- static volatile int irqraised1 = 0;% P: s( s, v. [, N
- static volatile int irqraised2 = 0;
% E5 a" s& f9 A# p( t/ t8 C
( W d/ S$ Q% b2 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; R4 Q) p5 |2 r, p9 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 h* m% N5 `' h; Z) l; G" O1 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \ U1 I0 A/ v8 Q
- 5 b1 e5 \; {# V9 D I
- dma_addr_t dmaphyssrc1 = 0;; t& g) |6 C G% U0 u" J! a4 q( ? w
- dma_addr_t dmaphyssrc2 = 0;& L l0 e5 t; {: K0 {) M6 R* ] x
- dma_addr_t dmaphysdest1 = 0;
4 R1 Y" H Z! H4 O1 O - dma_addr_t dmaphysdest2 = 0;: r, {* J' b0 Y `6 {4 C
- 2 D4 c; y2 H# A v* F: ~! X1 p9 {
- char *dmabufsrc1 = NULL;* b5 i7 g( P n' p
- char *dmabufsrc2 = NULL;- s9 y1 J3 m, j
- char *dmabufdest1 = NULL;
& Q1 Z K7 _8 q# m( r - char *dmabufdest2 = NULL;$ z4 b: o/ T+ U4 M- s z
- : e$ b! L5 E2 p6 _2 r. k! f
- static int acnt = 512;
0 Z3 U- g, W& s; Q5 R - static int bcnt = 8;1 y" e7 ]; O( T8 N3 n4 O
- static int ccnt = 8;& I3 T2 J% }" }$ k
- ! b9 m/ M; g. Z( ~2 z( G- m* Q
- module_param(acnt, int, S_IRUGO);
+ ?" Z6 G& [; |3 K/ p6 O - module_param(bcnt, int, S_IRUGO);
8 s X2 }! U% v0 D3 _7 Y1 s$ L - module_param(ccnt, int, S_IRUGO);
复制代码 9 v2 x- ? w5 W
0 d) C5 B8 U4 h% l1 u1 q$ ?- E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" E$ b3 _2 V" j7 K3 b$ J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 W1 i0 j! S0 c+ z9 `9 r0 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 e2 e) q% L5 T
6 _' x- H" B/ I# @& S' s$ Z0 D
e5 P$ \5 ^, U* n u2 S _: v
|
|