PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Functions
PDL API Reference » MCWDT (Multi-Counter Watchdog)

## General Description

## Functions
cy_en_mcwdt_status_t | Cy_MCWDT_Init (MCWDT_STRUCT_Type *base, cy_stc_mcwdt_config_t const *config)
| Initializes the MCWDT block. More...
void | Cy_MCWDT_DeInit (MCWDT_STRUCT_Type *base)
| De-initializes the MCWDT block, returns register values to their default state. More...
__STATIC_INLINE void | Cy_MCWDT_Enable (MCWDT_STRUCT_Type *base, uint32_t counters, uint16_t waitUs)
| Enables all specified counters. More...
__STATIC_INLINE void | Cy_MCWDT_Disable (MCWDT_STRUCT_Type *base, uint32_t counters, uint16_t waitUs)
| Disables all specified counters. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetEnabledStatus (MCWDT_STRUCT_Type const *base, cy_en_mcwdtctr_t counter)
| Reports the enabled status of the specified counter. More...
__STATIC_INLINE void | Cy_MCWDT_Lock (MCWDT_STRUCT_Type *base)
| Locks out configuration changes to all MCWDT registers. More...
__STATIC_INLINE void | Cy_MCWDT_Unlock (MCWDT_STRUCT_Type *base)
| Unlocks the MCWDT configuration registers. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetLockedStatus (MCWDT_STRUCT_Type const *base)
| Reports the locked/unlocked state of the MCWDT. More...
__STATIC_INLINE void | Cy_MCWDT_SetMode (MCWDT_STRUCT_Type *base, cy_en_mcwdtctr_t counter, cy_en_mcwdtmode_t mode)
| Sets the mode of the specified counter. More...
__STATIC_INLINE cy_en_mcwdtmode_t | Cy_MCWDT_GetMode (MCWDT_STRUCT_Type const *base, cy_en_mcwdtctr_t counter)
| Reports the mode of the specified counter. More...
__STATIC_INLINE void | Cy_MCWDT_SetClearOnMatch (MCWDT_STRUCT_Type *base, cy_en_mcwdtctr_t counter, uint32_t enable)
| Sets the Clear on match option for the specified counter. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetClearOnMatch (MCWDT_STRUCT_Type const *base, cy_en_mcwdtctr_t counter)
| Reports the Clear on match setting for the specified counter. More...
__STATIC_INLINE void | Cy_MCWDT_SetCascade (MCWDT_STRUCT_Type *base, cy_en_mcwdtcascade_t cascade)
| Sets all the counter cascade options. More...
__STATIC_INLINE cy_en_mcwdtcascade_t | Cy_MCWDT_GetCascade (MCWDT_STRUCT_Type const *base)
| Reports all the counter cascade option settings. More...
__STATIC_INLINE void | Cy_MCWDT_SetMatch (MCWDT_STRUCT_Type *base, cy_en_mcwdtctr_t counter, uint32_t match, uint16_t waitUs)
| Sets the match comparison value for the specified counter (0 or 1). More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetMatch (MCWDT_STRUCT_Type const *base, cy_en_mcwdtctr_t counter)
| Reports the match comparison value for the specified counter (0 or 1). More...
uint32_t | Cy_MCWDT_GetCountCascaded (MCWDT_STRUCT_Type const *base)
| Reports the current value of combined C1-C0 cascaded counters. More...
__STATIC_INLINE void | Cy_MCWDT_SetToggleBit (MCWDT_STRUCT_Type *base, uint32_t bit)
| Sets a bit in Counter 2 to monitor for a toggle. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetToggleBit (MCWDT_STRUCT_Type const *base)
| Reports which bit in Counter 2 is monitored for a toggle. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetCount (MCWDT_STRUCT_Type const *base, cy_en_mcwdtctr_t counter)
| Reports the current counter value of the specified counter. More...
__STATIC_INLINE void | Cy_MCWDT_ResetCounters (MCWDT_STRUCT_Type *base, uint32_t counters, uint16_t waitUs)
| Resets all specified counters. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetInterruptStatus (MCWDT_STRUCT_Type const *base)
| Reports the state of all MCWDT interrupts. More...
__STATIC_INLINE void | Cy_MCWDT_ClearInterrupt (MCWDT_STRUCT_Type *base, uint32_t counters)
| Clears all specified MCWDT interrupts. More...
__STATIC_INLINE void | Cy_MCWDT_SetInterrupt (MCWDT_STRUCT_Type *base, uint32_t counters)
| Sets MCWDT interrupt sources in the interrupt request register. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetInterruptMask (MCWDT_STRUCT_Type const *base)
| Returns the MCWDT interrupt mask register. More...
__STATIC_INLINE void | Cy_MCWDT_SetInterruptMask (MCWDT_STRUCT_Type *base, uint32_t counters)
| Writes MCWDT interrupt mask register. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetInterruptStatusMasked (MCWDT_STRUCT_Type const *base)
| Returns the MCWDT interrupt masked request register. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetLowerLimit (MCWDT_STRUCT_Type const *base, cy_en_mcwdtlowerlimit_t counter)
| Reports the Lower Limit value of the specified counter. More...
__STATIC_INLINE void | Cy_MCWDT_SetLowerLimit (MCWDT_STRUCT_Type *base, cy_en_mcwdtlowerlimit_t counter, uint32_t lowerLimit, uint16_t waitUs)
| Sets the lower limit value for the specified counter (0 or 1). More...
__STATIC_INLINE cy_en_mcwdtlowerlimitmode_t | Cy_MCWDT_GetLowerLimitMode (MCWDT_STRUCT_Type const *base, cy_en_mcwdtlowerlimit_t counter)
| Reports the lower limit mode of the specified counter. More...
__STATIC_INLINE void | Cy_MCWDT_SetLowerLimitMode (MCWDT_STRUCT_Type *base, cy_en_mcwdtlowerlimit_t counter, cy_en_mcwdtlowerlimitmode_t mode)
| Sets the lower limit mode option for the specified counter. More...
__STATIC_INLINE uint32_t | Cy_MCWDT_GetLowerLimitCascaded (MCWDT_STRUCT_Type const *base)
| Gets lower limit registers cascaded value. More...
__STATIC_INLINE void | Cy_MCWDT_SetCascadeCarryOutRollOver (MCWDT_STRUCT_Type *base, cy_en_mcwdtcascade_t counter, bool carryoutconfig)
| Enables the Rollover mode for carryout. More...
__STATIC_INLINE bool | Cy_MCWDT_GetCascadeCarryOutRollOver (MCWDT_STRUCT_Type const *base, cy_en_mcwdtcascade_t counter)
| Checks if Rollover mode enabled for carryout or not. More...
__STATIC_INLINE void | Cy_MCWDT_SetCascadeMatchCombined (MCWDT_STRUCT_Type *base, cy_en_mcwdtcascade_t counter, bool matchconfig)
| Sets the match to combined cascade counters. More...
__STATIC_INLINE bool | Cy_MCWDT_GetCascadeMatchCombined (MCWDT_STRUCT_Type const *base, cy_en_mcwdtcascade_t counter)
| Reports if match is enabled with combined cascade counters or not. More...

