|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: K% K, k( t' `* ~4 O- [code]EDMA sample test application* S* S& |$ x( M( n* Z
- /*( |. I1 h4 C* k' J) S4 U, [& E' Q
- * edma_test.c
Z7 M7 y ?4 M- G6 d - *% l" W! e% S6 \7 k. [
- * brief EDMA3 Test Application
0 N$ S. w5 o n/ L8 @9 H8 S - * g0 g. W) _) t
- * This file contains EDMA3 Test code.1 g) |7 t* m7 |9 ~) u8 p
- *7 j! I5 u; Z) B% C; f/ z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 m) Z, M2 o5 O) i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ e. N |8 L; L4 {1 g5 p - * TO CHANGE.
7 |" w Q8 H: L9 I7 H+ L - *+ H* O/ k! w3 Z9 v) F9 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 O& ?* G3 c5 X! Y% N8 v - *1 H5 b6 {1 t/ ]$ ?; p2 T* {
- * This program is free software; you can redistribute it and/or# N5 P; f% X7 N- u6 F z; C" ~
- * modify it under the terms of the GNU General Public License as+ v( V4 N7 t5 |3 y1 b4 ]* u
- * published by the Free Software Foundation version 2.
% l( G% R8 V" X - *3 \' N$ q( l( G8 M7 R+ z' l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' H: ?; ^, l0 A
- * kind, whether express or implied; without even the implied warranty
7 _/ p- e/ U+ W/ ?( V# m3 }! B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ C7 M/ X" R+ V, A1 f - * GNU General Public License for more details.5 x7 T+ \4 _4 A8 M
- */
# a0 b& B$ e+ c. J; o* ]8 z5 ]
7 @- w) F+ ^! l+ q; j" r- #include <linux/module.h>
' k* J; m. Q1 ]& ] - #include <linux/init.h>0 r! L5 S0 L- Z" a, T" t
- #include <linux/errno.h>) F6 ^" f3 G- B0 Z
- #include <linux/types.h>0 ^( H0 `! R- W) e
- #include <linux/interrupt.h>! Z% S& y3 V! R7 Z
- #include <asm/io.h>
% a! \8 ^# h: h- ~ - #include <linux/moduleparam.h>: M/ f- `' O9 @8 g9 O
- #include <linux/sysctl.h>
, ~5 G6 D+ r* X: T3 m( g - #include <linux/mm.h>2 [# b; r' d+ R/ V1 v. c
- #include <linux/dma-mapping.h>6 w0 h# q8 }( x
- * @9 m. Y9 m7 }* p' `& P/ U: l
- #include <mach/memory.h>
. J6 ^6 a- V$ D/ H! h - #include <mach/hardware.h>
7 E9 m1 b7 V0 }8 S: r$ F7 T2 M8 r - #include <mach/irqs.h>
5 @, @0 s8 v: J8 _! y% o, m8 n - #include <asm/hardware/edma.h>
- p7 D. v# O' s5 a/ p
; D: a2 R; J8 N* A7 q. d, m- #undef EDMA3_DEBUG
- ~+ q9 p/ {% x. Y+ P3 t" G5 R - /*#define EDMA3_DEBUG*/4 J0 L" T% p5 r% j' y3 w2 l
- % t! M( @! S2 O* w- T' y7 N
- #ifdef EDMA3_DEBUG
+ k. S0 A0 l. l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 @; Y( j8 v+ r2 `/ m P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 l v; D, }4 f2 K* z- O4 v, e# A& j: r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! f& J6 V8 ?0 Y8 W) z8 F; F/ e! I - #else; K) B1 W( B: s, J
- #define DMA_PRINTK( x... )# c3 I; J9 x9 ?$ ?$ ~
- #define DMA_FN_IN
" k k6 I2 `7 ?+ B8 r x - #define DMA_FN_OUT2 j" G: `- l9 x d x+ K" ^
- #endif& _/ o% F7 X4 ^) N# |7 U
: B+ w3 B! S8 x0 g+ E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& e0 M) I; V u2 b - #define STATIC_SHIFT 3+ Q/ b7 w- x2 X6 C
- #define TCINTEN_SHIFT 20
, q. ~/ a% m8 x3 t0 V; p3 W - #define ITCINTEN_SHIFT 21
$ A; S7 R3 J+ P" f' d- J$ X - #define TCCHEN_SHIFT 22& o+ O# _. h. e9 A, B* C; J) a
- #define ITCCHEN_SHIFT 238 i' [; X8 R- y" Q# }& V# G
" Y% ~. K/ j# n- static volatile int irqraised1 = 0;/ R6 |0 C% e& Q3 g1 c
- static volatile int irqraised2 = 0; G. K& s0 \7 v+ Y- P* f- [
- 0 J6 l. H% A7 V- c$ x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. v6 H i2 c; E! R6 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- @+ I/ M0 V9 H; V: f2 S0 d6 ?2 U: N& o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z; R/ |$ ^. H, T9 I7 b1 a5 N
8 K+ Q5 W0 a. w# ]' h- dma_addr_t dmaphyssrc1 = 0;
9 Q# `) D A/ }0 ?4 d - dma_addr_t dmaphyssrc2 = 0;( C, o$ t& A. v7 E$ `4 J
- dma_addr_t dmaphysdest1 = 0;* B. o0 `) v: b+ j3 T! v2 q! R
- dma_addr_t dmaphysdest2 = 0;
/ W) Y n" `1 m; O6 P2 U& L$ E
# v' [( J5 d) q+ J, l% m+ _& O: F- char *dmabufsrc1 = NULL;8 y5 q/ y) w) E0 ~$ _) H- x# K
- char *dmabufsrc2 = NULL;) A) L" o9 g( L0 ?, x
- char *dmabufdest1 = NULL;
0 H) }: Y H# v& e% V+ o - char *dmabufdest2 = NULL;
/ C0 {% b. p1 L! a# n% o9 s4 Y
, v& }9 {8 i) M+ k7 [- static int acnt = 512;
* ^) I1 p5 P. @& N- v - static int bcnt = 8;
" ]2 F4 ], X! w - static int ccnt = 8;: w# ]0 c3 S0 J# m
/ e% E: B$ c- a. L3 g7 a. P- module_param(acnt, int, S_IRUGO);
( ?) y* n0 U" c$ a) U - module_param(bcnt, int, S_IRUGO);
' o9 u8 s4 Y: x& s - module_param(ccnt, int, S_IRUGO);
复制代码
7 M: p+ ?( h& Z% A
0 |) y# G% u6 n' I2 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- O+ X; W0 k! U0 v& M9 ?2 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* r/ @0 g( ]8 P, K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 a1 @0 X6 Y. G: c1 R) u) e M
/ p2 a/ P8 b1 s& L* e
# ]* n2 W( [* ]! O |
|