OpenBIC
OpenSource Bridge-IC
plat_i2c_target.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef PLAT_I2C_SLAVE_H
18#define PLAT_I2C_SLAVE_H
19
20#include <drivers/i2c.h>
21#include "hal_i2c_target.h"
22
23#define TARGET_ENABLE 1
24#define TARGET_DISABLE 0
25
26#endif
27
28typedef struct __attribute__((__packed__)) {
29 uint8_t sensor_index_offset; // Sensor index offset (e.g. PDR sensor index offset)
30 uint32_t sensor_value; // Sensor value (4 bytes)
32
33typedef struct __attribute__((__packed__)) {
34 uint8_t device_type; // Device type (Aegis = 0x01, Rainbow = 0x02, Electra = 0x03, etc.)
35 uint8_t register_layout_version; // Register layout version (e.g. VERSION_1 = 0x01)
36 uint16_t sensor_base_index; // Sensor base index (SBI)
37 uint8_t max_sbi_off; // Max sensor base index offset in this register (0 <= MAX_SBI_OFF <= 49)
38 // The following is a flexible array of sensor entries.
39 // The number of entries is (max_sbi_off + 1)
40 sensor_entry sensor_entries[];
42
43void update_sensor_reading_by_sensor_number(uint8_t sensor_number);
44int get_cached_sensor_reading_by_sensor_number(uint8_t sensor_number);
void update_sensor_reading_by_sensor_number(uint8_t sensor_number)
Definition: plat_i2c_target.c:61
int get_cached_sensor_reading_by_sensor_number(uint8_t sensor_number)
Definition: plat_i2c_target.c:80
sensor_entry
Definition: plat_i2c_target.h:31
plat_sensor_reading
Definition: plat_i2c_target.h:41
Definition: pldm_smbios.h:61