(MESS) mstation: added emulation of SST 28SF040 flash. (nw)

This commit is contained in:
Sandro Ronco 2013-01-06 10:03:46 +00:00
parent cef23d614c
commit 4a2611210e
3 changed files with 66 additions and 19 deletions

View File

@ -88,6 +88,7 @@ const device_type INTEL_E28F400 = &device_creator<intel_e28f400_device>;
const device_type MACRONIX_29L001MC = &device_creator<macronix_29l001mc_device>;
const device_type PANASONIC_MN63F805MNP = &device_creator<panasonic_mn63f805mnp_device>;
const device_type SANYO_LE26FV10N1TS = &device_creator<sanyo_le26fv10n1ts_device>;
const device_type SST_28SF040 = &device_creator<sst_28sf040_device>;
const device_type SHARP_LH28F400 = &device_creator<sharp_lh28f400_device>;
const device_type INTEL_E28F008SA = &device_creator<intel_e28f008sa_device>;
@ -274,6 +275,13 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type
m_sector_is_4k = true;
map = ADDRESS_MAP_NAME( memory_map8_1Mb );
break;
case FLASH_SST_28SF040:
m_bits = 8;
m_size = 0x80000;
m_maker_id = MFG_SST;
m_device_id = 0x04;
map = ADDRESS_MAP_NAME( memory_map8_4Mb );
break;
}
int addrbits;
@ -327,6 +335,9 @@ panasonic_mn63f805mnp_device::panasonic_mn63f805mnp_device(const machine_config
sanyo_le26fv10n1ts_device::sanyo_le26fv10n1ts_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: intelfsh8_device(mconfig, SANYO_LE26FV10N1TS, "Sanyo LE26FV10N1TS Flash", tag, owner, clock, FLASH_SANYO_LE26FV10N1TS) { }
sst_28sf040_device::sst_28sf040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: intelfsh8_device(mconfig, SST_28SF040, "SST 28SF040 Flash", tag, owner, clock, FLASH_SST_28SF040) { }
sharp_lh28f400_device::sharp_lh28f400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: intelfsh16_device(mconfig, SHARP_LH28F400, "Sharp LH28F400 Flash", tag, owner, clock, FLASH_SHARP_LH28F400) { }
@ -846,7 +857,10 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
break;
}
m_status = 0x80;
m_flash_mode = FM_READSTATUS;
if (m_type == FLASH_SST_28SF040)
m_flash_mode = FM_NORMAL;
else
m_flash_mode = FM_READSTATUS;
break;
case FM_WRITEPAGEATMEL:
switch( m_bits )
@ -876,15 +890,27 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
case FM_CLEARPART1:
if( ( data & 0xff ) == 0xd0 )
{
// clear the 64k block containing the current address to all 0xffs
UINT32 base = address * ((m_bits == 16) ? 2 : 1);
for (offs_t offs = 0; offs < 64 * 1024; offs++)
m_addrspace[0]->write_byte((base & ~0xffff) + offs, 0xff);
if (m_type == FLASH_SST_28SF040)
{
// clear the 256 bytes block containing the current address to all 0xffs
UINT32 base = address * ((m_bits == 16) ? 2 : 1);
for (offs_t offs = 0; offs < 256; offs++)
m_addrspace[0]->write_byte((base & ~0xff) + offs, 0xff);
m_timer->adjust( attotime::from_msec( 4 ) );
}
else
{
// clear the 64k block containing the current address to all 0xffs
UINT32 base = address * ((m_bits == 16) ? 2 : 1);
for (offs_t offs = 0; offs < 64 * 1024; offs++)
m_addrspace[0]->write_byte((base & ~0xffff) + offs, 0xff);
m_timer->adjust( attotime::from_seconds( 1 ) );
}
m_status = 0x00;
m_flash_mode = FM_READSTATUS;
m_timer->adjust( attotime::from_seconds( 1 ) );
break;
}
else

View File

