|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - P$ D/ m3 d9 q* R- @; L
- [code]EDMA sample test application7 z% y, L6 U9 q+ P9 ^* B1 d
- /*
3 b& C+ u/ O% J r/ V- c' ` - * edma_test.c
7 {5 `* A/ ?5 I5 Y( I) u7 K: A% q - *3 l) y8 m. Q# e$ D0 z6 H
- * brief EDMA3 Test Application
' Z$ a8 n" m6 K8 D$ `) x u0 u. s" \ - *
* Y2 V" N- I! e- y) W& c - * This file contains EDMA3 Test code.( Y% n* x7 S( z, S( U6 K
- *
' w, |2 Y9 Y+ g% j3 b8 L( ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ o8 k9 M5 f0 `1 S$ f1 K) e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 Z- U! Z1 `4 g5 x6 N7 p% a - * TO CHANGE. w$ j* L* ~. [' d' B
- *- E9 y. P" a8 z+ a/ I" W, r- o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 C9 L* w6 O/ U5 p5 b9 B3 s
- *' x& k8 B8 ?7 z, y: g+ e: _: w
- * This program is free software; you can redistribute it and/or
6 K7 G* |. N' \4 A0 Y( [$ t - * modify it under the terms of the GNU General Public License as, A4 O: M- ~& ]6 q( K
- * published by the Free Software Foundation version 2.
7 ^5 |5 p3 G2 |! x3 `2 j - *
$ u6 N# F3 z0 y7 S4 s2 X5 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v7 L; C" ~; A" J# S! |8 J
- * kind, whether express or implied; without even the implied warranty$ ^# n9 I n) [% f( n/ w. C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& g3 l: ]5 O; T& N& P0 p. A9 ] t
- * GNU General Public License for more details.
* h @& r( z5 A& I: } - */4 U" i7 q8 ?0 n/ n
T7 Q( a7 O6 K5 e9 w' t$ N- #include <linux/module.h>
% R: I8 _0 E: b - #include <linux/init.h>$ n }; W5 N3 O w$ k
- #include <linux/errno.h>+ j5 E) M+ Z2 B" Y6 i) Y+ h
- #include <linux/types.h>. N% U) {$ W1 ^8 H. e: P; [
- #include <linux/interrupt.h>
+ j# z( i/ @6 f% R - #include <asm/io.h>) D E, ~* f w) A4 b3 M
- #include <linux/moduleparam.h>
- W3 c$ Q- C1 G; q3 J6 X- \# j - #include <linux/sysctl.h>
, _$ g7 n! [- l9 q& H - #include <linux/mm.h>* L, x7 [! g" E0 {. d
- #include <linux/dma-mapping.h>- A7 e: S$ x7 D6 @: ?. }
- 5 {4 E5 i! n7 v, q' ]
- #include <mach/memory.h>
! Z, n; \) d4 b5 y/ s0 P - #include <mach/hardware.h>
! N0 Z# d/ w5 ?% ]" b4 q - #include <mach/irqs.h>
5 n: P# s, w6 m+ j3 L! O& m - #include <asm/hardware/edma.h>3 w& l5 D% t% a9 W/ E
6 I; q: H! @$ M# _- #undef EDMA3_DEBUG2 A& W( s# m( x% D) N
- /*#define EDMA3_DEBUG*/5 I' X# x$ t" x8 z% |
- 6 Y( x; |- h+ \
- #ifdef EDMA3_DEBUG3 X' n3 {( w. D: x& Q! E- v& j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 L j+ O) \2 _' W- V. a7 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 c g" n2 m }5 n' B4 U1 j- s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! |6 ^( T- b+ \: h/ ~ - #else& u) w+ O, s, {* I0 u9 I
- #define DMA_PRINTK( x... )
! ?& T# n) @5 x - #define DMA_FN_IN7 o u4 ]5 r0 q& ?) g& {
- #define DMA_FN_OUT
, V) I2 f, \' c2 z - #endif
8 n+ d4 `0 J4 r7 t - . X1 w# T3 Q. Y: m8 C+ |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
{6 T2 p0 l' X9 j4 F/ t1 } - #define STATIC_SHIFT 3
, k( }3 `3 t9 P) c6 `4 i8 v9 Z/ u8 w - #define TCINTEN_SHIFT 208 @8 n1 ]7 f' [$ |: [$ r+ O- n
- #define ITCINTEN_SHIFT 21
& A4 M" B# g% S# | l - #define TCCHEN_SHIFT 22' o% ]$ r6 Z$ `( Y* Z1 e4 N( k
- #define ITCCHEN_SHIFT 23& y0 ]4 [4 V: L
- 3 ~( P2 M0 W- G( x8 t; A% Y2 p
- static volatile int irqraised1 = 0;2 f; u+ L: Y4 Q+ \3 _
- static volatile int irqraised2 = 0;% D& A5 |$ L. g% }
- 2 s+ D' \% o4 M' s' q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# R. `) c9 S' |- q( b1 | |5 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i2 Q$ Z0 J4 y! H( _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 F# P1 [8 ^3 P$ h7 s# B
% u$ S' C* z$ P. F- dma_addr_t dmaphyssrc1 = 0;
3 D2 o( _4 {5 O) ` - dma_addr_t dmaphyssrc2 = 0;3 |5 w5 L5 u" B1 J3 d0 _
- dma_addr_t dmaphysdest1 = 0;
6 T8 @& \, |* H( J4 J6 N - dma_addr_t dmaphysdest2 = 0;
' n8 n* o' n" D2 N, Y$ E( o5 B - : \/ d1 q" @' R. T( P) a
- char *dmabufsrc1 = NULL;
2 L8 ]# G5 n- Y - char *dmabufsrc2 = NULL;- L9 g8 k% |) U8 \# P" B2 e7 o
- char *dmabufdest1 = NULL;2 X4 g1 F6 m# s5 n( W) O( Z
- char *dmabufdest2 = NULL;, { v9 b* c/ E$ n* v! a/ V" X
- 5 z" c% H4 ?6 p: p
- static int acnt = 512;8 S# [( t# u9 M% T# e
- static int bcnt = 8;
+ d \) l" U9 O5 @ - static int ccnt = 8;# f/ \' V* I/ h# q* O7 q
- ( C2 Z; O! E( U
- module_param(acnt, int, S_IRUGO);
$ V# A- C3 ]0 E$ _0 Y/ u! y - module_param(bcnt, int, S_IRUGO);1 h) l. r% {! ]1 h! P7 o
- module_param(ccnt, int, S_IRUGO);
复制代码 # s& \2 k, t- r1 p' Q
) v L+ Y/ o6 `) T8 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 w! k: T: T$ e) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ^) h0 j7 p4 o& ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 i' v! ^; c7 \& f/ y' M% F
4 b' w1 c' u& n+ G' o1 F8 j' w
- c( u2 L/ @+ k2 q) O6 b |
|