-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathco_node_guard.h
64 lines (56 loc) · 1.55 KB
/
co_node_guard.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*********************************************************************
* _ _ _
* _ __ | |_ _ | | __ _ | |__ ___
* | '__|| __|(_)| | / _` || '_ \ / __|
* | | | |_ _ | || (_| || |_) |\__ \
* |_| \__|(_)|_| \__,_||_.__/ |___/
*
* www.rt-labs.com
* Copyright 2017 rt-labs AB, Sweden.
*
* This software is dual-licensed under GPLv3 and a commercial
* license. See the file LICENSE.md distributed with this software for
* full license information.
********************************************************************/
/**
* @file
* @brief Handles node guarding protocol
*/
#ifndef CO_NODE_GUARD_H
#define CO_NODE_GUARD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "co_api.h"
#include "co_main.h"
/**
* Receive node guard message
*
* This function should be called when a node guard message is
* received. The node guard timestamp will be updated.
*
* @param net network handle
* @param id CAN ID
* @param msg CAN message
* @param dlc size of CAN message
*
* @return 0 always
*/
int co_node_guard_rx (co_net_t * net, uint32_t id, void * msg, size_t dlc);
/**
* Node guard timer
*
* This function performs the node guard protocol and should be called
* periodically. An emergency will be triggered if node guarding has
* expired.
*
* @param net network handle
* @param now current timestamp
*
* @return 0 on success, -1 on failure
*/
int co_node_guard_timer (co_net_t * net, os_tick_t now);
#ifdef __cplusplus
}
#endif
#endif /* CO_NODE_GUARD_H */