GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LTC / V6-2-4 > ltct / rad750
#include <LTC/ltc.h>
#include <LTC/LTC_msgs.h>
#include <LTC/LTC_cmddefs.h>
#include <LTC/LTC_cmdxtrn.h>
#include <LTC/LTC_tlmdefs.h>
#include <ltcPrivate.h>
#include <ITC/ITC_pubdefs.h>
#include <IMM/RBM_pubdefs.h>
#include <LEM/defs.h>
#include <LEM/encode.h>
#include <LEM/encode_structs.h>
#include <LCBD/LCBC.h>
#include <LCBD/LCBD_drv.h>
#include <LCBD/LCBD_rst.h>
#include <FBS/FBS_pubrtos.h>
#include <CCSDS/CCSDS_pkt.h>
#include <MSG/MSG_pubdefs.h>
#include <CDM/CDM_pubdefs.h>
#include <CPU_DB/CPU_DB_pubdefs.h>
#include <LTC_DB/LTC_DB_schema.h>
#include <PBS/TASK.h>
#include <PBS/WCT.h>
#include <PBS/MBA.h>
#include <PBS/RW.h>
#include <PBI/Ofs.h>
#include <string.h>
Functions | |
static unsigned int | lockState (LTC_Wrk *tw, RW_key *key, LTC_Cntl_Modes old, LTC_Cntl_Modes new, const char *fnc) |
Walk round the state diagram. | |
static unsigned int | LTC_StartItcFork (LTC_Wrk *tw) |
Start Thermal Control tasks (telecommand and fork queue). | |
static unsigned int | LTC_Init (const LTC_DB_Schema *config) |
static unsigned int | LTC_InitCmdProc (LTC_Wrk *tw, unsigned short cmd_cnt, unsigned short pdu_cnt) |
Initialization for telecommand processing. | |
static unsigned int | LTC_InitIO (LTC_Wrk *tw) |
Setup for asynchrous reading RIT and reservoir temperature sensors. | |
static void | LTC_freeCmd (ITC_QueueItem *qitem, unsigned int status, void *prm0, void *prm1, void *prm2, unsigned int tx) |
Free a command buffer. | |
static unsigned | LTC_InitTlm (LTC_Wrk *tw) |
Initialize telemetry structures. | |
static unsigned | LTC_GetHeaterAddrs (LTC_Wrk *tw) |
Initialize SIB register addressess. | |
unsigned int | LTC_initialize (void) |
Initializes and configures thermal control software. | |
static unsigned int | LTC_AttachITCMem (LTC_Wrk *tw, unsigned short cmd_cnt, unsigned short pdu_cnt) |
Setup and attach memory for ITC. | |
unsigned int | LTC_InitSmooth (LTC_Wrk *tw) |
Allocates and inits storage for smoothing filters. | |
void | LTC_InitSensors (LTC_Wrk *tw) |
Sets initial values for LAT sensors. | |
void | LTC_InitBuiltIn (LTC_Wrk *tw) |
Initialization for built-in constants. | |
unsigned int | LTC_StartTask (void) |
Start Thermal Control processing. | |
unsigned int | LTC_StopTask (void) |
Stop Thermal Control processing. | |
static void | LTC_FreeMem (LTC_Wrk *tw) |
Free any allocated memory. | |
unsigned int | LTC_shutdown (void) |
Release resources associated with LTC. | |
unsigned int | LTC_GetTlm (LTC_DiagLTC_Tlm *tt) |
Retreive telemetry data. | |
unsigned int | LTC_GetConfigFile (unsigned int *fid) |
Get LTC configuration file ID. | |
void | LTC_cb_reset (unsigned short fmt, unsigned short len, const void *dat) |
Restore LTC operation after turbo reset. | |
Variables | |
LTC_FltDf | LTC_thrmFltDf |
Smoothing filter definition for RIT/thermistor type sensor. | |
LTC_FltDf | LTC_rtdFltDf |
Smoothing filter definition for RES/RTD type sensor. | |
short int | LTC_thrmCnvTbl [] |
Counts to temperature convertion table for RIT/thermistor type sensor. | |
short int | LTC_rtdCnvTbl [] |
Counts to temperature convertion table for RES/RTD type sensor. | |
LTC_DB_Schema | LTC_defaultConfig |
Default LTC configuration values. | |
LTC_Wrk | LTC_wrkStore |
Thermal control working storage. | |
LTC_Wrk * | LTC_wrk = <C_wrkStore |
Reference to thermal control working storage. |
static unsigned int lockState | ( | LTC_Wrk * | tw, | |
RW_key * | key, | |||
LTC_Cntl_Modes | old, | |||
LTC_Cntl_Modes | new, | |||
const char * | fnc | |||
) | [static] |
Walk round the state diagram.
tw | (in) LTC control block | |
key | (in) An RW key | |
old | (in) State the control block must be in to transition | |
new | (in) State to which the control block wishes to transition | |
fnc | (in) Function name calling this inline |
References _LTC_Wrk::mode, and _LTC_Wrk::rwi.
Referenced by LTC_shutdown(), LTC_StartTask(), and LTC_StopTask().
unsigned int LTC_AttachITCMem | ( | LTC_Wrk * | tw, | |
unsigned short | cmd_cnt, | |||
unsigned short | pdu_cnt | |||
) | [static] |
Setup and attach memory for ITC.
tw | (in) LTC working storage. | |
cmd_cnt | (in) The number of 128 byte telecommand packets for LTC. | |
pdu_cnt | (in) Count of packets to allocate for PDU results |
References _LTC_Wrk::ccBuff, _LTC_Wrk::cmdHdrSize, _LTC_Wrk::cmdPool, _LTC_Wrk::itc_task, _LTC_Wrk::itcHdrSize, _LTC_Wrk::pduMem, _LTC_Wrk::pduPool, and PRINTF.
Referenced by LTC_InitCmdProc().
void LTC_cb_reset | ( | unsigned short | fmt, | |
unsigned short | len, | |||
const void * | dat | |||
) |
Restore LTC operation after turbo reset.
fmt | (in) Format of global context data | |
len | (in) Length of global context data | |
dat | (in) Global context data |
References _LTC_SetMode_Prm::ActiveOrPassive, _LTC_Reset::cmdMode, _LTC_Wrk::cmdPool, _LTC_ReStart_Prm::cnfgFileId, _LTC_Reset::fidType, _LTC_ReStart_Prm::fidType, _LTC_Reset::fileID, LTC_EXTERNAL_CMD_APID, LTC_freeCmd(), LTC_K_RESET_FORMAT_0, LTC_RESTART_FCODE, LTC_SETMODE_FCODE, _LTC_ReStart_Prm::pad16, _LTC_SetMode_Pkt::pay, _LTC_ReStart_Pkt::pay, and _LTC_ReStart_Prm::spare.
static void LTC_freeCmd | ( | ITC_QueueItem * | qitem, | |
unsigned int | status, | |||
void * | prm0, | |||
void * | prm1, | |||
void * | prm2, | |||
unsigned int | tx | |||
) | [static] |
Free a command buffer.
LTC_freeCmd() frees the command packets used to do the turbo reset.
Referenced by LTC_cb_reset(), and LTC_WkUp().
static void LTC_FreeMem | ( | LTC_Wrk * | tw | ) | [static] |
Free any allocated memory.
tw | - LTC working storage. |
References LTC_FileDef::bff, _LTC_Wrk::cfgF, LTC_Temperature::cnvF, _LTC_Wrk::filePath, LTC_Temperature::fltF, _LTC_Wrk::htP, LTC_NUM_HPs, RES_TMP, RIT_TMP, and LTC_HeatPipe::temp.
Referenced by LTC_shutdown().
unsigned int LTC_GetConfigFile | ( | unsigned int * | fid | ) |
Get LTC configuration file ID.
fid | Stores LTC master FOF file ID on return. |
A | LTC MSG code. |
References LTC_FileDef::fid, and _LTC_Wrk::fofF.
static void LTC_GetHeaterAddrs | ( | LTC_Wrk * | tw | ) | [static] |
Initialize SIB register addressess.
tw | - LTC working storage. |
- | A LTC MSG code. |
References _LTC_Wrk::HtrCntrlRg, _LTC_Wrk::HtrWDogRg, MSG_SIGNAL, PRINTF, _LTC_Wrk::sim_heater_reg, and _LTC_Wrk::sim_wdog_reg.
Referenced by LTC_Init().
unsigned int LTC_GetTlm | ( | LTC_DiagLTC_Tlm * | tt | ) |
Retreive telemetry data.
Get LTC telemetry values.
tt | - Pointer to telemetry structure |
An | LTC MSG code \ \ Telemetry block contents: \ \ Bytes Off Name Contents \ |------|-----|-------------|--------------------------------------------------| \ | 24 | 0 | snsrSel | Per HP, selected RIT and RES sensors. For each | \ | | | | sensor the connected HP and sensor type is given.| \ | | | | 2 bytes per heat pipe, one byte per sensor: | \ | | | | 4-bits for HP # and 4-bits for type (DSHP, | \ | | | | DSHP_R, XLHP, XLHP_R, RSVR, and RSVR_R) | \ |------|-----|-------------|--------------------------------------------------| \ | 12 | 24 | snsrStat | Per HP, input sensor status. | \ | | | | RIT/RES 4 bits each, 0-NOT_READ, 1-READ_GOOD | \ | | | | 2-READ_BAD, 3-BROKEN. One byte pad added. | \ |------|-----|-------------|--------------------------------------------------| \ | 2 | 36 | actvHp | Per HP, 1-active, 0-not active (ON or OFF) | \ |------|-----|-------------|--------------------------------------------------| \ | 144 | 38 | rawAdc | Per each of 72 possible primary and redundant | \ | | | | sensors, raw ADC values (12 bits) and (4 bits) | \ | | | | read status. Ordered by HP, i.e. 6 for HP0, 6 | \ | | | | for HP1,...,6 for HP11. | \ |------|-----|-------------|--------------------------------------------------| \ | 48 | 182 | temps | Per each HP, temperature values input to control | \ | | | | Smoothed and converted to celsius for RIT and | \ | | | | RES. Fixed point scaled values. First 12 are | \ | | | | for RIT and 2nd 12 for RES. | \ |------|-----|-------------|--------------------------------------------------| \ | 24 | 230 | ritLo | Low limit for RIT sensors, heat pipes 0 - 11 | \ |------|-----|-------------|--------------------------------------------------| \ | 24 | 254 | ritHi | High limit for RIT sensors, heat pipes 0 - 11 | \ |------|-----|-------------|--------------------------------------------------| \ | 24 | 278 | resLo | Low limit for reservoir sensors, HPs 0 - 11 | \ |------|-----|-------------|--------------------------------------------------| \ | 24 | 302 | resHi | High limit for reservoir sensors, HPs 0 - 11 | \ |------|-----|-------------|--------------------------------------------------| \ | 24 | 326 | dbDelta | Deadband delta limit, HPs 0 - 11 | \ |------|-----|-------------|--------------------------------------------------| \ | 2 | 350 | htrCmd | Bit for each HP reservoir heater command, 1 is | \ | | | | command to on and 0 commanded to off. The upper | \ | | | | bit (2**15) indicates commanding mode: 1 is | \ | | | | actively sending commands to heaters, and 0 is | \ | | | | calculating commands but not sending to heaters. | \ |------|-----|-------------|--------------------------------------------------| \ | 2 | 352 | htrReg | Bit for each SIB control heater bit, 1 is | \ | | | | commanded on and 0 commanded off. The upper | \ | | | | bit (2**15) indicates LTC run mode: 1 is running | \ | | | | and 0 is stopped. | \ |-----------------------------------------------------------------------------| \ |-----------------------------------------------------------------------------| \ | 354 | TOTAL BYTES | | \ `-----------------------------------------------------------------------------' \ |
References _LTC_DiagLTC_Tlm::actvHp, _LTC_HeaterState::bf, _LTC_HeaterCommand::bf, _LTC_RawAdcStatus::bf, _LTC_ResRitStatus::bf, _LTC_ResRitSnsrSel::bf, LTC_Temperature::celsius, LTC_Cntrl::cmd, _LTC_Wrk::cmdMode, LTC_Sensor::cnt, _LTC_DiagLTC_Tlm::dbDelta, _LTC_Wrk::htP, _LTC_DiagLTC_Tlm::htrCmd, _LTC_Wrk::HtrCntrlRg, _LTC_DiagLTC_Tlm::htrReg, LTC_AUTO, LTC_CTL_INITIALIZED, LTC_CTL_RUNNING, LTC_NUM_HPs, LTC_SNSR_TYPS, _LTC_Wrk::ltcCntrl, _LTC_Wrk::mode, MSG_SIGNAL, LTC_HeatPipe::opts, LTC_HeatPipe::param, _LTC_DiagLTC_Tlm::rawAdc, RES_TMP, _LTC_DiagLTC_Tlm::resHi, _LTC_DiagLTC_Tlm::resLo, LTC_Options::resSel, RIT_TMP, _LTC_DiagLTC_Tlm::ritHi, _LTC_DiagLTC_Tlm::ritLo, LTC_Options::ritSel, _LTC_Wrk::runMode, _LTC_Wrk::rwi, LTC_HeatPipe::snsr, _LTC_DiagLTC_Tlm::snsrSel, _LTC_DiagLTC_Tlm::snsrStatus, LTC_Sensor::stat, LTC_HeatPipe::temp, _LTC_DiagLTC_Tlm::temps, _LTC_HeaterState::us, _LTC_HeaterCommand::us, and _LTC_HeaterMode::us.
Referenced by LTC_SndTlm().
static unsigned int LTC_Init | ( | const LTC_DB_Schema * | config | ) | [static] |
config | - LTC_DB schema configuration values |
A | LTC MSG code. |
References LTC_Cntrl::cmd, _LTC_Wrk::cmdHdrSize, _LTC_Reset::cmdMode, _LTC_Wrk::cmdMode, _LTC_Wrk::config, LTC_FileDef::fid, _LTC_Reset::fidType, _LTC_Reset::fileID, _LTC_Wrk::fofF, LTC_FileDef::idTyp, _LTC_Wrk::itcHdrSize, LTC_BIN_FOF, LTC_CTL_BROKEN, LTC_CTL_INITIALIZED, LTC_CTL_INITIALIZING, LTC_CTL_UNINITIALIZED, LTC_FILE_BUILT_IN, LTC_GetHeaterAddrs(), LTC_InitBuiltIn(), LTC_InitCfg(), LTC_InitCmdProc(), LTC_InitFile(), LTC_InitIO(), LTC_InitSensors(), LTC_InitSmooth(), LTC_InitTlm(), LTC_K_RESET_FORMAT_0, LTC_PASSIVE, LTC_RUNNING, _LTC_Wrk::ltcCntrl, _LTC_Wrk::mode, MSG_SIGNAL, _LTC_Wrk::pduTbl, _LTC_Wrk::prd, PRINTF, _LTC_Wrk::reset, _LTC_Wrk::runMode, _LTC_Wrk::rwi, _LTC_Wrk::tlmCnt, _LTC_Wrk::tlmFreq, _LTC_Wrk::tlmHdrSize, _LTC_Wrk::trd, LTC_FileDef::type, _LTC_Wrk::wut, and _LTC_Wrk::wutNSecs.
Referenced by LTC_initialize().
void LTC_InitBuiltIn | ( | LTC_Wrk * | tw | ) |
Initialization for built-in constants.
Initialization from built-in constants.
tw | - LTC working storage. |
References LTC_Options::actv, LTC_Options::cntrlMode, LTC_Temperature::cnv, _LTC_Wrk::config, LTC_Temperature::estTol, LTC_Options::fail, LTC_Filter::fdf, LTC_Temperature::flt, _LTC_Wrk::htP, LTC_AUTO, LTC_NUM_HPs, LTC_ON, LTC_rtdCnvTbl, LTC_thrmCnvTbl, LTC_YES, LTC_HeatPipe::opts, LTC_HeatPipe::param, PRINTF, RES_TMP, _LTC_Wrk::resFailLimit, LTC_Options::resSel, RIT_TMP, _LTC_Wrk::ritFailLimit, LTC_Options::ritSel, LTC_HeatPipe::temp, and TSCLF.
Referenced by LTC_Init(), and LTC_ReStart().
static unsigned int LTC_InitCmdProc | ( | LTC_Wrk * | tw, | |
unsigned short | cmd_cnt, | |||
unsigned short | pdu_cnt | |||
) | [static] |
Initialization for telecommand processing.
tw | - LTC working storage. | |
cmd_cnt | - Count of command packets allocated. | |
pdu_cnt | - Count of pdu/result packets allocated. |
0 | - success, 1 - failure |
References _LTC_Wrk::itc_task, LTC_Apid658, LTC_Apid659, LTC_AttachITCMem(), MSG_SIGNAL, and PRINTF.
Referenced by LTC_Init().
unsigned int LTC_initialize | ( | void | ) |
Initializes and configures thermal control software.
LTC initialization using LTC_DB lookup.
A | LTC MSG code. |
References LTC_defaultConfig, LTC_Init(), and MSG_SIGNAL.
static unsigned int LTC_InitIO | ( | LTC_Wrk * | tw | ) | [static] |
Setup for asynchrous reading RIT and reservoir temperature sensors.
tw | - LTC working storage. |
A | LTC MSG code Sets up handle, command list and response list allocation for asynchronous reads of temperature sensor data from the PDU using LCB. An individual command list reads a single PDU group. LCB does not allow interuption of a command group. So another task such as housekeeping cannot break-in and corrupt the sensor readings for the group. The reading of sensor data is driven by the PDU table created from the Sensor Definition File. This file defines the hardware configuration (heat pipe, pdu, group, adc#). |
References _LTC_Wrk::cl, _LTC_Wrk::lastClNum, _LTC_Wrk::lcb, _LTC_cl::ld_cmd, LTC_PDU_CNV_TIME, LTC_PDU_REGS, MSG_SIGNAL, _LTC_Wrk::nPdus, _LTC_Wrk::pdu, _LTC_Wrk::pduTbl, PRINTF, _LTC_cl::rd_cmd, and _LTC_cl::stall_cmd.
Referenced by LTC_Init().
void LTC_InitSensors | ( | LTC_Wrk * | tw | ) |
Sets initial values for LAT sensors.
tw | - LTC working storage |
References LTC_Sensor::bdRd, LTC_Sensor::cnt, DSHP_RIT, DSHP_RIT_R, LTC_Sensor::failLimit, _LTC_Wrk::htP, LTC_NUM_HPs, NOT_READ, PRINTF, RES_TMP, _LTC_Wrk::resFailLimit, RIT_TMP, _LTC_Wrk::ritFailLimit, RSVR_HTR, RSVR_HTR_R, LTC_HeatPipe::snsr, LTC_Sensor::stat, LTC_Sensor::tTyp, XLHP_RIT, and XLHP_RIT_R.
Referenced by LTC_Init(), and LTC_ReStart().
unsigned int LTC_InitSmooth | ( | LTC_Wrk * | tw | ) |
Allocates and inits storage for smoothing filters.
tw | - LTC working storage. |
A | LTC MSG code. |
References LTC_Filter::fdf, LTC_FltDf::fln, LTC_Temperature::flt, _LTC_Wrk::htP, LTC_MAX_FLT_SZ, LTC_MIN_FLT_SZ, LTC_NUM_HPs, MSG_SIGNAL, LTC_Filter::nv, PRINTF, RES_TMP, RIT_TMP, LTC_HeatPipe::temp, and LTC_Filter::zn.
Referenced by LTC_Init(), LTC_ReStart(), and LTC_Start().
static unsigned LTC_InitTlm | ( | LTC_Wrk * | tw | ) | [static] |
Initialize telemetry structures.
tw | - LTC working storage. |
- | A LTC MSG code |
References PRINTF, and _LTC_Wrk::tlmPool.
Referenced by LTC_Init().
unsigned int LTC_shutdown | ( | void | ) |
Release resources associated with LTC.
A | LTC MSG code |
References _LTC_Wrk::ccBuff, _LTC_Wrk::cmdPool, _LTC_Wrk::itc_task, lockState(), LTC_CTL_DEINITIALIZING, LTC_CTL_INITIALIZED, LTC_CTL_UNINITIALIZED, LTC_FreeMem(), _LTC_Wrk::mode, _LTC_Wrk::rwi, and _LTC_Wrk::tlmPool.
static unsigned int LTC_StartItcFork | ( | LTC_Wrk * | tw | ) | [static] |
Start Thermal Control tasks (telecommand and fork queue).
tw | - LTC working storage |
A | LTC MSG code |
References _LTC_Wrk::itc_task, MSG_SIGNAL, and PRINTF.
Referenced by LTC_StartTask().
unsigned int LTC_StartTask | ( | void | ) |
Start Thermal Control processing.
Start LTC Control Task.
A | LTC MSG code. |
References lockState(), LTC_CTL_INITIALIZED, LTC_CTL_RUNNING, LTC_CTL_STARTING, LTC_StartItcFork(), LTC_WkUp(), MSG_SIGNAL, PRINTF, _LTC_Wrk::wut, and _LTC_Wrk::wutNSecs.
unsigned int LTC_StopTask | ( | void | ) |
Stop Thermal Control processing.
Stop LTC Control Task.
A | LTC MSG code. |
References _LTC_Wrk::itc_task, lockState(), LTC_CTL_INITIALIZED, LTC_CTL_RUNNING, LTC_CTL_STOPPING, and _LTC_Wrk::wut.
LTC_DB_Schema LTC_defaultConfig |
Default LTC configuration values.
This database is used if the LTC_DB module is not loaded.
There are two PDU tables. One for primary PDU and one for redundant PDU. Each record of these tables provides definitions for each temperature read from the PDU. It is ordered by PDU group for easy use when working with PDU hardware. The PDU group and ADC number for each sensor is built into this table. The sensors are associated with a heat pipe as defined by the hardware configuration.
Default LTC_DB values in case DB not found.
Referenced by LTC_initialize().
short int LTC_rtdCnvTbl[] |
Counts to temperature convertion table for RES/RTD type sensor.
Generated based on PDU/RTD circuit and vendor (Goodrich Model 0118MF) resistance-temperature relationship table.
Default built-in RES temperature conversion table.
Smoothing filter definition for RES/RTD type sensor.
Long moving average filter to handle the excessive noise from the RES sensor electronics.
Default built-in RES sensor filter definition.
short int LTC_thrmCnvTbl[] |
Counts to temperature convertion table for RIT/thermistor type sensor.
Generated based on PDU/thermistor circuit and vendor (YSI 44900) resistance-temperature relationship table.
Default built-in RIT temperature conversion table.
Smoothing filter definition for RIT/thermistor type sensor.
Default built-in RIT sensor filter definition.