takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mac_mlme.h Source File

mac_mlme.h

00001 /*
00002  * Copyright (c) 2014-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 
00018 /*
00019  * \file mac_mlme.h
00020  * \brief Add short description about this file!!!
00021  *
00022  */
00023 
00024 #ifndef MAC_MLME_H_
00025 #define MAC_MLME_H_
00026 
00027 //TODO: Check if these are in correct place
00028 #include "net_interface.h"
00029 
00030 struct nwk_scan_params;
00031 struct nwk_filter_params;
00032 struct protocol_interface_rf_mac_setup;
00033 struct arm_event_s;
00034 struct arm_device_driver_list;
00035 struct mlme_poll_s;
00036 struct mlme_beacon_ind_s;
00037 struct mlme_reset_s;
00038 struct mlme_scan_s;
00039 struct mlme_start_s;
00040 struct mlme_get_conf_s;
00041 struct mlme_set_s;
00042 struct channel_list_s;
00043 
00044 void mac_mlme_scan_confirmation_handle(struct protocol_interface_rf_mac_setup *rf_ptr);
00045 
00046 /**
00047  * MLME Scan Request
00048  *
00049  */
00050 void mac_mlme_scan_request(const struct mlme_scan_s *msg, struct protocol_interface_rf_mac_setup *rf_mac_setup);
00051 /**
00052  * MLME Start Request
00053  *
00054  */
00055 int8_t mac_mlme_start_req(const struct mlme_start_s *s, struct protocol_interface_rf_mac_setup *rf_mac_setup);
00056 /**
00057  * MLME Reset Request
00058  *
00059  */
00060 int8_t mac_mlme_reset(struct protocol_interface_rf_mac_setup *rf_mac_setup, const struct mlme_reset_s *reset);
00061 
00062 int8_t mac_mlme_set_req(struct protocol_interface_rf_mac_setup *rf_mac_setup,const struct mlme_set_s *set_req);
00063 
00064 int8_t mac_mlme_get_req(struct protocol_interface_rf_mac_setup *rf_mac_setup, struct mlme_get_conf_s *get_req);
00065 
00066 void mac_extended_mac_set(struct protocol_interface_rf_mac_setup *rf_mac_setup, const uint8_t *mac64);
00067 
00068 uint32_t mac_mlme_framecounter_get(struct protocol_interface_rf_mac_setup *rf_mac_setup);
00069 
00070 void mac_mlme_framecounter_increment(struct protocol_interface_rf_mac_setup *rf_mac_setup);
00071 void mac_mlme_framecounter_decrement(struct protocol_interface_rf_mac_setup *rf_mac_setup);
00072 
00073 /**
00074  * MLME Poll Request
00075  *
00076  */
00077 void mac_mlme_poll_req(struct protocol_interface_rf_mac_setup *cur, const struct mlme_poll_s *poll_req);
00078 
00079 void mac_mlme_poll_process_confirm(struct protocol_interface_rf_mac_setup *rf_mac_setup, uint8_t status);
00080 
00081 /**
00082  * Radio Disable and enable functions
00083  */
00084 void mac_mlme_mac_radio_disabled(struct protocol_interface_rf_mac_setup *rf_mac_setup);
00085 void mac_mlme_mac_radio_enable(struct protocol_interface_rf_mac_setup *rf_mac_set);
00086 
00087 /**
00088  * Initialize MAC channel selection sequence
00089  *
00090  * TODO: initialize channel select sequence
00091  *       in coordinator mode
00092  *
00093  * \param new_channel channel to set
00094  *
00095  * \return 0 success
00096  * \return -1 HW error
00097  */
00098 int8_t mac_mlme_rf_channel_change(struct protocol_interface_rf_mac_setup *rf_mac_setup, uint8_t new_channel);
00099 
00100 void mac_mlme_active_scan_response_timer_start(void *interface);
00101 
00102 /**
00103  * @brief mac_mlme_beacon_notify Function which is called every time a beacon is received
00104  * @param rf_mac_setup Current MAC setup
00105  * @param data Reference to beacon data
00106  * @return
00107  */
00108 int mac_mlme_beacon_notify(struct protocol_interface_rf_mac_setup *rf_mac_setup, struct mlme_beacon_ind_s *data);
00109 
00110 void mac_mlme_event_cb(void *mac_ptr);
00111 
00112 void mac_mlme_set_active_state(struct protocol_interface_rf_mac_setup *entry, bool new_state);
00113 
00114 struct protocol_interface_rf_mac_setup * mac_mlme_data_base_allocate(uint8_t *mac64, struct arm_device_driver_list *dev_driver, struct mac_description_storage_size_s *storage_sizes);
00115 void mac_mlme_data_base_deallocate(struct protocol_interface_rf_mac_setup *rf_mac);
00116 
00117 uint8_t mac_mlme_set_new_sqn(struct protocol_interface_rf_mac_setup *rf_setup);
00118 uint8_t mac_mlme_set_new_beacon_sqn(struct protocol_interface_rf_mac_setup *rf_setup);
00119 
00120 uint16_t mac_mlme_get_panid(struct protocol_interface_rf_mac_setup *rf_setup);
00121 
00122 void mac_frame_src_address_set_from_interface(uint8_t SrcAddrMode,struct protocol_interface_rf_mac_setup *rf_ptr, uint8_t *addressPtr);
00123 
00124 int8_t mac_mlme_beacon_tx(struct protocol_interface_rf_mac_setup *rf_ptr);
00125 uint8_t mac_mlme_beacon_req_tx(struct protocol_interface_rf_mac_setup *rf_ptr);
00126 int8_t mac_mlme_virtual_confirmation_handle(int8_t driver_id, const uint8_t *data_ptr, uint16_t length);
00127 
00128 uint16_t mlme_scan_analyze_next_channel(struct channel_list_s *mac_channel_list);
00129 
00130 #endif /* MAC_MLME_H_ */