MTB CAT1 Peripheral driver library

General Description

Functions

cy_en_SysFault_status_t Cy_SysFault_Init (FAULT_STRUCT_Type *base, cy_stc_SysFault_t *config)
 Initializes the SysFault for recording faults. More...
 
void Cy_SysFault_ClearStatus (FAULT_STRUCT_Type *base)
 Clears status register. More...
 
cy_en_SysFault_source_t Cy_SysFault_GetErrorSource (FAULT_STRUCT_Type *base)
 Returns the source of error for the Fault. More...
 
uint32_t Cy_SysFault_GetFaultData (FAULT_STRUCT_Type *base, cy_en_SysFault_Data_t dataSet)
 Returns the Fault information for the provided dataSet. More...
 
uint32_t Cy_SysFault_GetPendingFault (FAULT_STRUCT_Type *base, cy_en_SysFault_Set_t pendingFault)
 Returns the sources of pending fault that are not captured. More...
 
void Cy_SysFault_SetMaskByIdx (FAULT_STRUCT_Type *base, cy_en_SysFault_source_t idx)
 Enable the Fault to be captured. More...
 
void Cy_SysFault_ClearMaskByIdx (FAULT_STRUCT_Type *base, cy_en_SysFault_source_t idx)
 Disable the faults to be captured. More...
 
uint32_t Cy_SysFault_GetInterruptStatus (FAULT_STRUCT_Type *base)
 Returns the status of the interrupt. More...
 
void Cy_SysFault_ClearInterrupt (FAULT_STRUCT_Type *base)
 Clears Active Interrupt Source. More...
 
void Cy_SysFault_SetInterrupt (FAULT_STRUCT_Type *base)
 Triggers an interrupt via a software write. More...
 
void Cy_SysFault_SetInterruptMask (FAULT_STRUCT_Type *base)
 Sets an interrupt mask. More...
 
void Cy_SysFault_ClearInterruptMask (FAULT_STRUCT_Type *base)
 Clears an interrupt mask. More...
 
uint32_t Cy_SysFault_GetInterruptMask (FAULT_STRUCT_Type *base)
 Returns the interrupt mask. More...
 
uint32_t Cy_SysFault_GetInterruptStatusMasked (FAULT_STRUCT_Type *base)
 Returns whether masked interrupt triggered the interrupt. More...
 

Function Documentation

◆ Cy_SysFault_Init()

cy_en_SysFault_status_t Cy_SysFault_Init ( FAULT_STRUCT_Type *  base,
cy_stc_SysFault_t config 
)

Initializes the SysFault for recording faults.

Parameters
baseThe pointer to a Fault structure instance.
configThe pointer to a Configuration structure.
Returns
Fault status. Refer cy_en_SysFault_status_t
Function Usage
/* Scenario: Configures the SysFault for recording faults. */
/* Fault config */
{
.ResetEnable = false,
.OutputEnable = true,
.TriggerEnable = false,
};
/* Configure Interrupt for Fault structure */
cy_stc_sysint_t IRQ_cfg =
{
.intrSrc = ((NvicMux3_IRQn << CY_SYSINT_INTRSRC_MUXIRQ_SHIFT) | cpuss_interrupts_fault_0_IRQn), /* Bit 0-15 of intrSrc is used to store system interrupt value and bit 16-31 to store CPU IRQ value */
.intrPriority = 2UL
};
/*********************************************************************/
/***** Fault report settings *****/
/*********************************************************************/
Cy_SysFault_ClearStatus(FAULT_STRUCT0); // clear status
Cy_SysFault_SetMaskByIdx(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); // enable Fault MCWDT #0
cy_en_SysFault_status_t status = Cy_SysFault_Init(FAULT_STRUCT0, &config);
/*********************************************************************/
/***** Interrupt settings *****/
/*********************************************************************/
Cy_SysInt_Init(&IRQ_cfg, &irqFaultHandler);
NVIC_SetPriority((IRQn_Type) NvicMux3_IRQn, 2UL);
NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
/* Triggers an interrupt via a software write.*/
Cy_SysFault_SetInterrupt(FAULT_STRUCT0);

◆ Cy_SysFault_ClearStatus()

void Cy_SysFault_ClearStatus ( FAULT_STRUCT_Type *  base)

