|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( U; J" [) j0 g* r- [code]EDMA sample test application! i" M( h. B/ U8 I; _
- /*
' L* j9 C& B% M& @; K5 T2 B9 A - * edma_test.c) h- q0 j0 B I) g5 T" _) M
- *9 ~" ]* o) x' A
- * brief EDMA3 Test Application
* y6 B9 ?* ?9 q, b; j$ R; R# e - *
+ Q# F" w& r. x* X4 L - * This file contains EDMA3 Test code.% r( `8 m! t3 }/ _9 F5 W% K
- *8 F$ v" |5 B: Z' Q4 V) [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! R9 m/ F) @# V9 T) O* d# d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# M0 d& L5 y, [
- * TO CHANGE.! _# m2 x5 E# ` ^
- *% ]: F' f3 z2 }. Q+ B8 d8 Q6 n9 S0 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 t. _+ B, x6 w7 M - *) q9 C @6 f- U+ a% C
- * This program is free software; you can redistribute it and/or3 A: r# \1 a8 r& G6 k4 g
- * modify it under the terms of the GNU General Public License as
" {" v8 J% [: d2 y1 q O; n/ Y D - * published by the Free Software Foundation version 2.' D: n! ?3 R7 M
- *
9 w& F' A4 {2 t$ R& A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& w0 O0 R, U; ^' p2 w/ d
- * kind, whether express or implied; without even the implied warranty
, H- H; }( J) ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
] S/ v/ k0 T$ M1 ` - * GNU General Public License for more details.
# h9 k5 Q( H5 D% A - */
' h- t. v9 e2 D5 O& l! W7 @ - 7 K0 a6 }8 |6 n1 z0 j
- #include <linux/module.h>* | j6 L* X' {) a: B5 i$ M
- #include <linux/init.h>: Q/ L: F' u; W/ S% }! j( [ u9 b1 A
- #include <linux/errno.h>- P$ {1 z' h/ q% V8 _' S
- #include <linux/types.h>2 ~: c$ K$ e4 Q+ b! `
- #include <linux/interrupt.h>
& V* s v4 R; F$ }: C' r - #include <asm/io.h>
" d1 t8 q4 O6 k9 R- M* H; ^ - #include <linux/moduleparam.h>
* I# f0 E% y% O6 C - #include <linux/sysctl.h>
: J( S4 ^5 w; V! U5 z+ u* f - #include <linux/mm.h>
' k+ D8 U1 X5 G% N; Z- F d - #include <linux/dma-mapping.h>' E. K2 T8 N. d2 S) i* i6 F
- 0 p& x8 o* Q0 ~1 `! B. f
- #include <mach/memory.h>, Q; @5 }5 L9 [+ t9 y0 Q8 x
- #include <mach/hardware.h>
8 S" o% G# M% c! E3 u) [+ a2 q$ C- d - #include <mach/irqs.h>
( W$ ?- z2 V0 S0 D1 f - #include <asm/hardware/edma.h>
- c& L/ r; B- q! C3 C
2 i/ }# d9 T! E& q y4 L- #undef EDMA3_DEBUG
/ m- I0 c! |$ @, Q5 s0 S - /*#define EDMA3_DEBUG*/
- t, ?6 d4 W3 u0 S) C' @
0 C$ b& r' x: G. f) T+ g! F; |& s- #ifdef EDMA3_DEBUG0 Z1 N0 T$ i2 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* T3 \) k6 T/ E/ `4 f6 d5 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& N! i \# L4 C! W0 ~ P) { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 A* C2 `% Z, m% d7 o. B% `; T6 ^
- #else
- U" A3 e* X( w) _! y2 t - #define DMA_PRINTK( x... )% n9 D, [% K! j, V
- #define DMA_FN_IN" b& l; I+ s# K* n' f
- #define DMA_FN_OUT
. o+ s& o. ~2 x9 k* e- u% D - #endif4 P% A/ y9 X7 u7 S2 C! J+ [
* @3 S) I3 ?) K/ q d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ k* `, i! A' O# Y( k' b! \* F" H
- #define STATIC_SHIFT 3
8 h% c" i3 {: c$ r* m7 O - #define TCINTEN_SHIFT 20! r; o/ ~# P, k: a2 C
- #define ITCINTEN_SHIFT 21
5 D( q9 `$ h% D2 o4 Y- `( G7 L" N - #define TCCHEN_SHIFT 22
% {% w2 O5 r$ A! f- T1 [ - #define ITCCHEN_SHIFT 23 Q% f" q" [# x Y, }0 y* i$ Z: C
- I' C& C, y. [% u5 ?$ Q: H
- static volatile int irqraised1 = 0;2 |1 N2 Z% b1 e7 Y! x4 p
- static volatile int irqraised2 = 0;
; e' L. k {2 c2 @ - 7 Q* q8 @6 w: s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Y! V7 L7 C; l6 l; ~$ T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S @9 e' x9 f* X) B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( |/ _( Z% F" A5 ]4 z6 Y! X8 z: {
# d5 s5 C6 d v( x3 u0 k/ B* a0 E- dma_addr_t dmaphyssrc1 = 0;
9 P2 g' n/ x' ^, y2 w! i$ Z0 C - dma_addr_t dmaphyssrc2 = 0;
z7 Y* a8 Q* h3 I - dma_addr_t dmaphysdest1 = 0;' q' P. K) w, ]; P1 I5 Y* h- O
- dma_addr_t dmaphysdest2 = 0;. w1 a5 Y, a& e6 x8 M t
- # d2 P9 o5 f6 m2 i8 R
- char *dmabufsrc1 = NULL;
0 ^: H- m0 Z9 u y2 H8 {& k' x - char *dmabufsrc2 = NULL;. r' \3 f. @, X" S7 Y% \
- char *dmabufdest1 = NULL;
, F9 G6 d U0 s& g' `+ { - char *dmabufdest2 = NULL;
. |/ u# ~: J# }! z
" ]9 G" W( o4 U# O8 g- static int acnt = 512;9 R$ \5 b' J/ Q" t M/ j
- static int bcnt = 8;
: A; t0 I) _% p$ Z2 E% y: b. u - static int ccnt = 8;
$ h9 _1 O1 \, j& Q0 ^ - 5 d8 V' @. G5 X
- module_param(acnt, int, S_IRUGO);
/ P( s' Y9 B% O# x5 } - module_param(bcnt, int, S_IRUGO);
/ Z( l# ]' y# |4 F! _" I- c6 o5 c - module_param(ccnt, int, S_IRUGO);
复制代码
+ ?- g: X) ^! M3 K1 C( I7 E
' K9 V, _! i0 C+ I+ v. A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. n& {1 z: [9 H9 M' s* u: Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m8 h( Y4 T- H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 F" B: g0 A9 [! W" a9 s! ] t3 F+ \1 g R6 \4 \0 Y% j6 x
; a' M m. ^; o8 j4 V |
|