2017-03-28 17:08:59 +00:00
|
|
|
/*!
|
|
|
|
* \file bits.h
|
2020-01-21 18:53:33 +00:00
|
|
|
* \brief Utilities for bit manipulation of the libswiftnav library
|
2017-03-28 17:08:59 +00:00
|
|
|
* \author Fergus Noble <fergus@swift-nav.com>
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2017-03-28 17:08:59 +00:00
|
|
|
* This file was originally borrowed from libswiftnav
|
|
|
|
* <https://github.com/swift-nav/libswiftnav>,
|
|
|
|
* a portable C library implementing GNSS related functions and algorithms,
|
|
|
|
* and then modified by J. Arribas and C. Fernandez
|
|
|
|
*
|
2017-03-23 14:45:41 +00:00
|
|
|
* Copyright (C) 2013, 2016 Swift Navigation Inc.
|
|
|
|
* Contact: Fergus Noble <fergus@swift-nav.com>
|
|
|
|
*
|
2017-03-28 17:08:59 +00:00
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: LGPL-3.0-only
|
|
|
|
*.
|
2017-03-23 14:45:41 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_BITS_H
|
|
|
|
#define GNSS_SDR_BITS_H
|
2017-03-23 14:45:41 +00:00
|
|
|
|
|
|
|
#include "swift_common.h"
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Telemetry_Decoder
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Telemetry_Decoder_libswiftcnav telemetry_decoder_libswiftcnav
|
|
|
|
* Utilities for CNAV message decoding by Swift Navigation Inc.
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2019-02-22 11:22:24 +00:00
|
|
|
uint8_t parity(uint32_t x);
|
|
|
|
uint32_t getbitu(const uint8_t *buff, uint32_t pos, uint8_t len);
|
|
|
|
int32_t getbits(const uint8_t *buff, uint32_t pos, uint8_t len);
|
|
|
|
void setbitu(uint8_t *buff, uint32_t pos, uint32_t len, uint32_t data);
|
|
|
|
void setbits(uint8_t *buff, uint32_t pos, uint32_t len, int32_t data);
|
|
|
|
void bitcopy(void *dst, uint32_t dst_index,
|
|
|
|
const void *src, uint32_t src_index, uint32_t count);
|
|
|
|
void bitshl(void *buf, uint32_t size, uint32_t shift);
|
|
|
|
uint8_t count_bits_u64(uint64_t v, uint8_t bv);
|
|
|
|
uint8_t count_bits_u32(uint32_t v, uint8_t bv);
|
|
|
|
uint8_t count_bits_u16(uint16_t v, uint8_t bv);
|
|
|
|
uint8_t count_bits_u8(uint8_t v, uint8_t bv);
|
2017-03-23 14:45:41 +00:00
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2019-03-17 12:53:31 +00:00
|
|
|
#endif /* GNSS_SDR_BITS_H_ */
|