Clears status register.

Parameters
baseThe pointer to a Fault structure instance.
Function Usage
/* Scenario: Configures the SysFault for recording faults. */
/* Fault config */
{
.ResetEnable = false,
.OutputEnable = true,
.TriggerEnable = false,
};
/* Configure Interrupt for Fault structure */
cy_stc_sysint_t IRQ_cfg =
{
.intrSrc = ((NvicMux3_IRQn << CY_SYSINT_INTRSRC_MUXIRQ_SHIFT) | cpuss_interrupts_fault_0_IRQn), /* Bit 0-15 of intrSrc is used to store system interrupt value and bit 16-31 to store CPU IRQ value */
.intrPriority = 2UL
};
/*********************************************************************/
/***** Fault report settings *****/
/*********************************************************************/
Cy_SysFault_ClearStatus(FAULT_STRUCT0); // clear status
Cy_SysFault_SetMaskByIdx(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); // enable Fault MCWDT #0
cy_en_SysFault_status_t status = Cy_SysFault_Init(FAULT_STRUCT0, &config);
/*********************************************************************/
/***** Interrupt settings *****/
/*********************************************************************/
Cy_SysInt_Init(&IRQ_cfg, &irqFaultHandler);
NVIC_SetPriority((IRQn_Type) NvicMux3_IRQn, 2UL);
NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
/* Triggers an interrupt via a software write.*/
Cy_SysFault_SetInterrupt(FAULT_STRUCT0);

◆ Cy_SysFault_GetErrorSource()

cy_en_SysFault_source_t Cy_SysFault_GetErrorSource ( FAULT_STRUCT_Type *  base)

Returns the source of error for the Fault.

Parameters
baseThe pointer to a Fault structure instance.
Returns
Fault source.
Function Usage
/* Scenario: Handle the faults generated and get the fault data. */
/* Returns the status of the interrupt for the fault structure */
uint32_t intrSource = Cy_SysFault_GetInterruptStatus(FAULT_STRUCT0);
/* Returns the interrupt mask. */
uint32_t intrMskStatus =Cy_SysFault_GetInterruptMask(FAULT_STRUCT0);
/* Returns whether masked interrupt and triggered the interrupt are same. */
uint32_t intrMskdStatus = Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT0);
cy_en_SysFault_source_t status = Cy_SysFault_GetErrorSource(FAULT_STRUCT0);
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0) // MCWDT0 fault
{
Cy_SysFault_GetFaultData(FAULT_STRUCT0, CY_SYSFAULT_DATA0); //Get fault data
}
}
/* Clears an interrupt mask.*/
/* Clear Interrupt flag */

◆ Cy_SysFault_GetFaultData()

uint32_t Cy_SysFault_GetFaultData ( FAULT_STRUCT_Type *  base,
cy_en_SysFault_Data_t  dataSet 
)

Returns the Fault information for the provided dataSet.

Parameters
baseThe pointer to a Fault structure instance.
dataSetInstance of data register.
Returns
Fault information.
Function Usage
/* Scenario: Handle the faults generated and get the fault data. */
/* Returns the status of the interrupt for the fault structure */
uint32_t intrSource = Cy_SysFault_GetInterruptStatus(FAULT_STRUCT0);
/* Returns the interrupt mask. */
uint32_t intrMskStatus =Cy_SysFault_GetInterruptMask(FAULT_STRUCT0);
/* Returns whether masked interrupt and triggered the interrupt are same. */
uint32_t intrMskdStatus = Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT0);
cy_en_SysFault_source_t status = Cy_SysFault_GetErrorSource(FAULT_STRUCT0);
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0) // MCWDT0 fault
{
Cy_SysFault_GetFaultData(FAULT_STRUCT0, CY_SYSFAULT_DATA0); //Get fault data
}
}
/* Clears an interrupt mask.*/
/* Clear Interrupt flag */

◆ Cy_SysFault_GetPendingFault()

uint32_t Cy_SysFault_GetPendingFault ( FAULT_STRUCT_Type *  base,
cy_en_SysFault_Set_t  pendingFault 
)

Returns the sources of pending fault that are not captured.

