#ifndef HARDWARE_LSSI_H_
#define HARDWARE_LSSI_H_

typedef struct
{
	volatile unsigned char ctrl;
	volatile unsigned char st;
	volatile unsigned char cfg;
	volatile unsigned char ss;
	volatile unsigned char fifoCtrl;
	volatile unsigned char fifoSt;
	volatile unsigned char cd;
	volatile unsigned char ie;
	volatile unsigned char ifr;
	volatile unsigned char im;
	volatile unsigned char ioCfg;
	volatile unsigned char buf;
	volatile unsigned char ras;
	volatile unsigned char ufc;
	volatile unsigned char txFifoLvl;
	volatile unsigned char rxFifoLvl;
} LssiRegs;

#define LSSI_CTRL_RX_EN (1U << 2)
#define LSSI_CTRL_TX_EN (1U << 1)
#define LSSI_CTRL_SB    (1U << 0)

#define LSSI_ST_RX_IP   (1U << 3)
#define LSSI_ST_TX_IP   (1U << 2)
#define LSSI_ST_TIP     (1U << 0)

#define LSSI_CFG_SM_SLAVE   (1U << 7)
#define LSSI_CFG_SM_MASTER  (0U << 7)
#define LSSI_CFG_PHA        (1U << 6)
#define LSSI_CFG_POL        (1U << 5)
#define LSSI_CFG_BL_5BIT    (3U << 3)
#define LSSI_CFG_BL_6BIT    (2U << 3)
#define LSSI_CFG_BL_7BIT    (1U << 3)
#define LSSI_CFG_BL_8BIT    (0U << 3)
#define LSSI_CFG_TBO_MSB    (1U << 1)
#define LSSI_CFG_TBO_LSB    (0U << 1)
#define LSSI_CFG_MODE_UART  (1U << 0)
#define LSSI_CFG_MODE_SPI   (0U << 0)

#define LSSI_SS_SS  1U

#define LSSI_FIFO_CTRL_RX_RST   (1U << 7)
#define LSSI_FIFO_CTRL_TX_RST   (1U << 6)
#define LSSI_FIFO_CTRL_RU       (1U << 3)
#define LSSI_FIFO_CTRL_RO       (1U << 2)
#define LSSI_FIFO_CTRL_TO       (1U << 1)
#define LSSI_FIFO_CTRL_TU       (1U << 0)

#define LSSI_FIFO_ST_RAF    (1U << 7)
#define LSSI_FIFO_ST_RAE    (1U << 6)
#define LSSI_FIFO_ST_TAF    (1U << 5)
#define LSSI_FIFO_ST_TAE    (1U << 4)
#define LSSI_FIFO_ST_RE     (1U << 3)
#define LSSI_FIFO_ST_RF     (1U << 2)
#define LSSI_FIFO_ST_TE     (1U << 1)
#define LSSI_FIFO_ST_TF     (1U << 0)

#define LSSI_IE_FE  (1U << 7)
#define LSSI_IE_PE  (1U << 6)
#define LSSI_IE_BD  (1U << 5)
#define LSSI_IE_SB  (1U << 4)
#define LSSI_IE_BE  (1U << 3)
#define LSSI_IE_TC  (1U << 2)
#define LSSI_IE_RF  (1U << 1)
#define LSSI_IE_TF  (1U << 0)

#define LSSI_IF_FE  LSSI_IE_FE
#define LSSI_IF_PE  LSSI_IE_PE
#define LSSI_IF_BD  LSSI_IE_BD
#define LSSI_IF_SB  LSSI_IE_SB
#define LSSI_IF_BE  LSSI_IE_BE
#define LSSI_IF_TC  LSSI_IE_TC
#define LSSI_IF_RF  LSSI_IE_RF
#define LSSI_IF_TF  LSSI_IE_TF

#define LSSI_IM_FE  LSSI_IE_FE
#define LSSI_IM_PE  LSSI_IE_PE
#define LSSI_IM_BD  LSSI_IE_BD
#define LSSI_IM_SB  LSSI_IE_SB
#define LSSI_IM_BE  LSSI_IE_BE
#define LSSI_IM_TC  LSSI_IE_TC
#define LSSI_IM_RF  LSSI_IE_RF
#define LSSI_IM_TF  LSSI_IE_TF

#define LSSI_IO_CFG_SOUT    1U

#define LSSI_RAS_PAR_ODD    2U
#define LSSI_RAS_PAR_EVEN   1U
#define LSSI_RAS_PAR_UNUSE  0U

#define LSSI_UFC_CTS    (1U << 2)
#define LSSI_UFC_CTS_EN (1U << 1)
#define LSSI_UFC_RTS_EN (1U << 0)

#endif /* HARDWARE_LSSI_H_ */
