|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 T& s) w: C, J- [code]EDMA sample test application( X" u' O f" q8 j- {$ k& K; j
- /*
# d/ o8 h, Q& T5 n% e; E$ C$ d/ O - * edma_test.c% I2 Z. d; {/ [5 N) O* f$ [& K
- *
& V1 ]' ?% J7 k+ A+ `7 e - * brief EDMA3 Test Application
& B% n- g4 g" I6 { - */ k8 Y" n7 Q" K! O% f
- * This file contains EDMA3 Test code.
, f: I1 i& [) l* V3 Z; t# H0 _+ n! h - *5 f% B# J" Q' \ N# z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 h- n% z/ h& c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D+ I/ N6 n! ]* }
- * TO CHANGE.8 b/ q; z+ w* L8 P* U
- *' h- ~. u6 ]/ g9 L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& T! @. g! t5 o7 W$ X: S. G' s9 w$ [ - *
3 y8 N0 F2 q8 g/ a( V1 [ - * This program is free software; you can redistribute it and/or
, K* @" l4 |: ]7 ]; c; P: {9 p - * modify it under the terms of the GNU General Public License as
2 v+ h8 ]2 m. s( M - * published by the Free Software Foundation version 2., ^/ p, i6 Z6 A2 q
- *
; g% J M$ N' g7 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; y# v2 N0 _& t4 y9 a - * kind, whether express or implied; without even the implied warranty- C. E8 Y* L8 I T( ^0 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' S9 ~4 p% L& Q) p: h) X - * GNU General Public License for more details., A. Y2 ~& \# K6 k
- */3 g8 m& H( K9 a
- 3 f; {) g& \! R/ `
- #include <linux/module.h>
( T( ~) k" ^( N, j5 B - #include <linux/init.h>
! i( Z& I$ s& }! v2 m0 M - #include <linux/errno.h>5 F; _: G) }# T
- #include <linux/types.h>
8 L# @3 X `- s7 b& ^ - #include <linux/interrupt.h>9 ] t% W6 i8 q* ~; t$ \8 d
- #include <asm/io.h>% f& z- v+ p! P, x9 S2 o
- #include <linux/moduleparam.h>
) m( q) ?0 K" t7 t" P5 o# {$ d - #include <linux/sysctl.h>
# O B; Q, {1 E' t; P R - #include <linux/mm.h>
+ A3 S0 J8 B) {$ _+ j - #include <linux/dma-mapping.h>0 l% R. H9 n+ s7 L* l S
- 7 l' i* A+ O5 q7 o
- #include <mach/memory.h>- E5 I1 R* n0 A& y* l( P
- #include <mach/hardware.h>
9 J$ ~; ?6 T; v - #include <mach/irqs.h>
: ? p1 Q0 j& C: [! T6 n - #include <asm/hardware/edma.h>; }/ [4 u) W' g" g9 M4 X( o
7 ^7 Y. P( M+ j- #undef EDMA3_DEBUG
( P. ^8 Z) p" T - /*#define EDMA3_DEBUG*/
; E7 Y _+ b* [# Z! C - : o6 p% m/ N( Q, g" z3 P; l
- #ifdef EDMA3_DEBUG9 @$ P1 d6 B1 D7 Y* A+ Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ C! P) U5 x8 j6 }: Y; B' T* i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 e9 M4 `. z, a, B0 B1 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 @8 T& @3 R* i ?" u: Y7 T
- #else, T6 m! D7 X Y
- #define DMA_PRINTK( x... ), s' u0 H, t% U2 d& m' e
- #define DMA_FN_IN
* V- H& i- `; f; J - #define DMA_FN_OUT. k) m' @) a* q' ^% E# x
- #endif
9 ?, t9 A- `9 _* f" y w - ! R" \, T {; I+ T: K K$ R& x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) D- i9 I1 W' b' Y7 k! ]6 Q! o: j# Q
- #define STATIC_SHIFT 3
2 E% ]- ^/ u! Q" Q - #define TCINTEN_SHIFT 20
, x5 Y7 H/ Q/ [/ m; T - #define ITCINTEN_SHIFT 21
4 s& B) t9 f7 b P - #define TCCHEN_SHIFT 22
" q# z' |8 j% |* j2 e - #define ITCCHEN_SHIFT 23
# V0 {. c6 `( H
9 A) ]% j8 Q* C8 }' Q+ m- static volatile int irqraised1 = 0;
; B7 [" P9 I& s1 }: w - static volatile int irqraised2 = 0;; d* X+ D- b% k' Y9 H- D
- 9 |( S2 x; U2 Z5 V+ N, x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 e& I! }3 w% O7 G2 E) s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P0 n/ p) @ T7 W: M! D3 A) {7 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, I* o( _5 F' D2 k, ?
, J; N; Z6 W( h- dma_addr_t dmaphyssrc1 = 0;: i2 G( D" U2 H. F0 b1 D
- dma_addr_t dmaphyssrc2 = 0;3 d; R' J: M! h, W
- dma_addr_t dmaphysdest1 = 0;
@+ w5 B" Q. a2 j4 E6 D( } - dma_addr_t dmaphysdest2 = 0;- _1 w( l( [" F
- 2 ^3 I% Z2 G; c3 X8 p
- char *dmabufsrc1 = NULL;
9 N# C5 N! u" L; x - char *dmabufsrc2 = NULL;
' Z# G! E5 J' A) i - char *dmabufdest1 = NULL;9 x4 v) \% M7 @
- char *dmabufdest2 = NULL; Q; G. h' v$ q& G3 ]1 d* E- x
- ) L5 b7 m; V" F: s1 i! K& J* i
- static int acnt = 512;+ E6 O' {9 q3 K! G: _' B+ P
- static int bcnt = 8;0 e4 Z# p; H7 [+ e% ?) o1 X4 k
- static int ccnt = 8;0 \* @) C% m" [4 q5 `, g& u
F# Q. o* C8 Q1 A9 C* d, V2 C8 _- module_param(acnt, int, S_IRUGO);8 }# v; Q( L% ~+ H7 G! \# f* @
- module_param(bcnt, int, S_IRUGO);
$ o$ r8 w+ r/ O- a- A - module_param(ccnt, int, S_IRUGO);
复制代码
" V% e7 e R6 H4 d' Q8 t
) ?9 [. c% u- V4 A2 s" b% h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( o' j7 j5 o! }2 `& u( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' n7 r$ w4 A s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! P0 P+ J" C$ D5 |9 ]. Q, V( v
# I. \4 N7 P m6 n& j0 w
; @/ @2 Q F# c. @ |
|