|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \0 C s% U0 _, a+ l* y1 h
- [code]EDMA sample test application
* j+ X9 o+ l! \7 K+ u- @, m; k - /*
# T. x( G) @4 ~0 m" I& J - * edma_test.c
; q0 C$ f4 t/ C - *9 _. `& K* I2 @3 M
- * brief EDMA3 Test Application, M" U# N+ D, y3 \3 [+ A
- *1 D* k% r6 q9 y
- * This file contains EDMA3 Test code.1 [' Y2 y7 ?! j
- *1 U! @! G/ M) A, m% v j" O1 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: k9 G9 c. J6 G# v" v& |# c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ z* w) s4 u4 G* a - * TO CHANGE.
; F6 M. x# [5 d n i3 |4 l# l% K - *
% V) J# K0 t; R/ J h: V; i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 e- p3 N5 H9 B7 P9 Q% ^7 l5 y
- ** v" x+ M. v1 q/ d
- * This program is free software; you can redistribute it and/or
3 r w# V9 X, j6 v# o4 N3 D - * modify it under the terms of the GNU General Public License as5 u T4 `; W3 G* W4 f( ^
- * published by the Free Software Foundation version 2.
2 g7 G* X/ R9 E% i) I - *
) C3 g4 q# Y+ i' _8 d1 V" |1 _* { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 I+ R) a7 F$ J" r& J2 f9 a - * kind, whether express or implied; without even the implied warranty
2 x: x* V0 R! |5 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 ?9 y1 A0 \6 q& p, |1 d$ ]
- * GNU General Public License for more details.
1 Z2 G1 i% ~7 O& C, N" i0 @ - */
& W1 A! v# ?( F) v- q! o
( @; I1 c7 _7 c- U+ q: t; X7 e- #include <linux/module.h>- }5 K( ^ U# s/ b
- #include <linux/init.h>3 i4 y' k0 t% W0 S; l- i- M+ v
- #include <linux/errno.h>
2 s0 O$ f) S: b" _ - #include <linux/types.h>3 o8 t: b& ?/ b; \; \
- #include <linux/interrupt.h>
* m; C$ x- o* w$ j3 J - #include <asm/io.h>
7 f5 Q6 J* v. S, M3 \9 `# A. C - #include <linux/moduleparam.h>" m% O# s# Q% P( d, t* ^: \- T
- #include <linux/sysctl.h>
! Y; ]) X" n4 x$ P" D2 Z: D - #include <linux/mm.h>% Q6 H6 v/ {1 O, y7 K6 J
- #include <linux/dma-mapping.h>+ z- P: t( D3 p( I
/ @( U. b ~, S. f- #include <mach/memory.h>8 N* \! ^) Q$ w3 H- R" G+ b
- #include <mach/hardware.h>. o! h; }/ q l$ C; d
- #include <mach/irqs.h>$ `6 P1 `+ w! O
- #include <asm/hardware/edma.h>' A$ K) I4 i: {
- 4 p! g' [! S5 b" u- G
- #undef EDMA3_DEBUG6 ?- b1 F) V( l, r4 l7 E* p* o* N. x
- /*#define EDMA3_DEBUG*/ n7 n! d7 J" a! Y4 m, G+ h
- 1 l. E) `; P2 M' M
- #ifdef EDMA3_DEBUG8 [$ I5 I: b: P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, l2 H6 }1 h1 V1 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ~$ g+ W' v$ ? c3 {& Y$ |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! H2 X7 z$ W% l. _
- #else
# {" e" E# F1 ~. E% y$ C& ` - #define DMA_PRINTK( x... )3 s1 }* Z3 `, N, A# u
- #define DMA_FN_IN+ x) `" G1 A. a5 `4 u
- #define DMA_FN_OUT% w5 H2 t! \5 h, d7 n
- #endif
8 O3 V# i* u$ f6 D - + g* l- j P. Z+ M) U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 v1 p. H# V: _4 h
- #define STATIC_SHIFT 3
- ~8 X3 [2 i- j& H3 J9 B- y) W0 n1 {5 z - #define TCINTEN_SHIFT 20
4 a7 k0 Q0 d3 ~& x - #define ITCINTEN_SHIFT 211 Y5 _1 \4 U5 `& \$ A
- #define TCCHEN_SHIFT 22
' R2 r* v6 n& ~1 I& Z" O" B - #define ITCCHEN_SHIFT 23# T9 b8 M8 m5 Q0 w( v8 |7 r( q
- 4 F C0 L& q# k& t
- static volatile int irqraised1 = 0;( S( _4 I E# P- V C& s) ~
- static volatile int irqraised2 = 0;. u9 U, h/ |2 n- R/ p) k
- , S6 @; I/ O6 y H% D: n- y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [7 e3 H$ P7 g' | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- C U3 }* M! Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A6 b8 F6 }/ B& q9 Y7 U9 |
- + @5 b8 l& G4 f5 Z
- dma_addr_t dmaphyssrc1 = 0;' T9 c9 T/ j+ Q1 }
- dma_addr_t dmaphyssrc2 = 0;
- a! z3 I7 _& B6 U1 S, t+ R( l - dma_addr_t dmaphysdest1 = 0;" p- X: z4 ]8 p5 |4 ?' P7 ~) P+ Y; ^
- dma_addr_t dmaphysdest2 = 0;
' C& F8 d' x7 E$ A
/ C! j: B% ]: ~& [- R: P* _( N- char *dmabufsrc1 = NULL;6 {6 S @* k" R* L8 K. J2 H
- char *dmabufsrc2 = NULL;
) C3 J' v: L# T - char *dmabufdest1 = NULL;! m1 P' }3 i$ B8 L
- char *dmabufdest2 = NULL;
; R0 c! Y& g# R# ]" E
) l# a, n. f: E( k$ @9 I4 R' a- static int acnt = 512;
$ d! Q7 D2 P2 D' y* e8 y2 F - static int bcnt = 8;
8 M3 n5 o% A. r+ S5 y) ^6 u - static int ccnt = 8;$ }7 c4 ?- @# P' H$ }2 F
- 9 F$ \% D! S+ T7 [& P% G, O K
- module_param(acnt, int, S_IRUGO);6 b7 c' p) l, T8 g @+ t
- module_param(bcnt, int, S_IRUGO);
+ F1 o, Z* Y' ]" O! m a - module_param(ccnt, int, S_IRUGO);
复制代码 ' C+ |5 K. a& J
; F7 M/ c D! K4 g- ~0 X5 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Y& e5 X+ K/ v" iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# b7 v3 S( ]( p; ~: G8 I) `; t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; Q% m4 \' ^+ w
9 B" }2 ]$ m6 b& o4 r: D
4 u) W/ L# o- _5 j; _ |
|