/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 2001   Matthew R. Stein                               *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *                                                                          *
 *      Driver file for TRC004/006 combination for Linux.  Trident card is  *
 *      directly accessed by kernel-level real-time routine running under   *
 *      real-time linux.  However, do a probe at RCI level to avoid         *
 *      activating the kernel-level process if the device is not responding *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#include "../h/cdefs.h"
#include "../h/IOdevice.h"
#include "../h/triDevice.h"
#include "../h/pumaInterface.h"
#include "../h/errorCodes.h"

#include "../drivers/driErrorMsgs.h"
#include <sys/perm.h>
#include <asm/io.h>

triProbe (dev)
IO_DEVICE *dev;
{
  int address;
  short status;

  address = dev->address;
  /* --- MS Under Linux, must obtain permission to write to port */
  /* --- Code imported from linux Mini-Howto IO-Port-Programming */
  /* Get access to the ports */
  if(address < 0x3ff) {
    if (ioperm(address, 64, 1)) {perror("ioperm"); exit(1);}
  } else 
    { iopl(3);
    }

  /* Do a read of the status word to see if OK */
  status = inw(address + STATUS_REG); /* defined in pumaInterface.h */
  
  return(status);


}
