initial checkin from subversion

This commit is contained in:
Tretter
2017-02-07 20:03:49 +00:00
commit ed54469421
108 changed files with 1999 additions and 0 deletions

52
parport-io.c Normal file
View File

@@ -0,0 +1,52 @@
void PortOpen(int port);
void PortClose(int pPort);
void PortWrite(int pPort, unsigned char val);
unsigned int PortRead(int pPort);
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>
//* #include "port.h"
void PortClose(int pPort)
{
int ret;
ret = ioperm(pPort, 4, 0);
if (ret != 0) {
printf("Error: ioperm(%d,4,0): %d '%s'\n",
pPort,errno, sys_errlist[errno] );
exit(-1);
}
printf( "SUCCESS: ioperm(%d,4,0) .. %d\n", pPort, ret );
}
void PortOpen(int pPort)
{
int ret;
ret = ioperm(pPort, 4, 1);
if (ret != 0) {
printf("Error: ioperm(%d,4,1): %d '%s'\n",
pPort,errno, sys_errlist[errno] );
exit(-1);
}
printf( "SUCCESS: ioperm(%d,4,1) .. %d\n", pPort, ret );
}
unsigned int PortRead(int pPort)
{
// return( (inb(pPort)<<8) + inb(pPort+1));
return( inb(pPort) );
}
void PortWrite(int pPort, unsigned char val)
{
outb(val, pPort);
}