#ifndef _USB_TEMPLATE_H_
#define _USB_TEMPLATE_H_
#ifndef USB_TEMPLATE_VENDOR
#define USB_TEMPLATE_VENDOR 0x0001
#endif
typedef const void *(usb_temp_get_string_desc_t)(uint16_t lang_id, uint8_t string_index);
typedef const void *(usb_temp_get_vendor_desc_t)(const struct usb_device_request *req, uint16_t *plen);
struct usb_temp_packet_size {
uint16_t mps[USB_SPEED_MAX];
};
struct usb_temp_interval {
uint8_t bInterval[USB_SPEED_MAX];
};
struct usb_temp_endpoint_desc {
const void **ppRawDesc;
const struct usb_temp_packet_size *pPacketSize;
const struct usb_temp_interval *pIntervals;
uint8_t bEndpointAddress;
uint8_t bmAttributes;
};
struct usb_temp_interface_desc {
const void **ppRawDesc;
const struct usb_temp_endpoint_desc **ppEndpoints;
uint8_t bInterfaceClass;
uint8_t bInterfaceSubClass;
uint8_t bInterfaceProtocol;
uint8_t iInterface;
uint8_t isAltInterface;
};
struct usb_temp_config_desc {
const struct usb_temp_interface_desc **ppIfaceDesc;
uint8_t bmAttributes;
uint8_t bMaxPower;
uint8_t iConfiguration;
};
struct usb_temp_device_desc {
usb_temp_get_string_desc_t *getStringDesc;
usb_temp_get_vendor_desc_t *getVendorDesc;
const struct usb_temp_config_desc **ppConfigDesc;
uint16_t idVendor;
uint16_t idProduct;
uint16_t bcdDevice;
uint8_t bDeviceClass;
uint8_t bDeviceSubClass;
uint8_t bDeviceProtocol;
uint8_t iManufacturer;
uint8_t iProduct;
uint8_t iSerialNumber;
};
struct usb_temp_data {
const struct usb_temp_device_desc *tdd;
struct usb_device_descriptor udd;
struct usb_device_qualifier udq;
};
extern const struct usb_temp_device_desc usb_template_audio;
extern const struct usb_temp_device_desc usb_template_cdce;
extern const struct usb_temp_device_desc usb_template_kbd;
extern const struct usb_temp_device_desc usb_template_modem;
extern const struct usb_temp_device_desc usb_template_mouse;
extern const struct usb_temp_device_desc usb_template_msc;
extern const struct usb_temp_device_desc usb_template_mtp;
extern const struct usb_temp_device_desc usb_template_phone;
extern const struct usb_temp_device_desc usb_template_serialnet;
usb_error_t usb_temp_setup(struct usb_device *,
const struct usb_temp_device_desc *);
void usb_temp_unsetup(struct usb_device *);
#endif