Skip to content

Commit ed4d0c0

Browse files
author
Jarkko Paso
authored
Merge pull request ARMmbed#2067 from ARMmbed/IOTTHD-3413
MAC: Cleaning data indication callback
2 parents dce4e25 + b3ec1f3 commit ed4d0c0

File tree

10 files changed

+262
-163
lines changed

10 files changed

+262
-163
lines changed

nanostack/platform/arm_hal_phy.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ typedef enum {
5454
PHY_LINK_CCA_PREPARE, /**< Prepare for CCA after CSMA-CA: changes to CCA channel and gives permission to TX. See PHY_LINK_CCA_PREPARE status definitions for return values */
5555
} phy_link_tx_status_e;
5656

57+
/** MAC filtering modes. Set corresponding bit to 1 (1 << MAC_FRAME_VERSION_X) in PHY_EXTENSION_FILTERING_SUPPORT request when PHY can handle the filtering of this frame type.
58+
* NOTE: Currently MAC supports filtering and Acking only 802.15.4-2015 frames. Any other frame version must be filtered and Acked by PHY with either HW or SW solution. */
59+
typedef enum {
60+
MAC_FRAME_VERSION_2 = 2 /**< 802.15.4-2015 */
61+
} phy_link_filters_e;
62+
5763
/** Extension types */
5864
typedef enum {
5965
PHY_EXTENSION_CTRL_PENDING_BIT, /**< Control MAC pending bit for indirect data. */
@@ -70,7 +76,8 @@ typedef enum {
7076
PHY_EXTENSION_GET_TIMESTAMP, /**< Read 32-bit constant monotonic time stamp in us */
7177
PHY_EXTENSION_SET_CSMA_PARAMETERS, /**< CSMA parameter's are given by phy_csma_params_t structure remember type cast uint8_t pointer to structure type*/
7278
PHY_EXTENSION_GET_SYMBOLS_PER_SECOND, /**< Read Symbols per seconds which will help to convert symbol time to real time */
73-
PHY_EXTENSION_SET_RF_CONFIGURATION /**< Set RF configuration using phy_rf_channel_parameters_s structure */
79+
PHY_EXTENSION_SET_RF_CONFIGURATION, /**< Set RF configuration using phy_rf_channel_parameters_s structure */
80+
PHY_EXTENSION_FILTERING_SUPPORT /**< Return filtering modes that can be supported by the PHY driver. See phy_link_filters_e */
7481
} phy_extension_type_e;
7582

7683
/** Address types */

source/MAC/IEEE802_15_4/mac_defines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ typedef struct protocol_interface_rf_mac_setup {
192192
unsigned macCurrentBE: 4;
193193
uint8_t macMaxCSMABackoffs;
194194
uint8_t backoff_period_in_10us; // max 2550us - it's 320us for standard 250kbps
195+
uint8_t mac_frame_filters;
195196
/* MAC channel parameters */
196197
channel_list_s mac_channel_list;
197198
uint8_t scan_duration; //Needed???

source/MAC/IEEE802_15_4/mac_header_helper_functions.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ const uint8_t *mac_header_parse_fcf_dsn(mac_fcf_sequence_t *header, const uint8_
267267
} else {
268268
header->DSN = 0;
269269
}
270+
//Check PanID presents at header
271+
header->DstPanPresents = mac_dst_panid_present(header);
272+
header->SrcPanPresents = mac_src_panid_present(header);
270273
return ptr;
271274

272275
}

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,6 @@ static int8_t mac_virtual_data_req_handler(protocol_interface_rf_mac_setup_s *rf
362362
}
363363

364364
mac_header_parse_fcf_dsn(&buffer->fcf_dsn, data_ptr);
365-
buffer->fcf_dsn.DstPanPresents = mac_dst_panid_present(&buffer->fcf_dsn);
366-
buffer->fcf_dsn.SrcPanPresents = mac_src_panid_present(&buffer->fcf_dsn);
367365
// Use MAC sequence as handle
368366
buffer->msduHandle = buffer->fcf_dsn.DSN;
369367
memcpy(buffer->mac_payload, data_ptr, data_length);
@@ -982,11 +980,6 @@ static void mac_data_interface_frame_handler(mac_pre_parsed_frame_t *buf)
982980
mcps_sap_pre_parsed_frame_buffer_free(buf);
983981
return;
984982
}
985-
986-
if (mac_filter_modify_link_quality(rf_mac_setup->mac_interface_id, buf) == 1) {
987-
mcps_sap_pre_parsed_frame_buffer_free(buf);
988-
return;
989-
}
990983
/* push data to stack if sniffer mode is enabled */
991984
if (rf_mac_setup->macProminousMode) {
992985
mac_nap_tun_data_handler(buf, rf_mac_setup);
@@ -1607,9 +1600,8 @@ static int8_t mcps_generic_packet_build(protocol_interface_rf_mac_setup_s *rf_pt
16071600
return 0;
16081601
}
16091602

1610-
int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, const mac_fcf_sequence_t *fcf, const uint8_t *data_ptr, const mcps_ack_data_payload_t *ack_payload, uint32_t rx_time)
1603+
int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, const mac_fcf_sequence_t *fcf, const uint8_t *data_ptr, const mcps_ack_data_payload_t *ack_payload)
16111604
{
1612-
(void)rx_time;
16131605
phy_device_driver_s *dev_driver = rf_ptr->dev_driver->phy_driver;
16141606
dev_driver_tx_buffer_s *tx_buf = &rf_ptr->dev_driver_tx_buffer;
16151607

source/MAC/IEEE802_15_4/mac_mcps_sap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,6 @@ uint8_t mcps_sap_purge_reg_handler(struct protocol_interface_rf_mac_setup *rf_ma
214214

215215
int8_t mcps_pd_data_rebuild(struct protocol_interface_rf_mac_setup *rf_ptr, mac_pre_build_frame_t *buffer);
216216

217-
int8_t mcps_generic_ack_build(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, uint32_t rx_time);
217+
int8_t mcps_generic_ack_build(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);
218218

219219
#endif /* MAC_IEEE802_15_4_MAC_MCPS_SAP_H_ */

source/MAC/IEEE802_15_4/mac_mlme.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,10 @@ protocol_interface_rf_mac_setup_s *mac_mlme_data_base_allocate(uint8_t *mac64, a
11541154
bool rf_support = false;
11551155
dev_driver->phy_driver->extension(PHY_EXTENSION_DYNAMIC_RF_SUPPORTED, (uint8_t *)&rf_support);
11561156
entry->rf_csma_extension_supported = rf_support;
1157+
dev_driver->phy_driver->extension(PHY_EXTENSION_FILTERING_SUPPORT, (uint8_t *)&entry->mac_frame_filters);
1158+
if (entry->mac_frame_filters & (1 << MAC_FRAME_VERSION_2)) {
1159+
tr_debug("PHY supports 802.15.4-2015 frame filtering");
1160+
}
11571161
mac_mlme_set_symbol_rate(entry);
11581162

11591163
//How many 10us ticks backoff period is for waiting 20symbols which is typically 10 bytes time

0 commit comments

Comments
 (0)