MTB CAT1 Peripheral driver library

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...
 
void Cy_SysInt_SetInterruptSource (IRQn_Type IRQn, cy_en_intr_t devIntrSrc)
 Configures the interrupt selection for the specified NVIC channel. More...
 
cy_en_intr_t Cy_SysInt_GetInterruptSource (IRQn_Type IRQn)
 Gets the interrupt source of the NVIC channel. More...
 
IRQn_Type Cy_SysInt_GetNvicConnection (cy_en_intr_t devIntrSrc)
 Gets the NVIC channel to which the interrupt source is connected. More...
 
cy_en_intr_t Cy_SysInt_GetInterruptActive (IRQn_Type IRQn)
 Gets the highest priority active interrupt for the selected NVIC channel. More...
 
void Cy_SysInt_DisconnectInterruptSource (IRQn_Type IRQn, cy_en_intr_t devIntrSrc)
 Disconnect the interrupt source from the specified NVIC channel. More...
 
cy_en_sysint_status_t Cy_SysInt_InitExtIRQ (const cy_stc_sysint_t *config, cy_israddress userIsr)
 Initializes the referenced external interrupt by setting the CPU IRQ priority and the interrupt vector. More...
 
cy_en_sysint_status_t Cy_SysInt_InitIntIRQ (const cy_stc_sysint_t *config, cy_israddress userIsr)
 Initializes the referenced internal interrupt by setting the priority and the interrupt vector. More...
 
void Cy_SysInt_SetSystemIrqVector (cy_en_intr_t sysIntSrc, cy_israddress userIsr)
 Sets the User ISR vector for the System Interrupt. More...
 
cy_israddress Cy_SysInt_GetSystemIrqVector (cy_en_intr_t sysIntSrc)
 Gets the address of the current user ISR vector for the System Interrupt. More...
 
void Cy_SysInt_EnableSystemInt (cy_en_intr_t sysIntSrc)
 Enable system interrupt. More...
 
void Cy_SysInt_DisableSystemInt (cy_en_intr_t sysIntSrc)
 Disable system interrupt. More...
 
void Cy_SysInt_SetNmiSource (cy_en_sysint_nmi_t nmiNum, cy_en_intr_t devIntrSrc)
 Sets the interrupt source of the CPU core NMI. More...
 
cy_en_intr_t Cy_SysInt_GetNmiSource (cy_en_sysint_nmi_t nmiNum)
 Gets the interrupt source of the CPU core NMI for the given NMI source number. 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.

In case of CM33 with Security Extension enabled, if this function is called from secure world then, the parameters are used to configure secure interrupt. If it is called form non-secure world then the parameters are used to configure non-secure interrupt. In case of CM33 without Security Extension, this function always configures the non-secure interrupt. In case of CM55, this function always configures the non-secure interrupt. In case of CM7/CM0+ it initializes the external system interrupt, maps it to CPU interrupt and registers the User ISR vector for the System Interrupt.

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
CM0+/CM4
The interrupt vector will be relocated only if the vector table was moved to __ramVectors in SRAM. Otherwise it is ignored.
CM33
The interrupt vector will be relocated only if the vector table was moved to __s_vector_table_rw and __ns_vector_table_rw for secure and non-secure world respectively.
CM55
The interrupt vector will be relocated only if the vector table was moved to __ns_vector_table_rw non-secure world.
Function Usage
/* Scenario: Vector table is relocated to RAM in __ramVectors[] */
/* Prototype of ISR function for port interrupt 0. For CY_IP_M7CPUSS port 21 is configured */
void Interrupt_Handler_Port0 (void);
/* Initialize the interrupt with vector at Interrupt_Handler_Port0() */
Cy_SysInt_Init(&intrCfg, &Interrupt_Handler_Port0);
/* Enable the interrupt */
#if (CY_IP_M7CPUSS)
NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
#else
NVIC_EnableIRQ(intrCfg.intrSrc);
#endif

◆ Cy_SysInt_SetVector()

cy_israddress Cy_SysInt_SetVector ( IRQn_Type  IRQn,
cy_israddress  userIsr 
)

Changes the ISR vector for the interrupt.

CM0+/CM4 (non-TVIIBE):
This function relies on the assumption that the vector table is relocated to __ramVectors[RAM_VECTORS_SIZE] in SRAM. Otherwise it will return the address of the default ISR location in the flash vector table.

CM0+/CM7 and TVIIBE CM0+/CM4:
This function relies on the assumption that the vector table is relocated to __ramVectors[RAM_VECTORS_SIZE] in SRAM. Otherwise it will return the address of the default ISR location in the flash vector table. This function is applicable only to User Interrupts (NvicMux0_IRQn - NvicMux7_IRQn) and System Interrupts (Internal0_IRQn - Internal0_IRQn).

