Changes

1,094 bytes added ,  17:56, 6 January 2021
Line 85: Line 85:  
|-
 
|-
 
| 0x00060000
 
| 0x00060000
| ReadGyroscopeValues (reads gyroscopy with corrected values)
+
| ReadGyroscopeValues (reads 3x s16 gyro ADC values into IPC+8)
 
|-
 
|-
 
| 0x00070000
 
| 0x00070000
| GetRaw3DSliderPosition
+
| GetRaw3DSliderPosition (u8 position in IPC+8)
 
|-
 
|-
 
| 0x00080040
 
| 0x00080040
Line 124: Line 124:  
|-
 
|-
 
| 0x00010080
 
| 0x00010080
| SetRTC
+
| [[MCURTC:SetRTC|SetRTC]]
 
|-
 
|-
 
| 0x00020000
 
| 0x00020000
| GetRTC
+
| [[MCURTC:GetRTC|GetRTC]]
 
|-
 
|-
 
| 0x00030040
 
| 0x00030040
| SetRTCSeconds
+
| SetRTCSeconds(u8 seconds)
 
|-
 
|-
 
| 0x00040000
 
| 0x00040000
| GetRTCSeconds
+
| u8 GetRTCSeconds
 
|-
 
|-
 
| 0x00050040
 
| 0x00050040
| SetRTCMinutes
+
| SetRTCMinutes(u8 minutes)
 
|-
 
|-
 
| 0x00060000
 
| 0x00060000
| GetRTCMinutes
+
| u8 GetRTCMinutes
 
|-
 
|-
 
| 0x00070040
 
| 0x00070040
| SetRTCHours
+
| SetRTCHours(u8 hours)
 
|-
 
|-
 
| 0x00080000
 
| 0x00080000
| GetRTCHours
+
| u8 GetRTCHours
 
|-
 
|-
 
| 0x00090040
 
| 0x00090040
| SetRTCDayOfWeek
+
| SetRTCDayOfWeek(u8 dayno)
 
|-
 
|-
 
| 0x000A0000
 
| 0x000A0000
| GetRTCDayOfWeek
+
| u8 GetRTCDayOfWeek
 
|-
 
|-
 
| 0x000B0040
 
| 0x000B0040
| SetRTCDayOfMonth
+
| SetRTCDayOfMonth(u8 day)
 
|-
 
|-
 
| 0x000C0000
 
| 0x000C0000
| GetRTCDayOfMonth
+
| u8 GetRTCDayOfMonth
 
|-
 
|-
 
| 0x000D0040
 
| 0x000D0040
| SetRTCMonth
+
| SetRTCMonth(u8 month)
 
|-
 
|-
 
| 0x000E0000
 
| 0x000E0000
| GetRTCMonth
+
| u8 GetRTCMonth
 
|-
 
|-
 
| 0x000F0040
 
| 0x000F0040
| SetRTCYear
+
| SetRTCYear(u8 year) where year = year - 2000
 
|-
 
|-
 
| 0x00100000
 
| 0x00100000
| GetRTCYear
+
| u8 GetRTCYear where year = result + 2000
 
|-
 
|-
 
| 0x00110040
 
| 0x00110040
| SetRTCLeapYearCounter
+
| SetRTCLeapYearCounter(u8 leap)
 
|-
 
|-
 
| 0x00120000
 
| 0x00120000
| GetRTCLeapYearCounter
+
| u8 GetRTCLeapYearCounter
 
|-
 
|-
 
| 0x00130080
 
| 0x00130080
| SetRTCAlarm
+
| [[MCURTC:SetRTCAlarm|SetRTCAlarm]]
 
|-
 
|-
 
| 0x00140000
 
| 0x00140000
| GetRTCAlarm
+
| [[MCURTC:GetRTCAlarm|GetRTCAlarm]]
 
|-
 
|-
 
| 0x00150040
 
| 0x00150040
| SetRTCAlarmComponent[0]
+
| SetRTCAlarmComponent[0] (u8 val)
 
|-
 
