|  | /* | 
|  | * 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 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_ |