FreeCalypso > hg > freecalypso-tools
view target-utils/simagent/byterx.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 | 9c1d580b50fb |
children | c136a1a2474b |
line wrap: on
line source
#include <stdlib.h> #include "types.h" #include "simregs.h" rx_sim_byte(count) unsigned count; { for (; count; count--) { if (!(SIMREGS.stat & SIM_STAT_FEMPTY)) return SIMREGS.drx; } return(-1); } flush_rx_fifo() { unsigned count; 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(-1); } } return(0); } void cmd_sertimeout(argbulk) char *argbulk; { char *argv[2]; int count; if (parse_args(argbulk, 1, 1, argv, 0) < 0) return; count = atoi(argv[0]); rx_sim_byte(count); }