nhw_convert_periph_base_addr: Fix include for nrf5340

For the nrf5340 the nrf.h does not provide all peripheral
types but only for the core being built.
We need to use the NHW_peri_types.h header instead
which provides all peripheral types for the whole SOC we
are building.
Similarly nrf_bsim_redef.h header which is meant to hack the
nrf definitions and only provides declarations for the
registers structures for a given core. So we need to declare
the ones that are exclusive for either core here.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-03-08 15:14:45 +01:00
parent 3925b70307
commit 319e3ebd31
1 changed files with 21 additions and 1 deletions

View File

@ -7,8 +7,9 @@
#include <stddef.h>
#include <stdint.h>
#include "bs_tracing.h"
#include "nrf.h"
#include "NHW_config.h"
#include "NHW_peri_types.h"
#include "nrf_bsim_redef.h"
/*
* Get the name of a core/domain
@ -36,6 +37,25 @@ const char *nhw_get_core_name(unsigned int core_n)
*/
void *nhw_convert_periph_base_addr(void *hw_addr) {
#if defined(NRF5340)
/* The nrf_bsim_redef.h header which is meant to hack the
* nrf definitions only provides declarations for the
* registers structures for a given core. So we need to declare
* the ones that are exclusive for either core here.
*
* If at some point we have more uses for a bulk peripheral definitions
* of all peripherals in a SOC consider moving it to a separate header
*/
extern NRF_AAR_Type NRF_AAR_regs;
extern NRF_CCM_Type NRF_CCM_regs;
extern NRF_ECB_Type NRF_ECB_regs;
extern NRF_RADIO_Type NRF_RADIO_regs;
extern NRF_RNG_Type NRF_RNG_regs;
extern int NRF_SWI_regs[];
extern NRF_TEMP_Type NRF_TEMP_regs;
extern NRF_VREQCTRL_Type NRF_VREQCTRL_regs;
#endif
struct {
void* simu_addr;
uint32_t real_add;