Cleanup code, comments

This commit is contained in:
cig
2020-02-10 20:02:16 +01:00
parent 98480e7102
commit 7e25d85f5c
15 changed files with 45 additions and 187 deletions
-10
View File
@@ -137,16 +137,6 @@ typedef struct {
uint8_t R2:6;
} __attribute__ ((__packed__)) NR_SINGLE_ENTRY_PHR_MAC_CE;
// /*! \brief CCCH payload */ // TBR
// typedef struct {
// uint8_t payload[CCCH_PAYLOAD_SIZE_MAX];
// } __attribute__ ((__packed__)) CCCH_PDU;
//
// /*! \brief RAR payload */ // TBR
// typedef struct {
// uint8_t payload[RAR_PAYLOAD_SIZE_MAX];
// } __attribute__ ((__packed__)) RAR_PDU;
//* RAR MAC subheader // TS 38.321 ch. 6.1.5, 6.2.2 *//
// - E: The Extension field is a flag indicating if the MAC subPDU including this MAC subheader is the last MAC subPDU or not in the MAC PDU
// - T: The Type field is a flag indicating whether the MAC subheader contains a Random Access Preamble ID or a Backoff Indicator (0, BI) (1, RAPID)
@@ -32,7 +32,6 @@
#ifndef __NR_MAC_EXTERN_H__
#define __NR_MAC_EXTERN_H__
#include "RRC/LTE/rrc_defs.h" // TBR
#include "common/ran_context.h"
#include "nr_mac.h"
+5 -5
View File
@@ -48,7 +48,7 @@
/* MAC */
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "LAYER2/MAC/mac.h" // TBR
#include "LAYER2/MAC/mac.h"
/* RRC */
#include "NR_DRX-Config.h"
@@ -116,15 +116,15 @@ typedef struct {
/* Random Access parameters */
/// state of RA procedure
RA_state_t ra_state; // TBR
RA_state_t ra_state;
/// RACH ConfigCommon
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon;
/// RA-rnti
uint16_t ra_rnti; // TBR
uint16_t ra_rnti;
/// Temporary CRNTI
uint16_t t_crnti; // TBR
uint16_t t_crnti;
/// CRNTI
uint16_t crnti; // TBR
uint16_t crnti;
/// number of attempt for rach
uint8_t RA_attempt_number;
/// Random-access procedure flag
+5 -3
View File
@@ -29,12 +29,14 @@
*/
#include "PHY/defs_common.h" // TBR
#include "PHY/defs_nr_common.h"
#include "mac_defs.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
// WIP todo:
//- frame_type and fr are hardcoded. Retireve from fp
/* TS 38.321 subclause 7.3 - return DELTA_PREAMBLE values in dB */
int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id){
@@ -44,8 +46,8 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id){
AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
uint8_t preambleFormat, prachConfigIndex;
lte_frame_type_t frame_type = TDD; // TODO TBR retrieve frame type. Currently hardcoded to TDD.
nr_frequency_range_e fr = nr_FR1; // TODO TBR retrieve frame type. Currently hardcoded to FR1.
lte_frame_type_t frame_type = TDD;
nr_frequency_range_e fr = nr_FR1;
int mu;
// SCS configuration from msg1_SubcarrierSpacing and table 4.2-1 in TS 38.211
+1 -1
View File
@@ -295,7 +295,7 @@ void nr_get_prach_resources(module_id_t mod_id,
LOG_D(MAC, "Computed ra_RNTI is %d", prach_resources->ra_RNTI);
}
// todo: RA_attempt_number not used TBR
// TbD: RA_attempt_number not used
void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id){
AssertFatal(CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
@@ -114,7 +114,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac,fapi_nr_dl_config_request_t *dl_
if (mac->ra_state == WAIT_RAR) {
// check for RAR
rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
rel15->rnti = 2;//get_RA_RNTI(mac,frame,slot); // TBR
rel15->rnti = 2;//get_RA_RNTI(mac,frame,slot); // WIP
dl_config->number_pdus = dl_config->number_pdus + 1;
}
else if (mac->ra_state == WAIT_CONTENTION_RESOLUTION) {
@@ -44,9 +44,6 @@
#include "NR_MAC_UE/mac_extern.h"
#include "common/utils/nr/nr_common.h"
//#include "LAYER2/MAC/mac_vars.h" // TBR Note that mac_vars.h is not NR specific and this should be updated
// also, the use of the same should be updated in nr-softmodem and nr-uesoftmodem
/* PHY UE */
#include "SCHED_NR_UE/defs.h"
#include "PHY/defs_nr_UE.h"
+2 -2
View File
@@ -365,10 +365,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
schedule_nr_mib(module_idP, frame_txP, slot_txP);
}
// TBR once RACH is available, start ta_timer when UE is connected
// TbD once RACH is available, start ta_timer when UE is connected
if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--;
if (ue_sched_ctl->ta_timer == 0) { // TBR check phy_test (see below)
if (ue_sched_ctl->ta_timer == 0) {
gNB->ta_command = ue_sched_ctl->ta_update;
/* if time is up, then set the timer to not send it for 5 frames
// regardless of the TA value */
@@ -164,7 +164,9 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
}
// WIP
// todo: fix
// todo:
// - fix me
// - get msg3 alloc (see nr_process_rar)
void nr_generate_Msg2(module_id_t module_idP,
int CC_id,
frame_t frameP,
@@ -333,7 +335,7 @@ void nr_generate_Msg2(module_id_t module_idP,
dl_req->nPDUs++;
// Program UL processing for Msg3
// nr_get_Msg3alloc(&cc[CC_id], slotP, frameP,&ra->Msg3_frame, &ra->Msg3_slot);
// nr_get_Msg3alloc(&cc[CC_id], slotP, frameP,&ra->Msg3_frame, &ra->Msg3_slot); // todo
LOG_D(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot);
nr_fill_rar(ra, cc[CC_id].RAR_pdu.payload, N_RB_UL);
nr_add_msg3(module_idP, CC_id, frameP, slotP);
@@ -1363,123 +1363,4 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP){
}
}
}
*/
/* // TBR fix this
void nr_get_Msg3alloc(NR_COMMON_channels_t *cc,
sub_frame_t current_subframe, // TBR sub_frame_t
frame_t current_frame,
frame_t *frame,
sub_frame_t *subframe){
// Fill in other TDD Configuration!!!!
// TBR missing ‘tdd_Config’ in NR_COMMON_channels_t
if (cc->tdd_Config == NULL) { // FDD
*subframe = current_subframe + 6;
if (*subframe > 9) {
*subframe = *subframe - 10;
*frame = (current_frame + 1) & 1023;
} else {
*frame = current_frame;
}
} else { // TDD
if (cc->tdd_Config->subframeAssignment == 1) {
switch (current_subframe) {
case 0:
*subframe = 7;
*frame = current_frame;
break;
case 4:
*subframe = 2;
*frame = (current_frame + 1) & 1023;
break;
case 5:
*subframe = 2;
*frame = (current_frame + 1) & 1023;
break;
case 9:
*subframe = 7;
*frame = (current_frame + 1) & 1023;
break;
}
} else if (cc->tdd_Config->subframeAssignment == 3) {
switch (current_subframe) {
case 0:
case 5:
case 6:
*subframe = 2;
*frame = (current_frame + 1) & 1023;
break;
case 7:
*subframe = 3;
*frame = (current_frame + 1) & 1023;
break;
case 8:
*subframe = 4;
*frame = (current_frame + 1) & 1023;
break;
case 9:
*subframe = 2;
*frame = (current_frame + 2) & 1023;
break;
}
} else if (cc->tdd_Config->subframeAssignment == 4) {
switch (current_subframe) {
case 0:
case 4:
case 5:
case 6:
*subframe = 2;
*frame = (current_frame + 1) & 1023;
break;
case 7:
*subframe = 3;
*frame = (current_frame + 1) & 1023;
break;
case 8:
case 9:
*subframe = 2;
*frame = (current_frame + 2) & 1023;
break;
}
} else if (cc->tdd_Config->subframeAssignment == 5) {
switch (current_subframe){
case 0:
case 4:
case 5:
case 6:
*subframe = 2;
*frame = (current_frame + 1) & 1023;
break;
case 7:
case 8:
case 9:
*subframe = 2;
*frame = (current_frame + 2) & 1023;
break;
}
}
} // else TDD
}*/
// uint16_t nr_mac_compute_RIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs){ // TBR
// uint16_t RIV;
//
// if (Lcrbs <= (1 + (N_RB_DL >> 1))) RIV = (N_RB_DL * (Lcrbs - 1)) + RBstart;
// else RIV = (N_RB_DL * (N_RB_DL + 1 - Lcrbs)) + (N_RB_DL - 1 - RBstart);
//
// return RIV;
// }
*/
-5
View File
@@ -133,11 +133,6 @@ typedef struct {
int msg4_TBsize;
/// MCS used for Msg4
int msg4_mcs;
///
int32_t crnti_rrc_mui; // TBR
///
int8_t crnti_harq_pid; // TBR
} NR_RA_t;
/*! \brief gNB common channels */
+2 -8
View File
@@ -93,10 +93,7 @@ int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_n
*/
}
int8_t handle_rar (nr_downlink_indication_t *dl_info,
uint8_t *pduP,
uint32_t pdu_len,
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment){ // TBR not used params
int8_t handle_rar (nr_downlink_indication_t *dl_info){
LOG_D(MAC, "handling RAR at MAC layer \n");
nr_process_rar (dl_info);
@@ -263,10 +260,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
break;
case FAPI_NR_RX_PDU_TYPE_RAR:
ret_mask |= (handle_rar(dl_info,
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu,
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length,
ul_time_alignment)) << FAPI_NR_RX_PDU_TYPE_RAR;
ret_mask |= (handle_rar(dl_info)) << FAPI_NR_RX_PDU_TYPE_RAR;
break;
default:
+1 -1
View File
@@ -199,7 +199,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc) {
rrc->carrier.pdsch_AntennaPorts,
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon,
0,
0, // TBR hardcoded rnti
0, // WIP hardcoded rnti
(NR_CellGroupConfig_t *)NULL
);