aboutsummaryrefslogtreecommitdiffstats
path: root/src/generic/usb_canbus.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2023-04-15 12:21:46 -0400
committerKevin O'Connor <kevin@koconnor.net>2023-04-24 11:31:06 -0400
commit28f11244c3a91c18f0f4f3c3a02b5f20b0ff5547 (patch)
tree38820808b6873e85c664b4c4aed047c23449a060 /src/generic/usb_canbus.c
parent3377f29bc54938ab2820ff6b5212ce525e12b511 (diff)
downloadkutter-28f11244c3a91c18f0f4f3c3a02b5f20b0ff5547.tar.gz
kutter-28f11244c3a91c18f0f4f3c3a02b5f20b0ff5547.tar.xz
kutter-28f11244c3a91c18f0f4f3c3a02b5f20b0ff5547.zip
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>
Diffstat (limited to 'src/generic/usb_canbus.c')
-rw-r--r--src/generic/usb_canbus.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/generic/usb_canbus.c b/src/generic/usb_canbus.c
index 602acc70..9b0bebe6 100644
--- a/src/generic/usb_canbus.c
+++ b/src/generic/usb_canbus.c
@@ -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;
}