|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ?, u2 \4 [1 T& [# e3 P; [! g3 T- [code]EDMA sample test application7 d4 F& O: A V
- /*6 `8 z8 ~. w' J5 D# h, R# b% k+ c2 f
- * edma_test.c
" c/ K" z; N# v6 Q/ A* Q - *0 h0 r5 i! V0 Q
- * brief EDMA3 Test Application6 a; g3 M0 k# Z$ l6 d8 E
- *
7 H* Z3 K" E& @ - * This file contains EDMA3 Test code.
0 E0 a+ x# Q# v - *) t* h% y: v2 A o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* k9 U1 q/ G- M4 u, b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 r n, f' Y7 i, e, u, D8 F
- * TO CHANGE.
7 L5 ?# o/ j9 i6 z& I9 @ - *' y, y1 o, \4 k0 p# X9 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# O! O$ G2 X i$ g& ]
- *3 f+ d5 Q# l* ]1 s& ]; F, b3 Q
- * This program is free software; you can redistribute it and/or2 b2 s, C( O0 d
- * modify it under the terms of the GNU General Public License as
5 V! Q6 A V9 T! W; |2 x - * published by the Free Software Foundation version 2.1 ?" q U. z2 ^" s6 e4 H! E
- *& f& s) T, G: W+ K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. q8 y3 s# t) r! j) E6 D; [
- * kind, whether express or implied; without even the implied warranty, t& K3 a7 Q/ p& `' D4 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, R$ s. j m) F2 y5 G - * GNU General Public License for more details.
9 t$ u( g5 F0 @6 x - */
: [9 V: M$ v% O5 L2 i4 Q6 m V: x, c
& O2 }9 h! f. C- #include <linux/module.h>
- M+ y2 M# y$ t1 D# w - #include <linux/init.h>
4 W& m( x8 F; o8 z9 R+ M - #include <linux/errno.h>
% l! h! p: Z% E - #include <linux/types.h>. L2 ]) n; q- w
- #include <linux/interrupt.h>
0 u7 Y! t( X+ j: e# K3 _) v5 y - #include <asm/io.h>6 [- N3 c# H3 [& b7 ]+ f
- #include <linux/moduleparam.h>8 I: _2 u1 T6 t# K4 v
- #include <linux/sysctl.h>0 h6 g1 y- y, U# M
- #include <linux/mm.h>
. y2 N$ S1 D7 Q2 L: I+ U - #include <linux/dma-mapping.h>2 n# v: J! T5 Z9 U
! Q& c5 s% }% V- ?$ |- #include <mach/memory.h>. z4 L. x4 a0 p$ j" ~2 }; _2 L
- #include <mach/hardware.h>
, x: @/ W! N" ~8 J. K" X: E - #include <mach/irqs.h>+ m# S9 T* k) F1 y7 v$ l& F
- #include <asm/hardware/edma.h>
7 X" X) K5 t, _4 _6 `
/ M" H& E! A) Z9 Y: D- #undef EDMA3_DEBUG' L2 o% J* N! O3 R! e. X7 z5 f5 |
- /*#define EDMA3_DEBUG*/( | Q7 M! a- I6 ?9 j* E2 c
- r& N, A( P- x% F8 F7 R& v- D
- #ifdef EDMA3_DEBUG
, p9 ?& a- c* X' K2 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" t9 K" o$ H; k# }/ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). j4 O* G( `5 Y" F% m1 ~& Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 n: s ^6 ^( W; }" }* g- t. r - #else$ e1 Z! z4 Q% R$ S
- #define DMA_PRINTK( x... )$ @8 d* P- n7 s8 k; O, P
- #define DMA_FN_IN" E# g) k- [. M' ? S
- #define DMA_FN_OUT
9 S) z# E* |5 l! a - #endif* I: [4 Y( b) | l/ ^5 x% |% G, W9 o
- 2 H" r* A3 l2 S; s+ o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' q) s' ^, U: B9 u; v
- #define STATIC_SHIFT 3% A% j5 V; z! N0 n+ n2 E
- #define TCINTEN_SHIFT 207 w0 I/ Z" A( U4 E% ?3 A. f" b+ E
- #define ITCINTEN_SHIFT 21 U* Z T7 @5 ?2 F, P
- #define TCCHEN_SHIFT 22
" S, T7 C# u& x. H, n8 l! Q, r - #define ITCCHEN_SHIFT 23
) ~- w5 n o% l2 `! P; d - " V, Z# m3 w+ s
- static volatile int irqraised1 = 0;
0 J1 \: j3 P0 o W, l - static volatile int irqraised2 = 0;+ W/ c1 L: F% a$ o# h! q
- 8 O$ x6 h% v* X3 U1 b$ c- l C* O; ?$ x* D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z& W9 z4 [ M7 m1 p; G% t/ Y1 @2 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 i7 P* e" g* W5 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V$ |5 O- h o' T' r' r+ P% \; Q5 |
% g& a6 j" U# H6 n- dma_addr_t dmaphyssrc1 = 0;
! \- @! N) K" {, L2 m - dma_addr_t dmaphyssrc2 = 0;) h+ P2 O4 N& T
- dma_addr_t dmaphysdest1 = 0;
8 D* T1 b( A# B8 S& f - dma_addr_t dmaphysdest2 = 0;
8 O1 g# M! M* B& G8 y3 [6 i7 i! f - 8 c" X# p9 G: I* K6 d0 m r$ k0 c
- char *dmabufsrc1 = NULL;3 O# U, N* \' s
- char *dmabufsrc2 = NULL;
3 F1 S1 S) Y& x' [. S& P( e Q4 B - char *dmabufdest1 = NULL;& }8 \8 y, i/ S, c" R) t
- char *dmabufdest2 = NULL;1 v) q! G3 a8 Q+ A
- : e+ @! c5 C1 o, b" p+ r$ z* d
- static int acnt = 512;
& t& I) o: N* R6 e2 z* x) V" a3 r - static int bcnt = 8; K4 X7 L: ]1 `
- static int ccnt = 8;
5 \1 a$ A/ {8 [1 T
: z$ g! T- I1 C0 K- module_param(acnt, int, S_IRUGO);9 X% t/ ]/ U9 K% d
- module_param(bcnt, int, S_IRUGO);
, P: L# x/ c5 T0 G# u: z - module_param(ccnt, int, S_IRUGO);
复制代码 0 g2 u, Y+ U% ~% w- t
( Z- N( r7 X) [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Y0 _2 x8 H+ }$ y" }arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 E! V5 K3 m9 f+ z9 t* {" _, I. s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }9 B" c; G( p# a; ?3 X- B! e
0 c6 g7 a# x' J- W& I& [
+ Z X1 Z6 }/ c4 O& b9 c9 R |
|