CAT2 Peripheral Driver Library

Functions

void Cy_CRWDT_Init (void)
 Initializes the Challenge Response WDT (CRWDT) to its default state. More...
 
bool Cy_CRWDT_IsEnabled (void)
 Returns the Challenge Response WDT (CRWDT) HW actual status. More...
 
void Cy_CRWDT_Enable (void)
 Enables the Challenge Response WDT (CRWDT) More...
 
void Cy_CRWDT_Disable (void)
 Disables the Challenge Response WDT (CRWDT) More...
 
uint8_t Cy_CRWDT_GetChallenge (void)
 Challenge/Response WatchDog Challenge value. More...
 
uint8_t Cy_CRWDT_CalculateResponse (uint8_t challengeValue)
 Calculates the response value according to the challenge value. More...
 
void Cy_CRWDT_SetResponse (uint8_t responseValue)
 Sets the response value to service the Challenge Response WDT (CRWDT) More...
 
uint32_t Cy_CRWDT_GetUpCnt (void)
 Get Up counter from Challenge Response WDT (CRWDT) More...
 
void Cy_CRWDT_SetEarlyLimit (uint32_t early)
 Set Early limit for Challenge Response WDT (CRWDT) action. More...
 
void Cy_CRWDT_SetWarnLimit (uint32_t warn)
 Set Warn limit for Challenge Response WDT (CRWDT) action. More...
 
void Cy_CRWDT_SetLateLimit (uint32_t late)
 Set Late limit for Challenge Response WDT (CRWDT) action. More...
 
void Cy_CRWDT_SetAction (uint32_t action)
 Enabling one or more actions for the CRWDT by specifying a composite action bitmask. More...
 
bool Cy_CRWDT_GetInterruptStatus (void)
 Get interrupt status for Challenge Response WDT (CRWDT) More...
 
void Cy_CRWDT_SetInterrupt (void)
 Triggers an interrupt with software. More...
 
void Cy_CRWDT_ClearInterrupt (void)
 Clears the CRWDT interrupt status. More...
 
void Cy_CRWDT_SetInterruptMask (bool enable)
 Sets the Challenge Response WDT (CRWDT) interrupt mask. More...
 
bool Cy_CRWDT_GetInterruptStatusMasked (void)
 Reads the Challenge Response WDT (CRWDT) masked interrupt status. More...
 

Detailed Description

Function Documentation

◆ Cy_CRWDT_Init()

void Cy_CRWDT_Init ( void  )

Initializes the Challenge Response WDT (CRWDT) to its default state.

  • EARLY_ACTION - None
  • WARN_ACTION - None
  • LATE_ACTION - Trigger a fault. Further, trigger a system-wide reset if the CRWDT is not disabled within 6
  • CHALLENGE_FAIL_ACTION - Action taken when a failed response occurs, For example, the expected LFSR value is different from the expected value.
  • DEBUG - When the debugger is connected, the counter pauses incrementing.
  • The Challenge Response WDT enable Cy_CRWDT_Enable
Note
After the initialization, the CRWDT is enabled, and the counter of CRWDT starts counting up from 0.
Warning
Will require 2 Low-Frequency Clock cycles to take effect.
Note
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* init CRWDT to the default state and run */

◆ Cy_CRWDT_IsEnabled()

bool Cy_CRWDT_IsEnabled ( void  )

Returns the Challenge Response WDT (CRWDT) HW actual status.

Warning
May lag Cy_CRWDT_Enable by up to one Low-Frequency Clock cycles.
Note
Applicable to PSOC4 HVMS/PA only.
Returns
true - Challenge Response WDT is enabled.
false - Challenge Response WDT is disabled.
Function Usage
/* setting thresholds ignored if CRWDT is not disabled */
isEnabled = Cy_CRWDT_IsEnabled();
if (true == isEnabled)
{
/* required up to 2 LF CLK cycles to takes effect
* frequency ticks = 1 000 000 uS
* 2 ticks = Needed delay uS
* Needed delay uS = 2 * 1000 000 / frequency
*/
Cy_SysLib_DelayUs((uint16_t)((CY_SYSCLK_MICRO_SCALER * 2U) / frequency));
}

