|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 d0 j$ R8 {5 B3 ]* ?- [code]EDMA sample test application+ z) z( @4 t( R/ Y, y5 q
- /*4 L# E$ _$ y2 q3 T; C0 Z7 Q/ Q# R$ g
- * edma_test.c& b: h+ I7 ]0 k* L1 q$ l6 f
- *
' b- J$ a M- h6 y: ^+ h - * brief EDMA3 Test Application9 V( Q# [ y6 Q8 ~
- *
$ V5 W9 D) \' ]( D% l - * This file contains EDMA3 Test code.: _5 x; R! ~; h- L9 M
- *; k. v% d) ?" h+ R) {! D1 V" Q. O& C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ l" N) l8 A/ R6 q% I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) f+ e% ?2 ?" W3 g, W! z - * TO CHANGE.
3 J" G1 O# h! B& i- X4 p: ^ - *# I% E! L+ ]$ u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. S3 \: Q; l6 ? - *
- A: \. e0 f Y- X! q9 e - * This program is free software; you can redistribute it and/or: E M2 V- O% {4 c$ |1 }5 Q7 m
- * modify it under the terms of the GNU General Public License as
3 e5 z' ?' S- \1 n( A - * published by the Free Software Foundation version 2.) ]: h) R; L0 X
- *
; G% H$ U# D* N3 |1 d2 h1 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% s1 A- [ L& ] - * kind, whether express or implied; without even the implied warranty# V3 B1 g* Y5 ^3 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. ^: a/ x) c8 f - * GNU General Public License for more details./ e2 ~! q8 t9 Q5 t1 m
- */, ~ q. {" R2 Y, k
* T u9 F. P$ {; L- #include <linux/module.h>: N) G$ ^) K, P, l
- #include <linux/init.h>( Z7 N5 \; ]7 x& p
- #include <linux/errno.h>
2 X3 M- B J* E# [% I - #include <linux/types.h>
$ W5 ~8 m5 q5 s; H8 f - #include <linux/interrupt.h>8 B! e2 \% C/ h6 ]# X
- #include <asm/io.h>
8 U5 R$ u9 H2 d6 T - #include <linux/moduleparam.h>
1 w# b B* \! R% [6 D G - #include <linux/sysctl.h>
$ \- E! {" \+ c3 l( Q - #include <linux/mm.h>: T3 a9 d; a- D3 Z0 ^3 d6 W
- #include <linux/dma-mapping.h>+ u7 p Z3 K5 V+ o. b( y, `+ u
* w- p0 z( j1 b( n( `. S1 q5 q) A- #include <mach/memory.h>
) j5 M% P/ `/ W- t3 @1 o* R - #include <mach/hardware.h>, ?- U+ `, Z _/ E; A- d
- #include <mach/irqs.h>
! R. Z/ \5 A9 m - #include <asm/hardware/edma.h>
! [, |7 z' a/ h0 r& H, O. `
, x& k1 u- }- e) C% F2 i8 Y" v% `/ [- #undef EDMA3_DEBUG
7 ]' v8 |5 n# P3 E - /*#define EDMA3_DEBUG*/1 T5 n2 h3 N3 H Z1 _
- ; y* K- G/ f% F- q8 N' a
- #ifdef EDMA3_DEBUG' O, F9 \! k* h) z5 k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 f% _% ]+ a6 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* }& d& Y9 A, q7 k$ c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" j# f* X1 n2 t9 c0 L6 |6 V - #else
9 g' b& k: N- ^- P5 q - #define DMA_PRINTK( x... )4 {/ p6 l/ m, `( ~
- #define DMA_FN_IN
/ H; ^6 d& }2 O: O8 S6 v7 ? - #define DMA_FN_OUT
, z6 T$ L3 I' o. q. x4 Q2 N: z - #endif
! J" X1 u, `' E" W - 9 b# r3 a% F6 J. u& [% A" G3 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), d a! |. Y$ Y) _5 H% Q
- #define STATIC_SHIFT 3
- m) E, G( D# K p. f; {% {2 z - #define TCINTEN_SHIFT 20# V' n# F' j: X
- #define ITCINTEN_SHIFT 21, [! B2 [/ d4 i+ M, I* h
- #define TCCHEN_SHIFT 22
" U( ]. M$ F/ `& }* h+ c' `5 y0 D - #define ITCCHEN_SHIFT 23
6 A4 q( ~* q& N) G) o
5 N8 k, J& m. D" j' y2 `- static volatile int irqraised1 = 0;
! j6 Q' z ?2 P! N - static volatile int irqraised2 = 0;
5 f# u4 X T! f& b, a - ; X% i; Q) @* Z7 @/ [: i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 d* R( \ b/ n& |7 K8 v# \# c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 G. V$ x- }+ A3 g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 R9 q' x# F7 B/ r4 `& _2 n/ o
( J- c c( g% R- dma_addr_t dmaphyssrc1 = 0;9 o/ e& W' c) p5 z- h3 U
- dma_addr_t dmaphyssrc2 = 0;
: p+ ~3 |" J& k# S( Y - dma_addr_t dmaphysdest1 = 0;& @+ y# D/ f9 f& C" s
- dma_addr_t dmaphysdest2 = 0;
; M4 ~0 O2 T/ n6 \" S
; w2 J5 p: N+ A7 ]$ j( x- char *dmabufsrc1 = NULL;
+ L+ r$ K( e; Q; A; K/ I" o) ?" V - char *dmabufsrc2 = NULL;) m6 ~" w: c( K
- char *dmabufdest1 = NULL;
: K9 x$ n6 U j9 p) t - char *dmabufdest2 = NULL;& T, k3 c4 p, g
" s3 p, f6 z' y3 [$ `- static int acnt = 512;3 k+ s$ T5 r! S( a. E, T- ?
- static int bcnt = 8;
5 h1 X; ~$ Y! F- p - static int ccnt = 8;/ [1 x! _. a$ @) d7 y# ?. V' v. \& g
" G$ J1 D$ t$ `3 N {- module_param(acnt, int, S_IRUGO);
^1 t3 u' m& ^ - module_param(bcnt, int, S_IRUGO);
9 }, M9 e. g& ~" C& s" F2 o& N - module_param(ccnt, int, S_IRUGO);
复制代码 * L' B" a+ U- S) u$ j
0 C/ K8 k @5 n- K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% T" Z9 ]# _( U3 [4 b: d R4 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 E" t! b$ O6 P6 ~! H4 k6 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ X2 p7 u' R$ i; v9 z2 G, V+ q$ @) }( ]1 k
* V2 P' ~+ m! O! y3 S8 ]" O |
|