debuggers.hg

view tools/ioemu/iodev/dma.h @ 3491:2c56c6b39a48

bitkeeper revision 1.1159.212.18 (41ebe1caQQ_SlJestrvsT95t1oER-Q)

Merge arcadians.cl.cam.ac.uk:/auto/groups/xeno/BK/xen-unstable.bk
into arcadians.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xen-unstable.bk
author cl349@arcadians.cl.cam.ac.uk
date Mon Jan 17 16:03:22 2005 +0000 (2005-01-17)
parents 9ad7af5b3f9b
children f89816eaeaad 26a00896163a d3f0465c034e bbe8541361dd
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 reset(unsigned type);
50 virtual void raise_HLDA(void);
51 virtual void set_DRQ(unsigned channel, bx_bool val);
52 virtual unsigned get_TC(void);
54 virtual unsigned registerDMA8Channel(unsigned channel,
55 void (* dmaRead)(Bit8u *data_byte),
56 void (* dmaWrite)(Bit8u *data_byte),
57 const char *name);
58 virtual unsigned registerDMA16Channel(unsigned channel,
59 void (* dmaRead)(Bit16u *data_word),
60 void (* dmaWrite)(Bit16u *data_word),
61 const char *name);
62 virtual unsigned unregisterDMAChannel(unsigned channel);
64 private:
66 static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
67 static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
68 #if !BX_USE_DMA_SMF
69 Bit32u read( Bit32u address, unsigned io_len) BX_CPP_AttrRegparmN(2);
70 void write(Bit32u address, Bit32u value, unsigned io_len) BX_CPP_AttrRegparmN(3);
71 #endif
72 BX_DMA_SMF void control_HRQ(bx_bool ma_sl);
73 BX_DMA_SMF void reset_controller(unsigned num);
75 struct {
76 bx_bool DRQ[4]; // DMA Request
77 bx_bool DACK[4]; // DMA Acknowlege
79 bx_bool mask[4];
80 bx_bool flip_flop;
81 Bit8u status_reg;
82 Bit8u command_reg;
83 Bit8u request_reg;
84 Bit8u temporary_reg;
85 struct {
86 struct {
87 Bit8u mode_type;
88 Bit8u address_decrement;
89 Bit8u autoinit_enable;
90 Bit8u transfer_type;
91 } mode;
92 Bit16u base_address;
93 Bit16u current_address;
94 Bit16u base_count;
95 Bit16u current_count;
96 Bit8u page_reg;
97 bx_bool used;
98 } chan[4]; /* DMA channels 0..3 */
99 } s[2]; // state information DMA-1 / DMA-2
101 bx_bool HLDA; // Hold Acknowlege
102 bx_bool TC; // Terminal Count
104 struct {
105 void (* dmaRead8)(Bit8u *data_byte);
106 void (* dmaWrite8)(Bit8u *data_byte);
107 void (* dmaRead16)(Bit16u *data_word);
108 void (* dmaWrite16)(Bit16u *data_word);
109 } h[4]; // DMA read and write handlers
111 };
113 #endif // #ifndef _PCDMA_H