Janitorial tab removal

This commit is contained in:
Andrew J. Kroll 2015-03-12 18:10:04 -04:00
parent 586ed62467
commit 2412be1bd9
27 changed files with 367 additions and 408 deletions

2
BTD.h
View file

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
/* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
This software may be distributed and modified under the terms of the GNU
General Public License version 2 (GPL2) as published by the Free Software

View file

@ -528,7 +528,7 @@ void USB::Task(void) //USB state machine
}
uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
//uint8_t buf[12];
//uint8_t buf[12];
uint8_t rcode;
UsbDevice *p0 = NULL, *p = NULL;
@ -733,8 +733,8 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
//printf("ERROR ENUMERATING %2.2x\r\n", rcode);
if(!(rcode == USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED || rcode == USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE)) {
// in case of an error dev_index should be reset to 0
// in order to start from the very beginning the
// next time the program gets here
// in order to start from the very beginning the
// next time the program gets here
//if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE)
// devConfigIndex = 0;
return rcode;

View file

@ -18,7 +18,7 @@ e-mail : support@circuitsathome.com
#if !defined(_usb_h_) || defined(USBCORE_H)
#error "Never include UsbCore.h directly; include Usb.h instead"
#else
#define USBCORE_H
#define USBCORE_H
// Not used anymore? If anyone uses this, please let us know so that this may be
// moved to the proper place, settings.h.
@ -46,57 +46,57 @@ typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega
#define bmREQ_SET USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //set request type for all but 'set feature' and 'set interface'
#define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type
// D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
// D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
// D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
// D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
// D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
// D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
// USB Device Classes
#define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
#define USB_CLASS_AUDIO 0x01 // Audio
#define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
#define USB_CLASS_HID 0x03 // HID
#define USB_CLASS_PHYSICAL 0x05 // Physical
#define USB_CLASS_IMAGE 0x06 // Image
#define USB_CLASS_PRINTER 0x07 // Printer
#define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
#define USB_CLASS_HUB 0x09 // Hub
#define USB_CLASS_CDC_DATA 0x0a // CDC-Data
#define USB_CLASS_SMART_CARD 0x0b // Smart-Card
#define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
#define USB_CLASS_VIDEO 0x0e // Video
#define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
#define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
#define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
#define USB_CLASS_MISC 0xef // Miscellaneous
#define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
#define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
#define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
#define USB_CLASS_AUDIO 0x01 // Audio
#define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
#define USB_CLASS_HID 0x03 // HID
#define USB_CLASS_PHYSICAL 0x05 // Physical
#define USB_CLASS_IMAGE 0x06 // Image
#define USB_CLASS_PRINTER 0x07 // Printer
#define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
#define USB_CLASS_HUB 0x09 // Hub
#define USB_CLASS_CDC_DATA 0x0a // CDC-Data
#define USB_CLASS_SMART_CARD 0x0b // Smart-Card
#define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
#define USB_CLASS_VIDEO 0x0e // Video
#define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
#define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
#define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
#define USB_CLASS_MISC 0xef // Miscellaneous
#define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
#define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
// Additional Error Codes
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
#define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
#define USB_ERROR_EPINFO_IS_NULL 0xD7
#define USB_ERROR_INVALID_ARGUMENT 0xD8
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
#define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
#define USB_ERROR_EPINFO_IS_NULL 0xD7
#define USB_ERROR_INVALID_ARGUMENT 0xD8
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET 0xE0
#define USB_ERROR_FailGetDevDescr 0xE1
#define USB_ERROR_FailSetDevTblEntry 0xE2
#define USB_ERROR_FailGetConfDescr 0xE3
#define USB_ERROR_TRANSFER_TIMEOUT 0xFF
#define USB_ERROR_TRANSFER_TIMEOUT 0xFF
#define USB_XFER_TIMEOUT 10000 //30000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec
//#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted
#define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
#define USB_SETTLE_DELAY 200 //settle delay in milliseconds
//#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted
#define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
#define USB_SETTLE_DELAY 200 //settle delay in milliseconds
#define USB_NUMDEVICES 16 //number of USB devices
//#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
#define USB_NUMDEVICES 16 //number of USB devices
//#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
/* USB state machine states */
#define USB_STATE_MASK 0xf0
@ -293,4 +293,4 @@ inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
#endif // defined(USB_METHODS_INLINE)
#endif /* USBCORE_H */
#endif /* USBCORE_H */

View file

