DS IPC: Fix Empty bits
Vicki Pfau vi@endrift.com
Mon, 20 Feb 2017 15:01:54 -0800
2 files changed,
6 insertions(+),
0 deletions(-)
M
src/ds/io.c
→
src/ds/io.c
@@ -165,6 +165,7 @@ }
void DS7IOInit(struct DS* ds) { memset(ds->memory.io7, 0, sizeof(ds->memory.io7)); + ds->memory.io7[DS_REG_IPCFIFOCNT >> 1] = 0x0101; } void DS7IOWrite(struct DS* ds, uint32_t address, uint16_t value) {@@ -320,6 +321,7 @@ }
void DS9IOInit(struct DS* ds) { memset(ds->memory.io9, 0, sizeof(ds->memory.io9)); + ds->memory.io9[DS_REG_IPCFIFOCNT >> 1] = 0x0101; } void DS9IOWrite(struct DS* ds, uint32_t address, uint16_t value) {
M
src/ds/ipc.c
→
src/ds/ipc.c
@@ -21,11 +21,15 @@ int16_t DSIPCWriteFIFOCNT(struct DSCommon* dscore, int16_t value) {
value &= 0xC40C; int16_t oldValue = dscore->memory.io[DS_REG_IPCFIFOCNT >> 1] & 0x4303; int16_t newValue = value | oldValue; + // TODO: Does Enable set enabled on both ends? if (DSIPCFIFOCNTIsError(value)) { newValue = DSIPCFIFOCNTClearError(newValue); } if (DSIPCFIFOCNTIsSendClear(newValue)) { CircleBufferClear(&dscore->ipc->fifo); + dscore->ipc->memory.io[DS_REG_IPCFIFOCNT >> 1] = DSIPCFIFOCNTFillRecvEmpty(dscore->ipc->memory.io[DS_REG_IPCFIFOCNT >> 1]); + newValue = DSIPCFIFOCNTFillSendEmpty(newValue); + newValue = DSIPCFIFOCNTClearSendClear(newValue); } return newValue; }