Files
mop3/kernel/device/usb/usb.h
kamkow1 024512c5e4
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 3m1s
Build documentation / build-and-deploy (push) Successful in 3m5s
XHCI parse full USB config
2026-04-02 00:00:35 +02:00

79 lines
1.7 KiB
C

#ifndef _KERNEL_DEVICE_USB_H
#define _KERNEL_DEVICE_USB_H
#include <aux/compiler.h>
#include <libk/std.h>
/* descriptor types */
#define USB_DESC_DEVICE 1
#define USB_DESC_CONFIG 2
#define USB_DESC_STRING 3
#define USB_DESC_IF 4
#define USB_DESC_ENDPOINT 5
#define USB_DESC_IF_POWER 8
#define USB_DESC_OTG 9
#define USB_DESC_DEBUG 10
#define USB_DESC_IF_ASSOC 11
#define USB_DESC_BOS 15
#define USB_DESC_DEV_CAPABILITY 16
#define USB_DESC_SS_USB_EP_COMP 48
struct usb_desc_hdr {
uint8_t length;
uint8_t desc_type;
} PACKED;
struct usb_device_desc {
struct usb_desc_hdr hdr;
uint16_t bcd_usb;
uint8_t dev_class;
uint8_t dev_subclass;
uint8_t dev_proto;
uint8_t max_packet_size; /* If USB 3.0, this must be read as (1 << max_packet_size) */
uint16_t vendor_id;
uint16_t product_id;
uint16_t bcd_device;
uint8_t manufacturer;
uint8_t product;
uint8_t serial_num;
uint8_t num_configs;
} PACKED;
struct usb_string_lang_desc {
struct usb_desc_hdr hdr;
uint16_t langs[126];
} PACKED;
struct usb_config_desc {
struct usb_desc_hdr hdr;
uint16_t total_length;
uint8_t num_ifs;
uint8_t config_value;
uint8_t config;
uint8_t attrs;
uint8_t max_power;
uint8_t data[245];
} PACKED;
struct usb_if_desc {
struct usb_desc_hdr hdr;
uint8_t if_num;
uint8_t alt_setting;
uint8_t num_endpoints;
uint8_t if_class;
uint8_t if_subclass;
uint8_t if_proto;
uint8_t if1;
} PACKED;
struct usb_endpoint_desc {
struct usb_desc_hdr hdr;
uint8_t endpoint_addr;
uint8_t attrs;
uint16_t max_packet_size;
uint8_t interval;
} PACKED;
#endif // _KERNEL_DEVICE_USB_H