|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 K( z( o$ D& s0 j9 v4 C8 u! l
- [code]EDMA sample test application
( c' D+ |' r# G9 k) ^- u - /*9 m5 [/ e1 b1 O% \- x% R( i8 e
- * edma_test.c
+ @ c9 p" m7 E5 _2 o5 p% { - *
% M* x* z+ u1 V4 E0 P7 E* J - * brief EDMA3 Test Application) Q3 n1 G" s0 u( Q* C: f* W: c& L4 T$ H
- *
% \+ J3 u- R- w2 ~% |) t - * This file contains EDMA3 Test code.
; }7 S0 {5 w$ P `' o F4 Z v - *
5 T& M% K a ^: m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 D- _( Q8 i' C* C9 b: H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 h& n8 v8 t7 e5 v3 z - * TO CHANGE.3 O: Y0 m# @5 H" T. A+ O
- *
% x# `4 H0 ?9 n+ C+ K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& c3 F5 R7 ~+ t2 i4 y, k! d+ n - *
~0 a" Y8 R& c" [0 { - * This program is free software; you can redistribute it and/or$ H9 r* e) Y) K( e6 }- g! |
- * modify it under the terms of the GNU General Public License as
9 t* L+ E3 d3 ^) r - * published by the Free Software Foundation version 2.6 U& E! r J' k& o- m; x
- *
! C0 U. V! M! P2 M1 V0 l0 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. R! D, @0 g( ~* v3 E
- * kind, whether express or implied; without even the implied warranty
; {/ b, b6 C" C* K$ [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 Z- S2 L7 A/ y w# f+ f' D
- * GNU General Public License for more details.- C. X8 K" s- G& ]9 f
- */. b( p. R' ~) j; L7 A9 Z
2 K u2 {1 P+ O% H, z3 E9 F4 |$ y- #include <linux/module.h>0 o; Y G/ x8 d1 M
- #include <linux/init.h>
: h+ a4 O2 V& k3 h/ \4 k3 [+ E: p - #include <linux/errno.h>
7 `" r# b: E; x5 l" c" u0 C - #include <linux/types.h>/ \% C% G, l% Y0 b. d
- #include <linux/interrupt.h>
3 Z0 P! ~; m _- x4 I3 m1 s+ E' O - #include <asm/io.h>8 a& r1 @7 _* l- Z+ U( m/ X! y* u
- #include <linux/moduleparam.h>) ^5 O4 ], k- `+ U
- #include <linux/sysctl.h>
# c+ x% j; ?: e9 k* f' x - #include <linux/mm.h>
- t& s+ y% W" y1 s7 m9 F - #include <linux/dma-mapping.h>
( u' e6 P& W0 ^ - , ^; n- W. O" h- [
- #include <mach/memory.h>
/ T1 Y( P" }: Y s& K. K- t - #include <mach/hardware.h>
8 w2 g$ V7 f q+ a* E! V# e2 J - #include <mach/irqs.h>1 S+ m, W$ x9 H
- #include <asm/hardware/edma.h>, i" R% c; R6 _+ c% ~
- : l/ K- M. G+ T4 j2 f4 A, H
- #undef EDMA3_DEBUG
6 @0 W# e" }% N - /*#define EDMA3_DEBUG*/
4 X- J5 V% \8 E# p% j V8 i- r
% E, C; K+ e7 F( ?" L# w- #ifdef EDMA3_DEBUG7 n7 z7 b% }7 H% d2 \$ l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: {3 [. L/ x: v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q. O% W4 f" H+ F6 x: k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ~; c Y- m4 m ]4 ^* N/ r' N
- #else
# l4 J! x' B5 }: L2 A# V - #define DMA_PRINTK( x... )
2 |. ]5 I7 j7 t% C& W8 O - #define DMA_FN_IN) e1 ~" r, y$ F4 ]: l# }
- #define DMA_FN_OUT/ R$ N# {. B( I/ C
- #endif
& l+ M2 K+ |* I" b. t5 E; i' I
; T0 A3 S$ ~" h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) O) j. d' P7 X; B
- #define STATIC_SHIFT 3+ V/ `! b! S$ A8 s
- #define TCINTEN_SHIFT 20, _# n, g0 D2 R
- #define ITCINTEN_SHIFT 21! h; j- S2 p1 t2 |
- #define TCCHEN_SHIFT 22
6 w% a5 B9 Y/ o3 R9 e - #define ITCCHEN_SHIFT 23; I6 m p/ t% E
- N: x o7 ^5 ?: P5 _
- static volatile int irqraised1 = 0;+ g0 y: r0 L& ?' D4 I7 e
- static volatile int irqraised2 = 0;
% L. f6 k5 I7 f3 t2 g* c" g8 s- s
' W& l/ U6 }. ]& W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 E; C4 m0 y3 V) Y/ j; Z+ f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 V- d. j6 j7 r" C% W" Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 \+ |8 j) v: k
% b) D. M' x2 P3 h0 S9 m( z- q( n- dma_addr_t dmaphyssrc1 = 0;
7 G/ z9 P+ t& s, @: z5 V% | T - dma_addr_t dmaphyssrc2 = 0;+ S0 n) z0 ~8 G, c* n8 m/ ^/ B
- dma_addr_t dmaphysdest1 = 0; |* j7 Z/ E- _8 K
- dma_addr_t dmaphysdest2 = 0;
, l u% L1 n3 w( P; S1 o* K. W
: o# v$ f" l2 O% e- char *dmabufsrc1 = NULL;
3 W# u7 J2 g8 [; p' } - char *dmabufsrc2 = NULL;
6 g s9 R. X0 [! f# E: d: B E - char *dmabufdest1 = NULL;
4 z2 R9 J$ u( a8 f4 ~3 }* ?( P" f - char *dmabufdest2 = NULL;+ d$ a8 }3 d% T
& K- u& z L" X+ \2 d8 Y" `- static int acnt = 512;
$ o" M, Y! s$ | - static int bcnt = 8;) W/ e7 F! l9 Y6 {
- static int ccnt = 8;1 Q1 n' y2 N7 `. D
- / w+ N# l$ v9 J( e3 ^3 L3 o
- module_param(acnt, int, S_IRUGO); W, N0 ]- F, `
- module_param(bcnt, int, S_IRUGO);
6 |. j& Y2 k* U& c - module_param(ccnt, int, S_IRUGO);
复制代码 ; {3 R- d/ H7 d
5 S! g+ D1 A* G% v3 U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& \- t4 J) j* D" P0 x* h
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+ _4 o$ k# n; R+ o+ Y( t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 l0 R% _$ f5 @
' {# T' P) a9 p3 }
! Z. }1 n, H2 `, @. j7 T. k |
|