|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( a, b1 p3 V% B7 I) t. d- [code]EDMA sample test application u( ?# b! H/ u# A! x8 H
- /*
6 p& z# e7 z1 w2 B+ ` - * edma_test.c$ ~7 ~4 O0 f/ L5 K5 U" x
- *' x. |" z* s) |$ r
- * brief EDMA3 Test Application
+ T! h3 D t* T2 ]1 z$ X - *9 Q! e9 i; n$ N; Q# k$ O( N' ?. e6 ]
- * This file contains EDMA3 Test code.
- P' t4 ~/ \6 v* E, y& l1 X3 m - *
& a# @1 u% G) z7 U; w- r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 W0 `; x) d; p0 C# y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 t0 m; D/ {3 C7 f. C5 t. z" f8 w - * TO CHANGE.9 d6 z$ U! Z M! H
- *
. [; M$ Z6 U" `( ^: u- | J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
h* F0 i- X y2 ~; P) } - *1 Q& ~% F: G! k. h0 \3 l( l
- * This program is free software; you can redistribute it and/or" j O; v% a3 C- G$ d. K S0 P
- * modify it under the terms of the GNU General Public License as3 E5 |# F5 g& b
- * published by the Free Software Foundation version 2.
/ f) U" K! {/ e5 \8 d+ }8 E5 a - *
' c0 d- p& H7 K$ Y, Z( y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 T6 Q( M m( c* T0 B8 ^6 {) l
- * kind, whether express or implied; without even the implied warranty
+ `* U7 w6 S( L# {2 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, e0 k* _: a0 b6 }/ J$ D - * GNU General Public License for more details.. e6 U7 b! x: S- U
- */ b* X T; |! ~
- . B: J( w. t: f! ~( B. l
- #include <linux/module.h>
' B7 k! z1 w3 I - #include <linux/init.h> D a8 ^' ?$ V
- #include <linux/errno.h>
9 p' B/ Q5 B0 ~1 g* W - #include <linux/types.h>
9 c% F- D+ b, _: @3 @6 I - #include <linux/interrupt.h>7 a/ E7 C. P1 t3 [5 c$ O9 P! d
- #include <asm/io.h>& _0 x7 M4 F$ U
- #include <linux/moduleparam.h>7 m; k: ~3 ?" C8 q) D
- #include <linux/sysctl.h>( M. {% w) H1 E% t6 \7 C- P
- #include <linux/mm.h>
5 [: ~' D3 B4 W) @# \3 n4 T2 K - #include <linux/dma-mapping.h>
7 V1 i/ I" K5 e6 O) I
" c! K: Z6 B$ T _- #include <mach/memory.h>
9 d1 L+ t, T2 j$ l1 ]' w - #include <mach/hardware.h>
5 ] {7 ]- l# o! P3 D# P# d, h! b - #include <mach/irqs.h>0 _. \) S' z B
- #include <asm/hardware/edma.h>! b, ^1 k. d# {5 _
- 8 Q, N( @( Y" i
- #undef EDMA3_DEBUG$ V4 j5 d' l# b9 M6 s
- /*#define EDMA3_DEBUG*/5 C9 J8 r' ^% k( M5 c
- : r% o; k+ q4 L" _; p9 e8 R5 f/ ~5 Q6 M
- #ifdef EDMA3_DEBUG
v9 W [2 \5 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 x: z/ h8 h; q' n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, F+ U6 M; r4 v A- U$ p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 U9 w0 x5 k# w9 o% J" u- p X
- #else% k. T! C: s! C3 D& e( e
- #define DMA_PRINTK( x... )
, P5 W) n/ {) l/ {$ X0 Z - #define DMA_FN_IN) q; g# k0 p, C6 x
- #define DMA_FN_OUT
8 a6 ]$ P: A, T8 a2 o7 D7 N0 m9 ` - #endif9 `6 u B/ j7 x
- ! B- K3 D- S$ N: V5 w0 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 u0 d# D# l# I- [* a9 [ - #define STATIC_SHIFT 3$ g6 {$ ~1 N9 l* Y0 z t/ S7 a# F
- #define TCINTEN_SHIFT 20
: u% } {2 d$ ~ w. R - #define ITCINTEN_SHIFT 21
5 v4 S6 h- h+ U - #define TCCHEN_SHIFT 22
9 M- { K6 A; `; `' a, f - #define ITCCHEN_SHIFT 23! T- m& V9 x- p
; N7 @. Z: Z5 z& T. d8 ~" A- static volatile int irqraised1 = 0;8 Y. t6 g' h! g- a R: \
- static volatile int irqraised2 = 0;
% g5 n$ H+ o$ ^$ w - # D( C7 _7 ]- [4 b5 ?6 _2 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 s4 P. s: T- e" ~3 E3 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u- I' K' v. b' v+ U9 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: C: [0 v$ t+ x3 V2 v3 a: }
. ~+ D' l4 p7 S+ y8 `1 E- dma_addr_t dmaphyssrc1 = 0;
; [ B# b( L$ ^, A' S% |( V - dma_addr_t dmaphyssrc2 = 0;
: H8 B! T- K o ]6 f. T2 A - dma_addr_t dmaphysdest1 = 0;6 E0 t9 [9 h: A+ ~& C; l$ o8 h9 i
- dma_addr_t dmaphysdest2 = 0;/ R! i% q8 _5 U+ d3 O7 s
2 L" F) Y% c4 [5 m- char *dmabufsrc1 = NULL;
W4 b3 Z* U8 D K! y" r - char *dmabufsrc2 = NULL;- D, M) S4 u5 x! R: m
- char *dmabufdest1 = NULL;) E( O3 I$ r5 x4 `% O5 U2 W0 W& h
- char *dmabufdest2 = NULL;5 I! ]2 k5 \1 G$ L
5 G' q, V o- l/ G/ W- static int acnt = 512;3 L. i8 C9 ^, N! c+ t+ z
- static int bcnt = 8;
2 M3 W0 P- g0 b% { - static int ccnt = 8;
. k5 F8 ^2 C/ X4 X& ~4 e - , A9 ?% o$ Y5 y- I% R; ~9 V2 D8 z
- module_param(acnt, int, S_IRUGO);
3 D( ^9 e) E- I9 w( B' [% L2 z6 h5 y - module_param(bcnt, int, S_IRUGO);) {: ^7 n9 S$ a3 z0 w
- module_param(ccnt, int, S_IRUGO);
复制代码
% _' G! p; ?! p6 b( H& O: x6 H* J9 f" V+ U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% c T+ E7 E3 g3 ]; Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 }4 X2 F# i% b( c3 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; f3 [2 r" ^' }/ V- V$ v+ ^
4 V( R7 N+ D: n' o0 l$ m1 ` c: {6 @, l+ S" M+ Q" k( U
|
|