|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ y3 B2 F7 ]3 a9 N6 G0 r- [code]EDMA sample test application
: O- l- W, E. \) H - /*5 x0 ?% c+ j& R' e: k
- * edma_test.c
( t$ `/ C/ p( O4 h# Q# `! V - *
- c& ]' v" f% x8 J) b - * brief EDMA3 Test Application
( X, Y+ `$ o# o - *& A. ]+ L- I5 l7 a
- * This file contains EDMA3 Test code.* z7 w3 P- M6 {/ D% v
- *
- {0 j& X3 U+ |$ j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. b+ E6 K9 H, m, ^. i+ c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# S& ]4 M; x% |6 c3 P. G( Q - * TO CHANGE.! F, o3 r' P5 U/ c$ s, C! C' ~9 p, s
- ** @! v! `3 H: B2 ^" y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Q7 f) \9 h2 z
- *
- h m; p ]4 I) _ - * This program is free software; you can redistribute it and/or( y2 Z. ~ u( C6 Q, P2 [3 T. |0 Q
- * modify it under the terms of the GNU General Public License as
7 O1 H# o. ` r8 v4 B - * published by the Free Software Foundation version 2.
9 q1 e4 _! A1 a. R, u3 r! `6 K - *5 `8 G* e+ ^) a% e1 d2 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, y& ]0 k3 `$ q
- * kind, whether express or implied; without even the implied warranty C X/ m5 N& ]8 ^& }( f) [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' p+ b# I& b* N - * GNU General Public License for more details.
+ V" W+ R# A& o - */
7 j1 q; W! c. s! W* W u* Q. O- e& |2 c
: y' o- a+ W; Y$ N% _- #include <linux/module.h>
) o* u2 M1 @9 _+ I+ T0 I* j - #include <linux/init.h>
) B* e- v1 r: B' M8 x3 n8 q - #include <linux/errno.h>7 X7 l9 M8 ]# \3 p+ n; l. K
- #include <linux/types.h>: o" h# @) M! o# h: o6 L
- #include <linux/interrupt.h>
4 `& T6 e5 P# E2 I8 T - #include <asm/io.h># R- T6 h% Z7 D: j3 A( [! {
- #include <linux/moduleparam.h>
2 e) |# L% ]$ }4 c+ V" N# I - #include <linux/sysctl.h>/ a, V% P z- T; k! X$ y+ o/ e+ n
- #include <linux/mm.h>/ u% V2 ?" U8 N
- #include <linux/dma-mapping.h>
; L) f1 V: I5 `# x1 T' n/ K
2 p( K; ~3 t$ p: M! j; d7 g4 S9 \- #include <mach/memory.h>
+ |& C! w Y7 T, i) q' h7 j" I7 ] - #include <mach/hardware.h>% z- O. b0 y, I3 j0 f' R
- #include <mach/irqs.h>
+ y& X) ?' Y& V2 ? - #include <asm/hardware/edma.h>
; N; t6 y. t$ m - , A4 D( \+ A/ P0 x0 b
- #undef EDMA3_DEBUG5 F% a5 x5 Q: `" @
- /*#define EDMA3_DEBUG*/4 Q k& h' O* O% N
- / i0 [; ^ ^5 b' L2 l+ {6 y _" v
- #ifdef EDMA3_DEBUG
; Q' y0 V8 _0 i# Q+ S# C* q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 a B4 k# n2 G5 x; I6 \9 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ L3 ~- s- G" E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 l {4 c+ l9 |8 `' C' q/ g( A5 G+ }
- #else. b3 Y, L% n4 B# C) y& M" K: d
- #define DMA_PRINTK( x... )/ z; ~" W) \, `5 X2 o
- #define DMA_FN_IN
* ~8 Q, F7 O; ? - #define DMA_FN_OUT
5 V4 G* \. L) R; ?5 ^! f" ` - #endif
; N) b3 V, X9 E; l
7 V! @% x& H/ H& A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ W9 O/ @: r; B, s
- #define STATIC_SHIFT 3/ Z7 i4 D4 U& O* }! L6 |
- #define TCINTEN_SHIFT 20( r! t7 F$ L6 u
- #define ITCINTEN_SHIFT 21
2 Q/ `* k/ Z# O - #define TCCHEN_SHIFT 22 A# u1 L9 n# F5 Y
- #define ITCCHEN_SHIFT 23
% Q! o5 A% |' \2 W* E2 S9 Y
0 h4 z; Q3 f5 w6 H, @* y- static volatile int irqraised1 = 0;
9 u" {; g4 A2 c2 b* m6 [" V, e - static volatile int irqraised2 = 0;+ }/ k5 S* U- K/ ~( F
- 8 W8 h& ~7 T6 G6 g( ~% i% K& K2 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: x' @; `* P! m4 Y' k1 v& x- o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G W. O: Z, I) A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W. x5 N# z' j# X% S: e
" X' G9 i: X* [- dma_addr_t dmaphyssrc1 = 0;5 `* D! D* J* g, y Z" h
- dma_addr_t dmaphyssrc2 = 0;6 V; k3 R2 B- D: H' J
- dma_addr_t dmaphysdest1 = 0;% H* _( @' Y! c8 V
- dma_addr_t dmaphysdest2 = 0;
% `' G( s/ }# j2 a5 L- H
. P2 r) F8 t6 p# g- char *dmabufsrc1 = NULL;, n& Y/ r: Y6 c- e0 P4 r4 {' U, H
- char *dmabufsrc2 = NULL;5 P" ^) w6 Q1 n& ^( l8 {+ y) Y- X3 M
- char *dmabufdest1 = NULL;
: L: Y& E9 u4 C+ g# M7 ]9 l - char *dmabufdest2 = NULL;
. L; B1 f) A6 r1 | - ' |2 W0 n) M4 O, }
- static int acnt = 512;' ]. a) Y f' H% Y5 r, r: E- [
- static int bcnt = 8;
/ O1 c* b% v: {: D5 p- M$ r - static int ccnt = 8;
" ?1 {5 O, F4 c2 K6 T3 m' @ - % D; D5 E8 @; u4 [% [3 y% [
- module_param(acnt, int, S_IRUGO);: w @7 i8 r/ K( D9 R# {+ R p, n
- module_param(bcnt, int, S_IRUGO);& A2 l8 i. J- n& D
- module_param(ccnt, int, S_IRUGO);
复制代码
6 m: x% O4 ^5 S; ?! H4 z- u3 ]' y$ }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X- f: E/ c5 I! |3 E! Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: t' J# `% o0 v6 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) L6 i d! i# g- w! Y0 c9 q7 t3 x& t7 z2 s. a
8 R2 D+ }. v0 b4 n. G
|
|