From 6376980d9dc581ddfbec50781daa7c89005991f7 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 4 May 2023 16:25:46 +0600 Subject: [PATCH] usb: More USB endpoint device infrastructure work --- src/include/86box/usb.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/include/86box/usb.h b/src/include/86box/usb.h index 53787158e..cf5938a3d 100644 --- a/src/include/86box/usb.h +++ b/src/include/86box/usb.h @@ -47,11 +47,29 @@ typedef struct usb_t usb_params_t* usb_params; } usb_t; +#pragma pack(push, 1) +/* Base USB descriptor struct. */ +typedef struct +{ + uint8_t bLength; + uint8_t bDescriptorType; +} usb_desc_base_t; +#pragma pack(pop) + /* USB endpoint device struct. Incomplete and unused. */ typedef struct { uint16_t vendor_id; uint16_t device_id; + + /* Reads from endpoint. Non-zero value indicates error. */ + uint8_t (*device_in)(void* priv, uint8_t* data, uint32_t len); + /* Writes to endpoint. Non-zero value indicates error. */ + uint8_t (*device_out)(void* priv, uint8_t* data, uint32_t len); + /* Process setup packets. */ + uint8_t (*device_setup)(void* priv, uint8_t* data); + + void* priv; } usb_device_t; /* Global variables. */