summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/express.cpp
#dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#include "emu.h"
#include "pci-smbus.h"

DEFINE_DEVICE_TYPE(SMBUS, smbus_device, "smbus", "SMBus interface")

void smbus_device::map(address_map &map)
{
	map(0x00, 0x00).rw(FUNC(smbus_device::hst_sts_r), FUNC(smbus_device::hst_sts_w));
	map(0x02, 0x02).rw(FUNC(smbus_device::hst_cnt_r), FUNC(smbus_device::hst_cnt_w));
	map(0x03, 0x03).rw(FUNC(smbus_device::hst_cmd_r), FUNC(smbus_device::hst_cmd_w));
	map(0x04, 0x04).rw(FUNC(smbus_device::xmit_slva_r), FUNC(smbus_device::xmit_slva_w));
	map(0x05, 0x05).rw(FUNC(smbus_device::hst_d0_r), FUNC(smbus_device::hst_d0_w));
	map(0x06, 0x06).rw(FUNC(smbus_device::hst_d1_r), FUNC(smbus_device::hst_d1_w));
	map(0x07, 0x07).rw(FUNC(smbus_device::host_block_db_r), FUNC(smbus_device::host_block_db_w));
	map(0x08, 0x08).rw(FUNC(smbus_device::pec_r), FUNC(smbus_device::pec_w));
	map(0x09, 0x09).rw(FUNC(smbus_device::rcv_slva_r), FUNC(smbus_device::rcv_slva_w));
	map(0x0a, 0x0b).rw(FUNC(smbus_device::slv_data_r), FUNC(smbus_device::slv_data_w));
	map(0x0c, 0x0c).rw(FUNC(smbus_device::aux_sts_r), FUNC(smbus_device::aux_sts_w));
	map(0x0d, 0x0d).rw(FUNC(smbus_device::aux_ctl_r), FUNC(smbus_device::aux_ctl_w));
	map(0x0e, 0x0e).rw(FUNC(smbus_device::smlink_pin_ctl_r), FUNC(smbus_device::smlink_pin_ctl_w));
	map(0x0f, 0x0f).rw(FUNC(smbus_device::smbus_pin_ctl_r), FUNC(smbus_device::smbus_pin_ctl_w));
	map(0x10, 0x10).rw(FUNC(smbus_device::slv_sts_r), FUNC(smbus_device::slv_sts_w));
	map(0x11, 0x11).rw(FUNC(smbus_device::slv_cmd_r), FUNC(smbus_device::slv_cmd_w));
	map(0x14, 0x14).r(FUNC(smbus_device::notify_daddr_r));
	map(0x16, 0x16).r(FUNC(smbus_device::notify_dlow_r));
	map(0x17, 0x17).r(FUNC(smbus_device::notify_dhigh_r));
}

smbus_device::smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: pci_device(mconfig, SMBUS, tag, owner, clock)
{
}

void smbus_device::device_start()
{
	pci_device::device_start();
	skip_map_regs(4);
	add_map(32, M_IO, FUNC(smbus_device::map));
}

void smbus_device::device_reset()
{
	pci_device::device_reset();
	hst_sts = 0x00;
	hst_cnt = 0x00;
	hst_cmd = 0x00;
	xmit_slva = 0x00;
	hst_d0 = 0x00;
	hst_d1 = 0x00;
	host_block_db = 0x00;
	pec = 0x00;
	rcv_slva = 0x44;
	slv_data = 0x0000;
	aux_sts = 0x00;
	aux_ctl = 0x00;
	smlink_pin_ctl = 0x00;
	smbus_pin_ctl = 0x00;
	slv_sts = 0x00;
	slv_cmd = 0x00;
	notify_daddr = 0x00;
	notify_dlow = 0x00;
	notify_dhigh = 0x00;
}

uint8_t smbus_device::hst_sts_r()
{
	return hst_sts;
}

void smbus_device::hst_sts_w(uint8_t data)
{
	hst_sts &= ~data;
	logerror("%s: hst_sts = %02x\n", tag(), hst_sts);
}

uint8_t smbus_device::hst_cnt_r()
{
	return hst_cnt;
}

