drivers: ieee802154: Use secure services
Allows the setting of ieee802154 EUI64 address in non-secure processing environment by reading the FICR device ID through the secure service. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
02bd034255
commit
4b80afdd27
|
@ -23,6 +23,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
|||
#include <debug/stack.h>
|
||||
|
||||
#include <soc.h>
|
||||
#include <soc_secure.h>
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include <debug/stack.h>
|
||||
|
@ -69,16 +70,14 @@ static struct nrf5_802154_data nrf5_data;
|
|||
|
||||
#if defined(CONFIG_IEEE802154_NRF5_UICR_EUI64_ENABLE)
|
||||
#if defined(CONFIG_SOC_NRF5340_CPUAPP)
|
||||
#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
|
||||
#error "NRF_UICR->OTP is not supported to read from non-secure"
|
||||
#else
|
||||
#define EUI64_ADDR (NRF_UICR->OTP)
|
||||
#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE */
|
||||
#else
|
||||
#define EUI64_ADDR (NRF_UICR->CUSTOMER)
|
||||
#endif /* CONFIG_SOC_NRF5340_CPUAPP */
|
||||
#else
|
||||
#if defined(CONFIG_SOC_NRF5340_CPUAPP) || defined(CONFIG_SOC_NRF5340_CPUNET)
|
||||
#define EUI64_ADDR (NRF_FICR->INFO.DEVICEID)
|
||||
#else
|
||||
#define EUI64_ADDR (NRF_FICR->DEVICEID)
|
||||
#endif /* CONFIG_SOC_NRF5340_CPUAPP || CONFIG_SOC_NRF5340_CPUNET */
|
||||
#endif /* CONFIG_IEEE802154_NRF5_UICR_EUI64_ENABLE */
|
||||
|
||||
#if defined(CONFIG_IEEE802154_NRF5_UICR_EUI64_ENABLE)
|
||||
|
@ -108,15 +107,17 @@ static void nrf5_get_eui64(uint8_t *mac)
|
|||
uint32_t index = 0;
|
||||
|
||||
#if !defined(CONFIG_IEEE802154_NRF5_UICR_EUI64_ENABLE)
|
||||
uint32_t deviceid[2];
|
||||
|
||||
/* 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;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SOC_NRF5340_CPUAPP) && \
|
||||
defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
|
||||
#error Accessing EUI64 on the non-secure mode is not supported at the moment
|
||||
soc_secure_read_deviceid(deviceid);
|
||||
|
||||
factoryAddress = (uint64_t)deviceid[EUI64_ADDR_HIGH] << 32;
|
||||
factoryAddress |= deviceid[EUI64_ADDR_LOW];
|
||||
#else
|
||||
/* Use device identifier assigned during the production. */
|
||||
factoryAddress = (uint64_t)EUI64_ADDR[EUI64_ADDR_HIGH] << 32;
|
||||
|
|
Loading…
Reference in a new issue