/*
 * Copyright(C) Paul und Scherer (mct.de/mct.net)
 *
 * This example demonstrates how to...
 *
 *  ... use high speed I/O.
 */

#include <stdio.h>
#include <target.h>

/*
 * P0.16 is toggled as fast as possible.
 * Watch the signal with a scope, to see
 * the difference between high speed I/O
 * and the "old", slow GPIO access mode.
 */
int
main(void)
{
	while (1) {
		long loop;			// loop count

		Intern_scs = 1;			// use fast I/O registers
		puts("Fast I/O...");
		for (loop = 10000000; loop--; Intern_fio0dir ^= 0x10000) ;

		Intern_scs = 0;			// use slow I/O registers
		puts("Slow I/O...");
		for (loop = 10000000; loop--; Intern_io0dir  ^= 0x10000) ;
	}
}

