diff target-utils/simagent/simup.c @ 782:badc5399d641

simagent: flush_rx_fifo() factored out
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Mar 2021 21:39:34 +0000
parents 6ec781e61e68
children
line wrap: on
line diff
--- a/target-utils/simagent/simup.c	Sat Mar 13 21:32:22 2021 +0000
+++ b/target-utils/simagent/simup.c	Sat Mar 13 21:39:34 2021 +0000
@@ -117,15 +117,9 @@
 	wait_ARM_cycles(WAIT_ONE_TDMA * 3);
 
 	/* flush any garbage in the Rx FIFO */
-	for (count = 0; ; ) {
-		if (SIMREGS.stat & SIM_STAT_FEMPTY)
-			break;
-		(void) SIMREGS.drx;
-		if (++count >= 32) {
-			printf("ERROR: Rx FIFO flush does not end\n");
-			return;
-		}
-	}
+	rc = flush_rx_fifo();
+	if (rc < 0)
+		return;
 	/* lift the card out of reset! */
 	SIMREGS.conf1 = conf1_reg |= SIM_CONF1_SRSTLEV;