◆ Cy_CRWDT_Enable()

void Cy_CRWDT_Enable ( void  )

Enables the Challenge Response WDT (CRWDT)

Note
The counter of CRWDT starts counting up
Warning
Will require 2 Low-Frequency Clock cycles to take effect.
Note
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* setting thresholds ignored if CRWDT is not disabled */
isEnabled = Cy_CRWDT_IsEnabled();
if (true == isEnabled)
{
/* required up to 2 LF CLK cycles to takes effect
* frequency ticks = 1 000 000 uS
* 2 ticks = Needed delay uS
* Needed delay uS = 2 * 1000 000 / frequency
*/
Cy_SysLib_DelayUs((uint16_t)((CY_SYSCLK_MICRO_SCALER * 2U) / frequency));
}

◆ Cy_CRWDT_Disable()

void Cy_CRWDT_Disable ( void  )

Disables the Challenge Response WDT (CRWDT)

Note
The counter of the CRWDT stops counting, and is cleared to 0.
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* setting thresholds ignored if CRWDT is not disabled */
isEnabled = Cy_CRWDT_IsEnabled();
if (true == isEnabled)
{
/* required up to 2 LF CLK cycles to takes effect
* frequency ticks = 1 000 000 uS
* 2 ticks = Needed delay uS
* Needed delay uS = 2 * 1000 000 / frequency
*/
Cy_SysLib_DelayUs((uint16_t)((CY_SYSCLK_MICRO_SCALER * 2U) / frequency));
}

◆ Cy_CRWDT_GetChallenge()

uint8_t Cy_CRWDT_GetChallenge ( void  )

Challenge/Response WatchDog Challenge value.

Note
Implements the Linear Feedback Shift Register (LFSR) CCRC8-AutoSar using the polynomial x^8+x^5+x^3+x^2+x+1. The next value in the LFSR sequence is used to compare against the response value.
Applicable to PSOC4 HVMS/PA only.
Returns
Challenge CRC-8 code
Function Usage
counter = Cy_CRWDT_GetUpCnt();
challenge = Cy_CRWDT_GetChallenge();
response = Cy_CRWDT_CalculateResponse(challenge);
if (counter > Cy_CRWDT_GetUpCnt())
{
/*
* CRWDT feeded correctly. Counter was reseted
*/
}
else
{
/*
* CRWDT feeded incorrectly.
* Fail action will occurs (if configured)
*/
}

◆ Cy_CRWDT_CalculateResponse()

uint8_t Cy_CRWDT_CalculateResponse ( uint8_t  challengeValue)

Calculates the response value according to the challenge value.

Parameters
challengeValue- Challenge CRC-8 code.
Note
Applicable to PSOC4 HVMS/PA only.
Returns
Response CRC-8 code.
Function Usage
counter = Cy_CRWDT_GetUpCnt();
challenge = Cy_CRWDT_GetChallenge();
response = Cy_CRWDT_CalculateResponse(challenge);
if (counter > Cy_CRWDT_GetUpCnt())
{
/*
* CRWDT feeded correctly. Counter was reseted
*/
}
else
{
/*
* CRWDT feeded incorrectly.
* Fail action will occurs (if configured)
*/
}

◆ Cy_CRWDT_SetResponse()

void Cy_CRWDT_SetResponse ( uint8_t  responseValue)

Sets the response value to service the Challenge Response WDT (CRWDT)

Note
Applicable to PSOC4 HVMS/PA only.
Parameters
responseValue- calculated response value to service CRWDT
Returns
none
Function Usage
counter = Cy_CRWDT_GetUpCnt();
challenge = Cy_CRWDT_GetChallenge();
response = Cy_CRWDT_CalculateResponse(challenge);
if (counter > Cy_CRWDT_GetUpCnt())
{
/*
* CRWDT feeded correctly. Counter was reseted
*/
}
else
{
/*
* CRWDT feeded incorrectly.
* Fail action will occurs (if configured)
*/
}