void smbus_device::hst_cnt_w(uint8_t data)
{
	hst_cnt = data;
	logerror("%s: hst_cnt = %02x\n", tag(), hst_cnt);

	if(xmit_slva != 0xa1)
		hst_sts = 4;
	else {
		const uint8_t eeprom[256] = {
			0x80, 0x08, 0x07, 0x0D, 0x0A, 0x02, 0x40, 0x00, 0x04, 0x50, 0x60, 0x00, 0x82, 0x08, 0x00, 0x01,
			0x0E, 0x04, 0x08, 0x01, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x28, 0x3C, 0x28, 0x40,
			0x60, 0x60, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x46, 0x28, 0x28, 0x55, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE,
			0x7F, 0x7F, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x56, 0x53, 0x35, 0x31, 0x32, 0x4D, 0x42,
			0x34, 0x30, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		};

		hst_sts = 2;
		hst_d0 = eeprom[hst_cmd];
	}
}

uint8_t smbus_device::hst_cmd_r()
{
	return hst_cmd;
}

void smbus_device::hst_cmd_w(uint8_t data)
{
	hst_cmd = data;
	logerror("%s: hst_cmd = %02x\n", tag(), hst_cmd);
}

uint8_t smbus_device::xmit_slva_r()
{
	return xmit_slva;
}

void smbus_device::xmit_slva_w(uint8_t data)
{
	xmit_slva = data;
	logerror("%s: xmit_slva = %02x\n", tag(), xmit_slva);
}

uint8_t smbus_device::hst_d0_r()
{
	return hst_d0;
}

void smbus_device::hst_d0_w(uint8_t data)
{
	hst_d0 = data;
	logerror("%s: hst_d0 = %02x\n", tag(), hst_d0);
}

uint8_t smbus_device::hst_d1_r()
{
	return hst_d1;
}

void smbus_device::hst_d1_w(uint8_t data)
{
	hst_d1 = data;
	logerror("%s: hst_d1 = %02x\n", tag(), hst_d1);
}

uint8_t smbus_device::host_block_db_r()
{
	return host_block_db;
}

void smbus_device::host_block_db_w(uint8_t data)
{
	host_block_db = data;
	logerror("%s: host_block_db = %02x\n", tag(), host_block_db);
}

uint8_t smbus_device::pec_r()
{
	return pec;
}

void smbus_device::pec_w(uint8_t data)
{
	pec = data;
	logerror("%s: pec = %02x\n", tag(), pec);
}

uint8_t smbus_device::rcv_slva_r()
{
	return rcv_slva;
}

void smbus_device::rcv_slva_w(uint8_t data)
{
	rcv_slva = data;
	logerror("%s: rcv_slva = %02x\n", tag(), rcv_slva);
}

uint16_t smbus_device::slv_data_r()
{
	return slv_data;
}

void smbus_device::slv_data_w(uint16_t data)
{
	slv_data = data;
	logerror("%s: slv_data = %02x\n", tag(), slv_data);
}

uint8_t smbus_device::aux_sts_r()
{
	return aux_sts;
}

void smbus_device::aux_sts_w(uint8_t data)
{
	aux_sts = data;
	logerror("%s: aux_sts = %02x\n", tag(), aux_sts);
}

uint8_t smbus_device::aux_ctl_r()
{
	return aux_ctl;
}

void smbus_device::aux_ctl_w(uint8_t data)
{
	aux_ctl = data;
	logerror("%s: aux_ctl = %02x\n", tag(), aux_ctl);
}

uint8_t smbus_device::smlink_pin_ctl_r()
{
	return smlink_pin_ctl;
}

void smbus_device::smlink_pin_ctl_w(uint8_t data)
{
	smlink_pin_ctl = data;
	logerror("%s: smlink_pin_ctl = %02x\n", tag(), smlink_pin_ctl);
}

uint8_t smbus_device::smbus_pin_ctl_r()
{
	return smbus_pin_ctl;
}

void smbus_device::smbus_pin_ctl_w(uint8_t data)
{
	smbus_pin_ctl = data;
	logerror("%s: smbus_pin_ctl = %02x\n", tag(), smbus_pin_ctl);
}

uint8_t smbus_device::slv_sts_r()
{
	return slv_sts;
}

void smbus_device::slv_sts_w(uint8_t data)
{
	slv_sts = data;
	logerror("%s: slv_sts = %02x\n", tag(), slv_sts);
}

uint8_t smbus_device::slv_cmd_r()
{
	return slv_cmd;
}

void smbus_device::slv_cmd_w(uint8_t data)
{
	slv_cmd = data;
	logerror("%s: slv_cmd = %02x\n", tag(), slv_cmd);
}

uint8_t smbus_device::notify_daddr_r()
{
	return notify_daddr;
}

