view target-utils/simagent/byterx.c @ 771:9c1d580b50fb

simagent: Rx byte timeout test implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Mar 2021 20:39:18 +0000
parents
children badc5399d641
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);
}

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);
}