|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; m, c0 A O+ ]% X+ C( K8 I
- [code]EDMA sample test application# ?' }1 h3 ]' K5 m2 k9 X# y7 \
- /*$ j; m* z, E- d
- * edma_test.c
8 E+ n$ b, B: @- E1 p# Q - *
( }" l, T$ {( v: q, }2 ` - * brief EDMA3 Test Application+ X& n3 n& g! a% f+ V
- *
4 j# I1 d4 J7 M! |( [5 f - * This file contains EDMA3 Test code.
. [& S: ]1 G4 U* g - *: F$ [9 f6 A8 d5 |: G9 Z3 r3 U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" B& [5 u# W( H1 b: j4 j! G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 ?, [& o3 |% A( f$ v2 s - * TO CHANGE.& a1 F5 A `$ e J/ r
- *
3 k6 ?) Q9 e5 M) z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& m( A: X6 z- C6 g7 v) S
- *
' [# f" @9 X, A- S; n* N- G R - * This program is free software; you can redistribute it and/or
" `; ^2 I6 K0 A" |# [: J4 o' o - * modify it under the terms of the GNU General Public License as
- Z; P5 R1 q# ^5 t Y% `- h - * published by the Free Software Foundation version 2.
2 [4 U H" k/ D% |# v) {, t5 s' I - *9 Q% R6 R( q+ p7 }# z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ n# i( _- U; k) r* Z. _$ J - * kind, whether express or implied; without even the implied warranty" A$ l+ h* @' H( x; T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# S3 A" f0 X4 `8 W- O8 h
- * GNU General Public License for more details.
3 E/ N$ \5 |& K - */ ?) x+ Z) E/ k$ K9 L
- 7 ^* Y" y( M/ K# u8 Z
- #include <linux/module.h>
9 d( m; s; F# y+ W - #include <linux/init.h>0 d- }! M# x! W8 m) A+ T
- #include <linux/errno.h>
5 G9 @. ?% a* s7 ^ - #include <linux/types.h>( @4 _$ x5 Z' R' e4 P& `" e0 `
- #include <linux/interrupt.h>
. Z0 f+ Z3 i! { - #include <asm/io.h>
/ p' Q; h3 N6 D) C I - #include <linux/moduleparam.h>. ]1 u* F3 y0 d3 a0 u+ B
- #include <linux/sysctl.h>5 @4 F; F m" Z; u/ ]
- #include <linux/mm.h>8 W P; p* L: t+ i X; C6 X8 `
- #include <linux/dma-mapping.h>
& o6 ?! j* U7 Q - 4 V' m& t5 D k5 F' J4 n
- #include <mach/memory.h>4 w# g7 x" K0 D, J% E$ L
- #include <mach/hardware.h>) }0 z# [/ \! L& g2 i' x* ?
- #include <mach/irqs.h>* @+ k ?) R6 l/ p' I& B+ [4 [1 F
- #include <asm/hardware/edma.h>; `, ]( R* e" A; E0 ^% c
- " i5 O/ i D% i- Y, W [' h
- #undef EDMA3_DEBUG
% V, D2 U L( h" x+ x1 f+ k; B$ x - /*#define EDMA3_DEBUG*/, N. X7 S; m. B
. r" c4 h! F* ~# ]# ]9 J+ B" O( \- ]/ x- #ifdef EDMA3_DEBUG+ I$ P L: R$ h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ H7 p; K9 n M* ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 K6 V1 R% `5 D/ {2 @1 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- N" P' H2 ^! W6 [ - #else
2 B0 }4 K6 C8 z - #define DMA_PRINTK( x... )1 w7 ], o% O( o1 w, `- B7 G, |
- #define DMA_FN_IN
' D3 r: _3 k# h7 Z - #define DMA_FN_OUT
! b; }8 |3 Y3 F7 l. S - #endif
9 l( e$ Q+ w6 ~! U+ L) z - 0 v- M6 g U3 a+ q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; t) G7 n; t5 ]1 v1 P - #define STATIC_SHIFT 3+ P T" o! v: k0 Y/ v, T% L- u# g3 j
- #define TCINTEN_SHIFT 20
/ a4 X: u" P1 A) Q - #define ITCINTEN_SHIFT 21
) G. _% _6 q0 h: y; O - #define TCCHEN_SHIFT 22. \0 m) L4 y7 s: G4 P
- #define ITCCHEN_SHIFT 23' o. R g1 w# Q! s0 I2 p* W3 J
- / W+ p; A( S2 G$ Z
- static volatile int irqraised1 = 0;- p1 `) s% J' P; d, F& C0 Z3 N
- static volatile int irqraised2 = 0;
1 a* v5 G6 J4 o - 1 V# H5 A! c3 x5 F9 q' O4 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ J: `' Y/ B/ n1 E( Y; ~9 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q; ]) ]' V$ {$ ~" p/ b: d6 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- {/ t4 x/ I7 P3 X) g
$ m" `$ A8 [- Y- dma_addr_t dmaphyssrc1 = 0;% }1 \& @- L( Y( K' q1 a
- dma_addr_t dmaphyssrc2 = 0;
/ l+ x" W! O. \# Y6 K - dma_addr_t dmaphysdest1 = 0;% S R5 E+ r4 y6 `
- dma_addr_t dmaphysdest2 = 0;/ N* T! b. W# p2 m4 K
- h0 r1 n+ ]4 U& j; z/ _1 e
- char *dmabufsrc1 = NULL;- r" {: W7 J; k* N* t1 f' }1 L
- char *dmabufsrc2 = NULL;9 k/ _( t* u) m
- char *dmabufdest1 = NULL;/ Y. v ~ A* P5 I( f2 J
- char *dmabufdest2 = NULL;' J7 t+ \/ b7 G% g& u. \
- . S$ |/ \, L' C: |5 Y }
- static int acnt = 512;3 w& v7 H( M$ Z! u1 d
- static int bcnt = 8;
4 d$ a! ~5 w! _% N5 a7 P | - static int ccnt = 8;
% l1 F; g9 ~ x9 R& `/ O( ] - # ~8 e8 @, I: z
- module_param(acnt, int, S_IRUGO);
7 B6 {: O \9 L - module_param(bcnt, int, S_IRUGO);
5 g9 c' N+ {- R' x9 P0 p - module_param(ccnt, int, S_IRUGO);
复制代码 2 k) v- U7 k$ J* {
, m' g, J% |* B; g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ ?3 R! L8 S3 J6 O- @' ^6 q' R: Y+ q1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: r' i2 {# n6 G9 a; V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' m1 K+ H: |- ?3 ^) q
+ J/ E% ]# U2 w
& H3 n& q% ^5 t |
|