|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# u9 R5 x& ~ z- [code]EDMA sample test application; ]) e1 x" A# `& o) ^
- /*8 u& y& e V7 U; I
- * edma_test.c4 m! M0 p2 |; x8 r5 W
- *2 ]& @& h" a( q
- * brief EDMA3 Test Application1 e) J! L1 u" ?2 T8 |
- *2 U& y; N# G0 E. J( J4 b, {
- * This file contains EDMA3 Test code." T% Z3 _" I2 C- y% u
- *# U) l0 r/ {; E8 Q, h; b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE l) U2 |! c. o9 B- n" Y0 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. u- d& t* }9 q6 m; y0 y* O - * TO CHANGE., F" O. i) D0 `( R8 Z) h
- *
: b1 E9 r( b2 L, V; f1 c4 w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ~* U4 Q8 ]9 t; M
- *% C( b- d! Q" w" \0 r/ L- m
- * This program is free software; you can redistribute it and/or, v' {3 d' A) s% i3 N* c+ C( w
- * modify it under the terms of the GNU General Public License as* U2 s+ [% D" w' i5 B0 j& o8 }" o
- * published by the Free Software Foundation version 2.
" n+ D. k' P. S4 O; Z9 I - *
2 A* e g( s- U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& G$ u: r7 n7 J9 C* b
- * kind, whether express or implied; without even the implied warranty
6 e6 Y( X2 o- W$ R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: s3 T; n: Z% r1 ^- z6 A, x
- * GNU General Public License for more details.0 @, O% i) J% D6 y" [7 u
- */8 M6 w& K5 _* \% h
0 w; C! [8 z5 K' l+ y+ F- #include <linux/module.h>
4 q! ]% Q( n) J, m: F - #include <linux/init.h>! E, R ]& h0 a: G& _/ N$ `6 _
- #include <linux/errno.h>. b( o2 u/ a/ H& }! c" y& I2 q8 ?: J
- #include <linux/types.h>
7 v8 d0 W: v8 F$ y* Z: }' t8 ? - #include <linux/interrupt.h>. F/ f# b( i) f1 ~0 p
- #include <asm/io.h>
- Q3 d1 }9 x3 o% v9 j) Z' D - #include <linux/moduleparam.h>8 U. A) v) T" n9 A
- #include <linux/sysctl.h>
$ D* i# E" d1 g4 e" G# A - #include <linux/mm.h>
# ` C! t" r3 ~2 g% f - #include <linux/dma-mapping.h>& j8 f! [% X) _
& h U. `0 I: n% Q- #include <mach/memory.h>
2 R; u. y, S2 Y3 { - #include <mach/hardware.h>' n- X1 I! {8 D* I; k8 @. ^, D: Q
- #include <mach/irqs.h>
; [( r' `' q: Y" P' i( ^$ E# E - #include <asm/hardware/edma.h>$ a- n- t2 F, O
- p0 W' M/ w$ p- #undef EDMA3_DEBUG
7 E' R) ^$ g4 ?- x - /*#define EDMA3_DEBUG*/
$ ?' [0 T: X1 H' P
, }1 x* S7 z6 {9 y- #ifdef EDMA3_DEBUG
. ~8 g% u5 D+ x7 w. o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( o+ |' b; `. C) W; W: ~$ K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ?* a" g; f" j9 d. I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
x9 X" h# e+ j' u - #else" c5 }$ d( c9 W/ m0 o. @7 p
- #define DMA_PRINTK( x... )
3 [0 Y6 \( f" U2 n' s& B - #define DMA_FN_IN
1 {4 q& O0 l1 P# A1 p - #define DMA_FN_OUT0 f: d, R; s* R& I' p
- #endif4 ?; \' e4 i0 L$ q5 u6 s u
- ) `, e( }5 ?3 C: s$ A7 y( x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); A6 X: E7 Q1 U! U2 Y$ B
- #define STATIC_SHIFT 37 S, s) W! I+ U5 |1 v: e9 s2 Q$ Q
- #define TCINTEN_SHIFT 20
$ M! M, @; h Q; t9 \ [ - #define ITCINTEN_SHIFT 21
/ ^# ^4 e" ]3 q1 \( k; J X, P8 } - #define TCCHEN_SHIFT 22
. k; j$ i7 @% e2 z - #define ITCCHEN_SHIFT 238 ^0 E# N0 h4 a4 {
- 6 e G- ?! I, r& F1 v- c1 q
- static volatile int irqraised1 = 0;( h8 B5 X1 W+ U3 Q1 L1 I
- static volatile int irqraised2 = 0;% E. I$ H) k J
- " U6 e2 d" f0 u" q& W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h8 ?, u2 Z6 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' o; d: e1 B0 D7 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" [- |4 Z' E) q$ {8 V
' @) m& @+ u& o, x+ H- dma_addr_t dmaphyssrc1 = 0;
: X* ^0 O& \+ Z8 X0 _ - dma_addr_t dmaphyssrc2 = 0;1 A8 h* k2 A8 b! |
- dma_addr_t dmaphysdest1 = 0;
7 u9 D; x3 L3 U0 L& J- R - dma_addr_t dmaphysdest2 = 0;
M6 ~+ N( ^3 P8 h. f4 _; W7 @ - 8 s. f7 W: j5 P. ]5 ~
- char *dmabufsrc1 = NULL;. [7 t! Y9 h2 O( d9 }6 p! [! j) _ R" }
- char *dmabufsrc2 = NULL;0 ~2 n/ v7 f+ n! |4 F
- char *dmabufdest1 = NULL;
! r/ J U1 d! x7 f8 D+ \ - char *dmabufdest2 = NULL; h- T: x8 U. V) f _& O
- * \8 U$ R# p5 X7 Y) Q
- static int acnt = 512;
# I9 k- l& u/ `0 K8 a - static int bcnt = 8;
% I% Z2 \ f+ A7 m h7 b) [7 w - static int ccnt = 8;' C9 [1 C8 U' {' ?6 Q
0 q, t0 f( D# j* B- module_param(acnt, int, S_IRUGO);
" e# ?6 @$ N) g T& N) ]' m - module_param(bcnt, int, S_IRUGO);
! ?! u h% i. l, C - module_param(ccnt, int, S_IRUGO);
复制代码
% l9 x& }' H% K+ I" H: F" L7 v4 Y
0 g# I4 F1 p9 ]3 a8 M% g+ y' { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 w8 U5 l& w: ^# J# [: v* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' q9 f7 a# |- }7 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- T0 U0 _; s6 d7 e) g, X6 q
5 T9 ]1 B2 j0 J6 k# \3 x+ ^7 [0 d+ u& w- V
|
|