#include "common-app.h"

void
init (void)
{
  REGS->mailboxes.mboxout = 0x23456789;

  /* Enable scrubber */
  SUPERVISOR->scrub_cfg = HYDRA_SUPERVISOR_REGS_SCRUB_CFG_IRAM_EN
    | HYDRA_SUPERVISOR_REGS_SCRUB_CFG_DRAM_EN;
}

void
main (void)
{
  SUPERVISOR->wd_key = WD_KEY;

  if (REGS->mailboxes.status & MBOX_REGS_STATUS_MBIN)
    {
      unsigned dat;

      dat = REGS->mailboxes.mboxin;
      REGS->mailboxes.mboxout = dat + 1;

      if (dat == 0 && SUPERVISOR->force_divergence != 1)
        SUPERVISOR->wd_key = WD_KEY;
    }
}
