aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2023-09-25 11:09:40 -0400
committerKevin O'Connor <kevin@koconnor.net>2023-10-03 23:29:17 -0400
commit5b204866c52bea7629f1e95ab345d0bbe8637764 (patch)
tree8ce58d8aeb5c9711369182532d15fc104a7d5f60 /src
parent472fd32cabadf6590a32f41c89d55095cc7ab59f (diff)
downloadkutter-5b204866c52bea7629f1e95ab345d0bbe8637764.tar.gz
kutter-5b204866c52bea7629f1e95ab345d0bbe8637764.tar.xz
kutter-5b204866c52bea7629f1e95ab345d0bbe8637764.zip
usb_canbus: Rename UsbCan.queue to UsbCan.canhw_queue
Rename the internal variable names. This is in preparation for support of a USB message queue. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/generic/usb_canbus.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/generic/usb_canbus.c b/src/generic/usb_canbus.c
index d776d45f..0cafac48 100644
--- a/src/generic/usb_canbus.c
+++ b/src/generic/usb_canbus.c
@@ -116,8 +116,8 @@ static struct usbcan_data {
uint32_t assigned_id;
// Data from physical canbus interface
- uint32_t pull_pos, push_pos;
- struct canbus_msg queue[32];
+ uint32_t canhw_pull_pos, canhw_push_pos;
+ struct canbus_msg canhw_queue[32];
} UsbCan;
enum {
@@ -139,16 +139,16 @@ void
canbus_process_data(struct canbus_msg *msg)
{
// Add to admin command queue
- uint32_t pushp = UsbCan.push_pos;
- if (pushp - UsbCan.pull_pos >= ARRAY_SIZE(UsbCan.queue))
+ uint32_t pushp = UsbCan.canhw_push_pos;
+ if (pushp - UsbCan.canhw_pull_pos >= ARRAY_SIZE(UsbCan.canhw_queue))
// No space - drop message
return;
if (UsbCan.assigned_id && (msg->id & ~1) == UsbCan.assigned_id)
// Id reserved for local
return;
- uint32_t pos = pushp % ARRAY_SIZE(UsbCan.queue);
- memcpy(&UsbCan.queue[pos], msg, sizeof(*msg));
- UsbCan.push_pos = pushp + 1;
+ uint32_t pos = pushp % ARRAY_SIZE(UsbCan.canhw_queue);
+ memcpy(&UsbCan.canhw_queue[pos], msg, sizeof(*msg));
+ UsbCan.canhw_push_pos = pushp + 1;
usb_notify_bulk_out();
}
@@ -167,24 +167,24 @@ send_frame(struct canbus_msg *msg)
// Send any pending hw frames to host
static void
-drain_hw_queue(void)
+drain_canhw_queue(void)
{
- uint32_t pull_pos = UsbCan.pull_pos;
+ uint32_t pull_pos = UsbCan.canhw_pull_pos;
for (;;) {
- uint32_t push_pos = readl(&UsbCan.push_pos);
+ uint32_t push_pos = readl(&UsbCan.canhw_push_pos);
if (push_pos == pull_pos) {
// No more data to send
UsbCan.usb_send_busy = 0;
return;
}
- uint32_t pos = pull_pos % ARRAY_SIZE(UsbCan.queue);
- int ret = send_frame(&UsbCan.queue[pos]);
+ uint32_t pos = pull_pos % ARRAY_SIZE(UsbCan.canhw_queue);
+ int ret = send_frame(&UsbCan.canhw_queue[pos]);
if (ret < 0) {
// USB is busy - retry later
UsbCan.usb_send_busy = 1;
return;
}
- UsbCan.pull_pos = pull_pos = pull_pos + 1;
+ UsbCan.canhw_pull_pos = pull_pos = pull_pos + 1;
}
}
@@ -195,7 +195,7 @@ usbcan_task(void)
return;
// Send any pending hw frames to host
- drain_hw_queue();
+ drain_canhw_queue();
for (;;) {
// See if previous host frame needs to be transmitted