mirror of https://github.com/ARMmbed/mbed-os.git
code formatting fixes
parent
69a095cf3e
commit
ff3b0c1623
|
@ -67,11 +67,11 @@ USBTester::~USBTester()
|
||||||
|
|
||||||
const char *USBTester::get_desc_string(const uint8_t *desc)
|
const char *USBTester::get_desc_string(const uint8_t *desc)
|
||||||
{
|
{
|
||||||
static char ret_string[128] = {};
|
static char ret_string[128] = { };
|
||||||
const uint8_t desc_size = desc[0] - 2;
|
const uint8_t desc_size = desc[0] - 2;
|
||||||
const uint8_t *desc_str = &desc[2];
|
const uint8_t *desc_str = &desc[2];
|
||||||
uint32_t j = 0;
|
uint32_t j = 0;
|
||||||
for(uint32_t i = 0; i < desc_size; i+=2, j++) {
|
for (uint32_t i = 0; i < desc_size; i += 2, j++) {
|
||||||
ret_string[j] = desc_str[i];
|
ret_string[j] = desc_str[i];
|
||||||
}
|
}
|
||||||
ret_string[j] = '\0';
|
ret_string[j] = '\0';
|
||||||
|
@ -80,7 +80,7 @@ const char *USBTester::get_desc_string(const uint8_t *desc)
|
||||||
|
|
||||||
void USBTester::suspend(bool suspended)
|
void USBTester::suspend(bool suspended)
|
||||||
{
|
{
|
||||||
if(suspended) {
|
if (suspended) {
|
||||||
++suspend_count;
|
++suspend_count;
|
||||||
} else {
|
} else {
|
||||||
++resume_count;
|
++resume_count;
|
||||||
|
@ -146,7 +146,7 @@ void USBTester::callback_request(const setup_packet_t *setup)
|
||||||
case VENDOR_TEST_CTRL_OUT:
|
case VENDOR_TEST_CTRL_OUT:
|
||||||
result = Receive;
|
result = Receive;
|
||||||
data = ctrl_buf;
|
data = ctrl_buf;
|
||||||
size = setup->wValue < 8 ? setup->wValue : 8;
|
size = setup->wValue < 8 ? setup->wValue : 8;
|
||||||
break;
|
break;
|
||||||
case VENDOR_TEST_CTRL_NONE:
|
case VENDOR_TEST_CTRL_NONE:
|
||||||
result = Success;
|
result = Success;
|
||||||
|
@ -176,8 +176,6 @@ void USBTester::callback_request(const setup_packet_t *setup)
|
||||||
} else {
|
} else {
|
||||||
complete_request(result, data, size);
|
complete_request(result, data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void USBTester::callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
|
void USBTester::callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
|
||||||
|
|
|
@ -62,6 +62,7 @@ bool USBDevice::_request_get_descriptor()
|
||||||
#endif
|
#endif
|
||||||
switch (DESCRIPTOR_TYPE(_transfer.setup.wValue)) {
|
switch (DESCRIPTOR_TYPE(_transfer.setup.wValue)) {
|
||||||
case DEVICE_DESCRIPTOR:
|
case DEVICE_DESCRIPTOR:
|
||||||
|
{
|
||||||
if (device_desc() != NULL) {
|
if (device_desc() != NULL) {
|
||||||
if ((device_desc()[0] == DEVICE_DESCRIPTOR_LENGTH) \
|
if ((device_desc()[0] == DEVICE_DESCRIPTOR_LENGTH) \
|
||||||
&& (device_desc()[1] == DEVICE_DESCRIPTOR)) {
|
&& (device_desc()[1] == DEVICE_DESCRIPTOR)) {
|
||||||
|
@ -75,6 +76,7 @@ bool USBDevice::_request_get_descriptor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case CONFIGURATION_DESCRIPTOR:
|
case CONFIGURATION_DESCRIPTOR:
|
||||||
{
|
{
|
||||||
const uint8_t idx = DESCRIPTOR_INDEX(_transfer.setup.wValue);
|
const uint8_t idx = DESCRIPTOR_INDEX(_transfer.setup.wValue);
|
||||||
|
@ -96,6 +98,7 @@ bool USBDevice::_request_get_descriptor()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STRING_DESCRIPTOR:
|
case STRING_DESCRIPTOR:
|
||||||
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("str descriptor\r\n");
|
printf("str descriptor\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -156,21 +159,29 @@ bool USBDevice::_request_get_descriptor()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case INTERFACE_DESCRIPTOR:
|
case INTERFACE_DESCRIPTOR:
|
||||||
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("interface descr\r\n");
|
printf("interface descr\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ENDPOINT_DESCRIPTOR:
|
case ENDPOINT_DESCRIPTOR:
|
||||||
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("endpoint descr\r\n");
|
printf("endpoint descr\r\n");
|
||||||
#endif
|
#endif
|
||||||
/* TODO: Support is optional, not implemented here */
|
/* TODO: Support is optional, not implemented here */
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("ERROR\r\n");
|
printf("ERROR\r\n");
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
@ -406,7 +417,6 @@ void USBDevice::_complete_set_configuration()
|
||||||
_phy->ep0_stall();
|
_phy->ep0_stall();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool USBDevice::_request_get_configuration()
|
bool USBDevice::_request_get_configuration()
|
||||||
|
|
Loading…
Reference in New Issue