@ -32,7 +32,7 @@
# include "liblte_rrc.h"
# include "liblte_rrc.h"
# include "srsapps/radio/radio_uhd.h"
# include "srsapps/radio/radio_uhd.h"
# include "srsapps/ue/phy/phy.h"
# include "srsapps/ue/phy/phy.h"
# include "srsapps/common/ tti_sync_cv .h"
# include "srsapps/common/ mac_interface .h"
# include "srsapps/common/log_stdout.h"
# include "srsapps/common/log_stdout.h"
# include "srsapps/ue/mac/mac.h"
# include "srsapps/ue/mac/mac.h"
# include "srsapps/ue/mac/mac_pcap.h"
# include "srsapps/ue/mac/mac_pcap.h"
@ -116,26 +116,26 @@ uint32_t sib_start_tti(uint32_t tti, uint32_t period, uint32_t x) {
void setup_mac_phy_sib2 ( LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT * sib2 , srslte : : ue : : mac * mac , srslte : : ue : : phy * phy ) {
void setup_mac_phy_sib2 ( LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT * sib2 , srslte : : ue : : mac * mac , srslte : : ue : : phy * phy ) {
// RACH-CONFIGCOMMON
// RACH-CONFIGCOMMON
if ( sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . present ) {
if ( sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . present ) {
mac - > set_param ( srslte : : ue : : mac_ params: : RA_NOFGROUPAPREAMBLES ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_NOFGROUPAPREAMBLES ,
liblte_rrc_message_size_group_a_num [ sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . size_of_ra ] ) ;
liblte_rrc_message_size_group_a_num [ sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . size_of_ra ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : RA_MESSAGESIZEA ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_MESSAGESIZEA ,
liblte_rrc_message_size_group_a_num [ sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . msg_size ] ) ;
liblte_rrc_message_size_group_a_num [ sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . msg_size ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : RA_MESSAGEPOWEROFFSETB ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_MESSAGEPOWEROFFSETB ,
liblte_rrc_message_power_offset_group_b_num [ sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . msg_pwr_offset_group_b ] ) ;
liblte_rrc_message_power_offset_group_b_num [ sib2 - > rr_config_common_sib . rach_cnfg . preambles_group_a_cnfg . msg_pwr_offset_group_b ] ) ;
}
}
mac - > set_param ( srslte : : ue : : mac_ params: : RA_NOFPREAMBLES ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_NOFPREAMBLES ,
liblte_rrc_number_of_ra_preambles_num [ sib2 - > rr_config_common_sib . rach_cnfg . num_ra_preambles ] ) ;
liblte_rrc_number_of_ra_preambles_num [ sib2 - > rr_config_common_sib . rach_cnfg . num_ra_preambles ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : RA_POWERRAMPINGSTEP ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_POWERRAMPINGSTEP ,
liblte_rrc_power_ramping_step_num [ sib2 - > rr_config_common_sib . rach_cnfg . pwr_ramping_step ] ) ;
liblte_rrc_power_ramping_step_num [ sib2 - > rr_config_common_sib . rach_cnfg . pwr_ramping_step ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : RA_INITRECEIVEDPOWER ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_INITRECEIVEDPOWER ,
liblte_rrc_preamble_initial_received_target_power_num [ sib2 - > rr_config_common_sib . rach_cnfg . preamble_init_rx_target_pwr ] ) ;
liblte_rrc_preamble_initial_received_target_power_num [ sib2 - > rr_config_common_sib . rach_cnfg . preamble_init_rx_target_pwr ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : RA_PREAMBLETRANSMAX ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_PREAMBLETRANSMAX ,
liblte_rrc_preamble_trans_max_num [ sib2 - > rr_config_common_sib . rach_cnfg . preamble_trans_max ] ) ;
liblte_rrc_preamble_trans_max_num [ sib2 - > rr_config_common_sib . rach_cnfg . preamble_trans_max ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : RA_RESPONSEWINDOW ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_RESPONSEWINDOW ,
liblte_rrc_ra_response_window_size_num [ sib2 - > rr_config_common_sib . rach_cnfg . ra_resp_win_size ] ) ;
liblte_rrc_ra_response_window_size_num [ sib2 - > rr_config_common_sib . rach_cnfg . ra_resp_win_size ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : RA_CONTENTIONTIMER ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : RA_CONTENTIONTIMER ,
liblte_rrc_mac_contention_resolution_timer_num [ sib2 - > rr_config_common_sib . rach_cnfg . mac_con_res_timer ] ) ;
liblte_rrc_mac_contention_resolution_timer_num [ sib2 - > rr_config_common_sib . rach_cnfg . mac_con_res_timer ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : HARQ_MAXMSG3TX ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : HARQ_MAXMSG3TX ,
sib2 - > rr_config_common_sib . rach_cnfg . max_harq_msg3_tx ) ;
sib2 - > rr_config_common_sib . rach_cnfg . max_harq_msg3_tx ) ;
printf ( " Set RACH ConfigCommon: NofPreambles=%d, ResponseWindow=%d, ContentionResolutionTimer=%d ms, MaxTrials=%d \n " ,
printf ( " Set RACH ConfigCommon: NofPreambles=%d, ResponseWindow=%d, ContentionResolutionTimer=%d ms, MaxTrials=%d \n " ,
@ -145,28 +145,28 @@ void setup_mac_phy_sib2(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2, srslte::u
liblte_rrc_preamble_trans_max_num [ sib2 - > rr_config_common_sib . rach_cnfg . preamble_trans_max ] ) ;
liblte_rrc_preamble_trans_max_num [ sib2 - > rr_config_common_sib . rach_cnfg . preamble_trans_max ] ) ;
// PDSCH ConfigCommon
// PDSCH ConfigCommon
mac - > set_param ( srslte : : ue : : mac_ params: : PDSCH_RSPOWER ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : PDSCH_RSPOWER ,
sib2 - > rr_config_common_sib . pdsch_cnfg . rs_power ) ;
sib2 - > rr_config_common_sib . pdsch_cnfg . rs_power ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : PDSCH_PB ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : PDSCH_PB ,
sib2 - > rr_config_common_sib . pdsch_cnfg . p_b ) ;
sib2 - > rr_config_common_sib . pdsch_cnfg . p_b ) ;
// PUSCH ConfigCommon
// PUSCH ConfigCommon
phy - > set_param ( srslte : : ue : : phy_ params: : PUSCH_BETA , 10 ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUSCH_BETA , 10 ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUSCH_EN_64QAM ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUSCH_EN_64QAM ,
sib2 - > rr_config_common_sib . pusch_cnfg . enable_64_qam ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . enable_64_qam ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUSCH_HOPPING_OFFSET ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUSCH_HOPPING_OFFSET ,
sib2 - > rr_config_common_sib . pusch_cnfg . pusch_hopping_offset ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . pusch_hopping_offset ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUSCH_HOPPING_N_SB ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUSCH_HOPPING_N_SB ,
sib2 - > rr_config_common_sib . pusch_cnfg . n_sb ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . n_sb ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUSCH_HOPPING_INTRA_SF ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUSCH_HOPPING_INTRA_SF ,
sib2 - > rr_config_common_sib . pusch_cnfg . hopping_mode = = LIBLTE_RRC_HOPPING_MODE_INTRA_AND_INTER_SUBFRAME ? 1 : 0 ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . hopping_mode = = LIBLTE_RRC_HOPPING_MODE_INTRA_AND_INTER_SUBFRAME ? 1 : 0 ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : DMRS_GROUP_HOPPING_EN ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : DMRS_GROUP_HOPPING_EN ,
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . group_hopping_enabled ? 1 : 0 ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . group_hopping_enabled ? 1 : 0 ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : DMRS_SEQUENCE_HOPPING_EN ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : DMRS_SEQUENCE_HOPPING_EN ,
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . sequence_hopping_enabled ? 1 : 0 ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . sequence_hopping_enabled ? 1 : 0 ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUSCH_RS_CYCLIC_SHIFT ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUSCH_RS_CYCLIC_SHIFT ,
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . cyclic_shift ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . cyclic_shift ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUSCH_RS_GROUP_ASSIGNMENT ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUSCH_RS_GROUP_ASSIGNMENT ,
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . group_assignment_pusch ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . ul_rs . group_assignment_pusch ) ;
printf ( " Set PUSCH ConfigCommon: HopOffset=%d, RSGroup=%d, RSNcs=%d, N_sb=%d \n " ,
printf ( " Set PUSCH ConfigCommon: HopOffset=%d, RSGroup=%d, RSNcs=%d, N_sb=%d \n " ,
@ -176,14 +176,14 @@ void setup_mac_phy_sib2(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2, srslte::u
sib2 - > rr_config_common_sib . pusch_cnfg . n_sb ) ;
sib2 - > rr_config_common_sib . pusch_cnfg . n_sb ) ;
// PUCCH ConfigCommon
// PUCCH ConfigCommon
phy - > set_param ( srslte : : ue : : phy_ params: : PUCCH_BETA , 10 ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUCCH_BETA , 10 ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUCCH_DELTA_SHIFT ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUCCH_DELTA_SHIFT ,
liblte_rrc_delta_pucch_shift_num [ sib2 - > rr_config_common_sib . pucch_cnfg . delta_pucch_shift ] ) ;
liblte_rrc_delta_pucch_shift_num [ sib2 - > rr_config_common_sib . pucch_cnfg . delta_pucch_shift ] ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUCCH_CYCLIC_SHIFT ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUCCH_CYCLIC_SHIFT ,
sib2 - > rr_config_common_sib . pucch_cnfg . n_cs_an ) ;
sib2 - > rr_config_common_sib . pucch_cnfg . n_cs_an ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUCCH_N_PUCCH_1 ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUCCH_N_PUCCH_1 ,
sib2 - > rr_config_common_sib . pucch_cnfg . n1_pucch_an ) ;
sib2 - > rr_config_common_sib . pucch_cnfg . n1_pucch_an ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PUCCH_N_RB_2 ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUCCH_N_RB_2 ,
sib2 - > rr_config_common_sib . pucch_cnfg . n_rb_cqi ) ;
sib2 - > rr_config_common_sib . pucch_cnfg . n_rb_cqi ) ;
printf ( " Set PUCCH ConfigCommon: DeltaShift=%d, CyclicShift=%d, N1=%d, NRB=%d \n " ,
printf ( " Set PUCCH ConfigCommon: DeltaShift=%d, CyclicShift=%d, N1=%d, NRB=%d \n " ,
liblte_rrc_delta_pucch_shift_num [ sib2 - > rr_config_common_sib . pucch_cnfg . delta_pucch_shift ] ,
liblte_rrc_delta_pucch_shift_num [ sib2 - > rr_config_common_sib . pucch_cnfg . delta_pucch_shift ] ,
@ -193,15 +193,15 @@ void setup_mac_phy_sib2(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2, srslte::u
// PRACH Configcommon
// PRACH Configcommon
phy - > set_param ( srslte : : ue : : phy_ params: : PRACH_ROOT_SEQ_IDX ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PRACH_ROOT_SEQ_IDX ,
sib2 - > rr_config_common_sib . prach_cnfg . root_sequence_index ) ;
sib2 - > rr_config_common_sib . prach_cnfg . root_sequence_index ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PRACH_HIGH_SPEED_FLAG ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PRACH_HIGH_SPEED_FLAG ,
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . high_speed_flag ? 1 : 0 ) ;
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . high_speed_flag ? 1 : 0 ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PRACH_FREQ_OFFSET ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PRACH_FREQ_OFFSET ,
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . prach_freq_offset ) ;
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . prach_freq_offset ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PRACH_ZC_CONFIG ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PRACH_ZC_CONFIG ,
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . zero_correlation_zone_config ) ;
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . zero_correlation_zone_config ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : PRACH_CONFIG_INDEX ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PRACH_CONFIG_INDEX ,
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . prach_config_index ) ;
sib2 - > rr_config_common_sib . prach_cnfg . prach_cnfg_info . prach_config_index ) ;
printf ( " Set PRACH ConfigCommon: SeqIdx=%d, HS=%d, FreqOffset=%d, ZC=%d, ConfigIndex=%d \n " ,
printf ( " Set PRACH ConfigCommon: SeqIdx=%d, HS=%d, FreqOffset=%d, ZC=%d, ConfigIndex=%d \n " ,
@ -213,9 +213,9 @@ void setup_mac_phy_sib2(LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT *sib2, srslte::u
// SRS ConfigCommon
// SRS ConfigCommon
if ( sib2 - > rr_config_common_sib . srs_ul_cnfg . present ) {
if ( sib2 - > rr_config_common_sib . srs_ul_cnfg . present ) {
phy - > set_param ( srslte : : ue : : phy_ params: : SRS_CS_BWCFG , sib2 - > rr_config_common_sib . srs_ul_cnfg . bw_cnfg ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : SRS_CS_BWCFG , sib2 - > rr_config_common_sib . srs_ul_cnfg . bw_cnfg ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : SRS_CS_SFCFG , sib2 - > rr_config_common_sib . srs_ul_cnfg . subfr_cnfg ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : SRS_CS_SFCFG , sib2 - > rr_config_common_sib . srs_ul_cnfg . subfr_cnfg ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : SRS_CS_ACKNACKSIMUL , sib2 - > rr_config_common_sib . srs_ul_cnfg . ack_nack_simul_tx ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : SRS_CS_ACKNACKSIMUL , sib2 - > rr_config_common_sib . srs_ul_cnfg . ack_nack_simul_tx ) ;
}
}
printf ( " Set SRS ConfigCommon: BW-Configuration=%d, SF-Configuration=%d, ACKNACK=%d \n " ,
printf ( " Set SRS ConfigCommon: BW-Configuration=%d, SF-Configuration=%d, ACKNACK=%d \n " ,
@ -229,25 +229,24 @@ void process_connsetup(LIBLTE_RRC_CONNECTION_SETUP_STRUCT *msg, srslte::ue::mac
// FIXME: There's an error parsing the connectionSetup message. This value is hard-coded:
// FIXME: There's an error parsing the connectionSetup message. This value is hard-coded:
if ( msg - > rr_cnfg . phy_cnfg_ded_present ) {
if ( msg - > rr_cnfg . phy_cnfg_ded_present ) {
phy - > set_param ( srslte : : ue : : phy_ params: : PUCCH_N_PUCCH_SR ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : PUCCH_N_PUCCH_SR ,
msg - > rr_cnfg . phy_cnfg_ded . sched_request_cnfg . sr_pucch_resource_idx ) ;
msg - > rr_cnfg . phy_cnfg_ded . sched_request_cnfg . sr_pucch_resource_idx ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : SR_CONFIG_INDEX ,
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : SR_CONFIG_INDEX ,
msg - > rr_cnfg . phy_cnfg_ded . sched_request_cnfg . sr_cnfg_idx ) ;
msg - > rr_cnfg . phy_cnfg_ded . sched_request_cnfg . sr_cnfg_idx ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : UCI_I_OFFSET_ACK , msg - > rr_cnfg . phy_cnfg_ded . pusch_cnfg_ded . beta_offset_ack_idx ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : UCI_I_OFFSET_ACK , msg - > rr_cnfg . phy_cnfg_ded . pusch_cnfg_ded . beta_offset_ack_idx ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : UCI_I_OFFSET_CQI , msg - > rr_cnfg . phy_cnfg_ded . pusch_cnfg_ded . beta_offset_cqi_idx ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : UCI_I_OFFSET_CQI , msg - > rr_cnfg . phy_cnfg_ded . pusch_cnfg_ded . beta_offset_cqi_idx ) ;
phy - > set_param ( srslte : : ue : : phy_ params: : UCI_I_OFFSET_RI , msg - > rr_cnfg . phy_cnfg_ded . pusch_cnfg_ded . beta_offset_ri_idx ) ;
phy - > set_param ( srslte : : ue : : phy_ interface_ params: : UCI_I_OFFSET_RI , msg - > rr_cnfg . phy_cnfg_ded . pusch_cnfg_ded . beta_offset_ri_idx ) ;
if ( msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded_present & & msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . setup_present ) {
if ( msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded_present & & msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . setup_present ) {
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_CS , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . cyclic_shift ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_CS , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . cyclic_shift ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_DURATION , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . duration ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_DURATION , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . duration ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_NRRC , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . freq_domain_pos ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_NRRC , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . freq_domain_pos ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_BW , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_bandwidth ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_BW , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_bandwidth ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_CONFIGINDEX , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_cnfg_idx ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_CONFIGINDEX , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_cnfg_idx ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_HOP , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_hopping_bandwidth ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_HOP , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_hopping_bandwidth ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_CYCLICSHIFT , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . cyclic_shift ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_CYCLICSHIFT , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . cyclic_shift ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_UE_TXCOMB , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . tx_comb ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_UE_TXCOMB , msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . tx_comb ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_IS_CONFIGURED , 1 ) ;
phy - > set_param ( srslte : : ue : : phy_interface_params : : SRS_IS_CONFIGURED , 1 ) ;
phy - > set_param ( srslte : : ue : : phy_params : : SRS_BETA , 10 ) ;
}
}
}
}
printf ( " Set PHY configuration: SR-n_pucch=%d, SR-ConfigIndex=%d, SRS-ConfigIndex=%d, SRS-bw=%d, SRS-Nrcc=%d, SRS-hop=%d, SRS-Ncs=%d \n " ,
printf ( " Set PHY configuration: SR-n_pucch=%d, SR-ConfigIndex=%d, SRS-ConfigIndex=%d, SRS-bw=%d, SRS-Nrcc=%d, SRS-hop=%d, SRS-Ncs=%d \n " ,
@ -259,15 +258,15 @@ void process_connsetup(LIBLTE_RRC_CONNECTION_SETUP_STRUCT *msg, srslte::ue::mac
msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_hopping_bandwidth ,
msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . srs_hopping_bandwidth ,
msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . cyclic_shift ) ;
msg - > rr_cnfg . phy_cnfg_ded . srs_ul_cnfg_ded . cyclic_shift ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : HARQ_MAXTX ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : HARQ_MAXTX ,
liblte_rrc_max_harq_tx_num [ msg - > rr_cnfg . mac_main_cnfg . explicit_value . ulsch_cnfg . max_harq_tx ] ) ;
liblte_rrc_max_harq_tx_num [ msg - > rr_cnfg . mac_main_cnfg . explicit_value . ulsch_cnfg . max_harq_tx ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : SR_TRANS_MAX ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : SR_TRANS_MAX ,
liblte_rrc_dsr_trans_max_num [ msg - > rr_cnfg . phy_cnfg_ded . sched_request_cnfg . dsr_trans_max ] ) ;
liblte_rrc_dsr_trans_max_num [ msg - > rr_cnfg . phy_cnfg_ded . sched_request_cnfg . dsr_trans_max ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : SR_PUCCH_CONFIGURED , 1 ) ;
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : SR_PUCCH_CONFIGURED , 1 ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : BSR_TIMER_RETX ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : BSR_TIMER_RETX ,
liblte_rrc_retransmission_bsr_timer_num [ msg - > rr_cnfg . mac_main_cnfg . explicit_value . ulsch_cnfg . retx_bsr_timer ] ) ;
liblte_rrc_retransmission_bsr_timer_num [ msg - > rr_cnfg . mac_main_cnfg . explicit_value . ulsch_cnfg . retx_bsr_timer ] ) ;
mac - > set_param ( srslte : : ue : : mac_ params: : BSR_TIMER_PERIODIC ,
mac - > set_param ( srslte : : ue : : mac_ interface_ params: : BSR_TIMER_PERIODIC ,
liblte_rrc_periodic_bsr_timer_num [ msg - > rr_cnfg . mac_main_cnfg . explicit_value . ulsch_cnfg . periodic_bsr_timer ] ) ;
liblte_rrc_periodic_bsr_timer_num [ msg - > rr_cnfg . mac_main_cnfg . explicit_value . ulsch_cnfg . periodic_bsr_timer ] ) ;
printf ( " Set MAC configuration: dsr-TransMAX: %d, harq-MaxReTX=%d, bsr-TimerReTX=%d, bsr-TimerPeriodic=%d \n " ,
printf ( " Set MAC configuration: dsr-TransMAX: %d, harq-MaxReTX=%d, bsr-TimerReTX=%d, bsr-TimerPeriodic=%d \n " ,
@ -325,7 +324,6 @@ void sig_int_handler(int signo)
if ( prog_args . do_trace ) {
if ( prog_args . do_trace ) {
//radio_uhd.write_trace("radio");
//radio_uhd.write_trace("radio");
phy . write_trace ( " phy " ) ;
phy . write_trace ( " phy " ) ;
mac . write_trace ( " mac " ) ;
}
}
if ( prog_args . do_pcap ) {
if ( prog_args . do_pcap ) {
mac_pcap . close ( ) ;
mac_pcap . close ( ) ;
@ -334,10 +332,139 @@ void sig_int_handler(int signo)
exit ( 0 ) ;
exit ( 0 ) ;
}
}
class my_rlc : public srslte : : ue : : rlc_interface_mac {
public :
bool mib_decoded ;
bool sib1_decoded ;
bool sib2_decoded ;
bool connsetup_decoded ;
int nsegm_dcch ;
uint8_t si_window_len , sib2_period ;
my_rlc ( ) {
mib_decoded = false ;
sib1_decoded = false ;
sib2_decoded = false ;
connsetup_decoded = false ;
nsegm_dcch = 0 ;
si_window_len = 0 ;
sib2_period = 0 ;
}
uint32_t get_buffer_state ( uint32_t lcid ) {
if ( lcid = = 0 ) {
if ( sib2_decoded & & ! connsetup_decoded ) {
return 6 ;
}
} else if ( lcid = = 1 ) {
if ( connsetup_decoded & & nsegm_dcch < 2 ) {
return lengths [ nsegm_dcch ] ;
} else if ( nsegm_dcch = = 2 ) {
return 2 ;
}
}
return 0 ;
}
uint32_t read_pdu ( uint32_t lcid , uint8_t * payload , uint32_t nof_bytes )
{
if ( lcid = = 0 ) {
LIBLTE_RRC_UL_CCCH_MSG_STRUCT ul_ccch_msg ;
// Prepare ConnectionRequest packet
ul_ccch_msg . msg_type = LIBLTE_RRC_UL_CCCH_MSG_TYPE_RRC_CON_REQ ;
ul_ccch_msg . msg . rrc_con_req . ue_id_type = LIBLTE_RRC_CON_REQ_UE_ID_TYPE_RANDOM_VALUE ;
ul_ccch_msg . msg . rrc_con_req . ue_id . random = 1000 ;
ul_ccch_msg . msg . rrc_con_req . cause = LIBLTE_RRC_CON_REQ_EST_CAUSE_MO_SIGNALLING ;
liblte_rrc_pack_ul_ccch_msg ( & ul_ccch_msg , & bit_msg ) ;
uint64_t uecri = 0 ;
uint8_t * ue_cri_ptr = ( uint8_t * ) & uecri ;
uint32_t nbytes = bit_msg . N_bits / 8 ;
uint8_t * ptr = bit_msg . msg ;
for ( int i = 0 ; i < nbytes ; i + + ) {
ue_cri_ptr [ nbytes - i - 1 ] = ( uint8_t ) srslte_bit_unpack ( & ptr , 8 ) ;
}
mac . set_param ( srslte : : ue : : mac_interface_params : : CONTENTION_ID , uecri ) ;
// Send ConnectionRequest Packet
printf ( " Send ConnectionRequest %d/%d bytes \n " , nbytes , nof_bytes ) ;
memcpy ( payload , nbytes , nbytes * sizeof ( uint8_t ) ) ;
bzero ( & payload [ nbytes ] , ( nof_bytes - nbytes ) * sizeof ( uint8_t ) ) ;
} else if ( lcid = = 1 ) {
if ( nsegm_dcch < 2 ) {
printf ( " Sending Connection Setup Complete %d length %d \n " , nsegm_dcch , lengths [ nsegm_dcch ] ) ;
memcpy ( payload , setupComplete_segm [ nsegm_dcch ] , lengths [ nsegm_dcch ] ) ;
nsegm_dcch + + ;
} else if ( nsegm_dcch = = 2 ) {
printf ( " Send RLC ACK \n " ) ;
memcpy ( payload , reply , 2 * sizeof ( uint8_t ) ) ;
nsegm_dcch + + ;
}
}
}
void write_pdu ( uint32_t lcid , uint8_t * payload , uint32_t nof_bytes ) {
if ( lcid = = 0 ) {
LIBLTE_RRC_DL_CCCH_MSG_STRUCT dl_ccch_msg ;
printf ( " ConnSetup received %d bytes \n " , nof_bytes ) ;
srslte_bit_pack_vector ( payload , bit_msg . msg , nof_bytes * 8 ) ;
bit_msg . N_bits = nof_bytes * 8 ;
liblte_rrc_unpack_dl_ccch_msg ( & bit_msg , & dl_ccch_msg ) ;
printf ( " Response: %s \n " , liblte_rrc_dl_ccch_msg_type_text [ dl_ccch_msg . msg_type ] ) ;
switch ( dl_ccch_msg . msg_type ) {
case LIBLTE_RRC_DL_CCCH_MSG_TYPE_RRC_CON_SETUP :
// Process ConnectionSetup
process_connsetup ( & dl_ccch_msg . msg . rrc_con_setup , & mac , & phy ) ;
connsetup_decoded = true ;
break ;
case LIBLTE_RRC_DL_CCCH_MSG_TYPE_RRC_CON_REJ :
mac . set_param ( srslte : : ue : : mac_interface_params : : RNTI_C , 0 ) ;
break ;
}
} else if ( lcid = = 1 ) {
printf ( " Received on DCCH0 %d bytes \n " , nof_bytes ) ;
}
}
void write_pdu_bcch_bch ( uint8_t * payload , uint32_t nof_bytes )
{
LIBLTE_RRC_MIB_STRUCT mib ;
srslte_bit_pack_vector ( payload , bit_msg . msg , nof_bytes * 8 ) ;
bit_msg . N_bits = nof_bytes * 8 ;
liblte_rrc_unpack_bcch_bch_msg ( & bit_msg , & mib ) ;
printf ( " MIB received %d bytes, BW=%s \n " , nof_bytes , liblte_rrc_dl_bandwidth_text [ mib . dl_bw ] ) ;
mib_decoded = true ;
}
void write_pdu_bcch_dlsch ( uint8_t * payload , uint32_t nof_bytes )
{
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg ;
srslte_bit_pack_vector ( payload , bit_msg . msg , nof_bytes * 8 ) ;
bit_msg . N_bits = nof_bytes * 8 ;
liblte_rrc_unpack_bcch_dlsch_msg ( & bit_msg , & dlsch_msg ) ;
if ( dlsch_msg . N_sibs > 0 ) {
if ( dlsch_msg . sibs [ 0 ] . sib_type = = LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1 ) {
si_window_len = liblte_rrc_si_window_length_num [ dlsch_msg . sibs [ 0 ] . sib . sib1 . si_window_length ] ;
sib2_period = liblte_rrc_si_periodicity_num [ dlsch_msg . sibs [ 0 ] . sib . sib1 . sched_info [ 0 ] . si_periodicity ] ;
printf ( " SIB1 received %d bytes, CellID=%d, si_window=%d, sib2_period=%d \n " ,
nof_bytes , dlsch_msg . sibs [ 0 ] . sib . sib1 . cell_id & 0xfff , si_window_len , sib2_period ) ;
sib1_decoded = true ;
} else if ( dlsch_msg . sibs [ 0 ] . sib_type = = LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2 ) {
printf ( " SIB2 received %d bytes \n " , nof_bytes ) ;
setup_mac_phy_sib2 ( & dlsch_msg . sibs [ 0 ] . sib . sib2 , & mac , & phy ) ;
sib2_decoded = true ;
}
}
}
private :
LIBLTE_BIT_MSG_STRUCT bit_msg ;
LIBLTE_BYTE_MSG_STRUCT byte_msg ;
} ;
int main ( int argc , char * argv [ ] )
int main ( int argc , char * argv [ ] )
{
{
srslte : : ue : : tti_sync_cv ttisync ( 10240 ) ;
srslte : : log_stdout mac_log ( " MAC " ) , phy_log ( " PHY " ) ;
srslte : : log_stdout mac_log ( " MAC " ) , phy_log ( " PHY " ) ;
parse_args ( & prog_args , argc , argv ) ;
parse_args ( & prog_args , argc , argv ) ;
@ -358,7 +485,6 @@ int main(int argc, char *argv[])
signal ( SIGINT , sig_int_handler ) ;
signal ( SIGINT , sig_int_handler ) ;
//radio_uhd.start_trace();
//radio_uhd.start_trace();
phy . start_trace ( ) ;
phy . start_trace ( ) ;
mac . start_trace ( ) ;
}
}
if ( prog_args . do_pcap ) {
if ( prog_args . do_pcap ) {
@ -374,144 +500,32 @@ int main(int argc, char *argv[])
radio_uhd . init ( ) ;
radio_uhd . init ( ) ;
radio_uhd . set_rx_gain ( prog_args . uhd_rx_gain ) ;
radio_uhd . set_rx_gain ( prog_args . uhd_rx_gain ) ;
radio_uhd . set_tx_gain ( prog_args . uhd_tx_gain ) ;
radio_uhd . set_tx_gain ( prog_args . uhd_tx_gain ) ;
phy . init ( & radio_uhd , & ttisyn c, & phy_log ) ;
phy . init ( & radio_uhd , & ma c, & phy_log ) ;
} else {
} else {
radio_uhd . init_agc ( ) ;
radio_uhd . init_agc ( ) ;
radio_uhd . set_tx_rx_gain_offset ( 0 ) ;
radio_uhd . set_tx_rx_gain_offset ( 0 ) ;
phy . init_agc ( & radio_uhd , & ttisyn c, & phy_log ) ;
phy . init_agc ( & radio_uhd , & ma c, & phy_log ) ;
}
}
// Init MAC
// Init MAC
mac . init ( & phy , & ttisyn c, & mac_log ) ;
mac . init ( & phy , & my_rl c, & mac_log ) ;
// Set RX freq
// Set RX freq
radio_uhd . set_rx_freq ( prog_args . uhd_rx_freq ) ;
radio_uhd . set_rx_freq ( prog_args . uhd_rx_freq ) ;
radio_uhd . set_tx_freq ( prog_args . uhd_tx_freq ) ;
radio_uhd . set_tx_freq ( prog_args . uhd_tx_freq ) ;
LIBLTE_BIT_MSG_STRUCT bit_msg ;
LIBLTE_RRC_MIB_STRUCT bch_msg ;
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg ;
LIBLTE_RRC_UL_CCCH_MSG_STRUCT ul_ccch_msg ;
LIBLTE_RRC_DL_CCCH_MSG_STRUCT dl_ccch_msg ;
uint32_t si_window_len , sib2_period ;
int tti ;
enum { START , SIB1 , SIB2 , CONNECT , SETUPCOMPLETE , IDLE } state = START ;
int n ;
while ( 1 ) {
while ( 1 ) {
switch ( state ) {
uint32_t tti ;
case START :
if ( my_rlc . mib_decoded ) {
n = mac . recv_bcch_sdu ( bit_msg . msg , LIBLTE_MAX_MSG_SIZE ) ;
if ( ! my_rlc . sib1_decoded ) {
if ( n > 0 ) {
tti = mac . get_current_tti ( ) ;
bit_msg . N_bits = n ;
mac . set_param ( srslte : : ue : : mac_interface_params : : BCCH_SI_WINDOW_ST , sib_start_tti ( tti , 2 , 5 ) ) ;
liblte_rrc_unpack_bcch_bch_msg ( & bit_msg , & bch_msg ) ;
mac . set_param ( srslte : : ue : : mac_interface_params : : BCCH_SI_WINDOW_LEN , 1 ) ;
printf ( " MIB received %d bytes, BW=%s \n " , n , liblte_rrc_dl_bandwidth_text [ bch_msg . dl_bw ] ) ;
} else {
state = SIB1 ;
tti = mac . get_current_tti ( ) ;
}
mac . set_param ( srslte : : ue : : mac_interface_params : : BCCH_SI_WINDOW_ST , sib_start_tti ( tti , my_rlc . sib2_period , 0 ) ) ;
break ;
mac . set_param ( srslte : : ue : : mac_interface_params : : BCCH_SI_WINDOW_LEN , my_rlc . si_window_len ) ;
case SIB1 :
}
n = mac . recv_bcch_sdu ( bit_msg . msg , LIBLTE_MAX_MSG_SIZE ) ;
if ( n > 0 ) {
bit_msg . N_bits = n ;
liblte_rrc_unpack_bcch_dlsch_msg ( & bit_msg , & dlsch_msg ) ;
si_window_len = liblte_rrc_si_window_length_num [ dlsch_msg . sibs [ 0 ] . sib . sib1 . si_window_length ] ;
sib2_period = liblte_rrc_si_periodicity_num [ dlsch_msg . sibs [ 0 ] . sib . sib1 . sched_info [ 0 ] . si_periodicity ] ;
printf ( " SIB1 received %d bytes, CellID=%d, si_window=%d, sib2_period=%d \n " ,
n / 8 , dlsch_msg . sibs [ 0 ] . sib . sib1 . cell_id & 0xfff , si_window_len , sib2_period ) ;
state = SIB2 ;
} else {
tti = mac . get_tti ( ) ;
mac . set_param ( srslte : : ue : : mac_params : : BCCH_SI_WINDOW_ST , sib_start_tti ( tti , 2 , 5 ) ) ;
mac . set_param ( srslte : : ue : : mac_params : : BCCH_SI_WINDOW_LEN , 1 ) ;
}
break ;
case SIB2 :
n = mac . recv_bcch_sdu ( bit_msg . msg , LIBLTE_MAX_MSG_SIZE ) ;
if ( n > 0 ) {
// Process SIB2
bit_msg . N_bits = n ;
liblte_rrc_unpack_bcch_dlsch_msg ( & bit_msg , & dlsch_msg ) ;
printf ( " SIB2 received %d bytes \n " , n / 8 ) ;
setup_mac_phy_sib2 ( & dlsch_msg . sibs [ 0 ] . sib . sib2 , & mac , & phy ) ;
// Prepare ConnectionRequest packet
ul_ccch_msg . msg_type = LIBLTE_RRC_UL_CCCH_MSG_TYPE_RRC_CON_REQ ;
ul_ccch_msg . msg . rrc_con_req . ue_id_type = LIBLTE_RRC_CON_REQ_UE_ID_TYPE_RANDOM_VALUE ;
ul_ccch_msg . msg . rrc_con_req . ue_id . random = 1000 ;
ul_ccch_msg . msg . rrc_con_req . cause = LIBLTE_RRC_CON_REQ_EST_CAUSE_MO_SIGNALLING ;
liblte_rrc_pack_ul_ccch_msg ( & ul_ccch_msg , & bit_msg ) ;
uint64_t uecri = 0 ;
uint8_t * ue_cri_ptr = ( uint8_t * ) & uecri ;
uint32_t nbytes = bit_msg . N_bits / 8 ;
uint8_t * ptr = bit_msg . msg ;
for ( int i = 0 ; i < nbytes ; i + + ) {
ue_cri_ptr [ nbytes - i - 1 ] = ( uint8_t ) srslte_bit_unpack ( & ptr , 8 ) ;
}
mac . set_param ( srslte : : ue : : mac_params : : CONTENTION_ID , uecri ) ;
// Send ConnectionRequest Packet
printf ( " Send ConnectionRequest %d bytes \n " , nbytes ) ;
mac . send_ccch_sdu ( bit_msg . msg , bit_msg . N_bits ) ;
state = CONNECT ;
} else {
tti = mac . get_tti ( ) ;
mac . set_param ( srslte : : ue : : mac_params : : BCCH_SI_WINDOW_ST , sib_start_tti ( tti , sib2_period , 0 ) ) ;
mac . set_param ( srslte : : ue : : mac_params : : BCCH_SI_WINDOW_LEN , si_window_len ) ;
}
break ;
case CONNECT :
// Wait for Connection Setup
n = mac . recv_ccch_sdu ( bit_msg . msg , LIBLTE_MAX_MSG_SIZE ) ;
if ( n > 0 ) {
printf ( " ConnSetup received %d bytes \n " , n / 8 ) ;
bit_msg . N_bits = n ;
srslte_vec_fprint_hex ( stdout , bit_msg . msg , n ) ;
liblte_rrc_unpack_dl_ccch_msg ( & bit_msg , & dl_ccch_msg ) ;
printf ( " Response: %s \n " , liblte_rrc_dl_ccch_msg_type_text [ dl_ccch_msg . msg_type ] ) ;
switch ( dl_ccch_msg . msg_type ) {
case LIBLTE_RRC_DL_CCCH_MSG_TYPE_RRC_CON_SETUP :
// Process ConnectionSetup
process_connsetup ( & dl_ccch_msg . msg . rrc_con_setup , & mac , & phy ) ;
// Generate and send ConnectionSetupComplete
for ( int i = 0 ; i < 2 ; i + + ) {
printf ( " Sending Connection Setup Complete %d \n " , i ) ;
srslte_bit_pack_vector ( setupComplete_segm [ i ] , bit_msg . msg , lengths [ i ] * 8 ) ;
n = mac . send_dcch0_sdu ( bit_msg . msg , lengths [ i ] * 8 ) ;
if ( n < 0 ) {
fprintf ( stderr , " Error writting to DCCH0 \n " ) ;
exit ( - 1 ) ;
}
}
state = SETUPCOMPLETE ;
break ;
case LIBLTE_RRC_DL_CCCH_MSG_TYPE_RRC_CON_REJ :
mac . set_param ( srslte : : ue : : mac_params : : RNTI_C , 0 ) ;
break ;
}
// exit(0);
}
break ;
case SETUPCOMPLETE :
// Wait for ConnectionSetup
n = mac . recv_dcch0_sdu ( bit_msg . msg , LIBLTE_MAX_MSG_SIZE ) ;
if ( n > 0 ) {
printf ( " Received on DCCH0 %d bytes \n " , n / 8 ) ;
printf ( " Send RLC ACK \n " ) ;
srslte_bit_pack_vector ( reply , bit_msg . msg , 2 * 8 ) ;
n = mac . send_dcch0_sdu ( bit_msg . msg , 2 * 8 ) ;
if ( n < 0 ) {
fprintf ( stderr , " Error writting to DCCH0 \n " ) ;
exit ( - 1 ) ;
}
state = IDLE ;
}
break ;
case IDLE :
break ;
}
}
usleep ( 10000 ) ;
usleep ( 10000 ) ;
}
}
}
}