Skip to content

Commit 607da3e

Browse files
author
Juha Heiskanen
committed
Bug fixes:
Extented driver enabled trig CCA backoff if driver return busy Wi-sun fixed channel allocaion random resolution fix. Change-Id: Ifa4d9310643d64a647405bf41b9617af72443ed9
1 parent f39312b commit 607da3e

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int8_t ws_fhss_discovery_configure(protocol_interface_info_entry_t *cur)
270270
fhss_configuration.ws_channel_function = WS_FIXED_CHANNEL;
271271
fhss_configuration.fhss_bc_dwell_interval = 0;
272272
fhss_configuration.fhss_broadcast_interval = 0;
273-
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels);
273+
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels - 1);
274274
memset(fhss_configuration.channel_mask, 0, sizeof(uint32_t) * 8);
275275
channel_list_set_channel(fhss_configuration.channel_mask, cur->ws_info->hopping_schdule.fixed_channel, true);
276276

@@ -1516,7 +1516,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
15161516
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
15171517
tr_debug("Border router start network");
15181518
// Randomize fixed channel. Only used if channel plan is fixed
1519-
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels);
1519+
cur->ws_info->hopping_schdule.fixed_channel = randLIB_get_random_in_range(0,cur->ws_info->hopping_schdule.number_of_channels - 1);
15201520
cur->ws_info->network_pan_id = randLIB_get_random_in_range(0,0xfffd);
15211521
cur->ws_info->pan_information.pan_size = 0;
15221522
cur->ws_info->pan_information.pan_version = randLIB_get_random_in_range(0,0xffff);

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,9 +1819,12 @@ static int8_t mcps_pd_data_cca_trig(protocol_interface_rf_mac_setup_s *rf_ptr, m
18191819
}
18201820
mac_pd_sap_set_phy_tx_time(rf_ptr, buffer->tx_time, cca_enabled);
18211821
if (mac_plme_cca_req(rf_ptr) != 0) {
1822-
rf_ptr->macTxProcessActive = false;
1823-
rf_ptr->mac_ack_tx_active = false;
1824-
return -1;
1822+
1823+
if (buffer->fcf_dsn.frametype == MAC_FRAME_ACK) {
1824+
rf_ptr->macTxProcessActive = false;
1825+
return -1;
1826+
}
1827+
mac_csma_backoff_start(rf_ptr);
18251828
}
18261829
} else {
18271830
timer_mac_start(rf_ptr, MAC_TIMER_CCA, (uint16_t)(buffer->tx_time / 50));

source/MAC/IEEE802_15_4/mac_pd_sap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static uint16_t mac_csma_backoff_period_convert_to50us(uint8_t random, uint8_t b
6464
return (random * backoff_period_in_10us) / 5;
6565
}
6666

67-
static void mac_csma_backoff_start(protocol_interface_rf_mac_setup_s *rf_mac_setup)
67+
void mac_csma_backoff_start(protocol_interface_rf_mac_setup_s *rf_mac_setup)
6868
{
6969
uint8_t backoff = mac_csma_random_backoff_get(rf_mac_setup);
7070
uint16_t backoff_slots = mac_csma_backoff_period_convert_to50us(backoff, rf_mac_setup->backoff_period_in_10us);

source/MAC/IEEE802_15_4/mac_pd_sap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ int8_t mac_pd_sap_data_cb(void *identifier, struct arm_phy_sap_msg_s *message);
4848
void mac_csma_param_init(struct protocol_interface_rf_mac_setup *rf_mac_setup);
4949

5050
uint32_t mac_csma_backoff_get(struct protocol_interface_rf_mac_setup *rf_mac_setup);
51+
52+
void mac_csma_backoff_start(struct protocol_interface_rf_mac_setup *rf_mac_setup);
5153
/**
5254
* Run Mac data interface state Machine.
5355
*

test/nanostack/unittest/stub/mac_pd_sap_stub.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,8 @@ uint32_t mac_csma_backoff_get(protocol_interface_rf_mac_setup_s *rf_mac_setup)
7373
return 960;
7474
}
7575

76+
void mac_csma_backoff_start(protocol_interface_rf_mac_setup_s *rf_mac_setup)
77+
{
78+
79+
}
80+

0 commit comments

Comments
 (0)