From e7d6cba3616f00d6b633eecdfad5b89b5a15846c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 27 Feb 2017 01:43:13 -0800 Subject: [PATCH] DS Slot-1: Add PW flash command --- src/ds/slot1.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ds/slot1.c b/src/ds/slot1.c index 765e9c4b6..64cec627a 100644 --- a/src/ds/slot1.c +++ b/src/ds/slot1.c @@ -264,13 +264,21 @@ static uint8_t _slot1SPIFlash(struct DSCommon* dscore, uint8_t datum) { } } + uint8_t oldValue; switch (dscore->p->memory.slot1.spiCommand) { case 0x03: // RD - return dscore->p->memory.slot1.spiData[dscore->p->memory.slot1.spiAddress++]; - case 0x02: // WR + oldValue = dscore->p->memory.slot1.spiData[dscore->p->memory.slot1.spiAddress]; + ++dscore->p->memory.slot1.spiAddress; + return oldValue; + case 0x02: // PP dscore->p->memory.slot1.spiData[dscore->p->memory.slot1.spiAddress] = datum; ++dscore->p->memory.slot1.spiAddress; break; + case 0x0A: // PW + oldValue = dscore->p->memory.slot1.spiData[dscore->p->memory.slot1.spiAddress]; + dscore->p->memory.slot1.spiData[dscore->p->memory.slot1.spiAddress] = datum; + ++dscore->p->memory.slot1.spiAddress; + return oldValue; default: mLOG(DS_SLOT1, STUB, "Unimplemented SPI Flash write: %04X:%02X:%02X", control, dscore->p->memory.slot1.spiCommand, datum); break;