TT Zephyr Platforms 19.5.0-rc1
Tenstorrent Firmware
Loading...
Searching...
No Matches
cat.c File Reference
#include "cat.h"
#include "reg.h"
#include "timer.h"
#include <stdbool.h>
#include <tenstorrent/post_code.h>
#include <tenstorrent/sys_init_defines.h>
#include <zephyr/sys/util.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sensor/tenstorrent/pvt_tt_bh.h>

Data Structures

struct  RESET_UNIT_CATMON_THERM_TRIP_CNTL_reg_t
union  RESET_UNIT_CATMON_THERM_TRIP_CNTL_reg_u

Macros

#define RESET_UNIT_CATMON_THERM_TRIP_STATUS_REG_ADDR   0x80030164
#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_ADDR   0x80030168
#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_DEFAULT   0x00000318
#define CAT_EARLY_TRIP_TEMP   100
#define DEFAULT_CALIBRATION   (CAT_EARLY_TRIP_TEMP - T_J_SHUTDOWN)
#define TRIM_CODE_BITS   6

Functions

 SENSOR_DT_READ_IODEV (cat_ts_avg_iodev, DT_NODELABEL(pvt), {SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0})
 RTIO_DEFINE (cat_ts_avg_ctx, 1, 1)
static uint8_t TempToTrimCode (float temp)
static float TrimCodeToTemp (int32_t trim_code)
static void WaitCATUpdate (void)
static void EnableCAT (uint8_t trim_code, bool shutdown_on_trip)
static int CATEarlyInit (void)
 SYS_INIT_APP (CATEarlyInit)
static float CalibrateCAT (void)
static int CATInit (void)
 SYS_INIT_APP (CATInit)

Variables

static const struct device *const pvt = DEVICE_DT_GET(DT_NODELABEL(pvt))
static uint8_t cat_ts_avg_buf [sizeof(struct sensor_value)]
static const struct devicegpio1 = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio1))

Macro Definition Documentation

◆ CAT_EARLY_TRIP_TEMP

#define CAT_EARLY_TRIP_TEMP   100

◆ DEFAULT_CALIBRATION

#define DEFAULT_CALIBRATION   (CAT_EARLY_TRIP_TEMP - T_J_SHUTDOWN)

◆ RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_ADDR

#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_ADDR   0x80030168

◆ RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_DEFAULT

#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_DEFAULT   0x00000318

◆ RESET_UNIT_CATMON_THERM_TRIP_STATUS_REG_ADDR

#define RESET_UNIT_CATMON_THERM_TRIP_STATUS_REG_ADDR   0x80030164

◆ TRIM_CODE_BITS

#define TRIM_CODE_BITS   6

Function Documentation

◆ CalibrateCAT()

float CalibrateCAT ( void )
static

◆ CATEarlyInit()

int CATEarlyInit ( void )
static

◆ CATInit()

int CATInit ( void )
static

◆ EnableCAT()

void EnableCAT ( uint8_t trim_code,
bool shutdown_on_trip )
static

◆ RTIO_DEFINE()

RTIO_DEFINE ( cat_ts_avg_ctx ,
1 ,
1  )

◆ SENSOR_DT_READ_IODEV()

SENSOR_DT_READ_IODEV ( cat_ts_avg_iodev ,
DT_NODELABEL(pvt) ,
{SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0}  )

◆ SYS_INIT_APP() [1/2]

SYS_INIT_APP ( CATEarlyInit )

◆ SYS_INIT_APP() [2/2]

SYS_INIT_APP ( CATInit )

◆ TempToTrimCode()

uint8_t TempToTrimCode ( float temp)
static

◆ TrimCodeToTemp()

float TrimCodeToTemp ( int32_t trim_code)
static

◆ WaitCATUpdate()

void WaitCATUpdate ( void )
static

Variable Documentation

◆ cat_ts_avg_buf

uint8_t cat_ts_avg_buf[sizeof(struct sensor_value)]
static

◆ gpio1

const struct device* gpio1 = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio1))
static

◆ pvt

const struct device* const pvt = DEVICE_DT_GET(DT_NODELABEL(pvt))
static