◆ Cy_CRWDT_GetUpCnt()

uint32_t Cy_CRWDT_GetUpCnt ( void  )

Get Up counter from Challenge Response WDT (CRWDT)

Note
Applicable to PSOC4 HVMS/PA only.
Returns
current up counter value
Function Usage
counter = Cy_CRWDT_GetUpCnt();
challenge = Cy_CRWDT_GetChallenge();
response = Cy_CRWDT_CalculateResponse(challenge);
if (counter > Cy_CRWDT_GetUpCnt())
{
/*
* CRWDT feeded correctly. Counter was reseted
*/
}
else
{
/*
* CRWDT feeded incorrectly.
* Fail action will occurs (if configured)
*/
}

◆ Cy_CRWDT_SetEarlyLimit()

void Cy_CRWDT_SetEarlyLimit ( uint32_t  early)

Set Early limit for Challenge Response WDT (CRWDT) action.

Parameters
early- limit for early action (24-bit)
Note
This function is ignored if CRWDT is not disabled
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* setting thresholds ignored if CRWDT is not disabled */
isEnabled = Cy_CRWDT_IsEnabled();
if (true == isEnabled)
{
/* required up to 2 LF CLK cycles to takes effect
* frequency ticks = 1 000 000 uS
* 2 ticks = Needed delay uS
* Needed delay uS = 2 * 1000 000 / frequency
*/
Cy_SysLib_DelayUs((uint16_t)((CY_SYSCLK_MICRO_SCALER * 2U) / frequency));
}

◆ Cy_CRWDT_SetWarnLimit()

void Cy_CRWDT_SetWarnLimit ( uint32_t  warn)

Set Warn limit for Challenge Response WDT (CRWDT) action.

Parameters
warn- limit for late action (24-bit)
Note
This function is ignored if CRWDT is disabled
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* setting thresholds ignored if CRWDT is not disabled */
isEnabled = Cy_CRWDT_IsEnabled();
if (true == isEnabled)
{
/* required up to 2 LF CLK cycles to takes effect
* frequency ticks = 1 000 000 uS
* 2 ticks = Needed delay uS
* Needed delay uS = 2 * 1000 000 / frequency
*/
Cy_SysLib_DelayUs((uint16_t)((CY_SYSCLK_MICRO_SCALER * 2U) / frequency));
}

◆ Cy_CRWDT_SetLateLimit()

void Cy_CRWDT_SetLateLimit ( uint32_t  late)

Set Late limit for Challenge Response WDT (CRWDT) action.

Parameters
late- limit for late action (24-bit)
Note
This function is ignored if CRWDT is disabled
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* setting thresholds ignored if CRWDT is not disabled */
isEnabled = Cy_CRWDT_IsEnabled();
if (true == isEnabled)
{
/* required up to 2 LF CLK cycles to takes effect
* frequency ticks = 1 000 000 uS
* 2 ticks = Needed delay uS
* Needed delay uS = 2 * 1000 000 / frequency
*/
Cy_SysLib_DelayUs((uint16_t)((CY_SYSCLK_MICRO_SCALER * 2U) / frequency));
}

◆ Cy_CRWDT_SetAction()

void Cy_CRWDT_SetAction ( uint32_t  action)

Enabling one or more actions for the CRWDT by specifying a composite action bitmask.

Parameters
action- The type of action to be activated

Actions details:

Note
This function is ignored if CRWDT is not Disabled
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
action = CY_CRWDT_NO_ACTION; /* reset all actions */
action |= CY_CRWDT_EARLY_ACTION; /* Trigger a Fault and interrupt at Early threshold */
action |= CY_CRWDT_WARN_ACTION; /* Trigger a Fault and interrupt at Warn threshold */
action |= CY_CRWDT_LATE_ACTION; /* Trigger a fault. Further, trigger a system-wide reset at LATE threshold */
action |= CY_CRWDT_FAIL_ACTION; /* Trigger a Reset if CRWDT was feeded incorrectly */
action |= CY_CRWDT_DEBUG_ACTION; /* Reset generation is blocked when debugger is connected */

