/****************************************************************************/
/* Copyright 1991 to 1996, MBARI                                            */
/****************************************************************************/
/* Summary  : IBC Board - IBC Board serial commands                         */
/* Filename : ibc_cmd.h                                                     */
/* Author   : Andrew Pearce                                                 */
/* Project  : Tiburon IBC CPU Board Rev 1.0                                 */
/* Version  : 1.0                                                           */
/* Created  : 02/12/96                                                      */
/* Modified : 01/31/95                                                      */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/* $Header: /usr/tiburon/.cvsroot/micro/h/ibc_cmd.h,v 1.1.1.1 1997/05/02 17:15:38 pean Exp $
 * $Log: ibc_cmd.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.
 *
 * Revision 1.1  93/07/02  09:33:50  09:33:50  pean (Andrew Pearce)
 * Initial revision
 *
*/
/****************************************************************************/

#define IBC_BUS_RESET           0x01    /* IBC Bus Reset command            */
#define IBC_BUS_READ_BYTE       0x02    /* IBC Bus read byte command        */
#define IBC_BUS_WRITE_BYTE      0x03    /* IBC Bus write word command       */
#define IBC_BUS_READ_WORD       0x04    /* IBC Bus Read Word command        */
#define IBC_BUS_WRITE_WORD      0x05    /* IBC Bus Write Word command       */

#define READ_HUMIDITY           0x06    /* Get Humidity Sensor Reading      */
#define READ_HUMIDITY_ALARM     0x07    /* Get Humidity Alarm Status        */
#define GET_HUMIDITY_THRESH     0x09    /* Get Humidity Alarm Threshold     */
#define SET_HUMIDITY_THRESH     0x0a    /* Set Humidity Alarm Threshold     */

#define IBC_CPU_PIC_STATUS      0x0d    /* Read Interrupt Controller status */
#define IBC_CPU_EEPROM_TEST     0x0e    /* Execute IBC CPU Board EEPROM Test*/

#define IBC_FUNCTIONS           0x1f    /* Enable IBC Board real-time funs  */
#define IBC_CARD_CONFIG         0x20    /* Get IBC card configuration       */

#define LPS_SWITCH_CTRL         0x21    /* Set Low Power Switch Chan On/Off */
#define LPS_SWITCH_STATUS       0x22    /* Get Low Power Switch Status      */
#define LPS_GET_TEMPERATURES    0x23    /* Get LPS Temperature readings     */
#define LPS_GET_CURRENTS        0x24    /* Get LPS Current readings         */
#define LPS_GET_VOLTAGE         0x25    /* Get LPS Vicor Voltage Output     */
#define LPS_VICOR_CONTROL       0x26    /* Set LPS Vicor On/Off             */
#define LPS_SET_TEMP_THRESH     0x27    /* Set LPS Temp Alarm Thresholds    */
#define LPS_GET_TEMP_THRESH     0x28    /* Get LPS Temp Alarm Thresholds    */
#define LPS_SET_CURRENT_THRESH  0x29    /* Set LPS Current Alarm Thresholds */
#define LPS_GET_CURRENT_THRESH  0x2A    /* Get LPS Current Alarm Thresholds */
#define LPS_GET_ALARM_STATUS    0x2B    /* Get LPS Alarm Status             */
#define LPS_SET_VOLTAGE_THRESH  0x2C    /* Set LPS Voltage Alarm Thresholds */
#define LPS_GET_VOLTAGE_THRESH  0x2D    /* Get LPS Voltage Alarm Thresholds */
#define LPS_SET_GANG_OUTPUT     0x2E    /* Set LPS Gang Output Mode         */
#define LPS_SET_SWITCH_DELAY    0x2F    /* Set LPS Switch on delay time     */

#define HPS_SWITCH_CTRL         0x30    /* Set High Power Switch State      */
#define HPS_READ_STATUS         0x31    /* Get High Power Switch Status     */
#define HPS_READ_CURRENT        0x32    /* Get High Power Switch Current    */
#define HPS_SET_CURRENT_THRESH  0x33    /* Set HPS Current Alarm Set Point  */
#define HPS_GET_CURRENT_THRESH  0x34    /* Get HPS Current Alarm Set Point  */
#define HPS_GET_ALARM_STATUS    0x35    /* Get HPS Alarm Status             */

