Skip to content

Commit bb21264

Browse files
author
Kari Severinkangas
authored
Thread combined nvm test (ARMmbed#1507)
hread nvm support for active/pending conf, device data, link info
1 parent 76f7725 commit bb21264

18 files changed

+754
-582
lines changed

source/6LoWPAN/Thread/thread_bootstrap.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,11 @@ void thread_bootstrap_attached_finish(protocol_interface_info_entry_t *cur)
17711771
if (cur->thread_info->releaseRouterId) {
17721772
thread_router_bootstrap_router_id_release(cur);
17731773
}
1774-
thread_nvm_store_link_info_file_write(cur);
1774+
uint8_t *parent_mac_addr = NULL;
1775+
if (cur->thread_info->thread_endnode_parent) {
1776+
parent_mac_addr = cur->thread_info->thread_endnode_parent->mac64;
1777+
}
1778+
thread_nvm_store_link_info_write(parent_mac_addr, mac_helper_mac16_address_get(cur));
17751779
thread_bootstrap_ready(cur);
17761780

17771781
if(thread_is_router_addr(mac_helper_mac16_address_get(cur))) {
@@ -2221,17 +2225,23 @@ static bool thread_bootstrap_sync_after_reset_start(protocol_interface_info_entr
22212225
uint16_t my_short_address;
22222226
uint8_t parent_mac64[8];
22232227

2224-
if (!thread_nvm_store_link_info_get(parent_mac64, &my_short_address)) {
2228+
int link_info_err = thread_nvm_store_link_info_get(parent_mac64, &my_short_address);
2229+
if ( link_info_err!= THREAD_NVM_FILE_SUCCESS) {
2230+
tr_warning("thread_nvm_store_link_info_get returned %d", link_info_err);
22252231
return false;
22262232
}
2227-
thread_nvm_store_link_info_clear();
2233+
link_info_err = thread_nvm_store_link_info_clear();
2234+
if ( link_info_err!= THREAD_NVM_FILE_SUCCESS) {
2235+
tr_warning("thread_nvm_store_link_info_clear returned %d", link_info_err);
2236+
}
22282237
if (thread_is_router_addr(my_short_address)) {
22292238
thread_info(cur)->routerShortAddress = my_short_address;
22302239
thread_dynamic_storage_build_mle_table(cur->id);
22312240
thread_router_bootstrap_link_synch_start(cur);
22322241
return true;
22332242
}
22342243
if (!thread_parent_data_allocate(cur->thread_info)) {
2244+
tr_info("parent alloc failed");
22352245
return false;
22362246
}
22372247

@@ -2294,16 +2304,6 @@ void thread_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
22942304
tr_debug("Thread SM:Active Scan");
22952305

22962306
thread_joiner_application_nvm_link_configuration_load(cur->id);
2297-
2298-
if (thread_joiner_application_nvm_operation_in_progress(cur->id)) {
2299-
/*
2300-
* joiner application has pending NVM operation in progress,
2301-
* wait it to complete before continuing startup
2302-
*/
2303-
cur->bootsrap_state_machine_cnt = 1;
2304-
return;
2305-
}
2306-
23072307
linkConfiguration = thread_joiner_application_get_config(cur->id);
23082308
if (!linkConfiguration) {
23092309
thread_bootstrap_start_network_discovery(cur);
@@ -3023,10 +3023,10 @@ void thread_bootstrap_dynamic_configuration_save(protocol_interface_info_entry_t
30233023
// in error situation this returns 0 !!!!
30243024
uint32_t mle_frame_counter = mle_service_security_get_frame_counter(cur->id);
30253025
if (linkConfiguration) {
3026-
thread_nvm_store_fast_data_check_and_store(mac_frame_counter, mle_frame_counter, linkConfiguration->key_sequence);
3026+
thread_nvm_store_fast_data_check_and_write(mac_frame_counter, mle_frame_counter, linkConfiguration->key_sequence);
30273027
}
30283028
else {
3029-
thread_nvm_store_frame_counters_check_and_store(mac_frame_counter, mle_frame_counter);
3029+
thread_nvm_store_frame_counters_check_and_write(mac_frame_counter, mle_frame_counter);
30303030
}
30313031
}
30323032

source/6LoWPAN/Thread/thread_common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ int8_t thread_bootstrap_down(protocol_interface_info_entry_t *cur)
245245
}
246246
mac_helper_link_frame_counter_read(cur->id, &fast_data.mac_frame_counter);
247247
fast_data.mle_frame_counter=mle_service_security_get_frame_counter(cur->id);
248-
thread_nvm_store_fast_data_store(&fast_data);
248+
thread_nvm_store_fast_data_write(&fast_data);
249+
thread_joiner_application_configuration_nvm_save(cur->id);
249250
mac_pairwise_key_flush_list(cur->id);
250251
thread_discovery_reset(cur->id);
251252
thread_bootstrap_stop(cur);
@@ -981,6 +982,7 @@ void thread_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t ticks)
981982
thread_border_router_seconds_timer(cur->id, ticks);
982983
thread_bbr_seconds_timer(cur->id, ticks);
983984
thread_lowpower_timer(cur, ticks);
985+
thread_nvm_store_seconds_timer(ticks);
984986

985987
if (cur->lowpan_info & INTERFACE_NWK_BOOTSRAP_ACTIVE) {
986988
nwk_bootsrap_state_update(ARM_NWK_BOOTSTRAP_READY, cur);

source/6LoWPAN/Thread/thread_host_bootstrap.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
#include "6LoWPAN/Thread/thread_management_client.h"
6464
#include "6LoWPAN/Thread/thread_network_data_lib.h"
6565
#include "6LoWPAN/Thread/thread_tmfcop_lib.h"
66-
#include "6LoWPAN/Thread/thread_nvm_store.h"
6766
#include "thread_management_if.h"
6867
#include "Common_Protocols/ipv6.h"
6968
#include "MPL/mpl.h"

0 commit comments

Comments
 (0)