GNU Radio's SATELLITES Package

crc_append.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_APPEND_H
12#define INCLUDED_SATELLITES_CRC_APPEND_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 Calculates and appends a CRC to a PDU
24 * \ingroup satellites
25 *
26 * \details
27 * The CRC append block receives a PDU, calculates the CRC of the PDU
28 * data, appends it to the PDU, and sends that as its output.
29 * It can support any CRC whose size is a multiple of 8 bits between
30 * 8 and 64 bits.
31 */
32 class SATELLITES_API crc_append : virtual public gr::block
33{
34 public:
35 typedef boost::shared_ptr<crc_append> sptr;
36
37 /*!
38 * \brief Build the CRC append block.
39 *
40 * \param num_bits CRC size in bits (must be a multiple of 8)
41 * \param poly CRC polynomial, in MSB-first notation
42 * \param initial_value Initial register value
43 * \param final_xor Final XOR value
44 * \param input_reflected true if the input is LSB-first, false if not
45 * \param result_reflected true if the output is LSB-first, false if not
46 * \param swap_endianness true if the CRC is stored as little-endian in the PDU,
47 false if not
48 * \param skip_header_bytes gives the number of header byte to skip in the CRC
49 calculation
50 */
51 static sptr make(unsigned num_bits,
52 uint64_t poly,
53 uint64_t initial_value,
54 uint64_t final_xor,
55 bool input_reflected,
56 bool result_reflected,
57 bool swap_endianness,
58 unsigned skip_header_bytes = 0);
59};
60
61} // namespace satellites
62} // namespace gr
63
64#endif /* INCLUDED_SATELLITES_CRC_APPEND_H */
api.h
SATELLITES_API
#define SATELLITES_API
Definition api.h:31
gr::satellites::crc_append
Calculates and appends a CRC to a PDU.
Definition crc_append.h:33
gr::satellites::crc_append::sptr
boost::shared_ptr< crc_append > sptr
Definition crc_append.h:35
gr::satellites::crc_append::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, unsigned skip_header_bytes=0)
Build the CRC append block.
gr::satellites
Definition ax100_decode.h:18
gr
Definition ax100_decode.h:17