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

163 lines
5.8 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: sch.h
*
* Description: Common UL and DL shared channel encode/decode functions.
*
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10
*****************************************************************************/
#ifndef SCH_
#define SCH_
#include "srslte/config.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/fec/rm_turbo.h"
#include "srslte/phy/fec/turbocoder.h"
#include "srslte/phy/fec/turbodecoder.h"
#include "srslte/phy/fec/crc.h"
#include "srslte/phy/phch/pdsch_cfg.h"
#include "srslte/phy/phch/pusch_cfg.h"
#include "srslte/phy/phch/uci.h"
2015-03-18 08:05:38 -07:00
#ifndef SRSLTE_RX_NULL
#define SRSLTE_RX_NULL 10000
#endif
2015-03-18 08:05:38 -07:00
#ifndef SRSLTE_TX_NULL
#define SRSLTE_TX_NULL 100
#endif
/* DL-SCH AND UL-SCH common functions */
typedef struct SRSLTE_API {
2017-09-26 05:48:59 -07:00
uint32_t max_iterations;
uint32_t nof_iterations;
/* buffers */
uint8_t *cb_in;
uint8_t *parity_bits;
2015-03-18 11:14:24 -07:00
void *e;
uint8_t *temp_g_bits;
2015-10-16 02:05:13 -07:00
uint16_t *ul_interleaver;
srslte_uci_bit_t ack_ri_bits[12*288];
uint32_t nof_ri_ack_bits;
2015-03-18 08:05:38 -07:00
srslte_tcod_t encoder;
2015-10-16 02:05:13 -07:00
srslte_tdec_t decoder;
srslte_crc_t crc_tb;
srslte_crc_t crc_cb;
srslte_uci_cqi_pusch_t uci_cqi;
2015-03-18 11:14:24 -07:00
} srslte_sch_t;
2017-09-21 03:48:09 -07:00
#include "srslte/phy/phch/pmch.h"
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_sch_init(srslte_sch_t *q);
2015-03-18 11:14:24 -07:00
SRSLTE_API void srslte_sch_free(srslte_sch_t *q);
2015-10-30 09:03:57 -07:00
SRSLTE_API void srslte_sch_set_max_noi(srslte_sch_t *q,
uint32_t max_iterations);
2015-03-18 11:14:24 -07:00
SRSLTE_API uint32_t srslte_sch_last_noi(srslte_sch_t *q);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_dlsch_encode(srslte_sch_t *q,
srslte_pdsch_cfg_t *cfg,
srslte_softbuffer_tx_t *softbuffer,
uint8_t *data,
uint8_t *e_bits);
SRSLTE_API int srslte_dlsch_encode2(srslte_sch_t *q,
srslte_pdsch_cfg_t *cfg,
srslte_softbuffer_tx_t *softbuffer,
uint8_t *data,
uint8_t *e_bits,
int codeword_idx);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_dlsch_decode(srslte_sch_t *q,
srslte_pdsch_cfg_t *cfg,
srslte_softbuffer_rx_t *softbuffer,
int16_t *e_bits,
uint8_t *data);
SRSLTE_API int srslte_dlsch_decode2(srslte_sch_t *q,
2017-07-25 04:17:36 -07:00
srslte_pdsch_cfg_t *cfg,
srslte_softbuffer_rx_t *softbuffer,
int16_t *e_bits,
uint8_t *data,
int codeword_idx);
2017-07-25 04:17:36 -07:00
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_ulsch_encode(srslte_sch_t *q,
srslte_pusch_cfg_t *cfg,
srslte_softbuffer_tx_t *softbuffer,
uint8_t *data,
uint8_t *g_bits,
uint8_t *q_bits);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_ulsch_uci_encode(srslte_sch_t *q,
srslte_pusch_cfg_t *cfg,
srslte_softbuffer_tx_t *softbuffer,
uint8_t *data,
srslte_uci_data_t uci_data,
uint8_t *g_bits,
uint8_t *q_bits);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_ulsch_decode(srslte_sch_t *q,
2016-04-25 12:40:53 -07:00
srslte_pusch_cfg_t *cfg,
srslte_softbuffer_rx_t *softbuffer,
2016-04-25 12:40:53 -07:00
int16_t *q_bits,
int16_t *g_bits,
uint8_t *data);
SRSLTE_API int srslte_ulsch_uci_decode(srslte_sch_t *q,
srslte_pusch_cfg_t *cfg,
srslte_softbuffer_rx_t *softbuffer,
int16_t *q_bits,
int16_t *g_bits,
uint8_t *data,
srslte_uci_data_t *uci_data);
SRSLTE_API int srslte_ulsch_uci_decode_ri_ack(srslte_sch_t *q,
srslte_pusch_cfg_t *cfg,
srslte_softbuffer_rx_t *softbuffer,
int16_t *q_bits,
uint8_t *c_seq,
srslte_uci_data_t *uci_data);
SRSLTE_API float srslte_sch_beta_cqi(uint32_t I_cqi);
SRSLTE_API uint32_t srslte_sch_find_Ioffset_ack(float beta);
SRSLTE_API uint32_t srslte_sch_find_Ioffset_cqi(float beta);
SRSLTE_API uint32_t srslte_sch_find_Ioffset_ri(float beta);
#endif