mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
5.5 KiB
C
158 lines
5.5 KiB
C
4 years ago
|
/**
|
||
10 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
10 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
10 years ago
|
*
|
||
4 years ago
|
* By using this file, you agree to the terms and conditions set
|
||
|
* forth in the LICENSE file which can be found at the top level of
|
||
|
* the distribution.
|
||
10 years ago
|
*
|
||
|
*/
|
||
|
|
||
10 years ago
|
/******************************************************************************
|
||
|
* File: cqi.h
|
||
|
*
|
||
|
* Description: Channel quality indicator message packing.
|
||
|
*
|
||
|
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.2.2.6, 5.2.3.3
|
||
|
*****************************************************************************/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_CQI_H
|
||
|
#define SRSRAN_CQI_H
|
||
10 years ago
|
|
||
|
#include <stdint.h>
|
||
|
|
||
4 years ago
|
#include "srsran/config.h"
|
||
|
#include "srsran/phy/common/phy_common.h"
|
||
10 years ago
|
|
||
4 years ago
|
#define SRSRAN_CQI_MAX_BITS 64
|
||
|
#define SRSRAN_DIF_CQI_MAX_BITS 3
|
||
|
#define SRSRAN_PMI_MAX_BITS 4
|
||
|
#define SRSRAN_CQI_STR_MAX_CHAR 64
|
||
9 years ago
|
|
||
6 years ago
|
typedef enum {
|
||
4 years ago
|
SRSRAN_CQI_MODE_10,
|
||
|
SRSRAN_CQI_MODE_11,
|
||
|
SRSRAN_CQI_MODE_12,
|
||
|
SRSRAN_CQI_MODE_20,
|
||
|
SRSRAN_CQI_MODE_21,
|
||
|
SRSRAN_CQI_MODE_22,
|
||
|
SRSRAN_CQI_MODE_30,
|
||
|
SRSRAN_CQI_MODE_31,
|
||
|
SRSRAN_CQI_MODE_NA,
|
||
|
} srsran_cqi_report_mode_t;
|
||
6 years ago
|
|
||
10 years ago
|
typedef struct {
|
||
6 years ago
|
bool periodic_configured;
|
||
|
bool aperiodic_configured;
|
||
5 years ago
|
uint16_t pmi_idx;
|
||
5 years ago
|
uint32_t ri_idx;
|
||
6 years ago
|
bool ri_idx_present;
|
||
|
bool format_is_subband;
|
||
|
uint32_t subband_size;
|
||
4 years ago
|
srsran_cqi_report_mode_t periodic_mode;
|
||
|
srsran_cqi_report_mode_t aperiodic_mode;
|
||
|
} srsran_cqi_report_cfg_t;
|
||
6 years ago
|
|
||
10 years ago
|
/* Table 5.2.2.6.2-1: Fields for channel quality information feedback for higher layer configured subband
|
||
7 years ago
|
CQI reports (transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and
|
||
|
transmission mode 8 configured without PMI/RI reporting). */
|
||
|
|
||
|
/* Table 5.2.2.6.2-2: Fields for channel quality information (CQI) feedback for higher layer configured subband CQI
|
||
|
reports (transmission mode 4, transmission mode 5 and transmission mode 6). */
|
||
|
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
5 years ago
|
uint8_t wideband_cqi_cw0; // 4-bit width
|
||
|
uint32_t subband_diff_cqi_cw0; // 2N-bit width
|
||
|
uint8_t wideband_cqi_cw1; // if RI > 1 then 4-bit width otherwise 0-bit width
|
||
|
uint32_t subband_diff_cqi_cw1; // if RI > 1 then 2N-bit width otherwise 0-bit width
|
||
|
uint32_t pmi; // if RI > 1 then 2-bit width otherwise 1-bit width
|
||
4 years ago
|
} srsran_cqi_hl_subband_t;
|
||
10 years ago
|
|
||
|
/* Table 5.2.2.6.3-1: Fields for channel quality information feedback for UE selected subband CQI
|
||
|
reports
|
||
|
(transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and
|
||
|
transmission mode 8 configured without PMI/RI reporting). */
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
5 years ago
|
uint8_t wideband_cqi; // 4-bit width
|
||
9 years ago
|
uint8_t subband_diff_cqi; // 2-bit width
|
||
10 years ago
|
uint32_t position_subband; // L-bit width
|
||
4 years ago
|
} srsran_cqi_ue_subband_t;
|
||
10 years ago
|
|
||
10 years ago
|
/* Table 5.2.3.3.1-1: Fields for channel quality information feedback for wideband CQI reports
|
||
|
(transmission mode 1, transmission mode 2, transmission mode 3, transmission mode 7 and
|
||
5 years ago
|
transmission mode 8 configured without PMI/RI reporting).
|
||
10 years ago
|
This is for PUCCH Format 2 reports
|
||
|
*/
|
||
7 years ago
|
|
||
|
/* Table 5.2.3.3.1-2: UCI fields for channel quality and precoding information (CQI/PMI) feedback for
|
||
|
wideband reports (transmission mode 4, transmission mode 5 and transmission mode 6)
|
||
|
This is for PUCCH Format 2 reports
|
||
|
*/
|
||
|
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
5 years ago
|
uint8_t wideband_cqi; // 4-bit width
|
||
|
uint8_t spatial_diff_cqi; // If Rank==1 then it is 0-bit width otherwise it is 3-bit width
|
||
|
uint8_t pmi;
|
||
4 years ago
|
} srsran_cqi_format2_wideband_t;
|
||
10 years ago
|
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
5 years ago
|
uint8_t subband_cqi; // 4-bit width
|
||
|
uint8_t subband_label; // 1- or 2-bit width
|
||
4 years ago
|
} srsran_cqi_format2_subband_t;
|
||
10 years ago
|
|
||
9 years ago
|
typedef enum {
|
||
4 years ago
|
SRSRAN_CQI_TYPE_WIDEBAND = 0,
|
||
|
SRSRAN_CQI_TYPE_SUBBAND,
|
||
|
SRSRAN_CQI_TYPE_SUBBAND_UE,
|
||
|
SRSRAN_CQI_TYPE_SUBBAND_HL
|
||
|
} srsran_cqi_type_t;
|
||
6 years ago
|
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
6 years ago
|
bool data_enable;
|
||
|
bool pmi_present;
|
||
5 years ago
|
bool four_antenna_ports; ///< If cell has 4 antenna ports then true otherwise false
|
||
|
bool rank_is_not_one; ///< If rank > 1 then true otherwise false
|
||
|
bool subband_label_2_bits; ///< false, label=1-bit, true label=2-ack_value
|
||
|
uint32_t scell_index; ///< Indicates the cell/carrier the measurement belongs, use 0 for PCell
|
||
6 years ago
|
uint32_t L;
|
||
|
uint32_t N;
|
||
4 years ago
|
srsran_cqi_type_t type;
|
||
6 years ago
|
uint32_t ri_len;
|
||
4 years ago
|
} srsran_cqi_cfg_t;
|
||
9 years ago
|
|
||
|
typedef struct {
|
||
|
union {
|
||
4 years ago
|
srsran_cqi_format2_wideband_t wideband;
|
||
|
srsran_cqi_format2_subband_t subband;
|
||
|
srsran_cqi_ue_subband_t subband_ue;
|
||
|
srsran_cqi_hl_subband_t subband_hl;
|
||
9 years ago
|
};
|
||
6 years ago
|
bool data_crc;
|
||
4 years ago
|
} srsran_cqi_value_t;
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_cqi_size(srsran_cqi_cfg_t* cfg);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_cqi_value_pack(srsran_cqi_cfg_t* cfg, srsran_cqi_value_t* value, uint8_t* buff);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int
|
||
|
srsran_cqi_value_unpack(srsran_cqi_cfg_t* cfg, uint8_t buff[SRSRAN_CQI_MAX_BITS], srsran_cqi_value_t* value);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int
|
||
|
srsran_cqi_value_tostring(srsran_cqi_cfg_t* cfg, srsran_cqi_value_t* value, char* buff, uint32_t buff_len);
|
||
8 years ago
|
|
||
4 years ago
|
SRSRAN_API bool
|
||
|
srsran_cqi_periodic_send(const srsran_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srsran_frame_type_t frame_type);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API bool
|
||
|
srsran_cqi_periodic_ri_send(const srsran_cqi_report_cfg_t* periodic_cfg, uint32_t tti, srsran_frame_type_t frame_type);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_cqi_hl_get_no_subbands(int nof_prb);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API uint8_t srsran_cqi_from_snr(float snr);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API float srsran_cqi_to_coderate(uint32_t cqi, bool use_alt_table);
|
||
7 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_CQI_H
|