Merge branch 'develop-nr' into nr_pdcch
Conflicts: cmake_targets/CMakeLists.txt
This commit is contained in:
@@ -37,9 +37,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NR_BCCH_DL_SCH 3 // SI
|
||||
#define NR_BCCH_DL_SCH 3 // SI
|
||||
|
||||
#define NR_BCCH_BCH 5 // MIB
|
||||
#define NR_BCCH_BCH 5 // MIB
|
||||
|
||||
/*!\brief UE layer 2 status */
|
||||
typedef enum {
|
||||
@@ -49,5 +49,65 @@ typedef enum {
|
||||
PHY_HO_PRACH
|
||||
} NR_UE_L2_STATE_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t LCID:6; // octet 1 [5:0]
|
||||
uint8_t F:1; // octet 1 [6]
|
||||
uint8_t R:1; // octet 1 [7]
|
||||
uint8_t L:8; // octet 2 [7:0]
|
||||
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_SHORT;
|
||||
|
||||
typedef struct {
|
||||
uint8_t LCID:6; // octet 1 [5:0]
|
||||
uint8_t F:1; // octet 1 [6]
|
||||
uint8_t R:1; // octet 1 [7]
|
||||
uint8_t L1:8; // octet 2 [7:0]
|
||||
uint8_t L2:8; // octet 3 [7:0]
|
||||
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG;
|
||||
|
||||
typedef struct {
|
||||
uint8_t LCID:5; // octet 1 [5:0]
|
||||
uint8_t R:2; // octet 1 [7:6]
|
||||
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
|
||||
|
||||
// 38.321 ch6.2.1, 38.331
|
||||
#define DL_SCH_LCID_CCCH 0x00
|
||||
#define DL_SCH_LCID_SRB1 0x01
|
||||
#define DL_SCH_LCID_SRB2 0x02
|
||||
#define DL_SCH_LCID_SRB3 0x03
|
||||
#define DL_SCH_LCID_RECOMMENDED_BITRATE 0x2F
|
||||
#define DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT 0x30
|
||||
#define DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT 0x31
|
||||
#define DL_SCH_LCID_SP_SRS_ACTIVATION 0x32
|
||||
#define DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT 0x33
|
||||
#define DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH 0x34
|
||||
#define DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH 0x35
|
||||
#define DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL 0x36
|
||||
#define DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT 0X37
|
||||
#define DL_SCH_LCID_DUPLICATION_ACT 0X38
|
||||
#define DL_SCH_LCID_SCell_ACT_4_OCT 0X39
|
||||
#define DL_SCH_LCID_SCell_ACT_1_OCT 0X3A
|
||||
#define DL_SCH_LCID_L_DRX 0x3B
|
||||
#define DL_SCH_LCID_DRX 0x3C
|
||||
#define DL_SCH_LCID_TA_COMMAND 0x3D
|
||||
#define DL_SCH_LCID_CON_RES_ID 0x3E
|
||||
#define DL_SCH_LCID_PADDING 0x3F
|
||||
|
||||
#define UL_SCH_LCID_CCCH 0x00
|
||||
#define UL_SCH_LCID_SRB1 0x01
|
||||
#define UL_SCH_LCID_SRB2 0x02
|
||||
#define UL_SCH_LCID_SRB3 0x03
|
||||
#define UL_SCH_LCID_CCCH_MSG3 0x21
|
||||
#define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35
|
||||
#define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36
|
||||
#define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37
|
||||
#define UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT 0x38
|
||||
#define UL_SCH_LCID_SINGLE_ENTRY_PHR 0x39
|
||||
#define UL_SCH_LCID_C_RNTI 0x3A
|
||||
#define UL_SCH_LCID_S_TRUNCATED_BSR 0x3B
|
||||
#define UL_SCH_LCID_L_TRUNCATED_BSR 0x3C
|
||||
#define UL_SCH_LCID_S_BSR 0x3D
|
||||
#define UL_SCH_LCID_L_BSR 0x3E
|
||||
#define UL_SCH_LCID_PADDING 0x3F
|
||||
|
||||
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
|
||||
@@ -59,6 +59,11 @@
|
||||
|
||||
#define NB_NR_UE_MAC_INST 1
|
||||
|
||||
typedef enum {
|
||||
SFN_C_MOD_2_EQ_0,
|
||||
SFN_C_MOD_2_EQ_1
|
||||
} SFN_C_TYPE;
|
||||
|
||||
/*!\brief Top level UE MAC structure */
|
||||
typedef struct {
|
||||
|
||||
@@ -71,30 +76,67 @@ typedef struct {
|
||||
NR_RNTI_Value_t *cs_RNTI;
|
||||
NR_MIB_t *mib;
|
||||
|
||||
/// Type0-PDCCH seach space coreset
|
||||
fapi_nr_search_space_t type0_pdcch_ss;
|
||||
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;
|
||||
/// Type0-PDCCH seach space
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t type0_pdcch_dci_config;
|
||||
uint32_t type0_pdcch_ss_mux_pattern;
|
||||
SFN_C_TYPE type0_pdcch_ss_sfn_c;
|
||||
uint32_t type0_pdcch_ss_n_c;
|
||||
uint32_t type0_pdcch_consecutive_slots;
|
||||
|
||||
/// Random access parameter
|
||||
uint16_t ra_rnti;
|
||||
|
||||
|
||||
//// 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;
|
||||
nr_phy_config_t phy_config;
|
||||
|
||||
|
||||
|
||||
|
||||
} NR_UE_MAC_INST_t;
|
||||
|
||||
typedef enum seach_space_mask_e {
|
||||
type0_pdcch = 0x1,
|
||||
type0a_pdcch = 0x2,
|
||||
type1_pdcch = 0x4,
|
||||
type2_pdcch = 0x8,
|
||||
type3_pdcch = 0x10
|
||||
} search_space_mask_t;
|
||||
|
||||
typedef enum subcarrier_spacing_e {
|
||||
scs_15kHz = 0x1,
|
||||
scs_30kHz = 0x2,
|
||||
scs_60kHz = 0x4,
|
||||
scs_120kHz = 0x8,
|
||||
scs_240kHz = 0x16
|
||||
} subcarrier_spacing_t;
|
||||
|
||||
typedef enum channel_bandwidth_e {
|
||||
bw_5MHz = 0x1,
|
||||
bw_10MHz = 0x2,
|
||||
bw_20MHz = 0x4,
|
||||
bw_40MHz = 0x8,
|
||||
bw_80MHz = 0x16,
|
||||
bw_100MHz = 0x32
|
||||
} channel_bandwidth_t;
|
||||
|
||||
typedef enum frequency_range_e {
|
||||
FR1 = 0,
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
|
||||
#define NUM_SLOT_FRAME 10
|
||||
|
||||
/*@}*/
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
|
||||
// Type0-PDCCH search space
|
||||
extern const int32_t table_38213_13_1_c2[16];
|
||||
extern const int32_t table_38213_13_1_c3[16];
|
||||
extern const int32_t table_38213_13_1_c4[16];
|
||||
@@ -78,4 +78,12 @@ 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];
|
||||
extern const float table_38213_13_12_c3[16];
|
||||
|
||||
extern const int32_t table_38213_10_1_1_c2[5];
|
||||
|
||||
// DCI extraction
|
||||
// for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
||||
extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||
// for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
||||
extern uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||
@@ -43,15 +43,17 @@
|
||||
\param extra_bits extra bits for frame calculation
|
||||
\param l_ssb_equal_64 check if ssb number of candicate is equal 64, 1=equal; 0=non equal. Reference 38.212 7.1.1
|
||||
\param pduP pointer to pdu
|
||||
\param pdu_length length of pdu*/
|
||||
\param pdu_length length of pdu
|
||||
\param cell_id cell id */
|
||||
int8_t nr_ue_decode_mib(
|
||||
module_id_t module_id,
|
||||
int cc_id,
|
||||
uint8_t gNB_index,
|
||||
uint8_t extra_bits,
|
||||
uint32_t l_ssb_equal_64,
|
||||
uint32_t ssb_length,
|
||||
uint32_t ssb_index,
|
||||
void *pduP,
|
||||
uint16_t pdu_len);
|
||||
uint16_t cell_id );
|
||||
|
||||
|
||||
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
|
||||
@@ -94,12 +96,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(
|
||||
const int cc_id,
|
||||
const frame_t rx_frame,
|
||||
const slot_t rx_slot,
|
||||
const int32_t ssb_index,
|
||||
const frame_t tx_frame,
|
||||
const slot_t tx_slot);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* \brief Get SR payload (0,1) from UE MAC
|
||||
@param Mod_id Instance id of UE in machine
|
||||
@@ -112,4 +112,20 @@ NR_UE_L2_STATE_t nr_ue_scheduler(
|
||||
uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe);
|
||||
|
||||
/** @}*/
|
||||
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
||||
|
||||
uint32_t get_ssb_frame(uint32_t test);
|
||||
uint32_t get_ssb_slot(uint32_t ssb_index);
|
||||
|
||||
|
||||
uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||
|
||||
void nr_ue_process_mac_pdu(
|
||||
module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t eNB_index);
|
||||
#endif
|
||||
/** @}*/
|
||||
@@ -79,12 +79,56 @@ const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserv
|
||||
const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
|
||||
const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default
|
||||
|
||||
const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5};
|
||||
const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O
|
||||
const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M
|
||||
const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default
|
||||
|
||||
const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // index 14-15 reserved
|
||||
const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved
|
||||
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}; // 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[5] = { 0, 0, 4, 2, 1 };
|
||||
|
||||
|
||||
#define mu_pusch 1
|
||||
// definition table j Table 6.1.2.1.1-4
|
||||
#define j ((mu_pusch==3)?3:(mu_pusch==2)?2:1)
|
||||
uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
||||
{j, 0,14}, // row index 1
|
||||
{j, 0,12}, // row index 2
|
||||
{j, 0,10}, // row index 3
|
||||
{j, 2,10}, // row index 4
|
||||
{j, 4,10}, // row index 5
|
||||
{j, 4,8}, // row index 6
|
||||
{j, 4,6}, // row index 7
|
||||
{j+1,0,14}, // row index 8
|
||||
{j+1,0,12}, // row index 9
|
||||
{j+1,0,10}, // row index 10
|
||||
{j+2,0,14}, // row index 11
|
||||
{j+2,0,12}, // row index 12
|
||||
{j+2,0,10}, // row index 13
|
||||
{j, 8,6}, // row index 14
|
||||
{j+3,0,14}, // row index 15
|
||||
{j+3,0,10} // row index 16
|
||||
};
|
||||
|
||||
#define dmrs_typeA_pos 2
|
||||
uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?12:11}, // row index 1
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?10:9}, // row index 2
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?9:8}, // row index 3
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?7:6}, // row index 4
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?5:4}, // row index 5
|
||||
{0,(dmrs_typeA_pos == 2)?9:10,(dmrs_typeA_pos == 2)?4:4}, // row index 6
|
||||
{0,(dmrs_typeA_pos == 2)?4:6, (dmrs_typeA_pos == 2)?4:4}, // row index 7
|
||||
{0,5,7}, // row index 8
|
||||
{0,5,2}, // row index 9
|
||||
{0,9,2}, // row index 10
|
||||
{0,12,2}, // row index 11
|
||||
{0,1,13}, // row index 12
|
||||
{0,1,6}, // row index 13
|
||||
{0,2,4}, // row index 14
|
||||
{0,4,7}, // row index 15
|
||||
{0,8,4} // row index 16
|
||||
};
|
||||
Executable → Regular
+513
-69
@@ -34,51 +34,36 @@
|
||||
#include "mac_extern.h"
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
#include "assertions.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef enum subcarrier_spacing_e {
|
||||
scs_15kHz = 0x1,
|
||||
scs_30kHz = 0x2,
|
||||
scs_60kHz = 0x4,
|
||||
scs_120kHz = 0x8,
|
||||
scs_240kHz = 0x16
|
||||
} subcarrier_spacing_t;
|
||||
uint32_t get_ssb_slot(uint32_t ssb_index){
|
||||
// this function now only support f <= 3GHz
|
||||
return ssb_index & 0x3 ;
|
||||
|
||||
typedef enum channel_bandwidth_e {
|
||||
bw_5MHz = 0x1,
|
||||
bw_10MHz = 0x2,
|
||||
bw_20MHz = 0x4,
|
||||
bw_40MHz = 0x8,
|
||||
bw_80MHz = 0x16,
|
||||
bw_100MHz = 0x32
|
||||
} channel_bandwidth_t;
|
||||
|
||||
typedef enum frequency_range_e {
|
||||
FR1 = 0,
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
// return first_symbol(case, freq, ssb_index) / 14
|
||||
}
|
||||
|
||||
int8_t nr_ue_decode_mib(
|
||||
module_id_t module_id,
|
||||
int cc_id,
|
||||
uint8_t gNB_index,
|
||||
uint8_t extra_bits, // 8bits 38.212 c7.1.1
|
||||
uint32_t l_ssb_equal_64,
|
||||
//uint32_t *ssb_index, // from decoded MIB
|
||||
//uint32_t *frameP, // 10 bits = 6(in decoded MIB)+4(in extra bits from L1)
|
||||
void *pduP, // encoded MIB
|
||||
uint16_t pdu_len){
|
||||
uint32_t ssb_length,
|
||||
uint32_t ssb_index,
|
||||
void *pduP,
|
||||
uint16_t cell_id ){
|
||||
|
||||
printf("[L2][MAC] decode mib\n");
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index,
|
||||
NR_BCCH_BCH, (uint8_t *) pduP, pdu_len );
|
||||
nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU
|
||||
|
||||
|
||||
if(mac->mib != NULL){
|
||||
AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n");
|
||||
//if(mac->mib != NULL){
|
||||
uint32_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused);
|
||||
uint32_t frame_number_4lsb = (uint32_t)(extra_bits & 0xf); // extra bits[0:3]
|
||||
uint32_t half_frame_bit = (uint32_t)(( extra_bits >> 4 ) & 0x1 ); // extra bits[4]
|
||||
@@ -86,20 +71,20 @@ int8_t nr_ue_decode_mib(
|
||||
|
||||
uint32_t ssb_subcarrier_offset = mac->mib->ssb_SubcarrierOffset;
|
||||
|
||||
uint32_t ssb_index = 0; // TODO: ssb_index should obtain from L1 in case Lssb != 64
|
||||
//uint32_t ssb_index = 0; // TODO: ssb_index should obtain from L1 in case Lssb != 64
|
||||
|
||||
frame = frame << 4;
|
||||
frame = frame | frame_number_4lsb;
|
||||
|
||||
if(l_ssb_equal_64){
|
||||
ssb_index = (( extra_bits >> 5 ) & 0x7 ); // extra bits[5:7]
|
||||
if(ssb_length == 64){
|
||||
ssb_index = ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] }
|
||||
}else{
|
||||
if(ssb_subcarrier_offset_msb){
|
||||
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef DEBUG_MIB
|
||||
printf("system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]);
|
||||
printf("system frame number(with LSB): %d\n", (int)frame);
|
||||
printf("subcarrier spacing: %d\n", (int)mac->mib->subCarrierSpacingCommon);
|
||||
@@ -112,15 +97,25 @@ int8_t nr_ue_decode_mib(
|
||||
printf("ssb index(extra bits): %d\n", (int)ssb_index);
|
||||
#endif
|
||||
|
||||
subcarrier_spacing_t scs_ssb = scs_15kHz; // default for testing
|
||||
subcarrier_spacing_t scs_pdcch = scs_15kHz; // default for testing
|
||||
channel_bandwidth_t min_channel_bw = bw_5MHz; // deafult for testing
|
||||
subcarrier_spacing_t scs_ssb = scs_30kHz; // default for
|
||||
//const uint32_t scs_index = 0;
|
||||
const uint32_t num_slot_per_frame = 20;
|
||||
subcarrier_spacing_t scs_pdcch;
|
||||
|
||||
// assume carrier frequency < 6GHz
|
||||
if(mac->mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){
|
||||
scs_pdcch = scs_15kHz;
|
||||
}else{ //NR_MIB__subCarrierSpacingCommon_scs30or120
|
||||
scs_pdcch = scs_30kHz;
|
||||
}
|
||||
|
||||
|
||||
channel_bandwidth_t min_channel_bw = bw_40MHz; // deafult for testing
|
||||
|
||||
uint32_t is_condition_A = 1;
|
||||
uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13
|
||||
frequency_range_t frequency_range = FR1;
|
||||
uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1 >> 4) & 0xf;
|
||||
uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1 & 0xf);
|
||||
|
||||
int32_t num_rbs = -1;
|
||||
int32_t num_symbols = -1;
|
||||
int32_t rb_offset = -1;
|
||||
@@ -242,24 +237,41 @@ int8_t nr_ue_decode_mib(
|
||||
AssertFatal(num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined");
|
||||
AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined");
|
||||
|
||||
uint32_t cell_id = 0; // obtain from L1 later
|
||||
mac->type0_pdcch_ss.coreset.rb_start = rb_offset;
|
||||
mac->type0_pdcch_ss.coreset.rb_end = rb_offset + num_rbs - 1;
|
||||
mac->type0_pdcch_ss.coreset.duration = num_symbols;
|
||||
mac->type0_pdcch_ss.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED;
|
||||
mac->type0_pdcch_ss.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L
|
||||
mac->type0_pdcch_ss.coreset.cce_reg_interleaved_interleaver_size = 2; // R
|
||||
mac->type0_pdcch_ss.coreset.cce_reg_interleaved_shift_index = cell_id;
|
||||
mac->type0_pdcch_ss.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE;
|
||||
mac->type0_pdcch_ss.coreset.pdcch_dmrs_scrambling_id = cell_id;
|
||||
//uint32_t cell_id = 0; // obtain from L1 later
|
||||
|
||||
//mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset;
|
||||
//mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1;
|
||||
uint64_t mask = 0x0;
|
||||
uint8_t i;
|
||||
for(i=0; i<(num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs
|
||||
mask = mask >> 1;
|
||||
mask = mask | 0x100000000000;
|
||||
}
|
||||
mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask;
|
||||
mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset
|
||||
|
||||
//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 38.211 7.3.2.2
|
||||
mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2
|
||||
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;
|
||||
|
||||
|
||||
|
||||
// type0-pdcch search space
|
||||
float big_o;
|
||||
uint32_t number_of_search_space_per_slot;
|
||||
float big_m;
|
||||
uint32_t temp;
|
||||
SFN_C_TYPE sfn_c; // only valid for mux=1
|
||||
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
|
||||
|
||||
// 38.213 table 10.1-1
|
||||
|
||||
/// MUX PATTERN 1
|
||||
if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){
|
||||
@@ -267,11 +279,21 @@ int8_t nr_ue_decode_mib(
|
||||
number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb];
|
||||
big_m = table_38213_13_11_c3[index_4lsb];
|
||||
|
||||
temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(ssb_index*big_m);
|
||||
n_c = temp / num_slot_per_frame;
|
||||
if((temp/num_slot_per_frame) & 0x1){
|
||||
sfn_c = SFN_C_MOD_2_EQ_1;
|
||||
}else{
|
||||
sfn_c = SFN_C_MOD_2_EQ_0;
|
||||
}
|
||||
|
||||
if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (ssb_index&1)){
|
||||
first_symbol_index = num_symbols;
|
||||
}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){
|
||||
@@ -286,17 +308,19 @@ int8_t nr_ue_decode_mib(
|
||||
}else{
|
||||
first_symbol_index = 0;
|
||||
}
|
||||
// 38.213 chapter 13: over two consecutive slots
|
||||
search_space_duration = 2;
|
||||
}
|
||||
|
||||
|
||||
/// MUX PATTERN 2
|
||||
if(mac->type0_pdcch_ss_mux_pattern == 2){
|
||||
|
||||
if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){
|
||||
// 38.213 Table 13-13
|
||||
AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n");
|
||||
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
||||
// TODO Type0SS_frame = SSB_frame
|
||||
// TODO Type0SS_slot = SSB_slot
|
||||
// sfn_c = SFN_C_EQ_SFN_SSB;
|
||||
n_c = get_ssb_slot(ssb_index);
|
||||
switch(ssb_index & 0x3){ // ssb_index(i) mod 4
|
||||
case 0:
|
||||
first_symbol_index = 0;
|
||||
@@ -317,7 +341,8 @@ int8_t nr_ue_decode_mib(
|
||||
// 38.213 Table 13-14
|
||||
AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n");
|
||||
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
||||
// TODO Type0SS_frame = SSB_frame
|
||||
// sfn_c = SFN_C_EQ_SFN_SSB;
|
||||
n_c = get_ssb_slot(ssb_index);
|
||||
switch(ssb_index & 0x7){ // ssb_index(i) mod 8
|
||||
case 0:
|
||||
first_symbol_index = 0;
|
||||
@@ -333,11 +358,11 @@ int8_t nr_ue_decode_mib(
|
||||
break;
|
||||
case 4:
|
||||
first_symbol_index = 12;
|
||||
// TODO Type0SS_slot = SSB_slot - 1
|
||||
n_c = get_ssb_slot(ssb_index) - 1;
|
||||
break;
|
||||
case 5:
|
||||
first_symbol_index = 13;
|
||||
// TODO Type0SS_slot = SSB_slot - 1
|
||||
n_c = get_ssb_slot(ssb_index) - 1;
|
||||
break;
|
||||
case 6:
|
||||
first_symbol_index = 0;
|
||||
@@ -348,6 +373,8 @@ int8_t nr_ue_decode_mib(
|
||||
default: break;
|
||||
}
|
||||
}else{ ; }
|
||||
// 38.213 chapter 13: over one slot
|
||||
search_space_duration = 1;
|
||||
}
|
||||
|
||||
/// MUX PATTERN 3
|
||||
@@ -356,8 +383,8 @@ int8_t nr_ue_decode_mib(
|
||||
// 38.213 Table 13-15
|
||||
AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n");
|
||||
// PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot
|
||||
// TODO Type0SS_frame = SSB_frame
|
||||
// TODO Type0SS_slot = SSB_slot
|
||||
// sfn_c = SFN_C_EQ_SFN_SSB;
|
||||
n_c = get_ssb_slot(ssb_index);
|
||||
switch(ssb_index & 0x3){ // ssb_index(i) mod 4
|
||||
case 0:
|
||||
first_symbol_index = 4;
|
||||
@@ -374,13 +401,24 @@ int8_t nr_ue_decode_mib(
|
||||
default: break;
|
||||
}
|
||||
}else{ ; }
|
||||
// 38.213 chapter 13: over one slot
|
||||
search_space_duration = 1;
|
||||
}
|
||||
|
||||
mac->type0_pdcch_ss_big_o = big_o;
|
||||
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;
|
||||
coreset_duration = num_symbols * number_of_search_space_per_slot;
|
||||
|
||||
mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0];
|
||||
mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1];
|
||||
mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4
|
||||
mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8
|
||||
mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // 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;
|
||||
|
||||
// fill in the elements in config request inside P5 message
|
||||
mac->phy_config.config_req.pbch_config.system_frame_number = frame; // after calculation
|
||||
mac->phy_config.config_req.pbch_config.subcarrier_spacing_common = mac->mib->subCarrierSpacingCommon;
|
||||
@@ -396,33 +434,439 @@ int8_t nr_ue_decode_mib(
|
||||
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL){
|
||||
mac->if_module->phy_config_request(&mac->phy_config);
|
||||
}
|
||||
}
|
||||
//}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms
|
||||
uint32_t get_ssb_frame(uint32_t test){
|
||||
return test;
|
||||
}
|
||||
|
||||
// Performs :
|
||||
// 1. TODO: Call RRC for link status return to PHY
|
||||
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
|
||||
// 3. TODO: Perform PHR procedures
|
||||
|
||||
NR_UE_L2_STATE_t nr_ue_scheduler(
|
||||
const module_id_t module_id,
|
||||
const uint8_t gNB_index,
|
||||
const int cc_id,
|
||||
const frame_t rx_frame,
|
||||
const slot_t rx_slot,
|
||||
const int32_t ssb_index,
|
||||
const frame_t tx_frame,
|
||||
const slot_t tx_slot){
|
||||
const slot_t tx_slot ){
|
||||
|
||||
uint32_t search_space_mask = 0;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
// check type0 from 38.213 13
|
||||
if(ssb_index != -1){
|
||||
|
||||
if(mac->type0_pdcch_ss_mux_pattern == 1){
|
||||
// 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;
|
||||
mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.duration;
|
||||
}
|
||||
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;
|
||||
mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.duration;
|
||||
}
|
||||
//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){
|
||||
// 38.213 Table 13-13, 13-14
|
||||
if((rx_frame == get_ssb_frame(rx_frame)) && (rx_slot == mac->type0_pdcch_ss_n_c)){
|
||||
search_space_mask = search_space_mask | type0_pdcch;
|
||||
mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.duration;
|
||||
}
|
||||
}
|
||||
if(mac->type0_pdcch_ss_mux_pattern == 3){
|
||||
// 38.213 Table 13-15
|
||||
if((rx_frame == get_ssb_frame(rx_frame)) && (rx_slot == mac->type0_pdcch_ss_n_c)){
|
||||
search_space_mask = search_space_mask | type0_pdcch;
|
||||
mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_dci_config.duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
||||
if((search_space_mask & type0_pdcch) || ( mac->type0_pdcch_consecutive_slots != 0 )){
|
||||
mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_consecutive_slots - 1;
|
||||
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15 = mac->type0_pdcch_dci_config;
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI;
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dci_config_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;
|
||||
}
|
||||
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format){
|
||||
|
||||
uint32_t
|
||||
ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe)
|
||||
{
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
||||
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
|
||||
const uint16_t n_RB_ULBWP = 106;
|
||||
const uint16_t n_RB_DLBWP = 106;
|
||||
|
||||
uint32_t k_offset;
|
||||
uint32_t sliv_S;
|
||||
uint32_t sliv_L;
|
||||
|
||||
uint32_t l_RB;
|
||||
uint32_t start_RB;
|
||||
uint32_t tmp_RIV;
|
||||
|
||||
switch(dci_format){
|
||||
case format0_0:
|
||||
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
||||
// 0, 1, 2, 3, or 4 bits as defined in:
|
||||
// Subclause 6.1.2.1 of [6, TS 38.214] for formats format0_0,format0_1
|
||||
// Subclause 5.1.2.1 of [6, TS 38.214] for formats format1_0,format1_1
|
||||
// The bitwidth for this field is determined as log2(I) bits,
|
||||
// where I the number of entries in the higher layer parameter pusch-AllocationList
|
||||
k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[dci->time_dom_resource_assignment][0];
|
||||
sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[dci->time_dom_resource_assignment][1];
|
||||
sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[dci->time_dom_resource_assignment][2];
|
||||
|
||||
/* FREQ_DOM_RESOURCE_ASSIGNMENT_UL */
|
||||
// At the moment we are supporting only format 1_0 (and not format 1_1), so we only support resource allocation type 1 (and not type 0).
|
||||
// For resource allocation type 1, the resource allocation field consists of a resource indication value (RIV):
|
||||
// RIV = n_RB_ULBWP * (l_RB - 1) + start_RB if (l_RB - 1) <= floor (n_RB_ULBWP/2)
|
||||
// RIV = n_RB_ULBWP * (n_RB_ULBWP - l_RB + 1) + (n_RB_ULBWP - 1 - start_RB) if (l_RB - 1) > floor (n_RB_ULBWP/2)
|
||||
// the following two expressions apply only if (l_RB - 1) <= floor (n_RB_ULBWP/2)
|
||||
l_RB = floor(dci->freq_dom_resource_assignment_DL/n_RB_ULBWP) + 1;
|
||||
start_RB = dci->freq_dom_resource_assignment_DL%n_RB_ULBWP;
|
||||
// if (l_RB - 1) > floor (n_RB_ULBWP/2) we need to recalculate them using the following lines
|
||||
tmp_RIV = n_RB_ULBWP * (l_RB - 1) + start_RB;
|
||||
if (tmp_RIV != dci->freq_dom_resource_assignment_DL) { // then (l_RB - 1) > floor (n_RB_ULBWP/2) and we need to recalculate l_RB and start_RB
|
||||
l_RB = n_RB_ULBWP - l_RB + 2;
|
||||
start_RB = n_RB_ULBWP - start_RB - 1;
|
||||
}
|
||||
|
||||
// UL_CONFIG_REQ
|
||||
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_PUSCH;
|
||||
ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti;
|
||||
fapi_nr_ul_config_pusch_pdu_rel15_t *ulsch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.ulsch_pdu_rel15;
|
||||
ulsch_config_pdu->number_rbs = l_RB;
|
||||
ulsch_config_pdu->start_rb = start_RB;
|
||||
ulsch_config_pdu->number_symbols = sliv_L;
|
||||
ulsch_config_pdu->start_symbol = sliv_S;
|
||||
ulsch_config_pdu->mcs = dci->mcs;
|
||||
//ulsch0->harq_processes[dci->harq_process_number]->first_rb = start_RB;
|
||||
//ulsch0->harq_processes[dci->harq_process_number]->nb_rb = l_RB;
|
||||
//ulsch0->harq_processes[dci->harq_process_number]->mcs = dci->mcs;
|
||||
//ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi= nr_pdci_info_extracted->ndi;
|
||||
break;
|
||||
|
||||
case format0_1:
|
||||
break;
|
||||
|
||||
case format1_0:
|
||||
|
||||
/* TIME_DOM_RESOURCE_ASSIGNMENT */
|
||||
// Subclause 5.1.2.1 of [6, TS 38.214]
|
||||
// the Time domain resource assignment field of the DCI provides a row index of a higher layer configured table pdsch-symbolAllocation
|
||||
// FIXME! To clarify which parameters to update after reception of row index
|
||||
k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[dci->time_dom_resource_assignment][0];
|
||||
sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A[dci->time_dom_resource_assignment][1];
|
||||
sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A[dci->time_dom_resource_assignment][2];
|
||||
|
||||
|
||||
/* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */
|
||||
// only uplink resource allocation type 1
|
||||
// At the moment we are supporting only format 0_0 (and not format 0_1), so we only support resource allocation type 1 (and not type 0).
|
||||
// For resource allocation type 1, the resource allocation field consists of a resource indication value (RIV):
|
||||
// RIV = n_RB_DLBWP * (l_RB - 1) + start_RB if (l_RB - 1) <= floor (n_RB_DLBWP/2)
|
||||
// RIV = n_RB_DLBWP * (n_RB_DLBWP - l_RB + 1) + (n_RB_DLBWP - 1 - start_RB) if (l_RB - 1) > floor (n_RB_DLBWP/2)
|
||||
// the following two expressions apply only if (l_RB - 1) <= floor (n_RB_DLBWP/2)
|
||||
|
||||
l_RB = floor(dci->freq_dom_resource_assignment_DL/n_RB_DLBWP) + 1;
|
||||
start_RB = dci->freq_dom_resource_assignment_DL%n_RB_DLBWP;
|
||||
// if (l_RB - 1) > floor (n_RB_DLBWP/2) we need to recalculate them using the following lines
|
||||
tmp_RIV = n_RB_DLBWP * (l_RB - 1) + start_RB;
|
||||
if (tmp_RIV != dci->freq_dom_resource_assignment_DL) { // then (l_RB - 1) > floor (n_RB_DLBWP/2) and we need to recalculate l_RB and start_RB
|
||||
l_RB = n_RB_DLBWP - l_RB + 2;
|
||||
start_RB = n_RB_DLBWP - start_RB - 1;
|
||||
}
|
||||
|
||||
|
||||
// DL_CONFIG_REQ
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
|
||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
||||
dlsch_config_pdu->number_rbs = l_RB;
|
||||
dlsch_config_pdu->start_rb = start_RB;
|
||||
dlsch_config_pdu->number_symbols = sliv_L;
|
||||
dlsch_config_pdu->start_symbol = sliv_S;
|
||||
dlsch_config_pdu->mcs = dci->mcs;
|
||||
|
||||
|
||||
//pdlsch0_harq->nb_rb = l_RB;
|
||||
//pdlsch0->current_harq_pid = dci->harq_process_number;
|
||||
//pdlsch0->active = 1;
|
||||
//pdlsch0->rnti = rnti;
|
||||
//pdlsch0_harq->mcs = nr_pdci_info_extracted->mcs;
|
||||
//pdlsch0_harq->DCINdi = nr_pdci_info_extracted->ndi;
|
||||
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
break;
|
||||
|
||||
case format1_1:
|
||||
break;
|
||||
|
||||
case format2_0:
|
||||
break;
|
||||
|
||||
case format2_1:
|
||||
break;
|
||||
|
||||
case format2_2:
|
||||
break;
|
||||
|
||||
case format2_3:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(rnti == SI_RNTI){
|
||||
|
||||
}else if(rnti == mac->ra_rnti){
|
||||
|
||||
}else if(rnti == P_RNTI){
|
||||
|
||||
}else{ // c-rnti
|
||||
|
||||
/// check if this is pdcch order
|
||||
//dci->random_access_preamble_index;
|
||||
//dci->ss_pbch_index;
|
||||
//dci->prach_mask_index;
|
||||
|
||||
/// else normal DL-SCH grant
|
||||
}
|
||||
}
|
||||
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe){
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void nr_ue_process_mac_pdu(
|
||||
module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t eNB_index){
|
||||
|
||||
uint8_t *pdu_ptr = pduP;
|
||||
uint16_t pdu_len = mac_pdu_len;
|
||||
|
||||
uint16_t mac_ce_len;
|
||||
uint16_t mac_subheader_len;
|
||||
uint16_t mac_sdu_len;
|
||||
|
||||
// For both DL/UL-SCH
|
||||
// Except:
|
||||
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
||||
// - UL/DL-SCH: padding
|
||||
// - UL-SCH: MSG3 48-bits
|
||||
// |0|1|2|3|4|5|6|7| bit-wise
|
||||
// |R|F| LCID |
|
||||
// | L |
|
||||
// |0|1|2|3|4|5|6|7| bit-wise
|
||||
// |R|F| LCID |
|
||||
// | L |
|
||||
// | L |
|
||||
|
||||
// For both DL/UL-SCH
|
||||
// For:
|
||||
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
||||
// - UL/DL-SCH: padding, for single/multiple 1-oct padding CE(s)
|
||||
// - UL-SCH: MSG3 48-bits
|
||||
// |0|1|2|3|4|5|6|7| bit-wise
|
||||
// |R|R| LCID |
|
||||
// LCID: The Logical Channel ID field identifies the logical channel instance of the corresponding MAC SDU or the type of the corresponding MAC CE or padding as described in Tables 6.2.1-1 and 6.2.1-2 for the DL-SCH and UL-SCH respectively. There is one LCID field per MAC subheader. The LCID field size is 6 bits;
|
||||
// L: The Length field indicates the length of the corresponding MAC SDU or variable-sized MAC CE in bytes. There is one L field per MAC subheader except for subheaders corresponding to fixed-sized MAC CEs and padding. The size of the L field is indicated by the F field;
|
||||
// F: lenght of L is 0:8 or 1:16 bits wide
|
||||
// R: Reserved bit, set to zero.
|
||||
|
||||
uint8_t done = 0;
|
||||
|
||||
while (!done || pdu_len <= 0){
|
||||
mac_ce_len = 0x0000;
|
||||
mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct
|
||||
mac_sdu_len = 0x0000;
|
||||
switch(((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID){
|
||||
// MAC CE
|
||||
case DL_SCH_LCID_CCCH:
|
||||
// MSG4 RRC Connection Setup 38.331
|
||||
// varialbe length
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
break;
|
||||
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
|
||||
// 38.321 Ch6.1.3.14
|
||||
// varialbe length
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
break;
|
||||
case DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL:
|
||||
// 38.321 Ch6.1.3.13
|
||||
// varialbe length
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
break;
|
||||
case DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT:
|
||||
// 38.321 Ch6.1.3.12
|
||||
// varialbe length
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
break;
|
||||
case DL_SCH_LCID_SP_SRS_ACTIVATION:
|
||||
// 38.321 Ch6.1.3.17
|
||||
// varialbe length
|
||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case DL_SCH_LCID_RECOMMENDED_BITRATE:
|
||||
// 38.321 Ch6.1.3.20
|
||||
mac_ce_len = 2;
|
||||
break;
|
||||
case DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT:
|
||||
// 38.321 Ch6.1.3.19
|
||||
mac_ce_len = 2;
|
||||
break;
|
||||
case DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT:
|
||||
// 38.321 Ch6.1.3.18
|
||||
mac_ce_len = 3;
|
||||
break;
|
||||
case DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT:
|
||||
// 38.321 Ch6.1.3.16
|
||||
mac_ce_len = 2;
|
||||
break;
|
||||
case DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH:
|
||||
// 38.321 Ch6.1.3.15
|
||||
mac_ce_len = 2;
|
||||
break;
|
||||
case DL_SCH_LCID_DUPLICATION_ACT:
|
||||
// 38.321 Ch6.1.3.11
|
||||
mac_ce_len = 1;
|
||||
break;
|
||||
case DL_SCH_LCID_SCell_ACT_4_OCT:
|
||||
// 38.321 Ch6.1.3.10
|
||||
mac_ce_len = 4;
|
||||
break;
|
||||
case DL_SCH_LCID_SCell_ACT_1_OCT:
|
||||
// 38.321 Ch6.1.3.10
|
||||
mac_ce_len = 1;
|
||||
break;
|
||||
case DL_SCH_LCID_L_DRX:
|
||||
// 38.321 Ch6.1.3.6
|
||||
// fixed length but not yet specify.
|
||||
mac_ce_len = 0;
|
||||
break;
|
||||
case DL_SCH_LCID_DRX:
|
||||
// 38.321 Ch6.1.3.5
|
||||
// fixed length but not yet specify.
|
||||
mac_ce_len = 0;
|
||||
break;
|
||||
case DL_SCH_LCID_TA_COMMAND:
|
||||
// 38.321 Ch6.1.3.4
|
||||
mac_ce_len = 1;
|
||||
break;
|
||||
case DL_SCH_LCID_CON_RES_ID:
|
||||
// 38.321 Ch6.1.3.3
|
||||
mac_ce_len = 6;
|
||||
break;
|
||||
case DL_SCH_LCID_PADDING:
|
||||
done = 1;
|
||||
// end of MAC PDU, can ignore the rest.
|
||||
break;
|
||||
|
||||
// MAC SDU
|
||||
case DL_SCH_LCID_SRB1:
|
||||
// check if LCID is valid at current time.
|
||||
case UL_SCH_LCID_SRB2:
|
||||
// check if LCID is valid at current time.
|
||||
case UL_SCH_LCID_SRB3:
|
||||
// check if LCID is valid at current time.
|
||||
default:
|
||||
// check if LCID is valid at current time.
|
||||
mac_sdu_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||
mac_subheader_len = 2;
|
||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||
mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||
mac_subheader_len = 3;
|
||||
}
|
||||
// DRB LCID by RRC
|
||||
break;
|
||||
}
|
||||
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||
AssertFatal(pdu_len >= 0, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length < 0!\n");
|
||||
}
|
||||
}
|
||||
|
||||
Executable → Regular
+115
-31
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "NR_IF_Module.h"
|
||||
#include "mac_proto.h"
|
||||
#include "assertions.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -39,32 +40,37 @@
|
||||
|
||||
static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES];
|
||||
|
||||
// L2 Abstraction Layer
|
||||
int8_t handle_bcch_bch(module_id_t module_id, int cc_id, uint8_t gNB_index, uint8_t *pduP, uint8_t additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id){
|
||||
|
||||
int8_t handle_bcch_bch(uint32_t pdu_len, uint8_t *pduP){
|
||||
|
||||
// pdu_len = 4, 32bits
|
||||
uint8_t extra_bits = pduP[0];
|
||||
nr_ue_decode_mib( (module_id_t)0,
|
||||
0,
|
||||
0,
|
||||
extra_bits,
|
||||
0, // Lssb = 64 is not support
|
||||
&pduP[1],
|
||||
pdu_len );
|
||||
return nr_ue_decode_mib( module_id,
|
||||
cc_id,
|
||||
gNB_index,
|
||||
additional_bits,
|
||||
ssb_length, // Lssb = 64 is not support
|
||||
ssb_index,
|
||||
pduP,
|
||||
cell_id);
|
||||
|
||||
}
|
||||
|
||||
// L2 Abstraction Layer
|
||||
int8_t handle_bcch_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len){
|
||||
|
||||
return 0;
|
||||
}
|
||||
// L2 Abstraction Layer
|
||||
int8_t handle_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_type){
|
||||
|
||||
int8_t handle_bcch_dlsch(uint32_t pdu_len, uint8_t *pduP){
|
||||
return nr_ue_process_dci(module_id, cc_id, gNB_index, dci, rnti, dci_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -72,6 +78,7 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
|
||||
ul_info->cc_id,
|
||||
ul_info->frame,
|
||||
ul_info->slot,
|
||||
ul_info->ssb_index,
|
||||
0, 0); // TODO check tx/rx frame/slot is need for NR version
|
||||
|
||||
switch(ret){
|
||||
@@ -87,39 +94,116 @@ int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
mac->if_module->scheduled_response(&mac->scheduled_response);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
|
||||
|
||||
int32_t i;
|
||||
uint32_t ret_mask = 0x0;
|
||||
module_id_t module_id = dl_info->module_id;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
// clean up scheduled_response structure
|
||||
|
||||
//if(dl_info->rx_ind != NULL){
|
||||
if(dl_info->rx_ind != NULL){
|
||||
printf("[L2][IF MODULE][DL INDICATION][RX_IND]\n");
|
||||
switch(dl_info->rx_ind.rx_request_body.pdu_index){
|
||||
case FAPI_NR_RX_PDU_BCCH_BCH_TYPE:
|
||||
handle_bcch_bch(dl_info->rx_ind.rx_request_body.pdu_length, dl_info->rx_ind.rx_request_body.pdu);
|
||||
break;
|
||||
case FAPI_NR_RX_PDU_BCCH_DLSCH_TYPE:
|
||||
handle_bcch_dlsch(dl_info->rx_ind.rx_request_body.pdu_length, dl_info->rx_ind.rx_request_body.pdu);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
for(i=0; i<dl_info->rx_ind->number_pdus; ++i){
|
||||
switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){
|
||||
case FAPI_NR_RX_PDU_TYPE_MIB:
|
||||
ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.additional_bits,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id )) << FAPI_NR_RX_PDU_TYPE_MIB;
|
||||
break;
|
||||
case FAPI_NR_RX_PDU_TYPE_SIB:
|
||||
ret_mask |= (handle_bcch_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->sib_pdu.sibs_mask,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu_length )) << FAPI_NR_RX_PDU_TYPE_SIB;
|
||||
break;
|
||||
case FAPI_NR_RX_PDU_TYPE_DLSCH:
|
||||
ret_mask |= (0) << FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//if(dl_info->dci_ind != NULL){
|
||||
|
||||
//}
|
||||
|
||||
if(nr_ue_if_module_inst[module_id] != NULL){
|
||||
nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(dl_info->dci_ind != NULL){
|
||||
printf("[L2][IF MODULE][DL INDICATION][DCI_IND]\n");
|
||||
for(i=0; dl_info->dci_ind->number_of_dcis; ++i){
|
||||
fapi_nr_dci_pdu_rel15_t *dci = &dl_info->dci_ind->dci_list[i].dci;
|
||||
|
||||
ret_mask |= (handle_dci(
|
||||
dl_info->module_id,
|
||||
dl_info->cc_id,
|
||||
dl_info->gNB_index,
|
||||
dci,
|
||||
(dl_info->dci_ind->dci_list+i)->rnti,
|
||||
(dl_info->dci_ind->dci_list+i)->dci_format)) << FAPI_NR_DCI_IND;
|
||||
|
||||
|
||||
/*switch((dl_info->dci_ind->dci_list+i)->dci_type){
|
||||
case FAPI_NR_DCI_TYPE_0_0:
|
||||
case FAPI_NR_DCI_TYPE_0_1:
|
||||
case FAPI_NR_DCI_TYPE_1_1:
|
||||
case FAPI_NR_DCI_TYPE_2_0:
|
||||
case FAPI_NR_DCI_TYPE_2_1:
|
||||
case FAPI_NR_DCI_TYPE_2_2:
|
||||
case FAPI_NR_DCI_TYPE_2_3:
|
||||
AssertFatal(1==0, "Not yet support at this moment!\n");
|
||||
break;
|
||||
|
||||
case FAPI_NR_DCI_TYPE_1_0:
|
||||
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
|
||||
|
||||
// mapping into DL_CONFIG_REQ for DL-SCH
|
||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
|
||||
|
||||
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = 0x0000; // TX RNTI: UE-spec
|
||||
memcpy(dlsch_config_pdu, dci, sizeof(fapi_nr_dci_pdu_rel15_t));
|
||||
|
||||
dl_config->number_pdus = dl_config->number_pdus + 1;
|
||||
|
||||
ret_mask |= (handle_dci(
|
||||
dl_info->module_id,
|
||||
dl_info->cc_id,
|
||||
dl_info->gNB_index,
|
||||
dci,
|
||||
(dl_info->dci_ind->dci_list+i)->rnti,
|
||||
(dl_info->dci_ind->dci_list+i)->dci_type)) << FAPI_NR_DCI_IND;
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
|
||||
|
||||
//(dl_info->dci_list+i)->rnti
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is void!\n" );
|
||||
nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -36,9 +36,13 @@
|
||||
#include "platform_types.h"
|
||||
#include "fapi_nr_ue_interface.h"
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/// module id
|
||||
module_id_t module_id;
|
||||
/// gNB index
|
||||
uint32_t gNB_index;
|
||||
/// component carrier id
|
||||
int cc_id;
|
||||
/// frame
|
||||
@@ -48,10 +52,10 @@ typedef struct {
|
||||
|
||||
/// NR UE FAPI-like P7 message, direction: L1 to L2
|
||||
/// data reception indication structure
|
||||
fapi_nr_rx_indication_t rx_ind;
|
||||
fapi_nr_rx_indication_t *rx_ind;
|
||||
|
||||
/// dci reception indication structure
|
||||
fapi_nr_dci_indication_t dci_ind;
|
||||
fapi_nr_dci_indication_t *dci_ind;
|
||||
|
||||
} nr_downlink_indication_t;
|
||||
|
||||
@@ -67,6 +71,8 @@ typedef struct {
|
||||
frame_t frame;
|
||||
/// slot
|
||||
uint32_t slot;
|
||||
/// ssb_index, if ssb is not present in current TTI, thie value set to -1
|
||||
int8_t ssb_index;
|
||||
} nr_uplink_indication_t;
|
||||
|
||||
// Downlink subframe P7
|
||||
@@ -175,18 +181,22 @@ int8_t nr_ue_if_module_kill(uint32_t module_id);
|
||||
\param dl_info including dci_ind and rx_request messages*/
|
||||
int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info);
|
||||
|
||||
|
||||
// TODO check
|
||||
/**\brief handle BCCH-BCH message from dl_indication
|
||||
\param pdu_len length(bytes) of pdu
|
||||
\param pduP pointer to pdu*/
|
||||
int8_t handle_bcch_bch(uint32_t pdu_len, uint8_t *pduP);
|
||||
|
||||
\param pduP pointer to bch pdu
|
||||
\param additional_bits corresponding to 38.212 ch.7
|
||||
\param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
|
||||
\param ssb_length corresponding to L1 parameter L_ssb
|
||||
\param cell_id cell id */
|
||||
int8_t handle_bcch_bch(module_id_t module_id, int cc_id, uint8_t gNB_index, uint8_t *pduP, uint8_t additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id);
|
||||
|
||||
// TODO check
|
||||
/**\brief handle BCCH-DL-SCH message from dl_indication
|
||||
\param pdu_len length(bytes) of pdu
|
||||
\param pduP pointer to pdu*/
|
||||
int8_t handle_bcch_dlsch(uint32_t pdu_len, uint8_t *pduP);
|
||||
int8_t handle_bcch_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len);
|
||||
|
||||
int8_t handle_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_type);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1807,9 +1807,10 @@ rrc_ue_process_rrcConnectionReconfiguration(
|
||||
LOG_I(RRC,"Radio Resource Configuration is present\n");
|
||||
rrc_ue_process_radioResourceConfigDedicated(ctxt_pP,eNB_index, rrcConnectionReconfiguration_r8->radioResourceConfigDedicated);
|
||||
}
|
||||
|
||||
|
||||
/* void *non_criticical_ext_iterator = rrcConnectionReconfiguration_r8;
|
||||
|
||||
// LTE Rel 15 not yet here
|
||||
#if Rel15
|
||||
void *non_criticical_ext_iterator = rrcConnectionReconfiguration_r8;
|
||||
RCCConnectionReconfiguration_v1510_IEs_t *rrc_connection_reconfiguration_v1510_IEs = (RRCConnectionReconfiguration_v1510_IEs_t *)0;
|
||||
// fetch EN-DC for NR_RRC here
|
||||
// r8
|
||||
@@ -1851,8 +1852,8 @@ rrc_ue_process_rrcConnectionReconfiguration(
|
||||
case nr_Config_r15_PR_setup:
|
||||
// process NR sCell config
|
||||
if(rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15 != (OCTET_STRING_t *)0){
|
||||
nr_rrc_ue_decode_rrcReconfiguration( rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15->buffer,
|
||||
rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15.size);
|
||||
nr_rrc_ue_decode_secondary_cellgroup_config( rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15->buffer,
|
||||
rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15.size);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1862,7 +1863,8 @@ rrc_ue_process_rrcConnectionReconfiguration(
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "rrc_defs.h"
|
||||
#include "rrc_proto.h"
|
||||
#include "assertions.h"
|
||||
|
||||
typedef uint32_t channel_t;
|
||||
|
||||
@@ -46,7 +47,7 @@ nr_mac_rrc_data_ind_ue(
|
||||
|
||||
switch(channel){
|
||||
case NR_BCCH_BCH:
|
||||
nr_rrc_ue_decode_NR_BCCH_BCH_Message( module_id, gNB_index, (uint8_t*)pduP, pdu_len);
|
||||
AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message( module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
+49
-36
@@ -50,22 +50,34 @@
|
||||
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
|
||||
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(
|
||||
const uint8_t *buffer,
|
||||
const uint32_t size
|
||||
){
|
||||
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
||||
const uint32_t size ){
|
||||
|
||||
NR_CellGroupConfig_t *cell_group_config = NULL;
|
||||
uint32_t i;
|
||||
|
||||
uper_decode(NULL,
|
||||
&asn_DEF_NR_CellGroupConfig, //might be added prefix later
|
||||
(void **)&cellGroupConfig,
|
||||
(uint8_t *)buffer,
|
||||
size, 0, 0);
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
||||
&asn_DEF_NR_CellGroupConfig,
|
||||
(void **)&cell_group_config,
|
||||
(uint8_t *)buffer,
|
||||
size );
|
||||
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
printf("NR_CellGroupConfig decode error\n");
|
||||
for (i=0; i<size; i++){
|
||||
printf("%02x ",buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
// free the memory
|
||||
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 1 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(NR_UE_rrc_inst->cell_group_config == NULL){
|
||||
NR_UE_rrc_inst->cell_group_config = cellGroupConfig;
|
||||
nr_rrc_ue_process_scg_config(cellGroupConfig);
|
||||
NR_UE_rrc_inst->cell_group_config = cell_group_config;
|
||||
nr_rrc_ue_process_scg_config(cell_group_config);
|
||||
}else{
|
||||
nr_rrc_ue_process_scg_config(cellGroupConfig);
|
||||
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cellGroupConfig, 0);
|
||||
nr_rrc_ue_process_scg_config(cell_group_config);
|
||||
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 0);
|
||||
}
|
||||
|
||||
//nr_rrc_mac_config_req_ue( module_id_t module_id, int CC_id, uint8_t gNB_index, NR_MIB_t *mibP, NR_MAC_CellGroupConfig_t *mac_cell_group_configP, NR_PhysicalCellGroupConfig_t *phy_cell_group_configP, NR_SpCellConfig_t *spcell_configP );
|
||||
@@ -263,34 +275,34 @@ int8_t openair_rrc_top_init_ue_nr(void){
|
||||
int8_t nr_ue_process_rlc_bearer_list(NR_CellGroupConfig_t *cell_group_config){
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
int8_t nr_ue_process_secondary_cell_list(NR_CellGroupConfig_t *cell_group_config){
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
int8_t nr_ue_process_mac_cell_group_config(NR_MAC_CellGroupConfig_t *mac_cell_group_config){
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
int8_t nr_ue_process_physical_cell_group_config(NR_PhysicalCellGroupConfig_t *phy_cell_group_config){
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
/*brief decode BCCH-BCH (MIB) message*/
|
||||
int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
|
||||
const module_id_t module_id,
|
||||
const uint8_t gNB_index,
|
||||
uint8_t *const bufferP,
|
||||
const uint8_t buffer_len){
|
||||
const uint8_t buffer_len ){
|
||||
int i;
|
||||
NR_BCCH_BCH_Message_t *bcch_message = NULL;
|
||||
NR_MIB_t *mib = NR_UE_rrc_inst->mib;
|
||||
@@ -305,22 +317,21 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
|
||||
}
|
||||
|
||||
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
||||
&asn_DEF_NR_BCCH_BCH_Message,
|
||||
(void **)&bcch_message,
|
||||
(const void *)bufferP,
|
||||
buffer_len
|
||||
);
|
||||
&asn_DEF_NR_BCCH_BCH_Message,
|
||||
(void **)&bcch_message,
|
||||
(const void *)bufferP,
|
||||
buffer_len );
|
||||
|
||||
if(bcch_message->message.choice.mib->systemFrameNumber.buf != 0){
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
|
||||
for (i=0; i<buffer_len; i++)
|
||||
printf("%02x ",bufferP[i]);
|
||||
|
||||
printf("\n");
|
||||
// free the memory
|
||||
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 );
|
||||
return -1;
|
||||
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
|
||||
printf("NR_CellGroupConfig decode error\n");
|
||||
for (i=0; i<buffer_len; i++){
|
||||
printf("%02x ",bufferP[i]);
|
||||
}
|
||||
printf("\n");
|
||||
// free the memory
|
||||
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// link to rrc instance
|
||||
@@ -331,6 +342,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
|
||||
|
||||
nr_rrc_mac_config_req_ue( 0, 0, 0, mib, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -340,8 +352,9 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
|
||||
const module_id_t module_id,
|
||||
const uint8_t gNB_index,
|
||||
const uint8_t *bufferP,
|
||||
const uint32_t buffer_len){
|
||||
const uint32_t buffer_len ){
|
||||
// uper_decode by nr R15 rrc_connection_reconfiguration
|
||||
|
||||
int32_t i;
|
||||
NR_DL_DCCH_Message_t *nr_dl_dcch_msg = NULL;
|
||||
|
||||
@@ -349,9 +362,9 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
|
||||
&asn_DEF_NR_DL_DCCH_Message,
|
||||
(void**)&nr_dl_dcch_msg,
|
||||
(uint8_t *)bufferP,
|
||||
buffer_len, 0, 0);
|
||||
buffer_len, 0, 0);
|
||||
|
||||
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
||||
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
|
||||
|
||||
for (i=0; i<buffer_len; i++)
|
||||
printf("%02x ",bufferP[i]);
|
||||
@@ -407,4 +420,4 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ int8_t openair_rrc_top_init_ue_nr(void);
|
||||
\param buffer encoded NR-RRC-Connection-Reconfiguration/Secondary-Cell-Group-Config message.
|
||||
\param size length of buffer*/
|
||||
//TODO check to use which one
|
||||
int8_t nr_rrc_ue_decode_rrcReconfiguration(const uint8_t *buffer, const uint32_t size);
|
||||
//int8_t nr_rrc_ue_decode_rrcReconfiguration(const uint8_t *buffer, const uint32_t size);
|
||||
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const uint8_t *buffer, const uint32_t size);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user