Compare commits

..

No commits in common. "3250b2e32a4203bfdcce8b04f621eeb94f93a878" and "5c39d04ca284d28b5590c23ac82c171b4fbf1c92" have entirely different histories.

60 changed files with 238 additions and 324 deletions

View file

@ -106,7 +106,7 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
| emupath={FOLDER path} | Forces emuMMC to use the selected one. (=emuMMC/RAW1, =emuMMC/SD00, etc). emuMMC must be created by hekate because it uses the raw_based/file_based files. | | emupath={FOLDER path} | Forces emuMMC to use the selected one. (=emuMMC/RAW1, =emuMMC/SD00, etc). emuMMC must be created by hekate because it uses the raw_based/file_based files. |
| emummcforce=1 | Forces the use of emuMMC. If emummc.ini is disabled or not found, then it causes an error. | | emummcforce=1 | Forces the use of emuMMC. If emummc.ini is disabled or not found, then it causes an error. |
| emummc_force_disable=1 | Disables emuMMC, if it's enabled. | | emummc_force_disable=1 | Disables emuMMC, if it's enabled. |
| stock=1 | OFW via hekate bootloader. Disables unneeded kernel patching and CFW kips when running stock. `If emuMMC is enabled, emummc_force_disable=1` is required. emuMMC is not supported on stock. If additional KIPs are needed other than OFW's, you can define them with `kip1` key. No kip should be used that relies on Atmosphère patching, because it will hang. If `NOGC` is needed, use `kip1patch=nogc`. | | stock=1 | Disables unneeded kernel patching and CFW kips when running stock or semi-stock. `If emuMMC is enabled, emummc_force_disable=1` is required. emuMMC is not supported on stock. If additional KIPs are needed other than OFW's, you can define them with `kip1` key. No kip should be used that relies on Atmosphère patching, because it will hang. If `NOGC` is needed, use `kip1patch=nogc`. |
| fullsvcperm=1 | Disables SVC verification (full services permission). Doesn't work with Mesosphere as kernel. | | fullsvcperm=1 | Disables SVC verification (full services permission). Doesn't work with Mesosphere as kernel. |
| debugmode=1 | Enables Debug mode. Obsolete when used with exosphere as secmon. | | debugmode=1 | Enables Debug mode. Obsolete when used with exosphere as secmon. |
| atmosphere=1 | Enables Atmosphère patching. Not needed when `fss0` is used. | | atmosphere=1 | Enables Atmosphère patching. Not needed when `fss0` is used. |

View file

@ -1,11 +1,11 @@
# IPL Version. # IPL Version.
BLVERSION_MAJOR := 6 BLVERSION_MAJOR := 6
BLVERSION_MINOR := 2 BLVERSION_MINOR := 2
BLVERSION_HOTFX := 2 BLVERSION_HOTFX := 1
BLVERSION_REL := 0 BLVERSION_REL := 0
# Nyx Version. # Nyx Version.
NYXVERSION_MAJOR := 1 NYXVERSION_MAJOR := 1
NYXVERSION_MINOR := 6 NYXVERSION_MINOR := 6
NYXVERSION_HOTFX := 4 NYXVERSION_HOTFX := 3
NYXVERSION_REL := 0 NYXVERSION_REL := 0

View file

@ -49,7 +49,6 @@
#include <soc/gpio.h> #include <soc/gpio.h>
#include <soc/hw_init.h> #include <soc/hw_init.h>
#include <soc/i2c.h> #include <soc/i2c.h>
#include <soc/irq.h>
#include <soc/kfuse.h> #include <soc/kfuse.h>
#include <soc/pinmux.h> #include <soc/pinmux.h>
#include <soc/pmc.h> #include <soc/pmc.h>
@ -77,4 +76,4 @@
#include <gfx_utils.h> #include <gfx_utils.h>
#endif #endif

View file

@ -935,7 +935,7 @@ void display_move_framebuffer(u32 window, void *fb)
DISPLAY_A(_DIREG(DC_CMD_DISPLAY_WINDOW_HEADER)) = BIT(WINDOW_SELECT + window); DISPLAY_A(_DIREG(DC_CMD_DISPLAY_WINDOW_HEADER)) = BIT(WINDOW_SELECT + window);
// Get current framebuffer address. // Get current framebuffer address.
const void *fb_curr = (void *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR)); void *fb_curr = (void *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR));
u32 win_size = DISPLAY_A(_DIREG(DC_WIN_PRESCALED_SIZE)); u32 win_size = DISPLAY_A(_DIREG(DC_WIN_PRESCALED_SIZE));
win_size = (win_size & 0x7FFF) * ((win_size >> 16) & 0x1FFF); win_size = (win_size & 0x7FFF) * ((win_size >> 16) & 0x1FFF);

View file

@ -390,7 +390,7 @@ static int _vic_wait_idle()
return 0; return 0;
} }
void vic_set_surface(const vic_surface_t *sfc) void vic_set_surface(vic_surface_t *sfc)
{ {
u32 flip_x = 0; u32 flip_x = 0;
u32 flip_y = 0; u32 flip_y = 0;

View file

@ -58,7 +58,7 @@ typedef struct _vic_surface_t
u32 rotation; u32 rotation;
} vic_surface_t; } vic_surface_t;
void vic_set_surface(const vic_surface_t *sfc); void vic_set_surface(vic_surface_t *sfc);
int vic_compose(); int vic_compose();
int vic_init(); int vic_init();
void vic_end(); void vic_end();

View file

