/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1987, 1991 by John E. Lloyd.			    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#ifndef _MEMDRIVER_H_
#define _MEMDRIVER_H_

#define MEM_LISTEN	0x1234
#define MEM_CONNECTED	0x4321
#define MEM_READ_READY	0x1111
#define MEM_WRITE_READY	0x2222
#define MEM_SIGNAL_ACK	0x3333

#define MEM_BUFSIZE		256

#define MEM_DEFAULT_BLOCKTIME	200	/* 200 milliseconds */

/* Shared memory control area */

struct memdev {
  
   /* Data and control information written by the host */

   unsigned short hostMode;
   unsigned short hostStatus;
   unsigned short hostSignal;
   unsigned short hostCount;
   unsigned short hostChecksum;
   unsigned short hostReady;
   unsigned short hostSigReady;
   unsigned short hostBuf[MEM_BUFSIZE];


   /* Data and control information written by the target device */

   unsigned short targetMode;
   unsigned short targetStatus;
   unsigned short targetSig;
   unsigned short targetCount;
   unsigned short targetChecksum;
   unsigned short targetReady;
   unsigned short targetSigReady;
   unsigned short targetBuf[MEM_BUFSIZE];
};

extern memRead();
extern memTestRead();
extern memWrite();
extern memTestWrite();

extern memProbe();
extern memAttach();
extern memDetach();
extern memSignal();

extern memIoctl();

struct memregs {
  unsigned short dma[2];	/* dma registers (not used) */
  unsigned short csr;		/* csr for sending programed interrupts */
  unsigned char reserved1[6];	/* reserved space */
  unsigned short cableDma;	/* cable DMA control register */
  unsigned char reserved2[2];	/* reserved space */
  unsigned short cmdreg;	/* Q22 bus command register */
  unsigned char reserved3[6];	/* reserved space */
  unsigned char remnodeCmd;	/* remote node command register */
  unsigned char reserved4[1];	/* reserved space */
  unsigned char addrPage;	/* remote node address page reg */
  unsigned char reserved5[2];	/* reserved space */
  unsigned char addrModify;	/* remote node addree modifier reg */
  unsigned char reserved6[2];	/* reserved space */
};

#define MEM_VME_AMSSIO	0x2d;	/* VME address mod. supervisor short I/O */

#endif
