#ifndef __USB_OTG_FS_IMPL_H__ #define __USB_OTG_FS_IMPL_H__ #include "usb_otg_fs.h" #include "usb_cdc.h" //#include "usb_msc.h" class USB_OTG_FS_Impl : public USB_OTG_FS { public: static const Uint16 DESC_DEVICE_bcdUSB = 0x0200; static const Uint16 DESC_DEVICE_bcdDevice = 0x0000; static const Uint8 DESC_DEVICE_iManufacturer = 0x01; static const Uint8 DESC_DEVICE_iProduct = 0x02; static const Uint8 DESC_DEVICE_iSerialNumber = 0x03; static const Uint16 DESC_DEVICE_idVendor = 0x10C4; static const Uint8 DESC_CONFIG_bConfigurationValue = 0x01; static const Uint8 DESC_CONFIG_iConfiguration = 0x00; static const Uint8 DESC_CONFIG_bmAttributes = 0x80; static const Uint8 DESC_CONFIG_MaxPower = 0x0F; static const DeviceDescriptor DESC_DEVICE; static const ConfigurationDescriptor DESC_CONFIG; static const struct CDC_Related_Descriptor { InterfaceDescriptor i0; USB_CDC::HeaderFunctionDescriptor cdc0; USB_CDC::AbstractControlManagementFunctionalDescriptor cdc1; USB_CDC::UnionFunctionalDescriptor cdc2; USB_CDC::CallManagementFunctionalDescriptor cdc3; EndpointDescriptor e0; InterfaceDescriptor i1; EndpointDescriptor e1; EndpointDescriptor e2; } DESC_CDC; static const struct FT232_Related_Descriptor { InterfaceDescriptor i0; EndpointDescriptor e0; EndpointDescriptor e1; } DESC_FT232; static const struct MSC_Related_Descriptor { InterfaceDescriptor i0; EndpointDescriptor e0; EndpointDescriptor e1; } DESC_MSC; static const Uint8 DESC_STRING0[]; static const Uint8 DESC_STRING1[]; static const Uint8 DESC_STRING2[]; static const Uint8 DESC_STRING3[]; protected: Uint8 descriptor_buf[0x400]; bool descriptor_buf_cached; bool dma_ready; int interfaces() const; bool descriptor( const Uint16 wValue, const Uint16 wIndex, unsigned char **buf, int *size); bool setup( const int &configuration); bool class_request_handle(const SetupBuffer &buf); bool vendor_request_handle(const SetupBuffer &buf); public: //USB_FT232 ft232; USB_CDC cdc; static const Uint8 EP_INDEX_COMCTL; static const Uint8 EP_INDEX_COMDATA; static const Uint8 EP_INDEX_MSC; USB_OTG_FS_Impl(); ~USB_OTG_FS_Impl(); // override functions for using DMA void init(); Uint16 read(const Uint8 &out_index, void *buf, const Uint16 &size); Uint16 read_skip(const Uint8 &out_index, const Uint16 &size); Uint16 write(const Uint8 &in_index, const void *buf, const Uint16 &size); Uint16 write_fill(const Uint8 &in_index, const Uint8 c, const Uint16 &size); }; extern USB_OTG_FS_Impl usb_otg_fs_impl; extern "C"{ void usb0_isr(); } #endif /* __USB_OTG_FS_IMPL_H__ */