blob: 3730cfdb9aaaff7ba533e48d2fb66e2bce311f5a [file] [log] [blame]
/*
* 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_