Skip to content

Commit 036e19c

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
Api Updates to LLC, ws_ie_lib and ws_info
Geneates new structure for channel hopping schedule information and integrate that to current code. ws_hoopping_schedule_t Implemetent unicast and brodacst hopping schedule build and length calculation functions. ws_wp_nested_hopping_schedule_write() and ws_wp_nested_hopping_schedule_length(). Removed same time seperate unicast and brodacast write. Asynch message request implemetation to bootstrap.
1 parent 192007b commit 036e19c

File tree

13 files changed

+355
-201
lines changed

13 files changed

+355
-201
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
#include "6LoWPAN/MAC/mac_helper.h"
2828
#include "6LoWPAN/MAC/mac_data_poll.h"
2929
#include "6LoWPAN/MAC/mpx_api.h"
30+
#include "6LoWPAN/ws/ws_common_defines.h"
3031
#include "6LoWPAN/ws/ws_common.h"
3132
#include "6LoWPAN/ws/ws_bootstrap.h"
3233
#include "RPL/rpl_control.h"
3334
#include "RPL/rpl_data.h"
3435
#include "Common_Protocols/icmpv6.h"
3536
#include "Common_Protocols/icmpv6_radv.h"
36-
#include "6LoWPAN/ws/ws_common_defines.h"
3737
#include "6LoWPAN/ws/ws_llc.h"
3838
#include "6LoWPAN/lowpan_adaptation_interface.h"
3939

@@ -132,7 +132,11 @@ static int8_t ws_bootsrap_event_trig(ws_bootsrap_event_type_e event_type, int8_t
132132
if (ret_val) {
133133
goto cleanup;
134134
}
135-
135+
//Set Network names, Pan information configure, hopping schedule & GTKHash
136+
ws_llc_set_network_name(cur, (uint8_t*)cur->ws_info->network_name, strlen(cur->ws_info->network_name));
137+
ws_llc_set_pan_information_pointer(cur, &cur->ws_info->pan_configuration);
138+
ws_llc_hopping_schedule_config(cur, &cur->ws_info->hopping_schdule);
139+
ws_llc_set_gtkhash(cur, cur->ws_info->gtkhash);
136140
/* Disable SLLAO send/mandatory receive with the ARO */
137141
cur->ipv6_neighbour_cache.use_eui64_as_slla_in_aro = true;
138142

@@ -278,6 +282,7 @@ int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
278282
return -4;
279283
}
280284

285+
281286
cur->if_up = ws_bootstrap_up;
282287
cur->if_down = ws_bootstrap_down;
283288

@@ -376,6 +381,84 @@ void ws_bootstrap_event_routing_ready(protocol_interface_info_entry_t *cur)
376381
ws_bootsrap_event_trig(WS_ROUTING_READY, cur->bootStrapId, ARM_LIB_LOW_PRIORITY_EVENT);
377382
}
378383

