Solaris Software
Toggle main menu visibility
Loading...
Searching...
No Matches
packet.h
Go to the documentation of this file.
1
/**
2
* @file packet.h
3
* @brief Solaris Packet Protocol (SPP) packet structure definitions.
4
*
5
* Defines the on-wire layout of an SPP packet, inspired by the ECSS Space
6
* Packet Protocol standard. Every sensor reading or telemetry message in
7
* the system is transported as an @ref SPP_Packet_t.
8
*
9
* Naming conventions used in this file:
10
* - Constants/macros: K_SPP_PKT_*
11
* - Types: SPP_Packet*_t
12
*/
13
14
#ifndef SPP_PACKET_H
15
#define SPP_PACKET_H
16
17
#include "
spp/core/types.h
"
18
19
/* ----------------------------------------------------------------
20
* Packet constants
21
* ---------------------------------------------------------------- */
22
23
/** @brief Current SPP protocol version embedded in each packet. */
24
#define K_SPP_PKT_VERSION (1U)
25
26
/** @brief Maximum payload size in bytes per packet. */
27
#define K_SPP_PKT_PAYLOAD_MAX (50U)
28
29
#define K_SPP_TOTAL_PACKET_SIZE (64U)
/**< Total packet size in bytes. Multiple of 8 bytes. */
30
31
/* ----------------------------------------------------------------
32
* Reserved APIDs
33
* ---------------------------------------------------------------- */
34
35
/** @brief APID reserved for SPP log message packets. */
36
#define K_SPP_APID_LOG (0x0001U)
37
38
/* ----------------------------------------------------------------
39
* Packet header types
40
* ---------------------------------------------------------------- */
41
42
/**
43
* @brief Primary header — routing and framing information.
44
*/
45
typedef
struct
__attribute__
((packed))
46
{
47
spp_uint8_t
version;
/**< Protocol version (= K_SPP_PKT_VERSION). */
48
spp_uint16_t
apid;
/**< Application Process Identifier. */
49
spp_uint16_t
seq;
/**< Packet sequence counter (wraps at UINT16_MAX). */
50
spp_uint16_t
payloadLen;
/**< Length of the payload field in bytes. */
51
}
SPP_PacketPrimary_t
;
52
53
/**
54
* @brief Secondary header — timing and reliability metadata.
55
*/
56
typedef
struct
__attribute__
((packed))
57
{
58
spp_uint32_t
timestampMs;
/**< System timestamp at packet creation (ms). */
59
spp_uint8_t
dropCounter;
/**< Number of packets dropped since last reset. */
60
}
SPP_PacketSecondary_t
;
61
62
/* ----------------------------------------------------------------
63
* Full packet type
64
* ---------------------------------------------------------------- */
65
66
/**
67
* @brief Complete SPP packet.
68
*
69
* Producers fill @c primaryHeader, @c secondaryHeader, and @c payload, then
70
* push the packet into the @c db_flow FIFO. Consumers pop it, process it,
71
* and return it to the databank.
72
*/
73
typedef
struct
__attribute__
((packed))
74
{
75
SPP_PacketPrimary_t
primaryHeader;
/**< Routing / framing header. */
76
SPP_PacketSecondary_t
secondaryHeader;
/**< Timing / metadata header. */
77
spp_uint8_t
payload[
K_SPP_PKT_PAYLOAD_MAX
];
/**< Raw payload bytes. */
78
spp_uint16_t
crc;
/**< CRC-16 over the full packet (0 = not computed). */
79
}
SPP_Packet_t
;
80
81
#endif
/* SPP_PACKET_H */
SPP_PacketPrimary_t
SPP_PacketPrimary_t
Definition
packet.h:51
SPP_PacketSecondary_t
SPP_PacketSecondary_t
Definition
packet.h:60
SPP_Packet_t
SPP_Packet_t
Definition
packet.h:79
K_SPP_PKT_PAYLOAD_MAX
#define K_SPP_PKT_PAYLOAD_MAX
Maximum payload size in bytes per packet.
Definition
packet.h:27
__attribute__
struct __attribute__((packed))
Primary header — routing and framing information.
Definition
packet.h:45
types.h
Portable integer types and SPI/storage configuration types for SPP.
spp_uint16_t
uint16_t spp_uint16_t
Definition
types.h:29
spp_uint32_t
uint32_t spp_uint32_t
Definition
types.h:31
spp_uint8_t
uint8_t spp_uint8_t
Definition
types.h:27
solaris-v2
spp
core
packet.h
Generated by
1.18.0