mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #1061 from mbedmicro/revert-1047-master
Revert "Fixed interrupt handler in serial_api.c for the Nordic NRF51.pull/1062/head
commit
aec674b45f
|
@ -162,20 +162,14 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void UART0_IRQHandler()
|
void UART0_IRQHandler()
|
||||||
{
|
{
|
||||||
if((NRF_UART0->INTENSET & UART_INTENSET_TXDRDY_Msk) && NRF_UART0->EVENTS_TXDRDY)
|
uint32_t irtype = 0;
|
||||||
{
|
|
||||||
uart_irq(1, 0);
|
|
||||||
|
|
||||||
/* Explicitly clear TX flag to prevent interrupt from firing
|
if((NRF_UART0->INTENSET & 0x80) && NRF_UART0->EVENTS_TXDRDY) {
|
||||||
immediately after returning from ISR. This ensures that the
|
irtype = 1;
|
||||||
last interrupt in a transmission sequence is correcly handled.
|
} else if((NRF_UART0->INTENSET & 0x04) && NRF_UART0->EVENTS_RXDRDY) {
|
||||||
*/
|
irtype = 2;
|
||||||
NRF_UART0->EVENTS_TXDRDY = 0;
|
|
||||||
}
|
|
||||||
else if((NRF_UART0->INTENSET & UART_INTENSET_RXDRDY_Msk) && NRF_UART0->EVENTS_RXDRDY)
|
|
||||||
{
|
|
||||||
uart_irq(2, 0);
|
|
||||||
}
|
}
|
||||||
|
uart_irq(irtype, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -244,18 +238,6 @@ int serial_getc(serial_t *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_putc(serial_t *obj, int c)
|
void serial_putc(serial_t *obj, int c)
|
||||||
{
|
|
||||||
/* In interrupt mode, send character immediately. Otherwise, block until
|
|
||||||
UART is ready to receive next character before sending.
|
|
||||||
|
|
||||||
The TXDRDY flag is cleared in interrupt handler to ensure that it is
|
|
||||||
cleared even if there are no more characters to send.
|
|
||||||
*/
|
|
||||||
if (NRF_UART0->INTENSET & UART_INTENSET_TXDRDY_Msk)
|
|
||||||
{
|
|
||||||
obj->uart->TXD = (uint8_t)c;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
while (!serial_writable(obj)) {
|
while (!serial_writable(obj)) {
|
||||||
}
|
}
|
||||||
|
@ -263,7 +245,6 @@ void serial_putc(serial_t *obj, int c)
|
||||||
obj->uart->EVENTS_TXDRDY = 0;
|
obj->uart->EVENTS_TXDRDY = 0;
|
||||||
obj->uart->TXD = (uint8_t)c;
|
obj->uart->TXD = (uint8_t)c;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int serial_readable(serial_t *obj)
|
int serial_readable(serial_t *obj)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue