|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( l7 `9 C9 N l
- [code]EDMA sample test application
$ g8 v6 p" {$ I) f - /*7 u8 K, `2 r1 `
- * edma_test.c
1 O' i0 s# B3 N {- k - *
8 A! v! ^* p* g* v. H - * brief EDMA3 Test Application" t" t6 t6 I0 A! v7 f) Q9 u0 u
- *
3 ?* S3 Q: Z* {: J3 _ - * This file contains EDMA3 Test code.& e( p) w; ?$ ~: ^$ E5 c- m/ Y
- */ b; X2 ~5 C3 u5 @, Z2 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) M" W3 S+ f4 O( ]- Y/ a/ i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% k& M3 \7 Q7 k, V8 V, y8 @% e N - * TO CHANGE., x5 A% b. J+ w9 m3 N% f
- *
) @: p9 l5 X. `" v) ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 d& v2 P# C7 m" R3 ^. ?3 c5 V
- *9 }7 v1 n3 x' i3 [5 P+ z9 G
- * This program is free software; you can redistribute it and/or
, ?) B; i" v3 A# s" r4 c3 ` - * modify it under the terms of the GNU General Public License as) ]+ a" A! ]9 |+ m$ x& g" `2 |9 {
- * published by the Free Software Foundation version 2.
0 z/ O, p' E3 ?# r3 c0 _ - *
( h* q' b/ ]$ y6 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# }8 L" i8 l( r, \6 J+ p - * kind, whether express or implied; without even the implied warranty
1 J, z8 ^( p! t: F6 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* g- h* i+ P7 w7 ^6 U5 S$ `7 k - * GNU General Public License for more details.5 q1 n3 k4 S( E$ @2 b+ B7 V
- */
7 q% { l9 f I, _6 q8 F
) z: r+ S4 b! c9 n- #include <linux/module.h>/ l' D8 W9 I: Z1 X" d1 U* M
- #include <linux/init.h>9 ]: I5 K( Y2 Q! p5 Z6 D$ ^" k
- #include <linux/errno.h>, h1 W/ }8 [4 f7 Z1 r0 j ^: y f
- #include <linux/types.h> v' P+ ~7 E* \% [
- #include <linux/interrupt.h>
7 f; k! y9 c9 W9 ~' C - #include <asm/io.h>
4 f Z* y/ k/ \/ D - #include <linux/moduleparam.h>6 j- V( p8 s! d% M: C- p$ H
- #include <linux/sysctl.h>- P! k" {+ i5 y0 N( d
- #include <linux/mm.h>
0 @( W; U- L0 ~. ~1 t$ P2 J* H - #include <linux/dma-mapping.h>
+ t" M) R9 O" V- i* e, R# T - 5 _& Z9 S: ^& L
- #include <mach/memory.h>$ h& M1 j, ]1 p! ^( j
- #include <mach/hardware.h>. y( W5 C) Q, P0 f/ n3 \
- #include <mach/irqs.h>: D& W% z+ F- S
- #include <asm/hardware/edma.h>
H( J. l: h2 i- `* M! L - + @+ W3 k+ y. u0 D
- #undef EDMA3_DEBUG
* R, K w" o5 }5 Y' ]) q - /*#define EDMA3_DEBUG*/: F1 W9 Z7 ]" U- i* f2 Y4 L' l
- 7 J1 k2 ]& r% h4 s1 w
- #ifdef EDMA3_DEBUG3 g" S# z. E" n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 k, a4 ^1 L* [8 [. Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 f) y" E, E- o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) V; S8 J \, `' K! u
- #else
3 z- Z/ |# b3 @6 I, {; f - #define DMA_PRINTK( x... )! B4 N% p- S5 P8 k
- #define DMA_FN_IN
7 `2 x q) I4 [/ @6 Y! A - #define DMA_FN_OUT
" z. B# M7 b: c1 C% D3 } - #endif0 e: Q8 \# ?( `! \/ _9 V0 G
- & J# }$ A& _ y! K* B4 O8 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" u$ w6 i x/ W, h - #define STATIC_SHIFT 32 [- s" ]- ^% J* P+ H& ~
- #define TCINTEN_SHIFT 20
9 ~, l$ K' c! o; q7 M" D - #define ITCINTEN_SHIFT 21
" v3 O& [8 f) ~ E( k3 e - #define TCCHEN_SHIFT 22
3 F* e# u5 m: H' W1 @6 ~* F! W - #define ITCCHEN_SHIFT 238 j0 N/ n/ q2 _
- C3 u( V6 ]* f3 A. b- static volatile int irqraised1 = 0;8 t3 j4 q# {1 |# S W/ r
- static volatile int irqraised2 = 0;
4 \4 D$ a" j) t5 O( k# f
5 P# u$ B# k* X6 `' x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ e% A0 B- |( }5 s+ I9 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* M3 P* I. d8 P4 G5 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q' Z3 i( O* o1 `2 ~* {9 n! O5 ^
W# Z- h1 U: `* @- dma_addr_t dmaphyssrc1 = 0;0 G$ I9 n* }) a" C9 i! [5 N1 C. i
- dma_addr_t dmaphyssrc2 = 0;1 ^5 `9 @, M' A% q, h- A
- dma_addr_t dmaphysdest1 = 0;1 W {1 |# {0 g6 r
- dma_addr_t dmaphysdest2 = 0;
9 j9 o. T1 ~. ~. f - / j0 m0 Z; ]/ I. b) U
- char *dmabufsrc1 = NULL;, d f- G0 b9 f. f& ~+ d( I5 _
- char *dmabufsrc2 = NULL;
! i. i% g( y3 Q0 P. i2 b - char *dmabufdest1 = NULL;
8 y7 ~0 y- V( r2 S7 H* ?# B2 ~ - char *dmabufdest2 = NULL;- a7 g8 X1 }5 B+ N I/ c
; |% L- `0 O; h5 R& B: F, z: m4 @- static int acnt = 512;
; c2 c) w5 M5 ] - static int bcnt = 8;
9 h5 a2 m7 M# V7 @% D - static int ccnt = 8;! _+ M/ E* X1 f3 z7 Q
2 V2 ~3 G. Y0 D9 \- module_param(acnt, int, S_IRUGO);1 n& W# w1 A4 h, I2 C# h5 g W" v! L
- module_param(bcnt, int, S_IRUGO);
% W0 t) S1 Z* }1 ?1 I6 ^ - module_param(ccnt, int, S_IRUGO);
复制代码
' i2 M, U" D2 B3 D- n/ G0 ~/ t
1 G# G6 _, M T6 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |; w) Y9 W+ n; _; P- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 f( e) o) [, ]! h% M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* e1 @ d* C( Y8 p) m$ I6 z
' I5 r" F1 B9 A& U& ^9 d: T
* t' @3 c6 |. k; {1 t! k |
|