zephyr/subsys/usb/usb_work_q.h
Peter Bigot 611263921a usb: add optional work queue
The USB infrastructure currently uses the system work queue for
offloading transfers, CDC-ACM UART transmission/reception, and device
firmware activities.  This causes problems when the system work queue
is also used to initiate some activities (such as UART) that normally
complete without requiring an external thread: in that case the USB
infrastructure is prevented from making progress because the system
work queue is blocked waiting for the USB infrastructure to provide
data.

Break the dependency by allowing the USB infrastructure to use a
dedicated work queue which doesn't depend on availability of the
system work queue.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-16 13:32:22 -05:00

30 lines
425 B
C

/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_USB_WORK_Q_H_
#define ZEPHYR_USB_WORK_Q_H_
#include <kernel.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef CONFIG_USB_WORKQUEUE
extern struct k_work_q z_usb_work_q;
#define USB_WORK_Q z_usb_work_q
#else
#define USB_WORK_Q k_sys_work_q
#endif
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_USB_WORK_Q_H_ */