|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 _7 D% T- U; @# y8 D+ i% a% N0 n' p- [code]EDMA sample test application) m& m. L5 a9 ~3 m
- /*1 r6 y! `! }/ E' \$ a$ ]- v! E9 L
- * edma_test.c( I! r/ s% }: a1 t4 J1 K
- *! i5 V# z# i8 n4 j. _: U
- * brief EDMA3 Test Application% b' z8 S# T, h
- *
+ {7 V1 I k3 G F0 u - * This file contains EDMA3 Test code.
( W8 P) X' j, z$ b6 x/ f r - *7 f* G4 v N& ^# ]! _3 G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. q% N* n* y2 D! \1 S3 {: T) o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* x2 I$ K& c$ d$ J
- * TO CHANGE.
8 V" Z, p4 r7 l; e" K) B - *
( I9 J5 I# p, }, H# s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. q, c4 B: b t. V
- *
5 W$ D3 Z# y4 w% E/ \* T* j - * This program is free software; you can redistribute it and/or1 n" ?+ @3 ?5 v' y f6 S
- * modify it under the terms of the GNU General Public License as, f$ `1 j' ~/ C; L, P% Z( M
- * published by the Free Software Foundation version 2.
. @2 G' d, U% b% p. l; L9 r) e - *& O# L, L+ N' n1 G! K5 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: B1 G# n2 _; M8 h0 Y- W# J - * kind, whether express or implied; without even the implied warranty
- q6 j3 G+ v0 I3 g; S* ]7 G7 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# ?, T( ^, m! a6 X; t
- * GNU General Public License for more details.
! f) W. j. G0 Q; N! w7 ] - */
% D& b7 f8 g! X1 M! y& F
5 m" F; R% G* A) i% P- #include <linux/module.h>" ?! J ~7 n2 u
- #include <linux/init.h>0 R/ {5 h7 j7 _6 P. _
- #include <linux/errno.h>
7 G/ Y; o% c2 D, ] - #include <linux/types.h>
6 } ~8 y G$ W6 R ~# i - #include <linux/interrupt.h>
9 R- V+ q2 M9 g! U. Y$ Y - #include <asm/io.h>3 U' l, L4 H; f
- #include <linux/moduleparam.h>
6 M' b, s( Z, q9 h0 k' l - #include <linux/sysctl.h>. A5 A2 ~5 C9 w& V
- #include <linux/mm.h>
/ w, r2 D! v2 }; z! B2 ^; n - #include <linux/dma-mapping.h>/ n# k( r( E6 D8 O, P) D6 _
- ) L1 Z% _- Z" F; A H1 b& Y, V
- #include <mach/memory.h>; C/ W) W5 d) u' \2 C I. c
- #include <mach/hardware.h>6 [) T" W+ r( D- J6 B
- #include <mach/irqs.h>- L/ r& V6 i2 N! R$ i( ^; `0 |7 ~# G
- #include <asm/hardware/edma.h>
2 d0 I, t2 s% P" g Z - ' f* W. p) Y+ F" {9 v
- #undef EDMA3_DEBUG' b) n+ }- S0 e& `* ~/ x+ c0 G2 ]( c# O, F
- /*#define EDMA3_DEBUG*/
* M4 q# r: ^2 m* a! S4 q5 @ - 7 Y+ }; S/ Z# P" e$ R ^, t; W
- #ifdef EDMA3_DEBUG
/ \ r7 f' M# G) o$ h7 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Z/ ~1 O% J0 F5 c( ` G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& c4 V$ s5 o f1 X0 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# D; H( C! ~; y; v8 Q; U - #else R ~! g5 c! P$ j8 F
- #define DMA_PRINTK( x... )
9 _% p) [; L8 ~# \% B - #define DMA_FN_IN
6 a& L7 s- E% h - #define DMA_FN_OUT! P6 u8 Y ?( b& \# @
- #endif
) D5 G. s! l J( ^
5 `/ p: ~% b# c* Q. J2 y+ Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( J0 m5 p; _7 q( m: j - #define STATIC_SHIFT 3
z& ]% q7 E4 W* z! K. A - #define TCINTEN_SHIFT 20( U' I( T. R' l1 g
- #define ITCINTEN_SHIFT 21 q' [* O7 U. c+ W
- #define TCCHEN_SHIFT 22
2 P& e4 r3 x t! d" ]2 L3 U- Z - #define ITCCHEN_SHIFT 23
, a& q# ]2 D* k. j+ \+ u7 E; A
3 @8 h' U) m3 c( ]0 l- static volatile int irqraised1 = 0;
8 P5 e z2 Z% g9 X7 f- D- t; D2 J - static volatile int irqraised2 = 0;
) O+ \6 V1 }8 ?4 Q: Y K/ r - ( }/ q% `) b/ A$ E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F& l+ e" k/ ~' v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 m- U$ ~5 G" R# q% w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a* ^* G0 ?4 X; c% h$ G% \
- $ i0 h1 T9 A8 X3 ~6 d
- dma_addr_t dmaphyssrc1 = 0;
4 c* n( @- ^* B7 i% y" N - dma_addr_t dmaphyssrc2 = 0;/ P9 i! c6 i9 ^9 K- r, K
- dma_addr_t dmaphysdest1 = 0;
: u! Z, c) H. }6 \5 O. z$ ? - dma_addr_t dmaphysdest2 = 0;
# m! I3 j# _: Y, i1 Z k - * ]8 a1 \+ O4 c9 u( b' y
- char *dmabufsrc1 = NULL;
4 A4 N: T8 P/ N; c' y - char *dmabufsrc2 = NULL;& m7 A4 x, y, I- r
- char *dmabufdest1 = NULL;) ^6 ~( W/ [2 y' x5 ~" n: I
- char *dmabufdest2 = NULL;" @$ }# P7 K& W3 Z
6 a' r2 C7 u4 l5 R- static int acnt = 512;
& O$ Q* o" I! \' w9 \5 R - static int bcnt = 8;8 A' t# J! m2 {8 M1 }) z. g. g; w) E
- static int ccnt = 8;# z" [ `: [( P# K$ p
- 4 k* w4 P: I- W3 \
- module_param(acnt, int, S_IRUGO);& e/ i$ k0 A; ~
- module_param(bcnt, int, S_IRUGO);
& Y0 F% U+ a1 d1 B! }+ ]) e - module_param(ccnt, int, S_IRUGO);
复制代码 - y* o$ M- E! N# ^& H. Q- Q0 v
6 D; ]6 ?# L9 p% f$ f7 R R6 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P$ O4 s. t6 w x: H( h! [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 f$ D! z! l$ j# C6 { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" f" b$ R* j6 v$ B4 v
4 U5 M5 ]- F- G9 z
) Q+ [6 \1 ` Y. R9 L" b
|
|