Hardware calibration

From 3dbrew
Revision as of 01:42, 24 September 2017 by MarcusD (talk | contribs) (Created page with "=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 heade...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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 Description
0x30 0x8C Camera position
0x218 0x06 Programmable Interrupt Timer??? (PIT)
0x540 0x0A MCU
0x550 0x04 3D screen (ULCD) delay
0x560 0x0A Microphone echo cancelation
0x570 0x10E Power saving mode (ABL) extra
0x680 0x0A CStick (Right stick)
0x690 0x1A Q Tracking Module (QTM)

Data block formats

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

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.