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.
Fork of OmniWheels by
mac_defines.h
00001 /* 00002 * Copyright (c) 2014-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 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 uint16_t mac_short_address; 00143 uint16_t pan_id; 00144 uint8_t mac64[8]; 00145 uint16_t coord_short_address; 00146 uint8_t coord_long_address[8]; 00147 /* MAC Capability Information */ 00148 bool macCapRxOnIdle:1; 00149 bool macCapCordinator:1; 00150 bool macCapAssocationPermit:1; 00151 bool macCapBatteryPowered:1; 00152 bool macCapSecrutityCapability:1; 00153 00154 bool macProminousMode:1; 00155 bool macGTSPermit:1; 00156 bool mac_security_enabled:1; 00157 /* Load balancing need this feature */ 00158 bool macAcceptAnyBeacon:1; 00159 00160 /* TX process Flag */ 00161 bool macTxProcessActive:1; 00162 bool macTxRequestAck:1; 00163 /* Data Poll state's */ 00164 bool macDataPollReq:1; 00165 bool macWaitingData:1; 00166 bool macRxDataAtPoll:1; 00167 /* Radio State flags */ 00168 bool macRfRadioOn:1; 00169 bool macRfRadioTxActive:1; 00170 bool macBroadcastDisabled:1; 00171 bool scan_active:1; 00172 /* CSMA Params */ 00173 unsigned macMinBE:4; 00174 unsigned macMaxBE:4; 00175 unsigned macCurrentBE:4; 00176 uint8_t macMaxCSMABackoffs; 00177 uint8_t backoff_period_in_10us; // max 2550us - it's 320us for standard 250kbps 00178 /* MAC channel parameters */ 00179 channel_list_s mac_channel_list; 00180 uint8_t scan_duration; //Needed??? 00181 mac_scan_type_t scan_type; 00182 00183 00184 uint8_t mac_channel; 00185 //uint8_t cca_failure; 00186 00187 /* MAC TX Queue */ 00188 uint16_t direct_queue_bytes; 00189 uint16_t unicast_queue_size; 00190 uint16_t broadcast_queue_size; 00191 struct mac_pre_build_frame *pd_data_request_queue_to_go; 00192 struct mac_pre_build_frame *pd_data_request_bc_queue_to_go; 00193 struct mac_pre_build_frame *active_pd_data_request; 00194 /* MAC Beacon info */ 00195 uint16_t max_beacon_payload_length; 00196 uint8_t *mac_beacon_payload; 00197 uint8_t mac_beacon_payload_size; 00198 uint8_t mac_bea_sequence; 00199 uint8_t mac_sequence; 00200 uint8_t mac_tx_retry; 00201 uint8_t mac_cca_retry; 00202 uint8_t mac_ack_wait_duration; 00203 uint8_t mac_mlme_retry_max; 00204 /* Indirect queue parameters */ 00205 struct mac_pre_build_frame *indirect_pd_data_request_queue; 00206 arm_event_t mac_mcps_timer_event; 00207 uint16_t indirect_pending_bytes; 00208 arm_nwk_mlme_event_type_e mac_mlme_event; 00209 mac_event_t timer_mac_event; 00210 mac_event_t mac_tx_result; 00211 uint16_t active_mac_events; 00212 int8_t mac_tasklet_id; 00213 int8_t mac_mcps_timer; 00214 int8_t mac_timer_id; 00215 int8_t ifs_timer_id; 00216 int8_t mlme_timer_id; 00217 int8_t cca_timer_id; 00218 int8_t bc_timer_id; 00219 uint32_t mlme_tick_count; 00220 uint8_t max_ED; 00221 uint16_t mlme_ED_counter; 00222 mac_tx_status_t mac_tx_status; 00223 struct cca_structure_s *cca_structure; 00224 /* MAC Security components */ 00225 struct mlme_device_descriptor_s *device_description_table; 00226 uint8_t device_description_table_size; 00227 struct mlme_key_descriptor_s *key_description_table; 00228 uint8_t key_description_table_size; 00229 uint8_t key_lookup_list_size; 00230 uint8_t key_usage_list_size; 00231 mlme_key_device_descriptor_t *key_device_desc_buffer; 00232 mlme_key_usage_descriptor_t *key_usage_list_buffer; 00233 mlme_key_id_lookup_descriptor_t *key_lookup_buffer; 00234 struct mlme_security_level_descriptor_s *security_level_descriptor_table; 00235 uint8_t security_level_descriptor_table_size; 00236 uint32_t security_frame_counter; 00237 uint8_t mac_default_key_source[8]; 00238 mlme_security_t mac_auto_request; 00239 /* end of security part */ 00240 //Device driver and buffer 00241 struct arm_device_driver_list *dev_driver; 00242 dev_driver_tx_buffer_s dev_driver_tx_buffer; 00243 struct arm_device_driver_list * tun_extension_rf_driver; 00244 /* End of API Control */ 00245 struct mlme_scan_conf_s *mac_mlme_scan_resp; 00246 //beacon_join_priority_tx_cb *beacon_join_priority_tx_cb_ptr; 00247 struct mac_statistics_s *mac_statistics; 00248 /* FHSS API*/ 00249 struct fhss_api *fhss_api; 00250 } protocol_interface_rf_mac_setup_s; 00251 00252 00253 #define MAC_FCF_FRAME_TYPE_MASK 0x0007 00254 #define MAC_FCF_FRAME_TYPE_SHIFT 0 00255 #define MAC_FCF_SECURITY_BIT_MASK 0x0008 00256 #define MAC_FCF_SECURITY_BIT_SHIFT 3 00257 #define MAC_FCF_PENDING_BIT_MASK 0x0010 00258 #define MAC_FCF_PENDING_BIT_SHIFT 4 00259 #define MAC_FCF_ACK_REQ_BIT_MASK 0x0020 00260 #define MAC_FCF_ACK_REQ_BIT_SHIFT 5 00261 #define MAC_FCF_INTRA_PANID_MASK 0x0040 00262 #define MAC_FCF_INTRA_PANID_SHIFT 6 00263 #define MAC_FCF_DST_ADDR_MASK 0x0c00 00264 #define MAC_FCF_DST_ADDR_SHIFT 10 00265 #define MAC_FCF_VERSION_MASK 0x3000 00266 #define MAC_FCF_VERSION_SHIFT 12 00267 #define MAC_FCF_SRC_ADDR_MASK 0xc000 00268 #define MAC_FCF_SRC_ADDR_SHIFT 14 00269 00270 /* MAC supported frame types */ 00271 #define FC_BEACON_FRAME 0x00 00272 #define FC_DATA_FRAME 0x01 00273 #define FC_ACK_FRAME 0x02 00274 #define FC_CMD_FRAME 0x03 00275 00276 /* MAC virtual configuration types*/ 00277 #define MAC_BROADCAST_EVENT 0 00278 00279 #define MAC_DATA_PACKET_MIN_HEADER_LENGTH 11 00280 00281 #define MAC_DEFAULT_MAX_FRAME_RETRIES 3 00282 00283 // TODO: make this dynamic 00284 #define FHSS_SYNCH_INFO_START 20 00285 00286 #endif /* MAC_DEFINES_H_ */
Generated on Fri Jul 22 2022 04:53:53 by
 1.7.2 
    