|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( n6 z# N6 u8 d, F" i
- [code]EDMA sample test application
5 ]2 E) f5 E9 s' U. K - /*
. ^. j* c! V- b" W! S! t- l3 ? - * edma_test.c6 k2 k" `- Y* ~
- *. X& Y1 U M. U- R. Y! y6 a
- * brief EDMA3 Test Application. }6 U) i7 }* u1 |3 u3 i+ ?) j
- *+ r6 s- V U7 B8 o/ P% |) i3 l+ s
- * This file contains EDMA3 Test code.
/ i' X D' v. U) q1 w- S5 f6 x - *
6 J) N" Q) U" D+ z, c4 L+ a7 ?- _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' E; ?2 G4 q# B/ x2 Y" F( N, T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i' t) f& P7 Q/ v# g7 ^
- * TO CHANGE.
7 ]$ s! j7 j& g - *
, f# @% n8 h- R, c! X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. I6 [2 N0 c" ~2 w' m - *
6 i; h, ^" }$ `4 e2 m - * This program is free software; you can redistribute it and/or
* N* f. c: T3 h, g4 [ - * modify it under the terms of the GNU General Public License as* g4 R1 Z y1 _+ w, ?3 R# G/ v. T7 _
- * published by the Free Software Foundation version 2.) D) B5 N; m; O: I8 A+ p
- *" I/ W. e( \8 T) b, f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 z% m/ T h2 V: p6 K
- * kind, whether express or implied; without even the implied warranty' k6 K% T7 n8 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 U- L3 E# h0 e8 R6 g. K& L& `
- * GNU General Public License for more details.4 ]8 |1 t1 H+ t/ u8 P
- */; r$ d' i6 r7 @# y( E
- ( D5 h* S8 E; v& r
- #include <linux/module.h>
1 F8 o9 w' r. l6 ~8 h F1 M" T - #include <linux/init.h>/ O$ l, C; H: m. X! }. N
- #include <linux/errno.h>
7 O& B0 z3 j, O4 r; _( K) d+ t - #include <linux/types.h>7 w+ b" o" G0 J* E1 S
- #include <linux/interrupt.h>
0 l* }/ Q. _4 ~( b* _ - #include <asm/io.h>
+ l5 @* r0 G# Y! C+ w5 R - #include <linux/moduleparam.h>2 { W6 ^& Y+ ^. ?1 ]( D4 s
- #include <linux/sysctl.h>7 t r0 z9 W5 X0 z9 s9 k
- #include <linux/mm.h>: i- T. F2 C& d# b& m' `9 X
- #include <linux/dma-mapping.h>3 t7 |5 X, ]2 b$ D; x( U4 F
& N/ P3 D1 j& ]% K" `- y6 ?9 n& X& p- #include <mach/memory.h>
* C* a% e9 n. u4 C7 r - #include <mach/hardware.h>. ?; g8 ~) p: p5 U' h
- #include <mach/irqs.h>
# z3 i- e- r4 l, ]0 C4 s0 R - #include <asm/hardware/edma.h>. p1 ~& h" M0 Q
( v9 e3 O9 _$ l. ^- #undef EDMA3_DEBUG$ V! a! t8 G% c0 o& @
- /*#define EDMA3_DEBUG*// t6 ^; o2 z1 X- s! x/ d- D$ V
2 G. y! E: R+ E; }- #ifdef EDMA3_DEBUG
2 z, Q5 ?& e( e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
}9 B0 q( Y; {3 z9 e. W8 L3 W/ p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* P" Q* q& T# {0 n) ~. h( g: C+ l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 F: s6 F9 c0 |4 q* p+ ? - #else" l* w4 ~* V1 {8 h+ F& Q$ K5 O
- #define DMA_PRINTK( x... )' K+ |$ ?/ o: @0 p
- #define DMA_FN_IN
: ~( q, `+ v' J. l+ m - #define DMA_FN_OUT, x H) O: \' R. v- O
- #endif
: V* c5 j; y6 a" o/ }8 ]! ~
3 ~& L. b! ~- N7 [+ J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' Q% ]2 ]8 P2 N- D9 K
- #define STATIC_SHIFT 3
! |/ A: E7 }0 _+ S) B - #define TCINTEN_SHIFT 20( N/ Z) ?, M+ C5 t
- #define ITCINTEN_SHIFT 21
' y) g+ } @ g+ r* ^) k - #define TCCHEN_SHIFT 22) a. M* U% ~9 |8 N* z
- #define ITCCHEN_SHIFT 23
, t( t0 h# L2 k5 Y
. T. T" F( ~1 N# V8 P8 Q- static volatile int irqraised1 = 0;8 y1 J) ]( z8 @
- static volatile int irqraised2 = 0;
; v& L1 P9 T" D' R4 Q2 G - 6 K# c7 M* _7 w: q' Q" d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 L, Y# Y5 E1 w7 @$ ?4 g3 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U7 L6 u8 }( q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% P4 ?0 M K/ d. Y# @
8 d! r0 `3 i0 @% L/ n- dma_addr_t dmaphyssrc1 = 0;
9 F, A0 W6 H) R: w$ {: O - dma_addr_t dmaphyssrc2 = 0;
: }: B9 ^5 t( s& ^1 w - dma_addr_t dmaphysdest1 = 0;
2 ^8 [( h& d6 C# ^$ Q - dma_addr_t dmaphysdest2 = 0;: O" v- \! K% L- s
6 K0 I/ f, w: N# v0 l k& q& A, L- char *dmabufsrc1 = NULL;
) w; y4 p( n' ^* c; s - char *dmabufsrc2 = NULL;
7 F/ g' A( U% G: f' T# u- V9 f" [; \1 U - char *dmabufdest1 = NULL;6 [+ z2 f1 V3 k3 x
- char *dmabufdest2 = NULL;% A7 s; U0 ^2 d4 {5 T' P. L( v. l
- 3 z0 o% I7 I; i8 Z2 V% e: o
- static int acnt = 512;! `% A' B1 q, Q; n4 E' W; f6 S3 W
- static int bcnt = 8;! ^3 @4 G: |: d7 D3 o
- static int ccnt = 8;
6 E0 ~, @" ]' @ - ; N8 o0 ^: t( t: f" ^) }
- module_param(acnt, int, S_IRUGO);0 q% b8 \- A' K" [" b: @/ z; |: V! Z
- module_param(bcnt, int, S_IRUGO);
7 j; C( r5 g; E" X( c9 `3 {$ g* J - module_param(ccnt, int, S_IRUGO);
复制代码
9 }# H6 t" R1 }$ H2 q" \7 ?
/ U7 T, B. g4 ]' J$ z7 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* S3 Q0 z0 u/ m& H# c2 I9 p0 t8 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a$ ]# U4 Z* e9 j) S+ d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 H/ t: u4 X% o5 I
$ F7 T! v" Z- r, i4 V6 T: ~$ F5 z9 b' E
|
|