|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 n3 F+ O- o" ~7 E: S1 C- [code]EDMA sample test application- H. U f: }: H) N" M$ D3 b
- /*2 w4 Y7 z/ u' a: V3 K
- * edma_test.c! x: [0 B/ U7 L1 U% i9 m& i( l
- */ D$ r8 V2 k# E0 W' A& O: Y
- * brief EDMA3 Test Application M6 G5 c+ B" l, g) ~/ U
- *
0 A7 g, `, ?4 ^3 q3 Q - * This file contains EDMA3 Test code.
8 W% k @" c6 K2 J( C7 F - *6 F( O4 ?/ }7 U. P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, h2 ^2 e0 `1 P6 Z2 E% X- u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 @# P% U$ C$ y+ C [6 {
- * TO CHANGE.' y W3 z! p1 b( `+ O
- *
; r- z G: H; o0 B/ S( K: L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; A: x$ c9 I. {- p+ Q
- *3 j: b L7 u7 s) m+ w8 o
- * This program is free software; you can redistribute it and/or
. `& e) ~; Y( v6 ^& V$ \ - * modify it under the terms of the GNU General Public License as
$ L+ h4 V, J( ?& o9 C# g% y9 z - * published by the Free Software Foundation version 2.
3 g7 ^! D2 A e+ L - *
% f/ W" H/ X- k' j `7 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 x9 A3 f3 m4 F4 f) l
- * kind, whether express or implied; without even the implied warranty% b7 O: O( j) c" y9 B/ d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- }$ O, i; o `! x, s: H - * GNU General Public License for more details.* U/ R/ t! M/ e% J# o
- */: F6 f% }6 v8 u
- ) |% ~3 F7 }; V9 e/ x
- #include <linux/module.h>7 z& V: h# E% R' y/ w4 u
- #include <linux/init.h>' v* d; V: q3 {6 v
- #include <linux/errno.h>3 E+ b" \4 d8 ?: N) m
- #include <linux/types.h>5 Q: j7 e8 q- l3 C
- #include <linux/interrupt.h>
* |1 O5 T1 b) A; c) z - #include <asm/io.h>
4 Q: P2 w; Y5 c6 G% } - #include <linux/moduleparam.h>
. X" ?" I9 C5 R8 `( B# e - #include <linux/sysctl.h>3 w+ h4 z$ A, O# |" C9 O
- #include <linux/mm.h>
; ~( o. ]- t8 \% a2 Y - #include <linux/dma-mapping.h>
+ y; C. _# ^3 q7 e
* w( [( f3 q/ g7 i; l- #include <mach/memory.h>
n2 u5 H) W) i" m5 W - #include <mach/hardware.h>
2 l2 L- P- \1 l- c# Y: w8 \ - #include <mach/irqs.h># E; N* H8 F! A! P5 g I7 B P) H
- #include <asm/hardware/edma.h>9 ~0 }& ~% o; A( [ `. P
- L, p- O5 ^* U. A% @
- #undef EDMA3_DEBUG
3 y/ |6 x! s5 y: h" j8 d - /*#define EDMA3_DEBUG*/4 O5 r% `+ O: V1 }$ e Y Q8 w
+ A# D( n V1 `' { i' r- #ifdef EDMA3_DEBUG
& t6 l: L" _; j0 d4 {7 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 d! a1 r% D& P# p' t& X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Y7 i) t) i5 j: {. x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) L* y" g; ]5 }, M
- #else
0 ^2 \4 d0 S: t1 y9 ? - #define DMA_PRINTK( x... )- Z1 q4 C. K! R* ?+ t ]2 t* k& v
- #define DMA_FN_IN
$ ?) K1 W" R" r9 Q, ?! m - #define DMA_FN_OUT
* U! f. I1 m; t$ c9 M - #endif1 o$ f7 M! G4 [! }9 I u* A1 f; h
& Y9 p$ r: ~7 R7 [! K! U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
u2 L3 X6 V5 l+ L - #define STATIC_SHIFT 3
, b! y0 X8 m& Y! K: R: r - #define TCINTEN_SHIFT 20+ L5 s( P% d4 r1 ? s
- #define ITCINTEN_SHIFT 21
8 b" j) O3 f- L+ E$ L - #define TCCHEN_SHIFT 22
+ J: x) |5 r5 T7 U% q - #define ITCCHEN_SHIFT 23
" o: D: c7 M/ {6 p
, @8 f* V5 R) F7 K9 _4 c- static volatile int irqraised1 = 0;
?- I3 w/ P" X! J/ v( a - static volatile int irqraised2 = 0;
: _# k! W( ^( C$ X5 F/ H& b - # Z! b8 |. G8 m0 x, {0 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) T1 h+ r1 h S1 B- v) f+ T: z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r. k- b; C- h6 y( Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o3 X3 \& G# O6 \6 E7 ?
- 5 N7 L% |; Q' c$ a
- dma_addr_t dmaphyssrc1 = 0;# o( C% w3 Y0 Y% k
- dma_addr_t dmaphyssrc2 = 0;
) [3 P$ D; `, O0 e - dma_addr_t dmaphysdest1 = 0;
" l" W. S- |" K8 F' y: ? @ Y - dma_addr_t dmaphysdest2 = 0;, F; y6 ~ F4 s) q% |# g4 k( `6 P/ _
6 D( P% J# Y0 l" s- char *dmabufsrc1 = NULL;4 T. Y, [5 I! h' X3 J! ?
- char *dmabufsrc2 = NULL;3 a# E: Z+ c8 W; v8 n! r
- char *dmabufdest1 = NULL;
. D) y% h) q0 ]+ U1 G - char *dmabufdest2 = NULL;
) X& m. D- Y& c& N# M - : m9 s' l- ^! \
- static int acnt = 512;0 |. d7 U, i$ q6 t$ w& X. ^; A9 _
- static int bcnt = 8;* I. j8 J7 A# X* @- t) \
- static int ccnt = 8;% t' }4 L/ F$ M+ M& D' o) S- X
+ e% {1 J% H H7 n: |9 i$ Z2 }- module_param(acnt, int, S_IRUGO);5 E" m9 v9 U% v2 q/ [
- module_param(bcnt, int, S_IRUGO);
3 Z: {4 k) ]4 d. O7 f( I% ~ - module_param(ccnt, int, S_IRUGO);
复制代码
3 a- ^* a8 }+ L' [" d
9 y4 z% d$ g' C0 C* J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* y# K! N% B% G; Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 O, H) `0 ]- b' `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# c8 x J! N3 H) O3 d
6 D$ A2 C" M7 i4 P, \' f+ i/ K R. ]
|
|