srsLTE/lib/include/srslte/phy/phch/psbch.h

112 lines
3.1 KiB
C
Raw Normal View History

2019-10-11 03:10:07 -07:00
/*
* Copyright 2013-2019 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_PSBCH_H
#define SRSLTE_PSBCH_H
#include <srslte/phy/dft/dft_precoding.h>
#include <srslte/phy/fec/convcoder.h>
#include <srslte/phy/fec/crc.h>
#include <srslte/phy/fec/viterbi.h>
#include <srslte/phy/modem/demod_soft.h>
#include <srslte/phy/modem/modem_table.h>
#include <srslte/phy/scrambling/scrambling.h>
#define SRSLTE_SL_BCH_CRC_LEN 16
2019-12-20 03:23:28 -08:00
/**
* \brief Physical Sidelink broadcast channel.
*
* Reference: 3GPP TS 36.211 version 15.6.0 Release 15 Sec. 9.6
*/
typedef struct SRSLTE_API {
uint32_t N_sl_id;
srslte_sl_tm_t tm;
srslte_cp_t cp;
2020-01-08 08:23:16 -08:00
uint32_t nof_data_re; ///< Number of RE considered during the channel mapping
uint32_t nof_tx_re; ///< Number of RE actually transmitted over the air (without last OFDM symbol)
2019-10-11 03:10:07 -07:00
uint32_t E;
uint32_t Qm;
uint32_t nof_prb;
2019-12-20 03:23:28 -08:00
uint32_t nof_data_symbols;
2020-01-08 08:23:16 -08:00
uint32_t nof_tx_symbols;
2019-12-20 03:23:28 -08:00
uint32_t sl_bch_tb_len;
uint32_t sl_bch_tb_crc_len;
uint32_t sl_bch_encoded_len;
2019-10-11 03:10:07 -07:00
float precoding_scaling;
// data
2019-12-20 03:23:28 -08:00
uint8_t* c;
2019-10-11 03:10:07 -07:00
// crc
2019-12-20 03:23:28 -08:00
srslte_crc_t crc_mib_sl;
2019-10-11 03:10:07 -07:00
uint8_t* crc_temp;
// channel coding
srslte_viterbi_t dec;
srslte_convcoder_t encoder;
uint8_t* d;
2020-01-08 08:23:16 -08:00
int16_t* d_16;
2019-10-11 03:10:07 -07:00
// rate matching
uint8_t* e;
2020-01-08 08:23:16 -08:00
uint8_t* e_bytes; ///< To pack bits to bytes
int16_t* e_16;
2019-12-20 03:23:28 -08:00
uint8_t* codeword;
2020-01-08 08:23:16 -08:00
uint8_t* codeword_bytes;
int16_t* llr;
2019-10-11 03:10:07 -07:00
// interleaving
uint32_t* interleaver_lut;
// scrambling
srslte_sequence_t seq;
// modulation
srslte_modem_table_t mod;
2019-12-20 03:23:28 -08:00
cf_t* mod_symbols;
2019-10-11 03:10:07 -07:00
// dft precoding
srslte_dft_precoding_t dft_precoder;
srslte_dft_precoding_t idft_precoder;
cf_t* scfdma_symbols;
} srslte_psbch_t;
2019-12-20 03:23:28 -08:00
SRSLTE_API int
srslte_psbch_init(srslte_psbch_t* q, uint32_t nof_prb, uint32_t N_sl_id, srslte_sl_tm_t tm, srslte_cp_t cp);
SRSLTE_API void srslte_psbch_free(srslte_psbch_t* q);
SRSLTE_API int srslte_psbch_encode(srslte_psbch_t* q, uint8_t* input, uint32_t input_len, cf_t* sf_buffer);
SRSLTE_API int srslte_psbch_decode(srslte_psbch_t* q, cf_t* scfdma_symbols, uint8_t* output, uint32_t max_output_len);
2019-10-11 03:10:07 -07:00
2019-12-20 03:23:28 -08:00
SRSLTE_API int srslte_psbch_reset(srslte_psbch_t* q, uint32_t N_sl_id);
2019-10-11 03:10:07 -07:00
2019-12-20 03:23:28 -08:00
SRSLTE_API int srslte_psbch_put(srslte_psbch_t* q, cf_t* symbols, cf_t* sf_buffer);
2019-10-11 03:10:07 -07:00
2019-12-20 03:23:28 -08:00
SRSLTE_API int srslte_psbch_get(srslte_psbch_t* q, cf_t* sf_buffer, cf_t* symbols);
2019-10-11 03:10:07 -07:00
#endif // SRSLTE_PSBCH_H