|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * W; `7 f% Y! J3 w: r2 ~" X
- [code]EDMA sample test application
( V- ?! f6 j$ D. C0 D: u) V* j/ H0 a - /*
( W5 O* L, r ^" J( X n/ N - * edma_test.c. M, D+ ]& g1 U
- *
, p3 X0 x* O5 V) B/ x; a+ b - * brief EDMA3 Test Application2 A! S) T: j8 r. `+ r
- *; q. h! F. n$ x9 O) q
- * This file contains EDMA3 Test code.* ~# i# @* g1 J" X: p
- *8 z7 M- K+ @. v6 |2 h4 _% Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" I! h y" e$ E7 u' u8 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* }- K$ t0 w; D; ~ - * TO CHANGE.5 ?% ~ N J" e8 e$ B" x( O
- *
( W$ V+ k* L2 P: i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" r; L/ X' Z7 y" _2 ?* u - *
5 N9 C. | w# D0 W( D# U - * This program is free software; you can redistribute it and/or$ P8 c' w, ]# k
- * modify it under the terms of the GNU General Public License as
* g& @* \/ g- @+ U - * published by the Free Software Foundation version 2.. G. M9 \2 E- j6 q. X3 W- x/ s U
- *
- h `. \# Q2 x& H4 O: X0 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 k( ]. p0 C- _. e
- * kind, whether express or implied; without even the implied warranty0 b" s9 x6 h/ c/ J' k( o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; Y8 @7 Q6 q- T7 z - * GNU General Public License for more details.9 ~0 j/ K- P3 D" x* Y
- */( H, _$ a6 {% [
- ; j' \# Y! h- `* r
- #include <linux/module.h>/ N6 K7 M: n& A. v
- #include <linux/init.h># S. {1 y$ p6 o
- #include <linux/errno.h>
4 r/ v: F8 U |; h0 [8 F! O+ a - #include <linux/types.h>
Z4 B( Y6 l! z$ e4 W - #include <linux/interrupt.h>
1 d( Q* i% N* p j( u4 ^7 }# b - #include <asm/io.h>
% j% v) i9 t& e- U- L - #include <linux/moduleparam.h>. ]' r0 O# w4 l5 O
- #include <linux/sysctl.h>
0 h; ?1 C0 b* J8 q$ J& Z3 g/ { - #include <linux/mm.h>
+ ~: A1 g/ H) a/ R m - #include <linux/dma-mapping.h>* f" {" H# `+ Z3 J' Y3 ^$ ~1 {3 x8 d
/ P8 H7 ^% \& S! z7 L$ q8 W. B- #include <mach/memory.h>
, K7 d9 a: o# B4 { - #include <mach/hardware.h>; J5 M- u( I: G4 Y4 g6 t
- #include <mach/irqs.h>; F r# p0 W- Z5 ^* I2 y j5 s' d# K
- #include <asm/hardware/edma.h>4 f. }' O6 F( i5 m% r6 y1 f8 J* F; x* @5 r
2 O/ W$ b& i, n9 c- #undef EDMA3_DEBUG
! v9 o! X2 }6 h L, e6 h; n - /*#define EDMA3_DEBUG*/
3 C, f: ~) f- K; z5 I
2 y* h# R* H, l$ T! p7 [" T- #ifdef EDMA3_DEBUG8 D* Y1 M: Z3 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ J% F8 P( V: L9 R9 F0 }( Q, D$ a3 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 r$ u/ r) |) D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# N( a' I! u& S - #else
! |# U' `+ w6 x- M+ ` - #define DMA_PRINTK( x... ): R4 o9 _" c9 X) d* E
- #define DMA_FN_IN
0 D& K- o) E" ~0 B" b. ^ - #define DMA_FN_OUT' o( C/ @( B D; C+ C9 u$ O. I
- #endif( O- D$ r! b8 U& P& E k, Y. v
- 2 S( u7 u7 e6 C5 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). p9 P8 I9 N r. h* {4 _- Q b0 O
- #define STATIC_SHIFT 3
9 l) g, v6 o4 U, G/ [! u/ |9 F - #define TCINTEN_SHIFT 20
9 o/ l; m& ]: s - #define ITCINTEN_SHIFT 21
/ t p# A: e) ?5 w- A - #define TCCHEN_SHIFT 22
0 h" E( B! @* y$ M7 w - #define ITCCHEN_SHIFT 23
, b* ]0 }4 x) j0 Q# V1 k - % Z# `( U: V$ ?5 \$ Q
- static volatile int irqraised1 = 0;' V- K, W5 Z/ U$ w9 v1 W
- static volatile int irqraised2 = 0;
- k, o. B. u: S/ p
4 n, F/ |" u( d( ?) z. w) A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 m$ A, T6 g- R# _9 Y* z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D" D( N* {% u: w! o6 P8 J" e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; n9 K& \% U4 m; J7 P) I3 F - $ E# y$ P9 L1 K" _7 H. N
- dma_addr_t dmaphyssrc1 = 0;
: R/ B) J0 P9 b+ i0 W - dma_addr_t dmaphyssrc2 = 0;
+ p6 Q- q: V5 T$ m2 q* k. H) I - dma_addr_t dmaphysdest1 = 0;1 Q; i! V' n8 }2 ^
- dma_addr_t dmaphysdest2 = 0;9 V! M1 f4 a& x
% ]7 m2 g, t4 m, o: b- char *dmabufsrc1 = NULL;7 T' Q: Z& s% _- q
- char *dmabufsrc2 = NULL;8 V( Z7 `$ V1 Z/ K# A2 c
- char *dmabufdest1 = NULL;& I9 o c# B3 N. \1 x' \
- char *dmabufdest2 = NULL;
1 R" S2 x/ H7 d. ^/ U& u b6 _5 l
0 J0 C: M$ E$ U- static int acnt = 512;' ^: {# d# l3 M! |9 J# Q% H1 O" G- h
- static int bcnt = 8;! A) z. v8 E1 [% o; \) i1 l: _
- static int ccnt = 8;# p: E0 N1 J5 p) i/ d# T ]( k
- 5 K. Z5 j: a8 D4 y; Q% [
- module_param(acnt, int, S_IRUGO);
" S. k0 H' _8 g' k: Y+ X N: e - module_param(bcnt, int, S_IRUGO);
/ j# ]6 T# C1 P7 A- \$ V - module_param(ccnt, int, S_IRUGO);
复制代码 2 o; v4 s0 W* w2 @7 A9 J( c
# ]4 M( _# x y- B* E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ o# t( i' A- k$ X. W( b0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# U* P0 {( O- j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h* ~/ Y: |8 [3 J1 Z" D
) o; S) R8 P2 H
0 R9 d3 _1 |& W9 K" H& M, ` |
|