/*
 * Copyright 2023 Google LLC
 * Copyright lowRISC contributors
 *
 * 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.
 */


#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_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_
