예제 #1
0
static int
s3c2410_getc(struct uart_bas *bas, struct mtx *mtx)
{
	while (!sscom_rxrdy(bas->bst, bas->bsh))
		continue;

	return sscom_getc(bas->bst, bas->bsh);
}
예제 #2
0
파일: sscom.c 프로젝트: MarginC/kame
int
getchar(void)
{
	uint8_t stat;
	int c;

	while (!sscom_rxrdy())
		/* spin */ ;
	c = INB(SSCOM_URXH);
	stat = INB(SSCOM_UERSTAT);	/* XXX */

	return c;
}
예제 #3
0
/*
 * Console kernel output character routine.
 */
void
sscomcnputc(dev_t dev, int c)
{
	int s = splserial();
	int timo;

	int cin;
	int __attribute__((__unused__)) stat;
	if (sscom_readaheadcount < MAX_READAHEAD && 
	    sscom_rxrdy(sscomconstag, sscomconsioh)) {
	    
		int __attribute__((__unused__))cn_trapped = 0;
		cin = sscom_getc(sscomconstag, sscomconsioh);
		stat = sscom_geterr(sscomconstag, sscomconsioh);
		cn_check_magic(dev, cin, sscom_cnm_state);
		sscom_readahead[sscom_readaheadcount++] = cin;
	}
예제 #4
0
static void
sscom_iflush(struct sscom_softc *sc)
{
	bus_space_tag_t iot = sc->sc_iot;
	bus_space_handle_t ioh = sc->sc_ioh;
	int timo;


	timo = 50000;
	/* flush any pending I/O */
	while ( sscom_rxrdy(iot, ioh) && --timo)
		(void)sscom_getc(iot,ioh);
#ifdef DIAGNOSTIC
	if (!timo)
		printf("%s: sscom_iflush timeout\n", device_xname(sc->sc_dev));
#endif
}
예제 #5
0
int
sscomcngetc(dev_t dev)
{
	int s = splserial();
	u_char __attribute__((__unused__)) stat;
	u_char c;

	/* got a character from reading things earlier */
	if (sscom_readaheadcount > 0) {
		int i;

		c = sscom_readahead[0];
		for (i = 1; i < sscom_readaheadcount; i++) {
			sscom_readahead[i-1] = sscom_readahead[i];
		}
		sscom_readaheadcount--;
		splx(s);
		return c;
	}

	/* block until a character becomes available */
	while (!sscom_rxrdy(sscomconstag, sscomconsioh))
		;

	c = sscom_getc(sscomconstag, sscomconsioh);
	stat = sscom_geterr(sscomconstag, sscomconsioh);
	{
		int __attribute__((__unused__))cn_trapped = 0;
#ifdef DDB
		extern int db_active;
		if (!db_active)
#endif
			cn_check_magic(dev, c, sscom_cnm_state);
	}
	splx(s);
	return c;
}