Message-Id: In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 18 May 1998 07:21:55 -0400 To: Eli Zaretskii From: Joseph Kaplan Subject: Re: hardware interrupts Cc: djgpp AT delorie DOT com Precedence: bulk At 14:04 +0300 5/17/98, you wrote: >On Thu, 14 May 1998, Joseph Kaplan wrote: > >> _go32_dpmi_chain_protected_mode_interrupt_vector( >> interrupt_vector, >> &protected_receive_handler); > >Why do you need to chain? Is there any other handler for this board >anywhere on your machine? > No, but I was running out of options. I have also just installed a protected mode handler without the real mode handler. The real mode handler doesn't do anything. > >> _go32_dpmi_get_real_mode_interrupt_vector( >> interrupt_vector, >> &real_previous_handler); > >Why do you need to install a real-mode handler? In DPMI mode, all the >hardware interrupts are automatically reflected to the protected-mode >handler, so you don't need the real-mode one. > See above. >> This is not working. > >``Not working''--how? Please explain what happens when your program >runs. > The program runs fine. The problem is that when data arrives at the board, it is supposed to set a status flag to true and then signal an interrupt on IRQ 5. This, in turn, should force my interrupt handler to get called. My interrupt handler is not being called. I have put a print statement in the interrupt handler to show this. >> What am I missing here? > >First, your code only installs the handler, but you didn't show the >handler itself. It might be that the problem is there. > Here is the relevant code. //============================================================================ //* Method: CondorArinc429Impl::protectedInterruptHandler(...) //* Handles interrupt for CondorArinc card //============================================================================ void CondorArinc429Impl::protectedInterruptHandler(...) { cout << "Interrupt Handler" << endl; determineReceiver(); outportb(interrupt_control_port,interrupt_acknowledge); } //============================================================================ //* Method CondorArinc429Impl::determineReceiver() //* Statically determines which receiver caused an interrupt,read that receiver //============================================================================ void CondorArinc429Impl::determineReceiver() /* statically determines which receiver caused the interrupt */ { int status; // Read the Status word for receivers 1 and 2 status = inportb(interrupt_set[RECEIVE_CHANNEL_1].read_status); if (status & STATUS_R1_FULL) { getInputData(RECEIVE_CHANNEL_1); } else if (status & STATUS_R2_FULL) { getInputData(RECEIVE_CHANNEL_2); } else { // Read the Status word for receivers 3 and 4 status = inportb(interrupt_set[RECEIVE_CHANNEL_3].read_status); if (status & STATUS_R3_FULL) { getInputData(RECEIVE_CHANNEL_3); } else if (status & STATUS_R4_FULL) { getInputData(RECEIVE_CHANNEL_4); } else { false_interrupts++; } } } //============================================================================ //* Method CondorArinc429Impl::getInputData(receive_channel channel) //* Given a channel, reads data on that channel (done on an interrupt) //============================================================================ void CondorArinc429Impl::getInputData(receive_channel channel) { unsigned long data; unsigned char *arinc_word_pointer = (unsigned char*)&data; inportb(interrupt_set[channel].receiver_enable); inportb(interrupt_set[channel].read_least_sig_word); *arinc_word_pointer++ = inportb(interrupt_set[channel].read_low_byte); *arinc_word_pointer++ = inportb(interrupt_set[channel].read_high_byte); inportb(interrupt_set[channel].read_most_sig_word); *arinc_word_pointer++ = inportb(interrupt_set[channel].read_low_byte); *arinc_word_pointer++ = inportb(interrupt_set[channel].read_high_byte); inportb(interrupt_set[channel].receiver_disable); int toggle_status = interrupt_set[channel].toggle; interrupt_set[channel].receive_queue[toggle_status]->push(data); } >Second, the code and data of the handler need to be locked. > I didn't lock any of the code or the data because I am using CWSDPR0 as my memory manager. I thought that was only necessary if you had a paging memory manager. >Last but not least, I suggest to read section 18.9 of the DJGPP FAQ >list, if you haven't done that already. > I did. I believe now that my problem may be hardware related at this point. I am going to check the status of IRQ 5 on the bus to insure that it is generating the interrupt. Thanks for the advice. Joe ----------------------------------------------------------- | Joseph Kaplan | NASA Langley Research Center | | j DOT a DOT kaplan AT larc DOT nasa DOT gov | Simulation Systems Branch | | VOICE: 757-864-6491 | Simulation & Research | | FAX: 757-864-8338 | Aircraft Division | -----------------------------------------------------------