#define VICOR_PSU_CONTROL       0x40    /* Set Vicor Power Supply State     */
#define VICOR_PSU_STATUS        0x41    /* Get Vicor Power Supply Status    */
#define VICOR_SET_TEMP_THRESH   0x42    /* Set Vicor Temperature Threshold  */
#define VICOR_GET_TEMP_THRESH   0x43    /* Get Vicor Temperature Threshold  */
#define VICOR_GET_TEMPERATURE   0x44    /* Get Dual Vicor Temperature       */
#define VICOR_GET_ALARM_STATUS  0x45    /* Get Dual Vicor Alarm Status      */


#define ADC_READ_VALUES         0x50    /* Read A to D Board Values         */
#define ADC_READ_CHAN           0x51    /* Read A to D Board Channel Values */
#define ADC_CARD_ENABLE         0x52    /* Enable A to D convertor          */
#define ADC_CARD_DISABLE        0x53    /* Disable A to D convertor         */

#define PIO_READ_PORT           0x58    /* Read Parallel IO Board port      */
#define PIO_WRITE_PORT          0x59    /* Write Parallel IO Board port     */

#define NAV_IF_READ_SYNCRO      0x5c    /* Read syncro from Nav Interface   */
#define NAV_IF_READ_STATUS      0x5d    /* Read PSU status from Nav Iface   */

#define GF_SET_CHARGE_TIMES     0x60    /* Set GF channel charge times      */
#define GF_GET_CHARGE_TIMES     0x61    /* Get GF channel charge times      */
#define GF_SET_TEMP_THRESH      0x62    /* Set GF Temperature Threshold     */
#define GF_GET_TEMP_THRESH      0x63    /* Get GF Temperature Threshold     */
#define GF_GET_TEMPERATURE      0x64    /* Get GF Board temperature sensor  */
#define GF_SET_VOLTAGE_THRESH   0x65    /* Set GF/5V Voltage Threshold      */
#define GF_GET_VOLTAGE_THRESH   0x66    /* Get GF/5V Voltage Threshold      */
#define GF_GET_CURRENTS         0x67    /* Get GF Board GF current values   */
#define GF_GET_ALARM_STATUS     0x68    /* Get GF fault & selftest status   */
#define GF_SET_FAULT_MONITOR    0x69    /* Enable/disabled GF fault monitor */
#define GF_RESTART_CHAN_CHARGE  0x6a    /* Restart channel charge up        */
#define GF_RUN_SELFTEST         0x6b    /* Run GF Board Selftest function   */
#define GF_SET_BUS_CAPACITANCE  0x6c    /* Set Regen Board Bus Capacitance  */


#define REGEN_SET_TEMP_THRESH   0x70    /* Set Regen Temperature Threshold  */
#define REGEN_GET_TEMP_THRESH   0x71    /* Get Regen Temperature Threshold  */
#define REGEN_SET_VOLT_THRESH   0x72    /* Set Regen Voltage Threshold      */
#define REGEN_GET_VOLT_THRESH   0x73    /* Get Regen Voltage Threshold      */
#define REGEN_RESET_MIN_MAX     0x74    /* Reset min/max bus voltage values */
#define REGEN_GET_STATUS        0x75    /* Get Regen board status           */
#define REGEN_DIGITAL_SCOPE     0x76    /* Execute Digital Scope Function   */
#define REGEN_GET_ALARM_STATUS  0x77    /* Get Regen Alarm Status           */

#define ISO_IO_READ_PORT        0x7a    /* Get Isolated IO Input Port       */
#define ISO_IO_WRITE_PORT       0x7b    /* Set Isolated IO Output Port      */
#define ISO_IO_WRITE_PORT_BIT   0x7c    /* Set Isolated IO Output Port Bit  */
#define ISO_IO_WRITE_DAC        0x7d    /* Set Isolated IO DAC Output Port  */

                                        /* IBC Quad Serial Port Requests    */
#define QUAD_SER_SET_TERM_CHAR  0x81    /* Set Term Character               */
#define QUAD_SER_OPEN_CHAN      0x82    /* Open serial channel              */
#define QUAD_SER_CLOSE_CHAN     0x83    /* Close serial channel             */
#define QUAD_SER_READ           0x84    /* Read serial channel              */
#define QUAD_SER_WRITE          0x85    /* Write serial channel             */
#define QUAD_SER_FLUSH          0x86    /* Flush serial channel             */
#define QUAD_SER_RX_BYTES       0x87    /* Get number of bytes in Rx buffer */
#define QUAD_SER_TX_BYTES       0x88    /* Get number of bytes in Tx buffer */
#define QUAD_SER_SEND_BREAK     0x89    /* Send Break On or Break Off       */
#define QUAD_SER_GET_PSU_STATUS 0x8a    /* Read Power Supply Status         */
#define QUAD_SER_VSP_OPEN       0x8b    /* Open Virtual Serial Port         */
#define QUAD_SER_GET_LINE_PARM  0x8c    /* Get Line Parameters              */
#define QUAD_SER_SET_LINE_PARM  0x8d    /* Set Line Parameters              */
#define QUAD_SER_TERM_CHARS     0x8e    /* Get Number of Term Chars         */
#define QUAD_SER_FWD            0x8f    /* Fwd Micro cmd to QS Board        */
#define QUAD_SER_PROTO_OPEN     0x90    /* Open Serial Channel w/485 proto  */

