|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 E9 e$ Q, Y% J0 H- [code]EDMA sample test application+ F/ ~. F- R4 a; {$ m7 t' v S) A
- /*
9 t$ X* D9 U8 K5 g& E; V - * edma_test.c
6 N: H g. M3 y4 p# h - *9 N' i$ k$ q2 l7 t
- * brief EDMA3 Test Application. i! {( O7 ^, j' P( y! F" |
- *
5 J* p9 c# t6 k# H# q4 d. M3 k) r - * This file contains EDMA3 Test code.) W3 Q1 a" f* l
- *
. u) h! x7 Y' O' G. f, K3 r$ R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' t1 s1 |+ [! z* N/ {6 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( {2 P# t$ h9 ~, y ]# I! Q - * TO CHANGE.& O0 u( m) G( ?. p
- *
1 c2 S! ?2 {7 X! F7 q# r% K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( r5 N% V4 x) Q6 a. G2 I4 y - *, _( {* P; @! f7 z! k! [& x! ^1 c
- * This program is free software; you can redistribute it and/or$ V. L2 h" j0 n. _2 s. K
- * modify it under the terms of the GNU General Public License as$ {2 w2 f, K, J0 T4 N
- * published by the Free Software Foundation version 2.0 `, `. q7 h, C0 P6 k4 ^. t
- *
# y0 A, o* j! `" v. z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 w ^8 k' i/ O9 u; X& t' u4 J- ^: Y
- * kind, whether express or implied; without even the implied warranty# _7 N6 f! q0 ~9 Z7 S: x( y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! `4 b" y/ ]3 G. E& X! f - * GNU General Public License for more details.
1 t2 l* @8 b* t2 }2 ? - */
- r9 d. P1 y! s9 H
2 T) V3 ?% ~2 n" B/ \- #include <linux/module.h>) P x2 J6 [7 e' ?
- #include <linux/init.h>
2 _ T7 r5 S' n6 C. S6 ` - #include <linux/errno.h>% l3 G9 ? P8 w: D# I8 Y d
- #include <linux/types.h>
5 V7 t/ o4 r3 l" ] - #include <linux/interrupt.h>5 l) N3 M3 s, `, i
- #include <asm/io.h>
7 o! g3 P7 A8 G6 y - #include <linux/moduleparam.h>$ t5 z# p- H/ w1 B
- #include <linux/sysctl.h>' X' f2 l7 m" t: x4 q( O. R
- #include <linux/mm.h>8 X; i3 M. i" \ S. Z
- #include <linux/dma-mapping.h>5 j# Z4 N; G. o
, g9 V) c- ~9 M$ A5 _$ G- #include <mach/memory.h>* y& k' q. [" M+ V( i
- #include <mach/hardware.h>1 S, Z m4 j: y
- #include <mach/irqs.h>8 v( ]; N$ E, r* |% C5 ~3 i
- #include <asm/hardware/edma.h>
4 Z) x& d! j, V; x) j3 K7 y
# Q. J! R1 Y. j: O+ k0 s$ d9 i; n- #undef EDMA3_DEBUG
; e0 Q7 `* t4 B2 M - /*#define EDMA3_DEBUG*/- y# F4 N1 d% Z8 ~
% E' h0 X' o! e! ?+ I! T- #ifdef EDMA3_DEBUG
: J4 N: }3 u1 R; d% Z; D7 V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): M5 y1 Q, g7 u9 X3 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ N/ M3 m# g7 m5 W# D% |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 B$ x* }% h/ D& S
- #else) j- H/ `5 t. R& v9 X4 g- D6 ^' b# c
- #define DMA_PRINTK( x... )
! ]3 |" y! N0 g5 T4 V! [8 |# z' q, _ - #define DMA_FN_IN
y4 A) `+ L3 J9 A; a - #define DMA_FN_OUT
5 T; b4 t `) { - #endif1 j8 @3 g- l) ~7 C
- ; L P+ V. K' D/ w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* n* N: _9 {1 K3 Q* f/ r7 @6 w4 R - #define STATIC_SHIFT 3: v0 Q3 b# \9 @. w& u! V8 a
- #define TCINTEN_SHIFT 20. Q* l+ w" k8 s& [/ N
- #define ITCINTEN_SHIFT 21
2 \. d" b/ E+ Z* s; B+ j5 G2 Q - #define TCCHEN_SHIFT 22- U$ d- P7 M8 n& m r I; z
- #define ITCCHEN_SHIFT 23
2 t3 Q: x! w( a3 s. r - & ?3 h) V: \' A- z' k" R, p
- static volatile int irqraised1 = 0;
! A$ i+ |8 Z$ O7 I ^# T8 {# y - static volatile int irqraised2 = 0;# h# h! ]: q# h+ T- Z$ Q
2 i% k% I$ ?/ S6 P: a6 D$ }2 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ v9 d+ G0 x. l9 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _, b& o/ o" R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ j& U! f2 ?* ]7 z! K. L5 t p
- ; Q0 o1 X0 X) u. j9 H' P# U
- dma_addr_t dmaphyssrc1 = 0;
' u; m) ?" c( a" _ X ~ - dma_addr_t dmaphyssrc2 = 0;1 W' i5 [( k" q6 \0 X |1 g
- dma_addr_t dmaphysdest1 = 0;' x! D+ y/ l0 x ^% t j0 j
- dma_addr_t dmaphysdest2 = 0;
* J% I/ P% J" m3 @! A3 {
* d H2 J9 E3 e* f D2 N" Z- ^) A0 D- char *dmabufsrc1 = NULL;; |" k4 R- r6 @( l% v
- char *dmabufsrc2 = NULL;" _" D* ~; H2 x6 D! T, T1 ~
- char *dmabufdest1 = NULL;4 ?: o9 _, z- h% v" g
- char *dmabufdest2 = NULL;$ R4 G7 N: o9 f2 i2 Y( B
- 5 x5 A3 Y8 u3 E5 P$ T
- static int acnt = 512;
, V: D7 o9 T. I% u" z - static int bcnt = 8;
4 G6 q; M1 P% A9 ^& v) H. M - static int ccnt = 8;
6 O6 B0 t: F2 I$ w
2 q0 X+ q/ f+ f% {- module_param(acnt, int, S_IRUGO);9 [ v4 {3 H% m
- module_param(bcnt, int, S_IRUGO);
- V9 ?! l% j# v! u( _5 t5 A - module_param(ccnt, int, S_IRUGO);
复制代码
: n8 e1 S/ ?# D+ [, S2 l/ N$ J: c$ K+ P3 r; o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 a( c7 ]7 j5 t- G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 A; n. T6 z2 z C7 {- T" A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% _! W; z0 n( K
" y; \3 F! {, ?! t' [) d. d/ H
! y- L L- ~4 Q# ]0 A2 x |
|