Software APIs
otp_img_types.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_MANUF_LIB_OTP_IMG_TYPES_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_MANUF_LIB_OTP_IMG_TYPES_H_
7 
8 #include <stdint.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif // __cplusplus
13 
14 /**
15  * OTP Value type definitions used in this module.
16  */
17 typedef enum otp_val_type {
18  /**Array of `uint32_t` values.*/
19  kOptValTypeUint32Buff,
20  /**Array of `uint64_t` values.*/
21  kOptValTypeUint64Buff,
22  /**Array of `uint64_t` random values to be extracted from an entropy source
23  before programming the target OTP address. */
24  kOptValTypeUint64Rnd,
25 } otp_val_type_t;
26 
27 /**
28  * Defines an OTP target `offset` and `num_values` to program using either a
29  * `value32` or a `value64` buffer source depending on the `type` definition.
30  */
31 typedef struct otp_kv {
32  /**OTP value type.*/
33  otp_val_type_t type;
34  /**
35  * Target absolute address with respect to the start of the OTP memory
36  * region.
37  */
38  uint32_t offset;
39  /**
40  * Number of values to configure. This is equivalent to the ARRAYSIZE of
41  * either `value32` or `value64` depending on the value `type`.
42  */
43  uint32_t num_values;
44  union {
45  /**
46  * Points to an `uint32_t` buffer if the `type` is set to
47  * kOptValTypeUint32Buff.
48  */
49  const uint32_t *value32;
50  /**
51  * Points to an `uint64_t` buffer if the `type` is set to
52  * kOptValTypeUint64Buff.
53  */
54  const uint64_t *value64;
55  };
56 } otp_kv_t;
57 
58 #ifdef __cplusplus
59 } // extern "C"
60 #endif // __cplusplus
61 
62 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_MANUF_LIB_OTP_IMG_TYPES_H_