nrfx 2.5
Macros | Enumerations | Functions
USBD HAL

Hardware access layer for managing the Universal Serial Bus Device (USBD) peripheral. More...

Macros

#define NRF_USBD_FRAMECNTR_SIZE   ( (USBD_FRAMECNTR_FRAMECNTR_Msk >> USBD_FRAMECNTR_FRAMECNTR_Pos) + 1UL )
 Frame counter size. More...
 
#define NRF_USBD_EPISO_FIRST   8
 First isochronous endpoint number. More...
 
#define NRF_USBD_EPIN_CNT   9
 Total number of IN endpoints. More...
 
#define NRF_USBD_EPOUT_CNT   9
 Total number of OUT endpoints. More...
 
#define NRF_USBD_EP_DIR_Msk   (1U << 7)
 Mask of the direction bit in an endpoint number.
 
#define NRF_USBD_EP_DIR_IN   (1U << 7)
 The value of direction bit for the IN endpoint direction.
 
#define NRF_USBD_EP_DIR_OUT   (0U << 7)
 The value of direction bit for the OUT endpoint direction.
 
#define NRF_USBD_EPIN(epnr)   (((uint8_t)(epnr)) | NRF_USBD_EP_DIR_IN)
 Macro for making the IN endpoint identifier from endpoint number. More...
 
#define NRF_USBD_EPOUT(epnr)   (((uint8_t)(epnr)) | NRF_USBD_EP_DIR_OUT)
 Macro for making the OUT endpoint identifier from endpoint number. More...
 
#define NRF_USBD_EP_NR_GET(ep)   ((uint8_t)(((uint8_t)(ep)) & 0xFU))
 Macro for extracting the endpoint number from the specified endpoint identifier. More...
 
#define NRF_USBD_EPIN_CHECK(ep)   ( (((uint8_t)(ep)) & NRF_USBD_EP_DIR_Msk) == NRF_USBD_EP_DIR_IN )
 Macro for checking the endpoint direction. More...
 
#define NRF_USBD_EPOUT_CHECK(ep)   ( (((uint8_t)(ep)) & NRF_USBD_EP_DIR_Msk) == NRF_USBD_EP_DIR_OUT )
 Macro for checking endpoint direction. More...
 
#define NRF_USBD_EPISO_CHECK(ep)   (NRF_USBD_EP_NR_GET(ep) >= NRF_USBD_EPISO_FIRST)
 Macro for checking if endpoint is isochronous. More...
 
#define NRF_USBD_EP_VALIDATE(ep)
 Macro for checking if given number is valid endpoint number. More...
 
#define NRF_USBD_EPISOOUT_NO_DATA   ((size_t)(-1))
 Not isochronous data frame received. More...
 

Enumerations

enum  nrf_usbd_task_t {
  NRF_USBD_TASK_STARTEPIN0 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[0] ),
  NRF_USBD_TASK_STARTEPIN1 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[1] ),
  NRF_USBD_TASK_STARTEPIN2 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[2] ),
  NRF_USBD_TASK_STARTEPIN3 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[3] ),
  NRF_USBD_TASK_STARTEPIN4 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[4] ),
  NRF_USBD_TASK_STARTEPIN5 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[5] ),
  NRF_USBD_TASK_STARTEPIN6 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[6] ),
  NRF_USBD_TASK_STARTEPIN7 = offsetof(NRF_USBD_Type, TASKS_STARTEPIN[7] ),
  NRF_USBD_TASK_STARTISOIN = offsetof(NRF_USBD_Type, TASKS_STARTISOIN ),
  NRF_USBD_TASK_STARTEPOUT0 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[0]),
  NRF_USBD_TASK_STARTEPOUT1 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[1]),
  NRF_USBD_TASK_STARTEPOUT2 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[2]),
  NRF_USBD_TASK_STARTEPOUT3 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[3]),
  NRF_USBD_TASK_STARTEPOUT4 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[4]),
  NRF_USBD_TASK_STARTEPOUT5 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[5]),
  NRF_USBD_TASK_STARTEPOUT6 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[6]),
  NRF_USBD_TASK_STARTEPOUT7 = offsetof(NRF_USBD_Type, TASKS_STARTEPOUT[7]),
  NRF_USBD_TASK_STARTISOOUT = offsetof(NRF_USBD_Type, TASKS_STARTISOOUT ),
  NRF_USBD_TASK_EP0RCVOUT = offsetof(NRF_USBD_Type, TASKS_EP0RCVOUT ),
  NRF_USBD_TASK_EP0STATUS = offsetof(NRF_USBD_Type, TASKS_EP0STATUS ),
  NRF_USBD_TASK_EP0STALL = offsetof(NRF_USBD_Type, TASKS_EP0STALL ),
  NRF_USBD_TASK_DRIVEDPDM = offsetof(NRF_USBD_Type, TASKS_DPDMDRIVE ),
  NRF_USBD_TASK_NODRIVEDPDM = offsetof(NRF_USBD_Type, TASKS_DPDMNODRIVE )
}
 USBD tasks. More...
 
enum  nrf_usbd_event_t {
  NRF_USBD_EVENT_USBRESET = offsetof(NRF_USBD_Type, EVENTS_USBRESET ),
  NRF_USBD_EVENT_STARTED = offsetof(NRF_USBD_Type, EVENTS_STARTED ),
  NRF_USBD_EVENT_ENDEPIN0 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[0] ),
  NRF_USBD_EVENT_ENDEPIN1 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[1] ),
  NRF_USBD_EVENT_ENDEPIN2 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[2] ),
  NRF_USBD_EVENT_ENDEPIN3 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[3] ),
  NRF_USBD_EVENT_ENDEPIN4 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[4] ),
  NRF_USBD_EVENT_ENDEPIN5 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[5] ),
  NRF_USBD_EVENT_ENDEPIN6 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[6] ),
  NRF_USBD_EVENT_ENDEPIN7 = offsetof(NRF_USBD_Type, EVENTS_ENDEPIN[7] ),
  NRF_USBD_EVENT_EP0DATADONE = offsetof(NRF_USBD_Type, EVENTS_EP0DATADONE),
  NRF_USBD_EVENT_ENDISOIN0 = offsetof(NRF_USBD_Type, EVENTS_ENDISOIN ),
  NRF_USBD_EVENT_ENDEPOUT0 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[0]),
  NRF_USBD_EVENT_ENDEPOUT1 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[1]),
  NRF_USBD_EVENT_ENDEPOUT2 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[2]),
  NRF_USBD_EVENT_ENDEPOUT3 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[3]),
  NRF_USBD_EVENT_ENDEPOUT4 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[4]),
  NRF_USBD_EVENT_ENDEPOUT5 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[5]),
  NRF_USBD_EVENT_ENDEPOUT6 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[6]),
  NRF_USBD_EVENT_ENDEPOUT7 = offsetof(NRF_USBD_Type, EVENTS_ENDEPOUT[7]),
  NRF_USBD_EVENT_ENDISOOUT0 = offsetof(NRF_USBD_Type, EVENTS_ENDISOOUT ),
  NRF_USBD_EVENT_SOF = offsetof(NRF_USBD_Type, EVENTS_SOF ),
  NRF_USBD_EVENT_USBEVENT = offsetof(NRF_USBD_Type, EVENTS_USBEVENT ),
  NRF_USBD_EVENT_EP0SETUP = offsetof(NRF_USBD_Type, EVENTS_EP0SETUP ),
  NRF_USBD_EVENT_DATAEP = offsetof(NRF_USBD_Type, EVENTS_EPDATA )
}
 USBD events. More...
 
