mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-03 08:46:05 +00:00
refactor(core): use memset_reg in asm code only
[no changelog]
This commit is contained in:
parent
c30233b832
commit
2ecf335349
@ -45,13 +45,6 @@ void __attribute__((noreturn)) reboot_and_upgrade(const uint8_t hash[32]);
|
||||
// unrecoverable error state.
|
||||
void __attribute__((noreturn)) secure_shutdown(void);
|
||||
|
||||
// Alternative memset with slightly different arguments
|
||||
//
|
||||
// This function writes a 32-bit value to a range of memory addresses.
|
||||
// The range is defined by the start and stop pointers and must
|
||||
// be aligned to 4 bytes.
|
||||
void memset_reg(volatile void *start, volatile void *stop, uint32_t val);
|
||||
|
||||
// Jumps to the next booting stage (e.g. bootloader to firmware).
|
||||
// `address` points to the flash at the vector table of the next stage.
|
||||
//
|
||||
|
@ -240,10 +240,11 @@ __attribute((used)) void clear_otg_hs_memory(void) {
|
||||
__HAL_RCC_USB_OTG_HS_CLK_ENABLE(); // enable USB_OTG_HS peripheral clock so
|
||||
// that the peripheral memory is
|
||||
// accessible
|
||||
memset_reg(
|
||||
(volatile void *)USB_OTG_HS_DATA_FIFO_RAM,
|
||||
(volatile void *)(USB_OTG_HS_DATA_FIFO_RAM + USB_OTG_HS_DATA_FIFO_SIZE),
|
||||
0);
|
||||
__IO uint32_t* usb_fifo_ram = (__IO uint32_t*)USB_OTG_HS_DATA_FIFO_RAM;
|
||||
|
||||
for (uint32_t i = 0; i < USB_OTG_HS_DATA_FIFO_SIZE / 4; i++) {
|
||||
usb_fifo_ram[i] = 0;
|
||||
}
|
||||
|
||||
__HAL_RCC_USB_OTG_HS_CLK_DISABLE(); // disable USB OTG_HS peripheral clock as
|
||||
// the peripheral is not needed right now
|
||||
|
Loading…
Reference in New Issue
Block a user