2018-12-22 01:53:34 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Nordic Semiconductor ASA
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief System/hardware module for Nordic Semiconductor nRF91 family processor
|
|
|
|
*
|
|
|
|
* This module provides routines to initialize and support board-level hardware
|
|
|
|
* for the Nordic Semiconductor nRF91 family processor.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <kernel.h>
|
|
|
|
#include <init.h>
|
2019-11-10 01:49:36 +08:00
|
|
|
#include <arch/arm/aarch32/cortex_m/cmsis.h>
|
2018-12-22 01:53:34 +08:00
|
|
|
#include <soc/nrfx_coredep.h>
|
|
|
|
#include <logging/log.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_RUNTIME_NMI
|
2019-10-01 03:31:07 +08:00
|
|
|
extern void z_arm_nmi_init(void);
|
|
|
|
#define NMI_INIT() z_arm_nmi_init()
|
2018-12-22 01:53:34 +08:00
|
|
|
#else
|
|
|
|
#define NMI_INIT()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_SOC_NRF9160)
|
|
|
|
#include <system_nrf9160.h>
|
|
|
|
#else
|
|
|
|
#error "Unknown SoC."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
|
|
|
|
LOG_MODULE_REGISTER(soc);
|
|
|
|
|
2020-05-01 02:33:38 +08:00
|
|
|
static int nordicsemi_nrf91_init(const struct device *arg)
|
2018-12-22 01:53:34 +08:00
|
|
|
{
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t key;
|
2018-12-22 01:53:34 +08:00
|
|
|
|
|
|
|
ARG_UNUSED(arg);
|
|
|
|
|
|
|
|
key = irq_lock();
|
|
|
|
|
|
|
|
#ifdef CONFIG_NRF_ENABLE_ICACHE
|
|
|
|
/* Enable the instruction cache */
|
|
|
|
NRF_NVMC->ICACHECNF = NVMC_ICACHECNF_CACHEEN_Msk;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Install default handler that simply resets the CPU
|
|
|
|
* if configured in the kernel, NOP otherwise
|
|
|
|
*/
|
|
|
|
NMI_INIT();
|
|
|
|
|
|
|
|
irq_unlock(key);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-28 00:26:57 +08:00
|
|
|
void arch_busy_wait(uint32_t time_us)
|
2018-12-22 01:53:34 +08:00
|
|
|
{
|
|
|
|
nrfx_coredep_delay_us(time_us);
|
|
|
|
}
|
|
|
|
|
|
|
|
SYS_INIT(nordicsemi_nrf91_init, PRE_KERNEL_1, 0);
|