## Function Documentation

## ◆ Cy_MCWDT_Init()

cy_en_mcwdt_status_t Cy_MCWDT_Init | ( | MCWDT_STRUCT_Type * | base,
|  | cy_stc_mcwdt_config_t const * | config
| ) |  |

Initializes the MCWDT block.

Parameters

  base | The base pointer to a structure that describes the registers.
  config | The pointer to a structure that contains component configuration data.

Returns
  cy_en_mcwdt_status_t *base checking result. If the pointer is NULL, returns error.

Note
  This API should not be called when the counters are running. Prior to calling this API the counter should be disabled.

## ◆ Cy_MCWDT_DeInit()

void Cy_MCWDT_DeInit | ( | MCWDT_STRUCT_Type * | base | ) |

De-initializes the MCWDT block, returns register values to their default state.

Parameters

  base | The base pointer to a structure that describes the registers.

Note
  This API should not be called when the counters are running. Prior to calling this API the counter should be disabled.

## ◆ Cy_MCWDT_Enable()

__STATIC_INLINE void Cy_MCWDT_Enable | ( | MCWDT_STRUCT_Type * | base,
|  | uint32_t | counters,
|  | uint16_t | waitUs
| ) |  |

Enables all specified counters.

Parameters

  base | The base pointer to a structure that describes registers.
  counters | OR of all counters to enable. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.
  waitUs | The function waits for some delay in microseconds before returning, because the counter begins counting after two lf_clk cycles pass. The recommended value is 93 us.

