struct spifi_reg {
volatile uint32_t spstat;
volatile uint32_t cmlen;
volatile uint32_t cmdpage;
volatile uint32_t count_hi;
volatile uint32_t count_mid;
volatile uint32_t count_low;
volatile uint32_t svptr_hi;
volatile uint32_t svptr_mid;
volatile uint32_t svptr_low;
volatile uint32_t intr;
volatile uint32_t imask;
volatile uint32_t prctrl;
volatile uint32_t prstat;
volatile uint32_t init_status;
volatile uint32_t fifoctrl;
volatile uint32_t fifodata;
volatile uint32_t config;
volatile uint32_t data_xfer;
volatile uint32_t autocmd;
volatile uint32_t autostat;
volatile uint32_t resel;
volatile uint32_t select;
volatile uint32_t prcmd;
volatile uint32_t auxctrl;
volatile uint32_t autodata;
volatile uint32_t loopctrl;
volatile uint32_t loopdata;
volatile uint32_t identify;
volatile uint32_t complete;
volatile uint32_t scsi_status;
volatile uint32_t data;
volatile uint32_t icond;
volatile uint32_t fastwide;
volatile uint32_t exctrl;
volatile uint32_t exstat;
volatile uint32_t test;
volatile uint32_t quematch;
volatile uint32_t quecode;
volatile uint32_t quetag;
volatile uint32_t quepage;
uint32_t image[88];
struct {
volatile uint32_t cdb[12];
volatile uint32_t quecode;
volatile uint32_t quetag;
volatile uint32_t idmsg;
volatile uint32_t status;
} cmbuf[8];
};
#define SPS_IDLE 0x00
#define SPS_SEL 0x01
#define SPS_ARB 0x02
#define SPS_RESEL 0x03
#define SPS_MSGOUT 0x04
#define SPS_COMMAND 0x05
#define SPS_DISCON 0x06
#define SPS_NXIN 0x07
#define SPS_INTR 0x08
#define SPS_NXOUT 0x09
#define SPS_CCOMP 0x0a
#define SPS_SVPTR 0x0b
#define SPS_STATUS 0x0c
#define SPS_MSGIN 0x0d
#define SPS_DATAOUT 0x0e
#define SPS_DATAIN 0x0f
#define CML_LENMASK 0x0f
#define CML_AMSG_EN 0x40
#define CML_ACOM_EN 0x80
#define INTR_BSRQ 0x01
#define INTR_COMRECV 0x02
#define INTR_PERR 0x04
#define INTR_TIMEO 0x08
#define INTR_DERR 0x10
#define INTR_TGSEL 0x20
#define INTR_DISCON 0x40
#define INTR_FCOMP 0x80
#define INTR_BITMASK \
"\20\10FCOMP\07DISCON\06TGSEL\05DERR\04TIMEO\03PERR\02COMRECV\01BSRQ"
#define PRS_IO 0x08
#define PRS_CD 0x10
#define PRS_MSG 0x20
#define PRS_ATN 0x40
#define PRS_Z 0x80
#define PRS_PHASE (PRS_MSG | PRS_CD | PRS_IO)
#define PRS_BITMASK "\20\10Z\07ATN\06MSG\05CD\04IO"
#define IST_ACK 0x40
#define FIFOC_FSLOT 0x0f
#define FIFOC_SSTKACT 0x10
#define FIFOC_RQOVRN 0x20
#define FIFOC_CLREVEN 0x00
#define FIFOC_CLRODD 0x40
#define FIFOC_FLUSH 0x80
#define FIFOC_LOAD 0xc0
#define CONFIG_PGENEN 0x08
#define CONFIG_PCHKEN 0x10
#define CONFIG_WORDEN 0x20
#define CONFIG_AUTOID 0x40
#define CONFIG_DMABURST 0x80
#define SEL_SETATN 0x02
#define SEL_IRESELEN 0x04
#define SEL_ISTART 0x08
#define SEL_WATN 0x80
#define PRC_DATAOUT 0
#define PRC_DATAIN 1
#define PRC_COMMAND 2
#define PRC_STATUS 3
#define PRC_TRPAD 4
#define PRC_MSGOUT 6
#define PRC_MSGIN 7
#define PRC_KILLREQ 0x08
#define PRC_CLRACK 0x10
#define PRC_NJMP 0x80
#define AUXCTRL_DMAEDGE 0x04
#define AUXCTRL_SETRST 0x20
#define AUXCTRL_CRST 0x40
#define AUXCTRL_SRST 0x80
#define ADATA_IN 0x40
#define ADATA_EN 0x80
#define ICOND_ADATAOFF 0x02
#define ICOND_AMSGOFF 0x06
#define ICOND_ACMDOFF 0x0a
#define ICOND_ASTATOFF 0x0e
#define ICOND_SVPTEXP 0x10
#define ICOND_ADATAMIS 0x20
#define ICOND_CNTZERO 0x40
#define ICOND_UXPHASEZ 0x80
#define ICOND_UXPHASENZ 0x81
#define ICOND_NXTREQ 0xa0
#define ICOND_UKMSGZ 0xc0
#define ICOND_UKMSGNZ 0xc1
#define ICOND_UBF 0xe0
#define FAST_FASTEN 0x01
#define EXC_IPLOCK 0x04
#define EXS_UBF 0x08