|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : `" h* h4 ], F5 t9 }7 J4 k
- [code]EDMA sample test application
1 E" X5 _2 j2 ~: Y5 P - /*6 S8 {/ A4 K3 ^, N
- * edma_test.c# B# z- U& G. [/ R
- *3 o; h0 T* t- G, {7 ^4 r
- * brief EDMA3 Test Application
$ m; I. M4 @, e - *8 h2 j, \( o5 u8 Z
- * This file contains EDMA3 Test code.3 n* j; q( m2 ]( a1 j
- *
$ _6 E L, C" z! d) A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: S7 D/ Q4 w7 B; L' f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ?+ U; y, l6 V. \
- * TO CHANGE.
7 A/ E# W+ d/ k - ** v) m0 { v: t+ j" s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, v( b" m1 w6 w7 B5 K7 l8 k4 {6 F - *
1 j% H% }1 R4 C' a - * This program is free software; you can redistribute it and/or
: V& l0 A& P5 T% I7 N) P - * modify it under the terms of the GNU General Public License as
( r" }: h5 @% |0 r7 g - * published by the Free Software Foundation version 2.' R( c0 M9 _: ?: |' S
- *9 Z' U& s4 w8 w t( U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ B( X' T E7 x% C U) Y$ Y9 c: e - * kind, whether express or implied; without even the implied warranty: z* D2 [7 D( j6 @& A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, s Z" p$ L, n! ? - * GNU General Public License for more details.
% s; i8 S2 f3 K1 b7 n6 [/ g* X7 { - */
3 c; M0 |: _0 G: E/ u: ] [
$ _7 t$ P- R) l& K) D- c2 A- #include <linux/module.h>* p2 d. | U. T
- #include <linux/init.h>
4 @/ m( y/ h, H - #include <linux/errno.h>6 X# E0 e. @5 ]+ v6 Q
- #include <linux/types.h>, i8 J2 f( E. r9 z5 o
- #include <linux/interrupt.h>7 J3 k9 R, F' w. c
- #include <asm/io.h>
) ^7 r: @: A3 i* O; Z, ]0 X- l - #include <linux/moduleparam.h>
! f3 C7 I1 _0 g0 G. @ - #include <linux/sysctl.h>, i1 P# b* o9 ]4 }+ |1 S
- #include <linux/mm.h>
9 A* ]2 n9 R/ R; m: j - #include <linux/dma-mapping.h>
3 M. w+ s2 y8 h) F) G/ g - - u8 \7 b2 M6 v1 V2 A
- #include <mach/memory.h>
: J" V l/ n4 ^% n - #include <mach/hardware.h>
- L9 _" z) ]4 [# X& ~* ] - #include <mach/irqs.h>' s. M) _& W- u! d5 R# E4 ?; A0 x
- #include <asm/hardware/edma.h>( v" k, c$ ]0 o& C! d. u; B2 G, x
+ D9 c/ K! e1 b: _6 m/ H- #undef EDMA3_DEBUG
( O: u- J t5 v( b8 k, F - /*#define EDMA3_DEBUG*/) \0 v# A; X. E. A
8 @. D( ]1 D& S+ L+ y. z. \# k- #ifdef EDMA3_DEBUG
9 h7 R0 y; r7 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ W3 q6 V6 E; C' ~. K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ |2 M6 G. v8 _7 J* @' p% d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; T" g9 ]3 L+ `% G6 P7 n - #else
4 [: v m) P$ Z' e% S6 n& ? - #define DMA_PRINTK( x... )
; V/ G1 h7 v& g& u - #define DMA_FN_IN
" F' s0 {8 h! ^0 S - #define DMA_FN_OUT$ `4 x- N$ ^. S1 R+ e4 x0 |
- #endif
* I' i/ k: }3 V
' t! y+ i- h- j$ K; y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 L: y6 M' ~7 ^, ~- s2 G- n
- #define STATIC_SHIFT 3
9 H: d6 v, H3 G- E, v2 w; Y - #define TCINTEN_SHIFT 20
: _3 P* q* y1 x6 T' ]* y" E; U - #define ITCINTEN_SHIFT 21
8 q: @( y5 y' z$ V9 L - #define TCCHEN_SHIFT 22
6 }7 W! T+ a9 g. D - #define ITCCHEN_SHIFT 23$ W! E1 O0 r3 |+ Y+ _% I7 z5 ?
- 7 h8 F* A' X* E% Y+ c" s
- static volatile int irqraised1 = 0;& [ o* Z% G6 Y5 o9 h
- static volatile int irqraised2 = 0;( A1 |: _0 Z: Y8 P0 @# b$ z3 c( s- v
1 m' G1 p* K- I, K% y6 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M9 @0 e: u3 k6 y+ B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~5 h+ X0 v& ]* B: X" P0 l* z+ n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 e4 R. h c6 X$ O# O - 6 N: f: N5 L' ~4 M* ^
- dma_addr_t dmaphyssrc1 = 0;: F$ Z S0 {! c' j# v: S
- dma_addr_t dmaphyssrc2 = 0;# `9 ~+ b6 V3 {# b
- dma_addr_t dmaphysdest1 = 0;
. K2 z5 ]' ?) G% ` - dma_addr_t dmaphysdest2 = 0;: k r* B, R% S
- : j! C: D# l& f& g
- char *dmabufsrc1 = NULL;
0 v, W7 p* ?! g - char *dmabufsrc2 = NULL;
9 O4 N! W4 n) Y$ D& Q - char *dmabufdest1 = NULL;
+ l* ^ Z! P& @ - char *dmabufdest2 = NULL;- `: }$ S# \) Y0 {0 o# ^
2 f! [7 a& _" ]8 `- a; n6 t- static int acnt = 512;/ M% l" f2 K; S) {: [4 B& b: y
- static int bcnt = 8;3 @4 w* }6 N" B
- static int ccnt = 8;
6 ]/ {% v) H# W0 m# v k - ) ^4 k n" s% q: ]7 |( x
- module_param(acnt, int, S_IRUGO);
9 m. ]' }( ]0 Y% S* P# v- w - module_param(bcnt, int, S_IRUGO);
3 S" C7 h! ]# }# S" C - module_param(ccnt, int, S_IRUGO);
复制代码 ' V" q/ r5 C7 o* H4 w
# R% Q4 p0 R& A# Q% L% }- ^" `, W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" j$ j I2 n& a# x0 j! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Q' X# h. Q8 f; H9 z1 U5 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 A; L a% x, a y$ T0 z
- p: }) ~2 ?: G/ W9 L
& g$ l5 {$ j- F* d5 E, e, `
|
|