Commit 78bc736c authored by Xenofon Foukas's avatar Xenofon Foukas

Fixed frame-subframe numbering bug

parent 1f520630
......@@ -292,13 +292,18 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){
}
int get_current_frame (mid_t mod_id) {
unsigned int get_current_frame (mid_t mod_id) {
#warning "SFN will not be in [0-1023] when oaisim is used"
return ((eNB_MAC_INST *)enb[mod_id])->frame;
}
int get_current_subframe (mid_t mod_id) {
unsigned int get_current_system_frame_num(mid_t mod_id) {
return (get_current_frame(mod_id) %1024);
}
unsigned int get_current_subframe (mid_t mod_id) {
return ((eNB_MAC_INST *)enb[mod_id])->subframe;
......@@ -306,12 +311,16 @@ int get_current_subframe (mid_t mod_id) {
uint16_t get_sfn_sf (mid_t mod_id) {
uint16_t frame, subframe;
uint16_t sfn_sf;
frame_t frame;
sub_frame_t subframe;
uint16_t sfn_sf, frame_mask, sf_mask;
frame = (frame_t) get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) get_current_subframe(mod_id);
frame_mask = ((1<<12) - 1);
sf_mask = ((1<<4) -1);
sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4);
frame = (uint16_t) get_current_frame(mod_id);
subframe = (uint16_t) get_current_subframe(mod_id);
sfn_sf = (subframe << 12) | frame;
return sfn_sf;
}
......
......@@ -109,9 +109,15 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran);
int get_current_time_ms (mid_t mod_id, int subframe_flag);
int get_current_frame(mid_t mod_id);
/*Return the current frame number
*Could be using implementation specific numbering of frames
*/
unsigned int get_current_frame(mid_t mod_id);
/*Return the current SFN (0-1023)*/
unsigned int get_current_system_frame_num(mid_t mod_id);
int get_current_subframe(mid_t mod_id);
unsigned int get_current_subframe(mid_t mod_id);
/*Return the frame and subframe number in compact 16-bit format.
Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/
......
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