/***************************************************************************//** * \file cy_mcwdt.h * \version 1.80 * * Provides an API declaration of the Cypress PDL 3.0 MCWDT driver * ******************************************************************************** * \copyright * Copyright (c) (2016-2022), Cypress Semiconductor Corporation (an Infineon company) or * an affiliate of Cypress Semiconductor Corporation. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ /** * \addtogroup group_mcwdt * \{ * A MCWDT has two 16-bit counters and one 32-bit counter. * * The functions and other declarations used in this driver are in cy_mcwdt.h. * You can include cy_pdl.h to get access to all functions * and declarations in the PDL. * * You can use this driver to create a free-running * timer or generate periodic interrupts. The driver also * includes support for the watchdog function to recover from CPU or * firmware failures. * * There are two primary use cases for MCWDT: generating periodic CPU interrupts; * and implementing a free-running timer. Both have many applications in * embedded systems: * * Measuring time between events * * Generating periodic events * * Synchronizing actions * * Real-time clocking * * Polling * * An additional use case is to implement a watchdog used for recovering from a CPU or * firmware failure. * * \section group_mcwdt_configuration Configuration Considerations * * Each MCWDT may be configured for a particular product. * One MCWDT block can be associated with only one CPU during runtime. * A single MCWDT is not intended to be used by multiple CPUs simultaneously. * Each block contains three sub-counters, each of which can be configured for * various system utility functions - free running counter, periodic interrupts, * watchdog reset, or three interrupts followed by a watchdog reset. * All counters are clocked by either LFCLK (nominal 32 kHz) or by a cascaded * counter. * A simplified diagram of the MCWDT hardware is shown below: * \image html mcwdt.png * The frequency of the periodic interrupts can be configured using the Match * value with combining Clear on match option, which can be set individually * for each counter using Cy_MCWDT_SetClearOnMatch(). When the Clear on match option * is not set, the periodic interrupts of the C0 and C1 16-bit sub-counters occur * after 65535 counts and the match value defines the shift between interrupts * (see the figure below). The enabled Clear on match option * resets the counter when the interrupt occurs. * \image html mcwdt_counters.png * 32-bit sub-counter C2 does not have Clear on match option. * The interrupt of counter C2 occurs when the counts equal * 2Toggle bit value. * \image html mcwdt_subcounters.png * To set up an MCWDT, provide the configuration parameters in the * cy_stc_mcwdt_config_t structure. Then call * Cy_MCWDT_Init() to initialize the driver. * Call Cy_MCWDT_Enable() to enable all specified counters. * * You can also set the mode of operation for any counter. If you choose * interrupt mode, use Cy_MCWDT_SetInterruptMask() with the * parameter for the masks described in Macro Section. All counter interrupts * are OR'd together to from a single combined MCWDT interrupt. * Additionally, enable the Global interrupts and initialize the referenced * interrupt by setting the priority and the interrupt vector using * \ref Cy_SysInt_Init() of the sysint driver. * * The values of the MCWDT counters can be monitored using * Cy_MCWDT_GetCount(). * * CAT1C and TVIIBE devices support MCWDT_B type of counters, which are slightly different * from MCWDT, which is explained above * * A simplified diagram of the MCWDT_B hardware is shown below: * \image html mcwdt_b.png * * \note Please refer to TRM for more information on CAT1C and TVIIBE supported MCWDT_B counters. * * \note In addition to the MCWDTs, each device has a separate watchdog timer * (WDT) that can also be used to generate a watchdog reset or periodic * interrupts. For more information on the WDT, see the appropriate section * of the PDL. * * \section group_mcwdt_more_information More Information * * For more information on the MCWDT peripheral, refer to * the technical reference manual (TRM). * * \section group_mcwdt_changelog Changelog *
| Version | Changes | Reason for Change |
|---|---|---|
| 1.80 | *Added support for TRAVEO™ II Body Entry devices. * Pre-processor check for MXS40SRSS version now groups ver. 2 with ver. 3. Previously ver. 2 was grouped with ver. 1. |
* Code enhancement and support for new devices. | *
| 1.70 | *Added MCWDT_B type support required for CAT1C devices. Newly added APIs: * \n Cy_MCWDT_SetLowerAction(), * \n Cy_MCWDT_SetUpperAction(), * \n Cy_MCWDT_SetWarnAction(), * \n Cy_MCWDT_SetSubCounter2Action(), * \n Cy_MCWDT_GetLowerAction(), * \n Cy_MCWDT_GetUpperAction(), * \n Cy_MCWDT_GetWarnAction(), * \n Cy_MCWDT_GetSubCounter2Action(), * \n Cy_MCWDT_SetAutoService(), * \n Cy_MCWDT_GetAutoService(), * \n Cy_MCWDT_SetSleepDeepPause(), * \n Cy_MCWDT_GetSleepDeepPause(), * \n Cy_MCWDT_SetDebugRun(), * \n Cy_MCWDT_GetDebugRun(), * \n Cy_MCWDT_SetLowerLimit(), * \n Cy_MCWDT_SetUpperLimit(), * \n Cy_MCWDT_SetWarnLimit(), * \n Cy_MCWDT_GetLowerLimit(), * \n Cy_MCWDT_GetUpperLimit(), * \n Cy_MCWDT_GetWarnLimit(), * \n Cy_MCWDT_WaitForCounterReset(), * \n Cy_MCWDT_CpuSelectForDpSlpPauseAction(), * \n Cy_MCWDT_GetCascadeMatchCombined(). |
* Support for new devices. | *
| 1.60 | *CAT1B, CAT1C devices support. Newly added APIs: * \n Cy_MCWDT_GetLowerLimit() to get the lower limit value of the specified counter, * \n Cy_MCWDT_SetLowerLimit() to set the the lower limit value of the specified counter, * \n Cy_MCWDT_GetLowerLimitMode() to get the lower limit mode of the specified counter, * \n Cy_MCWDT_SetLowerLimitMode() to set the lower limit mode of the specified counter, * \n Cy_MCWDT_GetLowerLimitCascaded() to get the lower limit registers cascaded value, * \n Cy_MCWDT_SetCascadeCarryOutRollOver() to enable the Rollover mode for carryout, * \n Cy_MCWDT_GetCascadeCarryOutRollOver() to check if Rollover mode enabled for carryout or not, * \n Cy_MCWDT_SetCascadeMatchCombined() to set the match to combined cascade counters, * \n Cy_MCWDT_GetCascadeMatchCombined() to report if match is enabled with combined cascade counters or not. |
* Support for new devices. | *
| 1.50.1 | *Minor documentation updates. | *Documentation enhancement. | *
| 1.50 | *Added support for new family of devices. | *New device support. | *
| 1.40 | *Fixed/documented MISRA 2012 violations. | *MISRA 2012 compliance. | *
| 1.30.1 | *Minor documentation updates. | *Documentation enhancement. | *
| 1.30 | *In version 1.20 the Cy_MCWDT_GetCountCascaded() function * returned the wrong value when counter#1 overflowed. * This bug is corrected in version 1.30. * | *Defect fixes. * | *
| 1.20 | *Flattened the organization of the driver source code into the single * source directory and the single include directory. * | *Driver library directory-structure simplification. | *
| Added register access layer. Use register access macros instead * of direct register access using dereferenced pointers. | *Makes register access device-independent, so that the PDL does * not need to be recompiled for each supported part number. | *|
| 1.10.1 | *Updated description of the \ref cy_stc_mcwdt_config_t structure type | *Documentation update and clarification | *
| 1.10 | *Added input parameter validation to the API functions. * Added API function GetCountCascaded() |
* * |
| 1.0 | *Initial version | ** |