Metropoli BBS
VIEWER: al6000.c MODE: TEXT (ASCII)
/*
 *
 */

 #include <stdio.h>
 #include <dos.h>
 #include "global.h"
 #include "kbd.h"
 #include "al6000.h"

 unsigned char id[] =
  {0x05,
   0x97,
   0x33,
   0x30};

 static FLAG chk_slot(int slot);

/***************************************************************************
 *
 * chk_slot(...)
 *
 * Return - true, if slot is occupied.
 *
 ***************************************************************************/

 static FLAG chk_slot(int slot)
 {
  unsigned int  io_addr;
  int	        x;

  io_addr = (slot << 12) + 0xc80;

  for(x = 0; x < 4; x++, io_addr++)
    if (inport(io_addr) != id[x])
      return(FALSE);

  return(TRUE);
  }

/***************************************************************************
 *
 * void_cache(...)
 *
 ***************************************************************************/

 #define MAX_SLOT 8

 #define MBX_BASE_OLD	 0x10
 #define MBX_BASE	 0x17
 #define ADAPTER_IRQ_REG 0x0D
 #define VOID_COMMAND	 0x81
 #define SEND_COMMAND	 0x80

 void al6_reset()
 {
  FLAG found = FALSE;
  int  x,
       io_base;
  long timeout;

  for(x = 0; x < MAX_SLOT; x++)				/* Search slots    */
    {
     if(chk_slot(x))
       {                                                /* Any AL6s?	   */
	found = TRUE;					/* One AL6 found   */
	printf("AL6x00 found EISA Bus slot #%d...\n",x);
	if (kbd_get_yn("Reset"))
	  {
	   io_base = (x << 12) + 0xc80;
	   outport(io_base+MBX_BASE, VOID_COMMAND);
	   outport(io_base+ADAPTER_IRQ_REG, SEND_COMMAND);
	   timeout = 1;
	   while((inport(io_base+ADAPTER_IRQ_REG) & SEND_COMMAND) && timeout)
	      timeout++;
           }
	}
     }
  if (!found)					/* No AL6s found?	   */
     error("Could not reset, no AL6000s found");
  }
[ RETURN TO DIRECTORY ]