384+
385+
static void ws_bootstrap_pan_advert_solicit(protocol_interface_info_entry_t *cur)
386+
{
387+
asynch_request_t async_req;
388+
memset(&async_req, 0, sizeof(asynch_request_t));
389+
async_req.message_type = WS_FT_PAN_ADVERT_SOL;
390+
//Request UTT Header and US and Net name from payload
391+
async_req.wh_requested_ie_list.utt_ie = true;
392+
async_req.wp_requested_nested_ie_list.us_ie = true;
393+
async_req.wp_requested_nested_ie_list.net_name_ie = true;
394+
for (int i=0; i<8; i++) {
395+
async_req.channel_list.channel_mask[i] = cur->ws_info->hopping_schdule.channel_mask[i];
396+
}
397+
async_req.channel_list.channel_page = CHANNEL_PAGE_0;
398+
async_req.security.SecurityLevel = 0;
399+
400+
ws_llc_asynch_request(cur, &async_req);
401+
}
402+
403+
static void ws_bootstrap_pan_config_solicit(protocol_interface_info_entry_t *cur)
404+
{
405+
asynch_request_t async_req;
406+
memset(&async_req, 0, sizeof(asynch_request_t));
407+
async_req.message_type = WS_FT_PAN_CONF_SOL;
408+
//Request UTT Header and US and Net name from payload
409+
async_req.wh_requested_ie_list.utt_ie = true;
410+
async_req.wp_requested_nested_ie_list.us_ie = true;
411+
async_req.wp_requested_nested_ie_list.net_name_ie = true;
412+
for (int i=0; i<8; i++) {
413+
async_req.channel_list.channel_mask[i] = cur->ws_info->hopping_schdule.channel_mask[i];
414+
}
415+
async_req.channel_list.channel_page = CHANNEL_PAGE_0;
416+
async_req.security.SecurityLevel = 0;
417+
418+
ws_llc_asynch_request(cur, &async_req);
419+
}
420+
421+
static void ws_bootstrap_pan_advert(protocol_interface_info_entry_t *cur)
422+
{
423+
asynch_request_t async_req;
424+
memset(&async_req, 0, sizeof(asynch_request_t));
425+
async_req.message_type = WS_FT_PAN_ADVERT;
426+
//Request UTT Header, Pan information and US and Net name from payload
427+
async_req.wh_requested_ie_list.utt_ie = true;
428+
async_req.wp_requested_nested_ie_list.us_ie = true;
429+
async_req.wp_requested_nested_ie_list.pan_ie = true;
430+
async_req.wp_requested_nested_ie_list.net_name_ie = true;
431+
for (int i=0; i<8; i++) {
432+
async_req.channel_list.channel_mask[i] = cur->ws_info->hopping_schdule.channel_mask[i];
433+
}
434+
async_req.channel_list.channel_page = CHANNEL_PAGE_0;
435+
async_req.security.SecurityLevel = 0;
436+
437+
ws_llc_asynch_request(cur, &async_req);
438+
}
439+
440+
static void ws_bootstrap_pan_config(protocol_interface_info_entry_t *cur)
441+
{
442+
asynch_request_t async_req;
443+
memset(&async_req, 0, sizeof(asynch_request_t));
444+
async_req.message_type = WS_FT_PAN_CONF;
445+
//Request UTT Header, Pan information and US and Net name from payload
446+
async_req.wh_requested_ie_list.utt_ie = true;
447+
async_req.wp_requested_nested_ie_list.us_ie = true;
448+
async_req.wp_requested_nested_ie_list.bs_ie = true;
449+
async_req.wp_requested_nested_ie_list.pan_version_ie = true;
450+
async_req.wp_requested_nested_ie_list.gtkhash_ie = true;
451+
async_req.wp_requested_nested_ie_list.vp_ie = true;
452+
for (int i=0; i<8; i++) {
453+
async_req.channel_list.channel_mask[i] = cur->ws_info->hopping_schdule.channel_mask[i];
454+
}
455+
async_req.channel_list.channel_page = CHANNEL_PAGE_0;
456+
async_req.security.SecurityLevel = mac_helper_default_security_level_get(cur);
457+
async_req.security.KeyIdMode = mac_helper_default_security_key_id_mode_get(cur);
458+
async_req.security.KeyIndex = mac_helper_default_key_index_get(cur);
459+
ws_llc_asynch_request(cur, &async_req);
460+
}
461+
379462
static void ws_bootstrap_event_handler(arm_event_s *event)
380463
{
381464
ws_bootsrap_event_type_e event_type;

source/6LoWPAN/ws/ws_common.c

Lines changed: 71 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <ns_list.h>
2121
#include <nsdynmemLIB.h>
2222
#include "NWK_INTERFACE/Include/protocol.h"
23+
#include "6LoWPAN/ws/ws_common_defines.h"
2324
#include "6LoWPAN/ws/ws_common.h"
2425
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
2526
#include "ws_management_api.h"
@@ -28,78 +29,78 @@
2829
#define TRACE_GROUP "wscm"
2930
int8_t ws_common_regulatory_domain_config(protocol_interface_info_entry_t *cur)
3031
{
31-
cur->ws_info->channel_plan = 0;
32-
cur->ws_info->channel_function = CHANNEL_FUNCTION_TR51CF;
32+
cur->ws_info->hopping_schdule.channel_plan = 0;
33+
cur->ws_info->hopping_schdule.channel_function = CHANNEL_FUNCTION_TR51CF;
3334

34-
if(cur->ws_info->regulatory_domain == REG_DOMAIN_KR) {
35-
if(cur->ws_info->operating_class == 1) {
36-
cur->ws_info->ch0_freq = 9171;
37-
cur->ws_info->channel_spacing = CHANNEL_SPACING_200;
38-
cur->ws_info->number_of_channels = 32;
39-
} else if(cur->ws_info->operating_class == 2) {
40-
cur->ws_info->ch0_freq = 9173;
41-
cur->ws_info->channel_spacing = CHANNEL_SPACING_400;
42-
cur->ws_info->number_of_channels = 16;
35+
if(cur->ws_info->hopping_schdule.regulatory_domain == REG_DOMAIN_KR) {
36+
if(cur->ws_info->hopping_schdule.operating_class == 1) {
37+
cur->ws_info->hopping_schdule.ch0_freq = 9171;
38+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_200;
39+
cur->ws_info->hopping_schdule.number_of_channels = 32;
40+
} else if(cur->ws_info->hopping_schdule.operating_class == 2) {
41+
cur->ws_info->hopping_schdule.ch0_freq = 9173;
42+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_400;
43+
cur->ws_info->hopping_schdule.number_of_channels = 16;
4344
} else {
4445
return -1;
4546
}
46-
} else if(cur->ws_info->regulatory_domain == REG_DOMAIN_EU) {
47-
if(cur->ws_info->operating_class == 1) {
48-
cur->ws_info->ch0_freq = 8631;
49-
cur->ws_info->channel_spacing = CHANNEL_SPACING_100;
50-
cur->ws_info->number_of_channels = 69;
51-
} else if(cur->ws_info->operating_class == 2) {
52-
cur->ws_info->ch0_freq = 8631;
53-
cur->ws_info->channel_spacing = CHANNEL_SPACING_200;
54-
cur->ws_info->number_of_channels = 35;
55-
} else if(cur->ws_info->operating_class == 3) {
56-
cur->ws_info->ch0_freq = 8701;
57-
cur->ws_info->channel_spacing = CHANNEL_SPACING_100;
58-
cur->ws_info->number_of_channels = 59;
59-
} else if(cur->ws_info->operating_class == 4) {
60-
cur->ws_info->ch0_freq = 8701;
61-
cur->ws_info->channel_spacing = CHANNEL_SPACING_200;
62-
cur->ws_info->number_of_channels = 30;
47+
} else if(cur->ws_info->hopping_schdule.regulatory_domain == REG_DOMAIN_EU) {
48+
if(cur->ws_info->hopping_schdule.operating_class == 1) {
49+
cur->ws_info->hopping_schdule.ch0_freq = 8631;
50+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_100;
51+
cur->ws_info->hopping_schdule.number_of_channels = 69;
52+
} else if(cur->ws_info->hopping_schdule.operating_class == 2) {
53+
cur->ws_info->hopping_schdule.ch0_freq = 8631;
54+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_200;
55+
cur->ws_info->hopping_schdule.number_of_channels = 35;
56+
} else if(cur->ws_info->hopping_schdule.operating_class == 3) {
57+
cur->ws_info->hopping_schdule.ch0_freq = 8701;
58+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_100;
59+
cur->ws_info->hopping_schdule.number_of_channels = 59;
60+
} else if(cur->ws_info->hopping_schdule.operating_class == 4) {
61+
cur->ws_info->hopping_schdule.ch0_freq = 8701;
62+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_200;
63+
cur->ws_info->hopping_schdule.number_of_channels = 30;
6364
} else {
6465
return -1;
6566
}
66-
} else if(cur->ws_info->regulatory_domain == REG_DOMAIN_NA) {
67-
if(cur->ws_info->operating_class == 1) {
68-
cur->ws_info->ch0_freq = 9022;
69-
cur->ws_info->channel_spacing = CHANNEL_SPACING_200;
70-
cur->ws_info->number_of_channels = 129;
71-
} else if(cur->ws_info->operating_class == 2) {
72-
cur->ws_info->ch0_freq = 9024;
73-
cur->ws_info->channel_spacing = CHANNEL_SPACING_400;
74-
cur->ws_info->number_of_channels = 64;
75-
} else if(cur->ws_info->operating_class == 3) {
76-
cur->ws_info->ch0_freq = 9026;
77-
cur->ws_info->channel_spacing = CHANNEL_SPACING_600;
78-
cur->ws_info->number_of_channels = 42;
67+
} else if(cur->ws_info->hopping_schdule.regulatory_domain == REG_DOMAIN_NA) {
68+
if(cur->ws_info->hopping_schdule.operating_class == 1) {
69+
cur->ws_info->hopping_schdule.ch0_freq = 9022;
70+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_200;
71+
cur->ws_info->hopping_schdule.number_of_channels = 129;
72+
} else if(cur->ws_info->hopping_schdule.operating_class == 2) {
73+
cur->ws_info->hopping_schdule.ch0_freq = 9024;
74+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_400;
75+
cur->ws_info->hopping_schdule.number_of_channels = 64;
76+
} else if(cur->ws_info->hopping_schdule.operating_class == 3) {
77+
cur->ws_info->hopping_schdule.ch0_freq = 9026;
78+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_600;
79+
cur->ws_info->hopping_schdule.number_of_channels = 42;
7980
} else {
8081
return -1;
8182
}
82-
} else if(cur->ws_info->regulatory_domain == REG_DOMAIN_JP) {
83-
if(cur->ws_info->operating_class == 1) {
84-
cur->ws_info->ch0_freq = 9206;
85-
cur->ws_info->channel_spacing = CHANNEL_SPACING_200;
86-
cur->ws_info->number_of_channels = 129;
87-
} else if(cur->ws_info->operating_class == 2) {
88-
cur->ws_info->ch0_freq = 9209;
89-
cur->ws_info->channel_spacing = CHANNEL_SPACING_400;
90-
cur->ws_info->number_of_channels = 64;
91-
} else if(cur->ws_info->operating_class == 3) {
92-
cur->ws_info->ch0_freq = 9208;
93-
cur->ws_info->channel_spacing = CHANNEL_SPACING_600;
94-
cur->ws_info->number_of_channels = 42;
83+
} else if(cur->ws_info->hopping_schdule.regulatory_domain == REG_DOMAIN_JP) {
84+
if(cur->ws_info->hopping_schdule.operating_class == 1) {
85+
cur->ws_info->hopping_schdule.ch0_freq = 9206;
86+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_200;
87+
cur->ws_info->hopping_schdule.number_of_channels = 129;
88+
} else if(cur->ws_info->hopping_schdule.operating_class == 2) {
89+
cur->ws_info->hopping_schdule.ch0_freq = 9209;
90+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_400;
91+
cur->ws_info->hopping_schdule.number_of_channels = 64;
92+
} else if(cur->ws_info->hopping_schdule.operating_class == 3) {
93+
cur->ws_info->hopping_schdule.ch0_freq = 9208;
94+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_600;
95+
cur->ws_info->hopping_schdule.number_of_channels = 42;
9596
} else {
9697
return -1;
9798
}
98-
} else if(cur->ws_info->regulatory_domain == REG_DOMAIN_WW) {
99-
if(cur->ws_info->operating_class == 2) {
100-
cur->ws_info->ch0_freq = 24004;
101-
cur->ws_info->channel_spacing = CHANNEL_SPACING_400;
102-
cur->ws_info->number_of_channels = 207;
99+
} else if(cur->ws_info->hopping_schdule.regulatory_domain == REG_DOMAIN_WW) {
100+
if(cur->ws_info->hopping_schdule.operating_class == 2) {
101+
cur->ws_info->hopping_schdule.ch0_freq = 24004;
102+
cur->ws_info->hopping_schdule.channel_spacing = CHANNEL_SPACING_400;
103+
cur->ws_info->hopping_schdule.number_of_channels = 207;
103104
} else {
104105
return -1;
105106
}
@@ -121,16 +122,20 @@ int8_t ws_common_allocate_and_init(protocol_interface_info_entry_t *cur)
121122

122123
memset(cur->ws_info,0, sizeof(ws_info_t));
123124

124-
cur->ws_info->regulatory_domain = REG_DOMAIN_KR;
125-
cur->ws_info->operating_mode = OPERATING_MODE_1a;
126-
cur->ws_info->operating_class = 1;
125+
cur->ws_info->pan_configuration.use_parent_bs = true;
126+
cur->ws_info->pan_configuration.rpl_routing_method = true;
127+
cur->ws_info->pan_configuration.version = WS_FAN_VERSION_1_0;
128+
129+
cur->ws_info->hopping_schdule.regulatory_domain = REG_DOMAIN_KR;
130+
cur->ws_info->hopping_schdule.operating_mode = OPERATING_MODE_1a;
131+
cur->ws_info->hopping_schdule.operating_class = 1;
127132
ws_common_regulatory_domain_config(cur);
128133

129-
cur->ws_info->fhss_uc_dwell_interval = 250;
130-
cur->ws_info->fhss_broadcast_interval = 800;
131-
cur->ws_info->fhss_bc_dwell_interval = 200;
134+
cur->ws_info->hopping_schdule.fhss_uc_dwell_interval = 250;
135+
cur->ws_info->hopping_schdule.fhss_broadcast_interval = 800;
136+
cur->ws_info->hopping_schdule.fhss_bc_dwell_interval = 200;
132137

133-
memset(&cur->ws_info->channel_mask,0xff,sizeof(cur->ws_info->channel_mask));
138+
memset(&cur->ws_info->hopping_schdule.channel_mask,0xff,sizeof(cur->ws_info->hopping_schdule.channel_mask));
134139

135140
return 0;
136141
}

source/6LoWPAN/ws/ws_common.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,20 @@
2020
#include "ns_types.h"
2121
#include "fhss_api.h"
2222
#include "fhss_config.h"
23+
#include "6LoWPAN/ws/ws_common_defines.h"
24+
25+
struct ws_pan_information_s;
26+
27+
#define WS_DEF_NET_NAME "mbedOSRock"
2328

2429
typedef struct ws_info_s {
2530
char network_name[33]; // Network name max 32 octets + terminating 0.
2631
uint16_t network_pan_id;
32+
uint8_t gtkhash[32];
2733

34+
struct ws_pan_information_s pan_configuration;
35+
ws_hoopping_schedule_t hopping_schdule;
2836
struct fhss_timer *fhss_timer_ptr; // Platform adaptation for FHSS timers.
29-
uint8_t fhss_uc_dwell_interval;
30-
uint32_t fhss_broadcast_interval;
31-
uint8_t fhss_bc_dwell_interval;
32-
33-
uint8_t regulatory_domain; // PHY regulatory domain default to "KR" 0x09
34-
uint8_t operating_class;// PHY operating class default to 1
35-
uint8_t operating_mode;// PHY operating mode default to "1b" symbol rate 50, modulation index 1
36-
uint8_t channel_plan; // 0: use regulatory domain values 1: application defined plan
37-
uint8_t channel_function; // 0: Fixed channel, 1:TR51CF, 2: Direct Hash, 3: Vendor defined
38-
uint32_t ch0_freq; // Default should be derived from regulatory domain
39-
uint8_t channel_spacing;// derived from regulatory domain. 0:200k, 1:400k, 2:600k, 3:100k
40-
uint8_t number_of_channels;// derived from regulatory domain
41-
uint32_t channel_mask[8];
42-
4337
} ws_info_t;
4438

4539
#ifdef HAVE_WS

source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,33 @@ typedef struct ws_pan_information_s {
6363
unsigned version:3; /**< Pan version support. */
6464
} ws_pan_information_t;
6565

66+
/**
67+
* @brief ws_hoopping_schedule_t Chanel hopping schedule information
68+
*/
69+
typedef struct ws_hoopping_schedule_s {
70+
uint8_t fhss_uc_dwell_interval;
71+
uint8_t fhss_bc_dwell_interval;
72+
uint8_t regulatory_domain; /**< PHY regulatory domain default to "KR" 0x09 */
73+
uint8_t operating_class; /**< PHY operating class default to 1 */
74+
uint8_t operating_mode; /**< PHY operating mode default to "1b" symbol rate 50, modulation index 1 */
75+
uint8_t channel_plan; /**< 0: use regulatory domain values 1: application defined plan */
76+
uint8_t channel_function; /**< 0: Fixed channel, 1:TR51CF, 2: Direct Hash, 3: Vendor defined */
77+
uint8_t channel_spacing; /**< derived from regulatory domain. 0:200k, 1:400k, 2:600k, 3:100k */
78+
uint8_t number_of_channels; /**< derived from regulatory domain */
79+
uint8_t clock_drift;
80+
uint8_t timing_accurancy;
81+
uint16_t fixed_channel;
82+
uint16_t fhss_bsi;
83+
uint32_t fhss_broadcast_interval;
84+
uint32_t channel_mask[8];
85+
uint_fast24_t ch0_freq; // Default should be derived from regulatory domain
86+
} ws_hoopping_schedule_t;
87+
6688

6789
#define MPX_KEY_MANAGEMENT_ENC_USER_ID 0x0001 /**< MPX Key management user ID */
6890
#define MPX_LOWPAN_ENC_USER_ID 0xA0ED /**< MPX Lowpan User Id */
6991

92+
#define WS_FAN_VERSION_1_0 1
93+
7094

7195
#endif /* WS_COMMON_DEFINES_H_ */

0 commit comments

Comments
 (0)