Note
  Setting this parameter to a zero means No wait. In this case, it is the user's responsibility to check whether the selected counters were enabled immediately after the function call. This can be done by the Cy_MCWDT_GetEnabledStatus() API.

## ◆ Cy_MCWDT_Disable()

__STATIC_INLINE void Cy_MCWDT_Disable | ( | MCWDT_STRUCT_Type * | base,
|  | uint32_t | counters,
|  | uint16_t | waitUs
| ) |  |

Disables all specified counters.

Parameters

  base | The base pointer to a structure describing registers.
  counters | OR of all counters to disable. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.
  waitUs | The function waits for some delay in microseconds before returning, because the counter stops counting after two lf_clk cycles pass. The recommended value is 93 us.

Note
  Setting this parameter to a zero means No wait. In this case, it is the user's responsibility to check whether the selected counters were disabled immediately after the function call. This can be done by the Cy_MCWDT_GetEnabledStatus() API.

## ◆ Cy_MCWDT_GetEnabledStatus()

__STATIC_INLINE uint32_t Cy_MCWDT_GetEnabledStatus | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtctr_t | counter
| ) |  |

Reports the enabled status of the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the MCWDT counter. The valid range is [0-2].

Returns
  The status of the MCWDT counter: 0 = disabled, 1 = enabled.

## ◆ Cy_MCWDT_Lock()

__STATIC_INLINE void Cy_MCWDT_Lock | ( | MCWDT_STRUCT_Type * | base | ) |

Locks out configuration changes to all MCWDT registers.

Parameters

  base | The base pointer to a structure that describes registers.

## ◆ Cy_MCWDT_Unlock()

__STATIC_INLINE void Cy_MCWDT_Unlock | ( | MCWDT_STRUCT_Type * | base | ) |

Unlocks the MCWDT configuration registers.

Parameters

  base | The base pointer to a structure that describes registers.

## ◆ Cy_MCWDT_GetLockedStatus()

__STATIC_INLINE uint32_t Cy_MCWDT_GetLockedStatus | ( | MCWDT_STRUCT_Type const * | base | ) |

Reports the locked/unlocked state of the MCWDT.

Parameters

  base | The base pointer to a structure that describes registers.

Returns
  The state of the MCWDT counter: 0 = unlocked, 1 = locked.

## ◆ Cy_MCWDT_SetMode()

__STATIC_INLINE void Cy_MCWDT_SetMode | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtctr_t | counter,
|  | cy_en_mcwdtmode_t | mode
| ) |  |

Sets the mode of the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-2].
  mode | The mode of operation for the counter. See enum typedef cy_en_mcwdtmode_t.

Note
  The mode for Counter 2 can be set only to CY_MCWDT_MODE_NONE or CY_MCWDT_MODE_INT.
  This API must not be called while the counters are running. Prior to calling this API, the counter must be disabled.

## ◆ Cy_MCWDT_GetMode()

__STATIC_INLINE cy_en_mcwdtmode_t Cy_MCWDT_GetMode | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtctr_t | counter
| ) |  |

Reports the mode of the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-2].

Returns
  The current mode of the counter. See enum typedef cy_en_mcwdtmode_t.

## ◆ Cy_MCWDT_SetClearOnMatch()

__STATIC_INLINE void Cy_MCWDT_SetClearOnMatch | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtctr_t | counter,
|  | uint32_t | enable
| ) |  |

Sets the Clear on match option for the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].

Note
  The match values are not supported by Counter 2.

Parameters

  enable | Set 0 to disable; 1 to enable.

Note
  This API must not be called while the counters are running. Prior to calling this API, the counter must be disabled.

## ◆ Cy_MCWDT_GetClearOnMatch()

__STATIC_INLINE uint32_t Cy_MCWDT_GetClearOnMatch | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtctr_t | counter
| ) |  |

Reports the Clear on match setting for the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].

Returns
  The Clear on match status: 1 = enabled, 0 = disabled.

Note
  The match value is not supported by Counter 2.

## ◆ Cy_MCWDT_SetCascade()

