X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FUSB%2FCore%2Fusb.h;h=c293c7db49b95849ea49624ed4d3c5528c979912;hb=3ab2857efdcb81ce34dabf4d07b39ad6f5ab0b4a;hp=9bc45c8e08df1149e3489dc1f3c60f4a9600387d;hpb=1474ce5c1ba164bbccfefa411883805d12a0dc62;p=tpg%2Facess2.git diff --git a/Modules/USB/Core/usb.h b/Modules/USB/Core/usb.h index 9bc45c8e..c293c7db 100644 --- a/Modules/USB/Core/usb.h +++ b/Modules/USB/Core/usb.h @@ -5,39 +5,53 @@ #ifndef _USB_H_ #define _USB_H_ -// === TYPES === +#include +#include +#include + typedef struct sUSBHost tUSBHost; -typedef struct sUSBHub tUSBHub; typedef struct sUSBDevice tUSBDevice; +typedef struct sUSBEndpoint tUSBEndpoint; // === STRUCTURES === /** - * \brief Defines a USB Host Controller type + * \brief USB Hub data */ -struct sUSBHost +struct sUSBHub { - tUSBHost *Next; + tUSBDevice *Device; + + tUSB_HubPoll CheckPorts; + + int nPorts; + tUSBDevice *Devices[]; +}; - void (*CheckPorts)(void *Ptr); +struct sUSBEndpoint +{ + tUSBInterface *Interface; + tUSBEndpoint *Next; // In the poll list + int PollingPeriod; // In 1ms intervals + int MaxPacketSize; // In bytes - void *(*SendIN)(void *Ptr, int Fcn, int Endpt, int DataTgl, int bIOC, void *Data, size_t Length); - void *(*SendOUT)(void *Ptr, int Fcn, int Endpt, int DataTgl, int bIOC, void *Data, size_t Length); - void *(*SendSETUP)(void *Ptr, int Fcn, int Endpt, int DataTgl, int bIOC, void *Data, size_t Length); + char Direction; // 1 Polled Input, 0 Output + + Uint8 Type; // Same as sDescriptor_Endpoint.Type }; /** - * \brief USB Hub data + * \brief Structure for a device's interface */ -struct sUSBHub +struct sUSBInterface { - /** - * \brief Host controller used - */ - tUSBHost *HostDef; - void *Controller; + tUSBInterface *Next; + tUSBDevice *Dev; - int nPorts; - tUSBDevice *Devices[]; + tUSBDriver *Driver; + void *Data; + + int nEndpoints; + tUSBEndpoint Endpoints[]; }; /** @@ -45,20 +59,31 @@ struct sUSBHub */ struct sUSBDevice { - tUSBDevice *Next; - tUSBDevice *Hub; + tUSBHub *ParentHub; + /** + * \brief Host controller used + */ + tUSBHost *Host; int Address; + + int nInterfaces; + tUSBInterface *Interfaces[]; +}; + +struct sUSBHost +{ + struct sUSBHost *Next; + + tUSBHostDef *HostDef; + void *Ptr; - int Type; + Uint8 AddressBitmap[128/8]; - union { - tUSBHub Hub; - char Impl[0]; - } Data; + tUSBDevice RootHubDev; + tUSBHub RootHub; }; -extern void USB_RegisterHost(tUSBHost *HostDef, void *ControllerPtr); extern void USB_NewDevice(tUSBHub *Hub); #endif