2019-04-26 12:27:38 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2013-2019 Software Radio Systems Limited
|
2014-03-03 11:09:26 -08:00
|
|
|
*
|
2019-04-26 12:27:38 -07:00
|
|
|
* This file is part of srsLTE.
|
2014-03-03 11:09:26 -08:00
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is free software: you can redistribute it and/or modify
|
2015-05-08 08:05:40 -07:00
|
|
|
* it under the terms of the GNU Affero General Public License as
|
2014-03-03 11:09:26 -08:00
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is distributed in the hope that it will be useful,
|
2014-03-03 11:09:26 -08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-05-08 08:05:40 -07:00
|
|
|
* GNU Affero General Public License for more details.
|
2014-03-03 11:09:26 -08:00
|
|
|
*
|
2015-05-08 08:05:40 -07:00
|
|
|
* A copy of the GNU Affero General Public License can be found in
|
2014-03-03 11:09:26 -08:00
|
|
|
* the LICENSE file in the top-level directory of this distribution
|
|
|
|
* and at http://www.gnu.org/licenses/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-04-03 05:49:12 -07:00
|
|
|
/******************************************************************************
|
|
|
|
* File: pbch.h
|
|
|
|
*
|
2015-04-08 11:47:52 -07:00
|
|
|
* Description: Physical broadcast channel. If cell.nof_ports = 0, the number
|
|
|
|
* of ports is blindly determined using the CRC of the received
|
|
|
|
* codeword for 1, 2 and 4 ports
|
2015-04-03 05:49:12 -07:00
|
|
|
*
|
|
|
|
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.6
|
|
|
|
*****************************************************************************/
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#ifndef SRSLTE_PBCH_H
|
|
|
|
#define SRSLTE_PBCH_H
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2015-03-18 05:16:28 -07:00
|
|
|
#include "srslte/config.h"
|
2019-04-23 01:53:11 -07:00
|
|
|
#include "srslte/phy/ch_estimation/chest_dl.h"
|
2017-05-18 00:48:24 -07:00
|
|
|
#include "srslte/phy/common/phy_common.h"
|
2019-04-23 01:53:11 -07:00
|
|
|
#include "srslte/phy/fec/convcoder.h"
|
|
|
|
#include "srslte/phy/fec/crc.h"
|
|
|
|
#include "srslte/phy/fec/rm_conv.h"
|
|
|
|
#include "srslte/phy/fec/viterbi.h"
|
2017-05-18 00:48:24 -07:00
|
|
|
#include "srslte/phy/mimo/layermap.h"
|
2019-04-23 01:53:11 -07:00
|
|
|
#include "srslte/phy/mimo/precoding.h"
|
2017-05-18 00:48:24 -07:00
|
|
|
#include "srslte/phy/modem/demod_soft.h"
|
2019-04-23 01:53:11 -07:00
|
|
|
#include "srslte/phy/modem/mod.h"
|
2017-05-18 00:48:24 -07:00
|
|
|
#include "srslte/phy/scrambling/scrambling.h"
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2015-03-24 07:58:33 -07:00
|
|
|
#define SRSLTE_BCH_PAYLOAD_LEN 24
|
|
|
|
#define SRSLTE_BCH_PAYLOADCRC_LEN (SRSLTE_BCH_PAYLOAD_LEN+16)
|
|
|
|
#define SRSLTE_BCH_ENCODED_LEN 3*(SRSLTE_BCH_PAYLOADCRC_LEN)
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
#define SRSLTE_PBCH_MAX_RE 256 // make it avx2-aligned
|
|
|
|
|
2014-03-03 11:09:26 -08:00
|
|
|
/* PBCH object */
|
2015-03-18 05:31:13 -07:00
|
|
|
typedef struct SRSLTE_API {
|
2015-03-18 05:41:50 -07:00
|
|
|
srslte_cell_t cell;
|
2014-06-29 15:44:39 -07:00
|
|
|
|
2014-07-01 01:48:51 -07:00
|
|
|
uint32_t nof_symbols;
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2014-06-17 02:11:41 -07:00
|
|
|
/* buffers */
|
2015-03-18 05:41:50 -07:00
|
|
|
cf_t *ce[SRSLTE_MAX_PORTS];
|
2015-03-18 11:14:24 -07:00
|
|
|
cf_t *symbols[SRSLTE_MAX_PORTS];
|
|
|
|
cf_t *x[SRSLTE_MAX_PORTS];
|
|
|
|
cf_t *d;
|
|
|
|
float *llr;
|
2014-06-17 02:11:41 -07:00
|
|
|
float *temp;
|
2015-03-24 07:58:33 -07:00
|
|
|
float rm_f[SRSLTE_BCH_ENCODED_LEN];
|
2015-03-18 11:14:24 -07:00
|
|
|
uint8_t *rm_b;
|
2015-03-24 07:58:33 -07:00
|
|
|
uint8_t data[SRSLTE_BCH_PAYLOADCRC_LEN];
|
|
|
|
uint8_t data_enc[SRSLTE_BCH_ENCODED_LEN];
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2014-07-01 01:48:51 -07:00
|
|
|
uint32_t frame_idx;
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2014-06-17 02:11:41 -07:00
|
|
|
/* tx & rx objects */
|
2015-03-23 08:03:06 -07:00
|
|
|
srslte_modem_table_t mod;
|
2015-03-18 11:14:24 -07:00
|
|
|
srslte_sequence_t seq;
|
2015-03-18 08:05:38 -07:00
|
|
|
srslte_viterbi_t decoder;
|
|
|
|
srslte_crc_t crc;
|
|
|
|
srslte_convcoder_t encoder;
|
2015-04-08 11:47:52 -07:00
|
|
|
bool search_all_ports;
|
2014-11-13 07:14:22 -08:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
} srslte_pbch_t;
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
SRSLTE_API int srslte_pbch_init(srslte_pbch_t *q);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API void srslte_pbch_free(srslte_pbch_t *q);
|
2015-04-08 11:53:32 -07:00
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
SRSLTE_API int srslte_pbch_set_cell(srslte_pbch_t *q,
|
|
|
|
srslte_cell_t cell);
|
|
|
|
|
2019-04-23 01:53:11 -07:00
|
|
|
SRSLTE_API int srslte_pbch_decode(srslte_pbch_t* q,
|
|
|
|
srslte_chest_dl_res_t* channel,
|
|
|
|
cf_t* sf_symbols[SRSLTE_MAX_PORTS],
|
|
|
|
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
|
|
|
uint32_t* nof_tx_ports,
|
|
|
|
int* sfn_offset);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2019-04-23 01:53:11 -07:00
|
|
|
SRSLTE_API int srslte_pbch_encode(srslte_pbch_t* q,
|
|
|
|
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
|
|
|
cf_t* sf_symbols[SRSLTE_MAX_PORTS],
|
|
|
|
uint32_t frame_idx);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API void srslte_pbch_decode_reset(srslte_pbch_t *q);
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2019-04-23 01:53:11 -07:00
|
|
|
SRSLTE_API void srslte_pbch_mib_unpack(uint8_t* msg, srslte_cell_t* cell, uint32_t* sfn);
|
2015-02-24 02:19:42 -08:00
|
|
|
|
2019-04-23 01:53:11 -07:00
|
|
|
SRSLTE_API void srslte_pbch_mib_pack(srslte_cell_t* cell, uint32_t sfn, uint8_t* msg);
|
2015-02-24 02:19:42 -08:00
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#endif // SRSLTE_PBCH_H
|