MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_bits.h File Reference

MRTKLIB Bits Module — Binary bit operations and CRC functions. More...

#include <stdint.h>
Include dependency graph for mrtk_bits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint32_t getbitu (const uint8_t *buff, int pos, int len)
 Extract unsigned bits from byte data.
int32_t getbits (const uint8_t *buff, int pos, int len)
 Extract signed bits from byte data.
void setbitu (uint8_t *buff, int pos, int len, uint32_t data)
 Set unsigned bits in byte data.
void setbits (uint8_t *buff, int pos, int len, int32_t data)
 Set signed bits in byte data.
uint32_t rtk_crc32 (const uint8_t *buff, int len)
 Compute CRC-32 parity for NovAtel raw data.
uint32_t rtk_crc24q (const uint8_t *buff, int len)
 Compute CRC-24Q parity for SBAS and RTCM3.
uint16_t rtk_crc16 (const uint8_t *buff, int len)
 Compute CRC-16 parity for BINEX and NVS.
int decode_word (uint32_t word, uint8_t *data)
 Check parity and decode GPS navigation data word.

Detailed Description

MRTKLIB Bits Module — Binary bit operations and CRC functions.

This header provides bit-level extraction/insertion functions (getbitu, getbits, setbitu, setbits), CRC parity computation (rtk_crc32, rtk_crc24q, rtk_crc16), and GPS navigation word decoding (decode_word), extracted from rtkcmn.c with zero algorithmic changes.

Note
Functions declared here are implemented in mrtk_bits.c.

Definition in file mrtk_bits.h.

Function Documentation

◆ decode_word()

int decode_word ( uint32_t word,
uint8_t * data )

Check parity and decode GPS navigation data word.

Parameters
[in]wordNavigation data word (2+30 bit) (previous word D29*-30* + current word D1-30)
[out]dataDecoded navigation data without parity (8bit x 3)
Returns
Status (1:ok, 0:parity error)
Note
See reference [1] 20.3.5.2 user parity algorithm

Definition at line 224 of file mrtk_bits.c.

References trace().

Referenced by input_rtcm2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getbits()

int32_t getbits ( const uint8_t * buff,
int pos,
int len )

Extract signed bits from byte data.

Parameters
[in]buffByte data
[in]posBit position from start of data (bits)
[in]lenBit length (bits) (len<=32)
Returns
Extracted signed bits

Definition at line 107 of file mrtk_bits.c.

References getbitu().

Referenced by decode_alm_sat(), decode_bds_d1_eph(), decode_bds_d1_ion(), decode_bds_d1_utc(), decode_bds_d2_eph(), decode_bds_d2_utc(), decode_bnx_7f_05(), decode_bnx_7f_05_obs(), decode_cssr_grid(), decode_frame_eph(), decode_frame_ion(), decode_frame_utc(), decode_gal_fnav_eph(), decode_gal_fnav_ion(), decode_gal_fnav_utc(), decode_gal_inav_eph(), decode_gal_inav_ion(), decode_gal_inav_utc(), decode_glostr_utc(), decode_has_clock(), decode_has_clock_subset(), decode_has_codebias(), decode_has_orbit(), decode_has_phasebias(), decode_irn_eph(), decode_irn_ion(), decode_irn_utc(), decode_longcorr0(), decode_longcorr1(), decode_mcssr_cb(), decode_mcssr_cc(), decode_mcssr_oc(), decode_mcssr_pb(), decode_measepoch(), decode_miono_correction(), decode_miono_coverage(), decode_msm4(), decode_msm5(), decode_msm6(), decode_msm7(), decode_sbstype2(), decode_sbstype24(), decode_sbstype9(), decode_ssr1(), decode_ssr2(), decode_ssr3(), decode_ssr4(), decode_ssr6(), decode_ssr7(), decode_sval(), decode_type1(), decode_type1002(), decode_type1004(), decode_type1010(), decode_type1012(), decode_type1019(), decode_type1041(), decode_type1042(), decode_type1044(), decode_type1045(), decode_type1046(), decode_type1230(), decode_type17(), decode_type18(), decode_type22(), decode_type3(), decode_type4050(), getbits2(), getbits3(), and getbits_38().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getbitu()

