BA / Mbed OS BaBoRo1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers channel_list.h Source File

channel_list.h

00001 /*
00002  * Copyright (c) 2015-2017, 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 #ifndef __CHANNEL_LIST_H__
00019 #define __CHANNEL_LIST_H__
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 /**
00026  * Dump the channel list object data to ns_trace using given trace level and group.
00027  */
00028 void channel_list_print(uint8_t dlevel, const char* grp, const uint32_t* list);
00029 
00030 /**
00031  * Get channel number using channel index.
00032  *
00033  * @param list to scan
00034  * @param channel index
00035  *
00036  * @return channel number
00037  */
00038 uint8_t channel_list_get_channel(const uint32_t* list, int current_index);
00039 
00040 /**
00041  * Clear the channel mask bitmap, does not change channel page.
00042  *
00043  * @param list list which mask is to be cleared
00044  */
00045 void channel_list_clear_mask(uint32_t* list);
00046 
00047 /**
00048  * Get next enabled channel number from given list. Channels are now taken sequentially,
00049  * starting from the index given.
00050  *
00051  * @param list to scan
00052  * @param the currently used channel index, ie. the place where search for next channel
00053  * is started
00054  * @return channel number of next channel
00055  */
00056 int channel_list_get_next(const uint32_t* list, int current_index);
00057 
00058 int channel_list_get_next_broadcast(const uint32_t* list, int broadcast_channel_count, int current_index);
00059 
00060 /**
00061  * Get the first channel enabled in a list.
00062  *
00063  * @param list to scan
00064  * @return index of the first channel enabled
00065  */
00066 int channel_list_get_first(const uint32_t* list);
00067 
00068 /**
00069  * Count the amount of channels enabled in a list.
00070  *
00071  * @param list to scan
00072  * @return amount of bits set in the channel masks
00073  */
00074 int channel_list_count_channels(const uint32_t* list);
00075 
00076 /**
00077  * Enable channel by given channel number. This is likely to be used
00078  * from the test/application configuration side.
00079  *
00080  * Note: the channel number validity is not (yet?) verified, so one
00081  * can enable invalid channels which should not be according to channel page.
00082  *
00083  * @param list to modify
00084  * @param channel number
00085  * @return 0 on success, negative on failure (out of bounds channel)
00086  */
00087 int channel_list_enable_channel(uint32_t* list, int channel_number);
00088 
00089 /**
00090  * Check, if given channel is enabled. This is likely to be used
00091  * from the test/application configuration side.
00092  *
00093  * Note: the channel number validity is not (yet?) verified, so one
00094  * can enable invalid channels which should not be according to channel page.
00095  *
00096  * @param list to test
00097  * @param channel number
00098  * @return true, if channel is enabled on mask, false if not
00099  */
00100 bool channel_list_is_channel_enabled(const uint32_t* list, int channel_number);
00101 
00102 #ifdef __cplusplus
00103 }
00104 #endif
00105 #endif // !__CHANNEL_LIST_H__