debuggers.hg

view tools/ioemu/iodev/dma.h @ 3680:26a00896163a

bitkeeper revision 1.1159.240.3 (4202bd17uoTYqnlSeqvW9fHjznmCHg)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into labyrinth.cl.cam.ac.uk:/auto/groups/xeno/users/iap10/xeno-clone/xen-unstable.bk
author iap10@labyrinth.cl.cam.ac.uk
date Fri Feb 04 00:08:55 2005 +0000 (2005-02-04)
parents 2c56c6b39a48 f89816eaeaad
children d3f0465c034e
line source
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: dma.h,v 1.15 2003/05/03 07:41:27 vruppert Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2002 MandrakeSoft S.A.
6 //
7 // MandrakeSoft S.A.
8 // 43, rue d'Aboukir
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
12 //
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
17 //
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef _PCDMA_H
29 #define _PCDMA_H
32 #if BX_USE_DMA_SMF
33 # define BX_DMA_SMF static
34 # define BX_DMA_THIS theDmaDevice->
35 #else
36 # define BX_DMA_SMF
37 # define BX_DMA_THIS this->
38 #endif
42 class bx_dma_c : public bx_dma_stub_c {
43 public:
45 bx_dma_c();
46 ~bx_dma_c(void);
48 virtual void init(void);
49 virtual void bios_init(void);
50 virtual void reset(unsigned type);
51 virtual void raise_HLDA(void);
52 virtual void set_DRQ(unsigned channel, bx_bool val);
53 virtual unsigned get_TC(void);
55 virtual unsigned registerDMA8Channel(unsigned channel,
56 void (* dmaRead)(Bit8u *data_byte),
57 void (* dmaWrite)(Bit8u *data_byte),
58 const char *name);
59 virtual unsigned registerDMA16Channel(unsigned channel,
60 void (* dmaRead)(Bit16u *data_word),
61 void (* dmaWrite)(Bit16u *data_word),
62 const char *name);
63 virtual unsigned unregisterDMAChannel(unsigned channel);
65 private:
67 static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
68 static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
69 #if !BX_USE_DMA_SMF
70 Bit32u read( Bit32u address, unsigned io_len) BX_CPP_AttrRegparmN(2);
71 void write(Bit32u address, Bit32u value, unsigned io_len) BX_CPP_AttrRegparmN(3);
72 #endif
73 BX_DMA_SMF void control_HRQ(bx_bool ma_sl);
74 BX_DMA_SMF void reset_controller(unsigned num);
76 struct {
77 bx_bool DRQ[4]; // DMA Request
78 bx_bool DACK[4]; // DMA Acknowlege
80 bx_bool mask[4];
81 bx_bool flip_flop;
82 Bit8u status_reg;
83 Bit8u command_reg;
84 Bit8u request_reg;
85 Bit8u temporary_reg;
86 struct {
87 struct {
88 Bit8u mode_type;
89 Bit8u address_decrement;
90 Bit8u autoinit_enable;
91 Bit8u transfer_type;
92 } mode;
93 Bit16u base_address;
94 Bit16u current_address;
95 Bit16u base_count;
96 Bit16u current_count;
97 Bit8u page_reg;
98 bx_bool used;
99 } chan[4]; /* DMA channels 0..3 */
100 } s[2]; // state information DMA-1 / DMA-2
102 bx_bool HLDA; // Hold Acknowlege
103 bx_bool TC; // Terminal Count
105 struct {
106 void (* dmaRead8)(Bit8u *data_byte);
107 void (* dmaWrite8)(Bit8u *data_byte);
108 void (* dmaRead16)(Bit16u *data_word);
109 void (* dmaWrite16)(Bit16u *data_word);
110 } h[4]; // DMA read and write handlers
112 };
114 #endif // #ifndef _PCDMA_H