__STATIC_INLINE void Cy_MCWDT_SetCascade | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtcascade_t | cascade
| ) |  |

Sets all the counter cascade options.

Parameters

  base | The base pointer to a structure that describes registers.
  cascade | Sets or clears each of the cascade options.

Note
  This API must not be called when the counters are running. Prior to calling this API, the counter must be disabled.

## ◆ Cy_MCWDT_GetCascade()

__STATIC_INLINE cy_en_mcwdtcascade_t Cy_MCWDT_GetCascade | ( | MCWDT_STRUCT_Type const * | base | ) |

Reports all the counter cascade option settings.

Parameters

  base | The base pointer to a structure that describes registers.

Returns
  The current cascade option values.

## ◆ Cy_MCWDT_SetMatch()

__STATIC_INLINE void Cy_MCWDT_SetMatch | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtctr_t | counter,
|  | uint32_t | match,
|  | uint16_t | waitUs
| ) |  |

Sets the match comparison value for the specified counter (0 or 1).

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].
  match | The value to match against the counter. The valid range is [0-65535] for c0ClearOnMatch (or c1ClearOnMatch) = 0 and [1-65535] for c0ClearOnMatch (or c1ClearOnMatch) = 1.

Note
  The match value is not supported by Counter 2.
  Action on match is taken on the next increment after the counter value equal to match value.

Parameters

  waitUs | The function waits for some delay in microseconds before returning, because the match affects after two lf_clk cycles pass. The recommended value is 93 us.

Note
  Setting this parameter to a zero means No wait. This must be taken into account when changing the match values on the running counters.

## ◆ Cy_MCWDT_GetMatch()

__STATIC_INLINE uint32_t Cy_MCWDT_GetMatch | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtctr_t | counter
| ) |  |

Reports the match comparison value for the specified counter (0 or 1).

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].

Note
  The match values are not supported by Counter 2.

Returns
  A 16-bit match value.

## ◆ Cy_MCWDT_GetCountCascaded()

uint32_t Cy_MCWDT_GetCountCascaded | ( | MCWDT_STRUCT_Type const * | base | ) |

Reports the current value of combined C1-C0 cascaded counters.

Parameters

  base | The base pointer to a structure that describes the registers.

Note
  The user must enable both counters, and cascade C0 to C1, before calling this function. C2 is not reported. Instead, to get a 64-bit C2-C1-C0 cascaded value, the user must call this function followed by Cy_MCWDT_GetCount(base, CY_MCWDT_COUNTER2), and then combine the results.
  This function does not return the correct result when it is called after the Cy_MCWDT_Enable() or Cy_MCWDT_ResetCounters() function with a delay less than two lf_clk cycles. The recommended waitUs parameter value is 100 us.

Returns
  The value of combined C1-C0 cascaded counters.

## ◆ Cy_MCWDT_SetToggleBit()

__STATIC_INLINE void Cy_MCWDT_SetToggleBit | ( | MCWDT_STRUCT_Type * | base,
|  | uint32_t | bit
| ) |  |

Sets a bit in Counter 2 to monitor for a toggle.

Parameters

  base | The base pointer to a structure that describes registers.
  bit | The Counter 2 bit is set to monitor for a toggle. The valid range [0-31].

Note
  This API must not be called when counters are running. Prior to calling this API, the counter must be disabled.

## ◆ Cy_MCWDT_GetToggleBit()

__STATIC_INLINE uint32_t Cy_MCWDT_GetToggleBit | ( | MCWDT_STRUCT_Type const * | base | ) |

Reports which bit in Counter 2 is monitored for a toggle.

Parameters

  base | The base pointer to a structure that describes registers.

Returns
  The bit that is monitored (range 0 to 31).

## ◆ Cy_MCWDT_GetCount()

__STATIC_INLINE uint32_t Cy_MCWDT_GetCount | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtctr_t | counter
| ) |  |

Reports the current counter value of the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-2].

Returns
  A live counter value. Counters 0 and 1 are 16-bit counters and Counter 2 is a 32-bit counter.

## ◆ Cy_MCWDT_ResetCounters()

__STATIC_INLINE void Cy_MCWDT_ResetCounters | ( | MCWDT_STRUCT_Type * | base,
|  | uint32_t | counters,
|  | uint16_t | waitUs
| ) |  |

