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_ws.h Source File

fhss_ws.h

00001 /*
00002  * Copyright (c) 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 #ifndef FHSS_WS_H_
00018 #define FHSS_WS_H_
00019 
00020 /* WS requires at least 19 MAC retransmissions (total 1+19=20 attempts). 802.15.4 macMaxFrameRetries is 3 (total 1+3=4 attempts).
00021  * At least 4 channel retries must be used: (Initial channel + WS_NUMBER_OF_CHANNEL_RETRIES) * MAC attempts = (1+4)*4=20 attempts
00022  */
00023 #define WS_NUMBER_OF_CHANNEL_RETRIES    4
00024 //TX/RX slot length in milliseconds
00025 #define WS_MAX_TXRX_SLOT_LEN_MS         100
00026 // Default minimum broadcast synchronization interval in seconds
00027 #define DEFAULT_MIN_SYNCH_INTERVAL      60
00028 // Drift compensation allowed if at least SYNCH_COMPENSATION_MIN_INTERVAL (seconds) since last synchronization
00029 #define SYNCH_COMPENSATION_MIN_INTERVAL 60
00030 // MAX compensation per received synchronization info in ns
00031 #define MAX_DRIFT_COMPENSATION_STEP     10
00032 typedef struct fhss_ws fhss_ws_t;
00033 
00034 struct fhss_ws {
00035     uint8_t bc_channel;
00036     uint16_t uc_slot;
00037     uint16_t bc_slot;
00038     uint16_t min_synch_interval;
00039     uint32_t txrx_slot_length_ms;
00040     uint32_t synchronization_time;
00041     uint32_t unicast_start_time_us;
00042     int32_t drift_per_millisecond_ns;
00043     int16_t *tr51_channel_table;
00044     uint8_t *tr51_output_table;
00045     bool unicast_timer_running;
00046     bool is_on_bc_channel;
00047     struct fhss_ws_configuration fhss_configuration;
00048     const struct broadcast_timing_info *parent_bc_info;
00049     fhss_get_neighbor_info *get_neighbor_info;
00050 };
00051 
00052 fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer);
00053 int fhss_ws_set_callbacks(fhss_structure_t *fhss_structure);
00054 int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info, const bool force_synch);
00055 int fhss_ws_remove_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8]);
00056 int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_configuration_t *fhss_configuration);
00057 int fhss_ws_set_hop_count(fhss_structure_t *fhss_structure, const uint8_t hop_count);
00058 
00059 #endif /*FHSS_WS_H_*/