RTC: Rename functions to match new naming convention
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
886dc7389a
commit
a3dbb38acc
|
@ -12,7 +12,7 @@ src/HW_models/NRF_RADIO.c
|
|||
src/HW_models/NRF_AES_ECB.c
|
||||
src/HW_models/crc.c
|
||||
src/HW_models/irq_ctrl.c
|
||||
src/HW_models/NRF_RTC.c
|
||||
src/HW_models/NHW_RTC.c
|
||||
src/HW_models/bstest_ticker.c
|
||||
src/HW_models/NRF_NVMC.c
|
||||
src/HW_models/NRF_GPIO.c
|
||||
|
|
|
@ -10,6 +10,6 @@ src/HW_models/NHW_DPPI.c
|
|||
src/HW_models/NHW_CLOCK.c
|
||||
src/HW_models/NHW_EGU.c
|
||||
src/HW_models/NRF_RNG.c
|
||||
src/HW_models/NRF_RTC.c
|
||||
src/HW_models/NHW_RTC.c
|
||||
src/HW_models/NHW_TIMER.c
|
||||
src/HW_models/weak_stubs.c
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include "NHW_CLOCK.h"
|
||||
#include "nsi_hw_scheduler.h"
|
||||
#include "NHW_xPPI.h"
|
||||
#include "NRF_RTC.h"
|
||||
#include "NHW_RTC.h"
|
||||
#include "irq_ctrl.h"
|
||||
#include "bs_tracing.h"
|
||||
#include "bs_utils.h"
|
||||
|
@ -443,7 +443,7 @@ void nhw_clock_LFTimer_triggered(struct clkpwr_status *this) {
|
|||
|
||||
nhw_clock_signal_LFCLKSTARTED(this->inst);
|
||||
|
||||
nrf_rtc_notify_first_lf_tick();
|
||||
nhw_rtc_notify_first_lf_tick();
|
||||
} else if (this->LF_Clock_state == Stopping) {
|
||||
this->LF_Clock_state = Stopped;
|
||||
CLOCK_regs->LFCLKSTAT &= ~CLOCK_LFCLKSTAT_STATE_Msk;
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
#include "NHW_xPPI.h"
|
||||
#include "NHW_CLOCK.h"
|
||||
#include "irq_ctrl.h"
|
||||
#include "NRF_RTC.h"
|
||||
#include "NHW_RTC.h"
|
||||
|
||||
#define RTC_COUNTER_MASK 0xFFFFFF /*24 bits*/
|
||||
#define RTC_TRIGGER_OVERFLOW_COUNTER_VALUE 0xFFFFF0
|
||||
|
@ -147,7 +147,7 @@ NRF_RTC_Type NRF_RTC_regs[NHW_RTC_TOTAL_INST];
|
|||
|
||||
static bs_time_t sub_us_time_to_us_time(uint64_t sub_us_time);
|
||||
static uint64_t us_time_to_sub_us_time(bs_time_t us_time);
|
||||
static void nrf_rtc_TASKS_CLEAR(uint rtc);
|
||||
static void nhw_rtc_TASKS_CLEAR(uint rtc);
|
||||
static void nhw_rtc_signal_OVERFLOW(uint rtc);
|
||||
static void nhw_rtc_signal_COMPARE(uint rtc, uint cc);
|
||||
|
||||
|
@ -428,7 +428,7 @@ static void handle_overflow_event(uint rtc)
|
|||
nhw_rtc_signal_OVERFLOW(rtc);
|
||||
}
|
||||
|
||||
static void nrf_rtc_timer_triggered(void) {
|
||||
static void nhw_rtc_timer_triggered(void) {
|
||||
for (int rtc = 0; rtc < NHW_RTC_TOTAL_INST ; rtc++) {
|
||||
struct rtc_status *rtc_el = &nhw_rtc_st[rtc];
|
||||
if (rtc_el->running == false) {
|
||||
|
@ -450,7 +450,7 @@ static void nrf_rtc_timer_triggered(void) {
|
|||
nhw_rtc_update_master_timer();
|
||||
}
|
||||
|
||||
NSI_HW_EVENT(Timer_RTC, nrf_rtc_timer_triggered, 50);
|
||||
NSI_HW_EVENT(Timer_RTC, nhw_rtc_timer_triggered, 50);
|
||||
|
||||
/**
|
||||
* Check if an EVTEN or INTEN has the tick event set
|
||||
|
@ -461,7 +461,7 @@ static void check_not_supported_TICK(uint32_t i) {
|
|||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_notify_first_lf_tick(void) {
|
||||
void nhw_rtc_notify_first_lf_tick(void) {
|
||||
first_lf_tick_time_sub_us = get_time_in_sub_us();
|
||||
bs_trace_raw_time(9, "RTC: First lf tick\n");
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ void nrf_rtc_notify_first_lf_tick(void) {
|
|||
/*
|
||||
* Update the counter register so it can be read by SW
|
||||
*/
|
||||
void nrf_rtc_update_COUNTER(uint rtc) {
|
||||
void nhw_rtc_update_COUNTER(uint rtc) {
|
||||
struct rtc_status *this = &nhw_rtc_st[rtc];
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[rtc];
|
||||
|
||||
|
@ -487,7 +487,7 @@ void nrf_rtc_update_COUNTER(uint rtc) {
|
|||
/**
|
||||
* TASK_START triggered handler
|
||||
*/
|
||||
static void nrf_rtc_TASKS_START(uint rtc) {
|
||||
static void nhw_rtc_TASKS_START(uint rtc) {
|
||||
struct rtc_status *this = &nhw_rtc_st[rtc];
|
||||
|
||||
if (this->running == true) {
|
||||
|
@ -506,7 +506,7 @@ static void nrf_rtc_TASKS_START(uint rtc) {
|
|||
/**
|
||||
* TASK_STOP triggered handler
|
||||
*/
|
||||
static void nrf_rtc_TASKS_STOP(uint rtc) {
|
||||
static void nhw_rtc_TASKS_STOP(uint rtc) {
|
||||
struct rtc_status *this = &nhw_rtc_st[rtc];
|
||||
|
||||
if (this->running == false) {
|
||||
|
@ -529,7 +529,7 @@ static void nrf_rtc_TASKS_STOP(uint rtc) {
|
|||
/**
|
||||
* TASK_CLEAR triggered handler
|
||||
*/
|
||||
static void nrf_rtc_TASKS_CLEAR(uint rtc) {
|
||||
static void nhw_rtc_TASKS_CLEAR(uint rtc) {
|
||||
bs_trace_raw_time(5, "RTC%i: TASK_CLEAR\n", rtc);
|
||||
|
||||
/* Pre-scaler value is latched to an internal register on tasks START, CLEAR, and TRIGOVRFLW */
|
||||
|
@ -540,7 +540,7 @@ static void nrf_rtc_TASKS_CLEAR(uint rtc) {
|
|||
/**
|
||||
* TASK_TRIGGER_OVERFLOW triggered handler
|
||||
*/
|
||||
static void nrf_rtc_TASKS_TRIGOVRFLW(uint rtc) {
|
||||
static void nhw_rtc_TASKS_TRIGOVRFLW(uint rtc) {
|
||||
|
||||
bs_trace_raw_time(5, "RTC%i: TASK_TRIGGER_OVERFLOW\n", rtc);
|
||||
|
||||
|
@ -550,13 +550,13 @@ static void nrf_rtc_TASKS_TRIGOVRFLW(uint rtc) {
|
|||
}
|
||||
|
||||
#if (NHW_RTC_HAS_CAPTURE)
|
||||
static void nrf_rtc_TASKS_CAPTURE(uint rtc, uint cc_n) {
|
||||
static void nhw_rtc_TASKS_CAPTURE(uint rtc, uint cc_n) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[rtc];
|
||||
|
||||
nrf_rtc_update_COUNTER(rtc);
|
||||
nhw_rtc_update_COUNTER(rtc);
|
||||
RTC_regs->CC[cc_n] = RTC_regs->COUNTER;
|
||||
|
||||
nrf_rtc_regw_sideeffects_CC(rtc, cc_n);
|
||||
nhw_rtc_regw_sideeffects_CC(rtc, cc_n);
|
||||
}
|
||||
#endif /* NHW_RTC_HAS_CAPTURE */
|
||||
|
||||
|
@ -602,7 +602,7 @@ static void nhw_rtc_signal_COMPARE(uint rtc, uint cc)
|
|||
|
||||
#if (NHW_RTC_HAS_SHORT_COMP_CLEAR)
|
||||
if (RTC_regs->SHORTS & (RTC_SHORTS_COMPARE0_CLEAR_Msk << cc)) {
|
||||
nrf_rtc_TASKS_CLEAR(rtc);
|
||||
nhw_rtc_TASKS_CLEAR(rtc);
|
||||
bs_trace_warning_line_time("RTC: COMPARE->CLEAR short used, but CLEAR is instantaneous."
|
||||
"If you are using this to generate a periodic interrupt, the period"
|
||||
"will be 1 count too short\n");
|
||||
|
@ -713,49 +713,49 @@ static void nhw_rtc_signal_OVERFLOW(uint rtc)
|
|||
nhw_rtc_eval_interrupts(rtc);
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffect_TASKS_START(uint i) {
|
||||
void nhw_rtc_regw_sideeffect_TASKS_START(uint i) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[i];
|
||||
|
||||
if (RTC_regs->TASKS_START) {
|
||||
RTC_regs->TASKS_START = 0;
|
||||
nrf_rtc_TASKS_START(i);
|
||||
nhw_rtc_TASKS_START(i);
|
||||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffect_TASKS_STOP(uint i) {
|
||||
void nhw_rtc_regw_sideeffect_TASKS_STOP(uint i) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[i];
|
||||
|
||||
if (RTC_regs->TASKS_STOP) {
|
||||
RTC_regs->TASKS_STOP = 0;
|
||||
nrf_rtc_TASKS_STOP(i);
|
||||
nhw_rtc_TASKS_STOP(i);
|
||||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffect_TASKS_CLEAR(uint i) {
|
||||
void nhw_rtc_regw_sideeffect_TASKS_CLEAR(uint i) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[i];
|
||||
|
||||
if (RTC_regs->TASKS_CLEAR) {
|
||||
RTC_regs->TASKS_CLEAR = 0;
|
||||
nrf_rtc_TASKS_CLEAR(i);
|
||||
nhw_rtc_TASKS_CLEAR(i);
|
||||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffect_TASKS_TRIGOVRFLW(uint i) {
|
||||
void nhw_rtc_regw_sideeffect_TASKS_TRIGOVRFLW(uint i) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[i];
|
||||
|
||||
if (RTC_regs->TASKS_TRIGOVRFLW) {
|
||||
RTC_regs->TASKS_TRIGOVRFLW = 0;
|
||||
nrf_rtc_TASKS_TRIGOVRFLW(i);
|
||||
nhw_rtc_TASKS_TRIGOVRFLW(i);
|
||||
}
|
||||
}
|
||||
|
||||
#if (NHW_RTC_HAS_CAPTURE)
|
||||
void nrf_rtc_regw_sideeffect_TASKS_CAPTURE(uint i, uint cc) {
|
||||
void nhw_rtc_regw_sideeffect_TASKS_CAPTURE(uint i, uint cc) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[i];
|
||||
|
||||
if (RTC_regs->TASKS_CAPTURE[cc]) {
|
||||
RTC_regs->TASKS_CAPTURE[cc] = 0;
|
||||
nrf_rtc_TASKS_CAPTURE(i, cc);
|
||||
nhw_rtc_TASKS_CAPTURE(i, cc);
|
||||
}
|
||||
}
|
||||
#endif /* NHW_RTC_HAS_CAPTURE */
|
||||
|
@ -765,10 +765,10 @@ void nrf_rtc_regw_sideeffect_TASKS_CAPTURE(uint i, uint cc) {
|
|||
static void nhw_rtc_taskcapture_wrap(void* param) {
|
||||
unsigned int inst = (uintptr_t)param >> 16;
|
||||
uint cc_n = (uintptr_t)param & 0xFFFF;
|
||||
nrf_rtc_TASKS_CAPTURE(inst, cc_n);
|
||||
nhw_rtc_TASKS_CAPTURE(inst, cc_n);
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(uint inst, uint cc_n) {
|
||||
void nhw_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(uint inst, uint cc_n) {
|
||||
struct rtc_status *this = &nhw_rtc_st[inst];
|
||||
|
||||
nhw_dppi_common_subscribe_sideeffect(this->dppi_map,
|
||||
|
@ -778,13 +778,13 @@ void nrf_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(uint inst, uint cc_n) {
|
|||
(void*)((inst << 16) + cc_n));
|
||||
}
|
||||
|
||||
#define NRF_RTC_REGW_SIDEFFECTS_SUBSCRIBE(TASK_N) \
|
||||
#define NHW_RTC_REGW_SIDEFFECTS_SUBSCRIBE(TASK_N) \
|
||||
static void nhw_rtc_task##TASK_N##_wrap(void* param) \
|
||||
{ \
|
||||
nrf_rtc_TASKS_##TASK_N((int) param); \
|
||||
nhw_rtc_TASKS_##TASK_N((int) param); \
|
||||
} \
|
||||
\
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_##TASK_N(uint inst) \
|
||||
void nhw_rtc_regw_sideeffects_SUBSCRIBE_##TASK_N(uint inst) \
|
||||
{ \
|
||||
struct rtc_status *this = &nhw_rtc_st[inst]; \
|
||||
\
|
||||
|
@ -795,14 +795,14 @@ void nrf_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(uint inst, uint cc_n) {
|
|||
(void*) inst); \
|
||||
}
|
||||
|
||||
NRF_RTC_REGW_SIDEFFECTS_SUBSCRIBE(START)
|
||||
NRF_RTC_REGW_SIDEFFECTS_SUBSCRIBE(STOP)
|
||||
NRF_RTC_REGW_SIDEFFECTS_SUBSCRIBE(CLEAR)
|
||||
NRF_RTC_REGW_SIDEFFECTS_SUBSCRIBE(TRIGOVRFLW)
|
||||
NHW_RTC_REGW_SIDEFFECTS_SUBSCRIBE(START)
|
||||
NHW_RTC_REGW_SIDEFFECTS_SUBSCRIBE(STOP)
|
||||
NHW_RTC_REGW_SIDEFFECTS_SUBSCRIBE(CLEAR)
|
||||
NHW_RTC_REGW_SIDEFFECTS_SUBSCRIBE(TRIGOVRFLW)
|
||||
|
||||
#endif /* NHW_HAS_DPPI */
|
||||
|
||||
void nrf_rtc_regw_sideeffect_INTENSET(uint rtc)
|
||||
void nhw_rtc_regw_sideeffect_INTENSET(uint rtc)
|
||||
{
|
||||
struct rtc_status *this = &nhw_rtc_st[rtc];
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[rtc];
|
||||
|
@ -816,7 +816,7 @@ void nrf_rtc_regw_sideeffect_INTENSET(uint rtc)
|
|||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffect_INTENCLR(uint rtc)
|
||||
void nhw_rtc_regw_sideeffect_INTENCLR(uint rtc)
|
||||
{
|
||||
struct rtc_status *this = &nhw_rtc_st[rtc];
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[rtc];
|
||||
|
@ -830,7 +830,7 @@ void nrf_rtc_regw_sideeffect_INTENCLR(uint rtc)
|
|||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffect_EVTENSET(uint i) {
|
||||
void nhw_rtc_regw_sideeffect_EVTENSET(uint i) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[i];
|
||||
|
||||
if ( RTC_regs->EVTENSET ){
|
||||
|
@ -840,7 +840,7 @@ void nrf_rtc_regw_sideeffect_EVTENSET(uint i) {
|
|||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffect_EVTENCLR(uint i) {
|
||||
void nhw_rtc_regw_sideeffect_EVTENCLR(uint i) {
|
||||
NRF_RTC_Type *RTC_regs = &NRF_RTC_regs[i];
|
||||
|
||||
if ( RTC_regs->EVTENCLR ){
|
||||
|
@ -850,11 +850,11 @@ void nrf_rtc_regw_sideeffect_EVTENCLR(uint i) {
|
|||
}
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffects_EVENTS_all(uint rtc) {
|
||||
void nhw_rtc_regw_sideeffects_EVENTS_all(uint rtc) {
|
||||
nhw_rtc_eval_interrupts(rtc);
|
||||
}
|
||||
|
||||
void nrf_rtc_regw_sideeffects_CC(uint rtc, uint cc_n) {
|
||||
void nhw_rtc_regw_sideeffects_CC(uint rtc, uint cc_n) {
|
||||
struct rtc_status *this = &nhw_rtc_st[rtc];
|
||||
|
||||
if (this->running == true) {
|
||||
|
@ -864,16 +864,16 @@ void nrf_rtc_regw_sideeffects_CC(uint rtc, uint cc_n) {
|
|||
}
|
||||
|
||||
#if (NHW_HAS_PPI)
|
||||
void nrf_rtc0_TASKS_START(void) { nrf_rtc_TASKS_START(0); }
|
||||
void nrf_rtc0_TASKS_STOP(void) { nrf_rtc_TASKS_STOP(0); }
|
||||
void nrf_rtc0_TASKS_CLEAR(void) { nrf_rtc_TASKS_CLEAR(0); }
|
||||
void nrf_rtc0_TASKS_TRIGOVRFLW(void) { nrf_rtc_TASKS_TRIGOVRFLW(0); }
|
||||
void nrf_rtc1_TASKS_START(void) { nrf_rtc_TASKS_START(1); }
|
||||
void nrf_rtc1_TASKS_STOP(void) { nrf_rtc_TASKS_STOP(1); }
|
||||
void nrf_rtc1_TASKS_CLEAR(void) { nrf_rtc_TASKS_CLEAR(1); }
|
||||
void nrf_rtc1_TASKS_TRIGOVRFLW(void) { nrf_rtc_TASKS_TRIGOVRFLW(1); }
|
||||
void nrf_rtc2_TASKS_START(void) { nrf_rtc_TASKS_START(2); }
|
||||
void nrf_rtc2_TASKS_STOP(void) { nrf_rtc_TASKS_STOP(2); }
|
||||
void nrf_rtc2_TASKS_CLEAR(void) { nrf_rtc_TASKS_CLEAR(2); }
|
||||
void nrf_rtc2_TASKS_TRIGOVRFLW(void) { nrf_rtc_TASKS_TRIGOVRFLW(2); }
|
||||
void nhw_rtc0_TASKS_START(void) { nhw_rtc_TASKS_START(0); }
|
||||
void nhw_rtc0_TASKS_STOP(void) { nhw_rtc_TASKS_STOP(0); }
|
||||
void nhw_rtc0_TASKS_CLEAR(void) { nhw_rtc_TASKS_CLEAR(0); }
|
||||
void nhw_rtc0_TASKS_TRIGOVRFLW(void) { nhw_rtc_TASKS_TRIGOVRFLW(0); }
|
||||
void nhw_rtc1_TASKS_START(void) { nhw_rtc_TASKS_START(1); }
|
||||
void nhw_rtc1_TASKS_STOP(void) { nhw_rtc_TASKS_STOP(1); }
|
||||
void nhw_rtc1_TASKS_CLEAR(void) { nhw_rtc_TASKS_CLEAR(1); }
|
||||
void nhw_rtc1_TASKS_TRIGOVRFLW(void) { nhw_rtc_TASKS_TRIGOVRFLW(1); }
|
||||
void nhw_rtc2_TASKS_START(void) { nhw_rtc_TASKS_START(2); }
|
||||
void nhw_rtc2_TASKS_STOP(void) { nhw_rtc_TASKS_STOP(2); }
|
||||
void nhw_rtc2_TASKS_CLEAR(void) { nhw_rtc_TASKS_CLEAR(2); }
|
||||
void nhw_rtc2_TASKS_TRIGOVRFLW(void) { nhw_rtc_TASKS_TRIGOVRFLW(2); }
|
||||
#endif /* NHW_HAS_PPI */
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Oticon A/S
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef _NRF_HW_MODEL_RTC_H
|
||||
#define _NRF_HW_MODEL_RTC_H
|
||||
|
||||
#include "bs_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
void nrf_rtc_LF_tick(void);
|
||||
void nhw_rtc_update_COUNTER(uint rtc);
|
||||
void nhw_rtc_regw_sideeffect_TASKS_START(uint i);
|
||||
void nhw_rtc_regw_sideeffect_TASKS_STOP(uint i);
|
||||
void nhw_rtc_regw_sideeffect_TASKS_CLEAR(uint i);
|
||||
void nhw_rtc_regw_sideeffect_TASKS_TRIGOVRFLW(uint i);
|
||||
void nhw_rtc_regw_sideeffect_TASKS_CAPTURE(uint i, uint cc);
|
||||
void nhw_rtc_regw_sideeffect_INTENSET(uint i);
|
||||
void nhw_rtc_regw_sideeffect_INTENCLR(uint i);
|
||||
void nhw_rtc_regw_sideeffect_EVTENSET(uint i);
|
||||
void nhw_rtc_regw_sideeffect_EVTENCLR(uint i);
|
||||
void nhw_rtc_regw_sideeffects_EVENTS_all(uint rtc);
|
||||
void nhw_rtc_regw_sideeffects_CC(uint rtc, uint cc_n);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_START(uint inst);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_STOP(uint inst);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_CLEAR(uint inst);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_TRIGOVRFLW(uint inst);
|
||||
void nhw_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(uint inst, uint cc);
|
||||
void nhw_rtc_notify_first_lf_tick(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -26,7 +26,7 @@
|
|||
#include "NRF_GPIOTE.h"
|
||||
#include "NRF_RNG.h"
|
||||
#include "NRF_PPI.h"
|
||||
#include "NRF_RTC.h"
|
||||
#include "NHW_RTC.h"
|
||||
#include "NHW_TIMER.h"
|
||||
#include "NHW_CLOCK.h"
|
||||
#include "NRF_RADIO.h"
|
||||
|
@ -204,18 +204,18 @@ static const ppi_tasks_table_t ppi_tasks_table[]={ //just the ones we may use
|
|||
{ (void*)&NRF_TIMER_regs[4].TASKS_STOP, nhw_timer4_TASK_STOP},
|
||||
|
||||
//RTC:
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_CLEAR, nrf_rtc0_TASKS_CLEAR},
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_START, nrf_rtc0_TASKS_START},
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_STOP , nrf_rtc0_TASKS_STOP},
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_TRIGOVRFLW , nrf_rtc0_TASKS_TRIGOVRFLW},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_CLEAR, nrf_rtc1_TASKS_CLEAR},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_START, nrf_rtc1_TASKS_START},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_STOP , nrf_rtc1_TASKS_STOP},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_TRIGOVRFLW , nrf_rtc1_TASKS_TRIGOVRFLW},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_CLEAR, nrf_rtc2_TASKS_CLEAR},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_START, nrf_rtc2_TASKS_START},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_STOP , nrf_rtc2_TASKS_STOP},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_TRIGOVRFLW , nrf_rtc2_TASKS_TRIGOVRFLW},
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_CLEAR, nhw_rtc0_TASKS_CLEAR},
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_START, nhw_rtc0_TASKS_START},
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_STOP , nhw_rtc0_TASKS_STOP},
|
||||
//{ (void*)&(NRF_RTC_regs[0]).TASKS_TRIGOVRFLW , nhw_rtc0_TASKS_TRIGOVRFLW},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_CLEAR, nhw_rtc1_TASKS_CLEAR},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_START, nhw_rtc1_TASKS_START},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_STOP , nhw_rtc1_TASKS_STOP},
|
||||
//{ (void*)&(NRF_RTC_regs[1]).TASKS_TRIGOVRFLW , nhw_rtc1_TASKS_TRIGOVRFLW},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_CLEAR, nhw_rtc2_TASKS_CLEAR},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_START, nhw_rtc2_TASKS_START},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_STOP , nhw_rtc2_TASKS_STOP},
|
||||
//{ (void*)&(NRF_RTC_regs[2]).TASKS_TRIGOVRFLW , nhw_rtc2_TASKS_TRIGOVRFLW},
|
||||
|
||||
//RNG:
|
||||
{ (void*)&NRF_RNG_regs.TASKS_START, nrf_rng_task_start},
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Oticon A/S
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef _NRF_HW_MODEL_RTC_H
|
||||
#define _NRF_HW_MODEL_RTC_H
|
||||
|
||||
#include "bs_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
void nrf_rtc_LF_tick(void);
|
||||
void nrf_rtc_update_COUNTER(uint rtc);
|
||||
void nrf_rtc_regw_sideeffect_TASKS_START(uint i);
|
||||
void nrf_rtc_regw_sideeffect_TASKS_STOP(uint i);
|
||||
void nrf_rtc_regw_sideeffect_TASKS_CLEAR(uint i);
|
||||
void nrf_rtc_regw_sideeffect_TASKS_TRIGOVRFLW(uint i);
|
||||
void nrf_rtc_regw_sideeffect_TASKS_CAPTURE(uint i, uint cc);
|
||||
void nrf_rtc_regw_sideeffect_INTENSET(uint i);
|
||||
void nrf_rtc_regw_sideeffect_INTENCLR(uint i);
|
||||
void nrf_rtc_regw_sideeffect_EVTENSET(uint i);
|
||||
void nrf_rtc_regw_sideeffect_EVTENCLR(uint i);
|
||||
void nrf_rtc_regw_sideeffects_EVENTS_all(uint rtc);
|
||||
void nrf_rtc_regw_sideeffects_CC(uint rtc, uint cc_n);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_START(uint inst);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_STOP(uint inst);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_CLEAR(uint inst);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_TRIGOVRFLW(uint inst);
|
||||
void nrf_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(uint inst, uint cc);
|
||||
void nrf_rtc_notify_first_lf_tick(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
#include "hal/nrf_rtc.h"
|
||||
#include "bs_tracing.h"
|
||||
#include "NRF_RTC.h"
|
||||
#include "NHW_RTC.h"
|
||||
|
||||
static int rtc_number_from_ptr(NRF_RTC_Type const * p_reg){
|
||||
int i = ( (int)p_reg - (int)&NRF_RTC_regs[0] ) / sizeof(NRF_RTC_Type);
|
||||
|
@ -19,27 +19,27 @@ void nrf_rtc_cc_set(NRF_RTC_Type * p_reg, uint32_t ch, uint32_t cc_val)
|
|||
{
|
||||
p_reg->CC[ch] = cc_val;
|
||||
int i = rtc_number_from_ptr(p_reg);
|
||||
nrf_rtc_regw_sideeffects_CC(i, ch);
|
||||
nhw_rtc_regw_sideeffects_CC(i, ch);
|
||||
}
|
||||
|
||||
void nrf_rtc_int_enable(NRF_RTC_Type * p_reg, uint32_t mask)
|
||||
{
|
||||
int i = rtc_number_from_ptr(p_reg);
|
||||
p_reg->INTENSET = mask;
|
||||
nrf_rtc_regw_sideeffect_INTENSET(i);
|
||||
nhw_rtc_regw_sideeffect_INTENSET(i);
|
||||
}
|
||||
|
||||
void nrf_rtc_int_disable(NRF_RTC_Type * p_reg, uint32_t mask)
|
||||
{
|
||||
int i = rtc_number_from_ptr(p_reg);
|
||||
p_reg->INTENCLR = mask;
|
||||
nrf_rtc_regw_sideeffect_INTENCLR(i);
|
||||
nhw_rtc_regw_sideeffect_INTENCLR(i);
|
||||
}
|
||||
|
||||
uint32_t nrf_rtc_counter_get(NRF_RTC_Type const * p_reg)
|
||||
{
|
||||
int i = rtc_number_from_ptr(p_reg);
|
||||
nrf_rtc_update_COUNTER(i);
|
||||
nhw_rtc_update_COUNTER(i);
|
||||
return p_reg->COUNTER;
|
||||
}
|
||||
|
||||
|
@ -50,17 +50,17 @@ void nrf_rtc_task_trigger(NRF_RTC_Type * p_reg, nrf_rtc_task_t task)
|
|||
int i = rtc_number_from_ptr(p_reg);
|
||||
|
||||
if ( task == NRF_RTC_TASK_START ) {
|
||||
nrf_rtc_regw_sideeffect_TASKS_START(i);
|
||||
nhw_rtc_regw_sideeffect_TASKS_START(i);
|
||||
} else if ( task == NRF_RTC_TASK_STOP ) {
|
||||
nrf_rtc_regw_sideeffect_TASKS_STOP(i);
|
||||
nhw_rtc_regw_sideeffect_TASKS_STOP(i);
|
||||
} else if ( task == NRF_RTC_TASK_CLEAR ) {
|
||||
nrf_rtc_regw_sideeffect_TASKS_CLEAR(i);
|
||||
nhw_rtc_regw_sideeffect_TASKS_CLEAR(i);
|
||||
} else if ( task == NRF_RTC_TASK_TRIGGER_OVERFLOW ) {
|
||||
nrf_rtc_regw_sideeffect_TASKS_TRIGOVRFLW(i);
|
||||
nhw_rtc_regw_sideeffect_TASKS_TRIGOVRFLW(i);
|
||||
#if defined(RTC_TASKS_CAPTURE_TASKS_CAPTURE_Msk)
|
||||
} else if ( task >= NRF_RTC_TASK_CAPTURE_0 ) {
|
||||
int cc = (task - NRF_RTC_TASK_CAPTURE_0)/sizeof(uint32_t);
|
||||
nrf_rtc_regw_sideeffect_TASKS_CAPTURE(i, cc);
|
||||
nhw_rtc_regw_sideeffect_TASKS_CAPTURE(i, cc);
|
||||
#endif
|
||||
} else {
|
||||
bs_trace_error_line_time("Not supported task started in nrf_rtc %i\n", i);
|
||||
|
@ -72,21 +72,21 @@ void nrf_rtc_event_clear(NRF_RTC_Type * p_reg, nrf_rtc_event_t event)
|
|||
*((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0;
|
||||
|
||||
int i = rtc_number_from_ptr(p_reg);
|
||||
nrf_rtc_regw_sideeffects_EVENTS_all(i);
|
||||
nhw_rtc_regw_sideeffects_EVENTS_all(i);
|
||||
}
|
||||
|
||||
void nrf_rtc_event_enable(NRF_RTC_Type * p_reg, uint32_t mask)
|
||||
{
|
||||
int i = rtc_number_from_ptr(p_reg);
|
||||
p_reg->EVTENSET = mask;
|
||||
nrf_rtc_regw_sideeffect_EVTENSET(i);
|
||||
nhw_rtc_regw_sideeffect_EVTENSET(i);
|
||||
}
|
||||
|
||||
void nrf_rtc_event_disable(NRF_RTC_Type * p_reg, uint32_t event)
|
||||
{
|
||||
int i = rtc_number_from_ptr(p_reg);
|
||||
p_reg->EVTENCLR = event;
|
||||
nrf_rtc_regw_sideeffect_EVTENCLR(i);
|
||||
nhw_rtc_regw_sideeffect_EVTENCLR(i);
|
||||
}
|
||||
|
||||
#if defined(DPPI_PRESENT)
|
||||
|
@ -107,7 +107,7 @@ static void nrf_rtc_subscribe_common(NRF_RTC_Type * p_reg,
|
|||
#if defined(RTC_TASKS_CAPTURE_TASKS_CAPTURE_Msk)
|
||||
} else if (task >= NRF_RTC_TASK_CAPTURE_0) {
|
||||
int cc_n = (task - NRF_RTC_TASK_CAPTURE_0)/sizeof(uint32_t);
|
||||
nrf_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(i, cc_n);
|
||||
nhw_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(i, cc_n);
|
||||
#endif
|
||||
} else {
|
||||
bs_trace_error_line_time("Attempted to subscribe to a not-supported task in the nrf_rtc (%i)\n",
|
||||
|
|
Loading…
Reference in New Issue