A web server for monitoring and controlling a MakerBot Replicator over the USB host and ethernet.
Dependencies: IAP NTPClient RTC mbed-rtos mbed Socket lwip-sys lwip BurstSPI
Fork of LPC1768_Mini-DK by
USBHostHub.h
00001 /* mbed USBHost Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef USBHOSTHUB_H 00018 #define USBHOSTHUB_H 00019 00020 #include "USBHostConf.h" 00021 00022 #if MAX_HUB_NB 00023 00024 #include "USBHostTypes.h" 00025 #include "IUSBEnumerator.h" 00026 00027 class USBHost; 00028 class USBDeviceConnected; 00029 class USBEndpoint; 00030 00031 /** 00032 * A class to use a USB Hub 00033 */ 00034 class USBHostHub : public IUSBEnumerator { 00035 public: 00036 /** 00037 * Constructor 00038 */ 00039 USBHostHub(); 00040 00041 /** 00042 * Check if a USB Hub is connected 00043 * 00044 * @return true if a serial device is connected 00045 */ 00046 bool connected(); 00047 00048 /** 00049 * Try to connect device 00050 * 00051 * @param dev device to connect 00052 * @return true if connection was successful 00053 */ 00054 bool connect(USBDeviceConnected * dev); 00055 00056 /** 00057 * Automatically called by USBHost when a device 00058 * has been enumerated by usb_thread 00059 * 00060 * @param dev device connected 00061 */ 00062 void deviceConnected(USBDeviceConnected * dev); 00063 00064 /** 00065 * Automatically called by USBHost when a device 00066 * has been disconnected from this hub 00067 * 00068 * @param dev device disconnected 00069 */ 00070 void deviceDisconnected(USBDeviceConnected * dev); 00071 00072 /** 00073 * Rest a specific port 00074 * 00075 * @param port port number 00076 */ 00077 void portReset(uint8_t port); 00078 00079 /* 00080 * Called by USBHost to set the instance of USBHost 00081 * 00082 * @param host host instance 00083 */ 00084 void setHost(USBHost * host); 00085 00086 /** 00087 * Called by USBhost when a hub has been disconnected 00088 */ 00089 void hubDisconnected(); 00090 00091 protected: 00092 //From IUSBEnumerator 00093 virtual void setVidPid(uint16_t vid, uint16_t pid); 00094 virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed 00095 virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used 00096 00097 private: 00098 USBHost * host; 00099 USBDeviceConnected * dev; 00100 bool dev_connected; 00101 USBEndpoint * int_in; 00102 uint8_t nb_port; 00103 uint8_t hub_characteristics; 00104 00105 void rxHandler(); 00106 00107 uint8_t buf[sizeof(HubDescriptor)]; 00108 00109 int hub_intf; 00110 bool hub_device_found; 00111 00112 void setPortFeature(uint32_t feature, uint8_t port); 00113 void clearPortFeature(uint32_t feature, uint8_t port); 00114 uint32_t getPortStatus(uint8_t port); 00115 00116 USBDeviceConnected * device_children[MAX_HUB_PORT]; 00117 00118 void init(); 00119 void disconnect(); 00120 00121 }; 00122 00123 #endif 00124 00125 #endif
Generated on Tue Jul 12 2022 17:52:03 by 1.7.2