Resets all specified counters.

Parameters

  base | The base pointer to a structure that describes registers.
  counters | OR of all counters to reset. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.
  waitUs | The function waits for some delay in microseconds before returning, because a reset occurs after one lf_clk cycle passes. The recommended value is 62 us.

Note
  This function resets the counters two times to prevent the case when the Counter 1 is not reset when the counters are cascaded. The delay waitUs must be greater than 100 us when the counters are cascaded. The total delay is greater than 2*waitUs because the function has the delay after the first reset.
  Setting this parameter to a zero means No wait. In this case, it is the user's responsibility to check whether the selected counters were reset immediately after the function call. This can be done by the Cy_MCWDT_GetCount() API.

Function Usage
  /* Scenario: Configure the MCWDT to trigger a fault and system reset when
  sub-counter 0 reaches its upper limit. */
  const cy_stc_mcwdt_config_t MCWDT1_config =
  {
  .c0LowerLimit = 0U,
  .c0UpperLimit = 0x7fffU,
  .c0WarnLimit = 0U,
  .c0LowerAction = CY_MCWDT_ACTION_NONE,
  .c0UpperAction = CY_MCWDT_ACTION_FAULT_THEN_RESET, /* Fault/Reset when upper limit is reached */
  .c0WarnAction = CY_MCWDT_WARN_ACTION_NONE,
  .c0AutoService = CY_MCWDT_DISABLE,
  .c0SleepDeepPause = CY_MCWDT_ENABLE,
  .c0DebugRun = CY_MCWDT_ENABLE,
  .c1LowerLimit = 0U,
  .c1UpperLimit = 0xffffU,
  .c1WarnLimit = 0U,
  .c1LowerAction = CY_MCWDT_ACTION_NONE,
  .c1UpperAction = CY_MCWDT_ACTION_NONE,
  .c1WarnAction = CY_MCWDT_WARN_ACTION_NONE,
  .c1AutoService = CY_MCWDT_DISABLE,
  .c1SleepDeepPause = CY_MCWDT_DISABLE,
  .c1DebugRun = CY_MCWDT_ENABLE,
  .c2ToggleBit = 31U,
  .c2Action = CY_MCWDT_CNT2_ACTION_NONE,
  .c2SleepDeepPause = CY_MCWDT_DISABLE,
  .c2DebugRun = CY_MCWDT_ENABLE,
  .coreSelect = CY_MCWDT_PAUSED_BY_DPSLP_CM7_0,
  };
  if (CY_MCWDT_SUCCESS != Cy_MCWDT_Init(MCWDT_1_HW, &MCWDT1_config))
  {
  /* Handle errors */
  }
  Cy_MCWDT_Unlock(MCWDT_1_HW);
  /* Enable MCWDT0 counter 0 and give blocking delay of 3 LF_CLKs to
  * allow configuration to complete */
  Cy_MCWDT_Enable(MCWDT_1_HW, CY_MCWDT_CTR0, MCWDT_THREE_LF_CLK_CYCLES_DELAY);
  Cy_MCWDT_Lock(MCWDT_1_HW);
  for(;;)
  {
  /* Place your application code here. */
  /* service the MCWDT at regular intervals to prevent a reset */
  Cy_MCWDT_ResetCounters(MCWDT_1_HW, CY_MCWDT_CTR0, 62U);
  }
  cy_stc_mcwdt_config_t::c0LowerLimit
  uint16_t c0LowerLimit
  Lower limit for sub-counter 0 of this MCWDT.
  Definition: cy_mcwdt.h:275
  cy_stc_mcwdt_config_t
  The MCWDT component configuration structure.
  Definition: cy_mcwdt.h:260
  CY_MCWDT_SUCCESS
  @ CY_MCWDT_SUCCESS
  Successful.
  Definition: cy_mcwdt.h:243
  Cy_MCWDT_Unlock
  __STATIC_INLINE void Cy_MCWDT_Unlock(MCWDT_STRUCT_Type *base)
  Unlocks the MCWDT configuration registers.
  Definition: cy_mcwdt.h:577
  Cy_MCWDT_Lock
  __STATIC_INLINE void Cy_MCWDT_Lock(MCWDT_STRUCT_Type *base)
  Locks out configuration changes to all MCWDT registers.
  Definition: cy_mcwdt.h:554
  Cy_MCWDT_Enable
  __STATIC_INLINE void Cy_MCWDT_Enable(MCWDT_STRUCT_Type *base, uint32_t counters, uint16_t waitUs)
  Enables all specified counters.
  Definition: cy_mcwdt.h:436
  Cy_MCWDT_Init
  cy_en_mcwdt_status_t Cy_MCWDT_Init(MCWDT_STRUCT_Type *base, cy_stc_mcwdt_config_t const *config)
  Initializes the MCWDT block.
  Definition: cy_mcwdt.c:56
  Cy_MCWDT_ResetCounters
  __STATIC_INLINE void Cy_MCWDT_ResetCounters(MCWDT_STRUCT_Type *base, uint32_t counters, uint16_t waitUs)
  Resets all specified counters.
  Definition: cy_mcwdt.h:1024
  CY_MCWDT_CTR0
  #define CY_MCWDT_CTR0
  The sub-counter#0 mask.
  Definition: cy_mcwdt.h:169

