// 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 MATCHA_SW_DEVICE_LIB_DIF_DIF_CAM_CTRL_H_
#define MATCHA_SW_DEVICE_LIB_DIF_DIF_CAM_CTRL_H_

/**
 * @file
 * @brief <a href="/hw/ip/cam_ctrl/doc/">Camera Controller</a> Device Interface Functions
 */

#include <stdint.h>

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

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

dif_result_t dif_cam_ctrl_set_en(const dif_cam_ctrl_t *cam_ctrl);
dif_result_t dif_cam_ctrl_clear_en(const dif_cam_ctrl_t *cam_ctrl);
dif_result_t dif_cam_ctrl_read_en(const dif_cam_ctrl_t *cam_ctrl, uint32_t *result);

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


/**
 * Runtime configuration for Camera Controller.
 *
 * This struct describes (SOFTWARE) runtime information for one-time
 * configuration of the hardware.
 */
typedef struct dif_cam_ctrl_config {
  // Fields, if necessary.
} dif_cam_ctrl_config_t;


/**
 * Parameters for a Camera Controller transaction.
 */
typedef struct dif_cam_ctrl_transaction {
  // Your fields here.
} dif_cam_ctrl_transaction_t;

/**
 * An output location for a Camera Controller transaction.
 */
typedef struct dif_cam_ctrl_output {
  // Your fields here.
} dif_cam_ctrl_output_t;

/**
 * Configures Camera Controller with runtime information.
 *
 * This function should only need to be called once for the lifetime of
 * `handle`.
 *
 * @param cam_ctrl A Camera Controller handle.
 * @param config Runtime configuration parameters.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_cam_ctrl_configure(
  const dif_cam_ctrl_t *cam_ctrl,
  dif_cam_ctrl_config_t config);

/**
 * Begins a Camera Controller transaction.
 *
 * Each call to this function should be sequenced with a call to
 * `dif_cam_ctrl_end()`.
 *
 * @param cam_ctrl A Camera Controller handle.
 * @param transaction Transaction configuration parameters.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_cam_ctrl_start(
  const dif_cam_ctrl_t *cam_ctrl,
  dif_cam_ctrl_transaction_t transaction);

/** Ends a Camera Controller transaction, writing the results to the given output.
 *
 * @param cam_ctrl A Camera Controller handle.
 * @param output Transaction output parameters.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_cam_ctrl_end(
  const dif_cam_ctrl_t *cam_ctrl,
  dif_cam_ctrl_output_t output);

/**
 * Locks out Camera Controller functionality.
 *
 * This function is reentrant: calling it while functionality is locked will
 * have no effect and return `kDifOk`.
 *
 * @param cam_ctrl A Camera Controller handle.
 * @return The result of the operation.
 */
OT_WARN_UNUSED_RESULT
dif_result_t dif_cam_ctrl_lock(
  const dif_cam_ctrl_t *cam_ctrl);

/**
 * Checks whether this Camera Controller is locked.
 *
 * @param cam_ctrl A Camera Controller 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_cam_ctrl_is_locked(
  const dif_cam_ctrl_t *cam_ctrl,
  bool *is_locked);

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

#endif  // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_CAM_CTRL_H_
