blob: 3bb06ac0678df8eb7c064768f15ea96caaa0a293 [file] [log] [blame]
// 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_