CM33:
When called from secure world. this function relies on the assumption that the vector table is relocated to __s_vector_table_rw[] in secure SRAM. Otherwise it will return the address of the default ISR location in the secure flash/ROM vector table.

When called from non-secure world. this function relies on the assumption that the vector table is relocated to __ns_vector_table_rw[] in non-secure SRAM. Otherwise it will return the address of the default ISR location in the non-secure flash/ROM vector table.

CM55:
This function relies on the assumption that the vector table is relocated to __ns_vector_table_rw[] in non-secure SRAM. Otherwise it will return the address of the default ISR location in the non-secure flash/ROM vector table.

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

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.
In case of CM33 with Security Extension enabled, if this function is called from secure world then, it sets the interrupt vector for the secure world. If it is called form non-secure world then it sets the interrupt vector for the non-secure world.
Function Usage
/* Scenario: Vector table is relocated to RAM in __ramVectors[]. 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.

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

CM0+/CM7:
This function relies on the assumption that the vector table is relocated to __ramVectors[RAM_VECTORS_SIZE] in SRAM. Otherwise it will return the address of the default ISR location in the flash vector table. This function is applicable only to User Interrupts (NvicMux0_IRQn - NvicMux7_IRQn) and System Interrupts (Internal0_IRQn - Internal0_IRQn).

CM33:
When called from the secure world, this function relies on the assumption that the vector table is relocated to __ns_vector_table_rw[] in non-secure SRAM. Otherwise it will return the address of the default ISR location in the flash/ROM vector table.

CM55:
This function relies on the assumption that the vector table is relocated to __ns_vector_table_rw[] in non-secure SRAM. Otherwise it will return the address of the default ISR location in the flash/ROM vector table.

Parameters
IRQnInterrupt source
Returns
Address of the ISR in the interrupt vector table
Note
CM0+:
This function returns the interrupt vector for the interrupt channel on the NVIC.
CM33:
In case of CM33 with Security Extension enabled, if this function is called from secure world then, it returns the interrupt vector for the secure world. If it is called form non-secure world then it returns the interrupt vector for the non-secure world.
Function Usage
/* Scenario: Vector table is relocated to RAM in __ramVectors[]. 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_SetInterruptSource()

void Cy_SysInt_SetInterruptSource ( IRQn_Type  IRQn,
cy_en_intr_t  devIntrSrc 
)

Configures the interrupt selection for the specified NVIC channel.

To disconnect the interrupt source from the NVIC channel use the Cy_SysInt_DisconnectInterruptSource.

Parameters
IRQnNVIC channel number connected to the CPU core.
devIntrSrcDevice interrupt to be routed to the NVIC channel.
Note
This function is available for CM0+/CM7 core only.
Function Usage
/* Scenario: Reconfigure the interrupt source of the NVIC input on the CM0+
core at run-time. The interrupt was initialized with the
"intrCfg" configuration struct. */
#if (CY_IP_M4CPUSS_VERSION == 1)
if(disconnected_IRQn == Cy_SysInt_GetInterruptSource(intrCfg.intrSrc))
#else /* CY_IP_M4CPUSS_VERSION == 2 */
if(unconnected_IRQn == Cy_SysInt_GetNvicConnection(intrCfg.cm0pSrc))
#endif /* CY_IP_M4CPUSS_VERSION */
{
/* Set the interrupt source for intrCfg.intrSrc on CM0+ */
Cy_SysInt_SetInterruptSource(intrCfg.intrSrc, intrCfg.cm0pSrc);
}

◆ Cy_SysInt_GetInterruptSource()

cy_en_intr_t Cy_SysInt_GetInterruptSource ( IRQn_Type  IRQn)

Gets the interrupt source of the NVIC channel.

Parameters
IRQnNVIC channel number connected to the CPU core
Returns
Device interrupt connected to the NVIC channel. A returned value of "disconnected_IRQn" indicates that the interrupt source is disconnected.
Note
This function is available for CM0+ core only.
This function supports only devices using CPUSS_ver1. For all other devices, use the Cy_SysInt_GetNvicConnection() function.
Function Usage
/* Scenario: Reconfigure the interrupt source of the NVIC input on the CM0+
core at run-time. The interrupt was initialized with the
"intrCfg" configuration struct. */
#if (CY_IP_M4CPUSS_VERSION == 1)
if(disconnected_IRQn == Cy_SysInt_GetInterruptSource(intrCfg.intrSrc))
#else /* CY_IP_M4CPUSS_VERSION == 2 */
if(unconnected_IRQn == Cy_SysInt_GetNvicConnection(intrCfg.cm0pSrc))
#endif /* CY_IP_M4CPUSS_VERSION */
{
/* Set the interrupt source for intrCfg.intrSrc on CM0+ */
Cy_SysInt_SetInterruptSource(intrCfg.intrSrc, intrCfg.cm0pSrc);
}

