|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 O% F6 e. c% ? C( [7 l% v3 M# p }
- [code]EDMA sample test application- R, Y' s5 H1 i; p
- /*
8 x! w0 g: h* I" O- o. q - * edma_test.c
$ c' e: w3 ]; z" _ - *# ^% J/ s. U0 \0 j
- * brief EDMA3 Test Application v( F. O1 |# |- O
- *
" r, U* v ]- h( L7 D. m% y( R - * This file contains EDMA3 Test code.
9 _4 n: w5 K3 l - *
) @- R$ T. a9 }. ~/ @6 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 L S, [! i3 t( O- X3 ?+ X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- N4 j- m; M$ {# K$ L J6 r - * TO CHANGE.
. x( Y; ~8 r. C. o$ ~: ?5 c - *
4 K9 Z9 c$ i" | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, d6 n) Z3 D' f3 j - *
# L3 U) V0 i- Q- }2 j4 U - * This program is free software; you can redistribute it and/or/ P( \0 @6 i% j* D6 X
- * modify it under the terms of the GNU General Public License as
( S9 J. G1 E! i+ J; }; A# Q: W% r - * published by the Free Software Foundation version 2.
; ]; j( D0 v$ p+ ^3 T - *4 A7 w$ w+ M; v |% H3 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! n' N0 p7 |6 a; q
- * kind, whether express or implied; without even the implied warranty
7 ]4 Z2 Q2 W0 V( P8 M- E1 K5 r, G7 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) @' U2 F- j* G3 g& G2 C8 f
- * GNU General Public License for more details.4 V+ j- t' U1 `$ x! e: c
- */: g# [( Y8 z5 M) [0 `8 t
- 9 O- f* ~. F& e2 `, D% }0 d
- #include <linux/module.h>
, s M& _9 B2 F3 J. J$ p* e( @ - #include <linux/init.h>7 ?! }5 Z# Q+ F+ B' I' q' e, G4 z
- #include <linux/errno.h>
5 c$ k7 A( X5 O9 u/ D& E2 P6 p - #include <linux/types.h>' e/ |3 H3 x6 A. L
- #include <linux/interrupt.h>! x3 N9 c! x7 F: M; g
- #include <asm/io.h>
4 @+ S: f5 J9 j$ s) u - #include <linux/moduleparam.h>
3 N' S2 D0 e7 g! h# K1 L; _+ k - #include <linux/sysctl.h>
! f, C. l3 E1 z$ T7 }( g8 a. b5 h - #include <linux/mm.h>
2 F1 w' J0 W$ l5 F" V2 u - #include <linux/dma-mapping.h>
2 j3 E! J( X1 v% A& ? M7 Y - + \/ W$ T) `/ ?3 s
- #include <mach/memory.h>/ e1 v. U5 O4 f+ b# Y0 `
- #include <mach/hardware.h>
! z# h( o+ L, ]7 ]9 ]4 U2 r - #include <mach/irqs.h>
" ?8 E/ U# J& S/ Z) `1 H5 M8 j - #include <asm/hardware/edma.h>
9 \4 m- ^: f/ q - 7 h5 l# g5 ]2 c
- #undef EDMA3_DEBUG/ i8 s0 Q7 `' E- Y0 t
- /*#define EDMA3_DEBUG*/
$ H5 L- r A) {% K5 ^$ k4 _
2 w: j X ~ Z5 F' l0 r4 J e- #ifdef EDMA3_DEBUG' R; ^( H3 K& D$ i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ o1 S- K" K- ?4 J+ ?( b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ [- e/ M @2 A: ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 D/ `( K4 T% u; x' M - #else' z( L1 a }! S; o; ^
- #define DMA_PRINTK( x... )
& h) _- X( ]0 M% k% r% |5 W - #define DMA_FN_IN
( S' Z }+ O [: Y1 e" H - #define DMA_FN_OUT
7 E. L2 j0 O# B8 l6 | - #endif
8 o8 A# e# K" u. h, s - 5 r: g# s* _+ J- i6 ~6 _$ g. \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# b& }4 A5 J) |! s' ?/ o - #define STATIC_SHIFT 3
1 B. G$ J$ U& M% V - #define TCINTEN_SHIFT 20
. \0 o* I% J8 G _8 j# w4 x7 { - #define ITCINTEN_SHIFT 217 i: s2 X5 ^$ Y* X0 o% S: o) [
- #define TCCHEN_SHIFT 22
# V) N7 j+ l4 v, U+ g- C, r- N8 R) U - #define ITCCHEN_SHIFT 23* ~; G$ P! E) I& H: K4 C
- % E+ _0 v) x+ n2 b b: w6 V
- static volatile int irqraised1 = 0;( I1 s" u' P7 f4 ]
- static volatile int irqraised2 = 0;
H& ]2 h3 B8 m* @3 T8 _ - : p7 t" Y; b) I } _$ p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 Z5 x* ^& B# W+ k$ n/ x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! W+ s$ q6 ]" B2 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A) _# j3 v1 l' G& L: y
- , h5 y' n5 j6 D- x
- dma_addr_t dmaphyssrc1 = 0;
: W6 U0 u5 ]8 Q+ w - dma_addr_t dmaphyssrc2 = 0;
' r" o5 Q1 P3 w' \( j2 X# r5 j' E' Y$ L - dma_addr_t dmaphysdest1 = 0;
* \% c+ }7 b% E- l5 v - dma_addr_t dmaphysdest2 = 0;
6 v8 n( p0 F/ H0 o. I. R* b
5 h( y- V) T8 z! M0 s/ |6 U' T' _: Q6 h: f- char *dmabufsrc1 = NULL;
, p+ ]& I# |2 d/ J, m) Y9 D - char *dmabufsrc2 = NULL;3 C, q. j B! w2 H, U
- char *dmabufdest1 = NULL;) v! E9 T! E5 N
- char *dmabufdest2 = NULL;8 c( R+ K, i- V1 G3 S% t4 q! ?$ F
& a- }7 F1 g/ T) p. a M8 R8 i% n! y- static int acnt = 512;
2 O+ c3 V m/ W3 B$ N+ t% _& K - static int bcnt = 8;" j1 n! E: c, S( j9 D
- static int ccnt = 8;
& g6 g7 Z. H$ O4 U
8 ^2 m9 T9 Q+ E1 }' ~- module_param(acnt, int, S_IRUGO);
8 L) p ?# K! ?7 Q3 {3 u# B8 d - module_param(bcnt, int, S_IRUGO);
* Y" N2 _6 [& L. y+ ] - module_param(ccnt, int, S_IRUGO);
复制代码
" R$ A+ `3 A8 _, x5 @8 D x9 E3 L& J; S# J: y: h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' }4 D [! R' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& v; i% A% I% P, _' h# L% n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ~) X" g! z5 F3 E1 t6 d5 y# j& G9 Q* n& y9 w
0 P9 q3 n. h5 b* d |
|