1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include <mod_sensor.h>
9 
10 #include <fwk_assert.h>
11 #include <fwk_element.h>
12 #include <fwk_id.h>
13 #include <fwk_macros.h>
14 #include <fwk_mm.h>
15 #include <fwk_module.h>
16 #include <fwk_module_idx.h>
17 #include <fwk_status.h>
18 
19 #include <string.h>
20 
21 /*
22  * When running on a model at least one fake sensor is required in order to
23  * properly initialize the entire sensor support.
24  */
25 static const struct fwk_element sensor_element_table[2] = {
26     [0] = {
27         .name = "Fake sensor",
28         .data = &((struct mod_sensor_dev_config) {
29             .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_REG_SENSOR, 0),
30             .driver_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_REG_SENSOR, 0),
31         }),
32     },
33 
34     [1] = { 0 } /* Termination description */
35 };
36 
get_sensor_element_table(fwk_id_t module_id)37 static const struct fwk_element *get_sensor_element_table(fwk_id_t module_id)
38 {
39     return sensor_element_table;
40 }
41 
42 struct fwk_module_config config_sensor = {
43     .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_sensor_element_table),
44 };
45