|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- q7 ?& J& b& K2 a$ l' T& i- [code]EDMA sample test application
/ m" c) u8 X( [0 ?* w - /*
& h3 C1 {2 x- q p - * edma_test.c- n) k4 d7 J3 T f" e
- *4 L* ~% a. y& [9 _5 j: e' {% N8 M
- * brief EDMA3 Test Application; x7 l1 V5 F1 }* r% |2 @
- *0 B# \6 t9 m8 H. o: L+ K% M
- * This file contains EDMA3 Test code.8 i! v. Y2 H& @8 U9 }* m
- *# _) F H" H5 [2 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 v# q! e3 ^5 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 A. o0 K; b5 A" l5 v; m5 T - * TO CHANGE.
q: w7 I5 R7 S# B$ v2 ^7 A3 r B - *
. l' f5 G! e, [% W n$ f+ c% j! E) H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! e$ F; |5 ]6 U) z( z8 B4 R8 w$ Q - *
0 O5 L9 W! n1 d: l- ?# D$ W - * This program is free software; you can redistribute it and/or
, W' A- E" L e' D - * modify it under the terms of the GNU General Public License as6 f8 i% [! [* y, U3 n
- * published by the Free Software Foundation version 2.& S% D. K) P4 L4 t6 X
- *
- s5 B `. ^! w$ ^6 I- |2 l; _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) u4 H8 O$ Y. r
- * kind, whether express or implied; without even the implied warranty( w- z4 H( R; m$ Z3 w# u- t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# W9 N0 i" H! |- S
- * GNU General Public License for more details.
0 ] @$ E9 w5 V) X - */ p6 c* s7 W: L7 a
- # L" M" j" F7 T8 A8 |8 B# G
- #include <linux/module.h>
/ v' \# p) l* Y2 ] - #include <linux/init.h>/ ^% w0 f) ]' R& J
- #include <linux/errno.h> S- F1 t! i! a
- #include <linux/types.h>
. [& ^! M3 ?$ ]3 j5 l - #include <linux/interrupt.h>0 e' L s% a. ~. Y
- #include <asm/io.h>
" ?6 B2 x8 V, s: ]( m - #include <linux/moduleparam.h>* w! a/ k1 `4 w7 y% g+ V3 `
- #include <linux/sysctl.h>4 v, m3 w9 y, s9 a* G
- #include <linux/mm.h>
2 `7 a* @, v' N( m - #include <linux/dma-mapping.h>
7 r. d2 i$ r u: W. h5 \7 K - E4 J' p' B: Q8 T" i; ?1 Y
- #include <mach/memory.h>- [5 V5 U+ S4 M) M
- #include <mach/hardware.h>
% l/ e- s5 m( {7 A' A0 g' s9 c - #include <mach/irqs.h>
" F; u x& a4 |- | - #include <asm/hardware/edma.h>
6 g7 Y8 p1 p, K$ f - & w% L, E( a, i- _/ E
- #undef EDMA3_DEBUG7 w, H8 ^3 s8 c
- /*#define EDMA3_DEBUG*/
6 s* P- t' j5 w - * _7 o. T Q6 U# X' T
- #ifdef EDMA3_DEBUG# H7 b8 @, u4 y7 v5 E; n3 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): @" Y: f. D' t9 `& D1 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" U0 p% _) `& r, @6 H& r- M' L* ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); a5 S; z* q* Y: g0 l& ~. C
- #else8 E1 g! U9 E) [+ A. Y+ `
- #define DMA_PRINTK( x... ), m4 ?8 Q; S* I# V7 |7 L5 w
- #define DMA_FN_IN
6 ~& }% i2 J3 Y. Y - #define DMA_FN_OUT
1 C. S" I, {4 i) P: K! I6 y - #endif/ o- `( L9 r i9 K
0 J& T/ ]# Y- [7 O( Z" {' _- #define MAX_DMA_TRANSFER_IN_BYTES (32768). t; D% S. w% ^, e9 E) ?! _; J
- #define STATIC_SHIFT 3
4 J8 D) {3 u# s% N4 J, V% M, n - #define TCINTEN_SHIFT 20
8 ~8 [; s1 V% t/ C3 N - #define ITCINTEN_SHIFT 21
7 O: t! F4 A% I7 X7 U - #define TCCHEN_SHIFT 22
5 a% r [- `/ r7 t, o - #define ITCCHEN_SHIFT 231 f4 m3 K1 T# \. }! B% N `
. Z* S$ H$ }" N( e) T8 `( e+ @! K9 a5 {- static volatile int irqraised1 = 0;: [& A+ m' P5 ^
- static volatile int irqraised2 = 0;' |5 o* @: O8 W/ r3 e6 _
- 0 {0 j$ R7 G# E0 C2 j6 Q: A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 {" q: q& S/ D/ o) r" p+ k' K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: T6 q9 j+ r* z6 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?7 ?" j! b- A% c - ' r3 u- T0 ~3 x) N+ H
- dma_addr_t dmaphyssrc1 = 0;, Q! h5 M' u6 o
- dma_addr_t dmaphyssrc2 = 0;, a7 c8 o% s2 X/ o1 \
- dma_addr_t dmaphysdest1 = 0;
8 K2 Z; e4 V" C. m. { - dma_addr_t dmaphysdest2 = 0;+ L8 @3 |4 |# ?
9 p& ~$ A5 E; H- char *dmabufsrc1 = NULL;" I$ m) G3 W5 U- k
- char *dmabufsrc2 = NULL;# c5 u7 b/ c9 i! m3 \ V2 P1 N
- char *dmabufdest1 = NULL; Y2 m; n7 y2 g7 `
- char *dmabufdest2 = NULL;
) M! X: {) \$ t7 a - & I7 _; ^% N9 ~
- static int acnt = 512;1 e7 X; E+ O/ a, T: ~* B
- static int bcnt = 8;* b8 a! W$ b& F4 @) y. V
- static int ccnt = 8;; y1 e4 l% v* n7 j+ I: _1 i4 Q
- / w% ~/ U, ]! U( T8 E1 ?; ^) Y) F
- module_param(acnt, int, S_IRUGO);( C' I; @8 I+ W
- module_param(bcnt, int, S_IRUGO);$ G, o. n- y4 G0 s) A/ s6 L6 U
- module_param(ccnt, int, S_IRUGO);
复制代码 0 ~( C5 P9 O& U& v6 q0 [
* L0 l$ D( v* n) k) p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ?* y" T# q- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ k# ^: F8 T, m. y/ L/ d% ^5 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 L8 D% ?$ }; ^4 ~, Z. Z& @: u, Z' l' C* h* A' V$ n
4 b1 b, ]- x6 ` J% Q) _, C |
|