|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( I, a5 ?$ H: c. s0 j2 f( X
- [code]EDMA sample test application& a) A" V0 x& s% t6 U1 t6 q% n3 C
- /*& s5 Y7 C3 f4 v' _% f
- * edma_test.c4 S0 s; o$ x+ |
- *- E) o6 H/ O4 i! Q1 p
- * brief EDMA3 Test Application5 E! k* k; p% q% S* f( b
- *6 ?+ U" \. w1 Q9 }! ^) E3 t
- * This file contains EDMA3 Test code.
( a { C# E6 j; I - *
3 ^2 P# {. y& R8 Q9 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' S3 A$ ?: h( M1 i0 S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ A7 @& v5 L6 P# N7 W6 F: A$ G0 q6 Q2 ] - * TO CHANGE.) [) G, F& [2 C8 B' `
- *
0 y& @5 O z& [: Q& d2 |; R: j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) T6 Z3 `" u; |& X& j" V- O& x
- *
9 ?9 ~( c7 M# m/ G: t - * This program is free software; you can redistribute it and/or3 [% q# F! f% u8 ~7 H. h
- * modify it under the terms of the GNU General Public License as R7 m3 H6 ?# a6 ^: a
- * published by the Free Software Foundation version 2.
& a' }) i) k+ ~3 ]$ T, } - *
5 Q, n$ |9 @) r; E; n- S. \/ e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 B6 |3 T& {9 i/ q
- * kind, whether express or implied; without even the implied warranty
$ O( z8 |& D& i) K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 ]; @! C3 j# {/ I% I
- * GNU General Public License for more details.
Y$ w8 e/ D. V9 a, U: p - */" u9 F6 Q& J& t: E3 i3 O
% H2 ]! r% H0 _) u4 I. G9 l- #include <linux/module.h>7 O' K) p B' c- I) R1 u
- #include <linux/init.h>
- r/ \% d# n7 o - #include <linux/errno.h>
2 r% ?- ]* D* i/ \ - #include <linux/types.h>
- F: p: y& A/ K5 L - #include <linux/interrupt.h>
( K& C8 e$ t6 Y" V1 v: q8 ]+ T; v+ | - #include <asm/io.h>3 V( r' } n: ?6 W, ?
- #include <linux/moduleparam.h>7 V5 w2 n! c- k3 ^9 R
- #include <linux/sysctl.h>3 Y6 `$ `) e! q" G: o! C {( w
- #include <linux/mm.h>4 D D* ^! \& K% A; ] V7 c4 q4 w
- #include <linux/dma-mapping.h>
6 a/ h$ j2 N/ i
. C' @7 J) B! {3 x- #include <mach/memory.h>
) B# `2 d) J Y+ `" A. U - #include <mach/hardware.h>0 l3 J0 X! w) b8 f$ r C' \' y$ Q
- #include <mach/irqs.h>- n; T n) m9 P- O, }
- #include <asm/hardware/edma.h>7 C1 m# D5 ?, P" u8 D
- H2 E# L% W4 V' z, }) w0 r) B
- #undef EDMA3_DEBUG
% O* [) T- \; }. r5 x9 n+ N - /*#define EDMA3_DEBUG*/
4 R- t: V* Z* R8 b6 ] - # I7 H% i+ H" A1 b
- #ifdef EDMA3_DEBUG; G! E0 x& S* H$ r) e9 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) X' R$ R# H" e& D7 n1 n7 S- [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. Z* u4 Q1 l( ]9 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); q) D9 ?0 e9 J x* Y
- #else
5 o) x7 D% _* I4 K' m5 D - #define DMA_PRINTK( x... ); A; T5 l/ {& R
- #define DMA_FN_IN8 s( p- m& `3 F+ X- O! H2 }% F
- #define DMA_FN_OUT
" | a9 d) N" }7 H& Z- v( e - #endif
+ X7 P. }* d m& ^: L0 F$ L5 u* a4 P/ t - $ s( s! A! m E& z4 R3 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' p& s6 {( \" J9 H- G; z* W - #define STATIC_SHIFT 3 e3 d$ b9 `) e! `
- #define TCINTEN_SHIFT 20+ X5 k0 I3 Y7 Z) X4 K( L* S
- #define ITCINTEN_SHIFT 21
/ L2 N1 {3 B4 p% u0 i - #define TCCHEN_SHIFT 22
) a" A. W K I4 ]& P7 Z7 _ - #define ITCCHEN_SHIFT 23* V8 v3 _; P4 {7 @2 l
- 7 ^- Q7 y- o7 D3 u: K( b
- static volatile int irqraised1 = 0;* H/ Y9 b' l5 w" P% ~: |
- static volatile int irqraised2 = 0;4 M' I B# X% N& r* }
- 0 t' @) D! M( j0 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 R3 O q0 w7 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~, I4 S$ E% N1 ]- ~8 ^3 r. r' m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z# E: Z! e( O% `3 |$ C
( u2 b, s( R0 g& L: b" R$ K- dma_addr_t dmaphyssrc1 = 0;0 }. M+ [' |1 D) f4 m1 Q) ]
- dma_addr_t dmaphyssrc2 = 0;
, p$ ]' r9 W: x) q# U$ ~ - dma_addr_t dmaphysdest1 = 0;
0 {" f" u. ^; s& f1 Y- m" P - dma_addr_t dmaphysdest2 = 0;3 `! l- T* `6 Q5 L! G
1 w: b; c+ G1 o% l7 U$ ^- char *dmabufsrc1 = NULL;) W& H _& p$ P5 L4 e k" U
- char *dmabufsrc2 = NULL;
% j# w2 V. e0 c - char *dmabufdest1 = NULL;4 \9 \4 j5 |* Y" p' V; h
- char *dmabufdest2 = NULL;' T& x- ]! {/ K
- / M2 Z* s- i$ q! z
- static int acnt = 512;. s+ O' _0 r8 f
- static int bcnt = 8;, |! X2 e! X/ U e$ |; D
- static int ccnt = 8;& l/ g& X4 ]$ v3 H
- # c7 D0 l. g- T! x" H+ \ Y
- module_param(acnt, int, S_IRUGO);8 H( p* c9 F6 j/ E
- module_param(bcnt, int, S_IRUGO);1 ^8 P7 e0 c# s- ~9 h4 q0 E
- module_param(ccnt, int, S_IRUGO);
复制代码
1 K1 w7 w* V' f) V( ?8 k; @, y5 J+ X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 [, f$ g5 Z4 [) U5 W) Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]$ t& g" ]1 x$ a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 [% l( g5 M: v9 I
+ w' i5 z: }8 Y' A: i) E8 f2 Y, `* W/ s" s: H
|
|