123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- /*
- * Copyright (c) 2025, sakumisu
- *
- * SPDX-License-Identifier: Apache-2.0
- */
- #include "usbh_core.h"
- #include "usbh_hub.h"
- int usb_hc_init(struct usbh_bus *bus)
- {
- return 0;
- }
- int usb_hc_deinit(struct usbh_bus *bus)
- {
- return 0;
- }
- uint16_t usbh_get_frame_number(struct usbh_bus *bus)
- {
- return 0;
- }
- int usbh_roothub_control(struct usbh_bus *bus, struct usb_setup_packet *setup, uint8_t *buf)
- {
- uint8_t nports;
- uint8_t port;
- uint32_t status;
- nports = CONFIG_USBHOST_MAX_RHPORTS;
- port = setup->wIndex;
- if (setup->bmRequestType & USB_REQUEST_RECIPIENT_DEVICE) {
- switch (setup->bRequest) {
- case HUB_REQUEST_CLEAR_FEATURE:
- switch (setup->wValue) {
- case HUB_FEATURE_HUB_C_LOCALPOWER:
- break;
- case HUB_FEATURE_HUB_C_OVERCURRENT:
- break;
- default:
- return -USB_ERR_NOTSUPP;
- }
- break;
- case HUB_REQUEST_SET_FEATURE:
- switch (setup->wValue) {
- case HUB_FEATURE_HUB_C_LOCALPOWER:
- break;
- case HUB_FEATURE_HUB_C_OVERCURRENT:
- break;
- default:
- return -USB_ERR_NOTSUPP;
- }
- break;
- case HUB_REQUEST_GET_DESCRIPTOR:
- break;
- case HUB_REQUEST_GET_STATUS:
- memset(buf, 0, 4);
- break;
- default:
- break;
- }
- } else if (setup->bmRequestType & USB_REQUEST_RECIPIENT_OTHER) {
- switch (setup->bRequest) {
- case HUB_REQUEST_CLEAR_FEATURE:
- if (!port || port > nports) {
- return -USB_ERR_INVAL;
- }
- switch (setup->wValue) {
- case HUB_PORT_FEATURE_ENABLE:
- break;
- case HUB_PORT_FEATURE_SUSPEND:
- break;
- case HUB_PORT_FEATURE_C_SUSPEND:
- break;
- case HUB_PORT_FEATURE_POWER:
- break;
- case HUB_PORT_FEATURE_C_CONNECTION:
- break;
- case HUB_PORT_FEATURE_C_ENABLE:
- break;
- case HUB_PORT_FEATURE_C_OVER_CURREN:
- break;
- case HUB_PORT_FEATURE_C_RESET:
- break;
- default:
- return -USB_ERR_NOTSUPP;
- }
- break;
- case HUB_REQUEST_SET_FEATURE:
- if (!port || port > nports) {
- return -USB_ERR_INVAL;
- }
- switch (setup->wValue) {
- case HUB_PORT_FEATURE_SUSPEND:
- break;
- case HUB_PORT_FEATURE_POWER:
- break;
- case HUB_PORT_FEATURE_RESET:
- break;
- default:
- return -USB_ERR_NOTSUPP;
- }
- break;
- case HUB_REQUEST_GET_STATUS:
- if (!port || port > nports) {
- return -USB_ERR_INVAL;
- }
- memcpy(buf, &status, 4);
- break;
- default:
- break;
- }
- }
- return 0;
- }
- int usbh_submit_urb(struct usbh_urb *urb)
- {
- return -USB_ERR_NOTSUPP;
- }
- int usbh_kill_urb(struct usbh_urb *urb)
- {
- return -USB_ERR_NOTSUPP;
- }
- void USBH_IRQHandler(uint8_t busid)
- {
- }
|