Lely core libraries
2.3.4
|
Go to the documentation of this file.
70 __co_nmt_hb_alloc(
void)
81 __co_nmt_hb_free(
void *ptr)
101 goto error_create_recv;
108 goto error_create_timer;
147 if (!__co_nmt_hb_init(hb,
net,
nmt)) {
155 __co_nmt_hb_free(hb);
165 __co_nmt_hb_fini(hb);
166 __co_nmt_hb_free(hb);
217 co_unsigned8_t
st = msg->
data[0];
228 co_unsigned8_t old_st = hb->
st;
229 int old_state = hb->
state;
234 "NMT: heartbeat time out resolved for node %d",
244 "NMT: heartbeat state change occurred for node %d",
262 diag(
DIAG_INFO, 0,
"NMT: heartbeat time out occurred for node %d",
void can_recv_destroy(can_recv_t *recv)
Destroys a CAN frame receiver.
co_unsigned8_t id
The node-ID.
uint_least8_t data[CAN_MSG_MAX_LEN]
The frame payload (in case of a data frame).
void co_nmt_hb_ind(co_nmt_t *nmt, co_unsigned8_t id, int state, int reason, co_unsigned8_t st)
The CANopen NMT heartbeat indication function, invoked when a heartbeat event occurs.
int state
Indicates whether a heartbeat error occurred (CO_NMT_EC_OCCURRED or CO_NMT_EC_RESOLVED).
@ DIAG_INFO
An informational message.
A CAN or CAN FD format frame.
#define CO_NUM_NODES
The maximum number of nodes in a CANopen network.
uint_least8_t len
The number of bytes in data (or the requested number of bytes in case of a remote frame).
void co_nmt_hb_set_st(co_nmt_hb_t *hb, co_unsigned8_t st)
Sets the expected state of a remote NMT node.
can_net_t * net
A pointer to a CAN network interface.
void can_timer_set_func(can_timer_t *timer, can_timer_func_t *func, void *data)
Sets the callback function invoked when a CAN timer is triggered.
void can_timer_stop(can_timer_t *timer)
Stops a CAN timer and unregisters it with a network interface.
void can_recv_set_func(can_recv_t *recv, can_recv_func_t *func, void *data)
Sets the callback function used to process CAN frames with a receiver.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
co_nmt_t * nmt
A pointer to an NMT master/slave service.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
co_nmt_hb_t * co_nmt_hb_create(can_net_t *net, co_nmt_t *nmt)
Creates a new CANopen NMT heartbeat consumer service.
#define CO_NMT_EC_CANID(id)
The CAN identifier used for both node guarding and heartbeat monitoring.
@ CO_NMT_EC_TIMEOUT
An NMT error control timeout event.
co_unsigned8_t st
The state of the node (excluding the toggle bit).
@ CO_NMT_EC_RESOLVED
An NMT error control event was resolved.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
void can_timer_destroy(can_timer_t *timer)
Destroys a CAN timer.
#define CO_NMT_ST_TOGGLE
The mask to get/set the toggle bit from an NMT state.
A CANopen NMT master/slave service.
A CANopen NMT heartbeat consumer.
@ CO_NMT_EC_OCCURRED
An NMT error control event occurred.
can_timer_t * timer
A pointer to the CAN timer.
void diag(enum diag_severity severity, int errc, const char *format,...)
Emits a diagnostic message.
void can_recv_start(can_recv_t *recv, can_net_t *net, uint_least32_t id, uint_least8_t flags)
Registers a CAN frame receiver with a network interface and starts processing frames.
can_recv_t * recv
A pointer to the CAN frame receiver.
void co_nmt_hb_set_1016(co_nmt_hb_t *hb, co_unsigned8_t id, co_unsigned16_t ms)
Processes the value of CANopen object 1016 (Consumer heartbeat time) for the specified heartbeat cons...
static int co_nmt_hb_recv(const struct can_msg *msg, void *data)
The CAN receive callback function for a heartbeat consumer.
@ CO_NMT_EC_STATE
An NMT error control state change event.
co_unsigned16_t ms
The consumer heartbeat time (in milliseconds).
void can_recv_stop(can_recv_t *recv)
Stops a CAN frame receiver from processing frames and unregisters it with the network interface.
void co_nmt_hb_destroy(co_nmt_hb_t *hb)
Destroys a CANopen NMT heartbeat consumer service.
static int co_nmt_hb_timer(const struct timespec *tp, void *data)
The CAN timer callback function for a heartbeat consumer.
can_recv_t * can_recv_create(void)
Creates a new CAN frame receiver.
can_timer_t * can_timer_create(void)
Creates a new CAN timer.
void can_timer_timeout(can_timer_t *timer, can_net_t *net, int timeout)
Starts a CAN timer and registers it with a network interface.
uint_least32_t id
The identifier (11 or 29 bits, depending on the CAN_FLAG_IDE flag).