|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ]* P0 u- X0 `7 j* N3 V- [code]EDMA sample test application
: A9 S1 q e: K3 X5 S - /*( A) D$ l4 C& T: t
- * edma_test.c1 y- @- p% x4 t( `! R" E/ G2 ~! S
- *
. R" Y% B: W/ ?* x0 |- s# c9 @ - * brief EDMA3 Test Application k X8 ~% Z! M0 d- W: p# g
- *
* i: B, [8 d( C- e* S - * This file contains EDMA3 Test code.
0 N4 j& D" H' x0 K2 C - *
~; i6 {8 [) z5 J' T1 u7 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# X) _# Q0 I) ?" H6 J& L3 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ ]: W) t/ C* [! r4 Q( M - * TO CHANGE.7 [1 t' H2 s- {! b) a
- *2 H& K+ w5 T, t8 F- S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, M2 B8 k2 G" W" }; k# r - *7 f* j. t, y# R6 {
- * This program is free software; you can redistribute it and/or8 \5 x, I- k& t+ |
- * modify it under the terms of the GNU General Public License as
5 e- C$ C. D# P9 W( J - * published by the Free Software Foundation version 2.
5 r0 ]/ d) F2 E% n# M2 n, G w - *! m* i9 ]0 X- T) C# e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% k" ]( L( v/ @! G0 @
- * kind, whether express or implied; without even the implied warranty
: U5 F% g2 O) o3 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 n- N) z, q- b+ c. } - * GNU General Public License for more details.
! j5 S w" ~1 d3 f; K) P" p - */
+ j6 t7 E, ~3 R# Z - 7 ] R, a P6 [+ l: \
- #include <linux/module.h>. {# C5 P" g3 g& l& r4 R
- #include <linux/init.h>4 c# b5 J# j9 n6 x: N1 ?: }
- #include <linux/errno.h>1 c* F4 M/ f: Z) I
- #include <linux/types.h>
: U3 _' T; T3 [& g5 i - #include <linux/interrupt.h>: J( s( w$ i1 t/ s1 Y: a" e
- #include <asm/io.h>
7 W9 U4 P0 M( P& p, k9 R+ Y! w+ i - #include <linux/moduleparam.h>
- e* j1 {2 F# t- c; F* o. I* Y t4 } - #include <linux/sysctl.h>
9 y" s9 ~/ V& @9 ]$ G# W) u - #include <linux/mm.h>
# m5 r9 j8 S; Y* B# _; t1 _- U3 e - #include <linux/dma-mapping.h>
0 |+ t: s( O# R) `
. z" x4 l2 Y; A! B- f. U' l- #include <mach/memory.h>; M( U; n4 v! Y1 ~
- #include <mach/hardware.h>/ v! j. F0 G$ Q5 ^" j! n
- #include <mach/irqs.h>$ i. Y4 t5 A* r& h9 `' q6 k! D
- #include <asm/hardware/edma.h>
7 F1 F) U& M+ b1 J7 ^
. _9 D* f% N$ C- #undef EDMA3_DEBUG
+ a. ^& ^7 Y8 I - /*#define EDMA3_DEBUG*/2 w) L- ~/ Z5 n/ |- I" ?7 z g) [
8 g+ s6 ]- _" Z- #ifdef EDMA3_DEBUG
/ P: |. ], m# c# H1 |. \; t( @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 W! G& l. m4 m9 M7 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ l) [, _5 i2 e$ _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) c# f' c# C2 }. a( O& a! w( _
- #else
9 i9 I. ? c4 E5 S& [, U" _6 z - #define DMA_PRINTK( x... )
0 |, c% ^* ?" H4 r - #define DMA_FN_IN
4 _4 q$ J. b! z, V1 v - #define DMA_FN_OUT) K, Z& A% q* O5 d6 G5 X
- #endif' R! x$ N3 p. Q
- - {+ O* e N# H4 C6 b, T( Y7 `0 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 j) ~% H/ L0 {# g; a7 N
- #define STATIC_SHIFT 3; M5 U2 q/ _. H
- #define TCINTEN_SHIFT 20
# w# y9 B m+ O1 ^( Z - #define ITCINTEN_SHIFT 213 Y* Z" ~& J4 U7 h
- #define TCCHEN_SHIFT 22& W. Z6 r" I+ y7 r7 `! [
- #define ITCCHEN_SHIFT 238 F. v9 {& k2 @' S
/ F1 W, G$ Q, \ z- static volatile int irqraised1 = 0;7 a) ~8 I& x4 r8 q
- static volatile int irqraised2 = 0;
B$ R" J4 h; g8 c" Y - ( {6 G6 l+ f/ C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 F6 b- J! l$ s8 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 E4 h0 d3 Z4 S: j1 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& N' L/ N& J C& W% @
- + g- v! y+ W! Y% S; h
- dma_addr_t dmaphyssrc1 = 0;8 [( I8 u7 x9 V& V
- dma_addr_t dmaphyssrc2 = 0;2 e5 G5 n$ e" n- s
- dma_addr_t dmaphysdest1 = 0;8 t/ y4 t4 ^+ v( T# |
- dma_addr_t dmaphysdest2 = 0;
/ G- T" x( m+ h! K - ; r N* z. x0 [& T
- char *dmabufsrc1 = NULL;
8 J" V! o: O; z6 W0 q; I - char *dmabufsrc2 = NULL;& c! M0 m: ^/ ], _2 K# [
- char *dmabufdest1 = NULL;
5 q& N' C7 E; E0 Y3 u' d - char *dmabufdest2 = NULL;
3 F5 u2 q" f! N: J - ' R% I* }7 B1 x! x
- static int acnt = 512;
1 W4 V# |, V2 ]* Q% s- z" C - static int bcnt = 8;: E9 d2 H( }. p& B( W
- static int ccnt = 8;3 @ X7 w K9 e" G8 T
- $ q6 b% n `2 g" E1 P/ J. f
- module_param(acnt, int, S_IRUGO);
; l& r/ k0 r0 v! k; \: Y2 V - module_param(bcnt, int, S_IRUGO);
: V' A6 c7 B8 Z - module_param(ccnt, int, S_IRUGO);
复制代码
# h2 @0 y1 Q# H, e8 t+ t1 b4 o" W. k( b. H& Z. i* i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 g9 S) H' O, s; ^' A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 Q0 O; Q. ^- y, X; t1 N4 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Z3 B1 k! ~- `1 j
* T: d' U7 H2 V
. s! B2 t; D. N% N |
|