blob: b1332415413f2bb9a68d86bd67b984ecf8f32f5d [file] [log] [blame]
// 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_SMC_CTRL_H_
#define MATCHA_SW_DEVICE_LIB_DIF_DIF_SMC_CTRL_H_
/**
* @file
* @brief <a href="/hw/ip/smc_ctrl/doc/">SMC Controller</a> Device Interface Functions
*/
#include <stdint.h>
#include "sw/device/lib/base/mmio.h"
#include "sw/device/lib/dif/autogen/dif_smc_ctrl_autogen.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
dif_result_t dif_smc_ctrl_set_regwen(const dif_smc_ctrl_t *smc_ctrl);
dif_result_t dif_smc_ctrl_clear_regwen(const dif_smc_ctrl_t *smc_ctrl);
dif_result_t dif_smc_ctrl_read_regwen(const dif_smc_ctrl_t *smc_ctrl, uint32_t *result);
dif_result_t dif_smc_ctrl_set_en(const dif_smc_ctrl_t *smc_ctrl);
dif_result_t dif_smc_ctrl_clear_en(const dif_smc_ctrl_t *smc_ctrl);
dif_result_t dif_smc_ctrl_read_en(const dif_smc_ctrl_t *smc_ctrl, uint32_t *result);
/**
* Below functions are auto-generated. Keep them here for now for reference.
*/
/**
* Runtime configuration for SMC Controller.
*
* This struct describes (SOFTWARE) runtime information for one-time
* configuration of the hardware.
*/
typedef struct dif_smc_ctrl_config {
// Fields, if necessary.
} dif_smc_ctrl_config_t;
/**
* Parameters for a SMC Controller transaction.
*/
typedef struct dif_smc_ctrl_transaction {
// Your fields here.
} dif_smc_ctrl_transaction_t;
/**
* An output location for a SMC Controller transaction.
*/
typedef struct dif_smc_ctrl_output {
// Your fields here.
} dif_smc_ctrl_output_t;
OT_WARN_UNUSED_RESULT
dif_result_t dif_smc_ctrl_configure(
const dif_smc_ctrl_t *smc_ctrl,
dif_smc_ctrl_config_t config);
/**
* Begins a SMC Controller transaction.
*
* Each call to this function should be sequenced with a call to
* `dif_smc_ctrl_end()`.
*
* @param smc_ctrl A SMC Controller handle.
* @param transaction Transaction configuration parameters.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_smc_ctrl_start(
const dif_smc_ctrl_t *smc_ctrl,
dif_smc_ctrl_transaction_t transaction);
/** Ends a SMC Controller transaction, writing the results to the given output.
*
* @param smc_ctrl A SMC Controller handle.
* @param output Transaction output parameters.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_smc_ctrl_end(
const dif_smc_ctrl_t *smc_ctrl,
dif_smc_ctrl_output_t output);
/**
* Locks out SMC Controller functionality.
*
* This function is reentrant: calling it while functionality is locked will
* have no effect and return `kDifOk`.
*
* @param smc_ctrl A SMC Controller handle.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_smc_ctrl_lock(
const dif_smc_ctrl_t *smc_ctrl);
/**
* Checks whether this SMC Controller is locked.
*
* @param smc_ctrl A SMC 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_smc_ctrl_is_locked(
const dif_smc_ctrl_t *smc_ctrl,
bool *is_locked);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // MATCHA_SW_DEVICE_LIB_DIF_DIF_SMC_CTRL_H_