|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 c* \/ G4 @, j9 n) }
- [code]EDMA sample test application
, {' S6 G# W# G - /*4 M9 ^7 l e `
- * edma_test.c, E1 b& S7 c) o; H% r% H6 v: I7 ^- h
- *
7 b/ e& Q' q. Y f$ M8 ^- u - * brief EDMA3 Test Application
+ B* K6 w+ B, \/ ? - *
5 Q2 Z) N4 O+ I - * This file contains EDMA3 Test code.
" @* _. d$ b& ?" N - *
# ]' }; _+ p( B4 }7 b8 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 ~4 I. X3 z5 S5 @8 \6 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 ` L5 l+ H( ~7 {5 I8 Q - * TO CHANGE.6 ~2 r* J7 c7 J& |/ U6 J
- ** ?; D- j1 W! x) B7 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ d0 K2 x/ N. @8 T9 w - * U- o6 I" |9 m8 Y6 w) N2 h1 w) Q: A+ Y7 p
- * This program is free software; you can redistribute it and/or
: U+ y U G% x1 J6 L - * modify it under the terms of the GNU General Public License as2 c5 b" [$ V* V$ V% N) I4 X* D
- * published by the Free Software Foundation version 2. x4 k9 g9 q4 |! z1 r6 b
- * X: D N$ y3 p2 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 d8 B% n7 f6 j( ]3 A" M9 {
- * kind, whether express or implied; without even the implied warranty: K; }2 n* p2 u1 @5 q: x6 R# Q6 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& m* \8 _0 Y/ C( p: X& l8 c9 ?
- * GNU General Public License for more details.0 h! {: M; J7 r6 k! h
- */+ |2 t( r' K6 l
- . S* p( L# P9 H" m9 m7 s% L( ?
- #include <linux/module.h>: }, B& t! y& m& |# _
- #include <linux/init.h>4 A3 R# i5 b! p+ z: @1 r) M# |
- #include <linux/errno.h>1 Y: q2 ~' X: a1 Y. o; }
- #include <linux/types.h>
n. o8 V# @% D9 n; l - #include <linux/interrupt.h>3 A ]% r- L! d3 ?
- #include <asm/io.h>
' X0 \$ T- o9 }6 H1 k- x - #include <linux/moduleparam.h>
' ]; O2 ~+ o$ z - #include <linux/sysctl.h>
6 E( v, u0 U; A4 G- O - #include <linux/mm.h>
/ Q$ _) h x) I: Z - #include <linux/dma-mapping.h>
6 a; F: J; t* Z6 V0 R - Z) s3 `1 ^8 z% T
- #include <mach/memory.h>9 A0 |" t8 F# h3 k* ^5 v& I
- #include <mach/hardware.h>1 X, P L) r& M7 [
- #include <mach/irqs.h>5 }# O- X7 e+ o) l6 i# J. D
- #include <asm/hardware/edma.h>
$ j/ t. q9 y7 u. H8 ]8 p
, P3 j$ \! I2 Q8 }4 }+ h# v- #undef EDMA3_DEBUG: ` O- F$ z1 I+ y
- /*#define EDMA3_DEBUG*/3 [5 J; C9 n o* _( u6 J
- . k8 O' N" L: g0 j4 a
- #ifdef EDMA3_DEBUG# {. e" H9 M* c9 S T. H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 v& u* E8 L) f: K6 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), W" f+ e# u5 r& T6 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ~( C% d( X/ d0 e( w+ e
- #else$ a W; i- `) @0 v
- #define DMA_PRINTK( x... )
R% Z1 ]5 x% `. P/ X4 q - #define DMA_FN_IN7 L2 _) O+ ]! P; V0 ~
- #define DMA_FN_OUT
0 a# S& i/ h9 Q C - #endif3 \, d( M O$ Q: T% E3 r3 W3 o
& o$ y$ Q; t, h2 e+ q- V- N! f! Z$ l- #define MAX_DMA_TRANSFER_IN_BYTES (32768), K {* e- m& f! Z# M, E
- #define STATIC_SHIFT 3
7 {- x% p- H0 S2 f* J - #define TCINTEN_SHIFT 20
0 i# m4 t6 T, D4 I: @9 c5 ] - #define ITCINTEN_SHIFT 216 {( g3 u! c% P
- #define TCCHEN_SHIFT 22+ c, p" x7 Q: Q f: [( ?
- #define ITCCHEN_SHIFT 23
) l6 q6 F, r4 G! a; e! J+ @ - 4 G. Z5 d* c3 v9 C- b# b
- static volatile int irqraised1 = 0;
+ J# l- V6 G+ `# y - static volatile int irqraised2 = 0;' y6 W8 K0 n$ k3 Q) ^, p9 a. e5 ^
# S5 x1 |' Z3 v0 r, i4 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R. l# E! G* F! O% n5 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 j: t5 n; |7 g7 E) i) N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a- ~1 _" S2 N9 ?+ Q5 X
) ~) ? D9 H& ]- dma_addr_t dmaphyssrc1 = 0;- i* X0 L3 z* l, B' p' ^9 Q9 v& t& t
- dma_addr_t dmaphyssrc2 = 0;) N# H0 @* S4 U( g0 L
- dma_addr_t dmaphysdest1 = 0;
3 _ c" X u/ e+ t( T: Y7 ^4 s- u - dma_addr_t dmaphysdest2 = 0;
3 C: | l1 _ N `$ d - . I! w, I; r! ]) t9 a) ^8 k
- char *dmabufsrc1 = NULL;
' [$ z2 ^" _ C# T. ~ - char *dmabufsrc2 = NULL;4 n# R- k8 U3 |, Q: s
- char *dmabufdest1 = NULL;
3 J+ J. c6 J. h8 c- b3 p - char *dmabufdest2 = NULL;
, B, ^! E$ @1 O& W, @9 N0 Z
: t- ]% K, t* ] _+ [& w- static int acnt = 512;
" M2 W4 L& x* P) Z - static int bcnt = 8;' @5 p |* i. c& u
- static int ccnt = 8;
. }: v& N$ T( C" A% ~0 o
7 A/ c9 }- `+ M6 W, l- module_param(acnt, int, S_IRUGO);1 q+ V, ?8 f |# F0 D2 i( X
- module_param(bcnt, int, S_IRUGO);
# L- k, q8 f; ?; [: w - module_param(ccnt, int, S_IRUGO);
复制代码
5 s% B9 n- ~, a% ^2 g/ C/ |4 F' \/ `0 b( ^# h0 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 N j; K9 ^$ s$ ^$ ]+ farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. v# ?; H) a5 r/ Y7 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 r/ N1 K; U$ c: Y7 ^& d
) F! z- a8 q2 Q& S; a) r9 R8 |5 H H% G! A+ @& {
|
|