|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 L: {7 F" ?8 i0 ~# w: S. o! X, g
- [code]EDMA sample test application
0 _& c, F1 a2 s/ B6 g% |; L1 ` - /*0 B0 x) @. q2 g; G" i3 V+ f
- * edma_test.c5 I/ e& R* w3 T3 |+ d2 Q
- *
l$ B' \* R4 t' U @. w1 { - * brief EDMA3 Test Application) U+ j+ t# c ]- d' W# T/ Z& z
- *
! Q& V2 S# R' E1 w - * This file contains EDMA3 Test code.
" m: H i/ ~5 P& l: d( g - *
2 H6 r t$ S: l) ]1 t& W" M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 A1 {( o$ z- w' c4 m7 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT v3 D7 q4 i: ~" V2 J
- * TO CHANGE.% ]$ x6 ]2 y1 J
- *
5 U, ~" Y. ]5 x& M8 l5 k; g/ y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 \! X+ V* Q; k% I - *
1 a! R1 d6 R9 o8 C3 [ - * This program is free software; you can redistribute it and/or+ M$ Z6 Q( @* Z1 C3 X1 m
- * modify it under the terms of the GNU General Public License as" A6 M) p# w( n$ z/ s3 U3 U
- * published by the Free Software Foundation version 2.- O G9 T* n2 z% H
- *
; D# X% |' H1 F6 e( D+ W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# \5 r( H6 ~3 g$ j1 L6 k3 U
- * kind, whether express or implied; without even the implied warranty
& t0 O) g: s ^ t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 \9 [$ d }$ N1 z - * GNU General Public License for more details.% b: H* p3 s, H$ G0 k
- */
& E/ J, @3 }# d2 S
. \* E% ?* g) U" J$ b X. B- #include <linux/module.h>: Q5 S% K2 w7 r+ }
- #include <linux/init.h>
7 @6 Q- u# A% ^" J1 a - #include <linux/errno.h>
. v: o- p: a" B% _6 e$ f, j - #include <linux/types.h>
6 a: L7 Z! a" z - #include <linux/interrupt.h>
' F; W7 e# D7 \( k1 {8 J3 h - #include <asm/io.h>
: T" M" X% O A" s# ?# p - #include <linux/moduleparam.h>! t* o9 ^# s# i# A5 t: Q
- #include <linux/sysctl.h>
C P0 f U, r h" I" V$ X - #include <linux/mm.h>
1 f3 [8 I( C- _" r1 Y& ?% ^ - #include <linux/dma-mapping.h>( M4 q3 M2 _* G) K* y
- # q! P4 q" _. ?& m, e# h
- #include <mach/memory.h>2 ]5 x* k6 E. y3 t
- #include <mach/hardware.h>& b9 C8 n# `; S8 n: N' g3 L
- #include <mach/irqs.h>
7 ^! y0 @8 u. O0 T - #include <asm/hardware/edma.h>/ t1 @3 C6 H0 Y
, q- C k4 L2 Q7 O) p- #undef EDMA3_DEBUG
) V' U) k- ^; `8 M: T# O - /*#define EDMA3_DEBUG*/
; u% k' }; `# ? x( ^5 K8 D
, ?* U' R( _% @; p( C7 }- #ifdef EDMA3_DEBUG
3 u1 ]0 D2 Y$ |' v% I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 @1 S, r6 z9 y* _1 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% h9 m- p2 Q9 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# Y9 F! Y: ^; d# O+ }4 t, A - #else
. }/ p+ z, P& s& K) V, }' ]) B - #define DMA_PRINTK( x... )# F+ N" Z& z3 [' s* G7 p0 `; H
- #define DMA_FN_IN( y$ C" f N, C* S: r" \6 _/ A
- #define DMA_FN_OUT
" `! b/ p% b7 _. U - #endif' H6 X) W8 u# t' ~$ r
6 V" {+ s3 t' u, W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( i, H/ N: @; d' s/ e - #define STATIC_SHIFT 3- [6 b0 W% Y9 S4 S5 P1 @ Q9 b$ s6 O
- #define TCINTEN_SHIFT 206 _8 j, P w1 [2 V. D9 B
- #define ITCINTEN_SHIFT 21" N3 d# Y+ i9 z# D! V' s4 ]) B
- #define TCCHEN_SHIFT 22$ }, Q7 G1 L( Z2 p
- #define ITCCHEN_SHIFT 23
3 W- d$ n# p9 ?. T+ v' S
4 n: N5 ~7 h0 k8 _- static volatile int irqraised1 = 0;8 P M8 p9 @! s+ v/ ~
- static volatile int irqraised2 = 0;
8 |7 i0 [: D+ |" O - 4 w- ]. I% H9 S+ V1 R# S! e$ v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: @, I) ^1 i& Z$ c9 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \* q, s% q$ T- E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( D* ~+ E" g C4 v0 s: B
0 ]0 E( @6 p* G+ t) l4 v( w- dma_addr_t dmaphyssrc1 = 0;) ]4 L# |8 G2 G
- dma_addr_t dmaphyssrc2 = 0;
- r& C4 B, ^' l, g6 m2 K2 S - dma_addr_t dmaphysdest1 = 0;4 u1 L/ ]- g$ f( ]
- dma_addr_t dmaphysdest2 = 0;
3 a$ ^6 n& O! h W
* y' s3 d+ n9 R6 j- char *dmabufsrc1 = NULL;
2 q7 x2 ]# Z- ` - char *dmabufsrc2 = NULL;
& }' K" k! @; L1 r1 b! _: H - char *dmabufdest1 = NULL;
V" J" i5 V( } - char *dmabufdest2 = NULL; N& L$ G: Z9 X5 k
5 ?+ L; G, G5 g- static int acnt = 512;1 H. j9 k! v4 S5 H/ x) Y( H1 F# d
- static int bcnt = 8;
) \7 ` p: B% G+ C0 ~! j+ s6 S - static int ccnt = 8;% R6 C. @1 |/ U( H c7 j$ \
- & t6 D/ a6 G3 }3 U4 P
- module_param(acnt, int, S_IRUGO);
H0 Z" m. ]" A; `4 K2 Q - module_param(bcnt, int, S_IRUGO);2 z, _4 D% R' s2 \4 F1 T
- module_param(ccnt, int, S_IRUGO);
复制代码
# A* f; y9 n s" s2 K6 c
W2 N9 P9 F. b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" B" v. l% n3 Z* s2 X' O9 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- L% K' V5 C- o+ R' r1 m) Q' k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" k! P% `* Z& l
! s% U, @4 F2 X; b: R8 h/ }, ]; ?1 z
+ F; S: M- d, ~, ~9 J7 z |
|