PSoC 6 Peripheral Driver Library

General Description

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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE void Cy_USBFS_Dev_Drv_DisableEp0Interrupt (USBFS_Type *base)
 Enables the Control Endpoint 0 interrupt source. More...
 
__STATIC_INLINE void Cy_USBFS_Dev_Drv_EnableEp0Interrupt (USBFS_Type *base)
 Enables the Control Endpoint 0 interrupt. More...
 

Function Documentation

◆ Cy_USBFS_Dev_Drv_Interrupt()

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
baseThe pointer to the USBFS instance.
intrCauseThe interrupt cause register value. Call appropriate function to get interrupt cause (Low, Medium or High):
contextThe 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.

◆ Cy_USBFS_Dev_Drv_GetInterruptCauseHi()

__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.

Parameters
baseThe pointer to the USBFS instance.
Returns
The mask with the OR of the following conditions that have been triggered. See Interrupt Cause for the set of constants.

◆ Cy_USBFS_Dev_Drv_GetInterruptCauseMed()

__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.

Parameters
baseThe pointer to the USBFS instance.
Returns
The mask with the OR of the following conditions that have been triggered. See Interrupt Cause for the set of constants.

◆ Cy_USBFS_Dev_Drv_GetInterruptCauseLo()

__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.

Parameters
baseThe pointer to the USBFS instance.
Returns
The mask with the OR of the following conditions that have been triggered. See Interrupt Cause for the set of constants.

◆ Cy_USBFS_Dev_Drv_RegisterServiceCallback()

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.

Parameters
baseThe pointer to the USBFS instance.
sourceThe event that involves the callback.
callbackThe pointer to a callback function.
contextThe 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.
Returns
The status code of the function execution cy_en_usbfs_dev_drv_status_t.

◆ Cy_USBFS_Dev_Drv_RegisterSofCallback()

__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.

Parameters
baseThe pointer to the USBFS instance.
callbackThe pointer to a callback function.
contextThe 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.
Note
To remove the callback, pass NULL as the pointer to a callback function.

◆ Cy_USBFS_Dev_Drv_RegisterLpmCallback()

__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.

Parameters
baseThe pointer to the USBFS instance.
callbackThe pointer to a callback function.
contextThe 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.
Note
To remove the callback, pass NULL as the pointer to the callback function.

◆ Cy_USBFS_Dev_Drv_RegisterEndpointCallback()

__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.
Parameters
baseThe pointer to the USBFS instance.
endpointThe data endpoint number.
callbackThe pointer to a callback function.
contextThe 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.
Note
To remove the callback, pass NULL as the pointer to the callback function.

◆ Cy_USBFS_Dev_Drv_SetInterruptsLevel()

__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
baseThe pointer to the USBFS instance.
intrLevelINTR_LVL_SEL register value.

◆ Cy_USBFS_Dev_Drv_GetInterruptsLevel()

__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.

Parameters
baseThe pointer to the USBFS instance.
Returns
Returns the INTR_LVL_SEL register that contains groups for all interrupt sources.

◆ Cy_USBFS_Dev_Drv_DisableEp0Interrupt()

__STATIC_INLINE void Cy_USBFS_Dev_Drv_DisableEp0Interrupt ( USBFS_Type *  base)

Enables the Control Endpoint 0 interrupt source.

Parameters
baseThe pointer to the USBFS instance.

◆ Cy_USBFS_Dev_Drv_EnableEp0Interrupt()

__STATIC_INLINE void Cy_USBFS_Dev_Drv_EnableEp0Interrupt ( USBFS_Type *  base)

Enables the Control Endpoint 0 interrupt.

Parameters
baseThe pointer to the USBFS instance source.