|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . D7 [, U: q! a2 e( z
- [code]EDMA sample test application
3 t/ Q, }# W5 u$ k; ^9 p - /*
6 ]# m" ]1 {" | - * edma_test.c. F& E$ Q) @% G$ R" c Y
- *
) M w" O4 h" N) `/ ?9 A: `9 Q9 v* } - * brief EDMA3 Test Application0 |: L3 M0 @& b
- *& U) c- B5 T# K. l! f
- * This file contains EDMA3 Test code.$ j8 Q1 E: i. l& t
- *
. U. f5 r" o# Z& | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* a) v) v) f6 ?4 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 I0 e7 K$ v r% s* C - * TO CHANGE., I; y1 l. F: ]' X$ U
- */ g% k. n8 d( J6 g0 a' g! |3 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* B! E( D p G$ [) Z; T/ k, S# ^
- *% c: ? L: \! @; n
- * This program is free software; you can redistribute it and/or
5 X5 F+ F, w- g: U9 ]1 B( H0 L - * modify it under the terms of the GNU General Public License as
1 S: R! Q0 b* v1 c$ f" G - * published by the Free Software Foundation version 2.
: d& b+ a0 ?. T3 k - *
. ?$ M/ X5 G. Y4 c2 Z0 j. \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 j* ]& Q9 ]7 s - * kind, whether express or implied; without even the implied warranty) J8 t% g2 h3 A2 w/ F6 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" j+ B' ]' ~( d
- * GNU General Public License for more details.- _$ g7 B" z5 s' B4 f( L+ t1 ]( d
- */
+ N5 k5 T$ p$ Z9 o. U - 9 K0 H9 }8 J3 v$ P! F+ T1 A3 D
- #include <linux/module.h>* u* D+ [& @8 _/ i: Y
- #include <linux/init.h>
" \2 @$ v& ^3 S$ a - #include <linux/errno.h>
; u# H: s7 X2 H. \! `% w4 [ - #include <linux/types.h>
( x0 C+ \2 q3 P% h: B- L( O, K; T - #include <linux/interrupt.h>
- ]9 B& M4 S% J3 {4 U$ L: | - #include <asm/io.h>
, E5 ^) A5 [3 x, I2 v) }3 R - #include <linux/moduleparam.h>
4 j9 {7 [5 l, o" b v6 L& k - #include <linux/sysctl.h>
% T J% T1 M6 d. h. s - #include <linux/mm.h>
8 }0 a' C# f, w$ m' ]: M* J - #include <linux/dma-mapping.h>
Y$ Z* O2 J- r" T: v. Q7 v
; S6 ~% i1 Q6 D$ A+ @- #include <mach/memory.h>
3 H$ H# m& o2 p - #include <mach/hardware.h>
, i( w& r( }* @% ~ - #include <mach/irqs.h>
5 g* c; y1 u( g2 j% S - #include <asm/hardware/edma.h>
' N+ V0 R& D5 f8 d
+ n3 W3 B8 {/ i* b- #undef EDMA3_DEBUG
" a1 p5 O5 g: {+ T' T, w; O0 G R) \ - /*#define EDMA3_DEBUG*/, h( x! x# [) s7 K2 t
- 9 l, I" Q8 H Y0 R% e
- #ifdef EDMA3_DEBUG; `! ~9 M8 S3 ?; [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ O" n! C; Y0 ?, ~4 @* w" Q. w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 b0 M2 l2 ~9 ?: W7 m1 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ v: `8 o1 m5 H# f* x0 n( J - #else" {$ H/ G3 m6 D2 {% k% g7 Z0 z
- #define DMA_PRINTK( x... )1 X) G$ }7 _+ P9 h! c* A6 G) h
- #define DMA_FN_IN
8 j* |5 @* {; s9 E1 c( M* m - #define DMA_FN_OUT
- _' r" o3 y* r; k - #endif. i1 [" L9 d/ l2 b# `# @
- . N7 v9 T, c0 [+ @0 Z- k3 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 E$ h7 y6 ~0 j8 n5 d - #define STATIC_SHIFT 3$ z( e: d c& a+ M+ Q
- #define TCINTEN_SHIFT 20
% v8 u. T8 G3 r0 F" q - #define ITCINTEN_SHIFT 21; o, X* n; }4 J! B1 W$ ?/ ^$ a
- #define TCCHEN_SHIFT 22" ~. ?! l6 K9 i& p
- #define ITCCHEN_SHIFT 23
+ M3 _7 v y7 o. u/ \$ i
, Y0 q9 K- ^3 n. c' a- v6 [5 {% O# A- static volatile int irqraised1 = 0;* S8 u( v# X: J# e+ M' m
- static volatile int irqraised2 = 0;9 d: J/ u" l. v7 h* U; N7 E6 @
- 0 f/ N) f# F. x4 w+ ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a! f2 O% @9 @, G. T+ J& @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 j+ [1 }; G% X9 @, c8 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h: j; C) [# x) r. Q5 O
- ' w( I1 J; k& m8 M* N7 C
- dma_addr_t dmaphyssrc1 = 0;* z8 R- z0 r( t/ a$ {, ]' b
- dma_addr_t dmaphyssrc2 = 0;
8 B7 m3 _) u0 k) J o3 E - dma_addr_t dmaphysdest1 = 0;
+ ]* H9 B( k( @1 w3 S( R. B' {! D - dma_addr_t dmaphysdest2 = 0;' B' R8 z9 T/ b! d+ m0 s' f, [) ~
- : w. X& y$ h" x' ]1 T" W0 n
- char *dmabufsrc1 = NULL;
4 x6 c$ V. K+ g+ g4 C1 `/ F - char *dmabufsrc2 = NULL;' p; }+ K7 K% t1 ~* J
- char *dmabufdest1 = NULL;9 V0 f2 w. m% O ]2 y [; U
- char *dmabufdest2 = NULL;
+ \4 u$ y5 t8 W5 U
. Z$ z- V! v) V+ d. ?- static int acnt = 512;3 P" Q9 {1 V( I0 p5 m, j0 a
- static int bcnt = 8;
4 Z) D+ h8 s& C6 ^6 H+ h - static int ccnt = 8;- k! b; Z! S Q2 g, D
7 N2 Q: p5 K7 w- module_param(acnt, int, S_IRUGO);
% j' z2 X6 U2 }# D% K* s - module_param(bcnt, int, S_IRUGO);! \! a/ f( K0 Z' z* x+ ?
- module_param(ccnt, int, S_IRUGO);
复制代码 ' R% a( [ ?( q; \- E
6 v4 l% z+ s }3 h* E9 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! m) ], K7 F" F9 {" W! i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ?# b: G4 C7 _5 B) G( q8 r2 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ^/ D" V3 f, ]9 F
1 d" D6 M9 K2 ^; Z2 y. i
; X u6 H7 [+ K# v$ c( C! z) |
|
|