blob: a587ddb9df8f55e3e3afa454639905a2b21551e6 [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_ML_TOP_H_
#define MATCHA_SW_DEVICE_LIB_DIF_DIF_ML_TOP_H_
/**
* @file
* @brief <a href="/hw/ip/ml_top/doc/">ML_Top</a> Device Interface Functions
*/
#include <stdint.h>
#include "sw/device/lib/dif/autogen/dif_ml_top_autogen.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// ML_Top Control Register
dif_result_t dif_ml_top_reset_ctrl_en(const dif_ml_top_t *ml_top);
dif_result_t dif_ml_top_read_ctrl_en(const dif_ml_top_t *ml_top, uint32_t *result);
// ML_Top Interrupt Enable Register
dif_result_t dif_ml_top_reset_intr_en(const dif_ml_top_t *ml_top);
dif_result_t dif_ml_top_read_intr_en(const dif_ml_top_t *ml_top, uint32_t *result);
/**
* Below functions are auto-generated. Keep them here for now for reference.
*/
/**
* Runtime configuration for ML_Top.
*
* This struct describes (SOFTWARE) runtime information for one-time
* configuration of the hardware.
*/
typedef struct dif_ml_top_config {
// Fields, if necessary.
} dif_ml_top_config_t;
/**
* Parameters for a ML_Top transaction.
*/
typedef struct dif_ml_top_transaction {
// Your fields here.
} dif_ml_top_transaction_t;
/**
* An output location for a ML_Top transaction.
*/
typedef struct dif_ml_top_output {
// Your fields here.
} dif_ml_top_output_t;
/**
* Configures ML_Top with runtime information.
*
* This function should only need to be called once for the lifetime of
* `handle`.
*
* @param ml_top A ML_Top handle.
* @param config Runtime configuration parameters.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_ml_top_configure(
const dif_ml_top_t *ml_top,
dif_ml_top_config_t config);
/**
* Begins a ML_Top transaction.
*
* Each call to this function should be sequenced with a call to
* `dif_ml_top_end()`.
*
* @param ml_top A ML_Top handle.
* @param transaction Transaction configuration parameters.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_ml_top_start(
const dif_ml_top_t *ml_top,
dif_ml_top_transaction_t transaction);
/** Ends a ML_Top transaction, writing the results to the given output.
*
* @param ml_top A ML_Top handle.
* @param output Transaction output parameters.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_ml_top_end(
const dif_ml_top_t *ml_top,
dif_ml_top_output_t output);
/**
* Locks out ML_Top functionality.
*
* This function is reentrant: calling it while functionality is locked will
* have no effect and return `kDifOk`.
*
* @param ml_top A ML_Top handle.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_ml_top_lock(
const dif_ml_top_t *ml_top);
/**
* Checks whether this ML_Top is locked.
*
* @param ml_top A ML_Top 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_ml_top_is_locked(
const dif_ml_top_t *ml_top,
bool *is_locked);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // MATCHA_SW_DEVICE_LIB_DIF_DIF_ML_TOP_H_