120 if ((p_packet == NULL) || (p_data == NULL))
133 p_packet->primaryHeader.apid = apid;
134 p_packet->primaryHeader.seq = seq;
135 p_packet->primaryHeader.payloadLen = dataLen;
138 p_packet->secondaryHeader.dropCounter = 0U;
140 memcpy(p_packet->payload, p_data, dataLen);
spp_uint16_t SPP_UTIL_crc16(const spp_uint8_t *p_data, spp_uint32_t length)
Compute a CRC-16/CCITT checksum over a byte buffer.
CRC-16/CCITT checksum utility.
SPP_Packet_t * SPP_SERVICES_DATABANK_getPacket(void)
Acquire a free packet from the pool.
SPP_RetVal_t SPP_SERVICES_DATABANK_returnPacket(SPP_Packet_t *p_packet)
Return a packet to the pool after processing.
static spp_bool_t s_initialized
Tracks whether the pool has been initialised.
static spp_uint16_t packetCrc(const SPP_Packet_t *p_packet)
SPP_RetVal_t SPP_SERVICES_DATABANK_init(void)
Initialise the packet pool.
spp_uint32_t SPP_SERVICES_DATABANK_freeCount(void)
Return the number of free packets currently available.
static SPP_Packet_t s_packets[K_SPP_DATABANK_SIZE]
Static storage for all packets.
SPP_RetVal_t SPP_SERVICES_DATABANK_packetData(SPP_Packet_t *p_packet, spp_uint16_t apid, spp_uint16_t seq, const void *p_data, spp_uint16_t dataLen)
Fill a packet with data and compute its CRC.
static SPP_Databank_t s_databank
Control structure (free-list stack).
Static packet pool manager.
#define K_SPP_DATABANK_SIZE
Number of packets in the static databank pool.
Solaris Packet Protocol (SPP) packet structure definitions.
#define K_SPP_PKT_VERSION
Current SPP protocol version embedded in each packet.
#define K_SPP_PKT_PAYLOAD_MAX
Maximum payload size in bytes per packet.
Standard return-value type used across all SPP modules.
SPP_RetVal_t
Unified return type for all SPP API functions.
@ K_SPP_ERROR_ALREADY_INITIALIZED
@ K_SPP_ERROR_NULL_POINTER
@ K_SPP_ERROR_INVALID_PARAMETER
Internal databank control structure.
SPP_Packet_t * p_freePackets[K_SPP_DATABANK_SIZE]
spp_uint32_t SPP_HAL_TIME_getTimeMs(void)
Return the current hardware time in milliseconds.
SPP HAL time API — dispatches through the registered HAL port.