USB host library, support isochronous,bulk,interrupt and control.
Dependents: BaseUsbHost_example BaseJpegDecode_example SimpleJpegDecode_example
Import programBaseUsbHost_example
BaseUsbHost example program
Diff: BaseUsbHost.h
- Revision:
- 2:fe1e62051d88
- Parent:
- 1:3b7bc4f87a61
- Child:
- 3:ae77d63a1eda
--- a/BaseUsbHost.h Wed Dec 05 13:23:06 2012 +0000 +++ b/BaseUsbHost.h Tue Dec 11 15:26:54 2012 +0000 @@ -1,11 +1,11 @@ -// BaseUsbHost.h 2012/12/5 +// BaseUsbHost.h 2012/12/11 #ifndef BASE_USB_HOST_H #define BASE_USB_HOST_H -#define USB_OK 0 -#define USB_ERROR -1 -#define USB_TIMEOUT -2 -#define USB_ERROR2 -3 +#define USB_OK 0 +#define USB_PROCESSING -1 +#define USB_ERROR -2 +#define USB_ERROR_MEMORY -3 // USB STANDARD REQUEST DEFINITIONS #define USB_DESCRIPTOR_TYPE_DEVICE 1 @@ -188,10 +188,10 @@ IsochronousEp(int addr, uint8_t ep, uint16_t size); virtual void irqWdhHandler(HCTD* td); void reset(); - HCITD* isochronousReveive(); - int isochronousSend(uint8_t* buf, int len); + HCITD* isochronousReveive(int millisec=osWaitForever); + int isochronousSend(uint8_t* buf, int len, int millisec=osWaitForever); HCITD* new_HCITD(); - HCITD* get_queue_HCITD(uint32_t millisec); + HCITD* get_queue_HCITD(int millisec); int m_itd_queue_count; uint16_t m_FrameNumber; int m_PacketSize; // 128,192 @@ -204,12 +204,14 @@ class UsbHub { public: UsbHub(ControlEp* ctlEp = NULL); + ControlEp* GetPortEp(int port); // port: 1-4 + int SetPortPower(int port); + int ClearPortPower(int port); +protected: void DeviceConnected(int port, int low_speed); int PortReset(int port); - // int SetPortFeature(int feature, int index); int ClearPortFeature(int feature, int index); - int SetPortPower(int port); int SetPortReset(int port); int GetPortStatus(int port, uint32_t* status); ControlEp* m_ctlEp; @@ -239,7 +241,7 @@ class BaseUvc { public: - void poll(); + void poll(int millisec=osWaitForever); int Control(int req, int cs, int index, uint8_t* buf, int size); ControlEp* m_ctlEp; IsochronousEp* m_isoEp;