Skip to content

Commit

Permalink
Bug fixes:
Browse files Browse the repository at this point in the history
Extented driver enabled trig CCA backoff if driver return busy

Wi-sun fixed channel allocaion random resolution fix.

Change-Id: Ifa4d9310643d64a647405bf41b9617af72443ed9
  • Loading branch information
Juha Heiskanen committed Aug 28, 2018
1 parent f39312b commit 607da3e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static int8_t ws_fhss_discovery_configure(protocol_interface_info_entry_t *cur)
fhss_configuration.ws_channel_function = WS_FIXED_CHANNEL;
fhss_configuration.fhss_bc_dwell_interval = 0;
fhss_configuration.fhss_broadcast_interval = 0;
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels);
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels - 1);
memset(fhss_configuration.channel_mask, 0, sizeof(uint32_t) * 8);
channel_list_set_channel(fhss_configuration.channel_mask, cur->ws_info->hopping_schdule.fixed_channel, true);

Expand Down Expand Up @@ -1516,7 +1516,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
tr_debug("Border router start network");
// Randomize fixed channel. Only used if channel plan is fixed
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels);
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels - 1);
cur->ws_info->network_pan_id = randLIB_get_random_in_range(0,0xfffd);
cur->ws_info->pan_information.pan_size = 0;
cur->ws_info->pan_information.pan_version = randLIB_get_random_in_range(0,0xffff);
Expand Down
9 changes: 6 additions & 3 deletions source/MAC/IEEE802_15_4/mac_mcps_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1819,9 +1819,12 @@ static int8_t mcps_pd_data_cca_trig(protocol_interface_rf_mac_setup_s *rf_ptr, m
}
mac_pd_sap_set_phy_tx_time(rf_ptr, buffer->tx_time, cca_enabled);
if (mac_plme_cca_req(rf_ptr) != 0) {
rf_ptr->macTxProcessActive = false;
rf_ptr->mac_ack_tx_active = false;
return -1;

if (buffer->fcf_dsn.frametype == MAC_FRAME_ACK) {
rf_ptr->macTxProcessActive = false;
return -1;
}
mac_csma_backoff_start(rf_ptr);
}
} else {
timer_mac_start(rf_ptr, MAC_TIMER_CCA, (uint16_t)(buffer->tx_time / 50));
Expand Down
2 changes: 1 addition & 1 deletion source/MAC/IEEE802_15_4/mac_pd_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static uint16_t mac_csma_backoff_period_convert_to50us(uint8_t random, uint8_t b
return (random * backoff_period_in_10us) / 5;
}

static void mac_csma_backoff_start(protocol_interface_rf_mac_setup_s *rf_mac_setup)
void mac_csma_backoff_start(protocol_interface_rf_mac_setup_s *rf_mac_setup)
{
uint8_t backoff = mac_csma_random_backoff_get(rf_mac_setup);
uint16_t backoff_slots = mac_csma_backoff_period_convert_to50us(backoff, rf_mac_setup->backoff_period_in_10us);
Expand Down
2 changes: 2 additions & 0 deletions source/MAC/IEEE802_15_4/mac_pd_sap.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ int8_t mac_pd_sap_data_cb(void *identifier, struct arm_phy_sap_msg_s *message);
void mac_csma_param_init(struct protocol_interface_rf_mac_setup *rf_mac_setup);

uint32_t mac_csma_backoff_get(struct protocol_interface_rf_mac_setup *rf_mac_setup);

void mac_csma_backoff_start(struct protocol_interface_rf_mac_setup *rf_mac_setup);
/**
* Run Mac data interface state Machine.
*
Expand Down
5 changes: 5 additions & 0 deletions test/nanostack/unittest/stub/mac_pd_sap_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ uint32_t mac_csma_backoff_get(protocol_interface_rf_mac_setup_s *rf_mac_setup)
return 960;
}

void mac_csma_backoff_start(protocol_interface_rf_mac_setup_s *rf_mac_setup)
{

}

0 comments on commit 607da3e

Please sign in to comment.