|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : q" X3 x3 [) M, I* L! q
- [code]EDMA sample test application
1 e2 _+ L: a/ K* F+ s - /*
+ ?" g/ J# }& G+ f8 y - * edma_test.c2 n. m; s: d4 Z& M; T0 E
- *5 c M3 d- t" w
- * brief EDMA3 Test Application; C5 K+ o ]0 `" P% i- G
- *5 l6 E$ y/ w4 h m/ d8 E
- * This file contains EDMA3 Test code.
/ @! V0 ^7 P# t( i) K J - *
4 E" F6 ` T) ]; f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ?* k, E! @8 a: D( {. J, X2 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. g5 N! J0 S1 q! a! v( U - * TO CHANGE.
$ A: m/ q4 |6 U) U# h) ?/ t- G1 x - *1 P8 O4 ^. u" L" f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 i/ p T; S T$ A. U4 c; d
- *
& R, Q( o1 N$ w* j" f* ]% |! b - * This program is free software; you can redistribute it and/or
+ @/ t L6 Z! ?; U8 O0 D - * modify it under the terms of the GNU General Public License as
* c7 u5 f- |3 H - * published by the Free Software Foundation version 2.
' i# _ }0 i1 k - *2 N' v+ H7 V# a! {. h9 K' _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- ^8 x6 J% J! m - * kind, whether express or implied; without even the implied warranty
! f R( }$ k/ V' J( w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( n) B7 a4 c4 A% O2 t. V2 p J
- * GNU General Public License for more details.4 Y2 h' f) k; g; K
- */# t6 V' H J5 Z% R1 {$ J9 `# }
- # n$ Z; w l6 J
- #include <linux/module.h>
4 `4 O* c8 n8 g8 U% [+ e! [$ I V - #include <linux/init.h>
+ S% I! Q$ w( }6 ^7 v - #include <linux/errno.h>
( j; }$ [: J# c( o: H - #include <linux/types.h>$ ]( V, r% W! d+ F* g! Z
- #include <linux/interrupt.h>5 ~& P( N$ `) W4 D; w# _
- #include <asm/io.h>
9 ?' ?9 p- ~$ [* X& ^( J! k# I - #include <linux/moduleparam.h>
1 ~: V; W+ H* g( E" C - #include <linux/sysctl.h>
- B$ t# G; H3 ~/ _ - #include <linux/mm.h> ]8 S$ b- ]7 M0 a( j2 U" r
- #include <linux/dma-mapping.h>
' g0 B% K3 H% }. n1 ^ O! E/ L$ X - # ^) n3 b" G9 K6 a
- #include <mach/memory.h>2 w* i, f/ f" n$ g2 t+ [" J
- #include <mach/hardware.h>; \5 d/ L) [1 B( I' u- i
- #include <mach/irqs.h>- N6 q' M5 [9 u+ o+ I
- #include <asm/hardware/edma.h>) t& t/ \6 g5 X0 i7 q+ ]
* x) K( `) Q. v/ \% e- #undef EDMA3_DEBUG) h- ?- a) C2 ?- N4 S9 r* A
- /*#define EDMA3_DEBUG*/# C: a8 B+ ]& S- G6 G
, ~7 L( D2 u5 V/ M- #ifdef EDMA3_DEBUG
9 b1 b6 G' r1 V# v7 G: W0 Z5 s9 N8 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
q/ v& u. g' P" v% _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 K p' F$ ?) {, |' `: w# W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: @( O8 O! H4 U - #else
1 x& y/ v( g: E% V) o5 x - #define DMA_PRINTK( x... )6 Y0 B+ h3 h) M
- #define DMA_FN_IN, K( h# q1 D6 e% W0 P+ s8 z ~
- #define DMA_FN_OUT" G1 M& ^4 q7 M4 s$ K: ^
- #endif
2 R) b# Q% i/ R% N5 ~7 Z* c4 j) o
8 c8 V- \2 f; t( K$ i- #define MAX_DMA_TRANSFER_IN_BYTES (32768); z; R! {3 d: E7 Q2 ^7 u/ P
- #define STATIC_SHIFT 3
( c8 X, G) r- N9 V - #define TCINTEN_SHIFT 204 ` J6 I) p J2 A
- #define ITCINTEN_SHIFT 21$ A! ~* D5 K2 t! k( n: p0 z
- #define TCCHEN_SHIFT 225 K! F" C* y: ^% _( K
- #define ITCCHEN_SHIFT 23
4 ~6 U6 i/ C+ D6 P9 h4 B
5 q5 A" h6 o. N( V i. h, V) ^! h- static volatile int irqraised1 = 0;9 m2 A6 f( X* j- B; m2 A
- static volatile int irqraised2 = 0;
- W4 ?" x2 q( V% {) E$ {9 w* s
. Q B: R4 d4 x% R' @ J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w9 M/ Z- M5 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ?: e- D) ^$ d% l2 \. e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n# I c1 ~- }) B! L) }
2 f, B& p0 y9 x9 u$ o* ?! C- dma_addr_t dmaphyssrc1 = 0;
' J! b+ c. k7 D9 p. J( _( o - dma_addr_t dmaphyssrc2 = 0;
. ~6 A- C6 k \1 H* F c - dma_addr_t dmaphysdest1 = 0;% u; q4 t2 \1 C$ }
- dma_addr_t dmaphysdest2 = 0;. A8 I! h" ^. z" C# M6 s' J" P
- , Q, k* I \, q5 O
- char *dmabufsrc1 = NULL;# Y7 c# d4 {& I! ]6 v; H( ]* ~$ q1 l
- char *dmabufsrc2 = NULL;
' j) [# G! ^/ M: a0 c3 j" z - char *dmabufdest1 = NULL;% l! G( I9 N" m/ P% N; o+ Z& y: `, I
- char *dmabufdest2 = NULL;
5 y. y" V7 _3 h: _" _" \
3 S. _% K, a% v1 N# A C- static int acnt = 512;
g2 h# T6 {8 d/ k1 O - static int bcnt = 8;0 H( i4 V8 ]" j X n" `
- static int ccnt = 8;
" m$ d' A9 K$ a% U- x
E) s2 m' G+ t$ y, F7 z7 k- module_param(acnt, int, S_IRUGO);
( s2 f8 B" s7 m( W, Z# [4 q - module_param(bcnt, int, S_IRUGO);# h) k4 @ T# z+ I V* A
- module_param(ccnt, int, S_IRUGO);
复制代码 , P/ {. h9 H: ?9 X
4 o" }$ w% E k6 s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" P1 \9 ]" @8 v0 u# }- q& x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 F: @$ t: T5 Z! M+ t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K1 T6 y# _# N* \
0 a. c; {4 j+ O, D1 b% a8 A: j u+ y! ` z. S+ d u
|
|