|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ T% n- p3 N; p7 V# K% z- [code]EDMA sample test application5 A6 q2 ]# Z9 g/ x
- /*6 t& _; V' W: _- D
- * edma_test.c
9 t1 L; U# y. x7 B8 p$ T* e, E - *# {9 A% C4 J8 R1 j6 N& q. z3 q( s
- * brief EDMA3 Test Application8 ?$ a; J' P$ @& }
- *, Z8 o! a" _& ?
- * This file contains EDMA3 Test code.$ K2 X3 w% f' a7 e7 E
- *5 c& F: |0 K9 E' q6 b; M; w& M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. v2 p' @* [7 d5 Q3 l9 o4 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# x) G% p* C" u: ~2 b
- * TO CHANGE.
; A k4 X' U2 v' N! }- G - *
! l, \$ H* Q5 |: z( p* O+ ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 [+ n- A" R% j. W' A% t% B - *
+ f/ N) P) {6 D O i - * This program is free software; you can redistribute it and/or6 R# i. J: M& n/ H J; _/ r- {) r
- * modify it under the terms of the GNU General Public License as
* z0 _; X$ |. T4 m: v - * published by the Free Software Foundation version 2.
2 R$ L4 w) D8 m - *( q+ k+ O ?, T, M9 f* R# R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) K0 C- i+ K( a' x* X
- * kind, whether express or implied; without even the implied warranty
& G8 L; z$ O j# |/ K. A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) u' \& U- n7 v
- * GNU General Public License for more details.
0 ~( I; N. a* z: i - */, w2 O, C6 V$ G4 s! X) j
4 J& p8 W2 K m- #include <linux/module.h>
6 h: R) Y {! v - #include <linux/init.h>
, K2 j! L; K' y6 J - #include <linux/errno.h>
9 `# Z" z+ e0 } - #include <linux/types.h>
0 i- A. ~1 W/ A$ ~* q& K - #include <linux/interrupt.h>
0 t; f2 ]: {/ B: ~* \+ H% g - #include <asm/io.h>2 I1 ^0 I% H" a1 U
- #include <linux/moduleparam.h>
5 y! k2 N5 a! `( i - #include <linux/sysctl.h>" E+ D- ]) F% Z R: ]
- #include <linux/mm.h>
$ k9 w/ }: r. R - #include <linux/dma-mapping.h>
1 p9 R& p' Q" V1 G2 s4 E# M
) a( `) [& u6 ~2 j' A2 v+ \: Z6 ^- #include <mach/memory.h>- H; ?* M" J" L$ [% `, ?; U9 N
- #include <mach/hardware.h>. F) l% E3 b# U, n
- #include <mach/irqs.h>
* |; G; I% b/ u3 p - #include <asm/hardware/edma.h>
+ f* M0 ]7 R1 [& ]* y N! ~ - # `5 Q- \7 A" F: [. `
- #undef EDMA3_DEBUG
5 x! u9 x2 {( F1 K, r$ M - /*#define EDMA3_DEBUG*/; {4 y+ H$ Z K! X9 V
- / r2 z) ?( j O1 R) W- K3 B
- #ifdef EDMA3_DEBUG
: P# j- @; E6 L+ O- p) u% Y1 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 P! U9 @% [6 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 s# `) f& a8 T# I" I, K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 H2 k* G/ u$ M' t4 B# p' w
- #else
/ E2 }& |" P& A - #define DMA_PRINTK( x... )) z& j) r. J% H9 o6 W
- #define DMA_FN_IN
& O# |; }; J4 I/ ? y, L$ h: o - #define DMA_FN_OUT) i0 s! d- S0 Z* w) [; h! s
- #endif
4 W3 {* d( f2 P8 g1 R1 ^ - 0 K. z- z. S$ [3 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 l3 M+ O) S/ v- m
- #define STATIC_SHIFT 3" y/ R# X6 D: h" N j4 L# y
- #define TCINTEN_SHIFT 20( l3 X9 E" A! o1 O
- #define ITCINTEN_SHIFT 216 m$ O1 G% q/ J) S$ l$ q4 \" [+ @' r
- #define TCCHEN_SHIFT 22: V1 H. h6 o1 X) c
- #define ITCCHEN_SHIFT 23
# T" n; P: J( I9 y, c0 O" ^7 F - 1 P) J+ {3 F4 R! S5 Q; f
- static volatile int irqraised1 = 0; t5 l8 n0 h" ] d
- static volatile int irqraised2 = 0;
4 K4 Z2 ?2 T- a( C6 B4 K - # W$ d7 z$ a# H" x& C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% S% T$ }! t* a1 X1 y5 u( c1 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ i" V7 I3 ]+ k0 S/ z# a0 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! D5 j! f! \! @0 _9 i4 ?
" Q4 g1 j3 H- C$ C3 r- dma_addr_t dmaphyssrc1 = 0;& p3 ^1 }. J; I% Z
- dma_addr_t dmaphyssrc2 = 0;' [. s* G- ^8 t( @
- dma_addr_t dmaphysdest1 = 0;; w9 [3 M$ x% _# e
- dma_addr_t dmaphysdest2 = 0;
3 @4 v7 m0 K1 f
- ?; \- K/ l; j- char *dmabufsrc1 = NULL;8 o8 l1 E$ S5 `, |2 Y
- char *dmabufsrc2 = NULL;
# d+ ~% [# P: w; a9 B8 V, p - char *dmabufdest1 = NULL;
* h# A) B9 D% R' N4 H - char *dmabufdest2 = NULL; s6 T* }# q( p7 G9 F7 N& a
- : r. N1 b% W8 n2 E- R* R$ J
- static int acnt = 512;) v$ {. }+ T4 \0 c. W; ~* Y
- static int bcnt = 8;
$ t; ]& E$ L- }% r, j - static int ccnt = 8;& s1 e* v+ K& S% ]& f, C
4 S5 @# h8 T y _% N. v9 p. t5 b- module_param(acnt, int, S_IRUGO);
+ M6 Z2 F: q1 t5 q( ~2 s - module_param(bcnt, int, S_IRUGO);
7 B4 [9 y+ s! g$ x" u: R2 S6 i - module_param(ccnt, int, S_IRUGO);
复制代码
7 N; r" e7 h5 Y. W; I+ Y V9 v. u {9 h8 o/ G8 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 B$ z' f: k0 }' I8 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ^: N, l5 U2 G, `( b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. h& X0 B% _3 m- e+ Q& `, M ]$ b1 G
6 C9 @ L+ t5 K# g6 h |
|