@ -24,10 +24,10 @@ e-mail : support@circuitsathome.com
/* NAK powers. To save space in endpoint data structure, amount of retries before giving up and returning 0x4 is stored in */
/* bmNakPower as a power of 2. The actual nak_limit is then calculated as nak_limit = ( 2^bmNakPower - 1) */
#define USB_NAK_MAX_POWER 15 //NAK binary order maximum value
#define USB_NAK_DEFAULT 14 //default 32K-1 NAKs before giving up
#define USB_NAK_NOWAIT 1 //Single NAK stops transfer
#define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout
#define USB_NAK_MAX_POWER 15 //NAK binary order maximum value
#define USB_NAK_DEFAULT 14 //default 32K-1 NAKs before giving up
#define USB_NAK_NOWAIT 1 //Single NAK stops transfer
#define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout
struct EpInfo {
uint8_t epAddr; // Endpoint address
@ -44,7 +44,7 @@ struct EpInfo {
};
} __attribute__((packed));
// 7 6 5 4 3 2 1 0
// 7 6 5 4 3 2 1 0
// ---------------------------------
// | | H | P | P | P | A | A | A |
// ---------------------------------
@ -68,16 +68,16 @@ struct UsbDeviceAddress {
};
} __attribute__((packed));
#define bmUSB_DEV_ADDR_ADDRESS 0x07
#define bmUSB_DEV_ADDR_PARENT 0x38
#define bmUSB_DEV_ADDR_HUB 0x40
#define bmUSB_DEV_ADDR_ADDRESS 0x07
#define bmUSB_DEV_ADDR_PARENT 0x38
#define bmUSB_DEV_ADDR_HUB 0x40
struct UsbDevice {
EpInfo *epinfo; // endpoint info pointer
UsbDeviceAddress address;
uint8_t epcount; // number of endpoints
bool lowspeed; // indicates if a device is the low speed one
// uint8_t devclass; // device class
// uint8_t devclass; // device class
} __attribute__((packed));
class AddressPool {
@ -89,8 +89,8 @@ public:
typedef void (*UsbDeviceHandleFunc)(UsbDevice *pdev);
#define ADDR_ERROR_INVALID_INDEX 0xFF
#define ADDR_ERROR_INVALID_ADDRESS 0xFF
#define ADDR_ERROR_INVALID_INDEX 0xFF
#define ADDR_ERROR_INVALID_ADDRESS 0xFF
template <const uint8_t MAX_DEVICES_ALLOWED>
class AddressPoolImpl : public AddressPool {
@ -265,17 +265,17 @@ public:
// It can be rather helpfull to find out if there are hubs attached than getting the exact number of hubs.
//uint8_t GetNumHubs()
//{
// return hubCounter;
// return hubCounter;
//};
//uint8_t GetNumDevices()
//{
// uint8_t counter = 0;
// uint8_t counter = 0;
// for (uint8_t i=1; i<MAX_DEVICES_ALLOWED; i++)
// if (thePool[i].address != 0);
// counter ++;
// for (uint8_t i=1; i<MAX_DEVICES_ALLOWED; i++)
// if (thePool[i].address != 0);
// counter ++;
// return counter;
// return counter;
//};
};

View file

@ -293,8 +293,8 @@ FailSwAcc:
#endif
//FailOnInit:
// USBTRACE("OnInit:");
// goto Fail;
// USBTRACE("OnInit:");
// goto Fail;
//
SwAttempt:
#ifdef DEBUG_USB_HOST

View file

@ -268,33 +268,6 @@ uint8_t ACM::Poll() {
if(!bPollEnable)
return 0;
//uint32_t time_now = millis();
//if (qNextPollTime <= time_now)
//{
// qNextPollTime = time_now + 100;
// uint8_t rcode;
// const uint8_t constBufSize = 16;
// uint8_t buf[constBufSize];
// for (uint8_t i=0; i<constBufSize; i++)
// buf[i] = 0;
// uint16_t read = (constBufSize > epInfo[epInterruptInIndex].maxPktSize)
// ? epInfo[epInterruptInIndex].maxPktSize : constBufSize;
// rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex].epAddr, &read, buf);
// if (rcode)
// return rcode;
// for (uint8_t i=0; i<read; i++)
// {
// PrintHex<uint8_t>(buf[i]);
// USB_HOST_SERIAL.print(" ");
// }
// USBTRACE("\r\n");
//}
return rcode;
}

View file

@ -23,53 +23,53 @@ e-mail : support@circuitsathome.com
#define bmREQ_CDCIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
// CDC Subclass Constants
#define CDC_SUBCLASS_DLCM 0x01 // Direct Line Control Model
#define CDC_SUBCLASS_ACM 0x02 // Abstract Control Model
#define CDC_SUBCLASS_TCM 0x03 // Telephone Control Model
#define CDC_SUBCLASS_MCCM 0x04 // Multi Channel Control Model
#define CDC_SUBCLASS_CAPI 0x05 // CAPI Control Model
#define CDC_SUBCLASS_ETHERNET 0x06 // Ethernet Network Control Model
#define CDC_SUBCLASS_ATM 0x07 // ATM Network Control Model
#define CDC_SUBCLASS_WIRELESS_HANDSET 0x08 // Wireless Handset Control Model
#define CDC_SUBCLASS_DEVICE_MANAGEMENT 0x09 // Device Management
#define CDC_SUBCLASS_MOBILE_DIRECT_LINE 0x0A // Mobile Direct Line Model
#define CDC_SUBCLASS_OBEX 0x0B // OBEX
#define CDC_SUBCLASS_ETHERNET_EMU 0x0C // Ethernet Emulation Model
#define CDC_SUBCLASS_DLCM 0x01 // Direct Line Control Model
#define CDC_SUBCLASS_ACM 0x02 // Abstract Control Model
#define CDC_SUBCLASS_TCM 0x03 // Telephone Control Model
#define CDC_SUBCLASS_MCCM 0x04 // Multi Channel Control Model
#define CDC_SUBCLASS_CAPI 0x05 // CAPI Control Model
#define CDC_SUBCLASS_ETHERNET 0x06 // Ethernet Network Control Model
#define CDC_SUBCLASS_ATM 0x07 // ATM Network Control Model
#define CDC_SUBCLASS_WIRELESS_HANDSET 0x08 // Wireless Handset Control Model
#define CDC_SUBCLASS_DEVICE_MANAGEMENT 0x09 // Device Management
#define CDC_SUBCLASS_MOBILE_DIRECT_LINE 0x0A // Mobile Direct Line Model
#define CDC_SUBCLASS_OBEX 0x0B // OBEX
#define CDC_SUBCLASS_ETHERNET_EMU 0x0C // Ethernet Emulation Model
// Communication Interface Class Control Protocol Codes
#define CDC_PROTOCOL_ITU_T_V_250 0x01 // AT Commands defined by ITU-T V.250
#define CDC_PROTOCOL_PCCA_101 0x02 // AT Commands defined by PCCA-101
#define CDC_PROTOCOL_PCCA_101_O 0x03 // AT Commands defined by PCCA-101 & Annex O
#define CDC_PROTOCOL_GSM_7_07 0x04 // AT Commands defined by GSM 7.07
#define CDC_PROTOCOL_3GPP_27_07 0x05 // AT Commands defined by 3GPP 27.007
#define CDC_PROTOCOL_C_S0017_0 0x06 // AT Commands defined by TIA for CDMA
#define CDC_PROTOCOL_USB_EEM 0x07 // Ethernet Emulation Model
#define CDC_PROTOCOL_ITU_T_V_250 0x01 // AT Commands defined by ITU-T V.250
#define CDC_PROTOCOL_PCCA_101 0x02 // AT Commands defined by PCCA-101
#define CDC_PROTOCOL_PCCA_101_O 0x03 // AT Commands defined by PCCA-101 & Annex O
#define CDC_PROTOCOL_GSM_7_07 0x04 // AT Commands defined by GSM 7.07
#define CDC_PROTOCOL_3GPP_27_07 0x05 // AT Commands defined by 3GPP 27.007
#define CDC_PROTOCOL_C_S0017_0 0x06 // AT Commands defined by TIA for CDMA
#define CDC_PROTOCOL_USB_EEM 0x07 // Ethernet Emulation Model
// CDC Commands defined by CDC 1.2
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
// CDC Commands defined by PSTN 1.2
#define CDC_SET_COMM_FEATURE 0x02
#define CDC_GET_COMM_FEATURE 0x03
#define CDC_CLEAR_COMM_FEATURE 0x04
#define CDC_SET_AUX_LINE_STATE 0x10
#define CDC_SET_HOOK_STATE 0x11
#define CDC_PULSE_SETUP 0x12
#define CDC_SEND_PULSE 0x13
#define CDC_SET_PULSE_TIME 0x14
#define CDC_RING_AUX_JACK 0x15
#define CDC_SET_LINE_CODING 0x20
#define CDC_GET_LINE_CODING 0x21
#define CDC_SET_CONTROL_LINE_STATE 0x22
#define CDC_SEND_BREAK 0x23
#define CDC_SET_RINGER_PARMS 0x30
#define CDC_GET_RINGER_PARMS 0x31
#define CDC_SET_OPERATION_PARMS 0x32
#define CDC_GET_OPERATION_PARMS 0x33
#define CDC_SET_LINE_PARMS 0x34
#define CDC_GET_LINE_PARMS 0x35
#define CDC_DIAL_DIGITS 0x36
#define CDC_SET_COMM_FEATURE 0x02
#define CDC_GET_COMM_FEATURE 0x03
#define CDC_CLEAR_COMM_FEATURE 0x04
#define CDC_SET_AUX_LINE_STATE 0x10
#define CDC_SET_HOOK_STATE 0x11
#define CDC_PULSE_SETUP 0x12
#define CDC_SEND_PULSE 0x13
#define CDC_SET_PULSE_TIME 0x14
#define CDC_RING_AUX_JACK 0x15
#define CDC_SET_LINE_CODING 0x20
#define CDC_GET_LINE_CODING 0x21
#define CDC_SET_CONTROL_LINE_STATE 0x22
#define CDC_SEND_BREAK 0x23
#define CDC_SET_RINGER_PARMS 0x30
#define CDC_GET_RINGER_PARMS 0x31
#define CDC_SET_OPERATION_PARMS 0x32
#define CDC_GET_OPERATION_PARMS 0x33
#define CDC_SET_LINE_PARMS 0x34
#define CDC_GET_LINE_PARMS 0x35
#define CDC_DIAL_DIGITS 0x36
//Class-Specific Notification Codes
#define NETWORK_CONNECTION 0x00
@ -135,7 +135,7 @@ public:
};
#define ACM_MAX_ENDPOINTS 4
#define ACM_MAX_ENDPOINTS 4
class ACM : public USBDeviceConfig, public UsbConfigXtracter {
protected:

View file

@ -46,11 +46,11 @@ uint8_t FTDI::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t rcode;
UsbDevice *p = NULL;
EpInfo *oldep_ptr = NULL;
//uint8_t len = 0;
//uint16_t cd_len = 0;
//uint8_t len = 0;
//uint16_t cd_len = 0;
uint8_t num_of_conf; // number of configurations
//uint8_t num_of_intf; // number of interfaces
//uint8_t num_of_intf; // number of interfaces
AddressPool &addrPool = pUsb->GetAddressPool();
@ -253,13 +253,13 @@ uint8_t FTDI::Poll() {
uint8_t rcode = 0;
//if (!bPollEnable)
// return 0;
// return 0;
//if (qNextPollTime <= millis())
//{
// USB_HOST_SERIAL.println(bAddress, HEX);
// USB_HOST_SERIAL.println(bAddress, HEX);
// qNextPollTime = millis() + 100;
// qNextPollTime = millis() + 100;
//}
return rcode;
}

View file

@ -22,57 +22,57 @@ e-mail : support@circuitsathome.com
#define bmREQ_FTDI_OUT 0x40
#define bmREQ_FTDI_IN 0xc0
//#define bmREQ_FTDI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
//#define bmREQ_FTDI_IN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
//#define bmREQ_FTDI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
//#define bmREQ_FTDI_IN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
#define FTDI_VID 0x0403 // FTDI VID
#define FTDI_PID 0x6001 // FTDI PID
#define FTDI_VID 0x0403 // FTDI VID
#define FTDI_PID 0x6001 // FTDI PID
#define FT232AM 0x0200
#define FT232BM 0x0400
#define FT2232 0x0500
#define FT232R 0x0600
#define FT232AM 0x0200
#define FT232BM 0x0400
#define FT2232 0x0500
#define FT232R 0x0600
// Commands
#define FTDI_SIO_RESET 0 /* Reset the port */
#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */
#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */
#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */
#define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */
#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */
#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */
#define FTDI_SIO_RESET 0 /* Reset the port */
#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */
#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */
#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */
#define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */
#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */
#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */
#define FTDI_SIO_RESET_SIO 0
#define FTDI_SIO_RESET_PURGE_RX 1
#define FTDI_SIO_RESET_PURGE_TX 2
#define FTDI_SIO_RESET_SIO 0
#define FTDI_SIO_RESET_PURGE_RX 1
#define FTDI_SIO_RESET_PURGE_TX 2
#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 )
#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
#define FTDI_SIO_SET_BREAK (0x1 << 14)
#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 )
#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 )
#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
#define FTDI_SIO_SET_BREAK (0x1 << 14)
#define FTDI_SIO_SET_DTR_MASK 0x1
#define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8))
#define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8))
#define FTDI_SIO_SET_RTS_MASK 0x2
#define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
#define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
#define FTDI_SIO_SET_DTR_MASK 0x1
#define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8))
#define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8))
#define FTDI_SIO_SET_RTS_MASK 0x2
#define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
#define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
#define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
#define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
#define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
#define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
#define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
#define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
#define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
#define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
#define FTDI_SIO_CTS_MASK 0x10
#define FTDI_SIO_DSR_MASK 0x20
#define FTDI_SIO_RI_MASK 0x40
#define FTDI_SIO_RLSD_MASK 0x80
#define FTDI_SIO_CTS_MASK 0x10
#define FTDI_SIO_DSR_MASK 0x20
#define FTDI_SIO_RI_MASK 0x40
#define FTDI_SIO_RLSD_MASK 0x80
class FTDI;
@ -88,8 +88,8 @@ public:
// Only single port chips are currently supported by the library,
// so only three endpoints are allocated.
#define FTDI_MAX_ENDPOINTS 3
// so only three endpoints are allocated.
#define FTDI_MAX_ENDPOINTS 3
class FTDI : public USBDeviceConfig, public UsbConfigXtracter {
static const uint8_t epDataInIndex; // DataIn endpoint index

View file

@ -195,16 +195,16 @@ Fail:
//uint8_t PL::Poll()
//{
// uint8_t rcode = 0;
// uint8_t rcode = 0;
//
// //if (!bPollEnable)
// // return 0;
// //if (!bPollEnable)
// // return 0;
//
// //if (qNextPollTime <= millis())
// //{
// // USB_HOST_SERIAL.println(bAddress, HEX);
// //if (qNextPollTime <= millis())
// //{
// // USB_HOST_SERIAL.println(bAddress, HEX);
//
// // qNextPollTime = millis() + 100;
// //}
// return rcode;
// // qNextPollTime = millis() + 100;
// //}
// return rcode;
//}

View file

@ -45,8 +45,8 @@ e-mail : support@circuitsathome.com
#define DEFAULT_NOTIFY 0x00
#define DEFAULT_STATE ( PD_S_TX_ENABLE | PD_S_RX_ENABLE | PD_RS232_A_TXO | PD_RS232_A_RXO )
#define CONTINUE_SEND 1
#define PAUSE_SEND 2
#define CONTINUE_SEND 1
#define PAUSE_SEND 2
#define kRxAutoFlow ((UInt32)( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO ))
#define kTxAutoFlow ((UInt32)( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD ))

View file

@ -29,10 +29,10 @@ public:
};
};
#define CP_MASK_COMPARE_CLASS 1
#define CP_MASK_COMPARE_SUBCLASS 2
#define CP_MASK_COMPARE_PROTOCOL 4
#define CP_MASK_COMPARE_ALL 7
#define CP_MASK_COMPARE_CLASS 1
#define CP_MASK_COMPARE_SUBCLASS 2
#define CP_MASK_COMPARE_PROTOCOL 4
#define CP_MASK_COMPARE_ALL 7
// Configuration Descriptor Parser Class Template
@ -109,10 +109,10 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
stateParseDescr = 2;
case 2:
// This is a sort of hack. Assuming that two bytes are all ready in the buffer
// the pointer is positioned two bytes ahead in order for the rest of descriptor
// to be read right after the size and the type fields.
// the pointer is positioned two bytes ahead in order for the rest of descriptor
// to be read right after the size and the type fields.
// This should be used carefully. varBuffer should be used directly to handle data
// in the buffer.
// in the buffer.
theBuffer.pValue = varBuffer + 2;
stateParseDescr = 3;
case 3:
@ -165,10 +165,10 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer);
break;
//case HID_DESCRIPTOR_HID:
// if (!valParser.Parse(pp, pcntdn))
// return false;
// PrintHidDescriptor((const USB_HID_DESCRIPTOR*)varBuffer);
// break;
// if (!valParser.Parse(pp, pcntdn))
// return false;
// PrintHidDescriptor((const USB_HID_DESCRIPTOR*)varBuffer);
// break;
default:
if(!theSkipper.Skip(pp, pcntdn, dscrLen - 2))
return false;