uint32_t getbitu ( const uint8_t * buff,
int pos,
int len )

Extract unsigned bits from byte data.

Parameters
[in]buffByte data
[in]posBit position from start of data (bits)
[in]lenBit length (bits) (len<=32)
Returns
Extracted unsigned bits

Definition at line 99 of file mrtk_bits.c.

Referenced by check_bit_width_atmos(), check_bit_width_bias(), check_bit_width_combo(), check_bit_width_grid(), check_bit_width_mask(), check_bit_width_si(), check_bit_width_stec(), decode_alm_gps(), decode_alm_qzs(), decode_alm_sat(), decode_bds_d1_eph(), decode_bds_d1_ion(), decode_bds_d1_utc(), decode_bds_d2_eph(), decode_bds_d2_utc(), decode_bdsraw(), decode_bnx_7f_05(), decode_bnx_7f_05_obs(), decode_cnav(), decode_cresgloeph(), decode_cssr_atmos(), decode_cssr_bias(), decode_cssr_combo(), decode_cssr_grid(), decode_cssr_head(), decode_cssr_mask(), decode_cssr_oc(), decode_cssr_pb(), decode_cssr_si(), decode_cssr_stec(), decode_cssr_ura(), decode_enav(), decode_frame_alm(), decode_frame_eph(), decode_frame_ion(), decode_frame_utc(), decode_gal_fnav_eph(), decode_gal_fnav_ion(), decode_gal_fnav_utc(), decode_gal_inav_eph(), decode_gal_inav_ion(), decode_gal_inav_utc(), decode_galrawfnav(), decode_galrawinav(), decode_glorawca(), decode_glostr_eph(), decode_glostr_utc(), decode_gnav(), decode_has_clock(), decode_has_clock_subset(), decode_has_mask(), decode_has_mt1(), decode_has_orbit(), decode_has_phasebias(), decode_head1001(), decode_head1009(), decode_irn_eph(), decode_irn_ion(), decode_irn_utc(), decode_L1nav(), decode_L2nav(), decode_L5nav(), decode_lclhead(), decode_lcliono(), decode_lcltrop(), decode_longcorr0(), decode_longcorr1(), decode_longcorrh(), decode_mcssr_head(), decode_mcssr_mask(), decode_mcssr_oc(), decode_mcssr_pb(), decode_mcssr_ura(), decode_miono_correction(), decode_miono_coverage(), decode_msm4(), decode_msm5(), decode_msm6(), decode_msm7(), decode_msm_head(), decode_nav(), decode_navicraw(), decode_qzs_msg(), decode_qzss_l6dmsg(), decode_qzss_l6emsg(), decode_rawca(), decode_rtcm2(), decode_rtcm3(), decode_rxmsfrb(), decode_sbstype1(), decode_sbstype18(), decode_sbstype2(), decode_sbstype24(), decode_sbstype26(), decode_sbstype6(), decode_sbstype7(), decode_sbstype9(), decode_ssr1(), decode_ssr1_head(), decode_ssr2(), decode_ssr2_head(), decode_ssr3(), decode_ssr4(), decode_ssr5(), decode_ssr6(), decode_ssr7(), decode_ssr7_head(), decode_ssr_epoch(), decode_stqbds(), decode_type1(), decode_type1002(), decode_type1004(), decode_type1005(), decode_type1006(), decode_type1007(), decode_type1008(), decode_type1010(), decode_type1012(), decode_type1019(), decode_type1020(), decode_type1029(), decode_type1033(), decode_type1041(), decode_type1042(), decode_type1044(), decode_type1045(), decode_type1046(), decode_type1230(), decode_type14(), decode_type16(), decode_type17(), decode_type18(), decode_type19(), decode_type22(), decode_type4050(), decode_type4073(), decode_type4076(), detslp_ll(), getbitg(), getbitg(), getbits(), getbits2(), getbits3(), getbits_38(), getbitu2(), getbitu3(), has_input_page(), input_rtcm3(), inputobs(), popcount_field(), save_msm_obs(), sbsupdatecorr(), and test_staid().

◆ rtk_crc16()

uint16_t rtk_crc16 ( const uint8_t * buff,
int len )

