bios/boot: remove SFL_CMD_LOAD_NO_CRC support (non longer useful since CRC checking is now fast).

This commit is contained in:
Florent Kermarrec 2020-12-03 12:11:48 +01:00
parent 136db6a0ca
commit 172dc18dfb
2 changed files with 12 additions and 16 deletions

View File

@ -189,20 +189,18 @@ int serialboot(void)
frame.payload[i] = uart_read();
/* Check Frame CRC (if CMD has a CRC) */
if (frame.cmd != SFL_CMD_LOAD_NO_CRC) {
actualcrc = ((int)frame.crc[0] << 8)|(int)frame.crc[1];
goodcrc = crc16(&frame.cmd, frame.payload_length+1);
if(actualcrc != goodcrc) {
/* Clear out the RX buffer */
while (uart_read_nonblock()) uart_read();
failed++;
if(failed == MAX_FAILED) {
printf("Too many consecutive errors, aborting");
return 1;
}
uart_write(SFL_ACK_CRCERROR);
continue;
actualcrc = ((int)frame.crc[0] << 8)|(int)frame.crc[1];
goodcrc = crc16(&frame.cmd, frame.payload_length+1);
if(actualcrc != goodcrc) {
/* Clear out the RX buffer */
while (uart_read_nonblock()) uart_read();
failed++;
if(failed == MAX_FAILED) {
printf("Too many consecutive errors, aborting");
return 1;
}
uart_write(SFL_ACK_CRCERROR);
continue;
}
/* Execute Frame CMD */
@ -211,8 +209,7 @@ int serialboot(void)
failed = 0;
uart_write(SFL_ACK_SUCCESS);
return 1;
case SFL_CMD_LOAD:
case SFL_CMD_LOAD_NO_CRC: {
case SFL_CMD_LOAD: {
char *writepointer;
failed = 0;

View File

@ -19,7 +19,6 @@ struct sfl_frame {
#define SFL_CMD_ABORT 0x00
#define SFL_CMD_LOAD 0x01
#define SFL_CMD_JUMP 0x02
#define SFL_CMD_LOAD_NO_CRC 0x03
#define SFL_CMD_FLASH 0x04
#define SFL_CMD_REBOOT 0x05