enum  nrf_usbd_short_mask_t {
  NRF_USBD_SHORT_EP0DATADONE_STARTEPIN0_MASK = USBD_SHORTS_EP0DATADONE_STARTEPIN0_Msk,
  NRF_USBD_SHORT_EP0DATADONE_STARTEPOUT0_MASK = USBD_SHORTS_EP0DATADONE_STARTEPOUT0_Msk,
  NRF_USBD_SHORT_EP0DATADONE_EP0STATUS_MASK = USBD_SHORTS_EP0DATADONE_EP0STATUS_Msk,
  NRF_USBD_SHORT_ENDEPOUT0_EP0STATUS_MASK = USBD_SHORTS_ENDEPOUT0_EP0STATUS_Msk,
  NRF_USBD_SHORT_ENDEPOUT0_EP0RCVOUT_MASK = USBD_SHORTS_ENDEPOUT0_EP0RCVOUT_Msk
}
 USBD shorts. More...
 
enum  nrf_usbd_int_mask_t {
  NRF_USBD_INT_USBRESET_MASK = USBD_INTEN_USBRESET_Msk,
  NRF_USBD_INT_STARTED_MASK = USBD_INTEN_STARTED_Msk,
  NRF_USBD_INT_ENDEPIN0_MASK = USBD_INTEN_ENDEPIN0_Msk,
  NRF_USBD_INT_ENDEPIN1_MASK = USBD_INTEN_ENDEPIN1_Msk,
  NRF_USBD_INT_ENDEPIN2_MASK = USBD_INTEN_ENDEPIN2_Msk,
  NRF_USBD_INT_ENDEPIN3_MASK = USBD_INTEN_ENDEPIN3_Msk,
  NRF_USBD_INT_ENDEPIN4_MASK = USBD_INTEN_ENDEPIN4_Msk,
  NRF_USBD_INT_ENDEPIN5_MASK = USBD_INTEN_ENDEPIN5_Msk,
  NRF_USBD_INT_ENDEPIN6_MASK = USBD_INTEN_ENDEPIN6_Msk,
  NRF_USBD_INT_ENDEPIN7_MASK = USBD_INTEN_ENDEPIN7_Msk,
  NRF_USBD_INT_EP0DATADONE_MASK = USBD_INTEN_EP0DATADONE_Msk,
  NRF_USBD_INT_ENDISOIN0_MASK = USBD_INTEN_ENDISOIN_Msk,
  NRF_USBD_INT_ENDEPOUT0_MASK = USBD_INTEN_ENDEPOUT0_Msk,
  NRF_USBD_INT_ENDEPOUT1_MASK = USBD_INTEN_ENDEPOUT1_Msk,
  NRF_USBD_INT_ENDEPOUT2_MASK = USBD_INTEN_ENDEPOUT2_Msk,
  NRF_USBD_INT_ENDEPOUT3_MASK = USBD_INTEN_ENDEPOUT3_Msk,
  NRF_USBD_INT_ENDEPOUT4_MASK = USBD_INTEN_ENDEPOUT4_Msk,
  NRF_USBD_INT_ENDEPOUT5_MASK = USBD_INTEN_ENDEPOUT5_Msk,
  NRF_USBD_INT_ENDEPOUT6_MASK = USBD_INTEN_ENDEPOUT6_Msk,
  NRF_USBD_INT_ENDEPOUT7_MASK = USBD_INTEN_ENDEPOUT7_Msk,
  NRF_USBD_INT_ENDISOOUT0_MASK = USBD_INTEN_ENDISOOUT_Msk,
  NRF_USBD_INT_SOF_MASK = USBD_INTEN_SOF_Msk,
  NRF_USBD_INT_USBEVENT_MASK = USBD_INTEN_USBEVENT_Msk,
  NRF_USBD_INT_EP0SETUP_MASK = USBD_INTEN_EP0SETUP_Msk,
  NRF_USBD_INT_DATAEP_MASK = USBD_INTEN_EPDATA_Msk
}
 USBD interrupts. More...
 
enum  nrf_usbd_eventcause_mask_t {
  NRF_USBD_EVENTCAUSE_ISOOUTCRC_MASK = USBD_EVENTCAUSE_ISOOUTCRC_Msk,
  NRF_USBD_EVENTCAUSE_SUSPEND_MASK = USBD_EVENTCAUSE_SUSPEND_Msk,
  NRF_USBD_EVENTCAUSE_RESUME_MASK = USBD_EVENTCAUSE_RESUME_Msk,
  NRF_USBD_EVENTCAUSE_WUREQ_MASK = USBD_EVENTCAUSE_USBWUALLOWED_Msk,
  NRF_USBD_EVENTCAUSE_READY_MASK = USBD_EVENTCAUSE_READY_Msk
}
 EVENTCAUSE register bit masks. More...
 
enum  nrf_usbd_dpdmvalue_t {
  NRF_USBD_DPDMVALUE_RESUME = USBD_DPDMVALUE_STATE_Resume,
  NRF_USBD_DPDMVALUE_J = USBD_DPDMVALUE_STATE_J,
  NRF_USBD_DPMVALUE_K = USBD_DPDMVALUE_STATE_K
}
 DPDMVALUE register. More...
 
enum  nrf_usbd_dtoggle_t {
  NRF_USBD_DTOGGLE_NOP = USBD_DTOGGLE_VALUE_Nop,
  NRF_USBD_DTOGGLE_DATA0 = USBD_DTOGGLE_VALUE_Data0,
  NRF_USBD_DTOGGLE_DATA1 = USBD_DTOGGLE_VALUE_Data1
}
 Data toggle value or operation. More...
 
enum  nrf_usbd_epstatus_mask_t {
  NRF_USBD_EPSTATUS_EPIN0_MASK = USBD_EPSTATUS_EPIN0_Msk,
  NRF_USBD_EPSTATUS_EPIN1_MASK = USBD_EPSTATUS_EPIN1_Msk,
  NRF_USBD_EPSTATUS_EPIN2_MASK = USBD_EPSTATUS_EPIN2_Msk,
  NRF_USBD_EPSTATUS_EPIN3_MASK = USBD_EPSTATUS_EPIN3_Msk,
  NRF_USBD_EPSTATUS_EPIN4_MASK = USBD_EPSTATUS_EPIN4_Msk,
  NRF_USBD_EPSTATUS_EPIN5_MASK = USBD_EPSTATUS_EPIN5_Msk,
  NRF_USBD_EPSTATUS_EPIN6_MASK = USBD_EPSTATUS_EPIN6_Msk,
  NRF_USBD_EPSTATUS_EPIN7_MASK = USBD_EPSTATUS_EPIN7_Msk,
  NRF_USBD_EPSTATUS_EPOUT0_MASK = USBD_EPSTATUS_EPOUT0_Msk,
  NRF_USBD_EPSTATUS_EPOUT1_MASK = USBD_EPSTATUS_EPOUT1_Msk,
  NRF_USBD_EPSTATUS_EPOUT2_MASK = USBD_EPSTATUS_EPOUT2_Msk,
  NRF_USBD_EPSTATUS_EPOUT3_MASK = USBD_EPSTATUS_EPOUT3_Msk,
  NRF_USBD_EPSTATUS_EPOUT4_MASK = USBD_EPSTATUS_EPOUT4_Msk,
  NRF_USBD_EPSTATUS_EPOUT5_MASK = USBD_EPSTATUS_EPOUT5_Msk,
  NRF_USBD_EPSTATUS_EPOUT6_MASK = USBD_EPSTATUS_EPOUT6_Msk,
  NRF_USBD_EPSTATUS_EPOUT7_MASK = USBD_EPSTATUS_EPOUT7_Msk
}
 EPSTATUS bit masks.
 