## ◆ Cy_MCWDT_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_MCWDT_GetInterruptStatus | ( | MCWDT_STRUCT_Type const * | base | ) |

Reports the state of all MCWDT interrupts.

Parameters

  base | The base pointer to a structure that describes registers.

Returns
  The OR'd state of the interrupts. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.

## ◆ Cy_MCWDT_ClearInterrupt()

__STATIC_INLINE void Cy_MCWDT_ClearInterrupt | ( | MCWDT_STRUCT_Type * | base,
|  | uint32_t | counters
| ) |  |

Clears all specified MCWDT interrupts.

All the WDT interrupts must be cleared by the firmware; otherwise interrupts are generated continuously.

Parameters

  base | The base pointer to a structure describes registers.
  counters | OR of all interrupt sources to clear. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.

## ◆ Cy_MCWDT_SetInterrupt()

__STATIC_INLINE void Cy_MCWDT_SetInterrupt | ( | MCWDT_STRUCT_Type * | base,
|  | uint32_t | counters
| ) |  |

Sets MCWDT interrupt sources in the interrupt request register.

Parameters

  base | The base pointer to a structure that describes registers.
  counters | OR of all interrupt sources to set. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.

## ◆ Cy_MCWDT_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_MCWDT_GetInterruptMask | ( | MCWDT_STRUCT_Type const * | base | ) |

Returns the MCWDT interrupt mask register.

This register specifies which bits from the MCWDT interrupt request register will trigger an interrupt event.

Parameters

  base | The base pointer to a structure that describes registers.

Returns
  The OR'd state of the interrupt masks. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.

## ◆ Cy_MCWDT_SetInterruptMask()

__STATIC_INLINE void Cy_MCWDT_SetInterruptMask | ( | MCWDT_STRUCT_Type * | base,
|  | uint32_t | counters
| ) |  |

Writes MCWDT interrupt mask register.

This register configures which bits from MCWDT interrupt request register will trigger an interrupt event.

Parameters

  base | The base pointer to a structure that describes registers.
  counters | OR of all interrupt masks to set. See CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.