#define HYDRO_PSU_SWITCH_CTRL   0xa0    /* Set Hydrophone PSU Output On/Off */
#define HYDRO_PSU_GET_STATE     0xa1    /* Get Hydrophone PSU Output State  */
#define HYDRO_PSU_GET_FAULT     0xa2    /* Get Hydrophone PSU Fault State   */

                                  /* IBC CPU Application Service Requests   */
#define IBC_BUS_TIMEOUT_SRQ              APPLIC_SRQ_BASE | 0x01
#define HUMIDITY_ALARM_SRQ               APPLIC_SRQ_BASE | 0x02

#define NAV_IF_PSU_STATUS                APPLIC_SRQ_BASE | 0x04
#define HYDRO_PSU_FAULT_SRQ              APPLIC_SRQ_BASE | 0x05

#define LPS_VICOR_TEMP_ALARM_SRQ         APPLIC_SRQ_BASE | 0x10
#define LPS_SW3_TEMP_ALARM_SRQ           APPLIC_SRQ_BASE | 0x11
#define LPS_VOLTAGE_ALARM_SRQ            APPLIC_SRQ_BASE | 0x12
#define LPS_CURRENT_ALARM_SRQ            APPLIC_SRQ_BASE | 0x13

#define HPS_TRIP_DETECTED_SRQ            APPLIC_SRQ_BASE | 0x30
#define HPS_CURRENT_ALARM_SRQ            APPLIC_SRQ_BASE | 0x31

#define DUAL_VICOR_TEMP_ALARM_SRQ        APPLIC_SRQ_BASE | 0x40
#define DUAL_VICOR_PSU_ERR_ON_SRQ        APPLIC_SRQ_BASE | 0x41
#define DUAL_VICOR_PSU_ERR_OFF_SRQ       APPLIC_SRQ_BASE | 0x42

#define GF_TEMP_ALARM_SRQ                APPLIC_SRQ_BASE | 0x60
#define GF_VOLTAGE_ALARM_SRQ             APPLIC_SRQ_BASE | 0x61
#define GF_SELFTEST_STATUS_SRQ           APPLIC_SRQ_BASE | 0x62
#define GF_CURRENT_ALARM_SRQ             APPLIC_SRQ_BASE | 0x63

#define GF_CURRENT_NORMAL_SRQ            APPLIC_SRQ_BASE | 0x68
#define GF_CURRENT_ADVISORY_SRQ          APPLIC_SRQ_BASE | 0x69
#define GF_CURRENT_WARNING_SRQ           APPLIC_SRQ_BASE | 0x6A
#define GF_CURRENT_CRITICAL_SRQ          APPLIC_SRQ_BASE | 0x6B

#define REGEN_MIN_VOLTAGE_ALARM_SRQ      APPLIC_SRQ_BASE | 0x70
#define REGEN_MAX_VOLTAGE_ALARM_SRQ      APPLIC_SRQ_BASE | 0x71
#define REGEN_TEMP_ALARM_SRQ             APPLIC_SRQ_BASE | 0x72

#define REGEN_OPEN_HEATER_ALARM_ON       APPLIC_SRQ_BASE | 0x73
#define REGEN_OPEN_HEATER_ALARM_OFF      APPLIC_SRQ_BASE | 0x74
#define REGEN_BAD_DUTY_ALARM_ON          APPLIC_SRQ_BASE | 0x75
#define REGEN_BAD_DUTY_ALARM_OFF         APPLIC_SRQ_BASE | 0x76

#define QUAD_SER_PSU_FAULT_SRQ           APPLIC_SRQ_BASE | 0x80
#define QUAD_SER_BYTES_IN_BUF_SRQ        APPLIC_SRQ_BASE | 0x81
#define QUAD_SER_RECV_ERROR_SRQ          APPLIC_SRQ_BASE | 0x82

/****************************************************************************/

#ifdef __STDC__

Int16 processIBCCommands(IBC_BoardEntry *IBC_CardTable[], Int16 IBC_CardCount,
                     Char * commandBuf, Int16 commandLen );

#endif
















