|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 i% c k7 a) D5 q2 P* ?- s- [code]EDMA sample test application ~" v% N* {3 `- P3 `
- /*
" y3 n, ] b' e; e- l- M' ? - * edma_test.c' E# v7 i. D2 Q7 ~
- *; g. W( _( D$ K3 J
- * brief EDMA3 Test Application9 P- h6 V+ ^+ m0 t+ m! x3 ?
- *: n4 x3 E8 {0 @. n
- * This file contains EDMA3 Test code.
4 q% [ J0 c: h - *' ~3 ]" L% k# N. e* G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: D a2 J! J! n1 p( k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, B7 j5 _! K: ]; W' s - * TO CHANGE./ i# ^& m$ }! H( N9 O& I
- *
" U6 y' a4 t6 t2 `4 n" C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; }7 h& K0 ^: M# {+ Y2 z
- *
. Y% e% t9 M; X1 v2 d- G* S - * This program is free software; you can redistribute it and/or9 k! \, s q$ t4 O& c# R1 d
- * modify it under the terms of the GNU General Public License as
l5 {2 I6 t" g& Q: ]) T* r8 T/ _' W - * published by the Free Software Foundation version 2." P* J ?3 `1 @# C+ u1 o
- *
) P9 g, ~$ @1 a; D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& `+ T# T# W& T% K; x - * kind, whether express or implied; without even the implied warranty" h* I4 d' S+ U$ i4 ?2 E8 W0 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 w! E p1 L4 d* s3 u- _ - * GNU General Public License for more details.
5 ~- I& j N; Y6 j7 Z) v - */9 e; W7 Y. c* C- W+ W
- ' o3 `- w1 {( m1 `+ F
- #include <linux/module.h>6 `* ~, T7 \$ H: H# a0 J6 Y
- #include <linux/init.h>
' Z+ F3 ^; t4 v; }: j) N0 T - #include <linux/errno.h>$ I2 y; Y/ u9 v7 }1 O2 x6 {6 @
- #include <linux/types.h>
Y, q/ y4 G8 `* x1 a - #include <linux/interrupt.h>
/ P: S. A. S" Q D - #include <asm/io.h>
[; O2 n( S3 a2 J/ A% M - #include <linux/moduleparam.h>
: q L& c' @- W& L/ G6 z$ ^* [ | - #include <linux/sysctl.h>
3 g# ?# Z; ^# y+ H2 }( L - #include <linux/mm.h>
6 j; D8 u; _2 x0 x0 U - #include <linux/dma-mapping.h>- p) K7 e0 r& \* z$ Q. X6 D
- 0 R, U+ h3 \; y @. S" b* w
- #include <mach/memory.h>
" {: L2 ]$ r$ y( g - #include <mach/hardware.h># ~$ J5 O" Z: l f# E- ?
- #include <mach/irqs.h>2 D- v3 t6 Q$ \9 m
- #include <asm/hardware/edma.h>2 t5 i5 n5 w" c, @3 W
- : ?$ N- p. H. i. \) M9 d9 M
- #undef EDMA3_DEBUG# e4 R3 T6 u( J; @2 _
- /*#define EDMA3_DEBUG*/
5 E% A+ O! s& C* k - 2 f! s- A5 N$ p" k/ e
- #ifdef EDMA3_DEBUG' E2 P- I# w+ t t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ?" u( J5 \! m1 a" ?2 Z( c7 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y0 N! o: Z8 w- g+ Q: D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ a5 I* [9 g. X0 k% |+ x$ O
- #else `) H, O& S, ?4 n: T$ P
- #define DMA_PRINTK( x... )" i9 X1 ?6 p# Q+ ^5 Z" A u. u
- #define DMA_FN_IN3 G( e' f( p! Z0 ] u
- #define DMA_FN_OUT
9 U5 O1 B9 N) v) p- b - #endif9 W: ]' Y- }8 x) y& [* Z& M
0 V1 n# {: L- O- X! G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 C6 D: ^: ?! u! d
- #define STATIC_SHIFT 3& s; m! u. O3 \/ U! [" r
- #define TCINTEN_SHIFT 20: g/ o1 Y3 ^9 ^3 y
- #define ITCINTEN_SHIFT 21 j2 ?3 I& S6 D0 z) B' ~0 H
- #define TCCHEN_SHIFT 227 x' Q' ~: O* P2 G/ u; `
- #define ITCCHEN_SHIFT 23% y4 e! S5 j: Y( Y$ S* ]# a
- * P- G4 k# D( R3 u
- static volatile int irqraised1 = 0;# q7 ^) l2 |, u; o
- static volatile int irqraised2 = 0;
) w* q, T. H. C3 P5 @( e
3 ]& |6 r0 d, Q# }* j; r" q/ o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 M4 v' E, ]1 ?: i; ?& G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); T! ]0 C7 v0 M$ M# S7 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e2 p3 k9 N: L3 r2 q4 ?* y
- 0 H. ~, l/ L& ]) b, O8 c7 _4 O( b
- dma_addr_t dmaphyssrc1 = 0;7 G$ p, m, R+ G' [ B3 |
- dma_addr_t dmaphyssrc2 = 0;2 {+ \. G" }/ Z' p! e
- dma_addr_t dmaphysdest1 = 0;
8 J; b+ K" _! Q5 T, f - dma_addr_t dmaphysdest2 = 0;& ]$ j) h0 E) @" _# F3 o& o, k
- 1 i; N( m, k4 t; E: u$ M5 ~7 r( K
- char *dmabufsrc1 = NULL;
# l: R9 w- d; d, G |! C8 ? - char *dmabufsrc2 = NULL;
* a* x) Z7 P0 b& P - char *dmabufdest1 = NULL;% R0 l& H& c# f, e+ E
- char *dmabufdest2 = NULL;
# p, m" ^; X$ h$ a, ` Z - 2 }; L5 D. q% b& H
- static int acnt = 512;
8 Q8 H5 `2 o) ` - static int bcnt = 8;1 b( g2 \. V* i
- static int ccnt = 8; H; I+ s7 C P d" K
/ O% D$ M6 s6 [1 q- module_param(acnt, int, S_IRUGO);
1 } _# O9 U3 W: C9 n1 G# J: A9 U - module_param(bcnt, int, S_IRUGO);
0 y O( q( m/ \7 _% S0 _' h" K - module_param(ccnt, int, S_IRUGO);
复制代码 . f0 R, H! z% L8 s' E
1 c5 T6 V! G( {2 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* m# l" L4 g, ~ g* darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, I8 d% f" l. d. v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# C. L# S& H) Z+ M" q+ `8 h
. d3 z/ }0 N& i# v6 ]0 S
- ]' t s1 N7 ?+ {7 ?! v* f
|
|