|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " a, c6 |8 n& ?
- [code]EDMA sample test application
* `9 V0 k) I& R; ^1 g5 S- x- O9 j - /*/ m( l% Z6 t" ~
- * edma_test.c! X8 J% H: r+ g& l5 U! v
- *
" }# v' M/ ?) K) ^5 W7 ? - * brief EDMA3 Test Application
' |! z+ i* }1 H - *
6 F6 i* Z$ l0 s6 H U - * This file contains EDMA3 Test code.
9 C. Z9 C6 v3 z! T; ?* [0 U - *4 q* u I3 |5 ?5 p* V; ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 f* p& \9 G" }; g" S( ^ y: n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; X# ?( V5 k* L6 l: B - * TO CHANGE.0 B: p# f# J+ C( u
- *" C( v2 R% Q8 d/ H8 E# d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! R3 N2 p( Q2 f, y1 E, H' Z - *
3 m8 A) P+ j ?: P$ W - * This program is free software; you can redistribute it and/or
& g1 o: z8 n# {0 I - * modify it under the terms of the GNU General Public License as8 l* `8 _" L% q
- * published by the Free Software Foundation version 2.( X1 O7 E$ K( e( _! r6 M
- *
2 n p2 z: D5 s8 I* W( Y+ T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" B0 x' h! B% A5 a& ]2 y9 l
- * kind, whether express or implied; without even the implied warranty
+ H" ?) L! f% R, T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" s( o, r- a6 Y0 ^
- * GNU General Public License for more details.$ j, R: X$ C- {. G# _
- */
, e# `& K1 }) @$ K/ K
# M* _7 L3 Z; }: ]- #include <linux/module.h>4 M' }9 z! o0 h8 o6 ~
- #include <linux/init.h>5 x. A; z2 r$ L& w* P/ O
- #include <linux/errno.h>
* C' n5 s( l4 J1 z* o- C, j - #include <linux/types.h>
. _9 O$ I& i* d C. x) e0 B - #include <linux/interrupt.h>
# g7 V- m0 ~8 }' c8 Z# R - #include <asm/io.h>
, x- l4 T! Z* o$ n; h- T - #include <linux/moduleparam.h>
4 C4 n2 c$ j+ a; I" V - #include <linux/sysctl.h>
8 c' z3 n) j, t. T* ?$ h0 p - #include <linux/mm.h>
$ ?8 N5 e. D9 C2 e5 ?+ F* v6 G - #include <linux/dma-mapping.h>
. Y" o$ Q4 z! f& @2 n8 P5 ]. d) C; {
, Q* O) v* B4 ^6 z# m% m2 Q- #include <mach/memory.h>% r# D' ~; ?/ C! U% G7 O
- #include <mach/hardware.h>
) Q$ L' z3 L( ~ _ - #include <mach/irqs.h>/ f) @- l/ q# x! \2 i
- #include <asm/hardware/edma.h>$ a/ Z. `+ C9 r
5 }: c( @, p% W# a) M0 M- #undef EDMA3_DEBUG
3 b4 j. d, p* y" u/ A - /*#define EDMA3_DEBUG*/, b! n7 q) [& i) g
: r/ B& }( W7 p4 o) w; X- #ifdef EDMA3_DEBUG
7 x# {) i/ @% h% t: Y% j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 P) K: ~# T1 ]) c i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! s* ~8 T0 w8 W0 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) W s2 _) L& D% a, q, L
- #else
: ?- }0 c' G- p% i+ j - #define DMA_PRINTK( x... )2 R- M7 u- R/ R5 ~
- #define DMA_FN_IN
% O2 H; X" p" b% [6 N' t, ^ - #define DMA_FN_OUT
( J# d+ s9 t9 I7 a - #endif
& j0 a2 u4 p/ o n: L; n
, R9 J( q9 i4 P2 }3 k7 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ p8 ?! N' T" c4 l5 u( B; ]1 t. q
- #define STATIC_SHIFT 3
4 Z, Y" Q( a- g4 w - #define TCINTEN_SHIFT 20; [4 y$ Q) ]4 Y1 y/ i6 R0 `, q/ m
- #define ITCINTEN_SHIFT 21, H7 h4 K$ R$ _ d5 p. J$ _$ n) b5 q$ X
- #define TCCHEN_SHIFT 22( C+ e% f% R0 ^2 T: P
- #define ITCCHEN_SHIFT 23
; B [, n& Y: o6 W - 2 O* X2 c1 l) Y$ v
- static volatile int irqraised1 = 0;
! D3 {- n- K+ V! I - static volatile int irqraised2 = 0;$ [' |7 L1 g5 @+ f
\/ m! B. U$ O, u9 m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [ H: G# Z) {& Y- p! o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 x R0 k: R8 l8 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ x( S" X/ N1 v9 m' C2 |
* d. K: ]) i2 ?. h% G7 ]- dma_addr_t dmaphyssrc1 = 0;
% R1 B, n6 M R - dma_addr_t dmaphyssrc2 = 0;$ u! Q$ N/ s0 ?% g0 r
- dma_addr_t dmaphysdest1 = 0;
2 I/ e4 ~ h. J1 P8 z+ G2 _5 } - dma_addr_t dmaphysdest2 = 0;% J1 {, [. K% d( G
/ \$ [/ E5 V+ r% [- char *dmabufsrc1 = NULL;
( s9 z! T; f: }% M' f3 Y0 K3 A4 [- Z - char *dmabufsrc2 = NULL;" U7 [0 u& W/ ^) [8 B
- char *dmabufdest1 = NULL;
# Q0 G0 x5 t. _1 T* W V - char *dmabufdest2 = NULL;
' y1 ^8 i2 p0 f2 E# q/ \* V8 B, b - 0 s0 [7 R2 g& S" T% ]( g2 c! H
- static int acnt = 512;- ]4 i `' X: @) C U' y
- static int bcnt = 8;
; \6 v# d$ p! N% O& t1 Z - static int ccnt = 8;+ c: [0 Z9 y: Y( N* ^9 p2 k+ t
& `3 W. w) q) g T, k& b, i/ {- module_param(acnt, int, S_IRUGO);% {/ b" n& K1 _9 L
- module_param(bcnt, int, S_IRUGO);
2 P+ U/ R- Y% J/ i. T - module_param(ccnt, int, S_IRUGO);
复制代码
) b1 ?8 C0 b0 d2 V# J9 g
5 N5 m: {" Z; t- C' N% v5 c. X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p/ i4 s& M) g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& a! P1 I6 a2 e) M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& _+ g3 b- w7 E5 z# k0 _- X
" e; x2 B8 `5 s3 y, x
! `0 A/ q3 J9 ~ |
|