|
| 1 | +/* |
| 2 | + * Copyright (c) 2018, Arm Limited and affiliates. |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +#ifndef WS_NEIGHBOUR_CLASS_H_ |
| 19 | +#define WS_NEIGHBOUR_CLASS_H_ |
| 20 | + |
| 21 | +/** |
| 22 | + * Neighbour Channel hopping information |
| 23 | + */ |
| 24 | +typedef struct ws_fhss_s { |
| 25 | + uint32_t utt_timestamp; /*!< Timestamp from MAC for Unicast time UTT-IE */ |
| 26 | + uint32_t bt_timestamp; /*!< Timestamp from MAC for Broadcast time BT-IE */ |
| 27 | + uint32_t broadcast_interval; |
| 28 | + uint32_t ufsi; /*!< Unicast Fractional Sequence Interval 24-bit */ |
| 29 | + uint32_t bti; /*!< Broadcast Interval_offset 24-bit */ |
| 30 | + uint16_t broadcast_slot_number; /*!< Broadcast Slot number */ |
| 31 | + uint16_t bsi; /*!< Broadcast schedule identifier */ |
| 32 | + uint8_t broadcast_dwell; |
| 33 | + uint8_t unicast_dwell; |
| 34 | + unsigned channel_function:3; |
| 35 | +} ws_fhss_t; |
| 36 | + |
| 37 | + |
| 38 | +typedef struct ws_neighbour_class_entry_s { |
| 39 | + ws_fhss_t fhhs_data; |
| 40 | +} ws_neighbour_class_entry_t; |
| 41 | + |
| 42 | +/** |
| 43 | + * Neighbour hopping info data base |
| 44 | + */ |
| 45 | +typedef struct ws_neighbour_class_s { |
| 46 | + ws_neighbour_class_entry_t *neigh_info_list; /*!< Allocated hopping info array*/ |
| 47 | + uint8_t list_size; /*!< List size*/ |
| 48 | +} ws_neighbour_class_t; |
| 49 | + |
| 50 | +/** |
| 51 | + * ws_neighbour_class_alloc a function for allocate giving list size |
| 52 | + * |
| 53 | + * \param class_data pointer to structure which will be initialized by this function |
| 54 | + * \param list_size define list size |
| 55 | + * |
| 56 | + * \return true Allocate Ok |
| 57 | + * \return false Allocate Fail |
| 58 | + * |
| 59 | + */ |
| 60 | +bool ws_neighbour_class_alloc(ws_neighbour_class_t *class_data, uint8_t list_size); |
| 61 | + |
| 62 | +/** |
| 63 | + * ws_neighbour_class_dealloc a function for free allocated neighbor hopping info |
| 64 | + * |
| 65 | + * \param class_data pointer to structure which will be initialized by this function |
| 66 | + * |
| 67 | + */ |
| 68 | +void ws_neighbour_class_dealloc(ws_neighbour_class_t *class_data); |
| 69 | + |
| 70 | +/** |
| 71 | + * ws_neighbour_class_entry_get a function for search hopping info for giving neighbor attribut |
| 72 | + * |
| 73 | + * \param class_data pointer to structure which will be initialized by this function |
| 74 | + * \param attribute_index define pointer to storage info |
| 75 | + * |
| 76 | + * \return NULL when Attribute is not correct |
| 77 | + * \return Pointer to neighbor hopping info |
| 78 | + * |
| 79 | + */ |
| 80 | +ws_neighbour_class_entry_t * ws_neighbour_class_entry_get(ws_neighbour_class_t *class_data, uint8_t attribute_index); |
| 81 | +/** |
| 82 | + * ws_neighbour_class_entry_remove a function for clean information should be call when neighbor is removed |
| 83 | + * |
| 84 | + * \param class_data pointer to structure which will be initialized by this function |
| 85 | + * \param attribute_index define pointer to storage info |
| 86 | + * |
| 87 | + */ |
| 88 | +void ws_neighbour_class_entry_remove(ws_neighbour_class_t *class_data, uint8_t attribute_index); |
| 89 | + |
| 90 | +#endif /* WS_NEIGHBOUR_CLASS_H_ */ |
0 commit comments