| 
                    
                 | 
                              
                              
                
                    Re: Parallel port and irq7
                     
                         
                    
                 
               | 
              
          
        
        
        
         
        
        
        
         
            
              | 
                
                 11/04/2008 11:04 AM 
                post15920 
               | 
                            
                              
                Re: Parallel port and irq7
                     
                         
                    
                 
                
Hi again ;)
Sorry to disturb you... I still have issues with interrupts and parrallel port.
In a few words : 
My program await on a lpt interrupt (IRQ7), its period is 1ms and the pulse duration is half of this period.
An input pin gives the start and stop signal ("MASK_RUN").
Every time the program catch an interrupt, it toggles one output pin.
This pin state is displayed on a oscilloscope and after around fifteen seconds the execution freezes...
Is it a kind of overflow?
I read some internet pages about lpt port, but didn't find anything about particular servicing.
//**********************************************************
#include <stdio.h>
#include <sys/neutrino.h>
#include <hw/inout.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
#define IRQ7                              0x07
#define BASE_ADDRESS_LPT1      0x378
#define INTR_BIT                        0x10
#define MASK_RUN                      0x20
#define MASK_TOGGLE		 0x02
struct sigevent event;
volatile int id1;
const struct sigevent *handler(void *area, int id);
int main(void){
	unsigned char reg;
	unsigned long lpt;
	ThreadCtl(_NTO_TCTL_IO, 0);
	event.sigev_notify = SIGEV_INTR;
	id1 = InterruptAttach(IRQ7, &handler, NULL, 0, 0 );
	/*access to parallel port bytes... to write, read and configure...*/
	lpt = mmap_device_io(3, BASE_ADDRESS_LPT1);
       /* lpt irq activation */
	reg = in8(lpt + 2);
	out8(lpt + 2, reg|INTR_BIT);
	while(~in8(lpt + 1) & MASK_RUN);
	while(in8(lpt + 1) & MASK_RUN){
		InterruptWait(0, NULL);
		reg = in8(lpt);
		out8(lpt, reg ^ MASK_TOGGLE);
	}
	munmap_device_io(lpt, 3);
	InterruptDetach(id1);
	return 0;
}
/*
  isr
*/
const struct sigevent *handler(void *area, int id) {
	if (id == id1)
		return &event;
	else
		return NULL;
}
//**********************************************************
I also tried to replace InterruptAttach by InterruptAttachEvent without any succes :/.
Thanks for your help and hints!
Cédric
              
                  
                 
               | 
            
            
              | 
                
                
               | 
            
          
            
              |               
                
               |