From 9634008e964779c49ab5aa99e99cbd4a357f0d88 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Wed, 22 May 2013 13:30:01 +0000 Subject: [PATCH] Added skeleton for uPD7227 LCD controller. (nw) --- .gitattributes | 2 + src/emu/emu.mak | 1 + src/emu/video/upd7227.c | 144 ++++++++++++++++++++++++++++++++++++++++ src/emu/video/upd7227.h | 74 +++++++++++++++++++++ 4 files changed, 221 insertions(+) create mode 100644 src/emu/video/upd7227.c create mode 100644 src/emu/video/upd7227.h diff --git a/.gitattributes b/.gitattributes index 20c2f38342a..93ea810affb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1885,6 +1885,8 @@ src/emu/video/upd3301.c svneol=native#text/plain src/emu/video/upd3301.h svneol=native#text/plain src/emu/video/upd7220.c svneol=native#text/plain src/emu/video/upd7220.h svneol=native#text/plain +src/emu/video/upd7227.c svneol=native#text/plain +src/emu/video/upd7227.h svneol=native#text/plain src/emu/video/v9938.c svneol=native#text/plain src/emu/video/v9938.h svneol=native#text/plain src/emu/video/vector.c svneol=native#text/plain diff --git a/src/emu/emu.mak b/src/emu/emu.mak index d0d0508fac6..b5c494bb56d 100644 --- a/src/emu/emu.mak +++ b/src/emu/emu.mak @@ -363,6 +363,7 @@ EMUVIDEOOBJS = \ $(EMUVIDEO)/tms9928a.o \ $(EMUVIDEO)/upd3301.o \ $(EMUVIDEO)/upd7220.o \ + $(EMUVIDEO)/upd7227.o \ $(EMUVIDEO)/v9938.o \ $(EMUVIDEO)/vector.o \ $(EMUVIDEO)/voodoo.o \ diff --git a/src/emu/video/upd7227.c b/src/emu/video/upd7227.c new file mode 100644 index 00000000000..9f202d192b0 --- /dev/null +++ b/src/emu/video/upd7227.c @@ -0,0 +1,144 @@ +/********************************************************************** + + uPD7227 Liquid Crystal Display Controller/Driver emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "emu.h" +#include "upd7227.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type UPD7227 = &device_creator; + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// upd7227_device - constructor +//------------------------------------------------- + +upd7227_device::upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD7227, "uPD7227", tag, owner, clock), + m_cs(1), + m_cd(1), + m_sck(1), + m_si(1), + m_so(1) +{ +} + + +//------------------------------------------------- +// static_set_config - configuration helper +//------------------------------------------------- + +void upd7227_device::static_set_config(device_t &device, int sx, int sy) +{ + upd7227_device &upd7227 = downcast(device); + + upd7227.m_sx = sx; + upd7227.m_sy = sy; +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd7227_device::device_start() +{ + // state saving + save_item(NAME(m_cs)); + save_item(NAME(m_cd)); + save_item(NAME(m_sck)); + save_item(NAME(m_si)); + save_item(NAME(m_so)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd7227_device::device_reset() +{ +} + + +//------------------------------------------------- +// update_screen - update screen +//------------------------------------------------- + +UINT32 upd7227_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +//------------------------------------------------- +// cs_w - chip select +//------------------------------------------------- + +WRITE_LINE_MEMBER( upd7227_device::cs_w ) +{ + m_cs = state; +} + + +//------------------------------------------------- +// cd_w - command/data select +//------------------------------------------------- + +WRITE_LINE_MEMBER( upd7227_device::cd_w ) +{ + m_cd = state; +} + + +//------------------------------------------------- +// sck_w - serial clock +//------------------------------------------------- + +WRITE_LINE_MEMBER( upd7227_device::sck_w ) +{ + m_sck = state; +} + + +//------------------------------------------------- +// si_w - serial input +//------------------------------------------------- + +WRITE_LINE_MEMBER( upd7227_device::si_w ) +{ + m_si = state; +} + + +//------------------------------------------------- +// so_r - serial output/busy +//------------------------------------------------- + +READ_LINE_MEMBER( upd7227_device::so_r ) +{ + return m_so; +} diff --git a/src/emu/video/upd7227.h b/src/emu/video/upd7227.h new file mode 100644 index 00000000000..a4bc0d4b5a5 --- /dev/null +++ b/src/emu/video/upd7227.h @@ -0,0 +1,74 @@ +/********************************************************************** + + uPD7227 Liquid Crystal Display Controller/Driver emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#pragma once + +#ifndef __UPD7227__ +#define __UPD7227__ + +#include "emu.h" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_UPD7227_ADD(_tag, _sx, _sy) \ + MCFG_DEVICE_ADD(_tag, UPD7227, 0) \ + upd7227_device::static_set_config(*device, _sx, _sy); + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> upd7227_device + +class upd7227_device : public device_t +{ +public: + // construction/destruction + upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // inline configuration helpers + static void static_set_config(device_t &device, int sx, int sy); + + DECLARE_WRITE_LINE_MEMBER( cs_w ); + DECLARE_WRITE_LINE_MEMBER( cd_w ); + DECLARE_WRITE_LINE_MEMBER( sck_w ); + DECLARE_WRITE_LINE_MEMBER( si_w ); + DECLARE_READ_LINE_MEMBER( so_r ); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + int m_sx; + int m_sy; + + int m_cs; + int m_cd; + int m_sck; + int m_si; + int m_so; +}; + + +// device type definition +extern const device_type UPD7227; + + + +#endif