GNU Radio's SATNOGS Package
ax100_mode6.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) 2020-2023, Libre Space Foundation <http://libre.space>
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 * SPDX-License-Identifier: GNU General Public License v3.0 or later
21 */
22
23#ifndef INCLUDED_SATNOGS_AX100_MODE6_H
24#define INCLUDED_SATNOGS_AX100_MODE6_H
25
26#include <gnuradio/digital/lfsr.h>
31
32#include <deque>
33
34namespace gr {
35namespace satnogs {
36
37/*!
38 * \brief AX.100 mode 6 decoder
39 *
40 * Mode 6 Decoder for the AX100 modem of GomSpace.
41 *
42 * In this particular mode, the modem encapsulates the payload inside an
43 * AX.25 frame. The payload is appended with a Castagnoli CRC32, scrambled with
44 * a CCSDS scrambler and encoded using the CCSDS compliant Reed Solomon.
45 *
46 * This non-sense framing scheme is used mainly for getting data
47 * from legacy ham stations receiving and reporting AX.25 frames.
48 *
49 * The implementation drops any kind of AX.25 information and does not check
50 * the 16-bit CRC, allowing the Reed Solomon to correct any error bits.
51 *
52 * \ingroup satnogs
53 *
54 */
56{
57public:
58 using sptr = std::shared_ptr<ax100_mode6>;
61 bool ax25_descramble = true);
62
63 ax100_mode6(crc::type crc, whitening::sptr descrambler, bool ax25_descramble);
64
66
67 decoder_status_t decode(const void* in, int len);
68
69 void reset();
70
71private:
72 typedef enum { NO_SYNC, IN_SYNC, DECODING } decoding_state_t;
73
74 const crc::type d_crc;
75 const bool d_ax25_descramble;
76 const size_t d_max_frame_len;
77 whitening::sptr d_descrambler;
78 decoding_state_t d_state;
79 uint32_t d_shift_reg;
80 uint8_t d_dec_b;
81 uint8_t d_prev_bit_nrzi;
82 size_t d_received_bytes;
83 size_t d_decoded_bits;
84 digital::lfsr d_lfsr;
85 uint8_t* d_frame_buffer;
86 std::deque<uint8_t> d_bitstream;
87 size_t d_start_idx;
88 uint64_t d_frame_start;
89 uint64_t d_sample_cnt;
90
91 void reset_state();
92 void enter_sync_state();
93 void enter_decoding_state();
94 bool enter_frame_end(decoder_status_t& status);
95
96 bool _decode(decoder_status_t& status);
97
98 inline void decode_1b(uint8_t in);
99};
100
101} // namespace satnogs
102} // namespace gr
103
104#endif /* INCLUDED_SATNOGS_AX100_MODE6_H */
#define SATNOGS_API
Definition: api.h:19
AX.100 mode 6 decoder.
Definition: ax100_mode6.h:56
std::shared_ptr< ax100_mode6 > sptr
Definition: ax100_mode6.h:58
static sptr make(crc::type crc=crc::type::CRC32_C, whitening::sptr descrambler=whitening::make_ccsds(), bool ax25_descramble=true)
ax100_mode6(crc::type crc, whitening::sptr descrambler, bool ax25_descramble)
decoder_status_t decode(const void *in, int len)
Definition: crc.h:44
type
Predefined CRC types.
Definition: crc.h:51
@ CRC32_C
Alias: CRC-16/ACORN, CRC-16/LTE, CRC-16/V-41-MSB, XMODEM, ZMODEM.
Abstract class that provided the API for the c decoders.
Definition: decoder.h:71
std::shared_ptr< whitening > sptr
Definition: whitening.h:42
static sptr make_ccsds(bool msb=false)
class decoder_status decoder_status_t
Definition: decoder.h:56
Definition: amsat_duv_decoder.h:29