mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 01:20:19 +00:00
Merge pull request #469 from hathach/followup-pr466-pr468
Followup pr466 pr468
This commit is contained in:
commit
7d2fc12445
@ -170,7 +170,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -180,6 +181,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -187,7 +187,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -197,6 +198,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -186,7 +186,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -196,6 +197,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -139,7 +139,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -151,6 +152,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 31;
|
chr_count = 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -218,7 +218,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -228,6 +229,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -146,7 +146,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -146,7 +146,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -144,7 +144,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -154,6 +155,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -152,7 +152,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -162,6 +163,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -160,7 +160,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -170,6 +171,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -200,7 +200,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -210,6 +211,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
|
if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for (unsigned int i=0; i<chr_count; i++)
|
for (unsigned int i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -166,7 +166,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -178,6 +179,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 31;
|
chr_count = 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -216,7 +216,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||||
|
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||||
|
|
||||||
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;
|
||||||
|
|
||||||
@ -226,6 +227,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > 31 ) chr_count = 31;
|
if ( chr_count > 31 ) chr_count = 31;
|
||||||
|
|
||||||
|
// Convert ASCII string into UTF-16
|
||||||
for(uint8_t i=0; i<chr_count; i++)
|
for(uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "tusb_option.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -59,19 +58,23 @@ static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semde
|
|||||||
|
|
||||||
static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr)
|
static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr)
|
||||||
{
|
{
|
||||||
if(!in_isr){
|
if ( !in_isr )
|
||||||
|
{
|
||||||
return xSemaphoreGive(sem_hdl) != 0;
|
return xSemaphoreGive(sem_hdl) != 0;
|
||||||
}
|
}
|
||||||
BaseType_t xHigherPriorityTaskWoken;
|
else
|
||||||
BaseType_t res = xSemaphoreGiveFromISR(sem_hdl, &xHigherPriorityTaskWoken);
|
{
|
||||||
|
BaseType_t xHigherPriorityTaskWoken;
|
||||||
|
BaseType_t res = xSemaphoreGiveFromISR(sem_hdl, &xHigherPriorityTaskWoken);
|
||||||
|
|
||||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||||
if (xHigherPriorityTaskWoken) {
|
if ( xHigherPriorityTaskWoken ) portYIELD_FROM_ISR();
|
||||||
portYIELD_FROM_ISR();
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
#endif
|
#endif
|
||||||
return res != 0;
|
|
||||||
|
return res != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec)
|
static inline bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec)
|
||||||
@ -138,19 +141,23 @@ static inline bool osal_queue_receive(osal_queue_t qhdl, void* data)
|
|||||||
|
|
||||||
static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr)
|
static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr)
|
||||||
{
|
{
|
||||||
if(!in_isr){
|
if ( !in_isr )
|
||||||
|
{
|
||||||
return xQueueSendToBack(qhdl, data, OSAL_TIMEOUT_WAIT_FOREVER) != 0;
|
return xQueueSendToBack(qhdl, data, OSAL_TIMEOUT_WAIT_FOREVER) != 0;
|
||||||
}
|
}
|
||||||
BaseType_t xHigherPriorityTaskWoken;
|
else
|
||||||
BaseType_t res = xQueueSendToBackFromISR(qhdl, data, &xHigherPriorityTaskWoken);
|
{
|
||||||
|
BaseType_t xHigherPriorityTaskWoken;
|
||||||
|
BaseType_t res = xQueueSendToBackFromISR(qhdl, data, &xHigherPriorityTaskWoken);
|
||||||
|
|
||||||
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
#if CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||||
if (xHigherPriorityTaskWoken) {
|
if ( xHigherPriorityTaskWoken ) portYIELD_FROM_ISR();
|
||||||
portYIELD_FROM_ISR();
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
#endif
|
#endif
|
||||||
return res != 0;
|
|
||||||
|
return res != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool osal_queue_empty(osal_queue_t qhdl)
|
static inline bool osal_queue_empty(osal_queue_t qhdl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user