Implemented termal sensor device
This commit is contained in:
parent
5f27e27a06
commit
2608a2767c
|
@ -260,6 +260,7 @@
|
||||||
<ClInclude Include="..\..\src\Common\Win32\XBController.h" />
|
<ClInclude Include="..\..\src\Common\Win32\XBController.h" />
|
||||||
<ClInclude Include="..\..\src\Common\Xbe.h" />
|
<ClInclude Include="..\..\src\Common\Xbe.h" />
|
||||||
<ClInclude Include="..\..\src\Common\Win32\XBVideo.h" />
|
<ClInclude Include="..\..\src\Common\Win32\XBVideo.h" />
|
||||||
|
<ClInclude Include="..\..\src\devices\ADM1032Device.h" />
|
||||||
<ClInclude Include="..\..\src\devices\EEPROMDevice.h" />
|
<ClInclude Include="..\..\src\devices\EEPROMDevice.h" />
|
||||||
<ClInclude Include="..\..\src\devices\EmuNVNet.h" />
|
<ClInclude Include="..\..\src\devices\EmuNVNet.h" />
|
||||||
<ClInclude Include="..\..\src\devices\LED.h" />
|
<ClInclude Include="..\..\src\devices\LED.h" />
|
||||||
|
@ -637,6 +638,7 @@
|
||||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\devices\ADM1032Device.cpp" />
|
||||||
<ClCompile Include="..\..\src\devices\EEPROMDevice.cpp" />
|
<ClCompile Include="..\..\src\devices\EEPROMDevice.cpp" />
|
||||||
<ClCompile Include="..\..\src\devices\EmuNVNet.cpp" />
|
<ClCompile Include="..\..\src\devices\EmuNVNet.cpp" />
|
||||||
<ClCompile Include="..\..\src\devices\MCPXDevice.cpp" />
|
<ClCompile Include="..\..\src\devices\MCPXDevice.cpp" />
|
||||||
|
|
|
@ -266,6 +266,9 @@
|
||||||
<Filter>Hardware\Video</Filter>
|
<Filter>Hardware\Video</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\HighPerformanceGraphicsEnabler.c" />
|
<ClCompile Include="..\..\src\HighPerformanceGraphicsEnabler.c" />
|
||||||
|
<ClCompile Include="..\..\src\devices\ADM1032Device.cpp">
|
||||||
|
<Filter>Hardware</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\src\Cxbx\DlgControllerConfig.h">
|
<ClInclude Include="..\..\src\Cxbx\DlgControllerConfig.h">
|
||||||
|
@ -529,6 +532,9 @@
|
||||||
<ClInclude Include="..\..\src\devices\video\queue.h">
|
<ClInclude Include="..\..\src\devices\video\queue.h">
|
||||||
<Filter>Hardware\Video</Filter>
|
<Filter>Hardware\Video</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\devices\ADM1032Device.h">
|
||||||
|
<Filter>Hardware</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\resource\Splash.jpg">
|
<None Include="..\..\resource\Splash.jpg">
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
|
||||||
|
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||||
|
// ******************************************************************
|
||||||
|
// *
|
||||||
|
// * .,-::::: .,:: .::::::::. .,:: .:
|
||||||
|
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
|
||||||
|
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
|
||||||
|
// * $$$ Y$$$P $$""""Y$$ Y$$$P
|
||||||
|
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||||
|
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||||
|
// *
|
||||||
|
// * src->devices->ADM1032Device.cpp
|
||||||
|
// *
|
||||||
|
// * This file is part of the Cxbx project.
|
||||||
|
// *
|
||||||
|
// * Cxbx and Cxbe are free software; you can redistribute them
|
||||||
|
// * and/or modify them under the terms of the GNU General Public
|
||||||
|
// * License as published by the Free Software Foundation; either
|
||||||
|
// * version 2 of the license, or (at your option) any later version.
|
||||||
|
// *
|
||||||
|
// * This program is distributed in the hope that it will be useful,
|
||||||
|
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// * GNU General Public License for more details.
|
||||||
|
// *
|
||||||
|
// * You should have recieved a copy of the GNU General Public License
|
||||||
|
// * along with this program; see the file COPYING.
|
||||||
|
// * If not, write to the Free Software Foundation, Inc.,
|
||||||
|
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
||||||
|
// *
|
||||||
|
// * (c) 2018 ergo720
|
||||||
|
// *
|
||||||
|
// * All rights reserved
|
||||||
|
// *
|
||||||
|
// ******************************************************************
|
||||||
|
|
||||||
|
#include "ADM1032Device.h"
|
||||||
|
#include "..\CxbxKrnl\Emu.h" // For EmuWarning
|
||||||
|
|
||||||
|
|
||||||
|
void ADM1032Device::Init()
|
||||||
|
{
|
||||||
|
// ergo720: these are the values reported by UnleashX on my modded Xbox after half an hour of playing (in celsius)
|
||||||
|
|
||||||
|
m_CPUTemperature = 45;
|
||||||
|
m_MBTemperature = 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ADM1032Device::ReadByte(uint8_t command)
|
||||||
|
{
|
||||||
|
if (command == 0x0) { return m_MBTemperature; }
|
||||||
|
else if(command == 0x1) { return m_CPUTemperature; }
|
||||||
|
|
||||||
|
EmuWarning("Unknown read command sent to the temperature sensor. The command was %d", command);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
|
||||||
|
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||||
|
// ******************************************************************
|
||||||
|
// *
|
||||||
|
// * .,-::::: .,:: .::::::::. .,:: .:
|
||||||
|
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
|
||||||
|
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
|
||||||
|
// * $$$ Y$$$P $$""""Y$$ Y$$$P
|
||||||
|
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||||
|
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||||
|
// *
|
||||||
|
// * src->devices->ADM1032Device.h
|
||||||
|
// *
|
||||||
|
// * This file is part of the Cxbx project.
|
||||||
|
// *
|
||||||
|
// * Cxbx and Cxbe are free software; you can redistribute them
|
||||||
|
// * and/or modify them under the terms of the GNU General Public
|
||||||
|
// * License as published by the Free Software Foundation; either
|
||||||
|
// * version 2 of the license, or (at your option) any later version.
|
||||||
|
// *
|
||||||
|
// * This program is distributed in the hope that it will be useful,
|
||||||
|
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// * GNU General Public License for more details.
|
||||||
|
// *
|
||||||
|
// * You should have recieved a copy of the GNU General Public License
|
||||||
|
// * along with this program; see the file COPYING.
|
||||||
|
// * If not, write to the Free Software Foundation, Inc.,
|
||||||
|
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
||||||
|
// *
|
||||||
|
// * (c) 2018 ergo720
|
||||||
|
// *
|
||||||
|
// * All rights reserved
|
||||||
|
// *
|
||||||
|
// ******************************************************************
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "SMDevice.h"
|
||||||
|
|
||||||
|
// ergo702: annoyingly, I must override all the pure functions defined in SMDevice even if don't need most of them. If I don't, then
|
||||||
|
// the compiler will complain about that ADM1032Device is an abstract class since it has pure functions within. Also, ADM1032Device
|
||||||
|
// must derive from SMDevice because ConnectDevice expects a pointer to an object of that class...
|
||||||
|
|
||||||
|
class ADM1032Device : public SMDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Init();
|
||||||
|
void Reset() {};
|
||||||
|
|
||||||
|
void QuickCommand(bool read) {};
|
||||||
|
uint8_t ReceiveByte() { return 0; };
|
||||||
|
uint8_t ReadByte(uint8_t command);
|
||||||
|
uint16_t ReadWord(uint8_t command) { return 0; };
|
||||||
|
int ReadBlock(uint8_t command, uint8_t *data) { return 0; };
|
||||||
|
|
||||||
|
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) {};
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t m_CPUTemperature;
|
||||||
|
uint8_t m_MBTemperature;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern ADM1032Device* g_ADM1032;
|
|
@ -45,6 +45,7 @@ namespace xboxkrnl
|
||||||
#include "CxbxKrnl\EmuShared.h"
|
#include "CxbxKrnl\EmuShared.h"
|
||||||
|
|
||||||
#include "SMCDevice.h" // For SMCDevice
|
#include "SMCDevice.h" // For SMCDevice
|
||||||
|
#include "ADM1032Device.h" // For ADM1032Device
|
||||||
#include "LED.h"
|
#include "LED.h"
|
||||||
|
|
||||||
void SetLEDSequence(LED::Sequence aLEDSequence)
|
void SetLEDSequence(LED::Sequence aLEDSequence)
|
||||||
|
@ -109,8 +110,10 @@ uint8_t SMCDevice::ReadByte(uint8_t command)
|
||||||
break;
|
break;
|
||||||
//case 0x03: // tray state
|
//case 0x03: // tray state
|
||||||
//case SMC_COMMAND_AV_PACK: // 0x04 // A / V Pack state
|
//case SMC_COMMAND_AV_PACK: // 0x04 // A / V Pack state
|
||||||
//case SMC_COMMAND_CPU_TEMP: // 0x09 // CPU temperature (°C)
|
case SMC_COMMAND_CPU_TEMP: // 0x09 // CPU temperature (°C)
|
||||||
//case SMC_COMMAND_MOTHERBOARD_TEMP: // 0x0A // motherboard temperature (°C)
|
return g_ADM1032->ReadByte(0x1);
|
||||||
|
case SMC_COMMAND_MOTHERBOARD_TEMP: // 0x0A // motherboard temperature (°C)
|
||||||
|
return g_ADM1032->ReadByte(0x0);
|
||||||
case 0x0F: // reads scratch register written with 0x0E
|
case 0x0F: // reads scratch register written with 0x0E
|
||||||
return buffer[0x0E];
|
return buffer[0x0E];
|
||||||
//case SMC_COMMAND_POWER_FAN_READBACK: // 0x10 // Current power fan speed (0-50)
|
//case SMC_COMMAND_POWER_FAN_READBACK: // 0x10 // Current power fan speed (0-50)
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
// Datasheet : http://ww1.microchip.com/downloads/en/DeviceDoc/30605D.pdf
|
// Datasheet : http://ww1.microchip.com/downloads/en/DeviceDoc/30605D.pdf
|
||||||
|
|
||||||
// NOTE : Instead of calling this device by it's real name ("PIC16LC63A-04/SO"),
|
// NOTE : Instead of calling this device by it's real name ("PIC16LC63A-04/SO"),
|
||||||
// we've decided to call this device "SMC", since we don't implementation
|
// we've decided to call this device "SMC", since we don't implement
|
||||||
// the low-level functionality of this PIC, but only the minimum set of
|
// the low-level functionality of this PIC, but only the minimum set of
|
||||||
// high-level commands that are sufficient for the Xbox.
|
// high-level commands that are sufficient for the Xbox.
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||||
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||||
// *
|
// *
|
||||||
// * src->CxbxKrnl->Xbox.cpp
|
// * src->devices->Xbox.cpp
|
||||||
// *
|
// *
|
||||||
// * This file is part of the Cxbx project.
|
// * This file is part of the Cxbx project.
|
||||||
// *
|
// *
|
||||||
|
@ -42,6 +42,7 @@ SMCDevice* g_SMC;
|
||||||
EEPROMDevice* g_EEPROM;
|
EEPROMDevice* g_EEPROM;
|
||||||
NVNetDevice* g_NVNet;
|
NVNetDevice* g_NVNet;
|
||||||
NV2ADevice* g_NV2A;
|
NV2ADevice* g_NV2A;
|
||||||
|
ADM1032Device* g_ADM1032;
|
||||||
|
|
||||||
MCPXRevision MCPXRevisionFromHardwareModel(HardwareModel hardwareModel)
|
MCPXRevision MCPXRevisionFromHardwareModel(HardwareModel hardwareModel)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +126,7 @@ void InitXboxHardware(HardwareModel hardwareModel)
|
||||||
g_EEPROM = new EEPROMDevice();
|
g_EEPROM = new EEPROMDevice();
|
||||||
g_NVNet = new NVNetDevice();
|
g_NVNet = new NVNetDevice();
|
||||||
g_NV2A = new NV2ADevice();
|
g_NV2A = new NV2ADevice();
|
||||||
|
g_ADM1032 = new ADM1032Device();
|
||||||
|
|
||||||
// Connect devices to SM bus
|
// Connect devices to SM bus
|
||||||
g_SMBus->ConnectDevice(SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER, g_SMC); // W 0x20 R 0x21
|
g_SMBus->ConnectDevice(SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER, g_SMC); // W 0x20 R 0x21
|
||||||
|
@ -132,7 +134,7 @@ void InitXboxHardware(HardwareModel hardwareModel)
|
||||||
|
|
||||||
// TODO : Other SMBus devices to connect
|
// TODO : Other SMBus devices to connect
|
||||||
//g_SMBus->ConnectDevice(SMBUS_ADDRESS_MCPX, g_MCPX); // W 0x10 R 0x11 -- TODO : Is MCPX an SMBus and/or PCI device?
|
//g_SMBus->ConnectDevice(SMBUS_ADDRESS_MCPX, g_MCPX); // W 0x10 R 0x11 -- TODO : Is MCPX an SMBus and/or PCI device?
|
||||||
//g_SMBus->ConnectDevice(SMBUS_ADDRESS_TEMPERATURE_MEASUREMENT, g_TemperatureMeasurement); // W 0x98 R 0x99
|
g_SMBus->ConnectDevice(SMBUS_ADDRESS_TEMPERATURE_MONITOR, g_ADM1032); // W 0x98 R 0x99
|
||||||
//g_SMBus->ConnectDevice(SMBUS_ADDRESS_TV_ENCODER, g_TVEncoder); // W 0x88 R 0x89
|
//g_SMBus->ConnectDevice(SMBUS_ADDRESS_TV_ENCODER, g_TVEncoder); // W 0x88 R 0x89
|
||||||
switch (tv_encoder) {
|
switch (tv_encoder) {
|
||||||
case TVEncoder::Conexant:
|
case TVEncoder::Conexant:
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||||
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||||
// *
|
// *
|
||||||
// * src->CxbxKrnl->Xbox.h
|
// * src->devices->Xbox.h
|
||||||
// *
|
// *
|
||||||
// * This file is part of the Cxbx project.
|
// * This file is part of the Cxbx project.
|
||||||
// *
|
// *
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
// *
|
// *
|
||||||
// * All rights reserved
|
// * All rights reserved
|
||||||
// *
|
// *
|
||||||
// ******************************************************************#pragma once
|
// ******************************************************************
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "PCIBus.h" // For PCIBus
|
#include "PCIBus.h" // For PCIBus
|
||||||
|
@ -41,13 +41,14 @@
|
||||||
#include "SMCDevice.h" // For SMCDevice
|
#include "SMCDevice.h" // For SMCDevice
|
||||||
#include "EEPROMDevice.h" // For EEPROMDevice
|
#include "EEPROMDevice.h" // For EEPROMDevice
|
||||||
#include "EmuNVNet.h" // For NVNetDevice
|
#include "EmuNVNet.h" // For NVNetDevice
|
||||||
|
#include "ADM1032Device.h" // For ADM1032
|
||||||
#include "devices\video\nv2a.h" // For NV2ADevice
|
#include "devices\video\nv2a.h" // For NV2ADevice
|
||||||
|
|
||||||
#define SMBUS_ADDRESS_MCPX 0x10 // = Write; Read = 0x11
|
#define SMBUS_ADDRESS_MCPX 0x10 // = Write; Read = 0x11
|
||||||
#define SMBUS_ADDRESS_TV_ENCODER 0x88 // = Write; Read = 0x89
|
#define SMBUS_ADDRESS_TV_ENCODER 0x88 // = Write; Read = 0x89
|
||||||
#define SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER 0x20 // = Write; Read = 0x21
|
#define SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER 0x20 // = Write; Read = 0x21
|
||||||
#define SMBUS_ADDRESS_TV_ENCODER_ID_CONEXANT 0x8A // = Write; Read = 0x8B
|
#define SMBUS_ADDRESS_TV_ENCODER_ID_CONEXANT 0x8A // = Write; Read = 0x8B
|
||||||
#define SMBUS_ADDRESS_TEMPERATURE_MEASUREMENT 0x98 // = Write; Read = 0x99
|
#define SMBUS_ADDRESS_TEMPERATURE_MONITOR 0x98 // = Write; Read = 0x99
|
||||||
#define SMBUS_ADDRESS_EEPROM 0xA8 // = Write; Read = 0xA9
|
#define SMBUS_ADDRESS_EEPROM 0xA8 // = Write; Read = 0xA9
|
||||||
#define SMBUS_ADDRESS_TV_ENCODER_ID_FOCUS 0xD4 // = Write; Read = 0xD5
|
#define SMBUS_ADDRESS_TV_ENCODER_ID_FOCUS 0xD4 // = Write; Read = 0xD5
|
||||||
#define SMBUS_ADDRESS_TV_ENCODER_ID_XCALIBUR 0xE0 // = Write; Read = 0xE1
|
#define SMBUS_ADDRESS_TV_ENCODER_ID_XCALIBUR 0xE0 // = Write; Read = 0xE1
|
||||||
|
|
Loading…
Reference in New Issue