|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & h) b @5 H, J
- [code]EDMA sample test application: H& D* h% j2 }) b' ?$ n8 Y
- /*3 h4 t4 m0 @. C5 z" O6 l
- * edma_test.c
% z' e7 a% N# G7 B$ P8 P# a" I' Q - ** `, Z; D4 S% D$ ]1 Z
- * brief EDMA3 Test Application/ M9 d4 |7 q W( U1 L
- *
t1 `+ e: ^5 ^, c+ p - * This file contains EDMA3 Test code.0 s) z2 [% [$ K- x9 r ]) d- @
- *& z* b K, r( R, S/ T6 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# c7 w# y0 v2 |9 O: N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! p& @$ v/ ~; V - * TO CHANGE.
8 i9 `. s- Y) i" X. Y/ | - */ u/ L$ Y" W3 Y8 D1 E5 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ E& ?$ {& _8 t& p( u" J" ]
- *
) Z& n* X# I* @* @) J6 i! Q0 O - * This program is free software; you can redistribute it and/or
# L6 P4 Q5 o. v/ [' `$ t - * modify it under the terms of the GNU General Public License as
) H1 ]; i0 B$ Y, { - * published by the Free Software Foundation version 2.9 h8 W1 L3 S6 ~! j6 \5 C) W @
- *: ^) m: @* e+ L5 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( \5 l1 I/ O7 b! X
- * kind, whether express or implied; without even the implied warranty4 z$ ^, z& ^0 c4 v" d/ r# v0 \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" P" ^; E# q5 H3 }$ n
- * GNU General Public License for more details.
5 K1 h) @3 _+ y6 Y - */
) U3 t k) j9 _2 C3 A
$ H( |* H' t( _ l1 U7 h& W# b- #include <linux/module.h>
9 y7 e) G, `, _- q4 L - #include <linux/init.h>
& \4 C" ?, L( D" L' {5 D+ v# ` - #include <linux/errno.h>
7 I/ }; [1 i9 i0 e# [* E V - #include <linux/types.h>
( J' L1 ~: q/ E. ~3 d. I - #include <linux/interrupt.h>
* x, [ S& @3 C. Y7 d+ | - #include <asm/io.h>
. ?) x9 z; L3 ~- N x$ q - #include <linux/moduleparam.h>4 f# k8 n6 M( h# V
- #include <linux/sysctl.h>
$ R. c4 M N! ~0 W - #include <linux/mm.h>: \; n- d5 j' F' K. o4 A& h2 E
- #include <linux/dma-mapping.h>0 Q3 ~( j2 F1 O( c
- ) B4 I0 e" q7 O' z- d8 H: W
- #include <mach/memory.h>
& K( d6 y( M, d" j$ \ - #include <mach/hardware.h>
, Q# A. Y" G9 D* Q% D - #include <mach/irqs.h>* v+ J, W- T! B
- #include <asm/hardware/edma.h>
; c2 Z V/ N& M: B8 E
% ]9 o4 I1 ^4 n3 e+ s- ^- #undef EDMA3_DEBUG
X( P7 V& r* y& \: c2 B) @$ \ - /*#define EDMA3_DEBUG*/) h+ R' Y. \5 A1 h* G
& |% g7 ?* ^) j8 W- #ifdef EDMA3_DEBUG
7 J- g2 U' J1 E/ d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ ~( P5 i+ J- M: V" n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 o* [: \9 u# a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): F( c2 E# l/ O
- #else3 s' u/ |: C7 D/ J4 h
- #define DMA_PRINTK( x... )
/ q5 j4 U" d# I/ T; e. L - #define DMA_FN_IN7 Z; m2 ~+ L4 b3 B/ g4 v# j+ U
- #define DMA_FN_OUT
! s0 P0 E# u0 T* e, a7 l2 s - #endif1 U+ R+ R5 ^5 J7 T$ {! C4 V
- 4 m+ q6 m- E" s& Y) t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- M/ m8 y3 Y: r' [9 N8 h
- #define STATIC_SHIFT 3
. f" ~7 X0 U& V% D - #define TCINTEN_SHIFT 20$ i& M- q: v- } |0 M, t( n
- #define ITCINTEN_SHIFT 21
# B% R/ ?! U6 [2 p# L- y - #define TCCHEN_SHIFT 226 i# y$ h6 o% P, l: v( {
- #define ITCCHEN_SHIFT 230 Y" a9 P" h( ~2 h$ v
- . @ |+ l! ~" Z+ @6 g
- static volatile int irqraised1 = 0;& j" D( ^$ M9 q0 X
- static volatile int irqraised2 = 0;
s* h8 Y5 g' P9 R% J9 |0 [) ] - L7 I- O1 Y: }4 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: h2 ~& ~* g; d' p; d5 X# @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! l4 {0 ^% t' O8 T" ^$ Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 G3 X! p& G( _ - - K/ B1 c0 Y0 Y5 y4 a: P
- dma_addr_t dmaphyssrc1 = 0;9 [) W3 ~. w* H# E& z
- dma_addr_t dmaphyssrc2 = 0;/ p/ ~8 P! O) J0 ^, u& B% y
- dma_addr_t dmaphysdest1 = 0;
y1 A( j, N2 W2 ?* { - dma_addr_t dmaphysdest2 = 0;
" {! F7 i% e" W" [
( W6 v# a! h! k W A- char *dmabufsrc1 = NULL;
# C/ h4 i6 n2 K( X- e - char *dmabufsrc2 = NULL;
$ Y. |' U$ ~' e8 G4 z - char *dmabufdest1 = NULL; P3 x, W& E$ n: m" |8 L3 v( A
- char *dmabufdest2 = NULL;
( D" M r) f0 G* B% i! [& O4 X - 7 k6 R' f. ~' |, G$ h) p& t
- static int acnt = 512;0 W$ W f8 g" w( m* H
- static int bcnt = 8;' O0 v3 ]2 u4 Q8 w
- static int ccnt = 8; A$ X4 [8 b8 w4 S
8 j& f/ p% p$ q( b- g- module_param(acnt, int, S_IRUGO);
, }! b& e; F8 B& G* l* U- C7 D9 h6 o - module_param(bcnt, int, S_IRUGO);/ B) v* u" T7 C. Q/ V, \
- module_param(ccnt, int, S_IRUGO);
复制代码
; k9 H2 w% l6 `
2 R( v! a/ G8 K( J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 d) Y! _9 S) Q) larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& C3 n9 ?" }7 `% q! R e" M1 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 `/ }/ E3 y$ N1 D( l) C: N' ~1 I8 T. _; U0 B6 C/ A
& I5 l7 E% F; t- Z. A
|
|