|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- v" g" @' H; c0 i# h- [code]EDMA sample test application
H: e5 X1 k T7 P0 r4 e+ \# ?1 t - /*
8 O* z% j4 Y* Y; x# L) B; t - * edma_test.c
* P- Y/ E: T$ _; r2 Z5 X: O - *
Q( F7 h6 O, ` - * brief EDMA3 Test Application
' ]0 I7 F5 e, z: s" _4 j1 B9 p' J - *
2 _& k2 U+ {3 ~5 p0 K+ R8 n& R - * This file contains EDMA3 Test code., q; J/ H; G7 M$ M- ^
- *
; h) |7 u& u- i$ n8 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" t" R% G" m0 f/ o; Y2 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; P; o& z# x) f& `/ l
- * TO CHANGE.5 U8 D* [, c% ^5 j( ~2 I* n
- *
3 J' s! J5 t( j" H, ?1 |- o' Z% K; O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 g/ E1 j) X# q% I - *
. w# j- l3 @' k% W6 y5 ^8 ^) F - * This program is free software; you can redistribute it and/or, v8 v# C/ j/ L. E3 `* |
- * modify it under the terms of the GNU General Public License as) E( K% ^6 B) B9 m7 h" K6 ]
- * published by the Free Software Foundation version 2.
5 a/ R" n9 [5 ]- ^6 @ - *9 N$ A+ Q! L0 B& P! a! ]6 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 m$ e5 y+ `1 `1 p$ S( o6 A
- * kind, whether express or implied; without even the implied warranty
2 g% H! q7 I. {( ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ N+ e* C) x8 v+ N - * GNU General Public License for more details.5 d0 O& f+ B- Z: P, X& _* T- _# P
- */
# Z w. I7 m/ m
& \, C7 }7 f6 N- #include <linux/module.h>
# ]$ p7 @$ a' C0 T - #include <linux/init.h>
4 E8 E) i8 M- N' v4 f - #include <linux/errno.h>
: B. q' u) P0 N+ u3 ~: h4 l - #include <linux/types.h>; y" g1 x H2 H( p. I7 i
- #include <linux/interrupt.h>+ k& m% B8 x3 o: Q' m
- #include <asm/io.h>
/ }# W, ?7 { G, ?/ J - #include <linux/moduleparam.h>
% O4 W5 T5 O! r- \ - #include <linux/sysctl.h>
& ^7 h7 z- [) H4 e - #include <linux/mm.h>* e" H0 v, O" f0 u
- #include <linux/dma-mapping.h>
; R% }( x5 F7 Y - 9 ?4 W: @& Y o X. u |/ ^
- #include <mach/memory.h>
' ^: e% a! P5 |! k - #include <mach/hardware.h>- y% W8 ^3 ~1 A% a; p
- #include <mach/irqs.h>0 U1 @5 t: K! \" T
- #include <asm/hardware/edma.h>
# u1 v( Q0 h# }/ Q: j9 h
$ I- a" _5 d! G3 I# s/ T# k3 n/ I& @1 O- #undef EDMA3_DEBUG
+ w' v2 F6 z0 h - /*#define EDMA3_DEBUG*/
+ a$ ?2 v3 B' W% L
4 y# C5 i. j5 {- L- #ifdef EDMA3_DEBUG, b% D! b4 _4 \6 S2 N- I; W, l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" c5 O0 t& O* Q# x7 i8 |( u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' K& e9 U. \+ S$ G& f+ J" u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" k" K3 L/ A+ p2 m% n( s% _' }, G; e: o - #else
" N7 M1 J8 [% K# o - #define DMA_PRINTK( x... )1 K5 ~! s' E0 C3 _
- #define DMA_FN_IN" [( A& p4 u. V
- #define DMA_FN_OUT+ R5 A1 ^1 |$ M/ s A
- #endif
7 O& n* o2 |3 R1 ^& R
( D7 V8 Y. r# k/ _% R$ {% i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 q( P3 ^7 r& I: ^9 J' U
- #define STATIC_SHIFT 3" a8 _! O7 t4 v1 h1 v4 N
- #define TCINTEN_SHIFT 20
; b3 @4 {, R( B - #define ITCINTEN_SHIFT 214 I3 C. ]6 \# `& Z/ \2 z
- #define TCCHEN_SHIFT 22( Z4 w* w# \; d; R
- #define ITCCHEN_SHIFT 23
6 n( T5 R9 K s4 {: l( j
& Z, o3 L6 ]* O' ?. e" O1 q- static volatile int irqraised1 = 0;
3 H5 X( x* |) A5 L: R - static volatile int irqraised2 = 0; r9 K6 S$ E. X( Y+ Y: M: s
- 1 D' U& r; y5 ?/ h# N) e0 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 W: S5 @! M% n1 w% g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f4 K# I- s4 h- g; ]) _ L! J5 b6 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 D, ?6 O. N" P3 u% A& v1 v
- 9 S5 \$ J5 }' n1 Q5 e4 E
- dma_addr_t dmaphyssrc1 = 0;
* X8 @$ W. L7 Y - dma_addr_t dmaphyssrc2 = 0;
7 Z7 s# t) U% g$ }" ]) p0 H# d - dma_addr_t dmaphysdest1 = 0;
* U- B e8 l4 R2 F" P - dma_addr_t dmaphysdest2 = 0;3 f, e$ L1 l6 r2 n" j/ V6 |; n3 X
- / i- L/ K) c1 y
- char *dmabufsrc1 = NULL;9 \6 y' I6 ?, w
- char *dmabufsrc2 = NULL;
. n* e, O2 |2 ?$ |: d7 K# K7 o - char *dmabufdest1 = NULL;
6 l Y+ D$ I1 R% r; k - char *dmabufdest2 = NULL;
( C i) ?! @' m( d+ `: S6 R9 ?( w2 @ O
3 x" \5 a8 L* V- f- static int acnt = 512;; c! `. X0 E( M* `9 D
- static int bcnt = 8;. j, R8 j+ R8 _$ u3 A$ T* P
- static int ccnt = 8;! M% `3 ^1 m% F; Y( q/ S
9 z; U j7 \* w5 g2 z- `- module_param(acnt, int, S_IRUGO);$ ^9 k' h+ T: ]' T' t, N/ a7 i. o
- module_param(bcnt, int, S_IRUGO);
7 }3 B @! p% x3 |: B1 x" q. R - module_param(ccnt, int, S_IRUGO);
复制代码
# O1 A H( o" G1 a% b
) T! B. g7 p: t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Z$ _8 q; Y; F9 Z, Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* K1 D/ C) K/ r5 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) h" C( @! C& _, V ~5 m0 J' r: F- [% ? U2 q" b
+ P7 }+ T& p; B5 c1 {# f: u |
|