# Input and peripherals Source: GBATEK's 3DS sections named per row (DOC unless marked). Under the recommended HLE of the OS (firmware-and-keys.md), games reach every device below through a Horizon service (hid, ir, mcu, cam, nfc, ...), so the HLE answers at the service; the register-level models are for homebrew, for the LLE path, and for the services' own implementation. ## Buttons, touch, pads | Input | Path | Notes | | --- | --- | --- | | A, B, X, Y, L, R, Select, Start, D-pad | **HID_PAD** at 10146000h, active-low, 12 bits; HID_PAD_IRQ with OR/AND condition (interrupt 5Bh) | GBATEK "HID Registers" | | Touchscreen | the TSC (TI codec, the DSi's successor) on SPI bus 1 in 3DS mode (bus 0 in DSi mode); pen-down on GPIO (interrupt 63h) | calibration in HWCAL files (console data, player's) and Wi-Fi flash for DS modes | | Circle Pad | the same TSC, extra register pages 64h/65h/67h/FBh | GBATEK "3DS TSC, Register Summary" | | HOME, POWER, Wi-Fi switch (older units), volume and 3D sliders | the **MCU** (I2C bus 1, device 4Ah) | interrupts through GPIO (71h) | | Accelerometer and pedometer | the MCU (registers 40h-51h), the sensor on the MCU's own I2C bus | | | Gyroscope | I2C bus 2: InvenSense ITG-3270 at D0h (Old 3DS), ITG-1010 at D2h (New 3DS); interrupt 6Ah | two machine rows; GBATEK lists both register maps | | C-stick, ZL, ZR (New 3DS) | I2C bus 2 device 54h; interrupt 68h | GBATEK "3DS I2C New3DS C-Stick and ZL/ZR-Buttons" | | Circle Pad Pro (Old 3DS) | over the IrDA port (I2C bus 2 device 9Ah) | an accessory; late | | Shell open/close, headphones | GPIO (60h/62h, 64h) | | Input timing (when a press becomes visible) is the board's: HID_PAD is sampled when read, so a host supplies input per frame and the register reflects it at once (HYPOTHESIS that no debounce is visible). ## The MCU A Renesas RL78 microcontroller with **its own firmware** (Nintendo's; GBATEK documents the RL78's opcodes and SFRs because the MCU firmware can be reprogrammed over UART). It owns power, the LEDs, the RTC, the accelerometer, the battery gauge and several buttons. **Proposal (decision N7): a functional model of its I2C register file** (GBATEK "3DS I2C MCU Register Summary" and the per-range sections), not an RL78 core running firmware we will not hold. That is the functional modelling level for firmware, as the charter allows; if an RL78 core is ever wanted, the CPU rule gives it its own repository. ## Cameras Three Aptina-type sensors as on the DSi (an inner camera and the two outer stereo cameras) configured over I2C (buses 0 and 1), delivering YUV422 through CAM0/CAM1 (10120000h/10121000h, FIFOs at 10320000h/10321000h), usually through Y2R to RGBA (GBATEK "3DS Video CAM Registers"). **Proposal**: a socket that delivers still images or a host camera feed; the sensor's I2C register file modelled functionally for what the camera service programs (GBATEK points to "DSi Cameras"). The New 3DS's QTM (head tracking: an I2C IO expander at 0:40h and the extra 4 MB memory) is later still. ## Storage - eMMC (NAND) and SD on the SDMMC controllers (ARM9 side); under HLE, the fs service reads the player's files; under LLE, the player's NAND image and an SD image (never ours). - Game cards: CTRCARD (3DS mode, encrypted protocol) and NTRCARD (DS mode) on the ARM9; card save memory on SPI_CARD. Under HLE the decrypted image is mounted directly; the card protocol is LLE-only and needs the player's keys (decision K2). ## Wireless and the rest (late) - **Wi-Fi**: an Atheros module on SDIO (10122000h) running its own Xtensa firmware (GBATEK "3DS Files - Module NWM (Wifi Driver)": the ARM11 driver carries Xtensa datablocks). Late, functional at the service level (ac, soc, uds) if ever. - **NFC** (New 3DS, I2C 1:EEh; Old 3DS through the NFC adapter on IR), **IrDA**, StreetPass, the camera's QTM: late; each a socket. - **Sound out**: CSND channels and the DSP's BTDMP output through the TSC/codec; the microphone at 10162000h (MIC). The codec's analogue path is out of scope. - **LCDs**: two screen controllers on I2C bus 1 (2Ch, 2Eh), backlights through the MCU, the parallax barrier (3D) state; pictures come from the framebuffers (gpu-pica200.md).