jerry_port_vm.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * jerry_port_vm.h - Additional Sming port functions used by jerryscript VM
8  *
9  * @author: Dec 2021 - Mikee47 <mike@sillyhouse.net>
10  *
11  */
12 
13 #pragma once
14 
15 #include <driver/hw_timer.h>
16 #include <jrt.h>
17 
22  uint32_t period;
23  uint32_t start;
24 };
25 
27 
31 void jerry_port_watchdog_set_period(uint32_t milliseconds);
32 
36 __forceinline static void jerry_port_watchdog_reset()
37 {
39 }
40 
44 __forceinline static uint32_t jerry_port_watchdog_read()
45 {
47 }
48 
52 __forceinline static bool jerry_port_watchdog_poll()
53 {
54  if(jerry_port_watchdog.period == 0) {
55  return true;
56  }
58  return true;
59  }
60  jerry_fatal(ERR_WATCHDOG_TIMEOUT);
61  return false;
62 }
static uint32_t hw_timer2_read(void)
Read current timer2 value.
Definition: Esp32/Components/driver/include/driver/hw_timer.h:147
static void jerry_port_watchdog_reset()
Reset watchdog timer before calling into jerryscript (load, run, etc)
Definition: jerry_port_vm.h:36
static bool jerry_port_watchdog_poll()
Called by jerryscript VM loop. Generates fatal error on timeout.
Definition: jerry_port_vm.h:52
struct jerry_port_watchdog_t jerry_port_watchdog
static uint32_t jerry_port_watchdog_read()
Get elapsed watchdog time (in ticks) since last reset.
Definition: jerry_port_vm.h:44
void jerry_port_watchdog_set_period(uint32_t milliseconds)
Set watchdog period in milliseconds.
Watchdog state information.
Definition: jerry_port_vm.h:21
uint32_t period
Watchdog timeout in hardware timer units.
Definition: jerry_port_vm.h:22
uint32_t start
Time of last call to jerry_port_watchdog_reset()
Definition: jerry_port_vm.h:23