| /* | |
| * 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_ML_TOP_H_ | |
| #define 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_release_ctrl_en(const dif_ml_top_t *ml_top); | |
| dif_result_t dif_ml_top_resume_ctrl_en(const dif_ml_top_t *ml_top, uint32_t pc); | |
| 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. | |
| */ | |
| #pragma clang diagnostic push | |
| #pragma clang diagnostic ignored "-Wextern-c-compat" | |
| /** | |
| * 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; | |
| #pragma clang diagnostic pop | |
| /** | |
| * 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 // SW_DEVICE_LIB_DIF_DIF_ML_TOP_H_ |