aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-07-11 22:11:27 +0200
committerStephane D'Alu <sdalu@sdalu.com>2016-07-11 22:11:27 +0200
commit539338100fffb76e152be37228c4040fa072ba92 (patch)
treee73660bd3d81d691c64626c1ce36596664fb0f0a /os/hal
parent52107b2ccbf1b5ed29123d77d5cd3bc982fdee2e (diff)
downloadChibiOS-Contrib-539338100fffb76e152be37228c4040fa072ba92.tar.gz
ChibiOS-Contrib-539338100fffb76e152be37228c4040fa072ba92.tar.bz2
ChibiOS-Contrib-539338100fffb76e152be37228c4040fa072ba92.zip
deal with write buffer
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/ports/NRF5/LLD/hal_gpt_lld.c2
-rw-r--r--os/hal/ports/NRF5/LLD/hal_qei_lld.c20
-rw-r--r--os/hal/ports/NRF5/LLD/hal_rng_lld.c10
-rw-r--r--os/hal/ports/NRF5/LLD/hal_serial_lld.c16
-rw-r--r--os/hal/ports/NRF5/LLD/hal_st_lld.c36
-rw-r--r--os/hal/ports/NRF5/LLD/hal_st_lld.h12
6 files changed, 83 insertions, 13 deletions
diff --git a/os/hal/ports/NRF5/LLD/hal_gpt_lld.c b/os/hal/ports/NRF5/LLD/hal_gpt_lld.c
index e850e31..20dbcef 100644
--- a/os/hal/ports/NRF5/LLD/hal_gpt_lld.c
+++ b/os/hal/ports/NRF5/LLD/hal_gpt_lld.c
@@ -102,7 +102,9 @@ static uint8_t prescaler(uint16_t freq)
static void gpt_lld_serve_interrupt(GPTDriver *gptp) {
gptp->tim->EVENTS_COMPARE[gptp->cc_int] = 0;
+#if CORTEX_MODEL >= 4
(void)gptp->tim->EVENTS_COMPARE[gptp->cc_int];
+#endif
if (gptp->state == GPT_ONESHOT)
gptp->state = GPT_READY; /* Back in GPT_READY state. */
gptp->config->callback(gptp);
diff --git a/os/hal/ports/NRF5/LLD/hal_qei_lld.c b/os/hal/ports/NRF5/LLD/hal_qei_lld.c
index 9044897..d3b99cd 100644
--- a/os/hal/ports/NRF5/LLD/hal_qei_lld.c
+++ b/os/hal/ports/NRF5/LLD/hal_qei_lld.c
@@ -64,7 +64,10 @@ static void serve_interrupt(QEIDriver *qeip) {
*/
if (qdec->EVENTS_ACCOF) {
qdec->EVENTS_ACCOF = 0;
-
+#if CORTEX_MODEL >= 4
+ (void)qdec->EVENTS_ACCOF;
+#endif
+
qeip->overflowed++;
if (qeip->config->overflowed_cb)
qeip->config->overflowed_cb(qeip);
@@ -75,7 +78,10 @@ static void serve_interrupt(QEIDriver *qeip) {
*/
if (qdec->EVENTS_REPORTRDY) {
qdec->EVENTS_REPORTRDY = 0;
-
+#if CORTEX_MODEL >= 4
+ (void)qdec->EVENTS_REPORTRDY;
+#endif
+
/* Read (and clear counters due to shortcut) */
int16_t acc = ( int16_t)qdec->ACCREAD;
uint16_t accdbl = (uint16_t)qdec->ACCDBLREAD;
@@ -207,6 +213,11 @@ void qei_lld_start(QEIDriver *qeip) {
qdec->EVENTS_SAMPLERDY = 0;
qdec->EVENTS_REPORTRDY = 0;
qdec->EVENTS_ACCOF = 0;
+#if CORTEX_MODEL >= 4
+ (void)qdec->EVENTS_SAMPLERDY;
+ (void)qdec->EVENTS_REPORTRDY;
+ (void)qdec->EVENTS_ACCOF;
+#endif
}
/**
@@ -264,6 +275,11 @@ void qei_lld_enable(QEIDriver *qeip) {
qeip->qdec->EVENTS_SAMPLERDY = 0;
qeip->qdec->EVENTS_REPORTRDY = 0;
qeip->qdec->EVENTS_ACCOF = 0;
+#if CORTEX_MODEL >= 4
+ (void)qeip->qdec->EVENTS_SAMPLERDY;
+ (void)qeip->qdec->EVENTS_REPORTRDY;
+ (void)qeip->qdec->EVENTS_ACCOF;
+#endif
qeip->qdec->TASKS_START = 1;
}
diff --git a/os/hal/ports/NRF5/LLD/hal_rng_lld.c b/os/hal/ports/NRF5/LLD/hal_rng_lld.c
index 5e85981..9712150 100644
--- a/os/hal/ports/NRF5/LLD/hal_rng_lld.c
+++ b/os/hal/ports/NRF5/LLD/hal_rng_lld.c
@@ -95,7 +95,10 @@ void rng_lld_start(RNGDriver *rngp) {
/* Clear pending events */
rng->EVENTS_VALRDY = 0;
-
+#if CORTEX_MODEL >= 4
+ (void)rng->EVENTS_VALRDY;
+#endif
+
/* Set interrupt mask */
rng->INTENSET = RNG_INTENSET_VALRDY_Msk;
@@ -151,7 +154,10 @@ msg_t rng_lld_write(RNGDriver *rngp, uint8_t *buf, size_t n,
/* Mark as read */
rng->EVENTS_VALRDY = 0;
-
+#if CORTEX_MODEL >= 4
+ (void)rng->EVENTS_VALRDY;
+#endif
+
/* Clear interrupt so we can wake up again */
nvicClearPending(rngp->irq);
}
diff --git a/os/hal/ports/NRF5/LLD/hal_serial_lld.c b/os/hal/ports/NRF5/LLD/hal_serial_lld.c
index 31e5ade..42091e8 100644
--- a/os/hal/ports/NRF5/LLD/hal_serial_lld.c
+++ b/os/hal/ports/NRF5/LLD/hal_serial_lld.c
@@ -148,10 +148,12 @@ static void configure_uart(const SerialConfig *config)
/* Enable UART and clear events */
NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Enabled;
NRF_UART0->EVENTS_RXDRDY = 0;
- (void)NRF_UART0->EVENTS_RXDRDY;
NRF_UART0->EVENTS_TXDRDY = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_UART0->EVENTS_RXDRDY;
(void)NRF_UART0->EVENTS_TXDRDY;
-
+#endif
+
if (config->rx_pad != NRF5_SERIAL_PAD_DISCONNECTED) {
while (NRF_UART0->EVENTS_RXDRDY != 0) {
(void)NRF_UART0->RXD;
@@ -204,8 +206,10 @@ OSAL_IRQ_HANDLER(Vector48) {
if ((NRF_UART0->EVENTS_RXDRDY != 0) && (isr & UART_INTENSET_RXDRDY_Msk)) {
// Clear UART RX event flag
NRF_UART0->EVENTS_RXDRDY = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_UART0->EVENTS_RXDRDY;
-
+#endif
+
osalSysLockFromISR();
if (iqIsEmptyI(&sdp->iqueue))
chnAddFlagsI(sdp, CHN_INPUT_AVAILABLE);
@@ -219,8 +223,10 @@ OSAL_IRQ_HANDLER(Vector48) {
// Clear UART TX event flag.
NRF_UART0->EVENTS_TXDRDY = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_UART0->EVENTS_TXDRDY;
-
+#endif
+
osalSysLockFromISR();
b = oqGetI(&sdp->oqueue);
osalSysUnlockFromISR();
@@ -241,7 +247,9 @@ OSAL_IRQ_HANDLER(Vector48) {
if ((NRF_UART0->EVENTS_ERROR != 0) && (isr & UART_INTENSET_ERROR_Msk)) {
// Clear UART ERROR event flag.
NRF_UART0->EVENTS_ERROR = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_UART0->EVENTS_ERROR;
+#endif
}
diff --git a/os/hal/ports/NRF5/LLD/hal_st_lld.c b/os/hal/ports/NRF5/LLD/hal_st_lld.c
index c78b4bb..8e42029 100644
--- a/os/hal/ports/NRF5/LLD/hal_st_lld.c
+++ b/os/hal/ports/NRF5/LLD/hal_st_lld.c
@@ -65,8 +65,10 @@ OSAL_IRQ_HANDLER(Vector6C) {
OSAL_IRQ_PROLOGUE();
NRF_RTC0->EVENTS_TICK = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_RTC0->EVENTS_TICK;
-
+#endif
+
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
@@ -88,8 +90,10 @@ OSAL_IRQ_HANDLER(Vector84) {
OSAL_IRQ_PROLOGUE();
NRF_RTC1->EVENTS_TICK = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_RTC1->EVENTS_TICK;
-
+#endif
+
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
@@ -113,8 +117,10 @@ OSAL_IRQ_HANDLER(Vector60) {
/* Clear timer compare event */
if (NRF_TIMER0->EVENTS_COMPARE[0] != 0) {
NRF_TIMER0->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_TIMER0->EVENTS_COMPARE[0];
-
+#endif
+
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
@@ -140,8 +146,10 @@ OSAL_IRQ_HANDLER(Vector6C) {
if (NRF_RTC0->EVENTS_COMPARE[0]) {
NRF_RTC0->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_RTC0->EVENTS_COMPARE[0];
-
+#endif
+
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
@@ -150,7 +158,9 @@ OSAL_IRQ_HANDLER(Vector6C) {
#if OSAL_ST_RESOLUTION == 16
if (NRF_RTC0->EVENTS_COMPARE[1]) {
NRF_RTC0->EVENTS_COMPARE[1] = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_RTC0->EVENTS_COMPARE[1];
+#endif
NRF_RTC0->TASKS_CLEAR = 1;
}
#endif
@@ -173,8 +183,10 @@ OSAL_IRQ_HANDLER(Vector84) {
if (NRF_RTC1->EVENTS_COMPARE[0]) {
NRF_RTC1->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_RTC1->EVENTS_COMPARE[0];
-
+#endif
+
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
@@ -183,7 +195,9 @@ OSAL_IRQ_HANDLER(Vector84) {
#if OSAL_ST_RESOLUTION == 16
if (NRF_RTC1->EVENTS_COMPARE[1]) {
NRF_RTC1->EVENTS_COMPARE[1] = 0;
+#if CORTEX_MODEL >= 4
(void)NRF_RTC1->EVENTS_COMPARE[1];
+#endif
NRF_RTC1->TASKS_CLEAR = 1;
}
#endif
@@ -211,10 +225,16 @@ void st_lld_init(void) {
NRF_RTC0->PRESCALER = (NRF5_LFCLK_FREQUENCY / OSAL_ST_FREQUENCY) - 1;
NRF_RTC0->EVTENCLR = RTC_EVTENSET_COMPARE0_Msk;
NRF_RTC0->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_RTC0->EVENTS_COMPARE[0];
+#endif
NRF_RTC0->INTENSET = RTC_INTENSET_COMPARE0_Msk;
#if OSAL_ST_RESOLUTION == 16
NRF_RTC0->CC[1] = 0x10000; /* 2^16 */
NRF_RTC0->EVENTS_COMPARE[1] = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_RTC0->EVENTS_COMPARE[1];
+#endif
NRF_RTC0->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
NRF_RTC0->INTENSET = RTC_INTENSET_COMPARE1_Msk;
#endif
@@ -231,10 +251,16 @@ void st_lld_init(void) {
NRF_RTC1->PRESCALER = (NRF5_LFCLK_FREQUENCY / OSAL_ST_FREQUENCY) - 1;
NRF_RTC1->EVTENCLR = RTC_EVTENSET_COMPARE0_Msk;
NRF_RTC1->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_RTC1->EVENTS_COMPARE[0];
+#endif
NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk;
#if OSAL_ST_RESOLUTION == 16
NRF_RTC1->CC[1] = 0x10000; /* 2^16 */
NRF_RTC1->EVENTS_COMPARE[1] = 0;
+#if CORTEX_MODEL >= 4
+ NRF_RTC1->EVENTS_COMPARE[1];
+#endif
NRF_RTC1->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE1_Msk;
#endif
diff --git a/os/hal/ports/NRF5/LLD/hal_st_lld.h b/os/hal/ports/NRF5/LLD/hal_st_lld.h
index 7073e12..93c2abb 100644
--- a/os/hal/ports/NRF5/LLD/hal_st_lld.h
+++ b/os/hal/ports/NRF5/LLD/hal_st_lld.h
@@ -181,11 +181,17 @@ static inline void st_lld_start_alarm(systime_t abstime) {
#if NRF5_ST_USE_RTC0 == TRUE
NRF_RTC0->CC[0] = abstime;
NRF_RTC0->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_RTC0->EVENTS_COMPARE[0];
+#endif
NRF_RTC0->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
#endif
#if NRF5_ST_USE_RTC1 == TRUE
NRF_RTC1->CC[0] = abstime;
NRF_RTC1->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_RTC1->EVENTS_COMPARE[0];
+#endif
NRF_RTC1->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
#endif
#if NRF5_ST_USE_TIMER0 == TRUE
@@ -202,10 +208,16 @@ static inline void st_lld_stop_alarm(void) {
#if NRF5_ST_USE_RTC0 == TRUE
NRF_RTC0->EVTENCLR = RTC_EVTENCLR_COMPARE0_Msk;
NRF_RTC0->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_RTC0->EVENTS_COMPARE[0];
+#endif
#endif
#if NRF5_ST_USE_RTC1 == TRUE
NRF_RTC1->EVTENCLR = RTC_EVTENCLR_COMPARE0_Msk;
NRF_RTC1->EVENTS_COMPARE[0] = 0;
+#if CORTEX_MODEL >= 4
+ (void)NRF_RTC1->EVENTS_COMPARE[0];
+#endif
#endif
}