| Kinetis SDK v.2.0 API Reference Manual Rev. 0 Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- API Reference

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Files | Data Structures | Enumerations
COP: Watchdog Driver

## Overview

The KSDK provides a peripheral driver for the COP module (COP) of Kinetis devices.

# Typical use case

cop_config_t config;
COP_GetDefaultConfig(&config);
config.timeoutCycles = kCOP_2Power8CyclesOr2Power16Cycles;
COP_Init(sim_base,&config);

## Files
file | fsl_cop.h

## Data Structures
struct | cop_config_t
| Describes COP configuration structure. More...

## Enumerations
enum | cop_clock_source_t { kCOP_LpoClock = 0U, kCOP_BusClock = 3U }
| COP clock source selection. More...
enum | cop_timeout_cycles_t { kCOP_2Power5CyclesOr2Power13Cycles = 1U, kCOP_2Power8CyclesOr2Power16Cycles = 2U, kCOP_2Power10CyclesOr2Power18Cycles = 3U }
| Define the COP timeout cycles. More...

## Driver version
#define | FSL_COP_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
| COP driver version 2.0.0. More...

## COP refresh sequence.
#define | COP_FIRST_BYTE_OF_REFRESH (0x55U)
| First byte of refresh sequence.
#define | COP_SECOND_BYTE_OF_REFRESH (0xAAU)
| Second byte of refresh sequence.

## COP Functional Operation
void | COP_GetDefaultConfig (cop_config_t *config)
| Initializes the COP configuration structure. More...
void | COP_Init (SIM_Type *base, const cop_config_t *config)
| Initializes the COP module. More...
static void | COP_Disable (SIM_Type *base)
| De-initializes the COP module. More...
void | COP_Refresh (SIM_Type *base)
| Refreshes the COP timer. More...

## Data Structure Documentation

struct cop_config_t

### Data Fields
bool | enableWindowMode
| COP run mode: window mode or normal mode.
cop_clock_source_t | clockSource
| Set COP clock source.
cop_timeout_cycles_t | timeoutCycles
| Set COP timeout value.

## Macro Definition Documentation

#define FSL_COP_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))

## Enumeration Type Documentation

enum cop_clock_source_t

Enumerator
kCOP_LpoClock | COP clock sourced from LPO.
kCOP_BusClock | COP clock sourced from Bus clock.

enum cop_timeout_cycles_t

Enumerator
kCOP_2Power5CyclesOr2Power13Cycles | 2^5 or 2^13 clock cycles
kCOP_2Power8CyclesOr2Power16Cycles | 2^8 or 2^16 clock cycles
kCOP_2Power10CyclesOr2Power18Cycles | 2^10 or 2^18 clock cycles

## Function Documentation

void COP_GetDefaultConfig | ( | cop_config_t * | config | ) |

This function initializes the COP configuration structure to default values. The default values are:

copConfig->enableWindowMode = false;
copConfig->timeoutMode = kCOP_LongTimeoutMode;
copConfig->enableStop = false;
copConfig->enableDebug = false;
copConfig->clockSource = kCOP_LpoClock;
copConfig->timeoutCycles = kCOP_2Power10CyclesOr2Power18Cycles;

Parameters

  config | Pointer to the COP configuration structure.

See Also
  cop_config_t

void COP_Init | ( | SIM_Type * | base,
|  | const cop_config_t * | config
| ) |  |

This function configures 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_Disable function can be called only once. A second call has no effect.

Example:

cop_config_t config;
COP_GetDefaultConfig(&config);
config.timeoutCycles = kCOP_2Power8CyclesOr2Power16Cycles;
COP_Init(sim_base,&config);

Parameters

  base | SIM peripheral base address.
  config | The configuration of COP.

static void COP_Disable | ( | SIM_Type * | base | ) |
| inline static

This dedicated function is not provided. Instead, the COP_Disable function can be used to disable the COP.

Disables the COP module.

This function disables the COP Watchdog. Note: The COP configuration register is a write-once after reset. To disable the COP Watchdog, call this function first.

Parameters

  base | SIM peripheral base address.

void COP_Refresh | ( | SIM_Type * | base | ) |

This function feeds the COP.

Parameters

  base | SIM peripheral base address.