|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' t$ ]0 Q& |8 y ^. i+ W- [code]EDMA sample test application
J+ d4 T H4 l7 q - /*
; p+ I) @3 ^% g% s4 U' ] - * edma_test.c
[/ G5 B! H" L4 R, x - *
" d6 ]& O4 D9 E6 K! ^+ r3 @% W; z0 ? - * brief EDMA3 Test Application
, J! m* U# y- b - *
; _, ]6 f) R* p b0 D2 r8 F - * This file contains EDMA3 Test code.
4 Z& t; g9 }# k - *
1 n. Z( e7 \* C9 y1 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( u% W W( V: F/ z) a) l. B' s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; H& m" r1 [5 w5 a0 a - * TO CHANGE.- W2 X* F& N3 {3 ~0 T
- *% x) O; n6 V& N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u& j' e7 y- `5 w4 s% k/ }9 P
- *3 _/ _' |- D2 z) w3 ]+ ~
- * This program is free software; you can redistribute it and/or
$ l, ?% S7 {2 A2 ?' ~4 B: C - * modify it under the terms of the GNU General Public License as4 w8 [ K- @& `/ ^# k* x. Q8 s
- * published by the Free Software Foundation version 2.% W: W7 b% j4 g3 X' ^; o$ ^
- *
5 U% R. |; B- H; h, W. B/ U2 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 L6 d* l: T: Y k$ |' S/ x: E - * kind, whether express or implied; without even the implied warranty
/ g# ^4 ]" Z$ p: n: h6 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the c/ c3 G5 t8 M" h4 l4 @. h
- * GNU General Public License for more details.; x; @/ L6 L/ F& ?4 s* N/ }( M
- */
0 E; h, o2 J+ [# J8 B" T y+ v6 b - 6 L5 y- |9 x! C. @! ^6 o
- #include <linux/module.h>/ x0 c3 l; Q9 T4 @( w8 d
- #include <linux/init.h>
$ {6 q1 c; V( {" h; O1 |+ M - #include <linux/errno.h>
6 T1 d: M( Z$ j - #include <linux/types.h>
* \2 z s2 I( g* ?; ` - #include <linux/interrupt.h>3 ^1 P9 o |( Z! |; w7 u
- #include <asm/io.h>
, d0 \% Q: z. r# j# {2 N! m3 y - #include <linux/moduleparam.h>
* ^+ ]0 r) `9 f1 r4 y6 z - #include <linux/sysctl.h>5 S( N* n+ t+ t. j' E c+ R3 o( ^
- #include <linux/mm.h>
; u- K" S8 z. `9 o4 Y$ ?' k - #include <linux/dma-mapping.h>
: o5 Y! \+ B; L( A+ t2 r0 J" p+ O
" u3 e) N; J9 j% o1 o; Y& K- #include <mach/memory.h>5 G+ g1 ?8 X T5 X! {" Q* I
- #include <mach/hardware.h>3 |2 W/ ?- {6 z; _
- #include <mach/irqs.h>
2 ^# m- i/ `* A3 t - #include <asm/hardware/edma.h>4 A" J3 |8 g: B4 @
$ Q! L6 l/ s$ r9 G, j- #undef EDMA3_DEBUG
/ b7 C P: I; z5 e9 T( ~: U4 q) h R - /*#define EDMA3_DEBUG*/5 _2 `5 \7 x# O9 W+ f' Y9 }
- 8 F5 p, u0 O3 j+ @/ o4 c3 o
- #ifdef EDMA3_DEBUG
; r1 W7 ^' Y& |0 X# N0 _ I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 `) `1 U& w/ G' U R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! }! g; m( y# t5 s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% ]8 q& |* y7 S2 l1 A* a. \ - #else
, J$ h0 Z# D Q% g- @4 |+ C - #define DMA_PRINTK( x... )
* b+ r% @! X" l, v - #define DMA_FN_IN
8 Q: u. J( G; ~% n5 M - #define DMA_FN_OUT; u# a1 u0 i: a! M* d5 i' p
- #endif/ e) T4 h. {# `# T
- ! ~$ C- @! e% _; V5 T u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ x8 S1 i3 n9 ]* l" E1 T - #define STATIC_SHIFT 3. Y! T0 k4 t' b# V3 B7 i8 ^
- #define TCINTEN_SHIFT 20
0 D, j b8 w$ l8 ?& T - #define ITCINTEN_SHIFT 21
& p" h! y. k& N4 ] - #define TCCHEN_SHIFT 22
( z K: P4 E/ C/ _2 \8 P - #define ITCCHEN_SHIFT 23* o+ u- r6 o9 }% K# Y
- 1 H% H! @# D, J0 k
- static volatile int irqraised1 = 0;
3 Q$ h# F n* o8 B - static volatile int irqraised2 = 0;' [5 y; @, J1 u! _
- T; K0 C8 C0 W% S9 M$ X( e$ b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% m Y, W$ o9 L8 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% v: L3 u4 Z+ v0 d* a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 |' f7 f0 ^4 d+ n+ Q3 M$ K7 O - ( E K: C7 j2 o) k( {& }
- dma_addr_t dmaphyssrc1 = 0;
# t0 E! q9 {' d# \8 U5 m - dma_addr_t dmaphyssrc2 = 0;
- d5 e& O# f/ F- R: ~7 M2 { - dma_addr_t dmaphysdest1 = 0;; V: ?! f6 h8 T( X+ n2 B4 W
- dma_addr_t dmaphysdest2 = 0;: U3 L6 L# [( K, X+ q" {+ `% `
- % i" t' ?9 D- _) g; T
- char *dmabufsrc1 = NULL;
# a' u, n9 g( ]" f* X+ w - char *dmabufsrc2 = NULL;' T3 {( j( f; e, |( t# j
- char *dmabufdest1 = NULL;% E0 e" ~& m b4 H, n
- char *dmabufdest2 = NULL;7 O* ~/ o5 e+ e- Q) s
- # z0 F+ y7 V! G: Z
- static int acnt = 512;% o. P6 P/ x9 S; B4 c
- static int bcnt = 8;
; y+ y) h4 l' Q, s! E9 M& `9 M - static int ccnt = 8;( Z/ i; g Q/ u5 S
- ) I! @- ?5 l: x n
- module_param(acnt, int, S_IRUGO);. m& m' S+ w1 E0 V
- module_param(bcnt, int, S_IRUGO);) d* n2 i& k# @* |- x D! w! Z4 l
- module_param(ccnt, int, S_IRUGO);
复制代码 " h# ~( i; _5 w6 m+ I, `
x7 F$ w4 K* T T, I" u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 A, u1 j; F! K9 |, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! E+ c5 c+ l3 }2 a8 D; L1 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 X6 S. u7 W" u _ v; Q4 k( T x3 W. B. |! f
4 g% M% F8 ]$ P3 h
|
|