|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / W' `, n( h2 K' x7 w! d; t
- [code]EDMA sample test application: p( m( @3 }# U4 `' u& _" q0 R( G
- /*
& ?: c6 X2 ~- q* W. N - * edma_test.c
7 {% C: b, S* `( Y4 w# R9 V - *
# c8 ~) f Z* `, | - * brief EDMA3 Test Application1 S' d7 D- {/ [3 d$ Q: J! h+ X
- *
: Q# b v* X t( j6 I - * This file contains EDMA3 Test code.' u+ M& l4 V" F& \
- *# `" L, u. n+ m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% N t. \* k5 w# D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, i- l' u; p- ` - * TO CHANGE.. K& `3 a0 |, r& o! A- u" v
- *
: E7 x1 ]" R) w' s$ V" D+ Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) Y1 N ?- g E% D: e - *6 a6 O) E( p5 P% d/ e
- * This program is free software; you can redistribute it and/or
" W9 E! T" O9 w! Y0 D' z* e+ H - * modify it under the terms of the GNU General Public License as1 N( ~( A% ], K
- * published by the Free Software Foundation version 2.( s5 B/ w( {1 m) ^+ X- G! F
- *
F8 }8 n7 {/ F; F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 M: T& q5 r7 S
- * kind, whether express or implied; without even the implied warranty
6 N3 a2 T. T/ F- P$ m4 Y1 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: r# L1 \6 U# F
- * GNU General Public License for more details.
- [" }7 z M! P* g" V - */
' X6 q# a1 c5 g2 T( r3 J) m# z - ; c+ d9 N# u/ n
- #include <linux/module.h>2 i; |8 A6 f o
- #include <linux/init.h>5 S0 W; D% x" U! a, s
- #include <linux/errno.h>9 ^6 p$ ?; I) G8 q5 }' g( c: \! h% Q
- #include <linux/types.h>$ |; A! ]# q3 _( D( S
- #include <linux/interrupt.h>
- f7 z. `4 Z \5 ?: C$ p - #include <asm/io.h> ]1 W* n# T! h+ t
- #include <linux/moduleparam.h>( [# ~9 {( @) j4 [
- #include <linux/sysctl.h>
6 ?& ^& F {3 G - #include <linux/mm.h>5 q, X( r' |6 B/ c
- #include <linux/dma-mapping.h>
4 y1 i) R- V1 s/ r, F' ]3 v8 d
3 l; I7 `6 r9 Y. R; B- #include <mach/memory.h>2 C1 F& |2 J/ W) |% j; A+ C1 `
- #include <mach/hardware.h>
' }% M# `$ U/ q& Z - #include <mach/irqs.h>
0 P7 ]$ s$ o* e) Z5 }* y - #include <asm/hardware/edma.h>2 k; }+ i" o" f" o5 s, g
- $ |, @1 K; X7 d' M2 t( g+ r* s
- #undef EDMA3_DEBUG
% o) O$ B7 g! i6 ^4 c" ~( `: b! r - /*#define EDMA3_DEBUG*/7 F8 o0 y: p" y1 c4 q0 ~% S3 ^
- & {1 `: t8 ], o `. _" n
- #ifdef EDMA3_DEBUG2 j& B4 y# {3 a' V4 B% o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) y+ s# ~7 `1 `9 d9 D& c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 ]/ @# Y2 ^8 K4 M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% N6 i/ D: e% {- X2 I7 T% G
- #else% D2 p0 d" V" i( l' l
- #define DMA_PRINTK( x... )2 Q8 h I* W7 [9 l1 r% K
- #define DMA_FN_IN
4 t: R; b, j& E- Q+ w - #define DMA_FN_OUT( L: s/ X' c/ d v3 u8 C! U
- #endif d7 B3 I( j' j1 D) R0 b+ x
0 k$ `' ]& b# D( d: j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 t4 E/ k( |. R
- #define STATIC_SHIFT 3, P& a C; D% f9 `, D- ]- C- K
- #define TCINTEN_SHIFT 20
9 h$ q6 G. K0 \' H - #define ITCINTEN_SHIFT 21
, y. X: V( s$ L6 m4 x. `! z - #define TCCHEN_SHIFT 22( n& u3 o$ u$ Y" ]
- #define ITCCHEN_SHIFT 23
3 j" L/ a! \. l) o3 Y2 Z! i
& r( R0 p" w. n3 ?4 C5 \5 D- static volatile int irqraised1 = 0;
) }; d3 i2 y0 u7 E# O - static volatile int irqraised2 = 0;
+ w h; C3 c5 S7 q' [; m - 0 c. m# C/ w/ D7 P- M$ Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; x2 _6 }& \4 F8 h0 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& o4 ?3 U2 J' l, H( l5 s; `* g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 v+ ~1 {8 o) S0 j: A
- ?, W! F9 f/ V4 J- dma_addr_t dmaphyssrc1 = 0;/ Q! `% S5 v! O' _
- dma_addr_t dmaphyssrc2 = 0;$ `+ f- i( N+ m7 C) G j
- dma_addr_t dmaphysdest1 = 0;
% u. G8 A& Y0 S& A. @$ \- M - dma_addr_t dmaphysdest2 = 0;& {9 ?0 S' @ x% k' ^5 U7 p/ E9 Z
& @5 m F2 t; d# k% e1 N- char *dmabufsrc1 = NULL;7 ?! a2 Z( I% U% `5 R5 N# [
- char *dmabufsrc2 = NULL;, r$ w3 ^8 g0 A3 ^
- char *dmabufdest1 = NULL;
2 x- l( R/ ]) Y2 w# Z$ i- f# B - char *dmabufdest2 = NULL;& f- |( L2 \/ j
- ; _9 @# h& u5 R
- static int acnt = 512;
7 L& b; R: r4 q; n) ]. H% r - static int bcnt = 8;) @& k: Z& \6 R+ h
- static int ccnt = 8;& u0 R3 D3 ?8 m( g: h: H
- 8 y4 U5 F5 O0 n$ G: f+ D+ s6 r
- module_param(acnt, int, S_IRUGO);
; {7 {2 T4 c9 z - module_param(bcnt, int, S_IRUGO); P% w1 l- v6 S( C$ X& _7 S9 z
- module_param(ccnt, int, S_IRUGO);
复制代码 p2 i/ Z! q/ X9 {
) F* F" \$ g/ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ~' [; [+ h. U8 i* k, }- Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; S# m9 t1 V9 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( J P1 A) L/ n7 y8 z/ B' F
9 P; U, o& [/ I& E; @8 r
2 F6 f' A! v" T4 ~! b. M
|
|