takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ws_common_defines.h Source File

ws_common_defines.h

00001 /*
00002  * Copyright (c) 2016-2018, 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 
00031 #define WS_WP_NESTED_IE             4 /**< WS nested Payload IE element'selement could include mltiple sub payload IE */
00032 
00033 #define WS_WP_SUB_IE_ELEMENT_HEADER_LENGTH 2
00034 
00035 /* Payload IE sub elements in side WS_WP_NESTED_IE */
00036 #define WP_PAYLOAD_IE_US_TYPE       1   /**< Unicast Schedule information */
00037 #define WP_PAYLOAD_IE_BS_TYPE       2   /**< Broadcast Schedule information */
00038 #define WP_PAYLOAD_IE_VP_TYPE       3   /**< Vendor Payload information */
00039 #define WP_PAYLOAD_IE_PAN_TYPE      4   /**< PAN Information */
00040 #define WP_PAYLOAD_IE_NETNAME_TYPE  5   /**< Network Name information */
00041 #define WP_PAYLOAD_IE_PAN_VER_TYPE  6   /**< Pan configuration version */
00042 #define WP_PAYLOAD_IE_GTKHASH_TYPE  7   /**< GTK Hash information */
00043 
00044 /* WS frame types to WH_IE_UTT_TYPE */
00045 #define WS_FT_PAN_ADVERT        0          /**< PAN Advert */
00046 #define WS_FT_PAN_ADVERT_SOL    1          /**< PAN Advert Solicit */
00047 #define WS_FT_PAN_CONF          2          /**< PAN Config */
00048 #define WS_FT_PAN_CONF_SOL      3          /**< PAN Config Solicit */
00049 #define WS_FT_DATA              4          /**< data type inside MPX */
00050 #define WS_FT_ACK               5          /**< Enhanced ACK */
00051 #define WS_FT_EAPOL             6          /**< EAPOL message inside MPX */
00052 
00053 
00054 /**
00055  * @brief ws_pan_information_t PAN information
00056  */
00057 typedef struct ws_pan_information_s {
00058     uint16_t pan_size;          /**< Number devices connected to Border Router. */
00059     uint16_t routing_cost;      /**< ETX to border Router. */
00060     uint16_t pan_version;       /**< Pan configuration version will be updatd by Border router at PAN. */
00061     bool use_parent_bs:1;       /**< 1 for force to follow parent broadcast schedule. 0 node may define own schedule. */
00062     bool rpl_routing_method:1;  /**< 1 when RPL routing is selected and 0 when L2 routing. */
00063     unsigned version:3;         /**< Pan version support. */
00064 } ws_pan_information_t;
00065 
00066 /**
00067  * @brief ws_hopping_schedule_t Chanel hopping schedule information
00068  */
00069 typedef struct ws_hopping_schedule_s {
00070     uint8_t fhss_uc_dwell_interval;
00071     uint8_t fhss_bc_dwell_interval;
00072     uint8_t regulatory_domain;          /**< PHY regulatory domain default to "KR" 0x09 */
00073     uint8_t operating_class;            /**< PHY operating class default to 1 */
00074     uint8_t operating_mode;             /**< PHY operating mode default to "1b" symbol rate 50, modulation index 1 */
00075     uint8_t channel_plan;               /**< 0: use regulatory domain values 1: application defined plan */
00076     uint8_t channel_function;           /**< 0: Fixed channel, 1:TR51CF, 2: Direct Hash, 3: Vendor defined */
00077     uint8_t channel_spacing;            /**< derived from regulatory domain. 0:200k, 1:400k, 2:600k, 3:100k */
00078     uint8_t number_of_channels;         /**< derived from regulatory domain */
00079     uint8_t clock_drift;
00080     uint8_t timing_accurancy;
00081     uint16_t fixed_channel;
00082     uint16_t fhss_bsi;
00083     uint32_t fhss_broadcast_interval;
00084     uint32_t channel_mask[8];
00085     uint_fast24_t ch0_freq; // Default should be derived from regulatory domain
00086 } ws_hopping_schedule_t;
00087 
00088 /**
00089  * @brief ws_utt_ie_t WS UTT-IE
00090  */
00091 typedef struct ws_utt_ie {
00092     uint8_t message_type;
00093     uint_fast24_t ufsi;
00094 } ws_utt_ie_t;
00095 
00096 /**
00097  * @brief ws_bt_ie_t WS BT-IE read
00098  */
00099 typedef struct ws_bt_ie {
00100     uint16_t broadcast_slot_number;
00101     uint_fast24_t broadcast_interval_offset;
00102 } ws_bt_ie_t;
00103 
00104 
00105 /**
00106  * @brief ws_channel_plan_zero_t WS channel plan 0 define domain and class
00107  */
00108 typedef struct ws_channel_plan_zero {
00109     uint8_t regulator_domain;
00110     uint8_t operation_class;
00111 } ws_channel_plan_zero_t;
00112 
00113 /**
00114  * @brief ws_channel_plan_one_t WS channel plan 1 define ch0, spasing and channel count
00115  */
00116 typedef struct ws_channel_plan_one {
00117     uint_fast24_t ch0;
00118     unsigned channel_spacing:4;
00119     uint16_t number_of_channel;
00120 } ws_channel_plan_one_t;
00121 
00122 /**
00123  * @brief ws_channel_function_zero_t WS function 0 fixed channel
00124  */
00125 typedef struct ws_channel_function_zero {
00126     uint16_t fixed_channel;
00127 } ws_channel_function_zero_t;
00128 
00129 /**
00130  * @brief ws_channel_function_three_t WS function 3 vendor spesific channel hop
00131  */
00132 typedef struct ws_channel_function_three {
00133     uint8_t channel_hop_count;
00134     uint8_t *channel_list;
00135 } ws_channel_function_three_t;
00136 
00137 /**
00138  * @brief ws_us_ie_t WS US-IE read
00139  */
00140 typedef struct ws_us_ie {
00141     uint8_t dwell_interval;
00142     uint8_t clock_drift;
00143     uint8_t timing_accurancy;
00144     unsigned channel_plan:3;
00145     unsigned channel_function:3;
00146     unsigned excluded_channel_ctrl:2;
00147     union {
00148         ws_channel_plan_zero_t zero;
00149         ws_channel_plan_one_t one;
00150     } plan;
00151     union {
00152         ws_channel_function_zero_t zero;
00153         ws_channel_function_three_t three;
00154     } function;
00155 } ws_us_ie_t;
00156 
00157 /**
00158  * @brief ws_bs_ie_t WS BS-IE read
00159  */
00160 typedef struct ws_bs_ie {
00161     uint32_t broadcast_interval;
00162     uint16_t broadcast_schedule_identifier;
00163     uint8_t dwell_interval;
00164     uint8_t clock_drift;
00165     uint8_t timing_accurancy;
00166     unsigned channel_plan:3;
00167     unsigned channel_function:3;
00168     unsigned excluded_channel_ctrl:2;
00169     union {
00170         ws_channel_plan_zero_t zero;
00171         ws_channel_plan_one_t one;
00172     } plan;
00173     union {
00174         ws_channel_function_zero_t zero;
00175         ws_channel_function_three_t three;
00176     } function;
00177 } ws_bs_ie_t;
00178 
00179 
00180 #define MPX_KEY_MANAGEMENT_ENC_USER_ID 0x0001   /**< MPX Key management user ID */
00181 #define MPX_LOWPAN_ENC_USER_ID 0xA0ED           /**< MPX Lowpan User Id */
00182 
00183 #define WS_FAN_VERSION_1_0 1
00184 
00185 #define WS_NEIGHBOR_LINK_TIMEOUT 240
00186 #define WS_NEIGHBOR_NUD_TIMEOUT WS_NEIGHBOR_LINK_TIMEOUT / 2
00187 
00188 /*
00189  * Threshold (referenced to DEVICE_MIN_SENS) above which a neighbor node may be considered for inclusion into candidate parent set
00190  */
00191 #define CAND_PARENT_THRESHOLD 10
00192 /*
00193  * Hysteresis factor to be applied to CAND_PARENT_THRESHOLD when admitting or dropping nodes from the candidate parent set.
00194  */
00195 #define CAND_PARENT_HYSTERISIS 3
00196 
00197 /*
00198  * value when send the first RPL DIS in 100ms ticks. Value is randomized between timeout/2 - timeout
00199  */
00200 #define WS_RPL_DIS_INITIAL_TIMEOUT 600
00201 /*
00202  * value when send subsequent RPL DIS in 100 ms tics. Value is randomized between timeout/2 - timeout
00203  */
00204 #define WS_RPL_DIS_TIMEOUT 1800
00205 
00206 #endif /* WS_COMMON_DEFINES_H_ */