Skip to content

Commit 4f23008

Browse files
KariHaapalehtoArto Kinnunen
authored andcommitted
(via Mbed OS) This is a initial version of Wi-Sun interface implementation.
To get Wi-Sun mesh network working, also nanostack with Wi-Sun support is needed. ws_empty_functions.c and ws_management_api.h are temporary included here, so that wisun_tasklet will compiled without problems. They will replaced with the official versions with next nanostack release.
1 parent e029444 commit 4f23008

File tree

1 file changed

+233
-0
lines changed

1 file changed

+233
-0
lines changed

source/6LoWPAN/ws/ws_management_api.h

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
/*
2+
* Copyright (c) 2018, Arm Limited and affiliates.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/**
19+
* \file ws_management_if.h
20+
* \brief Wi-SUN management interface.
21+
*
22+
* This interface is used for configuring Wi-SUN devices.
23+
* After creating the Wi-SUN interface, you can use this interface to configure the Wi-SUN device
24+
* behaviour. When you are done with the configurations, you need to call interface up to enable a Wi-SUN node.
25+
*
26+
*/
27+
28+
#ifndef WS_MANAGEMENT_API_H_
29+
#define WS_MANAGEMENT_API_H_
30+
31+
#include "ns_types.h"
32+
#include "net_interface.h" /* Declaration for channel_list_s. */
33+
34+
#ifdef __cplusplus
35+
extern "C" {
36+
#endif
37+
38+
/* Regulatory domain values*/
39+
#define REG_DOMAIN_WW 0x00 // World wide
40+
#define REG_DOMAIN_NA 0x01 // North America
41+
#define REG_DOMAIN_JP 0x02 // Japan
42+
#define REG_DOMAIN_EU 0x03 // European Union
43+
#define REG_DOMAIN_CH 0x04 // China
44+
#define REG_DOMAIN_IN 0x05 // India
45+
#define REG_DOMAIN_MX 0x06 //
46+
#define REG_DOMAIN_BZ 0x07 // Brazil
47+
#define REG_DOMAIN_AZ 0x08 // Australia
48+
#define REG_DOMAIN_NZ 0x08 // New zealand
49+
#define REG_DOMAIN_KR 0x09 // Korea
50+
#define REG_DOMAIN_PH 0x0A //
51+
#define REG_DOMAIN_MY 0x0B //
52+
#define REG_DOMAIN_HK 0x0C //
53+
#define REG_DOMAIN_SG 0x0D // band 866-869
54+
#define REG_DOMAIN_TH 0x0E //
55+
#define REG_DOMAIN_VN 0x0F //
56+
#define REG_DOMAIN_SG_H 0x10 // band 920-925
57+
58+
#define OPERATING_MODE_1a 0x1a
59+
#define OPERATING_MODE_1b 0x1b
60+
#define OPERATING_MODE_2a 0x2a
61+
#define OPERATING_MODE_2b 0x2b
62+
#define OPERATING_MODE_3 0x03
63+
#define OPERATING_MODE_4a 0x4a
64+
#define OPERATING_MODE_4b 0x4b
65+
#define OPERATING_MODE_5 0x05
66+
67+
#define CHANNEL_FUNCTION_FIXED 0x00 // Fixed channel
68+
#define CHANNEL_FUNCTION_TR51CF 0x01 // TR51CF
69+
#define CHANNEL_FUNCTION_DH1CF 0x02 // Direct Hash
70+
#define CHANNEL_FUNCTION_VENDOR_DEFINED 0x03 // vendor given channel hop schedule
71+
72+
#define CHANNEL_SPACING_200 0x00 // 200 khz
73+
#define CHANNEL_SPACING_400 0x01 // 400 khz
74+
#define CHANNEL_SPACING_600 0x02 // 600 khz
75+
#define CHANNEL_SPACING_100 0x03 // 100 khz
76+
#define CHANNEL_SPACING_250 0x04 // 250 khz
77+
78+
79+
/** Temporary API change flag. this will be removed when new version of API is implemented on applications
80+
*
81+
*/
82+
#define WS_MANAGEMENT_API_VER_2
83+
84+
/**
85+
* Initialize Wi-SUN stack.
86+
*
87+
* Generates the default configuration for Wi-SUN operation
88+
*
89+
* \param interface_id Network interface ID.
90+
* \param regulatory_domain Mandatory regulatory domain value of the device.
91+
* \param network_name_ptr Network name where to join if no configuration found from storage.
92+
* \param fhss_timer_ptr FHSS functions for timer adaptation to platform.
93+
*
94+
* \return 0, Init OK.
95+
* \return <0 Init fail.
96+
*/
97+
int ws_management_node_init(
98+
int8_t interface_id,
99+
uint8_t regulatory_domain,
100+
char *network_name_ptr,
101+
fhss_timer_t *fhss_timer_ptr);
102+
103+
/**
104+
* Configure regulatory domain of Wi-SUN stack.
105+
*
106+
* Change the default configuration for Wi-SUN PHY operation.
107+
*
108+
* Supported values:
109+
* Domain: "NA"(0x01), "KR"(0x09)
110+
* Operating class: (1), (2)
111+
* operation mode: "1b" (symbol rate 50, modulation index 1)
112+
*
113+
* if value of 255 is given then previous value is used.
114+
*
115+
* \param interface_id Network interface ID.
116+
* \param regulatory_domain FHSS regulatory domain default to "KR" 0x09.
117+
* \param operating_class FHSS operating class default to 1.
118+
* \param operating_mode FHSS phy operating mode default to "1b".
119+
*
120+
* \return 0, Init OK.
121+
* \return <0 Init fail.
122+
*/
123+
int ws_management_regulatory_domain_set(
124+
int8_t interface_id,
125+
uint8_t regulatory_domain,
126+
uint8_t operating_class,
127+
uint8_t operating_mode);
128+
129+
/**
130+
* Set channel mask for FHSS operation.
131+
*
132+
* Default value: all channels are allowed.
133+
*
134+
* \param interface_id Network interface ID.
135+
* \param channel_mask set bits matching the channel 1 to allow channel 0 to disallow.
136+
*
137+
* \return 0, Init OK.
138+
* \return <0 Init fail.
139+
*/
140+
int ws_management_channel_mask_set(
141+
int8_t interface_id,
142+
uint32_t channel_mask[8]);
143+
144+
/**
145+
* Configure Application defined channel plan.
146+
*
147+
* Change the application defined channel plan.
148+
* This changes our channel plan that is reported to our children.
149+
* PHY driver must be configured to follow these settings to make the configuration active.
150+
*
151+
*
152+
* \param interface_id Network interface ID.
153+
* \param channel_plan Channel plan must be 1 application defined if deviating from regulatory domain (0).
154+
* \param uc_channel_function 0: Fixed channel, 1:TR51CF, 2: Direct Hash, 3: Vendor defined.
155+
* \param bc_channel_function 0: Fixed channel, 1:TR51CF, 2: Direct Hash, 3: Vendor defined.
156+
* \param ch0_freq ch0 center frequency.
157+
* \param channel_spacing Channel spacing value 0:200k, 1:400k, 2:600k, 3:100k.
158+
* \param number_of_channels FHSS phy operating mode default to "1b".
159+
*
160+
* \return 0, Init OK.
161+
* \return <0 Init fail.
162+
*/
163+
int ws_management_channel_plan_set(
164+
int8_t interface_id,
165+
uint8_t channel_plan,
166+
uint8_t uc_channel_function,
167+
uint8_t bc_channel_function,
168+
uint32_t ch0_freq, // Stack can not modify this
169+
uint8_t channel_spacing,// Stack can not modify this
170+
uint8_t number_of_channels);// Stack can not modify this
171+
172+
/**
173+
* Configure timing values for FHSS.
174+
*
175+
* Change the default configuration for Wi-SUN FHSS operation.
176+
*
177+
* \param interface_id Network interface ID.
178+
* \param fhss_uc_dwell_interval default to 250 ms.
179+
* \param fhss_broadcast_interval default to 800 ms.
180+
* \param fhss_bc_dwell_interval default to 200 ms.
181+
*
182+
* \return 0, Init OK.
183+
* \return <0 Init fail.
184+
*/
185+
int ws_management_fhss_timing_configure(
186+
int8_t interface_id,
187+
uint8_t fhss_uc_dwell_interval,
188+
uint32_t fhss_broadcast_interval,
189+
uint8_t fhss_bc_dwell_interval);
190+
191+
/**
192+
* Configure unicast channel function.
193+
*
194+
* Change the default configuration for Wi-SUN FHSS operation.
195+
* if application defined is used the behaviour is undefined
196+
*
197+
* \param interface_id Network interface ID.
198+
* \param channel_function Unicast channel function.
199+
* \param fixed_channel Used channel when channel function is fixed channel. If 0xFFFF, randomly chosen channel is used.
200+
* \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
201+
*
202+
* \return 0, Init OK.
203+
* \return <0 Init fail.
204+
*/
205+
int ws_management_fhss_unicast_channel_function_configure(
206+
int8_t interface_id,
207+
uint8_t channel_function,
208+
uint16_t fixed_channel,
209+
uint8_t dwell_interval);
210+
211+
/**
212+
* Configure broadcast channel function.
213+
*
214+
* Change the default configuration for Wi-SUN FHSS operation.
215+
* if application defined is used the behaviour is undefined
216+
*
217+
* \param interface_id Network interface ID.
218+
* \param channel_function Broadcast channel function.
219+
* \param fixed_channel Used channel when channel function is fixed channel. If 0xFFFF, randomly chosen channel is used.
220+
* \param dwell_interval Broadcast channel dwell interval.
221+
* \param broadcast_interval Broadcast interval.
222+
*
223+
* \return 0, Init OK.
224+
* \return <0 Init fail.
225+
*/
226+
int ws_management_fhss_broadcast_channel_function_configure(
227+
int8_t interface_id,
228+
uint8_t channel_function,
229+
uint16_t fixed_channel,
230+
uint8_t dwell_interval,
231+
uint32_t broadcast_interval);
232+
233+
#endif /* WS_MANAGEMENT_API_H_ */

0 commit comments

Comments
 (0)