Compute CRC-16 parity for BINEX and NVS.

Parameters
[in]buffData buffer
[in]lenData length (bytes)
Returns
CRC-16 parity

Definition at line 199 of file mrtk_bits.c.

References tbl_CRC16, and trace().

Referenced by decode_bnx(), and decode_sbf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rtk_crc24q()

uint32_t rtk_crc24q ( const uint8_t * buff,
int len )

Compute CRC-24Q parity for SBAS and RTCM3.

Parameters
[in]buffData buffer
[in]lenData length (bytes)
Returns
CRC-24Q parity

Definition at line 181 of file mrtk_bits.c.

References tbl_CRC24Q, and trace().

Referenced by decode_enav(), decode_galrawfnav(), decode_galrawinav(), gen_rtcm3(), input_rtcm3(), and sbsdecodemsg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rtk_crc32()

uint32_t rtk_crc32 ( const uint8_t * buff,
int len )

Compute CRC-32 parity for NovAtel raw data.

Parameters
[in]buffData buffer
[in]lenData length (bytes)
Returns
CRC-32 parity
Note
See NovAtel OEMV firmware manual 1.7 32-bit CRC

Definition at line 156 of file mrtk_bits.c.

References POLYCRC32, and trace().

Referenced by decode_oem4().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setbits()

void setbits ( uint8_t * buff,
int pos,
int len,
int32_t data )

Set signed bits in byte data.

Parameters
[in,out]buffByte data
[in]posBit position from start of data (bits)
[in]lenBit length (bits) (len<=32)
[in]dataSigned data to set

Definition at line 136 of file mrtk_bits.c.

References setbitu().

Referenced by encode_msm_phrng(), encode_msm_phrng_ex(), encode_msm_psrng(), encode_msm_psrng_ex(), encode_msm_rrate(), encode_ssr1(), encode_ssr2(), encode_ssr3(), encode_ssr4(), encode_ssr6(), encode_ssr7(), encode_type1001(), encode_type1002(), encode_type1003(), encode_type1004(), encode_type1009(), encode_type1010(), encode_type1011(), encode_type1012(), encode_type1019(), encode_type1041(), encode_type1042(), encode_type1044(), encode_type1045(), encode_type1046(), encode_type1230(), encode_type63(), and set38bits().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setbitu()

void setbitu ( uint8_t * buff,
int pos,
int len,
uint32_t data )

Set unsigned bits in byte data.

Parameters
[in,out]buffByte data
[in]posBit position from start of data (bits)
[in]lenBit length (bits) (len<=32)
[in]dataUnsigned data to set

Definition at line 122 of file mrtk_bits.c.

Referenced by clas_input_cssr(), decode_bdsraw(), decode_cnav(), decode_enav(), decode_galrawfnav(), decode_galrawinav(), decode_georawl1(), decode_glorawca(), decode_L1nav(), decode_lD(), decode_nav(), decode_navicraw(), decode_rawca(), decode_rxmsfrb(), decode_snav(), decode_stqbds(), decode_stqglo(), detslp_ll(), encode_head(), encode_lclhead(), encode_lcliono(), encode_lcltrop(), encode_msm_cnr(), encode_msm_cnr_ex(), encode_msm_half_amb(), encode_msm_head(), encode_msm_info(), encode_msm_int_rrng(), encode_msm_lock(), encode_msm_lock_ex(), encode_msm_mod_rrng(), encode_msm_rate(), encode_ssr1(), encode_ssr2(), encode_ssr3(), encode_ssr4(), encode_ssr5(), encode_ssr6(), encode_ssr7(), encode_ssr_head(), encode_type1001(), encode_type1002(), encode_type1003(), encode_type1004(), encode_type1005(), encode_type1006(), encode_type1007(), encode_type1008(), encode_type1009(), encode_type1010(), encode_type1011(), encode_type1012(), encode_type1019(), encode_type1020(), encode_type1033(), encode_type1041(), encode_type1042(), encode_type1044(), encode_type1045(), encode_type1046(), encode_type1230(), encode_type63(), gen_rtcm3(), set38bits(), setbitg(), and setbits().

Here is the caller graph for this function: