|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / p9 {& Y) J/ E( k! m6 i5 w
- [code]EDMA sample test application
1 J! L, {- l! I9 X5 q( {/ y - /*0 n" i* ?2 {$ u1 A/ s* ~1 }: y
- * edma_test.c3 x7 L# R, V; O5 ~, ~: i
- *
, h0 ]' o8 D- ?! u) ~ - * brief EDMA3 Test Application
% z$ k0 x; m+ \. v5 ~; J# C - *) u# ?3 p: }7 B1 p2 u
- * This file contains EDMA3 Test code.2 u5 Q9 ]" @/ ~
- *
7 f# B: C* c4 N/ u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 D. ~1 c! Z& ~( p. p8 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. v# |# T8 I* U. l+ t - * TO CHANGE.
( _9 D% Z( c: R5 x# c8 d/ G - *
_1 _5 _7 B: U8 [+ q+ B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' J; T9 U: V9 i. _$ q( p
- *
+ I8 v! i: {0 L' D! @ - * This program is free software; you can redistribute it and/or% U$ a# O5 Z0 ^& k" |1 j6 k
- * modify it under the terms of the GNU General Public License as# v; a5 k9 u9 {& n6 O
- * published by the Free Software Foundation version 2.
/ C; a1 S. d: n/ D+ G - *
3 ^: `$ k# R0 g9 M, P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ A! j, d; |% A5 Y - * kind, whether express or implied; without even the implied warranty7 U7 }5 l) }# M% S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 F( q/ Q, ?! y6 W" p; F - * GNU General Public License for more details.7 i; ]* Z, b7 V* Z- y" @
- */
- X2 T Y( E8 E9 m* Y. @
9 ?* ]; M0 j: j0 o1 h( M8 e9 _- #include <linux/module.h>- W5 R9 q0 ]. F& x
- #include <linux/init.h>
+ ]! x8 `& e d. @9 Q2 }4 V2 e4 b - #include <linux/errno.h>
# A5 {7 t. y/ X/ o. W8 s - #include <linux/types.h> x/ @' _+ q* Q! N$ {8 Q/ [! S. Q
- #include <linux/interrupt.h>
1 V+ n: z9 D# {6 i - #include <asm/io.h>0 Z2 v4 [, |6 n% W' [$ o0 M1 ?& w
- #include <linux/moduleparam.h>/ x% q8 p, \* H. n
- #include <linux/sysctl.h>
6 `2 l! p; v7 q - #include <linux/mm.h>
; s% n. `# x# R - #include <linux/dma-mapping.h>3 O5 H8 U: @7 T( l/ h# t F6 n
! Y) U0 ~+ v. J L' y- #include <mach/memory.h>- u5 S9 D7 \: m7 z
- #include <mach/hardware.h>4 P, `. u6 e8 x
- #include <mach/irqs.h>
5 R% y0 R( ?4 P. t - #include <asm/hardware/edma.h>' T/ k$ W& C7 L1 j7 {8 T1 @
- ' J% ], P4 A; b* G5 b5 R9 w0 x( T
- #undef EDMA3_DEBUG
# |: S% o7 v; F- x: o, p. Q: p - /*#define EDMA3_DEBUG*/; I& S( u t: M- k
$ o; ?0 F3 h) v# A, R( _" h- #ifdef EDMA3_DEBUG
) E4 r% `3 F. ~: E$ o/ ~: @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 E7 y5 R/ j* l# V9 w0 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 i6 M* j+ P) S* V0 u. ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), U9 p4 v6 x: u
- #else
8 D l; b& j3 m3 `" N3 e - #define DMA_PRINTK( x... )
5 F$ ?. M% G2 X' p - #define DMA_FN_IN
0 b# C0 }) @/ @0 l8 l - #define DMA_FN_OUT
& M3 d. u: U a: m0 q# c& V- z - #endif5 b& d* Z" f! g# {. I7 ?5 u- R
8 X: m& W6 \) p& Y8 g' B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 F ^' g3 z# z) W - #define STATIC_SHIFT 3
$ w7 i7 X$ A6 ]' |& E - #define TCINTEN_SHIFT 20( f* S7 ]4 m. L
- #define ITCINTEN_SHIFT 21
, L( W- ^' v( v" G2 B4 p' T - #define TCCHEN_SHIFT 22+ P; x- C# }( B% V& E, R$ _3 c6 Q
- #define ITCCHEN_SHIFT 231 S3 p) z( _7 k# D# Y4 }# |5 J4 V
" w# g+ y) `% C7 {: ?( P- static volatile int irqraised1 = 0;- F B/ U! P8 j" q8 d! W
- static volatile int irqraised2 = 0;' L; b" l2 i6 L/ b# f/ r4 b# M
7 {) x& f6 G8 b) `; | c* k3 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m) f& l! y9 D- x4 x% ?. J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 W; A- k* O2 A- M y% i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V" H' n9 j1 n7 R' b
- 0 j$ P* l, K6 l1 u
- dma_addr_t dmaphyssrc1 = 0;) g4 `" R$ ]+ P- _
- dma_addr_t dmaphyssrc2 = 0;
4 u0 G0 g& q) H: g- q8 V - dma_addr_t dmaphysdest1 = 0;
4 a* }! S o* A# [9 i: ^2 L - dma_addr_t dmaphysdest2 = 0;
) b! Y; u1 i" x8 A+ U& d% o- B - B( s: P# i7 j+ _" _$ y1 n# u
- char *dmabufsrc1 = NULL;! D3 o$ G# K) ^9 ]; l: L
- char *dmabufsrc2 = NULL;& u; y& f( \; @9 \
- char *dmabufdest1 = NULL;
; y9 \; u9 t+ ^9 C6 W7 s7 }) W - char *dmabufdest2 = NULL;
~2 y. Y4 k% K8 [, Y/ y# S
0 t9 D6 w- v4 c* U- static int acnt = 512;5 |; d- e, k" \- [
- static int bcnt = 8;
- _8 A Y' d+ D$ F( v. A - static int ccnt = 8;
0 [- {% m9 @0 x
& B5 A" K9 r7 X; T2 q& T$ N' l# `0 u; ]- module_param(acnt, int, S_IRUGO);
N2 o8 J" c7 C3 n" X/ p1 m - module_param(bcnt, int, S_IRUGO);
5 S% w* e4 u6 e/ l+ I( A# R - module_param(ccnt, int, S_IRUGO);
复制代码
t& W1 o% N, G& }/ y: g6 z: \
5 k4 C3 N2 N" _6 p: ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 J; }' f6 [& s: e3 i( P* G6 a9 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]$ y" H( D* c# L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ M1 l4 z8 Y, V5 _. `1 u, u/ U0 \: L9 z" \ s& K: g+ L/ m
- g3 p2 Y# k! |$ m, R0 y9 e
|
|