Parameters
baseThe pointer to a Fault structure instance.
pendingFaultInstance of PENDING register. PENDING0 returns the occurred pending Faults in the range of 0-31 Fault ID.
Returns
The status of pending Faults.
Function Usage
/* Scenario: Capture the Faults that are triggered and not enabled. */
/* Fault config */
{
.ResetEnable = false,
.OutputEnable = true,
.TriggerEnable = false,
};
/*********************************************************************/
/***** Fault report settings *****/
/*********************************************************************/
Cy_SysFault_ClearStatus(FAULT_STRUCT0); // clear status
Cy_SysFault_ClearMaskByIdx(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); // Clear fault Id mask. To keep the fault in pending state
cy_en_SysFault_status_t status = Cy_SysFault_Init(FAULT_STRUCT0, &config);
uint32_t faultIdSet = Cy_SysFault_GetPendingFault(FAULT_STRUCT0, CY_SYSFAULT_SET0);

◆ Cy_SysFault_SetMaskByIdx()

void Cy_SysFault_SetMaskByIdx ( FAULT_STRUCT_Type *  base,
cy_en_SysFault_source_t  idx 
)

Enable the Fault to be captured.

Parameters
baseThe pointer to a Fault structure instance.
idxThe Fault id to be set in the mask register.
Returns
None.
Function Usage
/* Scenario: Configures the SysFault for recording faults. */
/* Fault config */
{
.ResetEnable = false,
.OutputEnable = true,
.TriggerEnable = false,
};
/* Configure Interrupt for Fault structure */
cy_stc_sysint_t IRQ_cfg =
{
.intrSrc = ((NvicMux3_IRQn << CY_SYSINT_INTRSRC_MUXIRQ_SHIFT) | cpuss_interrupts_fault_0_IRQn), /* Bit 0-15 of intrSrc is used to store system interrupt value and bit 16-31 to store CPU IRQ value */
.intrPriority = 2UL
};
/*********************************************************************/
/***** Fault report settings *****/
/*********************************************************************/
Cy_SysFault_ClearStatus(FAULT_STRUCT0); // clear status
Cy_SysFault_SetMaskByIdx(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); // enable Fault MCWDT #0
cy_en_SysFault_status_t status = Cy_SysFault_Init(FAULT_STRUCT0, &config);
/*********************************************************************/
/***** Interrupt settings *****/
/*********************************************************************/
Cy_SysInt_Init(&IRQ_cfg, &irqFaultHandler);
NVIC_SetPriority((IRQn_Type) NvicMux3_IRQn, 2UL);
NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
/* Triggers an interrupt via a software write.*/
Cy_SysFault_SetInterrupt(FAULT_STRUCT0);

◆ Cy_SysFault_ClearMaskByIdx()

void Cy_SysFault_ClearMaskByIdx ( FAULT_STRUCT_Type *  base,
cy_en_SysFault_source_t  idx 
)

Disable the faults to be captured.

Parameters
baseThe pointer to a Fault structure instance.
idxThe fault id to be cleared in the mask register.
Returns
None.
Function Usage
/* Scenario: Capture the Faults that are triggered and not enabled. */
/* Fault config */
{
.ResetEnable = false,
.OutputEnable = true,
.TriggerEnable = false,
};
/*********************************************************************/
/***** Fault report settings *****/
/*********************************************************************/
Cy_SysFault_ClearStatus(FAULT_STRUCT0); // clear status
Cy_SysFault_ClearMaskByIdx(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); // Clear fault Id mask. To keep the fault in pending state
cy_en_SysFault_status_t status = Cy_SysFault_Init(FAULT_STRUCT0, &config);
uint32_t faultIdSet = Cy_SysFault_GetPendingFault(FAULT_STRUCT0, CY_SYSFAULT_SET0);

◆ Cy_SysFault_GetInterruptStatus()

uint32_t Cy_SysFault_GetInterruptStatus ( FAULT_STRUCT_Type *  base)

Returns the status of the interrupt.

