|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; S6 X3 m) M* U* u- f- [code]EDMA sample test application
8 ~2 i* J7 g* w/ ~ - /*
) J; O- |$ x0 R4 U; R/ m - * edma_test.c
8 M1 m) K9 Z9 P0 m - *
' {- q' N1 {, F, W' M) C+ E - * brief EDMA3 Test Application% Z2 x2 a7 z! ~( f4 J7 k; N8 J
- *: K, A3 v; F8 `5 \! o1 s; J! t
- * This file contains EDMA3 Test code.
) g4 }: R1 ~$ S1 V& z - *
4 D/ Y' h' m: i3 S' a1 K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 x% j9 e. S* s2 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ G) n' n1 z1 m* }/ t- w z
- * TO CHANGE.
/ z' o. c% y |3 \: F - *+ h4 u9 P( H& V; l) F# h: V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Z, H. O3 p0 U9 T
- *7 X6 @. g a) c x4 Q( P& i
- * This program is free software; you can redistribute it and/or$ u) z$ f- Y" c) ]" P) O
- * modify it under the terms of the GNU General Public License as6 Z i% v' f0 h* R
- * published by the Free Software Foundation version 2.' } l$ p# J7 K( }+ ]( p
- *
4 q! }5 d: _8 V" f: W9 P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% U2 Z' B. i9 ?
- * kind, whether express or implied; without even the implied warranty
% }: Y7 R7 ]1 R* ?* e# `& k, [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 j: j/ \/ o3 d, A1 L
- * GNU General Public License for more details.3 r; U+ ]: a7 y/ r1 m
- */* m" p4 T6 e ~0 U0 D/ l
- - G, G7 D$ ^4 C' E
- #include <linux/module.h>
8 Z& U0 t3 s9 X# n - #include <linux/init.h>
- ]% @# ?8 t6 S0 W* n( e - #include <linux/errno.h>
2 Q* ^8 x" f: I( l. @! j - #include <linux/types.h>0 w" W5 ~. s- i9 c3 v
- #include <linux/interrupt.h>$ i! l3 d( \, K. b
- #include <asm/io.h>
1 e% A2 B/ W! { - #include <linux/moduleparam.h>
0 |( r* S( j a; G& O3 S! ? - #include <linux/sysctl.h>8 H. [) ~. x* T& d" V
- #include <linux/mm.h>
4 a. \" ?/ c9 \) x5 |8 e - #include <linux/dma-mapping.h>
( K% h' E- R* C b. L- @
4 {: c9 `( ^9 z. ~- #include <mach/memory.h>
4 m3 R: s) N+ A- V) e9 S% ?! o - #include <mach/hardware.h>: u: V z& n# n( j, ?: P7 g
- #include <mach/irqs.h>: N9 L% G) L( ~. P
- #include <asm/hardware/edma.h>
2 `% h* i4 f2 a& O" U
, a7 r* ]- x( l3 d- #undef EDMA3_DEBUG
5 ]" J. n" }) L) s2 M - /*#define EDMA3_DEBUG*/
( y' I6 A- o7 h' _+ E1 q) |% f - 7 G3 o1 D4 y& z
- #ifdef EDMA3_DEBUG
" A" c, C; j1 W T+ t; y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 a s$ E. ?1 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 r* y5 b- n+ @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 i4 G3 I& L, _1 z2 ]3 c7 l
- #else
7 j7 N7 Z& V0 R$ }' q5 x5 f - #define DMA_PRINTK( x... )
. \% X% `2 ]% r8 i/ t - #define DMA_FN_IN
3 j% L- {9 z7 O T6 J7 L$ { - #define DMA_FN_OUT
& Y9 Z" s3 {* x7 c/ K% E; X) r - #endif
, [ X: e: f1 L# E
6 ? e5 A# U! w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' @1 s7 M! F- b - #define STATIC_SHIFT 3% F/ Y% I2 \- s
- #define TCINTEN_SHIFT 20
/ Y/ e7 @! F! x* D1 h8 n* M5 R& f - #define ITCINTEN_SHIFT 21 `4 u" ]3 P$ W8 r9 L. o$ v7 U8 T, M
- #define TCCHEN_SHIFT 22
( Q& V+ E& e9 `1 [: b: x) I - #define ITCCHEN_SHIFT 23: e) U* r* ]: V" n
- ) n4 K) s0 i0 _4 m9 Z
- static volatile int irqraised1 = 0;
. G8 J# b& V5 U# H - static volatile int irqraised2 = 0;
. p% e: K; u( w& `" Z
' L0 a, s+ E E+ p) P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?6 n u4 Y* w/ i) `2 F7 o( }9 n1 t( Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y) q7 H7 ~8 s3 M% N0 H- p$ |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 w9 j4 ^8 R( ?% S
' j9 H2 N0 Q# ]- dma_addr_t dmaphyssrc1 = 0;: |5 V7 @/ c) M; e% W( \; v
- dma_addr_t dmaphyssrc2 = 0;, [8 ^6 o8 G# Q9 j* ?1 j. F
- dma_addr_t dmaphysdest1 = 0;
6 C# v+ Z" B7 p( T8 P - dma_addr_t dmaphysdest2 = 0;0 Y; X' m0 z5 F/ i9 B/ t/ d
~9 ^9 B3 R: t" E& _- char *dmabufsrc1 = NULL; E. Q% f" Q7 x' n7 J5 L+ e! p
- char *dmabufsrc2 = NULL;9 ], b) X: H. {& |; e
- char *dmabufdest1 = NULL;
0 Q/ |( l) ], P! z - char *dmabufdest2 = NULL;
8 G9 K8 @- X* l1 \ - . O# g& ?+ a# g2 M' h& l9 o
- static int acnt = 512;
2 V4 O' Q' m) @2 K0 y - static int bcnt = 8;3 {: X' M2 e& e0 ~/ W
- static int ccnt = 8;% ^. C" G+ i! t8 ?
- P5 }, d3 l2 v6 B$ S0 U8 C8 i. Z
- module_param(acnt, int, S_IRUGO);
+ {1 K4 Z" q2 r8 ? - module_param(bcnt, int, S_IRUGO);1 W4 Y, L g0 ~ J) N2 e
- module_param(ccnt, int, S_IRUGO);
复制代码 + F* ~- }2 i! \( ^9 g- g
, K: l) V7 O' ^0 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 U r0 r7 c+ ^3 B! ?/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A6 t. Q; W- c' ~( s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 v/ M3 l5 s( s2 d; M- L4 z
7 m1 q8 n" e* m5 J8 _3 d' {4 ^, h* Y4 J( g/ Z
|
|