|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ C5 d! d5 g' w! s, f2 T& m$ Z- K- [code]EDMA sample test application% J+ s& s" t$ ]8 C/ X
- /*) t$ t- {& }% [, K; N, }6 N" q
- * edma_test.c
" |! N* _6 D$ B/ u; j$ _# v. f - *, B7 {: k1 ^4 |
- * brief EDMA3 Test Application
6 f2 s. n, G. e& I- w5 _# r - ** w! n. a5 A" c% s Q6 D
- * This file contains EDMA3 Test code.
2 ~& X- j; T! M0 J5 y) V2 b - *
) c2 @1 C! ~0 {6 W* M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# J0 \5 |* Z. o, E3 R+ |5 |( i) R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 w, p) N3 Q- D
- * TO CHANGE.6 B U7 m: Y! x' f* R( z# m) A
- *# `3 N7 y/ R+ @5 {" w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ]/ J" x1 f1 |+ `* Z, x) m1 m
- *
. C) D3 l' H$ O2 v/ A - * This program is free software; you can redistribute it and/or' Q# O7 P" K& a/ @+ q6 H
- * modify it under the terms of the GNU General Public License as& s' B/ } z; D1 p! J
- * published by the Free Software Foundation version 2.3 h( |9 I, Z. i# X2 L9 ~
- *
9 v5 t5 H& l j4 R# u3 _% B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 Z! k$ V* J8 s2 t* I5 K7 q5 ] - * kind, whether express or implied; without even the implied warranty/ m6 j: b7 e0 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- o! p7 f: V+ a9 \4 I
- * GNU General Public License for more details.
0 D# O5 u1 Q. l2 H3 { - */
7 M1 u$ ^6 X4 \8 B' D3 T - & H8 c1 s4 a6 _' k6 G
- #include <linux/module.h>9 r7 p; r$ B }% u% R+ n
- #include <linux/init.h>* v* T% P2 `" w3 v/ g# Y0 W! r& y# G w
- #include <linux/errno.h>
$ A7 }8 I7 r, ?7 g5 o, Z7 w - #include <linux/types.h>: v8 P) m5 {; x+ W6 E1 I
- #include <linux/interrupt.h>: j! k8 ?1 f0 Z. Q' Z
- #include <asm/io.h> e' d* X5 @$ e4 E9 w/ m" d
- #include <linux/moduleparam.h>
3 c" O+ |. }* Q% u- F/ G - #include <linux/sysctl.h>
, k) A3 B2 X2 U - #include <linux/mm.h>
3 S9 Z5 J. r! @% H% N$ ]3 g - #include <linux/dma-mapping.h>
' f h8 U- s5 d% _& w - 3 y! V; y1 C) h4 Y1 P4 l
- #include <mach/memory.h>. ^ a$ K$ Q, U) }
- #include <mach/hardware.h>
! F$ ?; M( ?( e - #include <mach/irqs.h>! J+ M: g1 Q w" c, D
- #include <asm/hardware/edma.h>! O/ C7 ?8 `2 o, `' v; M
, k& K0 v. y O( X8 R- e- #undef EDMA3_DEBUG
. G+ f+ E1 J) G - /*#define EDMA3_DEBUG*/
/ J$ J' @ F; ]. _3 w) d, I: @ - ' \0 q# ~9 O9 h. N
- #ifdef EDMA3_DEBUG" G8 J( b' Y B; h& K9 f/ C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) M* s }6 c. J& f' d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Z) \9 ~9 g* }/ u$ a$ O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 M4 Y4 u& L" D* E
- #else( B" r& F, B) }* y+ m2 s: z( s
- #define DMA_PRINTK( x... )
$ Q$ E5 b$ H0 T' q# s7 h' c2 P - #define DMA_FN_IN
0 U/ |7 ^" Z* ^1 ^ r+ | - #define DMA_FN_OUT
# M5 g3 _6 s: m4 w - #endif
# y& W! M, C$ U# n6 O - 4 E K- _) m0 {+ \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: H# L: X6 F% p- C9 [: g7 F - #define STATIC_SHIFT 3# A$ ]1 j* r3 B, p" @6 b; k& E
- #define TCINTEN_SHIFT 207 o/ E/ N$ }/ e( `
- #define ITCINTEN_SHIFT 21
2 N3 ]2 \/ Z$ `- L. i; M - #define TCCHEN_SHIFT 223 Q3 ]& O. r" J. m7 [2 u: [
- #define ITCCHEN_SHIFT 23
* s' E) b5 Q w* _, W+ h( U* R - ) d& t- ]) U! e0 z' M; p
- static volatile int irqraised1 = 0;
6 w* F3 X/ c# x; i3 ~+ t - static volatile int irqraised2 = 0;
& _9 P; y9 k/ Z5 \8 U4 x; j
( d' p- s; D% r) }3 }. U: u( \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( A, P) C, z& l7 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- {. l T; m e4 P* |$ M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 L+ ?, Z/ r6 E. Y: G) I: V4 S
- ' q- W7 L; d1 ^# ^- d2 a
- dma_addr_t dmaphyssrc1 = 0;
) }. D: F5 I: ]/ u4 Y! Q4 J - dma_addr_t dmaphyssrc2 = 0;
`0 X* P( u/ `4 A7 ^& S4 V - dma_addr_t dmaphysdest1 = 0;
" O0 j- a# G' l" ?, i, ]) o0 ? - dma_addr_t dmaphysdest2 = 0;; `& B' p) P0 v/ H! u
( L' q% T+ \5 c4 G* { t- char *dmabufsrc1 = NULL;
! ]7 ~' C' _! m% x - char *dmabufsrc2 = NULL;
8 W) G [! F& l0 j3 K - char *dmabufdest1 = NULL;" X* b3 M* M% v- ]+ C6 N8 M: k
- char *dmabufdest2 = NULL;
9 `6 R3 K3 V) ?: K ^
$ q- u# @6 [4 y7 j" r$ N- static int acnt = 512;6 u" \/ m7 r$ b- m5 ]
- static int bcnt = 8;- o# H, I, [8 `' {
- static int ccnt = 8;( ~+ V& U7 E) @
- 7 ]' j& G+ T7 O2 A, ~& `0 ^& R' d
- module_param(acnt, int, S_IRUGO);
1 p* [$ K1 R3 u) O1 x+ _ - module_param(bcnt, int, S_IRUGO);" ^0 K' X& b" q; s# W& L. O
- module_param(ccnt, int, S_IRUGO);
复制代码 : x3 u7 q! h: \$ m
+ A0 x1 V+ p- `, A* R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! z8 a; q$ k) X- d2 p2 A1 c1 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* I) K% C9 z5 N; W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" o3 ?9 Y1 H7 c8 f* c( K# t- L9 m5 \* i$ m) I
, m1 R& o' q' k& M
|
|