GNU Radio's DAB Package
crc16_bb.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2017Moritz Luca Schmid, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT).
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21
22#ifndef INCLUDED_DAB_CRC16_BB_H
23#define INCLUDED_DAB_CRC16_BB_H
24
25#include <dab/api.h>
26#include <gnuradio/block.h>
27
28namespace gr {
29 namespace dab {
30
31/*! \brief crc16 is written in the last 2 bits of input vector
32 *
33 * input: char vector of length length (packed bytes)
34 *
35 * output: char vector of length length (packed bytes) with crc at last 2 bytes (overwrites last 2 bytes)
36 *
37 * uses the crc16 function to calculate a 2 byte crc word and write it to the FIB (overwrites last 2 bytes)
38 *
39 * @param length Length of input and output vector in bytes. (default is 32 for DAB FIBs)
40 * @param generator Generator polynom for shift register. (default is 0x1021 for DAB)
41 * @param initial_state Initial state of shift register. (default is 0xffff for DAB)
42 */
43 class DAB_API crc16_bb : virtual public gr::block
44 {
45 public:
46 typedef std::shared_ptr<crc16_bb> sptr;
47
48 /*!
49 * \brief Return a shared_ptr to a new instance of dab::crc16_bb.
50 *
51 * To avoid accidental use of raw pointers, dab::crc16_bb's
52 * constructor is in a private implementation
53 * class. dab::crc16_bb::make is the public interface for
54 * creating new instances.
55 */
56 static sptr make(int length, uint16_t generator, uint16_t initial_state);
57 };
58
59 } // namespace dab
60} // namespace gr
61
62#endif /* INCLUDED_DAB_CRC16_BB_H */
63
#define DAB_API
Definition api.h:19
crc16 is written in the last 2 bits of input vector
Definition crc16_bb.h:44
static sptr make(int length, uint16_t generator, uint16_t initial_state)
Return a shared_ptr to a new instance of dab::crc16_bb.
std::shared_ptr< crc16_bb > sptr
Definition crc16_bb.h:46
Definition complex_to_interleaved_float_vcf.h:28