TT Zephyr Platforms 18.11.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
pvt_tt_bh.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Tenstorrent AI ULC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef PVT_TT_BH_H
8#define PVT_TT_BH_H
9
11
17
28
35
40
41 /*
42 * Single-point calibration delta values for each temperature sensor.
43 *
44 * During device instantiation (DEFINE_PVT_TT_BH macro), a static array
45 * of size num_ts is allocated and zero-initialized for each device instance.
46 * The pointer is then set to reference this static array.
47 *
48 * During pvt_tt_bh_init(), each sensor's 25C calibration value is read from
49 * the functional eFuse. The delta between this eFuse value and the expected
50 * raw value for 25C is calculated and stored here.
51 *
52 * To apply calibration: calibrated_reading = raw_reading - therm_cali_delta[sensor_id]
53 *
54 * Values are in raw sensor units (not celcius). Positive delta means the
55 * sensor reads higher than expected, negative means it reads lower.
56 *
57 * Only populated if the eFuse calibration value is within 3C of 25C
58 * (22.0C to 28.0C range). If outside this range, the delta remains 0
59 * (no calibration applied).
60 *
61 * Array allocation: Static array created per device instance via DEFINE_PVT_TT_BH
62 * Array size: num_ts elements (from devicetree property)
63 * Initialization: Zero-filled during compilation, populated during pvt_tt_bh_init()
64 */
66};
67
69};
70
71/*
72 * Raw sensor data that will be submitted to the rtio buffer for the decoder
73 * to then use.
74 */
77 uint16_t raw; /* Raw sensor data can fit within 16 bits. */
78};
79
80/*
81 * Convert raw temperature sensor data to celcius.
82 */
84
85/*
86 * Convert celcius into raw temperature sensor data.
87 */
89
90/*
91 * Convert raw voltage monitor data to volts.
92 */
94
95/*
96 * Convert voltage insto raw voltage monitor data;
97 */
99
100/*
101 * Convert raw process detector data to MHz.
102 */
104
105/*
106 * Convert frequency into raw process detector data.
107 */
109
110/*
111 * Represent float data as two integers in struct sensor_value.
112 */
113void pvt_tt_bh_float_to_sensor_value(float data, struct sensor_value *val);
114
115int pvt_tt_bh_get_decoder(const struct device *dev, const struct sensor_decoder_api **api);
116
117void pvt_tt_bh_submit(const struct device *sensor, struct rtio_iodev_sqe *sqe);
118
119void pvt_tt_bh_delay_chain_set(uint32_t new_delay_chain_);
120
121#endif /* PVT_TT_BH_H */
SENSOR_ATTR_PRIV_START
SENSOR_CHAN_PRIV_START
pvt_tt_bh_channel
Definition pvt_tt_bh.h:22
@ SENSOR_CHAN_PVT_TT_BH_VM
Definition pvt_tt_bh.h:24
@ SENSOR_CHAN_PVT_TT_BH_TS_AVG
Definition pvt_tt_bh.h:26
@ SENSOR_CHAN_PVT_TT_BH_PD
Definition pvt_tt_bh.h:23
@ SENSOR_CHAN_PVT_TT_BH_TS
Definition pvt_tt_bh.h:25
void pvt_tt_bh_delay_chain_set(uint32_t new_delay_chain_)
int pvt_tt_bh_get_decoder(const struct device *dev, const struct sensor_decoder_api **api)
void pvt_tt_bh_submit(const struct device *sensor, struct rtio_iodev_sqe *sqe)
uint16_t pvt_tt_bh_freq_to_raw(const struct sensor_value *value)
uint16_t pvt_tt_bh_temp_to_raw(const struct sensor_value *value)
ReadStatus
Definition pvt_tt_bh.h:29
@ SampleFault
Definition pvt_tt_bh.h:31
@ SdifTimeout
Definition pvt_tt_bh.h:33
@ ReadOk
Definition pvt_tt_bh.h:30
@ IncorrectSampleType
Definition pvt_tt_bh.h:32
float pvt_tt_bh_raw_to_temp(uint16_t raw)
uint16_t pvt_tt_bh_volt_to_raw(const struct sensor_value *value)
float pvt_tt_bh_raw_to_freq(uint16_t raw)
float pvt_tt_bh_raw_to_volt(uint16_t raw)
void pvt_tt_bh_float_to_sensor_value(float data, struct sensor_value *val)
pvt_tt_bh_attribute
Definition pvt_tt_bh.h:12
@ SENSOR_ATTR_PVT_TT_BH_NUM_VM
Definition pvt_tt_bh.h:14
@ SENSOR_ATTR_PVT_TT_BH_NUM_TS
Definition pvt_tt_bh.h:15
@ SENSOR_ATTR_PVT_TT_BH_NUM_PD
Definition pvt_tt_bh.h:13
__UINT32_TYPE__ uint32_t
__UINT8_TYPE__ uint8_t
__UINT16_TYPE__ uint16_t
__INT16_TYPE__ int16_t
Definition pvt_tt_bh.h:36
uint8_t num_ts
Definition pvt_tt_bh.h:39
int16_t * therm_cali_delta
Definition pvt_tt_bh.h:65
uint8_t num_pd
Definition pvt_tt_bh.h:37
uint8_t num_vm
Definition pvt_tt_bh.h:38
Definition pvt_tt_bh.h:68
Definition pvt_tt_bh.h:75
struct sensor_chan_spec spec
Definition pvt_tt_bh.h:76
uint16_t raw
Definition pvt_tt_bh.h:77