|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 E1 o# X, C9 H A! a! d- [code]EDMA sample test application& V; |8 _) D" e0 G- G; j
- /*
* M& K J9 V; Q$ N: f" E* h - * edma_test.c
3 g( W+ R" s+ U) b - *; M# k, n' D# ^
- * brief EDMA3 Test Application
" l* k* ] i9 ~' D6 ` - *
6 ^7 q { w: v" g7 A* F9 k - * This file contains EDMA3 Test code.
5 F. ?0 G. F' D5 H5 K% w9 | - *5 X9 r9 {2 h6 F7 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; d d8 H9 }5 g1 }" U5 x V# k4 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 t" p! z" t. {! g; `, @
- * TO CHANGE./ A/ i B$ H, b" o7 ^% D
- *! G+ c/ ?! q$ e' Q+ K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 I% A9 U u+ z: K* v7 g0 Q' C, l - *1 q3 Z: r% l; [0 R" u: G. }4 `
- * This program is free software; you can redistribute it and/or- ?- g. a- S# k. E1 r/ F( x& M
- * modify it under the terms of the GNU General Public License as
6 O. K y- b; ~7 V6 k, [ - * published by the Free Software Foundation version 2.% G; ^# X C$ f" A5 a+ D% O
- *) v# b$ V ^7 p+ ? ^7 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" X) s% |9 e* ~# `7 i& t4 i3 J - * kind, whether express or implied; without even the implied warranty
" @+ e3 T9 H: o) T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 z* D4 j7 `/ g0 \" L `
- * GNU General Public License for more details.
; t1 X6 o' P. r - */+ Q% d- H% i& H6 C' E1 b% x6 h
- 1 l0 j3 Z6 F( Q/ X: @7 k
- #include <linux/module.h>; x0 `. U$ b/ d7 w! [1 q
- #include <linux/init.h>
9 D& F+ B8 t6 ^& a4 H' S. } - #include <linux/errno.h>
; g: l* m% e" }! H+ O - #include <linux/types.h>
% v( s/ c, D# Z. l - #include <linux/interrupt.h>
8 q9 e( g) H# t+ S# Q7 B7 t - #include <asm/io.h>
% n y5 N. G6 M' P - #include <linux/moduleparam.h> }/ ?0 F5 m" |% c) t. ^
- #include <linux/sysctl.h>
; H# c+ V. H& d$ Y* C - #include <linux/mm.h>3 C5 H0 B* }$ Q% a$ H3 m' Q3 \9 w
- #include <linux/dma-mapping.h>, F, P) g4 t. d* a3 n8 k* Z4 G
+ ~# N; x) n2 W' b k- #include <mach/memory.h>+ p$ \" \0 M6 C, S
- #include <mach/hardware.h>9 t6 K: u+ [7 ]& w1 p. I0 F4 B* ]
- #include <mach/irqs.h>
7 r! ~$ y% {8 Q3 P9 Z# s7 c. k* Z - #include <asm/hardware/edma.h>* D0 |" R6 |) a8 s. d2 q, Q
; q, f$ ~! |6 L) l7 r# @- #undef EDMA3_DEBUG" ]1 T5 j# U4 e" {2 y- e3 W
- /*#define EDMA3_DEBUG*/
3 U' V0 S5 a7 u( z4 d3 J$ ? - $ G+ S8 H: Q) l* V+ E$ ?
- #ifdef EDMA3_DEBUG
! r/ }. n8 }1 s% c+ j) ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( \7 | @5 Q# P4 W; y; S1 ~# w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
C+ r0 t* ^' c' P8 N( I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 Y7 w8 b2 Y. }: b - #else q) b& J& a7 }! E
- #define DMA_PRINTK( x... )& v4 }0 Q/ ~1 K- R: l' m S5 W
- #define DMA_FN_IN$ p: @" h! q% }0 C3 b
- #define DMA_FN_OUT
9 y# {/ t' J/ y! ^! I - #endif
8 V( Q$ B/ ~% a/ N! ? - $ N* }( u* a" ?# Z- _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 C) b" ?0 b1 F, Z& q3 P - #define STATIC_SHIFT 3
, U4 R4 z% A7 d$ f( t - #define TCINTEN_SHIFT 206 k9 \5 T( q$ O1 E% Y0 x
- #define ITCINTEN_SHIFT 21
" R F. l' s, X: A3 j - #define TCCHEN_SHIFT 22
+ L( A- n# m t9 l4 b: E2 W7 W - #define ITCCHEN_SHIFT 23
( `9 p: G; d2 y) R1 G - - V, O5 o W9 f/ g2 e$ M1 X
- static volatile int irqraised1 = 0;
1 `% x- j1 j9 P9 X - static volatile int irqraised2 = 0;
! [+ u6 q$ h1 H. a
: v8 w2 R! }. p; E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* r8 `8 {3 T6 e6 y% W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T* S' [. p+ N e3 d# Z) L; g& |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X+ J- b/ ^, y3 H- W
( T' u8 p: m5 j- dma_addr_t dmaphyssrc1 = 0;+ {2 ~( d( L1 h7 V9 k0 [
- dma_addr_t dmaphyssrc2 = 0;9 b' q7 u* f; g5 c9 h3 L; @
- dma_addr_t dmaphysdest1 = 0;
: p3 }( L# G3 y- U/ z - dma_addr_t dmaphysdest2 = 0;
2 S3 C+ c+ t } - ) S! f; ]5 {, `3 J" H& f
- char *dmabufsrc1 = NULL;' i8 b- z$ v; y3 Q1 V) a& \& @* t
- char *dmabufsrc2 = NULL;
! x2 j: Z Y6 A8 s/ R& i - char *dmabufdest1 = NULL;+ x$ S7 ~1 V, e1 A W
- char *dmabufdest2 = NULL;2 V& a; E5 r/ H% ~0 F7 `! b! ]
- , a9 T! r! T$ b( q4 k/ n, j" ^
- static int acnt = 512;
# x% P) R3 }' K& c5 X - static int bcnt = 8;
) u# W. a/ D; F$ P$ X - static int ccnt = 8;
' K# n( f0 Q) m. _7 d
+ ~/ Q0 ? G; B P7 V- module_param(acnt, int, S_IRUGO);
# u5 d5 b- c3 H) C0 T0 ^0 X# o# x2 y - module_param(bcnt, int, S_IRUGO);! @2 U; ?8 C: @; q# [$ N% p# E
- module_param(ccnt, int, S_IRUGO);
复制代码
1 }) m( r& f3 l1 `. A$ M6 l: o; U4 \4 t' C8 n, B- }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ g* y) V4 Q. s& Q! Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- p( n1 C2 j' N: N( o; K; [$ K) Y I5 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ c2 i1 W- n, \& P# t+ W. \: v" }$ ~, p$ ~2 `: V7 X Q
6 K y! ~' l4 X7 F |
|