|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 w" C/ q: P# n( R- K
- [code]EDMA sample test application7 W" @# q, _2 k/ K4 u! {
- /*1 k, A M. c& c" g' ~; }
- * edma_test.c& N& X! K5 d. ?, H( |0 S! Q0 b
- *
v G& F4 _% l$ ~ - * brief EDMA3 Test Application$ W: i2 i+ R( B- s
- *- b& R+ }* o3 E
- * This file contains EDMA3 Test code.
' n2 S0 ]8 E( [7 P5 z8 \ - *7 D; {0 y# W: x/ O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 L1 y( L/ r$ V( P, h% N& d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 G n* `* t+ Z& i, o/ M* A& B
- * TO CHANGE.# C6 }$ J! B- n5 o$ a! h( ?" ]
- *
( t' K- Z, j+ \3 U+ } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( V/ i* S1 O) C( d, y. s - *! H- k8 H& ]# s0 ]+ l
- * This program is free software; you can redistribute it and/or
; i- w( u$ I: X# e- I - * modify it under the terms of the GNU General Public License as
7 A& c6 ?- d" e6 b/ U7 g2 J - * published by the Free Software Foundation version 2.
& n+ H+ p/ {. ~ C - *: r" }$ E0 g+ C; [( c/ g) }7 W" }. D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: Z* l- u2 x+ o. G( y# N1 C - * kind, whether express or implied; without even the implied warranty
! E& H% k; r5 g4 R3 ~9 j* _3 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 T7 }/ V; V5 i8 t' { - * GNU General Public License for more details.
+ X( h4 [: g* F) K2 p2 K* }" M7 G- m - */2 I9 P7 S5 t) G
- c, I' Q) T6 j! C4 Y5 q* N0 a5 w
- #include <linux/module.h>- H! {; M9 M& ]2 s! M& y
- #include <linux/init.h>
8 A# E( K& _; Y3 n" T2 ^/ p - #include <linux/errno.h>; @3 Q$ l* y% \
- #include <linux/types.h>2 s4 [/ a5 T% \. E h. Z: X5 y. i) v
- #include <linux/interrupt.h>
2 O& _% ^1 p* g2 P/ s1 u - #include <asm/io.h>
! G# h; h( m: ] - #include <linux/moduleparam.h>; O ^) l* ?/ |+ T0 b5 a, ]9 x* ]
- #include <linux/sysctl.h>4 F4 g, y' J! [, m! S# @
- #include <linux/mm.h>4 i0 `+ l4 A; o$ o8 O( ~3 K
- #include <linux/dma-mapping.h>
% r3 b' m# a5 I - $ T7 }" b# P) t) |
- #include <mach/memory.h>
4 j2 @& ]' x' _: I4 { - #include <mach/hardware.h>
3 K: o! @; L6 J - #include <mach/irqs.h>- X1 ~4 E; S$ v) ^) R8 E
- #include <asm/hardware/edma.h>
" A' ?% C+ I% }. ?8 h' @, s' ?
; F' F- i( z" @- #undef EDMA3_DEBUG& N. T# y' _6 P1 H$ e
- /*#define EDMA3_DEBUG*/
% F. n, l; g" Y/ c! |4 T - 5 E3 F3 `) B$ I8 w b3 m+ E
- #ifdef EDMA3_DEBUG3 F+ j/ a: J6 i; H. ]3 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 m0 _4 f4 ]& R! }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# `8 Z/ _$ W2 C, }/ ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. V0 f( }9 T0 j& a8 ? - #else0 k ^) E B# |) ?9 x
- #define DMA_PRINTK( x... )
4 H7 O) p; Q# O1 C7 S" w - #define DMA_FN_IN) ?7 p: m3 L% }
- #define DMA_FN_OUT/ o: N& S; `3 C8 i' J9 z; K
- #endif) O+ t* `- o! u1 f3 R/ T
- 0 O+ J, h- f5 z7 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. D! g6 K6 k$ O: a( p+ F - #define STATIC_SHIFT 3
1 Y6 @ Z5 p- _# `3 Y6 Y - #define TCINTEN_SHIFT 20
+ P( x, [% t: u, W - #define ITCINTEN_SHIFT 218 h- @' |- C( R6 {1 D
- #define TCCHEN_SHIFT 22
8 b& `0 a& K9 @- `/ e8 s* p - #define ITCCHEN_SHIFT 23
. r/ w4 [0 o+ i2 |
( k4 m; Z6 z+ g- E; X: m- static volatile int irqraised1 = 0;! h: W% q2 E7 B. @0 z; L4 F2 R# a
- static volatile int irqraised2 = 0;
- Z9 }$ w7 b8 c+ {$ _ - / m, D+ q' L/ P) S. {, X+ n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, y, o8 X9 ?( p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 P: g' V& i& i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ T- S4 }# b B. Y% W6 E4 t3 ~
- j8 F7 y) q' s1 a6 `- dma_addr_t dmaphyssrc1 = 0;
; \0 S/ `( `7 `) m - dma_addr_t dmaphyssrc2 = 0;3 G) g: }8 O# h3 o
- dma_addr_t dmaphysdest1 = 0;
P5 S% e8 o$ V9 e7 _; v - dma_addr_t dmaphysdest2 = 0;8 w& D- v" u1 e5 V/ Z; n
- 2 c6 v0 ?" t; l% O
- char *dmabufsrc1 = NULL;
5 T- U1 ?& `9 b8 |, l$ c! F - char *dmabufsrc2 = NULL;3 Y. s: E, d; u: @' J9 b
- char *dmabufdest1 = NULL;6 `7 o9 F8 f* |
- char *dmabufdest2 = NULL;; ~4 y, M# r( y: S% a" p
- : r) m& H/ R8 Q9 ?; F
- static int acnt = 512;& j- j3 a3 i2 {6 k0 V! q; H
- static int bcnt = 8;
- w+ W/ O1 J; S, ~. p - static int ccnt = 8;
6 S1 K3 Y# N. N" C - 2 F6 {5 |9 b1 O7 M$ y8 d0 ^
- module_param(acnt, int, S_IRUGO);+ j- g0 [% S- C. z- s$ ^1 ^
- module_param(bcnt, int, S_IRUGO);
2 {' d+ m0 K! z) b0 p - module_param(ccnt, int, S_IRUGO);
复制代码
! Y" N1 s% j, n. [' W) n9 q
8 s/ `9 x7 Q$ X+ ?0 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 A0 x9 m& `; C; @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 N( @: t8 o5 d/ Q: Y/ g9 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- A7 U; o) B7 d9 d% N! m B
% C" v5 `" N- Q+ T9 _
& e! O" {4 O; r' W, @$ A |
|