Renamed USB class to USBHost, so it does not collide with the one defined in the Arduino Zero core

Also renamed the struct UsbDevice to UsbDeviceDefinition
This commit is contained in:
Kristian Sloth Lauszus 2016-01-19 16:34:45 +01:00
parent 47375fa8a7
commit 6c36eed239
42 changed files with 140 additions and 140 deletions

View file

@ -64,4 +64,4 @@ install:
- platformio lib install 416 417
script:
- platformio ci --board=uno --board=teensy31 --board=due --lib="."
- platformio ci --board=uno --board=teensy31 --board=due --board=zero --lib="."

View file

@ -24,12 +24,12 @@ const uint8_t BTD::BTD_EVENT_PIPE = 1;
const uint8_t BTD::BTD_DATAIN_PIPE = 2;
const uint8_t BTD::BTD_DATAOUT_PIPE = 3;
BTD::BTD(USB *p) :
BTD::BTD(USBHost *p) :
connectToWii(false),
pairWithWii(false),
connectToHIDDevice(false),
pairWithHIDDevice(false),
pUsb(p), // Pointer to USB class instance - mandatory
pUsb(p), // Pointer to USBHost class instance - mandatory
bAddress(0), // Device address - mandatory
bNumEP(1), // If config descriptor needs to be parsed
qNextPollTime(0), // Reset NextPollTime
@ -50,7 +50,7 @@ uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[constBufSize];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
Initialize(); // Set all variables, endpoint structs etc. to default values
@ -140,7 +140,7 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
#ifdef EXTRADEBUG
Notify(PSTR("\r\nBTD Init"), 0x80);
#endif
UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
UsbDeviceDefinition *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
if(!p) {
#ifdef DEBUG_USB_HOST

8
BTD.h
View file

@ -199,9 +199,9 @@ class BTD : public USBDeviceConfig, public UsbConfigXtracter {
public:
/**
* Constructor for the BTD class.
* @param p Pointer to USB class instance.
* @param p Pointer to USBHost class instance.
*/
BTD(USB *p);
BTD(USBHost *p);
/** @name USBDeviceConfig implementation */
/**
@ -497,8 +497,8 @@ public:
};
protected:
/** Pointer to USB class instance. */
USB *pUsb;
/** Pointer to USBHost class instance. */
USBHost *pUsb;
/** Device address. */
uint8_t bAddress;
/** Endpoint info structure. */

View file

@ -21,7 +21,7 @@
//#define PRINTREPORT // Uncomment to print the report send by the HID device
BTHID::BTHID(BTD *p, bool pair, const char *pin) :
BluetoothService(p), // Pointer to USB class instance - mandatory
BluetoothService(p), // Pointer to BTD class instance - mandatory
protocolMode(USB_HID_BOOT_PROTOCOL) {
for(uint8_t i = 0; i < NUM_PARSERS; i++)
pRptParser[i] = NULL;

View file

@ -21,7 +21,7 @@
//#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
PS3BT::PS3BT(BTD *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
BluetoothService(p) // Pointer to USB class instance - mandatory
BluetoothService(p) // Pointer to BTD class instance - mandatory
{
pBtd->my_bdaddr[5] = btadr5; // Change to your dongle's Bluetooth address instead
pBtd->my_bdaddr[4] = btadr4;

View file

@ -20,8 +20,8 @@
//#define EXTRADEBUG // Uncomment to get even more debugging data
//#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
PS3USB::PS3USB(USB *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
pUsb(p), // pointer to USB class instance - mandatory
PS3USB::PS3USB(USBHost *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
pUsb(p), // pointer to USBHost class instance - mandatory
bAddress(0), // device address - mandatory
bPollEnable(false) // don't start polling before dongle is connected
{
@ -48,7 +48,7 @@ uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint16_t PID;
uint16_t VID;

View file

@ -50,12 +50,12 @@ class PS3USB : public USBDeviceConfig {
public:
/**
* Constructor for the PS3USB class.
* @param pUsb Pointer to USB class instance.
* @param pUsb Pointer to USBHost class instance.
* @param btadr5,btadr4,btadr3,btadr2,btadr1,btadr0
* Pass your dongles Bluetooth address into the constructor,
* so you are able to pair the controller with a Bluetooth dongle.
*/
PS3USB(USB *pUsb, uint8_t btadr5 = 0, uint8_t btadr4 = 0, uint8_t btadr3 = 0, uint8_t btadr2 = 0, uint8_t btadr1 = 0, uint8_t btadr0 = 0);
PS3USB(USBHost *pUsb, uint8_t btadr5 = 0, uint8_t btadr4 = 0, uint8_t btadr3 = 0, uint8_t btadr2 = 0, uint8_t btadr1 = 0, uint8_t btadr0 = 0);
/** @name USBDeviceConfig implementation */
/**
@ -264,8 +264,8 @@ public:
bool PS3NavigationConnected;
protected:
/** Pointer to USB class instance. */
USB *pUsb;
/** Pointer to USBHost class instance. */
USBHost *pUsb;
/** Device address. */
uint8_t bAddress;
/** Endpoint info structure. */

View file

@ -32,9 +32,9 @@ class PS4USB : public HIDUniversal, public PS4Parser {
public:
/**
* Constructor for the PS4USB class.
* @param p Pointer to the USB class instance.
* @param p Pointer to the USBHost class instance.
*/
PS4USB(USB *p) :
PS4USB(USBHost *p) :
HIDUniversal(p) {
PS4Parser::Reset();
};

View file

@ -44,9 +44,9 @@ class PSBuzz : public HIDUniversal {
public:
/**
* Constructor for the PSBuzz class.
* @param p Pointer to the USB class instance.
* @param p Pointer to the USBHost class instance.
*/
PSBuzz(USB *p) :
PSBuzz(USBHost *p) :
HIDUniversal(p) {
Reset();
};

64
Usb.cpp
View file

@ -22,27 +22,27 @@ static uint8_t usb_error = 0;
static uint8_t usb_task_state;
/* constructor */
USB::USB() : bmHubPre(0) {
USBHost::USBHost() : bmHubPre(0) {
usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; //set up state machine
init();
}
/* Initialize data structures */
void USB::init() {
void USBHost::init() {
//devConfigIndex = 0;
bmHubPre = 0;
}
uint8_t USB::getUsbTaskState(void) {
uint8_t USBHost::getUsbTaskState(void) {
return ( usb_task_state);
}
void USB::setUsbTaskState(uint8_t state) {
void USBHost::setUsbTaskState(uint8_t state) {
usb_task_state = state;
}
EpInfo* USB::getEpInfoEntry(uint8_t addr, uint8_t ep) {
UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
EpInfo* USBHost::getEpInfoEntry(uint8_t addr, uint8_t ep) {
UsbDeviceDefinition *p = addrPool.GetUsbDevicePtr(addr);
if(!p || !p->epinfo)
return NULL;
@ -61,11 +61,11 @@ EpInfo* USB::getEpInfoEntry(uint8_t addr, uint8_t ep) {
/* set device table entry */
/* each device is different and has different number of endpoints. This function plugs endpoint record structure, defined in application, to devtable */
uint8_t USB::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr) {
uint8_t USBHost::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr) {
if(!eprecord_ptr)
return USB_ERROR_INVALID_ARGUMENT;
UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
UsbDeviceDefinition *p = addrPool.GetUsbDevicePtr(addr);
if(!p)
return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
@ -77,8 +77,8 @@ uint8_t USB::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr)
return 0;
}
uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit) {
UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
uint8_t USBHost::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit) {
UsbDeviceDefinition *p = addrPool.GetUsbDevicePtr(addr);
if(!p)
return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
@ -123,7 +123,7 @@ uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_l
/* 00 = success */
/* 01-0f = non-zero HRSLT */
uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
uint8_t USBHost::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p) {
bool direction = false; //request direction, IN or OUT
uint8_t rcode;
@ -203,22 +203,22 @@ uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bReque
/* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
fe USB xfer timeout */
uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
uint8_t USBHost::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
EpInfo *pep = NULL;
uint16_t nak_limit = 0;
uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
if(rcode) {
USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81);
USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81);
USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81);
USBTRACE3("(USBHost::InTransfer) SetAddress Failed ", rcode, 0x81);
USBTRACE3("(USBHost::InTransfer) addr requested ", addr, 0x81);
USBTRACE3("(USBHost::InTransfer) ep requested ", ep, 0x81);
return rcode;
}
return InTransfer(pep, nak_limit, nbytesptr, data, bInterval);
}
uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
uint8_t USBHost::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
uint8_t rcode = 0;
uint8_t pktsize;
@ -290,7 +290,7 @@ uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, ui
/* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */
/* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */
uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
uint8_t USBHost::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
EpInfo *pep = NULL;
uint16_t nak_limit = 0;
@ -302,7 +302,7 @@ uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dat
return OutTransfer(pep, nak_limit, nbytes, data);
}
uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
uint8_t USBHost::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
uint8_t rcode = hrSUCCESS, retry_count;
uint8_t *data_p = data; //local copy of the data pointer
uint16_t bytes_tosend, nak_count;
@ -374,7 +374,7 @@ breakout:
/* If bus timeout, re-sends up to USB_RETRY_LIMIT times */
/* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */
uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
uint8_t USBHost::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
unsigned long timeout = millis() + USB_XFER_TIMEOUT;
uint8_t tmpdata;
uint8_t rcode = hrSUCCESS;
@ -422,7 +422,7 @@ uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
}
/* USB main task. Performs enumeration/cleanup */
void USB::Task(void) //USB state machine
void USBHost::Task(void) //USB state machine
{
uint8_t rcode;
uint8_t tmpdata;
@ -528,10 +528,10 @@ void USB::Task(void) //USB state machine
} // switch( usb_task_state )
}
uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t USBHost::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
//uint8_t buf[12];
uint8_t rcode;
UsbDevice *p0 = NULL, *p = NULL;
UsbDeviceDefinition *p0 = NULL, *p = NULL;
// Get pointer to pseudo device with address 0 assigned
p0 = addrPool.GetUsbDevicePtr(0);
@ -568,7 +568,7 @@ uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
return 0;
};
uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t USBHost::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) {
//printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port);
uint8_t retries = 0;
@ -650,14 +650,14 @@ again:
* 8: if we get here, no driver likes the device plugged in, so exit failure.
*
*/
uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t USBHost::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
//uint8_t bAddress = 0;
//printf("Configuring: parent = %i, port = %i\r\n", parent, port);
uint8_t devConfigIndex;
uint8_t rcode = 0;
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
EpInfo epInfo;
@ -748,7 +748,7 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
return rcode;
}
uint8_t USB::ReleaseDevice(uint8_t addr) {
uint8_t USBHost::ReleaseDevice(uint8_t addr) {
if(!addr)
return 0;
@ -763,18 +763,18 @@ uint8_t USB::ReleaseDevice(uint8_t addr) {
#if 1 //!defined(USB_METHODS_INLINE)
//get device descriptor
uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
uint8_t USBHost::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL));
}
//get configuration descriptor
uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
uint8_t USBHost::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL));
}
/* Requests Configuration Descriptor. Sends two Get Conf Descr requests. The first one gets the total length of all descriptors, then the second one requests this
total length. The length of the first request can be shorter ( 4 bytes ), however, there are devices which won't work unless this length is set to 9 */
uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
uint8_t USBHost::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
const uint8_t bufSize = 64;
uint8_t buf[bufSize];
USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
@ -793,12 +793,12 @@ uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser
//get string descriptor
uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
uint8_t USBHost::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL));
}
//set address
uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
uint8_t USBHost::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL);
//delay(2); //per USB 2.0 sect.9.2.6.3
delay(300); // Older spec says you should wait at least 200ms
@ -807,7 +807,7 @@ uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
}
//set configuration
uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
uint8_t USBHost::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
}

