delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/15/11:19:04

Message-ID: <38CF57D7.1A344BB7@student.uni-ulm.de>
Date: Wed, 15 Mar 2000 10:28:55 +0100
From: Karsten Schmidt <Karsten*Schmidt AT student DOT uni-ulm DOT de>
X-Mailer: Mozilla 4.51 [en] (X11; I; SunOS 5.7 sun4u)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Interrupt handler crashes after a minute
NNTP-Posting-Host: mic17.e-technik.uni-ulm.de
X-Trace: 15 Mar 2000 10:28:55 +0100, mic17.e-technik.uni-ulm.de
Lines: 171
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.
--------------9BBB8B929343571AB18AD6FA
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I'm currently porting a Borland 16bit library to DJGPP and therefore I
must chain the interrupt of a PCI device.
When I use the _go32_dpmi_chain_protected_mode_interrupt_vector() the
library seems to work fine for a while, but suddenly the program hangs
and the only thing I can do is to reboot the machine.
But on the other hand I can exit and restart the program again and again
without any problems. I've attached the important parts of my library
with the Borland function calls commented out. 
The program is running on the CWSDPR0 DOS extender, because I have to
read the CR3 register of the CPU in order to get the physical address of
a DMA buffer.

Perhaps somebody has an idea.
Thanks in advance

-- 
Karsten

If you want to reply directly send a mail to:
Karsten*Schmidt AT student DOT uni-ulm DOT de and replace the * with a . (I hope
this will prevent me from getting more spam).
--------------9BBB8B929343571AB18AD6FA
Content-Type: text/plain; charset=us-ascii;
 name="lib.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="lib.cpp"

#include <dos.h>
#include <stddef.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include "acl.h"
#include "aclerr.h"
#include "amcc32.h"
#include "adr.h"
#include <dpmi.h>
#include <go32.h>
#include "aclasic.h"
#include "7200.h"

typedef struct _card {
        _go32_dpmi_seginfo old_int;
        _go32_dpmi_seginfo my_int;
        } CARD;

CARD card_array[PCI_MAXCARDS] = { {FALSE},
                                  {FALSE},
                                  {FALSE},
                                  {FALSE},
                                };

U8      acl_CardNo, acl_ExistPciCards;
U8      Ext_IRQ_Vect[PCI_MAXCARDS];

/*----------------------------------------------------------------------*/
int _7200_Initial(U8 card_number, U16 *pt_base_address, U8 *irq_no)
{
  int i, irq_err = 0;
  U8   bus_num, dev_func, command, mask;
  U8   interrupt_line, int_vector;

    i = card_number;

      /* Read the Interrupt Line register to determine the hardware IRQ */
      /* assigned to the S5933, then convert this to a software interrupt */
      /* number to insert the interrupt vector for the S5933 */
      if((read_configuration_byte(bus_num,dev_func,PCI_CS_INTERRUPT_LINE,
                &interrupt_line)==SUCCESSFUL) && (interrupt_line != 0xff))
      {
        *irq_no = (unsigned char) interrupt_line;
        card_array[i].irq = interrupt_line;

        /* Enable Interrupts */
        if(interrupt_line < 8)
        {
          int_vector = 0x08+interrupt_line;
          Ext_IRQ_Vect[i] = int_vector;
          mask = inportb(0x21);
          card_array[i].old_irq_mask = mask;
          mask = mask & ~(1<<interrupt_line);
          outportb(0x21,mask);
        }
        else
        {
          int_vector = 0x70+(interrupt_line-8);
          Ext_IRQ_Vect[i] = int_vector;
          mask = inportb(0xA1);
          card_array[i].old_irq_mask = mask;
          mask = mask & ~(1<<(interrupt_line-8));
          outportb(0xA1,mask);
        }
	/* Borland */
        /* Save the old interrupt vector */
        /* card_array[i].old_isr = getvect(int_vector); */
        
	/* Install the new interrupt vector */
        card_array[i].my_int.pm_selector = _my_cs();
        switch (card_number)
        { case 0: card_array[i].my_int.pm_offset =(unsigned long) PCI7200_isr0; break;
          case 1: card_array[i].my_int.pm_offset =(unsigned long) PCI7200_isr1; break;
        }
        irq_err = _go32_dpmi_chain_protected_mode_interrupt_vector(int_vector,&card_array[i].my_int);
        if (irq_err) printf("Installing ISR failed!\n");

      /* Borland  */
      /* switch (card_number)
        {
          case 0:  setvect(int_vector, PCI7200_isr0); break;
          case 1:  setvect(int_vector, PCI7200_isr1); break;
          //default:  return(PCICardNumErr);
        }  */
      }
      else
      {
        *irq_no = 0xff;
        card_array[card_number].irq = 0xff;
        return(ERR_PCIIrqNotExist);
      }
    return(ERR_NoError);
}

/************************************************************************/
/*      Function:       PCI7200_isr0                                    */
/*      Purpose:        check interrupt source and service S593x int's  */
/************************************************************************/
int PCI7200_isr0(void)
{
  U32 int_status, master_status, count, dio_csr, int_csr;
  
  disable();
  int_status = inpd(card_array[0].op_base_addr+AMCC_OP_REG_INTCSR);
  master_status = inpd(card_array[0].op_base_addr+AMCC_OP_REG_MCSR);
  if ((int_status & ANY_S593X_INT) != 0) /* My PCI Bridge generated the Int */
  {
  /* do some in- and outports */
  }
  else /* Chain Int to old handler */
  {
    /* Interrupt is not from the S5933, call the previous handler */
    /* Borland: */
    //- _chain_intr(card_array[0].old_isr);
     return 1;
  }

  /* Specific End of interrupt to clear in-service bit */
  /* Mask upper 5 bits of int. line register */
  if(card_array[0].irq<8)
    outportb(0x20,0x60|(card_array[0].irq&0x07));
  else
  {
    /* Issue master then slave EOI */
    outportb(0xa0,0x60|((card_array[0].irq-8)&0x07));
    outportb(0x20,0x62);
  }
  enable();
  return 0;
}


--------------9BBB8B929343571AB18AD6FA--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019