drivers: usb_dc_nrfx: use REQTYPE_GET_DIR and REQTYPE_GET_TYPE macros
Use REQTYPE_GET_DIR and REQTYPE_GET_TYPE macros from USB subsystem instead of specially introduced. Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
parent
a1d815ea9b
commit
04b91579ae
1 changed files with 5 additions and 16 deletions
|
@ -29,17 +29,6 @@
|
||||||
#include <logging/log.h>
|
#include <logging/log.h>
|
||||||
LOG_MODULE_REGISTER(usb_nrfx);
|
LOG_MODULE_REGISTER(usb_nrfx);
|
||||||
|
|
||||||
#define USB_BREQUEST_SETADDRESS 0x05
|
|
||||||
#define USB_BMREQUESTTYPE_DIR_POS 7uL
|
|
||||||
#define USB_BMREQUESTTYPE_DIR_MASK (1uL << USB_BMREQUESTTYPE_DIR_POS)
|
|
||||||
#define USB_BMREQUESTTYPE_DIR_HOSTTODEVICE_MASK 0uL
|
|
||||||
#define USB_BMREQUESTTYPE_DIR_DEVICETOHOST_MASK (1uL << USB_BMREQUESTTYPE_DIR_POS)
|
|
||||||
#define USB_BMREQUESTTYPE_TYPE_POS 5uL
|
|
||||||
#define USB_BMREQUESTTYPE_TYPE_MASK (3uL << USB_BMREQUESTTYPE_TYPE_POS)
|
|
||||||
#define USB_BMREQUESTTYPE_TYPE_STANDARD_MASK 0uL
|
|
||||||
#define USB_BMREQUESTTYPE_TYPE_CLASS_MASK (1uL << USB_BMREQUESTTYPE_TYPE_POS)
|
|
||||||
#define USB_BMREQUESTTYPE_TYPE_CLASS_VENDOR (2uL << USB_BMREQUESTTYPE_TYPE_POS)
|
|
||||||
|
|
||||||
#define MAX_EP_BUF_SZ 64UL
|
#define MAX_EP_BUF_SZ 64UL
|
||||||
#define MAX_ISO_EP_BUF_SZ 1024UL
|
#define MAX_ISO_EP_BUF_SZ 1024UL
|
||||||
|
|
||||||
|
@ -852,8 +841,8 @@ static inline void usbd_work_process_setup(struct nrf_usbd_ep_ctx *ep_ctx)
|
||||||
|
|
||||||
struct nrf_usbd_ctx *ctx = get_usbd_ctx();
|
struct nrf_usbd_ctx *ctx = get_usbd_ctx();
|
||||||
|
|
||||||
if (((usbd_setup->bmRequestType & USB_BMREQUESTTYPE_DIR_MASK)
|
if ((REQTYPE_GET_DIR(usbd_setup->bmRequestType)
|
||||||
== USB_BMREQUESTTYPE_DIR_HOSTTODEVICE_MASK)
|
== REQTYPE_DIR_TO_DEVICE)
|
||||||
&& (usbd_setup->wLength)) {
|
&& (usbd_setup->wLength)) {
|
||||||
struct nrf_usbd_ctx *ctx = get_usbd_ctx();
|
struct nrf_usbd_ctx *ctx = get_usbd_ctx();
|
||||||
|
|
||||||
|
@ -1175,9 +1164,9 @@ static void usbd_event_handler(nrfx_usbd_evt_t const *const p_event)
|
||||||
nrfx_usbd_setup_t drv_setup;
|
nrfx_usbd_setup_t drv_setup;
|
||||||
|
|
||||||
nrfx_usbd_setup_get(&drv_setup);
|
nrfx_usbd_setup_get(&drv_setup);
|
||||||
if ((drv_setup.bRequest != USB_BREQUEST_SETADDRESS)
|
if ((drv_setup.bRequest != REQ_SET_ADDRESS)
|
||||||
|| ((drv_setup.bmRequestType & USB_BMREQUESTTYPE_TYPE_MASK)
|
|| (REQTYPE_GET_TYPE(drv_setup.bmRequestType)
|
||||||
!= USB_BMREQUESTTYPE_TYPE_STANDARD_MASK)) {
|
!= REQTYPE_TYPE_STANDARD)) {
|
||||||
/* SetAddress is habdled by USBD hardware.
|
/* SetAddress is habdled by USBD hardware.
|
||||||
* No software action required.
|
* No software action required.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue