|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - c; r! v% v2 n: L5 d
- [code]EDMA sample test application: `9 l4 x2 h& E6 N s
- /** z& s4 H) m3 W+ {* N
- * edma_test.c
5 w! |8 v! V* @7 i - *
+ B- s1 s. @3 v& W) h7 `/ Y* q - * brief EDMA3 Test Application7 A& \6 E& g9 `- q/ |
- *
% {/ q: N5 d. u, X - * This file contains EDMA3 Test code.- j: {+ p5 o& {. M
- *
# y- R" D* _) w; f& a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% P3 z+ R+ f) X0 E4 [8 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 {6 ^ g6 ?* |
- * TO CHANGE., l0 O8 b1 r& y* |- _; y
- *
% ~6 N) l, t" d1 P( q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 R$ c- h1 p+ N9 ^
- *
( e8 X+ m7 M. Q1 e, f1 { - * This program is free software; you can redistribute it and/or
! r' ]2 E$ ~$ v; S7 A: M# k) A - * modify it under the terms of the GNU General Public License as) {* P% e3 }4 _' A
- * published by the Free Software Foundation version 2.) A/ Q2 T/ u# U5 o5 P: T
- *0 u) h/ s$ q) u7 I5 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 z* _% d. T p - * kind, whether express or implied; without even the implied warranty
, i* n9 |& e4 [8 H% `. }! }* P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) J7 ~& h1 S$ | - * GNU General Public License for more details.
8 V: Z% o, O( F1 T0 ] - */
4 d1 o) o. M: r! u6 ^, ~
6 W2 }6 Q/ O2 K- #include <linux/module.h>
9 x) h: ]7 B; z# [" y1 R - #include <linux/init.h>$ y1 X, j6 ? s& p3 t f. D
- #include <linux/errno.h>
/ m$ C3 E* G! g% Q( B- h6 f: [ - #include <linux/types.h>- ~0 E* I4 U! `9 G
- #include <linux/interrupt.h>
( q0 U( V2 s7 @$ A7 a - #include <asm/io.h>4 `( @3 `$ J$ |! T& Z
- #include <linux/moduleparam.h>
; X5 e8 T4 k6 m - #include <linux/sysctl.h>
+ J; L' X/ Q1 V" L+ ^5 k - #include <linux/mm.h>8 h" ^& A4 Y: E7 o! _' v
- #include <linux/dma-mapping.h>
" {; M& c2 H4 x3 E - ! a7 N n/ G- M, Z
- #include <mach/memory.h>8 T3 Z# T! V7 t1 q9 ~
- #include <mach/hardware.h>4 M: _5 ^$ W) y
- #include <mach/irqs.h>% ]3 R# P1 t# O8 E8 ~% I8 I+ N
- #include <asm/hardware/edma.h>
/ |/ G; v% N7 t3 k0 B- h - 6 ?% C' J3 V! Q3 v
- #undef EDMA3_DEBUG7 N: O: l+ @6 N. l/ m. j0 F i
- /*#define EDMA3_DEBUG*/
4 c9 U) Q4 z5 O' h
# g2 j& s$ K, Q; j6 E1 t( p. h9 x- #ifdef EDMA3_DEBUG
1 m& s/ C( z7 B8 T$ _1 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) X1 \+ j* O. O1 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 \8 a# _* c! m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), Q" z3 ~' j5 G* |4 s3 A
- #else1 @# K+ e z* X# s2 m
- #define DMA_PRINTK( x... )
' W; {" M: m& i3 L1 M/ ?5 } - #define DMA_FN_IN
U3 R! G& x) r$ ?! c - #define DMA_FN_OUT& \" K1 s0 [+ O$ l
- #endif# `1 Z+ Z3 C8 L+ t* i8 I
0 E* s. e0 K$ n4 d; e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 W3 H& M A* W- T' b
- #define STATIC_SHIFT 37 c7 w! X3 ?- p# m2 i' D
- #define TCINTEN_SHIFT 20) U; P% R! n9 m2 N# z8 E5 ]
- #define ITCINTEN_SHIFT 218 P& O9 ~! W4 ^+ y2 [+ p
- #define TCCHEN_SHIFT 22
& y. ^ n/ J, h3 Y - #define ITCCHEN_SHIFT 237 y/ s4 Q: m8 n4 P, v# F% [4 B
# ~ w0 H9 F2 u9 R! m% }8 m- static volatile int irqraised1 = 0;2 C% Q- @& n3 U& \! D+ z" W
- static volatile int irqraised2 = 0;
0 Y; K8 n, _ L1 A
. i7 J5 }0 C H* r$ L) Y, g4 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* @, d8 g6 \2 W! u4 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 S1 j6 l4 `/ `% F0 K2 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- I1 e3 D) q& ]# p! u. ~/ N! _
" _7 b7 G2 Z$ D0 w% d- dma_addr_t dmaphyssrc1 = 0;
7 w6 v A; j1 {2 D N - dma_addr_t dmaphyssrc2 = 0;
9 o0 o. K; r4 {( u - dma_addr_t dmaphysdest1 = 0;
- S3 X/ o* y* Q - dma_addr_t dmaphysdest2 = 0;
$ c2 F( y3 t- C K6 V
9 ^, S3 u' a$ U: R/ T# b! e5 M- char *dmabufsrc1 = NULL;
7 H3 |+ D( X( b9 O: Y1 \& i. y. W1 e* S8 r - char *dmabufsrc2 = NULL;
# m( b4 f" z* W! J. W - char *dmabufdest1 = NULL;
J* k* N( Q' P) ^8 S Y - char *dmabufdest2 = NULL;
% K; P% O- l: E' y - ! N- \3 A; r) ~* M5 n' ?! U6 E, D$ e
- static int acnt = 512;
2 I' [, `) z/ c, D+ L, l9 L - static int bcnt = 8;
1 l5 {2 b: P) r% z - static int ccnt = 8;
7 i- d! A/ h% z4 z6 R
s1 J; A5 d4 u# ]. N# X. L- module_param(acnt, int, S_IRUGO);8 @- E* `% [. K$ L# c; I
- module_param(bcnt, int, S_IRUGO);
- x3 ^$ ^- k9 `$ d - module_param(ccnt, int, S_IRUGO);
复制代码 % O2 }9 u" W6 W4 p U5 i* J- r0 q
/ U5 G. s2 g( Y3 c* t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^. w7 `, X; _+ \; n+ ~# J% a. Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 s& B* t, a' k& C2 y5 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ T; r) t) l4 F- s, H7 w% c
2 U, P6 C8 X y
8 ~- E3 E e$ r, ?* W) G8 d& ] |
|