/dev/stm/immediate

From WiiBrew
< /dev‎ | stm
Jump to: navigation, search

The State Transition Manager handles transitioning between power states (idle, on, standby, reset, etc).

Unless otherwise noted, ioctls take in an input buffer of 0x20 bytes and an io buffer of 0x20 bytes, e.g.

static u8 stm_inbuf[0x20] ATTRIBUTE_ALIGN(32);
static u8 stm_iobuf[0x20] ATTRIBUTE_ALIGN(32);
retval = IOS_Ioctl(fd, ioctl_no, inbuf, 0x20, outbuf, 0x20);

The contents of the buffers do not matter.

Events

Event Notes
0x00020000 Triggered when the reset button is pressed.
0x00000800 Triggered when the power button is pressed (by the GPIO event handler).

Ioctls (/dev/stm/eventhook)

Ioctl Function Notes
0x1000 STM_EventHook This async ioctl will block until the next event happens, at which point the async callback will be called.

Ioctls (/dev/stm/immediate)

Ioctl Function Notes
0x2001 STM_HotReset This will reset the Wii.
0x2003 STM_ShutdownToStandby This will power the Wii off (red LED).
0x2004 STM_ShutdownToIdle This will power the Wii off (yellow LED), leaving IOS running to service WC24 events. First four bytes of stm_inbuf should be 0xFCA08280 [check]
0x2005 STM_Wakeup This will turn the Wii on (green LED), generally launching the System Menu. This would generally be called by another IOS module that was running while the Wii was in Idle mode.
0x3001 STM_GetState Determines whether or not IOS is currently running in idle mode (yellow light on)
0x3002 STM_UnregisterStateEvent Cancels the EventHook callback set by STM_EventHook
0x4001 STM_ReadDDRReg Reads some DDR registers (in/out 0x20) from D8B4000 + in [check]
0x4002 STM_ReadDDRReg2 Reads some moar DDR registers (in/out 0x20) from 0xD8B42C4,0xD8B42BE,0xD8B42C8 [check]
0x5001 STM_SetVIForceDimming The 32-bit parameter (first 4 bytes of inbuf) changes the brightness of the entire screen. This is used to implement "Screen Saver" functionality (screen dimming).
0x6001 STM_FlashLED This sets the disc drive LED "brightness", input is a 32-bit word from inbuf. This probably can only be used by KD, as using this from Broadway does nothing.(Although STM returned zero.)
0x6002 STM_SetIdleLEDMode Please figure out what I do and update me! 32-bit parameter is passed in as the first word of inbuf. IOS say Forced LED off
0x7001 STM_ReadVer Reads the STM driver version number.