|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( @6 [7 e" r* C" s
- [code]EDMA sample test application
. ~" w q( K$ Q1 ^- @4 k - /*6 N1 `# d2 {5 ~3 Y# L8 u
- * edma_test.c3 k! c" W, M8 I; }/ i; m0 g& [
- *
) V& e% b9 ?" X: ` - * brief EDMA3 Test Application
' N2 H/ y+ I9 i. ^ V9 j - *; g' {0 b" i: W+ V/ V4 o
- * This file contains EDMA3 Test code.7 i- h x9 d7 i3 W; ~
- *2 @2 p0 {& C+ U& m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 F- f6 C: H* v# k& |; s/ B' A) b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 [- \9 G; b& _5 v- _: M" J8 p a7 @ - * TO CHANGE.
) X0 R& `/ `9 |0 s9 \ - * Q8 c1 {# _* T8 V( Q; [0 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ s& Y' a* E. [ f& e/ C/ R - *) E9 ]/ o; c. x
- * This program is free software; you can redistribute it and/or) C7 _, d# f5 u6 _$ n8 V( ]
- * modify it under the terms of the GNU General Public License as# L6 i: j( G8 s9 Q
- * published by the Free Software Foundation version 2.
0 l3 _; g- K$ d- s7 n% x& g - *( q- w& t2 @: c6 u' l) m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& [& R# ?4 C5 O
- * kind, whether express or implied; without even the implied warranty# }$ f! A% S$ W6 a# |& ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 v+ X, U$ P5 v# s% A
- * GNU General Public License for more details.1 g! ]/ F6 |- h% A
- */7 h0 _- D, ]9 m5 A' U( Z
- ) S; P' E# }# g1 Q9 Q& @
- #include <linux/module.h>
+ v" c0 G/ H) G) A& P) `3 k - #include <linux/init.h>
: t+ l$ u- k1 W+ I - #include <linux/errno.h>
; t3 ?! d8 J; G: t$ w - #include <linux/types.h>. E1 f$ @6 T+ i( O
- #include <linux/interrupt.h>2 y" t8 r6 m$ ]
- #include <asm/io.h>! X8 s# Y0 T' R+ F3 D) s. @" D, Z
- #include <linux/moduleparam.h>
3 |. o. p0 ~9 U - #include <linux/sysctl.h>
/ R' z' d$ l" N- V$ ? - #include <linux/mm.h>! j: h2 F$ w5 I$ P
- #include <linux/dma-mapping.h>
+ N a( G9 a+ z - 0 P3 H1 d- H' W$ [) s% L* c% u
- #include <mach/memory.h>8 s: y8 _2 | l8 Y) n& z5 r
- #include <mach/hardware.h>
' H& Y4 ^0 t. B& n+ Y* C - #include <mach/irqs.h>/ h6 Q7 j9 e m5 ^( L/ X0 r
- #include <asm/hardware/edma.h>
! w. S4 k& ~8 G; B6 f7 w+ p
6 G& j+ i# Z; C2 @7 f6 |- #undef EDMA3_DEBUG, V& q4 d6 G) ?; ?# E# T# L) A, A
- /*#define EDMA3_DEBUG*/
# b+ [* q3 G8 F5 \2 w/ W - / W# V( Y- ~' s
- #ifdef EDMA3_DEBUG# w. x7 X3 d' A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% w7 K6 @" _0 _4 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! I3 q, ^, d& W# w" m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 }$ }2 ]' L% j. C, `. S5 y9 `% }) A - #else
! ^. S' U. q8 L* j, q$ y# Q# i - #define DMA_PRINTK( x... )
8 C8 v+ K% j& W# b - #define DMA_FN_IN
1 n) y7 r/ F' l9 {7 e. G - #define DMA_FN_OUT- D# l$ l3 H% `& w2 z/ S
- #endif
$ J) ^ V& {) ~. {
8 y! n) S. E# C* U' b5 ]9 R/ U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 }3 c6 e6 o: S& N8 B# @6 E
- #define STATIC_SHIFT 36 \1 r6 _4 j. {4 ?
- #define TCINTEN_SHIFT 20
4 ?2 h$ W/ B" d7 U' a9 ] z - #define ITCINTEN_SHIFT 21
2 R* F2 S" P( W1 g, @" Q" ` - #define TCCHEN_SHIFT 22" f& X' e2 t) o
- #define ITCCHEN_SHIFT 237 m; e) {! b$ T; N7 R( E+ g
0 \* t) u+ U! Y- static volatile int irqraised1 = 0;
2 N1 v4 J& Q9 H& C; o - static volatile int irqraised2 = 0;# n5 U! g: T% U+ c- v
- 6 w; m Z/ R3 U+ C* V6 t; p8 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: C6 s% I1 b0 v/ w+ H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 K* l( c, W% i9 b3 e! x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% {# G- S% W; f! ]* {7 m - ' h8 v4 Z& p9 q" C/ p Z
- dma_addr_t dmaphyssrc1 = 0;( P5 }5 U/ F8 q! p0 t
- dma_addr_t dmaphyssrc2 = 0;+ {. p3 i4 c$ d, D- L
- dma_addr_t dmaphysdest1 = 0;
; z; O8 y5 l1 P6 K6 k) Q. `) ~& K! P - dma_addr_t dmaphysdest2 = 0;; }- c9 B% H8 h( ^5 P
- 1 K- o% t3 c' b( U+ V: s* p5 D
- char *dmabufsrc1 = NULL; V6 b7 b( i! m
- char *dmabufsrc2 = NULL;
G8 h5 f2 C' i( e! I1 \9 u) m" ^ - char *dmabufdest1 = NULL;
7 f! v. X3 n* U( i - char *dmabufdest2 = NULL;
. z. U5 @* ?+ ~6 H' ] - 5 C; P* w0 _) W6 q! \
- static int acnt = 512;
- R9 X# W+ I: n. I. O - static int bcnt = 8;$ p6 z3 Z4 [, q) X
- static int ccnt = 8;
9 R3 k" |- m4 y- w& _+ F0 b v% Q
& @! [4 q8 p f# j- module_param(acnt, int, S_IRUGO);4 M% G3 x" Q, E; J3 x3 p
- module_param(bcnt, int, S_IRUGO);
2 B8 _3 F$ ^0 ]+ U% P$ k* e, F6 J - module_param(ccnt, int, S_IRUGO);
复制代码 5 R( _, Y; _$ g
/ s P6 f& P8 ]/ `9 B3 Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. z* X$ }0 |+ X" oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 T. `7 h9 [8 Q. S- g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; _9 y5 c( I1 [* ]9 b) d/ m. J' f- l! c5 L( d( O
/ e1 N$ e, i j: e2 @
|
|