diff options
Diffstat (limited to 'os/hal')
-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. */
|