/*
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// Simple program to turn on the SMC and fall asleep.

#include "hw/top_matcha/sw/autogen/top_matcha.h"
#include "sw/device/lib/arch/device.h"
#include "sw/device/lib/dif/dif_pinmux.h"
#include "sw/device/lib/dif/dif_smc_ctrl.h"
#include "sw/device/lib/dif/dif_uart.h"
#include "sw/device/lib/runtime/hart.h"
#include "sw/device/lib/testing/pinmux_testutils.h"
#include "sw/device/lib/testing/test_framework/check.h"
#include "sw/device/lib/testing/test_framework/ottf_test_config.h"
#include "sw/device/lib/testing/test_framework/test_util.h"

#if defined(PAGE_BOUNDARY_TEST)
#include "sw/device/tests/smc/smc_page_boundary_test_fpga_nexus_bin_c.h"
#elif defined(INTERRUPT_BOUNDARY_TEST)
#include "sw/device/tests/smc/smc_interrupt_boundary_test_fpga_nexus_bin_c.h"
#elif defined(LSU_INTERRUPT_BOUNDARY_TEST)
#include "sw/device/tests/smc/smc_lsu_interrupt_boundary_test_fpga_nexus_bin_c.h"
#elif defined(LSU_PAGE_BOUNDARY_TEST)
#include "sw/device/tests/smc/smc_lsu_page_boundary_test_fpga_nexus_bin_c.h"
#elif defined(CAM_I2C_TEST)
#include "sw/device/tests/smc/smc_cam_i2c_test_fpga_nexus_bin_c.h"
#elif defined(I2S_RX_TEST)
#include "sw/device/tests/smc/smc_i2s_rx_test_fpga_nexus_bin_c.h"
#elif defined(I2S_TX_TEST)
#include "sw/device/tests/smc/smc_i2s_tx_test_fpga_nexus_bin_c.h"
#elif defined(SUPERVISOR_MODE_TEST)
#include "sw/device/tests/smc/smc_supervisor_mode_test_fpga_nexus_bin_c.h"
#elif defined(VIRTUAL_MEMORY_TEST)
#include "sw/device/tests/smc/smc_virtual_memory_test_fpga_nexus_bin_c.h"
#elif defined(ATOMICS_TEST)
#include "sw/device/tests/smc/smc_atomics_test_fpga_nexus_bin_c.h"
#elif defined(ISP_IRQ_TEST)
#include "sw/device/tests/smc/smc_isp_wrapper_irq_test_fpga_nexus_bin_c.h"
#elif defined(ISP_TPG_128_64_TEST)
#include "sw/device/tests/smc/smc_isp_wrapper_tpg_128_64_test_fpga_nexus_bin_c.h"
#elif defined(ML_TOP_IRQ_TEST)
#include "sw/device/tests/smc/smc_ml_top_irq_test_fpga_nexus_bin_c.h"
#endif

OTTF_DEFINE_TEST_CONFIG();

static dif_pinmux_t pinmux;
static dif_smc_ctrl_t smc_ctrl;
static dif_uart_t uart;

void _ottf_main(void) {
  // Initialize the UART to enable logging for non-DV simulation platforms.
  if (kDeviceType != kDeviceSimDV) {
    init_uart(TOP_MATCHA_UART0_BASE_ADDR, &uart);
  }

  CHECK_DIF_OK(dif_pinmux_init(
      mmio_region_from_addr(TOP_MATCHA_PINMUX_AON_BASE_ADDR), &pinmux));
#if defined(I2S_TX_TEST)
  CHECK_DIF_OK(pinmux_testutils_configure_i2s_tx(&pinmux));
#endif

#if defined(I2S_RX_TEST)
  CHECK_DIF_OK(pinmux_testutils_configure_i2s_rx(&pinmux));
#endif

#if defined(CAM_I2C_TEST)
  CHECK_DIF_OK(pinmux_testutils_configure_cam_i2c(&pinmux));
  CHECK_DIF_OK(pinmux_testutils_configure_cam_ctrl(&pinmux));
#endif

#if defined(CAM_I2C_TEST) || defined(ISP_IRQ_TEST) || \
    defined(ISP_TPG_128_64_TEST)
  CHECK_DIF_OK(pinmux_testutils_configure_isp_wrapper(&pinmux));
#endif

#if defined(HAS_SMC_BIN)
  if (kDeviceType == kDeviceFpgaNexus) {
    memcpy((void*)TOP_MATCHA_RAM_SMC_BASE_ADDR, smc_bin, smc_bin_len);
  }
#endif
  CHECK_DIF_OK(dif_smc_ctrl_init(
      mmio_region_from_addr(TOP_MATCHA_SMC_CTRL_BASE_ADDR), &smc_ctrl));

  CHECK_DIF_OK(dif_smc_ctrl_set_en(&smc_ctrl));

  // Note: the SMC must end the simulation through testing or otherwise, as the
  // secure core indefinitely sleeps.
  while (true) {
    asm volatile("wfi");
  }
}
