Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: openthread: Added config options for EUI64 and OUI. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions drivers/ieee802154/Kconfig.nrf5
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,18 @@ config IEEE802154_NRF5_EXT_IRQ_MGMT
the system. One example of external radio IRQ provider could be
a radio arbiter used in dynamic multiprotocol applications.

config IEEE802154_NRF5_VENDOR_OUI
int "Vendor Organizationally Unique Identifier"
default 16043574
help
Custom vendor OUI for OpenThread,
which makes 24 oldest bits of MAC address

config IEEE802154_NRF5_EUI64_CUSTOM_SOURCE
bool "Custom EUI64 source support"
help
Enable providing EUI64 address
by custom, user implemented
nrf5_get_eui64() method

endif
18 changes: 17 additions & 1 deletion drivers/ieee802154/ieee802154_nrf5.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +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_NRF5_EUI64_CUSTOM_SOURCE
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++] = (CONFIG_IEEE802154_NRF5_VENDOR_OUI >> 16) & 0xff;
mac[index++] = (CONFIG_IEEE802154_NRF5_VENDOR_OUI >> 8) & 0xff;
mac[index++] = CONFIG_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);
}
#else
/* User defined implementation of method */
extern void nrf5_get_eui64(uint8_t *mac);
#endif

static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
{
Expand Down