Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
ws_common_defines.h
00001 /* 00002 * Copyright (c) 2018-2019, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef WS_COMMON_DEFINES_H_ 00019 #define WS_COMMON_DEFINES_H_ 00020 00021 #define WH_IE_ELEMENT_HEADER_LENGTH 3 00022 00023 /* Header IE Sub elements */ 00024 #define WH_IE_UTT_TYPE 1 /**< Unicast Timing and Frame type information */ 00025 #define WH_IE_BT_TYPE 2 /**< Broadcast timing information */ 00026 #define WH_IE_FC_TYPE 3 /**< Flow Control for Extended Direct Frame Exchange */ 00027 #define WH_IE_RSL_TYPE 4 /**< Received Signal Level information */ 00028 #define WH_IE_MHDS_TYPE 5 /**< MHDS information for mesh routing */ 00029 #define WH_IE_VH_TYPE 6 /**< Vendor header information */ 00030 #define WH_IE_EA_TYPE 9 /**< Eapol Auhtenticator EUI-64 header information */ 00031 00032 #define WS_WP_NESTED_IE 4 /**< WS nested Payload IE element'selement could include mltiple sub payload IE */ 00033 00034 #define WS_WP_SUB_IE_ELEMENT_HEADER_LENGTH 2 00035 00036 /* Payload IE sub elements in side WS_WP_NESTED_IE */ 00037 #define WP_PAYLOAD_IE_US_TYPE 1 /**< Unicast Schedule information */ 00038 #define WP_PAYLOAD_IE_BS_TYPE 2 /**< Broadcast Schedule information */ 00039 #define WP_PAYLOAD_IE_VP_TYPE 3 /**< Vendor Payload information */ 00040 #define WP_PAYLOAD_IE_PAN_TYPE 4 /**< PAN Information */ 00041 #define WP_PAYLOAD_IE_NETNAME_TYPE 5 /**< Network Name information */ 00042 #define WP_PAYLOAD_IE_PAN_VER_TYPE 6 /**< Pan configuration version */ 00043 #define WP_PAYLOAD_IE_GTKHASH_TYPE 7 /**< GTK Hash information */ 00044 00045 /* WS frame types to WH_IE_UTT_TYPE */ 00046 #define WS_FT_PAN_ADVERT 0 /**< PAN Advert */ 00047 #define WS_FT_PAN_ADVERT_SOL 1 /**< PAN Advert Solicit */ 00048 #define WS_FT_PAN_CONF 2 /**< PAN Config */ 00049 #define WS_FT_PAN_CONF_SOL 3 /**< PAN Config Solicit */ 00050 #define WS_FT_DATA 4 /**< data type inside MPX */ 00051 #define WS_FT_ACK 5 /**< Enhanced ACK */ 00052 #define WS_FT_EAPOL 6 /**< EAPOL message inside MPX */ 00053 00054 00055 /** 00056 * @brief ws_pan_information_t PAN information 00057 */ 00058 typedef struct ws_pan_information_s { 00059 uint16_t pan_size; /**< Number devices connected to Border Router. */ 00060 uint16_t routing_cost; /**< ETX to border Router. */ 00061 uint16_t pan_version; /**< Pan configuration version will be updatd by Border router at PAN. */ 00062 bool use_parent_bs: 1; /**< 1 for force to follow parent broadcast schedule. 0 node may define own schedule. */ 00063 bool rpl_routing_method: 1; /**< 1 when RPL routing is selected and 0 when L2 routing. */ 00064 unsigned version: 3; /**< Pan version support. */ 00065 } ws_pan_information_t; 00066 00067 /** 00068 * @brief ws_hopping_schedule_t Chanel hopping schedule information 00069 */ 00070 typedef struct ws_hopping_schedule_s { 00071 uint8_t fhss_uc_dwell_interval; 00072 uint8_t fhss_bc_dwell_interval; 00073 uint8_t regulatory_domain; /**< PHY regulatory domain default to "KR" 0x09 */ 00074 uint8_t operating_class; /**< PHY operating class default to 1 */ 00075 uint8_t operating_mode; /**< PHY operating mode default to "1b" symbol rate 50, modulation index 1 */ 00076 uint8_t channel_plan; /**< 0: use regulatory domain values 1: application defined plan */ 00077 uint8_t uc_channel_function; /**< 0: Fixed channel, 1:TR51CF, 2: Direct Hash, 3: Vendor defined */ 00078 uint8_t bc_channel_function; /**< 0: Fixed channel, 1:TR51CF, 2: Direct Hash, 3: Vendor defined */ 00079 uint8_t channel_spacing; /**< derived from regulatory domain. 0:200k, 1:400k, 2:600k, 3:100k */ 00080 uint8_t number_of_channels; /**< derived from regulatory domain */ 00081 uint8_t clock_drift; 00082 uint8_t timing_accurancy; 00083 uint16_t uc_fixed_channel; 00084 uint16_t bc_fixed_channel; 00085 uint16_t fhss_bsi; 00086 uint32_t fhss_broadcast_interval; 00087 uint32_t channel_mask[8]; 00088 uint_fast24_t ch0_freq; // Default should be derived from regulatory domain 00089 } ws_hopping_schedule_t; 00090 00091 /** 00092 * @brief ws_utt_ie_t WS UTT-IE 00093 */ 00094 typedef struct ws_utt_ie { 00095 uint8_t message_type; 00096 uint_fast24_t ufsi; 00097 } ws_utt_ie_t; 00098 00099 /** 00100 * @brief ws_bt_ie_t WS BT-IE read 00101 */ 00102 typedef struct ws_bt_ie { 00103 uint16_t broadcast_slot_number; 00104 uint_fast24_t broadcast_interval_offset; 00105 } ws_bt_ie_t; 00106 00107 00108 /** 00109 * @brief ws_channel_plan_zero_t WS channel plan 0 define domain and class 00110 */ 00111 typedef struct ws_channel_plan_zero { 00112 uint8_t regulator_domain; 00113 uint8_t operation_class; 00114 } ws_channel_plan_zero_t; 00115 00116 /** 00117 * @brief ws_channel_plan_one_t WS channel plan 1 define ch0, spasing and channel count 00118 */ 00119 typedef struct ws_channel_plan_one { 00120 uint_fast24_t ch0; 00121 unsigned channel_spacing: 4; 00122 uint16_t number_of_channel; 00123 } ws_channel_plan_one_t; 00124 00125 /** 00126 * @brief ws_channel_function_zero_t WS function 0 fixed channel 00127 */ 00128 typedef struct ws_channel_function_zero { 00129 uint16_t fixed_channel; 00130 } ws_channel_function_zero_t; 00131 00132 /** 00133 * @brief ws_channel_function_three_t WS function 3 vendor spesific channel hop 00134 */ 00135 typedef struct ws_channel_function_three { 00136 uint8_t channel_hop_count; 00137 uint8_t *channel_list; 00138 } ws_channel_function_three_t; 00139 00140 /** 00141 * @brief ws_us_ie_t WS US-IE read 00142 */ 00143 typedef struct ws_us_ie { 00144 uint8_t dwell_interval; 00145 uint8_t clock_drift; 00146 uint8_t timing_accurancy; 00147 unsigned channel_plan: 3; 00148 unsigned channel_function: 3; 00149 unsigned excluded_channel_ctrl: 2; 00150 union { 00151 ws_channel_plan_zero_t zero; 00152 ws_channel_plan_one_t one; 00153 } plan; 00154 union { 00155 ws_channel_function_zero_t zero; 00156 ws_channel_function_three_t three; 00157 } function; 00158 } ws_us_ie_t; 00159 00160 /** 00161 * @brief ws_bs_ie_t WS BS-IE read 00162 */ 00163 typedef struct ws_bs_ie { 00164 uint32_t broadcast_interval; 00165 uint16_t broadcast_schedule_identifier; 00166 uint8_t dwell_interval; 00167 uint8_t clock_drift; 00168 uint8_t timing_accurancy; 00169 unsigned channel_plan: 3; 00170 unsigned channel_function: 3; 00171 unsigned excluded_channel_ctrl: 2; 00172 union { 00173 ws_channel_plan_zero_t zero; 00174 ws_channel_plan_one_t one; 00175 } plan; 00176 union { 00177 ws_channel_function_zero_t zero; 00178 ws_channel_function_three_t three; 00179 } function; 00180 } ws_bs_ie_t; 00181 00182 00183 #define MPX_KEY_MANAGEMENT_ENC_USER_ID 0x0001 /**< MPX Key management user ID */ 00184 #define MPX_LOWPAN_ENC_USER_ID 0xA0ED /**< MPX Lowpan User Id */ 00185 00186 #define WS_FAN_VERSION_1_0 1 00187 00188 #define WS_NEIGHBOR_LINK_TIMEOUT 2200 00189 #define WS_NEIGHBOR_TEMPORARY_LINK_MIN_TIMEOUT_LARGE 520 00190 #define WS_NEIGHBOR_TEMPORARY_LINK_MIN_TIMEOUT_SMALL 260 00191 #define WS_NEIGHBOR_NUD_TIMEOUT WS_NEIGHBOR_LINK_TIMEOUT / 2 00192 00193 #define WS_NEIGBOR_ETX_SAMPLE_MAX 3 00194 #define WS_NEIGHBOUR_MAX_CANDIDATE_PROBE 5 00195 00196 #define WS_PROBE_INIT_BASE_SECONDS 8 00197 00198 #define WS_NUD_RAND_PROBABILITY 1 00199 00200 #define WS_NUD_RANDOM_SAMPLE_LENGTH WS_NEIGHBOR_NUD_TIMEOUT / 2 00201 00202 #define WS_NUD_RANDOM_COMPARE (WS_NUD_RAND_PROBABILITY*WS_NUD_RANDOM_SAMPLE_LENGTH) / 100 00203 00204 #define WS_ETX_MIN_SAMPLE_COUNT 4 00205 00206 #define WS_ETX_MAX_UPDATE 1024 00207 00208 #define WS_ETX_MIN_WAIT_TIME 60 00209 00210 #define WS_RPL_PARENT_CANDIDATE_MAX 5 00211 #define WS_RPL_SELECTED_PARENT_MAX 2 00212 00213 #define WS_CERTIFICATE_RPL_PARENT_CANDIDATE_MAX 8 00214 #define WS_CERTIFICATE_RPL_SELECTED_PARENT_MAX 3 00215 00216 /** 00217 * Wi-sun spesific non-preferred prefix policy label 00218 */ 00219 00220 #define WS_NON_PREFFRED_LABEL 36 00221 00222 /* 00223 * Threshold (referenced to DEVICE_MIN_SENS) above which a neighbor node may be considered for inclusion into candidate parent set 00224 */ 00225 #define CAND_PARENT_THRESHOLD 10 00226 /* 00227 * Hysteresis factor to be applied to CAND_PARENT_THRESHOLD when admitting or dropping nodes from the candidate parent set. 00228 */ 00229 #define CAND_PARENT_HYSTERISIS 3 00230 00231 /* 00232 * value when send the first RPL DIS in 100ms ticks. Value is randomized between timeout/2 - timeout 00233 */ 00234 #define WS_RPL_DIS_INITIAL_TIMEOUT 600 00235 /* 00236 * value when send subsequent RPL DIS in 100 ms tics. Value is randomized between timeout/2 - timeout 00237 */ 00238 #define WS_RPL_DIS_TIMEOUT 1800 00239 00240 /* 00241 * MAC Ack wait duration in symbols. 2-FSK modulation used -> 1 bit per symbol. 00242 */ 00243 #define WS_ACK_WAIT_SYMBOLS 800 00244 00245 /* 00246 * Tack max time in milliseconds. 00247 */ 00248 #define WS_TACK_MAX_MS 5 00249 00250 // With FHSS we need to check CCA twice on TX channel 00251 #define WS_NUMBER_OF_CSMA_PERIODS 2 00252 // Interval between two CCA checks 00253 #define WS_CSMA_MULTI_CCA_INTERVAL 1000 00254 00255 /* Default FHSS timing information 00256 * 00257 */ 00258 #define WS_FHSS_UC_DWELL_INTERVAL 255; 00259 #define WS_FHSS_BC_INTERVAL 1020; 00260 #define WS_FHSS_BC_DWELL_INTERVAL 255; 00261 00262 /* 00263 * EAPOL relay and PAE authenticator socket settings 00264 */ 00265 #define EAPOL_RELAY_SOCKET_PORT 10253 00266 #define BR_EAPOL_RELAY_SOCKET_PORT 10255 00267 #define PAE_AUTH_SOCKET_PORT 10254 00268 00269 #endif /* WS_COMMON_DEFINES_H_ */
Generated on Tue Jul 12 2022 13:55:04 by
