MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_has_rs.h
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2 * mrtk_has_rs.h : Galileo HAS RS(255,32,224) erasure decoder (internal header)
3 *
4 * High-Parity Vertical Reed-Solomon (HPVRS) outer-layer decoder for Galileo
5 * HAS message pages, per Galileo HAS SIS ICD Issue 1.0 (May 2022) section 6.
6 *
7 * GF(256) is defined by the primitive polynomial p(a) = a^8+a^4+a^3+a^2+1
8 * (0x11D). The systematic 255x32 generator matrix G = [I32; P] is built at
9 * init by polynomial-remainder encoding of the 32 unit information vectors
10 * (ICD section 6.2.2); the decoder recovers a k-page message from any k
11 * distinct received encoded pages (ICD section 6.4).
12 *
13 * Internal to src/has/ — not part of the public mrtklib API.
14 *-----------------------------------------------------------------------------*/
15#ifndef MRTK_HAS_RS_H
16#define MRTK_HAS_RS_H
17
18#include <stdint.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/**
25 * @brief Build the GF(256) log/antilog tables and the systematic generator
26 * matrix G. Idempotent: safe to call repeatedly; builds only once.
27 * @return 0 on success.
28 */
29int has_rs_init(void);
30
31/**
32 * @brief Decode a k-page HAS message from k distinct received encoded pages
33 * using the RS(255,32,224) erasure decoder (ICD section 6.4).
34 *
35 * Each received page is a 53-octet encoded payload carrying Page ID @p pids[i]
36 * (1..255). The encoded page with PID p corresponds to row p-1 of G; output
37 * column j (0-based) corresponds to message page j+1.
38 *
39 * @param[in] pages k encoded pages, pages[i] is the 53-octet payload of PID
40 * pids[i].
41 * @param[in] pids k Page IDs (each 1..255), all distinct.
42 * @param[in] k number of received pages / message pages, 1 <= k <= 32.
43 * @param[out] out recovered message, k*53 octets (message pages
44 * concatenated, page 1 first).
45 * @return 0 on success, -1 on invalid input (bad k, PID out of range,
46 * duplicate PID, or singular decoding matrix).
47 */
48int has_rs_decode(const uint8_t pages[][53], const uint8_t* pids, int k, uint8_t* out);
49
50#ifdef __cplusplus
51}
52#endif
53
54#endif /* MRTK_HAS_RS_H */
int has_rs_init(void)
Build the GF(256) log/antilog tables and the systematic generator matrix G. Idempotent: safe to call ...
int has_rs_decode(const uint8_t pages[][53], const uint8_t *pids, int k, uint8_t *out)
Decode a k-page HAS message from k distinct received encoded pages using the RS(255,...