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

119 lines
3.7 KiB
C
Raw Normal View History

/**
*
* \section COPYRIGHT
*
2015-11-13 04:22:33 -08:00
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* 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
* 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
2015-05-08 08:05:40 -07:00
* GNU Affero General Public License for more details.
*
2015-05-08 08:05:40 -07:00
* 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/.
*
*/
/******************************************************************************
* File: pbch.h
*
* 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
*
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.6
*****************************************************************************/
#ifndef PBCH_
#define PBCH_
#include "srslte/config.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/mimo/precoding.h"
#include "srslte/phy/mimo/layermap.h"
#include "srslte/phy/modem/mod.h"
#include "srslte/phy/modem/demod_soft.h"
#include "srslte/phy/scrambling/scrambling.h"
#include "srslte/phy/fec/rm_conv.h"
#include "srslte/phy/fec/convcoder.h"
#include "srslte/phy/fec/viterbi.h"
#include "srslte/phy/fec/crc.h"
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)
#define SRSLTE_PBCH_MAX_RE 256 // make it avx2-aligned
/* PBCH object */
typedef struct SRSLTE_API {
2015-03-18 05:41:50 -07:00
srslte_cell_t cell;
uint32_t nof_symbols;
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];
uint32_t frame_idx;
2014-06-17 02:11:41 -07:00
/* tx & rx objects */
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;
bool search_all_ports;
2015-03-18 11:14:24 -07:00
} srslte_pbch_t;
SRSLTE_API int srslte_pbch_init(srslte_pbch_t *q);
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
SRSLTE_API int srslte_pbch_set_cell(srslte_pbch_t *q,
srslte_cell_t cell);
SRSLTE_API int srslte_pbch_decode(srslte_pbch_t *q,
cf_t *slot1_symbols,
2015-03-18 05:41:50 -07:00
cf_t *ce_slot1[SRSLTE_MAX_PORTS],
float noise_estimate,
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
uint32_t *nof_tx_ports,
int *sfn_offset);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_pbch_encode(srslte_pbch_t *q,
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
2016-07-11 14:32:25 -07:00
cf_t *slot1_symbols[SRSLTE_MAX_PORTS],
uint32_t frame_idx);
2015-03-18 11:14:24 -07:00
SRSLTE_API void srslte_pbch_decode_reset(srslte_pbch_t *q);
2015-03-18 11:14:24 -07:00
SRSLTE_API void srslte_pbch_mib_unpack(uint8_t *msg,
2015-03-18 05:41:50 -07:00
srslte_cell_t *cell,
uint32_t *sfn);
2015-03-18 11:14:24 -07:00
SRSLTE_API void srslte_pbch_mib_pack(srslte_cell_t *cell,
uint32_t sfn,
uint8_t *msg);
#endif // PBCH_