// Test Code for Allwinner A64 MIPI DSI
// Add `#include "../../pinephone-nuttx/test/test_a64_mipi_dsi2.c"` to the end of a64_mipi_dsi_enable(), before `return OK` in this file:
// https://github.com/apache/nuttx/blob/master/arch/arm64/src/a64/a64_mipi_dsi.c

{
  DEBUGASSERT(BUS_CLK_GATING_REG0 == 0x1c20060);
  DEBUGASSERT(MIPIDSI_GATING == 2);

  DEBUGASSERT(BUS_SOFT_RST_REG0 == 0x1c202c0);
  DEBUGASSERT(MIPI_DSI_RST == 2);

  DEBUGASSERT(DSI_CTL_REG == 0x1ca0000);
  DEBUGASSERT(DSI_EN == 1);

  DEBUGASSERT(DSI_BASIC_CTL0_REG == 0x1ca0010);
  DEBUGASSERT(dsi_basic_ctl0 == 0x30000);

  DEBUGASSERT(DSI_TRANS_START_REG == 0x1ca0060);
  DEBUGASSERT(DSI_TRANS_ZERO_REG == 0x1ca0078);

  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_LP11) == 0x1ca0020);
  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_TBA) == 0x1ca0024);
  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_HSC) == 0x1ca0028);
  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_HSD) == 0x1ca002c);
  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_LPDT) == 0x1ca0030);
  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_HSCEXIT) == 0x1ca0034);
  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_NOP) == 0x1ca0038);
  DEBUGASSERT(DSI_INST_FUNC_REG(DSI_INST_ID_DLY) == 0x1ca003c);

  DEBUGASSERT(DSI_INST_JUMP_CFG_REG(DSI_INST_JUMP_CFG) == 0x1ca004c);

  DEBUGASSERT(DSI_DEBUG_DATA_REG == 0x1ca02f8);

  DEBUGASSERT(DSI_BASIC_CTL1_REG == 0x1ca0014);
  DEBUGASSERT(dsi_basic_ctl1 == 0x5bc7);

  DEBUGASSERT(DSI_TCON_DRQ_REG == 0x1ca007c);

  DEBUGASSERT(DSI_INST_LOOP_SEL_REG == 0x1ca0040);

  DEBUGASSERT(DSI_INST_LOOP_NUM_REG(0) == 0x1ca0044);
  DEBUGASSERT(DSI_INST_LOOP_NUM_REG(1) == 0x1ca0054);

  DEBUGASSERT(DSI_PIXEL_PH_REG == 0x1ca0090);
  DEBUGASSERT(dsi_pixel_ph == 0x1308703e);
  DEBUGASSERT(DSI_PIXEL_PF0_REG == 0x1ca0098);

  DEBUGASSERT(DSI_PIXEL_PF1_REG == 0x1ca009c);
  DEBUGASSERT(dsi_pixel_pf1 == 0xffffffff);

  DEBUGASSERT(DSI_PIXEL_CTL0_REG == 0x1ca0080);
  DEBUGASSERT(dsi_pixel_ctl0 == 0x10008);
  DEBUGASSERT(DSI_BASIC_CTL_REG == 0x1ca000c);

  DEBUGASSERT(DSI_SYNC_HSS_REG == 0x1ca00b0);
  DEBUGASSERT(dsi_sync_hss == 0x12000021);

  DEBUGASSERT(DSI_SYNC_HSE_REG == 0x1ca00b4);
  DEBUGASSERT(dsi_sync_hse == 0x1000031);

  DEBUGASSERT(DSI_SYNC_VSS_REG == 0x1ca00b8);
  DEBUGASSERT(dsi_sync_vss == 0x7000001);

  DEBUGASSERT(DSI_SYNC_VSE_REG == 0x1ca00bc);
  DEBUGASSERT(dsi_sync_vse == 0x14000011);

  DEBUGASSERT(DSI_BASIC_SIZE0_REG == 0x1ca0018);
  DEBUGASSERT(dsi_basic_size0 == 0x11000a);

  DEBUGASSERT(DSI_BASIC_SIZE1_REG == 0x1ca001c);
  DEBUGASSERT(dsi_basic_size1 == 0x5cd05a0);

  DEBUGASSERT(DSI_BLK_HSA0_REG == 0x1ca00c0);
  DEBUGASSERT(DSI_BLK_HSA1_REG == 0x1ca00c4);
  DEBUGASSERT(dsi_blk_hsa1 == 0x50b40000);

  DEBUGASSERT(DSI_BLK_HBP0_REG == 0x1ca00c8);
  DEBUGASSERT(DSI_BLK_HBP1_REG == 0x1ca00cc);
  DEBUGASSERT(dsi_blk_hbp1 == 0x757a0000);

  DEBUGASSERT(DSI_BLK_HFP0_REG == 0x1ca00d0);
  DEBUGASSERT(DSI_BLK_HFP1_REG == 0x1ca00d4);
  DEBUGASSERT(dsi_blk_hfp1 == 0x50b40000);

  DEBUGASSERT(DSI_BLK_HBLK0_REG == 0x1ca00e0);
  DEBUGASSERT(DSI_BLK_HBLK1_REG == 0x1ca00e4);
  DEBUGASSERT(dsi_blk_hblk1 == 0x72bd0000);

  DEBUGASSERT(DSI_BLK_VBLK0_REG == 0x1ca00e8);
  DEBUGASSERT(DSI_BLK_VBLK1_REG == 0x1ca00ec);

  DEBUGASSERT(dsi_blk_vblk1 == 0xffff0000);
}
