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

fhss_common.h

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 #ifndef FHSS_COMMON_H_
00018 #define FHSS_COMMON_H_
00019 #include "ns_list.h"
00020 
00021 #define FHSS_TASKLET_INIT_EVENT             0
00022 #define FHSS_TIMER_EVENT                    1
00023 #define FHSS_COMPARE_SYNCH_PARENT           2
00024 #define FHSS_BROADCAST_CHANNEL              3
00025 #define FHSS_UPDATE_SYNCH_INFO_STORAGE      4
00026 
00027 struct fhss_failed_tx {
00028     uint8_t handle;
00029     uint8_t bad_channel;
00030     uint8_t retries_done;
00031     ns_list_link_t link;
00032 };
00033 typedef NS_LIST_HEAD (fhss_failed_tx_t, link) fhss_failed_tx_list_t;
00034 
00035 struct fhss_structure {
00036     uint8_t own_hop;
00037     uint8_t fhss_resolution_divider;
00038     uint8_t rx_channel;
00039     int8_t beacon_tasklet_id;
00040     int8_t fhss_event_timer;
00041     uint8_t active_fhss_events;
00042     uint16_t number_of_channels;
00043     fhss_states fhss_state;
00044     uint32_t fhss_timeout;
00045     uint32_t fhss_timer;
00046     struct fhss_api *fhss_api;
00047     struct fhss_bs *bs;
00048     struct fhss_ws *ws;
00049     struct fhss_timer platform_functions;
00050     struct fhss_callback callbacks;
00051     struct fhss_statistics *fhss_stats_ptr;
00052     fhss_failed_tx_list_t fhss_failed_tx_list;
00053     uint8_t synch_parent[8];
00054 };
00055 
00056 fhss_structure_t *fhss_get_object_with_timer_id(const int8_t timer_id);
00057 fhss_structure_t *fhss_allocate_instance(fhss_api_t *fhss_api, const fhss_timer_t *fhss_timer);
00058 int8_t fhss_free_instance(fhss_api_t *fhss_api);
00059 int8_t fhss_set_datarate(fhss_structure_t *fhss_structure, uint32_t datarate);
00060 fhss_structure_t *fhss_get_object_with_api(const fhss_api_t *fhss_api);
00061 void fhss_clear_active_event(fhss_structure_t *fhss_structure, uint8_t event_type);
00062 int8_t fhss_disable(fhss_structure_t *fhss_structure);
00063 void fhss_start_timer(fhss_structure_t *fhss_structure, uint32_t time, void (*callback)(const fhss_api_t *fhss_api, uint16_t));
00064 void fhss_stop_timer(fhss_structure_t *fhss_structure, void (*callback)(const fhss_api_t *fhss_api, uint16_t));
00065 int fhss_timeout_start(fhss_structure_t *fhss_structure, uint32_t time);
00066 int fhss_timeout_stop(fhss_structure_t *fhss_structure);
00067 int fhss_update_synch_parent_address(fhss_structure_t *fhss_structure);
00068 void fhss_trig_event(fhss_structure_t *fhss_structure, uint8_t event_type);
00069 int fhss_get_parent_address(fhss_structure_t *fhss_structure, uint8_t *p_addr);
00070 int fhss_compare_with_synch_parent_address(fhss_structure_t *fhss_structure, const uint8_t *source_addr);
00071 uint32_t fhss_read_timestamp_cb(const fhss_api_t *api);
00072 int fhss_init_callbacks_cb(const fhss_api_t *api, fhss_callback_t *callbacks);
00073 int fhss_failed_handle_remove(fhss_structure_t *fhss_structure, uint8_t handle);
00074 int fhss_failed_handle_add(fhss_structure_t *fhss_structure, uint8_t handle, uint8_t bad_channel);
00075 fhss_failed_tx_t *fhss_failed_handle_find(fhss_structure_t *fhss_structure, uint8_t handle);
00076 void fhss_failed_list_free(fhss_structure_t *fhss_structure);
00077 uint32_t fhss_get_tx_time(fhss_structure_t *fhss_structure, uint16_t bytes_to_send, uint8_t phy_header_length, uint8_t phy_tail_length);
00078 #endif /*FHSS_COMMON_H_*/