// Copyright 2022 Google LLC.
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#ifndef SW_DEVICE_LIB_DIF_DIF_ISP_WRAPPER_H_
#define SW_DEVICE_LIB_DIF_DIF_ISP_WRAPPER_H_

/**
 * @file
 * @brief <a href="/hw/ip/isp_wrapper/doc/">Image signal processor wrapper</a> Device Interface Functions
 */

#include <stdint.h>

#include "sw/device/lib/dif/autogen/dif_isp_wrapper_autogen.h"

#ifdef __cplusplus
extern "C" {
#endif  // __cplusplus

dif_result_t dif_isp_wrapper_set_en(const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_set_tpg_64_64_en(
    const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_set_raw_320x240_byp_320x240_en(
    const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_set_ml_mem_byp_320x240_en(
    const dif_isp_wrapper_t *isp_wrapper);
dif_result_t _dif_isp_wrapper_set_raw_320x240_byp_320x240_en(
    const dif_isp_wrapper_t *isp_wrapper, const uint32_t y_base_ad_init_addr,
    const uint32_t cb_base_ad_init_addr, const uint32_t cr_base_ad_init_addr,
    const uint32_t y_base_ad_init2_addr, const uint32_t cb_base_ad_init2_addr,
    const uint32_t cr_base_ad_init2_addr);
dif_result_t dif_isp_wrapper_set_raw_324x324_byp_324x324_en(
    const dif_isp_wrapper_t *isp_wrapper);

dif_result_t dif_isp_wrapper_clear_en(const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_isp_irq_mask(const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_mi_irq_mask(const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_isp_irq_done(const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_mi_irq_done(const dif_isp_wrapper_t *isp_wrapper);
dif_result_t dif_isp_wrapper_read_en(const dif_isp_wrapper_t *isp_wrapper,
                                     uint32_t *result);
dif_result_t dif_isp_wrapper_read_mi_mis(const dif_isp_wrapper_t *isp_wrapper,
                                         uint32_t *result);
dif_result_t dif_isp_wrapper_read_isp_mis(const dif_isp_wrapper_t *isp_wrapper,
                                          uint32_t *result);
dif_result_t dif_isp_wrapper_write_isp_icr(const dif_isp_wrapper_t *isp_wrapper,
                                           uint32_t val);
dif_result_t dif_isp_wrapper_write_mi_icr(const dif_isp_wrapper_t *isp_wrapper,
                                          uint32_t val);

/**
 * Below functions are auto-generated. Keep them here for now for reference.
 */

/**
 * Runtime configuration for image signal processor wrapper.
 *
 * This struct describes (SOFTWARE) runtime information for one-time
 * configuration of the hardware.
 */
typedef struct dif_isp_wrapper_config {
  // Fields, if necessary.
} dif_isp_wrapper_config_t;


/**
 * Parameters for a image signal processor wrapper transaction.
 */
typedef struct dif_isp_wrapper_transaction {
  // Your fields here.
} dif_isp_wrapper_transaction_t;

/**
 * An output location for a image signal processor wrapper transaction.
 */
typedef struct dif_isp_wrapper_output {
  // Your fields here.
} dif_isp_wrapper_output_t;

/**
 * Configures image signal processor wrapper with runtime information.
 *
 * This function should only need to be called once for the lifetime of
 * `handle`.
 *
 * @param isp_wrapper A image signal processor wrapper handle.
 * @param config Runtime configuration parameters.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_isp_wrapper_configure(
  const dif_isp_wrapper_t *isp_wrapper,
  dif_isp_wrapper_config_t config);

/**
 * Begins a image signal processor wrapper transaction.
 *
 * Each call to this function should be sequenced with a call to
 * `dif_isp_wrapper_end()`.
 *
 * @param isp_wrapper A image signal processor wrapper handle.
 * @param transaction Transaction configuration parameters.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_isp_wrapper_start(
  const dif_isp_wrapper_t *isp_wrapper,
  dif_isp_wrapper_transaction_t transaction);

/** Ends a image signal processor wrapper transaction, writing the results to the given output.
 *
 * @param isp_wrapper A image signal processor wrapper handle.
 * @param output Transaction output parameters.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_isp_wrapper_end(
  const dif_isp_wrapper_t *isp_wrapper,
  dif_isp_wrapper_output_t output);

/**
 * Locks out image signal processor wrapper functionality.
 *
 * This function is reentrant: calling it while functionality is locked will
 * have no effect and return `kDifOk`.
 *
 * @param isp_wrapper A image signal processor wrapper handle.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_isp_wrapper_lock(
  const dif_isp_wrapper_t *isp_wrapper);

/**
 * Checks whether this image signal processor wrapper is locked.
 *
 * @param isp_wrapper A image signal processor wrapper handle.
 * @param[out] is_locked Out-param for the locked state.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_isp_wrapper_is_locked(
  const dif_isp_wrapper_t *isp_wrapper,
  bool *is_locked);

#ifdef __cplusplus
}  // extern "C"
#endif  // __cplusplus

#endif  // SW_DEVICE_LIB_DIF_DIF_ISP_WRAPPER_H_
