You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/04/30 13:53:31 UTC
[GitHub] [mynewt-core] kasjer opened a new pull request #2279: [RFC] TinyUSB integration
kasjer opened a new pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279
## TinyUSB integration ##
TinyUSB is know for a while to have support for mynewt.
This work makes it easier to use it with mynewt base projects.
This work includes:
- USB task creation
- mynewt glue to CDC
- mynewt glue to HID
- hardware initialization code that could not be used as is from TinyUSB repository (BSP code duplicates in both repositories)
- Console over USB that can be used instead of UART or RTT
## Before this can be merge ##
**newt** tool needs to support **pkg.include_dirs** keyword that is introduced in by this PR https://github.com/apache/mynewt-newt/pull/397
Once this is approved pull request to TinyUSB repository will be made to change to **pkg.yml** to use this new keyword.
Without this it is possible to use TinyUSB but a lot of packages would need
```yml
pkg.cflags:
- "-I@tinyusb/src"
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] rymanluk commented on a change in pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
rymanluk commented on a change in pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#discussion_r422111600
##########
File path: hw/usb/tinyusb/README.md
##########
@@ -0,0 +1,48 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+
+To use tinyusb add following lines to **project.yml**.
+
+```yaml
+repository.tinyusb:
+ type: github
+ vers: 0.0.0
+ user: hathach
+ repo: tinyusb
+```
+
+This dependency will start USB stack task.
+```yaml
+pkg.deps:
+ - "@apache-mynewt-core/hw/usb/tinyusb"
+```
+
+To easy add support for CDC or HID class device simply add
+**hw/usb/tinyusb/std_descriptors** package to project
+```yaml
+pkg.deps:
+ - "@apache-mynewt-core/hw/usb/tinyusb/std_descriptors"
+```
+
+To use console over USB, set syscfg value
+```yaml
+ CONSOLE_USB: 1
Review comment:
We need also USBD_CDC to be set as it is not done automatically.
Need to figure out how to do it automatically.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-621873550
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/cdc_console/src/cdc_console.c
<details>
```diff
@@ -41,8 +41,9 @@
written = tud_cdc_write_char(c);
if (tud_cdc_write_available() == 0) {
tud_cdc_write_flush();
- if (written == 0)
+ if (written == 0) {
tud_cdc_write_char(c);
+ }
}
}
```
</details>
#### hw/usb/tinyusb/std_descriptors/include/tusb_config.h
<details>
```diff
@@ -37,7 +37,7 @@
#include <tusb_hw.h>
-// defined by compiler flags for flexibility
+/* defined by compiler flags for flexibility */
#ifndef CFG_TUSB_MCU
#error CFG_TUSB_MCU must be defined
#endif
```
</details>
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -48,10 +48,10 @@
#if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD) || MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
const uint8_t desc_hid_report[] = {
#if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD)
- TUD_HID_REPORT_DESC_KEYBOARD( MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD), ),
+ TUD_HID_REPORT_DESC_KEYBOARD(MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD), ),
#endif
#if MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
- TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(REPORT_ID_MOUSE), )
+ TUD_HID_REPORT_DESC_MOUSE (HID_REPORT_ID(REPORT_ID_MOUSE), )
#endif
};
#else
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
@@ -146,12 +146,14 @@
const uint8_t *
tud_descriptor_device_cb(void)
{
- return (const uint8_t *)&desc_device;
-}
-
-//--------------------------------------------------------------------+
-// Configuration Descriptor
-//--------------------------------------------------------------------+
+ return (const uint8_t *)&desc_device;
+}
+
+/*
+ --------------------------------------------------------------------+
+ Configuration Descriptor
+ --------------------------------------------------------------------+
+ */
enum {
#if CFG_TUD_CDC
@@ -209,8 +211,7 @@
return desc_configuration;
}
-const char *string_desc_arr[] =
-{
+const char *string_desc_arr[] = {
MYNEWT_VAL(USBD_VENDOR_STRING),
MYNEWT_VAL(USBD_PRODUCT_STRING),
MYNEWT_VAL(USBD_CDC_DECRIPTOR_STRING),
@@ -224,7 +225,8 @@
* Invoked when received GET STRING DESCRIPTOR request
* Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
*/
-const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid)
+const uint16_t *
+tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
int char_num = 0;
int i;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-621873550
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/cdc_console/src/cdc_console.c
<details>
```diff
@@ -41,8 +41,9 @@
written = tud_cdc_write_char(c);
if (tud_cdc_write_available() == 0) {
tud_cdc_write_flush();
- if (written == 0)
+ if (written == 0) {
tud_cdc_write_char(c);
+ }
}
}
```
</details>
#### hw/usb/tinyusb/std_descriptors/include/tusb_config.h
<details>
```diff
@@ -37,7 +37,7 @@
#include <tusb_hw.h>
-// defined by compiler flags for flexibility
+/* defined by compiler flags for flexibility */
#ifndef CFG_TUSB_MCU
#error CFG_TUSB_MCU must be defined
#endif
```
</details>
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -48,10 +48,10 @@
#if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD) || MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
const uint8_t desc_hid_report[] = {
#if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD)
- TUD_HID_REPORT_DESC_KEYBOARD( MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD), ),
+ TUD_HID_REPORT_DESC_KEYBOARD(MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD), ),
#endif
#if MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
- TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(REPORT_ID_MOUSE), )
+ TUD_HID_REPORT_DESC_MOUSE (HID_REPORT_ID(REPORT_ID_MOUSE), )
#endif
};
#else
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
@@ -146,12 +146,14 @@
const uint8_t *
tud_descriptor_device_cb(void)
{
- return (const uint8_t *)&desc_device;
-}
-
-//--------------------------------------------------------------------+
-// Configuration Descriptor
-//--------------------------------------------------------------------+
+ return (const uint8_t *)&desc_device;
+}
+
+/*
+ --------------------------------------------------------------------+
+ Configuration Descriptor
+ --------------------------------------------------------------------+
+ */
enum {
#if CFG_TUD_CDC
@@ -209,8 +211,7 @@
return desc_configuration;
}
-const char *string_desc_arr[] =
-{
+const char *string_desc_arr[] = {
MYNEWT_VAL(USBD_VENDOR_STRING),
MYNEWT_VAL(USBD_PRODUCT_STRING),
MYNEWT_VAL(USBD_CDC_DECRIPTOR_STRING),
@@ -224,7 +225,8 @@
* Invoked when received GET STRING DESCRIPTOR request
* Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
*/
-const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid)
+const uint16_t *
+tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
int char_num = 0;
int i;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2279: TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-630057534
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2279: TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-630051957
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-622291082
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] kasjer merged pull request #2279: TinyUSB integration
Posted by GitBox <gi...@apache.org>.
kasjer merged pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] mlaz commented on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
mlaz commented on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-625953069
I just tested with stm32f411 and slinky works perfectly. With nrf52840 I am getting the CDC tty device but no console.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-622305808
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] mlaz edited a comment on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
mlaz edited a comment on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-625953069
I just tested with stm32f411 and slinky works perfectly. With nrf52840 I am getting the CDC tty device but no console.
Update: The board I was using is an early version of pca10056 (nrf52840pdk), apparently its mcu is affected by [this anomaly](https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52840_Rev2%2FERR%2FnRF52840%2FRev2%2Flatest%2Ferr_840.html). Tested it on a recently bought Particle Boron board and it works perfectly!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2279: TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-627318407
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] sjanc commented on a change in pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#discussion_r422980753
##########
File path: hw/usb/tinyusb/std_descriptors/include/tusb_config.h
##########
@@ -0,0 +1,91 @@
+/*
+ * The MIT License (MIT)
Review comment:
this requires notice in LICENSE file
This product bundles part of tinyusb which is available under the MIT license. Bundled files are:
* hw/usb/tinyusb/std_descriptors/include/tusb_config.h
list all non-APL licensed files here
##########
File path: hw/usb/tinyusb/cdc_console/src/cdc_console.c
##########
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <os/mynewt.h>
+
+#include <class/cdc/cdc_device.h>
+
+#include <console/console.h>
+#include <bsp/bsp.h>
+
+static struct os_event rx_receive_event;
+static struct os_event tx_flush_event;
+
+static void
+cdc_schedule_tx_flush(void)
+{
+ os_eventq_put(os_eventq_dflt_get(), &tx_flush_event);
+}
+
+static void
+cdc_write(int c)
+{
+ uint32_t written;
+
+ written = tud_cdc_write_char(c);
+ if (tud_cdc_write_available() == 0) {
+ tud_cdc_write_flush();
+ if (written == 0) {
+ tud_cdc_write_char(c);
+ }
+ }
+}
+
+int
+console_out_nolock(int c)
+{
+ cdc_write(c);
+
+ if ('\n' == c) {
+ cdc_write('\r');
+ }
+
+ cdc_schedule_tx_flush();
+
+ return c;
+}
+
+void
+console_rx_restart(void)
+{
+ os_eventq_put(os_eventq_dflt_get(), &rx_receive_event);
+}
+
+bool connected;
Review comment:
nitpick: could be static and usually those are declared on top
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2279: TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-630051957
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-622291082
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
<details>
```diff
@@ -108,33 +108,33 @@
#endif /* CFG_TUD_HID */
const tusb_desc_device_t desc_device = {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
+ .bLength = sizeof(tusb_desc_device_t),
+ .bDescriptorType = TUSB_DESC_DEVICE,
+ .bcdUSB = 0x0200,
#if CFG_TUD_CDC
/*
* Use Interface Association Descriptor (IAD) for CDC
* As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
*/
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
#else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
-#endif
-
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
-
- .idVendor = MYNEWT_VAL(USBD_VID),
- .idProduct = MYNEWT_VAL(USBD_PID),
- .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
-
- .iManufacturer = 0x02,
- .iProduct = 0x03,
- .iSerialNumber = 0x01,
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+#endif
+
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
+
+ .idVendor = MYNEWT_VAL(USBD_VID),
+ .idProduct = MYNEWT_VAL(USBD_PID),
+ .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
+
+ .iManufacturer = 0x02,
+ .iProduct = 0x03,
+ .iSerialNumber = 0x01,
.bNumConfigurations = 0x01
};
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-core] mlaz edited a comment on pull request #2279: [RFC] TinyUSB integration
Posted by GitBox <gi...@apache.org>.
mlaz edited a comment on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-625953069
I just tested with stm32f411 and slinky works perfectly. With nrf52840 I am getting the CDC tty device but no console.
Update: The board I was using is an early version of pca10056 (nrf52840pdk), it's mcu is affected by [this anomaly](https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52840_Rev2%2FERR%2FnRF52840%2FRev2%2Flatest%2Ferr_840.html). Tested it on a recently bought Particle Boron board and it works perfectly!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org