|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 N" L+ L6 j; a, N& Q4 k: r
- [code]EDMA sample test application/ u! r c/ V/ [" R1 P$ u( ]' [2 z! M
- /*
1 F7 f, o O6 c# p( z4 E2 l - * edma_test.c
}: V# \% Z* o: x' x - *5 v8 d0 H- I# a. k* a
- * brief EDMA3 Test Application
, i# v+ X) P& ]$ {' V7 P' f - *
/ i6 d3 ^' B2 I! h* t3 l - * This file contains EDMA3 Test code.5 V L' U2 x0 @2 i
- *8 K8 D8 i9 K& ^. f) i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( v7 k2 U4 ?4 n# N8 a4 y# B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; Z1 B$ r" Y5 ^: R2 h+ Z - * TO CHANGE.5 u9 j- x! H$ A; d: N) c
- *
7 O4 d* @/ f) O& a9 p+ [2 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% a, C4 B% Y) d, @5 M - *% d5 U- Q0 r0 x9 @
- * This program is free software; you can redistribute it and/or. t3 u C @! A- Q! s9 E
- * modify it under the terms of the GNU General Public License as
; J" \1 M- E- \1 |: b& ~ - * published by the Free Software Foundation version 2.
$ Q& q1 N, G; e b& H! u5 V- R - *
" z2 j+ B- S2 T6 d9 n' \& |- ^$ u4 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, z+ b: E3 L* r9 l6 V2 k0 K
- * kind, whether express or implied; without even the implied warranty; ~2 Z3 K( D- c' u! s5 H8 B6 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 X! X" v' F5 y: P5 b4 \* Y - * GNU General Public License for more details.# s; `; u/ U& G0 S: x' T2 D
- */
8 f! z5 _' F$ A9 G j4 r - # h$ a$ Q A7 |' G
- #include <linux/module.h>
% _. S* ]3 _1 ^" Y4 ~6 V1 B - #include <linux/init.h>; ]" X0 f: G4 v8 a+ T
- #include <linux/errno.h>
( ~: x" K# c4 i/ l9 s; _8 a - #include <linux/types.h>
: j& |2 G- @" x$ h3 q - #include <linux/interrupt.h>
1 G8 W5 g4 K( s$ E; i8 V* \ - #include <asm/io.h>
/ E3 J* I! S9 U - #include <linux/moduleparam.h>
/ u/ r1 b3 |4 O8 n - #include <linux/sysctl.h>( @7 i) r8 O: P
- #include <linux/mm.h>& Q4 q1 Z* `/ S1 [" w6 t" h+ t% C7 Q
- #include <linux/dma-mapping.h>
; Q( |9 p( o' r, E3 @- q - 3 v) {* r5 s' U7 n
- #include <mach/memory.h>; {3 f8 `, P7 F4 u
- #include <mach/hardware.h>4 q* y7 F2 ^9 n
- #include <mach/irqs.h>2 z- q$ B1 e3 M2 E5 P4 G6 u4 m; p3 z
- #include <asm/hardware/edma.h>, X/ j2 S0 c( Y
- 9 _/ H$ @6 A. ]; S. L
- #undef EDMA3_DEBUG
3 G! J8 C! x! F! [ - /*#define EDMA3_DEBUG*/
5 P0 M6 J; B0 Z4 E
. D8 X* @; H2 Z- #ifdef EDMA3_DEBUG$ B6 Y A8 m- _- |( f' [/ H8 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! _0 j: B1 @! w1 M7 g- f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 ]( \$ y4 O0 @# o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 u4 H1 W- D( ^% w% ~% y - #else
# W6 t& M$ O9 m - #define DMA_PRINTK( x... )
) h6 T! O: u# U, q - #define DMA_FN_IN
- u0 R. g q+ o- h3 n2 w1 ?. x6 J2 X - #define DMA_FN_OUT3 d9 s% X5 N0 Q) u& U" s
- #endif
- f. s- D. ~/ N
% c1 b l/ N! A" X& j5 A, N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 Y9 V' C" ~( Z+ }! w4 }6 p. x+ i - #define STATIC_SHIFT 3
( P' A0 z: J5 U v4 i: k - #define TCINTEN_SHIFT 20# u" O% b$ Z4 o' T2 C! I
- #define ITCINTEN_SHIFT 21' \/ @3 ~& b+ ` x$ U/ b
- #define TCCHEN_SHIFT 22: R, L, _0 H8 W6 X |7 C
- #define ITCCHEN_SHIFT 23" n' u. m# i' ^% ?% v
0 N* }4 A* W8 O( V8 l0 b, V: [- static volatile int irqraised1 = 0;
" |4 j( ?+ W8 L7 H - static volatile int irqraised2 = 0;+ [7 p5 M3 f; {, ^# ^! n9 G* E
- & c/ i) F& X$ y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% R) `3 _& ]6 S/ v0 {0 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); d5 b0 Z# S1 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ r5 ^$ A# ~- @7 |
4 L1 U i) t8 v- q& a9 w2 a- dma_addr_t dmaphyssrc1 = 0;, i3 }& H, n& ~( }) q
- dma_addr_t dmaphyssrc2 = 0;
& t/ H0 v: N8 P+ D - dma_addr_t dmaphysdest1 = 0;& H2 E. k: N4 R0 z' d
- dma_addr_t dmaphysdest2 = 0;
" h% g5 \ ^ A$ z7 N) }4 u
- J9 Y" R, j& K3 v* X! Z- char *dmabufsrc1 = NULL;* `( E( e5 Z. c n6 m$ P
- char *dmabufsrc2 = NULL; h3 J* n E0 ^6 ^' F/ v5 l
- char *dmabufdest1 = NULL;/ J: j: o: k# \' J1 j9 _; Q- i
- char *dmabufdest2 = NULL;
0 h/ w4 _9 i; v9 k; W- v | - ) l" G9 y% p: e# F: L4 `+ ?3 R. u: r
- static int acnt = 512;; a, @' T+ X0 ^
- static int bcnt = 8;
5 {. j% J' j- m2 V - static int ccnt = 8;
. ^+ @$ A2 {6 j$ T$ C' p5 p& f& R - 7 J6 U6 B6 e" |4 I g
- module_param(acnt, int, S_IRUGO);
" H* x* u) T' p" B/ k) Y - module_param(bcnt, int, S_IRUGO);. ^+ T6 u# Y4 Z- P
- module_param(ccnt, int, S_IRUGO);
复制代码
4 m! U; {( }; G L7 d) Z- s8 q0 M- ~. j2 T0 }* N* v t5 T. E+ H* ]' J* _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* J# d, H1 |% W) a) S$ P2 z. xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: t: D) O% q% @2 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 G' ?! F! m9 j8 c
) }7 {6 ?+ v- ^' ]3 a5 X' l& J
|
|