Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sw_mac.h Source File

sw_mac.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2016-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 /** \file sw_mac.h
00019  * \brief Software MAC API.
00020  */
00021 
00022 #ifndef NS_SW_MAC_H
00023 #define NS_SW_MAC_H
00024 
00025 #include "ns_types.h"
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 struct protocol_interface_rf_mac_setup;
00032 struct mac_api_s;
00033 struct mac_description_storage_size_s;
00034 struct fhss_api;
00035 struct mac_statistics_s;
00036 
00037 /**
00038  * @brief Creates 802.15.4 MAC API instance which will use RF driver given
00039  * @param rf_driver_id RF driver id. Must be valid
00040  * @param storage_sizes dynamic mac storage sizes DO NOT set any values to zero !!
00041  * @return New MAC instance if successful, NULL otherwise
00042  */
00043 extern struct mac_api_s *ns_sw_mac_create(int8_t rf_driver_id, struct mac_description_storage_size_s *storage_sizes);
00044 
00045 /**
00046  * @brief ns_sw_mac_virtual_client_register registers virtual driver to be used with 802.15.4 MAC.
00047  * This is always used with serial_mac_api
00048  * @param api API to start using virtual driver
00049  * @param virtual_driver_id
00050  * @return 0 if success, -1 if api or driver is invalid
00051  */
00052 extern int8_t ns_sw_mac_virtual_client_register(struct mac_api_s *api, int8_t virtual_driver_id);
00053 
00054 /**
00055  * @brief ns_sw_mac_virtual_client_unregister Unregisters virtual driver from 802.15.4 MAC
00056  * @param api API from which to unregister virtual driver
00057  * @return 0 if success, -1 if api is invalid
00058  */
00059 extern int8_t ns_sw_mac_virtual_client_unregister(struct mac_api_s *api);
00060 
00061 /**
00062  * @brief Registers created FHSS API instance to given software MAC instance.
00063  * @param mac_api MAC instance.
00064  * @param fhss_api FHSS instance.
00065  * @return 0 on success, -1 on fail.
00066  */
00067 extern int ns_sw_mac_fhss_register(struct mac_api_s *mac_api, struct fhss_api *fhss_api);
00068 
00069 /**
00070  * @brief Start collecting statistics from software MAC.
00071  * @param mac_api MAC instance.
00072  * @param mac_statistics Statistics storage.
00073  * @return 0 on success, -1 on fail.
00074  */
00075 extern int ns_sw_mac_statistics_start(struct mac_api_s *mac_api, struct mac_statistics_s *mac_statistics);
00076 
00077 #ifdef __cplusplus
00078 }
00079 #endif
00080 
00081 #endif // NS_SW_MAC_H