◆ Cy_SysInt_GetNvicConnection()

IRQn_Type Cy_SysInt_GetNvicConnection ( cy_en_intr_t  devIntrSrc)

Gets the NVIC channel to which the interrupt source is connected.

Parameters
devIntrSrcDevice interrupt that is potentially connected to the NVIC channel.
Returns
NVIC channel number connected to the CPU core. A returned value of "unconnected_IRQn" indicates that the interrupt source is disabled.
Note
This function is available for CM0+/CM7 core only.
This function supports only devices using CPUSS_ver2 or higher.
Function Usage
/* Scenario: Reconfigure the interrupt source of the NVIC input on the CM0+
core at run-time. The interrupt was initialized with the
"intrCfg" configuration struct. */
#if (CY_IP_M4CPUSS_VERSION == 1)
if(disconnected_IRQn == Cy_SysInt_GetInterruptSource(intrCfg.intrSrc))
#else /* CY_IP_M4CPUSS_VERSION == 2 */
if(unconnected_IRQn == Cy_SysInt_GetNvicConnection(intrCfg.cm0pSrc))
#endif /* CY_IP_M4CPUSS_VERSION */
{
/* Set the interrupt source for intrCfg.intrSrc on CM0+ */
Cy_SysInt_SetInterruptSource(intrCfg.intrSrc, intrCfg.cm0pSrc);
}

◆ Cy_SysInt_GetInterruptActive()

cy_en_intr_t Cy_SysInt_GetInterruptActive ( IRQn_Type  IRQn)

Gets the highest priority active interrupt for the selected NVIC channel.

The priority of the interrupt in a given channel is determined by the index value of the interrupt in the cy_en_intr_t enum. The lower the index, the higher the priority. E.g. Consider a case where an interrupt source with value 29 and an interrupt source with value 46 both source the same NVIC channel. If both are active (triggered) at the same time, calling Cy_SysInt_GetInterruptActive() will return 29 as the active interrupt.

Parameters
IRQnNVIC channel number connected to the CPU core
Returns
Device interrupt connected to the NVIC channel. A returned value of "disconnected_IRQn" indicates that there are no active (pending) interrupts on this NVIC channel.
Note
This function is available for CM0+/CM7 core only.
This function supports only devices using CPUSS_ver2 or higher.
Function Usage
/* Scenario: Inside the interrupt service routine for NvicMux7_IRQn: */
if (intrCfg.cm0pSrc == Cy_SysInt_GetInterruptActive(intrCfg.intrSrc))
{
/* Handle the ioss_interrupts_gpio_0_IRQn interrupt */
}

◆ Cy_SysInt_DisconnectInterruptSource()

void Cy_SysInt_DisconnectInterruptSource ( IRQn_Type  IRQn,
cy_en_intr_t  devIntrSrc 
)

Disconnect the interrupt source from the specified NVIC channel.

Parameters
IRQnNVIC channel number connected to the CPU core. This parameter is ignored for devices using CPUSS_ver2.
devIntrSrcDevice interrupt routed to the NVIC channel. This parameter is ignored for devices using CPUSS_ver1.
Note
This function is available for CM0+ core only.
Function Usage
/* Scenario: Disconnect the previously connected interrupt source */
Cy_SysInt_DisconnectInterruptSource(intrCfg.intrSrc, intrCfg.cm0pSrc);

◆ Cy_SysInt_InitExtIRQ()

cy_en_sysint_status_t Cy_SysInt_InitExtIRQ ( const cy_stc_sysint_t config,
cy_israddress  userIsr 
)

Initializes the referenced external interrupt by setting the CPU IRQ 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
Note
This function is available for CAT1C CM0/CM7 cores, and CAT1A TVIIBE CM0/CM4 cores.
Returns
Initialization status
Note
CM0+/CM7
The interrupt vector will be relocated only if the vector table was moved to __ramVectors in SRAM. Otherwise it is ignored.

◆ Cy_SysInt_InitIntIRQ()

cy_en_sysint_status_t Cy_SysInt_InitIntIRQ ( const cy_stc_sysint_t config,
cy_israddress  userIsr 
)

Initializes the referenced internal 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
Note
This function is available for CAT1C CM0/CM7 cores, and CAT1A TVIIBE CM0/CM4 cores.
Returns
Initialization status
Note
CM0+/CM7
The interrupt vector will be relocated only if the vector table was moved to __ramVectors in SRAM. Otherwise it is ignored.

