diff --git a/subsys/net/ip/l2/ieee802154/ieee802154_frame.h b/subsys/net/ip/l2/ieee802154/ieee802154_frame.h index 70325a869b..599a780339 100644 --- a/subsys/net/ip/l2/ieee802154/ieee802154_frame.h +++ b/subsys/net/ip/l2/ieee802154/ieee802154_frame.h @@ -86,6 +86,7 @@ enum ieee802154_version { */ struct ieee802154_fcf_seq { struct { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ uint16_t frame_type :3; uint16_t security_enabled :1; uint16_t frame_pending :1; @@ -97,6 +98,19 @@ struct ieee802154_fcf_seq { uint16_t dst_addr_mode :2; uint16_t frame_version :2; uint16_t src_addr_mode :2; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + uint16_t reserved :1; + uint16_t pan_id_comp :1; + uint16_t ar :1; + uint16_t frame_pending :1; + uint16_t security_enabled :1; + uint16_t frame_type :3; + uint16_t src_addr_mode :2; + uint16_t frame_version :2; + uint16_t dst_addr_mode :2; + uint16_t ie_list :1; + uint16_t seq_num_suppr :1; +#endif } fc __packed; uint8_t sequence; @@ -138,34 +152,62 @@ struct ieee802154_mfr { }; struct ieee802154_gts_dir { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ uint8_t mask : 7; uint8_t reserved : 1; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + uint8_t reserved : 1; + uint8_t mask : 7; +#endif } __packed; struct ieee802154_gts { uint16_t short_address; +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ uint8_t starting_slot : 4; uint8_t length : 4; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + uint8_t length : 4; + uint8_t starting_slot : 4; +#endif } __packed; struct ieee802154_gts_spec { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /* Descriptor Count */ uint8_t desc_count : 3; uint8_t reserved : 4; /* GTS Permit */ uint8_t permit : 1; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + /* GTS Permit */ + uint8_t permit : 1; + uint8_t reserved : 4; + /* Descriptor Count */ + uint8_t desc_count : 3; +#endif } __packed; struct ieee802154_pas_spec { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /* Number of Short Addresses Pending */ uint8_t nb_sap : 3; uint8_t reserved_1 : 1; /* Number of Extended Addresses Pending */ uint8_t nb_eap : 3; uint8_t reserved_2 : 1; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + uint8_t reserved_1 : 1; + /* Number of Extended Addresses Pending */ + uint8_t nb_eap : 3; + uint8_t reserved_2 : 1; + /* Number of Short Addresses Pending */ + uint8_t nb_sap : 3; +#endif } __packed; struct ieee802154_beacon_sf { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /* Beacon Order*/ uint16_t bc_order : 4; /* Superframe Order*/ @@ -179,6 +221,21 @@ struct ieee802154_beacon_sf { uint16_t coordinator : 1; /* Association Permit */ uint16_t association : 1; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + /* Superframe Order*/ + uint16_t sf_order : 4; + /* Beacon Order*/ + uint16_t bc_order : 4; + /* Association Permit */ + uint16_t association : 1; + /* PAN Coordinator */ + uint16_t coordinator : 1; + uint16_t reserved : 1; + /* Battery Life Extension */ + uint16_t ble : 1; + /* Final CAP Slot */ + uint16_t cap_slot : 4; +#endif } __packed; struct ieee802154_beacon { @@ -191,6 +248,7 @@ struct ieee802154_beacon { /* See Section 5.3.1 */ struct ieee802154_cmd_assoc_req { struct { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ uint8_t reserved_1 : 1; uint8_t dev_type : 1; uint8_t power_src : 1; @@ -198,6 +256,15 @@ struct ieee802154_cmd_assoc_req { uint8_t reserved_2 : 2; uint8_t sec_capability : 1; uint8_t alloc_addr : 1; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + uint8_t alloc_addr : 1; + uint8_t sec_capability : 1; + uint8_t reserved_2 : 2; + uint8_t rx_on : 1; + uint8_t power_src : 1; + uint8_t dev_type : 1; + uint8_t reserved_1 : 1; +#endif } ci; } __packed; @@ -240,10 +307,17 @@ struct ieee802154_cmd_coord_realign { /* See Section 5.3.9 */ struct ieee802154_gts_request { struct { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ uint8_t length : 4; uint8_t direction : 1; uint8_t type : 1; uint8_t reserved : 2; +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + uint8_t reserved : 2; + uint8_t type : 1; + uint8_t direction : 1; + uint8_t length : 4; +#endif } gts; } __packed;