GNU Radio's DAB Package
crc16_bb_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2017 by Moritz 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 #ifndef INCLUDED_DAB_CRC16_BB_IMPL_H
22 #define INCLUDED_DAB_CRC16_BB_IMPL_H
23 
24 #include <grdab/crc16_bb.h>
25 
26 namespace gr {
27  namespace dab {
28 /*! \brief crc16 is written in the last 2 bits of input vector
29  *
30  * input: char vector of length length (packed bytes)
31  *
32  * output: char vector of length length (packed bytes) with crc at last 2 bytes (overwrites last 2 bytes)
33  *
34  * uses the crc16 function to calculate a 2 byte crc word and write it to the FIB (overwrites last 2 bytes)
35  *
36  * @param length Length of input and output vector in bytes. (default is 32 for DAB FIBs)
37  * @param generator Generator polynom for shift register. (default is 0x1021 for DAB)
38  * @param initial_state Initial state of shift register. (default is 0xffff for DAB)
39  */
40  class crc16_bb_impl : public crc16_bb {
41  private:
42  uint16_t d_crc;
43  int d_length, d_generator, d_initial_state;
44 
45  public:
46  crc16_bb_impl(int length, uint16_t generator, uint16_t initial_state);
47 
49 
50  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
51 
52  int general_work(int noutput_items,
53  gr_vector_int &ninput_items,
54  gr_vector_const_void_star &input_items,
55  gr_vector_void_star &output_items);
56  };
57 
58  }
59 }
60 
61 #endif /* INCLUDED_DAB_CRC16_BB_IMPL_H */
gr::dab::crc16_bb_impl::~crc16_bb_impl
~crc16_bb_impl()
gr::dab::crc16_bb_impl
crc16 is written in the last 2 bits of input vector
Definition: crc16_bb_impl.h:40
gr::dab::crc16_bb_impl::general_work
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
gr::dab::crc16_bb_impl::forecast
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
gr::dab::crc16_bb_impl::crc16_bb_impl
crc16_bb_impl(int length, uint16_t generator, uint16_t initial_state)
crc16_bb.h
gr
Definition: complex_to_interleaved_float_vcf.h:28
gr::dab::crc16_bb
crc16 is written in the last 2 bits of input vector
Definition: crc16_bb.h:44