|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# s+ G$ v2 b# H- [code]EDMA sample test application
4 h# M5 K% D4 ^/ P: d - /*5 z( h3 Z( a9 N" S7 y, M- K
- * edma_test.c
+ ^9 |3 \: f. S - *1 G; C; T4 v( ?' r% l1 o$ Q( `
- * brief EDMA3 Test Application
1 x" H( |3 E) l' s3 E - *" _2 E: F, ~$ j$ N( r) |
- * This file contains EDMA3 Test code.% Y" s* ]4 X# j1 ^6 L. |; H+ m
- *
( ^7 N. ?+ M4 ]* }8 D2 }7 O) H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 t" P) C' {* ]0 k% B8 C( q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 D' N3 b# z7 u( q
- * TO CHANGE.
+ K) u) I0 o- J, {) Q - *9 i7 z0 ?& i8 v" c. ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 {& D& H% H1 \/ J
- *; i4 h- s6 @4 q/ L9 ^
- * This program is free software; you can redistribute it and/or
( { F% n/ w/ d; L3 d5 ^, z- k1 R8 T2 ] - * modify it under the terms of the GNU General Public License as
3 b; g* q! H' ^+ B - * published by the Free Software Foundation version 2.! p! ~ b$ l, H: P& r! R
- *' Y/ M% ^2 Z9 I6 c# b8 `) ]0 N! \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ?" Z, ?- x7 f( O2 x( _/ G/ O9 u! y
- * kind, whether express or implied; without even the implied warranty
1 [7 b. ^# l& D. F- H, d- @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- B2 B, @) ~% @! D% G - * GNU General Public License for more details.
6 l3 x3 u* c; I+ K2 h - */) V; E% S, C. k7 Y1 L# h# Z# a
- ( S8 N/ w9 X, j# c6 l
- #include <linux/module.h>
1 q1 {# V4 C7 ]/ x4 E - #include <linux/init.h>
5 E- y1 r( B3 N9 x% t9 _ - #include <linux/errno.h>3 l) J6 k0 p5 s1 B: D: C
- #include <linux/types.h>1 R5 `& F7 `0 u* w; T' R
- #include <linux/interrupt.h>; H# P' ]3 f5 Z5 F. `
- #include <asm/io.h>' s1 @3 f2 q! m; ]) V: V: f
- #include <linux/moduleparam.h>& ]$ K; M2 A) t W. v" {5 J# p
- #include <linux/sysctl.h>
* p2 \8 I' y `7 Y - #include <linux/mm.h>" r0 I. p3 j& ~% f$ y
- #include <linux/dma-mapping.h>/ C* ^ j1 }/ E2 E$ g
! m7 ~8 O4 P i8 ?- #include <mach/memory.h>/ ~; _) h# q0 Q6 J) Z9 A- ?% U
- #include <mach/hardware.h> s2 D/ C& _8 q; r# o1 h) B
- #include <mach/irqs.h>
8 r- S% K' G. R4 l - #include <asm/hardware/edma.h>+ c L" s! R. O) t7 D7 }$ x/ Q
5 }& f7 ? H9 ?- |- r# ~ B. ^- #undef EDMA3_DEBUG0 Q6 m2 u. `; ^7 D
- /*#define EDMA3_DEBUG*/& p: E( U' c/ V
9 b5 R# o; \1 }- #ifdef EDMA3_DEBUG& Y4 J. x- R6 A- ^6 A0 ?" Y! U( C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" k$ o. l: o$ I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 `% b" ~. H; d; \$ w, }" ?* g$ a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): q6 k3 Z( z/ z; F% N
- #else8 h! Q% ?: D$ v o- a
- #define DMA_PRINTK( x... )
/ G" u: `- N6 ~ - #define DMA_FN_IN
1 }9 P* Z4 M, O; j, e3 G: e7 ~ - #define DMA_FN_OUT
) l+ O8 l" B, u" `4 y5 ^( D - #endif
8 G$ W& T. [+ { - 4 j+ w3 s( @0 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' ~! A9 ~; o3 C" w/ a( \* t# j
- #define STATIC_SHIFT 3
0 k" l. W/ S; A: p& @5 D3 @* c; \ - #define TCINTEN_SHIFT 20
: L7 d( v. g4 t! B - #define ITCINTEN_SHIFT 21
) e7 e4 z h; F$ j% b9 I# {4 L - #define TCCHEN_SHIFT 22
( ?) v" E+ n- [5 `% e5 Y5 p - #define ITCCHEN_SHIFT 235 Q0 ?6 g, n6 {0 Q3 u
2 H; p o! u% R/ A% U- static volatile int irqraised1 = 0;" c7 T. A: a& E, h
- static volatile int irqraised2 = 0;
8 h2 O5 p- ?1 e5 v' i4 o7 W - 0 W- B7 Q u! K2 a( J1 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 B& G4 | d! O4 U, z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" w% t; z* R: F- k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ?4 K8 P2 K) z1 o) Y
: I- O$ U# R, M. P- dma_addr_t dmaphyssrc1 = 0;
3 u/ M: A' Z/ f! J% z! X - dma_addr_t dmaphyssrc2 = 0;
- \! F- Y& U, | - dma_addr_t dmaphysdest1 = 0;
1 ?% _, X v. y: V% z' ~ - dma_addr_t dmaphysdest2 = 0;$ f6 w9 N: h( v/ I
- : ?9 O% l; }' R
- char *dmabufsrc1 = NULL;
% b$ f% w, m# E& y - char *dmabufsrc2 = NULL;! G2 x# H6 p% }. m6 y
- char *dmabufdest1 = NULL;
4 U& e' q. A6 @ - char *dmabufdest2 = NULL;
; T" k$ _' Q& N2 {3 P0 R+ D - {& C5 ^7 u* i/ {7 G; t, T% z
- static int acnt = 512;$ E! V* e0 D W% E
- static int bcnt = 8;
5 M' j; v" p5 P' L - static int ccnt = 8;3 S7 L6 _7 G9 x2 @7 j4 ^, b4 ?
- ' m$ Z- {% F% s) m! ~# }
- module_param(acnt, int, S_IRUGO);. W% @8 U1 o# N# m+ X2 V( ^. B
- module_param(bcnt, int, S_IRUGO);
$ i, h; C# Q& n0 e1 A: N - module_param(ccnt, int, S_IRUGO);
复制代码
9 r( [/ g4 ]3 W" G: E% }1 G
+ z9 k1 D7 ~) d7 a: \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ o! A% F* S8 W9 W. W- c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' U0 W) i; H) J7 m+ U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 U6 [9 c2 T+ `! }0 B5 g* ^7 b$ U! P; k+ `7 C3 I' T
+ m) b% k5 [7 `- N( n
|
|