|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
S+ Q/ K( J8 q1 o# ^- [code]EDMA sample test application' T4 D0 Z& L4 m
- /*$ H% R% F! u8 o
- * edma_test.c
- E1 L. q! t q - *
- f( a- P+ e ?, r - * brief EDMA3 Test Application
! l' P7 Z+ v& Z1 W4 ^ - *1 w7 Z9 y9 d% V, ]
- * This file contains EDMA3 Test code.- `& G0 Z& [5 W: O
- *4 K2 M' O+ T/ i1 L1 U/ a5 i* g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, {; L$ x; t$ v* T# y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 M' E2 I# [5 n8 v8 }# \
- * TO CHANGE.
1 j: e8 J! j+ u0 F" Q - * E$ Y6 S8 n' |$ _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ R# E+ [5 ^& u! p5 b
- *8 l" B. K- v2 T
- * This program is free software; you can redistribute it and/or
$ M) f% _4 }9 i - * modify it under the terms of the GNU General Public License as* i' k6 w, b4 h- t( {# x
- * published by the Free Software Foundation version 2.
- g- r- }3 H; U c. M) i - *
d" Y9 S x0 m$ p8 h, a+ | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% [' m8 X4 Z- W0 j5 n - * kind, whether express or implied; without even the implied warranty. P4 h+ l3 [! Q6 P9 k+ ~& P8 m! v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! W, z" H5 ?/ R: R$ l% O - * GNU General Public License for more details.
" E4 R9 \+ p( z0 k: X - */( h- E# J6 L. g' p' {
( b! a3 n- v& O" q2 l- #include <linux/module.h>* Q9 v1 O1 O! _ |. I3 G, V! D
- #include <linux/init.h>* t' O+ t* c+ f, N' W4 x5 q2 ?
- #include <linux/errno.h>% ?/ _) i- `1 A2 a J& u
- #include <linux/types.h>
6 P3 U5 D5 p2 ~) {9 p - #include <linux/interrupt.h>
. q7 ^, Z+ N Z V1 v7 J9 K( T - #include <asm/io.h>& o$ m/ X4 g' }) b1 }
- #include <linux/moduleparam.h>& ?5 e a9 E5 {: C
- #include <linux/sysctl.h>/ e" e3 S) Q) N+ S
- #include <linux/mm.h>
" v5 n* T) B0 g# a. K6 X - #include <linux/dma-mapping.h>& b. J! i2 F+ ?: _; K' U5 W
" o P' n$ x/ v' D8 l3 q$ n- #include <mach/memory.h>; \: J! Y3 A4 B& h5 x
- #include <mach/hardware.h>
& E+ S( g! Y+ z) e$ g9 f; S& t - #include <mach/irqs.h>
: W6 L: q2 P9 `* l. |5 H - #include <asm/hardware/edma.h>" C6 D, U4 N) q3 M/ K. ~
$ M' ~ ~7 G6 ?" v# r- F# @- #undef EDMA3_DEBUG+ ]( C- D8 M/ ?
- /*#define EDMA3_DEBUG*/7 R4 @) F+ K1 w) M t) b
- d( D& `' C. K0 e
- #ifdef EDMA3_DEBUG4 a) C* D& p( u6 S7 b+ V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" M: A! e. x; [& z1 a- F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 m! m+ e$ q& | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 |3 p. l( _7 Y& T0 O6 O
- #else0 u' @6 \- B& t E( G0 ~4 ~$ W
- #define DMA_PRINTK( x... )
6 B7 H1 _# j9 F# Z# i - #define DMA_FN_IN
" b5 U; E+ B8 b* x; m& s) e* d - #define DMA_FN_OUT% Z6 |/ A3 h6 {! f# Q0 |; ^5 K* G+ c
- #endif
+ S) {' O3 t+ ^/ k& A - - s- p% M. M2 Q' Y! L3 D v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( K7 Z6 R, m" e& O - #define STATIC_SHIFT 39 Z6 i8 u% z/ G# p4 ^. \' V5 @
- #define TCINTEN_SHIFT 207 I! O. p3 ?- x5 E( \$ }
- #define ITCINTEN_SHIFT 21
/ }- v- C3 A' w1 {$ P - #define TCCHEN_SHIFT 22
6 X1 a+ m3 N. z3 a+ r6 C - #define ITCCHEN_SHIFT 23; `/ U' F4 H. O1 o5 P3 u
) [& U9 S, i5 h. b# h- static volatile int irqraised1 = 0;) ~3 Q1 Y6 ^ ^* s5 O3 L
- static volatile int irqraised2 = 0;
+ F1 P% n* z0 \7 j# r M
% ]0 O9 J B" L9 @; n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' [/ Z& U K) y2 Q: }; H) q8 a# e! m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- p6 j4 N' t3 ]( v. U) x6 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
K* i! A* R' N/ o8 p( o# O - 5 k5 C- |, ?4 t5 g7 Z
- dma_addr_t dmaphyssrc1 = 0;# Z8 _& T$ W1 m# {) }
- dma_addr_t dmaphyssrc2 = 0;
0 E- w3 E1 m) B9 T; F - dma_addr_t dmaphysdest1 = 0;7 S1 h6 v& W+ a
- dma_addr_t dmaphysdest2 = 0;
4 O3 T |- a. F - ) D; [4 V, h* m& M
- char *dmabufsrc1 = NULL;
3 }2 Z. U# P) [, k - char *dmabufsrc2 = NULL;- j* O- M; P3 C4 w- x
- char *dmabufdest1 = NULL; z& A1 j6 \ ^8 ]
- char *dmabufdest2 = NULL;
4 s5 d8 o* k9 ^9 }9 {8 U% A Q. M7 z - ; |- ~2 b$ g1 D& m( w/ O% Y" G
- static int acnt = 512;
" @, C$ S- E+ |, U - static int bcnt = 8;7 s8 M6 _4 M$ k5 j, x
- static int ccnt = 8;
1 P% D' q3 R. W/ I - 1 G: T- E- g- R7 i+ s4 _
- module_param(acnt, int, S_IRUGO);7 S. m$ [8 O% m w/ P K5 x
- module_param(bcnt, int, S_IRUGO);+ P6 V- a0 V' e# s7 R7 o% k- ?
- module_param(ccnt, int, S_IRUGO);
复制代码 8 Q& \ [" U+ e& p! ?) U, P
9 g4 ]2 E3 [" G0 o- C" N; e6 R, J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: X* F: _; s0 u2 T. Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 J# L* O& |* ]1 ^$ \9 O3 m8 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s9 I2 s, y' d- [% j; |
* U% |& w* z" f& F- S
2 i0 n) d+ g$ n) o |
|