Update BDK to hekate v6.5.5
Replaces the old vendored BDK with the one from hekate v6.5.5 (CTCaer's 2025/2026 refactors: sdmmc, SE, minerva v1.6, display, heap, return value homogenisation). OmniNX additions re-applied on top: bq24193_charger_connected() and jc_clear_input(); s_vprintf now ships with the BDK. Ported to the new API: - sd_mount(), sdmmc_storage_* and ini_parse() now return 0 on success. The installer checked ini_parse() != 1, which would have made it miss manifest.ini and run every install as a clean install. - SD helpers come from bdk/storage/sd.c (source/nx_sd.* removed), ffsystem.c from the BDK, diskio.c/ffconf.h from hekate (ffconf keeps the sd:/ volume prefix). - minerva_init() needs the minerva storage; the installer still drops to 800 MHz afterwards. - Payload launch follows hekate (sd_file_read, hw_deinit); coreboot path removed upstream. - Stack moved to 0x96000000: the old 0x83100000 is inside the new heap. - GUI/USB/compression parts of the BDK are not built.
This commit is contained in:
1 parent
14be4646d0
commit
1b4a81239b
328 files changed
+108294
-42230
No files matched your search
+184
-176
@@ -1,176 +1,184 @@
|
||||
/*
|
||||
* Touch driver for Nintendo Switch's STM FingerTip S (4CD60D) touch controller
|
||||
*
|
||||
* Copyright (c) 2018 langerhans
|
||||
* Copyright (c) 2018-2020 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __TOUCH_H_
|
||||
#define __TOUCH_H_
|
||||
|
||||
#include <utils/types.h>
|
||||
|
||||
#define STMFTS_I2C_ADDR 0x49
|
||||
|
||||
/* I2C commands */
|
||||
#define STMFTS_READ_INFO 0x80
|
||||
#define STMFTS_READ_STATUS 0x84
|
||||
#define STMFTS_READ_ONE_EVENT 0x85
|
||||
#define STMFTS_READ_ALL_EVENT 0x86
|
||||
#define STMFTS_LATEST_EVENT 0x87
|
||||
#define STMFTS_SLEEP_IN 0x90
|
||||
#define STMFTS_SLEEP_OUT 0x91
|
||||
#define STMFTS_MS_MT_SENSE_OFF 0x92
|
||||
#define STMFTS_MS_MT_SENSE_ON 0x93
|
||||
#define STMFTS_SS_HOVER_SENSE_OFF 0x94
|
||||
#define STMFTS_SS_HOVER_SENSE_ON 0x95
|
||||
#define STMFTS_LP_TIMER_CALIB 0x97
|
||||
#define STMFTS_MS_KEY_SENSE_OFF 0x9A
|
||||
#define STMFTS_MS_KEY_SENSE_ON 0x9B
|
||||
#define STMFTS_SYSTEM_RESET 0xA0
|
||||
#define STMFTS_CLEAR_EVENT_STACK 0xA1
|
||||
#define STMFTS_FULL_FORCE_CALIBRATION 0xA2
|
||||
#define STMFTS_MS_CX_TUNING 0xA3
|
||||
#define STMFTS_SS_CX_TUNING 0xA4
|
||||
#define STMFTS_ITO_CHECK 0xA7
|
||||
#define STMFTS_RELEASEINFO 0xAA
|
||||
#define STMFTS_WRITE_REG 0xB6
|
||||
#define STMFTS_SWITCH_SENSE_MODE 0xC3
|
||||
#define STMFTS_NOISE_WRITE 0xC7
|
||||
#define STMFTS_NOISE_READ 0xC8
|
||||
#define STMFTS_RW_FRAMEBUFFER_REG 0xD0
|
||||
#define STMFTS_SAVE_CX_TUNING 0xFC
|
||||
|
||||
#define STMFTS_DETECTION_CONFIG 0xB0
|
||||
#define STMFTS_REQU_COMP_DATA 0xB8
|
||||
#define STMFTS_VENDOR 0xCF
|
||||
#define STMFTS_FLASH_UNLOCK 0xF7
|
||||
#define STMFTS_FLASH_WRITE_64K 0xF8
|
||||
#define STMFTS_FLASH_STATUS 0xF9
|
||||
#define STMFTS_FLASH_OP 0xFA
|
||||
#define STMFTS_UNK5 0x62
|
||||
|
||||
/* cmd parameters */
|
||||
#define STMFTS_VENDOR_GPIO_STATE 0x01
|
||||
#define STMFTS_VENDOR_SENSE_MODE 0x02
|
||||
#define STMFTS_STYLUS_MODE 0x00
|
||||
#define STMFTS_FINGER_MODE 0x01
|
||||
#define STMFTS_HOVER_MODE 0x02
|
||||
|
||||
/* events */
|
||||
#define STMFTS_EV_NO_EVENT 0x00
|
||||
#define STMFTS_EV_MULTI_TOUCH_DETECTED 0x02
|
||||
#define STMFTS_EV_MULTI_TOUCH_ENTER 0x03
|
||||
#define STMFTS_EV_MULTI_TOUCH_LEAVE 0x04
|
||||
#define STMFTS_EV_MULTI_TOUCH_MOTION 0x05
|
||||
#define STMFTS_EV_HOVER_ENTER 0x07
|
||||
#define STMFTS_EV_HOVER_LEAVE 0x08
|
||||
#define STMFTS_EV_HOVER_MOTION 0x09
|
||||
#define STMFTS_EV_KEY_STATUS 0x0e
|
||||
#define STMFTS_EV_ERROR 0x0f
|
||||
#define STMFTS_EV_NOISE_READ 0x17
|
||||
#define STMFTS_EV_NOISE_WRITE 0x18
|
||||
#define STMFTS_EV_VENDOR 0x20
|
||||
|
||||
#define STMFTS_EV_CONTROLLER_READY 0x10
|
||||
#define STMFTS_EV_STATUS 0x16
|
||||
#define STMFTS_EV_DEBUG 0xDB
|
||||
|
||||
#define STMFTS_EV_STATUS_MS_CX_TUNING_DONE 1
|
||||
#define STMFTS_EV_STATUS_SS_CX_TUNING_DONE 2
|
||||
#define STMFTS_EV_STATUS_WRITE_CX_TUNE_DONE 4
|
||||
|
||||
/* multi touch related event masks */
|
||||
#define STMFTS_MASK_EVENT_ID 0x0F
|
||||
#define STMFTS_MASK_TOUCH_ID 0xF0
|
||||
#define STMFTS_MASK_LEFT_EVENT 0x0F
|
||||
#define STMFTS_MASK_X_MSB 0x0F
|
||||
#define STMFTS_MASK_Y_LSB 0xF0
|
||||
|
||||
/* key related event masks */
|
||||
#define STMFTS_MASK_KEY_NO_TOUCH 0x00
|
||||
#define STMFTS_MASK_KEY_MENU 0x01
|
||||
#define STMFTS_MASK_KEY_BACK 0x02
|
||||
|
||||
#define STMFTS_EVENT_SIZE 8
|
||||
#define STMFTS_STACK_DEPTH 32
|
||||
#define STMFTS_DATA_MAX_SIZE (STMFTS_EVENT_SIZE * STMFTS_STACK_DEPTH)
|
||||
#define STMFTS_MAX_FINGERS 10
|
||||
|
||||
typedef enum _touch_ito_error {
|
||||
ITO_NO_ERROR = 0,
|
||||
ITO_FORCE_OPEN,
|
||||
ITO_SENSE_OPEN,
|
||||
ITO_FORCE_SHRT_GND,
|
||||
ITO_SENSE_SHRT_GND,
|
||||
ITO_FORCE_SHRT_VCM,
|
||||
ITO_SENSE_SHRT_VCM,
|
||||
ITO_FORCE_SHRT_FORCE,
|
||||
ITO_SENSE_SHRT_SENSE,
|
||||
ITO_F2E_SENSE,
|
||||
ITO_FPC_FORCE_OPEN,
|
||||
ITO_FPC_SENSE_OPEN,
|
||||
ITO_KEY_FORCE_OPEN,
|
||||
ITO_KEY_SENSE_OPEN,
|
||||
ITO_RESERVED0,
|
||||
ITO_RESERVED1,
|
||||
ITO_RESERVED2,
|
||||
ITO_MAX_ERR_REACHED = 0xFF
|
||||
} touch_ito_error;
|
||||
|
||||
typedef struct _touch_event {
|
||||
u8 raw[8];
|
||||
u16 type; // Event type.
|
||||
u16 x; // Horizontal coordinates.
|
||||
u16 y; // Vertical coordinates.
|
||||
u32 z;
|
||||
u8 fingers;
|
||||
bool touch;
|
||||
} touch_event;
|
||||
|
||||
typedef struct _touch_panel_info_t
|
||||
{
|
||||
u8 idx;
|
||||
u8 gpio0;
|
||||
u8 gpio1;
|
||||
u8 gpio2;
|
||||
char *vendor;
|
||||
} touch_panel_info_t;
|
||||
|
||||
typedef struct _touch_info {
|
||||
u16 chip_id;
|
||||
u16 fw_ver;
|
||||
u16 config_id;
|
||||
u16 config_ver;
|
||||
} touch_info;
|
||||
|
||||
typedef struct _touch_fw_info_t {
|
||||
u32 fw_id;
|
||||
u16 ftb_ver;
|
||||
u16 fw_rev;
|
||||
} touch_fw_info_t;
|
||||
|
||||
void touch_poll(touch_event *event);
|
||||
touch_event touch_poll_wait();
|
||||
touch_panel_info_t *touch_get_panel_vendor();
|
||||
int touch_get_fw_info(touch_fw_info_t *fw);
|
||||
touch_info touch_get_info();
|
||||
int touch_panel_ito_test(u8 *err);
|
||||
int touch_execute_autotune();
|
||||
int touch_sense_enable();
|
||||
int touch_power_on();
|
||||
void touch_power_off();
|
||||
|
||||
#endif /* __TOUCH_H_ */
|
||||
/*
|
||||
* Touch driver for Nintendo Switch's STM FingerTip S (4CD60D) touch controller
|
||||
*
|
||||
* Copyright (c) 2018 langerhans
|
||||
* Copyright (c) 2018-2026 CTCaer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __TOUCH_H_
|
||||
#define __TOUCH_H_
|
||||
|
||||
#include <utils/types.h>
|
||||
|
||||
#define FTS4_I2C_ADDR 0x49
|
||||
|
||||
#define FTS4_I2C_CHIP_ID 0x3670
|
||||
|
||||
/* I2C commands. */
|
||||
#define FTS4_CMD_READ_INFO 0x80
|
||||
#define FTS4_CMD_READ_STATUS 0x84
|
||||
#define FTS4_CMD_READ_ONE_EVENT 0x85
|
||||
#define FTS4_CMD_READ_ALL_EVENT 0x86
|
||||
#define FTS4_CMD_LATEST_EVENT 0x87 // Clears event stack.
|
||||
#define FTS4_CMD_SLEEP_IN 0x90
|
||||
#define FTS4_CMD_SLEEP_OUT 0x91
|
||||
#define FTS4_CMD_MS_MT_SENSE_OFF 0x92
|
||||
#define FTS4_CMD_MS_MT_SENSE_ON 0x93
|
||||
#define FTS4_CMD_SS_HOVER_SENSE_OFF 0x94
|
||||
#define FTS4_CMD_SS_HOVER_SENSE_ON 0x95
|
||||
#define FTS4_CMD_LP_TIMER_CALIB 0x97
|
||||
#define FTS4_CMD_MS_KEY_SENSE_OFF 0x9A
|
||||
#define FTS4_CMD_MS_KEY_SENSE_ON 0x9B
|
||||
#define FTS4_CMD_SYSTEM_RESET 0xA0
|
||||
#define FTS4_CMD_CLEAR_EVENT_STACK 0xA1
|
||||
#define FTS4_CMD_FULL_FORCE_CALIB 0xA2
|
||||
#define FTS4_CMD_MS_CX_TUNING 0xA3
|
||||
#define FTS4_CMD_SS_CX_TUNING 0xA4
|
||||
#define FTS4_CMD_ITO_CHECK 0xA7
|
||||
#define FTS4_CMD_RELEASEINFO 0xAA
|
||||
#define FTS4_CMD_HW_REG_READ 0xB6 // u16be address offset. Any size read.
|
||||
#define FTS4_CMD_HW_REG_WRITE FTS4_CMD_HW_REG_READ // u16be address offset, bytes to write.
|
||||
#define FTS4_CMD_SWITCH_SENSE_MODE 0xC3
|
||||
#define FTS4_CMD_NOISE_WRITE 0xC7
|
||||
#define FTS4_CMD_NOISE_READ 0xC8
|
||||
#define FTS4_CMD_FB_REG_READ 0xD0
|
||||
#define FTS4_CMD_FB_REG_WRITE FTS4_CMD_FB_REG_READ
|
||||
#define FTS4_CMD_SAVE_CX_TUNING 0xFC
|
||||
|
||||
#define FTS4_CMD_DETECTION_CONFIG 0xB0
|
||||
#define FTS4_CMD_REQ_CX_DATA 0xB8
|
||||
#define FTS4_CMD_VENDOR 0xCF
|
||||
#define FTS4_CMD_FLASH_UNLOCK 0xF7
|
||||
#define FTS4_CMD_FLASH_WRITE_64K 0xF8
|
||||
#define FTS4_CMD_FLASH_STATUS 0xF9
|
||||
#define FTS4_CMD_FLASH_OP 0xFA
|
||||
#define FTS4_CMD_UNK_62 0x62
|
||||
|
||||
/* Command parameters. */
|
||||
#define FTS4_VENDOR_GPIO_STATE 0x01
|
||||
#define FTS4_VENDOR_SENSE_MODE 0x02
|
||||
#define FTS4_STYLUS_MODE 0x00
|
||||
#define FTS4_FINGER_MODE 0x01
|
||||
#define FTS4_HOVER_MODE 0x02
|
||||
|
||||
/* HW Registers */
|
||||
#define FTS4_HW_REG_CHIP_ID_INFO 0x0004
|
||||
#define FTS4_HW_REG_EVENT_COUNT 0x0023
|
||||
#define FTS4_HW_REG_SYS_RESET 0x0028
|
||||
|
||||
/* FB Addresses */
|
||||
#define FTS4_FB_REG_FW_INFO_ADDRESS 0x0060
|
||||
|
||||
/* Events. */
|
||||
#define FTS4_EV_NO_EVENT 0x00
|
||||
#define FTS4_EV_MULTI_TOUCH_DETECTED 0x02
|
||||
#define FTS4_EV_MULTI_TOUCH_ENTER 0x03
|
||||
#define FTS4_EV_MULTI_TOUCH_LEAVE 0x04
|
||||
#define FTS4_EV_MULTI_TOUCH_MOTION 0x05
|
||||
#define FTS4_EV_HOVER_ENTER 0x07
|
||||
#define FTS4_EV_HOVER_LEAVE 0x08
|
||||
#define FTS4_EV_HOVER_MOTION 0x09
|
||||
#define FTS4_EV_KEY_STATUS 0x0E
|
||||
#define FTS4_EV_ERROR 0x0F
|
||||
#define FTS4_EV_CONTROLLER_READY 0x10
|
||||
#define FTS4_EV_STATUS 0x16
|
||||
#define FTS4_EV_NOISE_READ 0x17
|
||||
#define FTS4_EV_NOISE_WRITE 0x18
|
||||
#define FTS4_EV_VENDOR 0x20
|
||||
#define FTS4_EV_DEBUG 0xDB
|
||||
|
||||
/* FTS4_EV_STATUS Events. */
|
||||
#define FTS4_EV_STATUS_MS_CX_TUNING_DONE 0x01
|
||||
#define FTS4_EV_STATUS_SS_CX_TUNING_DONE 0x02
|
||||
#define FTS4_EV_STATUS_WRITE_CX_TUNE_DONE 0x04
|
||||
|
||||
#define FTS4_EV_ERROR_ITO_TEST 0x05
|
||||
|
||||
/* Multi touch related event masks. */
|
||||
#define FTS4_MASK_EVENT_ID 0x0F
|
||||
#define FTS4_MASK_TOUCH_ID 0xF0
|
||||
#define FTS4_MASK_X_MSB 0x0F
|
||||
#define FTS4_MASK_Y_LSB 0xF0
|
||||
|
||||
#define FTS4_EVENT_SIZE 8
|
||||
#define FTS4_STACK_DEPTH 32 // Actual 128.
|
||||
#define FTS4_DATA_MAX_SIZE (FTS4_EVENT_SIZE * FTS4_STACK_DEPTH)
|
||||
#define FTS4_MAX_FINGERS 10
|
||||
|
||||
typedef enum _touch_ito_error {
|
||||
ITO_NO_ERROR = 0,
|
||||
ITO_FORCE_OPEN,
|
||||
ITO_SENSE_OPEN,
|
||||
ITO_FORCE_SHRT_GND,
|
||||
ITO_SENSE_SHRT_GND,
|
||||
ITO_FORCE_SHRT_VCM,
|
||||
ITO_SENSE_SHRT_VCM,
|
||||
ITO_FORCE_SHRT_FORCE,
|
||||
ITO_SENSE_SHRT_SENSE,
|
||||
ITO_F2E_SENSE,
|
||||
ITO_FPC_FORCE_OPEN,
|
||||
ITO_FPC_SENSE_OPEN,
|
||||
ITO_KEY_FORCE_OPEN,
|
||||
ITO_KEY_SENSE_OPEN,
|
||||
ITO_RESERVED0,
|
||||
ITO_RESERVED1,
|
||||
ITO_RESERVED2,
|
||||
ITO_MAX_ERR_REACHED = 0xFF
|
||||
} touch_ito_error;
|
||||
|
||||
typedef struct _touch_event_t {
|
||||
u8 raw[FTS4_EVENT_SIZE];
|
||||
u16 x, y; // Coordinates.
|
||||
u32 z; // Orientation.
|
||||
bool touch;
|
||||
int finger;
|
||||
} touch_event_t;
|
||||
|
||||
typedef struct _touch_panel_info_t
|
||||
{
|
||||
u8 idx;
|
||||
u8 gpio0;
|
||||
u8 gpio1;
|
||||
u8 gpio2;
|
||||
char *vendor;
|
||||
} touch_panel_info_t;
|
||||
|
||||
typedef struct _touch_info_t {
|
||||
u16 chip_id;
|
||||
u16 fw_ver;
|
||||
u16 config_id;
|
||||
u16 config_ver;
|
||||
bool clone;
|
||||
} touch_info_t;
|
||||
|
||||
typedef struct _touch_fw_info_t {
|
||||
u32 fw_id;
|
||||
u16 ftb_ver;
|
||||
u16 fw_rev;
|
||||
} touch_fw_info_t;
|
||||
|
||||
int touch_poll(touch_event_t *event);
|
||||
touch_info_t *touch_get_chip_info();
|
||||
touch_panel_info_t *touch_get_panel_vendor();
|
||||
int touch_get_fw_info(touch_fw_info_t *fw);
|
||||
int touch_get_event_count();
|
||||
int touch_panel_ito_test(u8 *err);
|
||||
int touch_execute_autotune();
|
||||
int touch_switch_sense_mode(u8 mode, bool gis_6_2);
|
||||
int touch_sense_enable();
|
||||
int touch_power_on();
|
||||
void touch_power_off();
|
||||
|
||||
#endif /* __TOUCH_H_ */
|
||||
Reference in new issue
Block a user