SummerCart64/fw/btldr/btldr.c

23 lines
475 B
C
Raw Normal View History

2021-08-12 21:07:47 +02:00
#include "btldr.h"
2021-08-05 19:50:29 +02:00
2021-08-12 21:07:47 +02:00
int reset_handler (void) {
io8_t pointer = &RAM;
2021-08-18 13:54:07 +02:00
uint32_t length = 0;
2021-08-12 21:07:47 +02:00
2021-08-15 21:49:02 +02:00
while (!(USB_SR & USB_SR_TXE));
USB_DR = '>';
2021-08-05 19:50:29 +02:00
2021-08-18 13:54:07 +02:00
for (int i = 0; i < 4; i++) {
while (!(USB_SR & USB_SR_RXNE));
length |= (USB_DR << (i * 8));
}
2021-08-05 19:50:29 +02:00
while (1) {
2021-08-18 13:54:07 +02:00
while (!(USB_SR & USB_SR_RXNE));
*pointer++ = USB_DR;
if ((uint32_t)pointer == length) {
2021-08-12 21:07:47 +02:00
__asm__("call 0");
2021-08-05 19:50:29 +02:00
}
}
}