summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2011-01-19 11:38:36 +0100
committerAurelien Jarno <aurelien@aurel32.net>2011-01-20 12:37:20 +0100
commitb7d2b020934d0d3ae857ff486919601819e96dce (patch)
tree6c4eeabe66c850cdd89c34f12a9a86389609b912 /hw
parentb7277ac28908dbd9e95c3ce084da3d4e6539d0c8 (diff)
downloadqemu-b7d2b020934d0d3ae857ff486919601819e96dce.tar.gz
sh_serial: process all received characters
When operating on the SCIF, process all the received characters, as long as the FIFO can handle them. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw')
-rw-r--r--hw/sh_serial.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/hw/sh_serial.c b/hw/sh_serial.c
index ae9a207abc..191f4a60c6 100644
--- a/hw/sh_serial.c
+++ b/hw/sh_serial.c
@@ -293,26 +293,6 @@ static int sh_serial_can_receive(sh_serial_state *s)
return s->scr & (1 << 4);
}
-static void sh_serial_receive_byte(sh_serial_state *s, int ch)
-{
- if (s->feat & SH_SERIAL_FEAT_SCIF) {
- if (s->rx_cnt < SH_RX_FIFO_LENGTH) {
- s->rx_fifo[s->rx_head++] = ch;
- if (s->rx_head == SH_RX_FIFO_LENGTH)
- s->rx_head = 0;
- s->rx_cnt++;
- if (s->rx_cnt >= s->rtrg) {
- s->flags |= SH_SERIAL_FLAG_RDF;
- if (s->scr & (1 << 6) && s->rxi) {
- qemu_set_irq(s->rxi, 1);
- }
- }
- }
- } else {
- s->rx_fifo[0] = ch;
- }
-}
-
static void sh_serial_receive_break(sh_serial_state *s)
{
if (s->feat & SH_SERIAL_FEAT_SCIF)
@@ -328,7 +308,27 @@ static int sh_serial_can_receive1(void *opaque)
static void sh_serial_receive1(void *opaque, const uint8_t *buf, int size)
{
sh_serial_state *s = opaque;
- sh_serial_receive_byte(s, buf[0]);
+
+ if (s->feat & SH_SERIAL_FEAT_SCIF) {
+ int i;
+ for (i = 0; i < size; i++) {
+ if (s->rx_cnt < SH_RX_FIFO_LENGTH) {
+ s->rx_fifo[s->rx_head++] = buf[i];
+ if (s->rx_head == SH_RX_FIFO_LENGTH) {
+ s->rx_head = 0;
+ }
+ s->rx_cnt++;
+ if (s->rx_cnt >= s->rtrg) {
+ s->flags |= SH_SERIAL_FLAG_RDF;
+ if (s->scr & (1 << 6) && s->rxi) {
+ qemu_set_irq(s->rxi, 1);
+ }
+ }
+ }
+ }
+ } else {
+ s->rx_fifo[0] = buf[0];
+ }
}
static void sh_serial_event(void *opaque, int event)