Commit 57066055 authored by Guy De Souza's avatar Guy De Souza

Merge branch 'develop-nr' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nr

parents b0b11a92 1f439ef2
cmake_targets/log/
cmake_targets/ran_build/
targets/bin/
...@@ -370,12 +370,17 @@ typedef struct { ...@@ -370,12 +370,17 @@ typedef struct {
} fapi_nr_pucch_config_common_t; } fapi_nr_pucch_config_common_t;
typedef struct { typedef struct {
uint8_t subcarrier_spacing_common; uint8_t subcarrier_spacing_common;
uint8_t ssb_subcarrier_offset; uint8_t ssb_subcarrier_offset;
uint8_t dmrs_type_a_position; uint8_t dmrs_type_a_position;
uint8_t pdcch_config_sib1; uint8_t pdcch_config_sib1;
uint8_t cell_barred; uint8_t cell_barred;
uint8_t intra_frquency_reselection; uint8_t intra_frquency_reselection;
uint16_t system_frame_number;
uint8_t ssb_index;
uint8_t half_frame_bit;
} fapi_nr_pbch_config_t; } fapi_nr_pbch_config_t;
typedef struct { typedef struct {
...@@ -716,11 +721,18 @@ typedef struct { ...@@ -716,11 +721,18 @@ typedef struct {
} fapi_nr_ul_bwp_dedicated_config_t; } fapi_nr_ul_bwp_dedicated_config_t;
#define FAPI_NR_CONFIG_REQUEST_MASK_PBCH 0x01
#define FAPI_NR_CONFIG_REQUEST_MASK_DL_BWP_COMMON 0x02
#define FAPI_NR_CONFIG_REQUEST_MASK_UL_BWP_COMMON 0x04
#define FAPI_NR_CONFIG_REQUEST_MASK_DL_BWP_DEDICATED 0x08
#define FAPI_NR_CONFIG_REQUEST_MASK_UL_BWP_DEDICATED 0x10
typedef struct { typedef struct {
fapi_nr_p4_p5_message_header_t header; fapi_nr_p4_p5_message_header_t header;
uint8_t num_tlv; uint8_t num_tlv;
uint32_t config_mask;
fapi_nr_pbch_config_t pbch_config_common; // MIB fapi_nr_pbch_config_t pbch_config; // MIB
fapi_nr_dl_bwp_common_config_t dl_bwp_common; fapi_nr_dl_bwp_common_config_t dl_bwp_common;
fapi_nr_dl_bwp_dedicated_config_t dl_bwp_dedicated; fapi_nr_dl_bwp_dedicated_config_t dl_bwp_dedicated;
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#include "NR_SpCellConfig.h" #include "NR_SpCellConfig.h"
#include "NR_ServingCellConfig.h" #include "NR_ServingCellConfig.h"
#include "fapi_nr_ue_interface.h"
#include "NR_IF_Module.h"
#define NB_NR_UE_MAC_INST 1 #define NB_NR_UE_MAC_INST 1
...@@ -75,6 +77,16 @@ typedef struct { ...@@ -75,6 +77,16 @@ typedef struct {
NR_MIB_t *mib; NR_MIB_t *mib;
//// FAPI-like interface
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;
nr_ue_if_module_t *if_module;
nr_scheduled_response_t scheduled_response;
nr_phy_config_t phy_config;
} NR_UE_MAC_INST_t; } NR_UE_MAC_INST_t;
/*@}*/ /*@}*/
......
...@@ -37,31 +37,53 @@ int8_t nr_ue_decode_mib( ...@@ -37,31 +37,53 @@ int8_t nr_ue_decode_mib(
uint8_t gNB_index, uint8_t gNB_index,
uint8_t extra_bits, // 8bits 38.212 c7.1.1 uint8_t extra_bits, // 8bits 38.212 c7.1.1
uint32_t l_ssb_equal_64, uint32_t l_ssb_equal_64,
uint32_t *ssb_index, // from decoded MIB //uint32_t *ssb_index, // from decoded MIB
uint32_t *frameP, // 10 bits = 6(in decoded MIB)+4(in extra bits from L1) //uint32_t *frameP, // 10 bits = 6(in decoded MIB)+4(in extra bits from L1)
void *pduP, // encoded MIB void *pduP, // encoded MIB
uint16_t pdu_len){ uint16_t pdu_len){
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
nr_mac_rrc_data_ind_ue( module_id, CC_id, gNB_index, frameP, nr_mac_rrc_data_ind_ue( module_id, CC_id, gNB_index,
NR_BCCH_BCH, (uint8_t *) pduP, pdu_len ); NR_BCCH_BCH, (uint8_t *) pduP, pdu_len );
uint32_t frame = mac->mib->systemFrameNumber.buf[0]; uint32_t frame = mac->mib->systemFrameNumber.buf[0];
uint32_t frame_number_4lsb = (uint32_t)(extra_bits & 0xf); uint32_t frame_number_4lsb = (uint32_t)(extra_bits & 0xf); // extra bits[0:3]
uint32_t ssb_subcarrier_offset_msb = (uint32_t)(( extra_bits >> 4 ) & 0x1 ); uint32_t half_frame_bit = (uint32_t)(( extra_bits >> 4 ) & 0x1 ); // extra bits[4]
uint32_t ssb_subcarrier_offset_msb = (uint32_t)(( extra_bits >> 5 ) & 0x1 ); // extra bits[5]
uint32_t ssb_subcarrier_offset = mac->mib->subCarrierSpacingCommon;
uint32_t ssb_index;
frame = frame << 4; frame = frame << 4;
frame = frame | frame_number_4lsb; frame = frame | frame_number_4lsb;
*frameP = frame;
if(l_ssb_equal_64){ if(l_ssb_equal_64){
*ssb_index = (( extra_bits >> 4 ) & 0x7 ); ssb_index = (( extra_bits >> 5 ) & 0x7 ); // extra bits[5:7]
mac->phy_config.config_req.pbch_config.ssb_index = ssb_index;
}else{
if(ssb_subcarrier_offset_msb){
ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10;
}
} }
// 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;
mac->phy_config.config_req.pbch_config.ssb_subcarrier_offset = ssb_subcarrier_offset; // after calculation
mac->phy_config.config_req.pbch_config.dmrs_type_a_position = mac->mib->dmrs_TypeA_Position;
mac->phy_config.config_req.pbch_config.pdcch_config_sib1 = mac->mib->pdcch_ConfigSIB1;
mac->phy_config.config_req.pbch_config.cell_barred = mac->mib->cellBarred;
mac->phy_config.config_req.pbch_config.intra_frquency_reselection = mac->mib->intraFreqReselection;
mac->phy_config.config_req.pbch_config.half_frame_bit = half_frame_bit;
mac->phy_config.config_req.config_mask |= FAPI_NR_CONFIG_REQUEST_MASK_PBCH;
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL){
mac->if_module->phy_config_request(&mac->phy_config);
}
return 0; return 0;
} }
...@@ -36,12 +36,10 @@ ...@@ -36,12 +36,10 @@
\param CC_id component carrier id \param CC_id component carrier id
\param gNB_index gNB index \param gNB_index gNB index
\param extra_bits extra bits for frame calculation \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 c7.1.1 \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 ssb_index SSB index for frame calculation
\param frameP pointer to frame for revising after frame calculation
\param pduP pointer to pdu \param pduP pointer to pdu
\param pdu_length length of pdu*/ \param pdu_length length of pdu*/
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_index, uint32_t *frameP, void *pduP, uint16_t pdu_len); 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, void *pduP, uint16_t pdu_len);
/**\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) /**\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)
......
...@@ -44,19 +44,16 @@ int8_t handle_bcch_bch(uint32_t pdu_len, uint8_t *pduP){ ...@@ -44,19 +44,16 @@ int8_t handle_bcch_bch(uint32_t pdu_len, uint8_t *pduP){
// pdu_len = 4, 32bits // pdu_len = 4, 32bits
uint8_t extra_bits = pduP[3]; uint8_t extra_bits = pduP[3];
uint32_t ssb_index;
uint32_t frame;
nr_ue_decode_mib( (module_id_t)0, nr_ue_decode_mib( (module_id_t)0,
0, 0,
0, 0,
extra_bits, extra_bits,
0, // Lssb = 64 is not support 0, // Lssb = 64 is not support
&ssb_index,
&frame,
pduP, pduP,
3 ); 3 );
return 0; return 0;
} }
...@@ -66,6 +63,12 @@ int8_t handle_bcch_dlsch(uint32_t pdu_len, uint8_t *pduP){ ...@@ -66,6 +63,12 @@ int8_t handle_bcch_dlsch(uint32_t pdu_len, uint8_t *pduP){
} }
int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
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){
switch(dl_info->rx_ind->rx_request_body.pdu_index){ switch(dl_info->rx_ind->rx_request_body.pdu_index){
case FAPI_NR_RX_PDU_BCCH_BCH_TYPE: case FAPI_NR_RX_PDU_BCCH_BCH_TYPE:
...@@ -84,10 +87,13 @@ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -84,10 +87,13 @@ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
} }
return 0; if(nr_ue_if_module_inst[module_id] != NULL){
} nr_ue_if_module_inst[module_id]->scheduled_response(&mac->scheduled_response);
}
return 0;
}
nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){
...@@ -102,36 +108,6 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ ...@@ -102,36 +108,6 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){
return nr_ue_if_module_inst[module_id]; return nr_ue_if_module_inst[module_id];
} }
int8_t nr_ue_if_module_register_dl_indication(uint32_t module_id, nr_ue_dl_indication_f *f){
if (nr_ue_if_module_inst[module_id] == NULL) {
nr_ue_if_module_inst[module_id]->dl_indication = f;
}else{
return -1;
}
return 0;
}
int8_t nr_ue_if_module_register_phy_config_request(uint32_t module_id, nr_ue_phy_config_request_f *f){
if (nr_ue_if_module_inst[module_id] == NULL) {
nr_ue_if_module_inst[module_id]->phy_config_request = f;
}else{
return -1;
}
return 0;
}
int8_t nr_ue_if_module_register_scheduled_response(uint32_t module_id, nr_ue_scheduled_response_f *f){
if (nr_ue_if_module_inst[module_id] == NULL) {
nr_ue_if_module_inst[module_id]->scheduled_response = f;
}else{
return -1;
}
return 0;
}
int8_t nr_ue_if_module_kill(uint32_t module_id) { int8_t nr_ue_if_module_kill(uint32_t module_id) {
if (nr_ue_if_module_inst[module_id] != NULL){ if (nr_ue_if_module_inst[module_id] != NULL){
......
...@@ -91,7 +91,7 @@ typedef struct { ...@@ -91,7 +91,7 @@ typedef struct {
/// NR UE FAPI-like P5 message /// NR UE FAPI-like P5 message
/// physical layer configuration request structure /// physical layer configuration request structure
fapi_nr_config_request_t *config_req; fapi_nr_config_request_t config_req;
} nr_phy_config_t; } nr_phy_config_t;
...@@ -127,7 +127,7 @@ typedef int8_t(nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info); ...@@ -127,7 +127,7 @@ typedef int8_t(nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info);
// TODO check this stuff can be reuse of need modification // TODO check this stuff can be reuse of need modification
typedef struct IF_Module_s { typedef struct nr_ue_if_module_s {
nr_ue_scheduled_response_f *scheduled_response; nr_ue_scheduled_response_f *scheduled_response;
nr_ue_phy_config_request_f *phy_config_request; nr_ue_phy_config_request_f *phy_config_request;
nr_ue_dl_indication_f *dl_indication; nr_ue_dl_indication_f *dl_indication;
...@@ -154,21 +154,6 @@ int8_t nr_ue_if_module_kill(uint32_t module_id); ...@@ -154,21 +154,6 @@ int8_t nr_ue_if_module_kill(uint32_t module_id);
int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info); int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info);
/**\brief register dl_indication into certain if_module_inst by module_id
\param f function pointer to dl_indication*/
int8_t nr_ue_if_module_register_dl_indication(uint32_t module_id, nr_ue_dl_indication_f *f);
/**\brief register phy_config_request into certain if_module_inst by module_id
\param f function pointer to phy_config_request*/
int8_t nr_ue_if_module_register_phy_config_request(uint32_t module_id, nr_ue_phy_config_request_f *f);
/**\brief register scheduled_response into certain if_module_inst by module_id
\param f function pointer to scheduled_response*/
int8_t nr_ue_if_module_register_scheduled_response(uint32_t module_id, nr_ue_scheduled_response_f *f);
/**\brief handle BCCH-BCH message from dl_indication /**\brief handle BCCH-BCH message from dl_indication
\param pdu_len length(bytes) of pdu \param pdu_len length(bytes) of pdu
\param pduP pointer to pdu*/ \param pduP pointer to pdu*/
......
...@@ -38,7 +38,6 @@ nr_mac_rrc_data_ind_ue( ...@@ -38,7 +38,6 @@ nr_mac_rrc_data_ind_ue(
const module_id_t module_id, const module_id_t module_id,
const int CC_id, const int CC_id,
const uint8_t gNB_index, const uint8_t gNB_index,
const uint32_t* frameP,
const channel_t channel, const channel_t channel,
const uint8_t* pduP, const uint8_t* pduP,
const sdu_size_t pdu_len){ const sdu_size_t pdu_len){
......
...@@ -97,11 +97,10 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui ...@@ -97,11 +97,10 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui
\param module_id module id \param module_id module id
\param CC_id component carrier id \param CC_id component carrier id
\param gNB_index gNB index \param gNB_index gNB index
\param frameP pointer to frame for calculation
\param channel indicator for channel of the pdu \param channel indicator for channel of the pdu
\param pduP pointer to pdu \param pduP pointer to pdu
\param pdu_len data length of pdu*/ \param pdu_len data length of pdu*/
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const uint32_t *frameP, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len); int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len);
/** @}*/ /** @}*/
#endif #endif
\ No newline at end of file
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