blob: b1332415413f2bb9a68d86bd67b984ecf8f32f5d [file] [log] [blame]
Yen-Kai Wang834ed7a2022-09-12 15:33:58 -05001// Copyright lowRISC contributors.
Michael Hoang61e11aa2022-09-09 01:08:01 +00002// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5#ifndef MATCHA_SW_DEVICE_LIB_DIF_DIF_SMC_CTRL_H_
6#define MATCHA_SW_DEVICE_LIB_DIF_DIF_SMC_CTRL_H_
7
8/**
9 * @file
10 * @brief <a href="/hw/ip/smc_ctrl/doc/">SMC Controller</a> Device Interface Functions
11 */
12
13#include <stdint.h>
14
15#include "sw/device/lib/base/mmio.h"
16
17#include "sw/device/lib/dif/autogen/dif_smc_ctrl_autogen.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif // __cplusplus
22
23dif_result_t dif_smc_ctrl_set_regwen(const dif_smc_ctrl_t *smc_ctrl);
24dif_result_t dif_smc_ctrl_clear_regwen(const dif_smc_ctrl_t *smc_ctrl);
25dif_result_t dif_smc_ctrl_read_regwen(const dif_smc_ctrl_t *smc_ctrl, uint32_t *result);
26
27dif_result_t dif_smc_ctrl_set_en(const dif_smc_ctrl_t *smc_ctrl);
28dif_result_t dif_smc_ctrl_clear_en(const dif_smc_ctrl_t *smc_ctrl);
29dif_result_t dif_smc_ctrl_read_en(const dif_smc_ctrl_t *smc_ctrl, uint32_t *result);
30
31/**
32 * Below functions are auto-generated. Keep them here for now for reference.
33 */
34
35
36/**
37 * Runtime configuration for SMC Controller.
38 *
39 * This struct describes (SOFTWARE) runtime information for one-time
40 * configuration of the hardware.
41 */
42typedef struct dif_smc_ctrl_config {
43 // Fields, if necessary.
44} dif_smc_ctrl_config_t;
45
46
47/**
48 * Parameters for a SMC Controller transaction.
49 */
50typedef struct dif_smc_ctrl_transaction {
51 // Your fields here.
52} dif_smc_ctrl_transaction_t;
53
54/**
55 * An output location for a SMC Controller transaction.
56 */
57typedef struct dif_smc_ctrl_output {
58 // Your fields here.
59} dif_smc_ctrl_output_t;
60
61
62OT_WARN_UNUSED_RESULT
63dif_result_t dif_smc_ctrl_configure(
64 const dif_smc_ctrl_t *smc_ctrl,
65 dif_smc_ctrl_config_t config);
66
67/**
68 * Begins a SMC Controller transaction.
69 *
70 * Each call to this function should be sequenced with a call to
71 * `dif_smc_ctrl_end()`.
72 *
73 * @param smc_ctrl A SMC Controller handle.
74 * @param transaction Transaction configuration parameters.
75 * @return The result of the operation.
76 */
77OT_WARN_UNUSED_RESULT
78dif_result_t dif_smc_ctrl_start(
79 const dif_smc_ctrl_t *smc_ctrl,
80 dif_smc_ctrl_transaction_t transaction);
81
82/** Ends a SMC Controller transaction, writing the results to the given output.
83 *
84 * @param smc_ctrl A SMC Controller handle.
85 * @param output Transaction output parameters.
86 * @return The result of the operation.
87 */
88OT_WARN_UNUSED_RESULT
89dif_result_t dif_smc_ctrl_end(
90 const dif_smc_ctrl_t *smc_ctrl,
91 dif_smc_ctrl_output_t output);
92
93/**
94 * Locks out SMC Controller functionality.
95 *
96 * This function is reentrant: calling it while functionality is locked will
97 * have no effect and return `kDifOk`.
98 *
99 * @param smc_ctrl A SMC Controller handle.
100 * @return The result of the operation.
101 */
102OT_WARN_UNUSED_RESULT
103dif_result_t dif_smc_ctrl_lock(
104 const dif_smc_ctrl_t *smc_ctrl);
105
106/**
107 * Checks whether this SMC Controller is locked.
108 *
109 * @param smc_ctrl A SMC Controller handle.
110 * @param[out] is_locked Out-param for the locked state.
111 * @return The result of the operation.
112 */
113OT_WARN_UNUSED_RESULT
114dif_result_t dif_smc_ctrl_is_locked(
115 const dif_smc_ctrl_t *smc_ctrl,
116 bool *is_locked);
117
118#ifdef __cplusplus
119} // extern "C"
120#endif // __cplusplus
121
122#endif // MATCHA_SW_DEVICE_LIB_DIF_DIF_SMC_CTRL_H_