Skip to content

Commit

Permalink
formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Nov 12, 2023
1 parent 1c4f350 commit 81ec91f
Showing 1 changed file with 158 additions and 144 deletions.
302 changes: 158 additions & 144 deletions src/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,150 +396,164 @@ static void usb_setup_irq()
uint8_t type = req->bmRequestType;
uint8_t request = req->bRequest;

switch (type)
{
case (USB_HOST_TO_DEVICE | USB_STANDARD | USB_DEVICE):
switch (request) {
case USB_CLEAR_FEATURE:
usb_clear_remote_wakeup_handler(req); // TODO: check naming & usage
break;

case USB_SET_FEATURE:
usb_set_remote_wakeup_handler(req); // TODO: check naming & usage
break;

case USB_SET_ADDRESS:
usb_set_address_handler(req);
break;

case USB_SET_DESCRIPTOR:
usb_set_descriptor_handler(req);
break;

case USB_SET_CONFIGURATION:
usb_set_configuration_handler(req);
break;

default:
STALL_EP0();
return;
}
case (USB_DEVICE_TO_HOST | USB_STANDARD | USB_DEVICE):
switch (request) {
case USB_GET_STATUS:
usb_get_device_status_handler(req);
break;

case USB_GET_DESCRIPTOR:
usb_get_descriptor_handler(req);
break;

case USB_GET_CONFIGURATION:
usb_get_configuration_handler(req);
break;

default:
STALL_EP0();
return;
}
break;
case (USB_HOST_TO_DEVICE | USB_STANDARD | USB_INTERFACE):
switch (request) {
case USB_SET_INTERFACE:
usb_set_interface_handler(req);
break;

default:
STALL_EP0();
return;
}
break;
case (USB_DEVICE_TO_HOST | USB_STANDARD | USB_INTERFACE):
switch (request) {
case USB_GET_STATUS:
usb_get_interface_status_handler(req);
break;

case USB_GET_DESCRIPTOR:
usb_get_descriptor_handler(req); // TODO: this should be exclusive to the interface
break;

case USB_GET_INTERFACE:
usb_get_interface_handler(req);
break;

default:
STALL_EP0();
return;
}
break;
case (USB_HOST_TO_DEVICE | USB_STANDARD | USB_ENDPOINT):
switch (request) {
case USB_CLEAR_FEATURE:
usb_clear_endpoint_halt_handler(req); // TODO: check naming and usage
break;

case USB_SET_FEATURE:
usb_set_endpoint_halt_handler(req); // TODO: check naming and usage
break;

default:
STALL_EP0();
return;
}
break;
case (USB_DEVICE_TO_HOST | USB_STANDARD | USB_ENDPOINT):
switch (request) {
case USB_GET_STATUS:
usb_get_endpoint_status_handler(req); // TODO: check naming and usage
break;

default:
STALL_EP0();
return;
}
break;
case (USB_HOST_TO_DEVICE | USB_CLASS | USB_INTERFACE):
switch (request) {
case USB_HID_SET_REPORT:
usb_hid_set_report_handler(req); // TODO: include hid in naming
break;

case USB_HID_SET_IDLE:
usb_hid_set_idle_handler(req);
break;

case USB_HID_SET_PROTOCOL:
usb_hid_set_protocol_handler(req);
break;

default:
STALL_EP0();
return;
}
break;
case (USB_DEVICE_TO_HOST | USB_CLASS | USB_INTERFACE):
switch (request) {
case USB_HID_GET_REPORT:
usb_hid_get_report_handler(req); // TODO: include hid in naming
break;

case USB_HID_GET_IDLE:
usb_hid_get_idle_handler(req);
break;

case USB_HID_GET_PROTOCOL:
usb_hid_get_protocol_handler(req);
break;

default:
STALL_EP0();
return;
}
break;
default:
STALL_EP0();
return;
switch (type) {
case (USB_HOST_TO_DEVICE | USB_STANDARD | USB_DEVICE):
switch (request) {
case USB_CLEAR_FEATURE:
usb_clear_remote_wakeup_handler(req); // TODO: check naming & usage
break;

case USB_SET_FEATURE:
usb_set_remote_wakeup_handler(req); // TODO: check naming & usage
break;

case USB_SET_ADDRESS:
usb_set_address_handler(req);
break;

case USB_SET_DESCRIPTOR:
usb_set_descriptor_handler(req);
break;

case USB_SET_CONFIGURATION:
usb_set_configuration_handler(req);
break;

default:
STALL_EP0();
return;
}

case (USB_DEVICE_TO_HOST | USB_STANDARD | USB_DEVICE):
switch (request) {
case USB_GET_STATUS:
usb_get_device_status_handler(req);
break;

case USB_GET_DESCRIPTOR:
usb_get_descriptor_handler(req);
break;

case USB_GET_CONFIGURATION:
usb_get_configuration_handler(req);
break;

default:
STALL_EP0();
return;
}

break;

case (USB_HOST_TO_DEVICE | USB_STANDARD | USB_INTERFACE):
switch (request) {
case USB_SET_INTERFACE:
usb_set_interface_handler(req);
break;

default:
STALL_EP0();
return;
}

break;

case (USB_DEVICE_TO_HOST | USB_STANDARD | USB_INTERFACE):
switch (request) {
case USB_GET_STATUS:
usb_get_interface_status_handler(req);
break;

case USB_GET_DESCRIPTOR:
usb_get_descriptor_handler(req); // TODO: this should be exclusive to the interface
break;

case USB_GET_INTERFACE:
usb_get_interface_handler(req);
break;

default:
STALL_EP0();
return;
}

break;

case (USB_HOST_TO_DEVICE | USB_STANDARD | USB_ENDPOINT):
switch (request) {
case USB_CLEAR_FEATURE:
usb_clear_endpoint_halt_handler(req); // TODO: check naming and usage
break;

case USB_SET_FEATURE:
usb_set_endpoint_halt_handler(req); // TODO: check naming and usage
break;

default:
STALL_EP0();
return;
}

break;

case (USB_DEVICE_TO_HOST | USB_STANDARD | USB_ENDPOINT):
switch (request) {
case USB_GET_STATUS:
usb_get_endpoint_status_handler(req); // TODO: check naming and usage
break;

default:
STALL_EP0();
return;
}

break;

case (USB_HOST_TO_DEVICE | USB_CLASS | USB_INTERFACE):
switch (request) {
case USB_HID_SET_REPORT:
usb_hid_set_report_handler(req); // TODO: include hid in naming
break;

case USB_HID_SET_IDLE:
usb_hid_set_idle_handler(req);
break;

case USB_HID_SET_PROTOCOL:
usb_hid_set_protocol_handler(req);
break;

default:
STALL_EP0();
return;
}

break;

case (USB_DEVICE_TO_HOST | USB_CLASS | USB_INTERFACE):
switch (request) {
case USB_HID_GET_REPORT:
usb_hid_get_report_handler(req); // TODO: include hid in naming
break;

case USB_HID_GET_IDLE:
usb_hid_get_idle_handler(req);
break;

case USB_HID_GET_PROTOCOL:
usb_hid_get_protocol_handler(req);
break;

default:
STALL_EP0();
return;
}

break;

default:
STALL_EP0();
return;
}
}

Expand Down

0 comments on commit 81ec91f

Please sign in to comment.