|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 t5 `2 X7 V% {
- [code]EDMA sample test application4 w: e# r/ v% u% s/ J2 t: I- A. [, a
- /*
# L7 w- C7 U( { - * edma_test.c- {3 _9 T2 b: b: w3 [! `
- *
5 q9 ?" A! X, X! X - * brief EDMA3 Test Application
6 \0 l+ `, M5 w* j8 s - *7 g+ h$ L; P8 V3 k; Y4 B9 K! k
- * This file contains EDMA3 Test code.
+ g# |$ Y* [/ a - *: }' |" E1 y$ E( a) @: H) |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ o4 B3 K+ q N( `/ Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( e6 x# Q2 A# q1 o- _& @; l
- * TO CHANGE.- ?2 x3 E% e" E ]) s
- *
' i" y/ R) _0 z# C9 Y" a; i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 \: B% B G+ h. Z
- *( M2 c7 ?, l b* X
- * This program is free software; you can redistribute it and/or
7 @) h3 G: O! }/ I - * modify it under the terms of the GNU General Public License as
( R, P8 _8 a+ D" E - * published by the Free Software Foundation version 2.
4 M0 D2 w7 @; e2 L' W - *# q% }- q8 \% f d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) `1 Y- T) Z# s$ ^" e
- * kind, whether express or implied; without even the implied warranty
& |: D G% z# J- @( z' v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' D7 S- j% j1 ?6 p: ` ` - * GNU General Public License for more details.$ D, v$ C* A% e
- */
) h( ~9 o* n5 l: c - $ h- }+ k- x3 e& K9 T3 i1 l
- #include <linux/module.h>
5 T6 @9 m) b3 M5 P - #include <linux/init.h>6 S% X! b. S) u! A4 F: p
- #include <linux/errno.h>; C- ^( h. c% V
- #include <linux/types.h>
- A% l' U* q/ E: O) O% F0 e - #include <linux/interrupt.h>2 z9 t2 `! X T7 p
- #include <asm/io.h>
+ d: K4 H: |8 D4 N - #include <linux/moduleparam.h>
& ?0 r$ N0 n: ? - #include <linux/sysctl.h>
8 P3 K: M( { Q0 V: l% u - #include <linux/mm.h>
, m0 o3 P* `) K$ @; [& c - #include <linux/dma-mapping.h>
8 j2 P1 h. z: A: a& u- b
0 t6 o- T4 o/ o& w7 L6 ]+ F/ D9 }- #include <mach/memory.h>
- R0 O9 U2 C( g1 j1 L. d - #include <mach/hardware.h> h! J7 p1 ~" C6 i7 C9 a! v a
- #include <mach/irqs.h>
# z8 Q. ?# m( ]/ Q* q - #include <asm/hardware/edma.h>
6 \3 D, x1 }- Y1 Y+ W8 {1 U
2 W9 D f5 I9 q- x- #undef EDMA3_DEBUG5 O2 V, @, H! e. Q% x
- /*#define EDMA3_DEBUG*/! s* l) G+ B. R/ [
- 1 S+ s b4 U! G3 _! t
- #ifdef EDMA3_DEBUG
" I/ ^- N# }* J) \3 s. F1 | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' G/ c6 u- f ~* F, S9 q" j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% o+ {" r" q& |7 i% y# i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& H7 A: t6 V! x! @5 o) ~ - #else7 o+ C3 B& J t! X
- #define DMA_PRINTK( x... )3 c" e0 U+ j/ k9 o8 D% o& n" ` B
- #define DMA_FN_IN" d- t( a3 m2 c/ [, }
- #define DMA_FN_OUT
+ p4 I* D( J& W. e - #endif
# }% R: D( h( ]; n* X1 b* d" T - . Z: P2 A# p& `( j9 u5 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 ^2 I+ ^) O( X
- #define STATIC_SHIFT 35 H1 M4 ]; s7 D5 ~
- #define TCINTEN_SHIFT 20/ L8 ?/ J9 y7 x* p1 C
- #define ITCINTEN_SHIFT 21
4 y. B }1 d: [ S4 Y- Z - #define TCCHEN_SHIFT 228 j8 ^4 [7 }! g
- #define ITCCHEN_SHIFT 23( h, K0 e5 V) G1 U' K Q
- & U& V R* D% S8 E6 q
- static volatile int irqraised1 = 0;9 _0 \- s; ^0 \- u% g6 d
- static volatile int irqraised2 = 0;
% z" G9 t8 f1 v# l. S, _( `& Q
; ^) \3 H" K- O& R- Q% F' C6 Z: V% ? O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 i) a: W8 w# H7 X4 \ ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o6 w% u( b2 J5 i+ V0 n+ R5 C. {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G' t" i. P# V; h; Q
- 7 H7 D6 m, \5 b
- dma_addr_t dmaphyssrc1 = 0;' J6 b. n! S" \3 V! f
- dma_addr_t dmaphyssrc2 = 0;
. n4 i6 r6 l8 z! J1 t/ U - dma_addr_t dmaphysdest1 = 0;
0 }; b# l. ]5 n - dma_addr_t dmaphysdest2 = 0;; F5 h4 b( J' r( @8 C
- / c' {# @3 d- X4 O, C) ^6 L5 n5 t, @
- char *dmabufsrc1 = NULL;( x( S9 _' w; Z d' o3 ]
- char *dmabufsrc2 = NULL;! E2 m: Y# i/ g; T2 ~
- char *dmabufdest1 = NULL;
4 C, D4 t ?% c: J' g0 { - char *dmabufdest2 = NULL;
/ _" L5 H; w5 ^# B3 Y3 W - a$ O; N; c6 P. j8 p
- static int acnt = 512;& G9 }' t# W# _0 \. t
- static int bcnt = 8;
( q( j- O4 p8 q6 E - static int ccnt = 8;! P5 b0 {% j v4 h0 ]& Q4 e
: {2 m' A" J: }* {. c( g- [- module_param(acnt, int, S_IRUGO);
5 u' \8 a) J. e9 X, p2 ^5 ` - module_param(bcnt, int, S_IRUGO);
2 @( v3 ?/ D, k- |( @4 k! d# r1 e - module_param(ccnt, int, S_IRUGO);
复制代码
% B) g9 p& {$ o1 Q+ P+ z
5 D4 W$ I0 o9 v9 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. j0 i# A( z) q3 e# i6 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! S- ~% H+ ~! G/ w! `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 U& o0 N6 Q8 ]1 m, ~" h# g) z$ z5 M
1 e5 j( G; p% L) D0 @/ Q
|
|