Software APIs
sensor_ctrl.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_LIB_DRIVERS_SENSOR_CTRL_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_SENSOR_CTRL_H_
7 #include <stdint.h>
8 
9 #include "sw/device/silicon_creator/lib/drivers/lifecycle.h"
10 #include "sw/device/silicon_creator/lib/error.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /**
17  * The following constants represent the expected number of sec_mmio register
18  * writes performed by functions in provided in this module. See
19  * `SEC_MMIO_WRITE_INCREMENT()` for more details.
20  */
21 enum {
22  kSensorCtrlSecMmioConfigure = 12,
23 };
24 
25 /**
26  * Number of cycles to wait for sensor_ctrl to synchronize.
27  * See opentitan#23150. Since each CDC synchronize event takes
28  * 4 AON clocks, we need 5 cycles.
29  */
30 enum {
31  kSensorCtrlSyncCycles = 5,
32 };
33 
34 /**
35  * Configure sensors according to their OTP-defined configurations
36  *
37  * @param lc_state Life cycle state of the device.
38  * @return result of the operation.
39  */
41 rom_error_t sensor_ctrl_configure(lifecycle_state_t lc_state);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_SENSOR_CTRL_H_