diff options
author | Fabio Utzig <utzig@utzig.org> | 2015-05-14 23:07:10 -0300 |
---|---|---|
committer | Fabio Utzig <utzig@utzig.org> | 2015-05-14 23:07:10 -0300 |
commit | aa43fd6554c1d35360c857a1b5d5fddcf1577a32 (patch) | |
tree | a3a28e1370c41e67e43559367286a4dad60db1a3 /os | |
parent | 3a0eb96f70dfb6bba5cfaab23e138c39f9228411 (diff) | |
download | ChibiOS-Contrib-aa43fd6554c1d35360c857a1b5d5fddcf1577a32.tar.gz ChibiOS-Contrib-aa43fd6554c1d35360c857a1b5d5fddcf1577a32.tar.bz2 ChibiOS-Contrib-aa43fd6554c1d35360c857a1b5d5fddcf1577a32.zip |
Use sleep/wakeup for serial driver top-half
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/ports/NRF51/NRF51822/serial_lld.c | 17 | ||||
-rw-r--r-- | os/hal/ports/NRF51/NRF51822/serial_lld.h | 3 |
2 files changed, 6 insertions, 14 deletions
diff --git a/os/hal/ports/NRF51/NRF51822/serial_lld.c b/os/hal/ports/NRF51/NRF51822/serial_lld.c index 6cb6943..ea687c8 100644 --- a/os/hal/ports/NRF51/NRF51822/serial_lld.c +++ b/os/hal/ports/NRF51/NRF51822/serial_lld.c @@ -98,7 +98,9 @@ static void notify1(io_queue_t *qp) chnAddFlagsI(&SD1, CHN_OUTPUT_EMPTY);
return;
}
+ SD1.thread = chThdGetSelfX();
NRF_UART0->TXD = b;
+ chEvtWaitAny((eventmask_t) 1);
}
#endif
@@ -123,25 +125,14 @@ OSAL_IRQ_HANDLER(Vector48) { }
if (NRF_UART0->EVENTS_TXDRDY) {
- msg_t b;
-
NRF_UART0->EVENTS_TXDRDY = 0;
-
osalSysLockFromISR();
- b = oqGetI(&SD1.oqueue);
+ chEvtSignalI(SD1.thread, (eventmask_t) 1);
osalSysUnlockFromISR();
-
- if (b < Q_OK) {
- osalSysLockFromISR();
- chnAddFlagsI(&SD1, CHN_OUTPUT_EMPTY);
- osalSysUnlockFromISR();
- } else {
- NRF_UART0->TXD = b;
- }
}
//TODO
- NRF_UART0->EVENTS_ERROR = 0;
+ //NRF_UART0->EVENTS_ERROR = 0;
OSAL_IRQ_EPILOGUE();
}
diff --git a/os/hal/ports/NRF51/NRF51822/serial_lld.h b/os/hal/ports/NRF51/NRF51822/serial_lld.h index ae8e46e..b7b1beb 100644 --- a/os/hal/ports/NRF51/NRF51822/serial_lld.h +++ b/os/hal/ports/NRF51/NRF51822/serial_lld.h @@ -88,7 +88,8 @@ typedef struct { uint8_t ib[SERIAL_BUFFERS_SIZE]; \
/* Output circular buffer.*/ \
uint8_t ob[SERIAL_BUFFERS_SIZE]; \
- /* End of the mandatory fields.*/
+ /* End of the mandatory fields.*/ \
+ thread_t *thread;
/*===========================================================================*/
/* Driver macros. */
|