|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 h5 Q; w4 V# K* i; s" }
- [code]EDMA sample test application1 l0 N2 e$ V$ u( @5 m0 O- d# x+ @# Q
- /*% \' J# e3 j6 x. S
- * edma_test.c
! _+ n) d; b3 s O - *
: z. n8 Z" C4 p2 I& } - * brief EDMA3 Test Application
1 C/ R6 p! `6 U9 W! b7 _ - */ p; T' c/ H/ J+ u9 ~( }
- * This file contains EDMA3 Test code., Y2 Y1 s. X# f6 x
- * p; d7 O0 A S4 |0 _ b A v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; m% M0 w8 R! H) D* ?" [8 f, u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 _4 Y- {0 U1 u2 b8 ` - * TO CHANGE.$ D2 K3 Z- m+ b
- ** g" \* F. m" {0 Y7 n' t4 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. a* q0 r/ ~0 S4 `3 M0 Y( B6 H
- *
* ]: j5 T: F0 E' Q0 L/ T - * This program is free software; you can redistribute it and/or
2 s5 t) R( l: c2 z2 a; ?, O1 f - * modify it under the terms of the GNU General Public License as
3 p4 r) G" C* f: U - * published by the Free Software Foundation version 2.* Q/ c1 c8 ?. T/ O" O
- *& T% J- J1 g; z" j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. z! z/ e4 M8 }; {2 v) l2 @% {
- * kind, whether express or implied; without even the implied warranty6 ?5 w; ~, h s- c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 l8 C. @4 W3 b% c j* t) H5 ? - * GNU General Public License for more details.* W4 F/ W; P( W2 N O+ b$ r
- */
4 a4 A( P) Z+ c$ c$ x" I - ; n: G' X6 W3 d1 o1 a
- #include <linux/module.h>
5 f- M& x) \1 H - #include <linux/init.h>
. b1 ]3 g& i9 r$ Z4 O2 Z) L9 U- V - #include <linux/errno.h>
" [" Z1 R2 t, x& g9 S! G - #include <linux/types.h>
& p S- B! Y7 R) v# b, x6 l N - #include <linux/interrupt.h>+ T; H' }: b. h$ F
- #include <asm/io.h>6 i! q4 k- ~+ u% T
- #include <linux/moduleparam.h>. U2 T8 {7 R7 i1 O1 x/ \
- #include <linux/sysctl.h>& P: j5 P e" Z" p9 [/ j K0 h
- #include <linux/mm.h>
* F; c/ W: p# y, k - #include <linux/dma-mapping.h>
* s( @4 \5 W1 G, U8 S+ `
7 J- o: m4 O- c B) l4 s% `- #include <mach/memory.h>, w# _$ \; L" S- t Y! R
- #include <mach/hardware.h>
$ A( c$ o$ }9 }# Q0 q) F - #include <mach/irqs.h>, s# N6 E E# o
- #include <asm/hardware/edma.h>0 { s! D# |2 y+ N; \' v- ~6 C. f
- ' Z1 J3 M. Z1 d7 M" ^
- #undef EDMA3_DEBUG$ Q! {; P1 z4 S9 i6 |* M* [. w
- /*#define EDMA3_DEBUG*/- v* Q' O! g% ~3 Y6 O* n& c
1 }4 b. W8 ~( F9 z* t* S- #ifdef EDMA3_DEBUG
, u" {0 i' f; t( V$ _! |3 k$ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) @6 G F) Q( \5 ^# @3 w; w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& R+ p- {" l2 S, C2 R+ G" J8 s8 I p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) c3 q$ }8 ^ L. L2 C v' M6 c - #else7 p0 {1 g) e, ]$ Y/ d
- #define DMA_PRINTK( x... )
/ W6 I; x. h6 E, Q! h0 k( e- W& ^# O; y - #define DMA_FN_IN
$ Z* S. y2 G2 J. t) r - #define DMA_FN_OUT3 h( G- f# u$ E! Q$ E
- #endif
( V |5 r. ^& }# {( e9 }) L" @, |
0 o( n m+ b. `8 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 A! ?) |, A! h) f - #define STATIC_SHIFT 3
9 O+ o& A- U) W N; w) M3 ~ - #define TCINTEN_SHIFT 208 ?* p% |# ~3 @2 l- Z
- #define ITCINTEN_SHIFT 21
& W# f6 Z ^0 Y W' Q& j - #define TCCHEN_SHIFT 22
( u3 a0 K" a/ U* i# y - #define ITCCHEN_SHIFT 23, X$ }3 O+ x9 W8 e9 J% T+ c
7 `, `7 L }' c* l1 s& b& G- static volatile int irqraised1 = 0;
- ~0 T, J# M* s& g: y" i) g - static volatile int irqraised2 = 0;6 }$ U8 z- l. j, P
- # H' Y$ O0 }# x7 Q2 @6 R! ^5 ~- S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! k, g/ R; P$ i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# r, f4 N5 {0 ]& g/ B; l4 c; B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R' ~- C) |2 o
- Q3 {2 }2 a6 M0 i# O: ~- dma_addr_t dmaphyssrc1 = 0;1 l N, c6 a& g- w$ K! _7 D
- dma_addr_t dmaphyssrc2 = 0;/ ^ a9 i( H$ o
- dma_addr_t dmaphysdest1 = 0;( i4 ~% h* e( \' S) t5 ?" i9 Z
- dma_addr_t dmaphysdest2 = 0;
u1 G0 O8 I; E2 b5 x; r0 q/ t
2 r( Q5 \, J6 Q, s- char *dmabufsrc1 = NULL;
4 s! t+ P+ L2 T4 l4 J: f) m% B - char *dmabufsrc2 = NULL;
# }! ^+ x+ \+ L& f- X3 S - char *dmabufdest1 = NULL;
! O" I u3 D3 r0 E* a9 z0 ?& y- t/ |" | - char *dmabufdest2 = NULL;4 z, v+ ^3 o' ~. m' Q, W* ]5 Y
- - @) K3 w) b& L5 _# t
- static int acnt = 512;
& X8 j1 m G! q- J3 J1 e - static int bcnt = 8;+ z8 t* T, l6 |. |
- static int ccnt = 8;% ~! U& @" k7 Y5 f% O0 S
% i- U2 ?4 q! t8 @' b- module_param(acnt, int, S_IRUGO);
: e3 y' T$ D. x% @9 E - module_param(bcnt, int, S_IRUGO);1 p( a0 e0 h# i2 p1 X! T
- module_param(ccnt, int, S_IRUGO);
复制代码
, o) R- q+ j/ w8 b5 ^5 J* R# \/ x' q. \; o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; g% j& {1 P( u% I6 A! ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! W7 J& o( T$ |0 m0 G' N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T/ m- x! J- I' Q4 M, S! W
& k& [6 ^9 B. P* e9 H+ C* w
9 a r8 L3 k* w& |4 { |
|