#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>

#define BASEPORT 0x378

int main()
{
	if (ioperm(BASEPORT, 3, 1)) {perror("ioperm"); exit(1);}

	outb(0, BASEPORT);
	printf("0\n");
	usleep (200000);
	outb(1, BASEPORT);
	printf("1\n");
	usleep (200000);
	outb(2, BASEPORT);
	printf("2\n");
	usleep (200000);
	outb(4, BASEPORT);
	printf("4\n");
	usleep (200000);
	outb(8, BASEPORT);
	printf("8\n");
	usleep (200000);
	outb(16, BASEPORT);
	printf("16\n");
	usleep (200000);
	outb(32, BASEPORT);
	printf("32\n");
	usleep (200000);
	outb(64, BASEPORT);
	printf("64\n");
	usleep (200000);
	outb(128, BASEPORT);
	printf("128\n");
	usleep (200000);

	printf("status: %d\n", inb(BASEPORT));

	if (ioperm(BASEPORT, 3 ,0)) {perror("ioperm"); exit(1);}

	exit(0);
}

