|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % S- f, H( c3 G+ T
- [code]EDMA sample test application0 B" c: A& [, ^7 s! |. A
- /*
! ], a; M3 _( U( f9 Z - * edma_test.c
1 j4 h$ f- _% U( ?- f* b9 ]& { - *
7 j0 Y7 Q1 A3 X% E$ B" U7 ~. w - * brief EDMA3 Test Application
# o4 z: [2 D- e N; F0 P6 K - *7 f/ O5 D/ R/ M) j6 x7 c$ B
- * This file contains EDMA3 Test code.
# D; @; z' Q/ R - *6 d2 z( k. R! a& [3 ~- x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 o& e( M9 ?7 \3 M" ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" b' ^( \( h( h% q, q, c0 B2 C' |
- * TO CHANGE.& D0 U3 e9 X% b! C+ _" H
- *6 o( `5 c2 Q4 V+ y2 n1 E% Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& X; z( ^, {* y8 h& W; Y - *9 K/ T5 f. r% d% [4 [
- * This program is free software; you can redistribute it and/or
( ?2 r* U' @# _* l - * modify it under the terms of the GNU General Public License as' x! _8 h( r! D% l; W6 R- E
- * published by the Free Software Foundation version 2.$ l! k) C/ R7 v8 g5 ^# N2 P9 G! r
- *7 x; A5 X. T) U9 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 j4 P, P4 F* l/ A1 ]: [7 E - * kind, whether express or implied; without even the implied warranty) m' H) V3 T- s0 h7 k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! w- h f% m; [
- * GNU General Public License for more details.4 n+ h+ d% @' P3 j. i, h* ^
- */0 f, S) L& Q$ @4 j( U# P
- 2 J/ R6 w% i2 T! P9 F; ]
- #include <linux/module.h>
! n! h0 q3 n5 H/ O" K. | - #include <linux/init.h>, F4 I* V4 Z9 U \) f
- #include <linux/errno.h>7 F$ y9 l1 R9 h/ l6 w
- #include <linux/types.h>4 {0 R1 ?7 M. e, x, S' ^, m
- #include <linux/interrupt.h>1 X! H4 V$ x6 {" C7 Z# n5 ~
- #include <asm/io.h>; T# t( V5 Z8 t: C( g
- #include <linux/moduleparam.h>" y4 m/ b I) ?# o4 s) D' B
- #include <linux/sysctl.h>
8 B: f0 @, G& W0 h2 Q/ N }5 c - #include <linux/mm.h>
) l( e# Q: h- Q. N7 m, Y! c - #include <linux/dma-mapping.h> |) ^8 a9 |$ l: k1 v j
- 6 X, x1 n! l2 B e0 ^$ O
- #include <mach/memory.h>4 m7 ?! J( H2 `* X
- #include <mach/hardware.h>
1 g! q$ t" W/ a h9 u n$ g2 V$ ] - #include <mach/irqs.h>
* h# t5 ^1 ]* Q - #include <asm/hardware/edma.h>
$ W- a' d$ i4 L8 V9 T7 g - % r8 d7 h- |! ?- k; `3 l; ?. q s
- #undef EDMA3_DEBUG
/ O5 P$ z& ]* q - /*#define EDMA3_DEBUG*/
% h6 b+ ?: B" {7 R H4 R' Y: Y
6 Z$ ?! b9 N$ v* E- #ifdef EDMA3_DEBUG) [: @# C/ V3 D4 h9 J* @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( o) i* f4 H' j) P. K w. Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) O5 S T$ {3 X& I. Q- Z8 @* `% A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
m. m7 M0 Z4 M. s2 @, P - #else, p1 g! {# _( L
- #define DMA_PRINTK( x... )
" x% n) R# ~) Q+ Z8 j$ ?4 x! Y - #define DMA_FN_IN
( b' _# v5 ^: W' r0 J" t' t; A% C - #define DMA_FN_OUT! W+ U/ y$ U7 Q% f
- #endif0 d! n3 e1 ^- F+ Z' D% b# i) \& h
* W& @9 ?+ p8 N0 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 O% t( [% M' n% a- C, _
- #define STATIC_SHIFT 3
% L4 H7 z7 U0 o; S; A - #define TCINTEN_SHIFT 20
% ?$ o6 L5 v% p; A$ A! H - #define ITCINTEN_SHIFT 21
, E9 r6 T5 u; B# z( ~3 a% ]* l - #define TCCHEN_SHIFT 22% @) w% Q, H3 U: @9 W
- #define ITCCHEN_SHIFT 23
. Q, {& d1 u" i( u; E0 p+ h$ \
0 [3 F4 n; X A- z C1 C- static volatile int irqraised1 = 0;* C P( J0 A4 ]+ Z5 h$ ~
- static volatile int irqraised2 = 0;8 y: t5 S$ N' e; S4 z6 X+ y
- `/ G6 A5 X x' q( I/ T0 r' P1 e4 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 h! V. k S' e3 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 O# ], L b0 o: L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 R( m6 }+ t6 N% a s2 D' j( f
; H& x V, p5 x. E) [/ U% N- dma_addr_t dmaphyssrc1 = 0;. N7 l, f5 [3 D
- dma_addr_t dmaphyssrc2 = 0;2 Z) N2 i# y Y' Y ~3 r, k" B7 L
- dma_addr_t dmaphysdest1 = 0;* W- s2 B; R* q& T `, Z1 M
- dma_addr_t dmaphysdest2 = 0;
! t' e( i; ~0 P% F7 }
M/ M# t. p* |7 i$ e5 ^' h- char *dmabufsrc1 = NULL;
" W& M9 E# t8 I! m - char *dmabufsrc2 = NULL;+ L! z( }3 ~7 h1 N3 P
- char *dmabufdest1 = NULL;: H; k: } S1 R5 h
- char *dmabufdest2 = NULL;
$ y/ l8 h2 a# Q8 J& H0 r
b' B4 o4 _7 z( H# ?- W) W! T- static int acnt = 512;
5 Y1 v( u1 |! Y, x& R9 M4 J - static int bcnt = 8;
& ] ^6 K5 @) _5 Y" R* z - static int ccnt = 8;6 ^, U8 _) P8 k/ X* V8 O
- 7 [. J1 o$ q8 S7 @: }# S. `7 F
- module_param(acnt, int, S_IRUGO);
- n% j2 V! v7 D' s4 q - module_param(bcnt, int, S_IRUGO);
) x9 J& K& I9 j: Y+ C% S - module_param(ccnt, int, S_IRUGO);
复制代码 ' V/ O1 L. ?9 k4 r
, [. E' A1 K/ @, v, W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( R/ n( s) _2 ~4 ^2 K2 Q g3 `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 ~& D( Q: X [# g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 N8 a% l( o8 s' M- q' W- d8 V. T/ A3 o+ \# I
+ F: ]3 W. u( M8 U) t' i
|
|