Skip to content

Commit

Permalink
mac_addr(C6 and H2): Fix byte order of MAC_EXT and change format of I…
Browse files Browse the repository at this point in the history
…EEE802154 MAC

The changes only related to C6 and H2 chips where CONFIG_SOC_IEEE802154_SUPPORTED=y.
For this case these APIs return 8 bytes
    esp_efuse_mac_get_default() -> 8 bytes
    esp_efuse_mac_get_custom() -> 8 bytes
    esp_read_mac(..., ESP_MAC_IEEE802154) -> 8 bytes
The rest cases len is 6 bytes
  • Loading branch information
KonstantinKondrashov committed Jun 13, 2023
1 parent ea5e0ff commit e44a688
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 71 deletions.
6 changes: 4 additions & 2 deletions components/efuse/esp32c6/esp_efuse_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <assert.h>
#include "esp_efuse_table.h"

// md5_digest_table ab312e31f6976fdf923a9809093323fd
// md5_digest_table 344c54cf227f74643e4d13dce1b1d30f
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
Expand Down Expand Up @@ -481,7 +481,8 @@ static const esp_efuse_desc_t MAC[] = {
};

static const esp_efuse_desc_t MAC_EXT[] = {
{EFUSE_BLK1, 48, 16}, // [] Stores the extended bits of MAC address,
{EFUSE_BLK1, 56, 8}, // [] Stores the extended bits of MAC address,
{EFUSE_BLK1, 48, 8}, // [] Stores the extended bits of MAC address,
};

