#ifndef VERITEFBREG_H
#define VERITEFBREG_H
#define VFB_IO_BAR 0x14
#define VFB_FB_BAR 0x10
#define VFB_MMIO_BAR 0x18
#define VFB_MMIO_REG_BASE 0x20000
#define VFB_FIFO_SWAP_NO 0x00
#define VFB_FIFO_SWAP_END 0x04
#define VFB_FIFO_SWAP_INHW 0x08
#define VFB_FIFO_SWAP_HW 0x0c
#define VFB_FIFOINFREE 0x40
#define VFB_FIFOINFREE_MASK 0x1f
#define VFB_FIFO_SIZE 0x1f
#define VFB_FIFOOUTVALID 0x41
#define VFB_FIFOOUTVALID_MASK 0x07
#define VFB_COMM 0x42
#define VFB_COMM_SYSSTATUS_MASK 0x0f
#define VFB_COMM_RISCSTATUS_MASK 0xf0
#define VFB_MEMENDIAN 0x43
#define VFB_MEMENDIAN_NO 0
#define VFB_MEMENDIAN_END 1
#define VFB_MEMENDIAN_INHW 2
#define VFB_MEMENDIAN_HW 3
#define VFB_MEMENDIAN_MASK 3
#define VFB_INTR 0x44
#define VFB_INTREN 0x46
#define VFB_INTR_VERT 0x01
#define VFB_INTR_FIFOLOW 0x02
#define VFB_INTR_RISC 0x04
#define VFB_INTR_HALT 0x08
#define VFB_INTR_FIFOERROR 0x10
#define VFB_INTR_DMAERROR 0x20
#define VFB_INTR_DMA 0x40
#define VFB_INTR_X 0x80
#define VFB_DEBUG 0x48
#define VFB_DEBUG_SOFTRESET 0x01
#define VFB_DEBUG_HOLDRISC 0x02
#define VFB_DEBUG_STEPRISC 0x04
#define VFB_DEBUG_DIRECTSCLK 0x08
#define VFB_DEBUG_SOFTVGARESET 0x10
#define VFB_DEBUG_SOFTXRESET 0x20
#define VFB_LOWWATERMARK 0x49
#define VFB_STATUS 0x4a
#define VFB_STATUS_HOLD_MASK 0x8c
#define VFB_STATUS_HELD 0x02
#define VFB_XBUSCTL 0x4b
#define VFB_DMACMDPTR 0x50
#define VFB_DMACMDPTR_BUSY 0x01
#define VFB_DMAADDRESS 0x54
#define VFB_DMACOUNT 0x58
#define VFB_DMALEN_LINK 0x80000000
#define VFB_DMASWAP_NONE 0
#define VFB_DMASWAP_BYTE 1
#define VFB_DMASWAP_HWIN 2
#define VFB_DMASWAP_HW 3
#define VFB_DMA_LOWWATER 8
#define VFB_STATEINDEX 0x60
#define VFB_STATEDATA 0x64
#define VFB_STATEINDEX_IR 128
#define VFB_STATEINDEX_PC 129
#define VFB_STATEINDEX_S1 130
#define VFB_SCLKPLL 0x68
#define VFB_SCRATCH 0x70
#define VFB_MODE 0x72
#define VFB_MODE_VESA 0x01
#define VFB_MODE_VGA 0x02
#define VFB_MODE_VGA32 0x04
#define VFB_MODE_DMAEN 0x08
#define VFB_MODE_NATIVE 0x00
#define VFB_BANKSELECT 0x74
#define VFB_CRTCTEST 0x80
#define VFB_CRTCTEST_VIDEOLATENCY_MASK 0x1f
#define VFB_CRTCTEST_NOTVBLANK 0x10000
#define VFB_CRTCTEST_VBLANK 0x40000
#define VFB_CRTCCTL 0x84
#define VFB_CRTCCTL_SCRNFMT_MASK 0xf
#define VFB_CRTCCTL_VIDEOFIFOSIZE128 0x10
#define VFB_CRTCCTL_ENABLEDDC 0x20
#define VFB_CRTCCTL_DDCOUTPUT 0x40
#define VFB_CRTCCTL_DDCDATA 0x80
#define VFB_CRTCCTL_VSYNCHI 0x100
#define VFB_CRTCCTL_HSYNCHI 0x200
#define VFB_CRTCCTL_VSYNCENABLE 0x400
#define VFB_CRTCCTL_HSYNCENABLE 0x800
#define VFB_CRTCCTL_VIDEOENABLE 0x1000
#define VFB_CRTCCTL_STEREOSCOPIC 0x2000
#define VFB_CRTCCTL_FRAMEDISPLAYED 0x4000
#define VFB_CRTCCTL_FRAMEBUFFERBGR 0x8000
#define VFB_CRTCCTL_EVENFRAME 0x10000
#define VFB_CRTCCTL_LINEDOUBLE 0x20000
#define VFB_CRTCCTL_FRAMESWITCHED 0x40000
#define VFB_CRTCCTL_VIDEOFIFOSIZE256 0x800000
#define VFB_CRTCHORZ 0x88
#define VFB_CRTCHORZ_ACTIVE_MASK 0xff
#define VFB_CRTCHORZ_BACKPORCH_MASK 0x7e00
#define VFB_CRTCHORZ_SYNC_MASK 0x1f0000
#define VFB_CRTCHORZ_FRONTPORCH_MASK 0xe00000
#define VFB_CRTCVERT 0x8c
#define VFB_CRTCVERT_ACTIVE_MASK 0x7ff
#define VFB_CRTCVERT_BACKPORCH_MASK 0x1f800
#define VFB_CRTCVERT_SYNC_MASK 0xe0000
#define VFB_CRTCVERT_FRONTPORCH_MASK 0x03f00000
#define VFB_FRAMEBASEB 0x90
#define VFB_FRAMEBASEA 0x94
#define VFB_CRTCOFFSET 0x98
#define VFB_CRTCOFFSET_MASK 0xffff
#define VFB_VIDEOFIFO_BYTES 128
#define VFB_CRTCSTATUS 0x9c
#define VFB_CRTCSTATUS_VERT_MASK 0xc00000
#define VFB_CRTCSTATUS_VERT_FPORCH 0x400000
#define VFB_CRTCSTATUS_VERT_SYNC 0xc00000
#define VFB_CRTCSTATUS_VERT_BPORCH 0x800000
#define VFB_CRTCSTATUS_VERT_ACTIVE 0x000000
#define VFB_MEMCTL 0xa0
#define VFB_MEMCTL_ADRSWIZZLE_MASK 0x1800
#define VFB_MEMCTL_HOLDREFRESH 0x2000
#define VFB_MEMCTL_WREFRESH_MASK 0xff0000
#define VFB_MEMCTL_WREFRESH_DEFAULT 0x330000
#define VFB_MEMDIAG 0xa4
#define VFB_CURSORBASE 0xac
#define VFB_IOONLY_BASE 0xb0
#define VFB_DACRAMWRITEADR 0xb0
#define VFB_DACRAMDATA 0xb1
#define VFB_DACPIXELMSK 0xb2
#define VFB_DACRAMREADADR 0xb3
#define VFB_DACOVSWRITEADR 0xb4
#define VFB_DACOVSDATA 0xb5
#define VFB_DACCOMMAND0 0xb6
#define VFB_DACOVSREADADR 0xb7
#define VFB_DACCOMMAND1 0xb8
#define VFB_DACCOMMAND2 0xb9
#define VFB_DACSTATUS 0xba
#define VFB_DACCOMMAND3 0xba
#define VFB_DACCURSORDATA 0xbb
#define VFB_DACCURSORXLOW 0xbc
#define VFB_DACCURSORXHIGH 0xbd
#define VFB_DACCURSORYLOW 0xbe
#define VFB_DACCURSORYHIGH 0xbf
#define VFB_PCLKPLL 0xc0
#define VFB_PCLKPLL_M_MASK __BITS(8, 0)
#define VFB_PCLKPLL_P_MASK __BITS(12, 9)
#define VFB_PCLKPLL_N_MASK __BITS(18, 13)
#define VFB_PLL_M_MAX 0xff
#define VFB_PLL_N_MAX 0x3f
#define VFB_PLL_P_MAX 0x0f
#define VFB_PLL_PCF_MIN 100000
#define VFB_PLL_PCF_MAX 300000
#define VFB_PLL_VCO_MIN 12500000
#define VFB_PLL_VCO_MAX 25000000
#define VFB_PLL_STABILIZE_US 500
#define VFB_SCLKPLL_DEFAULT 0xa484d
#define VFB_PIXFMT_332 1
#define VFB_PIXFMT_8I 2
#define VFB_PIXFMT_565 4
#define VFB_PIXFMT_4444 5
#define VFB_PIXFMT_1555 6
#define VFB_PIXFMT_8888 12
#define VFB_DACCMD0_EXTENDED 0x80
#define VFB_DACCMD0_8BITDAC 0x02
#define VFB_DACCMD1_24BPP 0x00
#define VFB_DACCMD1_16BPP 0x20
#define VFB_DACCMD1_8BPP 0x40
#define VFB_DACCMD1_BYPASS_CLUT 0x10
#define VFB_DACCMD1_565 0x08
#define VFB_DACCMD1_PORT_AB 0x00
#define VFB_DACCMD2_PIXEL_INPUT_GATE 0x20
#define VFB_DACCMD2_DISABLE_CURSOR 0x00
#define VFB_DACCMD2_CURSOR_MASK 0x03
#define VFB_DACCMD3_INDEX 0x01
#define VFB_DACCMD3_CLK_DOUBLER 0x08
#endif