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

128 lines
4.3 KiB
C
Raw Normal View History

2014-03-27 09:31:25 -07:00
/**
*
* \section COPYRIGHT
*
2015-11-13 04:22:33 -08:00
* Copyright 2013-2015 Software Radio Systems Limited
2014-03-27 09:31:25 -07:00
*
* \section LICENSE
*
* This file is part of the srsLTE library.
2014-03-27 09:31:25 -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-27 09:31:25 -07:00
* 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,
2014-03-27 09:31:25 -07: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-27 09:31:25 -07:00
*
2015-05-08 08:05:40 -07:00
* A copy of the GNU Affero General Public License can be found in
2014-03-27 09:31:25 -07:00
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: phich.h
*
* Description: Physical Hybrid ARQ indicator channel.
*
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.9
*****************************************************************************/
2014-03-27 09:31:25 -07:00
2018-03-31 10:04:04 -07:00
#ifndef SRSLTE_PHICH_H
#define SRSLTE_PHICH_H
2014-03-27 09:31:25 -07:00
#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"
2014-03-27 09:31:25 -07:00
#include "regs.h"
2014-03-27 09:31:25 -07:00
2015-03-18 05:59:29 -07:00
#define SRSLTE_PHICH_NORM_NSEQUENCES 8
2015-03-18 11:14:24 -07:00
#define SRSLTE_PHICH_EXT_NSEQUENCES 4
#define SRSLTE_PHICH_NBITS 3
#define SRSLTE_PHICH_NORM_MSYMB SRSLTE_PHICH_NBITS * 4
#define SRSLTE_PHICH_EXT_MSYMB SRSLTE_PHICH_NBITS * 2
#define SRSLTE_PHICH_MAX_NSYMB SRSLTE_PHICH_NORM_MSYMB
#define SRSLTE_PHICH_NORM_C 1
#define SRSLTE_PHICH_EXT_C 2
#define SRSLTE_PHICH_NORM_NSF 4
#define SRSLTE_PHICH_EXT_NSF 2
2014-03-27 09:31:25 -07:00
/* phich object */
typedef struct SRSLTE_API {
2015-03-18 05:41:50 -07:00
srslte_cell_t cell;
uint32_t nof_rx_antennas;
2014-06-17 02:11:41 -07:00
/* handler to REGs resource mapper */
2015-03-18 11:14:24 -07:00
srslte_regs_t *regs;
2014-03-27 09:31:25 -07:00
2014-06-17 02:11:41 -07:00
/* buffers */
cf_t ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS][SRSLTE_PHICH_MAX_NSYMB];
cf_t sf_symbols[SRSLTE_MAX_PORTS][SRSLTE_PHICH_MAX_NSYMB];
2015-03-18 11:14:24 -07:00
cf_t x[SRSLTE_MAX_PORTS][SRSLTE_PHICH_MAX_NSYMB];
cf_t d[SRSLTE_PHICH_MAX_NSYMB];
cf_t d0[SRSLTE_PHICH_MAX_NSYMB];
cf_t z[SRSLTE_PHICH_NBITS];
2014-03-27 09:31:25 -07:00
2014-06-17 02:11:41 -07:00
/* bit message */
2015-03-18 11:14:24 -07:00
uint8_t data[SRSLTE_PHICH_NBITS];
float data_rx[SRSLTE_PHICH_NBITS];
2014-03-27 09:31:25 -07:00
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[SRSLTE_NSUBFRAMES_X_FRAME];
2015-03-18 11:14:24 -07:00
} srslte_phich_t;
2017-09-05 06:26:36 -07:00
SRSLTE_API int srslte_phich_init(srslte_phich_t *q,
uint32_t nof_rx_antennas);
2015-03-18 11:14:24 -07:00
SRSLTE_API void srslte_phich_free(srslte_phich_t *q);
SRSLTE_API int srslte_phich_set_cell(srslte_phich_t *q,
srslte_regs_t *regs,
srslte_cell_t cell);
SRSLTE_API void srslte_phich_calc(srslte_phich_t *q,
2016-06-28 09:28:57 -07:00
uint32_t n_prb_lowest,
uint32_t n_dmrs,
uint32_t *ngroup,
uint32_t *nseq);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_phich_decode(srslte_phich_t *q,
cf_t *slot_symbols[SRSLTE_MAX_PORTS],
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
2015-03-18 11:14:24 -07:00
float noise_estimate,
uint32_t ngroup,
uint32_t nseq,
uint32_t nsubframe,
uint8_t *ack,
float *distance);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_phich_encode(srslte_phich_t *q,
uint8_t ack,
uint32_t ngroup,
uint32_t nseq,
uint32_t nsubframe,
cf_t *slot_symbols[SRSLTE_MAX_PORTS]);
SRSLTE_API void srslte_phich_reset(srslte_phich_t *q,
cf_t *slot_symbols[SRSLTE_MAX_PORTS]);
SRSLTE_API uint32_t srslte_phich_ngroups(srslte_phich_t *q);
2014-03-27 09:31:25 -07:00
SRSLTE_API uint32_t srslte_phich_nsf(srslte_phich_t *q);
2018-03-31 10:04:04 -07:00
#endif // SRSLTE_PHICH_H