SIO registers can now be read and written properly
Jeffrey Pfau jeffrey@endrift.com
Mon, 10 Feb 2014 01:42:40 -0800
4 files changed,
22 insertions(+),
7 deletions(-)
M
src/gba/gba-io.c
→
src/gba/gba-io.c
@@ -259,6 +259,9 @@ case REG_RCNT:
value &= 0xC1FF; GBASIOWriteRCNT(&gba->sio, value); break; + case REG_SIOMLT_SEND: + GBASIOWriteSIOMLT_SEND(&gba->sio, value); + break; // Interrupts and misc case REG_WAITCNT:@@ -411,6 +414,11 @@ case REG_DMA0CNT_HI:
case REG_DMA1CNT_HI: case REG_DMA2CNT_HI: case REG_DMA3CNT_HI: + case REG_SIOMULTI0: + case REG_SIOMULTI1: + case REG_SIOMULTI2: + case REG_SIOMULTI3: + case REG_SIOMLT_SEND: case REG_IE: case REG_IF: case REG_WAITCNT:
M
src/gba/gba-sio.c
→
src/gba/gba-sio.c
@@ -108,11 +108,11 @@ }
} void GBASIOWriteSIOCNT(struct GBASIO* sio, uint16_t value) { - sio->siocnt = value; - _switchMode(sio); if (sio->activeDriver && sio->activeDriver->writeRegister) { - sio->activeDriver->writeRegister(sio->activeDriver, REG_SIOCNT, value); + value = sio->activeDriver->writeRegister(sio->activeDriver, REG_SIOCNT, value); } + sio->siocnt = value; + _switchMode(sio); } void GBASIOWriteSIOMLT_SEND(struct GBASIO* sio, uint16_t value) {
M
src/gba/gba.c
→
src/gba/gba.c
@@ -2,6 +2,7 @@ #include "gba.h"
#include "gba-bios.h" #include "gba-io.h" +#include "gba-sio.h" #include "gba-thread.h" #include "memory.h"@@ -194,6 +195,11 @@ nextEvent = testEvent;
} testEvent = GBAMemoryRunDMAs(&gbaBoard->p->memory, cycles); + if (testEvent < nextEvent) { + nextEvent = testEvent; + } + + testEvent = GBASIOProcessEvents(&gbaBoard->p->sio, cycles); if (testEvent < nextEvent) { nextEvent = testEvent; }@@ -447,10 +453,6 @@ }
}; void GBAWriteIE(struct GBA* gba, uint16_t value) { - if (value & (1 << IRQ_SIO)) { - GBALog(gba, GBA_LOG_STUB, "SIO interrupts not implemented"); - } - if (value & (1 << IRQ_KEYPAD)) { GBALog(gba, GBA_LOG_STUB, "Keypad interrupts not implemented"); }
M
src/util/socket.h
→
src/util/socket.h
@@ -8,6 +8,7 @@ typedef SOCKET Socket;
#else #include <fcntl.h> #include <netinet/in.h> +#include <netinet/tcp.h> #include <stdio.h> #include <sys/socket.h> #include <unistd.h>@@ -79,6 +80,10 @@ flags |= O_NONBLOCK;
} return fcntl(socket, F_SETFL, flags) >= 0; #endif +} + +static inline int SocketSetTCPPush(Socket socket, int push) { + return setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char*) &push, sizeof(int)) >= 0; } #endif