usb_canbus: No need to check if canserial can accept a packet

The canserial code already advertizes a receive window, so the host
should never flood the canserial code.  Remove the extra scheduling
checks to simplify the usb_canbus code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2023-04-15 12:21:46 -04:00
parent 3377f29bc5
commit 28f11244c3
3 changed files with 8 additions and 13 deletions

View File

@@ -204,20 +204,16 @@ usbcan_task(void)
msg.dlc = gs->can_dlc;
msg.data32[0] = gs->data32[0];
msg.data32[1] = gs->data32[1];
if (host_status & HS_TX_LOCAL) {
canserial_process_data(&msg);
UsbCan.host_status = host_status = host_status & ~HS_TX_LOCAL;
}
if (host_status & HS_TX_HW) {
ret = canhw_send(&msg);
if (ret < 0)
return;
UsbCan.host_status = host_status = host_status & ~HS_TX_HW;
}
if (host_status & HS_TX_LOCAL) {
ret = canserial_process_data(&msg);
if (ret < 0) {
usb_notify_bulk_out();
return;
}
UsbCan.host_status = host_status & ~HS_TX_LOCAL;
}
continue;
}