|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! m( G+ @. T% k# S9 r. V( x; ` |- [code]EDMA sample test application1 K5 R+ @6 S3 C- F% b
- /*# k2 x3 U- y4 ?3 a: A" I
- * edma_test.c
) c, _; r$ O9 L4 x: g* J: G - *. N' ?& O" E( J& c- [/ s
- * brief EDMA3 Test Application
) x1 b5 b8 z! \' C( m5 M" h - *
3 [. g+ ]- G$ N! @ Z - * This file contains EDMA3 Test code.+ D x) D4 Q* H! U3 Z& c
- *( k v% E" i0 M: K: p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* }( @' S& Y1 S/ V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ q: h9 r( H: K& f+ p( i
- * TO CHANGE.( {- ^8 `, A9 I9 ^+ d% o6 j
- *
: ?+ a. Y2 G$ V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- U: P1 L( G9 R3 d; U p
- *
1 D$ Q+ G8 u* U( d - * This program is free software; you can redistribute it and/or# E( g. ?8 M# }2 }4 ` L
- * modify it under the terms of the GNU General Public License as
' B' |5 |5 l0 \$ m( l. B" F, q. ] - * published by the Free Software Foundation version 2.
0 P) u& N& U9 d( M3 s - *
, T* H9 ?" z. {$ C: f/ c3 ?' j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' N% G$ N% f/ V7 Q% j/ z - * kind, whether express or implied; without even the implied warranty
% |: A# m( H% V! [1 U! g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( a- x( x( { X( B - * GNU General Public License for more details.
* b% F+ T1 ?9 Z: ?1 w& | - */4 Y0 p$ D$ m4 ?, e. x( F) V
, b7 r Y# b& G! G- }& E- #include <linux/module.h>
1 Z* f6 D# p& h% k- s1 S# b4 q - #include <linux/init.h>
1 u; A, n& \6 y: j, l - #include <linux/errno.h>) Q3 Z. T$ d6 l8 s# o* i
- #include <linux/types.h>. k) V; ^0 Z* a+ X3 d; a
- #include <linux/interrupt.h>; c4 c, `$ k8 t9 c$ w! n$ o
- #include <asm/io.h>7 M' P- J1 A. P, ?' Q; }
- #include <linux/moduleparam.h>) q7 Y6 B" `; q% d! R$ U" Q8 S
- #include <linux/sysctl.h>3 X3 e9 {% S- t" j3 O
- #include <linux/mm.h>7 B9 [; j$ e9 }& s8 U
- #include <linux/dma-mapping.h>: \# ]% ]+ H& \( R1 a F" ?
! {1 M, A. k' X4 N; g- q$ R- #include <mach/memory.h>* i6 {) x# P0 d/ Y* I7 K
- #include <mach/hardware.h>
% K S k4 G9 r( y. P0 E - #include <mach/irqs.h>) \; y. [% J7 P% G; u4 @
- #include <asm/hardware/edma.h>' O! R+ o9 @( X% H. \
) p% I+ Y2 P9 j* i' G% {- #undef EDMA3_DEBUG0 j/ i& _7 ~: r8 z; n: L' p8 l
- /*#define EDMA3_DEBUG*/
7 o& B8 E9 T# X/ [
) x" J7 _5 Z$ i, K' _9 `- #ifdef EDMA3_DEBUG
$ M7 @& j' \+ c! w2 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- I) `* x' U- {4 ~8 j$ H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ H1 I x0 I# r6 B, X8 P# \, f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) x6 v3 r; G9 L
- #else7 b. y v" t- H6 e; i& v8 [
- #define DMA_PRINTK( x... )6 [+ H# e* J/ t; I G: z; I( G
- #define DMA_FN_IN @+ |* _. \1 ]: H# Y
- #define DMA_FN_OUT( e$ c- s! F+ X+ r+ S0 g; a* H A/ a
- #endif0 ^# \$ A" q9 M: P: N9 E
& V# m5 Y4 B6 p! j- #define MAX_DMA_TRANSFER_IN_BYTES (32768), l D9 D0 C" k
- #define STATIC_SHIFT 3# E) s W& U& d8 }
- #define TCINTEN_SHIFT 20+ p& ]# x9 H0 s% O
- #define ITCINTEN_SHIFT 21
6 B& s6 c8 q& y Z5 l - #define TCCHEN_SHIFT 22$ R3 _* y1 Y3 z p$ r
- #define ITCCHEN_SHIFT 234 ^: F4 P) j+ I/ V$ x
- ) y( d3 i2 C1 F0 P
- static volatile int irqraised1 = 0;. Z/ N3 ^$ T" f$ g+ B
- static volatile int irqraised2 = 0;# c; |: g, E( l- }
4 X! M( U" I. v+ I9 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, w1 R& o) L6 P0 z8 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {/ Z7 y3 l1 v% {& U# }1 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, F$ e" u1 a; m" f
A8 G h" r1 I$ u# S- dma_addr_t dmaphyssrc1 = 0;
9 a$ ]8 o" g9 Z, z$ ~$ k2 D$ Q0 O0 e - dma_addr_t dmaphyssrc2 = 0;5 u j3 [' o1 d$ o0 n |" b
- dma_addr_t dmaphysdest1 = 0;# G+ ^) C0 t0 w9 t
- dma_addr_t dmaphysdest2 = 0;$ g" {% ]# Z2 j$ J$ L, T1 b
) ]7 y2 e1 C7 R- char *dmabufsrc1 = NULL;
! _0 Q2 `5 z- b, y; F9 @ - char *dmabufsrc2 = NULL;
+ g, o* y& W0 G3 ?% I$ L! m - char *dmabufdest1 = NULL; X: j+ h: b8 L y: a2 g
- char *dmabufdest2 = NULL;
6 q6 I9 [! o! O; r6 X
! r6 q" C2 k6 i8 `0 i/ P- static int acnt = 512;
- ?/ D: P+ z6 X% K* H% D I% s: N2 }9 u - static int bcnt = 8;
& m; I! b3 n( | - static int ccnt = 8;
0 _- n( @7 F1 r8 m: K9 V( E
" G& p: J5 i1 ?+ s- module_param(acnt, int, S_IRUGO);
4 e) a5 U, ]+ n9 C' m5 v - module_param(bcnt, int, S_IRUGO);2 j) C4 \3 g/ l) g4 L( N8 \
- module_param(ccnt, int, S_IRUGO);
复制代码
( Y8 W" M, l" h. {6 L
( F5 O$ S& o% z$ I8 k R+ z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* v) m! `2 L! ]. r1 z* N5 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ H. Y4 ?3 |, K/ D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m6 F; x D# |4 o8 \$ y# z2 ^& J+ R G& t) L& Q! v
" s5 A2 m' z' N& t5 c8 Q8 X& ~ |
|