-
Notifications
You must be signed in to change notification settings - Fork 3k
Remove inclusion of mbed.h from USB #9539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cmonr
merged 2 commits into
ARMmbed:feature-hal-spec-usb-device
from
c1728p9:fix_travis
Jan 30, 2019
Merged
Remove inclusion of mbed.h from USB #9539
cmonr
merged 2 commits into
ARMmbed:feature-hal-spec-usb-device
from
c1728p9:fix_travis
Jan 30, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove mbed.h from USB files and fix the build errors this causes. This is required to pass CI.
cmonr
approved these changes
Jan 29, 2019
Astyle quickfixFeel free to run the following script to correct this PR's astyle issues identified by Travis CI. git apply -3 <<'PATCH' && git commit -am "Applied suggested astyle fixes" && git push
diff --git a/TESTS/usb_device/basic/USBTester.cpp b/TESTS/usb_device/basic/USBTester.cpp
index 93cc892ff..eba6d7971 100644
--- a/TESTS/usb_device/basic/USBTester.cpp
+++ b/TESTS/usb_device/basic/USBTester.cpp
@@ -41,9 +41,9 @@
USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release):
- USBDevice(phy, vendor_id, product_id, product_release), interface_0_alt_set(NONE),
- interface_1_alt_set(NONE), configuration_set(NONE), reset_count(0),
- suspend_count(0), resume_count(0)
+ USBDevice(phy, vendor_id, product_id, product_release), interface_0_alt_set(NONE),
+ interface_1_alt_set(NONE), configuration_set(NONE), reset_count(0),
+ suspend_count(0), resume_count(0)
{
EndpointResolver resolver(endpoint_table());
@@ -269,14 +269,14 @@ bool USBTester::set_configuration(uint16_t configuration)
bulk_buf, sizeof(bulk_buf), &USBTester::epbulk_out_callback);
// interface 1 alternate 0
success &= setup_iterface(int_in, int_out, MAX_EP_SIZE, USB_EP_TYPE_INT,
- int_buf, sizeof(int_buf), &USBTester::epint_out_callback);
+ int_buf, sizeof(int_buf), &USBTester::epint_out_callback);
} else if (configuration == 2) {
// interface 0 alternate 0
success = setup_iterface(int_in, int_out, MIN_EP_SIZE, USB_EP_TYPE_INT,
int_buf, sizeof(int_buf), &USBTester::epint_out_callback);
// interface 1 alternate 0
success &= setup_iterface(bulk_in, bulk_out, MIN_EP_SIZE, USB_EP_TYPE_BULK,
- bulk_buf, sizeof(bulk_buf), &USBTester::epbulk_out_callback);
+ bulk_buf, sizeof(bulk_buf), &USBTester::epbulk_out_callback);
}
if (success) {
configuration_set = configuration;
diff --git a/TESTS/usb_device/basic/USBTester.h b/TESTS/usb_device/basic/USBTester.h
index ac3554e83..01045501e 100644
--- a/TESTS/usb_device/basic/USBTester.h
+++ b/TESTS/usb_device/basic/USBTester.h
@@ -47,12 +47,30 @@ public:
const char *get_serial_desc_string();
const char *get_iproduct_desc_string();
const char *get_iinterface_desc_string();
- uint32_t get_reset_count() const { return reset_count; }
- uint32_t get_suspend_count() const { return suspend_count; }
- uint32_t get_resume_count() const { return resume_count; }
- void clear_reset_count() { reset_count = 0; }
- void clear_suspend_count() { suspend_count = 0; }
- void clear_resume_count() { resume_count = 0; }
+ uint32_t get_reset_count() const
+ {
+ return reset_count;
+ }
+ uint32_t get_suspend_count() const
+ {
+ return suspend_count;
+ }
+ uint32_t get_resume_count() const
+ {
+ return resume_count;
+ }
+ void clear_reset_count()
+ {
+ reset_count = 0;
+ }
+ void clear_suspend_count()
+ {
+ suspend_count = 0;
+ }
+ void clear_resume_count()
+ {
+ resume_count = 0;
+ }
private:
diff --git a/usb/device/USBAudio/USBAudio.cpp b/usb/device/USBAudio/USBAudio.cpp
index ad6800a72..1b323ece0 100644
--- a/usb/device/USBAudio/USBAudio.cpp
+++ b/usb/device/USBAudio/USBAudio.cpp
@@ -498,7 +498,7 @@ void USBAudio::callback_request_xfer_done(const setup_packet_t *setup, bool abor
}
if ((setup->wLength == 1) || (setup->wLength == 2)) {
- uint16_t data = (_control_receive[0] << 0) | (_control_receive[1] << 8);
+ uint16_t data = (_control_receive[0] << 0) | (_control_receive[1] << 8);
data &= ((setup->wLength == 1) ? 0xFF : 0xFFFF);
switch (setup->wValue >> 8) {
case MUTE_CONTROL:
@@ -516,7 +516,7 @@ void USBAudio::callback_request_xfer_done(const setup_packet_t *setup, bool abor
case REQUEST_SET_CUR:
_vol_cur = data;
_volume = (float)_vol_cur / (float)_vol_max;
- _update_vol.call();
+ _update_vol.call();
break;
default:
break;
diff --git a/usb/device/USBAudio/USBAudio.h b/usb/device/USBAudio/USBAudio.h
index 90b7cd00c..28e230a65 100644
--- a/usb/device/USBAudio/USBAudio.h
+++ b/usb/device/USBAudio/USBAudio.h
@@ -80,7 +80,7 @@ public:
* @param product_id Your product_id
* @param product_release Your product_release
*/
- USBAudio(bool connect=true, uint32_t frequency_rx = 48000, uint8_t channel_count_rx = 1, uint32_t frequency_tx = 8000, uint8_t channel_count_tx = 1, uint32_t buffer_ms=10, uint16_t vendor_id = 0x7bb8, uint16_t product_id = 0x1111, uint16_t product_release = 0x0100);
+ USBAudio(bool connect = true, uint32_t frequency_rx = 48000, uint8_t channel_count_rx = 1, uint32_t frequency_tx = 8000, uint8_t channel_count_tx = 1, uint32_t buffer_ms = 10, uint16_t vendor_id = 0x7bb8, uint16_t product_id = 0x1111, uint16_t product_release = 0x0100);
/**
* Fully featured constructor
@@ -153,7 +153,7 @@ public:
* @param clear Reset the overflow count back to 0
* @return Number of packets dropped due to overflow
*/
- uint32_t read_overflows(bool clear=false);
+ uint32_t read_overflows(bool clear = false);
/**
* Check if the audio read channel is open
@@ -196,7 +196,7 @@ public:
* @return Number of packets that should have been
* sent but weren't due to overflow
*/
- uint32_t write_underflows(bool clear=false);
+ uint32_t write_underflows(bool clear = false);
/**
* Check if the audio write channel is open
diff --git a/usb/device/USBDevice/EndpointResolver.cpp b/usb/device/USBDevice/EndpointResolver.cpp
index d9ae07af7..1492d7ec0 100644
--- a/usb/device/USBDevice/EndpointResolver.cpp
+++ b/usb/device/USBDevice/EndpointResolver.cpp
@@ -73,7 +73,8 @@ bool EndpointResolver::valid()
return _valid && (_cost <= _table->resources);
}
-void EndpointResolver::reset() {
+void EndpointResolver::reset()
+{
_cost = 0;
_used = 0;
_valid = true;
diff --git a/usb/device/USBDevice/USBDevice.cpp b/usb/device/USBDevice/USBDevice.cpp
index 2ec6b3ed8..19a0fcd3c 100644
--- a/usb/device/USBDevice/USBDevice.cpp
+++ b/usb/device/USBDevice/USBDevice.cpp
@@ -64,8 +64,7 @@ bool USBDevice::_request_get_descriptor()
printf("get descr: type: %d\r\n", DESCRIPTOR_TYPE(_transfer.setup.wValue));
#endif
switch (DESCRIPTOR_TYPE(_transfer.setup.wValue)) {
- case DEVICE_DESCRIPTOR:
- {
+ case DEVICE_DESCRIPTOR: {
if (device_desc() != NULL) {
if ((device_desc()[0] == DEVICE_DESCRIPTOR_LENGTH) \
&& (device_desc()[1] == DEVICE_DESCRIPTOR)) {
@@ -80,8 +79,7 @@ bool USBDevice::_request_get_descriptor()
}
break;
}
- case CONFIGURATION_DESCRIPTOR:
- {
+ case CONFIGURATION_DESCRIPTOR: {
const uint8_t idx = DESCRIPTOR_INDEX(_transfer.setup.wValue);
if (configuration_desc(idx) != NULL) {
if ((configuration_desc(idx)[0] == CONFIGURATION_DESCRIPTOR_LENGTH) \
@@ -91,7 +89,7 @@ bool USBDevice::_request_get_descriptor()
#endif
/* Get wTotalLength */
_transfer.remaining = configuration_desc(idx)[2] \
- | (configuration_desc(idx)[3] << 8);
+ | (configuration_desc(idx)[3] << 8);
_transfer.ptr = (uint8_t *)configuration_desc(idx);
_transfer.direction = Send;
@@ -100,8 +98,7 @@ bool USBDevice::_request_get_descriptor()
}
break;
}
- case STRING_DESCRIPTOR:
- {
+ case STRING_DESCRIPTOR: {
#ifdef DEBUG
printf("str descriptor\r\n");
#endif
@@ -163,23 +160,20 @@ bool USBDevice::_request_get_descriptor()
}
break;
}
- case INTERFACE_DESCRIPTOR:
- {
+ case INTERFACE_DESCRIPTOR: {
#ifdef DEBUG
printf("interface descr\r\n");
#endif
break;
}
- case ENDPOINT_DESCRIPTOR:
- {
+ case ENDPOINT_DESCRIPTOR: {
#ifdef DEBUG
printf("endpoint descr\r\n");
#endif
/* TODO: Support is optional, not implemented here */
break;
}
- default:
- {
+ default: {
#ifdef DEBUG
printf("ERROR\r\n");
#endif
@@ -1154,7 +1148,7 @@ void USBDevice::endpoint_stall(usb_ep_t endpoint)
_phy->endpoint_stall(endpoint);
if (info->pending) {
- endpoint_abort(endpoint);
+ endpoint_abort(endpoint);
}
unlock();
@@ -1589,7 +1583,8 @@ void USBDevice::assert_locked()
MBED_ASSERT(_locked > 0);
}
-void USBDevice::_change_state(DeviceState new_state) {
+void USBDevice::_change_state(DeviceState new_state)
+{
assert_locked();
DeviceState old_state = _device.state;
diff --git a/usb/device/USBDevice/USBDevice.h b/usb/device/USBDevice/USBDevice.h
index e8b7f5c69..0cd438f31 100644
--- a/usb/device/USBDevice/USBDevice.h
+++ b/usb/device/USBDevice/USBDevice.h
@@ -403,7 +403,7 @@ protected:
* @param data Buffer to send or receive if the result is Send or Receive
* @param size Size to transfer if the result is Send or Receive
*/
- void complete_request(RequestResult result, uint8_t *data=NULL, uint32_t size=0);
+ void complete_request(RequestResult result, uint8_t *data = NULL, uint32_t size = 0);
/**
* Called by USBDevice on data stage completion
diff --git a/usb/device/USBHID/USBMouseKeyboard.h b/usb/device/USBHID/USBMouseKeyboard.h
index d8b9d39c5..84ce5673f 100644
--- a/usb/device/USBHID/USBMouseKeyboard.h
+++ b/usb/device/USBHID/USBMouseKeyboard.h
@@ -68,8 +68,7 @@
*
* @note Synchronization level: Thread safe
*/
-class USBMouseKeyboard: public USBHID, public mbed::Stream
-{
+class USBMouseKeyboard: public USBHID, public mbed::Stream {
public:
/**
@@ -86,7 +85,7 @@ public:
* @param product_release Your preoduct_release (default: 0x0001)
*
*/
- USBMouseKeyboard(bool connect_blocking=true, MOUSE_TYPE mouse_type=REL_MOUSE, uint16_t vendor_id=0x0021, uint16_t product_id=0x0011, uint16_t product_release=0x0001);
+ USBMouseKeyboard(bool connect_blocking = true, MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x0021, uint16_t product_id = 0x0011, uint16_t product_release = 0x0001);
/**
* Fully featured constructor
@@ -106,7 +105,7 @@ public:
* @param product_release Your preoduct_release (default: 0x0001)
*
*/
- USBMouseKeyboard(USBPhy *phy, MOUSE_TYPE mouse_type=REL_MOUSE, uint16_t vendor_id=0x0021, uint16_t product_id=0x0011, uint16_t product_release=0x0001);
+ USBMouseKeyboard(USBPhy *phy, MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x0021, uint16_t product_id = 0x0011, uint16_t product_release = 0x0001);
/**
* Destroy this object
@@ -221,7 +220,7 @@ public:
*
* @returns pointer to the report descriptor
*/
- virtual const uint8_t * report_desc();
+ virtual const uint8_t *report_desc();
/*
* Called when a data is received on the OUT endpoint. Useful to switch on LED of LOCK keys
diff --git a/usb/device/USBMSD/USBMSD.cpp b/usb/device/USBMSD/USBMSD.cpp
index 6961c8e0c..750cadf8a 100644
--- a/usb/device/USBMSD/USBMSD.cpp
+++ b/usb/device/USBMSD/USBMSD.cpp
@@ -212,14 +212,14 @@ void USBMSD::attach(mbed::Callback<void()> cb)
unlock();
}
-int USBMSD::disk_read(uint8_t* data, uint64_t block, uint8_t count)
+int USBMSD::disk_read(uint8_t *data, uint64_t block, uint8_t count)
{
bd_addr_t addr = block * _bd->get_erase_size();
bd_size_t size = count * _bd->get_erase_size();
return _bd->read(data, addr, size);
}
-int USBMSD::disk_write(const uint8_t* data, uint64_t block, uint8_t count)
+int USBMSD::disk_write(const uint8_t *data, uint64_t block, uint8_t count)
{
bd_addr_t addr = block * _bd->get_erase_size();
bd_size_t size = count * _bd->get_erase_size();
@@ -434,7 +434,7 @@ void USBMSD::_control(const setup_packet_t *setup)
break;
case MSC_REQUEST_GET_MAX_LUN:
result = Send;
- data = (uint8_t*)maxLUN;
+ data = (uint8_t *)maxLUN;
size = 1;
break;
default:
diff --git a/usb/device/USBMSD/USBMSD.h b/usb/device/USBMSD/USBMSD.h
index db733698d..5e96f31e3 100644
--- a/usb/device/USBMSD/USBMSD.h
+++ b/usb/device/USBMSD/USBMSD.h
@@ -181,7 +181,8 @@ private:
};
// Bulk-only CBW
- typedef MBED_PACKED(struct) {
+ typedef MBED_PACKED(struct)
+ {
uint32_t Signature;
uint32_t Tag;
uint32_t DataLength;
@@ -192,7 +193,8 @@ private:
} CBW;
// Bulk-only CSW
- typedef MBED_PACKED(struct) {
+ typedef MBED_PACKED(struct)
+ {
uint32_t Signature;
uint32_t Tag;
uint32_t DataResidue;
diff --git a/usb/device/USBSerial/USBSerial.h b/usb/device/USBSerial/USBSerial.h
index d393a297c..d7dbfb4a7 100644
--- a/usb/device/USBSerial/USBSerial.h
+++ b/usb/device/USBSerial/USBSerial.h
@@ -57,7 +57,7 @@ public:
* @param product_release Your product_release (default: 0x0001)
*
*/
- USBSerial(bool connect_blocking=true, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001);
+ USBSerial(bool connect_blocking = true, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
/**
* Fully featured constructor
@@ -76,7 +76,7 @@ public:
* @param product_release Your product_release (default: 0x0001)
*
*/
- USBSerial(USBPhy *phy, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001);
+ USBSerial(USBPhy *phy, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
/**
* Destroy this object
PATCH |
CI started |
Test run: SUCCESSSummary: 12 of 12 test jobs passed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Remove mbed.h from USB files and fix the build errors this causes. This is required to pass CI.
Pull request type