|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) y% E+ t9 T ^( G6 j ?
- [code]EDMA sample test application
, J7 g& T1 X- o+ x1 h - /** L! x8 U4 N2 ?, [2 ^' f' r! c- ~
- * edma_test.c! |8 J( R# ~) h$ g4 C# Y& ^
- *
" E" | Y! q) R; v - * brief EDMA3 Test Application- H5 V- F, k5 o
- *
% S/ _9 m& | k4 R4 R - * This file contains EDMA3 Test code.
! w: K1 k @/ r - *
- n2 M7 {" _' `9 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 g( A6 E! P" v/ F* V3 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 W- }: L2 U' z9 a8 b, G - * TO CHANGE.) r+ c) s% U9 y. q
- *4 X$ Q0 _( }: W+ q ]. H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 t! n, S% g0 E {' C - *+ j5 B" @. |$ E3 r
- * This program is free software; you can redistribute it and/or1 Y! w) C; J. M1 N% t8 Y8 Q) c
- * modify it under the terms of the GNU General Public License as
1 W' `9 M9 Z- I( u - * published by the Free Software Foundation version 2.
; j$ C4 b* V& ?# n& H8 e/ S - *
e6 Q5 t9 e" R$ p6 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
T- x$ @/ V2 t; @" I - * kind, whether express or implied; without even the implied warranty# W0 R' x: T9 z, W9 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) [4 t; M8 M d% U7 b3 i5 ? - * GNU General Public License for more details.
% T9 S& a4 _8 C% w) {( F - */
1 n8 y7 ~1 j9 j
' k2 Q' n; f$ _- B& c4 o1 A- #include <linux/module.h>
2 T( Y; w" `, u - #include <linux/init.h>* f" a8 f6 c/ C4 N+ D9 o8 H
- #include <linux/errno.h>& l+ l# X e" o* p$ v# n# c
- #include <linux/types.h>$ y% v) \+ Y6 B& a8 a
- #include <linux/interrupt.h>
: @* z) M- I" m3 L/ q& ~: s2 a - #include <asm/io.h> q# \) R( a1 T6 r0 B6 Q1 c
- #include <linux/moduleparam.h>1 g4 w- x& K/ A/ O S+ g. J! r
- #include <linux/sysctl.h>
$ H# I1 @+ g2 n2 s" Y - #include <linux/mm.h>
9 g" w9 p% A V1 ^ - #include <linux/dma-mapping.h>5 i: t- ] F' d% @5 s/ x4 m
( i$ Q* g, a% p; ^# I+ p9 H- #include <mach/memory.h>* @$ I8 d) h8 e0 L6 _, o8 s4 A
- #include <mach/hardware.h>* G$ m; D0 f+ ^9 B* m! ^* j5 G K! f8 ~, i
- #include <mach/irqs.h># T! Y" o0 i9 q' m1 A% ]
- #include <asm/hardware/edma.h>( |4 e/ R+ W7 C3 [+ v, h7 C
% Y3 T: }+ ]+ s7 o- #undef EDMA3_DEBUG
6 @2 f+ Q2 W1 L9 n8 {4 j - /*#define EDMA3_DEBUG*/
9 F3 D3 r# ]9 v8 T# j( T - 9 w' |. R' t$ i% I3 w V. f
- #ifdef EDMA3_DEBUG
! P q5 h" x" c. d5 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- n% w$ |* P1 `* f) Y* ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) @9 ]1 K# h' V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 L& j4 H0 X7 B4 k! [! | - #else* Y4 \" j1 b( V; Q. b
- #define DMA_PRINTK( x... )
( O) {3 a6 ~9 s" s0 ` - #define DMA_FN_IN
0 ^7 s9 x7 y9 A( n - #define DMA_FN_OUT6 {5 \1 p- A. u Y# O
- #endif
$ p7 W$ A6 u& Q
& n1 i0 P ?- ?7 K5 k" t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. ]& [0 F) c# f% e* D2 Y - #define STATIC_SHIFT 36 ~* d8 s; ~* H6 T# R/ K/ k% G
- #define TCINTEN_SHIFT 20
; V+ X5 R3 p, J7 [! i; R - #define ITCINTEN_SHIFT 215 n7 N8 W% R+ L: F
- #define TCCHEN_SHIFT 22# C n6 j( O) h& |6 M1 V
- #define ITCCHEN_SHIFT 23
) p3 w1 I7 R4 I" V3 t& h
6 K+ @! }2 h6 w- static volatile int irqraised1 = 0;( R, Z Z9 w0 a* K" ]
- static volatile int irqraised2 = 0;1 L! K6 M- j3 k" j% Q" ~& O( Q0 V
- , p5 o6 F) q9 @+ o# K% D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" p4 `& y7 b! \+ B( K2 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; M, U& ~# a# n9 R' h! [7 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! f) {' s( X3 }+ C; ]3 _! F8 w - 8 i1 R' D. c. m0 n4 N
- dma_addr_t dmaphyssrc1 = 0;
! `4 h* @8 \. }4 Z' D9 G/ k/ G - dma_addr_t dmaphyssrc2 = 0;8 V9 q$ d7 h" M% ]
- dma_addr_t dmaphysdest1 = 0;
: A6 _0 P4 S" w+ G1 @1 f9 ^2 u0 N - dma_addr_t dmaphysdest2 = 0;
7 {& i( W3 U5 _! l: s - 1 ]/ z- K0 d( D/ R
- char *dmabufsrc1 = NULL;+ {7 r# P9 W0 m. ~; S& F5 P# b/ y. ^
- char *dmabufsrc2 = NULL;/ r/ l/ S3 m Y; K5 w
- char *dmabufdest1 = NULL;
" {! D) g8 V R: S" \/ M - char *dmabufdest2 = NULL;5 K3 q" b- X; I- M; u
4 g" \/ J. }% R, y" N4 t4 ^& ~. S- static int acnt = 512;! A% O. k) c+ q# H# w3 i3 h4 h
- static int bcnt = 8;
- X2 f G! o6 G u - static int ccnt = 8;$ H* _# p# D) W$ x" ~2 K% k
- / M9 H! i! [5 d. C
- module_param(acnt, int, S_IRUGO);
$ C& K3 u: }0 n, X - module_param(bcnt, int, S_IRUGO);+ K) C& f$ L- R, R1 G' H9 m
- module_param(ccnt, int, S_IRUGO);
复制代码
( J. e, s# O2 K- b( Y; `
0 b" w( E6 R* _6 Y; K3 l X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. f: A$ r/ \+ x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 o! T ?! ^- @- |' @ \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% T1 e0 J3 s, b. P
$ c" x& L1 i, @; p2 s `9 ?( l3 C+ s0 t2 |$ R1 p' O- y
|
|