From 11fba59319d81fb9502fbf399abb4fe27cf3fa29 Mon Sep 17 00:00:00 2001 From: Dave Nadler Date: Wed, 28 Jun 2023 17:25:22 -0400 Subject: [PATCH] Name queues for easier FreeRTOS debugging with task- and queue-aware debuggers --- src/device/usbd.c | 4 ++-- src/host/usbh.c | 4 ++-- src/osal/osal_freertos.h | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/device/usbd.c b/src/device/usbd.c index 44c2530ce..b6c679b22 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -279,7 +279,7 @@ tu_static uint8_t _usbd_rhport = RHPORT_INVALID; // Event queue // usbd_int_set() is used as mutex in OS NONE config -OSAL_QUEUE_DEF(usbd_int_set, _usbd_qdef, CFG_TUD_TASK_QUEUE_SZ, dcd_event_t); +OSAL_QUEUE_DEF(usbd_int_set, usbd_events, CFG_TUD_TASK_QUEUE_SZ, dcd_event_t); tu_static osal_queue_t _usbd_q; // Mutex for claiming endpoint @@ -410,7 +410,7 @@ bool tud_init (uint8_t rhport) #endif // Init device queue & task - _usbd_q = osal_queue_create(&_usbd_qdef); + _usbd_q = osal_queue_create(&usbd_events); TU_ASSERT(_usbd_q); // Get application driver if available diff --git a/src/host/usbh.c b/src/host/usbh.c index f3e9d3858..987ff7a6e 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -219,7 +219,7 @@ static usbh_device_t _usbh_devices[TOTAL_DEVICES]; // Event queue // usbh_int_set is used as mutex in OS NONE config -OSAL_QUEUE_DEF(usbh_int_set, _usbh_qdef, CFG_TUH_TASK_QUEUE_SZ, hcd_event_t); +OSAL_QUEUE_DEF(usbh_int_set, usbh_events, CFG_TUH_TASK_QUEUE_SZ, hcd_event_t); static osal_queue_t _usbh_q; CFG_TUH_MEM_SECTION CFG_TUH_MEM_ALIGN @@ -330,7 +330,7 @@ bool tuh_init(uint8_t controller_id) TU_LOG_INT(USBH_DEBUG, sizeof(tu_edpt_stream_t)); // Event queue - _usbh_q = osal_queue_create( &_usbh_qdef ); + _usbh_q = osal_queue_create( &usbh_events ); TU_ASSERT(_usbh_q != NULL); #if OSAL_MUTEX_REQUIRED diff --git a/src/osal/osal_freertos.h b/src/osal/osal_freertos.h index 0b1b11589..e83277eb3 100644 --- a/src/osal/osal_freertos.h +++ b/src/osal/osal_freertos.h @@ -56,7 +56,7 @@ typedef SemaphoreHandle_t osal_mutex_t; // _int_set is not used with an RTOS #define OSAL_QUEUE_DEF(_int_set, _name, _depth, _type) \ static _type _name##_##buf[_depth];\ - osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf }; + osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf, .pQueueName = #_name }; typedef struct { @@ -66,6 +66,7 @@ typedef struct #if configSUPPORT_STATIC_ALLOCATION StaticQueue_t sq; #endif + const char* pQueueName; }osal_queue_def_t; typedef QueueHandle_t osal_queue_t; @@ -176,7 +177,7 @@ TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_de q = xQueueCreate(qdef->depth, qdef->item_sz); #endif #if defined(configQUEUE_REGISTRY_SIZE) && (configQUEUE_REGISTRY_SIZE>0) - vQueueAddToRegistry(q, "tinyUSB"); + vQueueAddToRegistry(q, qdef->pQueueName); #endif return q; }