Difference between revisions of "Hardware calibration"

From 3dbrew
Jump to navigation Jump to search
(Add some more blocks)
Line 35: Line 35:
 
| 0x30
 
| 0x30
 
| 0x1D0
 
| 0x1D0
| Zerofilled
+
| Zerofilled, padding for the 512byte block size
 
|}
 
|}
  
Line 96: Line 96:
 
!  Offset
 
!  Offset
 
!  Size
 
!  Size
 +
!  [[Config_Savegame#Configuration_blocks|ConfigInfoBlk]]
 
!  Description
 
!  Description
 
|-
 
|-
 
| 0x00
 
| 0x00
 
| 0x10
 
| 0x10
 +
| 00040000
 
| [[#Touch|Touch panel]]
 
| [[#Touch|Touch panel]]
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 0x08
 
| 0x08
 +
| ???
 
| [[#Circle_pad|Circle pad]]
 
| [[#Circle_pad|Circle pad]]
 
|-
 
|-
 
| 0x20
 
| 0x20
 
| 2*
 
| 2*
 +
| 00050000
 
| [[#Screen_flicker|Screen flicker]]
 
| [[#Screen_flicker|Screen flicker]]
 +
|-
 +
| 0x24
 +
| 1*
 +
| ???
 +
| ???
 +
|-
 +
| 0x28
 +
| 1*
 +
| ???
 +
| ???
 
|-
 
|-
 
| 0x30
 
| 0x30
| 0x8C
+
| 0x8A
 +
| ???
 
| [[#Camera_position|Camera position]]
 
| [[#Camera_position|Camera position]]
 +
|-
 +
| 0xBC
 +
| 0x12
 +
| ???
 +
| ???
 +
|-
 +
| 0xD0
 +
| 0xC
 +
| ???
 +
| [[#Accel|Accelerometer]]
 +
|-
 +
| 0xE0
 +
| 0x134
 +
| ???
 +
| ???
 
|-
 
|-
 
| 0x218
 
| 0x218
 
| 0x06
 
| 0x06
 +
| ???
 
| Programmable Infrared Transmitter (PIT)
 
| Programmable Infrared Transmitter (PIT)
 
|-
 
|-
 
| 0x220
 
| 0x220
 
| 0x214
 
| 0x214
 +
| ???
 
| [[#3D_filters|3D filters]]
 
| [[#3D_filters|3D filters]]
 +
|-
 +
| 0x440
 +
| 0x20
 +
| ???
 +
| [[#ABL|Power saving mode]]
 +
|-
 +
| 0x470
 +
| 0x20
 +
| ???
 +
| ???
 +
|-
 +
| 0x4A0
 +
| 0x38
 +
| ???
 +
| ???
 
|-
 
|-
 
| 0x4E0
 
| 0x4E0
 
| 0x18
 
| 0x18
 +
| ???
 
| [[#Circle_pad_extra|Circle pad extra]]
 
| [[#Circle_pad_extra|Circle pad extra]]
 +
|-
 +
| 0x500
 +
| 0xC
 +
| ???
 +
| ???
 +
|-
 +
| 0x510
 +
| 0x20
 +
| ???
 +
| ???
 
|-
 
|-
 
| 0x540
 
| 0x540
| 0x0A
+
| 0x08
| MCU
+
| ???
 +
| [[#MCU|MCU]]
 
|-
 
|-
 
| 0x550
 
| 0x550
| 0x04
+
| 0x02
 +
| ???
 
| [[#ULCD_delay|3D screen (ULCD) delay]]
 
| [[#ULCD_delay|3D screen (ULCD) delay]]
 
|-
 
|-
 
| 0x560
 
| 0x560
| 0x0A
+
| 0x08
| [[#Microphone echo cancel|Microphone echo cancellation]]
+
| ???
 +
| [[#Microphone_echo_cancel|Microphone echo cancellation]]
 
|-
 
|-
 
| 0x570
 
| 0x570
| 0x10E
+
| 0x10C
| [[#ABL|Power saving mode (ABL) extra]]
+
| ???
 +
| [[#ABL_extra|Power saving mode (ABL) extra]]
 
|-
 
|-
 
| 0x680
 
| 0x680
| 0x0A
+
| 0x08
 +
| ???
 
| [[#CStick|CStick (Right stick)]]
 
| [[#CStick|CStick (Right stick)]]
 
|-
 
|-
 
| 0x690
 
| 0x690
| 0x1A
+
| 0x18
| Q Tracking Module (QTM)
+
| ???
 +
| Quad Tracking Module (QTM)
 
|}
 
|}
  
Line 277: Line 341:
 
| 0x88
 
| 0x88
 
| s16 ccmPosition
 
| s16 ccmPosition
 +
|}
 +
 +
==Accel==
 +
{| class="wikitable" border="1"
 +
!  Offset
 +
!  Description
 +
|-
 +
| 0x00
 +
| s16 OffsetX
 +
|-
 +
| 0x02
 +
| s16 ScaleX
 +
|-
 +
| 0x04
 +
| s16 OffsetY
 +
|-
 +
| 0x06
 +
| s16 ScaleY
 +
|-
 +
| 0x08
 +
| s16 OffsetZ
 +
|-
 +
| 0x0A
 +
| s16 ScaleZ
 
|}
 
|}
  
Line 289: Line 377:
 
| 0x200
 
| 0x200
 
| u32 IIRSurroundFilter[5]
 
| u32 IIRSurroundFilter[5]
 +
|}
 +
 +
==ABL==
 +
{| class="wikitable" border="1"
 +
!  Offset
 +
!  Description
 +
|-
 +
| 0x00
 +
| u32 DitherPattern
 +
|-
 +
| 0x04
 +
| s16 StartX
 +
|-
 +
| 0x06
 +
| s16 StartY
 +
|-
 +
| 0x08
 +
| u16 SizeX
 +
|-
 +
| 0x0A
 +
| u16 SizeY
 +
|-
 +
| 0x0C
 +
| s16 GTH_Ratio
 +
|-
 +
| 0x0E
 +
| u8 DitherMode
 +
|-
 +
| 0x0F
 +
| u8 MinRS
 +
|-
 +
| 0x10
 +
| u8 MaxRS
 +
|-
 +
| 0x11
 +
| u8 MinGTH
 +
|-
 +
| 0x12
 +
| u8 MinMax (???)
 +
|-
 +
| 0x13
 +
| u8 ExMax (???)
 +
|-
 +
| 0x14
 +
| u8 inertia
 +
|-
 +
| 0x15
 +
| u8 LutListRS[9]
 +
|-
 +
| 0x1E
 +
| u8 reserved[2]
 
|}
 
|}
  
Line 319: Line 458:
 
| 0x12
 
| 0x12
 
| u8 unknown_padding[6]
 
| u8 unknown_padding[6]
 +
|}
 +
 +
==MCU==
 +
{| class="wikitable" border="1"
 +
!  Offset
 +
!  Description
 +
|-
 +
| 0x00
 +
| s16 SVR2_Min (???)
 +
|-
 +
| 0x02
 +
| s16 SVR2_Max (???)
 +
|-
 +
| 0x04
 +
| s16 VolumeSliderMin
 +
|-
 +
| 0x06
 +
| s16 VolumeSliderMax
 
|}
 
|}
  
Line 342: Line 499:
 
|}
 
|}
  
==ABL==
+
==ABL extra==
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
!  Offset
 
!  Offset

Revision as of 22:34, 11 October 2017

File format

The file consists out of a 0x200 big header (though the actual header is only 0x30 bytes, the rest is zerofilled), plus data whose size is indicated in the header.

Header

Offset Size Description
0x0 0x4 Magic "CCAL"
0x4 0x4 Version
0x8 0x4 Data size, always 0x7D0
0xC 0x2? ???
0xE 0x2 Bitmask of successful Aging tests
0x10 0x20 On devunits and if 0x1FF81006 is 3 or 4 or 7 or 8 or 9 then SHA256,

otherwise HMACSHA256 signature of the data section

0x30 0x1D0 Zerofilled, padding for the 512byte block size

Aging masks

Bit Description
0 FCRAM
1 LCD flicker (always successful)
2 Camera
3 Touch panel (always successful)
4 Circle pad (analog stick)
5 Codec
6 Gyroscope
7 RTC
8 Accelerometer
9 Surround
A Power saving mode (ABL)
B 3D screen (ULCD)
C Backlight PWM
D Analog stick A (???)
E Camera extensions
F Power saving mode (ABL) in legacy (DSi/GBA) mode

Data blocks

Offset Size ConfigInfoBlk Description
0x00 0x10 00040000 Touch panel
0x14 0x08 ??? Circle pad
0x20 2* 00050000 Screen flicker
0x24 1* ??? ???
0x28 1* ??? ???
0x30 0x8A ??? Camera position
0xBC 0x12 ??? ???
0xD0 0xC ??? Accelerometer
0xE0 0x134 ??? ???
0x218 0x06 ??? Programmable Infrared Transmitter (PIT)
0x220 0x214 ??? 3D filters
0x440 0x20 ??? Power saving mode
0x470 0x20 ??? ???
0x4A0 0x38 ??? ???
0x4E0 0x18 ??? Circle pad extra
0x500 0xC ??? ???
0x510 0x20 ??? ???
0x540 0x08 ??? MCU
0x550 0x02 ??? 3D screen (ULCD) delay
0x560 0x08 ??? Microphone echo cancellation
0x570 0x10C ??? Power saving mode (ABL) extra
0x680 0x08 ??? CStick (Right stick)
0x690 0x18 ??? Quad Tracking Module (QTM)

Data block formats

Touch

Offset Description
0x00 s16 RawX0
0x02 s16 RawY0
0x04 s16 PointX0
0x06 s16 PointY0
0x08 s16 RawX1
0x0A s16 RawY1
0x0C s16 PointX1
0x0E s16 PointY1

Circle pad

Offset Description
0x00 s16 CenterX
0x02 s16 CenterY

Screen flicker

Offset Description
0 u8 FlickerTop
1 u8 FlickerBottom
2* Checksum low byte, NOT THIS[0]
3* Checksum high byte, THIS[1]

Camera position

Offset Description
0x00 u32 flags
0x04 float scale
0x08 float RotationZ
0x0C float TranslationX
0x10 float TranslationY
0x14 float RotationX
0x18 float RotationY
0x1C float ViewAngleRight
0x20 float ViewAngleLeft
0x24 float ChartDistance(???)
0x28 float CameraDistance
0x2C s16 ImageWidth
0x2E s16 ImageHeight
0x30 u8 reserved[0x10]
0x40 u8 ???[0x40]
0x80 s16 aeBaseTarget(???)
0x82 s16 kRL
0x84 s16 kGL
0x86 s16 kBL
0x88 s16 ccmPosition

Accel

Offset Description
0x00 s16 OffsetX
0x02 s16 ScaleX
0x04 s16 OffsetY
0x06 s16 ScaleY
0x08 s16 OffsetZ
0x0A s16 ScaleZ

3D filters

Offset Description
0x00 u16 SpecialFilter[0x100]
0x200 u32 IIRSurroundFilter[5]

ABL

Offset Description
0x00 u32 DitherPattern
0x04 s16 StartX
0x06 s16 StartY
0x08 u16 SizeX
0x0A u16 SizeY
0x0C s16 GTH_Ratio
0x0E u8 DitherMode
0x0F u8 MinRS
0x10 u8 MaxRS
0x11 u8 MinGTH
0x12 u8 MinMax (???)
0x13 u8 ExMax (???)
0x14 u8 inertia
0x15 u8 LutListRS[9]
0x1E u8 reserved[2]

Circle pad extra

Offset Description
0x00 float ScaleX
0x04 float ScaleY
0x08 s16 MaxX
0x0A s16 MinX
0x0C s16 MaxY
0x0E s16 MinY
0x10 s16 type
0x12 u8 unknown_padding[6]

MCU

Offset Description
0x00 s16 SVR2_Min (???)
0x02 s16 SVR2_Max (???)
0x04 s16 VolumeSliderMin
0x06 s16 VolumeSliderMax

ULCD delay

Offset Description
0x00 u8 To2D
0x01 u8 To3D

Microphone echo cancel

Offset Description
0x00 s8 params[8]

ABL extra

Offset Description
0x00 u8 MaxInertia
0x01 u8 pad
0x02 u16 PWM_CNT_EX
0x04 u32 Histogram1
0x08 u32 Histogram2
0x0C u32 adjust[0x40]

CStick

Offset Description
0x00 u8 ThinningCountX(???)
0x01 u8 ThinningCountY(???)
0x02 u16 reserved[3]

Reading

If 0x1FF81006 is 3 or 4 or 7 or 8 or 9 then the callibration data is read from the EEPROM using the i2c:EEP service command 0x001000C0, using offset 0x000 for HWCAL0, and offset 0x800 for HWCAL1. Otherwise attempt is made to read CTRNAND:/ro/sys/HWCAL(0|1).dat instead.