mirror of
https://github.com/StrikerX3/StrikeBox.git
synced 2024-06-23 14:53:22 -04:00
Implement a basic ADM1032
This commit is contained in:
parent
673307a2bf
commit
0fc7143228
57
src/core/vixen/hw/sm/adm1032.cpp
Normal file
57
src/core/vixen/hw/sm/adm1032.cpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
// (C) Ivan "StrikerX3" Oliveira
|
||||
//
|
||||
// Datasheet: https://www.onsemi.com/pub/Collateral/ADM1032-D.PDF
|
||||
#include "adm1032.h"
|
||||
|
||||
namespace vixen {
|
||||
|
||||
ADM1032Device::~ADM1032Device() {
|
||||
}
|
||||
|
||||
void ADM1032Device::Init() {
|
||||
}
|
||||
|
||||
void ADM1032Device::Reset() {
|
||||
}
|
||||
|
||||
void ADM1032Device::QuickCommand(bool read) {
|
||||
}
|
||||
|
||||
uint8_t ADM1032Device::ReceiveByte() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t ADM1032Device::ReadByte(uint8_t command) {
|
||||
switch (command) {
|
||||
case ADM1032RegLocalTemp:
|
||||
return 40;
|
||||
case ADM1032RegExtTempHigh:
|
||||
return 30;
|
||||
case ADM1032RegExtTempLow:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t ADM1032Device::ReadWord(uint8_t command) {
|
||||
return ReadByte(command);
|
||||
}
|
||||
|
||||
int ADM1032Device::ReadBlock(uint8_t command, uint8_t *data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ADM1032Device::SendByte(uint8_t data) {
|
||||
}
|
||||
|
||||
void ADM1032Device::WriteByte(uint8_t command, uint8_t value) {
|
||||
}
|
||||
|
||||
void ADM1032Device::WriteWord(uint8_t command, uint16_t value) {
|
||||
}
|
||||
|
||||
void ADM1032Device::WriteBlock(uint8_t command, uint8_t* data, int length) {
|
||||
}
|
||||
|
||||
}
|
37
src/core/vixen/hw/sm/adm1032.h
Normal file
37
src/core/vixen/hw/sm/adm1032.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
// ADM1032 emulation
|
||||
// (C) Ivan "StrikerX3" Oliveira
|
||||
//
|
||||
// Datasheet: https://www.onsemi.com/pub/Collateral/ADM1032-D.PDF
|
||||
#pragma once
|
||||
|
||||
#include "sm.h"
|
||||
|
||||
namespace vixen {
|
||||
|
||||
enum ADM1032Register {
|
||||
ADM1032RegLocalTemp = 0x00, // (Read-only) Local Temperature Value
|
||||
ADM1032RegExtTempHigh = 0x01, // (Read-only) External Temperature Value high byte
|
||||
ADM1032RegExtTempLow = 0x10, // (Read-only) External Temperature Value low byte (only 3 most significant bits used, 0.125 C increments)
|
||||
};
|
||||
|
||||
class ADM1032Device : public SMDevice {
|
||||
public:
|
||||
virtual ~ADM1032Device();
|
||||
|
||||
// SMDevice functions
|
||||
void Init();
|
||||
void Reset();
|
||||
|
||||
void QuickCommand(bool read);
|
||||
uint8_t ReceiveByte();
|
||||
uint8_t ReadByte(uint8_t command);
|
||||
uint16_t ReadWord(uint8_t command);
|
||||
int ReadBlock(uint8_t command, uint8_t *data);
|
||||
|
||||
void SendByte(uint8_t data);
|
||||
void WriteByte(uint8_t command, uint8_t value);
|
||||
void WriteWord(uint8_t command, uint16_t value);
|
||||
void WriteBlock(uint8_t command, uint8_t* data, int length);
|
||||
};
|
||||
|
||||
}
|
|
@ -102,6 +102,7 @@ Xbox::~Xbox() {
|
|||
if (m_SMC != nullptr) delete m_SMC;
|
||||
if (m_EEPROM != nullptr) delete m_EEPROM;
|
||||
if (m_TVEncoder != nullptr) delete m_TVEncoder;
|
||||
if (m_ADM1032 != nullptr) delete m_ADM1032;
|
||||
|
||||
if (m_SMBus != nullptr) delete m_SMBus;
|
||||
|
||||
|
@ -453,6 +454,7 @@ EmulatorStatus Xbox::InitHardware() {
|
|||
|
||||
m_SMC = new SMCDevice(smcRevision);
|
||||
m_EEPROM = new EEPROMDevice();
|
||||
m_ADM1032 = new ADM1032Device();
|
||||
m_HostBridge = new HostBridgeDevice();
|
||||
m_MCPXRAM = new MCPXRAMDevice(mcpxRevision);
|
||||
m_LPC = new LPCDevice(m_IRQs, m_rom, m_bios, m_biosSize, m_mcpxROM, m_settings.hw_revision != DebugKit);
|
||||
|
@ -480,10 +482,10 @@ EmulatorStatus Xbox::InitHardware() {
|
|||
|
||||
m_SMBus->ConnectDevice(kSMBusAddress_SystemMicroController, m_SMC); // W 0x20 R 0x21
|
||||
m_SMBus->ConnectDevice(kSMBusAddress_EEPROM, m_EEPROM); // W 0xA8 R 0xA9
|
||||
m_SMBus->ConnectDevice(kSMBusAddress_TemperatureMeasurement, m_ADM1032); // W 0x98 R 0x99
|
||||
|
||||
// TODO: Other SMBus devices to connect
|
||||
//m_SMBus->ConnectDevice(kSMBusAddress_MCPX, m_MCPX); // W 0x10 R 0x11 -- TODO : Is MCPX an SMBus and/or PCI device?
|
||||
//m_SMBus->ConnectDevice(kSMBusAddress_TemperatureMeasurement, m_TemperatureMeasurement); // W 0x98 R 0x99
|
||||
//m_SMBus->ConnectDevice(kSMBusAddress_TVEncoder, m_TVEncoder); // W 0x88 R 0x89
|
||||
switch (tvEncoder) {
|
||||
case TVEncoder::Conexant:
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "vixen/hw/sm/smc.h"
|
||||
#include "vixen/hw/sm/eeprom.h"
|
||||
#include "vixen/hw/sm/tvenc.h"
|
||||
#include "vixen/hw/sm/adm1032.h"
|
||||
|
||||
#include "vixen/hw/pci/hostbridge.h"
|
||||
#include "vixen/hw/pci/mcpx_ram.h"
|
||||
|
@ -130,6 +131,7 @@ protected:
|
|||
SMCDevice *m_SMC;
|
||||
EEPROMDevice *m_EEPROM;
|
||||
TVEncoderDevice *m_TVEncoder;
|
||||
ADM1032Device *m_ADM1032;
|
||||
|
||||
PCIBus *m_PCIBus;
|
||||
HostBridgeDevice *m_HostBridge;
|
||||
|
|
Loading…
Reference in a new issue