|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; H' ]4 i4 O' k% D- L- [code]EDMA sample test application
8 C: `3 B, @" z6 C# G4 q5 ] - /* Z! u3 M5 N% _7 B# N
- * edma_test.c; a. k- N2 Q) }& `* M
- *
" t3 Z$ K8 C8 I" T* P5 [+ I- c" { - * brief EDMA3 Test Application
3 K3 p s F; W/ Q9 O- J - *" m; s3 M$ T( ~/ T* }% L1 _7 L6 J
- * This file contains EDMA3 Test code.: y0 L/ e. u9 E( _
- *
4 I1 H5 C% M9 f5 R3 S+ } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& |9 B9 t4 S# L `* L6 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 e q+ _. @! U1 L# t
- * TO CHANGE.
* x2 b- `" U: W0 T9 V5 a1 Y - *
/ } H! H- R0 S) k$ v+ _) L( t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" o! i( O; {5 ]' O @4 m2 x - *; ~# p' G/ H8 Y& I8 G- T
- * This program is free software; you can redistribute it and/or
0 r, A( v9 ^9 \. x3 \! y& x - * modify it under the terms of the GNU General Public License as
' ^4 }/ \" i B* R- f - * published by the Free Software Foundation version 2.5 K5 t' Y$ K' J* _
- *, S a0 Q/ K" j) t* a1 e8 v, |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 O6 Y& A+ _8 u4 E1 G* Y" q& q: B
- * kind, whether express or implied; without even the implied warranty8 E m+ F! Z/ O2 c: q: q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 [4 k' D) M4 N$ P9 g
- * GNU General Public License for more details.5 c0 Q2 O4 I' }1 `2 _; |# p* b
- */8 F3 x2 a' M* B7 t& [( X7 V
- # B9 g' N$ v. R! K, P
- #include <linux/module.h>4 G2 z- X, u. K* s. H+ V
- #include <linux/init.h>3 T" B6 {1 L/ F( G) U' I9 G$ k3 W
- #include <linux/errno.h>. n$ i+ T- C& \! H Y( T2 E' [( G
- #include <linux/types.h>
4 D+ N1 W% p4 h" C/ E - #include <linux/interrupt.h>2 H" P6 w/ X' y b! [( _: Z* W
- #include <asm/io.h>
& k( R! B6 N5 ?( L - #include <linux/moduleparam.h>
" a/ D! j: H* G5 B! q& z$ z - #include <linux/sysctl.h>
9 Q9 J6 g; e/ K: F. a' Y - #include <linux/mm.h>
/ g3 T+ l- @ ]0 V9 M - #include <linux/dma-mapping.h>
1 y! |' q0 k* @/ f* A" ~ - 6 s- _2 p; C! d4 A( |) `
- #include <mach/memory.h> K/ P! j+ V1 c$ T. D- Z( R' B
- #include <mach/hardware.h>
* c. o$ n- u! J3 H3 t - #include <mach/irqs.h>
; Y, X* X! }# D& t ^ - #include <asm/hardware/edma.h>
/ L2 I. P; D# ]. k4 n
+ v# y _3 R1 f) E- #undef EDMA3_DEBUG
}7 V' P2 K& Q0 E9 f% d J - /*#define EDMA3_DEBUG*/* w1 _3 \2 b& x) v* p Z, {/ \
- 0 u c' A0 e, O9 L) M X
- #ifdef EDMA3_DEBUG
, J- V+ R3 z* Z$ d0 V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* l' ^5 g2 d. _# W; o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); I1 F u9 d, y" t! ]- g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]! S! j# |8 x! ~- J1 l
- #else% x$ P8 P3 f ~$ O" w
- #define DMA_PRINTK( x... ), k, [9 Y: \1 C, O) k/ z2 |% B @
- #define DMA_FN_IN# p9 M B- h4 ~4 G- ?: l, f
- #define DMA_FN_OUT& N$ f" F: i* E6 C- o
- #endif: K9 A$ V5 b% c/ F. r8 k, q6 C
! D% }& F3 u% R; D* L! C; H) \$ Z' ?) f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 |( L: Y, i! S8 a+ h* U - #define STATIC_SHIFT 3
. R+ i: c1 C& V7 T6 ]; D - #define TCINTEN_SHIFT 20) V! ]& s; z5 l, D6 s% }/ I1 C& |
- #define ITCINTEN_SHIFT 21( F$ l0 [2 w4 z8 r6 _, N9 P) }0 f4 l
- #define TCCHEN_SHIFT 221 K' [5 O, U% ]/ P
- #define ITCCHEN_SHIFT 23/ o# b6 m" U% p/ ~
- / l8 C# b4 i, Y1 R9 h2 N/ q
- static volatile int irqraised1 = 0;5 c1 y! g7 p% B) s7 j
- static volatile int irqraised2 = 0;
0 ^( G: Y6 s5 ~3 f9 n - 7 q3 `+ ~) v2 W# d& W5 t7 \- C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Y7 g. U! W% U2 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* n6 {1 f. E8 ^. r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |2 a0 q! s6 W) P- c
4 R* u/ \' T+ p1 T- dma_addr_t dmaphyssrc1 = 0;
7 h, y$ ?2 ~7 ^ - dma_addr_t dmaphyssrc2 = 0;# m' Y$ i* v7 w# h) O5 h/ G
- dma_addr_t dmaphysdest1 = 0;9 I4 T6 Y- {6 r( l
- dma_addr_t dmaphysdest2 = 0;
- F2 ^1 S' S4 T: d2 a- T' c2 G - ; ]& N6 ~: c0 E: W' \
- char *dmabufsrc1 = NULL;: _, L6 }) ^- I9 R( R
- char *dmabufsrc2 = NULL;/ q, k& [! a1 E# N$ ?
- char *dmabufdest1 = NULL;- Z/ R( m9 j3 t# L5 ~$ n) X6 a
- char *dmabufdest2 = NULL;
$ b. B0 a8 h, U" }, r! H+ U. a
& `- B) P) h9 e. F/ Y- static int acnt = 512;# q2 B- t: x& c- @/ s
- static int bcnt = 8;
# R; I; W t6 k$ x8 @5 D7 Q* F - static int ccnt = 8; S) @8 k* s `4 ~" e) N
- m: W7 \: t+ v V8 l7 Z5 V2 a
- module_param(acnt, int, S_IRUGO);" G; U4 Q9 w+ K
- module_param(bcnt, int, S_IRUGO); [7 s: x$ X4 o& s
- module_param(ccnt, int, S_IRUGO);
复制代码 " {" ]5 I1 [) m# U% [/ `
# J9 T a, h/ f. ^- z _5 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 q7 j# T9 Q8 N: N- C/ G x6 p+ `% {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; d; l1 j3 g3 C1 z P( o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; T) d5 G% ?3 |" Z
% P. f+ {" q' _8 F# j/ X8 f0 N: V7 B4 [ L$ Q
|
|