enum  nrf_usbd_dataepstatus_mask_t {
  NRF_USBD_EPDATASTATUS_EPIN1_MASK = USBD_EPDATASTATUS_EPIN1_Msk,
  NRF_USBD_EPDATASTATUS_EPIN2_MASK = USBD_EPDATASTATUS_EPIN2_Msk,
  NRF_USBD_EPDATASTATUS_EPIN3_MASK = USBD_EPDATASTATUS_EPIN3_Msk,
  NRF_USBD_EPDATASTATUS_EPIN4_MASK = USBD_EPDATASTATUS_EPIN4_Msk,
  NRF_USBD_EPDATASTATUS_EPIN5_MASK = USBD_EPDATASTATUS_EPIN5_Msk,
  NRF_USBD_EPDATASTATUS_EPIN6_MASK = USBD_EPDATASTATUS_EPIN6_Msk,
  NRF_USBD_EPDATASTATUS_EPIN7_MASK = USBD_EPDATASTATUS_EPIN7_Msk,
  NRF_USBD_EPDATASTATUS_EPOUT1_MASK = USBD_EPDATASTATUS_EPOUT1_Msk,
  NRF_USBD_EPDATASTATUS_EPOUT2_MASK = USBD_EPDATASTATUS_EPOUT2_Msk,
  NRF_USBD_EPDATASTATUS_EPOUT3_MASK = USBD_EPDATASTATUS_EPOUT3_Msk,
  NRF_USBD_EPDATASTATUS_EPOUT4_MASK = USBD_EPDATASTATUS_EPOUT4_Msk,
  NRF_USBD_EPDATASTATUS_EPOUT5_MASK = USBD_EPDATASTATUS_EPOUT5_Msk,
  NRF_USBD_EPDATASTATUS_EPOUT6_MASK = USBD_EPDATASTATUS_EPOUT6_Msk,
  NRF_USBD_EPDATASTATUS_EPOUT7_MASK = USBD_EPDATASTATUS_EPOUT7_Msk
}
 DATAEPSTATUS bit masks.
 
enum  nrf_usbd_isosplit_t {
  NRF_USBD_ISOSPLIT_ONEDIR = USBD_ISOSPLIT_SPLIT_OneDir,
  NRF_USBD_ISOSPLIT_HALF = USBD_ISOSPLIT_SPLIT_HalfIN
}
 ISOSPLIT configurations. More...
 
enum  nrf_usbd_isoinconfig_t {
  NRF_USBD_ISOINCONFIG_NORESP = USBD_ISOINCONFIG_RESPONSE_NoResp,
  NRF_USBD_ISOINCONFIG_ZERODATA = USBD_ISOINCONFIG_RESPONSE_ZeroData
}
 ISOINCONFIG configurations. More...
 

Functions

NRF_STATIC_INLINE void nrf_usbd_task_trigger (NRF_USBD_Type *p_reg, nrf_usbd_task_t task)
 Function for activating the specified USBD task. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_task_address_get (NRF_USBD_Type const *p_reg, nrf_usbd_task_t task)
 Function for returning the address of the specified USBD task register. More...
 
NRF_STATIC_INLINE void nrf_usbd_event_clear (NRF_USBD_Type *p_reg, nrf_usbd_event_t event)
 Function for clearing the specified event. More...
 
NRF_STATIC_INLINE bool nrf_usbd_event_check (NRF_USBD_Type const *p_reg, nrf_usbd_event_t event)
 Function for retrieving the state of the USBD event. More...
 
NRF_STATIC_INLINE bool nrf_usbd_event_get_and_clear (NRF_USBD_Type *p_reg, nrf_usbd_event_t event)
 Function for getting and clearing the state of the specified event. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_event_address_get (NRF_USBD_Type const *p_reg, nrf_usbd_event_t event)
 Function for returning the address of the specified USBD event register. More...
 
NRF_STATIC_INLINE void nrf_usbd_shorts_enable (NRF_USBD_Type *p_reg, uint32_t mask)
 Function for setting shortcuts. More...
 
NRF_STATIC_INLINE void nrf_usbd_shorts_disable (NRF_USBD_Type *p_reg, uint32_t mask)
 Function for clearing shortcuts. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_shorts_get (NRF_USBD_Type const *p_reg)
 Function for getting the shortcut mask. More...
 
NRF_STATIC_INLINE void nrf_usbd_int_enable (NRF_USBD_Type *p_reg, uint32_t mask)
 Function for enabling the selected interrupts. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_int_enable_check (NRF_USBD_Type const *p_reg, uint32_t mask)
 Function for checking if the specified interrupts are enabled. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_int_enable_get (NRF_USBD_Type const *p_reg)
 Function for retrieving the information about the enabled interrupts. More...
 
NRF_STATIC_INLINE void nrf_usbd_int_disable (NRF_USBD_Type *p_reg, uint32_t mask)
 Function for disabling the selected interrupts. More...
 
NRF_STATIC_INLINE void nrf_usbd_enable (NRF_USBD_Type *p_reg)
 Function for enabling the USBD. More...
 
NRF_STATIC_INLINE void nrf_usbd_disable (NRF_USBD_Type *p_reg)
 Function for disabling the USBD. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_eventcause_get (NRF_USBD_Type const *p_reg)
 Function for getting the EVENTCAUSE register. More...
 
NRF_STATIC_INLINE void nrf_usbd_eventcause_clear (NRF_USBD_Type *p_reg, uint32_t flags)
 Function for clearing the EVENTCAUSE flags. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_eventcause_get_and_clear (NRF_USBD_Type *p_reg)
 Function for getting the EVENTCAUSE register and clearing flags that are set. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_halted_get (NRF_USBD_Type const *p_reg, uint8_t ep)
 Function for getting the HALTEDEPIN register value. More...
 
NRF_STATIC_INLINE bool nrf_usbd_ep_is_stall (NRF_USBD_Type const *p_reg, uint8_t ep)
 Function for checking whether the selected endpoint is stalled. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_epstatus_get (NRF_USBD_Type const *p_reg)
 Function for getting EPSTATUS register value. More...
 
NRF_STATIC_INLINE void nrf_usbd_epstatus_clear (NRF_USBD_Type *p_reg, uint32_t flags)
 Function for clearing EPSTATUS register value. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_epstatus_get_and_clear (NRF_USBD_Type *p_reg)
 Function for getting and clearing EPSTATUS register value. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_epdatastatus_get (NRF_USBD_Type const *p_reg)
 Function for getting DATAEPSTATUS register value. More...
 
NRF_STATIC_INLINE void nrf_usbd_epdatastatus_clear (NRF_USBD_Type *p_reg, uint32_t flags)
 Function for clearing DATAEPSTATUS register value. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_epdatastatus_get_and_clear (NRF_USBD_Type *p_reg)
 Function for getting and clearing DATAEPSTATUS register value. More...
 
NRF_STATIC_INLINE size_t nrf_usbd_epout_size_get (NRF_USBD_Type const *p_reg, uint8_t ep)
 Function for getting the number of received bytes on the selected endpoint. More...
 
NRF_STATIC_INLINE size_t nrf_usbd_episoout_size_get (NRF_USBD_Type const *p_reg, uint8_t ep)
 Function for getting number of the received bytes on isochronous endpoint. More...
 
NRF_STATIC_INLINE void nrf_usbd_epout_clear (NRF_USBD_Type *p_reg, uint8_t ep)
 Function for clearing OUT endpoint to accept any new incoming traffic. More...
 
NRF_STATIC_INLINE void nrf_usbd_pullup_enable (NRF_USBD_Type *p_reg)
 Function for enabling the USB pullup. More...
 
NRF_STATIC_INLINE void nrf_usbd_pullup_disable (NRF_USBD_Type *p_reg)
 Function for disabling the USB pullup. More...
 
NRF_STATIC_INLINE bool nrf_usbd_pullup_check (NRF_USBD_Type const *p_reg)
 Function for returning the current the USB pullup state. More...
 
NRF_STATIC_INLINE void nrf_usbd_dpdmvalue_set (NRF_USBD_Type *p_reg, nrf_usbd_dpdmvalue_t val)
 Function for configuring the value to be forced on the bus on the DRIVEDPDM task. More...
 
NRF_STATIC_INLINE void nrf_usbd_dtoggle_set (NRF_USBD_Type *p_reg, uint8_t ep, nrf_usbd_dtoggle_t op)
 Function for setting the data toggle. More...
 
NRF_STATIC_INLINE nrf_usbd_dtoggle_t nrf_usbd_dtoggle_get (NRF_USBD_Type *p_reg, uint8_t ep)
 Function for getting the data toggle. More...
 