uint8_t smbus_device::notify_dlow_r()
{
	return notify_dlow;
}

uint8_t smbus_device::notify_dhigh_r()
{
	return notify_dhigh;
}
Commit message (Collapse)AuthorAgeFilesLines
* debug/express.cpp: Fix bad iterator comparison in postfix conversion. (#12197) invertego2024-03-301-1/+1
| | | | | | One iterator was being compared with another from the wrong container. I observed this by chance when I hit an assert in a debug MSVC build with checked iterators enabled. This bug could cause dereferencing of a past-the-end iterator in expressions ending with an operator.
* dimemory: Add the target address space to translate, wrap the constants Olivier Galibert2023-03-181-10/+14
| | | | divtlb: Wrap the constants
* Revert "Make numbers signed in debugger where it matters" Vas Crabb2022-11-271-10/+10
| | | | | | | | | | | | | | This reverts commit 922d5b3c81459173ce99970dca0e44825f0a4494. This broke an important use case with MIPS3 address comparisons no longer behaving intutively. It's also another case of a debugger change that wasn't followed through properly, with absolutely no attempt to update the internal debugger help or the documentation for the web site. I realise signed maths woud be a useful feature, for the debugger, but it needs to be done in a way that doesn't break important use cases.
* Make numbers signed in debugger where it matters AJR2022-11-161-10/+10
| | | | | | | - Perform signed calculations for /, %, >>, /=, %=, >>=, <, >, <=, >= operators in debugger expressions - Eliminate workarounds in debugger printf method for system printf not reliably handling 64-bit integers (a previous refactoring adopted strformat for this) - Output signed decimals for %d in debugger printf formats; also add %u format - Add two-argument sext function to debugger
* Addressed some Lua scripting pitfalls. (#9294) Vas Crabb2022-02-121-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Addressed pure virtual function call crash on end of emulation session if you haven't explicitly removed all address space taps, memory corruption on end of emulation session if you haven't explicitly removed all address space change notifiers, and symbol being garbage-collected out from under you while you have parsed expressions or other symbol tables that depend on them. Removed the copy constructor for parsed expressions as the underlying C++ copy constructor appears to be broken, and simplified symbol table constructors. Also made symbol table add methods return the new entry to avoid the need for an extra lookup. Fixed breakpoint/watchpoint objects being inappropriately copied into the tables returned by bplist() and wplist(), allowing the enabled property to be modifiable for breakpoint and watchpoint objects in Lua. Fixed drivers and devices causing a new memory pass-through handler to be allocated on each soft reset, and fixed multiple instances of taps being installed in the event the machine is reset before the tap is removed. Added classes for managing broadcast subscriptions, and adapted address spaces to use this for change notifications.
* debugger: Memory accesses in expressions don't support taking the first ↵ Vas Crabb2021-10-201-3/+3
| | | | exposed space (yet).
* express.cpp: Fix regression in interpreting db@, ib@, ob@ and similar memory ↵ AJR2021-10-191-0/+4
| | | | access operators
* More user experience improvements: Vas Crabb2021-10-141-146/+146
| | | | | | | | | | | | | | | | | | | | | | | | | frontend: Allow clicking the adjuster arrows on menu items. This allows things like video options and DIP switches to be configured using a mouse only. Also fixed a bug preventing paging menus with a mouse if the first item scrolled off the bottom is not selectable. debugger: Allow wplist and bplist to accept a CPU argument to list breakpoints/watchpoints for a single CPU only. debugger: Fixed some corner cases in address space syntax in memory accesses, and allowed memory region accesses to use tags relative to the visible CPU. emu/softlist.cpp: Ignore notes elements when loading software lists. It's effectively a comment that isn't a comment syntactically, it's being used for things that are not useful to display in the internal UI, and it slows down startup. docs: Updated three more pages of debugger documentation. Also updated more of the built-in debugger help. minimaws: Fixed up schema for software list notes, made sofware list notes display initially collapsed.
* Various improvements to the user experience: Vas Crabb2021-10-131-183/+136
| | | | | | | | | | | | | | | | | | Extended the memory access prefixes in debugger expressions to support address space names. Made the debugger history command aware of how much history it has collected, and added a help topic for it to the built-in debugger help. Started updating the documentation for the web site, and corrected some of the more misleading built-in debugger help. Made some corrections to Chinese localisation after discussion with YuiFAN. Darkened the UI red colour a little. cpu/m6502/st2205u.h: Marked sound imperfect.