|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: X& I, {. A8 M1 Q" ]! f, j x- [code]EDMA sample test application
% A' i& F9 X. W% j! V% } - /*
! B% H/ `" [3 g" ~; I1 v7 z - * edma_test.c- R) N' c; Z& h# q P" N0 s
- *# ~$ f- F8 Z* |* k
- * brief EDMA3 Test Application. w! p4 Y* o9 J6 m6 j& H
- * E3 H' Y1 n G0 A8 g; P+ d! n( v& [
- * This file contains EDMA3 Test code.
; j3 ~& D4 e' p$ l. A | - *
: Z0 m/ m4 M( a6 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ _& J$ Y0 X. Z4 z9 Y/ c/ N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. Y+ Z# h+ m# @1 F7 G# ` E - * TO CHANGE.
2 T. [# @9 T c, @: ~ - *
9 S0 r" z/ u0 ]' c8 X' R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 u( L2 z+ f' I# G* [& I8 o - *
4 e# Y$ z0 V: S+ P3 X0 G$ `( ]$ D - * This program is free software; you can redistribute it and/or
% C! E6 e |3 i8 k - * modify it under the terms of the GNU General Public License as
* R6 j; f4 d: \, A2 D, a - * published by the Free Software Foundation version 2.2 X* j6 j0 e% n; n* l
- *
/ A7 |( {+ n% g; R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ Y1 ^! J/ X% e* O& E - * kind, whether express or implied; without even the implied warranty
v3 }* w- D, V) g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 l( P0 g0 i% B$ @% X* ^' C - * GNU General Public License for more details.
4 W4 G+ L8 h; ~# Y% k - */7 {$ i! O4 }4 i+ t% J; V% I, ]/ d1 _
i& k$ D, J2 J3 ]" G' M- #include <linux/module.h>0 c/ x0 T7 `5 S- E! b
- #include <linux/init.h>5 E8 S$ u/ e& n h( B4 ]
- #include <linux/errno.h>
2 F5 h9 R$ K) e0 w - #include <linux/types.h>* ?3 f, o: d4 z2 W B- Z
- #include <linux/interrupt.h>
j* A3 s4 Y8 [6 o/ T - #include <asm/io.h>
' g! R! J: Y+ Y8 y' b* Y1 f& _ - #include <linux/moduleparam.h>1 f" _ ~9 B& X! o# t: V3 Y4 O
- #include <linux/sysctl.h>$ Y# f4 y" \: x" G$ R, _' x \
- #include <linux/mm.h>
9 Y p; Q. y& \$ L - #include <linux/dma-mapping.h>7 f' \. \4 x0 u- w0 D3 W m
5 g& ^' B0 b% J3 i$ z1 f' ~& A& h8 _& Q- #include <mach/memory.h>
9 C; k1 C, y* p - #include <mach/hardware.h>8 E+ L: Y0 z* |
- #include <mach/irqs.h>, q _ Q- V6 v) k, S7 I
- #include <asm/hardware/edma.h>
; q; v* ?, k6 D. R- G/ P b! |' z# d
( G6 O+ L2 C+ ]: M* m4 i0 J7 M- #undef EDMA3_DEBUG# Y6 {: h4 _3 \1 F7 S3 Z2 x
- /*#define EDMA3_DEBUG*/3 `$ D! h1 U; B' B4 V8 f
- 2 }1 p3 L% V. c7 j# S% e
- #ifdef EDMA3_DEBUG" A$ I4 { H D+ p! Y' L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" t* c1 y9 S& R Y! ^3 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. ^0 s+ z, r) ^1 v. w8 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): N+ e* h# A/ j1 O: P
- #else5 u) R5 l5 ?+ R* n4 s
- #define DMA_PRINTK( x... )1 o7 e: X) N& _4 _4 |, `
- #define DMA_FN_IN* ^/ S3 `8 B+ ^: m+ l! u( O2 `" N
- #define DMA_FN_OUT1 _8 S& d$ H( v1 T
- #endif- d" m+ j5 Z( ?6 T/ f+ y
- K$ b- T1 F) ~0 p' T! o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; f. z A0 k+ c% N( D - #define STATIC_SHIFT 3
4 g% R6 [' O1 y+ }% ] - #define TCINTEN_SHIFT 20
# Z2 G; Q! ~2 o" o - #define ITCINTEN_SHIFT 21
. p, B0 w! [0 d. F+ `* a - #define TCCHEN_SHIFT 22) u! O* Z. ?) G) \
- #define ITCCHEN_SHIFT 23/ ?0 L3 p, }1 ]3 B
% ^0 [& X8 K: p7 }; N6 E- static volatile int irqraised1 = 0;
) i5 i. N1 A |$ Q; }. X) [ - static volatile int irqraised2 = 0;9 O$ W: f$ H3 c( o8 c2 O X- v
- p. B( g. |9 f' H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ A1 e5 W5 @1 `' X( p, f" b ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ~5 ?/ e3 f; O0 e6 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, k% A$ Z8 K6 |9 N! W1 m
! s+ U: T- A6 U6 Q2 y- dma_addr_t dmaphyssrc1 = 0;
: z' u1 d( r/ X) k3 t" s/ w5 f - dma_addr_t dmaphyssrc2 = 0;
6 G& ?: S' o1 R6 D! m6 f - dma_addr_t dmaphysdest1 = 0;
( R2 g* Z6 Y/ W - dma_addr_t dmaphysdest2 = 0;
0 n7 o& f" x/ {
4 L1 {- }& F5 l4 a- char *dmabufsrc1 = NULL;
& f9 W8 q2 s9 ~7 G. V- ?0 ^) ?6 \- _ - char *dmabufsrc2 = NULL;
3 S0 l; W% O" d" N. n- K - char *dmabufdest1 = NULL;7 E7 X9 m$ Q1 G9 V* t0 i; _) v% R2 k
- char *dmabufdest2 = NULL;2 l& J7 Q$ S) t' c8 }
- 9 t( m7 H+ s5 K* f( F8 D
- static int acnt = 512;
( q6 r" Z4 e* M3 U3 y/ ?+ b' v - static int bcnt = 8;. g9 ~9 Z6 p- M" F, |
- static int ccnt = 8;+ ~% @/ P! O5 a1 P3 V
: t4 N3 Q& X K- module_param(acnt, int, S_IRUGO);( I0 j; c9 l1 c9 h( T4 P* C
- module_param(bcnt, int, S_IRUGO);* G4 P/ B$ g8 O H
- module_param(ccnt, int, S_IRUGO);
复制代码 $ P; [) a9 l7 W7 V
8 x6 ` i) k1 z: t8 g& G. F$ D2 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J! b( G. A& C3 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; N1 z4 I) |. d* D* G* ~1 g& _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ B. G1 K8 C. t/ V: ?
0 ~( }# `) g9 h. K
& J7 f8 Y3 [/ E# j2 G& p |
|