|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 p: M1 L: L* B+ [9 S- [code]EDMA sample test application3 [: H: d, i2 @- Q' r; N" E
- /*6 o9 K: D; x6 @3 t
- * edma_test.c
3 l$ Z8 T: A( z0 H/ T - *6 q9 Q% V2 q/ o7 T z
- * brief EDMA3 Test Application/ l1 Q% _) B: _; \6 S
- *
! d9 P% C2 q8 N/ e - * This file contains EDMA3 Test code.( \+ Z2 l! ~' f
- *, l1 E2 o X: k3 K6 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ I% i* x/ S9 ~ z6 A* B' s: f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 z! k. r7 m/ w: W
- * TO CHANGE.
" H9 m- L, k1 j! p - *
4 W: i3 b$ D" e) y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: H' A7 j6 N: ] y - *7 b8 E# q: w. h8 `$ [; W. Q
- * This program is free software; you can redistribute it and/or0 k [# E2 X& f' ~4 h& v
- * modify it under the terms of the GNU General Public License as9 M% d R1 Q8 b. j! a- |
- * published by the Free Software Foundation version 2.
- Q- F7 Y+ i2 G. Q) I - *1 _ I8 L8 {0 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, H% |; w' y! n# P0 a - * kind, whether express or implied; without even the implied warranty9 y2 x: Y. p# I3 c5 @) e. w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) f( U/ G+ p! e# {7 _
- * GNU General Public License for more details.
% o! W. h; A5 p O: w1 i* k) r - */
" m( |. b$ h* y8 \& y; m - 1 p' {4 t2 P4 w- V
- #include <linux/module.h>% N- {$ E1 R3 ^3 K; ~1 V6 a
- #include <linux/init.h>
1 [, z) W; j2 L/ i+ @ - #include <linux/errno.h>* O( ^4 X1 W( M/ G
- #include <linux/types.h>
6 W. U- J2 S7 M; X0 @ - #include <linux/interrupt.h>
* r& H7 ~5 p1 F7 H% Y9 B: R' x - #include <asm/io.h>' s8 x i/ c d9 a2 U
- #include <linux/moduleparam.h>
: p; }3 W" @7 M( c3 O. |/ U9 @ - #include <linux/sysctl.h>0 j" V m* ^+ I4 I
- #include <linux/mm.h>
Z3 K, j, l, Q - #include <linux/dma-mapping.h>9 O8 D$ k2 ?& {0 o( E$ [5 e
2 Q. @& L8 T/ T' \8 G- #include <mach/memory.h>
0 Y+ u. D3 b* F. p9 \ - #include <mach/hardware.h>
! \& B# u+ U/ [ ]3 Y7 E; i. }& m - #include <mach/irqs.h>
( W# |& _) R9 ^5 |3 G - #include <asm/hardware/edma.h>) B: _+ m W. [
- # b# |$ A/ V |) e) z; C
- #undef EDMA3_DEBUG6 j S* H' f; H/ ~, X
- /*#define EDMA3_DEBUG*/
8 r+ u# k! n' c# w9 @0 W) y
" j( {, `7 L. g) x+ L- #ifdef EDMA3_DEBUG
/ Y3 v1 V; a1 @' D! M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 _, @( R( V+ I1 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 Y% c3 ^: v r8 z# f! j! F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) w4 T3 t' n2 N. b
- #else
}7 D# |) R5 |. t2 I" i - #define DMA_PRINTK( x... )) G7 i+ ?% e1 F$ M% j3 |
- #define DMA_FN_IN
( i# q7 ~2 v) I% r; E - #define DMA_FN_OUT
) b+ }% Y5 \1 @3 z w - #endif
! C* `3 w( [2 U, {8 f
# T( u9 Z: A) P/ k+ s+ S# g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ A. C' W$ p/ M - #define STATIC_SHIFT 3
" b( K1 E: Z: n0 ^% E N) S - #define TCINTEN_SHIFT 20
% X2 `8 H# p+ `( h! ]' a. ^ - #define ITCINTEN_SHIFT 21
6 Y1 U2 t" L- m7 n) V8 }8 X9 x - #define TCCHEN_SHIFT 22
6 z3 E9 e+ C) c6 Q, X' T7 r - #define ITCCHEN_SHIFT 23" W: y9 O' @' g- G' n3 f
/ F; w8 B7 h; N8 h2 G0 A- static volatile int irqraised1 = 0;, w- x7 ~9 [( {) U Z+ C
- static volatile int irqraised2 = 0;% {* J4 q3 ^: x. h
- , B: o2 A4 l2 ~9 S$ j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 \. q2 T* _) Y0 _* W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J8 o) @8 x$ d: y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f+ p& b/ N* _5 o
- 8 U2 T0 E# C( X; w$ a l7 n1 Y M
- dma_addr_t dmaphyssrc1 = 0;4 o* W. @' I, }! R, y
- dma_addr_t dmaphyssrc2 = 0;/ S- ?* P# `$ B5 f1 H8 d
- dma_addr_t dmaphysdest1 = 0;
' u( t3 h) H3 s2 q) {2 \( T; I# l - dma_addr_t dmaphysdest2 = 0;7 f( w- a5 m2 Q4 H& g2 I
7 M* ?* C+ }4 X+ q* B5 k* P6 t- char *dmabufsrc1 = NULL;6 v3 L( ^7 p0 R5 ^5 a- C3 m6 b1 K/ Q
- char *dmabufsrc2 = NULL;
9 m3 b4 V. C0 U& A. d - char *dmabufdest1 = NULL;
. s) h3 @4 W( A1 k - char *dmabufdest2 = NULL;
* _' _. b9 C3 V: \; }+ T) g( z l - / q* ]. |% K. X: i5 {1 e0 n
- static int acnt = 512;" x! ]4 l! n6 t5 g5 Y
- static int bcnt = 8;" P) G8 @ t6 P( Q
- static int ccnt = 8;: F. M3 Z/ _+ C, W2 p
- & W' q- U' \! `& i, s
- module_param(acnt, int, S_IRUGO);. j* Z4 e6 j4 P+ {4 m
- module_param(bcnt, int, S_IRUGO);
) d7 q) _# s4 p/ g4 [+ o% h" j- T - module_param(ccnt, int, S_IRUGO);
复制代码
. s4 F& x* m' E! m) N4 O% t$ |0 @9 E/ J+ E$ n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Q k$ L$ n, s$ e9 g. S; z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 f8 E. d2 l3 D1 w7 J* X9 M# d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; \: W9 e- n* @7 L
8 F; E) F& m& d: D; G2 }% D) i& E; [: t8 g9 C# q
|
|