summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/sh/sh7750/sci/sh4uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libcpu/sh/sh7750/sci/sh4uart.c')
-rw-r--r--c/src/lib/libcpu/sh/sh7750/sci/sh4uart.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/c/src/lib/libcpu/sh/sh7750/sci/sh4uart.c b/c/src/lib/libcpu/sh/sh7750/sci/sh4uart.c
index 8400a20dd4..a2b2dadbc8 100644
--- a/c/src/lib/libcpu/sh/sh7750/sci/sh4uart.c
+++ b/c/src/lib/libcpu/sh/sh7750/sci/sh4uart.c
@@ -761,24 +761,21 @@ sh4uart2_interrupt_transmit(rtems_vector_number vec)
rtems_status_code
sh4uart_interrupt_write(sh4uart *uart, const char *buf, int len)
{
- volatile uint8_t *scr1 = (volatile uint8_t *)SH7750_SCSCR1;
- volatile uint16_t *scr2 = (volatile uint16_t *)SH7750_SCSCR2;
- int level;
-
- while ((SCSSR1 & SH7750_SCSSR1_TEND) == 0);
-
- rtems_interrupt_disable(level);
+ if (len > 0) {
+ volatile uint8_t *scr1 = (volatile uint8_t *)SH7750_SCSCR1;
+ volatile uint16_t *scr2 = (volatile uint16_t *)SH7750_SCSCR2;
- uart->tx_buf = buf;
- uart->tx_buf_len = len;
- uart->tx_ptr = 0;
+ while ((SCSSR1 & SH7750_SCSSR1_TEND) == 0);
- if (uart->chn == SH4_SCI)
- *scr1 |= SH7750_SCSCR_TIE;
- else
- *scr2 |= SH7750_SCSCR_TIE;
+ uart->tx_buf = buf;
+ uart->tx_buf_len = len;
+ uart->tx_ptr = 0;
- rtems_interrupt_enable(level);
+ if (uart->chn == SH4_SCI)
+ *scr1 |= SH7750_SCSCR_TIE;
+ else
+ *scr2 |= SH7750_SCSCR_TIE;
+ }
return RTEMS_SUCCESSFUL;
}