|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 n% b* d6 {" b1 Y; C8 k. C- [code]EDMA sample test application
% [ s! N1 G9 O, L* ?% Z9 O! j# W( p - /*
- V T3 }+ k: W- D& l - * edma_test.c) q% U4 Q5 n5 w% S; }; Z; ], b
- *
' {. h( I6 ~+ _ - * brief EDMA3 Test Application1 g+ v) H C# }2 v- a9 n( I
- *7 N0 d6 Y, `4 N& \& V/ q4 m
- * This file contains EDMA3 Test code.1 U5 u$ Y% Y) Q/ r2 L* m
- *) z; Q9 Q+ [/ A0 H3 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 C* q3 |3 h. b, L/ R& L: s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; t% f: {- u' T" a
- * TO CHANGE.: ^ B1 e* i, e8 V5 L0 C1 t3 S6 U
- *+ |- P5 {( m, ^. @. K' g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! U% I! W2 S3 d F2 L8 }3 i - *+ m) K/ G3 c/ }: {, z, d" U7 F
- * This program is free software; you can redistribute it and/or
+ |" i9 J% J7 I, w6 b - * modify it under the terms of the GNU General Public License as. ~0 l( x& C& \ k( N8 l! ?$ C% y
- * published by the Free Software Foundation version 2.1 ]0 Y: O+ K' o- B' \1 B
- *
; L, v+ o8 O3 x4 e. a& ?7 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 n! J& D; |3 y - * kind, whether express or implied; without even the implied warranty
9 l7 H: F* c. `# y F, Z6 P8 y. D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: Z8 l- j+ M) o- g
- * GNU General Public License for more details.
`- s7 B _- ?/ o1 u5 y - */
# Y; d1 S+ G3 G) |# t - 1 @0 L; ] o1 g7 l8 c+ s
- #include <linux/module.h># f; V8 g. `1 D# L0 d
- #include <linux/init.h>9 T! Q$ t; \1 n% D+ g5 W
- #include <linux/errno.h>, L, N2 ~! O l2 z/ E/ ], Y
- #include <linux/types.h>
) d$ R$ I% S. ~! u - #include <linux/interrupt.h>
3 l4 Q$ y" a: R% h - #include <asm/io.h>5 k3 `! H, C- U+ h ^$ D+ [+ D
- #include <linux/moduleparam.h>
8 e9 G& l& n/ f4 L0 L# {8 ^; } - #include <linux/sysctl.h>
* }4 I7 z% L! _- X' R8 T- Y& c' b - #include <linux/mm.h>
; E6 o4 C' b+ z# Q1 ~* o1 V5 v - #include <linux/dma-mapping.h>
7 u! X. L# ~9 Y: S% A
7 L d, V* m) ]- #include <mach/memory.h>
, g$ k* L( ]" @+ p0 H/ o - #include <mach/hardware.h>
7 H+ V! t9 |, X( Z- ^) @3 | - #include <mach/irqs.h>
! k# D2 k8 }8 q - #include <asm/hardware/edma.h>& F! z+ b- N# j( k$ l ?' i
$ u/ O! k5 F; P# O+ Z( ?$ x" r- #undef EDMA3_DEBUG% R6 F- V* y$ \, |, N3 x
- /*#define EDMA3_DEBUG*/
5 L7 R- i* O/ @2 T2 H! B8 s+ Y
# s8 c# ^3 F3 g$ q7 w: h8 S6 i- #ifdef EDMA3_DEBUG
4 [0 t- d( ?2 F! Z7 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) _- L. }5 x9 t4 @, p& R: C/ ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), A: u& o. Z4 Z0 R$ Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! V* T; A h' B - #else
G/ @" P+ o4 `4 L- W - #define DMA_PRINTK( x... )
9 U: M* X% d. J7 F4 u% Q - #define DMA_FN_IN
+ ~6 t2 \% K* W) i - #define DMA_FN_OUT7 y: { {" v8 Z$ [
- #endif- V5 N F8 a( V) z. |
- , \# [9 I3 W) F8 i8 ? k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 G+ W7 K# U$ T0 }, o
- #define STATIC_SHIFT 3
7 ]! j% K) z5 p# l4 T/ g - #define TCINTEN_SHIFT 20
, N# R/ t( s0 l3 I3 M( _ - #define ITCINTEN_SHIFT 21
4 G9 H2 I& t+ A) a- h* {0 M - #define TCCHEN_SHIFT 22* `* f$ O. `* Y+ _( D$ G! |
- #define ITCCHEN_SHIFT 23; g3 B4 j/ x; b! G. V
- # O4 f" P4 V+ U: ~8 k( V" M
- static volatile int irqraised1 = 0;# }4 j% I- J/ x+ E8 h
- static volatile int irqraised2 = 0;
3 S! s2 H9 o% ]3 u# w0 k, B1 L
* x, R: I, b8 ?$ V& m9 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h+ m, V( c( z$ o, d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 r& u: [& |2 C, Q0 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x% T: Z% u1 n3 F/ _
- 2 ^6 F( z- e/ n+ S2 V* V6 d
- dma_addr_t dmaphyssrc1 = 0;' S0 e' w& G3 \5 V0 @4 g
- dma_addr_t dmaphyssrc2 = 0;
m% L$ F% M( {3 g7 V& J8 v - dma_addr_t dmaphysdest1 = 0;
8 }* c- c" y2 g1 b7 t, ? - dma_addr_t dmaphysdest2 = 0;
/ B I: o' @+ X
! t+ [0 F- ~* t) |9 a7 z- char *dmabufsrc1 = NULL;
, @! Q* M9 _/ m9 m - char *dmabufsrc2 = NULL;: E4 ?% t. \# Z# Z
- char *dmabufdest1 = NULL;" |/ G+ k, j8 I( l' w s1 e: M: A
- char *dmabufdest2 = NULL;5 R/ P8 V3 }: b5 G+ v6 W4 T
- % D8 s: K+ l4 C& W% \. W
- static int acnt = 512;, m7 |1 j0 U. @1 g
- static int bcnt = 8;- r2 F+ z3 a3 V7 S' r; w
- static int ccnt = 8;6 g0 J8 l7 |% [% v
/ |, W" s( [7 h B: F- O& N- module_param(acnt, int, S_IRUGO);$ F! |0 v; H6 _7 o
- module_param(bcnt, int, S_IRUGO);
4 f) t2 I5 J( _* k& y8 h, p - module_param(ccnt, int, S_IRUGO);
复制代码
- S. s' d: u+ e, Q* j8 }& L( {' h+ g7 K' F6 o+ [( G: s8 l' f, V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 _. O x3 z' H @7 H7 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. J: [4 X# F# Y4 }. d9 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& R& }3 b5 Y6 W' G* W, X M% o
. m8 j2 V$ X, ~. B# I- d1 o* I2 M/ W) W% Y1 H; w; Q
|
|