Skip to content
Permalink
Browse files

drivers: usb_dc_nrfx: do not use NRF_USBD_EP_NR_GET in ep_is_valid

Do not use NRF_USBD_EP_NR_GET in ep_is_valid because
it masks the higher nibble. Although this behavior is valid
to get an index from an endpoint, it is not suitable to check
if the address is incorrect, such as: 0x11.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
  • Loading branch information...
jfischer-phytec-iot authored and ioannisg committed Jul 1, 2019
1 parent ab8bcd2 commit 38cc23a7d975711d439f98df5ea81cdc17bd3c49
Showing with 3 additions and 3 deletions.
  1. +3 −3 drivers/usb/device/usb_dc_nrfx.c
@@ -310,10 +310,10 @@ static inline uint8_t nrfx_addr_to_ep(nrfx_usbd_ep_t ep)

static inline bool ep_is_valid(const u8_t ep)
{
u8_t ep_num = NRF_USBD_EP_NR_GET(ep);
u8_t ep_num = ep & ~USB_EP_DIR_MASK;

if (NRF_USBD_EPIN_CHECK(ep)) {
if (unlikely(NRF_USBD_EPISO_CHECK(ep))) {
if (unlikely(ep_num == NRF_USBD_EPISO_FIRST)) {
if (CFG_EP_ISOIN_CNT == 0) {
return false;
}
@@ -323,7 +323,7 @@ static inline bool ep_is_valid(const u8_t ep)
}
}
} else {
if (unlikely(NRF_USBD_EPISO_CHECK(ep))) {
if (unlikely(ep_num == NRF_USBD_EPISO_FIRST)) {
if (CFG_EP_ISOOUT_CNT == 0) {
return false;
}

0 comments on commit 38cc23a

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