View file

@ -194,13 +194,13 @@ public:
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0;
};
class USB : public MAX3421E {
class USBHost : public MAX3421E {
AddressPoolImpl<USB_NUMDEVICES> addrPool;
USBDeviceConfig* devConfig[USB_NUMDEVICES];
uint8_t bmHubPre;
public:
USB(void);
USBHost(void);
void SetHubPreMask() {
bmHubPre |= bmHUBPRE;
@ -269,27 +269,27 @@ private:
#if 0 //defined(USB_METHODS_INLINE)
//get device descriptor
inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
inline uint8_t USBHost::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
}
//get configuration descriptor
inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
inline uint8_t USBHost::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
}
//get string descriptor
inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
inline uint8_t USBHost::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
}
//set address
inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
inline uint8_t USBHost::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
}
//set configuration
inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
inline uint8_t USBHost::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
}

View file

@ -83,7 +83,7 @@ const uint32_t WII_PROCONTROLLER_BUTTONS[] PROGMEM = {
};
WII::WII(BTD *p, bool pair) :
BluetoothService(p) // Pointer to USB class instance - mandatory
BluetoothService(p) // Pointer to BTD class instance - mandatory
{
pBtd->pairWithWii = pair;

View file

@ -44,8 +44,8 @@ const uint8_t XBOXOLD_BUTTONS[] PROGMEM = {
3, // Y
};
XBOXOLD::XBOXOLD(USB *p) :
pUsb(p), // pointer to USB class instance - mandatory
XBOXOLD::XBOXOLD(USBHost *p) :
pUsb(p), // pointer to USBHost class instance - mandatory
bAddress(0), // device address - mandatory
bPollEnable(false) { // don't start polling before dongle is connected
for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
@ -64,7 +64,7 @@ uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint16_t PID;
uint16_t VID;

View file

@ -47,9 +47,9 @@ class XBOXOLD : public USBDeviceConfig {
public:
/**
* Constructor for the XBOXOLD class.
* @param pUsb Pointer to USB class instance.
* @param pUsb Pointer to USBHost class instance.
*/
XBOXOLD(USB *pUsb);
XBOXOLD(USBHost *pUsb);
/** @name USBDeviceConfig implementation */
/**
@ -145,8 +145,8 @@ public:
bool XboxConnected;
protected:
/** Pointer to USB class instance. */
USB *pUsb;
/** Pointer to USBHost class instance. */
USBHost *pUsb;
/** Device address. */
uint8_t bAddress;
/** Endpoint info structure. */

View file

@ -24,8 +24,8 @@
//#define EXTRADEBUG // Uncomment to get even more debugging data
//#define PRINTREPORT // Uncomment to print the report send by the Xbox ONE Controller
XBOXONE::XBOXONE(USB *p) :
pUsb(p), // pointer to USB class instance - mandatory
XBOXONE::XBOXONE(USBHost *p) :
pUsb(p), // pointer to USBHost class instance - mandatory
bAddress(0), // device address - mandatory
bPollEnable(false) { // don't start polling before dongle is connected
for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
@ -44,7 +44,7 @@ uint8_t XBOXONE::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint16_t PID;
uint16_t VID;

View file

@ -47,9 +47,9 @@ class XBOXONE : public USBDeviceConfig {
public:
/**
* Constructor for the XBOXONE class.
* @param pUsb Pointer to USB class instance.
* @param pUsb Pointer to USBHost class instance.
*/
XBOXONE(USB *pUsb);
XBOXONE(USBHost *pUsb);
/** @name USBDeviceConfig implementation */
/**
@ -132,8 +132,8 @@ public:
bool XboxOneConnected;
protected:
/** Pointer to USB class instance. */
USB *pUsb;
/** Pointer to USBHost class instance. */
USBHost *pUsb;
/** Device address. */
uint8_t bAddress;
/** Endpoint info structure. */

View file

@ -22,8 +22,8 @@
//#define EXTRADEBUG // Uncomment to get even more debugging data
//#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
XBOXRECV::XBOXRECV(USB *p) :
pUsb(p), // pointer to USB class instance - mandatory
XBOXRECV::XBOXRECV(USBHost *p) :
pUsb(p), // pointer to USBHost class instance - mandatory
bAddress(0), // device address - mandatory
bPollEnable(false) { // don't start polling before dongle is connected
for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
@ -43,7 +43,7 @@ uint8_t XBOXRECV::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[constBufSize];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint16_t PID, VID;
@ -142,7 +142,7 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
#ifdef EXTRADEBUG
Notify(PSTR("\r\nBTD Init"), 0x80);
#endif
UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
UsbDeviceDefinition *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
if(!p) {
#ifdef DEBUG_USB_HOST

View file

@ -56,9 +56,9 @@ class XBOXRECV : public USBDeviceConfig {
public:
/**
* Constructor for the XBOXRECV class.
* @param pUsb Pointer to USB class instance.
* @param pUsb Pointer to USBHost class instance.
*/
XBOXRECV(USB *pUsb);
XBOXRECV(USBHost *pUsb);
/** @name USBDeviceConfig implementation */
/**
@ -231,8 +231,8 @@ public:
uint8_t Xbox360Connected[4];
protected:
/** Pointer to USB class instance. */
USB *pUsb;
/** Pointer to USBHost class instance. */
USBHost *pUsb;
/** Device address. */
uint8_t bAddress;
/** Endpoint info structure. */

View file

@ -20,8 +20,8 @@
//#define EXTRADEBUG // Uncomment to get even more debugging data
//#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
XBOXUSB::XBOXUSB(USB *p) :
pUsb(p), // pointer to USB class instance - mandatory
XBOXUSB::XBOXUSB(USBHost *p) :
pUsb(p), // pointer to USBHost class instance - mandatory
bAddress(0), // device address - mandatory
bPollEnable(false) { // don't start polling before dongle is connected
for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
@ -40,7 +40,7 @@ uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint16_t PID;
uint16_t VID;

View file

@ -54,9 +54,9 @@ class XBOXUSB : public USBDeviceConfig {
public:
/**
* Constructor for the XBOXUSB class.
* @param pUsb Pointer to USB class instance.
* @param pUsb Pointer to USBHost class instance.
*/
XBOXUSB(USB *pUsb);
XBOXUSB(USBHost *pUsb);
/** @name USBDeviceConfig implementation */
/**
@ -185,8 +185,8 @@ public:
bool Xbox360Connected;
protected:
/** Pointer to USB class instance. */
USB *pUsb;
/** Pointer to USBHost class instance. */
USBHost *pUsb;
/** Device address. */
uint8_t bAddress;
/** Endpoint info structure. */

View file

@ -72,7 +72,7 @@ struct UsbDeviceAddress {
#define bmUSB_DEV_ADDR_PARENT 0x38
#define bmUSB_DEV_ADDR_HUB 0x40
struct UsbDevice {
struct UsbDeviceDefinition {
EpInfo *epinfo; // endpoint info pointer
UsbDeviceAddress address;
uint8_t epcount; // number of endpoints
@ -82,12 +82,12 @@ struct UsbDevice {
class AddressPool {
public:
virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) = 0;
virtual UsbDeviceDefinition* GetUsbDevicePtr(uint8_t addr) = 0;
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) = 0;
virtual void FreeAddress(uint8_t addr) = 0;
};
typedef void (*UsbDeviceHandleFunc)(UsbDevice *pdev);
typedef void (*UsbDeviceHandleFunc)(UsbDeviceDefinition *pdev);
#define ADDR_ERROR_INVALID_INDEX 0xFF
#define ADDR_ERROR_INVALID_ADDRESS 0xFF
@ -99,7 +99,7 @@ class AddressPoolImpl : public AddressPool {
uint8_t hubCounter; // hub counter is kept
// in order to avoid hub address duplication
UsbDevice thePool[MAX_DEVICES_ALLOWED];
UsbDeviceDefinition thePool[MAX_DEVICES_ALLOWED];
// Initializes address pool entry
@ -178,7 +178,7 @@ public:
// Returns a pointer to a specified address entry
virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) {
virtual UsbDeviceDefinition* GetUsbDevicePtr(uint8_t addr) {
if(!addr)
return thePool;

View file

@ -22,7 +22,7 @@ e-mail : support@circuitsathome.com
const uint8_t ADK::epDataInIndex = 1;
const uint8_t ADK::epDataOutIndex = 2;
ADK::ADK(USB *p, const char* manufacturer,
ADK::ADK(USBHost *p, const char* manufacturer,
const char* model,
const char* description,
const char* version,
@ -36,7 +36,7 @@ description(description),
version(version),
uri(uri),
serial(serial),
pUsb(p), //pointer to USB class instance - mandatory
pUsb(p), //pointer to USBHost class instance - mandatory
bAddress(0), //device address - mandatory
bConfNum(0), //configuration number
bNumEP(1), //if config descriptor needs to be parsed
@ -66,7 +66,7 @@ uint8_t ADK::Init(uint8_t parent, uint8_t port, bool lowspeed) {
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
uint8_t num_of_conf; // number of configurations
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
// get memory address of USB device address pool

4
adk.h
View file

@ -70,7 +70,7 @@ protected:
static const uint8_t epDataOutIndex; // DataOUT endpoint index
/* mandatory members */
USB *pUsb;
USBHost *pUsb;
uint8_t bAddress;
uint8_t bConfNum; // configuration number
@ -83,7 +83,7 @@ protected:
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
public:
ADK(USB *pUsb, const char* manufacturer,
ADK(USBHost *pUsb, const char* manufacturer,
const char* model,
const char* description,
const char* version,

View file

@ -16,7 +16,7 @@ e-mail : support@circuitsathome.com
*/
#include "cdc_XR21B1411.h"
XR21B1411::XR21B1411(USB *p, CDCAsyncOper *pasync) :
XR21B1411::XR21B1411(USBHost *p, CDCAsyncOper *pasync) :
ACM(p, pasync) {
// Is this needed??
_enhanced_status = enhanced_features(); // Set up features
@ -29,7 +29,7 @@ uint8_t XR21B1411::Init(uint8_t parent, uint8_t port, bool lowspeed) {
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint8_t num_of_conf; // number of configurations

View file

@ -104,7 +104,7 @@ class XR21B1411 : public ACM {
protected:
public:
XR21B1411(USB *pusb, CDCAsyncOper *pasync);
XR21B1411(USBHost *pusb, CDCAsyncOper *pasync);
/**
* Used by the USB core to check what this driver support.

View file

@ -20,7 +20,7 @@ const uint8_t ACM::epDataInIndex = 1;
const uint8_t ACM::epDataOutIndex = 2;
const uint8_t ACM::epInterruptInIndex = 3;
ACM::ACM(USB *p, CDCAsyncOper *pasync) :
ACM::ACM(USBHost *p, CDCAsyncOper *pasync) :
pUsb(p),
pAsync(pasync),
bAddress(0),
@ -51,7 +51,7 @@ uint8_t ACM::Init(uint8_t parent, uint8_t port, bool lowspeed) {
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint8_t num_of_conf; // number of configurations

View file

@ -166,7 +166,7 @@ protected:
static const uint8_t epDataOutIndex; // DataOUT endpoint index
static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
USB *pUsb;
USBHost *pUsb;
CDCAsyncOper *pAsync;
uint8_t bAddress;
uint8_t bConfNum; // configuration number
@ -183,7 +183,7 @@ protected:
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
public:
ACM(USB *pusb, CDCAsyncOper *pasync);
ACM(USBHost *pusb, CDCAsyncOper *pasync);
uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);
uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);

View file

@ -20,7 +20,7 @@ const uint8_t FTDI::epDataInIndex = 1;
const uint8_t FTDI::epDataOutIndex = 2;
const uint8_t FTDI::epInterruptInIndex = 3;
FTDI::FTDI(USB *p, FTDIAsyncOper *pasync, uint16_t idProduct) :
FTDI::FTDI(USBHost *p, FTDIAsyncOper *pasync, uint16_t idProduct) :
pAsync(pasync),
pUsb(p),
bAddress(0),
@ -44,7 +44,7 @@ uint8_t FTDI::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[constBufSize];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint8_t num_of_conf; // number of configurations

View file

@ -99,7 +99,7 @@ class FTDI : public USBDeviceConfig, public UsbConfigXtracter {
static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
FTDIAsyncOper *pAsync;
USB *pUsb;
USBHost *pUsb;
uint8_t bAddress;
uint8_t bConfNum; // configuration number
uint8_t bNumIface; // number of interfaces in the configuration
@ -114,7 +114,7 @@ class FTDI : public USBDeviceConfig, public UsbConfigXtracter {
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
public:
FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
FTDI(USBHost *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
uint8_t SetBaudRate(uint32_t baud);
uint8_t SetModemControl(uint16_t control);

View file

@ -16,7 +16,7 @@ e-mail : support@circuitsathome.com
*/
#include "cdcprolific.h"
PL2303::PL2303(USB *p, CDCAsyncOper *pasync) :
PL2303::PL2303(USBHost *p, CDCAsyncOper *pasync) :
ACM(p, pasync),
wPLType(0) {
}
@ -27,7 +27,7 @@ uint8_t PL2303::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[constBufSize];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint8_t num_of_conf; // number of configurations
#ifdef PL2303_COMPAT

View file

@ -123,7 +123,7 @@ class PL2303 : public ACM {
uint16_t wPLType; // Type of chip
public:
PL2303(USB *pusb, CDCAsyncOper *pasync);
PL2303(USBHost *pusb, CDCAsyncOper *pasync);
// USBDeviceConfig implementation
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);

View file

@ -218,7 +218,7 @@ class HIDBoot : public USBHID //public USBDeviceConfig, public UsbConfigXtracter
};
public:
HIDBoot(USB *p);
HIDBoot(USBHost *p);
virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
pRptParser[id] = prs;
@ -252,7 +252,7 @@ public:
};
template <const uint8_t BOOT_PROTOCOL>
HIDBoot<BOOT_PROTOCOL>::HIDBoot(USB *p) :
HIDBoot<BOOT_PROTOCOL>::HIDBoot(USBHost *p) :
USBHID(p),
qNextPollTime(0),
bPollEnable(false) {
@ -285,7 +285,7 @@ uint8_t HIDBoot<BOOT_PROTOCOL>::Init(uint8_t parent, uint8_t port, bool lowspeed
uint8_t buf[constBufSize];
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint8_t len = 0;
//uint16_t cd_len = 0;

View file

@ -17,7 +17,7 @@ e-mail : support@circuitsathome.com
#include "hiduniversal.h"
HIDUniversal::HIDUniversal(USB *p) :
HIDUniversal::HIDUniversal(USBHost *p) :
USBHID(p),
qNextPollTime(0),
pollInterval(0),
@ -99,7 +99,7 @@ uint8_t HIDUniversal::Init(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[constBufSize];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint8_t len = 0;

View file

@ -80,7 +80,7 @@ protected:
};
public:
HIDUniversal(USB *p);
HIDUniversal(USBHost *p);
// HID implementation
bool SetReportParser(uint8_t id, HIDReportParser *prs);

View file

@ -6,7 +6,7 @@
# Datatypes (KEYWORD1)
####################################################
USB KEYWORD1
USBHost KEYWORD1
USBHub KEYWORD1
####################################################

View file

@ -219,7 +219,7 @@ again:
////////////////////////////////////////////////////////////////////////////////
BulkOnly::BulkOnly(USB *p) :
BulkOnly::BulkOnly(USBHost *p) :
pUsb(p),
bAddress(0),
bIface(0),
@ -255,7 +255,7 @@ uint8_t BulkOnly::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
uint8_t buf[constBufSize];
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
USBTRACE("MS ConfigureDevice\r\n");
ClearAllEP();
@ -330,7 +330,7 @@ uint8_t BulkOnly::Init(uint8_t parent, uint8_t port, bool lowspeed) {
USBTRACE("MS Init\r\n");
AddressPool &addrPool = pUsb->GetAddressPool();
UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress);
UsbDeviceDefinition *p = addrPool.GetUsbDevicePtr(bAddress);
if(!p)
return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;

View file

@ -465,7 +465,7 @@ protected:
static const uint8_t epDataOutIndex; // DataOUT endpoint index
static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
USB *pUsb;
USBHost *pUsb;
uint8_t bAddress;
uint8_t bConfNum; // configuration number
uint8_t bIface; // interface value
@ -493,7 +493,7 @@ protected:
return 0;
};
public:
BulkOnly(USB *p);
BulkOnly(USBHost *p);
uint8_t GetLastUsbError() {
return bLastUsbError;

View file

@ -39,7 +39,7 @@ e-mail : support@circuitsathome.com
static uint8_t lcdPins; //copy of LCD pins
Max_LCD::Max_LCD(USB *pusb) : pUsb(pusb) {
Max_LCD::Max_LCD(USBHost *pusb) : pUsb(pusb) {
lcdPins = 0;
}

View file

@ -63,10 +63,10 @@ e-mail : support@circuitsathome.com
#define LCD_5x8DOTS 0x00
class Max_LCD : public Print {
USB *pUsb;
USBHost *pUsb;
public:
Max_LCD(USB *pusb);
Max_LCD(USBHost *pusb);
void init();
void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
void clear();

View file

@ -120,7 +120,7 @@ struct HidItemPrefix {
uint8_t bSize : 2;
uint8_t bType : 2;
uint8_t bTag : 4;
};
} __attribute__((packed));
struct MainItemIOFeature {
uint8_t bmIsConstantOrData : 1;
@ -131,7 +131,7 @@ struct MainItemIOFeature {
uint8_t bmIsNoPreferedOrPrefered : 1;
uint8_t bmIsNullOrNoNull : 1;
uint8_t bmIsVolatileOrNonVolatile : 1;
};
} __attribute__((packed));
class USBHID;
@ -142,7 +142,7 @@ public:
class USBHID : public USBDeviceConfig, public UsbConfigXtracter {
protected:
USB *pUsb; // USB class instance pointer
USBHost *pUsb; // USBHost class instance pointer
uint8_t bAddress; // address
protected:
@ -162,10 +162,10 @@ protected:
public:
USBHID(USB *pusb) : pUsb(pusb) {
USBHID(USBHost *pusb) : pUsb(pusb) {
};
const USB* GetUsb() {
const USBHost* GetUsb() {
return pUsb;
};

View file

@ -18,7 +18,7 @@ e-mail : support@circuitsathome.com
bool USBHub::bResetInitiated = false;
USBHub::USBHub(USB *p) :
USBHub::USBHub(USBHost *p) :
pUsb(p),
bAddress(0),
bNbrPorts(0),
@ -47,7 +47,7 @@ uint8_t USBHub::Init(uint8_t parent, uint8_t port, bool lowspeed) {
HubDescriptor* hd = reinterpret_cast<HubDescriptor*>(buf);
USB_CONFIGURATION_DESCRIPTOR * ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = NULL;
UsbDeviceDefinition *p = NULL;
EpInfo *oldep_ptr = NULL;
uint8_t len = 0;
uint16_t cd_len = 0;

View file

@ -164,7 +164,7 @@ struct HubEvent {
class USBHub : USBDeviceConfig {
static bool bResetInitiated; // True when reset is triggered
USB *pUsb; // USB class instance pointer
USBHost *pUsb; // USBHost class instance pointer
EpInfo epInfo[2]; // interrupt endpoint info structure
@ -178,7 +178,7 @@ class USBHub : USBDeviceConfig {
uint8_t PortStatusChange(uint8_t port, HubEvent &evt);
public:
USBHub(USB *p);
USBHub(USBHost *p);
uint8_t ClearHubFeature(uint8_t fid);
uint8_t ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel = 0);
@ -247,6 +247,6 @@ inline uint8_t USBHub::SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel) {
return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_PORT_FEATURE, USB_REQUEST_SET_FEATURE, fid, 0, (((0x0000 | sel) << 8) | port), 0, 0, NULL, NULL));
}
void PrintHubPortStatus(USB *usbptr, uint8_t addr, uint8_t port, bool print_changes = false);
void PrintHubPortStatus(USBHost *usbptr, uint8_t addr, uint8_t port, bool print_changes = false);
#endif // __USBHUB_H__