|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* y, X! t; m2 O& b& W& M! K- [code]EDMA sample test application+ x" C1 q* t% z$ j, O
- /*3 N) \* m) {- \8 R3 Q
- * edma_test.c
1 ]! G2 z% h5 D! ?+ {: C - *: z l; i3 Y+ _
- * brief EDMA3 Test Application
5 t. N; L5 Y$ X6 n - *
/ L: z& J' E. l0 K; ~# J6 _+ ] - * This file contains EDMA3 Test code.
4 D+ d) D7 w; E; X/ @ - *# G2 {# b5 [% X0 }7 ~6 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ L5 @9 c! ]6 h' J# f+ O" O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* h7 q- w7 w: A% ^0 ~ ~. M1 t+ H* Q - * TO CHANGE.
2 }1 I }5 D+ p0 \1 R - *
5 h6 H; R6 R2 F2 H% ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& X) D) m8 _& M8 d) w$ \. P0 |: h. f
- *2 w% D. ?6 F8 b5 h
- * This program is free software; you can redistribute it and/or# Z8 [, ~$ \; Z" ?3 w
- * modify it under the terms of the GNU General Public License as
6 e* G# z8 A, T' l3 f5 a1 t - * published by the Free Software Foundation version 2.
3 [7 M% Q: z, e1 z7 ^. W - *
" o6 N; ^( ~5 V$ z/ Q* S; O' S" I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: X1 ]- ^; c3 b6 K. ~/ s+ H" H
- * kind, whether express or implied; without even the implied warranty$ V9 C( o B% K. V7 K& N" h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! I2 E- ], R v: s) b - * GNU General Public License for more details.
; r% J/ K5 u" h6 |0 P - */- B c6 X' c# R
- 5 O D9 h3 I" a- T3 R- p
- #include <linux/module.h> k- B" K C! m& C, `
- #include <linux/init.h>8 N3 l( H" M% B9 g7 a4 D* L
- #include <linux/errno.h>
% w; H$ G: j. O - #include <linux/types.h>
4 ^2 ?" [5 H. L& ]7 r - #include <linux/interrupt.h>6 v/ F; G; C3 K* J1 r
- #include <asm/io.h>& \ M2 E2 {" T% W% U" X. s
- #include <linux/moduleparam.h># `& \* ~2 B. i! k
- #include <linux/sysctl.h>% t) j V w m/ Y, {5 n
- #include <linux/mm.h># U/ D9 Y# I$ n! W. f) s0 s; k
- #include <linux/dma-mapping.h>- ^: W% K/ _4 i; [, a2 ?% Z
- : U9 _; B0 i7 _& R3 L/ f! q
- #include <mach/memory.h>
8 P$ P# y8 C+ a* l" G - #include <mach/hardware.h>
5 P! p) u& |% v - #include <mach/irqs.h>; Q k6 D7 G8 P+ x7 y- u
- #include <asm/hardware/edma.h>
1 H: B j( T& {" B& G, y
& e/ I0 d+ j3 r4 i8 P- #undef EDMA3_DEBUG
, W5 W) {0 @2 q- p+ b& D" E U - /*#define EDMA3_DEBUG*/3 i: [ D' T) e
- ) ]; g% ?: R0 a" n8 ~* t! M+ ]
- #ifdef EDMA3_DEBUG
5 l C* f& T" N% u5 E& w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): e! W+ Y; ^& A) D1 o7 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Y0 J" C7 Q/ ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Q' t( Z8 s2 r1 N; u5 n7 l
- #else1 `. j% M. F- K3 M
- #define DMA_PRINTK( x... )
8 `0 l6 M6 M' z8 C* L5 c Q0 d - #define DMA_FN_IN% R: y" c, @9 M1 [' f
- #define DMA_FN_OUT
O. _% S% o3 g7 C - #endif
- |! }, ]# p5 T3 F+ K - - o& q- {1 k3 w7 X4 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 q6 X! N: K$ P - #define STATIC_SHIFT 3! ?; P k6 K0 ?3 l. O$ a% @
- #define TCINTEN_SHIFT 20
# J& }1 \( a7 C x - #define ITCINTEN_SHIFT 21) [, E" N# l1 I/ b: P: w
- #define TCCHEN_SHIFT 22
4 @, ?* l2 |4 z+ d - #define ITCCHEN_SHIFT 23
" p0 m5 d; Q K D% X9 w. I8 E - $ `) V. r1 c7 U* l" t6 `; ~
- static volatile int irqraised1 = 0;
/ H7 I3 c$ V+ E# g - static volatile int irqraised2 = 0;+ d4 s1 p) J! @2 a
- ' H( R0 F# v5 ~4 `3 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 c3 W" H4 r: Q j! j3 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A( e8 w; F' s) q0 t8 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h' q$ z# R( D! ]6 f4 g. O: G1 y
) H- }- i5 T. ?5 J- dma_addr_t dmaphyssrc1 = 0;
# y/ G2 e4 P! q. Y, F$ v: T' N) O" ~ - dma_addr_t dmaphyssrc2 = 0;
1 i. r4 H2 y; V+ O% e# c - dma_addr_t dmaphysdest1 = 0;
4 Z3 z' V0 P( T. [ - dma_addr_t dmaphysdest2 = 0;" e4 \/ j9 I- s6 s2 D
- 6 x! s" V7 W- y, L0 O
- char *dmabufsrc1 = NULL;
% I% d6 G3 a! v1 _ - char *dmabufsrc2 = NULL;4 O4 h% q# T7 ]' L) T" s" B# m- X$ } {
- char *dmabufdest1 = NULL;
7 P4 h, V z5 Z# d+ j - char *dmabufdest2 = NULL;$ e( z0 R) G! F* v: c e2 E
$ [& p- _- T3 q, }- static int acnt = 512;
& W6 ~2 x0 U' c9 O! a - static int bcnt = 8;
T, z% w- r7 b+ w" x h5 n - static int ccnt = 8;2 G; K- ?3 B3 X
0 j( F' u& U( X' ~- module_param(acnt, int, S_IRUGO); u) ]) K, i& B$ ^
- module_param(bcnt, int, S_IRUGO);# C2 A4 F" U' b. ~4 u4 o3 O6 f
- module_param(ccnt, int, S_IRUGO);
复制代码 ) [" I* c B3 y/ x( d# S
4 u1 i& o* N7 ^! r4 T; W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 s0 J G$ S1 X$ {: t8 e4 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) f- o C" E9 R! d' K# m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 C' _: i/ u) t
- n& _$ ~& z8 c/ {2 O( h
9 J+ M' s, C x' P |
|