/dev/stm/immediate
This device is used by synchronous STM calls.
Ioctls
Ioctl | Function | Notes |
---|---|---|
0x2001 | STM_HotReset() | This will reset the Wii. |
0x2002 | STM_HotResetForPD() | Like HotReset, but without asserting PPC SRESET before the reset. Prints "HOT Reset for Power-down Sequence". |
0x2003 | STM_Shutdown(u32 config) | This will power the Wii off (red LED). config parameter is the same as IdleMode*, but they don't matter, since the entire system is shut down after. |
0x2004 | STM_IdleMode(u32 config) | This will power the Wii off (yellow LED), leaving IOS running to service WC24 events. See IdleMode section below. |
0x2005 | STM_Wakeup() | This powers on everything that gets shut down in Idle mode, then does a hot reset. |
0x3001 | STM_GetState(u32* state) | Determines whether or not IOS is currently running in idle mode (yellow light on) |
0x3002 | STM_Release() | Cancels the EventHook callback set by STM_EventHook |
0x4001 | STM_ReadDDRReg(u16 indexes[16], u16 values[16]) | Reads DDR registers from ((u16*)0xD8B4000)[index]. Max value for index is 0x200. |
0x4002 | STM_ReadDDRReg2 | Reads some moar DDR registers (in/out 0x20) from 0xD8B42C4,0xD8B42BE,0xD8B42C8 [check] |
0x5001 | STM_VIDimming | See VIDimming section. |
0x6001 | STM_LEDFlash(u32 config, u16* user_pattern, u32 pattern_count) | This initiates a disc drive LED flashing pattern. Famously used by KD when new mail is received. See LEDFlash section. |
0x6002 | STM_LEDMode(u32 mode) | Corresponds to the "Slot illumination" setting in the Wii menu. 0: off, 1: dim, 2: bright. 0 makes STM print "Forced led off." |
0x7001 | STM_ReadVer | Reads the STM driver version number. |
0x8001 | STM_WriteDMCU(u32 message, u32* response) | vWii mode only. Writes a message to the DMCU. |
IdleMode
Starts by unconditionally writing 0x038F3FCF to HW_RESETS. Bit 6 is checked first.
Bit flags:
- 31: Sets FX bit in HW_CLOCKS, clears RSTB_DSKPLL, sets bit 6 in HW_PLLDSK, sets RSTB_DSKPLL again. then clears FX bit. Logs the values of "ACRPLLSYS" and "ACRPLLSYSEXT" after.
- 28[31]: Do not clear FX bit after.
- 30: Turns off the fan.
- 29: Turns off the Broadway.
- 26: Writes 0x80802001 to HW_VISOLID. (#202020). Not done in Shutdown.
- 23: Configures HW_IOPWRCTRL. Unconditionally clears bits 0, 10 and 11. HW_IOPWRCTRL on WiiUBrew
- 22[23]: Sets low bit of DSKPLLSRC of HW_BOOT0. Will also clear bit 1.
- 21[23]: Clears bits 0, 2 and 3.
- 20[23]: Clears bits 8 and 9. (Video interface.)
- 19[23]: Clears bits 12 and 13. (Audio interface.)
- 17[23]: Clears bits 20 and 21. (SDIO.)
- 16[23]: Clears bits 26 and 27. (GPIO, apparently, but there's another 2 bits as well below it)
- 15: Configures HW_PLLAI.
- 14[15]: Sets bit 29 of HW_PLLAI.
- 7: Configures HW_IFPOWER. Named HW_CLKGATE on WiiUBrew. Value starts off at 0x003EC5ED.
- 5[7]: Clears bit 2.
- 4[7]: Clears bits 8 and 20.
- 3[7]: Clears bits 7 and 21.
- 2[7]: Clears bits 14 and 15.
- 1[7]: Clears bits 17, 18 and 19.
- 6: Sets high bit of DSKPLLSRC of HW_BOOT0.
Default value used by the System menu is 0xFCE082C0. For Hollywood revisions <=2, uses 0xFCA08280 (cleared bit 6 and 22).
VIDimming
in[7]: { HW_VIDIM set, _HW_0x20 set, _HW_0x28 set, unused, HW_VIDIM mask, _HW_0x20 mask, _HW_0x28 mask }
out[8]: { HW_VIDIM original value, _HW_0x20 original value, _HW_0x28 original value, return flags }
mask -> "keep these bits, set the others to <set>".
Bits 0, 1 and 2 will be set in return flags if the masks for HW_VIDIM, _HW_0x20 and _HW_0x28 were not all 1 (0xFFFFFFFF).
Output buffer size must be at least 0x20.
LEDFlash
Bits 0-7 of config is the pattern ID. There are 30 pattern.
Bits 8-15 of config is the priority. If the LED loop thread is currently active, STM will update the current priority and active pattern if this is higher than the current one. Otherwise, the starting priority is set to this.
Bits 16-23 of config are the flags. Bit 16 will load a user-provided pattern. Bit 17 will not initiate the actual LED loop.