/*
 * Copyright(C) Paul und Scherer (mct.de/mct.net)
 *
 * This example demonstrates how to...
 *
 *  ... change the baudrate for stdin/stdout/stderr.
 */

#include <stdio.h>
#include <sys/io.h>

#define BAUD	9600

/*
 * stdin/stdout/stderr use SIO0 and so share the
 * same baudrate. Changing the baudrate for SIO0
 * changes the baudrate for all std I/O.
 */
int
main(void)
{
	/*
	 * Set SIO0 baudrate.
	 *
	 * If the baudrate cannot be set within +/-3%,
	 * _sio_init() returns non-zero and sets errno
	 * appropriately.
	 */
	if (_sio_init(BAUD, 0)) return perror("_sio_init"), 1;

	while (1) puts("hello..."), getchar();
}
