watchdog-timer-realtek-amebad  2.1.0
watchdog-timer-realtek-amebad
watchdog_timer_realtek_AmebaD.c
Go to the documentation of this file.
1 /*
2  * C
3  *
4  * Copyright 2021-2022 MicroEJ Corp. All rights reserved.
5  * Use of this source code is governed by a BSD-style license that can be found with this software.
6  */
7 
16 /* Includes ------------------------------------------------------------------*/
18 
19 #include "wdt_api.h"
20 #include "LLWATCHDOG_TIMER_configuration.h"
21 #include "LLWATCHDOG_TIMER_impl.h"
22 #include "watchdog_timer_helper.h"
23 
24 
25 #ifdef __cplusplus
26  extern "C" {
27 #endif
28 
29 
30 /* Macros and Defines --------------------------------------------------------*/
38 #if WATCHDOG_TIMER_REALTEK_AMEBAD_CONFIGURATION_VERSION != 1
39  #error "Version of the configuration file watchdog_timer_realtek_AmebaD_configuration.h is not compatible with this implementation."
40 #endif
41 
42 #if WATCHDOG_TIMER_TIMEOUT_MS <= 0
43 #error "Illegal watchdog timeout value defined with the macro WATCHDOG_TIMER_TIMEOUT_MS. The timeout value must be positive."
44 #endif
45 
46 
48  watchdog_init(WATCHDOG_TIMER_TIMEOUT_MS);
49 #if WATCHDOG_TIMER_MODE == WATCHDOG_TIMER_INTERRUPT_MODE
50  watchdog_irq_init((wdt_irq_handler)watchdog_timer_irq_handler, 0);
51 #endif
52  return WATCHDOG_TIMER_OK;
53 }
54 
55 int32_t LLWATCHDOG_TIMER_IMPL_start_action(void){
56  watchdog_start();
57  return WATCHDOG_TIMER_OK;
58 }
59 
60 int32_t LLWATCHDOG_TIMER_IMPL_stop_action(void){
61  watchdog_stop();
62  return WATCHDOG_TIMER_OK;
63 }
64 
65 int32_t LLWATCHDOG_TIMER_IMPL_refresh_action(void){
66  watchdog_refresh();
67  return WATCHDOG_TIMER_OK;
68 }
69 
70 uint8_t LLWATCHDOG_TIMER_IMPL_isResetCause_action(void){
71  if (BIT_BOOT_KM4WDG_RESET_HAPPEN & BOOT_Reason()){
72  return WATCHDOG_TIMER_TRUE;
73  }
74  return WATCHDOG_TIMER_FALSE;
75 }
76 
77 int32_t LLWATCHDOG_TIMER_IMPL_getWatchdogTimeoutMs_action(void){
79 }
80 
81 #ifdef __cplusplus
82  }
83 #endif
84 
int32_t LLWATCHDOG_TIMER_IMPL_init_action(void)
WATCHDOG TIMER REALTEK AMEBAD CCO configuration file.
#define WATCHDOG_TIMER_TIMEOUT_MS
The timeout (in milliseconds) of the hardware watchdog timer.