Difference between revisions of "/dev/stm/immediate"

< /devβ€Ž | stm
 
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
βˆ’
this handles the shutdown/reset button on the front of the Wii, maybe it handles more.
+
This device is used by synchronous STM calls.
βˆ’
(Perhaps It's An APM Like Sub-System?)
 
  
βˆ’
In all code that has been studied, the ioctls take in an input buffer of 0x20 bytes and an io buffer of 0x20 bytes, e.g.
+
== Ioctls ==
 +
{| class="wikitable"
 +
|-
 +
! Ioctl
 +
! Function
 +
! Notes
 +
|-
 +
| 0x2001
 +
| STM_HotReset
 +
| This will reset the Wii.
 +
|-
 +
| 0x2002
 +
| STM_HotResetForPD
 +
| Prints message "HOT Reset for Power-down Sequence", and does a reset of some sort{{check}}.
 +
|-
 +
| 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 [https://wiibrew.org/wiki//dev/stm/eventhook 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. If it is zero, IOS prints "Forced LED off."
 +
|-
 +
| 0x7001
 +
| STM_ReadVer
 +
| Reads the STM driver version number.
 +
|-
 +
| 0x8001
 +
| STM_WriteDMCU
 +
| [[vWii]] mode only. Writes a message to the DMCU.
 +
|}
  
βˆ’
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 seem to matter for the shutdown / reset functions. You should not expect to actually receive a return code, due to the nature of the functions -- any return value can then be treated as some sort of error.
 
βˆ’
=== Shutdown To Standby ===
 
βˆ’
 
βˆ’
STM_ShutdownToStandby: ioctl 0x2003
 
βˆ’
This will power the Wii off (red LED).
 
βˆ’
 
βˆ’
=== Shutdown To Idle ===
 
βˆ’
 
βˆ’
STM_ShutdownToIdle: ioctl 0x2004
 
βˆ’
This will put the Wii into idle mode (yellow LED). This might be useful, but not for known Homebrew-related purposes.
 
βˆ’
 
βˆ’
=== Hot Reset ===
 
βˆ’
 
βˆ’
STM_HotReset: ioctl 0x2001
 
βˆ’
This will reset the Wii.
 
βˆ’
 
βˆ’
=== Force Dimming ===
 
βˆ’
 
βˆ’
STM_SetVIForceDimming: ioctl 0x5001
 
βˆ’
The 32-bit parameter changes the brightness it sets the screen to. The parameter is the first word of inbuf. The brightness change stays until either the Wii reboots, or it is changed back.
 
βˆ’
 
βˆ’
=== Set Idle LED Mode ===
 
βˆ’
STM_SetIdleLEDMode: ioctl 0x6002
 
βˆ’
Please figure out what I do and update me! 32-bit parameter is passed in as the first word of inbuf.
 
βˆ’
 
βˆ’
=== Unregister State Event ===
 
βˆ’
STM_UnregisterStateEvent: ioctl 0x3002
 
βˆ’
 
βˆ’
Please figure out what I do and update me!
 
βˆ’
 
βˆ’
== Get state ==
 
βˆ’
#define ISTM_CMD_GETSTATE 0x3001
 
βˆ’
 
βˆ’
Found in IOS37 KD driver 0x13db0710 and on.
 
βˆ’
 
βˆ’
Please figure out what I do and update me!
 
βˆ’
 
βˆ’
== Wake up ==
 
βˆ’
#define ISTM_CMD_WAKEUP 0x2005
 
βˆ’
 
βˆ’
Found in IOS37 KD driver 0x13db0746 and on.
 
βˆ’
 
βˆ’
Please figure out what I do and update me!
 
βˆ’
 
βˆ’
== LED Flash??? ==
 
βˆ’
0x6001
 
βˆ’
 
βˆ’
Found in IOS37 KD driver 0x13db0660 and on.
 
βˆ’
 
βˆ’
Please figure out what I do and update me!
 
  
 
[[Category:IOS API documentation]]
 
[[Category:IOS API documentation]]

Latest revision as of 06:58, 12 May 2023

This device is used by synchronous STM calls.

Ioctls

Ioctl Function Notes
0x2001 STM_HotReset This will reset the Wii.
0x2002 STM_HotResetForPD Prints message "HOT Reset for Power-down Sequence", and does a reset of some sort[check].
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. If it is zero, IOS prints "Forced LED off."
0x7001 STM_ReadVer Reads the STM driver version number.
0x8001 STM_WriteDMCU vWii mode only. Writes a message to the DMCU.