NRF_STATIC_INLINE bool nrf_usbd_ep_enable_check (NRF_USBD_Type const *p_reg, uint8_t ep)
 Function for checking whether the endpoint is enabled. More...
 
NRF_STATIC_INLINE void nrf_usbd_ep_enable (NRF_USBD_Type *p_reg, uint8_t ep)
 Function for enabling the selected endpoint. More...
 
NRF_STATIC_INLINE void nrf_usbd_ep_disable (NRF_USBD_Type *p_reg, uint8_t ep)
 Function for disabling the selected endpoint. More...
 
NRF_STATIC_INLINE void nrf_usbd_ep_all_disable (NRF_USBD_Type *p_reg)
 Function for disabling all endpoints. More...
 
NRF_STATIC_INLINE void nrf_usbd_ep_default_config (NRF_USBD_Type *p_reg)
 Function for setting the default endpoint configuration. More...
 
NRF_STATIC_INLINE void nrf_usbd_ep_stall (NRF_USBD_Type *p_reg, uint8_t ep)
 Function for stalling the selected endpoint. More...
 
NRF_STATIC_INLINE void nrf_usbd_ep_unstall (NRF_USBD_Type *p_reg, uint8_t ep)
 Function for unstalling the selected endpoint. More...
 
NRF_STATIC_INLINE void nrf_usbd_isosplit_set (NRF_USBD_Type *p_reg, nrf_usbd_isosplit_t split)
 Function for configuring the isochronous buffer splitting. More...
 
NRF_STATIC_INLINE nrf_usbd_isosplit_t nrf_usbd_isosplit_get (NRF_USBD_Type const *p_reg)
 Function for getting the isochronous buffer splitting configuration. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_framecntr_get (NRF_USBD_Type const *p_reg)
 Function for getting current frame counter. More...
 
NRF_STATIC_INLINE void nrf_usbd_lowpower_enable (NRF_USBD_Type *p_reg)
 Function for entering into the USB low power mode. More...
 
NRF_STATIC_INLINE void nrf_usbd_lowpower_disable (NRF_USBD_Type *p_reg)
 Function for exiting from the USB low power mode. More...
 
NRF_STATIC_INLINE bool nrf_usbd_lowpower_check (NRF_USBD_Type const *p_reg)
 Function for checking the state of the low power mode. More...
 
NRF_STATIC_INLINE void nrf_usbd_isoinconfig_set (NRF_USBD_Type *p_reg, nrf_usbd_isoinconfig_t config)
 Function for configuring ISO IN endpoint response to an IN token when no data is ready to be sent. More...
 
NRF_STATIC_INLINE nrf_usbd_isoinconfig_t nrf_usbd_isoinconfig_get (NRF_USBD_Type const *p_reg)
 Function for getting the cofiguration of ISO IN endpoint response to an IN token when no data is ready to be sent. More...
 
NRF_STATIC_INLINE void nrf_usbd_ep_easydma_set (NRF_USBD_Type *p_reg, uint8_t ep, uint32_t ptr, uint32_t maxcnt)
 Function for configuring the EasyDMA channel. More...
 
NRF_STATIC_INLINE uint32_t nrf_usbd_ep_amount_get (NRF_USBD_Type const *p_reg, uint8_t ep)
 Function for getting number of transferred bytes. More...
 

Setup command frame functions.

Functions for setting up command frame part access.

NRF_STATIC_INLINE uint8_t nrf_usbd_setup_bmrequesttype_get (NRF_USBD_Type const *p_reg)
 Function for reading BMREQUESTTYPE - part of the SETUP packet. More...
 
NRF_STATIC_INLINE uint8_t nrf_usbd_setup_brequest_get (NRF_USBD_Type const *p_reg)
 Function for reading BMREQUEST - part of the SETUP packet. More...
 
NRF_STATIC_INLINE uint16_t nrf_usbd_setup_wvalue_get (NRF_USBD_Type const *p_reg)
 Function for reading WVALUE - part of the SETUP packet. More...
 
NRF_STATIC_INLINE uint16_t nrf_usbd_setup_windex_get (NRF_USBD_Type const *p_reg)
 Function for reading WINDEX - part of the SETUP packet. More...
 
NRF_STATIC_INLINE uint16_t nrf_usbd_setup_wlength_get (NRF_USBD_Type const *p_reg)
 Function for reading WLENGTH - part of the SETUP packet. More...
 

Detailed Description

Hardware access layer for managing the Universal Serial Bus Device (USBD) peripheral.

Macro Definition Documentation

◆ NRF_USBD_EP_NR_GET

#define NRF_USBD_EP_NR_GET (   ep)    ((uint8_t)(((uint8_t)(ep)) & 0xFU))

Macro for extracting the endpoint number from the specified endpoint identifier.

Macro that strips out the information about endpoint direction.

Parameters
[in]epEndpoint identifier.
Returns
Endpoint number.

◆ NRF_USBD_EP_VALIDATE

#define NRF_USBD_EP_VALIDATE (   ep)
Value:
( \
|| \
)
#define NRF_USBD_EP_NR_GET(ep)
Macro for extracting the endpoint number from the specified endpoint identifier.
Definition: nrf_usbd.h:453
#define NRF_USBD_EPOUT_CHECK(ep)
Macro for checking endpoint direction.
Definition: nrf_usbd.h:477
#define NRF_USBD_EPIN_CNT
Total number of IN endpoints.
Definition: nrf_usbd.h:404
#define NRF_USBD_EPOUT_CNT
Total number of OUT endpoints.
Definition: nrf_usbd.h:411
#define NRF_USBD_EPIN_CHECK(ep)
Macro for checking the endpoint direction.
Definition: nrf_usbd.h:465

Macro for checking if given number is valid endpoint number.

Parameters
[in]epEndpoint number to be checked.
Return values
trueThe endpoint is valid.
falseThe endpoint is not valid.

◆ NRF_USBD_EPIN

#define NRF_USBD_EPIN (   epnr)    (((uint8_t)(epnr)) | NRF_USBD_EP_DIR_IN)

Macro for making the IN endpoint identifier from endpoint number.

Macro that sets direction bit to make IN endpoint.

Parameters
[in]epnrEndpoint number.
Returns
IN Endpoint identifier.

◆ NRF_USBD_EPIN_CHECK

#define NRF_USBD_EPIN_CHECK (   ep)    ( (((uint8_t)(ep)) & NRF_USBD_EP_DIR_Msk) == NRF_USBD_EP_DIR_IN )

Macro for checking the endpoint direction.

This macro checks if the specified endpoint has the IN direction.

Parameters
[in]epEndpoint identifier.
Return values
trueThe endpoint direction is IN.
falseThe endpoint direction is OUT.

◆ NRF_USBD_EPIN_CNT

#define NRF_USBD_EPIN_CNT   9

Total number of IN endpoints.

Total number of IN endpoint (including ISOCHRONOUS).

◆ NRF_USBD_EPISO_CHECK

#define NRF_USBD_EPISO_CHECK (   ep)    (NRF_USBD_EP_NR_GET(ep) >= NRF_USBD_EPISO_FIRST)

Macro for checking if endpoint is isochronous.

Parameters
[in]epIt can be endpoint identifier or just endpoint number to be checked.
Return values
trueThe endpoint is isochronous type.
falseThe endpoint is bulk of interrupt type.

◆ NRF_USBD_EPISO_FIRST

#define NRF_USBD_EPISO_FIRST   8

First isochronous endpoint number.

The number of the first isochronous endpoint.

◆ NRF_USBD_EPISOOUT_NO_DATA

#define NRF_USBD_EPISOOUT_NO_DATA   ((size_t)(-1))

Not isochronous data frame received.

Special value returned by nrf_usbd_episoout_size_get function that means that data frame was not received at all. This allows differentiate between situations when zero size data comes or no data comes at all on isochronous endpoint.

◆ NRF_USBD_EPOUT

#define NRF_USBD_EPOUT (   epnr)    (((uint8_t)(epnr)) | NRF_USBD_EP_DIR_OUT)

