|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % o3 _( s# C& R) Q: B( D* s3 I& E
- [code]EDMA sample test application8 T: K% I( q @* ?' D9 t3 k3 g9 E
- /*7 N2 l7 n5 ~; T3 K% j C9 O2 C1 Z7 C
- * edma_test.c
/ b3 b/ F. K) D1 z& @7 x- r - *
. E3 R0 v6 I% l! |' c - * brief EDMA3 Test Application
; g$ \( Y" E7 p! x( } - *' z) t) W$ X% v+ M
- * This file contains EDMA3 Test code.
. P4 [& A( Z$ [5 r4 y9 c - *. H1 i9 W0 \$ i* W- W+ t; c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m0 t8 f7 ?. B- Q! \. P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ~$ z1 j8 L' j( o* \
- * TO CHANGE.
3 }1 m$ S0 n& q. H0 z( G7 I! l - *
( ]7 U; H' ~6 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. `/ H1 W6 W5 T5 L - *& x, Z3 d6 Y# r% s8 w! ?6 ]
- * This program is free software; you can redistribute it and/or, i; Y$ `% J6 l, N
- * modify it under the terms of the GNU General Public License as9 l* H5 H9 e/ y& a; u. `( o, Z
- * published by the Free Software Foundation version 2.
6 ~3 B0 u+ a1 c% x - *
; z/ P: g& y/ |# M" ?+ ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ t3 ? t3 D2 G9 ^7 K: k, [) g
- * kind, whether express or implied; without even the implied warranty! p8 V0 y3 g3 R4 a1 ~1 E5 n \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! a" u7 a ]7 q, X: K* J& {! J8 z
- * GNU General Public License for more details.: n/ e* ~3 n" H$ b. h$ s
- */
: f% v# R8 z- \ - 8 C; J1 I0 J1 J( `, U4 k' i
- #include <linux/module.h>. ^/ {' C3 b! S: p9 E( y
- #include <linux/init.h>1 ?* a' }0 K" B6 t! F+ B
- #include <linux/errno.h>) j% z7 y& _" H# z
- #include <linux/types.h>
V0 v7 N+ M9 r! f - #include <linux/interrupt.h>" u j: ~" [# u Y
- #include <asm/io.h># T. K; h/ U! }+ u* k
- #include <linux/moduleparam.h>" f! q* Z/ b+ p3 \8 m! f2 i
- #include <linux/sysctl.h>
. x9 L& k2 b" F% A - #include <linux/mm.h>
0 ? R% g' v! b - #include <linux/dma-mapping.h>
. }0 M6 }: i5 }. Y- C/ V - T( {& {' w3 ]3 ~6 e9 L
- #include <mach/memory.h>
9 C7 ~1 K( x4 i - #include <mach/hardware.h>
9 l; d( C* E5 F4 m2 D) G" W - #include <mach/irqs.h>
: ^) Z$ \# ]8 ]' g% v6 Q - #include <asm/hardware/edma.h>
9 U: t- W1 m# A, y1 f, O4 e - % U Z% m: j3 i, l. ]
- #undef EDMA3_DEBUG
0 w0 G. V; v- Q: { - /*#define EDMA3_DEBUG*/2 o9 Y$ U4 }; c' Y6 \' h
- . B8 i7 `# D! _0 a
- #ifdef EDMA3_DEBUG- L- M3 @3 r& |, ?& R( P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% V9 W1 n A8 R. h5 N( Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ i/ c5 J7 B2 z: w8 T @" ?5 n8 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ O: B. }( F3 U0 \! y' Y+ `
- #else
# @6 C& K1 O7 ~5 H( M4 [ - #define DMA_PRINTK( x... )
# _+ e* a; y: D2 S" Y - #define DMA_FN_IN o" g5 v! \9 Y" j! ?! K
- #define DMA_FN_OUT
$ {" k+ w8 _' r - #endif0 U( Q9 R5 I' a% D0 b$ V) b- C
- * c7 M6 h! R: a$ n! w' u# H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) o- }) O3 B4 N4 W
- #define STATIC_SHIFT 3
9 L3 W) P1 `+ @3 X - #define TCINTEN_SHIFT 20
' g8 j5 _ x! n! `/ H - #define ITCINTEN_SHIFT 21
/ ~) g( [+ n, b - #define TCCHEN_SHIFT 22
/ o; t- I) X/ Q - #define ITCCHEN_SHIFT 231 t" K1 d4 B |/ O2 v2 ?
- 1 V! s& @1 @1 M* o
- static volatile int irqraised1 = 0;+ `: X* v1 X% y# x
- static volatile int irqraised2 = 0;! }6 l( F/ u5 ~+ z9 x8 O1 t
- 7 p; t0 L+ y3 ~+ D$ w; E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 x v" D, ?% q/ i( K) g- }" [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S }0 i# S5 B# `* _9 A0 G& }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" t) s' ?- ^. a( A, f
. ^/ A* X8 F1 W" v: \1 y- dma_addr_t dmaphyssrc1 = 0;
/ v$ `, v8 J2 f- ?; ^ - dma_addr_t dmaphyssrc2 = 0;
6 P: Q/ Y. N# T/ } - dma_addr_t dmaphysdest1 = 0;+ k9 I* a% ?8 m3 ^. f
- dma_addr_t dmaphysdest2 = 0;3 h9 n3 _$ X4 W
- 8 F) d0 l, F2 O# r
- char *dmabufsrc1 = NULL;/ g* ?+ u! W9 d$ d, q) N
- char *dmabufsrc2 = NULL;& V, ?8 h, ]3 W% J
- char *dmabufdest1 = NULL;
8 A# \. S/ N# T2 h4 _$ v8 ` - char *dmabufdest2 = NULL;
2 y- F' q4 i- x5 e3 N - : g. ?6 y0 ~/ i
- static int acnt = 512;
8 M% m8 h, S/ s! J6 F3 Z6 Z1 m - static int bcnt = 8;+ Q4 j8 b* B- M9 d# d' z( B
- static int ccnt = 8;
& J# `. _$ I8 _! D) N, u! D7 C - 9 V. F& W7 B3 l3 h% H2 z% _& w. F4 N
- module_param(acnt, int, S_IRUGO);
) H' e0 ]" H0 s1 I! z4 d2 g; p - module_param(bcnt, int, S_IRUGO);
) A- p% O% y5 N1 E. y% E - module_param(ccnt, int, S_IRUGO);
复制代码 3 G/ M* {5 M: X
/ g3 s, ^9 l1 o0 k g! y9 g" E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, v" G8 x6 i) L0 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: W4 j/ e/ c3 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ Z2 n- o k1 t6 W: _* U( D8 s# W; D, f7 U
/ U; O+ t. x6 [+ W9 ]+ {" ^3 T
|
|