@ -22,6 +22,7 @@
#include <gfx_utils.h> #include <gfx_utils.h>
#include <power/max17050.h> #include <power/max17050.h>
#include <power/regulator_5v.h> #include <power/regulator_5v.h>
#include <soc/bpmp.h>
#include <soc/clock.h> #include <soc/clock.h>
#include <soc/fuse.h> #include <soc/fuse.h>
#include <soc/gpio.h> #include <soc/gpio.h>
@ -222,8 +223,8 @@ typedef struct _jc_hid_in_rpt_t
{ {
u8 cmd; u8 cmd;
u8 pkt_id; u8 pkt_id;
u8 conn_info:4; // Connection detect. u8 conn_info:4;
u8 batt_info:4; // Power info. u8 batt_info:4;
u8 btn_right; u8 btn_right;
u8 btn_shared; u8 btn_shared;
u8 btn_left; u8 btn_left;
@ -316,10 +317,9 @@ typedef struct _joycon_ctxt_t
u8 uart; u8 uart;
u8 type; u8 type;
u8 state; u8 state;
u8 mac[6];
u32 last_received_time; u32 last_received_time;
u32 last_status_req_time; u32 last_status_req_time;
u8 mac[6];
u8 pkt_id;
u8 rumble_sent; u8 rumble_sent;
u8 connected; u8 connected;
u8 detected; u8 detected;
@ -330,10 +330,11 @@ static joycon_ctxt_t jc_l = {0};
static joycon_ctxt_t jc_r = {0}; static joycon_ctxt_t jc_r = {0};
static bool jc_init_done = false; static bool jc_init_done = false;
static u32 hid_pkt_inc = 0;
static jc_gamepad_rpt_t jc_gamepad; static jc_gamepad_rpt_t jc_gamepad;
static u8 _jc_crc(const u8 *data, u16 len, u8 init) static u8 _jc_crc(u8 *data, u16 len, u8 init)
{ {
u8 crc = init; u8 crc = init;
for (u16 i = 0; i < len; i++) for (u16 i = 0; i < len; i++)
@ -447,7 +448,7 @@ static void _jc_conn_check()
if (jc_l.connected) if (jc_l.connected)
_jc_power_supply(UART_C, false); _jc_power_supply(UART_C, false);
jc_l.pkt_id = 0; hid_pkt_inc = 0;
jc_l.connected = false; jc_l.connected = false;
jc_l.rumble_sent = false; jc_l.rumble_sent = false;
@ -464,7 +465,7 @@ static void _jc_conn_check()
if (jc_r.connected) if (jc_r.connected)
_jc_power_supply(UART_B, false); _jc_power_supply(UART_B, false);
jc_r.pkt_id = 0; hid_pkt_inc = 0;
jc_r.connected = false; jc_r.connected = false;
jc_r.rumble_sent = false; jc_r.rumble_sent = false;
@ -483,7 +484,7 @@ static void _joycon_send_raw(u8 uart_port, const u8 *buf, u16 size)
uart_wait_xfer(uart_port, UART_TX_IDLE); uart_wait_xfer(uart_port, UART_TX_IDLE);
} }
static u16 _jc_packet_add_uart_hdr(jc_wired_hdr_t *out, u8 wired_cmd, const u8 *data, u16 size, bool crc) static u16 _jc_packet_add_uart_hdr(jc_wired_hdr_t *out, u8 wired_cmd, u8 *data, u16 size, bool crc)
{ {
out->uart_hdr.magic[0] = 0x19; out->uart_hdr.magic[0] = 0x19;
out->uart_hdr.magic[1] = 0x01; out->uart_hdr.magic[1] = 0x01;
@ -503,7 +504,7 @@ static u16 _jc_packet_add_uart_hdr(jc_wired_hdr_t *out, u8 wired_cmd, const u8 *
return sizeof(jc_wired_hdr_t); return sizeof(jc_wired_hdr_t);
} }
static u16 _jc_hid_output_rpt_craft(jc_wired_hdr_t *rpt, const u8 *payload, u16 size, bool crc) static u16 _jc_hid_output_rpt_craft(jc_wired_hdr_t *rpt, u8 *payload, u16 size, bool crc)
{ {
u16 pkt_size = _jc_packet_add_uart_hdr(rpt, JC_WIRED_HID, NULL, 0, crc); u16 pkt_size = _jc_packet_add_uart_hdr(rpt, JC_WIRED_HID, NULL, 0, crc);
pkt_size += size; pkt_size += size;
@ -518,18 +519,22 @@ static u16 _jc_hid_output_rpt_craft(jc_wired_hdr_t *rpt, const u8 *payload, u16
return pkt_size; return pkt_size;
} }
static void _jc_send_hid_output_rpt(joycon_ctxt_t *jc, jc_hid_out_rpt_t *hid_pkt, u16 size, bool crc) static void _jc_send_hid_output_rpt(u8 uart, u8 *payload, u16 size, bool crc)
{ {
u8 rpt[0x50]; u8 rpt[0x50];
memset(rpt, 0, sizeof(rpt)); memset(rpt, 0, sizeof(rpt));
hid_pkt->pkt_id = (jc->pkt_id++ & 0xF); u32 rpt_size = _jc_hid_output_rpt_craft((jc_wired_hdr_t *)rpt, payload, size, crc);
u32 rpt_size = _jc_hid_output_rpt_craft((jc_wired_hdr_t *)rpt, (u8 *)hid_pkt, size, crc);
_joycon_send_raw(jc->uart, rpt, rpt_size); _joycon_send_raw(uart, rpt, rpt_size);
} }
static void _jc_send_hid_cmd(joycon_ctxt_t *jc, u8 subcmd, const u8 *data, u16 size) static u8 _jc_hid_pkt_id_incr()
{
return (hid_pkt_inc++ & 0xF);
}
static void _jc_send_hid_cmd(u8 uart, u8 subcmd, u8 *data, u16 size)
{ {
static const u8 rumble_neutral[8] = { 0x00, 0x01, 0x40, 0x40, 0x00, 0x01, 0x40, 0x40 }; static const u8 rumble_neutral[8] = { 0x00, 0x01, 0x40, 0x40, 0x00, 0x01, 0x40, 0x40 };
static const u8 rumble_init[8] = { 0xc2, 0xc8, 0x03, 0x72, 0xc2, 0xc8, 0x03, 0x72 }; static const u8 rumble_init[8] = { 0xc2, 0xc8, 0x03, 0x72, 0xc2, 0xc8, 0x03, 0x72 };
@ -546,43 +551,47 @@ static void _jc_send_hid_cmd(joycon_ctxt_t *jc, u8 subcmd, const u8 *data, u16 s
// Enable rumble. // Enable rumble.
hid_pkt->cmd = JC_HID_OUTPUT_RPT; hid_pkt->cmd = JC_HID_OUTPUT_RPT;
hid_pkt->pkt_id = _jc_hid_pkt_id_incr();
hid_pkt->subcmd = JC_HID_SUBCMD_RUMBLE_CTL; hid_pkt->subcmd = JC_HID_SUBCMD_RUMBLE_CTL;
hid_pkt->subcmd_data[0] = 1; hid_pkt->subcmd_data[0] = 1;
if (send_r_rumble) if (send_r_rumble)
_jc_send_hid_output_rpt(&jc_r, hid_pkt, 0x10, false); _jc_send_hid_output_rpt(UART_B, (u8 *)hid_pkt, 0x10, false);
if (send_l_rumble) if (send_l_rumble)
_jc_send_hid_output_rpt(&jc_l, hid_pkt, 0x10, false); _jc_send_hid_output_rpt(UART_C, (u8 *)hid_pkt, 0x10, false);
// Send rumble. // Send rumble.
hid_pkt->cmd = JC_HID_RUMBLE_RPT; hid_pkt->cmd = JC_HID_RUMBLE_RPT;
hid_pkt->pkt_id = _jc_hid_pkt_id_incr();
memcpy(hid_pkt->rumble, rumble_init, sizeof(rumble_init)); memcpy(hid_pkt->rumble, rumble_init, sizeof(rumble_init));
if (send_r_rumble) if (send_r_rumble)
_jc_send_hid_output_rpt(&jc_r, hid_pkt, 10, false); _jc_send_hid_output_rpt(UART_B, (u8 *)hid_pkt, 10, false);
if (send_l_rumble) if (send_l_rumble)
_jc_send_hid_output_rpt(&jc_l, hid_pkt, 10, false); _jc_send_hid_output_rpt(UART_C, (u8 *)hid_pkt, 10, false);
msleep(15); msleep(15);
// Disable rumble. // Disable rumble.
hid_pkt->cmd = JC_HID_OUTPUT_RPT; hid_pkt->cmd = JC_HID_OUTPUT_RPT;
hid_pkt->pkt_id = _jc_hid_pkt_id_incr();
hid_pkt->subcmd = JC_HID_SUBCMD_RUMBLE_CTL; hid_pkt->subcmd = JC_HID_SUBCMD_RUMBLE_CTL;
hid_pkt->subcmd_data[0] = 0; hid_pkt->subcmd_data[0] = 0;
memcpy(hid_pkt->rumble, rumble_neutral, sizeof(rumble_neutral)); memcpy(hid_pkt->rumble, rumble_neutral, sizeof(rumble_neutral));
if (send_r_rumble) if (send_r_rumble)
_jc_send_hid_output_rpt(&jc_r, hid_pkt, 0x10, false); _jc_send_hid_output_rpt(UART_B, (u8 *)hid_pkt, 0x10, false);
if (send_l_rumble) if (send_l_rumble)
_jc_send_hid_output_rpt(&jc_l, hid_pkt, 0x10, false); _jc_send_hid_output_rpt(UART_C, (u8 *)hid_pkt, 0x10, false);
} }
else else
{ {
bool crc_needed = jc->type & JC_ID_HORI; bool crc_needed = (jc_l.uart == uart) ? (jc_l.type & JC_ID_HORI) : (jc_r.type & JC_ID_HORI);
hid_pkt->cmd = JC_HID_OUTPUT_RPT; hid_pkt->cmd = JC_HID_OUTPUT_RPT;
hid_pkt->pkt_id = _jc_hid_pkt_id_incr();
hid_pkt->subcmd = subcmd; hid_pkt->subcmd = subcmd;
if (data) if (data)
memcpy(hid_pkt->subcmd_data, data, size); memcpy(hid_pkt->subcmd_data, data, size);
_jc_send_hid_output_rpt(jc, hid_pkt, sizeof(jc_hid_out_rpt_t) + size, crc_needed); _jc_send_hid_output_rpt(uart, (u8 *)hid_pkt, sizeof(jc_hid_out_rpt_t) + size, crc_needed);
} }
} }
@ -814,7 +823,7 @@ static bool _jc_send_init_rumble(joycon_ctxt_t *jc)
// Send init rumble or request nx pad status report. // Send init rumble or request nx pad status report.
if ((jc_r.connected && !jc_r.rumble_sent) || (jc_l.connected && !jc_l.rumble_sent)) if ((jc_r.connected && !jc_r.rumble_sent) || (jc_l.connected && !jc_l.rumble_sent))
{ {
_jc_send_hid_cmd(jc, JC_HID_SUBCMD_SND_RUMBLE, NULL, 0); _jc_send_hid_cmd(jc->uart, JC_HID_SUBCMD_SND_RUMBLE, NULL, 0);
if (jc_l.connected) if (jc_l.connected)
jc_l.rumble_sent = true; jc_l.rumble_sent = true;
@ -855,7 +864,7 @@ static void _jc_req_nx_pad_status(joycon_ctxt_t *jc)
jc->last_status_req_time = get_tmr_ms() + (!jc->sio_mode ? 15 : 7); jc->last_status_req_time = get_tmr_ms() + (!jc->sio_mode ? 15 : 7);
} }
static bool _jc_validate_pairing_info(const u8 *buf, bool *is_hos) static bool _jc_validate_pairing_info(u8 *buf, bool *is_hos)
{ {
u8 crc = 0; u8 crc = 0;
for (u32 i = 0; i < 0x22; i++) for (u32 i = 0; i < 0x22; i++)
@ -924,13 +933,13 @@ retry:
{ {
if (!jc_l_found) if (!jc_l_found)
{ {
_jc_send_hid_cmd(&jc_l, JC_HID_SUBCMD_SPI_READ, (u8 *)&subcmd_data_l, 5); _jc_send_hid_cmd(jc_l.uart, JC_HID_SUBCMD_SPI_READ, (u8 *)&subcmd_data_l, 5);
jc_l.last_status_req_time = get_tmr_ms() + 15; jc_l.last_status_req_time = get_tmr_ms() + 15;
} }
if (!jc_r_found) if (!jc_r_found)
{ {
_jc_send_hid_cmd(&jc_r, JC_HID_SUBCMD_SPI_READ, (u8 *)&subcmd_data_r, 5); _jc_send_hid_cmd(jc_r.uart, JC_HID_SUBCMD_SPI_READ, (u8 *)&subcmd_data_r, 5);
jc_r.last_status_req_time = get_tmr_ms() + 15; jc_r.last_status_req_time = get_tmr_ms() + 15;
} }
@ -1121,7 +1130,7 @@ static void _jc_init_conn(joycon_ctxt_t *jc)
// Initialize the controller. // Initialize the controller.
u32 retries = 10; u32 retries = 10;
while (!jc->connected && retries) while (!jc->connected)
{ {
_joycon_send_raw(jc->uart, sio_init, sizeof(sio_init)); _joycon_send_raw(jc->uart, sio_init, sizeof(sio_init));
msleep(5); msleep(5);
@ -1230,12 +1239,12 @@ void jc_deinit()
u8 data = HCI_STATE_SLEEP; u8 data = HCI_STATE_SLEEP;
if (jc_r.connected && !(jc_r.type & JC_ID_HORI)) if (jc_r.connected && !(jc_r.type & JC_ID_HORI))
{ {
_jc_send_hid_cmd(&jc_r, JC_HID_SUBCMD_HCI_STATE, &data, 1); _jc_send_hid_cmd(UART_B, JC_HID_SUBCMD_HCI_STATE, &data, 1);
_jc_rcv_pkt(&jc_r); _jc_rcv_pkt(&jc_r);
} }
if (jc_l.connected && !(jc_l.type & JC_ID_HORI)) if (jc_l.connected && !(jc_l.type & JC_ID_HORI))
{ {
_jc_send_hid_cmd(&jc_l, JC_HID_SUBCMD_HCI_STATE, &data, 1); _jc_send_hid_cmd(UART_C, JC_HID_SUBCMD_HCI_STATE, &data, 1);
_jc_rcv_pkt(&jc_l); _jc_rcv_pkt(&jc_l);
} }
} }

View file

@ -38,7 +38,7 @@ typedef struct
bool emc_2X_clk_src_is_pllmb; bool emc_2X_clk_src_is_pllmb;
bool fsp_for_src_freq; bool fsp_for_src_freq;
bool train_ram_patterns; bool train_ram_patterns;
u32 init_done; bool init_done;
} mtc_config_t; } mtc_config_t;
enum train_mode_t enum train_mode_t

View file

@ -75,7 +75,7 @@ void bm92t36_get_sink_info(bool *inserted, usb_pd_objects_t *usb_pd)
{ {
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
_bm92t36_read_reg(buf, 2, STATUS1_REG); _bm92t36_read_reg(buf, 2, STATUS1_REG);
*inserted = (buf[0] & STATUS1_INSERT) ? true : false; *inserted = buf[0] & STATUS1_INSERT ? true : false;
} }
if (usb_pd) if (usb_pd)

View file

@ -194,7 +194,7 @@ static int _se_execute_one_block(u32 op, void *dst, u32 dst_size, const void *sr
return res; return res;
} }
static void _se_aes_ctr_set(const void *ctr) static void _se_aes_ctr_set(void *ctr)
{ {
u32 data[SE_AES_IV_SIZE / 4]; u32 data[SE_AES_IV_SIZE / 4];
memcpy(data, ctr, SE_AES_IV_SIZE); memcpy(data, ctr, SE_AES_IV_SIZE);
@ -226,7 +226,7 @@ u32 se_key_acc_ctrl_get(u32 ks)
return SE(SE_CRYPTO_KEYTABLE_ACCESS_REG + 4 * ks); return SE(SE_CRYPTO_KEYTABLE_ACCESS_REG + 4 * ks);
} }
void se_aes_key_set(u32 ks, const void *key, u32 size) void se_aes_key_set(u32 ks, void *key, u32 size)
{ {
u32 data[SE_AES_MAX_KEY_SIZE / 4]; u32 data[SE_AES_MAX_KEY_SIZE / 4];
memcpy(data, key, size); memcpy(data, key, size);
@ -238,7 +238,7 @@ void se_aes_key_set(u32 ks, const void *key, u32 size)
} }
} }
void se_aes_iv_set(u32 ks, const void *iv) void se_aes_iv_set(u32 ks, void *iv)
{ {
u32 data[SE_AES_IV_SIZE / 4]; u32 data[SE_AES_IV_SIZE / 4];
memcpy(data, iv, SE_AES_IV_SIZE); memcpy(data, iv, SE_AES_IV_SIZE);

View file

@ -25,8 +25,8 @@ void se_rsa_acc_ctrl(u32 rs, u32 flags);
void se_key_acc_ctrl(u32 ks, u32 flags); void se_key_acc_ctrl(u32 ks, u32 flags);
u32 se_key_acc_ctrl_get(u32 ks); u32 se_key_acc_ctrl_get(u32 ks);
void se_get_aes_keys(u8 *buf, u8 *keys, u32 keysize); void se_get_aes_keys(u8 *buf, u8 *keys, u32 keysize);
void se_aes_key_set(u32 ks, const void *key, u32 size); void se_aes_key_set(u32 ks, void *key, u32 size);
void se_aes_iv_set(u32 ks, const void *iv); void se_aes_iv_set(u32 ks, void *iv);
void se_aes_key_get(u32 ks, void *key, u32 size); void se_aes_key_get(u32 ks, void *key, u32 size);
void se_aes_key_clear(u32 ks); void se_aes_key_clear(u32 ks);
void se_aes_iv_clear(u32 ks); void se_aes_iv_clear(u32 ks);

View file

@ -237,7 +237,6 @@ void bpmp_clk_rate_relaxed(bool enable)
// APB clock affects RTC, PWM, MEMFETCH, APE, USB, SOR PWM, // APB clock affects RTC, PWM, MEMFETCH, APE, USB, SOR PWM,
// I2C host, DC/DSI/DISP. UART gives extra stress. // I2C host, DC/DSI/DISP. UART gives extra stress.
// 92: 100% success ratio. 93-94: 595-602MHz has 99% success ratio. 95: 608MHz less. // 92: 100% success ratio. 93-94: 595-602MHz has 99% success ratio. 95: 608MHz less.
// APB clock max is supposed to be 204 MHz though.
static const u8 pll_divn[] = { static const u8 pll_divn[] = {
0, // BPMP_CLK_NORMAL: 408MHz 0% - 136MHz APB. 0, // BPMP_CLK_NORMAL: 408MHz 0% - 136MHz APB.
85, // BPMP_CLK_HIGH_BOOST: 544MHz 33% - 136MHz APB. 85, // BPMP_CLK_HIGH_BOOST: 544MHz 33% - 136MHz APB.
@ -301,13 +300,6 @@ void bpmp_clk_rate_set(bpmp_freq_t fid)
} }
} }
// State is reset to RUN on any clock or source set via SW.
void bpmp_state_set(bpmp_state_t state)
{
u32 cfg = CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) & ~0xF0000000u;
CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) = cfg | (state << 28u);
}
// The following functions halt BPMP to reduce power while sleeping. // The following functions halt BPMP to reduce power while sleeping.
// They are not as accurate as RTC at big values but they guarantee time+ delay. // They are not as accurate as RTC at big values but they guarantee time+ delay.
void bpmp_usleep(u32 us) void bpmp_usleep(u32 us)

View file

@ -54,16 +54,6 @@ typedef enum
BPMP_CLK_MAX BPMP_CLK_MAX
} bpmp_freq_t; } bpmp_freq_t;
typedef enum
{
BPMP_STATE_STANDBY = 0, // 32KHz.
BPMP_STATE_IDLE = 1,
BPMP_STATE_RUN = 2,
BPMP_STATE_IRQ = BIT(2),
BPMP_STATE_FIQ = BIT(3),
} bpmp_state_t;
#define BPMP_CLK_LOWEST_BOOST BPMP_CLK_HIGH2_BOOST #define BPMP_CLK_LOWEST_BOOST BPMP_CLK_HIGH2_BOOST
#define BPMP_CLK_LOWER_BOOST BPMP_CLK_SUPER_BOOST #define BPMP_CLK_LOWER_BOOST BPMP_CLK_SUPER_BOOST
#define BPMP_CLK_DEFAULT_BOOST BPMP_CLK_HYPER_BOOST #define BPMP_CLK_DEFAULT_BOOST BPMP_CLK_HYPER_BOOST
@ -75,7 +65,6 @@ void bpmp_mmu_disable();
void bpmp_clk_rate_relaxed(bool enable); void bpmp_clk_rate_relaxed(bool enable);
void bpmp_clk_rate_get(); void bpmp_clk_rate_get();
void bpmp_clk_rate_set(bpmp_freq_t fid); void bpmp_clk_rate_set(bpmp_freq_t fid);
void bpmp_state_set(bpmp_state_t state);
void bpmp_usleep(u32 us); void bpmp_usleep(u32 us);
void bpmp_msleep(u32 ms); void bpmp_msleep(u32 ms);
void bpmp_halt(); void bpmp_halt();

View file

@ -701,7 +701,7 @@ static void _clock_sdmmc_clear_enable(u32 id)
static void _clock_sdmmc_config_legacy_tm() static void _clock_sdmmc_config_legacy_tm()
{ {
const clk_rst_t *clk = &_clock_sdmmc_legacy_tm; clk_rst_t *clk = &_clock_sdmmc_legacy_tm;
if (!(CLOCK(clk->enable) & BIT(clk->index))) if (!(CLOCK(clk->enable) & BIT(clk->index)))
clock_enable(clk); clock_enable(clk);
} }

View file

@ -150,7 +150,6 @@
#define CLK_RST_CONTROLLER_PLLC_MISC_2 0x5D0 #define CLK_RST_CONTROLLER_PLLC_MISC_2 0x5D0
#define CLK_RST_CONTROLLER_PLLC4_OUT 0x5E4 #define CLK_RST_CONTROLLER_PLLC4_OUT 0x5E4
#define CLK_RST_CONTROLLER_PLLMB_BASE 0x5E8 #define CLK_RST_CONTROLLER_PLLMB_BASE 0x5E8
#define CLK_RST_CONTROLLER_PLLMB_MISC1 0x5EC
#define CLK_RST_CONTROLLER_CLK_SOURCE_XUSB_FS 0x608 #define CLK_RST_CONTROLLER_CLK_SOURCE_XUSB_FS 0x608
#define CLK_RST_CONTROLLER_CLK_SOURCE_XUSB_CORE_DEV 0x60C #define CLK_RST_CONTROLLER_CLK_SOURCE_XUSB_CORE_DEV 0x60C
#define CLK_RST_CONTROLLER_CLK_SOURCE_XUSB_SS 0x610 #define CLK_RST_CONTROLLER_CLK_SOURCE_XUSB_SS 0x610

View file

