drivers: nrf: Added config option for OUI.
Support for defining vendor specific OUI (Organizationally Unique Identifier) was added. Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
This commit is contained in:
parent
af944ff665
commit
e4d20caee9
2 changed files with 36 additions and 1 deletions
|
@ -39,6 +39,24 @@ config IEEE802154_RDEV
|
|||
help
|
||||
PHY is a ranging-capable device (RDEV)
|
||||
|
||||
config IEEE802154_VENDOR_OUI_ENABLE
|
||||
bool "Enables setting Vendor Organizationally Unique Identifier"
|
||||
help
|
||||
This option enables setting custom vendor
|
||||
OUI using IEEE802154_VENDOR_OUI. After enabling,
|
||||
user is obliged to set IEEE802154_VENDOR_OUI value,
|
||||
as this option has no default value.
|
||||
|
||||
if IEEE802154_VENDOR_OUI_ENABLE
|
||||
|
||||
config IEEE802154_VENDOR_OUI
|
||||
int "Vendor Organizationally Unique Identifier"
|
||||
help
|
||||
Custom vendor OUI, which makes 24 most-significant
|
||||
bits of MAC address
|
||||
|
||||
endif # IEEE802154_VENDOR_OUI_ENABLE
|
||||
|
||||
source "drivers/ieee802154/Kconfig.cc2520"
|
||||
|
||||
source "drivers/ieee802154/Kconfig.kw41z"
|
||||
|
|
|
@ -60,9 +60,26 @@ static struct nrf5_802154_data nrf5_data;
|
|||
#define NRF5_802154_CFG(dev) \
|
||||
((const struct nrf5_802154_config * const)(dev)->config_info)
|
||||
|
||||
#if CONFIG_IEEE802154_VENDOR_OUI_ENABLE
|
||||
#define IEEE802154_NRF5_VENDOR_OUI CONFIG_IEEE802154_VENDOR_OUI
|
||||
#else
|
||||
#define IEEE802154_NRF5_VENDOR_OUI (uint32_t)0xF4CE36
|
||||
#endif
|
||||
|
||||
static void nrf5_get_eui64(uint8_t *mac)
|
||||
{
|
||||
memcpy(mac, (const uint32_t *)&NRF_FICR->DEVICEID, 8);
|
||||
uint64_t factoryAddress;
|
||||
uint32_t index = 0;
|
||||
|
||||
/* Set the MAC Address Block Larger (MA-L) formerly called OUI. */
|
||||
mac[index++] = (IEEE802154_NRF5_VENDOR_OUI >> 16) & 0xff;
|
||||
mac[index++] = (IEEE802154_NRF5_VENDOR_OUI >> 8) & 0xff;
|
||||
mac[index++] = IEEE802154_NRF5_VENDOR_OUI & 0xff;
|
||||
|
||||
/* Use device identifier assigned during the production. */
|
||||
factoryAddress = (uint64_t)NRF_FICR->DEVICEID[0] << 32;
|
||||
factoryAddress |= NRF_FICR->DEVICEID[1];
|
||||
memcpy(mac + index, &factoryAddress, sizeof(factoryAddress) - index);
|
||||
}
|
||||
|
||||
static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue