Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
rte_dual_msgchannel.h
Go to the documentation of this file.
1
41#ifndef RTE_DUAL_MSGCHANNEL_H
42#define RTE_DUAL_MSGCHANNEL_H
43
44#include <stdint.h>
45
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
58#define RTE_DUAL_MSGCHANNEL_MAX_PAYLOAD 248U
59
67typedef struct rte_dual_msgchannel_s
68{
70 uint32_t sender_id;
72 uint32_t next_sequence;
76
78typedef struct rte_dual_msgchannel_config_s
79{
88 uint32_t sender_id;
94
106
115 const rte_dual_msgchannel_config_t *config);
116
138 const uint8_t *payload,
139 uint8_t payload_size,
140 rte_duration_ms_t timeout_ms,
141 uint32_t *out_sequence);
142
172 uint8_t *out_payload,
173 uint8_t payload_max_size,
174 rte_duration_ms_t timeout_ms,
175 uint8_t *out_payload_size,
176 uint32_t *out_sequence);
177
191
192#ifdef __cplusplus
193}
194#endif
195
196#endif /* RTE_DUAL_MSGCHANNEL_H */
197
rte_status_t rte_dual_msgchannel_receive(rte_dual_msgchannel_t *channel, uint8_t *out_payload, uint8_t payload_max_size, rte_duration_ms_t timeout_ms, uint8_t *out_payload_size, uint32_t *out_sequence)
Receives one frame over config->link, blocking at most timeout_ms, verifies its CRC-64 and sequence c...
rte_status_t rte_dual_msgchannel_reset_sequence(rte_dual_msgchannel_t *channel)
Resets both sequence counters to 0. Intended to be called by the caller (typically rte_dual_channel_t...
rte_status_t rte_dual_msgchannel_init(rte_dual_msgchannel_t *channel, const rte_dual_msgchannel_config_t *config)
Initializes a rte_dual_msgchannel_t: starts both sequence counters at 0.
rte_status_t rte_dual_msgchannel_set_resync_on_sequence_error(rte_dual_msgchannel_t *channel, bool enable)
Turns sequence resynchronisation on or off (default off after init).
rte_status_t rte_dual_msgchannel_send(rte_dual_msgchannel_t *channel, const uint8_t *payload, uint8_t payload_size, rte_duration_ms_t timeout_ms, uint32_t *out_sequence)
Wraps payload in a rte_vital_message_t (this channel's own sender_id and next sequence_number) and se...
rte_status_t
Common result/status codes.
Definition rte_status.h:27
uint32_t rte_duration_ms_t
Definition rte_types.h:27
Checksum and CRC utilities for data integrity in redundant systems.
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
Configuration for rte_dual_msgchannel_init().
One rte_dual_msgchannel_t instance's state. Caller-owned storage (REQ-DUAL-MSGCHANNEL-001); opaque in...
rte_netlink_handle_t link