|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! i- G( q; O* t( ?3 z- [code]EDMA sample test application
- @" u9 b) h0 {1 K- |& D( c - /*4 l6 q/ B4 [4 a( Z6 r, a4 d
- * edma_test.c
+ D; _; D! k {: I* y7 L, F! _5 | - *8 [+ a, P) M# I4 g
- * brief EDMA3 Test Application
2 e1 M, z u+ p - *
( \/ K) D) Z+ D - * This file contains EDMA3 Test code.
5 |; |; k4 r' c: {7 {+ q - *
. O! A' F- Q( h$ M5 }- e5 m" B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 n- f. B8 x! ^: S1 L) m. v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 V4 s; {$ U) b; a7 ? f: E
- * TO CHANGE.
6 y: W0 g- z/ a' }1 X - *+ Y- Q+ Y7 B* s' c1 H4 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 [/ y$ [1 @% h/ b) B' F - *
. R- \ A5 W9 V f - * This program is free software; you can redistribute it and/or
}4 _+ _8 {5 y- A - * modify it under the terms of the GNU General Public License as
, S: L4 h7 z X+ l% ^ - * published by the Free Software Foundation version 2.6 a3 T* ], k0 T. A
- *$ B6 ?& Z$ |: F8 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. H/ I. v' K% J+ M+ C% x - * kind, whether express or implied; without even the implied warranty
, L [& _, r/ \! H+ T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 E: o+ y- K7 l: C
- * GNU General Public License for more details.
: o4 r+ L! ?5 u& } - */2 G5 J& S3 Z1 i1 Y; |
& }. O: _, }, f; x2 F- #include <linux/module.h>* Q; U: z: c( u
- #include <linux/init.h>
% u& t3 x8 }5 o n9 } - #include <linux/errno.h>8 y- h. X y/ N
- #include <linux/types.h>- b W: S' q8 [# L1 {
- #include <linux/interrupt.h>
5 G8 P# E$ [4 R% H - #include <asm/io.h>9 v6 ?! X4 L. z- J) N
- #include <linux/moduleparam.h>' K! Y; Y' w5 e
- #include <linux/sysctl.h>
- k, D% t+ }( D( Y - #include <linux/mm.h>
$ U2 w5 [& o3 C9 ?0 N - #include <linux/dma-mapping.h> W$ \: {1 L* ~6 n: ?
; `5 m6 S0 Y4 s4 O' i# l- #include <mach/memory.h>" U* J6 \" {% m9 q8 B/ _ [1 S
- #include <mach/hardware.h>
: i: r8 |! G( a9 z - #include <mach/irqs.h>' K4 J9 G$ F! p
- #include <asm/hardware/edma.h>/ R: M0 w) k6 L& H7 w0 ~8 X
! w M6 l% S+ r6 L& l- #undef EDMA3_DEBUG! Z9 D$ ^ @" z3 \2 j6 O2 v
- /*#define EDMA3_DEBUG*/7 O$ ?8 k7 C+ n) w! a& ?9 r; N
- 9 u; E" a4 w8 u. {; k2 q
- #ifdef EDMA3_DEBUG
% X% T) m( F' w C! \ o6 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. B9 c" K1 U( ^8 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' [# l0 J* M) y6 O+ [/ H: V% u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ F) t0 b3 B0 _ - #else
& U3 g. z, N: K1 D9 Z R7 `/ C0 j$ H* V - #define DMA_PRINTK( x... )% x5 G. b- [/ B" [) \% v
- #define DMA_FN_IN
Q% y8 U6 S; J - #define DMA_FN_OUT
9 g+ `4 ~9 q: g& f' {( w4 ^4 ~ - #endif/ s8 c& e5 {7 G9 r
4 {. `3 |/ B. X1 v! g G( q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 f/ b+ M' y3 m1 C - #define STATIC_SHIFT 3
, i7 p- K4 S# ^0 _- k; ~) B: { - #define TCINTEN_SHIFT 209 p7 R6 E1 |' V! E& o
- #define ITCINTEN_SHIFT 21
N, y* y8 N3 V% ^) @$ e - #define TCCHEN_SHIFT 22
% {, A9 f; s( M1 r; q5 L, `- V% T, V - #define ITCCHEN_SHIFT 23$ n; }& h1 z# p, _9 i# K, E
- ; E0 W- F# o) k7 x; f
- static volatile int irqraised1 = 0;0 ]/ y: v" k7 K. K) S
- static volatile int irqraised2 = 0;
1 P( ^1 [2 P, H6 c, m6 h
1 Z n! {& m: V$ }" k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 [! v1 U6 n8 A0 f1 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F& ]2 C3 V% J2 N: M) R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 |" j+ T7 g) K7 h
% {. R: f# h; E9 P' R& V- dma_addr_t dmaphyssrc1 = 0;0 y$ }: ^0 n' W: Z- G' ~3 A/ |
- dma_addr_t dmaphyssrc2 = 0;
6 ]- D- e3 B; M! m3 H2 b - dma_addr_t dmaphysdest1 = 0;. b# o" S; Q. b6 ^ n8 N
- dma_addr_t dmaphysdest2 = 0;
3 w' ~* \3 l# t
9 m1 [& a2 C% u: W' M6 G [- char *dmabufsrc1 = NULL;
. T) P0 v+ y+ I" e1 p: o - char *dmabufsrc2 = NULL;4 N; d& `) L. D2 C
- char *dmabufdest1 = NULL;
. u2 D6 h* R8 `8 T- b, H - char *dmabufdest2 = NULL;
7 N* F( h9 ~& I7 [8 A6 V0 T2 E& J- | - : y0 _9 h+ O, P( U
- static int acnt = 512;
: _! e# L. K2 Y* ~: o - static int bcnt = 8;
8 d, L- ?5 E1 a! X' n - static int ccnt = 8;
0 x! ]% ~9 e! i; n& a2 i# m - 0 z% h" a% e& `& T
- module_param(acnt, int, S_IRUGO);
. X. m4 b7 }6 f C H - module_param(bcnt, int, S_IRUGO);# H- Q" ^, E5 {9 l; p7 W
- module_param(ccnt, int, S_IRUGO);
复制代码
) {0 H- N, ?6 U4 Y: M0 Q4 ?5 U5 r! i$ U" u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. p2 s* W. @% Y* ]; V" c0 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, }+ ^7 U: n9 i7 O$ f" d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 l; E7 r3 T2 ]' l8 N
5 M5 K. {# P' f2 A, o( H5 C. F* I: Y
' j( O [8 ^9 H- \! s
|
|