|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ?* e# S* G9 x0 `% d+ J- Q- [code]EDMA sample test application$ k! w! o$ I/ R+ R9 }
- /*
9 g& K3 A2 [" h* n - * edma_test.c
) O3 V, P6 Z4 A - *
4 b( l" u9 p8 o/ ?! U7 } - * brief EDMA3 Test Application
* Q8 k6 E( C' O: x( L4 K6 c0 ?/ | - *
5 M* N! r% _3 f V) b# y% _1 @0 m9 e - * This file contains EDMA3 Test code.
2 q: C4 B) V! t& H - *
B- F' x, B0 X y" f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# w: s9 U) a/ e2 r: Q) E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 j7 g1 a$ V# l. I, c
- * TO CHANGE./ b8 v8 [; T0 u
- *
, N2 X: i, p2 a M4 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; |% w8 }2 i5 l8 n7 ~- @ - *3 }6 T. s g& j2 f/ k' M+ l z
- * This program is free software; you can redistribute it and/or6 }( `, i. O8 ~* D( Z) |
- * modify it under the terms of the GNU General Public License as" G6 X% l) t# z4 V
- * published by the Free Software Foundation version 2.
) }0 u8 u8 { j. L. V$ F+ U$ ^ - *
" G' E- e1 f3 r6 D! T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' @; o7 G8 Y+ T* w* d( d - * kind, whether express or implied; without even the implied warranty4 x! y6 o/ H" _2 P1 _4 {! I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ y. x1 Y. B3 u" Y* Y) |
- * GNU General Public License for more details.
- s' ~6 ]. i ?+ d - */
9 T; X, ^( ~, P! S; ?7 G4 G$ q
2 g( F$ |; a( k3 y" b- #include <linux/module.h>$ x2 ~& H* ]5 e2 L4 i
- #include <linux/init.h>
* j* M" D4 `( L# K+ R0 f+ X - #include <linux/errno.h>" C$ c% i1 N8 F( J" F+ R. [# |
- #include <linux/types.h>
: C/ e1 c& j3 j! n2 U - #include <linux/interrupt.h>
! V2 K! v+ Q9 @5 M/ ] - #include <asm/io.h>
) i" X% R# o$ d# ` - #include <linux/moduleparam.h>+ I6 q- y8 r; `" I+ {. \# Y! R* \' X
- #include <linux/sysctl.h>
/ X7 J( \' Z$ J% m- I% f - #include <linux/mm.h>; n" j9 L0 r# ]1 V4 H
- #include <linux/dma-mapping.h>% o& o, T5 a$ S" d; Z
; a8 M E! i$ b+ G# g4 i3 N' }+ G- #include <mach/memory.h>
; v. I# H% G$ S2 s* y - #include <mach/hardware.h>* O, Q, s" r# x+ `- @
- #include <mach/irqs.h>
# z% u( E2 y& ]+ G+ z1 c1 W. L - #include <asm/hardware/edma.h>
' B: v; ^$ h+ m; y: p1 c - 5 @, }. F- X* q7 q p T
- #undef EDMA3_DEBUG
3 ^8 W- [/ U- V5 z4 `% p. B - /*#define EDMA3_DEBUG*/
+ v! @( ~! V3 P. |, ^
4 j/ R5 S7 C' S7 T! v [+ r- #ifdef EDMA3_DEBUG' u E/ e5 Z+ A6 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! w# B! A' k# o: o5 U$ G& q1 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( G; ?) _5 j' X' s$ T m" x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 `% m. n9 N0 ]3 \* R - #else5 N& `' i+ T& F
- #define DMA_PRINTK( x... )
; |0 g- G& N9 R# f7 s0 _ - #define DMA_FN_IN
7 e: c6 I; D' F- F0 J - #define DMA_FN_OUT
( V' q u8 g! t1 N& q0 z; c - #endif
+ L( p9 {" D- N6 v7 w6 Q. f - * ~/ ]5 Q5 j: C/ c, U" f D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& f6 u9 m$ Y' s* {7 B5 Z - #define STATIC_SHIFT 3
$ Y8 U3 w# C/ _ - #define TCINTEN_SHIFT 200 f% F) H' }9 _; P
- #define ITCINTEN_SHIFT 215 O' Z" d3 f' U6 {9 d
- #define TCCHEN_SHIFT 22
9 b& A$ P/ e$ {8 i4 |) O - #define ITCCHEN_SHIFT 23
: ]( j/ r8 q$ X. m4 u- v3 A - ! X6 E( s3 j$ Q% e
- static volatile int irqraised1 = 0;
7 ?7 D3 |5 V' ? l i/ {3 k, j - static volatile int irqraised2 = 0;: K6 ^" H! X; p* D
5 m; s) A @& P- c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Y. v9 ~- F' ~5 T5 J5 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% v2 X' @$ {* x/ N" w8 x( b8 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* [, r1 x4 l8 V# Y4 |) b
( g7 t' w+ p g" D5 `( r' ?- dma_addr_t dmaphyssrc1 = 0;
- d- ~+ p& o. i1 o5 m% N, V# t - dma_addr_t dmaphyssrc2 = 0;
( f T9 j/ l1 T1 }8 N# M - dma_addr_t dmaphysdest1 = 0;# B) J) b6 K n7 p- j+ x. j
- dma_addr_t dmaphysdest2 = 0;7 F; W0 E$ O7 T$ J; W
- 3 U; R2 S. i; _6 i4 v" ^6 o
- char *dmabufsrc1 = NULL;! r2 e0 Q% `5 N- K! N: J N& E
- char *dmabufsrc2 = NULL;
" C- ~. ~1 ~/ L( g K' a6 U - char *dmabufdest1 = NULL;1 c9 T. o: t7 c- I2 e7 M$ A
- char *dmabufdest2 = NULL;
( e q( a$ @" z6 X S3 S
5 }3 s w& B2 G& S- static int acnt = 512;5 M: q5 `8 p% m
- static int bcnt = 8;+ L8 l/ J3 q% e, r3 w$ z
- static int ccnt = 8;
! E, i( e; k ]9 P. q; n% f
6 L G# M$ q# O- module_param(acnt, int, S_IRUGO);
, M( V4 g, I) ?) l8 \8 C - module_param(bcnt, int, S_IRUGO);+ o9 B# c! ~5 n- G% |6 \
- module_param(ccnt, int, S_IRUGO);
复制代码
* ^$ T" @5 ?) N$ c/ [
6 n" t" n: ~+ U2 r: T* _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 g) G: f. a. D w7 g5 X* rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" J: p& v) l2 A% X) d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 I8 r% N5 h6 Z/ W. o2 T
' K6 E$ p/ O+ s3 q4 S4 }$ {
! T4 p" ~' |/ i! u7 E- s |
|