|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ h) r4 q+ Y, I- [code]EDMA sample test application: W' A* J' T8 A; y4 i) t0 w( I
- /*
# `" c8 t; @+ h. l( N- i+ Q - * edma_test.c
3 ?: V6 n" r& a3 @8 n - *
7 E! I) w9 \- ]6 } l. q - * brief EDMA3 Test Application, `: K# E9 G2 g$ i
- *4 `% z' t3 j6 P( A. i0 u4 k
- * This file contains EDMA3 Test code.
/ q" ^( n" b: }- z: q3 h* z+ d7 ] - *% l8 j; M4 M# t( u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! |7 s8 n4 h' }. ?& |6 c; P4 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 f9 q; N3 P: m; A1 x - * TO CHANGE.
: `2 f0 u& \! b - ** U8 q; M9 C; D0 p$ w5 L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f& [ }0 h; k B6 \6 U
- *' _2 `/ O( e; z! r5 w- _/ E
- * This program is free software; you can redistribute it and/or
* A; i2 @+ I# E% ~ - * modify it under the terms of the GNU General Public License as4 w8 }! F( _' k8 I
- * published by the Free Software Foundation version 2.
& n& U) }# q- v* I - * i9 l7 A [1 n: A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ s+ ~/ ]2 e4 r
- * kind, whether express or implied; without even the implied warranty
8 u# W) d0 G- Q `; e! E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. i5 N. N @" q* }1 W" C1 V8 l" m
- * GNU General Public License for more details./ C: i# {9 E! D( i; ~5 z) `# H
- */
+ p( S/ Q+ ~. [, w d# M/ E# k, q
* M$ o$ d) M# o: T Q- #include <linux/module.h>/ H- v0 @/ W! B! G
- #include <linux/init.h>
% M9 _+ D6 y, q, Q8 X! S - #include <linux/errno.h>
. W9 U9 O8 j. z' I - #include <linux/types.h>' \9 w* E; Y4 s9 Q1 U. \% ^
- #include <linux/interrupt.h>
5 b# A, e% y) [0 G: L& K) a - #include <asm/io.h>
$ J$ j2 ^) x1 q) L7 ~" U- Z - #include <linux/moduleparam.h>" Y6 ^/ s5 p$ p9 Z3 ?7 e5 z& s
- #include <linux/sysctl.h>
3 Y$ i2 N; Q: N" t b - #include <linux/mm.h>) Z& ]( X' o4 o$ t9 V! r
- #include <linux/dma-mapping.h>' J K( u9 }- G% d) w2 D) {
6 K; h; d: N8 M! {/ Y1 ]* D- #include <mach/memory.h>& }' p+ v2 i1 a& I2 R
- #include <mach/hardware.h>
- \' h% z$ O8 ]) O - #include <mach/irqs.h>
. ]) }0 q, {' [- E - #include <asm/hardware/edma.h>0 a4 A; q3 G& O" h4 a% c# P
$ \# q0 @$ n4 E3 V p5 g* G- #undef EDMA3_DEBUG
8 u; G2 P. {% j L7 P - /*#define EDMA3_DEBUG*/8 a6 s. V+ z3 X
- 9 ]; c, g& ? j% y
- #ifdef EDMA3_DEBUG
& G9 C% h! Z& ]; f" s; m0 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 F% L X2 W) q5 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ S% W. E( O8 g1 Z3 ^7 r; X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 i/ F7 e# B6 Y - #else2 a8 p7 {& a( y+ c0 b7 ~
- #define DMA_PRINTK( x... )
' t. d2 ~/ x0 l4 i! y - #define DMA_FN_IN
) f3 ~& }6 P$ F5 l5 a - #define DMA_FN_OUT
) I i1 m) l3 ]7 J9 Z: a* } - #endif$ K) w( x2 Y I/ R8 S
$ }6 I: C! U0 H6 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ q z$ v6 w5 ^0 }2 H6 Y
- #define STATIC_SHIFT 3
- l" d+ H4 m) r* {9 ` - #define TCINTEN_SHIFT 204 ?2 o/ _( ]7 C, u. K. b5 N2 ]
- #define ITCINTEN_SHIFT 219 G5 `3 U8 J2 {. o- X
- #define TCCHEN_SHIFT 222 H) ^9 j' \( Z. j* E6 e% W
- #define ITCCHEN_SHIFT 239 I/ P$ [( I2 x* V5 n
: V0 k8 v y/ l6 i+ z- static volatile int irqraised1 = 0;. R( A, e& D9 d" H# ~' N( O" F
- static volatile int irqraised2 = 0;0 H. q' P$ y; Q0 l
- % H2 U: g$ ^' c0 p8 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _7 N$ I Q* Y; i4 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
G8 e: M d( h0 A+ h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L7 F6 n3 ~. r: v4 u- c
- ) }" r |2 K' a( T
- dma_addr_t dmaphyssrc1 = 0;# K; r. w7 F ~4 H
- dma_addr_t dmaphyssrc2 = 0;
- w! m7 I" \' |. U; Y: ^ - dma_addr_t dmaphysdest1 = 0;
$ J* @" U- \, G o9 d* A - dma_addr_t dmaphysdest2 = 0;3 X9 a. E0 [5 R& {
- 8 U! e4 D0 A p% ]8 t+ |
- char *dmabufsrc1 = NULL;' e) |6 b5 ?( a' G
- char *dmabufsrc2 = NULL;, j V) y! ~& Q& A
- char *dmabufdest1 = NULL;; V& d' e- j- V5 S, U. i2 y* V
- char *dmabufdest2 = NULL;
2 S$ w) N+ T0 r8 r - / A" c# } G3 U6 o b; B& {
- static int acnt = 512;
. k) I; ~0 |" @, c - static int bcnt = 8;
7 A; f! m, y \ - static int ccnt = 8;
7 R8 ^4 j9 f. V0 B2 ~1 C V
$ J9 S" s7 k: @- a# O- module_param(acnt, int, S_IRUGO);
9 ^7 V+ S' Z8 o* d! c- x - module_param(bcnt, int, S_IRUGO);, V; B* H: t8 I Q8 Q, {9 h0 G
- module_param(ccnt, int, S_IRUGO);
复制代码
( Q+ _4 y3 P3 C! x; W; Q3 {- N/ V2 g# G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* n% N) R: J+ k! v: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, t/ d$ c. {& m! D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% M. y. q! u, R2 G& J1 H! C
1 q8 o! A9 m2 h" P/ @- ~* v+ a; |0 }- I8 A5 h# G5 T0 P
|
|