arch/nrf52: reimplement I-Cache control operations in nrf52_start.c
This commit is contained in:
parent
c70c178a7d
commit
d416ead27c
@ -110,78 +110,6 @@ static inline void nrf_mem_barrier(void)
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nrf_nvmc_enable_icache
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Enable I-Cache for Flash
|
|
||||||
*
|
|
||||||
* Input Parameter:
|
|
||||||
* flag - Flag to enable or disable.
|
|
||||||
*
|
|
||||||
* Returned Values:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void nrf_nvmc_enable_icache(bool flag)
|
|
||||||
{
|
|
||||||
uint32_t value;
|
|
||||||
|
|
||||||
/* Read the current icache configuration */
|
|
||||||
|
|
||||||
value = getreg32(NRF52_NVMC_ICACHECNF);
|
|
||||||
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
value |= NVMC_ICACHECNF_CACHEEN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= ~NVMC_ICACHECNF_CACHEEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup the new icache configuration */
|
|
||||||
|
|
||||||
putreg32(value, NRF52_NVMC_ICACHECNF);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nrf_nvmc_enable_profile
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Enable profiling I-Cache for flash
|
|
||||||
*
|
|
||||||
* Input Parameter:
|
|
||||||
* flag - Flag to enable or disable.
|
|
||||||
*
|
|
||||||
* Returned Values:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void nrf_nvmc_enable_profile(bool flag)
|
|
||||||
{
|
|
||||||
uint32_t value;
|
|
||||||
|
|
||||||
/* Read the current icache configuration */
|
|
||||||
|
|
||||||
value = getreg32(NRF52_NVMC_ICACHECNF);
|
|
||||||
|
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
value |= NVMC_ICACHECNF_CACHEPROFEN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= ~NVMC_ICACHECNF_CACHEPROFEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup the new icache configuration */
|
|
||||||
|
|
||||||
putreg32(value, NRF52_NVMC_ICACHECNF);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nrf_nvmc_get_profiling_ihit
|
* Name: nrf_nvmc_get_profiling_ihit
|
||||||
*
|
*
|
||||||
|
@ -146,38 +146,6 @@ void nrf_nvmc_write_bytes(uint32_t address, const uint8_t *src,
|
|||||||
void nrf_nvmc_write_words(uint32_t address, const uint32_t *src,
|
void nrf_nvmc_write_words(uint32_t address, const uint32_t *src,
|
||||||
uint32_t num_words);
|
uint32_t num_words);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nrf_nvmc_enable_icache
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Enable I-Cache for Flash
|
|
||||||
*
|
|
||||||
* Input Parameter:
|
|
||||||
* flag - Flag to enable or disable.
|
|
||||||
*
|
|
||||||
* Returned Values:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void nrf_nvmc_enable_icache(bool flag);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nrf_nvmc_enable_profile
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Enable profiling I-Cache for flash
|
|
||||||
*
|
|
||||||
* Input Parameter:
|
|
||||||
* flag - Flag to enable or disable.
|
|
||||||
*
|
|
||||||
* Returned Values:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void nrf_nvmc_enable_profile(bool flag);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nrf_nvmc_get_profiling_ihit
|
* Name: nrf_nvmc_get_profiling_ihit
|
||||||
*
|
*
|
||||||
|
@ -33,10 +33,9 @@
|
|||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
|
|
||||||
#include "arm_internal.h"
|
#include "arm_internal.h"
|
||||||
#include "nvic.h"
|
#include "hardware/nrf52_nvmc.h"
|
||||||
|
|
||||||
#include "nrf52_clockconfig.h"
|
|
||||||
#include "hardware/nrf52_utils.h"
|
#include "hardware/nrf52_utils.h"
|
||||||
|
#include "nrf52_clockconfig.h"
|
||||||
#include "nrf52_lowputc.h"
|
#include "nrf52_lowputc.h"
|
||||||
#include "nrf52_start.h"
|
#include "nrf52_start.h"
|
||||||
#include "nrf52_gpio.h"
|
#include "nrf52_gpio.h"
|
||||||
@ -71,6 +70,61 @@
|
|||||||
void __start(void) noinstrument_function;
|
void __start(void) noinstrument_function;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRF52_FLASH_PREFETCH
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nrf52_enable_icache
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Enable I-Cache for Flash
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* enable - enable or disable I-Cache
|
||||||
|
*
|
||||||
|
* Returned Values:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void nrf52_enable_icache(bool enable)
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
modifyreg32(NRF52_NVMC_ICACHECNF, 0, NVMC_ICACHECNF_CACHEEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modifyreg32(NRF52_NVMC_ICACHECNF, NVMC_ICACHECNF_CACHEEN, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nrf52_enable_profile
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Enable profiling I-Cache for flash
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* enable - enable or disable profiling for I-Cache
|
||||||
|
*
|
||||||
|
* Returned Values:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void nrf52_enable_profile(bool enable)
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
modifyreg32(NRF52_NVMC_ICACHECNF, 0, NVMC_ICACHECNF_CACHEPROFEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modifyreg32(NRF52_NVMC_ICACHECNF, NVMC_ICACHECNF_CACHEPROFEN, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -145,8 +199,8 @@ void __start(void)
|
|||||||
arm_fpuconfig();
|
arm_fpuconfig();
|
||||||
|
|
||||||
#ifdef CONFIG_NRF52_FLASH_PREFETCH
|
#ifdef CONFIG_NRF52_FLASH_PREFETCH
|
||||||
nrf_nvmc_enable_icache(true);
|
nrf52_enable_icache(true);
|
||||||
nrf_nvmc_enable_profile(true);
|
nrf52_enable_profile(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
showprogress('D');
|
showprogress('D');
|
||||||
|
Loading…
Reference in New Issue
Block a user