|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
Q4 J B) S' q8 Z1 h+ N/ U5 T/ i! ?# N4 i- [code]EDMA sample test application. J$ N0 I u$ b5 L& W
- /*2 Q* |: `) Q6 C& ]! H
- * edma_test.c
$ T" G! p# @5 ?! Q; n - *
) P; M7 `% e) _ - * brief EDMA3 Test Application) @8 S0 {+ s( |* f! E
- *
& O$ V/ w1 M& c$ C+ A - * This file contains EDMA3 Test code.
, k5 z ]% z6 }- T" w6 ?; }; b - *
: W0 g" O% H+ b7 p9 P5 j3 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 R6 P3 v& d w, ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) J4 j& G/ _3 o
- * TO CHANGE.& n; L% A0 Y" \* w
- *! z: p6 n; d1 t" ]6 X: i8 m( Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 z; Q% C7 x5 M8 p
- *
* y/ x- Q/ A/ J4 Z, S7 \ - * This program is free software; you can redistribute it and/or& a1 v5 ~! h/ L+ A. q( k9 ~) L
- * modify it under the terms of the GNU General Public License as* I& C' F# V5 d; v5 I9 o
- * published by the Free Software Foundation version 2.# [! H. M# q; ]
- *
# P4 ?/ i0 u) T' n2 U0 \' \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L$ g& ?' U6 \4 O) r* _
- * kind, whether express or implied; without even the implied warranty
; o6 p- J) w6 N4 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) d! i0 Z% Z4 ] - * GNU General Public License for more details.+ f2 ^5 N( E; c& z r5 k
- */" c2 ^- E2 {* c
- ~: r8 e) m! }& {- A- #include <linux/module.h>; U* R4 ^9 X4 u9 Y
- #include <linux/init.h>; B6 |# Y# J( Z) |6 m$ _4 p
- #include <linux/errno.h>( ^& D* K i' z* R3 N
- #include <linux/types.h>! s! |& X+ f2 ^: w d% [# j7 B( l
- #include <linux/interrupt.h>* r0 H+ c1 f1 B4 G% S
- #include <asm/io.h>
8 r A" W6 C5 z1 {$ Y$ {3 i - #include <linux/moduleparam.h>
& C8 k, A0 b' \7 c. }0 E/ e6 I - #include <linux/sysctl.h>
$ U) V. L' o1 l# Q3 G) |3 B0 V, ` - #include <linux/mm.h>
% M) z2 C3 x1 h - #include <linux/dma-mapping.h>$ b, j+ r0 v( l c! v" f: Z7 U; D
- $ h$ u1 | I- z: t6 D. j
- #include <mach/memory.h>
' s5 _; ~/ F5 @! `3 q4 w - #include <mach/hardware.h>
: |" Y! b2 g) x; N - #include <mach/irqs.h>: O; T7 D$ n, U1 @, D2 y
- #include <asm/hardware/edma.h>7 S& i+ E. Q3 {# b( m$ S
4 k; k8 w* o! k0 U) {+ |4 f+ N/ { Q- #undef EDMA3_DEBUG
1 y1 z$ X7 O# E5 X6 ]- h) M$ I! `3 F - /*#define EDMA3_DEBUG*/5 z$ A% D9 b. V2 n& `! W, [7 p; e
- + Q. ~ I5 }9 o
- #ifdef EDMA3_DEBUG. v0 e( [2 H9 y9 f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' |; z- c+ k+ ~4 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ^6 N, S, ] n ?1 `+ A2 ^0 ~+ O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 c; b# ^5 ] L! @ - #else
5 U6 q/ p! h; ^3 p4 X: J! y# | - #define DMA_PRINTK( x... )- a) D7 i9 f3 H6 z7 T/ |, ~" E
- #define DMA_FN_IN
/ w5 b* [, V# g2 U4 [4 n; y4 T; \ - #define DMA_FN_OUT2 j& A, S' l- ~/ }+ B
- #endif# Y: M( E' Z* g
- 9 {% M& B' ?3 ]1 s0 M2 ]1 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 r$ `' s# N8 c
- #define STATIC_SHIFT 3; e0 S9 l! V1 |& w a
- #define TCINTEN_SHIFT 20; k; W$ d; L1 N* W; R, T
- #define ITCINTEN_SHIFT 21
. N9 C4 ?( z! t6 r+ F - #define TCCHEN_SHIFT 22
. J* s8 r# J8 V. d; ?4 _) e - #define ITCCHEN_SHIFT 23" @1 k ~+ A9 l% K' ?: {1 t1 h
6 n; F; T; i- f. e/ e- static volatile int irqraised1 = 0;( ~2 C0 C% Z6 r) r
- static volatile int irqraised2 = 0;9 \( F3 P- x: t' t9 r
- 9 u( v: T4 o$ W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B" o* R/ J- q( C, v( `4 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J" j$ E8 S$ L9 r: F3 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" a$ C' P! ^ C8 z- C- K8 B* ^ - a& n0 Z% {. u8 p. N, n+ x4 k
- dma_addr_t dmaphyssrc1 = 0;$ R" u1 n2 L( @! q4 \8 ?$ ]! L
- dma_addr_t dmaphyssrc2 = 0;8 _/ `- Y! J {/ c
- dma_addr_t dmaphysdest1 = 0;
$ e2 G! ~7 s5 z4 }- P4 x1 r - dma_addr_t dmaphysdest2 = 0;
* c5 M$ z; V: p" N2 b( C
. z! G9 e6 z- v) f/ r; t7 B: U8 n& `- char *dmabufsrc1 = NULL;& ~5 C+ O+ i7 j+ u
- char *dmabufsrc2 = NULL;- v* j+ a' x# O/ [/ d; f
- char *dmabufdest1 = NULL;# L, H9 i" c! c; y( Z! b2 A$ D
- char *dmabufdest2 = NULL;' c" ]2 H# n/ A
- # U. z0 C7 ^7 ?6 r5 I. \
- static int acnt = 512;, v7 W4 e; \; \
- static int bcnt = 8;4 e! s* s- g. R3 B! @ E+ {+ ?
- static int ccnt = 8;
8 M1 x9 B5 }: d; { - & Q- |. h5 g6 Z6 k
- module_param(acnt, int, S_IRUGO);4 y% C7 m0 s6 s; x1 }1 x
- module_param(bcnt, int, S_IRUGO);% k, V6 r- X8 Z, C! e
- module_param(ccnt, int, S_IRUGO);
复制代码 0 N2 t/ S# |0 G4 n
0 ]7 n2 X6 F$ c4 w6 H* } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' x% R6 Z* F6 U& narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 f! q. V, a: K! s8 P' n4 X' p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 E. S4 [& M; z* b$ V8 d; m8 W; w+ u
: K% s% X f y5 h+ G) {
1 d7 t7 C6 W/ C: Z! |! g1 l |
|