Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $cat parport.c
- #include <stdio.h>
- #include <sys/io.h>
- int port = 0;
- int
- init_parport(int p)
- {
- int err;
- err = ioperm(port = p, 3, 1);
- if (err)
- perror("ioperm");
- return err;
- }
- int
- done_parport()
- {
- int err = ioperm(port, 3, 0);
- if (err)
- perror("ioperm");
- return err;
- }
- unsigned char
- parport_read()
- {
- return inb(port+1);
- }
- int
- parport_write(unsigned char x)
- {
- outb(x, port);
- return 0;
- }
- int
- parport_write2(unsigned char x)
- {
- outb(x, port+2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement