|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- t- m# Y+ c' H2 w" n# L1 n- [code]EDMA sample test application0 J, {- U0 K2 Y7 J/ f5 q6 G
- /*
2 O9 H- X) x$ L: n# x$ M: { - * edma_test.c
1 }& x4 E: i$ `( w9 N: p - *# \ D! R+ K2 [7 H7 y
- * brief EDMA3 Test Application
3 M2 {, ]" y1 q, z2 S0 |; ?) e - *
: h _6 g; O# Y- c - * This file contains EDMA3 Test code.
6 Y. @& G; M. D* D$ m/ f8 l - *
6 `( E0 }8 E2 `- F- f/ c2 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 f. S1 i! ^, Q7 d9 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& x7 ~2 r* h5 w; S: N# E# ?8 z - * TO CHANGE.
) \, M2 n5 r+ ]$ e! E8 P" T - *
# p8 |$ u- `4 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 J" l' y2 I) I. u% {! U - *
& h: e4 D- w, Q% A% z% C) l - * This program is free software; you can redistribute it and/or
& n2 I+ E3 p2 ]( F$ l$ G4 k1 y - * modify it under the terms of the GNU General Public License as0 m& q: a4 }9 a2 F; ~$ I* X1 r
- * published by the Free Software Foundation version 2.
- W5 p3 j8 C% [( I% k( u - *
8 R7 J( N& j) F4 V2 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 y7 r. V$ S; I, x2 z1 q - * kind, whether express or implied; without even the implied warranty
3 H+ d1 ~5 }! c! J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 k6 p- i7 Y# A1 I8 d
- * GNU General Public License for more details.2 w7 y+ {3 {3 U5 m B: f& ~
- */% `' [+ \. \. K. G8 g9 p
% [! }5 i9 J( k1 H6 k! d! X- #include <linux/module.h>2 t) g6 k) o9 D
- #include <linux/init.h>
O: [2 t9 s) `% \ - #include <linux/errno.h>2 P( | {3 h2 q; a3 B' y Y
- #include <linux/types.h>/ e( H, M% A4 F
- #include <linux/interrupt.h>! n. i- \ n8 q
- #include <asm/io.h>) Q* V2 V4 w; [; G; y# o: E
- #include <linux/moduleparam.h>
- O6 \8 C+ ~# w$ N# n - #include <linux/sysctl.h>
% \# E7 p. T4 w7 z; I - #include <linux/mm.h>
h# q4 U/ _4 s) E - #include <linux/dma-mapping.h>
4 ^( l( a+ Q- S6 H* G6 d1 F" y ` - ! t. J/ v. o. O( p" b# J
- #include <mach/memory.h>5 Y0 [- o9 q2 N9 [% q4 a1 U
- #include <mach/hardware.h>
. H: N+ [/ [; L+ E8 _; @! u4 E( B - #include <mach/irqs.h>
" ^6 s6 B6 {; C g: ~. u - #include <asm/hardware/edma.h>- H# J! Q8 U/ Q9 O" z# q. j
- , g @5 {8 }; p9 O% p. O, v
- #undef EDMA3_DEBUG
6 n1 k9 @9 j: [5 g7 i# S - /*#define EDMA3_DEBUG*/2 C1 ? ?0 l" S$ T
- % \4 J5 I# P( k* H* k, c1 p
- #ifdef EDMA3_DEBUG
' M& O) ~" N$ l2 \9 e) Y( j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( n6 i# r. b: C1 q5 R: m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) M* G5 t4 i7 V5 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 j# U* [, |. D9 |# k4 K
- #else8 z3 [6 v5 s5 f* J/ ^; ^
- #define DMA_PRINTK( x... )
5 w9 P( k% [3 z - #define DMA_FN_IN1 j! O, u) v/ e9 d8 d9 N# l$ g
- #define DMA_FN_OUT6 \0 {9 {# U* K' B
- #endif
) ?; b% @* _1 m J! i; D, e8 H. t! i
6 J2 d7 D( U- [0 R! A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 b; m/ Z6 D4 b8 D, H( H
- #define STATIC_SHIFT 3( f, V) b: M" n! v& Q. U1 J$ e
- #define TCINTEN_SHIFT 20
2 g1 y- \4 W! G- j4 q8 e2 |0 A9 o - #define ITCINTEN_SHIFT 211 `4 f. [/ w$ y9 z; [
- #define TCCHEN_SHIFT 223 n+ c9 v5 O, S' Q# I3 `
- #define ITCCHEN_SHIFT 23
& N& P0 \/ O& {3 d6 V4 P) n
8 [1 }0 Q1 ~) {1 |0 m4 O/ C- static volatile int irqraised1 = 0;- v# @; J- x1 S. H! \
- static volatile int irqraised2 = 0;1 I% f `4 x: O+ i2 e
8 A- Z% I( F& m2 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n9 p! B+ x' f; d5 T! Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 V3 T% ~% n* T7 C1 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; _( J* y2 B3 `( F0 ?
3 R2 K' l S5 S0 B2 I% G' K: l: X- dma_addr_t dmaphyssrc1 = 0;
# C) ?$ S; V$ |/ W" ~ - dma_addr_t dmaphyssrc2 = 0;: R4 X8 k6 T0 ~0 a/ V0 [. L
- dma_addr_t dmaphysdest1 = 0;& F5 m9 W/ o: y" L% }/ H: i
- dma_addr_t dmaphysdest2 = 0;; C9 H: G) p8 [8 c3 N; N
: L" h( K/ o4 R5 f& K' t* s* L- char *dmabufsrc1 = NULL;
+ }# P' H8 z, c" n" w - char *dmabufsrc2 = NULL;# \5 F: z: i4 X' `9 b( X+ ^
- char *dmabufdest1 = NULL;, Q& l/ \2 m, {( A" E! u
- char *dmabufdest2 = NULL;" u- e) x! ^6 J* Z5 [, L( g2 ~
0 G/ Z3 v8 z0 F- static int acnt = 512;' n5 D# R1 n( Z: J( O
- static int bcnt = 8;
. W# } F% I, Y" a5 y - static int ccnt = 8;
+ F) i- O+ K' u. t4 d9 ]& I+ h
1 I8 p% E/ T' ~! g! b- module_param(acnt, int, S_IRUGO);* U6 t. I6 G9 t, y: B
- module_param(bcnt, int, S_IRUGO);" ~1 x5 o5 v) h2 r @1 d2 R$ [$ D, n7 X
- module_param(ccnt, int, S_IRUGO);
复制代码 * q5 g7 c7 z/ o& |; g7 Z
9 G" O" o ?# y* p2 ^' v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Z& r D. d& B. B0 Z; n
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 q' K* I# s& N% I7 \! ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! X' R9 H1 Z, e
v: P1 U# p3 ^' x+ b
& T/ k2 x" ?7 Q5 p1 N |
|