@ -189,7 +189,7 @@ void fuse_read_array(u32 *words)
words[i] = fuse_read(i); words[i] = fuse_read(i);
} }
static u32 _parity32_even(const u32 *words, u32 count) static u32 _parity32_even(u32 *words, u32 count)
{ {
u32 acc = words[0]; u32 acc = words[0];
for (u32 i = 1; i < count; i++) for (u32 i = 1; i < count; i++)
@ -303,7 +303,7 @@ int fuse_read_ipatch(void (*ipatch)(u32 offset, u32 value))
u32 words[80]; u32 words[80];
u32 word_count; u32 word_count;
u32 word_addr; u32 word_addr;
u32 word0; u32 word0 = 0;
u32 total_read = 0; u32 total_read = 0;
word_count = FUSE(FUSE_FIRST_BOOTROM_PATCH_SIZE); word_count = FUSE(FUSE_FIRST_BOOTROM_PATCH_SIZE);
@ -363,7 +363,7 @@ int fuse_read_evp_thunk(u32 *iram_evp_thunks, u32 *iram_evp_thunks_len)
u32 words[80]; u32 words[80];
u32 word_count; u32 word_count;
u32 word_addr; u32 word_addr;
u32 word0; u32 word0 = 0;
u32 total_read = 0; u32 total_read = 0;
int evp_thunk_written = 0; int evp_thunk_written = 0;
void *evp_thunk_dst_addr = 0; void *evp_thunk_dst_addr = 0;

View file

@ -96,7 +96,7 @@ static void _i2c_load_cfg_wait(vu32 *base)
} }
} }
static int _i2c_send_single(u32 i2c_idx, u32 dev_addr, const u8 *buf, u32 size) static int _i2c_send_single(u32 i2c_idx, u32 dev_addr, u8 *buf, u32 size)
{ {
if (size > 8) if (size > 8)
return 0; return 0;
@ -384,7 +384,7 @@ int i2c_recv_buf_big(u8 *buf, u32 size, u32 i2c_idx, u32 dev_addr, u32 reg)
return _i2c_recv_pkt(i2c_idx, buf, size, dev_addr, reg); return _i2c_recv_pkt(i2c_idx, buf, size, dev_addr, reg);
} }
int i2c_send_buf_small(u32 i2c_idx, u32 dev_addr, u32 reg, const u8 *buf, u32 size) int i2c_send_buf_small(u32 i2c_idx, u32 dev_addr, u32 reg, u8 *buf, u32 size)
{ {
u8 tmp[8]; u8 tmp[8];

View file

@ -31,7 +31,7 @@ void i2c_init(u32 i2c_idx);
int i2c_recv_buf(u8 *buf, u32 size, u32 i2c_idx, u32 dev_addr); int i2c_recv_buf(u8 *buf, u32 size, u32 i2c_idx, u32 dev_addr);
int i2c_send_buf_big(u32 i2c_idx, u32 dev_addr, u8 *buf, u32 size); int i2c_send_buf_big(u32 i2c_idx, u32 dev_addr, u8 *buf, u32 size);
int i2c_recv_buf_big(u8 *buf, u32 size, u32 i2c_idx, u32 dev_addr, u32 reg); int i2c_recv_buf_big(u8 *buf, u32 size, u32 i2c_idx, u32 dev_addr, u32 reg);
int i2c_send_buf_small(u32 i2c_idx, u32 dev_addr, u32 reg, const u8 *buf, u32 size); int i2c_send_buf_small(u32 i2c_idx, u32 dev_addr, u32 reg, u8 *buf, u32 size);
int i2c_recv_buf_small(u8 *buf, u32 size, u32 i2c_idx, u32 dev_addr, u32 reg); int i2c_recv_buf_small(u8 *buf, u32 size, u32 i2c_idx, u32 dev_addr, u32 reg);
int i2c_send_byte(u32 i2c_idx, u32 dev_addr, u32 reg, u8 val); int i2c_send_byte(u32 i2c_idx, u32 dev_addr, u32 reg, u8 val);
u8 i2c_recv_byte(u32 i2c_idx, u32 dev_addr, u32 reg); u8 i2c_recv_byte(u32 i2c_idx, u32 dev_addr, u32 reg);

View file

@ -124,8 +124,8 @@ static irq_status_t _irq_handle_source(u32 irq)
} }
} }
// Do not re-enable if not handled or error. // Do not re-enable if not handled.
if (status != IRQ_HANDLED) if (status == IRQ_NONE)
return status; return status;
if (irqs[idx].flags & IRQ_FLAG_ONE_OFF) if (irqs[idx].flags & IRQ_FLAG_ONE_OFF)

View file

