Skip to content

Commit db81d02

Browse files
author
Juha Heiskanen
committed
SW MAC timestamp read update
Now timestamp is returned by functional. Change-Id: Ieb10d01847f7a5298943dd53c847f0f6ce262ab9
1 parent eddf91b commit db81d02

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

nanostack/sw_mac.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ extern int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_stat
8484
/**
8585
* @brief Read current timestamp for compared storaged data timestamp.
8686
* @param mac_api MAC instance.
87-
* @param time_stamp_buffer pointer for staorage time stamp
88-
* @return 0 on succeess, < 0 on fail
87+
* @return Current timestamp in us
8988
*/
90-
int ns_sw_mac_read_current_timestamp(struct mac_api_s *mac_api, uint32_t *time_stamp_buffer);
89+
uint32_t ns_sw_mac_read_current_timestamp(struct mac_api_s *mac_api);
9190

9291
#ifdef __cplusplus
9392
}

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,7 @@ static void ws_bootstrap_asynch_confirm(struct protocol_interface_info_entry *in
13041304
uint32_t ws_time_from_last_unicast_traffic(uint32_t current_time_stamp, ws_neighbor_class_entry_t *ws_neighbor)
13051305
{
13061306
uint32_t time_from_last_unicast_shedule = current_time_stamp;
1307+
13071308
//Time from last RX unicast in us
13081309
time_from_last_unicast_shedule -= ws_neighbor->fhss_data.uc_timing_info.utt_rx_timestamp;
13091310
time_from_last_unicast_shedule /= 1000000; //Convert to seconds
@@ -1320,8 +1321,7 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
13201321
}
13211322
memcpy(ll_target, ADDR_LINK_LOCAL_PREFIX, 8);
13221323

1323-
uint32_t current_time_stamp = 0;
1324-
ns_sw_mac_read_current_timestamp(interface->mac_api, &current_time_stamp);
1324+
uint32_t current_time_stamp = ns_sw_mac_read_current_timestamp(interface->mac_api);
13251325

13261326
mac_neighbor_table_entry_t *neighbor_entry_ptr = NULL;
13271327
ns_list_foreach_safe(mac_neighbor_table_entry_t, cur, &mac_neighbor_info(interface)->neighbour_list) {

source/MAC/IEEE802_15_4/sw_mac.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,17 +700,18 @@ void sw_mac_stats_update(protocol_interface_rf_mac_setup_s *setup, mac_stats_typ
700700
}
701701
}
702702

703-
int ns_sw_mac_read_current_timestamp(struct mac_api_s *mac_api, uint32_t *time_stamp_buffer)
703+
uint32_t ns_sw_mac_read_current_timestamp(struct mac_api_s *mac_api)
704704
{
705705
if (!mac_api) {
706-
return -1;
706+
return 0;
707707
}
708708

709709
// Get a pointer to MAC setup structure
710710
protocol_interface_rf_mac_setup_s *mac_setup = get_sw_mac_ptr_by_mac_api(mac_api);
711711
if (!mac_setup) {
712-
return -2;
712+
return 0;
713713
}
714+
uint32_t time_stamp_buffer;
714715
mac_setup->dev_driver->phy_driver->extension(PHY_EXTENSION_GET_TIMESTAMP, (uint8_t *)&time_stamp_buffer);
715-
return 0;
716+
return time_stamp_buffer;
716717
}

test/nanostack/unittest/stub/sw_mac_stub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void sw_mac_stats_update(protocol_interface_rf_mac_setup_s *setup, mac_stats_typ
7575

7676
}
7777

78-
int ns_sw_mac_read_current_timestamp(struct mac_api_s *mac_api, uint32_t *time_stamp_buffer)
78+
uint32_t ns_sw_mac_read_current_timestamp(struct mac_api_s *mac_api)
7979
{
80-
return -1;
80+
return 0;
8181
}

0 commit comments

Comments
 (0)