|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' J- {. g. k# a2 \/ u, V- [code]EDMA sample test application
$ {7 A. D% T9 I( E* i - /*
9 H# _: P8 B. O2 E5 A4 o; A, p - * edma_test.c4 \0 y$ y. m% d$ |" `) u3 c
- *
0 C. Y1 }3 K0 `" p# E - * brief EDMA3 Test Application
' }% F9 X9 \9 F- M' p/ ` - *6 R% d2 b1 Y3 F4 x# u
- * This file contains EDMA3 Test code.
. P! }5 i' e0 c$ V - *
9 |7 k9 X$ D2 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) T& F8 L8 J; Y( P1 S% [' z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" l8 K9 M, f. j - * TO CHANGE.
2 f/ [$ ?8 g# S* B - *
4 F6 ~" e( A7 x. g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- L, U5 l8 e) }) D - *
: y$ N% R* z) f9 I9 E$ S - * This program is free software; you can redistribute it and/or
5 I8 M7 ` Q' g( M$ } - * modify it under the terms of the GNU General Public License as
: D/ g& L, C# I' B `9 \. e - * published by the Free Software Foundation version 2.4 g$ ]& B8 k/ I& }: D0 i
- *
9 k6 ?! g$ w0 P( z/ N$ u, h9 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! g: V1 @5 j: ?) k* E9 i - * kind, whether express or implied; without even the implied warranty
1 M2 k' M2 f. Z9 h+ c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 c; h1 _+ U- Z9 _; ]5 @9 y. |
- * GNU General Public License for more details.
: L* W# w: i) Z! m# K2 k3 R - */
( V0 m8 |7 u& V0 M3 c2 V - 6 F0 e. H( g: S C0 Q" l* P
- #include <linux/module.h>0 F' d7 I( w1 O8 {# K$ |9 S
- #include <linux/init.h>
" z7 N9 y( a$ X2 ^7 w - #include <linux/errno.h>
) V: g! c+ S, y& T% X! O - #include <linux/types.h>1 Y' `# `0 p: _
- #include <linux/interrupt.h>) u' \: r# I# D+ E# ]( \
- #include <asm/io.h>- g6 ?9 P2 S% H2 z( T; i2 o1 Y+ O
- #include <linux/moduleparam.h>! f% ^4 g, m& d) f! q! N& t% ~1 Y0 ?
- #include <linux/sysctl.h>
* U; `0 B7 z' T8 _ - #include <linux/mm.h> j; B$ T% @+ ~ Z& I9 J. \, l. [
- #include <linux/dma-mapping.h>$ s% B1 C2 l7 o. }
- + N' B- i1 J: U/ Q! I, M9 ?9 j
- #include <mach/memory.h>8 ^5 p' B4 v Y/ J0 u* S* v( Y
- #include <mach/hardware.h>
# E$ n: T( g, f' |- [' R1 M3 Q - #include <mach/irqs.h>7 U E1 Y! E8 c" o7 b
- #include <asm/hardware/edma.h>
* f* \& R* d4 A& K- R/ y/ m7 f
6 m1 H2 {/ i$ k% q0 K- #undef EDMA3_DEBUG& F; B- N0 y7 l) z, A
- /*#define EDMA3_DEBUG*/
- t/ w9 N0 u$ H' e- s - , ?3 ^6 n: f( h
- #ifdef EDMA3_DEBUG
( _* ~2 }- f; ]& u3 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" Y* @5 s% z" t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ J' H/ U8 l6 ^' `0 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 p! k- G, r8 z* H4 H: M$ T - #else! S( m- j5 c/ Y& E A
- #define DMA_PRINTK( x... )& {- F* ~/ _. R. _
- #define DMA_FN_IN* g$ K0 C: a. X# W3 x
- #define DMA_FN_OUT1 f6 N" u' x' D& | b
- #endif
. s5 s" E0 v* c1 t; N: G; V
( ^+ K+ C/ Y( M& Z! {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ u$ O Q: K) K. ]6 ` - #define STATIC_SHIFT 3
; _# ~/ Q- z1 B- L5 d+ v/ z2 _4 m - #define TCINTEN_SHIFT 20& O4 j o' d# U* A5 D2 ?! h
- #define ITCINTEN_SHIFT 21, \9 p$ V% L/ l: {0 e/ E
- #define TCCHEN_SHIFT 22
1 v4 z- W0 Z) W - #define ITCCHEN_SHIFT 237 h( n0 I: r0 ~# Y5 _3 N+ S9 ]
- # Z" F4 A9 V, b- q( A, J
- static volatile int irqraised1 = 0;) _. y0 A; R& r. U# H
- static volatile int irqraised2 = 0;
& j3 ]7 |% G- g% o - 2 ?; W6 R, `% v8 `+ }1 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Y c2 ~4 f4 N0 P4 @/ F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ p k: u) o# C0 V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c, {. |# [/ `; w; k9 h
- ( d1 q% q6 ?' m8 I, p
- dma_addr_t dmaphyssrc1 = 0;
, |! |# @+ A! s' a) q6 V - dma_addr_t dmaphyssrc2 = 0;8 o% A6 m9 Y! u$ ?' O9 U
- dma_addr_t dmaphysdest1 = 0;
2 ~3 w2 f4 b" i) {3 j7 z* G - dma_addr_t dmaphysdest2 = 0;7 c$ T5 V; O' i/ r! U
- & t0 D) i* a" f% O
- char *dmabufsrc1 = NULL;
/ E' t5 L/ F3 U3 c' @& H6 s$ s - char *dmabufsrc2 = NULL;- O0 L) D$ A G( m
- char *dmabufdest1 = NULL;& v: E2 p& l, [
- char *dmabufdest2 = NULL;! C3 m5 H5 L! q/ z
' F, v2 ~; z% b- static int acnt = 512;
! k. A: |& [ A5 _( O C - static int bcnt = 8;
0 H, U( E# Y7 O+ g - static int ccnt = 8;
& F5 E" B1 B' [3 h) r3 M' A6 H - # B& M" o* b( {: o1 u( E$ g5 A
- module_param(acnt, int, S_IRUGO);$ u4 d8 o8 o& m) a5 z/ G9 r! x* H
- module_param(bcnt, int, S_IRUGO);
* J( n- F$ g" a% @) m - module_param(ccnt, int, S_IRUGO);
复制代码 7 O3 C" V( p2 k$ ^
0 `9 o3 c: p5 `; w" r! i- @' w% r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: b( J" d* s) Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ?$ T# T0 `3 W7 r+ }2 K% s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 J- k9 ^3 A* b2 k5 I
1 ~4 g$ w% U; E" ^- ]% S
: X/ u# x% N5 \% o! D |
|