◆ Cy_CRWDT_GetInterruptStatus()

bool Cy_CRWDT_GetInterruptStatus ( void  )

Get interrupt status for Challenge Response WDT (CRWDT)

Note
Applicable to PSOC4 HVMS/PA only.
Returns
true - CRWDT interrupt occurred.
false - CRWDT interrupt did not occur.
Function Usage
/* Scenario: Set interrupt for CRWDT. */
/* Hook interrupt service routine */
(void) Cy_SysInt_Init(&CRWDTIntrConfig, &CRWDT_Isr);
/* unmask interrupts if interrupts were masked*/
{
}
/* clear old interrupts */
/* enable interrupt for interrupt controller */
NVIC_EnableIRQ(SYSCLK_INTR_NUM);
/* force interrupt for CRWDT*/

◆ Cy_CRWDT_SetInterrupt()

void Cy_CRWDT_SetInterrupt ( void  )

Triggers an interrupt with software.

Can be used to set interrupts for firmware testing.

Note
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* Scenario: Set interrupt for CRWDT. */
/* Hook interrupt service routine */
(void) Cy_SysInt_Init(&CRWDTIntrConfig, &CRWDT_Isr);
/* unmask interrupts if interrupts were masked*/
{
}
/* clear old interrupts */
/* enable interrupt for interrupt controller */
NVIC_EnableIRQ(SYSCLK_INTR_NUM);
/* force interrupt for CRWDT*/

◆ Cy_CRWDT_ClearInterrupt()

void Cy_CRWDT_ClearInterrupt ( void  )

Clears the CRWDT interrupt status.

Note
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* Scenario: Set interrupt for CRWDT. */
/* Hook interrupt service routine */
(void) Cy_SysInt_Init(&CRWDTIntrConfig, &CRWDT_Isr);
/* unmask interrupts if interrupts were masked*/
{
}
/* clear old interrupts */
/* enable interrupt for interrupt controller */
NVIC_EnableIRQ(SYSCLK_INTR_NUM);
/* force interrupt for CRWDT*/

◆ Cy_CRWDT_SetInterruptMask()

void Cy_CRWDT_SetInterruptMask ( bool  enable)

Sets the Challenge Response WDT (CRWDT) interrupt mask.

This API enables or disables interrupt handling, but not enable or disable interrupt itself.

Parameters
enabletrue : to masking interrupt. After masking the interrupt, it is not passed to the CPU.
false : to reset masking. After unmasking the interrupt, it is passed to CPU.
Note
Applicable to PSOC4 HVMS/PA only.
Returns
none
Function Usage
/* Scenario: Set interrupt for CRWDT. */
/* Hook interrupt service routine */
(void) Cy_SysInt_Init(&CRWDTIntrConfig, &CRWDT_Isr);
/* unmask interrupts if interrupts were masked*/
{
}
/* clear old interrupts */
/* enable interrupt for interrupt controller */
NVIC_EnableIRQ(SYSCLK_INTR_NUM);
/* force interrupt for CRWDT*/

◆ Cy_CRWDT_GetInterruptStatusMasked()

bool Cy_CRWDT_GetInterruptStatusMasked ( void  )

Reads the Challenge Response WDT (CRWDT) masked interrupt status.

Note
Applicable to PSOC4 HVMS/PA only.
Returns
true : Masked interrupt occurs
false : No Masked interrupt occurs.
Function Usage
/* Scenario: Set interrupt for CRWDT. */
/* Hook interrupt service routine */
(void) Cy_SysInt_Init(&CRWDTIntrConfig, &CRWDT_Isr);
/* unmask interrupts if interrupts were masked*/
{
}
/* clear old interrupts */
/* enable interrupt for interrupt controller */
NVIC_EnableIRQ(SYSCLK_INTR_NUM);
/* force interrupt for CRWDT*/