firmware/ice40-riscv: Create a reboot() function
instead of direct access to registers. Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: Iaee092c5ef651f0350b3f46386ed79fdbe06afcb
This commit is contained in:
parent
4ea7d27764
commit
46d6b412f5
|
@ -55,8 +55,7 @@ boot_dfu(void)
|
||||||
usb_disconnect();
|
usb_disconnect();
|
||||||
|
|
||||||
/* Boot firmware */
|
/* Boot firmware */
|
||||||
volatile uint32_t *boot = (void*)MISC_BASE;
|
reboot(1);
|
||||||
*boot = (1 << 2) | (1 << 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -35,3 +35,10 @@ e1_tick_read(uint16_t *ticks)
|
||||||
ticks[0] = (v ) & 0xffff;
|
ticks[0] = (v ) & 0xffff;
|
||||||
ticks[1] = (v >> 16) & 0xffff;
|
ticks[1] = (v >> 16) & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
reboot(int fw)
|
||||||
|
{
|
||||||
|
misc_regs->warmboot = (1 << 2) | (fw << 0);
|
||||||
|
}
|
||||||
|
|
|
@ -13,3 +13,5 @@
|
||||||
void vio_set(unsigned value);
|
void vio_set(unsigned value);
|
||||||
|
|
||||||
void e1_tick_read(uint16_t *ticks);
|
void e1_tick_read(uint16_t *ticks);
|
||||||
|
|
||||||
|
void reboot(int fw);
|
||||||
|
|
|
@ -53,8 +53,7 @@ boot_dfu(void)
|
||||||
usb_disconnect();
|
usb_disconnect();
|
||||||
|
|
||||||
/* Boot firmware */
|
/* Boot firmware */
|
||||||
volatile uint32_t *boot = (void*)(MISC_BASE);
|
reboot(1);
|
||||||
*boot = (1 << 2) | (1 << 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -56,3 +56,9 @@ e1_tick_read(void)
|
||||||
{
|
{
|
||||||
return misc_regs->e1_tick[0].tx;
|
return misc_regs->e1_tick[0].tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
reboot(int fw)
|
||||||
|
{
|
||||||
|
misc_regs->warmboot = (1 << 2) | (fw << 0);
|
||||||
|
}
|
||||||
|
|
|
@ -28,3 +28,5 @@ void pdm_set(int chan, bool enable, unsigned value, bool normalize);
|
||||||
|
|
||||||
void e1_led_set(bool enable, uint8_t cfg);
|
void e1_led_set(bool enable, uint8_t cfg);
|
||||||
uint16_t e1_tick_read(void);
|
uint16_t e1_tick_read(void);
|
||||||
|
|
||||||
|
void reboot(int fw);
|
||||||
|
|
Loading…
Reference in New Issue