Skip to content
Permalink
Browse files

drivers: usb_dc_nrfx: cleanup USB_NRFX_EVT_QUEUE_SIZE

Cleanup around USB_NRFX_EVT_QUEUE_SIZE option.
Add value range for USB_NRFX_EVT_QUEUE_SIZE to Kconfig.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
  • Loading branch information...
jfischer-phytec-iot authored and nashif committed Jul 3, 2019
1 parent 226a429 commit 6904a86835f91d897ef8e94b2da2e26eeffd992c
Showing with 5 additions and 5 deletions.
  1. +1 −0 drivers/usb/device/Kconfig
  2. +4 −5 drivers/usb/device/usb_dc_nrfx.c
@@ -69,6 +69,7 @@ menuconfig USB_NRF52840

config USB_NRFX_EVT_QUEUE_SIZE
int "USBD event queue size"
range 4 64
default 32
depends on USB_NRF52840
help
@@ -177,16 +177,15 @@ struct usbd_event {
*/
#define FIFO_ELEM_MIN_SZ sizeof(struct usbd_event)
#define FIFO_ELEM_MAX_SZ sizeof(struct usbd_event)
#define FIFO_ELEM_COUNT CONFIG_USB_NRFX_EVT_QUEUE_SIZE
#define FIFO_ELEM_ALIGN sizeof(unsigned int)

K_MEM_POOL_DEFINE(fifo_elem_pool, FIFO_ELEM_MIN_SZ, FIFO_ELEM_MAX_SZ,
FIFO_ELEM_COUNT, FIFO_ELEM_ALIGN);

#if CONFIG_USB_NRFX_EVT_QUEUE_SIZE < 4
#error Invalid USBD event queue size (CONFIG_USB_NRFX_EVT_QUEUE_SIZE). Minimum size: 4.
#error Invalid USBD event queue size (CONFIG_USB_NRFX_EVT_QUEUE_SIZE).
#endif

K_MEM_POOL_DEFINE(fifo_elem_pool, FIFO_ELEM_MIN_SZ, FIFO_ELEM_MAX_SZ,
CONFIG_USB_NRFX_EVT_QUEUE_SIZE, FIFO_ELEM_ALIGN);

/**
* @brief Endpoint buffer pool
* Used for allocating buffers for the endpoints' data transfer

0 comments on commit 6904a86

Please sign in to comment.
You can’t perform that action at this time.