Macro for making the OUT endpoint identifier from endpoint number.

Macro that sets direction bit to make OUT endpoint.

Parameters
[in]epnrEndpoint number.
Returns
OUT Endpoint identifier.

◆ NRF_USBD_EPOUT_CHECK

#define NRF_USBD_EPOUT_CHECK (   ep)    ( (((uint8_t)(ep)) & NRF_USBD_EP_DIR_Msk) == NRF_USBD_EP_DIR_OUT )

Macro for checking endpoint direction.

This macro checks if given endpoint has OUT direction.

Parameters
[in]epEndpoint identifier
Return values
trueThe endpoint direction is OUT
falseThe endpoint direction is IN

◆ NRF_USBD_EPOUT_CNT

#define NRF_USBD_EPOUT_CNT   9

Total number of OUT endpoints.

Total number of OUT endpoint (including ISOCHRONOUS).

◆ NRF_USBD_FRAMECNTR_SIZE

#define NRF_USBD_FRAMECNTR_SIZE   ( (USBD_FRAMECNTR_FRAMECNTR_Msk >> USBD_FRAMECNTR_FRAMECNTR_Pos) + 1UL )

Frame counter size.

The number of counts that can be fitted into frame counter.

Enumeration Type Documentation

◆ nrf_usbd_dpdmvalue_t

DPDMVALUE register.

Enumerator
NRF_USBD_DPDMVALUE_RESUME 

Generate RESUME signal. Signal is generated for 50 us or 5 ms, depending on bus state.

NRF_USBD_DPDMVALUE_J 

D+ Forced high, D- forced low (J state)

NRF_USBD_DPMVALUE_K 

D+ Forced low, D- forced high (K state)

◆ nrf_usbd_dtoggle_t

Data toggle value or operation.

Enumerator
NRF_USBD_DTOGGLE_NOP 

No operation - do not change the current data toggle on the selected endpoint.

NRF_USBD_DTOGGLE_DATA0 

Data toggle is DATA0 on the selected endpoint.

NRF_USBD_DTOGGLE_DATA1 

Data toggle is DATA1 on the selected endpoint.

◆ nrf_usbd_event_t

USBD events.

Enumerator
NRF_USBD_EVENT_USBRESET 

Signals that a USB reset condition is detected on the USB lines.

NRF_USBD_EVENT_STARTED 

Confirms that the EPIN[n].PTR, EPIN[n].MAXCNT, EPIN[n].CONFIG, or EPOUT[n].PTR, EPOUT[n].MAXCNT, and EPOUT[n].CONFIG registers have been captured on all endpoints reported in the EPSTATUS register.

NRF_USBD_EVENT_ENDEPIN0 

The whole EPIN[0] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPIN1 

The whole EPIN[1] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPIN2 

The whole EPIN[2] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPIN3 

The whole EPIN[3] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPIN4 

The whole EPIN[4] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPIN5 

The whole EPIN[5] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPIN6 

The whole EPIN[6] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPIN7 

The whole EPIN[7] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_EP0DATADONE 

An acknowledged data transfer has taken place on the control endpoint.

NRF_USBD_EVENT_ENDISOIN0 

The whole ISOIN buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT0 

The whole EPOUT[0] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT1 

The whole EPOUT[1] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT2 

The whole EPOUT[2] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT3 

The whole EPOUT[3] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT4 

The whole EPOUT[4] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT5 

The whole EPOUT[5] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT6 

The whole EPOUT[6] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDEPOUT7 

The whole EPOUT[7] buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_ENDISOOUT0 

The whole ISOOUT buffer has been consumed. The RAM buffer can be accessed safely by software.

NRF_USBD_EVENT_SOF 

Signals that a SOF (start of frame) condition has been detected on the USB lines.

NRF_USBD_EVENT_USBEVENT 

An event or an error not covered by the specified events has occurred, check EVENTCAUSE register to find the cause.

NRF_USBD_EVENT_EP0SETUP 

A valid SETUP token has been received (and acknowledged) on the control endpoint.

NRF_USBD_EVENT_DATAEP 

A data transfer has occurred on a data endpoint, indicated by the EPDATASTATUS register.

◆ nrf_usbd_eventcause_mask_t

EVENTCAUSE register bit masks.

Enumerator
NRF_USBD_EVENTCAUSE_ISOOUTCRC_MASK 

CRC error was detected on isochronous OUT endpoint 8.

NRF_USBD_EVENTCAUSE_SUSPEND_MASK 

Signals that the USB lines have been seen idle long enough for the device to enter suspend.

NRF_USBD_EVENTCAUSE_RESUME_MASK 

Signals that a RESUME condition (K state or activity restart) has been detected on the USB lines.

NRF_USBD_EVENTCAUSE_WUREQ_MASK 

The USBD peripheral has exited Low Power mode.

NRF_USBD_EVENTCAUSE_READY_MASK 

MAC is ready for normal operation, rised few us after USBD enabling.

◆ nrf_usbd_int_mask_t

USBD interrupts.

Enumerator
NRF_USBD_INT_USBRESET_MASK 

Enable or disable interrupt for USBRESET event.

NRF_USBD_INT_STARTED_MASK 

Enable or disable interrupt for STARTED event.

NRF_USBD_INT_ENDEPIN0_MASK 

Enable or disable interrupt for ENDEPIN[0] event.

NRF_USBD_INT_ENDEPIN1_MASK 

Enable or disable interrupt for ENDEPIN[1] event.

NRF_USBD_INT_ENDEPIN2_MASK 

Enable or disable interrupt for ENDEPIN[2] event.

NRF_USBD_INT_ENDEPIN3_MASK 

Enable or disable interrupt for ENDEPIN[3] event.

NRF_USBD_INT_ENDEPIN4_MASK 

Enable or disable interrupt for ENDEPIN[4] event.

NRF_USBD_INT_ENDEPIN5_MASK 

Enable or disable interrupt for ENDEPIN[5] event.

NRF_USBD_INT_ENDEPIN6_MASK 

Enable or disable interrupt for ENDEPIN[6] event.

NRF_USBD_INT_ENDEPIN7_MASK 

Enable or disable interrupt for ENDEPIN[7] event.

NRF_USBD_INT_EP0DATADONE_MASK 

Enable or disable interrupt for EP0DATADONE event.

NRF_USBD_INT_ENDISOIN0_MASK 

Enable or disable interrupt for ENDISOIN[0] event.

NRF_USBD_INT_ENDEPOUT0_MASK 

Enable or disable interrupt for ENDEPOUT[0] event.

NRF_USBD_INT_ENDEPOUT1_MASK 

Enable or disable interrupt for ENDEPOUT[1] event.

NRF_USBD_INT_ENDEPOUT2_MASK 

Enable or disable interrupt for ENDEPOUT[2] event.

NRF_USBD_INT_ENDEPOUT3_MASK 

Enable or disable interrupt for ENDEPOUT[3] event.

NRF_USBD_INT_ENDEPOUT4_MASK 

Enable or disable interrupt for ENDEPOUT[4] event.

NRF_USBD_INT_ENDEPOUT5_MASK 

Enable or disable interrupt for ENDEPOUT[5] event.

NRF_USBD_INT_ENDEPOUT6_MASK 

Enable or disable interrupt for ENDEPOUT[6] event.

NRF_USBD_INT_ENDEPOUT7_MASK 

Enable or disable interrupt for ENDEPOUT[7] event.

NRF_USBD_INT_ENDISOOUT0_MASK 

Enable or disable interrupt for ENDISOOUT[0] event.

NRF_USBD_INT_SOF_MASK 

Enable or disable interrupt for SOF event.

NRF_USBD_INT_USBEVENT_MASK 

Enable or disable interrupt for USBEVENT event.

NRF_USBD_INT_EP0SETUP_MASK 

Enable or disable interrupt for EP0SETUP event.

NRF_USBD_INT_DATAEP_MASK 

Enable or disable interrupt for EPDATA event.

◆ nrf_usbd_isoinconfig_t

ISOINCONFIG configurations.