static const esp_efuse_desc_t WAFER_VERSION_MINOR[] = {
Expand Down Expand Up @@ -1142,6 +1143,7 @@ const esp_efuse_desc_t* ESP_EFUSE_MAC[] = {

const esp_efuse_desc_t* ESP_EFUSE_MAC_EXT[] = {
&MAC_EXT[0], // [] Stores the extended bits of MAC address
&MAC_EXT[1], // [] Stores the extended bits of MAC address
NULL
};

Expand Down
3 changes: 2 additions & 1 deletion components/efuse/esp32c6/esp_efuse_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ MAC, EFUSE_BLK1, 40, 8, [MAC_FACT
, EFUSE_BLK1, 16, 8, [MAC_FACTORY] MAC address
, EFUSE_BLK1, 8, 8, [MAC_FACTORY] MAC address
, EFUSE_BLK1, 0, 8, [MAC_FACTORY] MAC address
MAC_EXT, EFUSE_BLK1, 48, 16, [] Stores the extended bits of MAC address
MAC_EXT, EFUSE_BLK1, 56, 8, [] Stores the extended bits of MAC address
, EFUSE_BLK1, 48, 8, [] Stores the extended bits of MAC address
WAFER_VERSION_MINOR, EFUSE_BLK1, 114, 4, []
WAFER_VERSION_MAJOR, EFUSE_BLK1, 118, 2, []
PKG_VERSION, EFUSE_BLK1, 120, 3, [] Package version
Expand Down
2 changes: 1 addition & 1 deletion components/efuse/esp32c6/include/esp_efuse_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {

#include "esp_efuse.h"

// md5_digest_table ab312e31f6976fdf923a9809093323fd
// md5_digest_table 344c54cf227f74643e4d13dce1b1d30f
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
Expand Down
6 changes: 4 additions & 2 deletions components/efuse/esp32h2/esp_efuse_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <assert.h>
#include "esp_efuse_table.h"

// md5_digest_table 910e196e9c9c5c052f1c57710fe3977c
// md5_digest_table 47596a1f76a01780351e34b4785323dd
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
Expand Down Expand Up @@ -481,7 +481,8 @@ static const esp_efuse_desc_t MAC[] = {
};

static const esp_efuse_desc_t MAC_EXT[] = {
{EFUSE_BLK1, 48, 16}, // [] Stores the extended bits of MAC address,
{EFUSE_BLK1, 56, 8}, // [] Stores the extended bits of MAC address,
{EFUSE_BLK1, 48, 8}, // [] Stores the extended bits of MAC address,
};

static const esp_efuse_desc_t WAFER_VERSION_MINOR[] = {
Expand Down Expand Up @@ -1150,6 +1151,7 @@ const esp_efuse_desc_t* ESP_EFUSE_MAC[] = {

const esp_efuse_desc_t* ESP_EFUSE_MAC_EXT[] = {
&MAC_EXT[0], // [] Stores the extended bits of MAC address
&MAC_EXT[1], // [] Stores the extended bits of MAC address
NULL
};

Expand Down
3 changes: 2 additions & 1 deletion components/efuse/esp32h2/esp_efuse_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ MAC, EFUSE_BLK1, 40, 8, [MAC_FACT
, EFUSE_BLK1, 16, 8, [MAC_FACTORY] MAC address
, EFUSE_BLK1, 8, 8, [MAC_FACTORY] MAC address
, EFUSE_BLK1, 0, 8, [MAC_FACTORY] MAC address
MAC_EXT, EFUSE_BLK1, 48, 16, [] Stores the extended bits of MAC address
MAC_EXT, EFUSE_BLK1, 56, 8, [] Stores the extended bits of MAC address
, EFUSE_BLK1, 48, 8, [] Stores the extended bits of MAC address
WAFER_VERSION_MINOR, EFUSE_BLK1, 114, 3, []
WAFER_VERSION_MAJOR, EFUSE_BLK1, 117, 2, []
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK1, 119, 1, [] Disables check of wafer version major
Expand Down
2 changes: 1 addition & 1 deletion components/efuse/esp32h2/include/esp_efuse_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {

#include "esp_efuse.h"

// md5_digest_table 910e196e9c9c5c052f1c57710fe3977c
// md5_digest_table 47596a1f76a01780351e34b4785323dd
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
// If you want to change some fields, you need to change esp_efuse_table.csv file
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
Expand Down
42 changes: 21 additions & 21 deletions components/esp_hw_support/include/esp_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ extern "C" {
#endif

typedef enum {
ESP_MAC_WIFI_STA,
ESP_MAC_WIFI_SOFTAP,
ESP_MAC_BT,
ESP_MAC_ETH,
ESP_MAC_IEEE802154,
ESP_MAC_BASE,
ESP_MAC_EFUSE_FACTORY,
ESP_MAC_EFUSE_CUSTOM,
ESP_MAC_WIFI_STA, /**< MAC for WiFi Station (6 bytes) */
ESP_MAC_WIFI_SOFTAP, /**< MAC for WiFi Soft-AP (6 bytes) */
ESP_MAC_BT, /**< MAC for Bluetooth (6 bytes) */
ESP_MAC_ETH, /**< MAC for Ethernet (6 bytes) */
ESP_MAC_IEEE802154, /**< if CONFIG_SOC_IEEE802154_SUPPORTED=y, MAC for IEEE802154 (8 bytes) */
ESP_MAC_BASE, /**< Base MAC for that used for other MAC types (6 bytes) */
ESP_MAC_EFUSE_FACTORY, /**< MAC_FACTORY eFuse which was burned by Espressif in production (6 bytes) */
ESP_MAC_EFUSE_CUSTOM, /**< MAC_CUSTOM eFuse which was can be burned by customer (6 bytes) */
ESP_MAC_EFUSE_EXT, /**< if CONFIG_SOC_IEEE802154_SUPPORTED=y, MAC_EXT eFuse which is used as an extender for IEEE802154 MAC (2 bytes) */
} esp_mac_type_t;

/** @cond */
Expand Down Expand Up @@ -62,9 +63,8 @@ typedef enum {
* @note If not using a valid OUI, set the "locally administered" bit
* (bit value 0x02 in the first byte) to avoid collisions.
*
* @param mac base MAC address, length: 6 bytes/8 bytes.
* @param mac base MAC address, length: 6 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for IEEE 802.15.4)
*
* @return ESP_OK on success
* ESP_ERR_INVALID_ARG If mac is NULL or is not a unicast MAC
Expand All @@ -76,9 +76,8 @@ esp_err_t esp_base_mac_addr_set(const uint8_t *mac);
*
* @note If no custom Base MAC has been set, this returns the pre-programmed Espressif base MAC address.
*
* @param mac base MAC address, length: 6 bytes/8 bytes.
* @param mac base MAC address, length: 6 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for IEEE 802.15.4)
*
* @return ESP_OK on success
* ESP_ERR_INVALID_ARG mac is NULL
Expand All @@ -100,7 +99,7 @@ esp_err_t esp_base_mac_addr_get(uint8_t *mac);
*
* @param mac base MAC address, length: 6 bytes/8 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for IEEE 802.15.4)
* 8 bytes for EUI-64(used for IEEE 802.15.4, if CONFIG_SOC_IEEE802154_SUPPORTED=y)
*
* @return ESP_OK on success
* ESP_ERR_INVALID_ARG mac is NULL
Expand All @@ -115,7 +114,7 @@ esp_err_t esp_efuse_mac_get_custom(uint8_t *mac);
*
* @param mac base MAC address, length: 6 bytes/8 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for IEEE 802.15.4)
* 8 bytes for EUI-64(used for IEEE 802.15.4, if CONFIG_SOC_IEEE802154_SUPPORTED=y)
*
* @return ESP_OK on success
* ESP_ERR_INVALID_ARG mac is NULL
Expand All @@ -133,7 +132,7 @@ esp_err_t esp_efuse_mac_get_default(uint8_t *mac);
*
* @param mac base MAC address, length: 6 bytes/8 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for IEEE 802.15.4)
* 8 bytes for EUI-64(used for IEEE 802.15.4, if CONFIG_SOC_IEEE802154_SUPPORTED=y)
* @param type Type of MAC address to return
*
* @return ESP_OK on success
Expand All @@ -151,9 +150,8 @@ esp_err_t esp_read_mac(uint8_t *mac, esp_mac_type_t type);
* address, then the first octet is XORed with 0x4 in order to create a different
* locally administered MAC address.
*
* @param local_mac base MAC address, length: 6 bytes/8 bytes.
* @param local_mac base MAC address, length: 6 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for IEEE 802.15.4)
* @param universal_mac Source universal MAC address, length: 6 bytes.
*
* @return ESP_OK on success
Expand All @@ -166,7 +164,7 @@ esp_err_t esp_derive_local_mac(uint8_t *local_mac, const uint8_t *universal_mac)
*
* @param mac MAC address, length: 6 bytes/8 bytes.
* length: 6 bytes for MAC-48
* 8 bytes for EUI-64(used for ESP_MAC_IEEE802154 type)
* 8 bytes for EUI-64(used for ESP_MAC_IEEE802154 type, if CONFIG_SOC_IEEE802154_SUPPORTED=y)
* @param type Type of MAC address
*
* @return ESP_OK on success
Expand All @@ -176,9 +174,11 @@ esp_err_t esp_iface_mac_addr_set(const uint8_t *mac, esp_mac_type_t type);
/**
* @brief Return the size of the MAC type in bytes.
*
* If CONFIG_IEEE802154_ENABLED is set then for these types:
* ESP_MAC_IEEE802154, ESP_MAC_BASE, ESP_MAC_EFUSE_FACTORY and ESP_MAC_EFUSE_CUSTOM the MAC size is 8 bytes.
* If CONFIG_IEEE802154_ENABLED is not set then for all types it returns 6 bytes.
* If CONFIG_SOC_IEEE802154_SUPPORTED is set then for these types:
* - ESP_MAC_IEEE802154 is 8 bytes.
* - ESP_MAC_BASE, ESP_MAC_EFUSE_FACTORY and ESP_MAC_EFUSE_CUSTOM the MAC size is 6 bytes.
* - ESP_MAC_EFUSE_EXT is 2 bytes.
* If CONFIG_SOC_IEEE802154_SUPPORTED is not set then for all types it returns 6 bytes.
*
* @param type Type of MAC address
*
Expand Down
Loading

0 comments on commit e44a688

Please sign in to comment.