diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-05-19 22:17:28 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-05-19 22:17:28 +0200 |
commit | edc959dcf51eda1e5c844896f1c1efe67cff5776 (patch) | |
tree | b7551438a9933c03fa0672db2f5ee8fea67ca8e3 | |
parent | d29dc7a2f01406305266acd4bc922853b9080a94 (diff) |
draft APIs for threading in the core.
also, misc wifi crap, nothing noteworthy.
-rw-r--r-- | src/Platform.h | 14 | ||||
-rw-r--r-- | src/Wifi.cpp | 15 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/Platform.h b/src/Platform.h index 3e0b376..d2d8199 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -24,6 +24,20 @@ namespace Platform { +void* Thread_Create(void (*func)()); +void Thread_Free(void* thread); +void Thread_Wait(void* thread); + +void* Event_Create(); +void Event_Free(void* event); +void Event_Wait(void* event); +void Event_Signal(void* event); + +void* Semaphore_Create(); +void Semaphore_Free(void* sema); +void Semaphore_Wait(void* sema); +void Semaphore_Post(void* sema); + bool MP_Init(); void MP_DeInit(); int MP_SendPacket(u8* data, int len); diff --git a/src/Wifi.cpp b/src/Wifi.cpp index 994fee4..2a60a6a 100644 --- a/src/Wifi.cpp +++ b/src/Wifi.cpp @@ -208,7 +208,7 @@ void SetIRQ14(bool forced) if (IOPORT(W_ListenCount) == 0) IOPORT(W_ListenCount) = IOPORT(W_ListenInterval); - IOPORT(W_ListenCount)--; + IOPORT(W_ListenCount)--;printf("IRQ14 prebeacon %04X\n", IOPORT(W_PreBeacon)); } void SetIRQ15() @@ -216,7 +216,7 @@ void SetIRQ15() SetIRQ(15); if (IOPORT(W_PowerTX) & 0x0001) - { + {printf("wakeup\n"); IOPORT(W_RFPins) |= 0x0080; IOPORT(W_RFStatus) = 1; } @@ -291,6 +291,8 @@ void StartTX_Beacon() void FireTX() { u16 txbusy = IOPORT(W_TXBusy); + printf("attempting to fire TX: %04X %04X\n", txbusy, IOPORT(W_TXSlotLoc2)); + if (txbusy & 0x0008) { if (IOPORT(W_TXSlotLoc3) & 0x8000) @@ -666,6 +668,8 @@ u16 Read(u32 addr) } } break; + //case 0x214: NDS::debug(0); break; + //case 0x040: NDS::debug(0); break; } //printf("WIFI: read %08X\n", addr); @@ -766,6 +770,10 @@ void Write(u32 addr, u16 val) // TODO: delay for this SetIRQ(11); IOPORT(W_PowerState) = 0x0000; + + // checkme + IOPORT(W_RFPins) = 0x00C6; + IOPORT(W_RFStatus) = 9; } return; case W_PowerForce: @@ -776,7 +784,7 @@ void Write(u32 addr, u16 val) IOPORT(0x034) = 0x0002; IOPORT(W_PowerState) = 0x0200; IOPORT(W_TXReqRead) = 0; - IOPORT(W_RFPins) = 00046; + IOPORT(W_RFPins) = 0x0046; IOPORT(W_RFStatus) = 9; } break; @@ -885,6 +893,7 @@ void Write(u32 addr, u16 val) return; case W_TXSlotReset: + printf("TX slot reset: %04X\n", val); if (val & 0x0001) IOPORT(W_TXSlotLoc1) &= 0x7FFF; if (val & 0x0002) IOPORT(W_TXSlotCmd) &= 0x7FFF; if (val & 0x0004) IOPORT(W_TXSlotLoc2) &= 0x7FFF; |