Commit e6c47f94 authored by Michele Paffetti's avatar Michele Paffetti

Setup of required variables for managing the SI messages transmission,...

Setup of required variables for managing the SI messages transmission, according to our Assumptions. Still to include the function for encoding, scrambling ecc.. of npdsch and npdcch for the DL path. Code compile. 141 Warnings
parent 2a68d847
......@@ -807,6 +807,16 @@ typedef struct {
// NB-IoT
//----------------------------------------------------------------------------------------------------
//enum for distinguish the different type of ndlsch (may in the future will be not needed)
typedef enum
{
SIB1,
SI_Message,
RAR,
UE_Data
}ndlsch_flag_t;
typedef struct {
......@@ -841,10 +851,9 @@ typedef struct {
/// NB-IoT
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
/// The number of the subframe to transmit the NPDSCH TB TS 36.213 Table 16.4.1.3-1 (Nsf
/// FAPI spec P.181 for the NPDSCH containing BCCH value 1-8, while 36.331 P.190 value only 2 & 8
/// The number of the subframe to transmit the NPDSCH Table TS 36.213 Table 16.4.1.3-1 (Nsf) (NB. in this case is not the index Isf)
uint8_t resource_assignment;
/// Determined the repeat number of NPDSCH TB TS 36.213 Table 16.4.1.3-2 (Nrep)
/// is the index that determined the repeat number of NPDSCH through table TS 36.213 Table 16.4.1.3-2 / for SIB1-NB Table 16.4.1.3-3
uint8_t repetition_number;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
......@@ -891,8 +900,6 @@ typedef struct {
uint8_t nCCE[10];
/*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
/// The only HARQ process for the DLSCH
NB_IoT_DL_eNB_HARQ_t *harq_process;
/// Number of soft channel bits
......@@ -912,15 +919,22 @@ typedef struct {
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
/*
* This indicate the current subframe within the subframe interval between the NPDSCH transmission (Nsf*Nrep)
*/
//This indicate the current subframe within the subframe interval between the NPDSCH transmission (Nsf*Nrep)
uint16_t sf_index;
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDSCH transmission
/// see FAPI/NFAPI specs Table 4-47
uint8_t npdsch_start_symbol;
/*SIB1-NB related parameters*/
///flag for indicate if the current frame is the start of a new SIB1-NB repetition within the SIB1-NB period (0 = FALSE, 1 = TRUE)
uint8_t sib1_rep_start;
///the number of the frame within the 16 continuous frame in which sib1-NB is transmitted (1-8 = 1st, 2nd ecc..) (0 = not foresees a transmission)
uint8_t relative_sib1_frame;
//Flag used to discern among different NDLSCH structures (SIB1,SI,RA,UE-spec)
//(in this case is used because we may have that more that one calls of npdch_procedure is needed for transmitting a data (NB-IoT implement repetitions)
ndlsch_flag_t ndlsch_type;
} NB_IoT_eNB_NDLSCH_t;
......@@ -1036,6 +1050,9 @@ typedef struct {
#define NPBCH_A 34
typedef struct {
//the 2 LSB of the hsfn (the MSB are indicated by the SIB1-NB)
uint16_t h_sfn_lsb;
uint8_t npbch_d[96+(3*(16+NPBCH_A))];
uint8_t npbch_w[3*3*(16+NPBCH_A)];
uint8_t npbch_e[1600];
......
......@@ -68,7 +68,7 @@ void ccode_encode_npdsch_NB_IoT (int32_t numbits,
int dlsch_encoding_NB_IoT(unsigned char *a,
NB_IoT_eNB_DLSCH_t *dlsch,
uint8_t Nsf, // number of subframes required for npdsch pdu transmission calculated from Isf (3GPP spec table)
unsigned int G; // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
unsigned int G, // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats)
......
......@@ -22,38 +22,47 @@ void handle_nfapi_dlsch_pdu_NB(PHY_VARS_eNB *eNB,
//Check for SI PDU since in NB-IoT there is no DCI for that
//SIB1 (type 0), other DLSCH data (type 1) (include the SI messages) based on our ASSUMPTIONs
//is SIB1-NB
if(rel13->rnti_type == 0 && rel13->rnti == 65535)
{
/*
* the configuration of the NDLSCH PDU for the SIB1-NB shoudl be the following:
* RNTI type = 0;
* RNTI = OxFFFF (65535)
* Repetition number = 0-15 and should be mapped to 4,8,16 as reported in Table 16.4.1.3-3 TS 36.213
* Number of subframe for resource assignment = may is not neded to know since the scheduling is fixed
* -RNTI type = 0; (BCCH)
* -RNTI = OxFFFF (65535)
* -Repetition number = 0-15 and should be mapped to 4,8,16 as reported in Table 16.4.1.3-3 TS 36.213 (is the schedulingInoSIB1 of the MIB)
* -Number of subframe for resource assignment = may is not neded to know since the scheduling is fixed
* (Spec TS 36.331 "SIB1-NB transmission occur in subframe #4 of every other frame in 16 continuous frame"
* meaning that from the starting point we should transmit the SIB1-NB in 8 subframes among the 16 available (every other))
*
* From spec. TS 36.321 v14.2.o pag 31 --> there is an HARQ process for all the broadcast
* From spec. TS 36.321 v14.2.o pag 31 --> there is an HARQ process for all the broadcast (so we consider it also for SIB1-NB)
*
*/
ndlsch= eNB->ndlsch_SIB1;
ndlsch->ndlsch_type = SIB1;
ndlsch->npdsch_start_symbol = rel13->start_symbol; //start symbol for the ndlsch transmission
ndlsch_harq = ndlsch->harq_process;
ndlsch_harq->pdu = sdu;
//should be from 1 to 8
ndlsch_harq->resource_assignment = rel13->number_of_subframes_for_resource_assignment;
ndlsch_harq->repetition_number = rel13->repetition_number; //is the schedulingInfoSIB1 of MMIB that is mapped into value 4-8-16 (see NDLSCH fapi specs Table 4-47)
ndlsch_harq->resource_assignment = rel13->number_of_subframes_for_resource_assignment;//maybe we don't care about it since a fixed schedule
ndlsch_harq->repetition_number = rel13->repetition_number; //is the schedulingInfoSIB1 (value 1-15) of MIB that is mapped into value 4-8-16 (see NDLSCH fapi specs Table 4-47)
ndlsch_harq->modulation = rel13->modulation;
ndlsch_harq->status = ACTIVE;
//SI information in reality have no feedback (so there is no retransmission from the HARQ view point since no sck and nack)
//SI information in reality have no feedback (so there is no retransmission from the HARQ view point since no ack and nack)
// ndlsch_harq->frame = frame;
// ndlsch_harq->subframe = subframe;
ndlsch->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue;
ndlsch->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit;
}
//This are System Information (SI message)
//is SI message (this is an NDLSCH that will be transmitted very frequently)
else if(rel13->rnti_type == 1 && rel13->rnti == 65535)
{
/*
......@@ -62,38 +71,45 @@ void handle_nfapi_dlsch_pdu_NB(PHY_VARS_eNB *eNB,
* RNTI type = 1;
* RNTI = OxFFFF (65535)
* Repetition number = 0 and should be mapped to 1 through Table 16.4.1.3-2 TS 36.213
* Number of subframe for resource assignment = will be evaluated by the MAC based on the value of the "si-TB" field inside the SIB1-NB
* Number of subframe for resource assignment = will be evaluated by the MAC based on the value of the "si-TB" field inside the SIB1-NB (value 2 or 8)
*
* From spec. TS 36.321 v14.2.o pag 31 --> there is an HARQ process for all the broadcast
*
*
*/
ndlsch= eNB->ndlsch_SI;
ndlsch->npdsch_start_symbol = rel13->start_symbol; //start symbol for the ndlsch transmission
ndlsch->ndlsch_type = SI_Message;
ndlsch->npdsch_start_symbol = rel13->start_symbol; //start OFDM symbol for the ndlsch transmission
ndlsch_harq = ndlsch->harq_process;
if(sdu != NULL) //new SI starting transmission
ndlsch_harq->pdu = sdu;
else //this indicate me to continue the transmission of the previous one
//new SI starting transmission
if(sdu != NULL)
{
//the major fact is that i should be aware when the SI should be transmitted since the PHY layer have no logic for this
ndlsch_harq->pdu = sdu;
ndlsch_harq->resource_assignment = rel13->number_of_subframes_for_resource_assignment;//value 2 or 8
ndlsch_harq->repetition_number = rel13->repetition_number;//should be always fix to 0 to be mapped in 1
ndlsch_harq->modulation = rel13->modulation;
ndlsch_harq->status = ACTIVE;
//SI information in reality have no feedback (so there is no retransmission from the HARQ view point since no sck and nack)
// ndlsch_harq->frame = frame;
// ndlsch_harq->subframe = subframe;
ndlsch->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue;
ndlsch->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit;
}
//continue the remaining transmission of the previous SI at PHY if any (otherwise nothing)
else
{
ndlsch_harq->pdu = NULL;
//there is no need of repeating the configuration on the ndlsch
//should be from 1 to 8
ndlsch_harq->resource_assignment = rel13->number_of_subframes_for_resource_assignment;
ndlsch_harq->repetition_number = rel13->repetition_number;
ndlsch_harq->modulation = rel13->modulation;
ndlsch_harq->status = ACTIVE;
//SI information in reality have no feedback (so there is no retransmission from the HARQ view point since no sck and nack)
// ndlsch_harq->frame = frame;
// ndlsch_harq->subframe = subframe;
ndlsch->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue;
ndlsch->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit;
}
}
//ue specific data or RAR
//ue specific data or RAR (we already have received the DCI for this)
else if(rel13->rnti != 65535 && rel13->rnti_type == 1)
{
......@@ -203,14 +219,18 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
// for the moment we don't care about the n-bch pdu content since we need only the sdu if tx.request
npbch = eNB->npbch; //in the main of the lte-softmodem they should allocate this memory of phy vars
npbch = eNB->npbch; //in the main of the lte-softmodem they should allocate this memory of PHY_vars
npbch->h_sfn_lsb = dl_config_pdu->nbch_pdu.nbch_pdu_rel13.hyper_sfn_2_lsbs;
if(Sched_INFO->sdu[i] != NULL)
npbch->pdu = Sched_INFO->sdu[i];
else
LOG_E(PHY, "REceived a schedule_response with N-BCH but no PDU!!\n");
LOG_E(PHY, "Received a schedule_response with N-BCH but no SDU!!\n");
break;
case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE://we can have three types of NDLSCH based on our assumptions: SIB1, SI, Data
case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
//we can have three types of NDLSCH based on our assumptions: SIB1, SI, Data
//remember that SI messages have no DCI in NB-IoT therefore this is the only way to configure the ndlsch_SI structure
handle_nfapi_dlsch_pdu_NB(eNB, proc,dl_config_pdu,Sched_INFO->sdu[i]);
......
......@@ -560,11 +560,12 @@ int npdsch_rep_to_array[3] ={4,8,16}; //TS 36.213 Table 16.4.1.3-3
int sib1_startFrame_to_array[4] = {0,16,32,48};//TS 36.213 Table 16.4.1.3-4
//New----------------------------------------------------
//return -1 whenever no SIB1-NB transmission occur.
//return sib1_startFrame when transmission occur
//return sib1_startFrame when transmission occur in the current frame
uint32_t is_SIB1_NB(
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId //by configuration
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId, //by configuration
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
)
{
uint8_t nb_rep=0; // number of sib1-nb repetitions within the 256 radio frames
......@@ -584,20 +585,29 @@ uint32_t is_SIB1_NB(
* schedule with a periodicity of 2560 ms (256 Radio Frames) and repetitions (4, 8 or 16) are made, equally spaced
* within the 2560 ms period
*
*
* 0)find the SIB1-NB period over the 1024 frames in which the actual frame fall
* 0.0) check the input parameters
* 0)find the SIB1-NB period number over the 1024 frames in which the actual frame fall
* 1)from the schedulingInfoSIB1 of MIB-NB and the physCell_id we deduce the starting radio frame
* 2)check if the actual frame is after the staring radio frame
* 3)check if the actual frame is within a SIB1-transmission interval
* 4)based on the starting radio frame we can state when SIB1-NB is transmitted in odd or even frame
* 4)based on the starting radio frame we can state when SIB1-NB is transmitted in odd or even frame (commented)
* (if the starting frame is even (0,16,32,48) then SIB1-NB is transmitted in even frames, if starting frame is odd (1)
* we can state that SIB1-NB will be transmitted in every odd frame since repetitions are 16 in 256 radio frame period)
* 4bis) we do a for loop over the 16 continuous frame (hopping by 2) for check if the frame is considered in that interval
*
* *0) is necessary because at least i need to know in which of the even frames the repetition are -> is based on the offset
* *in 1023 frames there are exactly 4 period of SIB1-NB
**/
if(schedulingInfoSIB1 > 11 || schedulingInfoSIB1 < 0){
LOG_E(RRC, "is_SIB1_NB: schedulingInfoSIB1 value not allowed");
return 0;
}
//SIB1-NB period number
period_nb = (int) frameP/sib1_NB_period;
......@@ -646,35 +656,126 @@ uint32_t is_SIB1_NB(
//loop over the SIB1-NB period
for( int i = 0; i < nb_rep; i++)
{
//find the correct sib1-nb repetition interval in which the actual frame is
//this is the start frame of a repetition
index = sib1_startFrame+ i*(16+offset) + period_nb*256;
if(frameP>= index && frameP <= (index+15)) //SIB1_NB transmission interval
//the actual frame is in a gap between two consecutive repetitions
if(frameP < index)
{
ndlsch_SIB1->sib1_rep_start = 0;
ndlsch_SIB1->relative_sib1_frame = 0;
return -1;
}
//this is needed for ndlsch_procedure
else if(frameP == index)
{
//the actual frame is the start of a new repetition (SIB1-NB should be retransmitted)
ndlsch_SIB1->sib1_rep_start = 1;
ndlsch_SIB1->relative_sib1_frame = 1;
return sib1_startFrame;
}
else
ndlsch_SIB1->sib1_rep_start = 0;
//check in the current SIB1_NB repetition
if(frameP>= index && frameP <= (index+15))
{
//find if the actual frame is one of the "every other frame in 16 continuous frame" in which SIB1-NB is transmitted
if(sib1_startFrame%2 != 0){ // means that the starting frame was 1 --> sib1-NB is transmitted in every odd frame
if(frameP%2 == 1){
for(int y = 0; y < 16; y += 2) //every other frame (increment by 2)
{
if(frameP == index + y)
{
//this flag tell which is the number of the current frame w.r.t the 8th (over the continuous 16) in a repetition
ndlsch_SIB1->relative_sib1_frame = y/2 + 1; //1st, 2nd, 3rd,...
return sib1_startFrame;
}
}
}
//in all other starting frame cases SIB1-NB is transmitted in the even frames inside the corresponding repetition interval
if(frameP%2 == 0){ // SIB1-NB is transmitted
return sib1_startFrame;
}
//if we are here means that the frame was inside the repetition interval but not considered for SIB1-NB transmission
ndlsch_SIB1->relative_sib1_frame = 0;
return -1;
//XXX this part has been commented because in case that the "relative_sib1_frame" flag is not needed is necessary just a simple check if even or odd frame depending on sib1_startFrame
// if(sib1_startFrame%2 != 0){ // means that the starting frame was 1 --> sib1-NB is transmitted in every odd frame
// if(frameP%2 == 1){ //the actual frame is odd
// return sib1_startFrame;
// }
// }
//
// //in all other starting frame cases SIB1-NB is transmitted in the even frames inside the corresponding repetition interval
// if(frameP%2 == 0){ // SIB1-NB is transmitted
// return sib1_startFrame;
// }
//---------------------------------------------------------------------------------------------------------------------------------------------------------
}
if(index> frameP) // was not inside an interval of 16 radio frames for sib1-nb transmission
return -1;
}
return -1;
}
//New----------------------------------------------------
//Function for check if the current frame is the start of a new SIB1-NB period
uint8_t is_SIB1_NB_start(
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId //by configuration
)
{
uint8_t nb_rep=0; // number of sib1-nb repetitions within the 256 radio frames
uint32_t sib1_startFrame;
uint32_t sib1_NB_period = 256;//from specs TS 36.331 (rf)
uint8_t index;
int offset;
int period_nb; // the number of the actual period over the 1024 frames
if(schedulingInfoSIB1 > 11 || schedulingInfoSIB1 < 0){
LOG_E(RRC, "is_SIB1_NB: schedulingInfoSIB1 value not allowed");
return 0;
}
//number of repetitions
nb_rep = npdsch_rep_to_array[schedulingInfoSIB1%3];
//based on number of rep. and the physical cell id we derive the starting radio frame (TS 36.213 Table 16.4.1.3-3/4)
switch(nb_rep)
{
case 4:
//physCellId%4 possible value are 0,1,2,3
sib1_startFrame = sib1_startFrame_to_array[physCellId%4];
break;
case 8:
//physCellId%2possible value are 0,1
sib1_startFrame = sib1_startFrame_to_array[physCellId%2];
break;
case 16:
//physCellId%2 possible value are 0,1
if(physCellId%2 == 0)
sib1_startFrame = 0;
else
sib1_startFrame = 1; // the only case in which the starting frame is odd
break;
default:
LOG_E(RRC, "Number of repetitions %d not allowed", nb_rep);
return -1;
}
if((frameP-sib1_startFrame)%256 == 0)
return 0;
else
return -1;
}
//-------------------------------------------------------
//---------------------------------------------------------------------------
//New
int si_windowLength_to_rf[7]={16,32,48,64,96,128,160}; //TS 36.331 v14.2.1 pag 587
......@@ -901,8 +1002,10 @@ int8_t NB_mac_rrc_data_req_eNB(
}
//sib1-NB scheduled in subframe #4
if(subframeP == 4 && is_SIB1_NB(frameP,schedulingInfoSIB1, physCellId)!= -1){
///XXX Following FAPI implementation in principle we should only take care of get the PDU from the MAC only when the SIB1-NB period Start
//sib1-NB scheduled in subframe #4
if(subframeP == 4 && is_SIB1_NB_start(frameP,schedulingInfoSIB1, physCellId)!= -1){
memcpy(&buffer_pP[0],
eNB_rrc_inst_NB[Mod_idP].carrier[CC_id].SIB1_NB,
......
......@@ -98,15 +98,30 @@ int NB_rrc_mac_config_req_eNB(
//New
/**\brief function for evaluate if the SIB1-NB transmission occur
* called by the NB_mac_rrc_data_req
* return the SIB1 starting frame
* called by phy_procedure_eNB_Tx before calling the npdsch_procedure
*/
uint32_t is_SIB1_NB(
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId, //by configuration
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
);
//--------------------------------------
//New
/**\brief function for evaluate if the SIB1-NB period start
* return 0 = TRUE
* return -1 = FALSE
* called by the NB_mac_rrc_data_req
*/
uint8_t is_SIB1_NB_start(
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId //by configuration
);
//New
/**\brief function for evaluate if the SIB23-NB transmission occurr
* called by the NB_mac_rrc_data_req
......
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