SMC : Renamed device from PIC16LC (since we're only emulating it at a functional level, not low level).
This commit is contained in:
parent
f15a572bef
commit
509f8a5f11
|
@ -236,7 +236,7 @@
|
|||
<ClInclude Include="..\..\src\CxbxKrnl\PhysicalMemory.h" />
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\PCIBus.h" />
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\PCIDevice.h" />
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\PIC16LCDevice.h" />
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\SMCDevice.h" />
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\ReservedMemory.h" />
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\ResourceTracker.h" />
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\VMManager.h" />
|
||||
|
@ -523,7 +523,7 @@
|
|||
<ClCompile Include="..\..\src\CxbxKrnl\PhysicalMemory.cpp" />
|
||||
<ClCompile Include="..\..\src\CxbxKrnl\PCIBus.cpp" />
|
||||
<ClCompile Include="..\..\src\CxbxKrnl\PCIDevice.cpp" />
|
||||
<ClCompile Include="..\..\src\CxbxKrnl\PIC16LCDevice.cpp" />
|
||||
<ClCompile Include="..\..\src\CxbxKrnl\SMCDevice.cpp" />
|
||||
<ClCompile Include="..\..\src\CxbxKrnl\ResourceTracker.cpp">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
|
|
@ -220,7 +220,7 @@
|
|||
<ClCompile Include="..\..\src\CxbxKrnl\EEPROMDevice.cpp">
|
||||
<Filter>Hardware</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\CxbxKrnl\PIC16LCDevice.cpp">
|
||||
<ClCompile Include="..\..\src\CxbxKrnl\SMCDevice.cpp">
|
||||
<Filter>Hardware</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -423,7 +423,7 @@
|
|||
<ClInclude Include="..\..\src\CxbxKrnl\EEPROMDevice.h">
|
||||
<Filter>Hardware</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\PIC16LCDevice.h">
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\SMCDevice.h">
|
||||
<Filter>Hardware</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\CxbxKrnl\PhysicalMemory.h">
|
||||
|
|
|
@ -66,12 +66,12 @@ namespace xboxkrnl
|
|||
#include "PCIBus.h"
|
||||
#include "SMBus.h"
|
||||
#include "EEPROMDevice.h" // For EEPROMDevice
|
||||
#include "PIC16LCDevice.h" // For PIC16LCDevice
|
||||
#include "SMCDevice.h" // For SMCDevice
|
||||
|
||||
PCIBus* g_PCIBus;
|
||||
SMBus* g_SMBus;
|
||||
EEPROMDevice* g_EEPROM;
|
||||
PIC16LCDevice* g_PIC16LC;
|
||||
SMCDevice* g_SMC;
|
||||
|
||||
/* prevent name collisions */
|
||||
namespace NtDll
|
||||
|
@ -1022,8 +1022,8 @@ __declspec(noreturn) void CxbxKrnlInit
|
|||
g_SMBus->ConnectDevice(SMBUS_EEPROM_ADDRESS, g_EEPROM);
|
||||
// https://github.com/docbrown/vxb/wiki/Xbox-Hardware-Information
|
||||
// https://web.archive.org/web/20100617022549/http://www.xbox-linux.org/wiki/PIC
|
||||
g_PIC16LC = new PIC16LCDevice();
|
||||
g_SMBus->ConnectDevice(SMBUS_SMC_SLAVE_ADDRESS, g_PIC16LC);
|
||||
g_SMC = new SMCDevice();
|
||||
g_SMBus->ConnectDevice(SMBUS_SMC_SLAVE_ADDRESS, g_SMC);
|
||||
|
||||
// TODO : Handle other SMBUS Addresses, like PIC_ADDRESS, XCALIBUR_ADDRESS
|
||||
// Resources : http://pablot.com/misc/fancontroller.cpp
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace xboxkrnl
|
|||
#include "EmuX86.h" // HalReadWritePciSpace needs this
|
||||
#include "SMBus.h" // For g_SMBus
|
||||
#include "EmuEEPROM.h" // For EEPROM
|
||||
#include "PIC16LCDevice.h" // For SMC_COMMAND_SCRATCH
|
||||
#include "SMCDevice.h" // For SMC_COMMAND_SCRATCH
|
||||
#include "EmuShared.h"
|
||||
#include "EmuFile.h" // For FindNtSymbolicLinkObjectByDriveLetter
|
||||
|
||||
|
@ -540,7 +540,7 @@ XBSYSAPI EXPORTNUM(50) xboxkrnl::NTSTATUS NTAPI xboxkrnl::HalWriteSMBusValue
|
|||
// Note : GE_HOST_STC triggers ExecuteTransaction, which writes the command to the specified address
|
||||
|
||||
// TODO : Figure out the error status (Status = STATUS_UNSUCCESSFUL)
|
||||
|
||||
g_SMBus->IORead(1, SMB_GLOBAL_ENABLE);
|
||||
// TODO : Reenable interrupts
|
||||
|
||||
RETURN(Status);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||
// *
|
||||
// * src->CxbxKrnl->PIC16LCDevice.cpp
|
||||
// * src->CxbxKrnl->SMCDevice.cpp
|
||||
// *
|
||||
// * This file is part of the Cxbx project.
|
||||
// *
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <cstring> // For memcpy
|
||||
|
||||
#include "PIC16LCDevice.h" // For PIC16LCDevice
|
||||
#include "SMCDevice.h" // For SMCDevice
|
||||
|
||||
void SetLEDSequence(uint8_t LEDSequence)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ const char *PICVersion_Retail_1_0 = "P01";
|
|||
const char *PICVersion_Retail_1_1 = "P05";
|
||||
const char *PICVersion_Debug_Kit = "DXB";
|
||||
|
||||
void PIC16LCDevice::Init()
|
||||
void SMCDevice::Init()
|
||||
{
|
||||
m_PICVersion = (char*)PICVersion_Retail_1_1; // TODO : Configurable selection
|
||||
|
||||
|
@ -59,22 +59,22 @@ void PIC16LCDevice::Init()
|
|||
buffer[SMC_COMMAND_SCRATCH] = 0; // http://xboxdevwiki.net/PIC#Scratch_register_values
|
||||
}
|
||||
|
||||
void PIC16LCDevice::Reset()
|
||||
void SMCDevice::Reset()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void PIC16LCDevice::QuickCommand(bool read)
|
||||
void SMCDevice::QuickCommand(bool read)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
uint8_t PIC16LCDevice::ReceiveByte()
|
||||
uint8_t SMCDevice::ReceiveByte()
|
||||
{
|
||||
return 0; // TODO
|
||||
}
|
||||
|
||||
uint8_t PIC16LCDevice::ReadByte(uint8_t command)
|
||||
uint8_t SMCDevice::ReadByte(uint8_t command)
|
||||
{
|
||||
switch (command) {
|
||||
case SMC_COMMAND_VERSION: // 0x01 PIC version string
|
||||
|
@ -112,22 +112,22 @@ uint8_t PIC16LCDevice::ReadByte(uint8_t command)
|
|||
return buffer[command];
|
||||
}
|
||||
|
||||
uint16_t PIC16LCDevice::ReadWord(uint8_t command)
|
||||
uint16_t SMCDevice::ReadWord(uint8_t command)
|
||||
{
|
||||
return 0; // TODO
|
||||
}
|
||||
|
||||
int PIC16LCDevice::ReadBlock(uint8_t command, uint8_t *data)
|
||||
int SMCDevice::ReadBlock(uint8_t command, uint8_t *data)
|
||||
{
|
||||
return 0; // TODO
|
||||
}
|
||||
|
||||
void PIC16LCDevice::SendByte(uint8_t data)
|
||||
void SMCDevice::SendByte(uint8_t data)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void PIC16LCDevice::WriteByte(uint8_t command, uint8_t value)
|
||||
void SMCDevice::WriteByte(uint8_t command, uint8_t value)
|
||||
{
|
||||
switch (command) {
|
||||
case SMC_COMMAND_VERSION: // 0x01 PIC version string counter reset
|
||||
|
@ -156,14 +156,14 @@ void PIC16LCDevice::WriteByte(uint8_t command, uint8_t value)
|
|||
buffer[command] = value;
|
||||
}
|
||||
|
||||
void PIC16LCDevice::WriteWord(uint8_t command, uint16_t value)
|
||||
void SMCDevice::WriteWord(uint8_t command, uint16_t value)
|
||||
{
|
||||
// TODO : Is this needed and/or acceptable?
|
||||
WriteByte(command, value >> 8);
|
||||
WriteByte(command + 1, value & 0xFF);
|
||||
}
|
||||
|
||||
void PIC16LCDevice::WriteBlock(uint8_t command, uint8_t* data, int length)
|
||||
void SMCDevice::WriteBlock(uint8_t command, uint8_t* data, int length)
|
||||
{
|
||||
// TODO
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||
// *
|
||||
// * src->CxbxKrnl->PIC16LCDevice.h
|
||||
// * src->CxbxKrnl->SMCDevice.h
|
||||
// *
|
||||
// * This file is part of the Cxbx project.
|
||||
// *
|
||||
|
@ -44,6 +44,11 @@
|
|||
// Producer : http://www.microchip.com/wwwproducts/en/en010145
|
||||
// Datasheet : http://ww1.microchip.com/downloads/en/DeviceDoc/30605D.pdf
|
||||
|
||||
// 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
|
||||
// the low-level functionality of this PIC, but only the minimum set of
|
||||
// high-level commands that are sufficient for the Xbox.
|
||||
|
||||
#define SMBUS_SMC_SLAVE_ADDRESS 0x20 // = Write; Read = 0x21
|
||||
|
||||
// Reading:
|
||||
|
@ -82,7 +87,7 @@
|
|||
//0x20 response to PIC challenge(written first)
|
||||
//0x21 response to PIC challenge(written second)
|
||||
|
||||
class PIC16LCDevice : public SMDevice {
|
||||
class SMCDevice : public SMDevice {
|
||||
public:
|
||||
// SMDevice functions
|
||||
void Init();
|
||||
|
@ -103,4 +108,4 @@ private:
|
|||
uint8_t buffer[256] = {};
|
||||
};
|
||||
|
||||
extern PIC16LCDevice* gPIC16LC;
|
||||
extern SMCDevice* g_SMC;
|
Loading…
Reference in New Issue