2011-03-12 20:37:26 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
// $Id$
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011 The Bochs Project
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
#ifndef BX_IODEV_ES1370_H
|
|
|
|
#define BX_IODEV_ES1370_H
|
|
|
|
|
|
|
|
#if BX_USE_ES1370_SMF
|
|
|
|
# define BX_ES1370_SMF static
|
|
|
|
# define BX_ES1370_THIS theES1370Device->
|
|
|
|
# define BX_ES1370_THIS_PTR theES1370Device
|
|
|
|
#else
|
|
|
|
# define BX_ES1370_SMF
|
|
|
|
# define BX_ES1370_THIS this->
|
|
|
|
# define BX_ES1370_THIS_PTR this
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Bit32u shift;
|
|
|
|
Bit32u leftover;
|
|
|
|
Bit32u scount;
|
|
|
|
Bit32u frame_addr;
|
|
|
|
Bit32u frame_cnt;
|
|
|
|
} chan_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
chan_t chan[3];
|
|
|
|
Bit32u ctl;
|
|
|
|
Bit32u status;
|
|
|
|
Bit32u mempage;
|
|
|
|
Bit32u codec;
|
|
|
|
Bit32u sctl;
|
|
|
|
|
|
|
|
int dac1_timer_index;
|
|
|
|
int dac2_timer_index;
|
2011-04-25 21:35:39 +04:00
|
|
|
bx_bool dac_outputinit;
|
2011-04-04 20:07:24 +04:00
|
|
|
bx_bool adc_inputinit;
|
2011-04-25 21:35:39 +04:00
|
|
|
int dac_nr_active;
|
2011-04-26 22:35:43 +04:00
|
|
|
Bit16u dac_packet_size[2];
|
2011-03-12 20:37:26 +03:00
|
|
|
|
|
|
|
Bit8u devfunc;
|
|
|
|
} bx_es1370_t;
|
|
|
|
|
|
|
|
|
|
|
|
// forward definition
|
2011-03-19 15:57:13 +03:00
|
|
|
class bx_sound_lowlevel_c;
|
2011-03-12 20:37:26 +03:00
|
|
|
|
|
|
|
class bx_es1370_c : public bx_devmodel_c, bx_pci_device_stub_c {
|
|
|
|
public:
|
|
|
|
bx_es1370_c();
|
|
|
|
virtual ~bx_es1370_c();
|
|
|
|
virtual void init(void);
|
|
|
|
virtual void reset(unsigned type);
|
|
|
|
virtual void register_state(void);
|
|
|
|
virtual void after_restore_state(void);
|
|
|
|
|
|
|
|
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len);
|
|
|
|
virtual void pci_write_handler(Bit8u address, Bit32u value, unsigned io_len);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bx_es1370_t s;
|
|
|
|
|
|
|
|
BX_ES1370_SMF void set_irq_level(bx_bool level);
|
|
|
|
BX_ES1370_SMF void update_status(Bit32u new_status);
|
|
|
|
BX_ES1370_SMF void check_lower_irq(Bit32u sctl);
|
2011-03-27 13:32:17 +04:00
|
|
|
BX_ES1370_SMF void update_voices(Bit32u ctl, Bit32u sctl, bx_bool force);
|
2011-04-04 20:07:24 +04:00
|
|
|
BX_ES1370_SMF void run_channel(unsigned channel, int timer_id, Bit32u buflen);
|
2011-03-12 20:37:26 +03:00
|
|
|
|
|
|
|
static void es1370_timer_handler(void *);
|
|
|
|
void es1370_timer(void);
|
|
|
|
|
2011-04-04 20:07:24 +04:00
|
|
|
static Bit32u es1370_adc_handler(void *, Bit32u len);
|
|
|
|
|
2011-03-12 20:37:26 +03:00
|
|
|
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
|
|
|
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
|
|
|
|
#if !BX_USE_ES1370_SMF
|
|
|
|
Bit32u read(Bit32u address, unsigned io_len);
|
|
|
|
void write(Bit32u address, Bit32u value, unsigned io_len);
|
|
|
|
#endif
|
|
|
|
|
2011-03-19 15:57:13 +03:00
|
|
|
bx_sound_lowlevel_c *soundmod;
|
2011-03-12 20:37:26 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|