Commit 459257da authored by Calvin HSU's avatar Calvin HSU

UE: Finish Type0-PDCCH scheduling and corresponding FAPI-like message DL_CONFIG_REQ

Procedures based on 38.213 ch.13 and ch.10, 38.211 ch.7.
 - Type0-PDCCH search space
 - Type0-PDCCH coreset
parent 96497092
Pipeline #10240 failed with stage
in 0 seconds
#ifndef _FAPI_NR_UE_CONSTANTS_H_
#define _FAPI_NR_UE_CONSTANTS_H_
// constants defined by specification 38.331
#define FAPI_NR_MAX_NUM_DL_ALLOCATIONS 16
#define FAPI_NR_MAX_NUM_UL_ALLOCATIONS 16
#define FAPI_NR_MAX_NUM_SERVING_CELLS 32
#define FAPI_NR_MAX_NUM_ZP_CSI_RS_RESOURCE_PER_SET 16
#define FAPI_NR_MAX_NUM_CANDIDATE_BEAMS 16
#define FAPI_NR_MAX_RA_OCCASION_PER_CSIRS 64
#define FAPI_NR_RX_PDU_TYPE_MIB 0x01
#define FAPI_NR_RX_PDU_TYPE_SIB 0x02
#define FAPI_NR_RX_PDU_TYPE_DLSCH 0x03
#define CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01
#define CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02
#define PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE 0x01
#define PRECODER_GRANULARITY_ALL_CONTIGUOUS_RBS 0x02
#endif
\ No newline at end of file
......@@ -15,20 +15,11 @@
*/
#ifndef _FAPI_NR_INTERFACE_NR_EXTENSION_H_
#define _FAPI_NR_INTERFACE_NR_EXTENSION_H_
#define _FAPI_NR_INTERFACE_H_
#ifndef _FAPI_NR_UE_INTERFACE_H_
#define _FAPI_NR_UE_INTERFACE_H_
#include "stddef.h"
#define FAPI_NR_MAX_NUM_DL_ALLOCATIONS 16
#define FAPI_NR_MAX_NUM_UL_ALLOCATIONS 16
#define FAPI_NR_MAX_NUM_SERVING_CELLS 32
#define FAPI_NR_MAX_NUM_ZP_CSI_RS_RESOURCE_PER_SET 16
#define FAPI_NR_MAX_NUM_CANDIDATE_BEAMS 16
#define FAPI_NR_MAX_RA_OCCASION_PER_CSIRS 64
#include "fapi_nr_ue_constants.h"
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
......@@ -37,35 +28,6 @@ typedef signed int int32_t;
typedef signed short int16_t;
typedef signed char int8_t;
typedef enum {
FAPI_NR_RX_PDU_BCCH_BCH_TYPE = 0,
FAPI_NR_RX_PDU_BCCH_DLSCH_TYPE
} fapi_nr_rx_pdu_type_e;
typedef struct {
uint16_t phy_id;
uint16_t message_id;
uint16_t message_length;
uint16_t spare;
} fapi_nr_p4_p5_message_header_t;
typedef struct {
uint16_t phy_id;
uint16_t message_id;
uint16_t message_length;
uint16_t m_segment_sequence; /* This consists of 3 fields - namely, M, Segement & Sequence number*/
uint32_t checksum;
uint32_t transmit_timestamp;
} fapi_nr_p7_message_header_t;
typedef struct {
uint16_t tag;
uint16_t length;
} fapi_nr_tl_t;
#define FAPI_NR_TAG_LENGTH_PACKED_LEN 4
typedef struct {
// dci pdu
uint8_t dci_format;
......@@ -107,7 +69,6 @@ typedef struct {
uint8_t short_messages;
uint8_t tb_scaling;
uint8_t prb_bundling_size_indicator; // 38.214 chapter 5.1.2.3
uint8_t rate_matching_indicator;
uint8_t zp_csi_rs_trigger;
......@@ -130,10 +91,8 @@ typedef struct {
uint8_t dci2_3_tpc_command;
} fapi_nr_dci_pdu_rel15_t;
#define FAPI_NR_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG 0x2020
typedef struct {
fapi_nr_tl_t tl;
uint8_t uci_format;
uint8_t uci_channel;
uint8_t harq_ack_bits;
......@@ -144,15 +103,7 @@ typedef struct {
uint32_t sr;
} fapi_nr_uci_pdu_rel15_t;
typedef enum {
CCE_REG_MAPPING_TYPE_INTERLEAVED,
CCE_REG_MAPPING_TYPE_NON_INTERLEAVED,
} coreset_cce_reg_mapping_type_t;
typedef enum{
PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE,
PRECODER_GRANULARITY_ALL_CONTIGUOUS_RBS
} coreset_precoder_granularity_t;
typedef struct {
/// frequency_domain_resource;
......@@ -160,11 +111,11 @@ typedef struct {
uint32_t rb_end;
uint8_t duration;
coreset_cce_reg_mapping_type_t cce_reg_mapping_type; // interleaved or noninterleaved
uint8_t cce_reg_mapping_type; // interleaved or noninterleaved
uint8_t cce_reg_interleaved_reg_bundle_size; // valid if CCE to REG mapping type is interleaved type
uint8_t cce_reg_interleaved_interleaver_size; // valid if CCE to REG mapping type is interleaved type
uint8_t cce_reg_interleaved_shift_index; // valid if CCE to REG mapping type is interleaved type
coreset_precoder_granularity_t precoder_granularity;
uint8_t precoder_granularity;
uint8_t tci_state_pdcch;
uint8_t tci_present_in_dci;
......@@ -189,15 +140,13 @@ typedef struct {
} fapi_nr_dci_indication_pdu_t;
typedef struct {
fapi_nr_tl_t tl;
uint16_t number_of_dcis;
fapi_nr_dci_indication_pdu_t* dci_list;
} fapi_nr_dci_indication_body_t;
///
typedef struct {
fapi_nr_p7_message_header_t header;
uint16_t sfn_sf_slot;
uint32_t sfn_slot;
fapi_nr_dci_indication_body_t dci_indication_body;
} fapi_nr_dci_indication_t;
......@@ -220,32 +169,27 @@ typedef struct {
} fapi_nr_sib_pdu_t;
typedef struct {
fapi_nr_tl_t tl;
uint8_t pdu_type;
union {
fapi_nr_pdsch_pdu_t pdsch_pdu;
fapi_nr_mib_pdu_t mib_pdu;
fapi_nr_sib_pdu_t sib_pdu;
};
} fapi_nr_rx_request_body_t;
///
typedef struct {
fapi_nr_p7_message_header_t header;
uint16_t sfn_sf_slot;
uint32_t sfn_slot;
uint16_t number_pdus;
fapi_nr_rx_request_body_t *rx_request_body;
} fapi_nr_rx_indication_t;
typedef struct {
fapi_nr_tl_t tl;
uint8_t ul_cqi;
uint16_t timing_advance;
uint16_t rnti;
} fapi_nr_tx_config_t;
typedef struct {
uint16_t pdu_length;
uint16_t pdu_index;
......@@ -253,7 +197,6 @@ typedef struct {
} fapi_nr_tx_request_pdu_t;
typedef struct {
fapi_nr_tl_t tl;
fapi_nr_tx_config_t tx_config;
uint16_t number_of_pdus;
fapi_nr_tx_request_pdu_t* tx_pdu_list;
......@@ -261,8 +204,7 @@ typedef struct {
///
typedef struct {
fapi_nr_p7_message_header_t header;
uint16_t sfn_sf_slot;
uint32_t sfn_slot;
fapi_nr_tx_request_body_t tx_request_body;
} fapi_nr_tx_request_t;
......@@ -276,13 +218,11 @@ typedef struct {
} fapi_nr_ul_config_request_pdu_t;
typedef struct {
fapi_nr_tl_t tl;
fapi_nr_ul_config_request_pdu_t ul_config_pdu_list;
} fapi_nr_ul_config_request_body_t;
///
typedef struct {
fapi_nr_p7_message_header_t header;
uint16_t sfn_sf_slot;
uint32_t sfn_slot;
fapi_nr_ul_config_request_body_t ul_config_request_body;
} fapi_nr_ul_config_request_t;
......@@ -292,8 +232,7 @@ typedef struct {
fapi_nr_coreset_t coreset;
uint32_t duration;
uint8_t aggregation_level;
uint8_t number_of_candidates;
uint8_t number_of_candidates[5]; // aggregation level 1, 2, 4, 8, 16
uint16_t monitoring_symbols_within_slot;
// DCI foramt-specific
uint8_t format_2_0_number_of_candidates[5]; // aggregation level 1, 2, 4, 8, 16
......@@ -324,11 +263,9 @@ typedef struct {
} fapi_nr_dl_config_request_pdu_t;
typedef struct {
fapi_nr_p7_message_header_t header;
uint16_t sfn_sf_slot;
uint8_t number_dci;
uint8_t number_pdsch;
fapi_nr_dl_config_request_pdu_t *dl_config_request_body;
uint32_t sfn_slot;
uint8_t number_pdus;
fapi_nr_dl_config_request_pdu_t dl_config_request_body[10]; // TODO MARCO
} fapi_nr_dl_config_request_t;
......@@ -435,7 +372,6 @@ typedef struct {
} fapi_nr_pbch_config_t;
typedef struct {
fapi_nr_tl_t tl;
fapi_nr_pdcch_config_common_t pdcch_config_common;
fapi_nr_pdsch_config_common_t pdsch_config_common;
......@@ -779,8 +715,6 @@ typedef struct {
#define FAPI_NR_CONFIG_REQUEST_MASK_UL_BWP_DEDICATED 0x10
typedef struct {
fapi_nr_p4_p5_message_header_t header;
uint8_t num_tlv;
uint32_t config_mask;
fapi_nr_pbch_config_t pbch_config; // MIB
......
......@@ -78,27 +78,22 @@ typedef struct {
NR_RNTI_Value_t *cs_RNTI;
NR_MIB_t *mib;
/// Type0-PDCCH seach space coreset
fapi_nr_coreset_t type0_pdcch_coreset;
/// Type0-PDCCH seach space
fapi_nr_dl_config_dci_dl_pdu_rel15_t type0_pdcch_dci_config;
uint32_t type0_pdcch_ss_mux_pattern;
// float type0_pdcch_ss_big_o;
uint32_t type0_pdcch_ss_number_of_search_space_per_slot;
// float type0_pdcch_ss_big_m;
uint32_t type0_pdcch_ss_first_symbol_index;
SFN_C_TYPE type0_pdcch_ss_sfn_c;
uint32_t type0_pdcch_ss_n_c;
/// Type0-PDCCH seach space
//// FAPI-like interface
//// FAPI-like interface message
fapi_nr_tx_request_t tx_request;
fapi_nr_ul_config_request_t ul_config_request;
fapi_nr_dl_config_request_t dl_config_request;
fapi_nr_dci_indication_t dci_indication;
fapi_nr_rx_indication_t rx_indication;
/// Interface module instances
nr_ue_if_module_t *if_module;
nr_scheduled_response_t scheduled_response;
......
......@@ -78,4 +78,6 @@ extern const int32_t table_38213_13_11_c4[16];
extern const float table_38213_13_12_c1[16];
extern const int32_t table_38213_13_12_c2[16];
extern const float table_38213_13_12_c3[16];
\ No newline at end of file
extern const float table_38213_13_12_c3[16];
extern const int32_t table_38213_10_1_1_c2[3];
\ No newline at end of file
......@@ -88,3 +88,4 @@ const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7
const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved
const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved
const int32_t table_38213_10_1_1_c2[3] = { 4, 2, 1 };
\ No newline at end of file
......@@ -249,15 +249,15 @@ int8_t nr_ue_decode_mib(
AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined");
uint32_t cell_id = 0; // obtain from L1 later
mac->type0_pdcch_coreset.rb_start = rb_offset;
mac->type0_pdcch_coreset.rb_end = rb_offset + num_rbs - 1;
mac->type0_pdcch_coreset.duration = num_symbols;
mac->type0_pdcch_coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED;
mac->type0_pdcch_coreset.cce_reg_interleaved_reg_bundle_size = 6; // L
mac->type0_pdcch_coreset.cce_reg_interleaved_interleaver_size = 2; // R
mac->type0_pdcch_coreset.cce_reg_interleaved_shift_index = cell_id;
mac->type0_pdcch_coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
mac->type0_pdcch_coreset.pdcch_dmrs_scrambling_id = cell_id;
mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset;
mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1;
//mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols;
mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED;
mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L
mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R
mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id;
mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id;
......@@ -269,9 +269,14 @@ int8_t nr_ue_decode_mib(
uint32_t n_c;
uint32_t number_of_search_space_per_slot;
uint32_t first_symbol_index;
uint32_t search_space_duration; // element of search space
uint32_t coreset_duration; // element of coreset
const uint32_t scs_index = 0;
const uint32_t num_slot_per_frame = 10;
// 38.213 table 10.1-1
/// MUX PATTERN 1
if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){
......@@ -292,6 +297,8 @@ const uint32_t num_slot_per_frame = 10;
}else{
first_symbol_index = table_38213_13_11_c4[index_4lsb];
}
// 38.213 chapter 13: over two consecutive slots
search_space_duration = 2;
}
if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){
......@@ -306,6 +313,8 @@ const uint32_t num_slot_per_frame = 10;
}else{
first_symbol_index = 0;
}
// 38.213 chapter 13: over two consecutive slots
search_space_duration = 2;
}
......@@ -370,6 +379,8 @@ const uint32_t num_slot_per_frame = 10;
default: break;
}
}else{ ; }
// 38.213 chapter 13: over one slot
search_space_duration = 1;
}
/// MUX PATTERN 3
......@@ -396,14 +407,22 @@ const uint32_t num_slot_per_frame = 10;
default: break;
}
}else{ ; }
// 38.213 chapter 13: over one slot
search_space_duration = 1;
}
//mac->type0_pdcch_ss_big_o = big_o;
coreset_duration = num_symbols * number_of_search_space_per_slot;
mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[0]; // CCE aggregation level = 4
mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[1]; // CCE aggregation level = 8
mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 16
mac->type0_pdcch_dci_config.duration = search_space_duration;
mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset
mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff;
mac->type0_pdcch_ss_sfn_c = sfn_c;
mac->type0_pdcch_ss_n_c = n_c;
mac->type0_pdcch_ss_number_of_search_space_per_slot = number_of_search_space_per_slot;
//mac->type0_pdcch_ss_big_m = big_m;
mac->type0_pdcch_ss_first_symbol_index = first_symbol_index;
// fill in the elements in config request inside P5 message
mac->phy_config.config_req.pbch_config.system_frame_number = frame; // after calculation
......@@ -428,12 +447,17 @@ typedef enum seach_space_mask_e {
type0_pdcch = 0x1,
type0a_pdcch = 0x2,
type1_pdcch = 0x4,
type2_pdcch = 0x8
type2_pdcch = 0x8,
type3_pdcch = 0x10
} search_space_mask_t;
// TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms
#define NUM_SLOT_FRAME 10
uint32_t get_ssb_frame(){
return 0;
}
// Performs :
// 1. TODO: Call RRC for link status return to PHY
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
......@@ -449,29 +473,75 @@ NR_UE_L2_STATE_t nr_ue_scheduler(
const slot_t tx_slot ){
uint32_t search_space_mask = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
// check type0 from 38.213 13
if(ssb_index != -1){
if(mac->type0_pdcch_ss_mux_pattern == 1){
// now bigO and bigM use floating point implementation, after can optimize to use fixed point implementation by change mac_vars table and operation 'multiple'
// 38.213 chapter 13
if((mac->type0_pdcch_ss_sfn_c == SFN_C_MOD_2_EQ_0) && !(rx_frame & 0x1) && (rx_slot == mac->type0_pdcch_ss_n_c)){
search_space_mask = search_space_mask | type0_pdcch;
}
if((mac->type0_pdcch_ss_sfn_c == SFN_C_MOD_2_EQ_1) && (rx_frame & 0x1) && (rx_slot == mac->type0_pdcch_ss_n_c)){
search_space_mask = search_space_mask | type0_pdcch;
}
if((mac->type0_pdcch_ss_sfn_c == SFN_C_EQ_SFN_SSB) && ( get_ssb_frame() )){
search_space_mask = search_space_mask | type0_pdcch;
}
}
if(mac->type0_pdcch_ss_mux_pattern == 2){
if(ssb_index != -1){
search_space_mask = search_space_mask & type0_pdcch;
// 38.213 Table 13-13, 13-14
if((rx_frame == get_ssb_frame()) && (rx_slot == mac->type0_pdcch_ss_n_c)){
search_space_mask = search_space_mask | type0_pdcch;
}
}
if(mac->type0_pdcch_ss_mux_pattern == 3){
if(ssb_index != -1){
search_space_mask = search_space_mask & type0_pdcch;
// 38.213 Table 13-15
if((rx_frame == get_ssb_frame()) && (rx_slot == mac->type0_pdcch_ss_n_c)){
search_space_mask = search_space_mask | type0_pdcch;
}
}
}
#if 0
uint16_t rnti;
fapi_nr_coreset_t coreset;
uint32_t duration;
uint8_t aggregation_level;
uint8_t number_of_candidates;
uint16_t monitoring_symbols_within_slot;
// DCI foramt-specific
uint8_t format_2_0_number_of_candidates[5]; // aggregation level 1, 2, 4, 8, 16
uint8_t format_2_3_monitorying_periodicity;
uint8_t format_2_3_number_of_candidates;
#endif
if(search_space_mask & type0_pdcch){
dl_config->dl_config_request_body[dl_config->number_pdus].dci_pdu.dci_config_rel15 = mac->type0_pdcch_dci_config;
//dl_config->dl_config_request_body[dl_config->number_pdus].pdu_type = ;
dl_config->number_pdus = dl_config->number_pdus + 1;
dl_config->dl_config_request_body[dl_config->number_pdus].dci_pdu.dci_config_rel15.rnti = 0xaaaa; // to be set
}
if(search_space_mask & type0a_pdcch){
}
if(search_space_mask & type1_pdcch){
}
if(search_space_mask & type2_pdcch){
}
if(search_space_mask & type3_pdcch){
}
mac->scheduled_response.dl_config = dl_config;
return CONNECTION_OK;
}
......
......@@ -65,6 +65,8 @@ int8_t handle_bcch_dlsch(uint32_t pdu_len, uint8_t *pduP){
int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
NR_UE_L2_STATE_t ret;
module_id_t module_id = ul_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
ret = nr_ue_scheduler(
ul_info->module_id,
......@@ -88,6 +90,9 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
break;
}
mac->if_module->scheduled_response(&mac->scheduled_response);
return 0;
}
......@@ -103,11 +108,13 @@ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
printf("[L2][IF MODULE][DL INDICATION][RX_IND]\n");
for(i=0; i<dl_info->rx_ind->number_pdus; ++i){
switch(dl_info->rx_ind->rx_request_body[i].pdu_type){
case FAPI_NR_RX_PDU_BCCH_BCH_TYPE:
case FAPI_NR_RX_PDU_TYPE_MIB:
handle_bcch_bch(dl_info->rx_ind->rx_request_body[i].mib_pdu.pdu, dl_info->rx_ind->rx_request_body[i].mib_pdu.additional_bits, dl_info->rx_ind->rx_request_body[i].mib_pdu.ssb_index, dl_info->rx_ind->rx_request_body[i].mib_pdu.l_ssb);
break;
case FAPI_NR_RX_PDU_BCCH_DLSCH_TYPE:
case FAPI_NR_RX_PDU_TYPE_SIB:
break;
case FAPI_NR_RX_PDU_TYPE_DLSCH:
break;
default:
break;
......
......@@ -36,6 +36,8 @@
#include "platform_types.h"
#include "fapi_nr_ue_interface.h"
typedef struct {
/// module id
module_id_t module_id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment