summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/megadrive/stm95.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/megadrive/stm95.h')
-rw-r--r--src/devices/bus/megadrive/stm95.h51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/devices/bus/megadrive/stm95.h b/src/devices/bus/megadrive/stm95.h
index 1e0561f3fae..c1291e1f12f 100644
--- a/src/devices/bus/megadrive/stm95.h
+++ b/src/devices/bus/megadrive/stm95.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli, MetalliC
-#ifndef __MD_STM95_H
-#define __MD_STM95_H
+#ifndef MAME_BUS_MEGADRIVE_STM95_H
+#define MAME_BUS_MEGADRIVE_STM95_H
+
+#pragma once
#include "md_slot.h"
@@ -12,22 +14,11 @@
/* ST M95320 32Kbit serial EEPROM implementation */
// TO DO: STM95 should be made a separate EEPROM device and this should be merged with md_eeprom.c!
-#define M95320_SIZE 0x1000
-
-enum STMSTATE
-{
- IDLE = 0,
- CMD_WRSR,
- CMD_RDSR,
- M95320_CMD_READ,
- CMD_WRITE,
- READING,
- WRITING
-};
-
class stm95_eeprom_device
{
public:
+ static constexpr unsigned M95320_SIZE = 0x1000;
+
stm95_eeprom_device(running_machine &machine, uint8_t *eeprom);
running_machine &machine() const { return m_machine; }
@@ -39,6 +30,17 @@ public:
int get_so_line(void);
protected:
+ enum STMSTATE
+ {
+ IDLE = 0,
+ CMD_WRSR,
+ CMD_RDSR,
+ M95320_CMD_READ,
+ CMD_WRITE,
+ READING,
+ WRITING
+ };
+
int latch;
int reset_line;
int sck_line;
@@ -55,23 +57,24 @@ protected:
// ======================> md_eeprom_stm95_device
-class md_eeprom_stm95_device : public device_t,
- public device_md_cart_interface
+class md_eeprom_stm95_device : public device_t, public device_md_cart_interface
{
public:
// construction/destruction
- md_eeprom_stm95_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
md_eeprom_stm95_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
-
// reading and writing
virtual DECLARE_READ16_MEMBER(read) override;
virtual DECLARE_READ16_MEMBER(read_a13) override;
virtual DECLARE_WRITE16_MEMBER(write_a13) override;
+protected:
+ md_eeprom_stm95_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
private:
uint8_t m_bank[3];
int m_rdcnt;
@@ -81,6 +84,6 @@ private:
// device type definition
-extern const device_type MD_EEPROM_STM95;
+DECLARE_DEVICE_TYPE(MD_EEPROM_STM95, md_eeprom_stm95_device)
-#endif
+#endif // MAME_BUS_MEGADRIVE_STM95_H