|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 d$ {5 K5 q8 l" o" q- [code]EDMA sample test application
) O5 h/ s9 {* T - /*" W8 W; E# m6 _. _3 d
- * edma_test.c4 @+ z3 X% a1 k |
- *8 o0 S7 l' C$ A0 h9 D' u9 A
- * brief EDMA3 Test Application
$ Y ^; a: ]4 ]1 b+ z8 v* y - *. I; R. F) u: e, ~
- * This file contains EDMA3 Test code.! k7 b( c* p j/ f* W: H. d
- *
! c/ b$ \7 y6 _5 }3 H2 N; Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! p* }2 [2 h$ _/ O0 n( V |8 A2 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( f) J" V V2 }" H - * TO CHANGE.' N) o+ P: w4 L6 y; E2 Z" M( ` q1 A" ^
- *
3 _% G( ^" n6 v+ K: g i3 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ p: A8 x1 R6 m0 ~* s/ L
- *
- i% @6 E O' i o3 W - * This program is free software; you can redistribute it and/or
1 ~- P s' C$ ~: |6 p# |6 H0 N - * modify it under the terms of the GNU General Public License as
2 m* m2 V7 l/ V" Q. q - * published by the Free Software Foundation version 2.
) g5 |& h; L9 p# q5 F) g - *- B! |8 r0 |1 S' U5 h- k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 r' i: o+ k; I2 q3 m% G
- * kind, whether express or implied; without even the implied warranty
, Q1 ]1 E& p# O8 K5 p4 [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- S- l! _" _7 \3 g* M* f - * GNU General Public License for more details.
6 u! y( l- C+ e0 p$ i* `" u, B - */
6 z- Y9 t8 M' t
# Y1 W3 H T/ T' y' o7 p, s- #include <linux/module.h>
! G P5 J# i+ i+ E2 a L. ? - #include <linux/init.h>8 U0 [$ i$ B( }, ]. M
- #include <linux/errno.h>" v: b. c+ c5 c( ~
- #include <linux/types.h>9 A; P! E! s9 r. W
- #include <linux/interrupt.h>
& e5 F8 a, G3 N- Y! F3 N - #include <asm/io.h>( X/ z p ?* U. V8 T: W! M' s1 H
- #include <linux/moduleparam.h>, e( I3 a4 {; D- R# d% _
- #include <linux/sysctl.h>
8 [9 K1 d. k( x V8 V8 g - #include <linux/mm.h>: e1 r5 e" P4 j# ?. V. D
- #include <linux/dma-mapping.h>1 U" K, I5 |% W! \, U
$ _3 k! E1 l* i; j- q- #include <mach/memory.h>5 c4 F9 B. N: k' n4 H3 _
- #include <mach/hardware.h>7 d$ S. c# X( r9 U$ M# s: ^/ c: G
- #include <mach/irqs.h>
# Y, i& u' `# L- V% N8 s9 { - #include <asm/hardware/edma.h># e& M8 v. p( t* `
- - r- {7 s1 w: h
- #undef EDMA3_DEBUG& {" R) ?% S3 F' F1 ?
- /*#define EDMA3_DEBUG*/$ w: g; |: s% g9 O! q" ?4 m
- R; [9 x9 u& Y" ]& a
- #ifdef EDMA3_DEBUG4 F- f1 ~+ O. T+ u4 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ^5 n6 @- p& w) j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ t" z. f- j2 ~! |2 n1 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 `0 k9 G" ~) {- {' d4 n, M9 W - #else
3 c7 @& Z: T+ p' W8 r5 O - #define DMA_PRINTK( x... )
; j5 @) M+ I" L) I8 c4 k" { - #define DMA_FN_IN
. B& _9 u S+ h3 k* q% E3 k$ _- m - #define DMA_FN_OUT# H) V7 T# E1 C1 c( P
- #endif$ b8 J! Y2 b- A, U+ u
- ' h2 x" }% [- j& j9 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# `/ G F2 T, L- W4 m5 N
- #define STATIC_SHIFT 3( d' G/ v6 M7 g
- #define TCINTEN_SHIFT 200 R5 ^. K2 y- a" L- j, _" u
- #define ITCINTEN_SHIFT 21
& X/ q* f" h" h: c - #define TCCHEN_SHIFT 22
6 [2 y' m) ]3 K" `! g* K; ]" T* M - #define ITCCHEN_SHIFT 23
, A/ i [) E3 c' g$ w: s - 1 m' a; d3 g# m! e# u3 c$ A
- static volatile int irqraised1 = 0;& Z# J1 o# [1 I& Z' F' Y
- static volatile int irqraised2 = 0;& C; c9 `+ C( n- p
! @4 I" p( e4 e+ _& w6 C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~, q9 ^! C) S" M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [1 F5 E. R% `2 k7 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
a( u( k j# I5 [$ p9 l, T
) b+ l( N: B* x$ b# V8 K- dma_addr_t dmaphyssrc1 = 0;
6 @8 y1 `2 S# N; `- ]4 A - dma_addr_t dmaphyssrc2 = 0;6 O9 |4 w3 m/ }. S/ r
- dma_addr_t dmaphysdest1 = 0;
' C* m: T' c! m& s) ~; v2 P# J) S - dma_addr_t dmaphysdest2 = 0;
. E$ F1 f" g2 R$ \ - & V$ A, u8 L( X
- char *dmabufsrc1 = NULL;9 V) S$ K( Y$ Q; E6 @5 v, B$ k7 }
- char *dmabufsrc2 = NULL;
/ @6 ^3 I1 T& T4 h% O& {* h! |/ ? - char *dmabufdest1 = NULL;4 n. d3 o( ~6 p: u3 f* j$ x
- char *dmabufdest2 = NULL;
1 N2 b- t8 f3 ?2 c
0 E! m% C H' b! ]( o& V- static int acnt = 512;+ o" u+ i4 `* T0 j- U% {
- static int bcnt = 8;
8 P8 f H, o. h# O - static int ccnt = 8;! c) R! `" ^ w
" Z9 g0 C- T9 [0 ~# R. }- module_param(acnt, int, S_IRUGO);# V+ ^. K8 `" C
- module_param(bcnt, int, S_IRUGO);* Q' I, i8 z }$ P: J( c0 U$ p
- module_param(ccnt, int, S_IRUGO);
复制代码 $ H0 T0 ^4 z+ P' z5 D% o1 l
7 F# o$ S5 Q" P8 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Y6 e( r T% U2 ~# L# }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ~/ A9 @2 M7 g# @5 [2 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 v% r1 b7 p5 O' a" q" h, d, f
* i) c9 x4 h, _$ n- K+ F
|
|