|-
 
| 0x00160000
 
| 0x00160000
| GetRTCAlarmComponent[0]
+
| u8 GetRTCAlarmComponent[0]
 
|-
 
|-
 
| 0x00170040
 
| 0x00170040
| SetRTCAlarmComponent[1]
+
| SetRTCAlarmComponent[1] (u8 val)
 
|-
 
|-
 
| 0x00180000
 
| 0x00180000
| GetRTCAlarmComponent[1]
+
| u8 GetRTCAlarmComponent[1]
 
|-
 
|-
 
| 0x00190040
 
| 0x00190040
| SetRTCAlarmComponent[2]
+
| SetRTCAlarmComponent[2] (u8 val)
 
|-
 
|-
 
| 0x001A0000
 
| 0x001A0000
| GetRTCAlarmComponent[2]
+
| u8 GetRTCAlarmComponent[2]
 
|-
 
|-
 
| 0x001B0040
 
| 0x001B0040
| SetRTCAlarmComponent[3]
+
| SetRTCAlarmComponent[3] (u8 val)
 
|-
 
|-
 
| 0x001C0000
 
| 0x001C0000
| GetRTCAlarmComponent[3]
+
| u8 GetRTCAlarmComponent[3]
 
|-
 
|-
 
| 0x001D0040
 
| 0x001D0040
| SetRTCAlarmComponent[4]
+
| SetRTCAlarmComponent[4] (u8 val)
 
|-
 
|-
 
| 0x001E0000
 
| 0x001E0000
| GetRTCAlarmComponent[4]
+
| u8 GetRTCAlarmComponent[4]
 
|-
 
|-
 
| 0x001F0040
 
| 0x001F0040
| SetPedometerRecordingMode
+
| SetPedometerRecordingMode(u8 mode)
 
|-
 
|-
 
| 0x00200000
 
| 0x00200000
| GetPedometerRecordingMode
+
| u8 GetPedometerRecordingMode
 
|-
 
|-
 
| 0x00210080
 
| 0x00210080
| GetStepCount (for the current day)
+
| u8 GetStepCount (for the current day)
 
|-
 
|-
 
| 0x00220042
 
| 0x00220042
Line 226: Line 226:  
|-
 
|-
 
| 0x00230000
 
| 0x00230000
| ??? writes 1 to register 0x4E which is not writable
+
| void ??? writes 1 to register 0x4E which is not writable
 
|-
 
|-
 
| 0x00240000
 
| 0x00240000
| GetPowerEventHandle. MCU notifications 1, 8, 9, 10, 13, 14 and 15 signal this.
+
| Handle GetPowerEventHandle. MCU notifications 1, 8, 9, 10, 13, 14 and 15 signal this.
 
