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