1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-22 18:06:40 +00:00

bdk: constify various args

This commit is contained in:
CTCaer 2024-10-04 21:45:57 +03:00
parent b1bc6ebdd8
commit 9e239df39e
20 changed files with 36 additions and 35 deletions

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.
void *fb_curr = (void *)DISPLAY_A(_DIREG(DC_WINBUF_START_ADDR)); const 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(vic_surface_t *sfc) void vic_set_surface(const 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(vic_surface_t *sfc); void vic_set_surface(const vic_surface_t *sfc);
int vic_compose(); int vic_compose();
int vic_init(); int vic_init();
void vic_end(); void vic_end();

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;
bool init_done; u32 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(void *ctr) static void _se_aes_ctr_set(const 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, void *key, u32 size) void se_aes_key_set(u32 ks, const 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, void *key, u32 size)
} }
} }
void se_aes_iv_set(u32 ks, void *iv) void se_aes_iv_set(u32 ks, const 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, void *key, u32 size); void se_aes_key_set(u32 ks, const void *key, u32 size);
void se_aes_iv_set(u32 ks, void *iv); void se_aes_iv_set(u32 ks, const 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

@ -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()
{ {
clk_rst_t *clk = &_clock_sdmmc_legacy_tm; const 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,6 +150,7 @@
#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(u32 *words, u32 count) static u32 _parity32_even(const 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 = 0; u32 word0;
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 = 0; u32 word0;
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, u8 *buf, u32 size) static int _i2c_send_single(u32 i2c_idx, u32 dev_addr, const 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, u8 *buf, u32 size) int i2c_send_buf_small(u32 i2c_idx, u32 dev_addr, u32 reg, const 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, u8 *buf, u32 size); int i2c_send_buf_small(u32 i2c_idx, u32 dev_addr, u32 reg, const 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

@ -274,7 +274,7 @@ void *sd_file_read(const char *path, u32 *fsize)
return buf; return buf;
} }
int sd_save_to_file(void *buf, u32 size, const char *filename) int sd_save_to_file(const 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(void *buf, u32 size, const char *filename); int sd_save_to_file(const 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(u32 *resp, u32 start, u32 size) static inline u32 unstuff_bits(const 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(u32 *raw_cid) void _sd_storage_debug_print_cid(const u32 *raw_cid)
{ {
gfx_printf("Card Identification\n"); gfx_printf("Card Identification\n");
@ -799,7 +799,7 @@ void _sd_storage_debug_print_cid(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(u32 *raw_csd) void _sd_storage_debug_print_csd(const u32 *raw_csd)
{ {
gfx_printf("\n"); gfx_printf("\n");
@ -836,7 +836,7 @@ void _sd_storage_debug_print_csd(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(u32 *raw_scr) void _sd_storage_debug_print_scr(const 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(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(u8 *raw_ssr) void _sd_storage_debug_print_ssr(const 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, sdmmc_cmd_t *cmd, bool is_data_present) static int _sdmmc_send_cmd(sdmmc_t *sdmmc, const 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, sdmmc_req_t *req) static int _sdmmc_config_sdma(sdmmc_t *sdmmc, u32 *blkcnt_out, const 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(jc_gamepad_rpt_t *jc_pad) static bool _jc_calibration(const 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

@ -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, void *trb, bool ring_doorbell) static int _xusb_queue_trb(u32 ep_idx, const 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(transfer_event_trb_t *trb) static int _xusb_handle_transfer_event(const 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(usb_ctrl_setup_t *ctrl_setup) static int _xusb_handle_get_class_request(const 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(usb_ctrl_setup_t *ctrl_setup) static int _xusb_handle_get_descriptor(const usb_ctrl_setup_t *ctrl_setup)
{ {
u32 size; u32 size;
void *descriptor; void *descriptor;
@ -1621,7 +1621,7 @@ static int _xusb_handle_get_descriptor(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(usb_ctrl_setup_t *ctrl_setup) static void _xusb_handle_set_request_dev_address(const 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(usb_ctrl_setup_t *ctrl_setup)
usbd_xotg->device_state = XUSB_ADDRESSED_STS_WAIT; usbd_xotg->device_state = XUSB_ADDRESSED_STS_WAIT;
} }
static void _xusb_handle_set_request_configuration(usb_ctrl_setup_t *ctrl_setup) static void _xusb_handle_set_request_configuration(const usb_ctrl_setup_t *ctrl_setup)
{ {
usbd_xotg->config_num = ctrl_setup->wValue; usbd_xotg->config_num = ctrl_setup->wValue;

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, char *ini_path, bool is_dir) int ini_parse(link_t *dst, const char *ini_path, bool is_dir)
{ {
FIL fp; FIL fp;
u32 lblen; u32 lblen;

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, char *ini_path, bool is_dir); int ini_parse(link_t *dst, const 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);