Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fhss_config.h Source File

fhss_config.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2015-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 /**
00019  * \file fhss_config.h
00020  * \brief
00021  */
00022 
00023 #ifndef FHSS_CONFIG_H
00024 #define FHSS_CONFIG_H
00025 
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 #include "fhss_ws_extension.h "
00032 
00033 /**
00034  * @brief WS channel functions.
00035  */
00036 typedef enum {
00037     /** Fixed channel. */
00038     WS_FIXED_CHANNEL,
00039     /** TR51 channel function. */
00040     WS_TR51CF,
00041     /** Direct Hash channel function. */
00042     WS_DH1CF,
00043     /** Vendor Defined channel function. */
00044     WS_VENDOR_DEF_CF
00045 } fhss_ws_channel_functions;
00046 
00047 /**
00048  * \brief Struct fhss_tuning_parameter defines FHSS tuning parameters.
00049  * All delays are given in microseconds.
00050  */
00051 typedef struct fhss_tuning_parameter {
00052     /** Delay between data pushed to PHY TX function and TX started (Contains CSMA-CA maximum random period). */
00053     uint32_t tx_processing_delay;
00054 
00055     /** Delay between TX done (by transmitter) and received data pushed to MAC (by receiver). */
00056     uint32_t rx_processing_delay;
00057 
00058     /** Delay between TX done (by transmitter) and Ack transmission started (by receiver) */
00059     uint32_t ack_processing_delay;
00060 } fhss_tuning_parameter_t;
00061 
00062 /**
00063  * \brief Struct fhss_configuration defines basic configuration of FHSS.
00064  */
00065 typedef struct fhss_configuration {
00066     /** Tuning parameters can be used to enhance synchronization accuracy*/
00067     fhss_tuning_parameter_t fhss_tuning_parameters;
00068 
00069     /** Maximum used interval for requesting synchronization info from FHSS parent device (seconds). */
00070     uint16_t fhss_max_synch_interval;
00071 
00072     /** Number of channel retries. */
00073     uint8_t fhss_number_of_channel_retries;
00074 
00075     /** Channel mask */
00076     uint32_t channel_mask[8];
00077 
00078 } fhss_configuration_t;
00079 
00080 /**
00081  * @brief Get channel using vendor defined channel function.
00082  * @param api FHSS instance.
00083  * @param slot Slot number in channel schedule.
00084  * @param eui64 EUI-64 address of node for which the (unicast) schedule is calculated. NULL for broadcast schedule.
00085  * @param bsi Broadcast schedule identifier used in (broadcast) schedule calculation.
00086  * @param number_of_channels Number of channels in schedule.
00087  * @return Channel.
00088  */
00089 typedef int32_t fhss_vendor_defined_cf(const fhss_api_t *api, uint16_t slot, uint8_t eui64[8], uint16_t bsi, uint16_t number_of_channels);
00090 
00091 /**
00092  * \brief Struct fhss_ws_configuration defines configuration of WS FHSS.
00093  */
00094 typedef struct fhss_ws_configuration {
00095     /** WS unicast channel function. */
00096     fhss_ws_channel_functions ws_uc_channel_function;
00097 
00098     /** WS broadcast channel function. */
00099     fhss_ws_channel_functions ws_bc_channel_function;
00100 
00101     /** Broadcast schedule identifier. */
00102     uint16_t bsi;
00103 
00104     /** Unicast dwell interval. Range: 15-250 milliseconds. */
00105     uint8_t fhss_uc_dwell_interval;
00106 
00107     /** Broadcast interval. Duration between broadcast dwell intervals. Range: 0-16777216 milliseconds. */
00108     uint32_t fhss_broadcast_interval;
00109 
00110     /** Broadcast dwell interval. Range: 15-250 milliseconds. */
00111     uint8_t fhss_bc_dwell_interval;
00112 
00113     /** Unicast fixed channel */
00114     uint8_t unicast_fixed_channel;
00115 
00116     /** Broadcast fixed channel */
00117     uint8_t broadcast_fixed_channel;
00118 
00119     /** Channel mask. */
00120     uint32_t channel_mask[8];
00121 
00122     /** Vendor defined channel function. */
00123     fhss_vendor_defined_cf *vendor_defined_cf;
00124 
00125 } fhss_ws_configuration_t;
00126 
00127 /**
00128  * \brief Struct fhss_timer defines interface between FHSS and FHSS platform timer.
00129  * Application must implement FHSS timer driver which is then used by FHSS with this interface.
00130  */
00131 typedef struct fhss_timer {
00132     /** Start timeout (1us). Timer must support multiple simultaneous timeouts */
00133     int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);
00134 
00135     /** Stop timeout */
00136     int (*fhss_timer_stop)(void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);
00137 
00138     /** Get remaining time of started timeout*/
00139     uint32_t (*fhss_get_remaining_slots)(void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);
00140 
00141     /** Get timestamp since initialization of driver. Overflow of 32-bit counter is allowed (1us) */
00142     uint32_t (*fhss_get_timestamp)(const fhss_api_t *fhss_api);
00143 
00144     /** Divide 1 microsecond resolution. E.g. to use 64us resolution, use fhss_resolution_divider = 64*/
00145     uint8_t fhss_resolution_divider;
00146 } fhss_timer_t;
00147 
00148 /**
00149  * \brief Struct fhss_synch_configuration defines the synchronization time configurations.
00150  * Border router application must define and set these configuration for FHSS network.
00151  */
00152 typedef struct fhss_synch_configuration {
00153     /** Number of broadcast channels. */
00154     uint8_t fhss_number_of_bc_channels;
00155 
00156     /** TX slots per channel. */
00157     uint8_t fhss_number_of_tx_slots;
00158 
00159     /** Length of superframe(microseconds) * Number of superframes defines the
00160         channel dwell time. E.g. 50000us * 8 -> Channel dwell time 400ms */
00161     uint16_t fhss_superframe_length;
00162 
00163     /** Number of superframes. */
00164     uint8_t fhss_number_of_superframes;
00165 } fhss_synch_configuration_t;
00166 
00167 
00168 /**
00169  * \brief Struct fhss_statistics defines the available FHSS statistics.
00170  */
00171 typedef struct fhss_statistics {
00172     /** FHSS synchronization drift compensation (us/channel). */
00173     int16_t fhss_drift_compensation;
00174 
00175     /** FHSS hop count. */
00176     uint8_t fhss_hop_count;
00177 
00178     /** FHSS synchronization interval (s). */
00179     uint16_t fhss_synch_interval;
00180 
00181     /** Average of 5 preceding synchronization fixes (us). Updated after every fifth synch fix. */
00182     int16_t fhss_prev_avg_synch_fix;
00183 
00184     /** FHSS synchronization lost counter. */
00185     uint32_t fhss_synch_lost;
00186 
00187     /** FHSS TX to unknown neighbour counter. */
00188     uint32_t fhss_unknown_neighbor;
00189 
00190     /** FHSS channel retry counter. */
00191     uint32_t fhss_channel_retry;
00192 } fhss_statistics_t;
00193 
00194 /**
00195  * \brief Enumeration fhss_channel_mode_e defines the channel modes.
00196  */
00197 typedef enum fhss_channel_mode_e {
00198     SINGLE_CHANNEL,     //< Single channel
00199     FHSS,               //< Frequency hopping mode
00200 } fhss_channel_mode_e;
00201 
00202 #ifdef __cplusplus
00203 }
00204 #endif
00205 
00206 #endif // FHSS_CONFIG_H