mirror of https://github.com/PCSX2/pcsx2.git
FW: clang-format
This commit is contained in:
parent
385c698212
commit
6f98fd4b65
|
@ -570,7 +570,6 @@ Global
|
||||||
{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
|
{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
|
||||||
{E4081455-398C-4610-A87C-90A8A7D72DC3} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF}
|
{E4081455-398C-4610-A87C-90A8A7D72DC3} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF}
|
||||||
{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E}
|
{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E}
|
||||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E}
|
|
||||||
{04439C5F-05FB-4A9C-AAD1-5388C25377DB} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E}
|
{04439C5F-05FB-4A9C-AAD1-5388C25377DB} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E}
|
||||||
{A51123F5-9505-4EAE-85E7-D320290A272C} = {88F517F9-CE1C-4005-9BDF-4481FEB55053}
|
{A51123F5-9505-4EAE-85E7-D320290A272C} = {88F517F9-CE1C-4005-9BDF-4481FEB55053}
|
||||||
{4639972E-424E-4E13-8B07-CA403C481346} = {88F517F9-CE1C-4005-9BDF-4481FEB55053}
|
{4639972E-424E-4E13-8B07-CA403C481346} = {88F517F9-CE1C-4005-9BDF-4481FEB55053}
|
||||||
|
|
|
@ -56,7 +56,7 @@ set(pcsx2Sources
|
||||||
GameDatabase.cpp
|
GameDatabase.cpp
|
||||||
Dump.cpp
|
Dump.cpp
|
||||||
Elfheader.cpp
|
Elfheader.cpp
|
||||||
FW.cpp
|
FW.cpp
|
||||||
FiFo.cpp
|
FiFo.cpp
|
||||||
FPU.cpp
|
FPU.cpp
|
||||||
Gif.cpp
|
Gif.cpp
|
||||||
|
@ -136,7 +136,7 @@ set(pcsx2Headers
|
||||||
Dump.h
|
Dump.h
|
||||||
GameDatabase.h
|
GameDatabase.h
|
||||||
Elfheader.h
|
Elfheader.h
|
||||||
FW.h
|
FW.h
|
||||||
Gif.h
|
Gif.h
|
||||||
Gif_Unit.h
|
Gif_Unit.h
|
||||||
GS.h
|
GS.h
|
||||||
|
|
273
pcsx2/FW.cpp
273
pcsx2/FW.cpp
|
@ -13,6 +13,8 @@
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "PrecompiledHeader.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -20,179 +22,182 @@ using namespace std;
|
||||||
#include "FW.h"
|
#include "FW.h"
|
||||||
|
|
||||||
u8 phyregs[16];
|
u8 phyregs[16];
|
||||||
s8 *fwregs;
|
s8* fwregs;
|
||||||
|
|
||||||
void (*FWirq)();
|
void (*FWirq)();
|
||||||
|
|
||||||
s32 FWopen()
|
s32 FWopen()
|
||||||
{
|
{
|
||||||
memset(phyregs, 0, sizeof(phyregs));
|
memset(phyregs, 0, sizeof(phyregs));
|
||||||
// Initializing our registers.
|
// Initializing our registers.
|
||||||
fwregs = (s8 *)calloc(0x10000, 1);
|
fwregs = (s8*)calloc(0x10000, 1);
|
||||||
if (fwregs == NULL) {
|
if (fwregs == NULL)
|
||||||
DevCon.WriteLn("FW: Error allocating Memory");
|
{
|
||||||
return -1;
|
DevCon.WriteLn("FW: Error allocating Memory");
|
||||||
}
|
return -1;
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FWclose()
|
void FWclose()
|
||||||
{
|
{
|
||||||
// Freeing the registers.
|
// Freeing the registers.
|
||||||
free(fwregs);
|
free(fwregs);
|
||||||
fwregs = NULL;
|
fwregs = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PHYWrite()
|
void PHYWrite()
|
||||||
{
|
{
|
||||||
u8 reg = (PHYACC >> 8) & 0xf;
|
u8 reg = (PHYACC >> 8) & 0xf;
|
||||||
u8 data = PHYACC & 0xff;
|
u8 data = PHYACC & 0xff;
|
||||||
|
|
||||||
phyregs[reg] = data;
|
phyregs[reg] = data;
|
||||||
|
|
||||||
PHYACC &= ~0x4000ffff;
|
PHYACC &= ~0x4000ffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PHYRead()
|
void PHYRead()
|
||||||
{
|
{
|
||||||
u8 reg = (PHYACC >> 24) & 0xf;
|
u8 reg = (PHYACC >> 24) & 0xf;
|
||||||
|
|
||||||
PHYACC &= ~0x80000000;
|
PHYACC &= ~0x80000000;
|
||||||
|
|
||||||
PHYACC |= phyregs[reg] | (reg << 8);
|
PHYACC |= phyregs[reg] | (reg << 8);
|
||||||
|
|
||||||
if (fwRu32(0x8424) & 0x40000000) //RRx interrupt mask
|
if (fwRu32(0x8424) & 0x40000000) //RRx interrupt mask
|
||||||
{
|
{
|
||||||
fwRu32(0x8420) |= 0x40000000;
|
fwRu32(0x8420) |= 0x40000000;
|
||||||
FWirq();
|
FWirq();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 FWread32(u32 addr)
|
u32 FWread32(u32 addr)
|
||||||
{
|
{
|
||||||
u32 ret = 0;
|
u32 ret = 0;
|
||||||
|
|
||||||
switch (addr) {
|
switch (addr)
|
||||||
//Node ID Register the top part is default, bottom part i got from my ps2
|
{
|
||||||
case 0x1f808400:
|
//Node ID Register the top part is default, bottom part i got from my ps2
|
||||||
ret = /*(0x3ff << 22) | 1;*/ 0xffc00001;
|
case 0x1f808400:
|
||||||
break;
|
ret = /*(0x3ff << 22) | 1;*/ 0xffc00001;
|
||||||
// Control Register 2
|
break;
|
||||||
case 0x1f808410:
|
// Control Register 2
|
||||||
ret = fwRu32(addr); //SCLK OK (Needs to be set when FW is "Ready"
|
case 0x1f808410:
|
||||||
break;
|
ret = fwRu32(addr); //SCLK OK (Needs to be set when FW is "Ready"
|
||||||
//Interrupt 0 Register
|
break;
|
||||||
case 0x1f808420:
|
//Interrupt 0 Register
|
||||||
ret = fwRu32(addr);
|
case 0x1f808420:
|
||||||
break;
|
ret = fwRu32(addr);
|
||||||
|
break;
|
||||||
|
|
||||||
//Dunno what this is, but my home console always returns this value 0x10000001
|
//Dunno what this is, but my home console always returns this value 0x10000001
|
||||||
//Seems to be related to the Node ID however (does some sort of compare/check)
|
//Seems to be related to the Node ID however (does some sort of compare/check)
|
||||||
case 0x1f80847c:
|
case 0x1f80847c:
|
||||||
ret = 0x10000001;
|
ret = 0x10000001;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Include other relevant 32 bit addresses we need to catch here.
|
// Include other relevant 32 bit addresses we need to catch here.
|
||||||
default:
|
default:
|
||||||
// By default, read fwregs.
|
// By default, read fwregs.
|
||||||
ret = fwRu32(addr);
|
ret = fwRu32(addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevCon.WriteLn("FW: read mem 0x%x: 0x%x", addr, ret);
|
DevCon.WriteLn("FW: read mem 0x%x: 0x%x", addr, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FWwrite32(u32 addr, u32 value)
|
void FWwrite32(u32 addr, u32 value)
|
||||||
{
|
{
|
||||||
switch (addr) {
|
switch (addr)
|
||||||
// Include other memory locations we want to catch here.
|
{
|
||||||
// For example:
|
// Include other memory locations we want to catch here.
|
||||||
//
|
// For example:
|
||||||
// case 0x1f808400:
|
//
|
||||||
// case 0x1f808414:
|
// case 0x1f808400:
|
||||||
// case 0x1f808420:
|
// case 0x1f808414:
|
||||||
// case 0x1f808428:
|
// case 0x1f808420:
|
||||||
// case 0x1f808430:
|
// case 0x1f808428:
|
||||||
//
|
// case 0x1f808430:
|
||||||
|
//
|
||||||
|
|
||||||
//PHY access
|
//PHY access
|
||||||
case 0x1f808414:
|
case 0x1f808414:
|
||||||
//If in read mode (top bit set) we read the PHY register requested then set the RRx interrupt if it's enabled
|
//If in read mode (top bit set) we read the PHY register requested then set the RRx interrupt if it's enabled
|
||||||
//Im presuming we send that back to pcsx2 then. This register stores the result, plus whatever was written (minus the read/write flag
|
//Im presuming we send that back to pcsx2 then. This register stores the result, plus whatever was written (minus the read/write flag
|
||||||
fwRu32(addr) = value; //R/W Bit cleaned in underneath function
|
fwRu32(addr) = value; //R/W Bit cleaned in underneath function
|
||||||
if (value & 0x40000000) //Writing to PHY
|
if (value & 0x40000000) //Writing to PHY
|
||||||
{
|
{
|
||||||
PHYWrite();
|
PHYWrite();
|
||||||
} else if (value & 0x80000000) //Reading from PHY
|
}
|
||||||
{
|
else if (value & 0x80000000) //Reading from PHY
|
||||||
PHYRead();
|
{
|
||||||
}
|
PHYRead();
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
//Control Register 0
|
//Control Register 0
|
||||||
case 0x1f808408:
|
case 0x1f808408:
|
||||||
//This enables different functions of the link interface
|
//This enables different functions of the link interface
|
||||||
//Just straight writes, should brobably struct these later.
|
//Just straight writes, should brobably struct these later.
|
||||||
//Default written settings (on unreal tournament) are
|
//Default written settings (on unreal tournament) are
|
||||||
//Urcv M = 1
|
//Urcv M = 1
|
||||||
//RSP 0 = 1
|
//RSP 0 = 1
|
||||||
//Retlim = 0xF
|
//Retlim = 0xF
|
||||||
//Cyc Tmr En = 1
|
//Cyc Tmr En = 1
|
||||||
//Bus ID Rst = 1
|
//Bus ID Rst = 1
|
||||||
//Rcv Self ID = 1
|
//Rcv Self ID = 1
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
// if((value & 0x800000) && (fwRu32(0x842C) & 0x2))
|
// if((value & 0x800000) && (fwRu32(0x842C) & 0x2))
|
||||||
// {
|
// {
|
||||||
// fwRu32(0x8428) |= 0x2;
|
// fwRu32(0x8428) |= 0x2;
|
||||||
// FWirq();
|
// FWirq();
|
||||||
// }
|
// }
|
||||||
fwRu32(addr) &= ~0x800000;
|
fwRu32(addr) &= ~0x800000;
|
||||||
break;
|
break;
|
||||||
//Control Register 2
|
//Control Register 2
|
||||||
case 0x1f808410: // fwRu32(addr) = value; break;
|
case 0x1f808410: // fwRu32(addr) = value; break;
|
||||||
//Ignore writes to this for now, apart from 0x2 which is Link Power Enable
|
//Ignore writes to this for now, apart from 0x2 which is Link Power Enable
|
||||||
//0x8 is SCLK OK (Ready) which should be set for emulation
|
//0x8 is SCLK OK (Ready) which should be set for emulation
|
||||||
fwRu32(addr) = 0x8 /*| value & 0x2*/;
|
fwRu32(addr) = 0x8 /*| value & 0x2*/;
|
||||||
break;
|
break;
|
||||||
//Interrupt 0 Register
|
//Interrupt 0 Register
|
||||||
case 0x1f808420:
|
case 0x1f808420:
|
||||||
//Interrupt 1 Register
|
//Interrupt 1 Register
|
||||||
case 0x1f808428:
|
case 0x1f808428:
|
||||||
//Interrupt 2 Register
|
//Interrupt 2 Register
|
||||||
case 0x1f808430:
|
case 0x1f808430:
|
||||||
//Writes of 1 clear the corresponding bits
|
//Writes of 1 clear the corresponding bits
|
||||||
fwRu32(addr) &= ~value;
|
fwRu32(addr) &= ~value;
|
||||||
break;
|
break;
|
||||||
//Interrupt 0 Register Mask
|
//Interrupt 0 Register Mask
|
||||||
case 0x1f808424:
|
case 0x1f808424:
|
||||||
//Interrupt 1 Register Mask
|
//Interrupt 1 Register Mask
|
||||||
case 0x1f80842C:
|
case 0x1f80842C:
|
||||||
//Interrupt 2 Register Mask
|
//Interrupt 2 Register Mask
|
||||||
case 0x1f808434:
|
case 0x1f808434:
|
||||||
//These are direct writes (as it's a mask!)
|
//These are direct writes (as it's a mask!)
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
//DMA Control and Status Register 0
|
//DMA Control and Status Register 0
|
||||||
case 0x1f8084B8:
|
case 0x1f8084B8:
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
//DMA Control and Status Register 1
|
//DMA Control and Status Register 1
|
||||||
case 0x1f808538:
|
case 0x1f808538:
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// By default, just write it to fwregs.
|
// By default, just write it to fwregs.
|
||||||
fwRu32(addr) = value;
|
fwRu32(addr) = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DevCon.WriteLn("FW: write mem 0x%x: 0x%x", addr, value);
|
DevCon.WriteLn("FW: write mem 0x%x: 0x%x", addr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FWirqCallback(void (*callback)())
|
void FWirqCallback(void (*callback)())
|
||||||
{
|
{
|
||||||
// Register FWirq, so we can trigger an interrupt with it later.
|
// Register FWirq, so we can trigger an interrupt with it later.
|
||||||
FWirq = callback;
|
FWirq = callback;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
#define FWdefs
|
#define FWdefs
|
||||||
|
|
||||||
// Our main memory storage, and defines for accessing it.
|
// Our main memory storage, and defines for accessing it.
|
||||||
extern s8 *fwregs;
|
extern s8* fwregs;
|
||||||
#define fwRs32(mem) (*(s32 *)&fwregs[(mem)&0xffff])
|
#define fwRs32(mem) (*(s32*)&fwregs[(mem)&0xffff])
|
||||||
#define fwRu32(mem) (*(u32 *)&fwregs[(mem)&0xffff])
|
#define fwRu32(mem) (*(u32*)&fwregs[(mem)&0xffff])
|
||||||
|
|
||||||
//PHY Access Address for ease of use :P
|
//PHY Access Address for ease of use :P
|
||||||
#define PHYACC fwRu32(0x8414)
|
#define PHYACC fwRu32(0x8414)
|
||||||
|
|
|
@ -154,6 +154,9 @@
|
||||||
<Filter Include="System\Ps2\Iop\CDVD\Linux">
|
<Filter Include="System\Ps2\Iop\CDVD\Linux">
|
||||||
<UniqueIdentifier>{a5904fb6-e846-4cbf-940c-ca1c604140a0}</UniqueIdentifier>
|
<UniqueIdentifier>{a5904fb6-e846-4cbf-940c-ca1c604140a0}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="System\Ps2\Iop\FW">
|
||||||
|
<UniqueIdentifier>{157740ae-b338-4d7f-81cb-cffa9d39a756}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\Utilities\folderdesc.txt">
|
<None Include="..\..\Utilities\folderdesc.txt">
|
||||||
|
@ -893,7 +896,7 @@
|
||||||
<Filter>System</Filter>
|
<Filter>System</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\FW.cpp">
|
<ClCompile Include="..\..\FW.cpp">
|
||||||
<Filter>System</Filter>
|
<Filter>System\Ps2\Iop\FW</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1354,7 +1357,7 @@
|
||||||
<Filter>System\Include</Filter>
|
<Filter>System\Include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\FW.h">
|
<ClInclude Include="..\..\FW.h">
|
||||||
<Filter>System\Include</Filter>
|
<Filter>System\Ps2\Iop\FW</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue