Commit 1dc1db41 authored by Nick Ho's avatar Nick Ho

Schedule functions complete (UL/DL/SI/RA)

parent 0b90e899
......@@ -53,7 +53,7 @@ int extend_alpha_offset[num_flags] = {10, 10};
int uss_space = 320;
int uss_alpha_offset = 10;
void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe, uint32_t *scheduler_flags, uint32_t *common_flags){
void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe, int *scheduler_flags, int *common_flags){
uint32_t subframe = abs_subframe % 10;
uint32_t frame = abs_subframe / 10;
int i;
......@@ -97,13 +97,14 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe){
// eNB_MAC_INST_NB_IoT *eNB = &eNB_mac_inst_NB_IoT[module_id];
int i, max_subframe, scheduler_flags, common_flags,MIB_flag,SIB1_flag;
int a = 0;
/*Check this subframe should schedule something, set the flag*/
scheduler_flags = 0;
common_flags = 0;
MIB_flag = 0;
SIB1_flag = 0;
int h,f,sf;
int a;
uint32_t h,f,sf;
//int a;
//DEBUG("--------------[%04d][eNB scheduler NB-IoT] Start Scheduling------------\n", mac_inst->current_subframe);
eNB_scheduler_computing_flag_NB_IoT(mac_inst, abs_subframe, &scheduler_flags, &common_flags);
/*Update the available resource list to current state*/
......@@ -123,7 +124,7 @@ void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t ab
maintain_available_resource(mac_inst);
static int test=2;
//static int test=2;
if((abs_subframe % rachperiod[4]) == rachstart[0]){
add_UL_Resource();
......@@ -173,7 +174,7 @@ void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t ab
void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, uint32_t subframe, uint32_t frame, uint32_t hypersfn, int index_ss)
{
int32_t i;
//int32_t i;
//SCHEDULE_NB_IoT_t *scheduler = &eNB->scheduler;
mac_inst->scheduling_flag.flag_uss[0]=1;
mac_inst->scheduling_flag.flag_uss[1]=0;
......@@ -219,7 +220,7 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
break;
//Uplink Scheduling
case 0:
DEBUG("uss uplink scheduling.. \n");
printf("uss uplink scheduling.. \n");
schedule_UL_NB_IoT(mac_inst, UE_template_temp, subframe, frame, hypersfn);
break;
case -1:
......
......@@ -33,18 +33,18 @@
#include "proto_NB_IoT.h"
#include "extern_NB_IoT.h"
char str1[] = "rar_dci";
char str2[] = "rar";
char str3[] = "msg4_dci";
char str4[] = "msg4";
char str5[] = "ack_msg4";
char str6[] = "msg3_dci(retransmit)";
char str7[] = "msg3(retransmit)";
char str8[] = "msg4_dci(retransmit)";
char str9[] = "msg4(retransmit)";
char str10[] = "ack_msg4(retransmit)";
char str11[] = "msg3";
char str12[] = "msg3(retransmit)";
unsigned char str1[] = "rar_dci";
unsigned char str2[] = "rar";
unsigned char str3[] = "msg4_dci";
unsigned char str4[] = "msg4";
unsigned char str5[] = "ack_msg4";
unsigned char str6[] = "msg3_dci(retransmit)";
unsigned char str7[] = "msg3(retransmit)";
unsigned char str8[] = "msg4_dci(retransmit)";
unsigned char str9[] = "msg4(retransmit)";
unsigned char str10[] = "ack_msg4(retransmit)";
unsigned char str11[] = "msg3";
unsigned char str12[] = "msg3(retransmit)";
// 7bytes
void fill_rar_NB_IoT(
......@@ -58,9 +58,9 @@ void fill_rar_NB_IoT(
{
uint8_t *dlsch_buffer = &ra_template->rar_buffer[0];
RA_HEADER_RAPID_NB_IoT *rarh = (RA_HEADER_RAPID_NB_IoT *)dlsch_buffer;
int i,ra_idx = -1;
uint16_t rballoc;
uint8_t mcs,TPC,ULdelay,cqireq;
int i;
//uint16_t rballoc;
//uint8_t mcs,TPC,ULdelay,cqireq;
for(i=0; i<7; ++i){
dlsch_buffer[i] = 0x0;
......@@ -101,17 +101,17 @@ void schedule_msg3_retransimission_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst){
RA_TEMPLATE_NB_IoT *msg3_nodes = mac_inst->RA_msg3_list.head;
available_resource_DL_t *dci_node, *msg3_node;
available_resource_DL_t *dci_node;
int rmax, fail, res, r;
int dci_subframe, dci_end_subframe, dci_first_subframe, num_dci_subframe;
int msg3_subframe, msg3_end_subframe;
int msg3_subframe;
int dci_candidate, num_candidate;
int msg3_scheduling_delay;
schedule_result_t *dci_result;//, *msg3_result;
int rep=1;
sched_temp_UL_NB_IoT_t npusch_info;
//sched_temp_UL_NB_IoT_t npusch_info;
while((RA_TEMPLATE_NB_IoT *)0 != msg3_nodes){
if(msg3_nodes->wait_msg3_ack == 0){
......@@ -225,16 +225,16 @@ void schedule_msg3_retransimission_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst){
void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst){
RA_TEMPLATE_NB_IoT *msg2_nodes = mac_inst->RA_msg2_list.head;
RA_TEMPLATE_NB_IoT *msg3_list_tail = mac_inst->RA_msg3_list.tail;
//RA_TEMPLATE_NB_IoT *msg3_list_tail = mac_inst->RA_msg3_list.tail;
RA_TEMPLATE_NB_IoT *migrate_node;
schedule_result_t *dci_result, *msg2_result;
DCIFormatN0_t *dci_n0;
DCIFormatN1_t *dci_n1_rar;
available_resource_DL_t *dci_node, *msg2_node, *msg3_node;
available_resource_DL_t *dci_node, *msg2_node;
int rmax, fail, r, res;
int dci_subframe, dci_end_subframe, dci_first_subframe, num_dci_subframe;
int msg2_subframe, msg2_end_subframe, msg2_first_subframe, num_msg2_subframe;
int msg3_subframe, msg3_end_subframe;
int msg3_subframe;
int dci_candidate, i, num_candidate;
int msg2_i_delay;
......@@ -444,7 +444,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst){
// msg4 scheduling: both first time or retransmit would be scheduled in this function(msg4_list).
void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst){
RA_TEMPLATE_NB_IoT *msg4_nodes = mac_inst->RA_msg4_list.head, *migrate_node;
RA_TEMPLATE_NB_IoT *msg4_nodes = mac_inst->RA_msg4_list.head;
available_resource_DL_t *dci_node, *msg4_node;
int rmax, fail, r;
......
......@@ -4,7 +4,7 @@
#include "proto_NB_IoT.h"
#include "extern_NB_IoT.h"
char str[6][7] = { "SIBs_1", "SIBs_2", "SIBs_3", "SIBs_4", "SIBs_5", "SIBs_6" };
unsigned char str[6][7] = { "SIBs_1", "SIBs_2", "SIBs_3", "SIBs_4", "SIBs_5", "SIBs_6" };
void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start_subframe1){
......
......@@ -46,7 +46,7 @@ void schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE
//DCI N1
DCIFormatN1_t *DCI_N1 = (DCIFormatN1_t*)malloc(sizeof(DCIFormatN1_t));
//RLC Status
mac_rlc_status_resp_NB_IoT_t rlc_status;
//mac_rlc_status_resp_NB_IoT_t rlc_status;
/*Index in DCI_N1*/
uint32_t I_mcs, I_tbs, I_delay, I_sf;
/*value for corresponding index*/
......@@ -60,13 +60,13 @@ void schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE
int HARQ_delay=0;
uint32_t data_size;
uint32_t mac_sdu_size;
//uint32_t mac_sdu_size;
uint8_t sdu_temp[SCH_PAYLOAD_SIZE_MAX_NB_IoT];
//uint8_t sdu_temp[SCH_PAYLOAD_SIZE_MAX_NB_IoT];
logical_chan_id_t logical_channel;
uint32_t subheader_length=2;
uint32_t payload_offset;
//uint32_t payload_offset;
uint32_t search_space_end_sf, h_temp, f_temp, sf_temp;
......@@ -217,7 +217,7 @@ void schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE
//DEBUG("[%04d][DLSchedulerUSS] finish generate scheduling result\n");
//matain DL avialable resource
maintain_resource_DL(mac_inst, NPDCCH_info, NPDSCH_info);
available_resource_DL_t *temp=available_resource_DL;
//available_resource_DL_t *temp=available_resource_DL;
/*
while(temp!=NULL)
{
......@@ -409,7 +409,7 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
mac_header->F2=0;
mac_header->R=0;
offset++;
DEBUG("last sdu\n");
printf("last sdu\n");
}
else
{
......@@ -639,8 +639,8 @@ void maintain_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, sched_temp_DL_NB_IoT_t
uint8_t flag_same=0;
int align_left;
int align_right;
int H_temp, f_temp, sf_temp;
int H_temp_r, f_temp_r, sf_temp_r;
uint32_t H_temp, f_temp, sf_temp;
uint32_t H_temp_r, f_temp_r, sf_temp_r;
if(NPDSCH_info==NULL)
{
......@@ -861,4 +861,5 @@ uint8_t get_index_Rep_dl(uint16_t R)
}
printf("[get_index_Rep] error\n");
}
return -1;
}
\ No newline at end of file
......@@ -13,8 +13,8 @@
#include "extern_NB_IoT.h"
char str20[] = "DCI_uss";
char str21[] = "DATA_uss";
unsigned char str20[] = "DCI_uss";
unsigned char str21[] = "DATA_uss";
// scheduling UL
int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info,uint32_t subframe, uint32_t frame, uint32_t H_SFN){
......@@ -37,7 +37,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
DCIFormatN0_t *DCI_N0 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t));
available_resource_DL_t *node;
//available_resource_DL_t *node;
// setting of the NDI
if(UE_info->HARQ_round == 0)
......@@ -269,7 +269,7 @@ int multi_tone_ru_allocation(uint32_t uplink_time, int total_ru, sched_temp_UL_N
int Check_UL_resource(uint32_t uplink_time, int total_ru, sched_temp_UL_NB_IoT_t *NPUSCH_info, int multi_tone, int fmt2_flag)
{
int i, result =-1;
int result =-1;
if(fmt2_flag ==0)
{
if(multi_tone == 1)
......
......@@ -221,7 +221,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
}
int l2_init_eNB_NB_IoT()
int l2_init_eNB_NB_IoT(void)
{
LOG_I(MAC,"[MAIN] Mapping L2 IF-Module functions\n");
IF_Module_init_L2();
......
......@@ -37,9 +37,11 @@
* @{
*/
int l2_init_eNB_NB_IoT(void);
// main schedule functions
void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe, uint32_t *scheduler_flags, uint32_t *common_flags);
void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe, int *scheduler_flags, int *common_flags);
/*function description:
* top level of the scheduler, this will trigger in every subframe,
......@@ -104,7 +106,7 @@ void rrc_mac_config_req_NB_IoT(rrc_config_NB_IoT_t *mac_config,
void fill_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, available_resource_DL_t *node, int start_subframe, int end_subframe, schedule_result_t *new_node);
available_resource_DL_t *check_sibs_resource(eNB_MAC_INST_NB_IoT *mac_inst, int check_start_subframe, int check_end_subframe, int num_subframe, int *residual_subframe, int *out_last_subframe, int *out_first_subframe);
available_resource_DL_t *check_sibs_resource(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t check_start_subframe, uint32_t check_end_subframe, uint32_t num_subframe, uint32_t *residual_subframe, uint32_t *out_last_subframe, uint32_t *out_first_subframe);
uint32_t calculate_DLSF(eNB_MAC_INST_NB_IoT *mac_inst, int abs_start_subframe, int abs_end_subframe);
......
......@@ -302,8 +302,8 @@ void fill_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, available_resource_DL_t *no
}
}
available_resource_DL_t *check_sibs_resource(eNB_MAC_INST_NB_IoT *mac_inst, int check_start_subframe, int check_end_subframe, int num_subframe, int *residual_subframe, int *out_last_subframe, int *out_first_subframe){
available_resource_DL_t *pt, *pt_free;
available_resource_DL_t *check_sibs_resource(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t check_start_subframe, uint32_t check_end_subframe, uint32_t num_subframe, uint32_t *residual_subframe, uint32_t *out_last_subframe, uint32_t *out_first_subframe){
available_resource_DL_t *pt;
uint32_t num_dlsf;
uint8_t output = 0x0;
pt = available_resource_DL;
......@@ -366,7 +366,7 @@ available_resource_DL_t *check_sibs_resource(eNB_MAC_INST_NB_IoT *mac_inst, int
uint32_t calculate_DLSF(eNB_MAC_INST_NB_IoT *mac_inst, int abs_start_subframe, int abs_end_subframe){
int i;
int num_dlsf=0;
int diff_subframe = abs_end_subframe - abs_start_subframe;
//int diff_subframe = abs_end_subframe - abs_start_subframe;
int start_frame = abs_start_subframe / 10;
int end_frame = abs_end_subframe / 10;
......
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