/******************************************************************************/
/**
 *
 * @file fip_urv_cmd.h
 *
 * This is the header file for the fip interaction in Hydra
 *
 ******************************************************************************/
#ifndef __FIP_URV_CMD_H
#define __FIP_URV_CMD_H

#ifdef __cplusplus
extern "C" {
#endif

/***************** Macros (Inline Functions) Definitions **********************/
/* CMD Flags */
#define CMD_ERROR           0
#define CMD_WRITE_WORD      1
#define CMD_READ_WORD       2
#define CMD_SET_LEDS        3
#define CMD_GET_LEDS        4
#define CMD_I2C_TFR         5
#define CMD_I2C_STAT        6
#define CMD_I2C_BUF         7
#define CMD_I2C_MON         8
#define CMD_MON_BUF         9
#define CMD_STAT_BUF        10
#define CMD_FIP_PING        11
#define CMD_CPU_FLT         12
#define CMD_WRITE_ECC       13
#define CMD_WAIT            14
#define CMD_WRITE_BLOCK     15
#define CMD_FAN_OFF         16
#define CMD_FAN_ON          17

#define CMD_APP_FLAG        0x80
#define CMD_ALRM_FLAG       0x40

/* I2c commands  */
#define I2C_CMD_IDLE        0x00
#define I2C_CMD_START       0x01
#define I2C_CMD_WRITE       0x02
#define I2C_CMD_WRITE_STOP  0x03
#define I2C_CMD_READ        0x04
#define I2C_CMD_READ_STOP   0x05
#define I2C_CMD_READLEN     0x06
#define I2C_CMD_RUN         0x07
#define I2C_CMD_ERR         0x10

/* I2c slaves (flags in system buffer) */
#define I2C_SLV_MON 0
#define I2C_SLV_FT  1
#define I2C_SLV_RTP 2

/* Build Macros */
#ifndef C_BUILD_DATE
#define C_BUILD_DATE        4102441200
#endif

#ifndef C_GIT_HASH
#define C_GIT_HASH          0xDEADCAFE
#endif

/* Statistics register map */
#define STAT_MONIMOD_RST    0   /* Number of monimod resets */
#define STAT_FANTRAY_RST    1   /* Number of fantray resets */
#define STAT_RATOPUS_ERR    2   /* Number of ratopus errors */
#define STAT_MIN_WD_CNT     3   /* Minimum watchdog counter */
#define STAT_RECOVERY       4   /* Number of recovery reset */
#define STAT_RESET          5   /* Number of reset */
#define STAT_LAST_RST       6   /* Last cpu reset */
#define STAT_CYCLE_CNT      7   /* Number of cycles executed */
#define STAT_FIP_CMD        8   /* Number of FIP commands (incl padding) */
#define STAT_FIP_PAD        9   /* Number of FIP padding command */
#define STAT_BUILD_DATE     10  /* Build date (seconds since 1970-01-01) */
#define STAT_GIT_HASH       11  /* Git commit hash (32b) */
#define STAT_APP0_START     12  /* App0 CPU program address in eNVM */
#define STAT_FIP_WRITES     13  /* Number of FIP writes command */
#define STAT_WRITE_ADDR     14  /* Last write address */
#define STAT_DATA_WR        15
#define STAT_DATA_WDIS      16
#define STAT_NBR            17

#ifdef __cplusplus
}
#endif

#endif /* __FIP_URV_CMD_H */
