IoT Supervisor
0.0
Loading...
Searching...
No Matches
IoT_Supervisor.h
Go to the documentation of this file.
1
11
#ifndef INC_IOT_SUPERVISOR_H_
12
#define INC_IOT_SUPERVISOR_H_
13
#include <stdint.h>
14
#include <stdbool.h>
15
16
//-----------------------------------------------------------------------------
17
// Defines
18
//-----------------------------------------------------------------------------
22
#define C_WDT_PET 0x5A
23
#define C_WDT_DIS 0xA5
// group Modbus WDT State Machine
28
#define C_CMD_COMMIT 0x5FAF
29
#define C_CMD_CANCEL 0x0000
30
#define C_SID_MIN 1
31
#define C_SID_MAX 247
// group Configuration_State_Machine
33
//-----------------------------------------------------------------------------
34
// Type Definitions
35
//-----------------------------------------------------------------------------
36
#define t1Count_t uint16_t
37
48
typedef
enum
49
{
56
eVIN_Init
= 0,
57
eVIN_VLow
,
58
eVIN_OK
59
}
VinSm_t
;
// group Voltage_State_Machine
71
typedef
enum
72
{
73
eMW_Ini
= 0,
74
eMW_En
,
75
eMW_Timeout
76
}
mbWDTsmS_t
;
// Modbus_WDT_State_Machine
87
typedef
enum
88
{
89
eLR_Init
= 0,
90
eLR_VSM
,
91
eLR_WDT
92
}
LastRst_t
;
// Main_Application
103
typedef
enum
104
{
110
eVS_Norm
= 0,
111
eVS_Cfg
,
112
eVS_Prog
,
113
eVS_Setup
114
}
VerifSt_t
;
115
122
typedef
enum
123
{
124
eCFG_Idle
= 0,
125
eCFG_Load
,
126
eCFG_Cache
,
127
eCFG_Commit
,
128
eCFG_Erase
,
129
eCFG_Write
130
}
CfgSM_t
;
131
133
typedef
struct
134
{
135
uint8_t
sid
;
136
uint8_t
baud
;
137
uint8_t
wdto
;
138
uint16_t
pw
;
139
}
cfg_t
;
// group Configuration_State_Machine
141
151
typedef
union
152
{
153
/* bitfield access
154
*
155
* @note these fields are represented in LSB first which is normal in C
156
*/
157
struct
158
{
159
VinSm_t
vinSmS
:2;
160
mbWDTsmS_t
wdtSmS
:2;
161
LastRst_t
lastRstS
:2;
162
VerifSt_t
verifSt
:2;
163
} v;
165
uint8_t
b
;
166
}
sv_dev_sta_t
;
// Main_Application
168
169
//-----------------------------------------------------------------------------
170
// Globals
171
//-----------------------------------------------------------------------------
172
extern
bool
sys_ok
;
173
174
extern
volatile
t1Count_t
t1Count
;
175
extern
volatile
bool
cprif
;
176
177
extern
volatile
uint8_t
t0Count
;
178
extern
uint8_t
T0C_TOP
;
179
180
extern
sv_dev_sta_t
sv_dev_sta
;
181
182
extern
bool
mbWDTen
;
183
extern
bool
mbWDTpet
;
184
extern
uint8_t
MB_WD_TIMEOUT
;
185
186
extern
bool
pw_flag
;
187
extern
bool
dir_tx
;
188
extern
uint16_t
pw
;
189
extern
cfg_t
cfg
;
190
191
extern
CfgSM_t
cfgSmS
;
192
//-----------------------------------------------------------------------------
193
// Functions
194
//-----------------------------------------------------------------------------
195
void
VinSm
(
void
);
196
void
mbWDTsm
(
void
);
197
198
#endif
/* INC_IOT_SUPERVISOR_H_ */
t1Count_t
#define t1Count_t
Definition
IoT_Supervisor.h:36
sys_ok
bool sys_ok
Definition
IoT Supervisor_main.c:108
pw_flag
bool pw_flag
Definition
IoT Supervisor_main.c:456
cfg
cfg_t cfg
Definition
IoT Supervisor_main.c:460
pw
uint16_t pw
Definition
IoT Supervisor_main.c:459
CfgSM_t
CfgSM_t
Definition
IoT_Supervisor.h:123
dir_tx
bool dir_tx
Definition
IoT Supervisor_main.c:457
cfgSmS
CfgSM_t cfgSmS
Definition
IoT Supervisor_main.c:455
VerifSt_t
VerifSt_t
Definition
IoT_Supervisor.h:104
eCFG_Cache
@ eCFG_Cache
New Configuration is Caching from Modbus.
Definition
IoT_Supervisor.h:126
eCFG_Load
@ eCFG_Load
Configuration Loading from memory.
Definition
IoT_Supervisor.h:125
eCFG_Commit
@ eCFG_Commit
New Configuration is Committed (Active)
Definition
IoT_Supervisor.h:127
eCFG_Idle
@ eCFG_Idle
Idle State. No configuration state machine activity.
Definition
IoT_Supervisor.h:124
eCFG_Write
@ eCFG_Write
Write the new Configuration (into Flash)
Definition
IoT_Supervisor.h:129
eCFG_Erase
@ eCFG_Erase
Erase the old Configuration (from Flash)
Definition
IoT_Supervisor.h:128
eVS_Cfg
@ eVS_Cfg
Configuration Error or CRC Mismatch Detected.
Definition
IoT_Supervisor.h:111
eVS_Prog
@ eVS_Prog
Program Memory Mismatch Detected.
Definition
IoT_Supervisor.h:112
eVS_Norm
@ eVS_Norm
Definition
IoT_Supervisor.h:110
eVS_Setup
@ eVS_Setup
Initial Setup.
Definition
IoT_Supervisor.h:113
T0C_TOP
uint8_t T0C_TOP
Definition
IoT Supervisor_main.c:55
t1Count
volatile t1Count_t t1Count
Definition
IoT Supervisor_main.c:50
sv_dev_sta
sv_dev_sta_t sv_dev_sta
Definition
IoT Supervisor_main.c:47
LastRst_t
LastRst_t
Definition
IoT_Supervisor.h:88
t0Count
volatile uint8_t t0Count
Definition
IoT Supervisor_main.c:53
eLR_Init
@ eLR_Init
Initial State. No recorded reset.
Definition
IoT_Supervisor.h:89
eLR_WDT
@ eLR_WDT
The modbus watchdog timer caused the last reset.
Definition
IoT_Supervisor.h:91
eLR_VSM
@ eLR_VSM
A low voltage condition caused the last reset.
Definition
IoT_Supervisor.h:90
mbWDTsm
void mbWDTsm(void)
Definition
IoT Supervisor_main.c:308
mbWDTpet
bool mbWDTpet
Definition
IoT Supervisor_main.c:300
mbWDTsmS_t
mbWDTsmS_t
Definition
IoT_Supervisor.h:72
MB_WD_TIMEOUT
uint8_t MB_WD_TIMEOUT
Definition
IoT Supervisor_main.c:298
mbWDTen
bool mbWDTen
Definition
IoT Supervisor_main.c:299
eMW_Ini
@ eMW_Ini
Initial State.
Definition
IoT_Supervisor.h:73
eMW_Timeout
@ eMW_Timeout
Timeout State. This watchdog bites!
Definition
IoT_Supervisor.h:75
eMW_En
@ eMW_En
Enable State.
Definition
IoT_Supervisor.h:74
cprif
volatile bool cprif
Definition
IoT Supervisor_main.c:190
VinSm_t
VinSm_t
Definition
IoT_Supervisor.h:49
VinSm
void VinSm(void)
Definition
IoT Supervisor_main.c:204
eVIN_Init
@ eVIN_Init
Definition
IoT_Supervisor.h:56
eVIN_VLow
@ eVIN_VLow
Voltage Low State.
Definition
IoT_Supervisor.h:57
eVIN_OK
@ eVIN_OK
Voltage in and Reset State Machine OK.
Definition
IoT_Supervisor.h:58
cfg_t
This struct is a storage type for flash memory.
Definition
IoT_Supervisor.h:134
cfg_t::pw
uint16_t pw
Definition
IoT_Supervisor.h:138
cfg_t::sid
uint8_t sid
Definition
IoT_Supervisor.h:135
cfg_t::wdto
uint8_t wdto
Definition
IoT_Supervisor.h:137
cfg_t::baud
uint8_t baud
Definition
IoT_Supervisor.h:136
sv_dev_sta_t
Definition
IoT_Supervisor.h:152
sv_dev_sta_t::b
uint8_t b
byte access
Definition
IoT_Supervisor.h:165
sv_dev_sta_t::verifSt
VerifSt_t verifSt
Definition
IoT_Supervisor.h:162
sv_dev_sta_t::wdtSmS
mbWDTsmS_t wdtSmS
Definition
IoT_Supervisor.h:160
sv_dev_sta_t::vinSmS
VinSm_t vinSmS
Definition
IoT_Supervisor.h:159
sv_dev_sta_t::lastRstS
LastRst_t lastRstS
Definition
IoT_Supervisor.h:161
inc
IoT_Supervisor.h
Generated by
1.9.8