Changeset - f0e27aa8f0f5
[Not reviewed]
default
0 1 0
drewp - 22 years ago 2003-06-13 06:13:31

attempt to make a better exception with getparport(). didn't help, afaict
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light8/parport.c
Show inline comments
 
#include <stdio.h>
 
#include <stdlib.h>
 
#include <unistd.h>
 
#include <sys/ioctl.h>
 
#include <asm/io.h>
 
#include <fcntl.h>
 
#include <Python.h>
 

	
 
void getparport() {
 
int getparport() {
 
    if( ioperm(888,3,1) ) {
 
      printf("Couldn't get parallel port at 888-890\n");
 

	
 
      // the following doesn't have any effect!
 
      PyErr_SetString(PyExc_IOError,"Couldn't get parallel port at 888-890");
 
      return 0;
 
    } 
 
    return 1;
 
}
 

	
 
void outdata(unsigned char val) {
 
  outb(val,888);
 
}
 

	
 
void outcontrol( unsigned char val ) {
 
  outb(val,890);
 
}
 

	
 
void outbyte( unsigned char val ) {
 
  // set data, raise clock, lower clock
 
  outdata(val);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
0 comments (0 inline, 0 general)