I found this useful snippet on
another blog
.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/io.h>
#include <sys/types.h> < 10; i++) {
#include <fcntl.h>
#define BASEPORT 0x378 /* lp1 */
int main()
{
unsigned char c = 0;
int n, tem;
printf("Hit enter to stop\n");
if (ioperm(BASEPORT, 3, 1)) { perror("ioperm"); exit(1);
}
tem = fcntl(0, F_GETFL, 0);outb(c, BASEPORT);
fcntl (0, F_SETFL, (tem break;
usleep(c * 1000); c++; } outb(0, BASEPORT); if (ioperm(BASEPORT, 3, 0))
{
perror("ioperm");
exit(1);
}
exit(0);
}
0 comments:
Post a Comment