◆ Cy_SysInt_SetSystemIrqVector()

void Cy_SysInt_SetSystemIrqVector ( cy_en_intr_t  sysIntSrc,
cy_israddress  userIsr 
)

Sets the User ISR vector for the System Interrupt.

Parameters
sysIntSrcInterrupt source
Note
This function is available for CAT1C CM0/CM7 cores.
Parameters
userIsrAddress of the ISR to set in the interrupt vector table
Returns
none

◆ Cy_SysInt_GetSystemIrqVector()

cy_israddress Cy_SysInt_GetSystemIrqVector ( cy_en_intr_t  sysIntSrc)

Gets the address of the current user ISR vector for the System Interrupt.

Parameters
sysIntSrcInterrupt source
Note
This function is available for CAT1C CM0/CM7 cores.
Returns
Address of the ISR in the interrupt vector table

◆ Cy_SysInt_EnableSystemInt()

void Cy_SysInt_EnableSystemInt ( cy_en_intr_t  sysIntSrc)

Enable system interrupt.

Parameters
sysIntSrcSystem interrupt source to be enabled.
Note
This function is available for CAT1C CM0/CM7 cores, and CAT1A TVIIBE CM0/CM4 cores.
Returns
none

◆ Cy_SysInt_DisableSystemInt()

void Cy_SysInt_DisableSystemInt ( cy_en_intr_t  sysIntSrc)

Disable system interrupt.

Parameters
sysIntSrcSystem interrupt source to be disabled.
Note
This function is available for CAT1C CM0/CM7 cores, and CAT1A TVIIBE CM0/CM4 cores.
Returns
none

◆ Cy_SysInt_SetNmiSource()

void Cy_SysInt_SetNmiSource ( cy_en_sysint_nmi_t  nmiNum,
cy_en_intr_t  devIntrSrc 
)

Sets the interrupt source of the CPU core NMI.

The interrupt source must be a positive number. Setting the value to "unconnected_IRQn" or "disconnected_IRQn" disconnects the interrupt source from the NMI. Depending on the device, the number of interrupt sources that can provide the NMI trigger signal to the core can vary.

Parameters
nmiNumNMI source number. CPUSS_ver2 allows up to 4 sources to trigger the core NMI. CPUSS_ver1 allows only one source to trigger the core NMI and the specified NMI number is ignored.
devIntrSrcInterrupt source. This parameter can either be of type cy_en_intr_t or IRQn_Type for CM0+/CM7 and CM4/CM33/CM55 respectively.
Note
CM0+ may call this function only at PC=0, CM4 may set its NMI handler at any PC.
The CM0+ NMI is used for performing system calls that execute out of ROM.
Function Usage
/* Scenario: Set the NMI trigger source for the processor of interest. The
interrupt was initialized with the "intrCfg" configuration struct. */
#if (CY_CPU_CORTEX_M0P)
if(disconnected_IRQn == Cy_SysInt_GetNmiSource(CY_SYSINT_NMI1))
#else /* CM4 */
if(unconnected_IRQn == Cy_SysInt_GetNmiSource(CY_SYSINT_NMI1))
#endif /* CY_CPU_CORTEX_M0P */
{
/* Set the NMI source to GPIO port 0 interrupt */
Cy_SysInt_SetNmiSource(CY_SYSINT_NMI1, ioss_interrupts_gpio_0_IRQn);
}

◆ Cy_SysInt_GetNmiSource()

cy_en_intr_t Cy_SysInt_GetNmiSource ( cy_en_sysint_nmi_t  nmiNum)

Gets the interrupt source of the CPU core NMI for the given NMI source number.

Parameters
nmiNumNMI source number. CPUSS_ver2 allows up to 4 sources to trigger the core NMI (i.e. #1, 2, 3, 4). CPUSS_ver1 allows only 1 source to trigger the core NMI (i.e #1).
Returns
Interrupt Source. This parameter can either be of type cy_en_intr_t or IRQn_Type for CM0+/CM7 and CM4/CM33/CM55 respectively.
Function Usage
/* Scenario: Set the NMI trigger source for the processor of interest. The
interrupt was initialized with the "intrCfg" configuration struct. */
#if (CY_CPU_CORTEX_M0P)
if(disconnected_IRQn == Cy_SysInt_GetNmiSource(CY_SYSINT_NMI1))
#else /* CM4 */
if(unconnected_IRQn == Cy_SysInt_GetNmiSource(CY_SYSINT_NMI1))
#endif /* CY_CPU_CORTEX_M0P */
{
/* Set the NMI source to GPIO port 0 interrupt */
Cy_SysInt_SetNmiSource(CY_SYSINT_NMI1, ioss_interrupts_gpio_0_IRQn);
}