|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, R" b1 U5 I7 |0 O$ _3 ?- [code]EDMA sample test application
0 n h* j# M: B! ]6 @7 ^: J - /*
6 S/ Q9 B% B5 M - * edma_test.c# K. ]7 I! ^8 S9 m) _$ S
- *
) ^& Y4 Q. v8 j; U( j* Q3 F - * brief EDMA3 Test Application; |0 P4 n! p' L2 r, {% ]1 o
- *
X. W1 [2 i6 I% o9 R - * This file contains EDMA3 Test code.
# C5 s$ c7 q' G# }" w - *# |) ?# g# ^" W2 g8 O8 X, d( h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 f0 z' U B; ?5 N* H# p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- o' V. K/ ]4 N4 Q - * TO CHANGE.
6 a/ t6 `( E, F0 r( n - *
' r1 c* Q" F0 B- a. C8 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% @$ b$ ~$ m; G. }, v/ q7 I* B! }
- *
4 \( d3 ]" J& X. m! M- C - * This program is free software; you can redistribute it and/or1 g3 T( _8 i% R' W; q
- * modify it under the terms of the GNU General Public License as
" P+ R; W2 I$ ]6 A& \ - * published by the Free Software Foundation version 2.
; G# C, x2 e" m - *; Z) `2 V9 ? w% O: O# B- G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 A9 j: C/ \- q' f9 ^7 m - * kind, whether express or implied; without even the implied warranty
: j) }+ k6 h B8 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 O+ q4 T/ X% |' e$ u W& k - * GNU General Public License for more details." f# @) n3 V- @! [- }2 e
- */6 _" K A) ^6 H8 C
6 J/ C/ r7 q: G- z( W- #include <linux/module.h>
H7 Z% Z, X' J n - #include <linux/init.h>
9 {1 p5 y4 q4 ^* z9 H* a! M - #include <linux/errno.h>
5 O% ~! M: `$ R5 k5 A' f - #include <linux/types.h>
* _7 c; }* ^& o" {7 h* k - #include <linux/interrupt.h>2 ^4 J3 _* k* n) n% }* _0 z* J
- #include <asm/io.h>0 l4 ]4 Z. ~ g7 a0 t* G
- #include <linux/moduleparam.h>
) `# T/ }( V! K - #include <linux/sysctl.h>
8 n8 u! `3 E% i; H - #include <linux/mm.h>
& i5 ^2 D- u4 l" p3 ?$ t - #include <linux/dma-mapping.h>/ q$ I- p; n1 O0 q- @3 N- {
( }; f* C) ~" O# Q* H; @' F5 @+ ]& t- #include <mach/memory.h>
2 ]: ]$ u! B6 B) z - #include <mach/hardware.h>, T1 I9 J7 N3 u, `8 R
- #include <mach/irqs.h># x' s) e! c% l/ }+ s7 n
- #include <asm/hardware/edma.h>
* f7 O4 U6 u6 }% E! i% a) ^
- p0 }; d; i. A. O: M- #undef EDMA3_DEBUG
% S. S# M' P5 e - /*#define EDMA3_DEBUG*/
% F) i1 K' G* L9 r2 D
* W0 d) ?' k7 Z/ ^7 ?1 \' f: s- { q- #ifdef EDMA3_DEBUG% n& M2 X: }2 V" C! u* q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ d' N' M% j2 L- Q0 v/ Y" W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 u6 _+ y. R6 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: J( i1 O7 D- k3 d - #else4 m/ K j# j4 a7 X3 v& L
- #define DMA_PRINTK( x... )8 Z- b3 O* M" z2 x; t' J
- #define DMA_FN_IN& o+ k4 R! O8 S3 o
- #define DMA_FN_OUT
1 {1 @6 B7 A8 n3 U4 f - #endif- `7 O* a( t4 K5 {
- 5 I2 X* L) r) t9 O# s6 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 H. X% I) w/ E! s* \2 U/ K; n
- #define STATIC_SHIFT 33 R& O$ e. J9 @/ r
- #define TCINTEN_SHIFT 20$ @; H0 [& g7 i0 `% g/ X
- #define ITCINTEN_SHIFT 21! `6 g z3 a( K! f5 B
- #define TCCHEN_SHIFT 224 `# u0 m5 P) |0 H% R8 A$ D, `
- #define ITCCHEN_SHIFT 235 t, S' O2 r0 q* }9 M
! f- @9 p5 B# v% `1 U- static volatile int irqraised1 = 0;
! j# ^" [& b. s) b0 x$ W - static volatile int irqraised2 = 0;
$ O; u$ f1 C' h; ]
1 H: a' G/ b" w& }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n* S% a2 ~% L1 Z/ F5 L, [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Y. C! w3 F+ x4 S& A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ?- w% z% [/ C3 @7 Z2 L" y
, Z% j$ L% v' m- dma_addr_t dmaphyssrc1 = 0;4 S1 D) D2 }4 c2 ?( J5 n3 p6 Y
- dma_addr_t dmaphyssrc2 = 0;
7 G* P! @3 u# @ - dma_addr_t dmaphysdest1 = 0;
% f( k6 p) k& q" ? - dma_addr_t dmaphysdest2 = 0;% N& `2 T+ s" i9 T7 h
- 6 U/ ^0 C7 _& g$ h* E& l) \2 s
- char *dmabufsrc1 = NULL;" R0 d' F |( F+ o6 p
- char *dmabufsrc2 = NULL;
& X( j/ e8 B; r& p - char *dmabufdest1 = NULL;, H& u% Y. ^7 ]/ B1 y+ D
- char *dmabufdest2 = NULL;% n) g: N2 t2 G* y. s# s
" b- J5 F- H) `# N# n- static int acnt = 512;
& V% }! J' g* ?& f6 v3 @' Z% N - static int bcnt = 8;$ ?5 W1 y3 p9 Q# ^! Z
- static int ccnt = 8;
; ?" Q$ \3 \4 j
+ J0 D: s% k: i7 I' o- module_param(acnt, int, S_IRUGO);5 s- A+ _7 _# V
- module_param(bcnt, int, S_IRUGO);! s5 C S& ?9 |6 Z: J, c
- module_param(ccnt, int, S_IRUGO);
复制代码 $ ?3 K# M& E/ o6 T, ?6 W; g) C
0 D8 r" a6 y& i) g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! T' Z C8 ] m8 q4 Y4 T' B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C- ~5 D, @/ _1 I( P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 S: g/ y0 S; {2 R: A5 g8 |
% O$ l) n1 j' u7 u& c4 h. E% D
( m# f A* Z0 B6 ] |
|