|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 h- v% D& R) c* y6 [% d- [code]EDMA sample test application& N7 X% f7 N: G
- /* J# n: ?5 n, O9 I! z( @
- * edma_test.c
2 v% U8 X- m- A. J4 d* P8 N- R' X - *: g; k6 ~+ o. o' Y% U# U
- * brief EDMA3 Test Application$ [8 s: C- k1 F6 C( H3 L
- *
1 W/ X$ E& ]- Z7 L - * This file contains EDMA3 Test code.7 Q3 W6 N5 F/ n9 h1 p+ X
- *" ^! t% }9 m; R' H! A3 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 k# h1 [, ^% U/ u( x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: t8 I( V' Z& l" Y/ ]. G# f' O. N
- * TO CHANGE.1 t' t1 d; I3 t$ h
- *
! C6 [/ Y4 M- Q) A3 u, A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ]8 Z) W7 g5 Z4 A! L S6 G" p
- *
. ]1 Q7 p* O5 p. W. p; d - * This program is free software; you can redistribute it and/or
1 [) R/ S* K( E2 S; z+ X - * modify it under the terms of the GNU General Public License as
. U. K- F: A8 _8 H8 K" C - * published by the Free Software Foundation version 2.
, g% o7 P, j$ i$ U& m - *
5 d4 D5 b& X3 A' o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* I" d7 i( J- d( M8 @: D
- * kind, whether express or implied; without even the implied warranty0 u6 j1 {2 p0 W7 F4 f7 x! e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 L F- G6 j9 m9 ^( k6 p) { - * GNU General Public License for more details.. c( H% [4 I& v$ Y: A; w! W( _
- */4 V) A( p m, _3 Y
- ' J* D; W* f5 b& [
- #include <linux/module.h>
! i, Z$ a. u* i3 \! x - #include <linux/init.h>
7 @0 i5 Q* [5 ~ Q" U } - #include <linux/errno.h>7 N4 A8 X8 ]+ Y. m9 \
- #include <linux/types.h>. E( x7 O8 w" i8 i- N* ]
- #include <linux/interrupt.h>1 w- c% X! K. X. E
- #include <asm/io.h>
' S1 ?& ^* p; q" y' w2 h6 {& [0 c) F - #include <linux/moduleparam.h> W3 \- Y0 o( j3 m7 H4 O
- #include <linux/sysctl.h>
6 e& {- l1 N5 E - #include <linux/mm.h>( [, c; B; m) r A
- #include <linux/dma-mapping.h>
0 m+ ~" U" B+ f
, w5 b% E+ }. |$ J7 f, h6 w- #include <mach/memory.h>! R5 s, }: Z( D6 q c, L
- #include <mach/hardware.h>
: U( i6 r S T& Q U' h2 O6 Z - #include <mach/irqs.h>. l( m% R4 X% M7 s/ e
- #include <asm/hardware/edma.h>
/ Q" x+ M$ E) O
$ W3 ?6 r) m- [. v. U. Y2 r1 E- #undef EDMA3_DEBUG
( I6 {1 V6 l6 X I - /*#define EDMA3_DEBUG*/
! ?2 r0 z7 v# ~! b; Q& g- A - , j g& R1 r* M( n H6 q
- #ifdef EDMA3_DEBUG
% E/ |/ |4 Z+ Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) k! i0 b7 S: V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% l, M2 o9 p# x# f* ^7 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 |0 h. H6 I; X6 h+ U% S1 c. t - #else
/ K2 H3 m! G+ F$ F& \ - #define DMA_PRINTK( x... ), W' `" b- V* \; F0 B
- #define DMA_FN_IN
) ]! w1 [5 ~! I* b0 j% {( a - #define DMA_FN_OUT" Z* r5 k0 w5 ?, c$ j/ z9 s
- #endif
5 o; ^5 [! ?/ x - % i) r. G0 V0 X0 z1 s: l6 J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 {+ i) r' {$ u' @ K - #define STATIC_SHIFT 3( A1 t3 Z( p h$ C
- #define TCINTEN_SHIFT 20; B% f" k" v1 c7 f* S- g$ e
- #define ITCINTEN_SHIFT 21* `0 x5 {+ x4 G/ O4 T( T
- #define TCCHEN_SHIFT 22
6 m2 X: e3 l& Y9 }' f% l; g - #define ITCCHEN_SHIFT 23
: p; q/ U; `+ ~9 D% e - + o* w! }& s' r# e* i' E
- static volatile int irqraised1 = 0;. ~- }# }8 M# ]6 T
- static volatile int irqraised2 = 0;
: { |1 p* B' t' a' D* i# P
& j2 K% s7 x: ~. `: C) Q. ]6 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `( B1 E( Q1 v* Z: V$ a( |) V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ }8 ?6 {2 n* a, ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 a4 E2 J" x/ `3 _9 u - " }/ h7 l% ]2 i" ~
- dma_addr_t dmaphyssrc1 = 0;! {0 L; \* r% _3 j8 F) m
- dma_addr_t dmaphyssrc2 = 0;
% [5 ?( b6 z+ L4 e- D5 ^ - dma_addr_t dmaphysdest1 = 0;
$ I% R5 G0 t F - dma_addr_t dmaphysdest2 = 0;
1 N m% {; r( o' N/ u6 p# ~ - 2 c1 R* j- X& N/ q- C2 ^& P V
- char *dmabufsrc1 = NULL;
. f' L K0 X g1 ~2 O. v) O" o - char *dmabufsrc2 = NULL;
) T# Y- ^) o1 Z7 y9 p - char *dmabufdest1 = NULL;
! ?9 {; S5 L/ S5 ?9 S - char *dmabufdest2 = NULL; s$ x1 {1 G" f: P3 U) G. ~: _* W
* e {4 e- g2 `- ^& v- static int acnt = 512;
3 i# I' M) w) ~9 ~' w9 p5 k- t( _ - static int bcnt = 8;8 y+ [5 a5 o' S* A; d2 h
- static int ccnt = 8;
* h4 j0 \8 q5 c% d% o - : D( Z; m! z' f8 B: J
- module_param(acnt, int, S_IRUGO);" n, Z+ c0 V: H, Y K" v
- module_param(bcnt, int, S_IRUGO);( d, u2 h5 ?0 U j5 D* g) ?
- module_param(ccnt, int, S_IRUGO);
复制代码
+ K+ E9 Q: F( D
% _: l+ R# G N/ I9 N9 J. F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 y. _* t1 s$ ^% S" A. t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! k9 f1 S' T# P' }5 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- F; h: P5 s( J) ~
0 ?" @( @: E J E0 B
# r1 W& K* \" n2 S. \ |
|