Commit d0b9146c authored by luis_pereira87's avatar luis_pereira87

Msg4 transmitted from MAC to RRC through ITTI (TASK_RRC_NRUE created)

parent d1c56742
...@@ -180,6 +180,23 @@ void print_difftimes(void) { ...@@ -180,6 +180,23 @@ void print_difftimes(void) {
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec); LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
} }
int create_tasks_nrue(uint32_t ue_nb) {
LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
itti_wait_ready(1);
if (ue_nb > 0) {
LOG_I(NR_RRC,"create TASK_RRC_NRUE \n");
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
}
itti_wait_ready(0);
return 0;
}
void exit_function(const char *file, const char *function, const int line, const char *s) { void exit_function(const char *file, const char *function, const int line, const char *s) {
int CC_id; int CC_id;
...@@ -561,6 +578,12 @@ int main( int argc, char **argv ) { ...@@ -561,6 +578,12 @@ int main( int argc, char **argv ) {
// wait for end of program // wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n"); printf("TYPE <CTRL-C> TO TERMINATE\n");
if (create_tasks_nrue(1) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
}
// Sleep a while before checking all parameters have been used // Sleep a while before checking all parameters have been used
// Some are used directly in external threads, asynchronously // Some are used directly in external threads, asynchronously
sleep(20); sleep(20);
......
...@@ -87,12 +87,15 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4]; ...@@ -87,12 +87,15 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4];
// dummy functions // dummy functions
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, int8_t nr_mac_rrc_data_ind_ue(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 int8_t channel, const frame_t frame,
const uint8_t* pduP, const sub_frame_t sub_frame,
const sdu_size_t pdu_len) const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len)
{ {
return 0; return 0;
} }
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "OCG_vars.h" #include "OCG_vars.h"
#include <openair2/LAYER2/MAC/mac_vars.h> #include <openair2/LAYER2/MAC/mac_vars.h>
#include <openair2/RRC/LTE/rrc_vars.h> #include <openair2/RRC/LTE/rrc_vars.h>
#include <openair2/RRC/NR_UE/rrc_defs.h>
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
...@@ -130,7 +131,18 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( ...@@ -130,7 +131,18 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
return 0; return 0;
} }
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return 0;} int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const frame_t frame,
const sub_frame_t sub_frame,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len)
{
return 0;
}
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index)
{ {
......
...@@ -82,9 +82,19 @@ double cpuf; ...@@ -82,9 +82,19 @@ double cpuf;
//uint8_t nfapi_mode = 0; //uint8_t nfapi_mode = 0;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const frame_t frame,
const sub_frame_t sub_frame,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len)
{
return 0;
}
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; }
int generate_dlsch_header(unsigned char *mac_header, int generate_dlsch_header(unsigned char *mac_header,
unsigned char num_sdus, unsigned char num_sdus,
unsigned short *sdu_lengths, unsigned short *sdu_lengths,
......
...@@ -105,7 +105,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -105,7 +105,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
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, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU
AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n");
//if(mac->mib != NULL){ //if(mac->mib != NULL){
...@@ -161,7 +161,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, ...@@ -161,7 +161,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
uint8_t *pduP, uint8_t *pduP,
uint32_t pdu_len) { uint32_t pdu_len) {
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
return 0; return 0;
} }
...@@ -1824,23 +1824,28 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, ...@@ -1824,23 +1824,28 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
// MAC CE // MAC CE
case DL_SCH_LCID_CCCH: case DL_SCH_LCID_CCCH:
// MSG4 RRC Connection Setup 38.331 // MSG4 RRC Connection Setup 38.331
// variable length // variable length
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8)
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
mac_subheader_len = 3;
} else {
mac_sdu_len = ((NR_MAC_SUBHEADER_LONG *) pduP)->L1;
mac_subheader_len = 2; mac_subheader_len = 2;
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ }
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
mac_subheader_len = 3;
}
LOG_D(NR_MAC,"DL_SCH_LCID_CCCH with payload len %d: bits\n", mac_ce_len); LOG_D(NR_MAC,"DL_SCH_LCID_CCCH with payload len %d: bits\n", mac_sdu_len);
// TODO: Forward RRCSetup to RRC
LOG_D(NR_MAC,"RRCSetup received at nr_ue_process_mac_pdu with payload len %d: \n bits, rx bytes: \n", mac_ce_len); LOG_D(NR_MAC,"RRCSetup received at nr_ue_process_mac_pdu with payload len %d: \n bits, rx bytes: \n", mac_sdu_len);
for (int i = 0; i < mac_ce_len/8; i++) { for (int i = 0; i < mac_sdu_len/8; i++) {
LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[i + 2]); LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[i + 2]);
} }
break;
nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_sdu_len);
break;
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
......
...@@ -42,17 +42,48 @@ nr_mac_rrc_data_ind_ue( ...@@ -42,17 +42,48 @@ 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 frame_t frame,
const sub_frame_t sub_frame,
const rnti_t rnti,
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){
sdu_size_t sdu_size = 0;
protocol_ctxt_t ctxt;
switch(channel){ switch(channel){
case NR_BCCH_BCH: case NR_BCCH_BCH:
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"); 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; break;
case NR_BCCH_DL_SCH: case NR_BCCH_DL_SCH:
AssertFatal( nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len, 0, 0) == 0, "UE decode BCCH-DL-SCH error!\n"); AssertFatal( nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len, 0, 0) == 0, "UE decode BCCH-DL-SCH error!\n");
break; break;
case CCCH:
if (pdu_len>0) {
LOG_T(NR_RRC,"[UE %d] Received SDU for CCCH on SRB %ld from gNB %d\n",module_id,channel & RAB_OFFSET,gNB_index);
MessageDef *message_p;
int msg_sdu_size = CCCH_SDU_SIZE;
if (pdu_len > msg_sdu_size) {
LOG_E(NR_RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = pdu_len;
}
message_p = itti_alloc_new_message (TASK_MAC_UE, 0, NR_RRC_MAC_CCCH_DATA_IND);
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = gNB_index;
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP
itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p);
}
default: default:
break; break;
} }
......
...@@ -109,7 +109,15 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui ...@@ -109,7 +109,15 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui
\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 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 frame_t frame,
const sub_frame_t sub_frame,
const rnti_t rnti,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len);
/**\brief /**\brief
\param module_id module id \param module_id 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