mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-08 22:40:59 +00:00
trezorhal: use uint32_t* for sdcard_{read,write}_blocks
This commit is contained in:
parent
fa802e9353
commit
69c17dae9b
@ -124,7 +124,7 @@ static secbool copy_sdcard(void)
|
||||
|
||||
uint32_t buf[SDCARD_BLOCK_SIZE / sizeof(uint32_t)];
|
||||
for (int i = 0; i < (IMAGE_HEADER_SIZE + codelen) / SDCARD_BLOCK_SIZE; i++) {
|
||||
sdcard_read_blocks((uint8_t *)buf, i, 1);
|
||||
sdcard_read_blocks(buf, i, 1);
|
||||
for (int j = 0; j < SDCARD_BLOCK_SIZE / sizeof(uint32_t); j++) {
|
||||
if (sectrue != flash_write_word(BOOTLOADER_START + i * SDCARD_BLOCK_SIZE + j * sizeof(uint32_t), buf[j])) {
|
||||
display_printf("copy failed\n");
|
||||
|
@ -150,7 +150,7 @@ static HAL_StatusTypeDef sdcard_wait_finished(SD_HandleTypeDef *sd, uint32_t tim
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
secbool sdcard_read_blocks(void *dest, uint32_t block_num, uint32_t num_blocks) {
|
||||
secbool sdcard_read_blocks(uint32_t *dest, uint32_t block_num, uint32_t num_blocks) {
|
||||
// check that SD card is initialised
|
||||
if (sd_handle.Instance == NULL) {
|
||||
return secfalse;
|
||||
@ -163,7 +163,7 @@ secbool sdcard_read_blocks(void *dest, uint32_t block_num, uint32_t num_blocks)
|
||||
|
||||
HAL_StatusTypeDef err = HAL_OK;
|
||||
|
||||
err = HAL_SD_ReadBlocks(&sd_handle, dest, block_num, num_blocks, 60000);
|
||||
err = HAL_SD_ReadBlocks(&sd_handle, (uint8_t *)dest, block_num, num_blocks, 60000);
|
||||
if (err == HAL_OK) {
|
||||
err = sdcard_wait_finished(&sd_handle, 60000);
|
||||
}
|
||||
@ -171,7 +171,7 @@ secbool sdcard_read_blocks(void *dest, uint32_t block_num, uint32_t num_blocks)
|
||||
return sectrue * (err == HAL_OK);
|
||||
}
|
||||
|
||||
secbool sdcard_write_blocks(const void *src, uint32_t block_num, uint32_t num_blocks) {
|
||||
secbool sdcard_write_blocks(const uint32_t *src, uint32_t block_num, uint32_t num_blocks) {
|
||||
// check that SD card is initialised
|
||||
if (sd_handle.Instance == NULL) {
|
||||
return secfalse;
|
||||
@ -184,7 +184,7 @@ secbool sdcard_write_blocks(const void *src, uint32_t block_num, uint32_t num_bl
|
||||
|
||||
HAL_StatusTypeDef err = HAL_OK;
|
||||
|
||||
err = HAL_SD_WriteBlocks(&sd_handle, (uint8_t*)src, block_num, num_blocks, 60000);
|
||||
err = HAL_SD_WriteBlocks(&sd_handle, (uint8_t *)src, block_num, num_blocks, 60000);
|
||||
if (err == HAL_OK) {
|
||||
err = sdcard_wait_finished(&sd_handle, 60000);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ secbool sdcard_is_present(void);
|
||||
secbool sdcard_power_on(void);
|
||||
secbool sdcard_power_off(void);
|
||||
uint64_t sdcard_get_capacity_in_bytes(void);
|
||||
secbool sdcard_read_blocks(void *dest, uint32_t block_num, uint32_t num_blocks);
|
||||
secbool sdcard_write_blocks(const void *src, uint32_t block_num, uint32_t num_blocks);
|
||||
secbool sdcard_read_blocks(uint32_t *dest, uint32_t block_num, uint32_t num_blocks);
|
||||
secbool sdcard_write_blocks(const uint32_t *src, uint32_t block_num, uint32_t num_blocks);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user