X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FUSB%2FCore%2Fusb.h;h=8759ee1de3d40e84ad42d65a8e8be3323ed4b449;hb=3e39f3e998538521830c10da09fe14c7a7dc66bd;hp=c0cf7854a1425bfd59e083f8198b334a33840d87;hpb=f8b9bcd7dba0da30a4ae21aa0e7d5feae2db3841;p=tpg%2Facess2.git diff --git a/Modules/USB/Core/usb.h b/Modules/USB/Core/usb.h index c0cf7854..8759ee1d 100644 --- a/Modules/USB/Core/usb.h +++ b/Modules/USB/Core/usb.h @@ -5,19 +5,51 @@ #ifndef _USB_H_ #define _USB_H_ -// === TYPES === +#include +#include +#include + typedef struct sUSBHost tUSBHost; typedef struct sUSBDevice tUSBDevice; +typedef struct sUSBEndpoint tUSBEndpoint; // === STRUCTURES === /** - * \brief Defines a USB Host Controller + * \brief USB Hub data */ -struct sUSBHost +struct sUSBHub +{ + tUSBInterface *Interface; + + int nPorts; + tUSBDevice *Devices[]; +}; + +struct sUSBEndpoint +{ + tUSBEndpoint *Next; // In the poll list + tUSBInterface *Interface; + int EndpointNum; + + int PollingPeriod; // In 1ms intervals + int MaxPacketSize; // In bytes + + Uint8 Type; // Same as sUSBDriver.Endpoints.Type +}; + +/** + * \brief Structure for a device's interface + */ +struct sUSBInterface { - int (*SendIN)(void *Ptr, int Fcn, int Endpt, int DataTgl, void *Data, size_t Length); - int (*SendOUT)(void *Ptr, int Fcn, int Endpt, int DataTgl, void *Data, size_t Length); - int (*SendSETUP)(void *Ptr, int Fcn, int Endpt, int DataTgl, void *Data, size_t Length); + tUSBInterface *Next; + tUSBDevice *Dev; + + tUSBDriver *Driver; + void *Data; + + int nEndpoints; + tUSBEndpoint Endpoints[]; }; /** @@ -25,16 +57,32 @@ struct sUSBHost */ struct sUSBDevice { - tUSBHost *HostDef; - void *Controller; + tUSBHub *ParentHub; + /** + * \brief Host controller used + */ + tUSBHost *Host; int Address; - int MaxControl; - int MaxBulk; - int MaxISync; + int nInterfaces; + tUSBInterface *Interfaces[]; +}; + +struct sUSBHost +{ + struct sUSBHost *Next; + + tUSBHostDef *HostDef; + void *Ptr; + + Uint8 AddressBitmap[128/8]; + + tUSBDevice RootHubDev; + tUSBInterface RootHubIf; + tUSBHub RootHub; }; -extern void USB_RegisterHost(tUSBHost *HostDef, void *ControllerPtr); +extern void USB_NewDevice(tUSBHub *Hub); #endif