mirror of https://github.com/ARMmbed/mbed-os.git
mbed-os v5.9 LPTICKER implementation
parent
b88329acb8
commit
0ddec48efc
|
@ -147,14 +147,23 @@ time_t rtc_read(void)
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
void lp_ticker_init(void)
|
void lp_ticker_init(void)
|
||||||
{
|
{
|
||||||
if (lp_ticker_inited) {
|
RTC_DisableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
|
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
|
||||||
NVIC_EnableIRQ(RTC0_IRQn);
|
NVIC_EnableIRQ(RTC0_IRQn);
|
||||||
init_rtc();
|
init_rtc();
|
||||||
lp_ticker_inited = 1;
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
void lp_ticker_free(void)
|
||||||
|
{
|
||||||
|
// Disable interrupt associated with LPTICKER API
|
||||||
|
RTC_DisableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
|
|
||||||
|
// RTC hardware is shared by LPTICKER and RTC APIs.
|
||||||
|
// Prior initialization of the RTC API gates disabling the RTC hardware.
|
||||||
|
if (!(MXC_RTCTMR->inten & MXC_F_RTC_INTEN_OVERFLOW)) {
|
||||||
|
RTC_Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
@ -167,13 +176,13 @@ uint32_t lp_ticker_read(void)
|
||||||
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
MXC_RTCTMR->comp[0] = timestamp;
|
MXC_RTCTMR->comp[0] = timestamp;
|
||||||
MXC_RTCTMR->flags = MXC_F_RTC_FLAGS_ASYNC_CLR_FLAGS;
|
MXC_RTCTMR->flags = MXC_F_RTC_FLAGS_COMP0;
|
||||||
MXC_RTCTMR->inten |= MXC_F_RTC_INTEN_COMP0;
|
RTC_EnableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
|
|
||||||
// Enable wakeup from RTC compare 0
|
// Enable as LP wakeup source
|
||||||
LP_ConfigRTCWakeUp(1, 0, 0, rtc_inited);
|
MXC_PWRSEQ->msk_flags |= MXC_F_PWRSEQ_FLAGS_RTC_CMPR0;
|
||||||
|
|
||||||
// Wait for pending transactions
|
// Postponed write pending wait for comp0 and flags
|
||||||
while (MXC_RTCTMR->ctrl & MXC_F_RTC_CTRL_PENDING);
|
while (MXC_RTCTMR->ctrl & MXC_F_RTC_CTRL_PENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +195,7 @@ void lp_ticker_disable_interrupt(void)
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
void lp_ticker_clear_interrupt(void)
|
void lp_ticker_clear_interrupt(void)
|
||||||
{
|
{
|
||||||
RTC_ClearFlags(MXC_F_RTC_FLAGS_ASYNC_CLR_FLAGS);
|
RTC_ClearFlags(MXC_F_RTC_FLAGS_COMP0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
|
@ -147,14 +147,23 @@ time_t rtc_read(void)
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
void lp_ticker_init(void)
|
void lp_ticker_init(void)
|
||||||
{
|
{
|
||||||
if (lp_ticker_inited) {
|
RTC_DisableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
|
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
|
||||||
NVIC_EnableIRQ(RTC0_IRQn);
|
NVIC_EnableIRQ(RTC0_IRQn);
|
||||||
init_rtc();
|
init_rtc();
|
||||||
lp_ticker_inited = 1;
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
void lp_ticker_free(void)
|
||||||
|
{
|
||||||
|
// Disable interrupt associated with LPTICKER API
|
||||||
|
RTC_DisableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
|
|
||||||
|
// RTC hardware is shared by LPTICKER and RTC APIs.
|
||||||
|
// Prior initialization of the RTC API gates disabling the RTC hardware.
|
||||||
|
if (!(MXC_RTCTMR->inten & MXC_F_RTC_INTEN_OVERFLOW)) {
|
||||||
|
RTC_Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
@ -167,13 +176,13 @@ uint32_t lp_ticker_read(void)
|
||||||
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
MXC_RTCTMR->comp[0] = timestamp;
|
MXC_RTCTMR->comp[0] = timestamp;
|
||||||
MXC_RTCTMR->flags = MXC_F_RTC_FLAGS_ASYNC_CLR_FLAGS;
|
MXC_RTCTMR->flags = MXC_F_RTC_FLAGS_COMP0;
|
||||||
MXC_RTCTMR->inten |= MXC_F_RTC_INTEN_COMP0;
|
RTC_EnableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
|
|
||||||
// Enable wakeup from RTC compare 0
|
// Enable as LP wakeup source
|
||||||
LP_ConfigRTCWakeUp(1, 0, 0, rtc_inited);
|
MXC_PWRSEQ->msk_flags |= MXC_F_PWRSEQ_FLAGS_RTC_CMPR0;
|
||||||
|
|
||||||
// Wait for pending transactions
|
// Postponed write pending wait for comp0 and flags
|
||||||
while (MXC_RTCTMR->ctrl & MXC_F_RTC_CTRL_PENDING);
|
while (MXC_RTCTMR->ctrl & MXC_F_RTC_CTRL_PENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +195,7 @@ void lp_ticker_disable_interrupt(void)
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
void lp_ticker_clear_interrupt(void)
|
void lp_ticker_clear_interrupt(void)
|
||||||
{
|
{
|
||||||
RTC_ClearFlags(MXC_F_RTC_FLAGS_ASYNC_CLR_FLAGS);
|
RTC_ClearFlags(MXC_F_RTC_FLAGS_COMP0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
|
@ -109,8 +109,8 @@ void rtc_free(void)
|
||||||
if (lp_ticker_inited) {
|
if (lp_ticker_inited) {
|
||||||
RTC_DisableINT(MXC_F_RTC_FLAGS_OVERFLOW);
|
RTC_DisableINT(MXC_F_RTC_FLAGS_OVERFLOW);
|
||||||
} else {
|
} else {
|
||||||
MXC_RTCTMR->ctrl |= MXC_F_RTC_CTRL_CLEAR;
|
MXC_RTCTMR->ctrl |= MXC_F_RTC_CTRL_CLEAR;
|
||||||
RTC_Stop();
|
RTC_Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,14 +147,23 @@ time_t rtc_read(void)
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
void lp_ticker_init(void)
|
void lp_ticker_init(void)
|
||||||
{
|
{
|
||||||
if (lp_ticker_inited) {
|
RTC_DisableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
|
NVIC_SetVector(RTC0_IRQn, (uint32_t)lp_ticker_irq_handler);
|
||||||
NVIC_EnableIRQ(RTC0_IRQn);
|
NVIC_EnableIRQ(RTC0_IRQn);
|
||||||
init_rtc();
|
init_rtc();
|
||||||
lp_ticker_inited = 1;
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
void lp_ticker_free(void)
|
||||||
|
{
|
||||||
|
// Disable interrupt associated with LPTICKER API
|
||||||
|
RTC_DisableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
|
|
||||||
|
// RTC hardware is shared by LPTICKER and RTC APIs.
|
||||||
|
// Prior initialization of the RTC API gates disabling the RTC hardware.
|
||||||
|
if (!(MXC_RTCTMR->inten & MXC_F_RTC_INTEN_OVERFLOW)) {
|
||||||
|
RTC_Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
@ -167,13 +176,13 @@ uint32_t lp_ticker_read(void)
|
||||||
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
void lp_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
MXC_RTCTMR->comp[0] = timestamp;
|
MXC_RTCTMR->comp[0] = timestamp;
|
||||||
MXC_RTCTMR->flags = MXC_F_RTC_FLAGS_ASYNC_CLR_FLAGS;
|
MXC_RTCTMR->flags = MXC_F_RTC_FLAGS_COMP0;
|
||||||
MXC_RTCTMR->inten |= MXC_F_RTC_INTEN_COMP0;
|
RTC_EnableINT(MXC_F_RTC_INTEN_COMP0);
|
||||||
|
|
||||||
// Enable wakeup from RTC compare 0
|
// Enable as LP wakeup source
|
||||||
LP_ConfigRTCWakeUp(1, 0, 0, rtc_inited);
|
MXC_PWRSEQ->msk_flags |= MXC_F_PWRSEQ_FLAGS_RTC_CMPR0;
|
||||||
|
|
||||||
// Wait for pending transactions
|
// Postponed write pending wait for comp0 and flags
|
||||||
while (MXC_RTCTMR->ctrl & MXC_F_RTC_CTRL_PENDING);
|
while (MXC_RTCTMR->ctrl & MXC_F_RTC_CTRL_PENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +195,7 @@ void lp_ticker_disable_interrupt(void)
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
void lp_ticker_clear_interrupt(void)
|
void lp_ticker_clear_interrupt(void)
|
||||||
{
|
{
|
||||||
RTC_ClearFlags(MXC_F_RTC_FLAGS_ASYNC_CLR_FLAGS);
|
RTC_ClearFlags(MXC_F_RTC_FLAGS_COMP0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
|
@ -2858,7 +2858,7 @@
|
||||||
"macros": ["TARGET=MAX32625","TARGET_REV=0x4132", "OPEN_DRAIN_LEDS"],
|
"macros": ["TARGET=MAX32625","TARGET_REV=0x4132", "OPEN_DRAIN_LEDS"],
|
||||||
"extra_labels": ["Maxim", "MAX32625"],
|
"extra_labels": ["Maxim", "MAX32625"],
|
||||||
"supported_toolchains": ["GCC_ARM", "IAR", "ARM"],
|
"supported_toolchains": ["GCC_ARM", "IAR", "ARM"],
|
||||||
"device_has": ["ANALOGIN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "STDIO_MESSAGES", "USTICKER"],
|
"device_has": ["ANALOGIN", "I2C", "INTERRUPTIN", "LPTICKER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "STDIO_MESSAGES", "USTICKER"],
|
||||||
"release_versions": ["2", "5"],
|
"release_versions": ["2", "5"],
|
||||||
"public": false
|
"public": false
|
||||||
},
|
},
|
||||||
|
@ -2893,9 +2893,9 @@
|
||||||
"macros": ["__SYSTEM_HFX=96000000", "TARGET=MAX32630", "TARGET_REV=0x4132", "BLE_HCI_UART", "OPEN_DRAIN_LEDS"],
|
"macros": ["__SYSTEM_HFX=96000000", "TARGET=MAX32630", "TARGET_REV=0x4132", "BLE_HCI_UART", "OPEN_DRAIN_LEDS"],
|
||||||
"extra_labels": ["Maxim", "MAX32630"],
|
"extra_labels": ["Maxim", "MAX32630"],
|
||||||
"supported_toolchains": ["GCC_ARM", "IAR", "ARM"],
|
"supported_toolchains": ["GCC_ARM", "IAR", "ARM"],
|
||||||
"device_has": ["ANALOGIN", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "STDIO_MESSAGES", "USTICKER"],
|
"device_has": ["ANALOGIN", "I2C", "INTERRUPTIN", "LPTICKER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "STDIO_MESSAGES", "USTICKER"],
|
||||||
"features": ["BLE"],
|
"features": ["BLE"],
|
||||||
"release_versions": []
|
"release_versions": ["2", "5"]
|
||||||
},
|
},
|
||||||
"EFM32": {
|
"EFM32": {
|
||||||
"inherits": ["Target"],
|
"inherits": ["Target"],
|
||||||
|
|
Loading…
Reference in New Issue