/****************************************************************************/
/* Copyright 1994 MBARI                                                     */
/****************************************************************************/
/* Summary  : IBC Isolated Input/Output Interface Board definitions         */
/* Filename : iso_io.h                                                      */
/* Author   : Andrew Pearce                                                 */
/* Project  : New ROV Data Concentrator                                     */
/* Version  : 1.0                                                           */
/* Created  : 11/08/94                                                      */
/* Modified : 11/08/94                                                      */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/* $Header: /usr/tiburon/.cvsroot/micro/h/iso_io.h,v 1.1.1.1 1997/05/02 17:15:38 pean Exp $
 * $Log: iso_io.h,v $
 * Revision 1.1.1.1  1997/05/02 17:15:38  pean
 * Initial release of the microcontroller software after Tiburon
 * Moolpool Dive to test IView, Lapboxes, modified Power can
 * GF/5V using bus capacitance mode.
 *
*/
/****************************************************************************/

                                        /* Isolated IO Board Register Offset*/

                                        /* Map chan/addr 0=3, 1=2, 2=1, 3=0 */
#define ISO_IO_DAC_REG(addr, dac) (Byte*) addr + (3-dac)

#define ISO_IO_OUTPUT_REG(addr) (Byte*) ISO_IO_0_ADDR + 0x0c + ((addr & 0x0c) >> 2)

#define ISO_IO_INPUT_REG   0            /* Address of Input Data register   */
#define ISO_IO_LED_OFF     1            /* Address of LED OFF register      */
#define ISO_IO_LED_ON      2            /* Address of LED ON register       */


typedef struct                          /* Parallel IO Data Structure       */
{
    IBC_BoardEntry IBC_Board;           /* IBC Board Entry structure        */
    Byte outputPortCopy;                /* Copy of output port value        */
} iso_IO_BoardEntry;

#ifdef __STDC__

Int16 iso_IO_BoardSearch( IBC_BoardEntry *IBC_Boards[], Int16 maxCards );

iso_IO_BoardEntry* iso_IO_BoardInit( Byte *boardBaseAddr );

Int16 iso_IO_ReadPort( iso_IO_BoardEntry *iso_io_Board );

Int16 iso_IO_WritePort( iso_IO_BoardEntry *iso_IO_Board, Byte value );

Int16 iso_IO_SetPortBit( iso_IO_BoardEntry *iso_IO_Board, Word portBit,
      MBool state );

Int16 iso_IO_WriteDacPort( iso_IO_BoardEntry *iso_IO_Board, Byte dac,
     Byte value );

Void iso_IO_ReadPortCmd( IBC_BoardEntry* IBC_CardTable[], Int16 IBC_CardCount,
     Byte *commandBuf );

Void iso_IO_WritePortCmd( IBC_BoardEntry* IBC_CardTable[], Int16 IBC_CardCount,
     Byte *commandBuf );

Void iso_IO_WriteDacCmd( IBC_BoardEntry* IBC_CardTable[], Int16 IBC_CardCount,
     Byte *commandBuf );

Void iso_IO_SetPortBitCmd( IBC_BoardEntry* IBC_CardTable[],
    Int16 IBC_CardCount, Byte *commandBuf );

#endif
