|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 v! \7 u5 }# w, S8 p9 _; l- [code]EDMA sample test application" T( _. a' L5 d7 U2 m
- /*
f+ W: b1 {4 |9 f7 Y2 h9 b - * edma_test.c
$ y2 ^5 m% I# T1 I2 b - *
1 p& I2 u1 p3 ]$ ^7 y) g; V2 ~ - * brief EDMA3 Test Application1 w3 c9 `( W3 o6 P P
- *
# d- u3 h1 n4 t - * This file contains EDMA3 Test code.
' H7 p! W7 V5 i; E% e1 \ - *
( i" m8 T8 q5 ?% o, j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ \( C3 ~7 B% N5 \; U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ t1 D5 E/ v( k5 f% O: V - * TO CHANGE.2 M; d$ d7 n6 a( x
- *
' H& [4 w% h- s; E5 @4 Z# v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" X+ N; Y( w1 o$ _: e+ O
- *
5 o7 O2 b" r( y/ f: E - * This program is free software; you can redistribute it and/or& `0 T3 i2 s; v# v4 e) u
- * modify it under the terms of the GNU General Public License as& P% q/ c7 p3 `$ y8 b8 R; |( A b
- * published by the Free Software Foundation version 2.
8 u# F$ s, x5 `) `+ t - *
; j6 V( `0 ^( y% P6 ]3 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 R- \) F2 H- J0 \7 c - * kind, whether express or implied; without even the implied warranty
! }7 h- Y2 F# q7 _# ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 p3 u3 d3 I: U2 i7 z
- * GNU General Public License for more details.2 c$ v& b5 @( o% n9 X0 `
- */
# r# p# O& C$ {# e8 E9 x. d8 ? - + _; ?8 L R2 c8 v' u* S0 \' ?7 v
- #include <linux/module.h>2 n! u& \2 {: k( U/ L
- #include <linux/init.h>
' E, w+ n9 z" Z6 b - #include <linux/errno.h>8 b. E& m: Y; t- M8 m: g7 b$ V- a
- #include <linux/types.h>
) o& ~0 c7 S) x* H! d - #include <linux/interrupt.h>
% m3 Z' }' i! U; e1 h) m4 L( L - #include <asm/io.h>
& Q+ e/ d/ K8 d; g - #include <linux/moduleparam.h>
) w+ B5 H" n6 U1 J' @, @( ~: x - #include <linux/sysctl.h>
- F4 J7 S, r! `' J0 j2 z" ? - #include <linux/mm.h>
% W1 a; z# |1 r* C9 w d9 L$ h. Y - #include <linux/dma-mapping.h>- A, r/ \! }/ @9 ^ {9 C
9 `$ Q8 [9 `8 n7 `( w- #include <mach/memory.h>
) ?% U6 R3 c- N* L: B - #include <mach/hardware.h>. ^) b& {! T6 z( t) i1 c
- #include <mach/irqs.h>
9 G" G2 R1 H( b2 a6 p - #include <asm/hardware/edma.h>
: I6 {) a. h7 O) P( j
3 i {( K9 U2 C" i$ o8 ^- #undef EDMA3_DEBUG
& K3 J* \* @. |( f8 e# U - /*#define EDMA3_DEBUG*/! h( m6 p) @' l
: ]; [$ }3 x9 f, ]- #ifdef EDMA3_DEBUG
2 c* R, _1 }, j) y1 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( e8 K: h$ P3 J J5 o2 g* t5 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 ? X/ Y& f6 u( F! f! P$ P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" J+ g# q2 H4 n; s2 r - #else: _. Z, f$ y8 u: j `
- #define DMA_PRINTK( x... )
8 N8 r' W. U& S1 E/ } - #define DMA_FN_IN T' \( P: c7 u) D
- #define DMA_FN_OUT
* H3 L* T$ B/ b$ a# w# P - #endif+ S* [: \( S" i t
, {) Z( A; _4 v. e& x- G8 s3 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 S4 v! H% ~& C3 C - #define STATIC_SHIFT 3
* x2 a% b4 S7 z3 d: z - #define TCINTEN_SHIFT 20! w# P$ L! n9 `$ w/ l
- #define ITCINTEN_SHIFT 213 D, g# {- `9 _4 f) [7 T1 S
- #define TCCHEN_SHIFT 22. G/ ~6 P' k$ F$ U' e5 w8 e
- #define ITCCHEN_SHIFT 235 I$ R( k" E' V8 u) c$ w
) R& |& N1 S% |( j; S" m, M- static volatile int irqraised1 = 0;/ V/ s4 R, A; q& @& f: p
- static volatile int irqraised2 = 0;
+ m$ ^% x0 E% \! W$ ~ - ) H4 c& W; d. i5 V! y+ G3 Q7 k4 N) T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& B4 M$ M( ^$ n" e0 d9 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ v: D! P/ m# R/ a0 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 j6 |, c. V# T5 B' ^3 Z l
- 8 \# @3 u7 E5 I% C8 X
- dma_addr_t dmaphyssrc1 = 0;
3 R+ W3 _. Q% E( r& b+ F. l - dma_addr_t dmaphyssrc2 = 0;& X- e T8 h1 O4 _, U2 G
- dma_addr_t dmaphysdest1 = 0;; t4 q( D W" x
- dma_addr_t dmaphysdest2 = 0;5 s; |9 I, u- T; p6 O/ ?* i/ G
: X4 a0 B6 }# |- char *dmabufsrc1 = NULL;7 y2 A( F% h3 [- c+ Z4 p
- char *dmabufsrc2 = NULL;
M* i; y' }( o% A; w# e - char *dmabufdest1 = NULL;. W3 D" d) _: ~3 L7 @1 L6 Z
- char *dmabufdest2 = NULL; }8 D6 s2 N8 e# m5 y
7 J# G0 r4 H" X" _( u' w0 K) N- static int acnt = 512;! I/ s( } {6 v% v: M/ ]+ q
- static int bcnt = 8;
+ {& P1 e4 z, {: g5 X6 r$ n3 | - static int ccnt = 8;
5 f+ c* i/ y1 @3 T8 v
9 B2 [/ Q& g9 p3 [! o- module_param(acnt, int, S_IRUGO);
( W7 J1 i4 ^; ?; E8 \5 Q4 D - module_param(bcnt, int, S_IRUGO);! j' P3 _5 e& K
- module_param(ccnt, int, S_IRUGO);
复制代码
! H4 E- n$ [5 F( t
0 c" f7 b: n- S, p F8 F( u$ F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `: P7 n' L+ L, s; g7 Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 L/ u h7 c1 l1 c% y# c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 K7 ?3 y/ \0 z+ W$ F3 S3 g, g O, D" e* z
6 W5 ]/ T: x1 z |
|