see [[I2C_Registers#Device_3|Register 0x18]]
 
see [[I2C_Registers#Device_3|Register 0x18]]
 
|-
 
|-
 
| 0x00250000
 
| 0x00250000
| GetPowerInterruptHistory
+
| u32 GetPowerInterruptHistory
 
|-
 
|-
 
| 0x00260000
 
| 0x00260000
| CheckRegister02hBit0
+
| bool CheckRegister02hBit0
 
|-
 
|-
 
| 0x00270000
 
| 0x00270000
| ClearRegister02hBit0 (does nothing since the register is not writable)
+
| void ClearRegister02hBit0 (does nothing since the register is not writable)
 
|-
 
|-
 
| 0x00280000
 
| 0x00280000
| CheckRegister02hBit1
+
| bool CheckRegister02hBit1
 
|-
 
|-
 
| 0x00290000
 
| 0x00290000
| ClearRegister02hBit1
+
| void ClearRegister02hBit1
 
|-
 
|-
 
| 0x002A0000
 
| 0x002A0000
| GetShellState. This writes the value of I2C-MCU register 0xf bit1 to u8 cmdreply[2].
+
| bool GetShellState. This writes the value of I2C-MCU register 0xf bit1 to u8 cmdreply[2].
 
|-
 
|-
 
| 0x002B0000
 
| 0x002B0000
| GetAdapterState. This writes the value of I2C-MCU register 0xf bit3 to u8 cmdreply[2].
+
| bool GetAdapterState. This writes the value of I2C-MCU register 0xf bit3 to u8 cmdreply[2].
 
|-
 
|-
 
| 0x002C0000
 
| 0x002C0000
| GetBatteryChargeState. This writes the value of I2C-MCU register 0xf bit4 to u8 cmdreply[2].
+
| bool GetBatteryChargeState. This writes the value of I2C-MCU register 0xf bit4 to u8 cmdreply[2].
 
|-
 
|-
 
| 0x002D0000
 
| 0x002D0000
Line 260: Line 260:  
|-
 
|-
 
| 0x002E0000
 
| 0x002E0000
| GetBatteryEmptyPatternByte0
+
| u8 SetPowerModeIndicatorState (see [[I2C_Registers#Device_3|Register 0x29]])
 
|-
 
|-
 
| 0x002F0000
 
| 0x002F0000
| GetBatteryEmptyPatternByte0_safe™
+
| u8 GetBatteryEmptyPatternByte0_safe™
 
|-
 
|-
 
| 0x00300040
 
| 0x00300040
| SetLEDBrightness (see [[I2C_Registers#Device_3|Register 0x28]])
+
| SetLEDBrightness(u8 brightness) (see [[I2C_Registers#Device_3|Register 0x28]])
 
|-
 
|-
 
| 0x00310000
 
| 0x00310000
| GetLEDBrightness (see [[I2C_Registers#Device_3|Register 0x28]])
+
| u8 GetLEDBrightness (see [[I2C_Registers#Device_3|Register 0x28]])
 
|-
 
|-
 
| 0x00320000
 
| 0x00320000
| PowerOff (writes 0x1 to i2c MCU device, [[I2C_Registers#Device_3|reg 0x20]])
+
| void PowerOff (writes 0x1 to i2c MCU device, [[I2C_Registers#Device_3|reg 0x20]])
 
|-
 
|-
 
| 0x00330000
 
| 0x00330000
| HardwareReboot (writes 0x4 to i2c MCU device, [[I2C_Registers#Device_3|reg 0x20]])
+
| void HardwareReboot (writes 0x4 to i2c MCU device, [[I2C_Registers#Device_3|reg 0x20]])
 
|-
 
|-
 
| 0x00340000
 
| 0x00340000
| WriteRegister reg=0x23 value=0x72 (writing to read-only registers does nothing)
+
| ResetMcu
 
|-
 
|-
 
| 0x00350000
 
| 0x00350000
Line 284: Line 284:  
|-
 
|-
 
| 0x00360040
 
| 0x00360040
| SetWatchdogTimer
+
| SetWatchdogTimer(u8 timer)
 
|-
 
|-
 
| 0x00370000
 
| 0x00370000
| GetWatchdogTimer
+
| u8 GetWatchdogTimer
 
|-
 
|-
 
| 0x00380042
 
| 0x00380042
| ReadInfoRegister(u32 unused_size, translation_param size << 4 <nowiki>|</nowiki> 0xC, u8[0x13] ptr)
+
| Same as [[MCUHWC:GetInfoRegisters]]
 
|-
 
|-
 
| 0x00390082
 
| 0x00390082
| WriteLoop (translation parameters too complex)
+
| SetPlayCountRegisters (u8 index, const u8 *data, u32 size). Write to free reg bank at index+8.
 
|-
 
|-
 
| 0x003A0082
 
| 0x003A0082
| ReadLoop (translation parameters too complex)
+
| GetPlayCountRegisters
 
|-
 
|-
 
| 0x003B0640
 
| 0x003B0640
Line 308: Line 308:  
|-
 
|-
 
| 0x003E0040
 
| 0x003E0040
| WriteRegister50h
+
| WriteRegister50h(u8 value)
 
|-
 
|-
 
| 0x003F0000
 
| 0x003F0000
| ReadRegister50h
+
| u8 ReadRegister50h
 
|-
 
|-
 
| 0x00400040
 
| 0x00400040
| WriteRegister51h
+
| WriteRegister51h(u8 value)
 
|-
 
|-
 
| 0x00410000
 
| 0x00410000
| ReadRegister51h
+
| u8 ReadRegister51h
 
|-
 
|-
 
| 0x00420040
 
| 0x00420040
Line 323: Line 323:  
|-
 
|-
 
| 0x00430040
 
| 0x00430040
| SetScreenFlickerTop
+
| SetScreenFlickerTop(u8 flicker)
 
|-
 
|-
 
| 0x00440000
 
| 0x00440000
| GetScreenFlickerTop
+
| u8 GetScreenFlickerTop
 
|-
 
|-
 
| 0x00450040
 
| 0x00450040
| SetScreenFlickerBottom
+
| SetScreenFlickerBottom(u8 flicker)
 
|-
 
|-
 
| 0x00460000
 
| 0x00460000
| GetScreenFlickerBottom
+
| u8 GetScreenFlickerBottom
 
|-
 
|-
 
| 0x00470080
 
| 0x00470080
| SetVolumeSliderBounds
+
| SetVolumeSliderBounds(u8 low, u8 high) (see [[I2C_Registers#Device_3|Register 0x58]])
 
|-
 
|-
 
| 0x00480000
 
| 0x00480000
| GetVolumeSliderBounds
+
| u8 low, u8 high GetVolumeSliderBounds
 
|-
 
|-
 
| 0x00490040
 
| 0x00490040
| SetInterruptMask (see [[I2C_Registers#Device_3|Register 0x18]])
+
| SetInterruptMask(u32 mask) (see [[I2C_Registers#Device_3|Register 0x18]])
 
|-
 
|-
 
| 0x004A0000
 
| 0x004A0000
| GetInterruptMask (see [[I2C_Registers#Device_3|Register 0x18]])
+
| u32 GetInterruptMask (see [[I2C_Registers#Device_3|Register 0x18]])
 
|-
 
|-
 
| 0x004B0000
 
| 0x004B0000
| ExitExclusiveInterruptMode
+
| void ExitExclusiveInterruptMode
 
|-
 
|-
 
| 0x004C0000
 
| 0x004C0000
| EnterExclusiveInterruptMode
+
| void EnterExclusiveInterruptMode
 
|-
 
|-
 
| 0x004D0000
 
| 0x004D0000
| [[MCURTC:ReadHidFlagRegister|ReadInterrupt]] (see [[I2C_Registers#Device_3|Register 0x10]])
+
| [[MCURTC:ReadInterrupt|ReadInterrupt]] (see [[I2C_Registers#Device_3|Register 0x10]])
 
|-
 
|-
 
| 0x004E0040
 
| 0x004E0040
Line 359: Line 359:  
|-
 
|-
 
| 0x004F0040
 
| 0x004F0040
| SetMCUFirmUpdated(u32 flag) not used by anything
+
| SetMCUFirmUpdated(u32 flag) used by PTM module
 
|-
 
|-
 
| 0x00500000
 
| 0x00500000
| IsMCUFirmUpdated
+
| u32 IsMCUFirmUpdated
 
|-
 
|-
 
| 0x00510040
 
| 0x00510040
Line 371: Line 371:  
|-
 
|-
 
| 0x00530040
 
| 0x00530040
| ?
+
| SetLgyLcdData
 
|-
 
|-
 
| 0x00540000
 
| 0x00540000
| ?
+
| GetLgyLcdData
 
|-
 
|-
 
| 0x00550040
 
| 0x00550040
| ?
+
| SetLgyNativeResolutionFlag
 
|-
 
|-
 
| 0x00560000
 
| 0x00560000
| ?
+
| GetLgyNativeResolutionFlag
 
|-
 
|-
 
| 0x00570040
 
| 0x00570040
| ?
+
| SetLocalFriendCodeCounter
 
|-
 
|-
 
| 0x00580000
 
| 0x00580000
| ?
+
| GetLocalFriendCodeCounter
 
|-
 
|-
 
| 0x00590040
 
| 0x00590040
Line 393: Line 393:  
| 0x005A0000
 
| 0x005A0000
 
| [[MCURTC:GetLegacyJumpProhibitedFlag|GetLegacyJumpProhibitedFlag]]
 
| [[MCURTC:GetLegacyJumpProhibitedFlag|GetLegacyJumpProhibitedFlag]]
 +
|-
 +
| 0x005B0040
 +
| SetUUIDClockSequence
 +
|-
 +
| 0x005C0000
 +
| GetUUIDClockSequence
 +
|-
 
|}
 
|}
   Line 488: Line 495:  
|-
 
|-
 
| 0x000E0080
 
| 0x000E0080
| ?
+
| GetBatteryTemperature
 
|-
 
|-
 
| 0x000F00C0
 
| 0x000F00C0
Line 513: Line 520:  
|-
 
|-
 
| 0x00020000
 
| 0x00020000
| u8 GetSeconds
+
| [[MCUPLS:GetSeconds|GetSeconds]]
 
|-
 
|-
 
| 0x00030000
 
| 0x00030000
Line 552: Line 559:  
=MCU firmware versions=
 
=MCU firmware versions=
   −
These reside in mcu-module .rodata, are uploaded to MCU register 0x05 and are usually 0x4003 bytes in size (the actual firmware is 0x4000 bytes preceeded by a 3 byte RL78 assembly opcode "<code>jhl</code>" (<code>or 0xffe68, #108</code>) to switch the I2C comms into flash write mode).
+
These reside in mcu sysmodule .rodata, are uploaded to MCU register 0x05 and are usually 0x4003 bytes in size (the actual firmware is 0x4000 bytes preceeded by a 3 byte magic header "<code>jhl</code>" which switches the I2C comms into flash write mode). 
 +
Switching requires register 0x05 (at address <code>0xFFBA9</code>) to contain 0x6A ('<code>j</code>'), register 0x06 containing 0x68 ('<code>h</code>'), and writing 0x6C ('<code>l</code>') to register 0x07. The actual flashing sequence is only signaled (code at 0x3312-0x331A) when writing register 0x07, it's skipped otherwise. Register 0x07 gets written anyways, just the actual signaling is skipped if the conditions aren't met.
   −
Before the upload could commence, WiFi interrupts are turned off via GPIO command 0x00020080(0, 0x40000), then after the upload completed, the sysmodule waits exactly one second for the MCU to reboot, then turns WiFi interrupts back on via <code>gpio:MCU</code> command 0x00020080(0x40000, 0x40000).
+
Before the upload could commence, external MCU interrupts are turned off via GPIO command 0x00020080(0, 0x40000), then after the upload completed, the sysmodule waits exactly one second for the MCU to reboot, then turns external MCU interrupts back on via <code>gpio:MCU</code> command 0x00020080(0x40000, 0x40000).
   −
There exists an alternate code path where uploading is done using register 0x3B (if register 0x0F is zero meaning all peripherals are turned off, and 0x10 must be 1 (power button pressed/held)). This may be a "hack" around early versions of MCU? Register 0x3B is part of the RTC alarm registers on recent versions of MCU.
+
There exists an alternate code path in very old MCU_FIRM versions where uploading is done using register 0x3B (if register 0x0F is zero and 0x10 is 1). Register 0x3B is part of the RTC alarm registers on recent versions of MCU.
    
On dev-units, the user-facing representation of this firmware version is displayed by first subtracting 0x10 from the major field (raw register 0x00). It is these user-facing versions that are displayed in the table below. It is unknown what bit4 (0x10) actually represents, but it is seemingly always set.
 
On dev-units, the user-facing representation of this firmware version is displayed by first subtracting 0x10 from the major field (raw register 0x00). It is these user-facing versions that are displayed in the table below. It is unknown what bit4 (0x10) actually represents, but it is seemingly always set.
516

edits