GNU Radio's SATNOGS Package
frame_acquisition.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
4  *
5  * Copyright (C) 2018, Libre Space Foundation <http://librespacefoundation.org/>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef INCLUDED_SATNOGS_FRAME_ACQUISITION_H
22 #define INCLUDED_SATNOGS_FRAME_ACQUISITION_H
23 
24 #include <satnogs/api.h>
25 #include <satnogs/whitening.h>
26 #include <gnuradio/sync_block.h>
27 
28 namespace gr {
29 namespace satnogs {
30 
31 /*!
32  * \brief A generic frame acquisition block
33  *
34  * A generic frame acquisition block trying to cover a variaty of different
35  * framing schemes.
36  *
37  * The goal of this block is to provide a unified way to acquire the frame
38  * from different satellites with different but closely related framing schemes.
39  * To keep the logic inside the block simple, it assumes that the received
40  * bit stream is ready for framing extraction. Any bit stream coding, like
41  * NRZI, Manchester, etc should be done prior this block.
42  *
43  * Currently the supported are:
44  * - TI framing, constant frame length
45  * - TI framing, variable frame length
46  * - TI like framing, variable frame length with a 12-bit frame legth field
47  * coded with Golay (24, 12, 8) scheme.
48  *
49  * The block supports also an arbitrary descrambler (if provided) using the
50  * satnogs::whitening claass.
51  *
52  * For the CRC calculation (if any) the currently supported schemes are:
53  * - CRC16-CCITT
54  * - Reversed CRC16-CCITT
55  * - CRC16-IBM
56  * - CRC32-CCITT
57  *
58  * \ingroup satnogs
59  *
60  */
61 class SATNOGS_API frame_acquisition : virtual public gr::sync_block {
62 public:
63  typedef boost::shared_ptr<frame_acquisition> sptr;
64 
65  /**
66  * Different framing schemes variants
67  */
68  typedef enum {
69  GENERIC_CONSTANT_FRAME_LEN = 0,//!< TI CCXXX like, constant frame length
70  GENERIC_VAR_FRAME_LEN, //!< TI CCXXX like, variable frame length
71  GOLAY24_CODED_FRAME_LEN //!< TI CCXXX like, variable frame length, 12-bit frame legth field coded with Golay (24, 12, 8)
72  } variant_t;
73 
74  typedef enum {
75  CRC_NONE = 0,
79  CRC32
80  } checksum_t;
81 
82 
83  /**
84  * A generic frame acquisition block trying to cover a variaty of different
85  * framing schemes.
86  *
87  * The goal of this block is to provide a unified way to acquire the frame
88  * from different satellites with different but closely related framing schemes.
89  * To keep the logic inside the block simple, it assumes that the received
90  * bit stream is ready for framing extraction. Any bit stream coding, like
91  * NRZI, Manchester, etc should be done prior this block.
92  *
93  * @param variant the framing variant
94  *
95  * @param preamble the preamble should be a repeated word. Note that due to AGC
96  * settling, the receiver may not receive the whole preamble. If the preamble
97  * is indeed a repeated pattern, a portion of it can be given as parameter.
98  * The block should be able to deal with this. However, a quite small subset
99  * may lead to a larger number of false alarms.
100  *
101  * @param preamble_threshold the maximum number of bits that are
102  * allowed to be wrong at the preamble
103  *
104  * @param sync the sysnchronization work following the preamble
105  *
106  * @param sync_threshold the maximum number of bits that are
107  * allowed to be wrong at the synchronization word
108 
109  * @param frame_size_field_len the length of the field describing the frame
110  * length. I most cases should be 1 or 2.
111  *
112  * @param frame_len if the variant dictates a constant frame length, this
113  * parameter provides the length of the frame
114  *
115  * @param crc the CRC scheme to use
116  * @param descrambler the descramble used
117  * @param max_frame_len the maximum allowed frame length
118  * @return a shared pointer of a frame_acquisition block
119  */
120  static sptr
121  make(variant_t variant,
122  const std::vector<uint8_t> &preamble,
123  size_t preamble_threshold,
124  const std::vector<uint8_t> &sync,
125  size_t sync_threshold,
126  size_t frame_size_field_len,
127  size_t frame_len,
128  checksum_t crc = CRC_NONE,
129  whitening::whitening_sptr descrambler = nullptr,
130  size_t max_frame_len = 2048);
131 };
132 
133 } // namespace satnogs
134 } // namespace gr
135 
136 #endif /* INCLUDED_SATNOGS_FRAME_ACQUISITION_H */
137 
TI CCXXX like, variable frame length.
Definition: frame_acquisition.h:70
A generic frame acquisition block.
Definition: frame_acquisition.h:61
variant_t
Definition: frame_acquisition.h:68
Definition: frame_acquisition.h:76
Definition: amsat_duv_decoder.h:29
checksum_t
Definition: frame_acquisition.h:74
boost::shared_ptr< frame_acquisition > sptr
Definition: frame_acquisition.h:63
Definition: crc.h:33
#define SATNOGS_API
Definition: api.h:30
Definition: frame_acquisition.h:78