Intel® Quark™ Microcontroller Software Interface 1.4.0 Intel® Quark™ Microcontroller BSP

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Enumerations | Functions
WDT

Watchdog timer. More...

## Data Structures
struct | qm_wdt_config_t
| QM WDT configuration type. More...

## Enumerations
enum | qm_wdt_mode_t { QM_WDT_MODE_RESET = 0, QM_WDT_MODE_INTERRUPT_RESET }
| WDT Mode type. More...

## Functions
int | qm_wdt_start (const qm_wdt_t wdt)
| Start WDT. More...
int | qm_wdt_set_config (const qm_wdt_t wdt, const qm_wdt_config_t *const cfg)
| Set configuration of WDT module. More...
int | qm_wdt_reload (const qm_wdt_t wdt)
| Reload the WDT counter. More...
int | qm_wdt_save_context (const qm_wdt_t wdt, qm_wdt_context_t *const ctx)
| Save watchdog context. More...
int | qm_wdt_restore_context (const qm_wdt_t wdt, const qm_wdt_context_t *const ctx)
| Restore watchdog context. More...

## Detailed Description

Watchdog timer.

## Enumeration Type Documentation

enum qm_wdt_mode_t

WDT Mode type.

Enumerator
QM_WDT_MODE_RESET | Watchdog Reset Response Mode. The watchdog will request a SoC Warm Reset on a timeout.
QM_WDT_MODE_INTERRUPT_RESET | Watchdog Interrupt Reset Response Mode. The watchdog will generate an interrupt on first timeout. If interrupt has not been cleared by the second timeout the watchdog will then request a SoC Warm Reset.

Definition at line 21 of file qm_wdt.h.

## Function Documentation

int qm_wdt_reload | ( | const qm_wdt_t | wdt | ) |

Reload the WDT counter.

Reload the WDT counter with safety value, i.e. service the watchdog.

Parameters

  [in] | wdt | WDT index.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 98 of file qm_wdt.c.

Referenced by qm_wdt_set_config(), and qm_wdt_start().

int qm_wdt_restore_context | ( | const qm_wdt_t | wdt,
|  | const qm_wdt_context_t *const | ctx
| ) |  |

Restore watchdog context.

Restore the configuration of the watchdog after exiting sleep.

Parameters

  [in] | wdt | WDT index.
  [in] | ctx | WDT context structure. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 152 of file qm_wdt.c.

int qm_wdt_save_context | ( | const qm_wdt_t | wdt,
|  | qm_wdt_context_t *const | ctx
| ) |  |

Save watchdog context.

Save the configuration of the watchdog before entering sleep.

Parameters

  [in] | wdt | WDT index.
  [out] | ctx | WDT context structure. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 144 of file qm_wdt.c.

int qm_wdt_set_config | ( | const qm_wdt_t | wdt,
|  | const qm_wdt_config_t *const | cfg
| ) |  |

Set configuration of WDT module.

This includes the timeout period in PCLK cycles, the WDT mode of operation. It also registers an ISR to the user defined callback.

Parameters

  [in] | wdt | WDT index.
  [in] | cfg | New configuration for WDT. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 60 of file qm_wdt.c.

References qm_wdt_config_t::callback, qm_wdt_config_t::callback_data, qm_wdt_config_t::mode, qm_wdt_config_t::pause_en, QM_WDT_MODE_INTERRUPT_RESET, qm_wdt_reload(), and qm_wdt_config_t::timeout.

int qm_wdt_start | ( | const qm_wdt_t | wdt | ) |

Start WDT.

Once started, WDT can only be stopped by a SoC reset.

Parameters

  [in] | wdt | WDT index.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 44 of file qm_wdt.c.

References CLK_PERIPH_CLK, clk_periph_enable(), CLK_PERIPH_WDT_REGISTER, and qm_wdt_reload().