mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Use DevCon/Console log functions & silence some logs
This commit is contained in:
parent
53dfb8efb9
commit
b8858663f4
|
@ -47,9 +47,9 @@ void ATA::WritePaddedString(u8* data, int* index, std::string value, u32 len)
|
|||
void ATA::CreateHDDinfo(int sizeMb)
|
||||
{
|
||||
const u16 sectorSize = 512;
|
||||
DEV9_LOG_VERB("HddSize : %i\n", config.HddSize);
|
||||
DevCon.WriteLn("HddSize : %i", config.HddSize);
|
||||
const u64 nbSectors = ((u64)(sizeMb / sectorSize) * 1024 * 1024);
|
||||
DEV9_LOG_VERB("nbSectors : %i\n", nbSectors);
|
||||
DevCon.WriteLn("nbSectors : %i", nbSectors);
|
||||
|
||||
memset(&identifyData, 0, sizeof(identifyData));
|
||||
//Defualt CHS translation
|
||||
|
@ -390,5 +390,5 @@ void ATA::CreateHDDinfoCsum() //Is this correct?
|
|||
for (int i = 0; i < (512); i++)
|
||||
counter += identifyData[i];
|
||||
|
||||
DEV9_LOG_VERB("%s\n", counter);
|
||||
DevCon.WriteLn("%i", counter);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void ATA::Close()
|
|||
{
|
||||
if (!IsQueueEmpty())
|
||||
{
|
||||
DEV9_LOG_ERROR("Write queue not empty");
|
||||
Console.Error("ATA: Write queue not empty");
|
||||
pxAssert(false);
|
||||
abort(); //All data must be written at this point
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ void ATA::ResetEnd(bool hard)
|
|||
|
||||
void ATA::ATA_HardReset()
|
||||
{
|
||||
DEV9_LOG_VERB("*ATA_HARD RESET\n");
|
||||
DevCon.WriteLn("*ATA_HARD RESET");
|
||||
ResetBegin();
|
||||
ResetEnd(true);
|
||||
}
|
||||
|
@ -155,12 +155,12 @@ u16 ATA::Read16(u32 addr)
|
|||
case ATA_R_DATA:
|
||||
return ATAreadPIO();
|
||||
case ATA_R_ERROR:
|
||||
DEV9_LOG_VERB("*ATA_R_ERROR 16bit read at address %x, value %x, Active %s\n", addr, regError, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
DevCon.WriteLn("*ATA_R_ERROR 16bit read at address %x, value %x, Active %s", addr, regError, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
if (GetSelectedDevice() != 0)
|
||||
return 0;
|
||||
return regError;
|
||||
case ATA_R_NSECTOR:
|
||||
DEV9_LOG_VERB("*ATA_R_NSECTOR 16bit read at address %x, value %x, Active %s\n", addr, nsector, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
DevCon.WriteLn("*ATA_R_NSECTOR 16bit read at address %x, value %x, Active %s", addr, nsector, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
if (GetSelectedDevice() != 0)
|
||||
return 0;
|
||||
if (!regControlHOBRead)
|
||||
|
@ -168,7 +168,7 @@ u16 ATA::Read16(u32 addr)
|
|||
else
|
||||
return regNsectorHOB;
|
||||
case ATA_R_SECTOR:
|
||||
DEV9_LOG_VERB("*ATA_R_NSECTOR 16bit read at address %x, value %x, Active %s\n", addr, regSector, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
DevCon.WriteLn("*ATA_R_NSECTOR 16bit read at address %x, value %x, Active %s", addr, regSector, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
if (GetSelectedDevice() != 0)
|
||||
return 0;
|
||||
if (!regControlHOBRead)
|
||||
|
@ -176,7 +176,7 @@ u16 ATA::Read16(u32 addr)
|
|||
else
|
||||
return regSectorHOB;
|
||||
case ATA_R_LCYL:
|
||||
DEV9_LOG_VERB("*ATA_R_LCYL 16bit read at address %x, value %x, Active %s\n", addr, regLcyl, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
DevCon.WriteLn("*ATA_R_LCYL 16bit read at address %x, value %x, Active %s", addr, regLcyl, (GetSelectedDevice() == 0) ? "True" : "False");
|
||||
if (GetSelectedDevice() != 0)
|
||||
return 0;
|
||||
if (!regControlHOBRead)
|
||||
|
@ -184,7 +184,7 @@ u16 ATA::Read16(u32 addr)
|
|||
else
|
||||
return regLcylHOB;
|
||||
case ATA_R_HCYL:
|
||||
DEV9_LOG_VERB("*ATA_R_HCYL 16bit read at address % x, value % x, Active %s\n", addr, regHcyl, (GetSelectedDevice() == 0) ? " True " : " False ");
|
||||
DevCon.WriteLn("*ATA_R_HCYL 16bit read at address % x, value % x, Active %s", addr, regHcyl, (GetSelectedDevice() == 0) ? " True " : " False ");
|
||||
if (GetSelectedDevice() != 0)
|
||||
return 0;
|
||||
if (!regControlHOBRead)
|
||||
|
@ -192,21 +192,21 @@ u16 ATA::Read16(u32 addr)
|
|||
else
|
||||
return regHcylHOB;
|
||||
case ATA_R_SELECT:
|
||||
DEV9_LOG_VERB("*ATA_R_SELECT 16bit read at address % x, value % x, Active %s\n", addr, regSelect, (GetSelectedDevice() == 0) ? " True " : " False ");
|
||||
DevCon.WriteLn("*ATA_R_SELECT 16bit read at address % x, value % x, Active %s", addr, regSelect, (GetSelectedDevice() == 0) ? " True " : " False ");
|
||||
return regSelect;
|
||||
case ATA_R_STATUS:
|
||||
DEV9_LOG_VERB("*ATA_R_STATUS (Fallthough to ATA_R_ALT_STATUS)\n");
|
||||
DevCon.WriteLn("*ATA_R_STATUS (Fallthough to ATA_R_ALT_STATUS)");
|
||||
//Clear irqcause
|
||||
dev9.irqcause &= ~ATA_INTR_INTRQ;
|
||||
[[fallthrough]];
|
||||
case ATA_R_ALT_STATUS:
|
||||
DEV9_LOG_VERB("*ATA_R_ALT_STATUS 16bit read at address % x, value % x, Active %s\n", addr, regStatus, (GetSelectedDevice() == 0) ? " True " : " False ");
|
||||
DevCon.WriteLn("*ATA_R_ALT_STATUS 16bit read at address % x, value % x, Active %s", addr, regStatus, (GetSelectedDevice() == 0) ? " True " : " False ");
|
||||
//raise IRQ?
|
||||
if (GetSelectedDevice() != 0)
|
||||
return 0;
|
||||
return regStatus;
|
||||
default:
|
||||
DEV9_LOG_ERROR("*Unknown 16bit read at address %x\n", addr);
|
||||
Console.Error("ATA: Unknown 16bit read at address %x", addr);
|
||||
return 0xff;
|
||||
}
|
||||
}
|
||||
|
@ -215,49 +215,49 @@ void ATA::Write16(u32 addr, u16 value)
|
|||
{
|
||||
if (addr != ATA_R_CMD && (regStatus & (ATA_STAT_BUSY | ATA_STAT_DRQ)) != 0)
|
||||
{
|
||||
DEV9_LOG_ERROR("*DEVICE BUSY, DROPPING WRITE\n");
|
||||
Console.Error("ATA: DEVICE BUSY, DROPPING WRITE");
|
||||
return;
|
||||
}
|
||||
switch (addr)
|
||||
{
|
||||
case ATA_R_FEATURE:
|
||||
DEV9_LOG_VERB("*ATA_R_FEATURE 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_FEATURE 16bit write at address %x, value %x", addr, value);
|
||||
ClearHOB();
|
||||
regFeatureHOB = regFeature;
|
||||
regFeature = (u8)value;
|
||||
break;
|
||||
case ATA_R_NSECTOR:
|
||||
DEV9_LOG_VERB("*ATA_R_NSECTOR 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_NSECTOR 16bit write at address %x, value %x", addr, value);
|
||||
ClearHOB();
|
||||
regNsectorHOB = regNsector;
|
||||
regNsector = (u8)value;
|
||||
break;
|
||||
case ATA_R_SECTOR:
|
||||
DEV9_LOG_VERB("*ATA_R_SECTOR 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_SECTOR 16bit write at address %x, value %x", addr, value);
|
||||
ClearHOB();
|
||||
regSectorHOB = regSector;
|
||||
regSector = (u8)value;
|
||||
break;
|
||||
case ATA_R_LCYL:
|
||||
DEV9_LOG_VERB("*ATA_R_LCYL 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_LCYL 16bit write at address %x, value %x", addr, value);
|
||||
ClearHOB();
|
||||
regLcylHOB = regLcyl;
|
||||
regLcyl = (u8)value;
|
||||
break;
|
||||
case ATA_R_HCYL:
|
||||
DEV9_LOG_VERB("*ATA_R_HCYL 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_HCYL 16bit write at address %x, value %x", addr, value);
|
||||
ClearHOB();
|
||||
regHcylHOB = regHcyl;
|
||||
regHcyl = (u8)value;
|
||||
break;
|
||||
case ATA_R_SELECT:
|
||||
DEV9_LOG_VERB("*ATA_R_SELECT 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_SELECT 16bit write at address %x, value %x", addr, value);
|
||||
regSelect = (u8)value;
|
||||
//bus->ifs[0].select = (val & ~0x10) | 0xa0;
|
||||
//bus->ifs[1].select = (val | 0x10) | 0xa0;
|
||||
break;
|
||||
case ATA_R_CONTROL:
|
||||
DEV9_LOG_VERB("*ATA_R_CONTROL 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_CONTROL 16bit write at address %x, value %x", addr, value);
|
||||
//dev9Ru16(ATA_R_CONTROL) = value;
|
||||
if ((value & 0x2) != 0)
|
||||
{
|
||||
|
@ -270,7 +270,7 @@ void ATA::Write16(u32 addr, u16 value)
|
|||
|
||||
if ((value & 0x4) != 0)
|
||||
{
|
||||
DEV9_LOG_VERB("*ATA_R_CONTROL RESET\n");
|
||||
DevCon.WriteLn("*ATA_R_CONTROL RESET");
|
||||
ResetBegin();
|
||||
ResetEnd(false);
|
||||
}
|
||||
|
@ -279,14 +279,14 @@ void ATA::Write16(u32 addr, u16 value)
|
|||
|
||||
break;
|
||||
case ATA_R_CMD:
|
||||
DEV9_LOG_VERB("*ATA_R_CMD 16bit write at address %x, value %x\n", addr, value);
|
||||
DevCon.WriteLn("*ATA_R_CMD 16bit write at address %x, value %x", addr, value);
|
||||
regCommand = value;
|
||||
regControlHOBRead = false;
|
||||
dev9.irqcause &= ~ATA_INTR_INTRQ;
|
||||
IDE_ExecCmd(value);
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("*UNKOWN 16bit write at address %x, value %x\n", addr, value);
|
||||
Console.Error("ATA: UNKOWN 16bit write at address %x, value %x", addr, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ s64 ATA::HDD_GetLBA()
|
|||
regStatus |= (u8)ATA_STAT_ERR;
|
||||
regError |= (u8)ATA_ERR_ABORT;
|
||||
|
||||
DEV9_LOG_ERROR("DEV9 ERROR : tried to get LBA address while LBA mode disabled\n");
|
||||
Console.Error("ATA: Tried to get LBA address while LBA mode disabled");
|
||||
//(c.Nh + h).Ns+(s-1)
|
||||
//s64 CHSasLBA = ((regLcyl + (regHcyl << 8)) * curHeads + (regSelect & 0x0F)) * curSectors + (regSector - 1);
|
||||
return -1;
|
||||
|
@ -391,7 +391,7 @@ void ATA::HDD_SetLBA(s64 sectorNum)
|
|||
regStatus |= ATA_STAT_ERR;
|
||||
regError |= ATA_ERR_ABORT;
|
||||
|
||||
DEV9_LOG_ERROR("DEV9 ERROR : tried to get LBA address while LBA mode disabled\n");
|
||||
Console.Error("ATA: Tried to set LBA address while LBA mode disabled");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ bool ATA::HDD_CanAccess(int* sectors)
|
|||
if (lba == -1)
|
||||
return false;
|
||||
|
||||
DEV9_LOG_VERB("LBA :%i\n", lba);
|
||||
DevCon.WriteLn("LBA :%i", lba);
|
||||
posStart = lba;
|
||||
|
||||
if (posStart > maxLBA)
|
||||
|
|
|
@ -67,7 +67,7 @@ void ATA::IO_Read()
|
|||
|
||||
if (lba == -1)
|
||||
{
|
||||
DEV9_LOG_ERROR("Invalid LBA");
|
||||
Console.Error("ATA: Invalid LBA");
|
||||
pxAssert(false);
|
||||
abort();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void ATA::IO_Read()
|
|||
hddImage.seekg(pos, std::ios::beg);
|
||||
if (hddImage.fail())
|
||||
{
|
||||
DEV9_LOG_ERROR("Read error");
|
||||
Console.Error("ATA: File read error");
|
||||
pxAssert(false);
|
||||
abort();
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ bool ATA::IO_Write()
|
|||
hddImage.write((char*)data, len);
|
||||
if (hddImage.fail())
|
||||
{
|
||||
DEV9_LOG_ERROR("Write error");
|
||||
Console.Error("ATA: File write error");
|
||||
pxAssert(false);
|
||||
abort();
|
||||
}
|
||||
|
|
|
@ -92,8 +92,7 @@ void ATA::ATAreadDMA8Mem(u8* pMem, int size)
|
|||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
DEV9_LOG_VERB("DMA read, size %i, transferred %i, total size %i\n", size, rdTransferred, nsector * 512);
|
||||
DevCon.WriteLn("DMA read, size %i, transferred %i, total size %i", size, rdTransferred, nsector * 512);
|
||||
|
||||
//read
|
||||
memcpy(pMem, &readBuffer[rdTransferred], size);
|
||||
|
@ -116,7 +115,7 @@ void ATA::ATAwriteDMA8Mem(u8* pMem, int size)
|
|||
if ((udmaMode >= 0) &&
|
||||
(dev9.if_ctrl & SPD_IF_ATA_DMAEN) != 0)
|
||||
{
|
||||
DEV9_LOG_VERB("DMA write, size %i, transferred %i, total size %i\n", size, wrTransferred, nsector * 512);
|
||||
DevCon.WriteLn("DMA write, size %i, transferred %i, total size %i", size, wrTransferred, nsector * 512);
|
||||
|
||||
//write
|
||||
memcpy(¤tWrite[wrTransferred], pMem, size);
|
||||
|
@ -140,7 +139,7 @@ void ATA::HDD_ReadDMA(bool isLBA48)
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_VERB("HDD_ReadDMA\n");
|
||||
DevCon.WriteLn("HDD_ReadDMA");
|
||||
|
||||
IDE_CmdLBA48Transform(isLBA48);
|
||||
|
||||
|
@ -160,7 +159,7 @@ void ATA::HDD_WriteDMA(bool isLBA48)
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_VERB("HDD_WriteDMA\n");
|
||||
DevCon.WriteLn("HDD_WriteDMA");
|
||||
|
||||
IDE_CmdLBA48Transform(isLBA48);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void ATA::HDD_FlushCache() //Can't when DRQ set
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_VERB("HDD_FlushCache\n");
|
||||
DevCon.WriteLn("HDD_FlushCache");
|
||||
|
||||
awaitFlush = true;
|
||||
Async(-1);
|
||||
|
@ -50,7 +50,7 @@ void ATA::HDD_FlushCache() //Can't when DRQ set
|
|||
void ATA::HDD_InitDevParameters()
|
||||
{
|
||||
PreCmd(); //Ignore DRDY bit
|
||||
DEV9_LOG_INFO("HDD_InitDevParameters\n");
|
||||
DevCon.WriteLn("HDD_InitDevParameters");
|
||||
|
||||
curSectors = regNsector;
|
||||
curHeads = (u8)((regSelect & 0x7) + 1);
|
||||
|
@ -61,7 +61,7 @@ void ATA::HDD_ReadVerifySectors(bool isLBA48)
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_VERB("HDD_ReadVerifySectors\n");
|
||||
DevCon.WriteLn("HDD_ReadVerifySectors");
|
||||
|
||||
IDE_CmdLBA48Transform(isLBA48);
|
||||
|
||||
|
@ -74,7 +74,7 @@ void ATA::HDD_SeekCmd()
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_INFO("HDD_SeekCmd\n");
|
||||
DevCon.WriteLn("HDD_SeekCmd");
|
||||
|
||||
regStatus &= ~ATA_STAT_SEEK;
|
||||
|
||||
|
@ -93,7 +93,7 @@ void ATA::HDD_SetFeatures()
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_VERB("HDD_SetFeatures\n");
|
||||
DevCon.WriteLn("HDD_SetFeatures");
|
||||
|
||||
switch (regFeature)
|
||||
{
|
||||
|
@ -113,49 +113,49 @@ void ATA::HDD_SetFeatures()
|
|||
{
|
||||
case 0x00: //pio default
|
||||
//if mode = 1, disable IORDY
|
||||
DEV9_LOG_ERROR("PIO Default\n");
|
||||
DevCon.WriteLn("PIO Default");
|
||||
pioMode = 4;
|
||||
sdmaMode = -1;
|
||||
mdmaMode = -1;
|
||||
udmaMode = -1;
|
||||
break;
|
||||
case 0x01: //pio mode (3,4)
|
||||
DEV9_LOG_ERROR("PIO Mode %i\n", mode);
|
||||
DevCon.WriteLn("PIO Mode %i", mode);
|
||||
pioMode = mode;
|
||||
sdmaMode = -1;
|
||||
mdmaMode = -1;
|
||||
udmaMode = -1;
|
||||
break;
|
||||
case 0x02: //Single word dma mode (0,1,2)
|
||||
DEV9_LOG_ERROR("SDMA Mode %i\n", mode);
|
||||
DevCon.WriteLn("SDMA Mode %i", mode);
|
||||
//pioMode = -1;
|
||||
sdmaMode = mode;
|
||||
mdmaMode = -1;
|
||||
udmaMode = -1;
|
||||
break;
|
||||
case 0x04: //Multi word dma mode (0,1,2)
|
||||
DEV9_LOG_ERROR("MDMA Mode %i\n", mode);
|
||||
DevCon.WriteLn("MDMA Mode %i", mode);
|
||||
//pioMode = -1;
|
||||
sdmaMode = -1;
|
||||
mdmaMode = mode;
|
||||
udmaMode = -1;
|
||||
break;
|
||||
case 0x08: //Ulta dma mode (0,1,2,3,4,5,6)
|
||||
DEV9_LOG_ERROR("UDMA Mode %i\n", mode);
|
||||
DevCon.WriteLn("UDMA Mode %i", mode);
|
||||
//pioMode = -1;
|
||||
sdmaMode = -1;
|
||||
mdmaMode = -1;
|
||||
udmaMode = mode;
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("Unkown transfer mode\n");
|
||||
Console.Error("ATA: Unkown transfer mode");
|
||||
CmdNoDataAbort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("Unkown feature mode\n");
|
||||
Console.Error("ATA: Unkown feature mode");
|
||||
break;
|
||||
}
|
||||
PostCmdNoData();
|
||||
|
@ -165,7 +165,7 @@ void ATA::HDD_SetMultipleMode()
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_INFO("HDD_SetMultipleMode\n");
|
||||
DevCon.WriteLn("HDD_SetMultipleMode");
|
||||
|
||||
curMultipleSectorsSetting = regNsector;
|
||||
|
||||
|
@ -176,8 +176,7 @@ void ATA::HDD_Nop()
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
|
||||
DEV9_LOG_INFO("HDD_Nop\n");
|
||||
DevCon.WriteLn("HDD_Nop");
|
||||
|
||||
if (regFeature == 0)
|
||||
{
|
||||
|
@ -196,8 +195,7 @@ void ATA::HDD_Idle()
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
|
||||
DEV9_LOG_VERB("HDD_Idle\n");
|
||||
DevCon.WriteLn("HDD_Idle");
|
||||
|
||||
long idleTime = 0; //in seconds
|
||||
if (regNsector >= 1 && regNsector <= 240)
|
||||
|
@ -229,6 +227,6 @@ void ATA::HDD_Idle()
|
|||
}
|
||||
}
|
||||
|
||||
DEV9_LOG_VERB("HDD_Idle for %is\n", idleTime);
|
||||
DevCon.WriteLn("HDD_Idle for %is", idleTime);
|
||||
PostCmdNoData();
|
||||
}
|
||||
|
|
|
@ -51,11 +51,11 @@ void ATA::PostCmdPIODataToHost()
|
|||
//FromHost
|
||||
u16 ATA::ATAreadPIO()
|
||||
{
|
||||
DEV9_LOG_VERB("*ATA_R_DATA 16bit read, pio_count %i, pio_size %i\n", pioPtr, pioEnd);
|
||||
DevCon.WriteLn("*ATA_R_DATA 16bit read, pio_count %i, pio_size %i", pioPtr, pioEnd);
|
||||
if (pioPtr < pioEnd)
|
||||
{
|
||||
const u16 ret = *(u16*)&pioBuffer[pioPtr * 2];
|
||||
DEV9_LOG_VERB("*ATA_R_DATA returned value is %x\n", ret);
|
||||
DevCon.WriteLn("*ATA_R_DATA returned value is %x", ret);
|
||||
pioPtr++;
|
||||
if (pioPtr >= pioEnd) //Fnished transfer (Changed from MegaDev9)
|
||||
PostCmdPIODataToHost();
|
||||
|
@ -70,7 +70,7 @@ void ATA::HDD_IdentifyDevice()
|
|||
{
|
||||
if (!PreCmd())
|
||||
return;
|
||||
DEV9_LOG_VERB("HddidentifyDevice\n");
|
||||
DevCon.WriteLn("HddidentifyDevice");
|
||||
|
||||
//IDE transfer start
|
||||
CreateHDDinfo(config.HddSize);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
void ATA::HDD_Smart()
|
||||
{
|
||||
DEV9_LOG_VERB("HDD_Smart\n");
|
||||
DevCon.WriteLn("HDD_Smart");
|
||||
|
||||
if ((regStatus & ATA_STAT_READY) == 0)
|
||||
return;
|
||||
|
@ -54,22 +54,22 @@ void ATA::HDD_Smart()
|
|||
SMART_ReturnStatus();
|
||||
return;
|
||||
case 0xD1: //SMART_READ_THRESH
|
||||
DEV9_LOG_ERROR("DEV9 : SMART_READ_THRESH Not Impemented\n");
|
||||
Console.Error("ATA: SMART_READ_THRESH Not Impemented");
|
||||
CmdNoDataAbort();
|
||||
return;
|
||||
case 0xD0: //SMART_READ_DATA
|
||||
DEV9_LOG_ERROR("DEV9 : SMART_READ_DATA Not Impemented\n");
|
||||
Console.Error("ATA: SMART_READ_DATA Not Impemented");
|
||||
CmdNoDataAbort();
|
||||
return;
|
||||
case 0xD5: //SMART_READ_LOG
|
||||
DEV9_LOG_ERROR("DEV9 : SMART_READ_LOG Not Impemented\n");
|
||||
Console.Error("ATA: SMART_READ_LOG Not Impemented");
|
||||
CmdNoDataAbort();
|
||||
return;
|
||||
case 0xD4: //SMART_EXECUTE_OFFLINE
|
||||
SMART_ExecuteOfflineImmediate();
|
||||
return;
|
||||
default:
|
||||
DEV9_LOG_ERROR("DEV9 : Unknown SMART command %x\n", regFeature);
|
||||
Console.Error("ATA: Unknown SMART command %x", regFeature);
|
||||
CmdNoDataAbort();
|
||||
return;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ void ATA::SMART_SetAutoSaveAttribute()
|
|||
smartAutosave = true;
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("DEV9 : Unknown SMART_ATTR_AUTOSAVE command %s\n", regSector);
|
||||
Console.Error("ATA: Unknown SMART_ATTR_AUTOSAVE command %s", regSector);
|
||||
CmdNoDataAbort();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ void ATA::IDE_ExecCmd(u16 value)
|
|||
|
||||
void ATA::HDD_Unk()
|
||||
{
|
||||
DEV9_LOG_ERROR("DEV9 HDD error : unknown cmd %x\n", regCommand);
|
||||
Console.Error("ATA: Unknown cmd %x", regCommand);
|
||||
|
||||
PreCmd();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
void ATA::HDD_SCE()
|
||||
{
|
||||
DEV9_LOG_INFO("DEV9 : SONY-SPECIFIC SECURITY CONTROL COMMAND %x\n", regFeature);
|
||||
DevCon.WriteLn("DEV9 : SONY-SPECIFIC SECURITY CONTROL COMMAND %x", regFeature);
|
||||
|
||||
switch (regFeature)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ void ATA::HDD_SCE()
|
|||
SCE_IDENTIFY_DRIVE();
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("DEV9 : Unknown SCE command %x\n", regFeature);
|
||||
Console.Error("ATA: Unknown SCE command %x", regFeature);
|
||||
CmdNoDataAbort();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -96,71 +96,16 @@ int mapping;
|
|||
|
||||
std::string s_strIniPath = "inis";
|
||||
std::string s_strLogPath = "logs";
|
||||
// Warning: The below log function is SLOW. Better fix it before attempting to use it.
|
||||
#ifdef _DEBUG
|
||||
int logFile = 1;
|
||||
#else
|
||||
int logFile = 0;
|
||||
#endif
|
||||
|
||||
void __Log(int level, const char* fmt, ...)
|
||||
{
|
||||
static char buffer[1024];
|
||||
|
||||
if (level < DEV9_LOG_LEVEL)
|
||||
return;
|
||||
|
||||
va_list list1;
|
||||
va_list list2;
|
||||
|
||||
static int ticks = -1;
|
||||
int nticks = GetTickCount();
|
||||
|
||||
if (ticks == -1)
|
||||
ticks = nticks;
|
||||
|
||||
if (logFile)
|
||||
DEV9Log.Write("[%10d + %4d] ", nticks, nticks - ticks);
|
||||
ticks = nticks;
|
||||
|
||||
if (logFile)
|
||||
{
|
||||
va_start(list1, fmt);
|
||||
//PSELog has no vargs method
|
||||
//use tmp buffer
|
||||
vsnprintf(buffer, 1024, fmt, list1);
|
||||
DEV9Log.Write(buffer);
|
||||
va_end(list1);
|
||||
}
|
||||
|
||||
va_start(list2, fmt);
|
||||
emu_vprintf(fmt, list2);
|
||||
va_end(list2);
|
||||
}
|
||||
|
||||
void LogInit()
|
||||
{
|
||||
const char* logName = "dev9Log.txt";
|
||||
|
||||
//GHC uses UTF8 on all platforms
|
||||
ghc::filesystem::path path(GetLogFolder().ToUTF8().data());
|
||||
path /= logName;
|
||||
std::string strPath = path.u8string();
|
||||
|
||||
DEV9Log.WriteToFile = true;
|
||||
DEV9Log.Open(strPath.c_str());
|
||||
}
|
||||
|
||||
s32 DEV9init()
|
||||
{
|
||||
LogInit();
|
||||
DEV9_LOG("DEV9init\n");
|
||||
DevCon.WriteLn("DEV9init");
|
||||
|
||||
memset(&dev9, 0, sizeof(dev9));
|
||||
dev9.ata = new ATA();
|
||||
DEV9_LOG("DEV9init2\n");
|
||||
DevCon.WriteLn("DEV9init2");
|
||||
|
||||
DEV9_LOG("DEV9init3\n");
|
||||
DevCon.WriteLn("DEV9init3");
|
||||
|
||||
FLASHinit();
|
||||
|
||||
|
@ -228,30 +173,28 @@ s32 DEV9init()
|
|||
pbd->length = 0;
|
||||
}
|
||||
|
||||
DEV9_LOG("DEV9init ok\n");
|
||||
DevCon.WriteLn("DEV9init ok");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DEV9shutdown()
|
||||
{
|
||||
DEV9_LOG("DEV9shutdown\n");
|
||||
DevCon.WriteLn("DEV9shutdown");
|
||||
delete dev9.ata;
|
||||
if (logFile)
|
||||
DEV9Log.Close();
|
||||
}
|
||||
|
||||
s32 DEV9open(void* pDsp)
|
||||
{
|
||||
DEV9_LOG("DEV9open\n");
|
||||
DevCon.WriteLn("DEV9open");
|
||||
LoadConf();
|
||||
#ifdef _WIN32
|
||||
//Convert to utf8
|
||||
char mbHdd[sizeof(config.Hdd)] = {0};
|
||||
WideCharToMultiByte(CP_UTF8, 0, config.Hdd, -1, mbHdd, sizeof(mbHdd) - 1, nullptr, nullptr);
|
||||
DEV9_LOG("open r+: %s\n", mbHdd);
|
||||
DevCon.WriteLn("open r+: %s", mbHdd);
|
||||
#else
|
||||
DEV9_LOG("open r+: %s\n", config.Hdd);
|
||||
DevCon.WriteLn("open r+: %s", config.Hdd);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -281,7 +224,7 @@ s32 DEV9open(void* pDsp)
|
|||
|
||||
void DEV9close()
|
||||
{
|
||||
DEV9_LOG("DEV9close\n");
|
||||
DevCon.WriteLn("DEV9close");
|
||||
|
||||
dev9.ata->Close();
|
||||
_DEV9close();
|
||||
|
@ -290,7 +233,7 @@ void DEV9close()
|
|||
int DEV9irqHandler(void)
|
||||
{
|
||||
//dev9Ru16(SPD_R_INTR_STAT)|= dev9.irqcause;
|
||||
DEV9_LOG("_DEV9irqHandler %x, %x\n", dev9.irqcause, dev9.irqmask);
|
||||
DevCon.WriteLn("_DEV9irqHandler %x, %x", dev9.irqcause, dev9.irqmask);
|
||||
if (dev9.irqcause & dev9.irqmask)
|
||||
return 1;
|
||||
return 0;
|
||||
|
@ -298,7 +241,7 @@ int DEV9irqHandler(void)
|
|||
|
||||
void _DEV9irq(int cause, int cycles)
|
||||
{
|
||||
DEV9_LOG("_DEV9irq %x, %x\n", cause, dev9.irqmask);
|
||||
DevCon.WriteLn("_DEV9irq %x, %x", cause, dev9.irqmask);
|
||||
|
||||
dev9.irqcause |= cause;
|
||||
|
||||
|
@ -317,7 +260,7 @@ void HDDWriteFIFO()
|
|||
const int spaceSectors = (SPD_DBUF_AVAIL_MAX * 512 - unread) / 512;
|
||||
if (spaceSectors < 0)
|
||||
{
|
||||
DEV9_LOG_ERROR("No Space on SPEED FIFO");
|
||||
Console.Error("DEV9: No Space on SPEED FIFO");
|
||||
pxAssert(false);
|
||||
abort();
|
||||
}
|
||||
|
@ -342,14 +285,14 @@ void IOPReadFIFO(int bytes)
|
|||
{
|
||||
dev9.fifo_bytes_read += bytes;
|
||||
if (dev9.fifo_bytes_read > dev9.fifo_bytes_write)
|
||||
DEV9_LOG_ERROR("UNDERFLOW BY IOP\n");
|
||||
Console.Error("DEV9: UNDERFLOW BY IOP");
|
||||
//FIFOIntr();
|
||||
}
|
||||
void IOPWriteFIFO(int bytes)
|
||||
{
|
||||
dev9.fifo_bytes_write += bytes;
|
||||
if (dev9.fifo_bytes_write - SPD_DBUF_AVAIL_MAX * 512 > dev9.fifo_bytes_read)
|
||||
DEV9_LOG_ERROR("OVERFLOW BY IOP\n");
|
||||
Console.Error("DEV9: OVERFLOW BY IOP");
|
||||
//FIFOIntr();
|
||||
}
|
||||
void FIFOIntr()
|
||||
|
@ -377,7 +320,7 @@ u8 DEV9read8(u32 addr)
|
|||
u8 hard;
|
||||
if (addr >= ATA_DEV9_HDD_BASE && addr < ATA_DEV9_HDD_END)
|
||||
{
|
||||
DEV9_LOG_ERROR("ATA does not support 8bit reads %lx\n", addr);
|
||||
Console.Error("ATA does not support 8bit reads %lx", addr);
|
||||
return 0;
|
||||
}
|
||||
if (addr >= SMAP_REGBASE && addr < FLASH_REGBASE)
|
||||
|
@ -420,17 +363,17 @@ u8 DEV9read8(u32 addr)
|
|||
}
|
||||
else
|
||||
hard = 0;
|
||||
DEV9_LOG_VERB("SPD_R_PIO_DATA 8bit read %x\n", hard);
|
||||
DevCon.WriteLn("SPD_R_PIO_DATA 8bit read %x", hard);
|
||||
return hard;
|
||||
|
||||
case DEV9_R_REV:
|
||||
hard = 0x32; // expansion bay
|
||||
DEV9_LOG_VERB("DEV9_R_REV 8bit read %x\n", hard);
|
||||
DevCon.WriteLn("DEV9_R_REV 8bit read %x", hard);
|
||||
return hard;
|
||||
|
||||
default:
|
||||
hard = dev9Ru8(addr);
|
||||
DEV9_LOG_ERROR("*Unknown 8bit read at address %lx value %x\n", addr, hard);
|
||||
Console.Error("DEV9: Unknown 8bit read at address %lx value %x", addr, hard);
|
||||
return hard;
|
||||
}
|
||||
}
|
||||
|
@ -458,11 +401,11 @@ u16 DEV9read16(u32 addr)
|
|||
switch (addr)
|
||||
{
|
||||
case SPD_R_INTR_STAT:
|
||||
DEV9_LOG_VERB("SPD_R_INTR_STAT 16bit read %x\n", dev9.irqcause);
|
||||
DevCon.WriteLn("SPD_R_INTR_STAT 16bit read %x", dev9.irqcause);
|
||||
return dev9.irqcause;
|
||||
|
||||
case SPD_R_INTR_MASK:
|
||||
DEV9_LOG("SPD_R_INTR_MASK 16bit read %x\n", dev9.irqmask);
|
||||
DevCon.WriteLn("SPD_R_INTR_MASK 16bit read %x", dev9.irqmask);
|
||||
return dev9.irqmask;
|
||||
|
||||
case SPD_R_PIO_DATA:
|
||||
|
@ -493,22 +436,22 @@ u16 DEV9read16(u32 addr)
|
|||
}
|
||||
else
|
||||
hard = 0;
|
||||
DEV9_LOG_VERB("SPD_R_PIO_DATA 16bit read %x\n", hard);
|
||||
DevCon.WriteLn("SPD_R_PIO_DATA 16bit read %x", hard);
|
||||
return hard;
|
||||
|
||||
case DEV9_R_REV:
|
||||
//hard = 0x0030; // expansion bay
|
||||
DEV9_LOG_VERB("DEV9_R_REV 16bit read %x\n", dev9.irqmask);
|
||||
DevCon.WriteLn("DEV9_R_REV 16bit read %x", dev9.irqmask);
|
||||
hard = 0x0032;
|
||||
return hard;
|
||||
|
||||
case SPD_R_REV_1:
|
||||
DEV9_LOG_VERB("SPD_R_REV_1 16bit read %x\n", 0);
|
||||
DevCon.WriteLn("SPD_R_REV_1 16bit read %x", 0);
|
||||
return 0;
|
||||
|
||||
case SPD_R_REV_2:
|
||||
hard = 0x0011;
|
||||
DEV9_LOG_VERB("STD_R_REV_1 16bit read %x\n", hard);
|
||||
DevCon.WriteLn("STD_R_REV_1 16bit read %x", hard);
|
||||
return hard;
|
||||
|
||||
case SPD_R_REV_3:
|
||||
|
@ -518,15 +461,15 @@ u16 DEV9read16(u32 addr)
|
|||
if (config.ethEnable)
|
||||
hard |= SPD_CAPS_SMAP;
|
||||
hard |= SPD_CAPS_FLASH;
|
||||
DEV9_LOG_VERB("SPD_R_REV_3 16bit read %x\n", hard);
|
||||
DevCon.WriteLn("SPD_R_REV_3 16bit read %x", hard);
|
||||
return hard;
|
||||
|
||||
case SPD_R_0e:
|
||||
hard = 0x0002; //Have HDD inserted
|
||||
DEV9_LOG_VERB("SPD_R_0e 16bit read %x\n", hard);
|
||||
DevCon.WriteLn("SPD_R_0e 16bit read %x", hard);
|
||||
return hard;
|
||||
case SPD_R_XFR_CTRL:
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL 16bit read %x\n", dev9.xfr_ctrl);
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL 16bit read %x", dev9.xfr_ctrl);
|
||||
return dev9.xfr_ctrl;
|
||||
case SPD_R_DBUF_STAT:
|
||||
{
|
||||
|
@ -562,15 +505,15 @@ u16 DEV9read16(u32 addr)
|
|||
hard |= SPD_DBUF_STAT_FULL;
|
||||
}
|
||||
|
||||
DEV9_LOG_VERB("SPD_R_DBUF_STAT 16bit read %x\n", hard);
|
||||
DevCon.WriteLn("SPD_R_DBUF_STAT 16bit read %x", hard);
|
||||
return hard;
|
||||
}
|
||||
case SPD_R_IF_CTRL:
|
||||
DEV9_LOG_VERB("SPD_R_IF_CTRL 16bit read %x\n", dev9.if_ctrl);
|
||||
DevCon.WriteLn("SPD_R_IF_CTRL 16bit read %x", dev9.if_ctrl);
|
||||
return dev9.if_ctrl;
|
||||
default:
|
||||
hard = dev9Ru16(addr);
|
||||
DEV9_LOG_ERROR("*Unknown 16bit read at address %lx value %x\n", addr, hard);
|
||||
Console.Error("DEV9: Unknown 16bit read at address %lx value %x", addr, hard);
|
||||
return hard;
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +526,7 @@ u32 DEV9read32(u32 addr)
|
|||
u32 hard;
|
||||
if (addr >= ATA_DEV9_HDD_BASE && addr < ATA_DEV9_HDD_END)
|
||||
{
|
||||
DEV9_LOG_ERROR("ATA does not support 32bit reads %lx\n", addr);
|
||||
Console.Error("ATA does not support 32bit reads %lx", addr);
|
||||
return 0;
|
||||
}
|
||||
if (addr >= SMAP_REGBASE && addr < FLASH_REGBASE)
|
||||
|
@ -597,7 +540,7 @@ u32 DEV9read32(u32 addr)
|
|||
}
|
||||
|
||||
hard = dev9Ru32(addr);
|
||||
DEV9_LOG_ERROR("*Unknown 32bit read at address %lx value %x\n", addr, hard);
|
||||
Console.Error("DEV9: Unknown 32bit read at address %lx value %x", addr, hard);
|
||||
return hard;
|
||||
}
|
||||
|
||||
|
@ -628,19 +571,19 @@ void DEV9write8(u32 addr, u8 value)
|
|||
switch (addr)
|
||||
{
|
||||
case 0x10000020:
|
||||
DEV9_LOG_ERROR("SPD_R_INTR_CAUSE, WTFH ?\n");
|
||||
Console.Error("SPD_R_INTR_CAUSE, WTFH ?");
|
||||
dev9.irqcause = 0xff;
|
||||
break;
|
||||
case SPD_R_INTR_STAT:
|
||||
DEV9_LOG_ERROR("SPD_R_INTR_STAT, WTFH ?\n");
|
||||
Console.Error("SPD_R_INTR_STAT, WTFH ?");
|
||||
dev9.irqcause = value;
|
||||
return;
|
||||
case SPD_R_INTR_MASK:
|
||||
DEV9_LOG_ERROR("SPD_R_INTR_MASK8, WTFH ?\n");
|
||||
Console.Error("SPD_R_INTR_MASK8, WTFH ?");
|
||||
break;
|
||||
|
||||
case SPD_R_PIO_DIR:
|
||||
DEV9_LOG_VERB("SPD_R_PIO_DIR 8bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_PIO_DIR 8bit write %x", value);
|
||||
|
||||
if ((value & 0xc0) != 0xc0)
|
||||
return;
|
||||
|
@ -654,7 +597,7 @@ void DEV9write8(u32 addr, u8 value)
|
|||
return;
|
||||
|
||||
case SPD_R_PIO_DATA:
|
||||
DEV9_LOG_VERB("SPD_R_PIO_DATA 8bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_PIO_DATA 8bit write %x", value);
|
||||
|
||||
if ((value & 0xc0) != 0xc0)
|
||||
return;
|
||||
|
@ -702,13 +645,13 @@ void DEV9write8(u32 addr, u8 value)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("Unkown EEPROM COMMAND\n");
|
||||
Console.Error("DEV9: Unkown EEPROM COMMAND");
|
||||
break;
|
||||
}
|
||||
return;
|
||||
default:
|
||||
dev9Ru8(addr) = value;
|
||||
DEV9_LOG_ERROR("*Unknown 8bit write at address %lx value %x\n", addr, value);
|
||||
Console.Error("DEV9: Unknown 8bit write at address %lx value %x", addr, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -738,17 +681,17 @@ void DEV9write16(u32 addr, u16 value)
|
|||
switch (addr)
|
||||
{
|
||||
case SPD_R_INTR_MASK:
|
||||
DEV9_LOG_VERB("SPD_R_INTR_MASK 16bit write %x , checking for masked/unmasked interrupts\n", value);
|
||||
DevCon.WriteLn("SPD_R_INTR_MASK 16bit write %x , checking for masked/unmasked interrupts", value);
|
||||
if ((dev9.irqmask != value) && ((dev9.irqmask | value) & dev9.irqcause))
|
||||
{
|
||||
DEV9_LOG_VERB("SPD_R_INTR_MASK16 firing unmasked interrupts\n");
|
||||
DevCon.WriteLn("SPD_R_INTR_MASK16 firing unmasked interrupts");
|
||||
dev9Irq(1);
|
||||
}
|
||||
dev9.irqmask = value;
|
||||
break;
|
||||
|
||||
case SPD_R_PIO_DIR:
|
||||
DEV9_LOG_VERB("SPD_R_PIO_DIR 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_PIO_DIR 16bit write %x", value);
|
||||
|
||||
if ((value & 0xc0) != 0xc0)
|
||||
return;
|
||||
|
@ -762,7 +705,7 @@ void DEV9write16(u32 addr, u16 value)
|
|||
return;
|
||||
|
||||
case SPD_R_PIO_DATA:
|
||||
DEV9_LOG_VERB("SPD_R_PIO_DATA 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_PIO_DATA 16bit write %x", value);
|
||||
|
||||
if ((value & 0xc0) != 0xc0)
|
||||
return;
|
||||
|
@ -810,69 +753,69 @@ void DEV9write16(u32 addr, u16 value)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("Unkown EEPROM COMMAND\n");
|
||||
Console.Error("Unkown EEPROM COMMAND");
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
case SPD_R_DMA_CTRL:
|
||||
DEV9_LOG_VERB("SPD_R_IF_CTRL 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_IF_CTRL 16bit write %x", value);
|
||||
dev9.dma_ctrl = value;
|
||||
|
||||
if (value & SPD_DMA_TO_SMAP)
|
||||
DEV9_LOG_VERB("SPD_R_DMA_CTRL DMA For SMAP\n");
|
||||
DevCon.WriteLn("SPD_R_DMA_CTRL DMA For SMAP");
|
||||
else
|
||||
DEV9_LOG_VERB("SPD_R_DMA_CTRL DMA For ATA\n");
|
||||
DevCon.WriteLn("SPD_R_DMA_CTRL DMA For ATA");
|
||||
|
||||
if ((value & SPD_DMA_FASTEST) != 0)
|
||||
DEV9_LOG_VERB("SPD_R_DMA_CTRL Fastest DMA Mode\n");
|
||||
DevCon.WriteLn("SPD_R_DMA_CTRL Fastest DMA Mode");
|
||||
else
|
||||
DEV9_LOG_VERB("SPD_R_DMA_CTRL Slower DMA Mode\n");
|
||||
DevCon.WriteLn("SPD_R_DMA_CTRL Slower DMA Mode");
|
||||
|
||||
if ((value & SPD_DMA_WIDE) != 0)
|
||||
DEV9_LOG_VERB("SPD_R_DMA_CTRL Wide(32bit) DMA Mode Set\n");
|
||||
DevCon.WriteLn("SPD_R_DMA_CTRL Wide(32bit) DMA Mode Set");
|
||||
else
|
||||
DEV9_LOG_VERB("SPD_R_DMA_CTRL 16bit DMA Mode\n");
|
||||
DevCon.WriteLn("SPD_R_DMA_CTRL 16bit DMA Mode");
|
||||
|
||||
if ((value & SPD_DMA_PAUSE) != 0)
|
||||
DEV9_LOG_ERROR("SPD_R_DMA_CTRL Pause DMA\n");
|
||||
Console.Error("SPD_R_DMA_CTRL Pause DMA Not Implemented");
|
||||
|
||||
if ((value & 0b1111111111101000) != 0)
|
||||
DEV9_LOG_ERROR("SPD_R_DMA_CTRL Unkown value written %x\n", value);
|
||||
Console.Error("SPD_R_DMA_CTRL Unkown value written %x", value);
|
||||
|
||||
break;
|
||||
case SPD_R_XFR_CTRL:
|
||||
DEV9_LOG_VERB("SPD_R_IF_CTRL 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_IF_CTRL 16bit write %x", value);
|
||||
dev9.xfr_ctrl = value;
|
||||
|
||||
if (value & SPD_XFR_WRITE)
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL Set Write\n");
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL Set Write");
|
||||
else
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL Set Read\n");
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL Set Read");
|
||||
|
||||
if ((value & (1 << 1)) != 0)
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL Unkown Bit 1\n");
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL Unkown Bit 1");
|
||||
|
||||
if ((value & (1 << 2)) != 0)
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL Unkown Bit 2\n");
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL Unkown Bit 2");
|
||||
|
||||
if (value & SPD_XFR_DMAEN)
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL For DMA Enabled\n");
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL For DMA Enabled");
|
||||
else
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL For DMA Disabled\n");
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL For DMA Disabled");
|
||||
|
||||
if ((value & 0b1111111101111000) != 0)
|
||||
{
|
||||
DEV9_LOG_ERROR("SPD_R_XFR_CTRL Unkown value written %x\n", value);
|
||||
Console.Error("SPD_R_XFR_CTRL Unkown value written %x", value);
|
||||
}
|
||||
|
||||
break;
|
||||
case SPD_R_DBUF_STAT:
|
||||
DEV9_LOG_VERB("SPD_R_DBUF_STAT 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_DBUF_STAT 16bit write %x", value);
|
||||
|
||||
if ((value & SPD_DBUF_RESET_FIFO) != 0)
|
||||
{
|
||||
DEV9_LOG_VERB("SPD_R_XFR_CTRL Reset FIFO\n");
|
||||
DevCon.WriteLn("SPD_R_XFR_CTRL Reset FIFO");
|
||||
dev9.fifo_bytes_write = 0;
|
||||
dev9.fifo_bytes_read = 0;
|
||||
dev9.xfr_ctrl &= ~SPD_XFR_WRITE; //?
|
||||
|
@ -882,25 +825,25 @@ void DEV9write16(u32 addr, u16 value)
|
|||
}
|
||||
|
||||
if (value != 3)
|
||||
DEV9_LOG_ERROR("SPD_R_38 16bit write %x Which != 3!!!", value);
|
||||
Console.Error("SPD_R_38 16bit write %x Which != 3!!!", value);
|
||||
break;
|
||||
|
||||
case SPD_R_IF_CTRL:
|
||||
DEV9_LOG_VERB("SPD_R_IF_CTRL 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_IF_CTRL 16bit write %x", value);
|
||||
dev9.if_ctrl = value;
|
||||
|
||||
if (value & SPD_IF_UDMA)
|
||||
DEV9_LOG_VERB("IF_CTRL UDMA Enabled\n");
|
||||
DevCon.WriteLn("IF_CTRL UDMA Enabled");
|
||||
else
|
||||
DEV9_LOG_VERB("IF_CTRL UDMA Disabled\n");
|
||||
DevCon.WriteLn("IF_CTRL UDMA Disabled");
|
||||
if (value & SPD_IF_READ)
|
||||
DEV9_LOG_VERB("IF_CTRL DMA Is ATA Read\n");
|
||||
DevCon.WriteLn("IF_CTRL DMA Is ATA Read");
|
||||
else
|
||||
DEV9_LOG_VERB("IF_CTRL DMA Is ATA Write\n");
|
||||
DevCon.WriteLn("IF_CTRL DMA Is ATA Write");
|
||||
|
||||
if (value & SPD_IF_ATA_DMAEN)
|
||||
{
|
||||
DEV9_LOG_VERB("IF_CTRL ATA DMA Enabled\n");
|
||||
DevCon.WriteLn("IF_CTRL ATA DMA Enabled");
|
||||
if (value & SPD_IF_READ) //Semi async
|
||||
{
|
||||
HDDWriteFIFO(); //Yes this is not a typo
|
||||
|
@ -912,24 +855,24 @@ void DEV9write16(u32 addr, u16 value)
|
|||
FIFOIntr();
|
||||
}
|
||||
else
|
||||
DEV9_LOG_VERB("IF_CTRL ATA DMA Disabled\n");
|
||||
DevCon.WriteLn("IF_CTRL ATA DMA Disabled");
|
||||
|
||||
if (value & (1 << 3))
|
||||
DEV9_LOG_VERB("IF_CTRL Unkown Bit 3 Set\n");
|
||||
DevCon.WriteLn("IF_CTRL Unkown Bit 3 Set");
|
||||
|
||||
if (value & (1 << 4))
|
||||
DEV9_LOG_ERROR("IF_CTRL Unkown Bit 4 Set\n");
|
||||
Console.Error("IF_CTRL Unkown Bit 4 Set");
|
||||
if (value & (1 << 5))
|
||||
DEV9_LOG_ERROR("IF_CTRL Unkown Bit 5 Set\n");
|
||||
Console.Error("IF_CTRL Unkown Bit 5 Set");
|
||||
|
||||
if ((value & SPD_IF_HDD_RESET) == 0) //Maybe?
|
||||
{
|
||||
DEV9_LOG_INFO("IF_CTRL HDD Hard Reset\n");
|
||||
DevCon.WriteLn("IF_CTRL HDD Hard Reset");
|
||||
dev9.ata->ATA_HardReset();
|
||||
}
|
||||
if ((value & SPD_IF_ATA_RESET) != 0)
|
||||
{
|
||||
DEV9_LOG_INFO("IF_CTRL ATA Reset\n");
|
||||
DevCon.WriteLn("IF_CTRL ATA Reset");
|
||||
//0x62 0x0020
|
||||
dev9.if_ctrl = 0x001A;
|
||||
//0x66 0x0001
|
||||
|
@ -940,87 +883,87 @@ void DEV9write16(u32 addr, u16 value)
|
|||
}
|
||||
|
||||
if ((value & 0xFF00) > 0)
|
||||
DEV9_LOG_ERROR("IF_CTRL Unkown Bit(s) %x\n", (value & 0xFF00));
|
||||
Console.Error("IF_CTRL Unkown Bit(s) %x", (value & 0xFF00));
|
||||
|
||||
break;
|
||||
case SPD_R_PIO_MODE: //ATA only? or includes EEPROM?
|
||||
DEV9_LOG_VERB("SPD_R_PIO_MODE 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_PIO_MODE 16bit write %x", value);
|
||||
dev9.pio_mode = value;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case 0x92:
|
||||
DEV9_LOG_INFO("SPD_R_PIO_MODE 0\n");
|
||||
DevCon.WriteLn("SPD_R_PIO_MODE 0");
|
||||
break;
|
||||
case 0x72:
|
||||
DEV9_LOG_INFO("SPD_R_PIO_MODE 1\n");
|
||||
DevCon.WriteLn("SPD_R_PIO_MODE 1");
|
||||
break;
|
||||
case 0x32:
|
||||
DEV9_LOG_INFO("SPD_R_PIO_MODE 2\v");
|
||||
DevCon.WriteLn("SPD_R_PIO_MODE 2");
|
||||
break;
|
||||
case 0x24:
|
||||
DEV9_LOG_INFO("SPD_R_PIO_MODE 3\n");
|
||||
DevCon.WriteLn("SPD_R_PIO_MODE 3");
|
||||
break;
|
||||
case 0x23:
|
||||
DEV9_LOG_INFO("SPD_R_PIO_MODE 4\n");
|
||||
DevCon.WriteLn("SPD_R_PIO_MODE 4");
|
||||
break;
|
||||
|
||||
default:
|
||||
DEV9_LOG_ERROR("SPD_R_PIO_MODE UNKOWN MODE %x\n", value);
|
||||
Console.Error("SPD_R_PIO_MODE UNKOWN MODE %x", value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SPD_R_MDMA_MODE: //ATA only? or includes EEPROM?
|
||||
DEV9_LOG_VERB("SPD_R_MDMA_MODE 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_MDMA_MODE 16bit write %x", value);
|
||||
dev9.mdma_mode = value;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case 0xFF:
|
||||
DEV9_LOG_INFO("SPD_R_MDMA_MODE 0\n");
|
||||
DevCon.WriteLn("SPD_R_MDMA_MODE 0");
|
||||
break;
|
||||
case 0x45:
|
||||
DEV9_LOG_INFO("SPD_R_MDMA_MODE 1\n");
|
||||
DevCon.WriteLn("SPD_R_MDMA_MODE 1");
|
||||
break;
|
||||
case 0x24:
|
||||
DEV9_LOG_INFO("SPD_R_MDMA_MODE 2\n");
|
||||
DevCon.WriteLn("SPD_R_MDMA_MODE 2");
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("SPD_R_MDMA_MODE UNKOWN MODE %x\n", value);
|
||||
Console.Error("SPD_R_MDMA_MODE UNKOWN MODE %x", value);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case SPD_R_UDMA_MODE: //ATA only?
|
||||
DEV9_LOG_VERB("SPD_R_UDMA_MODE 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SPD_R_UDMA_MODE 16bit write %x", value);
|
||||
dev9.udma_mode = value;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case 0xa7:
|
||||
DEV9_LOG_VERB("SPD_R_UDMA_MODE 0\n");
|
||||
DevCon.WriteLn("SPD_R_UDMA_MODE 0");
|
||||
break;
|
||||
case 0x85:
|
||||
DEV9_LOG_VERB("SPD_R_UDMA_MODE 1\n");
|
||||
DevCon.WriteLn("SPD_R_UDMA_MODE 1");
|
||||
break;
|
||||
case 0x63:
|
||||
DEV9_LOG_VERB("SPD_R_UDMA_MODE 2\n");
|
||||
DevCon.WriteLn("SPD_R_UDMA_MODE 2");
|
||||
break;
|
||||
case 0x62:
|
||||
DEV9_LOG_VERB("SPD_R_UDMA_MODE 3\n");
|
||||
DevCon.WriteLn("SPD_R_UDMA_MODE 3");
|
||||
break;
|
||||
case 0x61:
|
||||
DEV9_LOG_VERB("SPD_R_UDMA_MODE 4\n");
|
||||
DevCon.WriteLn("SPD_R_UDMA_MODE 4");
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG_ERROR("SPD_R_UDMA_MODE UNKOWN MODE %x\n", value);
|
||||
Console.Error("SPD_R_UDMA_MODE UNKOWN MODE %x", value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
dev9Ru16(addr) = value;
|
||||
DEV9_LOG_ERROR("*Unknown 16bit write at address %lx value %x\n", addr, value);
|
||||
Console.Error("*Unknown 16bit write at address %lx value %x", addr, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1052,11 +995,11 @@ void DEV9write32(u32 addr, u32 value)
|
|||
switch (addr)
|
||||
{
|
||||
case SPD_R_INTR_MASK:
|
||||
DEV9_LOG_ERROR("SPD_R_INTR_MASK , WTFH ?\n");
|
||||
Console.Error("SPD_R_INTR_MASK , WTFH ?");
|
||||
break;
|
||||
default:
|
||||
dev9Ru32(addr) = value;
|
||||
DEV9_LOG_ERROR("*Unknown 32bit write at address %lx write %x\n", addr, value);
|
||||
Console.Error("DEV9: Unknown 32bit write at address %lx write %x", addr, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1068,8 +1011,7 @@ void DEV9readDMA8Mem(u32* pMem, int size)
|
|||
|
||||
size >>= 1;
|
||||
|
||||
DEV9_LOG_VERB("*DEV9readDMA8Mem: size %x\n", size);
|
||||
DEV9_LOG_INFO("rDMA\n");
|
||||
DevCon.WriteLn("*DEV9readDMA8Mem: size %x", size);
|
||||
|
||||
if (dev9.dma_ctrl & SPD_DMA_TO_SMAP)
|
||||
smap_readDMA8Mem(pMem, size);
|
||||
|
@ -1095,8 +1037,7 @@ void DEV9writeDMA8Mem(u32* pMem, int size)
|
|||
|
||||
size >>= 1;
|
||||
|
||||
DEV9_LOG_VERB("*DEV9writeDMA8Mem: size %x\n", size);
|
||||
DEV9_LOG_INFO("wDMA\n");
|
||||
DevCon.WriteLn("*DEV9writeDMA8Mem: size %x", size);
|
||||
|
||||
if (dev9.dma_ctrl & SPD_DMA_TO_SMAP)
|
||||
smap_writeDMA8Mem(pMem, size);
|
||||
|
@ -1134,28 +1075,4 @@ void DEV9setLogDir(const char* dir)
|
|||
{
|
||||
// Get the path to the log directory.
|
||||
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
// Currently dosn't change winPcap log directories post DEV9open()
|
||||
DEV9Log.Close();
|
||||
LogInit();
|
||||
}
|
||||
|
||||
int emu_printf(const char* fmt, ...)
|
||||
{
|
||||
va_list vl;
|
||||
int ret;
|
||||
va_start(vl, fmt);
|
||||
ret = vfprintf(stderr, fmt, vl);
|
||||
va_end(vl);
|
||||
fflush(stderr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int emu_vprintf(const char* fmt, va_list vl)
|
||||
{
|
||||
int ret;
|
||||
ret = vfprintf(stderr, fmt, vl);
|
||||
fflush(stderr);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -42,18 +42,6 @@
|
|||
#define __inline inline
|
||||
|
||||
#endif
|
||||
// clang-format off
|
||||
#define DEV_LOG_LEVEL_VERBOSE 1
|
||||
#define DEV_LOG_LEVEL_INFO 2
|
||||
#define DEV_LOG_LEVEL_ERROR 3
|
||||
|
||||
#define DEV9_LOG_LEVEL DEV_LOG_LEVEL_INFO
|
||||
|
||||
#define DEV9_LOG(...) __Log(DEV_LOG_LEVEL_VERBOSE,__VA_ARGS__)
|
||||
#define DEV9_LOG_VERB(...) __Log(DEV_LOG_LEVEL_VERBOSE,__VA_ARGS__)
|
||||
#define DEV9_LOG_INFO(...) __Log(DEV_LOG_LEVEL_INFO, __VA_ARGS__)
|
||||
#define DEV9_LOG_ERROR(...) __Log(DEV_LOG_LEVEL_ERROR, __VA_ARGS__)
|
||||
// clang-format on
|
||||
|
||||
void rx_process(NetPacket* pk);
|
||||
bool rx_fifo_can_rx();
|
||||
|
@ -151,11 +139,9 @@ s32 _DEV9open();
|
|||
void _DEV9close();
|
||||
//void DEV9thread();
|
||||
|
||||
EXTERN PluginLog DEV9Log;
|
||||
//Yes these are meant to be a lowercase extern
|
||||
extern std::string s_strIniPath;
|
||||
extern std::string s_strLogPath;
|
||||
void __Log(int level, const char* fmt, ...);
|
||||
|
||||
void SysMessage(char* fmt, ...);
|
||||
|
||||
|
@ -742,9 +728,6 @@ void DEV9write8(u32 addr, u8 value);
|
|||
void DEV9write16(u32 addr, u16 value);
|
||||
void DEV9write32(u32 addr, u32 value);
|
||||
|
||||
int emu_printf(const char* fmt, ...);
|
||||
int emu_vprintf(const char* fmt, va_list);
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(error : 4013)
|
||||
#endif
|
||||
|
|
|
@ -67,7 +67,7 @@ void SaveConf()
|
|||
|
||||
const std::string file(GetSettingsFolder().Combine(wxString("DEV9.cfg")).GetFullPath());
|
||||
|
||||
fprintf(stderr, "CONF: %s", file.c_str());
|
||||
Console.WriteLn("CONF: %s", file.c_str());
|
||||
|
||||
xmlSaveFormatFileEnc(file.c_str(), doc, "UTF-8", 1);
|
||||
// free(configFile);
|
||||
|
|
|
@ -237,7 +237,7 @@ s32 _DEV9open()
|
|||
NetAdapter* na = GetNetAdapter();
|
||||
if (!na)
|
||||
{
|
||||
emu_printf("Failed to GetNetAdapter()\n");
|
||||
Console.Error("Failed to GetNetAdapter()");
|
||||
config.ethEnable = false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -391,7 +391,7 @@ s32 _DEV9open()
|
|||
NetAdapter* na = GetNetAdapter();
|
||||
if (!na)
|
||||
{
|
||||
emu_printf("Failed to GetNetAdapter()\n");
|
||||
Console.Error("Failed to GetNetAdapter()");
|
||||
config.ethEnable = false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -94,7 +94,7 @@ void FLASHinit()
|
|||
ret = fread(file, 1, CARD_SIZE_ECC, fd);
|
||||
if (ret != CARD_SIZE_ECC)
|
||||
{
|
||||
DEV9_LOG("Reading error.");
|
||||
DevCon.WriteLn("Reading error.");
|
||||
}
|
||||
|
||||
fclose(fd);
|
||||
|
@ -112,7 +112,7 @@ u32 FLASHread32(u32 addr, int size)
|
|||
case FLASH_R_DATA:
|
||||
memcpy(&value, &data[counter], size);
|
||||
counter += size;
|
||||
DEV9_LOG("*FLASH DATA %dbit read 0x%08lX %s\n", size * 8, value, (ctrl & FLASH_PP_READ) ? "READ_ENABLE" : "READ_DISABLE");
|
||||
DevCon.WriteLn("*FLASH DATA %dbit read 0x%08lX %s", size * 8, value, (ctrl & FLASH_PP_READ) ? "READ_ENABLE" : "READ_DISABLE");
|
||||
if (cmd == SM_CMD_READ3)
|
||||
{
|
||||
if (counter >= PAGE_SIZE_ECC)
|
||||
|
@ -148,33 +148,33 @@ u32 FLASHread32(u32 addr, int size)
|
|||
return value;
|
||||
|
||||
case FLASH_R_CMD:
|
||||
DEV9_LOG("*FLASH CMD %dbit read %s DENIED\n", size * 8, getCmdName(cmd));
|
||||
DevCon.WriteLn("*FLASH CMD %dbit read %s DENIED", size * 8, getCmdName(cmd));
|
||||
return cmd;
|
||||
|
||||
case FLASH_R_ADDR:
|
||||
DEV9_LOG("*FLASH ADDR %dbit read DENIED\n", size * 8);
|
||||
DevCon.WriteLn("*FLASH ADDR %dbit read DENIED", size * 8);
|
||||
return 0;
|
||||
|
||||
case FLASH_R_CTRL:
|
||||
DEV9_LOG("*FLASH CTRL %dbit read 0x%08lX\n", size * 8, ctrl);
|
||||
DevCon.WriteLn("*FLASH CTRL %dbit read 0x%08lX", size * 8, ctrl);
|
||||
return ctrl;
|
||||
|
||||
case FLASH_R_ID:
|
||||
if (cmd == SM_CMD_READID)
|
||||
{
|
||||
DEV9_LOG("*FLASH ID %dbit read 0x%08lX\n", size * 8, id);
|
||||
DevCon.WriteLn("*FLASH ID %dbit read 0x%08lX", size * 8, id);
|
||||
return id; //0x98=Toshiba/0xEC=Samsung maker code should be returned first
|
||||
}
|
||||
else if (cmd == SM_CMD_GETSTATUS)
|
||||
{
|
||||
value = 0x80 | ((ctrl & 1) << 6); // 0:0=pass, 6:ready/busy, 7:1=not protected
|
||||
DEV9_LOG("*FLASH STATUS %dbit read 0x%08lX\n", size * 8, value);
|
||||
DevCon.WriteLn("*FLASH STATUS %dbit read 0x%08lX", size * 8, value);
|
||||
return value;
|
||||
} //else fall off
|
||||
return 0;
|
||||
|
||||
default:
|
||||
DEV9_LOG("*FLASH Unknown %dbit read at address %lx\n", size * 8, addr);
|
||||
DevCon.WriteLn("*FLASH Unknown %dbit read at address %lx", size * 8, addr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ void FLASHwrite32(u32 addr, u32 value, int size)
|
|||
{
|
||||
case FLASH_R_DATA:
|
||||
|
||||
DEV9_LOG("*FLASH DATA %dbit write 0x%08lX %s\n", size * 8, value, (ctrl & FLASH_PP_WRITE) ? "WRITE_ENABLE" : "WRITE_DISABLE");
|
||||
DevCon.WriteLn("*FLASH DATA %dbit write 0x%08lX %s", size * 8, value, (ctrl & FLASH_PP_WRITE) ? "WRITE_ENABLE" : "WRITE_DISABLE");
|
||||
memcpy(&data[counter], &value, size);
|
||||
counter += size;
|
||||
counter %= PAGE_SIZE_ECC; //should not get past the last byte, but at the end
|
||||
|
@ -197,7 +197,7 @@ void FLASHwrite32(u32 addr, u32 value, int size)
|
|||
{
|
||||
if ((value != SM_CMD_GETSTATUS) && (value != SM_CMD_RESET))
|
||||
{
|
||||
DEV9_LOG("*FLASH CMD %dbit write %s ILLEGAL in busy mode - IGNORED\n", size * 8, getCmdName(value));
|
||||
DevCon.WriteLn("*FLASH CMD %dbit write %s ILLEGAL in busy mode - IGNORED", size * 8, getCmdName(value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -205,12 +205,12 @@ void FLASHwrite32(u32 addr, u32 value, int size)
|
|||
{
|
||||
if ((value != SM_CMD_PROGRAMPAGE) && (value != SM_CMD_RESET))
|
||||
{
|
||||
DEV9_LOG("*FLASH CMD %dbit write %s ILLEGAL after WRITEDATA cmd - IGNORED\n", size * 8, getCmdName(value));
|
||||
DevCon.WriteLn("*FLASH CMD %dbit write %s ILLEGAL after WRITEDATA cmd - IGNORED", size * 8, getCmdName(value));
|
||||
ctrl &= ~FLASH_PP_READY; //go busy, reset is needed
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEV9_LOG("*FLASH CMD %dbit write %s\n", size * 8, getCmdName(value));
|
||||
DevCon.WriteLn("*FLASH CMD %dbit write %s", size * 8, getCmdName(value));
|
||||
switch (value)
|
||||
{ // A8 bit is encoded in READ cmd;)
|
||||
case SM_CMD_READ1:
|
||||
|
@ -268,10 +268,10 @@ void FLASHwrite32(u32 addr, u32 value, int size)
|
|||
break;
|
||||
|
||||
case FLASH_R_ADDR:
|
||||
DEV9_LOG("*FLASH ADDR %dbit write 0x%08lX\n", size * 8, value);
|
||||
DevCon.WriteLn("*FLASH ADDR %dbit write 0x%08lX", size * 8, value);
|
||||
address |= (value & 0xFF) << (addrbyte == 0 ? 0 : (1 + 8 * addrbyte));
|
||||
addrbyte++;
|
||||
DEV9_LOG("*FLASH ADDR = 0x%08lX (addrbyte=%d)\n", address, addrbyte);
|
||||
DevCon.WriteLn("*FLASH ADDR = 0x%08lX (addrbyte=%d)", address, addrbyte);
|
||||
if (!(value & 0x100))
|
||||
{ // address is complete
|
||||
if ((cmd == SM_CMD_READ1) || (cmd == SM_CMD_READ2) || (cmd == SM_CMD_READ3))
|
||||
|
@ -287,22 +287,22 @@ void FLASHwrite32(u32 addr, u32 value, int size)
|
|||
u32 pages = address - (blocks * BLOCK_SIZE);
|
||||
[[maybe_unused]]const u32 bytes = pages % PAGE_SIZE;
|
||||
pages = pages / PAGE_SIZE;
|
||||
DEV9_LOG("*FLASH ADDR = 0x%08lX (%d:%d:%d) (addrbyte=%d) FINAL\n", address, blocks, pages, bytes, addrbyte);
|
||||
DevCon.WriteLn("*FLASH ADDR = 0x%08lX (%d:%d:%d) (addrbyte=%d) FINAL", address, blocks, pages, bytes, addrbyte);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FLASH_R_CTRL:
|
||||
DEV9_LOG("*FLASH CTRL %dbit write 0x%08lX\n", size * 8, value);
|
||||
DevCon.WriteLn("*FLASH CTRL %dbit write 0x%08lX", size * 8, value);
|
||||
ctrl = (ctrl & FLASH_PP_READY) | (value & ~FLASH_PP_READY);
|
||||
break;
|
||||
|
||||
case FLASH_R_ID:
|
||||
DEV9_LOG("*FLASH ID %dbit write 0x%08lX DENIED :P\n", size * 8, value);
|
||||
DevCon.WriteLn("*FLASH ID %dbit write 0x%08lX DENIED :P", size * 8, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEV9_LOG("*FLASH Unkwnown %dbit write at address 0x%08lX= 0x%08lX IGNORED\n", size * 8, addr, value);
|
||||
DevCon.WriteLn("*FLASH Unkwnown %dbit write at address 0x%08lX= 0x%08lX IGNORED", size * 8, addr, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,9 +74,9 @@ void TermNet()
|
|||
{
|
||||
RxRunning = false;
|
||||
nif->close();
|
||||
emu_printf("Waiting for RX-net thread to terminate..");
|
||||
Console.WriteLn("Waiting for RX-net thread to terminate..");
|
||||
rx_thread.join();
|
||||
emu_printf(".done\n");
|
||||
Console.WriteLn("Done");
|
||||
|
||||
delete nif;
|
||||
nif = nullptr;
|
||||
|
|
|
@ -119,7 +119,7 @@ int pcap_io_init(char* adapter, mac_address virtual_mac)
|
|||
char filter[1024] = "ether broadcast or ether dst ";
|
||||
int dlt;
|
||||
char* dlt_name;
|
||||
emu_printf("Opening adapter '%s'...", adapter);
|
||||
Console.WriteLn("Opening adapter '%s'...", adapter);
|
||||
|
||||
/* Open the adapter */
|
||||
if ((adhandle = pcap_open_live(adapter, // name of the device
|
||||
|
@ -130,8 +130,8 @@ int pcap_io_init(char* adapter, mac_address virtual_mac)
|
|||
errbuf // error buffer
|
||||
)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s", errbuf);
|
||||
fprintf(stderr, "\nUnable to open the adapter. %s is not supported by pcap\n", adapter);
|
||||
Console.Error("%s", errbuf);
|
||||
Console.Error("Unable to open the adapter. %s is not supported by pcap", adapter);
|
||||
return -1;
|
||||
}
|
||||
char virtual_mac_str[18];
|
||||
|
@ -141,13 +141,13 @@ int pcap_io_init(char* adapter, mac_address virtual_mac)
|
|||
|
||||
if (pcap_compile(adhandle, &fp, filter, 1, PCAP_NETMASK_UNKNOWN) == -1)
|
||||
{
|
||||
fprintf(stderr, "Error calling pcap_compile: %s\n", pcap_geterr(adhandle));
|
||||
Console.Error("Error calling pcap_compile: %s", pcap_geterr(adhandle));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pcap_setfilter(adhandle, &fp) == -1)
|
||||
{
|
||||
fprintf(stderr, "Error setting filter: %s\n", pcap_geterr(adhandle));
|
||||
Console.Error("Error setting filter: %s", pcap_geterr(adhandle));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ int pcap_io_init(char* adapter, mac_address virtual_mac)
|
|||
dlt = pcap_datalink(adhandle);
|
||||
dlt_name = (char*)pcap_datalink_val_to_name(dlt);
|
||||
|
||||
fprintf(stderr, "Device uses DLT %d: %s\n", dlt, dlt_name);
|
||||
Console.Error("Device uses DLT %d: %s", dlt, dlt_name);
|
||||
switch (dlt)
|
||||
{
|
||||
case DLT_EN10MB:
|
||||
|
@ -171,7 +171,7 @@ int pcap_io_init(char* adapter, mac_address virtual_mac)
|
|||
dump_pcap = pcap_dump_open(adhandle, plfile.c_str());
|
||||
|
||||
pcap_io_running = 1;
|
||||
emu_printf("Ok.\n");
|
||||
Console.WriteLn("Adapter Ok.");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ void rx_process(NetPacket* pk)
|
|||
|
||||
if (!(pbd->ctrl_stat & SMAP_BD_RX_EMPTY))
|
||||
{
|
||||
emu_printf("ERROR : Discarding %d bytes (RX%d not ready)\n", bytes, dev9.rxbdi);
|
||||
Console.Error("ERROR : Discarding %d bytes (RX%d not ready)", bytes, dev9.rxbdi);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ void tx_process()
|
|||
|
||||
if (!(pbd->ctrl_stat & SMAP_BD_TX_READY))
|
||||
{
|
||||
emu_printf("ERROR : !pbd->ctrl_stat&SMAP_BD_TX_READY\n");
|
||||
Console.Error("SMAP: ERROR : !pbd->ctrl_stat&SMAP_BD_TX_READY");
|
||||
break;
|
||||
}
|
||||
if (pbd->length & 3)
|
||||
|
@ -158,19 +158,18 @@ void tx_process()
|
|||
|
||||
if (pbd->length > 1514)
|
||||
{
|
||||
emu_printf("ERROR : Trying to send packet too big.\n");
|
||||
Console.Error("SMAP: ERROR : Trying to send packet too big.");
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 base = (pbd->pointer - 0x1000) & 16383;
|
||||
DEV9_LOG("Sending Packet from base %x, size %d\n", base, pbd->length);
|
||||
//spams// emu_printf("Sending Packet from base %x, size %u\n", base, pbd->length);
|
||||
DevCon.WriteLn("Sending Packet from base %x, size %d", base, pbd->length);
|
||||
|
||||
pk.size = pbd->length;
|
||||
|
||||
if (!(pbd->pointer >= 0x1000))
|
||||
{
|
||||
emu_printf("ERROR: odd , !pbd->pointer>0x1000 | 0x%X %u\n", pbd->pointer, pbd->length);
|
||||
Console.Error("SMAP: ERROR: odd , !pbd->pointer>0x1000 | 0x%X %u", pbd->pointer, pbd->length);
|
||||
}
|
||||
//increase fifo pointer(s)
|
||||
//uh does that even exist on real h/w ?
|
||||
|
@ -212,7 +211,7 @@ void tx_process()
|
|||
u32 was = 16384 - base;
|
||||
memcpy(pk.buffer, dev9.txfifo + base, was);
|
||||
memcpy(pk.buffer + was, dev9.txfifo, pbd->length - was);
|
||||
printf("Warped read, was=%u, sz=%u, sz-was=%u\n", was, pbd->length, pbd->length - was);
|
||||
DevCon.WriteLn("Warped read, was=%u, sz=%u, sz-was=%u", was, pbd->length, pbd->length - was);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -236,7 +235,7 @@ void tx_process()
|
|||
//if some error/early exit signal TXDNV
|
||||
if (fc != cnt || cnt == 0)
|
||||
{
|
||||
printf("WARN : (fc!=cnt || cnt==0) but packet send request was made oO..\n");
|
||||
Console.Error("SMAP: WARN : (fc!=cnt || cnt==0) but packet send request was made oO..");
|
||||
_DEV9irq(SMAP_INTR_TXDNV, 0);
|
||||
}
|
||||
//if we actualy send something send TXEND
|
||||
|
@ -251,32 +250,32 @@ void emac3_write(u32 addr)
|
|||
switch (addr)
|
||||
{
|
||||
case SMAP_R_EMAC3_MODE0_L:
|
||||
DEV9_LOG("SMAP: SMAP_R_EMAC3_MODE0 write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_EMAC3_MODE0 write %x", value);
|
||||
value = (value & (~SMAP_E3_SOFT_RESET)) | SMAP_E3_TXMAC_IDLE | SMAP_E3_RXMAC_IDLE;
|
||||
dev9Ru16(SMAP_R_EMAC3_STA_CTRL_H) |= SMAP_E3_PHY_OP_COMP;
|
||||
break;
|
||||
case SMAP_R_EMAC3_TxMODE0_L:
|
||||
DEV9_LOG("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x", value);
|
||||
//spams// emu_printf("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value);
|
||||
//Process TX here ?
|
||||
if (!(value & SMAP_E3_TX_GNP_0))
|
||||
emu_printf("SMAP_R_EMAC3_TxMODE0_L: SMAP_E3_TX_GNP_0 not set\n");
|
||||
Console.Error("SMAP_R_EMAC3_TxMODE0_L: SMAP_E3_TX_GNP_0 not set");
|
||||
|
||||
tx_process();
|
||||
value = value & ~SMAP_E3_TX_GNP_0;
|
||||
if (value)
|
||||
emu_printf("SMAP_R_EMAC3_TxMODE0_L: extra bits set !\n");
|
||||
Console.Error("SMAP_R_EMAC3_TxMODE0_L: extra bits set !");
|
||||
break;
|
||||
case SMAP_R_EMAC3_TxMODE1_L:
|
||||
emu_printf("SMAP_R_EMAC3_TxMODE1_L 32bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_TxMODE1_L 32bit write %x", value);
|
||||
if (value == 0x380f0000)
|
||||
{
|
||||
emu_printf("Adapter Detection Hack - Resetting RX/TX\n");
|
||||
Console.WriteLn("Adapter Detection Hack - Resetting RX/TX");
|
||||
_DEV9irq(SMAP_INTR_RXEND | SMAP_INTR_TXEND | SMAP_INTR_TXDNV, 5);
|
||||
}
|
||||
break;
|
||||
case SMAP_R_EMAC3_STA_CTRL_L:
|
||||
DEV9_LOG("SMAP: SMAP_R_EMAC3_STA_CTRL write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_EMAC3_STA_CTRL write %x", value);
|
||||
{
|
||||
if (value & (SMAP_E3_PHY_READ))
|
||||
{
|
||||
|
@ -294,7 +293,7 @@ void emac3_write(u32 addr)
|
|||
val |= SMAP_PHY_STS_LINK | SMAP_PHY_STS_100M | SMAP_PHY_STS_FDX | SMAP_PHY_STS_ANCP;
|
||||
break;
|
||||
}
|
||||
DEV9_LOG("phy_read %d: %x\n", reg, val);
|
||||
DevCon.WriteLn("phy_read %d: %x", reg, val);
|
||||
value = (value & 0xFFFF) | (val << 16);
|
||||
}
|
||||
if (value & (SMAP_E3_PHY_WRITE))
|
||||
|
@ -309,13 +308,13 @@ void emac3_write(u32 addr)
|
|||
val |= 0x1;
|
||||
break;
|
||||
}
|
||||
DEV9_LOG("phy_write %d: %x\n", reg, val);
|
||||
DevCon.WriteLn("phy_write %d: %x", reg, val);
|
||||
dev9.phyregs[reg] = val;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DEV9_LOG("SMAP: emac3 write %x=%x\n", addr, value);
|
||||
DevCon.WriteLn("SMAP: emac3 write %x=%x", addr, value);
|
||||
}
|
||||
dev9Ru32(addr) = wswap(value);
|
||||
}
|
||||
|
@ -325,21 +324,21 @@ smap_read8(u32 addr)
|
|||
switch (addr)
|
||||
{
|
||||
case SMAP_R_TXFIFO_FRAME_CNT:
|
||||
printf("SMAP_R_TXFIFO_FRAME_CNT read 8\n");
|
||||
DevCon.WriteLn("SMAP_R_TXFIFO_FRAME_CNT read 8");
|
||||
break;
|
||||
case SMAP_R_RXFIFO_FRAME_CNT:
|
||||
printf("SMAP_R_RXFIFO_FRAME_CNT read 8\n");
|
||||
DevCon.WriteLn("SMAP_R_RXFIFO_FRAME_CNT read 8");
|
||||
break;
|
||||
|
||||
case SMAP_R_BD_MODE:
|
||||
return dev9.bd_swap;
|
||||
|
||||
default:
|
||||
DEV9_LOG("SMAP : Unknown 8 bit read @ %X,v=%X\n", addr, dev9Ru8(addr));
|
||||
DevCon.WriteLn("SMAP : Unknown 8 bit read @ %X,v=%X", addr, dev9Ru8(addr));
|
||||
return dev9Ru8(addr);
|
||||
}
|
||||
|
||||
DEV9_LOG("SMAP : error , 8 bit read @ %X,v=%X\n", addr, dev9Ru8(addr));
|
||||
DevCon.WriteLn("SMAP : error , 8 bit read @ %X,v=%X", addr, dev9Ru8(addr));
|
||||
return dev9Ru8(addr);
|
||||
}
|
||||
EXPORT_C_(u16)
|
||||
|
@ -356,25 +355,25 @@ smap_read16(u32 addr)
|
|||
{
|
||||
case 0: // ctrl_stat
|
||||
hard = dev9Ru16(addr);
|
||||
//DEV9_LOG("TX_CTRL_STAT[%d]: read %x\n", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
//DevCon.WriteLn("TX_CTRL_STAT[%d]: read %x", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
case 2: // unknown
|
||||
hard = dev9Ru16(addr);
|
||||
//DEV9_LOG("TX_UNKNOWN[%d]: read %x\n", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
//DevCon.WriteLn("TX_UNKNOWN[%d]: read %x", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
case 4: // length
|
||||
hard = dev9Ru16(addr);
|
||||
DEV9_LOG("TX_LENGTH[%d]: read %x\n", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
DevCon.WriteLn("TX_LENGTH[%d]: read %x", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
case 6: // pointer
|
||||
hard = dev9Ru16(addr);
|
||||
DEV9_LOG("TX_POINTER[%d]: read %x\n", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
DevCon.WriteLn("TX_POINTER[%d]: read %x", (addr - SMAP_BD_TX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
|
@ -391,105 +390,105 @@ smap_read16(u32 addr)
|
|||
{
|
||||
case 0: // ctrl_stat
|
||||
hard = dev9Ru16(addr);
|
||||
//DEV9_LOG("RX_CTRL_STAT[%d]: read %x\n", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
//DevCon.WriteLn("RX_CTRL_STAT[%d]: read %x", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
case 2: // unknown
|
||||
hard = dev9Ru16(addr);
|
||||
//DEV9_LOG("RX_UNKNOWN[%d]: read %x\n", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
//DevCon.WriteLn("RX_UNKNOWN[%d]: read %x", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
case 4: // length
|
||||
hard = dev9Ru16(addr);
|
||||
DEV9_LOG("RX_LENGTH[%d]: read %x\n", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
DevCon.WriteLn("RX_LENGTH[%d]: read %x", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
case 6: // pointer
|
||||
hard = dev9Ru16(addr);
|
||||
DEV9_LOG("RX_POINTER[%d]: read %x\n", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
DevCon.WriteLn("RX_POINTER[%d]: read %x", (addr - SMAP_BD_RX_BASE) / 8, hard);
|
||||
if(dev9.bd_swap)
|
||||
return (hard<<8)|(hard>>8);
|
||||
return hard;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#if (DEV9_LOG_LEVEL <= 1)
|
||||
#if (0)
|
||||
switch (addr)
|
||||
{
|
||||
case SMAP_R_TXFIFO_FRAME_CNT:
|
||||
printf("SMAP_R_TXFIFO_FRAME_CNT read 16\n");
|
||||
DevCon.WriteLn("SMAP_R_TXFIFO_FRAME_CNT read 16");
|
||||
return dev9Ru16(addr);
|
||||
case SMAP_R_RXFIFO_FRAME_CNT:
|
||||
printf("SMAP_R_RXFIFO_FRAME_CNT read 16\n");
|
||||
DevCon.WriteLn("SMAP_R_RXFIFO_FRAME_CNT read 16");
|
||||
return dev9Ru16(addr);
|
||||
case SMAP_R_EMAC3_MODE0_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_MODE0_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_MODE0_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_MODE0_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_MODE0_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_MODE0_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_MODE1_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_MODE1_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_MODE1_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_MODE1_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_MODE1_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_MODE1_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_RxMODE_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_RxMODE_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_RxMODE_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_RxMODE_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_RxMODE_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_RxMODE_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_INTR_STAT_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_INTR_STAT_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_INTR_STAT_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_INTR_STAT_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_INTR_STAT_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_INTR_STAT_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_INTR_ENABLE_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_INTR_ENABLE_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_INTR_ENABLE_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_INTR_ENABLE_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_INTR_ENABLE_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_INTR_ENABLE_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_TxMODE0_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_TxMODE0_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_TxMODE0_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_TxMODE0_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_TxMODE0_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_TxMODE0_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_TxMODE1_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_TxMODE1_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_TxMODE1_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_TxMODE1_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_TxMODE1_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_TxMODE1_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_STA_CTRL_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_STA_CTRL_L 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_STA_CTRL_L 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
|
||||
case SMAP_R_EMAC3_STA_CTRL_H:
|
||||
DEV9_LOG("SMAP_R_EMAC3_STA_CTRL_H 16bit read %x\n", dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_STA_CTRL_H 16bit read %x", dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
default:
|
||||
DEV9_LOG("SMAP : Unknown 16 bit read @ %X,v=%X\n", addr, dev9Ru16(addr));
|
||||
DevCon.WriteLn("SMAP : Unknown 16 bit read @ %X,v=%X", addr, dev9Ru16(addr));
|
||||
return dev9Ru16(addr);
|
||||
}
|
||||
#endif
|
||||
|
@ -508,13 +507,13 @@ smap_read32(u32 addr)
|
|||
switch (addr)
|
||||
{
|
||||
case SMAP_R_TXFIFO_FRAME_CNT:
|
||||
printf("SMAP_R_TXFIFO_FRAME_CNT read 32\n");
|
||||
DevCon.WriteLn("SMAP_R_TXFIFO_FRAME_CNT read 32");
|
||||
return dev9Ru32(addr);
|
||||
case SMAP_R_RXFIFO_FRAME_CNT:
|
||||
printf("SMAP_R_RXFIFO_FRAME_CNT read 32\n");
|
||||
DevCon.WriteLn("SMAP_R_RXFIFO_FRAME_CNT read 32");
|
||||
return dev9Ru32(addr);
|
||||
case SMAP_R_EMAC3_STA_CTRL_L:
|
||||
DEV9_LOG("SMAP_R_EMAC3_STA_CTRL_L 32bit read value %x\n", dev9Ru32(addr));
|
||||
DevCon.WriteLn("SMAP_R_EMAC3_STA_CTRL_L 32bit read value %x", dev9Ru32(addr));
|
||||
return dev9Ru32(addr);
|
||||
|
||||
case SMAP_R_RXFIFO_DATA:
|
||||
|
@ -528,11 +527,11 @@ smap_read32(u32 addr)
|
|||
if (dev9.bd_swap)
|
||||
rv = (rv << 24) | (rv >> 24) | ((rv >> 8) & 0xFF00) | ((rv << 8) & 0xFF0000);
|
||||
|
||||
DEV9_LOG("SMAP_R_RXFIFO_DATA 32bit read %x\n", rv);
|
||||
DevCon.WriteLn("SMAP_R_RXFIFO_DATA 32bit read %x", rv);
|
||||
return rv;
|
||||
}
|
||||
default:
|
||||
DEV9_LOG("SMAP : Unknown 32 bit read @ %X,v=%X\n", addr, dev9Ru32(addr));
|
||||
DevCon.WriteLn("SMAP : Unknown 32 bit read @ %X,v=%X", addr, dev9Ru32(addr));
|
||||
return dev9Ru32(addr);
|
||||
}
|
||||
}
|
||||
|
@ -544,14 +543,14 @@ smap_write8(u32 addr, u8 value)
|
|||
switch (addr)
|
||||
{
|
||||
case SMAP_R_TXFIFO_FRAME_INC:
|
||||
DEV9_LOG("SMAP_R_TXFIFO_FRAME_INC 8bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP_R_TXFIFO_FRAME_INC 8bit write %x", value);
|
||||
{
|
||||
dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT)++;
|
||||
}
|
||||
return;
|
||||
|
||||
case SMAP_R_RXFIFO_FRAME_DEC:
|
||||
DEV9_LOG("SMAP_R_RXFIFO_FRAME_DEC 8bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP_R_RXFIFO_FRAME_DEC 8bit write %x", value);
|
||||
counter_lock.lock();
|
||||
dev9Ru8(addr) = value;
|
||||
{
|
||||
|
@ -561,7 +560,7 @@ smap_write8(u32 addr, u8 value)
|
|||
return;
|
||||
|
||||
case SMAP_R_TXFIFO_CTRL:
|
||||
DEV9_LOG("SMAP_R_TXFIFO_CTRL 8bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP_R_TXFIFO_CTRL 8bit write %x", value);
|
||||
if (value & SMAP_TXFIFO_RESET)
|
||||
{
|
||||
dev9.txbdi = 0;
|
||||
|
@ -575,7 +574,7 @@ smap_write8(u32 addr, u8 value)
|
|||
return;
|
||||
|
||||
case SMAP_R_RXFIFO_CTRL:
|
||||
DEV9_LOG("SMAP_R_RXFIFO_CTRL 8bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP_R_RXFIFO_CTRL 8bit write %x", value);
|
||||
if (value & SMAP_RXFIFO_RESET)
|
||||
{
|
||||
reset_lock.lock(); //lock reset mutex 1st
|
||||
|
@ -595,19 +594,17 @@ smap_write8(u32 addr, u8 value)
|
|||
case SMAP_R_BD_MODE:
|
||||
if (value & SMAP_BD_SWAP)
|
||||
{
|
||||
DEV9_LOG("SMAP_R_BD_MODE: byteswapped.\n");
|
||||
emu_printf("BD Byteswapping enabled.\n");
|
||||
DevCon.WriteLn("SMAP_R_BD_MODE: Byteswapping enabled.");
|
||||
dev9.bd_swap = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEV9_LOG("SMAP_R_BD_MODE: NOT byteswapped.\n");
|
||||
emu_printf("BD Byteswapping disabled.\n");
|
||||
DevCon.WriteLn("SMAP_R_BD_MODE: Byteswapping disabled.");
|
||||
dev9.bd_swap = 0;
|
||||
}
|
||||
return;
|
||||
default:
|
||||
DEV9_LOG("SMAP : Unknown 8 bit write @ %X,v=%X\n", addr, value);
|
||||
DevCon.WriteLn("SMAP : Unknown 8 bit write @ %X,v=%X", addr, value);
|
||||
dev9Ru8(addr) = value;
|
||||
return;
|
||||
}
|
||||
|
@ -624,20 +621,20 @@ smap_write16(u32 addr, u16 value)
|
|||
switch (addr & 0x7)
|
||||
{
|
||||
case 0: // ctrl_stat
|
||||
DEV9_LOG("TX_CTRL_STAT[%d]: write %x\n", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
DevCon.WriteLn("TX_CTRL_STAT[%d]: write %x", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
//hacky
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case 2: // unknown
|
||||
//DEV9_LOG("TX_UNKNOWN[%d]: write %x\n", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
//DevCon.WriteLn("TX_UNKNOWN[%d]: write %x", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case 4: // length
|
||||
DEV9_LOG("TX_LENGTH[%d]: write %x\n", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
DevCon.WriteLn("TX_LENGTH[%d]: write %x", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case 6: // pointer
|
||||
DEV9_LOG("TX_POINTER[%d]: write %x\n", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
DevCon.WriteLn("TX_POINTER[%d]: write %x", (addr - SMAP_BD_TX_BASE) / 8, value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
}
|
||||
|
@ -654,23 +651,23 @@ smap_write16(u32 addr, u16 value)
|
|||
switch (addr & 0x7)
|
||||
{
|
||||
case 0: // ctrl_stat
|
||||
DEV9_LOG("RX_CTRL_STAT[%d]: write %x\n", rx_index, value);
|
||||
DevCon.WriteLn("RX_CTRL_STAT[%d]: write %x", rx_index, value);
|
||||
dev9Ru16(addr) = value;
|
||||
if(value&0x8000)
|
||||
{
|
||||
DEV9_LOG(" * * PACKET READ COMPLETE: rd_ptr=%d, wr_ptr=%d\n", dev9Ru32(SMAP_R_RXFIFO_RD_PTR), dev9.rxfifo_wr_ptr);
|
||||
DevCon.WriteLn(" * * PACKET READ COMPLETE: rd_ptr=%d, wr_ptr=%d", dev9Ru32(SMAP_R_RXFIFO_RD_PTR), dev9.rxfifo_wr_ptr);
|
||||
}
|
||||
return;
|
||||
case 2: // unknown
|
||||
//DEV9_LOG("RX_UNKNOWN[%d]: write %x\n", rx_index, value);
|
||||
//DevCon.WriteLn("RX_UNKNOWN[%d]: write %x", rx_index, value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case 4: // length
|
||||
DEV9_LOG("RX_LENGTH[%d]: write %x\n", rx_index, value);
|
||||
DevCon.WriteLn("RX_LENGTH[%d]: write %x", rx_index, value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case 6: // pointer
|
||||
DEV9_LOG("RX_POINTER[%d]: write %x\n", rx_index, value);
|
||||
DevCon.WriteLn("RX_POINTER[%d]: write %x", rx_index, value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
}
|
||||
|
@ -681,17 +678,17 @@ smap_write16(u32 addr, u16 value)
|
|||
switch (addr)
|
||||
{
|
||||
case SMAP_R_INTR_CLR:
|
||||
DEV9_LOG("SMAP: SMAP_R_INTR_CLR 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_INTR_CLR 16bit write %x", value);
|
||||
dev9.irqcause &= ~value;
|
||||
return;
|
||||
|
||||
case SMAP_R_TXFIFO_WR_PTR:
|
||||
DEV9_LOG("SMAP: SMAP_R_TXFIFO_WR_PTR 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_TXFIFO_WR_PTR 16bit write %x", value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
#define EMAC3_L_WRITE(name) \
|
||||
case name: \
|
||||
DEV9_LOG("SMAP: " #name " 16 bit write %x\n", value); \
|
||||
DevCon.WriteLn("SMAP: " #name " 16 bit write %x", value); \
|
||||
dev9Ru16(addr) = value; \
|
||||
return;
|
||||
// clang-format off
|
||||
|
@ -728,7 +725,7 @@ smap_write16(u32 addr, u16 value)
|
|||
|
||||
#define EMAC3_H_WRITE(name) \
|
||||
case name: \
|
||||
DEV9_LOG("SMAP: " #name " 16 bit write %x\n", value); \
|
||||
DevCon.WriteLn("SMAP: " #name " 16 bit write %x", value); \
|
||||
dev9Ru16(addr) = value; \
|
||||
emac3_write(addr - 2); \
|
||||
return;
|
||||
|
@ -765,11 +762,11 @@ smap_write16(u32 addr, u16 value)
|
|||
// clang-format on
|
||||
/*
|
||||
case SMAP_R_EMAC3_MODE0_L:
|
||||
DEV9_LOG("SMAP: SMAP_R_EMAC3_MODE0 write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_EMAC3_MODE0 write %x", value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case SMAP_R_EMAC3_TxMODE0_L:
|
||||
DEV9_LOG("SMAP: SMAP_R_EMAC3_TxMODE0_L 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_EMAC3_TxMODE0_L 16bit write %x", value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case SMAP_R_EMAC3_TxMODE1_L:
|
||||
|
@ -787,13 +784,13 @@ smap_write16(u32 addr, u16 value)
|
|||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
case SMAP_R_EMAC3_STA_CTRL_H:
|
||||
DEV9_LOG("SMAP: SMAP_R_EMAC3_STA_CTRL_H 16bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP: SMAP_R_EMAC3_STA_CTRL_H 16bit write %x", value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
*/
|
||||
|
||||
default:
|
||||
DEV9_LOG("SMAP : Unknown 16 bit write @ %X,v=%X\n", addr, value);
|
||||
DevCon.WriteLn("SMAP : Unknown 16 bit write @ %X,v=%X", addr, value);
|
||||
dev9Ru16(addr) = value;
|
||||
return;
|
||||
}
|
||||
|
@ -813,12 +810,12 @@ smap_write32(u32 addr, u32 value)
|
|||
if (dev9.bd_swap)
|
||||
value = (value << 24) | (value >> 24) | ((value >> 8) & 0xFF00) | ((value << 8) & 0xFF0000);
|
||||
|
||||
DEV9_LOG("SMAP_R_TXFIFO_DATA 32bit write %x\n", value);
|
||||
DevCon.WriteLn("SMAP_R_TXFIFO_DATA 32bit write %x", value);
|
||||
*((u32*)(dev9.txfifo + dev9Ru32(SMAP_R_TXFIFO_WR_PTR))) = value;
|
||||
dev9Ru32(SMAP_R_TXFIFO_WR_PTR) = (dev9Ru32(SMAP_R_TXFIFO_WR_PTR) + 4) & 16383;
|
||||
return;
|
||||
default:
|
||||
DEV9_LOG("SMAP : Unknown 32 bit write @ %X,v=%X\n", addr, value);
|
||||
DevCon.WriteLn("SMAP : Unknown 32 bit write @ %X,v=%X", addr, value);
|
||||
dev9Ru32(addr) = value;
|
||||
return;
|
||||
}
|
||||
|
@ -830,7 +827,7 @@ smap_readDMA8Mem(u32* pMem, int size)
|
|||
{
|
||||
dev9Ru32(SMAP_R_RXFIFO_RD_PTR) &= 16383;
|
||||
|
||||
DEV9_LOG(" * * SMAP DMA READ START: rd_ptr=%d, wr_ptr=%d\n", dev9Ru32(SMAP_R_RXFIFO_RD_PTR), dev9.rxfifo_wr_ptr);
|
||||
DevCon.WriteLn(" * * SMAP DMA READ START: rd_ptr=%d, wr_ptr=%d", dev9Ru32(SMAP_R_RXFIFO_RD_PTR), dev9.rxfifo_wr_ptr);
|
||||
while (size > 0)
|
||||
{
|
||||
*pMem = *((u32*)(dev9.rxfifo + dev9Ru32(SMAP_R_RXFIFO_RD_PTR)));
|
||||
|
@ -839,7 +836,7 @@ smap_readDMA8Mem(u32* pMem, int size)
|
|||
|
||||
size -= 4;
|
||||
}
|
||||
DEV9_LOG(" * * SMAP DMA READ END: rd_ptr=%d, wr_ptr=%d\n", dev9Ru32(SMAP_R_RXFIFO_RD_PTR), dev9.rxfifo_wr_ptr);
|
||||
DevCon.WriteLn(" * * SMAP DMA READ END: rd_ptr=%d, wr_ptr=%d", dev9Ru32(SMAP_R_RXFIFO_RD_PTR), dev9.rxfifo_wr_ptr);
|
||||
|
||||
dev9Ru16(SMAP_R_RXFIFO_CTRL) &= ~SMAP_RXFIFO_DMAEN;
|
||||
}
|
||||
|
@ -851,7 +848,7 @@ smap_writeDMA8Mem(u32* pMem, int size)
|
|||
{
|
||||
dev9Ru32(SMAP_R_TXFIFO_WR_PTR) &= 16383;
|
||||
|
||||
DEV9_LOG(" * * SMAP DMA WRITE START: wr_ptr=%d, rd_ptr=%d\n", dev9Ru32(SMAP_R_TXFIFO_WR_PTR), dev9.txfifo_rd_ptr);
|
||||
DevCon.WriteLn(" * * SMAP DMA WRITE START: wr_ptr=%d, rd_ptr=%d", dev9Ru32(SMAP_R_TXFIFO_WR_PTR), dev9.txfifo_rd_ptr);
|
||||
while (size > 0)
|
||||
{
|
||||
int value = *pMem;
|
||||
|
@ -862,7 +859,7 @@ smap_writeDMA8Mem(u32* pMem, int size)
|
|||
dev9Ru32(SMAP_R_TXFIFO_WR_PTR) = (dev9Ru32(SMAP_R_TXFIFO_WR_PTR) + 4) & 16383;
|
||||
size -= 4;
|
||||
}
|
||||
DEV9_LOG(" * * SMAP DMA WRITE END: wr_ptr=%d, rd_ptr=%d\n", dev9Ru32(SMAP_R_TXFIFO_WR_PTR), dev9.txfifo_rd_ptr);
|
||||
DevCon.WriteLn(" * * SMAP DMA WRITE END: wr_ptr=%d, rd_ptr=%d", dev9Ru32(SMAP_R_TXFIFO_WR_PTR), dev9.txfifo_rd_ptr);
|
||||
|
||||
dev9Ru16(SMAP_R_TXFIFO_CTRL) &= ~SMAP_TXFIFO_DMAEN;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue