Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
mac_mcps_sap.h
00001 /* 00002 * Copyright (c) 2016-2019, 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 * mac_mcps_sap.h 00020 * 00021 * Created on: 19 Jan 2016 00022 * Author: juhhei01 00023 */ 00024 00025 #ifndef MAC_IEEE802_15_4_MAC_MCPS_SAP_H_ 00026 #define MAC_IEEE802_15_4_MAC_MCPS_SAP_H_ 00027 00028 #include "mlme.h" 00029 #include "mac_common_defines.h" 00030 #include "mac_data_buffer.h" 00031 00032 struct protocol_interface_rf_mac_setup; 00033 struct mcps_data_req_s; 00034 struct arm_phy_sap_msg_s; 00035 struct mcps_purge_s; 00036 struct mcps_data_req_ie_list; 00037 struct channel_list_s; 00038 00039 /** Address types */ 00040 typedef enum { 00041 MAC_FRAME_REQ, /*!< MAC upper layer data request message */ 00042 MAC_PHY_RAW_REQ, 00043 MAC_PARSED_FRAME_IND, /*!< PD-SAP parsed MAC Frame */ 00044 } mac_mcps_primitiv_type; 00045 00046 00047 #define MAC_PD_DATA_NORMAL_PRIORITY 0 //Normal MCPS DATA REQ 00048 #define MAC_PD_DATA_MEDIUM_PRIORITY 1 //Indirect Data which is polled 00049 #define MAC_PD_DATA_HIGH_PRIOTITY 2 //Beacon request Beacon response 00050 00051 #define MCPS_SAP_DATA_IND_EVENT 1 00052 #define MCPS_SAP_DATA_CNF_EVENT 2 00053 #define MCPS_SAP_DATA_CNF_FAIL_EVENT 3 00054 #define MAC_MLME_EVENT_HANDLER 4 00055 #define MAC_MCPS_INDIRECT_TIMER_CB 5 00056 #define MAC_MLME_SCAN_CONFIRM_HANDLER 6 00057 #define MAC_SAP_TRIG_TX 7 00058 #define MCPS_SAP_DATA_ACK_CNF_EVENT 8 00059 00060 // Default number of CSMA-CA periods 00061 #define MAC_DEFAULT_NUMBER_OF_CSMA_PERIODS 1 00062 // Interval between two CCA checks 00063 #define MAC_DEFAULT_CSMA_MULTI_CCA_INTERVAL 1000 00064 00065 00066 void mac_generic_event_trig(uint8_t event_type, void *mac_ptr, bool low_latency); 00067 00068 /** 00069 * Create MAC MCPS event handler tasklet 00070 */ 00071 int8_t mac_mcps_sap_tasklet_init(void); 00072 00073 /** 00074 * Free MAC MCPS SAP layer pre parsed buffer 00075 */ 00076 void mcps_sap_pre_parsed_frame_buffer_free(mac_pre_parsed_frame_t *buf); 00077 00078 00079 /** 00080 * Allocate MCPS SAP data request buffer frame 00081 * 00082 * \param payload_size set 0 when MCPS-DATA-REQUSEST other wise MAC internal packet send need to set dynamic payload size!! 00083 */ 00084 mac_pre_build_frame_t *mcps_sap_prebuild_frame_buffer_get(uint16_t payload_size); 00085 00086 /** 00087 * Free MCPS SAP data request buffer frame 00088 * 00089 * \param buffer pointer to allocated frame 00090 */ 00091 void mcps_sap_prebuild_frame_buffer_free(mac_pre_build_frame_t *buffer); 00092 00093 void mcps_sap_pd_req_queue_write(struct protocol_interface_rf_mac_setup *rf_mac_setup, mac_pre_build_frame_t *buffer); 00094 00095 00096 /** 00097 * Allocate MAC MCPS SAP layer buffer for received PHY layer Data Indication 00098 */ 00099 mac_pre_parsed_frame_t *mcps_sap_pre_parsed_frame_buffer_get(const uint8_t *data_ptr, uint16_t frame_length); 00100 00101 /** 00102 * Forward Buffer for MAC MCPS SAP layer event handler 00103 */ 00104 int8_t mcps_sap_pd_ind(mac_pre_parsed_frame_t *buffer); 00105 00106 /** 00107 * MAC MCPS SAP layer data confirmation event trig 00108 */ 00109 int8_t mcps_sap_pd_confirm(void *mac_ptr); 00110 00111 int8_t mcps_sap_pd_confirm_failure(void *mac_ptr); 00112 00113 void mcps_sap_pd_ack(void *ack_ptr); 00114 00115 int8_t mac_virtual_sap_data_cb(void *identifier, struct arm_phy_sap_msg_s *message); 00116 00117 void mcps_sap_data_req_handler(struct protocol_interface_rf_mac_setup *rf_mac_setup, const struct mcps_data_req_s *data_req); 00118 00119 void mcps_sap_data_req_handler_ext(struct protocol_interface_rf_mac_setup *rf_mac_setup, const struct mcps_data_req_s *data_req, const struct mcps_data_req_ie_list *ie_list, const channel_list_s *asynch_channel_list); 00120 00121 void mac_mcps_trig_buffer_from_queue(struct protocol_interface_rf_mac_setup *rf_mac_setup); 00122 00123 void mac_mcps_buffer_queue_free(struct protocol_interface_rf_mac_setup *rf_mac_setup); 00124 00125 bool mac_is_ack_request_set(mac_pre_build_frame_t *buffer); 00126 00127 int mac_convert_frame_type_to_fhss(uint8_t frame_type); 00128 00129 void mcps_sap_trig_tx(void *mac_ptr); 00130 00131 uint8_t mcps_sap_purge_reg_handler(struct protocol_interface_rf_mac_setup *rf_mac_setup, const struct mcps_purge_s *purge_req); 00132 00133 int8_t mcps_pd_data_rebuild(struct protocol_interface_rf_mac_setup *rf_ptr, mac_pre_build_frame_t *buffer); 00134 00135 int8_t mcps_generic_ack_data_request_init(struct protocol_interface_rf_mac_setup *rf_ptr, const mac_fcf_sequence_t *fcf, const uint8_t *data_ptr, const mcps_ack_data_payload_t *ack_payload); 00136 00137 int8_t mcps_generic_ack_build(struct protocol_interface_rf_mac_setup *rf_ptr, bool init_build); 00138 00139 int mcps_packet_ingress_rate_limit_by_memory(uint8_t free_heap_percentage); 00140 00141 uint32_t mac_mcps_sap_get_phy_timestamp(struct protocol_interface_rf_mac_setup *rf_mac_setup); 00142 00143 void mcps_pending_packet_counter_update_check(struct protocol_interface_rf_mac_setup *rf_mac_setup, mac_pre_build_frame_t *buffer); 00144 00145 #endif /* MAC_IEEE802_15_4_MAC_MCPS_SAP_H_ */
Generated on Tue Jul 12 2022 13:54:31 by
