Interrupt Functions

group group_usbfs_dev_drv_functions_interrupts

The Functions Interrupt functions provide an API to register callbacks for interrupt events provided by the USB block, interrupt handler, and configuration functions.

Functions

void Cy_USBFS_Dev_Drv_Interrupt(USBFS_Type *base, uint32_t intrCause, cy_stc_usbfs_dev_drv_context_t *context)

Processes interrupt events generated by the USBFS Device.

The interrupts are mandatory for USBFS Device operation and this function must be called inside the user-defined interrupt service routine.

Parameters

__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetInterruptCauseHi (USBFS_Type const *base)

Returns the mask of bits showing the source of the current triggered interrupt.

This is useful for modes of operation where an interrupt can be generated by conditions in multiple interrupt source registers.

Return

The mask with the OR of the following conditions that have been triggered. See Interrupt Cause for the set of constants.

Parameters
  • base: The pointer to the USBFS instance.

__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetInterruptCauseMed (USBFS_Type const *base)

Returns the mask of bits showing the source of the current triggered interrupt.

This is useful for modes of operation where an interrupt can be generated by conditions in multiple interrupt source registers.

Return

The mask with the OR of the following conditions that have been triggered. See Interrupt Cause for the set of constants.

Parameters
  • base: The pointer to the USBFS instance.

__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetInterruptCauseLo (USBFS_Type const *base)

Returns the mask of bits showing the source of the current triggered interrupt.

This is useful for modes of operation where an interrupt can be generated by conditions in multiple interrupt source registers.

Return

The mask with the OR of the following conditions that have been triggered. See Interrupt Cause for the set of constants.

Parameters
  • base: The pointer to the USBFS instance.

void Cy_USBFS_Dev_Drv_RegisterServiceCallback(USBFS_Type const *base, cy_en_usb_dev_service_cb_t source, cy_cb_usbfs_dev_drv_callback_t callback, cy_stc_usbfs_dev_drv_context_t *context)

Registers a callback function to notify about service events (Bus Reset or Endpoint 0 communication) in Cy_USBFS_Dev_Drv_Interrupt.

To remove callback function, pass NULL as function pointer.

Return

The status code of the function execution cy_en_usbfs_dev_drv_status_t.

Parameters
  • base: The pointer to the USBFS instance.

  • source: The event that involves the callback.

  • callback: The pointer to a callback function.

  • context: The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

__STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterSofCallback (USBFS_Type *base, cy_cb_usbfs_dev_drv_callback_t callback, cy_stc_usbfs_dev_drv_context_t *context)

Registers a callback function to notify about an SOF event in Cy_USBFS_Dev_Drv_Interrupt.

The SOF interrupt source is enabled after registration. To remove callback function, pass NULL as the function pointer. When the callback is removed, the interrupt source is disabled.

note

To remove the callback, pass NULL as the pointer to a callback function.

Parameters
  • base: The pointer to the USBFS instance.

  • callback: The pointer to a callback function.

  • context: The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

__STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterLpmCallback (USBFS_Type *base, cy_cb_usbfs_dev_drv_callback_t callback, cy_stc_usbfs_dev_drv_context_t *context)

Registers a callback function to notify about an LPM event in Cy_USBFS_Dev_Drv_Interrupt.

The LPM interrupt source is enabled after registration. To remove the callback function, pass NULL as the function pointer. When the callback is removed, the interrupt source is disabled.

note

To remove the callback, pass NULL as the pointer to the callback function.

Parameters
  • base: The pointer to the USBFS instance.

  • callback: The pointer to a callback function.

  • context: The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

__STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterEndpointCallback (USBFS_Type const *base, uint32_t endpoint, cy_cb_usbfs_dev_drv_ep_callback_t callback, cy_stc_usbfs_dev_drv_context_t *context)

Registers a callback function to notify of an endpoint transfer completion event in Cy_USBFS_Dev_Drv_Interrupt.

  • IN endpoint - The Host read data from the endpoint and new data can be loaded.

  • OUT endpoint - The Host has written data into the endpoint and the data is ready to be read. To remove the callback function, pass NULL as function pointer.

note

To remove the callback, pass NULL as the pointer to the callback function.

Parameters
  • base: The pointer to the USBFS instance.

  • endpoint: The data endpoint number.

  • callback: The pointer to a callback function.

  • context: The pointer to the context structure cy_stc_usbfs_dev_drv_context_t allocated by the user. The structure is used during the USBFS Device operation for internal configuration and data retention. The user must not modify anything in this structure.

__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetInterruptsLevel (USBFS_Type *base, uint32_t intrLevel)

Writes INTR_LVL_SEL register which contains groups for all interrupt sources.

Parameters
  • base: The pointer to the USBFS instance.

  • intrLevel: INTR_LVL_SEL register value.

__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetInterruptsLevel (USBFS_Type const *base)

Returns the INTR_LVL_SEL register that contains groups for all interrupt sources.

Return

Returns the INTR_LVL_SEL register that contains groups for all interrupt sources.

Parameters
  • base: The pointer to the USBFS instance.

__STATIC_INLINE void Cy_USBFS_Dev_Drv_DisableEp0Interrupt (USBFS_Type *base)

Enables the Control Endpoint 0 interrupt source.

Parameters
  • base: The pointer to the USBFS instance.

__STATIC_INLINE void Cy_USBFS_Dev_Drv_EnableEp0Interrupt (USBFS_Type *base)

Enables the Control Endpoint 0 interrupt.

Parameters
  • base: The pointer to the USBFS instance source.