PSoC 4 Peripheral Driver Library - Alpha

General Description

Functions

cy_en_sysint_status_t Cy_SysInt_Init (const cy_stc_sysint_t *config, cy_israddress userIsr)
 Initializes the referenced interrupt by setting the priority and the interrupt vector. More...
 
cy_israddress Cy_SysInt_SetVector (IRQn_Type IRQn, cy_israddress userIsr)
 Changes the ISR vector for the interrupt. More...
 
cy_israddress Cy_SysInt_GetVector (IRQn_Type IRQn)
 Gets the address of the current ISR vector for the interrupt. More...
 

Function Documentation

◆ Cy_SysInt_Init()

cy_en_sysint_status_t Cy_SysInt_Init ( const cy_stc_sysint_t config,
cy_israddress  userIsr 
)

Initializes the referenced interrupt by setting the priority and the interrupt vector.

Use the CMSIS core function NVIC_EnableIRQ(config.intrSrc) to enable the interrupt.

Parameters
configInterrupt configuration structure
userIsrAddress of the ISR
Returns
Initialization status
Note
The interrupt vector will be relocated only if the vector table was moved to __RAM_VECTOR_TABLE in SRAM. Otherwise it is ignored.
Function Usage
/* Scenario: Vector table is relocated to RAM in __RAM_VECTOR_TABLE[] */
/* Prototype of ISR function for port interrupt 0 */
void Interrupt_Handler_Port0 (void);
cy_stc_sysint_t intrCfg =
{
/*.intrSrc =*/ ioss_interrupts_gpio_0_IRQn, /* Interrupt source is GPIO port 0 interrupt */
/*.intrPriority =*/ 3UL /* Interrupt priority is 3 */
};
/* Initialize the interrupt with vector at Interrupt_Handler_Port0() */
Cy_SysInt_Init(&intrCfg, &Interrupt_Handler_Port0);
/* Enable the interrupt */
NVIC_EnableIRQ(intrCfg.intrSrc);

◆ Cy_SysInt_SetVector()

cy_israddress Cy_SysInt_SetVector ( IRQn_Type  IRQn,
cy_israddress  userIsr 
)

Changes the ISR vector for the interrupt.

This function relies on the assumption that the vector table is relocated to __RAM_VECTOR_TABLE[RAM_VECTORS_SIZE] in SRAM. Otherwise it will return the address of the default ISR location in the flash vector table.

Parameters
IRQnInterrupt source
userIsrAddress of the ISR to set in the interrupt vector table
Returns
Previous address of the ISR in the interrupt vector table
Note
For CM0+, this function sets the interrupt vector for the interrupt channel on the NVIC.
Function Usage
/* Scenario: Vector table is relocated to RAM in __RAM_VECTOR_TABLE[]. The interrupt
was initialized with the "intrCfg" configuration struct. */
/* Prototype of ISR function for port interrupt 0 */
void Interrupt_Handler_Port0 (void);
if(&Interrupt_Handler_Port0 != Cy_SysInt_GetVector(intrCfg.intrSrc))
{
/* Set the port0 interrupt vector to be at Interrupt_Handler_Port0() */
(void)Cy_SysInt_SetVector(intrCfg.intrSrc, &Interrupt_Handler_Port0);
}

◆ Cy_SysInt_GetVector()

cy_israddress Cy_SysInt_GetVector ( IRQn_Type  IRQn)

Gets the address of the current ISR vector for the interrupt.

This function relies on the assumption that the vector table is relocated to __RAM_VECTOR_TABLE[RAM_VECTORS_SIZE] in SRAM. Otherwise it will return the address of the default ISR location in the flash vector table.

Parameters
IRQnInterrupt source
Returns
Address of the ISR in the interrupt vector table
Note
For CM0+, this function returns the interrupt vector for the interrupt channel on the NVIC.
Function Usage
/* Scenario: Vector table is relocated to RAM in __RAM_VECTOR_TABLE[]. The interrupt
was initialized with the "intrCfg" configuration struct. */
/* Prototype of ISR function for port interrupt 0 */
void Interrupt_Handler_Port0 (void);
if(&Interrupt_Handler_Port0 != Cy_SysInt_GetVector(intrCfg.intrSrc))
{
/* Set the port0 interrupt vector to be at Interrupt_Handler_Port0() */
(void)Cy_SysInt_SetVector(intrCfg.intrSrc, &Interrupt_Handler_Port0);
}