The section describes the programming interface of the COP Peripheral driver. The COP driver configures the COP and provides a simple way to initialize and configure the COP.
COP Initialization
To initialize the COP module, call the COP_DRV_Init() function and pass in the user configuration structure. This function automatically enables the COP module and clock.
After the COP_DRV_Init() function is called, the COP is enabled and its counter is working. Therefore, the COP_DRV_Refresh() function should be called before the COP times out.
This example code shows how to initialize and configure the driver:
cop_user_config_t copInit =
{
.copWindowModeEnable = (uint8_t)false,
#if FSL_FEATURE_COP_HAS_LONGTIME_MODE
.copTimeoutMode = kCopShortTimeoutMode,
#else
#endif
#if FSL_FEATURE_COP_HAS_LONGTIME_MODE
.copStopModeEnable = (uint8_t)false,
.copDebugModeEnable = (uint8_t)false,
#endif
};
COP Refresh
After the COP is enabled, the COP_DRV_Refresh() function should be called periodically to prevent the COP from timing out.
Otherwise, a reset is asserted. This is called the "Feed Dog".
COP Reset Count
The COP can reset the system.
- After COP_DRV_Reset(), the chip is be reset.
This function initializes the COP. After it is called, the COP starts running according to the configuration. Because all COP control registers are write-once only, the cop_init function and the cop_shutdown function can be called only once. A second call has no effect.
- Parameters
-
instance | The COP peripheral instance number. |
initPtr | COP Initialize data structure. |
- Returns
- The initialization status.
void COP_DRV_Disable |
( |
uint32_t |
instance | ) |
|
This function disables the COP Watchdog. Note: The COP configuration register is write-once after reset. To disable the COP Watchdog, call this function first.
- Parameters
-
instance | The COP peripheral instance number. |
void COP_DRV_Refresh |
( |
uint32_t |
instance | ) |
|
This function feeds the COP. It sets the COP timer count to zero and should be called before the COP timer expires. Otherwise, a RESET is asserted.
- Parameters
-
instance | The COP peripheral instance number. |
bool COP_DRV_IsRunning |
( |
uint32_t |
instance | ) |
|
This function gets the COP running status.
- Parameters
-
instance | The COP peripheral instance number. |
- Returns
- COP running status; 0 means not running; 1 means running
void COP_DRV_ResetSystem |
( |
uint32_t |
instance | ) |
|
This function resets the device.
- Parameters
-
instance | The COP peripheral instance number. |
SIM_Type* const g_copBase[] |