Enumerator
NRF_USBD_ISOINCONFIG_NORESP 

Endpoint does not respond to an ISO IN token when no data is ready.

NRF_USBD_ISOINCONFIG_ZERODATA 

Endpoint responds with a zero-length data packet to an ISO IN token when no data is ready.

◆ nrf_usbd_isosplit_t

ISOSPLIT configurations.

Enumerator
NRF_USBD_ISOSPLIT_ONEDIR 

Full buffer dedicated to either ISO IN or OUT.

NRF_USBD_ISOSPLIT_HALF 

Buffer divided in half.

◆ nrf_usbd_short_mask_t

USBD shorts.

Enumerator
NRF_USBD_SHORT_EP0DATADONE_STARTEPIN0_MASK 

Shortcut between EP0DATADONE event and STARTEPIN0 task.

NRF_USBD_SHORT_EP0DATADONE_STARTEPOUT0_MASK 

Shortcut between EP0DATADONE event and STARTEPOUT0 task.

NRF_USBD_SHORT_EP0DATADONE_EP0STATUS_MASK 

Shortcut between EP0DATADONE event and EP0STATUS task.

NRF_USBD_SHORT_ENDEPOUT0_EP0STATUS_MASK 

Shortcut between ENDEPOUT[0] event and EP0STATUS task.

NRF_USBD_SHORT_ENDEPOUT0_EP0RCVOUT_MASK 

Shortcut between ENDEPOUT[0] event and EP0RCVOUT task.

◆ nrf_usbd_task_t

USBD tasks.

Enumerator
NRF_USBD_TASK_STARTEPIN0 

Captures the EPIN[0].PTR, EPIN[0].MAXCNT, and EPIN[0].CONFIG registers values, and enables control endpoint IN 0 to respond to traffic from host.

NRF_USBD_TASK_STARTEPIN1 

Captures the EPIN[1].PTR, EPIN[1].MAXCNT, and EPIN[1].CONFIG registers values, and enables data endpoint IN 1 to respond to traffic from host.

NRF_USBD_TASK_STARTEPIN2 

Captures the EPIN[2].PTR, EPIN[2].MAXCNT, and EPIN[2].CONFIG registers values, and enables data endpoint IN 2 to respond to traffic from host.

NRF_USBD_TASK_STARTEPIN3 

Captures the EPIN[3].PTR, EPIN[3].MAXCNT, and EPIN[3].CONFIG registers values, and enables data endpoint IN 3 to respond to traffic from host.

NRF_USBD_TASK_STARTEPIN4 

Captures the EPIN[4].PTR, EPIN[4].MAXCNT, and EPIN[4].CONFIG registers values, and enables data endpoint IN 4 to respond to traffic from host.

NRF_USBD_TASK_STARTEPIN5 

Captures the EPIN[5].PTR, EPIN[5].MAXCNT, and EPIN[5].CONFIG registers values, and enables data endpoint IN 5 to respond to traffic from host.

NRF_USBD_TASK_STARTEPIN6 

Captures the EPIN[6].PTR, EPIN[6].MAXCNT, and EPIN[6].CONFIG registers values, and enables data endpoint IN 6 to respond to traffic from host.

NRF_USBD_TASK_STARTEPIN7 

Captures the EPIN[7].PTR, EPIN[7].MAXCNT, and EPIN[7].CONFIG registers values, and enables data endpoint IN 7 to respond to traffic from host.

NRF_USBD_TASK_STARTISOIN 

Captures the ISOIN.PTR, ISOIN.MAXCNT, and ISOIN.CONFIG registers values, and enables sending data on ISO endpoint 8.

NRF_USBD_TASK_STARTEPOUT0 

Captures the EPOUT[0].PTR, EPOUT[0].MAXCNT, and EPOUT[0].CONFIG registers values, and enables control endpoint 0 to respond to traffic from host.

NRF_USBD_TASK_STARTEPOUT1 

Captures the EPOUT[1].PTR, EPOUT[1].MAXCNT, and EPOUT[1].CONFIG registers values, and enables data endpoint 1 to respond to traffic from host.

NRF_USBD_TASK_STARTEPOUT2 

Captures the EPOUT[2].PTR, EPOUT[2].MAXCNT, and EPOUT[2].CONFIG registers values, and enables data endpoint 2 to respond to traffic from host.

NRF_USBD_TASK_STARTEPOUT3 

Captures the EPOUT[3].PTR, EPOUT[3].MAXCNT, and EPOUT[3].CONFIG registers values, and enables data endpoint 3 to respond to traffic from host.

NRF_USBD_TASK_STARTEPOUT4 

Captures the EPOUT[4].PTR, EPOUT[4].MAXCNT, and EPOUT[4].CONFIG registers values, and enables data endpoint 4 to respond to traffic from host.

NRF_USBD_TASK_STARTEPOUT5 

Captures the EPOUT[5].PTR, EPOUT[5].MAXCNT, and EPOUT[5].CONFIG registers values, and enables data endpoint 5 to respond to traffic from host.

NRF_USBD_TASK_STARTEPOUT6 

Captures the EPOUT[6].PTR, EPOUT[6].MAXCNT, and EPOUT[6].CONFIG registers values, and enables data endpoint 6 to respond to traffic from host.

NRF_USBD_TASK_STARTEPOUT7 

Captures the EPOUT[7].PTR, EPOUT[7].MAXCNT, and EPOUT[7].CONFIG registers values, and enables data endpoint 7 to respond to traffic from host.

NRF_USBD_TASK_STARTISOOUT 

Captures the ISOOUT.PTR, ISOOUT.MAXCNT, and ISOOUT.CONFIG registers values, and enables receiving of data on ISO endpoint 8.

NRF_USBD_TASK_EP0RCVOUT 

Allows OUT data stage on the control endpoint 0.

NRF_USBD_TASK_EP0STATUS 

Allows status stage on the control endpoint 0.

NRF_USBD_TASK_EP0STALL 

STALLs data and status stage on the control endpoint 0.

NRF_USBD_TASK_DRIVEDPDM 

Forces D+ and D-lines to the state defined in the DPDMVALUE register.

NRF_USBD_TASK_NODRIVEDPDM 

Stops forcing D+ and D- lines to any state (USB engine takes control).

Function Documentation

◆ nrf_usbd_disable()

NRF_STATIC_INLINE void nrf_usbd_disable ( NRF_USBD_Type *  p_reg)

Function for disabling the USBD.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_usbd_dpdmvalue_set()

NRF_STATIC_INLINE void nrf_usbd_dpdmvalue_set ( NRF_USBD_Type *  p_reg,
nrf_usbd_dpdmvalue_t  val 
)

Function for configuring the value to be forced on the bus on the DRIVEDPDM task.

The selected state will be forced on the bus when NRF_USBD_TASK_DRIVEDPDM is set. The state will be removed from the bus on NRF_USBD_TASK_NODRIVEDPDM and the control will be returned to the USBD peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]valState to be set.

◆ nrf_usbd_dtoggle_get()

NRF_STATIC_INLINE nrf_usbd_dtoggle_t nrf_usbd_dtoggle_get ( NRF_USBD_Type *  p_reg,
uint8_t  ep 
)

Function for getting the data toggle.

Get the current state of data toggling.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint number to return the information about current data toggling.
Return values
NRF_USBD_DTOGGLE_DATA0Data toggle is DATA0 on selected endpoint.
NRF_USBD_DTOGGLE_DATA1Data toggle is DATA1 on selected endpoint.

◆ nrf_usbd_dtoggle_set()

NRF_STATIC_INLINE void nrf_usbd_dtoggle_set ( NRF_USBD_Type *  p_reg,
uint8_t  ep,
nrf_usbd_dtoggle_t  op 
)

Function for setting the data toggle.

Configuration of the current state of data toggling.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint number with the information about its direction.
[in]opOperation to execute.

◆ nrf_usbd_enable()

NRF_STATIC_INLINE void nrf_usbd_enable ( NRF_USBD_Type *  p_reg)

