|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % B3 y7 i" v- w: |1 H
- [code]EDMA sample test application! F3 v! _2 s$ t) j
- /*3 b7 K+ Y1 B5 ~6 z
- * edma_test.c
' ?: L. `/ R, g - *9 ?; N" d, b: i, ^8 q# m
- * brief EDMA3 Test Application
/ X9 C% z% a0 E. L - *- T* q+ b* n! ^8 ?: @% l- V/ }
- * This file contains EDMA3 Test code.5 |, n% `1 n$ g3 M
- */ S/ Z, \1 Y; o7 A& _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# q$ @% Q8 [/ K' N f& A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ o; L+ ]8 e0 N# P- ~9 g
- * TO CHANGE.
; `, B: K C9 q6 b - *! Q: E- n7 f' p" x% M6 Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 b% d$ \$ ]$ G/ [. V8 \4 P - *
; L: u' |% ^' \: I6 J - * This program is free software; you can redistribute it and/or; Q+ B3 J! n: v! A) n
- * modify it under the terms of the GNU General Public License as2 N0 s+ s4 n! Q9 V: I J ?# M
- * published by the Free Software Foundation version 2.
( z8 I& |+ k: L1 Z+ B - *
' m) m( N4 g/ L3 B3 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 m: ]0 i* w) u, s
- * kind, whether express or implied; without even the implied warranty
0 }5 U! |% q9 n( M' ]$ I) k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 q# u& G. B# b) y - * GNU General Public License for more details.
; R. B6 j" v g! O - */* _0 @. x1 t* o! l4 o3 Q1 @
) G( f6 A6 x4 j3 T: |) _. T! P- #include <linux/module.h>
5 @" _5 V! d- d, N - #include <linux/init.h>
5 c% f7 o4 ?6 N. l4 b: _+ [5 f" E: m8 j - #include <linux/errno.h>' k9 Z9 J. }3 ^% x6 o9 E
- #include <linux/types.h>$ v4 b; h1 A. v1 Y0 l5 V/ J
- #include <linux/interrupt.h>+ {: B0 [9 A/ y% g1 q
- #include <asm/io.h>
0 d" b2 G/ l+ n" d) p) \, v - #include <linux/moduleparam.h>. S: {# \4 g! I" e, P7 _# B9 s; e
- #include <linux/sysctl.h>) y. m+ x5 B) l0 y
- #include <linux/mm.h>
) c) d5 |; V' H" q) X - #include <linux/dma-mapping.h>
& _2 [( |# r% g$ R, k4 @
' `7 F1 `$ d( S9 ]/ B# E; Z! Z$ X- #include <mach/memory.h>6 V" E! d5 ]) R# x
- #include <mach/hardware.h>
) r8 k/ D% h9 G6 W$ } - #include <mach/irqs.h>3 k+ o" E( C5 ?- s" j
- #include <asm/hardware/edma.h>
J/ L, e; P7 x2 D3 q1 }. P
: P, [2 u$ S) Q* {3 T: N8 I- #undef EDMA3_DEBUG* N8 h8 P; d4 E) K. l) f6 z
- /*#define EDMA3_DEBUG*/
, [- v, W$ I9 ~4 w0 f - 2 y- Q2 y7 d. R3 m. h9 G: n/ Q5 y* z0 f
- #ifdef EDMA3_DEBUG$ H6 k$ V. r$ ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ~3 Q% V7 y( P6 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a1 Q+ b* `! s$ ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 e' i1 F) p& |; m; G" {) b( \ - #else
* }8 M3 h' B, M* I - #define DMA_PRINTK( x... )# L3 z- H8 w, `) U9 ]8 D# o
- #define DMA_FN_IN
! |2 n$ P* q* T. W, S! I - #define DMA_FN_OUT
8 k# c# \7 |, J - #endif
3 U: Y4 ]( x6 S4 O - # U- v/ C6 Y/ G! R' S- P. _) g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 a& i5 X3 B) U& e8 m0 T
- #define STATIC_SHIFT 3; N+ h) h% n- Z
- #define TCINTEN_SHIFT 203 E& y( X8 p9 s! q. \7 K% P- I
- #define ITCINTEN_SHIFT 21# f0 i2 d4 E+ v. E5 L$ D
- #define TCCHEN_SHIFT 220 \- T' z5 }6 f" H6 k' r! m
- #define ITCCHEN_SHIFT 23
o" G( d# r; ~: A7 D - % P2 \. y) F/ n+ B' X
- static volatile int irqraised1 = 0;8 e# L- g' r' @2 ?
- static volatile int irqraised2 = 0;
' i( `; _0 U; O% ` - 0 C2 c% Y: Q4 M2 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K! d( i7 o" M- A" S* E+ j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" G, f: F: R) b0 B8 ?) V8 f. L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 d& ^# h# u' \: @7 M) V% k; m
, a- S k5 r. G% h9 q( x0 C6 m- dma_addr_t dmaphyssrc1 = 0;
) c; y' z7 o* O3 I: j1 r N - dma_addr_t dmaphyssrc2 = 0;
4 u6 w" [6 j* r7 ~/ n5 w4 H - dma_addr_t dmaphysdest1 = 0;
5 J$ M2 l; |5 e! g7 G! F - dma_addr_t dmaphysdest2 = 0;: E2 K2 E! @1 m9 v4 L
8 {# N4 E- D7 H7 ` v7 H- char *dmabufsrc1 = NULL;$ P( L) x; H+ k6 j
- char *dmabufsrc2 = NULL;/ ~# t8 ]5 D9 V2 _
- char *dmabufdest1 = NULL;
' F; z. x: N* J - char *dmabufdest2 = NULL;
1 z1 A2 b5 E8 |! X- n) [ - * h# H9 v7 q) J( G' W
- static int acnt = 512;
2 r7 K( a& V# Y* N' u4 ~ - static int bcnt = 8;
# w' |1 |+ Q) B - static int ccnt = 8;9 y; W8 F+ H. m5 B
- 0 l3 u0 k9 Q; m. A6 { y
- module_param(acnt, int, S_IRUGO);& d9 z) m* q: h; c
- module_param(bcnt, int, S_IRUGO);8 K5 }# j6 {3 s7 D, X' z
- module_param(ccnt, int, S_IRUGO);
复制代码
0 w2 S4 W, i4 q# j- L' g
9 D, v- T- f# L" S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) Z8 C5 P% V- y; _2 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ r3 C1 E3 Y3 d3 J- e9 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 C6 r5 a1 C7 o, Z- O0 G: b! b
& W) e* j% Y i: p. H9 f& F/ s% x+ y% O& K
|
|