deal with write buffer

This commit is contained in:
Stephane D'Alu 2016-07-11 22:11:27 +02:00
parent 52107b2ccb
commit 539338100f
6 changed files with 83 additions and 13 deletions

View File

@ -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);

View File

@ -64,6 +64,9 @@ 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)
@ -75,6 +78,9 @@ 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;
@ -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;
}

View File

@ -95,6 +95,9 @@ 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,6 +154,9 @@ 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);

View File

@ -148,9 +148,11 @@ 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) {
@ -204,7 +206,9 @@ 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))
@ -219,7 +223,9 @@ 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);
@ -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
}

View File

@ -65,7 +65,9 @@ OSAL_IRQ_HANDLER(Vector6C) {
OSAL_IRQ_PROLOGUE();
NRF_RTC0->EVENTS_TICK = 0;
#if CORTEX_MODEL >= 4
(void)NRF_RTC0->EVENTS_TICK;
#endif
osalSysLockFromISR();
osalOsTimerHandlerI();
@ -88,7 +90,9 @@ OSAL_IRQ_HANDLER(Vector84) {
OSAL_IRQ_PROLOGUE();
NRF_RTC1->EVENTS_TICK = 0;
#if CORTEX_MODEL >= 4
(void)NRF_RTC1->EVENTS_TICK;
#endif
osalSysLockFromISR();
osalOsTimerHandlerI();
@ -113,7 +117,9 @@ 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();
@ -140,7 +146,9 @@ 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();
@ -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,7 +183,9 @@ 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();
@ -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

View File

@ -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
}