Function for enabling the USBD.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_usbd_ep_all_disable()

NRF_STATIC_INLINE void nrf_usbd_ep_all_disable ( NRF_USBD_Type *  p_reg)

Function for disabling all endpoints.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_usbd_ep_amount_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_ep_amount_get ( NRF_USBD_Type const *  p_reg,
uint8_t  ep 
)

Function for getting number of transferred bytes.

This function gets the number of transferred bytes in the last transaction.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint identifier.
Returns
The content of the AMOUNT register.

◆ nrf_usbd_ep_default_config()

void nrf_usbd_ep_default_config ( NRF_USBD_Type *  p_reg)

Function for setting the default endpoint configuration.

Note
The default configuration means that all endpoints, except for EP0 IN and EP0 OUT, are disabled. Such configuration is used after the USB device reset.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_usbd_ep_disable()

NRF_STATIC_INLINE void nrf_usbd_ep_disable ( NRF_USBD_Type *  p_reg,
uint8_t  ep 
)

Function for disabling the selected endpoint.

The disabled endpoint does not respond for the tokens on the USB bus.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint ID to be disabled.

◆ nrf_usbd_ep_easydma_set()

NRF_STATIC_INLINE void nrf_usbd_ep_easydma_set ( NRF_USBD_Type *  p_reg,
uint8_t  ep,
uint32_t  ptr,
uint32_t  maxcnt 
)

Function for configuring the EasyDMA channel.

Configures EasyDMA for the transfer.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint identifier (with direction).
[in]ptrPointer to the data.
[in]maxcntNumber of bytes to transfer.

◆ nrf_usbd_ep_enable()

NRF_STATIC_INLINE void nrf_usbd_ep_enable ( NRF_USBD_Type *  p_reg,
uint8_t  ep 
)

Function for enabling the selected endpoint.

The enabled endpoint responds for the tokens on the USB bus.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint ID to be enabled.

◆ nrf_usbd_ep_enable_check()

NRF_STATIC_INLINE bool nrf_usbd_ep_enable_check ( NRF_USBD_Type const *  p_reg,
uint8_t  ep 
)

Function for checking whether the endpoint is enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint ID to be checked.
Return values
trueEndpoint is enabled.
falseEndpoint is disabled.

◆ nrf_usbd_ep_is_stall()

NRF_STATIC_INLINE bool nrf_usbd_ep_is_stall ( NRF_USBD_Type const *  p_reg,
uint8_t  ep 
)

Function for checking whether the selected endpoint is stalled.

Function to be used as a syntax sweeter for nrf_usbd_halted_get.

Also as the isochronous endpoint cannot be halted - it returns always false if isochronous endpoint is checked.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint number with IN or OUT flag.
Return values
trueThe endpoint is halted.
falseThe endpoint is not halted.

◆ nrf_usbd_ep_stall()

NRF_STATIC_INLINE void nrf_usbd_ep_stall ( NRF_USBD_Type *  p_reg,
uint8_t  ep 
)

Function for stalling the selected endpoint.

Note
This function cannot be called on isochronous endpoint.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint identifier.

◆ nrf_usbd_ep_unstall()

NRF_STATIC_INLINE void nrf_usbd_ep_unstall ( NRF_USBD_Type *  p_reg,
uint8_t  ep 
)

Function for unstalling the selected endpoint.

Note
This function cannot be called on isochronous endpoint.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint identifier

◆ nrf_usbd_epdatastatus_clear()

NRF_STATIC_INLINE void nrf_usbd_epdatastatus_clear ( NRF_USBD_Type *  p_reg,
uint32_t  flags 
)

Function for clearing DATAEPSTATUS register value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]flagsFlags defined in nrf_usbd_dataepstatus_mask_t.

◆ nrf_usbd_epdatastatus_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_epdatastatus_get ( NRF_USBD_Type const *  p_reg)

Function for getting DATAEPSTATUS register value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Flag values defined in nrf_usbd_dataepstatus_mask_t.

◆ nrf_usbd_epdatastatus_get_and_clear()

NRF_STATIC_INLINE uint32_t nrf_usbd_epdatastatus_get_and_clear ( NRF_USBD_Type *  p_reg)

Function for getting and clearing DATAEPSTATUS register value.

Function clears all flags in register set before returning its value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Flag values defined in nrf_usbd_dataepstatus_mask_t.

◆ nrf_usbd_episoout_size_get()

NRF_STATIC_INLINE size_t nrf_usbd_episoout_size_get ( NRF_USBD_Type const *  p_reg,
uint8_t  ep 
)

Function for getting number of the received bytes on isochronous endpoint.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint identifier, must be an isochronous OUT endpoint.
Returns
Number of bytes received or NRF_USBD_EPISOOUT_NO_DATA.

◆ nrf_usbd_epout_clear()

NRF_STATIC_INLINE void nrf_usbd_epout_clear ( NRF_USBD_Type *  p_reg,
uint8_t  ep 
)

Function for clearing OUT endpoint to accept any new incoming traffic.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint identifier. Only OUT interrupt/bulk endpoints are accepted.

◆ nrf_usbd_epout_size_get()

NRF_STATIC_INLINE size_t nrf_usbd_epout_size_get ( NRF_USBD_Type const *  p_reg,
uint8_t  ep 
)

Function for getting the number of received bytes on the selected endpoint.

Note
This function can be used on bulk, interrupt, and isochronous endpoints.
For the function that returns different value for the ISOOUT zero transfer or no transfer at all, see the nrf_usbd_episoout_size_get function. This function will return 0 for both cases.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint identifier.
Returns
Number of received bytes.

◆ nrf_usbd_epstatus_clear()

NRF_STATIC_INLINE void nrf_usbd_epstatus_clear ( NRF_USBD_Type *  p_reg,
uint32_t  flags 
)

Function for clearing EPSTATUS register value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]flagsFlags defined in nrf_usbd_epstatus_mask_t.

◆ nrf_usbd_epstatus_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_epstatus_get ( NRF_USBD_Type const *  p_reg)

Function for getting EPSTATUS register value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Flag values defined in nrf_usbd_epstatus_mask_t.

◆ nrf_usbd_epstatus_get_and_clear()

NRF_STATIC_INLINE uint32_t nrf_usbd_epstatus_get_and_clear ( NRF_USBD_Type *  p_reg)

Function for getting and clearing EPSTATUS register value.

Function clears all flags in register set before returning its value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Flag values defined in nrf_usbd_epstatus_mask_t.

◆ nrf_usbd_event_address_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_event_address_get ( NRF_USBD_Type const *  p_reg,
nrf_usbd_event_t  event 
)

Function for returning the address of the specified USBD event register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent.
Returns
Address.

◆ nrf_usbd_event_check()

NRF_STATIC_INLINE bool nrf_usbd_event_check ( NRF_USBD_Type const *  p_reg,
nrf_usbd_event_t  event 
)

Function for retrieving the state of the USBD event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrf_usbd_event_clear()

NRF_STATIC_INLINE void nrf_usbd_event_clear ( NRF_USBD_Type *  p_reg,
nrf_usbd_event_t  event 
)

Function for clearing the specified event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent.

◆ nrf_usbd_event_get_and_clear()

NRF_STATIC_INLINE bool nrf_usbd_event_get_and_clear ( NRF_USBD_Type *  p_reg,
nrf_usbd_event_t  event 
)

Function for getting and clearing the state of the specified event.

This function checks the state of the event and clears it.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent.
Return values
trueThe event was set.
falseThe event was not set.

◆ nrf_usbd_eventcause_clear()

NRF_STATIC_INLINE void nrf_usbd_eventcause_clear ( NRF_USBD_Type *  p_reg,
uint32_t  flags 
)

Function for clearing the EVENTCAUSE flags.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]flagsFlags defined in nrf_usbd_eventcause_mask_t.

◆ nrf_usbd_eventcause_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_eventcause_get ( NRF_USBD_Type const *  p_reg)

Function for getting the EVENTCAUSE register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Flag values defined in nrf_usbd_eventcause_mask_t.