Function Usage
  /* Scenario: Configure the MCWDT to trigger periodic interrupts. */
  const cy_stc_mcwdt_config_t MCWDT1_config =
  {
  .c0LowerLimit = 0U,
  .c0UpperLimit = 0xFFFFU,
  .c0WarnLimit = 0x7FFFU,
  .c0LowerAction = CY_MCWDT_ACTION_NONE,
  .c0UpperAction = CY_MCWDT_ACTION_NONE,
  .c0WarnAction = CY_MCWDT_WARN_ACTION_INT, /* Interrupt when WarnLimit is reached */
  .c0AutoService = CY_MCWDT_ENABLE, /* Automatically reset the timer when warn limit is reached */
  .c0SleepDeepPause = CY_MCWDT_ENABLE,
  .c0DebugRun = CY_MCWDT_ENABLE,
  .c1LowerLimit = 0U,
  .c1UpperLimit = 0xffffU,
  .c1WarnLimit = 0U,
  .c1LowerAction = CY_MCWDT_ACTION_NONE,
  .c1UpperAction = CY_MCWDT_ACTION_NONE,
  .c1WarnAction = CY_MCWDT_WARN_ACTION_NONE,
  .c1AutoService = CY_MCWDT_DISABLE,
  .c1SleepDeepPause = CY_MCWDT_DISABLE,
  .c1DebugRun = CY_MCWDT_ENABLE,
  .c2ToggleBit = 31U,
  .c2Action = CY_MCWDT_CNT2_ACTION_NONE,
  .c2SleepDeepPause = CY_MCWDT_DISABLE,
  .c2DebugRun = CY_MCWDT_ENABLE,
  .coreSelect = CY_MCWDT_PAUSED_BY_DPSLP_CM7_0,
  };
  /* MCWDT interrupt configuration structure */
  const cy_stc_sysint_t MCWDT_1_IRQ_cfg = {
  .intrSrc = (uint32_t)((NvicMux3_IRQn << CY_SYSINT_INTRSRC_MUXIRQ_SHIFT) | srss_interrupt_mcwdt_1_IRQn),
  .intrPriority = 3
  };
  Cy_SysInt_Init(&MCWDT_1_IRQ_cfg, MCWDT_ISR);
  NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
  if (CY_MCWDT_SUCCESS != Cy_MCWDT_Init(MCWDT_1_HW, &MCWDT1_config))
  {
  /* Handle errors */
  }
  Cy_MCWDT_Unlock(MCWDT_1_HW);
  Cy_MCWDT_SetInterruptMask(MCWDT_1_HW, CY_MCWDT_CTR0);
  /* Enable MCWDT0 counter 0 and give blocking delay of 3 LF_CLKs to
  * allow configuration to complete */
  Cy_MCWDT_Enable(MCWDT_1_HW, CY_MCWDT_CTR0, MCWDT_THREE_LF_CLK_CYCLES_DELAY);
  Cy_MCWDT_Lock(MCWDT_1_HW);
  Cy_MCWDT_SetInterruptMask
  __STATIC_INLINE void Cy_MCWDT_SetInterruptMask(MCWDT_STRUCT_Type *base, uint32_t counters)
  Writes MCWDT interrupt mask register.
  Definition: cy_mcwdt.h:1157
  cy_stc_sysint_t::intrSrc
  IRQn_Type intrSrc
  Interrupt source.
  Definition: cy_sysint.h:229
  cy_stc_sysint_t
  Initialization configuration structure for a single interrupt channel.
  Definition: cy_sysint.h:227
  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.
  Definition: cy_sysint_v2.c:80
  CY_SYSINT_INTRSRC_MUXIRQ_SHIFT
  #define CY_SYSINT_INTRSRC_MUXIRQ_SHIFT
  Bit 0-11 indicate system interrupt and bit 12-15 will indicate the CPU IRQ.
  Definition: cy_sysint.h:179

## ◆ Cy_MCWDT_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_MCWDT_GetInterruptStatusMasked | ( | MCWDT_STRUCT_Type const * | base | ) |

Returns the MCWDT interrupt masked request register.

This register contains the logical AND of corresponding bits from the MCWDT interrupt request and mask registers. In the interrupt service routine, this function identifies which of the enabled MCWDT interrupt sources caused an interrupt event.

Parameters

  base | The base pointer to a structure that describes registers.

Returns
  The current status of enabled MCWDT interrupt sources. See the CY_MCWDT_CTR0, CY_MCWDT_CTR1, and CY_MCWDT_CTR2 macros.

## ◆ Cy_MCWDT_GetLowerLimit()

__STATIC_INLINE uint32_t Cy_MCWDT_GetLowerLimit | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtlowerlimit_t | counter
| ) |  |

Reports the Lower Limit value of the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].

Returns
  A Lower Limit value. Counters 0 and 1 are 16-bit counters.

## ◆ Cy_MCWDT_SetLowerLimit()

__STATIC_INLINE void Cy_MCWDT_SetLowerLimit | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtlowerlimit_t | counter,
|  | uint32_t | lowerLimit,
|  | uint16_t | waitUs
| ) |  |

Sets the lower limit value for the specified counter (0 or 1).

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].
  lowerLimit | The value to be written in the lower limit register The valid range is [0-65535] for c0 and [1-65535] for c1.

