From 4ce894b05fc0dd1ec8f0bb4ca4519a287a4e7240 Mon Sep 17 00:00:00 2001 From: Patrick Mackinlay Date: Tue, 22 Jan 2019 19:18:51 +0700 Subject: am9517a: added eisa variant --- src/devices/machine/am9517a.cpp | 31 ++++++++++++++++++++++++++--- src/devices/machine/am9517a.h | 43 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/devices/machine/am9517a.cpp b/src/devices/machine/am9517a.cpp index b4a48463e4d..d2637b11aa4 100644 --- a/src/devices/machine/am9517a.cpp +++ b/src/devices/machine/am9517a.cpp @@ -39,6 +39,18 @@ */ +/* + * The EISA_DMA device represents the 82C37A-compatible DMA devices present in + * EISA bus systems, in particular those embedded within the i82357 Integrated + * System Peripheral. The device supports 32 bit addressing, 32 bit data sizes, + * and 24 bit transfer counts, allowing DMA across 64k boundaries. It also adds + * stop registers, supporting ring-buffer memory arrangements. + * + * TODO + * - stop registers + * - 16/32-bit transfer sizes + */ + #include "emu.h" #include "am9517a.h" @@ -54,6 +66,7 @@ DEFINE_DEVICE_TYPE(AM9517A, am9517a_device, "am9517a", "AM9517A") DEFINE_DEVICE_TYPE(V5X_DMAU, v5x_dmau_device, "v5x_dmau", "V5X DMAU") DEFINE_DEVICE_TYPE(PCXPORT_DMAC, pcxport_dmac_device, "pcx_dmac", "PC Transporter DMAC") +DEFINE_DEVICE_TYPE(EISA_DMA, eisa_dma_device, "eisa_dma", "EISA DMA") //************************************************************************** @@ -290,8 +303,6 @@ inline void am9517a_device::dma_advance() { bool msb_changed = false; - m_channel[m_current_channel].m_count--; - if (m_current_channel || !COMMAND_MEM_TO_MEM || !COMMAND_CH0_ADDRESS_HOLD) { if (MODE_ADDRESS_DECREMENT) @@ -316,7 +327,7 @@ inline void am9517a_device::dma_advance() } } - if (m_channel[m_current_channel].m_count == 0xffff) + if (m_channel[m_current_channel].m_count-- == 0) { end_of_process(); } @@ -1298,3 +1309,17 @@ void pcxport_dmac_device::end_of_process() m_state = STATE_SI; } + +eisa_dma_device::eisa_dma_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : am9517a_device(mconfig, EISA_DMA, tag, owner, clock) +{ +} + +void eisa_dma_device::device_start() +{ + am9517a_device::device_start(); + + m_address_mask = 0xffffffffU; + + save_item(NAME(m_stop)); +} diff --git a/src/devices/machine/am9517a.h b/src/devices/machine/am9517a.h index 37390a930d3..33dfd0cdaa1 100644 --- a/src/devices/machine/am9517a.h +++ b/src/devices/machine/am9517a.h @@ -95,9 +95,9 @@ protected: struct { uint32_t m_address; - uint16_t m_count; + uint32_t m_count; uint32_t m_base_address; - uint16_t m_base_count; + uint32_t m_base_count; uint8_t m_mode; } m_channel[4]; @@ -186,11 +186,50 @@ protected: virtual void end_of_process() override; }; +class eisa_dma_device : public am9517a_device +{ +public: + eisa_dma_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + template u8 get_address_page() { return m_channel[Channel].m_address >> 16; } + template void set_address_page(u8 data) + { + m_channel[Channel].m_base_address = (m_channel[Channel].m_base_address & 0x0000ffffU) | (u32(data) << 16); + m_channel[Channel].m_address = (m_channel[Channel].m_address & 0x0000ffffU) | (u32(data) << 16); + } + + template u8 get_address_page_high() { return m_channel[Channel].m_address >> 24; } + template void set_address_page_high(u8 data) + { + m_channel[Channel].m_base_address = (m_channel[Channel].m_base_address & 0x00ffffffU) | (u32(data) << 24); + m_channel[Channel].m_address = (m_channel[Channel].m_address & 0x00ffffffU) | (u32(data) << 24); + } + + template u8 get_count_high() { return m_channel[Channel].m_count >> 16; } + template void set_count_high(u8 data) + { + m_channel[Channel].m_base_count = (m_channel[Channel].m_base_count & 0x0000ffffU) | (u32(data) << 16); + m_channel[Channel].m_count = (m_channel[Channel].m_count & 0x0000ffffU) | (u32(data) << 16); + } + template u32 get_stop() { return m_stop[Channel]; } + template void set_stop(offs_t offset, u32 data, u32 mem_mask) + { + mem_mask &= 0x00fffffcU; + COMBINE_DATA(&m_stop[Channel]); + } + +protected: + virtual void device_start() override; + +private: + u32 m_stop[4]; +}; // device type definition DECLARE_DEVICE_TYPE(AM9517A, am9517a_device) DECLARE_DEVICE_TYPE(V5X_DMAU, v5x_dmau_device) DECLARE_DEVICE_TYPE(PCXPORT_DMAC, pcxport_dmac_device) +DECLARE_DEVICE_TYPE(EISA_DMA, eisa_dma_device) #endif // MAME_MACHINE_AM9517_H -- cgit v1.2.3