◆ nrf_usbd_eventcause_get_and_clear()

NRF_STATIC_INLINE uint32_t nrf_usbd_eventcause_get_and_clear ( NRF_USBD_Type *  p_reg)

Function for getting the EVENTCAUSE register and clearing flags that are set.

The safest way to return current EVENTCAUSE register. All the flags that are returned would be cleared inside EVENTCAUSE register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Flag values defined in nrf_usbd_eventcause_mask_t

◆ nrf_usbd_framecntr_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_framecntr_get ( NRF_USBD_Type const *  p_reg)

Function for getting current frame counter.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current frame counter.

◆ nrf_usbd_halted_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_halted_get ( NRF_USBD_Type const *  p_reg,
uint8_t  ep 
)

Function for getting the HALTEDEPIN register value.

Note
Use this function for the response for GetStatus() request to endpoint. To check whether the endpoint is stalled in the code, use nrf_usbd_ep_is_stall.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]epEndpoint number with IN or OUT flag.
Returns
The value of the HALTEDEPIN or HALTEDOUT register for the selected endpoint.

◆ nrf_usbd_int_disable()

NRF_STATIC_INLINE void nrf_usbd_int_disable ( NRF_USBD_Type *  p_reg,
uint32_t  mask 
)

Function for disabling the selected interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be disabled.

◆ nrf_usbd_int_enable()

NRF_STATIC_INLINE void nrf_usbd_int_enable ( NRF_USBD_Type *  p_reg,
uint32_t  mask 
)

Function for enabling the selected interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be enabled.

◆ nrf_usbd_int_enable_check()

NRF_STATIC_INLINE uint32_t nrf_usbd_int_enable_check ( NRF_USBD_Type const *  p_reg,
uint32_t  mask 
)

Function for checking if the specified interrupts are enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be checked.
Returns
Mask of enabled interrupts.

◆ nrf_usbd_int_enable_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_int_enable_get ( NRF_USBD_Type const *  p_reg)

Function for retrieving the information about the enabled interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
The flags of the enabled interrupts.

◆ nrf_usbd_isoinconfig_get()

NRF_STATIC_INLINE nrf_usbd_isoinconfig_t nrf_usbd_isoinconfig_get ( NRF_USBD_Type const *  p_reg)

Function for getting the cofiguration of ISO IN endpoint response to an IN token when no data is ready to be sent.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current configuration.

◆ nrf_usbd_isoinconfig_set()

NRF_STATIC_INLINE void nrf_usbd_isoinconfig_set ( NRF_USBD_Type *  p_reg,
nrf_usbd_isoinconfig_t  config 
)

Function for configuring ISO IN endpoint response to an IN token when no data is ready to be sent.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]configRequired configuration.

◆ nrf_usbd_isosplit_get()

NRF_STATIC_INLINE nrf_usbd_isosplit_t nrf_usbd_isosplit_get ( NRF_USBD_Type const *  p_reg)

Function for getting the isochronous buffer splitting configuration.

This function gets the current isochronous buffer splitting configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current configuration.

◆ nrf_usbd_isosplit_set()

NRF_STATIC_INLINE void nrf_usbd_isosplit_set ( NRF_USBD_Type *  p_reg,
nrf_usbd_isosplit_t  split 
)

Function for configuring the isochronous buffer splitting.

This function configures isochronous buffer splitting between IN and OUT endpoints.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]splitRequired configuration.

◆ nrf_usbd_lowpower_check()

NRF_STATIC_INLINE bool nrf_usbd_lowpower_check ( NRF_USBD_Type const *  p_reg)

Function for checking the state of the low power mode.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe USBD is in low power mode.
falseThe USBD is not in low power mode.

◆ nrf_usbd_lowpower_disable()

NRF_STATIC_INLINE void nrf_usbd_lowpower_disable ( NRF_USBD_Type *  p_reg)

Function for exiting from the USB low power mode.

After this function is called, the clock source for the USBD is connected internally. The NRF_USBD_EVENTCAUSE_WUREQ_MASK event will be generated and then the USBD registers can be accessed.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
See also
nrf_usbd_lowpower_enable
nrf_usbd_lowpower_check

◆ nrf_usbd_lowpower_enable()

NRF_STATIC_INLINE void nrf_usbd_lowpower_enable ( NRF_USBD_Type *  p_reg)

Function for entering into the USB low power mode.

After this function is called, the clock source from the USBD is disconnected internally. After this function is called, most of the USBD registers cannot be accessed anymore.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
See also
nrf_usbd_lowpower_disable
nrf_usbd_lowpower_check

◆ nrf_usbd_pullup_check()

NRF_STATIC_INLINE bool nrf_usbd_pullup_check ( NRF_USBD_Type const *  p_reg)

Function for returning the current the USB pullup state.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe USB pullup is enabled.
falseThe USB pullup is disabled.

◆ nrf_usbd_pullup_disable()

NRF_STATIC_INLINE void nrf_usbd_pullup_disable ( NRF_USBD_Type *  p_reg)

Function for disabling the USB pullup.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_usbd_pullup_enable()

NRF_STATIC_INLINE void nrf_usbd_pullup_enable ( NRF_USBD_Type *  p_reg)

Function for enabling the USB pullup.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_usbd_setup_bmrequesttype_get()

NRF_STATIC_INLINE uint8_t nrf_usbd_setup_bmrequesttype_get ( NRF_USBD_Type const *  p_reg)

Function for reading BMREQUESTTYPE - part of the SETUP packet.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Value of BREQUESTTYPE on the last received SETUP frame.

◆ nrf_usbd_setup_brequest_get()

NRF_STATIC_INLINE uint8_t nrf_usbd_setup_brequest_get ( NRF_USBD_Type const *  p_reg)

Function for reading BMREQUEST - part of the SETUP packet.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Value of BREQUEST on the last received SETUP frame.

◆ nrf_usbd_setup_windex_get()

NRF_STATIC_INLINE uint16_t nrf_usbd_setup_windex_get ( NRF_USBD_Type const *  p_reg)

Function for reading WINDEX - part of the SETUP packet.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Value of WINDEX on the last received SETUP frame.

◆ nrf_usbd_setup_wlength_get()

NRF_STATIC_INLINE uint16_t nrf_usbd_setup_wlength_get ( NRF_USBD_Type const *  p_reg)

Function for reading WLENGTH - part of the SETUP packet.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Value of WLENGTH on the last received SETUP frame.

◆ nrf_usbd_setup_wvalue_get()

NRF_STATIC_INLINE uint16_t nrf_usbd_setup_wvalue_get ( NRF_USBD_Type const *  p_reg)

Function for reading WVALUE - part of the SETUP packet.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Value of WVALUE on the last received SETUP frame.

◆ nrf_usbd_shorts_disable()

NRF_STATIC_INLINE void nrf_usbd_shorts_disable ( NRF_USBD_Type *  p_reg,
uint32_t  mask 
)

Function for clearing shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcut mask.

◆ nrf_usbd_shorts_enable()

NRF_STATIC_INLINE void nrf_usbd_shorts_enable ( NRF_USBD_Type *  p_reg,
uint32_t  mask 
)

Function for setting shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcut mask.

◆ nrf_usbd_shorts_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_shorts_get ( NRF_USBD_Type const *  p_reg)

Function for getting the shortcut mask.

Function returns shortcut register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Flags of the currently enabled shortcuts.

◆ nrf_usbd_task_address_get()

NRF_STATIC_INLINE uint32_t nrf_usbd_task_address_get ( NRF_USBD_Type const *  p_reg,
nrf_usbd_task_t  task 
)

Function for returning the address of the specified USBD task register.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask.
Returns
Task address.

◆ nrf_usbd_task_trigger()

NRF_STATIC_INLINE void nrf_usbd_task_trigger ( NRF_USBD_Type *  p_reg,
nrf_usbd_task_t  task 
)

Function for activating the specified USBD task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask to be activated.

Documentation feedback | Developer Zone | Subscribe | Updated