|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " z1 i @0 f. l; c" X U, N6 ~4 |: Q0 j
- [code]EDMA sample test application
2 V& N3 f& r q; O- m9 t& w - /*, Q* R; m& ~" M+ d" R, I4 d
- * edma_test.c+ m' [% L E3 g, K) O
- *$ u* m% p9 o4 N" o- d/ Y& ~* w
- * brief EDMA3 Test Application3 c& {, E* i/ _6 l. z2 K' b7 F
- *
+ Y6 r' Y1 ~, i4 O - * This file contains EDMA3 Test code.- k3 G" j; |; C, d q$ O3 b
- *% p5 Y. t o1 V5 z% {6 h; t$ n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* F' L3 A: z4 {* [" T7 _% P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( i4 N3 ^7 }! }8 H' e
- * TO CHANGE.6 @, v; a: E* g- f+ B
- *
# }6 S4 s) n- {1 {- W9 O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 G' l# j3 f4 G5 i, x
- *
$ l1 J% ~, ]- U* G: O2 l - * This program is free software; you can redistribute it and/or
/ k# Y; f5 {% P# v. P% e; ?$ e - * modify it under the terms of the GNU General Public License as
\& \: x# v3 B! @9 q# e9 q. {# h - * published by the Free Software Foundation version 2.' x* P" @1 b. o
- *
7 s) D; d. R U2 ^/ \/ J, m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 T4 d; x" L$ ^, Y) F - * kind, whether express or implied; without even the implied warranty% Z+ J1 Z( B: B& ]# {! R l% k. g( m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 c/ u( t, Q! S/ w8 M+ `6 L
- * GNU General Public License for more details.
0 s& k! Y+ ?) F# ^# ]. T6 | - */
5 o9 F% V9 o/ k9 M6 ] - # a. c# q0 d2 M
- #include <linux/module.h>3 ~1 g. ^& y6 @7 E
- #include <linux/init.h>
9 ^8 o( t. o* C - #include <linux/errno.h>
0 B `2 Z) v4 v. F6 X2 m/ r - #include <linux/types.h>
5 i5 a0 j2 M0 v' v" H - #include <linux/interrupt.h>
$ W* Y( T3 R! k) j% B - #include <asm/io.h>
8 ]3 t3 s% `- ?0 t - #include <linux/moduleparam.h>
1 k' U5 g* A ~ e0 I - #include <linux/sysctl.h>
4 N6 J H7 \ `3 i - #include <linux/mm.h># X1 r$ w$ B# S |0 E: g1 z
- #include <linux/dma-mapping.h>8 v2 F: ?- I+ F; n" Z( W0 `! R* e9 V
/ y$ V& K+ L+ M- v6 Y- #include <mach/memory.h>7 e, W1 E& h6 V7 ~0 ]
- #include <mach/hardware.h>
. u6 G- u' {- S$ G - #include <mach/irqs.h>
1 F, N R6 d4 s9 U - #include <asm/hardware/edma.h>7 u' [4 V$ f3 t5 [2 R
- 1 g* U, w+ P6 K& ~
- #undef EDMA3_DEBUG/ c3 z7 Q- U5 H0 p
- /*#define EDMA3_DEBUG*/
$ q2 b$ p; }+ Z- l9 E) q( D
7 ^. W1 j' G2 l) s- #ifdef EDMA3_DEBUG
$ z H: q0 H, j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 f4 W- r5 W+ |: p7 E3 m9 a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 l8 {$ ]; x/ B& C4 ]0 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 j3 n# c7 E/ k
- #else
8 a7 C1 V( B5 T$ }1 m/ _, H - #define DMA_PRINTK( x... )
, V# Q4 R+ ~* ~2 s2 y3 b; p - #define DMA_FN_IN+ o; Y) L H( I# a$ T3 w% Y' i+ o8 f
- #define DMA_FN_OUT+ `( }9 z# [# Q7 n
- #endif
' S3 k ~# I; O) B* B% t& R - ' R0 h: n0 n8 J2 q% n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
l, g/ n0 A: s! a4 o - #define STATIC_SHIFT 3
5 |: w5 p2 `' v& l6 P! v6 J - #define TCINTEN_SHIFT 20- \' N j$ R( f. a+ D3 q) v* z
- #define ITCINTEN_SHIFT 21
8 a/ \1 T4 X/ T! d' o C3 p - #define TCCHEN_SHIFT 22
4 m& k: W$ r+ b1 u - #define ITCCHEN_SHIFT 235 [8 R3 b& x3 Q+ ?9 P
0 X+ F5 n0 {, k2 b2 [) @- static volatile int irqraised1 = 0;
) w3 N7 y; {# u( r, f1 @/ `& ^8 c - static volatile int irqraised2 = 0;6 B0 |8 T+ H' P& e2 I) A" d
. s5 h2 E& T$ r! ^; U& ]" f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 m5 l2 `+ G0 M9 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# s% w% E% x0 |) w; T1 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 q3 V+ Q$ F+ M$ S2 y+ K8 G! H; q
; Y( q8 g! _7 _( x2 j- dma_addr_t dmaphyssrc1 = 0;4 [$ X; I; w8 P8 v" C9 S
- dma_addr_t dmaphyssrc2 = 0;
" g0 i$ d, ?2 X - dma_addr_t dmaphysdest1 = 0;/ U2 _. q w/ _0 _2 \& K
- dma_addr_t dmaphysdest2 = 0;0 G: `6 }3 F, U; G$ Y( a
- 8 B6 O' \* P4 S+ S
- char *dmabufsrc1 = NULL;
) J; g$ Q9 K! j* y1 t9 m' ^ - char *dmabufsrc2 = NULL;
5 f. D$ @# k A - char *dmabufdest1 = NULL;
+ J! v% o, _0 F: q; u - char *dmabufdest2 = NULL;
) }& \& D R1 i3 z- a
h: [+ G3 ?. J# K- o O4 A. q0 W- static int acnt = 512;
* T6 a6 r- X2 Q( _$ G" L. c: h - static int bcnt = 8;+ w' Y6 Y/ @9 E6 c9 u- a, L' L6 p
- static int ccnt = 8;' r# J b5 D5 [1 I7 O
- $ D: J. l0 k/ w, T/ y
- module_param(acnt, int, S_IRUGO);
8 d6 O4 P) ]; ]/ j& W2 l5 s$ Z - module_param(bcnt, int, S_IRUGO);
. m. ~9 Z- u: h( `7 z7 x; v5 \$ H - module_param(ccnt, int, S_IRUGO);
复制代码
5 X5 {+ L( J* ?0 |# S, d1 } ` E; g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ]( x) e8 V. F
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 ~3 m' R1 t6 |8 \; B: ~3 R3 d& P! f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ C: \3 Q. d& M( f2 v$ Q7 f8 K( e9 r p) D
) h" |% }- X5 w |
|