GNU Radio's SATELLITES Package

crc_check.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2022 Daniel Estevez <daniel@destevez.net>
4 *
5 * This file is part of gr-satellites
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_SATELLITES_CRC_CHECK_H
12#define INCLUDED_SATELLITES_CRC_CHECK_H
13
14#include <gnuradio/block.h>
15#include <satellites/api.h>
16
17#include <stdint.h>
18
19 namespace gr {
20 namespace satellites {
21
22/*!
23 * \brief Check the CRC at the end of a PDU
24 * \ingroup satellites
25 *
26 * \details
27 * The CRC append block receives a PDU containing a CRC at its end,
28 * and checks whether the CRC is correct. The PDU is sent over the ok
29 * or fail output ports according to the result of this check.
30 * It can support any CRC whose size is a multiple of 8 bits between
31 * 8 and 64 bits.
32 */
33 class SATELLITES_API crc_check : virtual public gr::block
34{
35 public:
36 typedef boost::shared_ptr<crc_check> sptr;
37
38 /*!
39 * \brief Build the CRC append block.
40 *
41 * \param num_bits CRC size in bits (must be a multiple of 8)
42 * \param poly CRC polynomial, in MSB-first notation
43 * \param initial_value Initial register value
44 * \param final_xor Final XOR value
45 * \param input_reflected true if the input is LSB-first, false if not
46 * \param result_reflected true if the output is LSB-first, false if not
47 * \param swap_endianness true if the CRC is stored as little-endian in the PDU,
48 false if not
49 * \param discard_crc If true, the CRC is removed from the PDU before sending
50 it to the output port. If false, the CRC is preserved in the outupt PDU.
51 * \param skip_header_bytes gives the number of header byte to skip in the CRC
52 calculation
53 */
54 static sptr make(unsigned num_bits,
55 uint64_t poly,
56 uint64_t initial_value,
57 uint64_t final_xor,
58 bool input_reflected,
59 bool result_reflected,
60 bool swap_endianness,
61 bool discard_crc = false,
62 unsigned skip_header_bytes = 0);
63};
64
65} // namespace satellites
66} // namespace gr
67
68#endif /* INCLUDED_SATELLITES_CRC_CHECK_H */
api.h
SATELLITES_API
#define SATELLITES_API
Definition api.h:31
gr::satellites::crc_check
Check the CRC at the end of a PDU.
Definition crc_check.h:34
gr::satellites::crc_check::make
static sptr make(unsigned num_bits, uint64_t poly, uint64_t initial_value, uint64_t final_xor, bool input_reflected, bool result_reflected, bool swap_endianness, bool discard_crc=false, unsigned skip_header_bytes=0)
Build the CRC append block.
gr::satellites::crc_check::sptr
boost::shared_ptr< crc_check > sptr
Definition crc_check.h:36
gr::satellites
Definition ax100_decode.h:18
gr
Definition ax100_decode.h:17