|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) ?* x/ @, l2 x J4 [" P0 Z
- [code]EDMA sample test application
8 n0 Y m, a1 M8 S9 O/ h, o7 j3 Q - /* t3 n: }, u0 h' \: M* O4 [
- * edma_test.c
3 b1 E$ h7 h! y: O% d' K. A1 R - *
! X# U P/ \ W; g1 ^ - * brief EDMA3 Test Application3 s0 F! V6 S* t# ^: c! K4 `
- *5 ?+ j2 b; y# s- S7 C" H% m( \9 X
- * This file contains EDMA3 Test code.
5 F" \; O# P+ Z - *
3 q' V$ j. z F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 |( \: m7 ~/ B( z) h8 K4 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' j' O! D: z" L8 L! _ |$ X' } - * TO CHANGE.5 ^; y2 m0 A3 k- C. J1 ~
- *
4 P5 _7 e# n9 L* S3 a: l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 V' }" z1 o: L' m- V: s9 o - *, L. K. W2 _8 z- r
- * This program is free software; you can redistribute it and/or1 X4 ^9 H; L# s8 N# l
- * modify it under the terms of the GNU General Public License as2 V S* C: e2 s9 v2 O# U
- * published by the Free Software Foundation version 2.
2 e6 b% p$ t9 A - *- c# V4 t( y; t J, j" p+ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. a3 g/ h1 c# Q! l4 _. L - * kind, whether express or implied; without even the implied warranty# s7 o6 b, K- B+ h& Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) G' T7 d7 c. r' ?/ I/ f, i - * GNU General Public License for more details.
' o3 h3 ^! G& g2 ?- R) @3 c - */& v# [+ a6 ^- y/ N3 T/ \* O
' L- M4 E+ K+ n) T& U; s- #include <linux/module.h>; W' @6 u$ l1 c2 V! T7 E: m
- #include <linux/init.h>
+ l* [* ]7 k/ n0 }1 F' U - #include <linux/errno.h>6 P5 y; B+ y T, V4 v
- #include <linux/types.h>! ]0 R( A6 ]8 ^( a6 r9 W' \
- #include <linux/interrupt.h>' t0 R; p X* q }
- #include <asm/io.h>3 w3 v1 d0 v: C" @2 z, @" ^% a8 @
- #include <linux/moduleparam.h>
! K) t5 \( H& z& n# } - #include <linux/sysctl.h>
: c' U2 j/ b% M E' H! a2 e - #include <linux/mm.h>% a4 j2 D S& U; `- S {; y# k
- #include <linux/dma-mapping.h>: p7 Z- p+ f# b4 F' U+ U
- 9 m4 V+ B1 ^& w H8 M
- #include <mach/memory.h>
* H* T# R& w6 \1 Y - #include <mach/hardware.h>" E& Z) H' K! ~* w: [$ D% s( P
- #include <mach/irqs.h>8 q2 V7 u0 Y, F6 l; {6 E3 g8 a$ r
- #include <asm/hardware/edma.h>
+ W+ \8 e6 g, M) x; {
, R0 z0 I! p: a, ~7 x3 y* ^- #undef EDMA3_DEBUG& p. u) m y/ U* ]. d0 z8 G
- /*#define EDMA3_DEBUG*/3 z# K2 a C7 `- D+ }8 B1 W
+ [1 C4 v4 E5 K- #ifdef EDMA3_DEBUG5 \4 ?1 Q i. B8 g" @0 Q$ V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! u: L" `) F4 X7 h, S" z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 q' a+ ?$ i9 W3 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& F' K$ D' u6 G3 j! h5 y - #else2 V* A5 a( J- G. Z
- #define DMA_PRINTK( x... )
9 X6 y) a/ M3 W, u - #define DMA_FN_IN! D* a) l; m5 V' X) a1 _
- #define DMA_FN_OUT& U, b5 Q, |+ c" T
- #endif
/ `! D- a( ?& a' h/ S
1 @# v& }% C9 W! P7 C/ E3 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* K. T1 p/ v5 h' h1 Z - #define STATIC_SHIFT 3
( l" L2 I5 @9 A: }, p% V - #define TCINTEN_SHIFT 20
0 X. F* k1 V$ @; Y+ ] - #define ITCINTEN_SHIFT 21
3 s* M( y d/ `$ R' f6 o* l - #define TCCHEN_SHIFT 22
3 e$ n. \4 L/ q8 f5 Z# A6 l2 O: q - #define ITCCHEN_SHIFT 23
3 l% @- }8 k9 d) n$ V7 `
& ?. N- e- \8 A0 E6 ?, M- static volatile int irqraised1 = 0;
8 \, Y, B g. Y A - static volatile int irqraised2 = 0;
. G$ ]% z: n2 v. J6 h& ^5 s
, V. y) H/ l0 l: t: r. x& Z u8 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Y! ] `) K# ?" Y: _ i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; J3 H/ q8 W, F7 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# z) q3 X+ e: A, S - 3 j2 ]7 d2 X7 m, M$ m
- dma_addr_t dmaphyssrc1 = 0;2 q0 e j" C- N
- dma_addr_t dmaphyssrc2 = 0;
. X( _* e0 Z4 N& ?# k - dma_addr_t dmaphysdest1 = 0;
8 @1 {. J: h1 a- n. k; @6 n - dma_addr_t dmaphysdest2 = 0;
& Q1 q& ^0 K2 k# o/ Z - 7 D9 l; Y% m7 L4 @" U) G5 x
- char *dmabufsrc1 = NULL;
2 w4 a% \; S' v1 o - char *dmabufsrc2 = NULL;2 ~5 A( R8 j/ I
- char *dmabufdest1 = NULL;
5 q5 A8 C7 J& d% J$ { - char *dmabufdest2 = NULL;0 J, |' r4 l. ]/ d
- ' Y$ E& z# W7 y) B
- static int acnt = 512;
5 R' n ~0 a4 Y S, o/ }# C - static int bcnt = 8;
- Q5 W" h5 z( T) h; U k. B - static int ccnt = 8;
4 _! y2 h+ e9 N. y0 [% s - / u, ^& p) j& ]: |
- module_param(acnt, int, S_IRUGO);/ W$ }4 u0 f) ^* V; S4 i) B
- module_param(bcnt, int, S_IRUGO);
6 G; g% g$ R T p7 A - module_param(ccnt, int, S_IRUGO);
复制代码 + `' I; p% S# C: k7 G, h7 }! ^0 }$ w4 G
3 l9 v8 C6 I+ d) e8 m9 m# N! P3 ^. P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 Y0 U3 Q2 G) U. m3 z1 V+ G' barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 s' [# U6 z9 Z& ]9 p- _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ H$ D0 {, Z' ~0 h& [
4 \3 t" Y" H, [: J" g
1 ~. A- y$ f% l2 k( K
|
|