@ -46,6 +46,9 @@
#define MCFG_SANYO_LE26FV10N1TS_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, SANYO_LE26FV10N1TS, 0)
#define MCFG_SST_28SF040_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, SST_28SF040, 0)
#define MCFG_SHARP_LH28F400_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, SHARP_LH28F400, 0)
@ -90,6 +93,7 @@ public:
FLASH_MACRONIX_29L001MC,
FLASH_PANASONIC_MN63F805MNP,
FLASH_SANYO_LE26FV10N1TS,
FLASH_SST_28SF040,
// 16-bit variants
FLASH_SHARP_LH28F400 = 0x1000,
@ -252,6 +256,11 @@ public:
sanyo_le26fv10n1ts_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
class sst_28sf040_device : public intelfsh8_device
{
public:
sst_28sf040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// 16-bit variants
class sharp_lh28f400_device : public intelfsh16_device
@ -298,6 +307,7 @@ extern const device_type INTEL_E28F400;
extern const device_type MACRONIX_29L001MC;
extern const device_type PANASONIC_MN63F805MNP;
extern const device_type SANYO_LE26FV10N1TS;
extern const device_type SST_28SF040;
extern const device_type SHARP_LH28F400;
extern const device_type INTEL_E28F008SA;

View File

@ -13,7 +13,6 @@
- RCV336ACFW 33.6kbps modem
TODO:
- SST-28SF040 flash
- RCV336ACFW modem
- Add similar models (Mivo 100/150/200/250/350)
- New Mail led
@ -60,6 +59,8 @@ public:
DECLARE_WRITE8_MEMBER( flash_0x4000_write_handler );
DECLARE_READ8_MEMBER( flash_0x8000_read_handler );
DECLARE_WRITE8_MEMBER( flash_0x8000_write_handler );
DECLARE_READ8_MEMBER( modem_r );
DECLARE_WRITE8_MEMBER( modem_w );
void lcd_w(UINT16 offset, int column, UINT8 data);
UINT8 lcd_r(UINT16 offset, int column);
@ -104,10 +105,7 @@ WRITE8_MEMBER( mstation_state::flash_0x0000_write_handler )
READ8_MEMBER( mstation_state::flash_0x4000_read_handler )
{
if (m_flash_at_0x4000 == 1)
return 0x00; //TODO: read from SST-28SF040
else
return m_flashes[m_flash_at_0x4000]->read(((m_bank1[0] & 0x3f)<<14) | offset);
return m_flashes[m_flash_at_0x4000]->read(((m_bank1[0] & 0x3f)<<14) | offset);
}
WRITE8_MEMBER( mstation_state::flash_0x4000_write_handler )
@ -125,6 +123,15 @@ WRITE8_MEMBER( mstation_state::flash_0x8000_write_handler )
m_flashes[m_flash_at_0x8000]->write(((m_bank2[0] & 0x3f)<<14) | offset, data);
}
READ8_MEMBER( mstation_state::modem_r )
{
return 0xff;
}
WRITE8_MEMBER( mstation_state::modem_w )
{
}
//***************************************************************************
// video hardware emulation
@ -208,6 +215,11 @@ void mstation_state::refresh_memory(UINT8 bank, UINT8 chip_select)
program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_right_r), this), write8_delegate(FUNC(mstation_state::lcd_right_w), this));
active_flash = -1;
break;
case 5: // modem
program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0x07, 0, read8_delegate(FUNC(mstation_state::modem_r), this), write8_delegate(FUNC(mstation_state::modem_w), this));
active_flash = -1;
break;
default:
logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff);
program.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff);
@ -254,7 +266,7 @@ WRITE8_MEMBER( mstation_state::port2_w )
bit 7: power down request
bit 5: real time clock
bit 6: unknown
bit 6: modem
bit 4: 1 sec int
bit 3: unknown
bit 0: unknown
@ -285,10 +297,10 @@ WRITE8_MEMBER( mstation_state::irq_w )
READ8_MEMBER( mstation_state::battery_status_r )
{
/*
bit 0-6 - unknown
bit 7 - battery status
bit 0-3 - unknown
bit 4-7 - battery status
*/
return 0x80;
return 0xf0;
}
WRITE8_MEMBER( mstation_state::kb_w )
@ -328,6 +340,7 @@ static ADDRESS_MAP_START(mstation_io , AS_IO, 8, mstation_state)
AM_RANGE( 0x07, 0x08 ) AM_READWRITE(bank2_r, bank2_w)
AM_RANGE( 0x09, 0x09 ) AM_READ(battery_status_r)
AM_RANGE( 0x10, 0x1f ) AM_DEVREADWRITE("rtc", rp5c01_device, read, write)
//AM_RANGE( 0x2c, 0x2c ) printer
ADDRESS_MAP_END
@ -473,7 +486,6 @@ WRITE_LINE_MEMBER( mstation_state::rtc_irq )
TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_1hz_timer)
{
m_irq |= (1<<4);
refresh_ints();
@ -481,7 +493,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_1hz_timer)
TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_kb_timer)
{
m_irq |= (1<<1);
refresh_ints();
@ -516,7 +527,7 @@ static MACHINE_CONFIG_START( mstation, mstation_state )
MCFG_DEFAULT_LAYOUT(layout_lcd)
MCFG_AMD_29F080_ADD("flash0")
MCFG_AMD_29F080_ADD("flash1") //SST-28SF040
MCFG_SST_28SF040_ADD("flash1")
// IRQ 4 is generated every second, used for auto power off
MCFG_TIMER_DRIVER_ADD_PERIODIC("1hz_timer", mstation_state, mstation_1hz_timer, attotime::from_hz(1))