Parameters
baseThe pointer to a Fault structure instance.
Returns
Interrupt status.
Function Usage
/* Scenario: Handle the faults generated and get the fault data. */
/* Returns the status of the interrupt for the fault structure */
uint32_t intrSource = Cy_SysFault_GetInterruptStatus(FAULT_STRUCT0);
/* Returns the interrupt mask. */
uint32_t intrMskStatus =Cy_SysFault_GetInterruptMask(FAULT_STRUCT0);
/* Returns whether masked interrupt and triggered the interrupt are same. */
uint32_t intrMskdStatus = Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT0);
cy_en_SysFault_source_t status = Cy_SysFault_GetErrorSource(FAULT_STRUCT0);
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0) // MCWDT0 fault
{
Cy_SysFault_GetFaultData(FAULT_STRUCT0, CY_SYSFAULT_DATA0); //Get fault data
}
}
/* Clears an interrupt mask.*/
/* Clear Interrupt flag */

◆ Cy_SysFault_ClearInterrupt()

void Cy_SysFault_ClearInterrupt ( FAULT_STRUCT_Type *  base)

Clears Active Interrupt Source.

Parameters
baseThe pointer to a Fault structure instance.
Returns
None.
Function Usage
/* Scenario: Handle the faults generated and get the fault data. */
/* Returns the status of the interrupt for the fault structure */
uint32_t intrSource = Cy_SysFault_GetInterruptStatus(FAULT_STRUCT0);
/* Returns the interrupt mask. */
uint32_t intrMskStatus =Cy_SysFault_GetInterruptMask(FAULT_STRUCT0);
/* Returns whether masked interrupt and triggered the interrupt are same. */
uint32_t intrMskdStatus = Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT0);
cy_en_SysFault_source_t status = Cy_SysFault_GetErrorSource(FAULT_STRUCT0);
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0) // MCWDT0 fault
{
Cy_SysFault_GetFaultData(FAULT_STRUCT0, CY_SYSFAULT_DATA0); //Get fault data
}
}
/* Clears an interrupt mask.*/
/* Clear Interrupt flag */

◆ Cy_SysFault_SetInterrupt()

void Cy_SysFault_SetInterrupt ( FAULT_STRUCT_Type *  base)

Triggers an interrupt via a software write.

Parameters
baseThe pointer to a Fault structure instance.
Returns
None.
Function Usage
/* Scenario: Configures the SysFault for recording faults. */
/* Fault config */
{
.ResetEnable = false,
.OutputEnable = true,
.TriggerEnable = false,
};
/* Configure Interrupt for Fault structure */
cy_stc_sysint_t IRQ_cfg =
{
.intrSrc = ((NvicMux3_IRQn << CY_SYSINT_INTRSRC_MUXIRQ_SHIFT) | cpuss_interrupts_fault_0_IRQn), /* Bit 0-15 of intrSrc is used to store system interrupt value and bit 16-31 to store CPU IRQ value */
.intrPriority = 2UL
};
/*********************************************************************/
/***** Fault report settings *****/
/*********************************************************************/
Cy_SysFault_ClearStatus(FAULT_STRUCT0); // clear status
Cy_SysFault_SetMaskByIdx(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); // enable Fault MCWDT #0
cy_en_SysFault_status_t status = Cy_SysFault_Init(FAULT_STRUCT0, &config);
/*********************************************************************/
/***** Interrupt settings *****/
/*********************************************************************/
Cy_SysInt_Init(&IRQ_cfg, &irqFaultHandler);
NVIC_SetPriority((IRQn_Type) NvicMux3_IRQn, 2UL);
NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
/* Triggers an interrupt via a software write.*/
Cy_SysFault_SetInterrupt(FAULT_STRUCT0);

◆ Cy_SysFault_SetInterruptMask()

void Cy_SysFault_SetInterruptMask ( FAULT_STRUCT_Type *  base)

Sets an interrupt mask.