Note
  The lower limit mode is not supported by Counter 2.

Parameters

  waitUs | The function waits for some delay in microseconds before returning, because the lower limit register write affects after two lf_clk cycles pass. The recommended value is 93 us.

Note
  Setting this parameter to a zero means No wait. This must be taken into account when changing the lower limit register values.

## ◆ Cy_MCWDT_GetLowerLimitMode()

__STATIC_INLINE cy_en_mcwdtlowerlimitmode_t Cy_MCWDT_GetLowerLimitMode | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtlowerlimit_t | counter
| ) |  |

Reports the lower limit mode of the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].

Returns
  The current lower limit mode of the counter. See enum typedef cy_en_mcwdtlowerlimitmode_t.

## ◆ Cy_MCWDT_SetLowerLimitMode()

__STATIC_INLINE void Cy_MCWDT_SetLowerLimitMode | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtlowerlimit_t | counter,
|  | cy_en_mcwdtlowerlimitmode_t | mode
| ) |  |

Sets the lower limit mode option for the specified counter.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The number of the WDT counter. The valid range is [0-1].

Note
  The lower limit mode is not supported by Counter 2.

Parameters

  mode | Set 0 - Do nothing, 1 - Assert WDT_INTx, 2 - Assert WDT Reset

Note
  This API must not be called while the counters are running. Prior to calling this API, the counter must be disabled.

## ◆ Cy_MCWDT_GetLowerLimitCascaded()

__STATIC_INLINE uint32_t Cy_MCWDT_GetLowerLimitCascaded | ( | MCWDT_STRUCT_Type const * | base | ) |

Gets lower limit registers cascaded value.

Parameters

  base | The base pointer to a structure that describes registers.

Note
  The lower limit mode is not supported by Counter 2.

Returns
  A 32-bit lower limit register value.

## ◆ Cy_MCWDT_SetCascadeCarryOutRollOver()

__STATIC_INLINE void Cy_MCWDT_SetCascadeCarryOutRollOver | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtcascade_t | counter,
|  | bool | carryoutconfig
| ) |  |

Enables the Rollover mode for carryout.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The cascaded counter type. The valid cascaded type is either C0C1 or C1C2.
  carryoutconfig | For CY_MCWDT_CASCADE_C0C1: FALSE: carry out on counter 0 match TRUE: carry out on counter 0 rollover. For CY_MCWDT_CASCADE_C1C2: FALSE: carry out on counter 1 match TRUE: carry out on counter 1 rollover.

## ◆ Cy_MCWDT_GetCascadeCarryOutRollOver()

__STATIC_INLINE bool Cy_MCWDT_GetCascadeCarryOutRollOver | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtcascade_t | counter
| ) |  |

Checks if Rollover mode enabled for carryout or not.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The cascaded counter type. The valid cascaded type is either C0C1 or C1C2.

Returns
  True : Rollover Enabled False : Rollover Disabled

## ◆ Cy_MCWDT_SetCascadeMatchCombined()

__STATIC_INLINE void Cy_MCWDT_SetCascadeMatchCombined | ( | MCWDT_STRUCT_Type * | base,
|  | cy_en_mcwdtcascade_t | counter,
|  | bool | matchconfig
| ) |  |

Sets the match to combined cascade counters.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The cascaded counter type. The valid cascaded type is either C0C1 or C1C2.
  matchconfig | For CY_MCWDT_CASCADE_C0C1: FALSE: Match based on counter 1 alone TRUE: Match based on counter 1 and counter 0 matching simultaneously For CY_MCWDT_CASCADE_C1C2: FALSE: Match based on counter 2 alone TRUE: Match based on counter 2 and counter 1 matching simultaneously

## ◆ Cy_MCWDT_GetCascadeMatchCombined()

__STATIC_INLINE bool Cy_MCWDT_GetCascadeMatchCombined | ( | MCWDT_STRUCT_Type const * | base,
|  | cy_en_mcwdtcascade_t | counter
| ) |  |

Reports if match is enabled with combined cascade counters or not.

Parameters

  base | The base pointer to a structure that describes registers.
  counter | The cascaded counter type. The valid cascaded type is either C0C1 or C1C2.

Returns
  True : Combined match is enabled False : Combined match is disabled.