|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 R( C2 B8 F. j+ c; u3 I2 L* I' W
- [code]EDMA sample test application3 j$ P9 C3 u$ G2 d9 J
- /*' Y9 h D) _: M
- * edma_test.c
" x* `* s2 `+ b6 N1 q0 M - *
* `+ k4 v, w5 D' q9 [$ o - * brief EDMA3 Test Application
) L3 g6 j* y: E - *8 R* {2 _* r! o6 S4 Y9 w, A
- * This file contains EDMA3 Test code./ o* w, X4 @2 n
- *. [- r: K5 F+ T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, b: K& k% N* G5 n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" I; d* R* y) M* j& l1 k - * TO CHANGE.
6 L# F7 [9 L; ]! ?: y, r - *! a3 x/ P, y. d0 M! h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~& g: b1 ~% f8 q0 [
- *
2 j8 \ n0 b8 |! h% j - * This program is free software; you can redistribute it and/or: `8 X% t! P3 F# @1 t$ N
- * modify it under the terms of the GNU General Public License as7 |, A% S2 o9 i# u c+ j! H" R
- * published by the Free Software Foundation version 2.
2 C( r$ J0 \' B9 }8 E9 a - */ m$ V* X) l% k0 h4 b8 @ Z/ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
`/ Q$ B' O3 X$ g5 P) c! n - * kind, whether express or implied; without even the implied warranty
3 T4 ^$ s$ P# ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 n: F- u. r" q& }; K& N
- * GNU General Public License for more details.4 m/ R4 M1 s7 _) ]6 f
- */: G6 }1 x- x! S' E7 u! t
- ^7 o5 E' @9 t$ g* }9 A1 L& J) g9 e- #include <linux/module.h>
; ]. g6 U4 T! a0 ?6 c6 I - #include <linux/init.h>2 W. u+ v: ^+ J1 m
- #include <linux/errno.h>% P; X7 N4 _6 `. E
- #include <linux/types.h>
9 d2 H: V; d& X. U - #include <linux/interrupt.h>
# y+ [' D9 B2 G, Q f! o* y, g7 \ - #include <asm/io.h>
7 A; d9 W, i; d# P+ X2 ~( V - #include <linux/moduleparam.h>
# Y; q3 t& z0 l& C8 O2 _. l - #include <linux/sysctl.h>& ~ y' I: |( _$ d
- #include <linux/mm.h>
# ?6 Q. E' @; e. S' W - #include <linux/dma-mapping.h>
! j6 U- h/ N: F8 o
. R4 A [6 _% n8 h8 h U. R$ [- #include <mach/memory.h>6 L0 u5 w5 k/ F6 M% H, ]) w( o( C
- #include <mach/hardware.h>
8 w8 x, w# x' Z, w0 S9 d - #include <mach/irqs.h>9 u( t) H6 H0 W2 F; H
- #include <asm/hardware/edma.h>
& j4 v; c% `8 L# T# B {2 e
% |3 b5 q* k' {- #undef EDMA3_DEBUG+ S( z) {; B& k0 z% d R- @: A
- /*#define EDMA3_DEBUG*/$ W1 H. ]3 l+ l( j
7 q$ B E+ Z+ i! d4 c, }- #ifdef EDMA3_DEBUG% t$ [# h" r. d% F7 G' \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 W" M& a( y( t4 V9 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), l, O" [' t, Z5 W. m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; G1 O1 e* y$ e9 X0 b& G - #else1 B- z; ~5 m$ p
- #define DMA_PRINTK( x... )
" t- ^ I5 L* s* c - #define DMA_FN_IN" _2 q' l0 ?4 c
- #define DMA_FN_OUT
, f0 M" J- j7 ` - #endif
3 g1 o1 D2 l4 E! J) n4 B - 8 K# r! B0 `) B7 D: h4 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 I$ O' I- Q( A
- #define STATIC_SHIFT 3
1 ^- d l4 n. U( i9 v - #define TCINTEN_SHIFT 20. ?9 Z! z9 K; o0 _- f
- #define ITCINTEN_SHIFT 21
i& @( b. e! W9 Z - #define TCCHEN_SHIFT 22
% l5 A& R& T* J - #define ITCCHEN_SHIFT 23
( W0 i+ d5 c/ l! h - " a1 k4 {8 d5 y. Y! b
- static volatile int irqraised1 = 0;8 b2 n- f7 m) Q# O; }
- static volatile int irqraised2 = 0;3 m$ ]2 C/ y( K$ h
- / C' O+ D0 k9 ~8 p# s# T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 H0 c) F G& ]. i+ I6 Z: G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 \! j5 ]2 t* f& ~' R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 W% f. u; O$ C* ]1 n7 M! C6 [: V - / q7 Y$ L. e; i% h! g. X
- dma_addr_t dmaphyssrc1 = 0;
2 w6 m8 W! ]5 k$ t' d0 Q' o3 K - dma_addr_t dmaphyssrc2 = 0;4 R+ G* G5 V3 g; P
- dma_addr_t dmaphysdest1 = 0;
- o7 y( P" v7 k n0 F - dma_addr_t dmaphysdest2 = 0;
k+ H" `, Q6 W
! s6 U$ s# a& \/ U8 l3 ^6 e# g! G- char *dmabufsrc1 = NULL;
( V# `3 E8 @0 W$ f. W - char *dmabufsrc2 = NULL;; X+ Y. k* O0 P3 L7 g- b2 Q
- char *dmabufdest1 = NULL;
3 l" Y8 i9 q. q( T1 y2 T - char *dmabufdest2 = NULL;8 ]; d: Y0 f0 w6 W9 o6 s
- * `4 H4 z- m; t3 F* \! L
- static int acnt = 512;
I7 o0 x0 F& ^) o* e8 P9 X" A' |6 Y - static int bcnt = 8;+ R M6 T D, G! q
- static int ccnt = 8;
% n8 {! u% [- f" G( c - ( |* n$ q6 f$ G0 M( x) H
- module_param(acnt, int, S_IRUGO);0 S- H: m3 @; n2 h, X
- module_param(bcnt, int, S_IRUGO);$ h4 p0 U7 p0 l0 Q i: U
- module_param(ccnt, int, S_IRUGO);
复制代码
, X% f- O, i W" L K" _7 I
# |$ x: _7 R' i. ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* d. G4 J2 ]& x2 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! m5 v+ o6 g, {9 M7 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 \3 G4 b* R! I# `
4 Y2 M' j# b9 J' i* x1 Z0 a% _( M5 L$ z- _
|
|