Callisto4Bootloader: test/watchdog_test.c File Reference

Callisto4Bootloader

Macros | Functions
watchdog_test.c File Reference
`#include "c4_watchdog.h"`
`#include "watchdog_test.h"`
`#include "lib/c4_watchdog_types.h"`
`#include "fsl_wdog.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Macros

#define | TEST_IF(fn, res, rc)
| Macro to perform test and display result. More...

## Functions

void | BL_SysTick_DelayTicks (uint32_t n)
| Sets a delay. More...
exit_code_t | watchdog_test ()
| Test function for watchdog 1. More...
exit_code_t | watchdog_if_test (c4_wdog_t wdog)
| Test Callisto 4 watchdog interfaces. More...

## Detailed Description

Copyright
  2020 Remsdaq Ltd.

Date
  : 4 Aug 2020

Author
  : Dan Smithers

Definition in file watchdog_test.c.

## Macro Definition Documentation

## ◆ TEST_IF

#define TEST_IF | ( |  | fn,
|  |  | res,
|  |  | rc
| ) |  |

Value:
{ rc = fn; \
C4_displayError(#fn, rc, false); \
rc = ((rc == res) ? C4_ERR_OK : C4_ERR_FAILED); \
}

Macro to perform test and display result.

Parameters

  [in] | fn | Function and parameters to execute.
  [out] | rc | return code.
  [in] | res | Expected result

Definition at line 33 of file watchdog_test.c.

## Function Documentation

## ◆ BL_SysTick_DelayTicks()

void BL_SysTick_DelayTicks | ( | uint32_t | n | ) |

Sets a delay.

Expose function from bootloader.c.

Parameters

  [in] | n | Delay time in ms

Definition at line 317 of file bootloader.c.

## ◆ watchdog_if_test()

exit_code_t watchdog_if_test | ( | c4_wdog_t | wdog | ) |

Test Callisto 4 watchdog interfaces.

Parameters

  [in] | wdog | Watch dog to exercise.

Returns
  Test status

Return values

  ERR_OK | All tests passed.

Definition at line 166 of file watchdog_test.c.

## ◆ watchdog_test()

exit_code_t watchdog_test | ( | void |  | ) |

Test function for watchdog 1.

Exercises detecting power-on reset (POR), software reset (SWR) and timeout reset (TOUT) through the WDOG1 registers. The test also shows a watchdog being constantly fed and also raising an interrupt prior to expiry.

Definition at line 56 of file watchdog_test.c.

References C4_WDOG1, _wdog_config::enableInterrupt, _wdog_config::interruptTimeValue, kWDOG_InterruptEnable, kWDOG_PowerOnResetFlag, kWDOG_SoftwareResetFlag, kWDOG_TimeoutResetFlag, NVIC_EnableIRQ, sWdogRegisters, _wdog_config::timeoutValue, WDOG1_IRQn, WDOG_EnableInterrupts(), WDOG_GetDefaultConfig(), WDOG_GetStatusFlags(), WDOG_Init(), WDOG_Refresh(), and WDOG_TriggerSystemSoftwareReset().