/****************************************************************************/
/* Copyright 1990 to 1993 MBARI                                             */
/****************************************************************************/
/* Summary  : Microcontroller commands                                      */
/* Filename : microcmd.h                                                    */
/* Author   : Andrew Pearce                                                 */
/* Project  : Tiburon ROV Microcontroller Applications                      */
/* Version  : 1.0                                                           */
/* Created  : 11/21/90                                                      */
/* Modified : 04/08/92                                                      */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/* $Header: /usr/tiburon/.cvsroot/micro/h/microcmd.h,v 1.1.1.1 1997/05/02 17:15:39 pean Exp $
 * $Log: microcmd.h,v $
 * Revision 1.1.1.1  1997/05/02 17:15:39  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  92/05/14  09:17:50  09:17:50  pean (Andrew Pearce 408-647-3746)
 * Initial revision
 *
*/
/****************************************************************************/

#ifndef MICROCMD_H
#define MICROCMD_H

#define CMD_OK      1               /* Command received and processed OK    */
#define ECOMMAND    2               /* Command received bot not recognized  */
#define EARGUMENT   3               /* Command received with bad arguments  */
#define CMD_ERROR   4               /* Error occurred executing command     */

#define MICRO_IDENT            0x00 /* Get Identification String from Micro */
#define MICRO_RESET            0x01 /* Reset Microcontroller Board          */
#define MICRO_PING             0x02 /* Sends back a sequence number         */
#define GET_RELAY_CTRL         0x03 /* Get RS485 Relay Status               */
#define SET_RELAY_CTRL         0x04 /* Set RS485 Relay Status Open/Closed   */

#define GET_STATUS             0x05 /* Get Status Word from Microcontroller */
#define GET_GNDFLT_TEST        0x06 /* Report Ground Fault Test             */
#define SET_GNDFLT_TEST        0x07 /* Test Ground Fault Detector           */

#define GET_GNDFLT_VALUE       0x09 /* Read Ground Fault Resistance         */
#define GET_GNDFLT_STATUS      0x0B /* Get current Ground Fault Status      */
#define READ_MEMORY            0x0C /* Read microcontroller memory          */
#define WRITE_MEMORY           0x0D /* Write microcontroller memory         */
#define GET_MICRO_SER_NO       0x0E /* Read micro board serial number       */
#define SET_MICRO_SER_NO       0x0F /* Write micro board serial number      */
#define SOFTWARE_REV           0x10 /* Read Software Revision String        */
#define CMD_ENABLE             0x11 /* Enable processing of commands        */
#define READ_ADC_CHANS         0x12 /* Read Micro A/D Channels              */
#define READ_HSI_PORT          0x13 /* Read Micro HSI Port                  */
#define WRITE_HSO_PORT         0x14 /* Write Micro HSO Port                 */
#define SET_LINK_RX_TIME       0x15 /* Set Link Receive Timeout Value       */
#define GET_LINK_RX_TIME       0x16 /* Get Link Receive Timeout Value       */
                                    /* Service Request Defines              */
#define MICRO_RESET_SRQ        0x10 /* Microcontroller Reset Service Req    */
#define COMMAND_ERROR_SRQ      0x11 /* Command Error Service Request        */
#define WATER_ALARM_ON_SRQ     0x12 /* Water Alarm Service Request          */
#define WATER_ALARM_OFF_SRQ    0x13 /* Water Alarm not detected             */
#define GF_TEST_FAIL_OFF_SRQ   0x14 /* Ground Fault Enabled & not detected  */
#define GF_TEST_FAIL_ON_SRQ    0x15 /* Ground Fault Disabled and Detected   */
#define LOCAL_GNDFLT_SRQ       0x16 /* Local Ground Fault Active SRQ        */
#define EXTERNAL_GNDFLT_SRQ    0x17 /* External Ground Fault Active SRQ     */
#define COM_LINK_ERROR_SRQ     0x18 /* Serial communications link down SRQ  */
#define GF_TEST_STATUS_SRQ     0x19 /* GF Selftest Status SRQ               */

#define TEMP_ALARM_OFF         0x1B /* Temperature Alarm On SRQ             */
#define TEMP_ALARM_ON          0x1C /* Temperature Alarm Off SRQ            */

#define INITIALIZED_SRQ        0x20 /* Application Initialized SRQ          */

#define APPLIC_SRQ_BASE      0x8000 /* Application specific SRQ's start here */

#define MICRO_ID_LEN           40 /* Maximum length of ID string            */
#define MICRO_SERNO_LEN        12 /* Maximum length of Serial Number String */
#define SOFTWARE_REV_LEN       20 /* Maximum length of Software Revision    */

#define RAM_TEST_MASK      0x0001 /* Ram Test Result Status Bit             */

#endif