32
hid.h
View file

@ -20,8 +20,8 @@ e-mail : support@circuitsathome.com
#include "Usb.h"
#include "hidusagestr.h"
#define MAX_REPORT_PARSERS 2
#define HID_MAX_HID_CLASS_DESCRIPTORS 5
#define MAX_REPORT_PARSERS 2
#define HID_MAX_HID_CLASS_DESCRIPTORS 5
#define DATA_SIZE_MASK 0x03
#define TYPE_MASK 0x0C
@ -98,23 +98,23 @@ e-mail : support@circuitsathome.com
#define HID_ITEM_TYPE_LOCAL 2
#define HID_ITEM_TYPE_RESERVED 3
#define HID_LONG_ITEM_PREFIX 0xfe // Long item prefix value
#define HID_LONG_ITEM_PREFIX 0xfe // Long item prefix value
#define bmHID_MAIN_ITEM_TAG 0xfc // Main item tag mask
#define bmHID_MAIN_ITEM_TAG 0xfc // Main item tag mask
#define bmHID_MAIN_ITEM_INPUT 0x80 // Main item Input tag value
#define bmHID_MAIN_ITEM_OUTPUT 0x90 // Main item Output tag value
#define bmHID_MAIN_ITEM_FEATURE 0xb0 // Main item Feature tag value
#define bmHID_MAIN_ITEM_COLLECTION 0xa0 // Main item Collection tag value
#define bmHID_MAIN_ITEM_END_COLLECTION 0xce // Main item End Collection tag value
#define bmHID_MAIN_ITEM_INPUT 0x80 // Main item Input tag value
#define bmHID_MAIN_ITEM_OUTPUT 0x90 // Main item Output tag value
#define bmHID_MAIN_ITEM_FEATURE 0xb0 // Main item Feature tag value
#define bmHID_MAIN_ITEM_COLLECTION 0xa0 // Main item Collection tag value
#define bmHID_MAIN_ITEM_END_COLLECTION 0xce // Main item End Collection tag value
#define HID_MAIN_ITEM_COLLECTION_PHYSICAL 0
#define HID_MAIN_ITEM_COLLECTION_APPLICATION 1
#define HID_MAIN_ITEM_COLLECTION_LOGICAL 2
#define HID_MAIN_ITEM_COLLECTION_REPORT 3
#define HID_MAIN_ITEM_COLLECTION_NAMED_ARRAY 4
#define HID_MAIN_ITEM_COLLECTION_USAGE_SWITCH 5
#define HID_MAIN_ITEM_COLLECTION_USAGE_MODIFIER 6
#define HID_MAIN_ITEM_COLLECTION_PHYSICAL 0
#define HID_MAIN_ITEM_COLLECTION_APPLICATION 1
#define HID_MAIN_ITEM_COLLECTION_LOGICAL 2
#define HID_MAIN_ITEM_COLLECTION_REPORT 3
#define HID_MAIN_ITEM_COLLECTION_NAMED_ARRAY 4
#define HID_MAIN_ITEM_COLLECTION_USAGE_SWITCH 5
#define HID_MAIN_ITEM_COLLECTION_USAGE_MODIFIER 6
struct HidItemPrefix {
uint8_t bSize : 2;

View file

@ -129,12 +129,12 @@ void KeyboardReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t
if (buf[2] == 1)
return;
//KBDINFO *pki = (KBDINFO*)buf;
//KBDINFO *pki = (KBDINFO*)buf;
// provide event for changed control key state
if (prevState.bInfo[0x00] != buf[0x00]) {
OnControlKeysChanged(prevState.bInfo[0x00], buf[0x00]);
}
// provide event for changed control key state
if (prevState.bInfo[0x00] != buf[0x00]) {
OnControlKeysChanged(prevState.bInfo[0x00], buf[0x00]);
}
for (uint8_t i = 2; i < 8; i++) {
bool down = false;

View file

@ -1005,7 +1005,7 @@ void ReportDescParserBase::Parse(const uint16_t len, const uint8_t *pbuf, const
ParseItem(&p, &cntdn);
//if (ParseItem(&p, &cntdn))
// return;
// return;
}
//USBTRACE2("Total:", totalSize);
}
@ -1089,7 +1089,7 @@ void ReportDescParserBase::PrintItemTitle(uint8_t prefix) {
}
uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
//uint8_t ret = enErrorSuccess;
//uint8_t ret = enErrorSuccess;
//reinterpret_cast<>(varBuffer);
switch(itemParseState) {
case 0:
@ -1233,22 +1233,10 @@ ReportDescParserBase::UsagePageFunc ReportDescParserBase::usagePageFunctions[] /
void ReportDescParserBase::SetUsagePage(uint16_t page) {
pfUsage = NULL;
if(VALUE_BETWEEN(page, 0x00, 0x11))
if(VALUE_BETWEEN(page, 0x00, 0x11)) {
pfUsage = (usagePageFunctions[page - 1]);
// Dead code...
//
// pfUsage = (UsagePageFunc)pgm_read_pointer(usagePageFunctions[page - 1]);
//else if (page > 0x7f && page < 0x84)
// E_Notify(pstrUsagePageMonitor);
//else if (page > 0x83 && page < 0x8c)
// E_Notify(pstrUsagePagePower);
//else if (page > 0x8b && page < 0x92)
// E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c]));
//else if (page > 0xfeff && page <= 0xffff)
// E_Notify(pstrUsagePageVendorDefined);
//
else
} else {
switch(page) {
case 0x14:
pfUsage = &ReportDescParserBase::PrintAlphanumDisplayPageUsage;
@ -1257,6 +1245,7 @@ void ReportDescParserBase::SetUsagePage(uint16_t page) {
pfUsage = &ReportDescParserBase::PrintMedicalInstrumentPageUsage;
break;
}
}
}
void ReportDescParserBase::PrintUsagePage(uint16_t page) {
@ -1438,7 +1427,7 @@ void ReportDescParserBase::PrintMedicalInstrumentPageUsage(uint16_t usage) {
}
uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
//uint8_t ret = enErrorSuccess;
//uint8_t ret = enErrorSuccess;
switch(itemParseState) {
case 0:
@ -1553,9 +1542,9 @@ void ReportDescParser2::OnInputItem(uint8_t itm) {
if(print_usemin_usemax)
pfUsage(usage);
// bits_left - number of bits in the field(array of fields, depending on Report Count) left to process
// bits_of_byte - number of bits in current byte left to process
// bits_to_copy - number of bits to copy to result buffer
// bits_left - number of bits in the field(array of fields, depending on Report Count) left to process
// bits_of_byte - number of bits in current byte left to process
// bits_to_copy - number of bits to copy to result buffer
// for each bit in a field
for(uint8_t bits_left = rptSize, bits_to_copy = 0; bits_left;

View file

@ -103,7 +103,7 @@ uint8_t HIDUniversal::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t len = 0;
uint8_t num_of_conf; // number of configurations
//uint8_t num_of_intf; // number of interfaces
//uint8_t num_of_intf; // number of interfaces
AddressPool &addrPool = pUsb->GetAddressPool();
@ -200,7 +200,7 @@ uint8_t HIDUniversal::Init(uint8_t parent, uint8_t port, bool lowspeed) {
USBTRACE2("NC:", num_of_conf);
for(uint8_t i = 0; i < num_of_conf; i++) {
//HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
//HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
ConfigDescParser<USB_CLASS_HID, 0, 0,
CP_MASK_COMPARE_CLASS> confDescrParser(this);

View file

@ -358,7 +358,7 @@ const char pstrUsageProgrammableButton [] PROGMEM = "Prog Button";
const char pstrUsageHookSwitch [] PROGMEM = "Hook Sw";
const char pstrUsageFlash [] PROGMEM = "Flash";
const char pstrUsageFeature [] PROGMEM = "Feature";
//const char pstrUsageHold [] PROGMEM = "Hold";
//const char pstrUsageHold [] PROGMEM = "Hold";
const char pstrUsageRedial [] PROGMEM = "Redial";
const char pstrUsageTransfer [] PROGMEM = "Transfer";
const char pstrUsageDrop [] PROGMEM = "Drop";
@ -367,7 +367,7 @@ const char pstrUsageForwardCalls [] PROGMEM = "Fwd Calls";
const char pstrUsageAlternateFunction [] PROGMEM = "Alt Func";
const char pstrUsageLine [] PROGMEM = "Line";
const char pstrUsageSpeakerPhone [] PROGMEM = "Spk Phone";
//const char pstrUsageConference [] PROGMEM = "Conference";
//const char pstrUsageConference [] PROGMEM = "Conference";
const char pstrUsageRingEnable [] PROGMEM = "Ring Enbl";
const char pstrUsageRingSelect [] PROGMEM = "Ring Sel";
const char pstrUsagePhoneMute [] PROGMEM = "Phone Mute";
@ -379,7 +379,7 @@ const char pstrUsageRecallNumber [] PROGMEM = "Recall Num";
const char pstrUsagePhoneDirectory [] PROGMEM = "Phone Dir";
const char pstrUsageVoiceMail [] PROGMEM = "Voice Mail";
const char pstrUsageScreenCalls [] PROGMEM = "Screen Calls";
//const char pstrUsageDoNotDisturb [] PROGMEM = "Do Not Disturb";
//const char pstrUsageDoNotDisturb [] PROGMEM = "Do Not Disturb";
const char pstrUsageMessage [] PROGMEM = "Msg";
const char pstrUsageAnswerOnOff [] PROGMEM = "Answer On/Off";
const char pstrUsageInsideDialTone [] PROGMEM = "Inside Dial Tone";
@ -417,14 +417,14 @@ const char pstrUsagePhoneKeyD [] PROGMEM = "D";
// Consumer Usage Page
const char pstrUsageConsumerControl [] PROGMEM = "Consumer Ctrl";
const char pstrUsageNumericKeyPad [] PROGMEM = "Num Key Pad";
//const char pstrUsageProgrammableButton [] PROGMEM = "Prog Btn";
//const char pstrUsageMicrophone [] PROGMEM = "Mic";
//const char pstrUsageProgrammableButton [] PROGMEM = "Prog Btn";
//const char pstrUsageMicrophone [] PROGMEM = "Mic";
const char pstrUsageHeadphone [] PROGMEM = "Headphone";
const char pstrUsageGraphicEqualizer [] PROGMEM = "Graph Eq";
const char pstrUsagePlus10 [] PROGMEM = "+10";
const char pstrUsagePlus100 [] PROGMEM = "+100";
const char pstrUsageAMPM [] PROGMEM = "AM/PM";
//const char pstrUsagePower [] PROGMEM = "Pwr";
//const char pstrUsagePower [] PROGMEM = "Pwr";
const char pstrUsageReset [] PROGMEM = "Reset";
const char pstrUsageSleep [] PROGMEM = "Sleep";
const char pstrUsageSleepAfter [] PROGMEM = "Sleep After";
@ -483,19 +483,19 @@ const char pstrUsageOnce [] PROGMEM = "Once";
const char pstrUsageDaily [] PROGMEM = "Daily";
const char pstrUsageWeekly [] PROGMEM = "Weekly";
const char pstrUsageMonthly [] PROGMEM = "Monthly";
//const char pstrUsagePlay [] PROGMEM = "Play";
//const char pstrUsagePause [] PROGMEM = "Pause";
//const char pstrUsageRecord [] PROGMEM = "Rec";
//const char pstrUsageFastForward [] PROGMEM = "FF";
//const char pstrUsageRewind [] PROGMEM = "Rewind";
//const char pstrUsagePlay [] PROGMEM = "Play";
//const char pstrUsagePause [] PROGMEM = "Pause";
//const char pstrUsageRecord [] PROGMEM = "Rec";
//const char pstrUsageFastForward [] PROGMEM = "FF";
//const char pstrUsageRewind [] PROGMEM = "Rewind";
const char pstrUsageScanNextTrack [] PROGMEM = "Next Track";
const char pstrUsageScanPreviousTrack [] PROGMEM = "Prev Track";
//const char pstrUsageStop [] PROGMEM = "Stop";
//const char pstrUsageStop [] PROGMEM = "Stop";
const char pstrUsageEject [] PROGMEM = "Eject";
const char pstrUsageRandomPlay [] PROGMEM = "Random";
const char pstrUsageSelectDisk [] PROGMEM = "Sel Disk";
const char pstrUsageEnterDisk [] PROGMEM = "Ent Disk";
//const char pstrUsageRepeat [] PROGMEM = "Repeat";
//const char pstrUsageRepeat [] PROGMEM = "Repeat";
const char pstrUsageTracking [] PROGMEM = "Tracking";
const char pstrUsageTrackNormal [] PROGMEM = "Trk Norm";
const char pstrUsageSlowTracking [] PROGMEM = "Slow Trk";
@ -516,7 +516,7 @@ const char pstrUsagePlayPause [] PROGMEM = "Play/Pause";
const char pstrUsagePlaySkip [] PROGMEM = "Play/Skip";
const char pstrUsageVolume [] PROGMEM = "Vol";
const char pstrUsageBalance [] PROGMEM = "Balance";
//const char pstrUsageMute [] PROGMEM = "Mute";
//const char pstrUsageMute [] PROGMEM = "Mute";
const char pstrUsageBass [] PROGMEM = "Bass";
const char pstrUsageTreble [] PROGMEM = "Treble";
const char pstrUsageBassBoost [] PROGMEM = "Bass Boost";
@ -808,7 +808,7 @@ const char pstrUsageDataValid [] PROGMEM = "Data Valid";
const char pstrUsageTransducerIndex [] PROGMEM = "Transducer Ind";
const char pstrUsageTabletFunctionKeys [] PROGMEM = "Tabl Func Keys";
const char pstrUsageProgramChangeKeys [] PROGMEM = "Pgm Chng Keys";
//const char pstrUsageBatteryStrength [] PROGMEM = "Bat Strength";
//const char pstrUsageBatteryStrength [] PROGMEM = "Bat Strength";
const char pstrUsageInvert [] PROGMEM = "Invert";
const char pstrUsageXTilt [] PROGMEM = "X Tilt";
const char pstrUsageYTilt [] PROGMEM = "Y Tilt";
@ -830,7 +830,7 @@ const char pstrUsageDataReadBack [] PROGMEM = "Data Rd Back";
const char pstrUsageFontReadBack [] PROGMEM = "Fnt Rd Back";
const char pstrUsageDisplayControlReport [] PROGMEM = "Disp Ctrl Rpt";
const char pstrUsageClearDisplay [] PROGMEM = "Clr Disp";
//const char pstrUsageDisplayEnable [] PROGMEM = "Disp Enbl";
//const char pstrUsageDisplayEnable [] PROGMEM = "Disp Enbl";
const char pstrUsageScreenSaverDelay [] PROGMEM = "Scr Sav Delay";
const char pstrUsageScreenSaverEnable [] PROGMEM = "Scr Sav Enbl";
const char pstrUsageVerticalScroll [] PROGMEM = "V Scroll";
@ -903,7 +903,7 @@ const char pstrUsagePrint [] PROGMEM = "Print";
const char pstrUsageMicrophoneEnable [] PROGMEM = "Mic Enbl";
const char pstrUsageCine [] PROGMEM = "Cine";
const char pstrUsageTransmitPower [] PROGMEM = "Trans Pwr";
//const char pstrUsageVolume [] PROGMEM = "Vol";
//const char pstrUsageVolume [] PROGMEM = "Vol";
const char pstrUsageFocus [] PROGMEM = "Focus";
const char pstrUsageDepth [] PROGMEM = "Depth";
const char pstrUsageSoftStepPrimary [] PROGMEM = "Soft Stp-Pri";

View file

@ -19,6 +19,8 @@ e-mail : support@circuitsathome.com
#include "hidusagestr.h"
// This is here why?
//const char *usagePageTitles0[] PROGMEM =
//{
// pstrUsagePageGenericDesktopControls ,

View file

@ -18,7 +18,7 @@ e-mail : support@circuitsathome.com
#if !defined(_usb_h_) || defined(MACROS_H)
#error "Never include macros.h directly; include Usb.h instead"
#else
#define MACROS_H
#define MACROS_H
////////////////////////////////////////////////////////////////////////////////
// HANDY MACROS
@ -78,5 +78,5 @@ e-mail : support@circuitsathome.com
#define USBTRACE3(s,r,l) (Notify(PSTR(s), l), D_PrintHex((r), l), Notify(PSTR("\r\n"), l))
#endif /* MACROS_H */
#endif /* MACROS_H */

View file

@ -29,35 +29,35 @@ e-mail : support@circuitsathome.com
#define bmREQ_MASSIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
// Mass Storage Subclass Constants
#define MASS_SUBCLASS_SCSI_NOT_REPORTED 0x00 // De facto use
#define MASS_SUBCLASS_RBC 0x01
#define MASS_SUBCLASS_ATAPI 0x02 // MMC-5 (ATAPI)
#define MASS_SUBCLASS_OBSOLETE1 0x03 // Was QIC-157
#define MASS_SUBCLASS_UFI 0x04 // Specifies how to interface Floppy Disk Drives to USB
#define MASS_SUBCLASS_OBSOLETE2 0x05 // Was SFF-8070i
#define MASS_SUBCLASS_SCSI 0x06 // SCSI Transparent Command Set
#define MASS_SUBCLASS_LSDFS 0x07 // Specifies how host has to negotiate access before trying SCSI
#define MASS_SUBCLASS_IEEE1667 0x08
#define MASS_SUBCLASS_SCSI_NOT_REPORTED 0x00 // De facto use
#define MASS_SUBCLASS_RBC 0x01
#define MASS_SUBCLASS_ATAPI 0x02 // MMC-5 (ATAPI)
#define MASS_SUBCLASS_OBSOLETE1 0x03 // Was QIC-157
#define MASS_SUBCLASS_UFI 0x04 // Specifies how to interface Floppy Disk Drives to USB
#define MASS_SUBCLASS_OBSOLETE2 0x05 // Was SFF-8070i
#define MASS_SUBCLASS_SCSI 0x06 // SCSI Transparent Command Set
#define MASS_SUBCLASS_LSDFS 0x07 // Specifies how host has to negotiate access before trying SCSI
#define MASS_SUBCLASS_IEEE1667 0x08
// Mass Storage Class Protocols
#define MASS_PROTO_CBI 0x00 // CBI (with command completion interrupt)
#define MASS_PROTO_CBI_NO_INT 0x01 // CBI (without command completion interrupt)
#define MASS_PROTO_OBSOLETE 0x02
#define MASS_PROTO_BBB 0x50 // Bulk Only Transport
#define MASS_PROTO_UAS 0x62
#define MASS_PROTO_CBI 0x00 // CBI (with command completion interrupt)
#define MASS_PROTO_CBI_NO_INT 0x01 // CBI (without command completion interrupt)
#define MASS_PROTO_OBSOLETE 0x02
#define MASS_PROTO_BBB 0x50 // Bulk Only Transport
#define MASS_PROTO_UAS 0x62
// Request Codes
#define MASS_REQ_ADSC 0x00
#define MASS_REQ_GET 0xFC
#define MASS_REQ_PUT 0xFD
#define MASS_REQ_GET_MAX_LUN 0xFE
#define MASS_REQ_BOMSR 0xFF // Bulk-Only Mass Storage Reset
#define MASS_REQ_ADSC 0x00
#define MASS_REQ_GET 0xFC
#define MASS_REQ_PUT 0xFD
#define MASS_REQ_GET_MAX_LUN 0xFE
#define MASS_REQ_BOMSR 0xFF // Bulk-Only Mass Storage Reset
#define MASS_CBW_SIGNATURE 0x43425355
#define MASS_CSW_SIGNATURE 0x53425355
#define MASS_CBW_SIGNATURE 0x43425355
#define MASS_CSW_SIGNATURE 0x53425355
#define MASS_CMD_DIR_OUT 0 // (0 << 7)
#define MASS_CMD_DIR_IN 0x80 //(1 << 7)
#define MASS_CMD_DIR_IN 0x80 //(1 << 7)
/*
* Reference documents from T10 (http://www.t10.org)
@ -67,21 +67,21 @@ e-mail : support@circuitsathome.com
*/
/* Group 1 commands (CDB's here are should all be 6-bytes) */
#define SCSI_CMD_TEST_UNIT_READY 0x00
#define SCSI_CMD_REQUEST_SENSE 0x03
#define SCSI_CMD_FORMAT_UNIT 0x04
#define SCSI_CMD_READ_6 0x08
#define SCSI_CMD_WRITE_6 0x0A
#define SCSI_CMD_INQUIRY 0x12
#define SCSI_CMD_TEST_UNIT_READY 0x00
#define SCSI_CMD_REQUEST_SENSE 0x03
#define SCSI_CMD_FORMAT_UNIT 0x04
#define SCSI_CMD_READ_6 0x08
#define SCSI_CMD_WRITE_6 0x0A
#define SCSI_CMD_INQUIRY 0x12
#define SCSI_CMD_MODE_SELECT_6 0x15
#define SCSI_CMD_MODE_SENSE_6 0x1A
#define SCSI_CMD_START_STOP_UNIT 0x1B
#define SCSI_CMD_MODE_SENSE_6 0x1A
#define SCSI_CMD_START_STOP_UNIT 0x1B
#define SCSI_CMD_PREVENT_REMOVAL 0x1E
/* Group 2 Commands (CDB's here are 10-bytes) */
#define SCSI_CMD_READ_FORMAT_CAPACITIES 0x23
#define SCSI_CMD_READ_CAPACITY_10 0x25
#define SCSI_CMD_READ_10 0x28
#define SCSI_CMD_WRITE_10 0x2A
#define SCSI_CMD_READ_CAPACITY_10 0x25
#define SCSI_CMD_READ_10 0x28
#define SCSI_CMD_WRITE_10 0x2A
#define SCSI_CMD_SEEK_10 0x2B
#define SCSI_CMD_ERASE_10 0x2C
#define SCSI_CMD_WRITE_AND_VERIFY_10 0x2E
@ -139,42 +139,42 @@ e-mail : support@circuitsathome.com
#define SCSI_CMD_READ_ALL_SUBCODES 0xDF /* Vendor unique */
/* SCSI error codes */
#define SCSI_S_NOT_READY 0x02
#define SCSI_S_MEDIUM_ERROR 0x03
#define SCSI_S_ILLEGAL_REQUEST 0x05
#define SCSI_S_UNIT_ATTENTION 0x06
#define SCSI_S_NOT_READY 0x02
#define SCSI_S_MEDIUM_ERROR 0x03
#define SCSI_S_ILLEGAL_REQUEST 0x05
#define SCSI_S_UNIT_ATTENTION 0x06
#define SCSI_ASC_LBA_OUT_OF_RANGE 0x21
#define SCSI_ASC_MEDIA_CHANGED 0x28
#define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3A
/* USB error codes */
#define MASS_ERR_SUCCESS 0x00
#define MASS_ERR_PHASE_ERROR 0x02
#define MASS_ERR_UNIT_NOT_READY 0x03
#define MASS_ERR_UNIT_BUSY 0x04
#define MASS_ERR_STALL 0x05
#define MASS_ERR_CMD_NOT_SUPPORTED 0x06
#define MASS_ERR_INVALID_CSW 0x07
#define MASS_ERR_NO_MEDIA 0x08
#define MASS_ERR_SUCCESS 0x00
#define MASS_ERR_PHASE_ERROR 0x02
#define MASS_ERR_UNIT_NOT_READY 0x03
#define MASS_ERR_UNIT_BUSY 0x04
#define MASS_ERR_STALL 0x05
#define MASS_ERR_CMD_NOT_SUPPORTED 0x06
#define MASS_ERR_INVALID_CSW 0x07
#define MASS_ERR_NO_MEDIA 0x08
#define MASS_ERR_BAD_LBA 0x09
#define MASS_ERR_MEDIA_CHANGED 0x0A
#define MASS_ERR_DEVICE_DISCONNECTED 0x11
#define MASS_ERR_UNABLE_TO_RECOVER 0x12 // Reset recovery error
#define MASS_ERR_INVALID_LUN 0x13
#define MASS_ERR_WRITE_STALL 0x14
#define MASS_ERR_UNABLE_TO_RECOVER 0x12 // Reset recovery error
#define MASS_ERR_INVALID_LUN 0x13
#define MASS_ERR_WRITE_STALL 0x14
#define MASS_ERR_READ_NAKS 0x15
#define MASS_ERR_WRITE_NAKS 0x16
#define MASS_ERR_WRITE_PROTECTED 0x17
#define MASS_ERR_NOT_IMPLEMENTED 0xFD
#define MASS_ERR_GENERAL_SCSI_ERROR 0xFE
#define MASS_ERR_GENERAL_USB_ERROR 0xFF
#define MASS_ERR_USER 0xA0 // For subclasses to define their own error codes
#define MASS_ERR_GENERAL_SCSI_ERROR 0xFE
#define MASS_ERR_GENERAL_USB_ERROR 0xFF
#define MASS_ERR_USER 0xA0 // For subclasses to define their own error codes
#define MASS_TRANS_FLG_CALLBACK 0x01 // Callback is involved
#define MASS_TRANS_FLG_NO_STALL_CHECK 0x02 // STALL condition is not checked
#define MASS_TRANS_FLG_NO_PHASE_CHECK 0x04 // PHASE_ERROR is not checked
#define MASS_TRANS_FLG_CALLBACK 0x01 // Callback is involved
#define MASS_TRANS_FLG_NO_STALL_CHECK 0x02 // STALL condition is not checked
#define MASS_TRANS_FLG_NO_PHASE_CHECK 0x04 // PHASE_ERROR is not checked
#define MASS_MAX_ENDPOINTS 3
#define MASS_MAX_ENDPOINTS 3
struct Capacity {
uint8_t data[8];

View file

@ -25,11 +25,6 @@ e-mail : support@circuitsathome.com
/* Arduino pin definitions */
/* pin numbers to port numbers */
//#define MAX_INT 9 // Duemielanove
//#define MAX_GPX 8
#define SE0 0
#define SE1 1
#define FSHOST 2
@ -150,7 +145,7 @@ e-mail : support@circuitsathome.com
#define bmFRAMEIRQ 0x40
#define bmHXFRDNIRQ 0x80
#define rHIEN 0xd0 //26<<3
#define rHIEN 0xd0 //26<<3
/* HIEN Bits */
#define bmBUSEVENTIE 0x01
@ -162,7 +157,7 @@ e-mail : support@circuitsathome.com
#define bmFRAMEIE 0x40
#define bmHXFRDNIE 0x80
#define rMODE 0xd8 //27<<3
#define rMODE 0xd8 //27<<3
/* MODE Bits */
#define bmHOST 0x01

View file

@ -25,42 +25,42 @@ e-mail : support@circuitsathome.com
#include "Print.h"
// commands
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
#define LCD_ENTRYMODESET 0x04
#define LCD_DISPLAYCONTROL 0x08
#define LCD_CURSORSHIFT 0x10
#define LCD_FUNCTIONSET 0x20
#define LCD_SETCGRAMADDR 0x40
#define LCD_SETDDRAMADDR 0x80
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
#define LCD_ENTRYMODESET 0x04
#define LCD_DISPLAYCONTROL 0x08
#define LCD_CURSORSHIFT 0x10
#define LCD_FUNCTIONSET 0x20
#define LCD_SETCGRAMADDR 0x40
#define LCD_SETDDRAMADDR 0x80
// flags for display entry mode
#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYSHIFTINCREMENT 0x01
#define LCD_ENTRYSHIFTDECREMENT 0x00
// flags for display on/off control
#define LCD_DISPLAYON 0x04
#define LCD_DISPLAYOFF 0x00
#define LCD_CURSORON 0x02
#define LCD_CURSOROFF 0x00
#define LCD_BLINKON 0x01
#define LCD_BLINKOFF 0x00
#define LCD_DISPLAYON 0x04
#define LCD_DISPLAYOFF 0x00
#define LCD_CURSORON 0x02
#define LCD_CURSOROFF 0x00
#define LCD_BLINKON 0x01
#define LCD_BLINKOFF 0x00
// flags for display/cursor shift
#define LCD_DISPLAYMOVE 0x08
#define LCD_CURSORMOVE 0x00
#define LCD_MOVERIGHT 0x04
#define LCD_MOVELEFT 0x00
#define LCD_DISPLAYMOVE 0x08
#define LCD_CURSORMOVE 0x00
#define LCD_MOVERIGHT 0x04
#define LCD_MOVELEFT 0x00
// flags for function set
#define LCD_8BITMODE 0x10
#define LCD_4BITMODE 0x00
#define LCD_2LINE 0x08
#define LCD_1LINE 0x00
#define LCD_5x10DOTS 0x04
#define LCD_5x8DOTS 0x00
#define LCD_8BITMODE 0x10
#define LCD_4BITMODE 0x00
#define LCD_2LINE 0x08
#define LCD_1LINE 0x00
#define LCD_5x10DOTS 0x04
#define LCD_5x8DOTS 0x00
class Max_LCD : public Print {
USB *pUsb;

View file

@ -135,4 +135,4 @@ e-mail : support@circuitsathome.com
#if defined(__PIC32MX__) || defined(__PIC32MZ__)
#include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
#endif
#endif /* SETTINGS_H */
#endif /* SETTINGS_H */

View file

@ -60,17 +60,17 @@ e-mail : support@circuitsathome.com
/* USB descriptors */
#define USB_DESCRIPTOR_DEVICE 0x01 // bDescriptorType for a Device Descriptor.
#define USB_DESCRIPTOR_CONFIGURATION 0x02 // bDescriptorType for a Configuration Descriptor.
#define USB_DESCRIPTOR_STRING 0x03 // bDescriptorType for a String Descriptor.
#define USB_DESCRIPTOR_INTERFACE 0x04 // bDescriptorType for an Interface Descriptor.
#define USB_DESCRIPTOR_ENDPOINT 0x05 // bDescriptorType for an Endpoint Descriptor.
#define USB_DESCRIPTOR_DEVICE_QUALIFIER 0x06 // bDescriptorType for a Device Qualifier.
#define USB_DESCRIPTOR_OTHER_SPEED 0x07 // bDescriptorType for a Other Speed Configuration.
#define USB_DESCRIPTOR_INTERFACE_POWER 0x08 // bDescriptorType for Interface Power.
#define USB_DESCRIPTOR_OTG 0x09 // bDescriptorType for an OTG Descriptor.
#define USB_DESCRIPTOR_DEVICE 0x01 // bDescriptorType for a Device Descriptor.
#define USB_DESCRIPTOR_CONFIGURATION 0x02 // bDescriptorType for a Configuration Descriptor.
#define USB_DESCRIPTOR_STRING 0x03 // bDescriptorType for a String Descriptor.
#define USB_DESCRIPTOR_INTERFACE 0x04 // bDescriptorType for an Interface Descriptor.
#define USB_DESCRIPTOR_ENDPOINT 0x05 // bDescriptorType for an Endpoint Descriptor.
#define USB_DESCRIPTOR_DEVICE_QUALIFIER 0x06 // bDescriptorType for a Device Qualifier.
#define USB_DESCRIPTOR_OTHER_SPEED 0x07 // bDescriptorType for a Other Speed Configuration.
#define USB_DESCRIPTOR_INTERFACE_POWER 0x08 // bDescriptorType for Interface Power.
#define USB_DESCRIPTOR_OTG 0x09 // bDescriptorType for an OTG Descriptor.
#define HID_DESCRIPTOR_HID 0x21
#define HID_DESCRIPTOR_HID 0x21

View file

@ -445,7 +445,7 @@ uint8_t MAX3421e< SPI_SS, INTR >::IntHandler() {
//template< typename SPI_SS, typename INTR >
//uint8_t MAX3421e< SPI_SS, INTR >::GpxHandler()
//{
// uint8_t GPINIRQ = regRd( rGPINIRQ ); //read GPIN IRQ register
// uint8_t GPINIRQ = regRd( rGPINIRQ ); //read GPIN IRQ register
//// if( GPINIRQ & bmGPINIRQ7 ) { //vbus overload
//// vbusPwr( OFF ); //attempt powercycle
//// delay( 1000 );

View file

@ -253,9 +253,9 @@ uint8_t USBHub::CheckHubStatus() {
// rcode = GetHubStatus(1, 0, 1, 4, buf);
// if (rcode)
// {
// USB_HOST_SERIAL.print("GetHubStatus Error");
// USB_HOST_SERIAL.println(rcode, HEX);
// return rcode;
// USB_HOST_SERIAL.print("GetHubStatus Error");
// USB_HOST_SERIAL.println(rcode, HEX);
// return rcode;
// }
//}
for(uint8_t port = 1, mask = 0x02; port < 8; mask <<= 1, port++) {

View file

@ -19,7 +19,7 @@ e-mail : support@circuitsathome.com
#include "Usb.h"
#define USB_DESCRIPTOR_HUB 0x09 // Hub descriptor type
#define USB_DESCRIPTOR_HUB 0x09 // Hub descriptor type
// Hub Requests
#define bmREQ_CLEAR_HUB_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
@ -73,62 +73,62 @@ e-mail : support@circuitsathome.com
#define HUB_PORT_INDICATOR_OFF 3
// Hub Port Status Bitmasks
#define bmHUB_PORT_STATUS_PORT_CONNECTION 0x0001
#define bmHUB_PORT_STATUS_PORT_ENABLE 0x0002
#define bmHUB_PORT_STATUS_PORT_SUSPEND 0x0004
#define bmHUB_PORT_STATUS_PORT_OVER_CURRENT 0x0008
#define bmHUB_PORT_STATUS_PORT_RESET 0x0010
#define bmHUB_PORT_STATUS_PORT_POWER 0x0100
#define bmHUB_PORT_STATUS_PORT_LOW_SPEED 0x0200
#define bmHUB_PORT_STATUS_PORT_HIGH_SPEED 0x0400
#define bmHUB_PORT_STATUS_PORT_TEST 0x0800
#define bmHUB_PORT_STATUS_PORT_INDICATOR 0x1000
#define bmHUB_PORT_STATUS_PORT_CONNECTION 0x0001
#define bmHUB_PORT_STATUS_PORT_ENABLE 0x0002
#define bmHUB_PORT_STATUS_PORT_SUSPEND 0x0004
#define bmHUB_PORT_STATUS_PORT_OVER_CURRENT 0x0008
#define bmHUB_PORT_STATUS_PORT_RESET 0x0010
#define bmHUB_PORT_STATUS_PORT_POWER 0x0100
#define bmHUB_PORT_STATUS_PORT_LOW_SPEED 0x0200
#define bmHUB_PORT_STATUS_PORT_HIGH_SPEED 0x0400
#define bmHUB_PORT_STATUS_PORT_TEST 0x0800
#define bmHUB_PORT_STATUS_PORT_INDICATOR 0x1000
// Hub Port Status Change Bitmasks (used one byte instead of two)
#define bmHUB_PORT_STATUS_C_PORT_CONNECTION 0x0001
#define bmHUB_PORT_STATUS_C_PORT_ENABLE 0x0002
#define bmHUB_PORT_STATUS_C_PORT_SUSPEND 0x0004
#define bmHUB_PORT_STATUS_C_PORT_OVER_CURRENT 0x0008
#define bmHUB_PORT_STATUS_C_PORT_RESET 0x0010
#define bmHUB_PORT_STATUS_C_PORT_CONNECTION 0x0001
#define bmHUB_PORT_STATUS_C_PORT_ENABLE 0x0002
#define bmHUB_PORT_STATUS_C_PORT_SUSPEND 0x0004
#define bmHUB_PORT_STATUS_C_PORT_OVER_CURRENT 0x0008
#define bmHUB_PORT_STATUS_C_PORT_RESET 0x0010
// Hub Status Bitmasks (used one byte instead of two)
#define bmHUB_STATUS_LOCAL_POWER_SOURCE 0x01
#define bmHUB_STATUS_OVER_CURRENT 0x12
#define bmHUB_STATUS_LOCAL_POWER_SOURCE 0x01
#define bmHUB_STATUS_OVER_CURRENT 0x12
// Hub Status Change Bitmasks (used one byte instead of two)
#define bmHUB_STATUS_C_LOCAL_POWER_SOURCE 0x01
#define bmHUB_STATUS_C_OVER_CURRENT 0x12
#define bmHUB_STATUS_C_LOCAL_POWER_SOURCE 0x01
#define bmHUB_STATUS_C_OVER_CURRENT 0x12
// Hub Port Configuring Substates
#define USB_STATE_HUB_PORT_CONFIGURING 0xb0
#define USB_STATE_HUB_PORT_POWERED_OFF 0xb1
#define USB_STATE_HUB_PORT_WAIT_FOR_POWER_GOOD 0xb2
#define USB_STATE_HUB_PORT_DISCONNECTED 0xb3
#define USB_STATE_HUB_PORT_DISABLED 0xb4
#define USB_STATE_HUB_PORT_RESETTING 0xb5
#define USB_STATE_HUB_PORT_ENABLED 0xb6
#define USB_STATE_HUB_PORT_CONFIGURING 0xb0
#define USB_STATE_HUB_PORT_POWERED_OFF 0xb1
#define USB_STATE_HUB_PORT_WAIT_FOR_POWER_GOOD 0xb2
#define USB_STATE_HUB_PORT_DISCONNECTED 0xb3
#define USB_STATE_HUB_PORT_DISABLED 0xb4
#define USB_STATE_HUB_PORT_RESETTING 0xb5
#define USB_STATE_HUB_PORT_ENABLED 0xb6
// Additional Error Codes
#define HUB_ERROR_PORT_HAS_BEEN_RESET 0xb1
#define HUB_ERROR_PORT_HAS_BEEN_RESET 0xb1
// The bit mask to check for all necessary state bits
#define bmHUB_PORT_STATUS_ALL_MAIN ((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE | bmHUB_PORT_STATUS_C_PORT_SUSPEND | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
#define bmHUB_PORT_STATUS_ALL_MAIN ((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE | bmHUB_PORT_STATUS_C_PORT_SUSPEND | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
// Bit mask to check for DISABLED state in HubEvent::bmStatus field
#define bmHUB_PORT_STATE_CHECK_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
#define bmHUB_PORT_STATE_CHECK_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
// Hub Port States
#define bmHUB_PORT_STATE_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
#define bmHUB_PORT_STATE_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
// Hub Port Events
#define bmHUB_PORT_EVENT_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
#define bmHUB_PORT_EVENT_DISCONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER)
#define bmHUB_PORT_EVENT_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION)
#define bmHUB_PORT_EVENT_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
#define bmHUB_PORT_EVENT_DISCONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER)
#define bmHUB_PORT_EVENT_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION)
#define bmHUB_PORT_EVENT_LS_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
#define bmHUB_PORT_EVENT_LS_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
#define bmHUB_PORT_EVENT_LS_PORT_ENABLED (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
#define bmHUB_PORT_EVENT_LS_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
#define bmHUB_PORT_EVENT_LS_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
#define bmHUB_PORT_EVENT_LS_PORT_ENABLED (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
struct HubDescriptor {
uint8_t bDescLength; // descriptor length