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.
mac_defines.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 #ifndef MAC_DEFINES_H_ 00019 #define MAC_DEFINES_H_ 00020 00021 #include "eventOS_event.h" 00022 #include "mlme.h" 00023 #include "ns_list.h" 00024 00025 struct cca_structure_s; 00026 struct buffer; 00027 struct mac_pre_build_frame; 00028 struct mlme_key_descriptor_s; 00029 struct arm_device_driver_list; 00030 struct fhss_api; 00031 00032 typedef enum mac_event_t { 00033 MAC_STATE_IDLE = 0, 00034 MAC_TX_DONE, 00035 MAC_TX_DONE_PENDING, 00036 MAC_CCA_FAIL, 00037 MAC_TIMER_ACK, 00038 MAC_TIMER_CCA, 00039 MAC_TX_FAIL, 00040 MAC_TX_TIMEOUT 00041 } mac_event_t; 00042 00043 typedef enum mac_tx_status_type_t { 00044 MAC_TX_STATUS_LEN = 0, 00045 MAC_TX_STATUS_CCA_CNT, 00046 MAC_TX_STATUS_RETRY_CNT, 00047 } mac_tx_status_type_t; 00048 00049 00050 typedef enum mac_int_event_t { 00051 MAC_INT_IDLE = 0, 00052 MAC_INT_TX, 00053 MAC_INT_TIMER 00054 } mac_int_event_t; 00055 00056 00057 typedef enum mac_ifs_event_t { 00058 MAC_IFS_IDLE = 0, 00059 MAC_IFS_CCA, 00060 MAC_IFS_TRIG_TX, 00061 MAC_IFS_TX_ACTIVE, 00062 MAC_IFS_CCA_FAILED, 00063 MAC_IFS_ACK_TIMEOUT, 00064 } mac_ifs_event_t; 00065 00066 00067 00068 typedef enum mac_timer_event_t { 00069 MAC_INT_TIMER_IDLE = 0, 00070 MAC_INT_TIMER_ACK, 00071 MAC_INT_TIMER_CCA 00072 } mac_timer_event_t; 00073 00074 typedef enum { 00075 MAC_FRAME_BEACON = 0, 00076 MAC_FRAME_DATA = 1, 00077 MAC_FRAME_ACK = 2, 00078 MAC_FRAME_CMD = 3, 00079 MAC_ILLEGAL_LEGACY = 5, 00080 MAC_FRAME_RANGING = 14, 00081 MAC_FRAME_NONE = 15 00082 } mac_frame_e; 00083 00084 typedef enum arm_nwk_mlme_event_type { 00085 ARM_NWK_MAC_MLME_IDLE = 0, 00086 ARM_NWK_MAC_MLME_SCAN = 1, 00087 ARM_NWK_MAC_MLME_ED_ANALYZE = 2, 00088 ARM_NWK_MAC_MLME_INDIRECT_DATA_POLL = 4, 00089 ARM_NWK_MAC_MLME_INDIRECT_DATA_POLL_AFTER_DATA = 5, 00090 } arm_nwk_mlme_event_type_e; 00091 00092 typedef struct dev_driver_tx_buffer { 00093 uint8_t *buf; 00094 uint16_t len; 00095 unsigned priority:2; 00096 } dev_driver_tx_buffer_s; 00097 00098 /* 00099 * Table 82-MAC command frames 00100 * 00101 * Command Command name RFD Subclause 00102 * Tx Rx */ 00103 #define MAC_ASSOC_REQ 0x01 // Association request X 7.3.1 00104 #define MAC_ASSOC_RESP 0x02 // Association response X 7.3.2 00105 #define MAC_DISASSOC_NOTIFY 0x03 // Disassociation notification X X 7.3.3 00106 #define MAC_DATA_REQ 0x04 // Data request X 7.3.4 00107 #define MAC_PAN_CONFLICT 0x05 // PAN ID conflict notification X 7.3.5 00108 #define MAC_ORPHAN 0x06 // Orphan notification X 7.3.6 00109 #define MAC_BEACON_REQ 0x07 // Beacon request 7.3.7 00110 #define MAC_COORD_REALIGN 0x08 // Coordinator realignment X 7.3.8 00111 #define MAC_GTS_REQ 0x09 // GTS request 7.3.9 00112 // 0x0a-0xff Reserved 00113 00114 #define MAC_CCA_MAX 8 00115 #define MAC_DEF_MIN_BE 3 00116 #define MAC_DEF_MAX_BE 5 00117 00118 typedef struct mac_active_scan { 00119 uint8_t pan_id[2]; 00120 uint8_t address[8]; 00121 uint8_t lqi; 00122 uint8_t beacon_scan_ok; 00123 } mac_active_scan; 00124 00125 #define MAC_EXT_ADDLIST_SIZE 8 00126 typedef struct mac_extented_address_table_t { 00127 uint8_t short_addr[2]; 00128 uint8_t addr[8]; 00129 } mac_extented_address_table_t; 00130 00131 typedef struct mac_tx_status_t { 00132 uint16_t length; 00133 uint8_t cca_cnt; 00134 uint8_t retry; 00135 } mac_tx_status_t; 00136 00137 typedef struct protocol_interface_rf_mac_setup { 00138 int8_t mac_interface_id; 00139 bool macUpState; 00140 bool shortAdressValid: 1; //Define Dynamic src address to mac16 when it is true 00141 bool beaconSrcAddressModeLong: 1; //This force beacon src to mac64 otherwise shortAdressValid will define type 00142 bool mac_extension_enabled:1; 00143 bool mac_ack_tx_active:1; 00144 bool mac_frame_pending:1; 00145 uint16_t mac_short_address; 00146 uint16_t pan_id; 00147 uint8_t mac64[8]; 00148 uint16_t coord_short_address; 00149 uint8_t coord_long_address[8]; 00150 /* MAC Capability Information */ 00151 bool macCapRxOnIdle:1; 00152 bool macCapCordinator:1; 00153 bool macCapAssocationPermit:1; 00154 bool macCapBatteryPowered:1; 00155 bool macCapSecrutityCapability:1; 00156 00157 bool macProminousMode:1; 00158 bool macGTSPermit:1; 00159 bool mac_security_enabled:1; 00160 /* Let trough packet which is secured properly (MIC authenticated group key) and src address is 64-bit*/ 00161 bool mac_security_bypass_unknow_device:1; 00162 /* Load balancing need this feature */ 00163 bool macAcceptAnyBeacon:1; 00164 00165 /* TX process Flag */ 00166 bool macTxProcessActive:1; 00167 bool macTxRequestAck:1; 00168 /* Data Poll state's */ 00169 bool macDataPollReq:1; 00170 bool macWaitingData:1; 00171 bool macRxDataAtPoll:1; 00172 /* Radio State flags */ 00173 bool macRfRadioOn:1; 00174 bool macRfRadioTxActive:1; 00175 bool macBroadcastDisabled:1; 00176 bool scan_active:1; 00177 bool rf_csma_extension_supported:1; 00178 /* CSMA Params */ 00179 unsigned macMinBE:4; 00180 unsigned macMaxBE:4; 00181 unsigned macCurrentBE:4; 00182 uint8_t macMaxCSMABackoffs; 00183 uint8_t backoff_period_in_10us; // max 2550us - it's 320us for standard 250kbps 00184 /* MAC channel parameters */ 00185 channel_list_s mac_channel_list; 00186 uint8_t scan_duration; //Needed??? 00187 mac_scan_type_t scan_type; 00188 00189 00190 uint8_t mac_channel; 00191 //uint8_t cca_failure; 00192 00193 /* MAC TX Queue */ 00194 uint16_t direct_queue_bytes; 00195 uint16_t unicast_queue_size; 00196 uint16_t broadcast_queue_size; 00197 struct mac_pre_build_frame *pd_data_request_queue_to_go; 00198 struct mac_pre_build_frame *pd_data_request_bc_queue_to_go; 00199 struct mac_pre_build_frame *active_pd_data_request; 00200 /* MAC Beacon info */ 00201 uint16_t max_beacon_payload_length; 00202 uint8_t *mac_beacon_payload; 00203 uint8_t mac_beacon_payload_size; 00204 uint8_t mac_bea_sequence; 00205 uint8_t mac_sequence; 00206 uint8_t mac_tx_retry; 00207 uint8_t mac_cca_retry; 00208 uint8_t mac_ack_wait_duration; 00209 uint8_t mac_mlme_retry_max; 00210 uint8_t aUnitBackoffPeriod; 00211 /* Indirect queue parameters */ 00212 struct mac_pre_build_frame *indirect_pd_data_request_queue; 00213 arm_event_t mac_mcps_timer_event; 00214 uint16_t indirect_pending_bytes; 00215 arm_nwk_mlme_event_type_e mac_mlme_event; 00216 mac_event_t timer_mac_event; 00217 mac_event_t mac_tx_result; 00218 uint16_t active_mac_events; 00219 int8_t mac_tasklet_id; 00220 int8_t mac_mcps_timer; 00221 int8_t mac_timer_id; 00222 int8_t ifs_timer_id; 00223 int8_t mlme_timer_id; 00224 int8_t cca_timer_id; 00225 int8_t bc_timer_id; 00226 uint32_t mlme_tick_count; 00227 uint32_t symbol_rate; 00228 uint32_t symbol_time_us; 00229 uint8_t max_ED; 00230 uint16_t mlme_ED_counter; 00231 mac_tx_status_t mac_tx_status; 00232 struct cca_structure_s *cca_structure; 00233 /* MAC Security components */ 00234 struct mlme_device_descriptor_s *device_description_table; 00235 uint8_t device_description_table_size; 00236 struct mlme_key_descriptor_s *key_description_table; 00237 uint8_t key_description_table_size; 00238 uint8_t key_lookup_list_size; 00239 uint8_t key_usage_list_size; 00240 mlme_key_device_descriptor_t *key_device_desc_buffer; 00241 mlme_key_usage_descriptor_t *key_usage_list_buffer; 00242 mlme_key_id_lookup_descriptor_t *key_lookup_buffer; 00243 struct mlme_security_level_descriptor_s *security_level_descriptor_table; 00244 uint8_t security_level_descriptor_table_size; 00245 uint32_t security_frame_counter; 00246 uint8_t mac_default_key_source[8]; 00247 mlme_security_t mac_auto_request; 00248 /* end of security part */ 00249 //Device driver and buffer 00250 struct arm_device_driver_list *dev_driver; 00251 dev_driver_tx_buffer_s dev_driver_tx_buffer; 00252 struct arm_device_driver_list * tun_extension_rf_driver; 00253 /* End of API Control */ 00254 struct mlme_scan_conf_s *mac_mlme_scan_resp; 00255 //beacon_join_priority_tx_cb *beacon_join_priority_tx_cb_ptr; 00256 struct mac_statistics_s *mac_statistics; 00257 /* FHSS API*/ 00258 struct fhss_api *fhss_api; 00259 } protocol_interface_rf_mac_setup_s; 00260 00261 00262 #define MAC_FCF_FRAME_TYPE_MASK 0x0007 00263 #define MAC_FCF_FRAME_TYPE_SHIFT 0 00264 #define MAC_FCF_SECURITY_BIT_MASK 0x0008 00265 #define MAC_FCF_SECURITY_BIT_SHIFT 3 00266 #define MAC_FCF_PENDING_BIT_MASK 0x0010 00267 #define MAC_FCF_PENDING_BIT_SHIFT 4 00268 #define MAC_FCF_ACK_REQ_BIT_MASK 0x0020 00269 #define MAC_FCF_ACK_REQ_BIT_SHIFT 5 00270 #define MAC_FCF_INTRA_PANID_MASK 0x0040 00271 #define MAC_FCF_INTRA_PANID_SHIFT 6 00272 #define MAC_FCF_SEQ_NUM_SUPPRESS_MASK 0x0100 00273 #define MAC_FCF_SEQ_NUM_SUPPRESS_SHIFT 8 00274 #define MAC_FCF_IE_PRESENTS_MASK 0x0200 00275 #define MAC_FCF_IE_PRESENTS_SHIFT 9 00276 #define MAC_FCF_DST_ADDR_MASK 0x0c00 00277 #define MAC_FCF_DST_ADDR_SHIFT 10 00278 #define MAC_FCF_VERSION_MASK 0x3000 00279 #define MAC_FCF_VERSION_SHIFT 12 00280 #define MAC_FCF_SRC_ADDR_MASK 0xc000 00281 #define MAC_FCF_SRC_ADDR_SHIFT 14 00282 00283 /* MAC supported frame types */ 00284 #define FC_BEACON_FRAME 0x00 00285 #define FC_DATA_FRAME 0x01 00286 #define FC_ACK_FRAME 0x02 00287 #define FC_CMD_FRAME 0x03 00288 00289 /* MAC virtual configuration types*/ 00290 #define MAC_BROADCAST_EVENT 0 00291 00292 #define MAC_DATA_PACKET_MIN_HEADER_LENGTH 11 00293 00294 #define MAC_DEFAULT_MAX_FRAME_RETRIES 3 00295 00296 // TODO: make this dynamic 00297 #define FHSS_SYNCH_INFO_START 20 00298 00299 #endif /* MAC_DEFINES_H_ */
Generated on Tue Aug 9 2022 00:37:12 by
1.7.2