/****************************************************************************/
/* Copyright 2015 MBARI                                                     */
/****************************************************************************/
/* Summary  : Modbus register numbers for OASIS5 Expander and Extender Boards*/
/* Filename : regs.h                                                        */
/* Author   : Robert Herlien (rah)                                          */
/* Project  : OASIS Mooring Replacement (OASIS5)                            */
/* Revision: 1.0                                                            */
/* Created  : 10/28/2015 by Bob Herlien (rah)                               */
/*                                                                          */
/* MBARI provides this documentation and code "as is", with no warranty,    */
/* express or implied, of its quality or consistency. It is provided without*/
/* support and without obligation on the part of the Monterey Bay Aquarium  */
/* Research Institute to assist in its use, correction, modification, or    */
/* enhancement. This information should not be published or distributed to  */
/* third parties without specific written permission from MBARI.            */
/*                                                                          */
/****************************************************************************/
/* Modification History:                                                    */
/* 28oct2015 rah - created                                                  */
/****************************************************************************/

#ifndef REGS_H
#define REGS_H

#include "serial.h"

#define BOARD_TYPE_REG    1
#define NUM_SER_PORTS_REG 2
#define NUM_RELAYS_REG    3
#define NUM_DIO_REG       4
#define NUM_ANALOG_REG    5
#define SER_SWITCH_REG    6
#define CONTROL_REG       7
#define BLINKY_REG        8

#define SERIAL_NUM_REG	  0x0010
#define SOFTWARE_REV_REG  0x0011
#define CONFIG_REG_H	  0x0012
#define CONFIG_REG_L	  0x0013
#define MB_ID_REG         0x0014
#define MB_BAUD_REG       0x0015
#define RELAY_STATE_REG   0x0016
#define HW_CONFIG_REG     0x0017
#define MB_TIMEOUT_REG    0x0018

#define MISC_START	BOARD_TYPE_REG
#define MISC_END	MB_TIMEOUT_REG

#define SERIAL_RX_STAT    0x00FE
#define SERIAL_TX_STAT    0x00FF
#define SER_HOLDING_START 0x0100
#define SER_HOLDING_END   ((SER_PORT_TOTAL << 8) + 0xFF)

#define INST_HOLDING_START  SERIAL_RX_STAT
#define INST_HOLDING_END    SER_HOLDING_END
#define REG_HOLDING_MAX     INST_HOLDING_END


#define FIRST_COIL   1
#define TOTAL_COILS  24

#define REG_INPUT_START 1000
#define REG_INPUT_NREGS 4

/* Board Types  */
typedef enum
    { BOARD_TYPE_CONFIGURED=0, BOARD_TYPE_CHAMBER_CONTROLLER,
      BOARD_TYPE_SENSOR_NODE, BOARD_TYPE_O5_EXPANDER, BOARD_TYPE_O5_DAUGHTER
    } BoardType;

#endif

