Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers channel_functions.h Source File

channel_functions.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 CHANNEL_FUNC_H_
00018 #define CHANNEL_FUNC_H_
00019 
00020 /**
00021  * @brief Function calculates nearest (higher) prime number for given start value.
00022  * @param start_value Start value.
00023  * @return Calculated prime number.
00024  */
00025 uint16_t tr51_calc_nearest_prime_number(uint16_t start_value);
00026 
00027 /**
00028  * @brief Initialize channel table for TR51 channel function.
00029  * @param channel_table Channel table to be initialized.
00030  * @param number_of_channels Number of channels.
00031  * @return 0 Success, -1 Failure.
00032  */
00033 int tr51_init_channel_table(int16_t *channel_table, int16_t number_of_channels);
00034 
00035 /**
00036  * @brief Compute the unicast schedule channel index using tr51 channel function.
00037  * @param channel_table Channel table.
00038  * @param output_table Table used to generate output channel.
00039  * @param slot_number Current slot number.
00040  * @param mac MAC address of the node for which the index is calculated.
00041  * @param number_of_channels Number of channels.
00042  * @param excluded_channels Excluded channels.
00043  * @return Channel index.
00044  */
00045 int32_t tr51_get_uc_channel_index(int16_t *channel_table, uint8_t *output_table, uint16_t slot_number, uint8_t *mac, int16_t number_of_channels, uint32_t *excluded_channels);
00046 
00047 /**
00048  * @brief Compute the broadcast schedule channel index using tr51 channel function.
00049  * @param channel_table Channel table.
00050  * @param output_table Table used to generate output channel.
00051  * @param slot_number Current slot number.
00052  * @param bsi Broadcast schedule identifier of the node for which the index is calculated.
00053  * @param number_of_channels Number of channels.
00054  * @param excluded_channels Excluded channels.
00055  * @return Channel index.
00056  */
00057 int32_t tr51_get_bc_channel_index(int16_t *channel_table, uint8_t *output_table, uint16_t slot_number, uint16_t bsi, int16_t number_of_channels, uint32_t *excluded_channels);
00058 
00059 /**
00060  * @brief Compute the unicast schedule channel index using direct hash channel function.
00061  * @param slot_number Current slot number.
00062  * @param mac MAC address of the node for which the index is calculated.
00063  * @param number_of_channels Number of channels.
00064  * @return Channel index.
00065  */
00066 int32_t dh1cf_get_uc_channel_index(uint16_t slot_number, uint8_t *mac, int16_t number_of_channels);
00067 
00068 /**
00069  * @brief Compute the broadcast schedule channel index using direct hash channel function.
00070  * @param slot_number Current slot number.
00071  * @param bsi Broadcast schedule identifier of the node for which the index is calculated.
00072  * @param number_of_channels Number of channels.
00073  * @return Channel index.
00074  */
00075 int32_t dh1cf_get_bc_channel_index(uint16_t slot_number, uint16_t bsi, int16_t number_of_channels);
00076 
00077 #endif /*CHANNEL_FUNC_H_*/