-
Notifications
You must be signed in to change notification settings - Fork 771
/
dif_rom_ctrl.h
94 lines (81 loc) · 2.49 KB
/
dif_rom_ctrl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_ROM_CTRL_H_
#define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_ROM_CTRL_H_
/**
* @file
* @brief <a href="/hw/ip/rom_ctrl/doc/">ROM Controller</a> Device Interface
* Functions
*/
#include <stdint.h>
#include "rom_ctrl_regs.h" // Generated.
#include "sw/device/lib/dif/autogen/dif_rom_ctrl_autogen.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/**
* A fatal alert cause error.
*
* See also: `dif_rom_ctrl_fatal_alert_causes_t`.
*/
typedef enum dif_rom_ctrl_fatal_alert_cause {
/**
* No error has occured.
*/
kDifRomCtrlFatalAlertCauseNoError = 0,
/**
* Set on a fatal error detected by the ROM checker.
*/
kDifRomCtrlFatalAlertCauseCheckerError =
ROM_CTRL_FATAL_ALERT_CAUSE_CHECKER_ERROR_BIT,
/**
* Set on an integrity error from the register interface.
*/
kDifRomCtrlFatalAlertCauseIntegrityError =
ROM_CTRL_FATAL_ALERT_CAUSE_INTEGRITY_ERROR_BIT,
} dif_rom_ctrl_fatal_alert_cause_t;
/**
* A set of fatal alert cause errors.
*/
typedef uint32_t dif_rom_ctrl_fatal_alert_causes_t;
/**
* A typed representation of the ROM digest.
*/
typedef struct dif_rom_ctrl_digest {
uint32_t digest[ROM_CTRL_DIGEST_MULTIREG_COUNT];
} dif_rom_ctrl_digest_t;
/**
* Reads the fatal alert cause bits of the ROM Controller.
*
* @param rom_ctrl A ROM Controller handle.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_rom_ctrl_get_fatal_alert_cause(
const dif_rom_ctrl_t *rom_ctrl,
dif_rom_ctrl_fatal_alert_causes_t *alert_causes);
/**
* Reads the (KMAC computed) ROM digest.
*
* @param rom_ctrl A ROM Controller handle.
* @param digest KMAC digest of ROM.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_rom_ctrl_get_digest(const dif_rom_ctrl_t *rom_ctrl,
dif_rom_ctrl_digest_t *digest);
/**
* Reads the expected ROM digest contained in the top eight words of ROM.
*
* @param rom_ctrl A ROM Controller handle.
* @param expected_digest Expected KMAC digest of ROM.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
dif_result_t dif_rom_ctrl_get_expected_digest(
const dif_rom_ctrl_t *rom_ctrl, dif_rom_ctrl_digest_t *expected_digest);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_ROM_CTRL_H_