@ -25,8 +25,6 @@
#define EXCP_TYPE_ADDR 0x4003FFF8 #define EXCP_TYPE_ADDR 0x4003FFF8
#define EXCP_TYPE_WDT 0x544457 // "WDT". #define EXCP_TYPE_WDT 0x544457 // "WDT".
#define USE_RTC_TIMER
u32 get_tmr_s() u32 get_tmr_s()
{ {
(void)RTC(APBDEV_RTC_MILLI_SECONDS); (void)RTC(APBDEV_RTC_MILLI_SECONDS);
@ -120,4 +118,4 @@ bool watchdog_fired()
{ {
// Return if watchdog got fired. User handles clearing. // Return if watchdog got fired. User handles clearing.
return (*(u32 *)EXCP_TYPE_ADDR == EXCP_TYPE_WDT); return (*(u32 *)EXCP_TYPE_ADDR == EXCP_TYPE_WDT);
} }

View file

@ -174,14 +174,14 @@ void uart_empty_fifo(u32 idx, u32 which)
(void)uart->UART_SPR; (void)uart->UART_SPR;
usleep(96); usleep(96);
uart->UART_IIR_FCR = UART_IIR_FCR_EN_FIFO | which; uart->UART_IIR_FCR = UART_IIR_FCR_EN_FIFO | UART_IIR_FCR_TX_CLR | UART_IIR_FCR_RX_CLR;
(void)uart->UART_SPR; (void)uart->UART_SPR;
usleep(18); usleep(18);
u32 tries = 0; u32 tries = 0;
if (UART_IIR_FCR_TX_CLR & which) if (UART_IIR_FCR_TX_CLR & which)
{ {
while (tries < 10 && !(uart->UART_LSR & UART_LSR_TMTY)) while (tries < 10 && uart->UART_LSR & UART_LSR_TMTY)
{ {
tries++; tries++;
usleep(100); usleep(100);
@ -191,7 +191,7 @@ void uart_empty_fifo(u32 idx, u32 which)
if (UART_IIR_FCR_RX_CLR & which) if (UART_IIR_FCR_RX_CLR & which)
{ {
while (tries < 10 && (uart->UART_LSR & UART_LSR_RDR)) while (tries < 10 && !uart->UART_LSR & UART_LSR_RDR)
{ {
tries++; tries++;
usleep(100); usleep(100);

View file

@ -274,7 +274,7 @@ void *sd_file_read(const char *path, u32 *fsize)
return buf; return buf;
} }
int sd_save_to_file(const void *buf, u32 size, const char *filename) int sd_save_to_file(void *buf, u32 size, const char *filename)
{ {
FIL fp; FIL fp;
u32 res = 0; u32 res = 0;

View file

@ -61,6 +61,6 @@ void sd_unmount();
void sd_end(); void sd_end();
bool sd_is_gpt(); bool sd_is_gpt();
void *sd_file_read(const char *path, u32 *fsize); void *sd_file_read(const char *path, u32 *fsize);
int sd_save_to_file(const void *buf, u32 size, const char *filename); int sd_save_to_file(void *buf, u32 size, const char *filename);
#endif #endif

View file

@ -33,7 +33,7 @@
u32 sd_power_cycle_time_start; u32 sd_power_cycle_time_start;
static inline u32 unstuff_bits(const u32 *resp, u32 start, u32 size) static inline u32 unstuff_bits(u32 *resp, u32 start, u32 size)
{ {
const u32 mask = (size < 32 ? 1 << size : 0) - 1; const u32 mask = (size < 32 ? 1 << size : 0) - 1;
const u32 off = 3 - ((start) / 32); const u32 off = 3 - ((start) / 32);
@ -783,7 +783,7 @@ static int _sd_storage_execute_app_cmd_type1(sdmmc_storage_t *storage, u32 *resp
} }
#ifdef SDMMC_DEBUG_PRINT_SD_REGS #ifdef SDMMC_DEBUG_PRINT_SD_REGS
void _sd_storage_debug_print_cid(const u32 *raw_cid) void _sd_storage_debug_print_cid(u32 *raw_cid)
{ {
gfx_printf("Card Identification\n"); gfx_printf("Card Identification\n");
@ -799,7 +799,7 @@ void _sd_storage_debug_print_cid(const u32 *raw_cid)
gfx_printf("--RSVD-- %X\n", unstuff_bits(raw_cid, 20, 4)); gfx_printf("--RSVD-- %X\n", unstuff_bits(raw_cid, 20, 4));
} }
void _sd_storage_debug_print_csd(const u32 *raw_csd) void _sd_storage_debug_print_csd(u32 *raw_csd)
{ {
gfx_printf("\n"); gfx_printf("\n");
@ -836,7 +836,7 @@ void _sd_storage_debug_print_csd(const u32 *raw_csd)
unstuff_bits(raw_csd, 16, 5), unstuff_bits(raw_csd, 8, 2)); unstuff_bits(raw_csd, 16, 5), unstuff_bits(raw_csd, 8, 2));
} }
void _sd_storage_debug_print_scr(const u32 *raw_scr) void _sd_storage_debug_print_scr(u32 *raw_scr)
{ {
u32 resp[4]; u32 resp[4];
memcpy(&resp[2], raw_scr, 8); memcpy(&resp[2], raw_scr, 8);
@ -857,7 +857,7 @@ void _sd_storage_debug_print_scr(const u32 *raw_scr)
gfx_printf("--RSVD-- %X\n", unstuff_bits(resp, 36, 2)); gfx_printf("--RSVD-- %X\n", unstuff_bits(resp, 36, 2));
} }
void _sd_storage_debug_print_ssr(const u8 *raw_ssr) void _sd_storage_debug_print_ssr(u8 *raw_ssr)
{ {
u32 raw_ssr0[4]; // 511:384. u32 raw_ssr0[4]; // 511:384.
u32 raw_ssr1[4]; // 383:256. u32 raw_ssr1[4]; // 383:256.

View file

@ -575,7 +575,7 @@ static int _sdmmc_setup_read_small_block(sdmmc_t *sdmmc)
return 1; return 1;
} }
static int _sdmmc_send_cmd(sdmmc_t *sdmmc, const sdmmc_cmd_t *cmd, bool is_data_present) static int _sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_cmd_t *cmd, bool is_data_present)
{ {
u16 cmdflags = 0; u16 cmdflags = 0;
@ -1025,7 +1025,7 @@ int sdmmc_stop_transmission(sdmmc_t *sdmmc, u32 *rsp)
return result; return result;
} }
static int _sdmmc_config_sdma(sdmmc_t *sdmmc, u32 *blkcnt_out, const sdmmc_req_t *req) static int _sdmmc_config_sdma(sdmmc_t *sdmmc, u32 *blkcnt_out, sdmmc_req_t *req)
{ {
if (!req->blksize || !req->num_sectors) if (!req->blksize || !req->num_sectors)
return 0; return 0;

View file

@ -80,7 +80,7 @@ enum {
static jc_cal_t jc_cal_ctx; static jc_cal_t jc_cal_ctx;
static usb_ops_t usb_ops; static usb_ops_t usb_ops;
static bool _jc_calibration(const jc_gamepad_rpt_t *jc_pad) static bool _jc_calibration(jc_gamepad_rpt_t *jc_pad)
{ {
// Calibrate left stick. // Calibrate left stick.
if (jc_cal_ctx.cl_step != JC_CAL_MAX_STEPS) if (jc_cal_ctx.cl_step != JC_CAL_MAX_STEPS)

View file

@ -1936,9 +1936,7 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs)
_handle_ep0_ctrl(&ums); _handle_ep0_ctrl(&ums);
_parse_scsi_cmd(&ums, &ums.bulk_ctxt); if (_parse_scsi_cmd(&ums, &ums.bulk_ctxt) || (ums.state > UMS_STATE_NORMAL))
if (ums.state > UMS_STATE_NORMAL)
continue; continue;
_handle_ep0_ctrl(&ums); _handle_ep0_ctrl(&ums);

View file

@ -1011,7 +1011,7 @@ static void _xusb_device_power_down()
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_W_CLR) = BIT(CLK_W_XUSB); CLOCK(CLK_RST_CONTROLLER_CLK_ENB_W_CLR) = BIT(CLK_W_XUSB);
} }
static int _xusb_queue_trb(u32 ep_idx, const void *trb, bool ring_doorbell) static int _xusb_queue_trb(u32 ep_idx, void *trb, bool ring_doorbell)
{ {
int res = USB_RES_OK; int res = USB_RES_OK;
data_trb_t *next_trb; data_trb_t *next_trb;
@ -1226,7 +1226,7 @@ static int _xusb_wait_ep_stopped(u32 endpoint)
return USB_RES_OK; return USB_RES_OK;
} }
static int _xusb_handle_transfer_event(const transfer_event_trb_t *trb) static int _xusb_handle_transfer_event(transfer_event_trb_t *trb)
{ {
// Advance dequeue list. // Advance dequeue list.
data_trb_t *next_trb; data_trb_t *next_trb;
@ -1461,7 +1461,7 @@ static int _xusb_handle_get_ep_status(u32 ep_idx)
return _xusb_issue_data_trb(xusb_ep_status_descriptor, 2, USB_DIR_IN); return _xusb_issue_data_trb(xusb_ep_status_descriptor, 2, USB_DIR_IN);
} }
static int _xusb_handle_get_class_request(const usb_ctrl_setup_t *ctrl_setup) static int _xusb_handle_get_class_request(usb_ctrl_setup_t *ctrl_setup)
{ {
u8 _bRequest = ctrl_setup->bRequest; u8 _bRequest = ctrl_setup->bRequest;
u16 _wIndex = ctrl_setup->wIndex; u16 _wIndex = ctrl_setup->wIndex;
@ -1492,7 +1492,7 @@ stall:
return USB_RES_OK; return USB_RES_OK;
} }
static int _xusb_handle_get_descriptor(const usb_ctrl_setup_t *ctrl_setup) static int _xusb_handle_get_descriptor(usb_ctrl_setup_t *ctrl_setup)
{ {
u32 size; u32 size;
void *descriptor; void *descriptor;
@ -1621,7 +1621,7 @@ static int _xusb_handle_get_descriptor(const usb_ctrl_setup_t *ctrl_setup)
return _xusb_issue_data_trb(descriptor, size, USB_DIR_IN); return _xusb_issue_data_trb(descriptor, size, USB_DIR_IN);
} }
static void _xusb_handle_set_request_dev_address(const usb_ctrl_setup_t *ctrl_setup) static void _xusb_handle_set_request_dev_address(usb_ctrl_setup_t *ctrl_setup)
{ {
u32 addr = ctrl_setup->wValue & 0xFF; u32 addr = ctrl_setup->wValue & 0xFF;
@ -1633,7 +1633,7 @@ static void _xusb_handle_set_request_dev_address(const usb_ctrl_setup_t *ctrl_se
usbd_xotg->device_state = XUSB_ADDRESSED_STS_WAIT; usbd_xotg->device_state = XUSB_ADDRESSED_STS_WAIT;
} }
static void _xusb_handle_set_request_configuration(const usb_ctrl_setup_t *ctrl_setup) static void _xusb_handle_set_request_configuration(usb_ctrl_setup_t *ctrl_setup)
{ {
usbd_xotg->config_num = ctrl_setup->wValue; usbd_xotg->config_num = ctrl_setup->wValue;

View file

@ -17,23 +17,21 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "dirlist.h"
#include <libs/fatfs/ff.h> #include <libs/fatfs/ff.h>
#include <mem/heap.h> #include <mem/heap.h>
#include <utils/types.h> #include <utils/types.h>
dirlist_t *dirlist(const char *directory, const char *pattern, bool includeHiddenFiles, bool parse_dirs) #define MAX_ENTRIES 64
char *dirlist(const char *directory, const char *pattern, bool includeHiddenFiles, bool parse_dirs)
{ {
int res = 0; int res = 0;
u32 k = 0; u32 i = 0, j = 0, k = 0;
DIR dir; DIR dir;
FILINFO fno; FILINFO fno;
dirlist_t *dir_entries = (dirlist_t *)malloc(sizeof(dirlist_t)); char *dir_entries = (char *)zalloc(MAX_ENTRIES * 256);
char *temp = (char *)zalloc(256);
// Setup pointer tree.
for (u32 i = 0; i < DIR_MAX_ENTRIES; i++)
dir_entries->name[i] = &dir_entries->data[i * 256];
if (!pattern && !f_opendir(&dir, directory)) if (!pattern && !f_opendir(&dir, directory))
{ {
@ -49,8 +47,9 @@ dirlist_t *dirlist(const char *directory, const char *pattern, bool includeHidde
{ {
if ((fno.fname[0] != '.') && (includeHiddenFiles || !(fno.fattrib & AM_HID))) if ((fno.fname[0] != '.') && (includeHiddenFiles || !(fno.fattrib & AM_HID)))
{ {
strcpy(&dir_entries->data[k * 256], fno.fname); strcpy(dir_entries + (k * 256), fno.fname);
if (++k >= DIR_MAX_ENTRIES) k++;
if (k > (MAX_ENTRIES - 1))
break; break;
} }
} }
@ -63,8 +62,9 @@ dirlist_t *dirlist(const char *directory, const char *pattern, bool includeHidde
{ {
if (!(fno.fattrib & AM_DIR) && (fno.fname[0] != '.') && (includeHiddenFiles || !(fno.fattrib & AM_HID))) if (!(fno.fattrib & AM_DIR) && (fno.fname[0] != '.') && (includeHiddenFiles || !(fno.fattrib & AM_HID)))
{ {
strcpy(&dir_entries->data[k * 256], fno.fname); strcpy(dir_entries + (k * 256), fno.fname);
if (++k >= DIR_MAX_ENTRIES) k++;
if (k > (MAX_ENTRIES - 1))
break; break;
} }
res = f_findnext(&dir, &fno); res = f_findnext(&dir, &fno);
@ -74,27 +74,27 @@ dirlist_t *dirlist(const char *directory, const char *pattern, bool includeHidde
if (!k) if (!k)
{ {
free(temp);
free(dir_entries); free(dir_entries);
return NULL; return NULL;
} }
// Terminate name list.
dir_entries->name[k] = NULL;
// Reorder ini files by ASCII ordering. // Reorder ini files by ASCII ordering.
for (u32 i = 0; i < k - 1 ; i++) for (i = 0; i < k - 1 ; i++)
{ {
for (u32 j = i + 1; j < k; j++) for (j = i + 1; j < k; j++)
{ {
if (strcmp(dir_entries->name[i], dir_entries->name[j]) > 0) if (strcmp(&dir_entries[i * 256], &dir_entries[j * 256]) > 0)
{ {
char *tmp = dir_entries->name[i]; strcpy(temp, &dir_entries[i * 256]);
dir_entries->name[i] = dir_entries->name[j]; strcpy(&dir_entries[i * 256], &dir_entries[j * 256]);
dir_entries->name[j] = tmp; strcpy(&dir_entries[j * 256], temp);
} }
} }
} }
free(temp);
return dir_entries; return dir_entries;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2024 CTCaer * Copyright (c) 2018 CTCaer
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -16,12 +16,4 @@
#include <utils/types.h> #include <utils/types.h>
#define DIR_MAX_ENTRIES 64 char *dirlist(const char *directory, const char *pattern, bool includeHiddenFiles, bool parse_dirs);
typedef struct _dirlist_t
{
char *name[DIR_MAX_ENTRIES];
char data[DIR_MAX_ENTRIES * 256];
} dirlist_t;
dirlist_t *dirlist(const char *directory, const char *pattern, bool includeHiddenFiles, bool parse_dirs);

View file

@ -53,7 +53,7 @@ ini_sec_t *_ini_create_section(link_t *dst, ini_sec_t *csec, char *name, u8 type
return csec; return csec;
} }
int ini_parse(link_t *dst, const char *ini_path, bool is_dir) int ini_parse(link_t *dst, char *ini_path, bool is_dir)
{ {
FIL fp; FIL fp;
u32 lblen; u32 lblen;
@ -62,7 +62,7 @@ int ini_parse(link_t *dst, const char *ini_path, bool is_dir)
ini_sec_t *csec = NULL; ini_sec_t *csec = NULL;
char *lbuf = NULL; char *lbuf = NULL;
dirlist_t *filelist = NULL; char *filelist = NULL;
char *filename = (char *)malloc(256); char *filename = (char *)malloc(256);
strcpy(filename, ini_path); strcpy(filename, ini_path);
@ -85,9 +85,9 @@ int ini_parse(link_t *dst, const char *ini_path, bool is_dir)
// Copy ini filename in path string. // Copy ini filename in path string.
if (is_dir) if (is_dir)
{ {
if (filelist->name[k]) if (filelist[k * 256])
{ {
strcpy(filename + pathlen, filelist->name[k]); strcpy(filename + pathlen, &filelist[k * 256]);
k++; k++;
} }
else else

View file

@ -43,7 +43,7 @@ typedef struct _ini_sec_t
u32 color; u32 color;
} ini_sec_t; } ini_sec_t;
int ini_parse(link_t *dst, const char *ini_path, bool is_dir); int ini_parse(link_t *dst, char *ini_path, bool is_dir);
char *ini_check_special_section(ini_sec_t *cfg); char *ini_check_special_section(ini_sec_t *cfg);
void ini_free(link_t *src); void ini_free(link_t *src);

View file

@ -29,6 +29,8 @@
#include <storage/sd.h> #include <storage/sd.h>
#include <utils/util.h> #include <utils/util.h>
#define USE_RTC_TIMER
u8 bit_count(u32 val) u8 bit_count(u32 val)
{ {
u8 cnt = 0; u8 cnt = 0;

View file

@ -313,20 +313,23 @@ void print_battery_charger_info()
gfx_printf("%k\n\nBattery Charger Info:\n%k", TXT_CLR_CYAN_L, TXT_CLR_DEFAULT); gfx_printf("%k\n\nBattery Charger Info:\n%k", TXT_CLR_CYAN_L, TXT_CLR_DEFAULT);
bq24193_get_property(BQ24193_InputVoltageLimit, &value);
gfx_printf("Input voltage limit: %4d mV\n", value);
bq24193_get_property(BQ24193_InputCurrentLimit, &value); bq24193_get_property(BQ24193_InputCurrentLimit, &value);
gfx_printf("Input current limit: %4d mA\n", value); gfx_printf("Input current limit: %4d mA\n", value);
bq24193_get_property(BQ24193_SystemMinimumVoltage, &value); bq24193_get_property(BQ24193_SystemMinimumVoltage, &value);
gfx_printf("System voltage limit: %4d mV\n", value); gfx_printf("Min voltage limit: %4d mV\n", value);
bq24193_get_property(BQ24193_FastChargeCurrentLimit, &value); bq24193_get_property(BQ24193_FastChargeCurrentLimit, &value);
gfx_printf("Charge current limit: %4d mA\n", value); gfx_printf("Fast charge current limit: %4d mA\n", value);
bq24193_get_property(BQ24193_ChargeVoltageLimit, &value); bq24193_get_property(BQ24193_ChargeVoltageLimit, &value);
gfx_printf("Charge voltage limit: %4d mV\n", value); gfx_printf("Charge voltage limit: %4d mV\n", value);
bq24193_get_property(BQ24193_ChargeStatus, &value); bq24193_get_property(BQ24193_ChargeStatus, &value);
gfx_printf("Charge status: "); gfx_printf("Charge status: ");
switch (value) switch (value)
{ {
case 0: case 0:
@ -346,7 +349,7 @@ void print_battery_charger_info()
break; break;
} }
bq24193_get_property(BQ24193_TempStatus, &value); bq24193_get_property(BQ24193_TempStatus, &value);
gfx_printf("Temperature status: "); gfx_printf("Temperature status: ");
switch (value) switch (value)
{ {
case 0: case 0:

View file

@ -155,8 +155,6 @@ void menu_autorcm()
tui_do_menu(&menu); tui_do_menu(&menu);
emmc_end(); emmc_end();
free(ments);
} }
#pragma GCC pop_options #pragma GCC pop_options

View file

@ -31,7 +31,7 @@
extern hekate_config h_cfg; extern hekate_config h_cfg;
extern bool is_ipl_updated(void *buf, const char *path, bool force); extern bool is_ipl_updated(void *buf, char *path, bool force);
// FSS0 Magic and Meta header offset. // FSS0 Magic and Meta header offset.
#define FSS0_MAGIC 0x30535346 #define FSS0_MAGIC 0x30535346

View file

@ -123,7 +123,6 @@ static const u8 master_kekseed_t210_tsec_v4[HOS_KB_VERSION_MAX - HOS_KB_VERSION_
{ 0x99, 0x22, 0x09, 0x57, 0xA7, 0xF9, 0x5E, 0x94, 0xFE, 0x78, 0x7F, 0x41, 0xD6, 0xE7, 0x56, 0xE6 }, // 16.0.0. { 0x99, 0x22, 0x09, 0x57, 0xA7, 0xF9, 0x5E, 0x94, 0xFE, 0x78, 0x7F, 0x41, 0xD6, 0xE7, 0x56, 0xE6 }, // 16.0.0.
{ 0x71, 0xB9, 0xA6, 0xC0, 0xFF, 0x97, 0x6B, 0x0C, 0xB4, 0x40, 0xB9, 0xD5, 0x81, 0x5D, 0x81, 0x90 }, // 17.0.0. { 0x71, 0xB9, 0xA6, 0xC0, 0xFF, 0x97, 0x6B, 0x0C, 0xB4, 0x40, 0xB9, 0xD5, 0x81, 0x5D, 0x81, 0x90 }, // 17.0.0.
{ 0x00, 0x04, 0x5D, 0xF0, 0x4D, 0xCD, 0x14, 0xA3, 0x1C, 0xBF, 0xDE, 0x48, 0x55, 0xBA, 0x35, 0xC1 }, // 18.0.0. { 0x00, 0x04, 0x5D, 0xF0, 0x4D, 0xCD, 0x14, 0xA3, 0x1C, 0xBF, 0xDE, 0x48, 0x55, 0xBA, 0x35, 0xC1 }, // 18.0.0.
{ 0xD7, 0x63, 0x74, 0x46, 0x4E, 0xBA, 0x78, 0x0A, 0x7C, 0x9D, 0xB3, 0xE8, 0x7A, 0x3D, 0x71, 0xE3 }, // 19.0.0.
}; };
//!TODO: Update on mkey changes. //!TODO: Update on mkey changes.
@ -141,7 +140,6 @@ static const u8 master_kekseed_t210b01[HOS_KB_VERSION_MAX - HOS_KB_VERSION_600 +
{ 0xA5, 0xEC, 0x16, 0x39, 0x1A, 0x30, 0x16, 0x08, 0x2E, 0xCF, 0x09, 0x6F, 0x5E, 0x7C, 0xEE, 0xA9 }, // 16.0.0. { 0xA5, 0xEC, 0x16, 0x39, 0x1A, 0x30, 0x16, 0x08, 0x2E, 0xCF, 0x09, 0x6F, 0x5E, 0x7C, 0xEE, 0xA9 }, // 16.0.0.
{ 0x8D, 0xEE, 0x9E, 0x11, 0x36, 0x3A, 0x9B, 0x0A, 0x6A, 0xC7, 0xBB, 0xE9, 0xD1, 0x03, 0xF7, 0x80 }, // 17.0.0. { 0x8D, 0xEE, 0x9E, 0x11, 0x36, 0x3A, 0x9B, 0x0A, 0x6A, 0xC7, 0xBB, 0xE9, 0xD1, 0x03, 0xF7, 0x80 }, // 17.0.0.
{ 0x4F, 0x41, 0x3C, 0x3B, 0xFB, 0x6A, 0x01, 0x2A, 0x68, 0x9F, 0x83, 0xE9, 0x53, 0xBD, 0x16, 0xD2 }, // 18.0.0. { 0x4F, 0x41, 0x3C, 0x3B, 0xFB, 0x6A, 0x01, 0x2A, 0x68, 0x9F, 0x83, 0xE9, 0x53, 0xBD, 0x16, 0xD2 }, // 18.0.0.
{ 0x31, 0xBE, 0x25, 0xFB, 0xDB, 0xB4, 0xEE, 0x49, 0x5C, 0x77, 0x05, 0xC2, 0x36, 0x9F, 0x34, 0x80 }, // 19.0.0.
}; };
static const u8 console_keyseed[SE_KEY_128_SIZE] = static const u8 console_keyseed[SE_KEY_128_SIZE] =
@ -383,7 +381,7 @@ int hos_keygen(void *keyblob, u32 kb, tsec_ctxt_t *tsec_ctxt, bool stock, bool i
_hos_eks_get(); _hos_eks_get();
// Use tsec keygen for old firmware or if EKS keys does not exist for newer. // Use tsec keygen for old firmware or if EKS keys does not exist for newer.
if (kb <= HOS_KB_VERSION_620 || !h_cfg.eks || (h_cfg.eks->enabled != HOS_EKS_TSEC_VER)) if (kb <= HOS_KB_VERSION_620 || !h_cfg.eks || (h_cfg.eks && h_cfg.eks->enabled != HOS_EKS_TSEC_VER))
use_tsec = true; use_tsec = true;
if (kb <= HOS_KB_VERSION_600) if (kb <= HOS_KB_VERSION_600)
@ -804,7 +802,6 @@ int hos_launch(ini_sec_t *cfg)
// Check if stock is enabled and device can boot in OFW. // Check if stock is enabled and device can boot in OFW.
if (ctxt.stock && (h_cfg.t210b01 || !tools_autorcm_enabled())) if (ctxt.stock && (h_cfg.t210b01 || !tools_autorcm_enabled()))
{ {
sdram_src_pllc(false);
emmc_end(); emmc_end();
WPRINTF("\nRebooting to OFW in 5s..."); WPRINTF("\nRebooting to OFW in 5s...");

View file

@ -45,8 +45,7 @@ enum {
HOS_KB_VERSION_1600 = 15, HOS_KB_VERSION_1600 = 15,
HOS_KB_VERSION_1700 = 16, HOS_KB_VERSION_1700 = 16,
HOS_KB_VERSION_1800 = 17, HOS_KB_VERSION_1800 = 17,
HOS_KB_VERSION_1900 = 18, HOS_KB_VERSION_MAX = HOS_KB_VERSION_1800
HOS_KB_VERSION_MAX = HOS_KB_VERSION_1900
}; };
#define HOS_TSEC_VERSION 4 //! TODO: Update on TSEC Root Key changes. #define HOS_TSEC_VERSION 4 //! TODO: Update on TSEC Root Key changes.

View file

@ -65,7 +65,7 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
u32 dirlen = 0; u32 dirlen = 0;
dir[strlen(dir) - 2] = 0; dir[strlen(dir) - 2] = 0;
dirlist_t *filelist = dirlist(dir, "*.kip*", false, false); char *filelist = dirlist(dir, "*.kip*", false, false);
strcat(dir, "/"); strcat(dir, "/");
dirlen = strlen(dir); dirlen = strlen(dir);
@ -75,10 +75,10 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
{ {
while (true) while (true)
{ {
if (!filelist->name[i]) if (!filelist[i * 256])
break; break;
strcpy(dir + dirlen, filelist->name[i]); strcpy(dir + dirlen, &filelist[i * 256]);
merge_kip_t *mkip1 = (merge_kip_t *)malloc(sizeof(merge_kip_t)); merge_kip_t *mkip1 = (merge_kip_t *)malloc(sizeof(merge_kip_t));
mkip1->kip1 = sd_file_read(dir, &size); mkip1->kip1 = sd_file_read(dir, &size);

View file

@ -170,8 +170,7 @@ static const pkg1_id_t _pkg1_ids[] = {
{ "20220801", 14, 17, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 15.0.0 - 15.0.1. { "20220801", 14, 17, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 15.0.0 - 15.0.1.
{ "20230111", 15, 18, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 16.0.0 - 16.1.0. { "20230111", 15, 18, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 16.0.0 - 16.1.0.
{ "20230906", 16, 19, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 17.0.0 - 17.0.1. { "20230906", 16, 19, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 17.0.0 - 17.0.1.
{ "20240207", 17, 19, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 18.0.0 - 18.1.0. { "20240207", 17, 19, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 18.0.0+
{ "20240808", 18, 20, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000, NULL }, // 19.0.0+
}; };
const pkg1_id_t *pkg1_get_latest() const pkg1_id_t *pkg1_get_latest()

View file

@ -170,7 +170,7 @@ static void parse_external_kip_patches()
ext_patches_parsed = true; ext_patches_parsed = true;
} }
const pkg2_kernel_id_t *pkg2_identify(const u8 *hash) const pkg2_kernel_id_t *pkg2_identify(u8 *hash)
{ {
for (u32 i = 0; i < ARRAY_SIZE(_pkg2_kernel_ids); i++) for (u32 i = 0; i < ARRAY_SIZE(_pkg2_kernel_ids); i++)
{ {

View file

@ -159,7 +159,7 @@ void pkg2_merge_kip(link_t *info, pkg2_kip1_t *kip1);
void pkg2_get_ids(kip1_id_t **ids, u32 *entries); void pkg2_get_ids(kip1_id_t **ids, u32 *entries);
const char *pkg2_patch_kips(link_t *info, char *patch_names); const char *pkg2_patch_kips(link_t *info, char *patch_names);
const pkg2_kernel_id_t *pkg2_identify(const u8 *hash); const pkg2_kernel_id_t *pkg2_identify(u8 *hash);
pkg2_hdr_t *pkg2_decrypt(void *data, u8 kb, bool is_exo); pkg2_hdr_t *pkg2_decrypt(void *data, u8 kb, bool is_exo);
void pkg2_build_encrypt(void *dst, void *hos_ctxt, link_t *kips_info, bool is_exo); void pkg2_build_encrypt(void *dst, void *hos_ctxt, link_t *kips_info, bool is_exo);

View file

@ -95,7 +95,7 @@ static ini_kip_sec_t *_ini_create_kip_section(link_t *dst, ini_kip_sec_t *ksec,
return ksec; return ksec;
} }
int ini_patch_parse(link_t *dst, const char *ini_path) int ini_patch_parse(link_t *dst, char *ini_path)
{ {
FIL fp; FIL fp;
u32 lblen; u32 lblen;
@ -154,15 +154,15 @@ int ini_patch_parse(link_t *dst, const char *ini_path)
pt->length = strtol(&lbuf[pos], NULL, 16); pt->length = strtol(&lbuf[pos], NULL, 16);
pos += str_start + 1; pos += str_start + 1;
u8 *data = malloc(pt->length * 2); u8 *buf = malloc(pt->length * 2);
// Set patch source data. // Set patch source data.
str_start = _find_patch_section_name(&lbuf[pos], lblen - pos, ','); str_start = _find_patch_section_name(&lbuf[pos], lblen - pos, ',');
pt->src_data = _htoa(NULL, &lbuf[pos], pt->length, data); pt->src_data = _htoa(NULL, &lbuf[pos], pt->length, buf);
pos += str_start + 1; pos += str_start + 1;
// Set patch destination data. // Set patch destination data.
pt->dst_data = _htoa(NULL, &lbuf[pos], pt->length, data + pt->length); pt->dst_data = _htoa(NULL, &lbuf[pos], pt->length, buf + pt->length);
} }
list_append(&ksec->pts, &pt->link); list_append(&ksec->pts, &pt->link);

View file

@ -37,6 +37,6 @@ typedef struct _ini_kip_sec_t
link_t link; link_t link;
} ini_kip_sec_t; } ini_kip_sec_t;
int ini_patch_parse(link_t *dst, const char *ini_path); int ini_patch_parse(link_t *dst, char *ini_path);
#endif #endif

View file

@ -794,30 +794,6 @@ static const kip1_patchset_t _fs_patches_1800_exfat[] = {
{ NULL, NULL } { NULL, NULL }
}; };
static const kip1_patch_t _fs_nogc_1900[] = {
{ KPS(KIP_TEXT) | 0x16F070, 8, KIP1_PATCH_SRC_NO_CHECK, "\xE0\x03\x1F\x2A\xC0\x03\x5F\xD6" },
{ KPS(KIP_TEXT) | 0x195B74, 4, KIP1_PATCH_SRC_NO_CHECK, "\x14\x80\x80\x52" },
{ KPS(KIP_TEXT) | 0x195D74, 4, KIP1_PATCH_SRC_NO_CHECK, "\x16\x80\x80\x52" },
{ 0, 0, NULL, NULL }
};
static const kip1_patchset_t _fs_patches_1900[] = {
{ "nogc", _fs_nogc_1900 },
{ NULL, NULL }
};
static const kip1_patch_t _fs_nogc_1900_exfat[] = {
{ KPS(KIP_TEXT) | 0x17A8A0, 8, KIP1_PATCH_SRC_NO_CHECK, "\xE0\x03\x1F\x2A\xC0\x03\x5F\xD6" },
{ KPS(KIP_TEXT) | 0x1A13A4, 4, KIP1_PATCH_SRC_NO_CHECK, "\x14\x80\x80\x52" },
{ KPS(KIP_TEXT) | 0x1A15A4, 4, KIP1_PATCH_SRC_NO_CHECK, "\x16\x80\x80\x52" },
{ 0, 0, NULL, NULL }
};
static const kip1_patchset_t _fs_patches_1900_exfat[] = {
{ "nogc", _fs_nogc_1900_exfat },
{ NULL, NULL }
};
// SHA256 hashes. // SHA256 hashes.
static const kip1_id_t _kip_ids[] = static const kip1_id_t _kip_ids[] =
{ {
@ -881,6 +857,4 @@ static const kip1_id_t _kip_ids[] =
{ "FS", "\x1E\x2C\x64\xB1\xCC\xE2\x78\x24", _fs_patches_1800_exfat }, // FS 18.0.0 exFAT { "FS", "\x1E\x2C\x64\xB1\xCC\xE2\x78\x24", _fs_patches_1800_exfat }, // FS 18.0.0 exFAT
{ "FS", "\xA3\x39\xF0\x1C\x95\xBF\xA7\x68", _fs_patches_1800 }, // FS 18.1.0 { "FS", "\xA3\x39\xF0\x1C\x95\xBF\xA7\x68", _fs_patches_1800 }, // FS 18.1.0
{ "FS", "\x20\x4C\xBA\x86\xDE\x08\x44\x6A", _fs_patches_1800_exfat }, // FS 18.1.0 exFAT { "FS", "\x20\x4C\xBA\x86\xDE\x08\x44\x6A", _fs_patches_1800_exfat }, // FS 18.1.0 exFAT
{ "FS", "\xD9\x4C\x68\x15\xF8\xF5\x0A\x20", _fs_patches_1900 }, // FS 19.0.0
{ "FS", "\xED\xA8\x78\x68\xA4\x49\x07\x50", _fs_patches_1900_exfat }, // FS 19.0.0 exFAT
}; };

View file

@ -199,7 +199,7 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
case 12: case 12:
exo_fw_no = EXO_FW_VER(9, 1); exo_fw_no = EXO_FW_VER(9, 1);
break; break;
case 13 ... 22: //!TODO: Update on API changes. 22: 19.0.0. case 13 ... 21: //!TODO: Update on API changes. 21: 18.0.0.
exo_fw_no = EXO_FW_VER(exo_fw_no - 3, ctxt->exo_ctx.hos_revision); exo_fw_no = EXO_FW_VER(exo_fw_no - 3, ctxt->exo_ctx.hos_revision);
break; break;
} }
@ -207,10 +207,10 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
// Parse exosphere.ini. // Parse exosphere.ini.
if (!ctxt->stock) if (!ctxt->stock)
{ {
LIST_INIT(ini_exo_sections); LIST_INIT(ini_sections);
if (ini_parse(&ini_exo_sections, "exosphere.ini", false)) if (ini_parse(&ini_sections, "exosphere.ini", false))
{ {
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_exo_sections, link) LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
{ {
// Only parse exosphere section. // Only parse exosphere section.
if (!(ini_sec->type == INI_CHOICE) || strcmp(ini_sec->name, "exosphere")) if (!(ini_sec->type == INI_CHOICE) || strcmp(ini_sec->name, "exosphere"))
@ -245,10 +245,10 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base)
// Parse usb mtim settings. Avoid parsing if it's overridden. // Parse usb mtim settings. Avoid parsing if it's overridden.
if (!ctxt->exo_ctx.usb3_force) if (!ctxt->exo_ctx.usb3_force)
{ {
LIST_INIT(ini_sys_sections); LIST_INIT(ini_sections);
if (ini_parse(&ini_sys_sections, "atmosphere/config/system_settings.ini", false)) if (ini_parse(&ini_sections, "atmosphere/config/system_settings.ini", false))
{ {
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sys_sections, link) LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
{ {
// Only parse usb section. // Only parse usb section.
if (!(ini_sec->type == INI_CHOICE) || strcmp(ini_sec->name, "usb")) if (!(ini_sec->type == INI_CHOICE) || strcmp(ini_sec->name, "usb"))

View file

@ -36,11 +36,10 @@
* 4: Arachne Register Cell v3. DRAM OPT and DDR200 changes. * 4: Arachne Register Cell v3. DRAM OPT and DDR200 changes.
* 5: Arachne Register Cell v4. DRAM FREQ and DDR200 changes. * 5: Arachne Register Cell v4. DRAM FREQ and DDR200 changes.
* 6: Arachne Register Cell v5. Signal quality and performance changes. TZ param changes. * 6: Arachne Register Cell v5. Signal quality and performance changes. TZ param changes.
* 7: Arachne Register Cell v6. Decouple of rd/wr latencies.
*/ */
#define L4T_LOADER_API_REV 7 #define L4T_LOADER_API_REV 6
#define L4T_FIRMWARE_REV 0x37524556 // REV7. #define L4T_FIRMWARE_REV 0x36524556 // REV6.
#ifdef DEBUG_UART_PORT #ifdef DEBUG_UART_PORT
#include <soc/uart.h> #include <soc/uart.h>
@ -852,7 +851,7 @@ static int _l4t_sc7_exit_config(bool t210b01)
return 1; return 1;
} }
static void _l4t_bl33_cfg_set_key(char *env, const char *key, const char *val) static void _l4t_bl33_cfg_set_key(char *env, char *key, char *val)
{ {
strcat(env, key); strcat(env, key);
strcat(env, "="); strcat(env, "=");

View file

@ -120,7 +120,7 @@ static void _reloc_patcher(u32 payload_dst, u32 payload_src, u32 payload_size)
} }
} }
bool is_ipl_updated(void *buf, const char *path, bool force) bool is_ipl_updated(void *buf, char *path, bool force)
{ {
ipl_ver_meta_t *update_ft = (ipl_ver_meta_t *)(buf + PATCHED_RELOC_SZ + sizeof(boot_cfg_t)); ipl_ver_meta_t *update_ft = (ipl_ver_meta_t *)(buf + PATCHED_RELOC_SZ + sizeof(boot_cfg_t));
@ -257,9 +257,9 @@ static void _launch_payloads()
{ {
u8 max_entries = 61; u8 max_entries = 61;
ment_t *ments = NULL; ment_t *ments = NULL;
char *filelist = NULL;
char *file_sec = NULL; char *file_sec = NULL;
char *dir = NULL; char *dir = NULL;
dirlist_t *filelist = NULL;
gfx_clear_grey(0x1B); gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
@ -286,11 +286,11 @@ static void _launch_payloads()
while (true) while (true)
{ {
if (i > max_entries || !filelist->name[i]) if (i > max_entries || !filelist[i * 256])
break; break;
ments[i + 2].type = INI_CHOICE; ments[i + 2].type = INI_CHOICE;
ments[i + 2].caption = filelist->name[i]; ments[i + 2].caption = &filelist[i * 256];
ments[i + 2].data = filelist->name[i]; ments[i + 2].data = &filelist[i * 256];
i++; i++;
} }
@ -1446,7 +1446,7 @@ ment_t ment_top[] = {
MDEF_END() MDEF_END()
}; };
menu_t menu_top = { ment_top, "hekate v6.2.2", 0, 0 }; menu_t menu_top = { ment_top, "hekate v6.2.1", 0, 0 };
extern void pivot_stack(u32 stack_top); extern void pivot_stack(u32 stack_top);

View file

@ -85,7 +85,7 @@ typedef struct
bool emc_2X_clk_src_is_pllmb; bool emc_2X_clk_src_is_pllmb;
bool fsp_for_src_freq; bool fsp_for_src_freq;
bool train_ram_patterns; bool train_ram_patterns;
u32 init_done; bool init_done;
} mtc_config_t; } mtc_config_t;
enum train_mode_t enum train_mode_t

View file

@ -105,7 +105,7 @@ static void _get_valid_partition(u32 *sector_start, u32 *sector_size, u32 *part_
*sector_start = *sector_start + 0x8000; *sector_start = *sector_start + 0x8000;
} }
static lv_obj_t *create_mbox_text(const char *text, bool button_ok) static lv_obj_t *create_mbox_text(char *text, bool button_ok)
{ {
lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL); lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_style(dark_bg, &mbox_darken); lv_obj_set_style(dark_bg, &mbox_darken);
@ -137,7 +137,7 @@ static void _update_filename(char *outFilename, u32 sdPathLen, u32 currPartIdx)
itoa(currPartIdx, &outFilename[sdPathLen], 10); itoa(currPartIdx, &outFilename[sdPathLen], 10);
} }
static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lba_curr, const char *outFilename, const emmc_part_t *part) static int _dump_emmc_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage, u32 lba_curr, char *outFilename, emmc_part_t *part)
{ {
FIL fp; FIL fp;
FIL hashFp; FIL hashFp;
@ -1118,7 +1118,7 @@ multipart_not_allowed:
manual_system_maintenance(true); manual_system_maintenance(true);
} }
return -1; return 0;
} }
else if (!use_multipart && (((u32)((u64)f_size(&fp) >> (u64)9)) != totalSectors)) // Check total restore size vs emmc size. else if (!use_multipart && (((u32)((u64)f_size(&fp) >> (u64)9)) != totalSectors)) // Check total restore size vs emmc size.
{ {
@ -1475,13 +1475,10 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
if (!res) if (!res)
s_printf(txt_buf, "#FFDD00 Failed!#\n"); s_printf(txt_buf, "#FFDD00 Failed!#\n");
else if (res > 0) else
s_printf(txt_buf, "Done!\n"); s_printf(txt_buf, "Done!\n");
if (res >= 0) lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
else
res = 0;
manual_system_maintenance(true); manual_system_maintenance(true);
} }
} }
@ -1511,13 +1508,10 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
if (!res) if (!res)
s_printf(txt_buf, "#FFDD00 Failed!#\n"); s_printf(txt_buf, "#FFDD00 Failed!#\n");
else if (res > 0) else
s_printf(txt_buf, "Done!\n"); s_printf(txt_buf, "Done!\n");
if (res >= 0) lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
else
res = 0;
manual_system_maintenance(true); manual_system_maintenance(true);
} }
emmc_gpt_free(&gpt); emmc_gpt_free(&gpt);
@ -1550,13 +1544,10 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
if (!res) if (!res)
s_printf(txt_buf, "#FFDD00 Failed!#\n"); s_printf(txt_buf, "#FFDD00 Failed!#\n");
else if (res > 0) else
s_printf(txt_buf, "Done!\n"); s_printf(txt_buf, "Done!\n");
if (res >= 0) lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
else
res = 0;
manual_system_maintenance(true); manual_system_maintenance(true);
} }
} }

View file

@ -143,7 +143,7 @@ void update_emummc_base_folder(char *outFilename, u32 sdPathLen, u32 currPartIdx
itoa(currPartIdx, &outFilename[sdPathLen], 10); itoa(currPartIdx, &outFilename[sdPathLen], 10);
} }
static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_storage_t *storage, const emmc_part_t *part) static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_storage_t *storage, emmc_part_t *part)
{ {
static const u32 FAT32_FILESIZE_LIMIT = 0xFFFFFFFF; static const u32 FAT32_FILESIZE_LIMIT = 0xFFFFFFFF;
static const u32 SECTORS_TO_MIB_COEFF = 11; static const u32 SECTORS_TO_MIB_COEFF = 11;
@ -779,7 +779,7 @@ static int _emummc_raw_derive_bis_keys(emmc_tool_gui_t *gui, u32 resized_count)
// Generate BIS keys. // Generate BIS keys.
hos_bis_keygen(); hos_bis_keygen();
u8 *cal0_buff = malloc(SZ_64K); u8 *cal0_buf = malloc(SZ_64K);
// Read and decrypt CAL0 for validation of working BIS keys. // Read and decrypt CAL0 for validation of working BIS keys.
emmc_set_partition(EMMC_GPP); emmc_set_partition(EMMC_GPP);
@ -787,11 +787,11 @@ static int _emummc_raw_derive_bis_keys(emmc_tool_gui_t *gui, u32 resized_count)
emmc_gpt_parse(&gpt); emmc_gpt_parse(&gpt);
emmc_part_t *cal0_part = emmc_part_find(&gpt, "PRODINFO"); // check if null emmc_part_t *cal0_part = emmc_part_find(&gpt, "PRODINFO"); // check if null
nx_emmc_bis_init(cal0_part, false, 0); nx_emmc_bis_init(cal0_part, false, 0);
nx_emmc_bis_read(0, 0x40, cal0_buff); nx_emmc_bis_read(0, 0x40, cal0_buf);
nx_emmc_bis_end(); nx_emmc_bis_end();
emmc_gpt_free(&gpt); emmc_gpt_free(&gpt);
nx_emmc_cal0_t *cal0 = (nx_emmc_cal0_t *)cal0_buff; nx_emmc_cal0_t *cal0 = (nx_emmc_cal0_t *)cal0_buf;
// Check keys validity. // Check keys validity.
if (memcmp(&cal0->magic, "CAL0", 4)) if (memcmp(&cal0->magic, "CAL0", 4))
@ -803,7 +803,7 @@ static int _emummc_raw_derive_bis_keys(emmc_tool_gui_t *gui, u32 resized_count)
error = true; error = true;
} }
free(cal0_buff); free(cal0_buf);
if (error) if (error)
{ {

View file

@ -694,7 +694,7 @@ lv_img_dsc_t *bmp_to_lvimg_obj(const char *path)
img_desc->header.always_zero = 0; img_desc->header.always_zero = 0;
img_desc->header.w = bmpData.size_x; img_desc->header.w = bmpData.size_x;
img_desc->header.h = bmpData.size_y; img_desc->header.h = bmpData.size_y;
img_desc->header.cf = (bitmap[28] == 32) ? LV_IMG_CF_TRUE_COLOR_ALPHA : LV_IMG_CF_TRUE_COLOR; // Only LV_IMG_CF_TRUE_COLOR_ALPHA is actually allowed. img_desc->header.cf = (bitmap[28] == 32) ? LV_IMG_CF_TRUE_COLOR_ALPHA : LV_IMG_CF_TRUE_COLOR;
img_desc->data_size = bmpData.size - bmpData.offset; img_desc->data_size = bmpData.size - bmpData.offset;
img_desc->data = (u8 *)offset_copy; img_desc->data = (u8 *)offset_copy;
@ -1394,7 +1394,7 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
goto out_end; goto out_end;
} }
dirlist_t *filelist = dirlist("bootloader/payloads", NULL, false, false); char *filelist = dirlist("bootloader/payloads", NULL, false, false);
sd_unmount(); sd_unmount();
u32 i = 0; u32 i = 0;
@ -1402,9 +1402,9 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
{ {
while (true) while (true)
{ {
if (!filelist->name[i]) if (!filelist[i * 256])
break; break;
lv_list_add(list, NULL, filelist->name[i], launch_payload); lv_list_add(list, NULL, &filelist[i * 256], launch_payload);
i++; i++;
} }
free(filelist); free(filelist);
@ -1440,15 +1440,15 @@ static lv_res_t _launch_more_cfg_action(lv_obj_t *btn)
static lv_res_t _win_launch_close_action(lv_obj_t * btn) static lv_res_t _win_launch_close_action(lv_obj_t * btn)
{ {
// Cleanup icons. // Cleanup icons.
for (u32 i = 0; i < (n_cfg.entries_5_col ? 10 : 8); i++) for (u32 i = 0; i < 8; i++)
{ {
lv_obj_t *btns = launch_ctxt.btn[i]; lv_obj_t *btn = launch_ctxt.btn[i];
lv_btn_ext_t *ext = lv_obj_get_ext_attr(btns); lv_btn_ext_t *ext = lv_obj_get_ext_attr(btn);
if (ext->idx) if (ext->idx)
{ {
// This gets latest object, which is the button overlay. So iterate 2 times. // This gets latest object, which is the button overlay. So iterate 2 times.
lv_obj_t * img = lv_obj_get_child(btns, NULL); lv_obj_t * img = lv_obj_get_child(btn, NULL);
img = lv_obj_get_child(btns, img); img = lv_obj_get_child(btn, img);
lv_img_dsc_t *src = (lv_img_dsc_t *)lv_img_get_src(img); lv_img_dsc_t *src = (lv_img_dsc_t *)lv_img_get_src(img);
@ -1832,7 +1832,7 @@ ini_parsing:
} }
// Add button mask/radius and align icon. // Add button mask/radius and align icon.
lv_obj_t *btns = lv_btn_create(launch_ctxt.btn[curr_btn_idx], NULL); lv_obj_t *btn = lv_btn_create(launch_ctxt.btn[curr_btn_idx], NULL);
u32 btn_width = 200; u32 btn_width = 200;
u32 btn_height = 200; u32 btn_height = 200;
if (img_noborder) if (img_noborder)
@ -1848,25 +1848,25 @@ ini_parsing:
lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_REL, &btn_home_noborder_rel); lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_REL, &btn_home_noborder_rel);
lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_home_noborder_rel); lv_btn_set_style(launch_ctxt.btn[curr_btn_idx], LV_BTN_STYLE_PR, &btn_home_noborder_rel);
} }
lv_obj_set_size(btns, btn_width, btn_height); lv_obj_set_size(btn, btn_width, btn_height);
lv_btn_set_style(btns, LV_BTN_STYLE_REL, img_noborder ? &btn_home_noborder_rel : &btn_home_transp_rel); lv_btn_set_style(btn, LV_BTN_STYLE_REL, img_noborder ? &btn_home_noborder_rel : &btn_home_transp_rel);
lv_btn_set_style(btns, LV_BTN_STYLE_PR, &btn_home_transp_pr); lv_btn_set_style(btn, LV_BTN_STYLE_PR, &btn_home_transp_pr);
if (img) if (img)
lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, 0);
if (img_noborder) if (img_noborder)
lv_obj_align(btns, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(btn, NULL, LV_ALIGN_CENTER, 0, 0);
// Set autoboot index. // Set autoboot index.
ext = lv_obj_get_ext_attr(btns); ext = lv_obj_get_ext_attr(btn);
ext->idx = entry_idx; ext->idx = entry_idx;
ext = lv_obj_get_ext_attr(launch_ctxt.btn[curr_btn_idx]); // Redundancy. ext = lv_obj_get_ext_attr(launch_ctxt.btn[curr_btn_idx]); // Redundancy.
ext->idx = entry_idx; ext->idx = entry_idx;
// Set action. // Set action.
if (!more_cfg) if (!more_cfg)
lv_btn_set_action(btns, LV_BTN_ACTION_CLICK, _launch_action); lv_btn_set_action(btn, LV_BTN_ACTION_CLICK, _launch_action);
else else
lv_btn_set_action(btns, LV_BTN_ACTION_CLICK, _launch_more_cfg_action); lv_btn_set_action(btn, LV_BTN_ACTION_CLICK, _launch_more_cfg_action);
// Set button's label text. // Set button's label text.
lv_label_set_text(launch_ctxt.label[curr_btn_idx], ini_sec->name); lv_label_set_text(launch_ctxt.label[curr_btn_idx], ini_sec->name);
@ -2461,12 +2461,9 @@ void nyx_load_and_run()
// Gui loop. // Gui loop.
if (h_cfg.t210b01) if (h_cfg.t210b01)
{ {
// Minerva not supported on T210B01 yet. Slight power saving via spinlock. // Minerva not supported on T210B01 yet. No power saving.
while (true) while (true)
{
lv_task_handler(); lv_task_handler();
usleep(400);
}
} }
else else
{ {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2024 CTCaer * Copyright (c) 2019-2022 CTCaer
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -749,7 +749,7 @@ static lv_res_t _create_emummc_migrate_action(lv_obj_t * btns, const char * txt)
typedef struct _emummc_images_t typedef struct _emummc_images_t
{ {
dirlist_t *dirlist; char *dirlist;
u32 part_sector[3]; u32 part_sector[3];
u32 part_type[3]; u32 part_type[3];
u32 part_end[3]; u32 part_end[3];
@ -1009,9 +1009,9 @@ static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
FIL fp; FIL fp;
// Check for sd raw partitions, based on the folders in /emuMMC. // Check for sd raw partitions, based on the folders in /emuMMC.
while (emummc_img->dirlist->name[emummc_idx]) while (emummc_img->dirlist[emummc_idx * 256])
{ {
s_printf(path, "emuMMC/%s/raw_based", emummc_img->dirlist->name[emummc_idx]); s_printf(path, "emuMMC/%s/raw_based", &emummc_img->dirlist[emummc_idx * 256]);
if (!f_stat(path, NULL)) if (!f_stat(path, NULL))
{ {
@ -1024,21 +1024,21 @@ static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
if ((curr_list_sector == 2) || (emummc_img->part_sector[0] && curr_list_sector >= emummc_img->part_sector[0] && if ((curr_list_sector == 2) || (emummc_img->part_sector[0] && curr_list_sector >= emummc_img->part_sector[0] &&
curr_list_sector < emummc_img->part_end[0] && emummc_img->part_type[0] != 0x83)) curr_list_sector < emummc_img->part_end[0] && emummc_img->part_type[0] != 0x83))
{ {
s_printf(&emummc_img->part_path[0], "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]); s_printf(&emummc_img->part_path[0], "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]);
emummc_img->part_sector[0] = curr_list_sector; emummc_img->part_sector[0] = curr_list_sector;
emummc_img->part_end[0] = 0; emummc_img->part_end[0] = 0;
} }
else if (emummc_img->part_sector[1] && curr_list_sector >= emummc_img->part_sector[1] && else if (emummc_img->part_sector[1] && curr_list_sector >= emummc_img->part_sector[1] &&
curr_list_sector < emummc_img->part_end[1] && emummc_img->part_type[1] != 0x83) curr_list_sector < emummc_img->part_end[1] && emummc_img->part_type[1] != 0x83)
{ {
s_printf(&emummc_img->part_path[1 * 128], "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]); s_printf(&emummc_img->part_path[1 * 128], "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]);
emummc_img->part_sector[1] = curr_list_sector; emummc_img->part_sector[1] = curr_list_sector;
emummc_img->part_end[1] = 0; emummc_img->part_end[1] = 0;
} }
else if (emummc_img->part_sector[2] && curr_list_sector >= emummc_img->part_sector[2] && else if (emummc_img->part_sector[2] && curr_list_sector >= emummc_img->part_sector[2] &&
curr_list_sector < emummc_img->part_end[2] && emummc_img->part_type[2] != 0x83) curr_list_sector < emummc_img->part_end[2] && emummc_img->part_type[2] != 0x83)
{ {
s_printf(&emummc_img->part_path[2 * 128], "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]); s_printf(&emummc_img->part_path[2 * 128], "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]);
emummc_img->part_sector[2] = curr_list_sector; emummc_img->part_sector[2] = curr_list_sector;
emummc_img->part_end[2] = 0; emummc_img->part_end[2] = 0;
} }
@ -1050,19 +1050,19 @@ static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
u32 file_based_idx = 0; u32 file_based_idx = 0;
// Sanitize the directory list with sd file based ones. // Sanitize the directory list with sd file based ones.
while (emummc_img->dirlist->name[emummc_idx]) while (emummc_img->dirlist[emummc_idx * 256])
{ {
s_printf(path, "emuMMC/%s/file_based", emummc_img->dirlist->name[emummc_idx]); s_printf(path, "emuMMC/%s/file_based", &emummc_img->dirlist[emummc_idx * 256]);
if (!f_stat(path, NULL)) if (!f_stat(path, NULL))
{ {
char *tmp = emummc_img->dirlist->name[emummc_idx]; char *tmp = &emummc_img->dirlist[emummc_idx * 256];
memcpy(emummc_img->dirlist->name[file_based_idx], tmp, strlen(tmp) + 1); memcpy(&emummc_img->dirlist[file_based_idx * 256], tmp, strlen(tmp) + 1);
file_based_idx++; file_based_idx++;
} }
emummc_idx++; emummc_idx++;
} }
emummc_img->dirlist->name[file_based_idx] = NULL; emummc_img->dirlist[file_based_idx * 256] = 0;
out0:; out0:;
static lv_style_t h_style; static lv_style_t h_style;
@ -1179,9 +1179,9 @@ out0:;
emummc_idx = 0; emummc_idx = 0;
// Add file based to the list. // Add file based to the list.
while (emummc_img->dirlist->name[emummc_idx]) while (emummc_img->dirlist[emummc_idx * 256])
{ {
s_printf(path, "emuMMC/%s", emummc_img->dirlist->name[emummc_idx]); s_printf(path, "emuMMC/%s", &emummc_img->dirlist[emummc_idx * 256]);
lv_list_add(list_sd_based, NULL, path, _save_file_emummc_cfg_action); lv_list_add(list_sd_based, NULL, path, _save_file_emummc_cfg_action);

View file

@ -587,10 +587,7 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
strcpy(fuses_hos_version, "16.0.0 - 16.1.0"); strcpy(fuses_hos_version, "16.0.0 - 16.1.0");
break; break;
case 19: case 19:
strcpy(fuses_hos_version, "17.0.0 - 18.1.0"); strcpy(fuses_hos_version, "17.0.0+");
break;
case 20:
strcpy(fuses_hos_version, "19.0.0+");
break; break;
case 255: case 255:
strcpy(fuses_hos_version, "#FFD000 Overburnt#"); strcpy(fuses_hos_version, "#FFD000 Overburnt#");
@ -1759,7 +1756,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
emmc_gpt_parse(&gpt); emmc_gpt_parse(&gpt);
u32 idx = 0; u32 idx = 0;
int lines_left = 20; u32 lines_left = 20;
s_printf(txt_buf + strlen(txt_buf), "#FFBA00 Idx Name Size Offset Sectors#\n"); s_printf(txt_buf + strlen(txt_buf), "#FFBA00 Idx Name Size Offset Sectors#\n");
LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link) LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link)
{ {
@ -2307,9 +2304,10 @@ static lv_res_t _create_window_battery_status(lv_obj_t *btn)
lv_label_set_static_text(lb_desc2, lv_label_set_static_text(lb_desc2,
"#00DDFF Battery Charger IC Info:#\n" "#00DDFF Battery Charger IC Info:#\n"
"Input voltage limit:\n"
"Input current limit:\n" "Input current limit:\n"
"System voltage limit:\n" "Min voltage limit:\n"
"Charge current limit:\n" "Fast charge current limit:\n"
"Charge voltage limit:\n" "Charge voltage limit:\n"
"Charge status:\n" "Charge status:\n"
"Temperature status:\n\n" "Temperature status:\n\n"
@ -2327,9 +2325,12 @@ static lv_res_t _create_window_battery_status(lv_obj_t *btn)
lv_obj_t * lb_val2 = lv_label_create(val2, lb_desc); lv_obj_t * lb_val2 = lv_label_create(val2, lb_desc);
// Charger IC info. // Charger IC info.
bq24193_get_property(BQ24193_InputVoltageLimit, &value);
s_printf(txt_buf, "\n%d mV\n", value);
int iinlim = 0; int iinlim = 0;
bq24193_get_property(BQ24193_InputCurrentLimit, &iinlim); bq24193_get_property(BQ24193_InputCurrentLimit, &iinlim);
s_printf(txt_buf, "\n%d mA\n", iinlim); s_printf(txt_buf + strlen(txt_buf), "%d mA\n", iinlim);
bq24193_get_property(BQ24193_SystemMinimumVoltage, &value); bq24193_get_property(BQ24193_SystemMinimumVoltage, &value);
s_printf(txt_buf + strlen(txt_buf), "%d mV\n", value); s_printf(txt_buf + strlen(txt_buf), "%d mV\n", value);
@ -2399,8 +2400,8 @@ static lv_res_t _create_window_battery_status(lv_obj_t *btn)
if (!usb_pd.pdo_no) if (!usb_pd.pdo_no)
strcat(txt_buf, "\nNon PD"); strcat(txt_buf, "\nNon PD");
// Limit to 6 profiles so it can fit. // Limit to 5 profiles so it can fit.
usb_pd.pdo_no = MIN(usb_pd.pdo_no, 6); usb_pd.pdo_no = MIN(usb_pd.pdo_no, 5);
for (u32 i = 0; i < usb_pd.pdo_no; i++) for (u32 i = 0; i < usb_pd.pdo_no; i++)
{ {

View file

@ -954,8 +954,8 @@ save_data:
cal0->gyro_offset[0], cal0->gyro_offset[1], cal0->gyro_offset[2], cal0->gyro_offset[0], cal0->gyro_offset[1], cal0->gyro_offset[2],
cal0->gyro_scale[0], cal0->gyro_scale[1], cal0->gyro_scale[2], cal0->gyro_scale[0], cal0->gyro_scale[1], cal0->gyro_scale[2],
cal0->bd_mac[0], cal0->bd_mac[1], cal0->bd_mac[2], cal0->bd_mac[3], cal0->bd_mac[4], cal0->bd_mac[5]); cal0->bd_mac[0], cal0->bd_mac[1], cal0->bd_mac[2], cal0->bd_mac[3], cal0->bd_mac[4], cal0->bd_mac[5]);
if (!error)
error = f_open(&fp, "switchroot/switch.cal", FA_WRITE | FA_CREATE_ALWAYS) ? 4 : 0; error = f_open(&fp, "switchroot/switch.cal", FA_WRITE | FA_CREATE_ALWAYS) ? 4 : 0;
if (!error) if (!error)
{ {
f_puts(data, &fp); f_puts(data, &fp);

View file

@ -85,7 +85,7 @@ l4t_flasher_ctxt_t l4t_flash_ctxt;
lv_obj_t *btn_flash_l4t; lv_obj_t *btn_flash_l4t;
lv_obj_t *btn_flash_android; lv_obj_t *btn_flash_android;
int _copy_file(const char *src, const char *dst, const char *path) int _copy_file(const char *src, const char *dst, char *path)
{ {
FIL fp_src; FIL fp_src;
FIL fp_dst; FIL fp_dst;
@ -265,7 +265,7 @@ out:
return res; return res;
} }
static void _create_gpt_partition(gpt_t *gpt, u8 *gpt_idx, u32 *curr_part_lba, u32 size_lba, const char *name, int name_size) static void _create_gpt_partition(gpt_t *gpt, u8 *gpt_idx, u32 *curr_part_lba, u32 size_lba, char *name, int name_size)
{ {
static const u8 linux_part_guid[] = { 0xAF, 0x3D, 0xC6, 0x0F, 0x83, 0x84, 0x72, 0x47, 0x8E, 0x79, 0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4 }; static const u8 linux_part_guid[] = { 0xAF, 0x3D, 0xC6, 0x0F, 0x83, 0x84, 0x72, 0x47, 0x8E, 0x79, 0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4 };
u8 random_number[16]; u8 random_number[16];
@ -813,7 +813,7 @@ static u32 _get_available_l4t_partition()
return size_sct; return size_sct;
} }
static int _get_available_android_partition() static bool _get_available_android_partition()
{ {
gpt_t *gpt = zalloc(sizeof(gpt_t)); gpt_t *gpt = zalloc(sizeof(gpt_t));
@ -827,17 +827,11 @@ static int _get_available_android_partition()
// Find kernel partition. // Find kernel partition.
for (u32 i = 0; i < gpt->header.num_part_ents; i++) for (u32 i = 0; i < gpt->header.num_part_ents; i++)
{ {
if (gpt->entries[i].lba_start) if (gpt->entries[i].lba_start && (!memcmp(gpt->entries[i].name, (char[]) { 'L', 0, 'N', 0, 'X', 0 }, 6) || !memcmp(gpt->entries[i].name, (char[]) { 'b', 0, 'o', 0, 'o', 0, 't', 0 }, 8)))
{ {
int found = !memcmp(gpt->entries[i].name, (char[]) { 'b', 0, 'o', 0, 'o', 0, 't', 0 }, 8) ? 2 : 0; free(gpt);
found |= !memcmp(gpt->entries[i].name, (char[]) { 'L', 0, 'N', 0, 'X', 0 }, 6) ? 1 : 0;
if (found) return true;
{
free(gpt);
return found;
}
} }
if (i > 126) if (i > 126)
@ -888,7 +882,7 @@ static lv_res_t _action_check_flash_linux(lv_obj_t *btn)
// Find an applicable partition for L4T. // Find an applicable partition for L4T.
u32 size_sct = _get_available_l4t_partition(); u32 size_sct = _get_available_l4t_partition();
if (!l4t_flash_ctxt.offset_sct || size_sct < 0x800000) if (!l4t_flash_ctxt.offset_sct || !size_sct || size_sct < 0x800000)
{ {
lv_label_set_text(lbl_status, "#FFDD00 Error:# No partition found!"); lv_label_set_text(lbl_status, "#FFDD00 Error:# No partition found!");
goto error; goto error;
@ -2057,9 +2051,9 @@ static void _create_mbox_check_files_total_size()
bar_l4t_ind.body.main_color = LV_COLOR_HEX(0x00DDFF); bar_l4t_ind.body.main_color = LV_COLOR_HEX(0x00DDFF);
bar_l4t_ind.body.grad_color = bar_l4t_ind.body.main_color; bar_l4t_ind.body.grad_color = bar_l4t_ind.body.main_color;
// Set GPT bar style. // Set Android bar style.
lv_style_copy(&bar_and_ind, lv_theme_get_current()->bar.indic); lv_style_copy(&bar_and_ind, lv_theme_get_current()->bar.indic);
bar_and_ind.body.main_color = LV_COLOR_HEX(0xC000FF); bar_and_ind.body.main_color = LV_COLOR_HEX(0xFF8000);
bar_and_ind.body.grad_color = bar_and_ind.body.main_color; bar_and_ind.body.grad_color = bar_and_ind.body.main_color;
// Set separator styles. // Set separator styles.
@ -2071,7 +2065,7 @@ static void _create_mbox_check_files_total_size()
sep_l4t_bg.body.main_color = LV_COLOR_HEX(0x00DDFF); sep_l4t_bg.body.main_color = LV_COLOR_HEX(0x00DDFF);
sep_l4t_bg.body.grad_color = sep_l4t_bg.body.main_color; sep_l4t_bg.body.grad_color = sep_l4t_bg.body.main_color;
lv_style_copy(&sep_and_bg, &sep_emu_bg); lv_style_copy(&sep_and_bg, &sep_emu_bg);
sep_and_bg.body.main_color = LV_COLOR_HEX(0xC000FF); sep_and_bg.body.main_color = LV_COLOR_HEX(0xFF8000);
sep_and_bg.body.grad_color = sep_and_bg.body.main_color; sep_and_bg.body.grad_color = sep_and_bg.body.main_color;
char *txt_buf = malloc(SZ_8K); char *txt_buf = malloc(SZ_8K);
@ -2754,35 +2748,27 @@ lv_res_t create_window_partition_manager(lv_obj_t *btn)
// Disable Flash Linux button if partition not found. // Disable Flash Linux button if partition not found.
u32 size_sct = _get_available_l4t_partition(); u32 size_sct = _get_available_l4t_partition();
if (!l4t_flash_ctxt.offset_sct || size_sct < 0x800000) if (!l4t_flash_ctxt.offset_sct || !size_sct || size_sct < 0x800000)
{ {
lv_obj_set_click(btn_flash_l4t, false); lv_obj_set_click(btn_flash_l4t, false);
lv_btn_set_state(btn_flash_l4t, LV_BTN_STATE_INA); lv_btn_set_state(btn_flash_l4t, LV_BTN_STATE_INA);
} }
int part_type_and = _get_available_android_partition();
// Create Flash Android button. // Create Flash Android button.
btn_flash_android = lv_btn_create(h1, NULL); btn_flash_android = lv_btn_create(h1, NULL);
label_btn = lv_label_create(btn_flash_android, NULL); label_btn = lv_label_create(btn_flash_android, NULL);
lv_btn_set_fit(btn_flash_android, true, true); lv_btn_set_fit(btn_flash_android, true, true);
switch (part_type_and) lv_label_set_static_text(label_btn, SYMBOL_DOWNLOAD" Flash Android");
{
case 0: // Disable Flash Android button if partition not found.
lv_label_set_static_text(label_btn, SYMBOL_DOWNLOAD" Flash Android");
lv_obj_set_click(btn_flash_android, false);
lv_btn_set_state(btn_flash_android, LV_BTN_STATE_INA);
break;
case 1: // Android 10/11.
lv_label_set_static_text(label_btn, SYMBOL_DOWNLOAD" Flash Android 10/11");
break;
case 2: // Android 13+
lv_label_set_static_text(label_btn, SYMBOL_DOWNLOAD" Flash Android 13+");
break;
}
lv_obj_align(btn_flash_android, btn_flash_l4t, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 3, 0); lv_obj_align(btn_flash_android, btn_flash_l4t, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 3, 0);
lv_btn_set_action(btn_flash_android, LV_BTN_ACTION_CLICK, _action_flash_android); lv_btn_set_action(btn_flash_android, LV_BTN_ACTION_CLICK, _action_flash_android);
// Disable Flash Android button if partition not found.
if (!_get_available_android_partition())
{
lv_obj_set_click(btn_flash_android, false);
lv_btn_set_state(btn_flash_android, LV_BTN_STATE_INA);
}
// Create next step button. // Create next step button.
btn1 = lv_btn_create(h1, NULL); btn1 = lv_btn_create(h1, NULL);
label_btn = lv_label_create(btn1, NULL); label_btn = lv_label_create(btn1, NULL);

View file

@ -76,7 +76,7 @@ static const u8 master_kekseed_620[SE_KEY_128_SIZE] =
//!TODO: Update on mkey changes. //!TODO: Update on mkey changes.
static const u8 master_kekseed_t210_max[SE_KEY_128_SIZE] = static const u8 master_kekseed_t210_max[SE_KEY_128_SIZE] =
{ 0xD7, 0x63, 0x74, 0x46, 0x4E, 0xBA, 0x78, 0x0A, 0x7C, 0x9D, 0xB3, 0xE8, 0x7A, 0x3D, 0x71, 0xE3 }; // 19.0.0. { 0x00, 0x04, 0x5D, 0xF0, 0x4D, 0xCD, 0x14, 0xA3, 0x1C, 0xBF, 0xDE, 0x48, 0x55, 0xBA, 0x35, 0xC1 }; // 18.0.0.
//!TODO: Update on mkey changes. //!TODO: Update on mkey changes.
static const u8 master_kekseed_t210b01[HOS_KB_VERSION_MAX - HOS_KB_VERSION_600 + 1][SE_KEY_128_SIZE] = { static const u8 master_kekseed_t210b01[HOS_KB_VERSION_MAX - HOS_KB_VERSION_600 + 1][SE_KEY_128_SIZE] = {
@ -93,7 +93,6 @@ static const u8 master_kekseed_t210b01[HOS_KB_VERSION_MAX - HOS_KB_VERSION_600 +
{ 0xA5, 0xEC, 0x16, 0x39, 0x1A, 0x30, 0x16, 0x08, 0x2E, 0xCF, 0x09, 0x6F, 0x5E, 0x7C, 0xEE, 0xA9 }, // 16.0.0. { 0xA5, 0xEC, 0x16, 0x39, 0x1A, 0x30, 0x16, 0x08, 0x2E, 0xCF, 0x09, 0x6F, 0x5E, 0x7C, 0xEE, 0xA9 }, // 16.0.0.
{ 0x8D, 0xEE, 0x9E, 0x11, 0x36, 0x3A, 0x9B, 0x0A, 0x6A, 0xC7, 0xBB, 0xE9, 0xD1, 0x03, 0xF7, 0x80 }, // 17.0.0. { 0x8D, 0xEE, 0x9E, 0x11, 0x36, 0x3A, 0x9B, 0x0A, 0x6A, 0xC7, 0xBB, 0xE9, 0xD1, 0x03, 0xF7, 0x80 }, // 17.0.0.
{ 0x4F, 0x41, 0x3C, 0x3B, 0xFB, 0x6A, 0x01, 0x2A, 0x68, 0x9F, 0x83, 0xE9, 0x53, 0xBD, 0x16, 0xD2 }, // 18.0.0. { 0x4F, 0x41, 0x3C, 0x3B, 0xFB, 0x6A, 0x01, 0x2A, 0x68, 0x9F, 0x83, 0xE9, 0x53, 0xBD, 0x16, 0xD2 }, // 18.0.0.
{ 0x31, 0xBE, 0x25, 0xFB, 0xDB, 0xB4, 0xEE, 0x49, 0x5C, 0x77, 0x05, 0xC2, 0x36, 0x9F, 0x34, 0x80 }, // 19.0.0.
}; };
static const u8 console_keyseed[SE_KEY_128_SIZE] = static const u8 console_keyseed[SE_KEY_128_SIZE] =
@ -125,7 +124,6 @@ static const u8 mkey_vectors[HOS_KB_VERSION_MAX + 1][SE_KEY_128_SIZE] = {
{ 0xAF, 0x11, 0x4C, 0x67, 0x17, 0x7A, 0x52, 0x43, 0xF7, 0x70, 0x2F, 0xC7, 0xEF, 0x81, 0x72, 0x16 }, // Mkey 14 encrypted with mkey 15. { 0xAF, 0x11, 0x4C, 0x67, 0x17, 0x7A, 0x52, 0x43, 0xF7, 0x70, 0x2F, 0xC7, 0xEF, 0x81, 0x72, 0x16 }, // Mkey 14 encrypted with mkey 15.
{ 0x25, 0x12, 0x8B, 0xCB, 0xB5, 0x46, 0xA1, 0xF8, 0xE0, 0x52, 0x15, 0xB7, 0x0B, 0x57, 0x00, 0xBD }, // Mkey 15 encrypted with mkey 16. { 0x25, 0x12, 0x8B, 0xCB, 0xB5, 0x46, 0xA1, 0xF8, 0xE0, 0x52, 0x15, 0xB7, 0x0B, 0x57, 0x00, 0xBD }, // Mkey 15 encrypted with mkey 16.
{ 0x58, 0x15, 0xD2, 0xF6, 0x8A, 0xE8, 0x19, 0xAB, 0xFB, 0x2D, 0x52, 0x9D, 0xE7, 0x55, 0xF3, 0x93 }, // Mkey 16 encrypted with mkey 17. { 0x58, 0x15, 0xD2, 0xF6, 0x8A, 0xE8, 0x19, 0xAB, 0xFB, 0x2D, 0x52, 0x9D, 0xE7, 0x55, 0xF3, 0x93 }, // Mkey 16 encrypted with mkey 17.
{ 0x4A, 0x01, 0x3B, 0xC7, 0x44, 0x6E, 0x45, 0xBD, 0xE6, 0x5E, 0x2B, 0xEC, 0x07, 0x37, 0x52, 0x86 }, // Mkey 17 encrypted with mkey 18.
}; };
//!TODO: Update on mkey changes. //!TODO: Update on mkey changes.
@ -145,7 +143,6 @@ static const u8 new_console_keyseed[HOS_KB_VERSION_MAX - HOS_KB_VERSION_400 + 1]
{ 0xEA, 0x90, 0x6E, 0xA8, 0xAE, 0x92, 0x99, 0x64, 0x36, 0xC1, 0xF3, 0x1C, 0xC6, 0x32, 0x83, 0x8C }, // 16.0.0 New Device Key Source. { 0xEA, 0x90, 0x6E, 0xA8, 0xAE, 0x92, 0x99, 0x64, 0x36, 0xC1, 0xF3, 0x1C, 0xC6, 0x32, 0x83, 0x8C }, // 16.0.0 New Device Key Source.
{ 0xDA, 0xB9, 0xD6, 0x77, 0x52, 0x2D, 0x1F, 0x78, 0x73, 0xC9, 0x98, 0x5B, 0x06, 0xFE, 0xA0, 0x52 }, // 17.0.0 New Device Key Source. { 0xDA, 0xB9, 0xD6, 0x77, 0x52, 0x2D, 0x1F, 0x78, 0x73, 0xC9, 0x98, 0x5B, 0x06, 0xFE, 0xA0, 0x52 }, // 17.0.0 New Device Key Source.
{ 0x14, 0xF5, 0xA5, 0xD0, 0x73, 0x6D, 0x44, 0x80, 0x5F, 0x31, 0x5A, 0x8F, 0x1E, 0xD4, 0x0D, 0x63 }, // 18.0.0 New Device Key Source. { 0x14, 0xF5, 0xA5, 0xD0, 0x73, 0x6D, 0x44, 0x80, 0x5F, 0x31, 0x5A, 0x8F, 0x1E, 0xD4, 0x0D, 0x63 }, // 18.0.0 New Device Key Source.
{ 0x07, 0x38, 0x9A, 0xEC, 0x9C, 0xBD, 0x50, 0x4A, 0x4C, 0x1F, 0x04, 0xDA, 0x40, 0x68, 0x29, 0xE3 }, // 19.0.0 New Device Key Source.
}; };
//!TODO: Update on mkey changes. //!TODO: Update on mkey changes.
@ -165,7 +162,6 @@ static const u8 new_console_kekseed[HOS_KB_VERSION_MAX - HOS_KB_VERSION_400 + 1]
{ 0xF0, 0xF3, 0xFF, 0x52, 0x75, 0x2F, 0xBA, 0x4D, 0x09, 0x72, 0x30, 0x89, 0xA9, 0xDF, 0xFE, 0x1F }, // 16.0.0 New Device Keygen Source. { 0xF0, 0xF3, 0xFF, 0x52, 0x75, 0x2F, 0xBA, 0x4D, 0x09, 0x72, 0x30, 0x89, 0xA9, 0xDF, 0xFE, 0x1F }, // 16.0.0 New Device Keygen Source.
{ 0x21, 0xD6, 0x35, 0xF1, 0x0F, 0x7A, 0xF0, 0x5D, 0xDF, 0x79, 0x1C, 0x7A, 0xE4, 0x32, 0x82, 0x9E }, // 17.0.0 New Device Keygen Source. { 0x21, 0xD6, 0x35, 0xF1, 0x0F, 0x7A, 0xF0, 0x5D, 0xDF, 0x79, 0x1C, 0x7A, 0xE4, 0x32, 0x82, 0x9E }, // 17.0.0 New Device Keygen Source.
{ 0xE7, 0x85, 0x8C, 0xA2, 0xF4, 0x49, 0xCB, 0x07, 0xD1, 0x8E, 0x48, 0x1B, 0xE8, 0x1E, 0x28, 0x3B }, // 18.0.0 New Device Keygen Source. { 0xE7, 0x85, 0x8C, 0xA2, 0xF4, 0x49, 0xCB, 0x07, 0xD1, 0x8E, 0x48, 0x1B, 0xE8, 0x1E, 0x28, 0x3B }, // 18.0.0 New Device Keygen Source.
{ 0x9B, 0xA5, 0xFD, 0x74, 0x7F, 0xCD, 0x23, 0xD1, 0xD9, 0xBD, 0x6C, 0x51, 0x72, 0x5F, 0x3D, 0x1F }, // 19.0.0 New Device Keygen Source.
}; };
static const u8 gen_keyseed[SE_KEY_128_SIZE] = static const u8 gen_keyseed[SE_KEY_128_SIZE] =
@ -367,7 +363,7 @@ int hos_keygen(void *keyblob, u32 kb, tsec_ctxt_t *tsec_ctxt)
_hos_eks_get(); _hos_eks_get();
// Use tsec keygen for old firmware or if EKS keys does not exist for newer. // Use tsec keygen for old firmware or if EKS keys does not exist for newer.
if (kb <= HOS_KB_VERSION_620 || !h_cfg.eks || (h_cfg.eks->enabled != HOS_EKS_TSEC_VER)) if (kb <= HOS_KB_VERSION_620 || !h_cfg.eks || (h_cfg.eks && h_cfg.eks->enabled != HOS_EKS_TSEC_VER))
use_tsec = true; use_tsec = true;
if (kb <= HOS_KB_VERSION_600) if (kb <= HOS_KB_VERSION_600)

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2018 naehrwert * Copyright (c) 2018 naehrwert
* Copyright (c) 2018-2024 CTCaer * Copyright (c) 2018-2023 CTCaer
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -45,8 +45,7 @@ enum {
HOS_KB_VERSION_1600 = 15, HOS_KB_VERSION_1600 = 15,
HOS_KB_VERSION_1700 = 16, HOS_KB_VERSION_1700 = 16,
HOS_KB_VERSION_1800 = 17, HOS_KB_VERSION_1800 = 17,
HOS_KB_VERSION_1900 = 18, HOS_KB_VERSION_MAX = HOS_KB_VERSION_1800
HOS_KB_VERSION_MAX = HOS_KB_VERSION_1900
}; };
#define HOS_TSEC_VERSION 4 //! TODO: Update on TSEC Root Key changes. #define HOS_TSEC_VERSION 4 //! TODO: Update on TSEC Root Key changes.

View file

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2018 naehrwert * Copyright (c) 2018 naehrwert
* Copyright (c) 2018 st4rk * Copyright (c) 2018 st4rk
* Copyright (c) 2018-2024 CTCaer * Copyright (c) 2018-2023 CTCaer
* Copyright (c) 2018 balika011 * Copyright (c) 2018 balika011
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -66,8 +66,7 @@ static const pkg1_id_t _pkg1_ids[] = {
{ "20220801", 14, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 15.0.0 - 15.0.1. { "20220801", 14, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 15.0.0 - 15.0.1.
{ "20230111", 15, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 16.0.0 - 16.1.0. { "20230111", 15, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 16.0.0 - 16.1.0.
{ "20230906", 16, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 17.0.0 - 17.0.1. { "20230906", 16, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 17.0.0 - 17.0.1.
{ "20240207", 17, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 18.0.0 - 18.1.0. { "20240207", 17, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 18.0.0+
{ "20240808", 18, 0x0E00, 0x6FE0, 0x40030000, 0x4003E000 }, // 19.0.0+
}; };
const pkg1_id_t *pkg1_identify(u8 *pkg1, char *build_date) const pkg1_id_t *pkg1_identify(u8 *pkg1, char *build_date)

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2018 naehrwert * Copyright (c) 2018 naehrwert
* Copyright (c) 2018-2024 CTCaer * Copyright (c) 2018-2023 CTCaer
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@ -113,8 +113,6 @@ static const u8 mkey_vector_7xx[HOS_KB_VERSION_MAX - HOS_KB_VERSION_810 + 1][SE_
{ 0x25, 0x12, 0x8B, 0xCB, 0xB5, 0x46, 0xA1, 0xF8, 0xE0, 0x52, 0x15, 0xB7, 0x0B, 0x57, 0x00, 0xBD }, { 0x25, 0x12, 0x8B, 0xCB, 0xB5, 0x46, 0xA1, 0xF8, 0xE0, 0x52, 0x15, 0xB7, 0x0B, 0x57, 0x00, 0xBD },
// Master key 16 encrypted with 17. (17.0.0 with 18.0.0) // Master key 16 encrypted with 17. (17.0.0 with 18.0.0)
{ 0x58, 0x15, 0xD2, 0xF6, 0x8A, 0xE8, 0x19, 0xAB, 0xFB, 0x2D, 0x52, 0x9D, 0xE7, 0x55, 0xF3, 0x93 }, { 0x58, 0x15, 0xD2, 0xF6, 0x8A, 0xE8, 0x19, 0xAB, 0xFB, 0x2D, 0x52, 0x9D, 0xE7, 0x55, 0xF3, 0x93 },
// Master key 17 encrypted with 18. (18.0.0 with 19.0.0)
{ 0x4A, 0x01, 0x3B, 0xC7, 0x44, 0x6E, 0x45, 0xBD, 0xE6, 0x5E, 0x2B, 0xEC, 0x07, 0x37, 0x52, 0x86 },
}; };
static bool _pkg2_key_unwrap_validate(pkg2_hdr_t *tmp_test, pkg2_hdr_t *hdr, u8 src_slot, u8 *mkey, const u8 *key_seed) static bool _pkg2_key_unwrap_validate(pkg2_hdr_t *tmp_test, pkg2_hdr_t *hdr, u8 src_slot, u8 *mkey, const u8 *key_seed)