Parameters
baseThe pointer to a Fault structure instance.
Returns
None.
Function Usage
/* Scenario: Configures the SysFault for recording faults. */
/* Fault config */
{
.ResetEnable = false,
.OutputEnable = true,
.TriggerEnable = false,
};
/* Configure Interrupt for Fault structure */
cy_stc_sysint_t IRQ_cfg =
{
.intrSrc = ((NvicMux3_IRQn << CY_SYSINT_INTRSRC_MUXIRQ_SHIFT) | cpuss_interrupts_fault_0_IRQn), /* Bit 0-15 of intrSrc is used to store system interrupt value and bit 16-31 to store CPU IRQ value */
.intrPriority = 2UL
};
/*********************************************************************/
/***** Fault report settings *****/
/*********************************************************************/
Cy_SysFault_ClearStatus(FAULT_STRUCT0); // clear status
Cy_SysFault_SetMaskByIdx(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); // enable Fault MCWDT #0
cy_en_SysFault_status_t status = Cy_SysFault_Init(FAULT_STRUCT0, &config);
/*********************************************************************/
/***** Interrupt settings *****/
/*********************************************************************/
Cy_SysInt_Init(&IRQ_cfg, &irqFaultHandler);
NVIC_SetPriority((IRQn_Type) NvicMux3_IRQn, 2UL);
NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
/* Triggers an interrupt via a software write.*/
Cy_SysFault_SetInterrupt(FAULT_STRUCT0);

◆ Cy_SysFault_ClearInterruptMask()

void Cy_SysFault_ClearInterruptMask ( FAULT_STRUCT_Type *  base)

Clears an interrupt mask.

Parameters
baseThe pointer to a Fault structure instance.
Returns
None.
Function Usage
/* Scenario: Handle the faults generated and get the fault data. */
/* Returns the status of the interrupt for the fault structure */
uint32_t intrSource = Cy_SysFault_GetInterruptStatus(FAULT_STRUCT0);
/* Returns the interrupt mask. */
uint32_t intrMskStatus =Cy_SysFault_GetInterruptMask(FAULT_STRUCT0);
/* Returns whether masked interrupt and triggered the interrupt are same. */
uint32_t intrMskdStatus = Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT0);
cy_en_SysFault_source_t status = Cy_SysFault_GetErrorSource(FAULT_STRUCT0);
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0) // MCWDT0 fault
{
Cy_SysFault_GetFaultData(FAULT_STRUCT0, CY_SYSFAULT_DATA0); //Get fault data
}
}
/* Clears an interrupt mask.*/
/* Clear Interrupt flag */

◆ Cy_SysFault_GetInterruptMask()

uint32_t Cy_SysFault_GetInterruptMask ( FAULT_STRUCT_Type *  base)

Returns the interrupt mask.

Parameters
baseThe pointer to a Fault structure instance.
Returns
Interrupt Mask.
Function Usage
/* Scenario: Handle the faults generated and get the fault data. */
/* Returns the status of the interrupt for the fault structure */
uint32_t intrSource = Cy_SysFault_GetInterruptStatus(FAULT_STRUCT0);
/* Returns the interrupt mask. */
uint32_t intrMskStatus =Cy_SysFault_GetInterruptMask(FAULT_STRUCT0);
/* Returns whether masked interrupt and triggered the interrupt are same. */
uint32_t intrMskdStatus = Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT0);
cy_en_SysFault_source_t status = Cy_SysFault_GetErrorSource(FAULT_STRUCT0);
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0) // MCWDT0 fault
{
Cy_SysFault_GetFaultData(FAULT_STRUCT0, CY_SYSFAULT_DATA0); //Get fault data
}
}
/* Clears an interrupt mask.*/
/* Clear Interrupt flag */

◆ Cy_SysFault_GetInterruptStatusMasked()

uint32_t Cy_SysFault_GetInterruptStatusMasked ( FAULT_STRUCT_Type *  base)

Returns whether masked interrupt triggered the interrupt.

Parameters
baseThe pointer to a Fault structure instance.
Returns
Interrupt Mask.
Function Usage
/* Scenario: Handle the faults generated and get the fault data. */
/* Returns the status of the interrupt for the fault structure */
uint32_t intrSource = Cy_SysFault_GetInterruptStatus(FAULT_STRUCT0);
/* Returns the interrupt mask. */
uint32_t intrMskStatus =Cy_SysFault_GetInterruptMask(FAULT_STRUCT0);
/* Returns whether masked interrupt and triggered the interrupt are same. */
uint32_t intrMskdStatus = Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT0);
cy_en_SysFault_source_t status = Cy_SysFault_GetErrorSource(FAULT_STRUCT0);
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0) // MCWDT0 fault
{
Cy_SysFault_GetFaultData(FAULT_STRUCT0, CY_SYSFAULT_DATA0); //Get fault data
}
}
/* Clears an interrupt mask.*/
/* Clear Interrupt flag */