From a5e4482ebff3aef553f7ceffdcfc14ddc408dfa8 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 19 Feb 2024 13:49:04 +0100 Subject: lc7582: rename file to lc7580 --- scripts/src/video.lua | 8 +-- src/devices/video/lc7580.cpp | 125 +++++++++++++++++++++++++++++++++++++++++++ src/devices/video/lc7580.h | 80 +++++++++++++++++++++++++++ src/devices/video/lc7582.cpp | 125 ------------------------------------------- src/devices/video/lc7582.h | 80 --------------------------- src/mame/cxg/dominator.cpp | 2 +- src/mame/cxg/professor.cpp | 2 +- 7 files changed, 211 insertions(+), 211 deletions(-) create mode 100644 src/devices/video/lc7580.cpp create mode 100644 src/devices/video/lc7580.h delete mode 100644 src/devices/video/lc7582.cpp delete mode 100644 src/devices/video/lc7582.h diff --git a/scripts/src/video.lua b/scripts/src/video.lua index edac07a927f..825ff9b08a9 100644 --- a/scripts/src/video.lua +++ b/scripts/src/video.lua @@ -619,13 +619,13 @@ end -------------------------------------------------- -- ---@src/devices/video/lc7582.h,VIDEOS["LC7582"] = true +--@src/devices/video/lc7580.h,VIDEOS["LC7580"] = true -------------------------------------------------- -if (VIDEOS["LC7582"]~=null) then +if (VIDEOS["LC7580"]~=null) then files { - MAME_DIR .. "src/devices/video/lc7582.cpp", - MAME_DIR .. "src/devices/video/lc7582.h", + MAME_DIR .. "src/devices/video/lc7580.cpp", + MAME_DIR .. "src/devices/video/lc7580.h", } end diff --git a/src/devices/video/lc7580.cpp b/src/devices/video/lc7580.cpp new file mode 100644 index 00000000000..17090f74578 --- /dev/null +++ b/src/devices/video/lc7580.cpp @@ -0,0 +1,125 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + +Sanyo LC7580 LCD Driver + +53 outputs (static), or 104 outputs (1/2 duty) + +TODO: +- any difference between LC7580 and LC7582? +- OSC pin (input is R/C) +- AD/DSP function + +*/ + +#include "emu.h" +#include "video/lc7580.h" + + +DEFINE_DEVICE_TYPE(LC7580, lc7580_device, "lc7580", "Sanyo LC7580 LCD Driver") +DEFINE_DEVICE_TYPE(LC7582, lc7582_device, "lc7582", "Sanyo LC7582 LCD Driver") + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +lc7580_device::lc7580_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, type, tag, owner, clock), + m_write_segs(*this) +{ } + +lc7580_device::lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + lc7580_device(mconfig, LC7580, tag, owner, clock) +{ } + +lc7582_device::lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + lc7580_device(mconfig, LC7582, tag, owner, clock) +{ } + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void lc7580_device::device_start() +{ + // zerofill + m_data = 0; + m_ce = 0; + m_clk = 0; + m_blank = false; + m_duty = 0; + m_addsp = 0; + m_shift = 0; + std::fill_n(m_latch, std::size(m_latch), 0); + + // register for savestates + save_item(NAME(m_data)); + save_item(NAME(m_ce)); + save_item(NAME(m_clk)); + save_item(NAME(m_blank)); + save_item(NAME(m_duty)); + save_item(NAME(m_addsp)); + save_item(NAME(m_shift)); + save_item(NAME(m_latch)); +} + + +//------------------------------------------------- +// handlers +//------------------------------------------------- + +void lc7580_device::refresh_output() +{ + if (m_duty) + { + u64 segs[2] = { 0, 0 }; + + // COM1 on even bits, COM2 on uneven bits + for (int i = 0; i < 104; i++) + segs[i & 1] |= BIT(m_latch[i / 52], i % 52) << (i >> 1); + + for (int i = 0; i < 2; i++) + m_write_segs(i, m_blank ? 0 : segs[i]); + } + else + { + m_write_segs(0, m_blank ? 0 : m_latch[0]); + m_write_segs(1, 0); + } +} + +void lc7580_device::clk_w(int state) +{ + state = (state) ? 1 : 0; + + // clock shift register + if (state && !m_clk) + m_shift = m_shift >> 1 | u64(m_data) << 55; + + m_clk = state; +} + +void lc7580_device::ce_w(int state) +{ + state = (state) ? 1 : 0; + + // latch at falling edge + if (!state && m_ce) + { + // d53: DP (drive mode select, aka duty) + // d54: DQ (AD/DSP function) + // d55: latch select + if (!BIT(m_shift, 55)) + { + m_duty = BIT(m_shift, 53); + m_addsp = BIT(m_shift, 54); + } + + m_latch[BIT(m_shift, 55)] = m_shift & u64(0x1f'ffff'ffff'ffff); + refresh_output(); + } + + m_ce = state; +} diff --git a/src/devices/video/lc7580.h b/src/devices/video/lc7580.h new file mode 100644 index 00000000000..583ce3c45d6 --- /dev/null +++ b/src/devices/video/lc7580.h @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Sanyo LC7580 LCD Driver + +*/ + +#ifndef MAME_VIDEO_LC7580_H +#define MAME_VIDEO_LC7580_H + +#pragma once + +/* + +quick pinout reference (64-pin QFP) + +pin desc +------------------------------ +1-54 = S1-S53 segment outputs, pin 24 N/C, pins 45-54 also used with AD/DSP +55 = OSC +56 = Vdd +57 = _INH +58 = Vlcd +59 = Vss +60 = CE \ +61 = CLK | serial input +62 = DATA / +63,64 = COM1/COM2 outputs + +*/ + + +class lc7580_device : public device_t +{ +public: + lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + // configuration helpers + auto write_segs() { return m_write_segs.bind(); } // S pins, COM1/COM2 in offset + + void data_w(int state) { m_data = (state) ? 1 : 0; } + void clk_w(int state); + void ce_w(int state); + void inh_w(int state) { m_blank = bool(state); refresh_output(); } + +protected: + lc7580_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + + // device_t implementation + virtual void device_start() override; + +private: + void refresh_output(); + + int m_data; + int m_ce; + int m_clk; + bool m_blank; + + int m_duty; + int m_addsp; + u64 m_shift; + u64 m_latch[2]; + + // callbacks + devcb_write64 m_write_segs; +}; + +class lc7582_device : public lc7580_device +{ +public: + lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + + +DECLARE_DEVICE_TYPE(LC7580, lc7580_device) +DECLARE_DEVICE_TYPE(LC7582, lc7582_device) + +#endif // MAME_VIDEO_LC7580_H diff --git a/src/devices/video/lc7582.cpp b/src/devices/video/lc7582.cpp deleted file mode 100644 index 221c7450c1c..00000000000 --- a/src/devices/video/lc7582.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/* - -Sanyo LC7580 LCD Driver - -53 outputs (static), or 104 outputs (1/2 duty) - -TODO: -- any difference between LC7580 and LC7582? -- OSC pin (input is R/C) -- AD/DSP function - -*/ - -#include "emu.h" -#include "video/lc7582.h" - - -DEFINE_DEVICE_TYPE(LC7580, lc7580_device, "lc7580", "Sanyo LC7580 LCD Driver") -DEFINE_DEVICE_TYPE(LC7582, lc7582_device, "lc7582", "Sanyo LC7582 LCD Driver") - -//------------------------------------------------- -// constructor -//------------------------------------------------- - -lc7580_device::lc7580_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : - device_t(mconfig, type, tag, owner, clock), - m_write_segs(*this) -{ } - -lc7580_device::lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - lc7580_device(mconfig, LC7580, tag, owner, clock) -{ } - -lc7582_device::lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - lc7580_device(mconfig, LC7582, tag, owner, clock) -{ } - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void lc7580_device::device_start() -{ - // zerofill - m_data = 0; - m_ce = 0; - m_clk = 0; - m_blank = false; - m_duty = 0; - m_addsp = 0; - m_shift = 0; - std::fill_n(m_latch, std::size(m_latch), 0); - - // register for savestates - save_item(NAME(m_data)); - save_item(NAME(m_ce)); - save_item(NAME(m_clk)); - save_item(NAME(m_blank)); - save_item(NAME(m_duty)); - save_item(NAME(m_addsp)); - save_item(NAME(m_shift)); - save_item(NAME(m_latch)); -} - - -//------------------------------------------------- -// handlers -//------------------------------------------------- - -void lc7580_device::refresh_output() -{ - if (m_duty) - { - u64 segs[2] = { 0, 0 }; - - // COM1 on even bits, COM2 on uneven bits - for (int i = 0; i < 104; i++) - segs[i & 1] |= BIT(m_latch[i / 52], i % 52) << (i >> 1); - - for (int i = 0; i < 2; i++) - m_write_segs(i, m_blank ? 0 : segs[i]); - } - else - { - m_write_segs(0, m_blank ? 0 : m_latch[0]); - m_write_segs(1, 0); - } -} - -void lc7580_device::clk_w(int state) -{ - state = (state) ? 1 : 0; - - // clock shift register - if (state && !m_clk) - m_shift = m_shift >> 1 | u64(m_data) << 55; - - m_clk = state; -} - -void lc7580_device::ce_w(int state) -{ - state = (state) ? 1 : 0; - - // latch at falling edge - if (!state && m_ce) - { - // d53: DP (drive mode select, aka duty) - // d54: DQ (AD/DSP function) - // d55: latch select - if (!BIT(m_shift, 55)) - { - m_duty = BIT(m_shift, 53); - m_addsp = BIT(m_shift, 54); - } - - m_latch[BIT(m_shift, 55)] = m_shift & u64(0x1f'ffff'ffff'ffff); - refresh_output(); - } - - m_ce = state; -} diff --git a/src/devices/video/lc7582.h b/src/devices/video/lc7582.h deleted file mode 100644 index 668dc4f021d..00000000000 --- a/src/devices/video/lc7582.h +++ /dev/null @@ -1,80 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:hap -/* - - Sanyo LC7580 LCD Driver - -*/ - -#ifndef MAME_VIDEO_LC7582_H -#define MAME_VIDEO_LC7582_H - -#pragma once - -/* - -quick pinout reference (64-pin QFP) - -pin desc ------------------------------- -1-54 = S1-S53 segment outputs, pin 24 N/C, pins 45-54 also used with AD/DSP -55 = OSC -56 = Vdd -57 = _INH -58 = Vlcd -59 = Vss -60 = CE \ -61 = CLK | serial input -62 = DATA / -63,64 = COM1/COM2 outputs - -*/ - - -class lc7580_device : public device_t -{ -public: - lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - - // configuration helpers - auto write_segs() { return m_write_segs.bind(); } // S pins, COM1/COM2 in offset - - void data_w(int state) { m_data = (state) ? 1 : 0; } - void clk_w(int state); - void ce_w(int state); - void inh_w(int state) { m_blank = bool(state); refresh_output(); } - -protected: - lc7580_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); - - // device_t implementation - virtual void device_start() override; - -private: - void refresh_output(); - - int m_data; - int m_ce; - int m_clk; - bool m_blank; - - int m_duty; - int m_addsp; - u64 m_shift; - u64 m_latch[2]; - - // callbacks - devcb_write64 m_write_segs; -}; - -class lc7582_device : public lc7580_device -{ -public: - lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); -}; - - -DECLARE_DEVICE_TYPE(LC7580, lc7580_device) -DECLARE_DEVICE_TYPE(LC7582, lc7582_device) - -#endif // MAME_VIDEO_LC7582_H diff --git a/src/mame/cxg/dominator.cpp b/src/mame/cxg/dominator.cpp index 70d233ff661..e87845df2ec 100644 --- a/src/mame/cxg/dominator.cpp +++ b/src/mame/cxg/dominator.cpp @@ -27,7 +27,7 @@ Sphinx Galaxy is on similar hardware too, with less leds. #include "machine/nvram.h" #include "machine/sensorboard.h" #include "sound/dac.h" -#include "video/lc7582.h" +#include "video/lc7580.h" #include "video/pwm.h" #include "speaker.h" diff --git a/src/mame/cxg/professor.cpp b/src/mame/cxg/professor.cpp index d18329d5561..a0544a8d90b 100644 --- a/src/mame/cxg/professor.cpp +++ b/src/mame/cxg/professor.cpp @@ -27,7 +27,7 @@ TODO: #include "cpu/m6800/m6801.h" #include "machine/sensorboard.h" #include "sound/dac.h" -#include "video/lc7582.h" +#include "video/lc7580.h" #include "video/pwm.h" #include "screen.h" -- cgit v1.2.3