|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , U8 x& r, T9 s6 B/ Z
- [code]EDMA sample test application
9 m5 U9 o' O& v# x7 I2 D - /*8 u; b+ D4 f9 r5 D$ W' c( c/ x2 a
- * edma_test.c5 ~% S$ V& `) ^7 O
- *
4 i8 n$ d- s- x$ b( y9 W' U' K4 e - * brief EDMA3 Test Application9 [: I$ S9 i. @* ?% T
- *1 h5 |, B9 I0 r8 C
- * This file contains EDMA3 Test code.
$ _* m0 R- l% y% q7 H" u2 e - *9 q3 J8 y3 ?' e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 T2 s: R: B+ [# E, m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 n' w' N* }! P9 } - * TO CHANGE.
' k- L7 \0 P9 b: g: d" r( _2 O6 J - *
, r3 V7 p' I" c. @/ u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# d! H7 B: O# T7 f - *
& s: j1 o7 |- G' _ - * This program is free software; you can redistribute it and/or
. D9 n* Q6 N1 c- B - * modify it under the terms of the GNU General Public License as* r5 N# V P* \3 T
- * published by the Free Software Foundation version 2.
" L( D( m9 g, ]. [9 B# p - *% E! \ ~7 Q, h3 s- w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# j* S7 S8 ?* M' r
- * kind, whether express or implied; without even the implied warranty' O& [$ \- [0 y; T+ ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( O, ^' Y; b- m9 ?+ F
- * GNU General Public License for more details.
! }$ Y( `9 B. [1 s X4 p - */! I' v Z' T3 M( L
- 8 Y D8 |7 V, b" V( Q! o/ d1 z
- #include <linux/module.h>
B7 q a. I; s( W! q o+ G - #include <linux/init.h>! y4 s; |2 @4 S, i# z, o1 k( F" q
- #include <linux/errno.h>; J0 E3 B/ f1 @9 H9 J% Z
- #include <linux/types.h>
& q& r) q2 d* @9 x. `4 Z. k, r: ~# w - #include <linux/interrupt.h>
. m9 f$ y: W. u; C - #include <asm/io.h>4 [! c8 z; Q/ `2 k! R$ c/ K- `) V9 z
- #include <linux/moduleparam.h>
! Q: b$ u6 Q# I5 K( T. L$ I- d: g, R - #include <linux/sysctl.h>' v8 _' J( l3 a+ o+ p( t$ T
- #include <linux/mm.h>; b# j: |& k) M2 I- j _, H
- #include <linux/dma-mapping.h>7 c0 Z! p- C# A/ {/ |6 Q. i7 G
- ' `* P" W: A9 H( a% I
- #include <mach/memory.h>
* |: H# I9 \9 X# f, \& U - #include <mach/hardware.h>
, q/ J! v) V+ T& v9 l( k9 L) D - #include <mach/irqs.h>
& B3 g* n) O4 p - #include <asm/hardware/edma.h>
6 b; O- b1 e- Y8 l" V' \ - " d/ w7 p6 p. l9 S. W; S
- #undef EDMA3_DEBUG& V9 p/ _ z6 t5 f9 ~; | m& [
- /*#define EDMA3_DEBUG*/# A+ z) M) L: a5 e% X
- * T+ a( f% d+ x, d5 O4 \
- #ifdef EDMA3_DEBUG4 t& u& e3 K6 v4 W2 \& f$ l/ K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 o; p4 f2 {! j' X5 | N/ E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
k4 N: z Y$ O& B) m# e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J0 ^9 R* n1 r& ~
- #else
. h4 U# U: \ v8 K: x" Q& Y( a - #define DMA_PRINTK( x... )' m6 Z, H. k$ a, W& z r/ ~7 q3 I6 P
- #define DMA_FN_IN- p: o7 V3 i2 t: i, x1 P
- #define DMA_FN_OUT
& o2 e% ~& a7 u4 q - #endif- k2 F1 g! g5 `2 K% \" W' q
" \4 h5 }" d& N: h/ F& E2 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ b/ X/ J7 `+ m+ b, S
- #define STATIC_SHIFT 3% P( Q. K/ A/ s3 a3 g1 q; n
- #define TCINTEN_SHIFT 20
9 J0 ^. w; r, B - #define ITCINTEN_SHIFT 21
1 f7 p# ]6 u% H2 s7 P+ _3 s - #define TCCHEN_SHIFT 22
" Z9 W: ]% Q+ H. T; U - #define ITCCHEN_SHIFT 23& T( T3 N+ g& ^
- & z3 t' W1 j2 l+ x* E
- static volatile int irqraised1 = 0;: ]" ?6 o5 [" }" ]. N0 o
- static volatile int irqraised2 = 0;
1 B0 H6 c& w6 p7 @9 N
' y/ I D5 h1 c. t1 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s5 m/ [! h2 T6 l/ p( F# e8 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. D, W8 O7 K9 o1 U3 o. ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' W) C& k; q( L* v" f - 2 J* c: m; c; f6 @- |$ e
- dma_addr_t dmaphyssrc1 = 0;2 j* ^2 S, F* `
- dma_addr_t dmaphyssrc2 = 0;
K2 L# ~: Y2 d/ n# z0 k# o" |: q7 X - dma_addr_t dmaphysdest1 = 0;/ l3 N5 u1 K7 P% T& L: L- }5 q
- dma_addr_t dmaphysdest2 = 0;
! m: E- b- W9 b* U3 n2 y! u, j - 5 o5 |. O7 A" E. H
- char *dmabufsrc1 = NULL;
. H% }8 `1 e; |+ m! n& A4 U7 x0 m+ h - char *dmabufsrc2 = NULL;
! i8 N2 u- q# J( N& P( Y. f$ e z - char *dmabufdest1 = NULL;* q1 n2 @- c+ n; q* W, b1 {7 T+ k
- char *dmabufdest2 = NULL;
+ w6 } |& g2 S/ F# q+ ? - ; X5 f L0 |) X% N# l
- static int acnt = 512; ^) e& F7 N4 M% W3 U* n0 k- ?
- static int bcnt = 8;7 K8 t+ } h& S2 V7 `: l
- static int ccnt = 8;
# b/ ~* E1 Y* G
1 y7 g/ A* H# e3 e1 S& R- module_param(acnt, int, S_IRUGO);7 i2 q0 ~/ p' z% m
- module_param(bcnt, int, S_IRUGO);" K; N) I6 M3 C# a/ @# V
- module_param(ccnt, int, S_IRUGO);
复制代码
' y& ]) p9 Z& [5 Z2 r& [
, {1 E. B* I/ S; b1 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' W1 I$ t/ n. b( X* f! Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ V6 B0 Y; o4 \- k- f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" n( s2 Q% J% S7 u
9 J; Q" p" Y* R! y4 C& d& ? Z; J2 [! ?; K& A$ Q8 Z
|
|