Changeset - a3dc9c1508ab
[Not reviewed]
default
0 2 0
Drew Perttula - 19 years ago 2006-06-16 16:57:33
drewp@bigasterisk.com
attemted parport fixes on dash. i don't think these got used
2 files changed with 20 insertions and 27 deletions:
0 comments (0 inline, 0 general)
light9/io/Makefile
Show inline comments
 
@@ -2,13 +2,13 @@ LIB=/usr/local/lib
 
INC=-I/usr/local/include/python2.3
 

	
 
go: _parport.so _serport.so
 
	result="your modules and links are now up to date"
 

	
 
_parport.so: parport_wrap.c
 
	gcc -shared ${INC} parport_wrap.c parport.c -o _parport.so 
 
	gcc -shared -g ${INC} parport_wrap.c parport.c -o _parport.so 
 

	
 
parport_wrap.c: parport.c parport.i
 
	swig -python parport.i
 

	
 
_serport.so: serport_wrap.c
 
	gcc -shared -O ${INC} serport_wrap.c -o _serport.so 
light9/io/parport.c
Show inline comments
 
@@ -4,12 +4,13 @@
 
#include <sys/ioctl.h>
 
#include <asm/io.h>
 
#include <fcntl.h>
 
#include <Python.h>
 

	
 
int getparport() {
 
  printf("parport - ver 4\n");
 
    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;
 
@@ -23,40 +24,32 @@ void outdata(unsigned char val) {
 

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

	
 
void outbyte( unsigned char val ) {
 
  int i;
 
  // 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);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 
  outcontrol(2);
 

	
 
  /* this was originally 26 outcontrol calls, but on new dash that
 
     leads to screwed up dmx about once a minute. I tried doing 26*4
 
     outcontrol calls, but it still screwed up. I suspect the athlon64
 
     or my new kernel version is sending the parport really fast,
 
     sometimes faster than the pic sees the bits. Then I put a 1ms
 
     sleep after the outcontrol(2)'s and that didn't help either, so
 
     I'm not sure what's going on. Putting the parallel cable on miles
 
     seems to work. 
 

	
 
     todo:
 
     try a little pause after outcontrol(3) to make sure pic sees that
 
  */
 

	
 
  for (i=0; i<26*4; i++) {
 
    outcontrol(2);
 
  }
 
  outcontrol(3);
 
}
 
void outstart() {
 
  // send start code: pin 14 high, 5ms to let a dmx cycle finish,
 
  // then pin14 low (pin1 stays low)
 
  outcontrol(1);
0 comments (0 inline, 0 general)