X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FUSB%2FCore%2Finclude%2Fusb_core.h;h=104d0e3d943950a23adbe71ad57c60a7c01329d3;hb=3e39f3e998538521830c10da09fe14c7a7dc66bd;hp=d8d16363d7af2ce78286017bed594141bebafcca;hpb=79089cf3bb4828329d224c1d1cac9250bc57f932;p=tpg%2Facess2.git diff --git a/Modules/USB/Core/include/usb_core.h b/Modules/USB/Core/include/usb_core.h index d8d16363..104d0e3d 100644 --- a/Modules/USB/Core/include/usb_core.h +++ b/Modules/USB/Core/include/usb_core.h @@ -8,7 +8,7 @@ #ifndef _USB_CORE_H_ #define _USB_CORE_H_ -typedef struct sUSBDevice tUSBDevice; +typedef struct sUSBInterface tUSBInterface; typedef struct sUSBDriver tUSBDriver; /** @@ -18,29 +18,43 @@ struct sUSBDriver tUSBDriver *Next; const char *Name; - - // 23:16 - Interface Class - // 15:8 - Interface Sub Class - // 7:0 - Interface Protocol - Uint32 ClassMask; - Uint32 ClassCode; - void (*Connected)(tUSBDevice *Dev); - void (*Disconnected)(tUSBDevice *Dev); + int MatchType; // 0: Interface, 1: Device, 2: Vendor + union { + struct { + // 23:16 - Interface Class + // 15:8 - Interface Sub Class + // 7:0 - Interface Protocol + Uint32 ClassMask; + Uint32 ClassCode; + } Class; + struct { + Uint16 VendorID; + Uint16 DeviceID; + } VendorDev; + } Match; + + void (*Connected)(tUSBInterface *Dev); + void (*Disconnected)(tUSBInterface *Dev); int MaxEndpoints; struct { - // 0: Bulk, 1: Control, 2: Interrupt - int Type; + // USB Attrbute byte + // NOTE: Top bit indicates the direction (1=Input) + Uint8 Attributes; // Data availiable Callback - void (*Interrupt)(tUSBDevice *Dev, int Length, void *Data); + void (*DataAvail)(tUSBInterface *Dev, int Length, void *Data); } Endpoints[]; }; -extern void *USB_GetDeviceDataPtr(tUSBDevice *Dev); -extern void USB_SetDeviceDataPtr(tUSBDevice *Dev, void *Ptr); +extern void *USB_GetDeviceDataPtr(tUSBInterface *Dev); +extern void USB_SetDeviceDataPtr(tUSBInterface *Dev, void *Ptr); -extern void USB_SendData(tUSBDevice *Dev, int Endpoint, int Length, void *Data); +extern void USB_StartPollingEndpoint(tUSBInterface *Dev, int Endpoint); +extern void USB_ReadDescriptor(tUSBInterface *Dev, int Type, int Index, int Length, void *Data); +// TODO: Async +extern void USB_SendData(tUSBInterface *Dev, int Endpoint, int Length, void *Data); +extern void USB_RecvData(tUSBInterface *Dev, int Endpoint, int Length, void *Data); #endif