test1.c
#include <stdio.h> #include <unistd.h> #include <asm/io.h> #define BASEPORT 0x320 /* our special address */ int main() { /* Get access to the ports */ if (ioperm(BASEPORT, 3, 1)) { perror("ioperm"); exit(1);} /* Set the data signals (D0-7) of the port to all low (0) */ outb(1, BASEPORT); usleep(100000); outb(0, BASEPORT); usleep(50000000); outb(2, BASEPORT); usleep(100000); outb(0, BASEPORT); usleep(500000); /* Sleep for a while (100 ms) */ /* usleep(10000); */ /* Read from the status port (BASE+1) and display the result */ /*printf("status: %d\n", inb(BASEPORT + 1)); */ /* We don't need the ports anymore */ if (ioperm(BASEPORT, 3, 0)) {perror("ioperm"); exit(1);} exit(0); }
gcc test1.c -o test1 -I/usr/include -I/usr/lib/syslinux/com32/include/klibc -static