GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PIG / V10-1-5 > pig_flying / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

cmdrsp.c File Reference

Implementation of the PIG power and C/R routines. More...

#include <pig_p.h>
#include <pig_const_p.h>
#include <pig_macro_p.h>
#include <PIG/pig.h>
#include <PIG/power.h>
#include <PIG/PIG_msgs.h>
#include <PIG_DB/schema.h>
#include <CDM/CDM_pubdefs.h>
#include <LEM/list.h>
#include <LEM/encode.h>
#include <LEM/decode.h>
#include <LEM/msg_macros.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/TASK.h>
#include <PBS/TOV.h>
#include <string.h>

Enumerations

enum  {
  CSR_STALL = 200,
  TEM_USE_RED_DAB = 3 << 24,
  ARC_LAM_STALL = 640,
  PWR_CAL = 0x2,
  PWR_TKR = 0x1,
  PWR_OFF = 0,
  PWR_ON = 1,
  DEFAULT_EPU_DELAY = 50,
  DEFAULT_ON_DELAY = 100,
  DEFAULT_OFF_DELAY = 10
}

Functions

static unsigned epus_on (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state)
static unsigned epus_off (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state)
static unsigned tems_on (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state, const PIG_DB_Schema *pdb)
static unsigned tems_off (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state)
static unsigned twr_pwr (LEM_micr *cr, unsigned short mask, unsigned select, unsigned action, PIG_state *state, const PIG_DB_Schema *pdb)
static unsigned acd_on (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state, const PIG_DB_Schema *pdb)
static unsigned acd_off (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state)
static unsigned free_on (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state)
static unsigned free_off (LEM_micr *cr, PIG_cfg *cfg, PIG_state *state)
static void delay_epu (void)
static void delay_off (void)
static void delay_on (void)
static unsigned get_epu_id (unsigned index)
static unsigned get_free_id (unsigned index)
static unsigned get_tem_id (unsigned index)
static unsigned change_order (unsigned *new_order, unsigned n, unsigned *old_order)
unsigned PIG_insert (PIG_cfg *cfg)
 Insert one or more nodes into the C/R fabric, possibly powering on said node on at the same time.
unsigned PIG_extract (PIG_cfg *cfg)
 Extract one or more nodes from the C/R fabric, possibly powering off said node at the same time.
unsigned PIG_safe (void)
 Power off all the LAT components.
unsigned PIG_shed (void)
 Shed the LAT power load.
unsigned PIG_get_pdus (void)
 Get PDUs present.
void PIG_set_epu_delay (unsigned delay)
 Set the delay after EPU power on.
void PIG_set_off_delay (unsigned delay)
 Set the delay after power-off of a component.
void PIG_set_on_delay (unsigned delay)
 Set the delay after power-on of a component.
unsigned PIG_order_EPU (unsigned order[PIG_N_EPU])
 Change the power-on order of the EPUs from the default to order.
unsigned PIG_order_FREE (unsigned order[PIG_N_FREE])
 Change the power-on order of the FREE boards from the default to order.
unsigned PIG_order_TEM (unsigned order[PIG_N_TEM])
 Change the power-on order of the TEMs from the default to order.

Variables

static unsigned pig_epu_delay = DEFAULT_EPU_DELAY
 Time to wait after powering up an EPU.
static unsigned pig_off_delay = DEFAULT_OFF_DELAY
 Time to wait after powering off a component.
static unsigned pig_on_delay = DEFAULT_ON_DELAY
 Time to wait after powering on a component.
static unsigned tem_order [PIG_N_TEM]
 Specify the order in which to power on the tems.
static unsigned epu_order [PIG_N_EPU] = {0, 1, 2}
 Specify the order in which to power on the EPUs.
static unsigned free_order [PIG_N_FREE]
 Specify the order in which to power the FREE boards.


Detailed Description

Implementation of the PIG power and C/R routines.

Author:
James Swain & Owen Saxton
$Id: cmdrsp.c,v 1.53 2011/03/28 17:11:13 saxton Exp $

Function Documentation

unsigned PIG_extract ( PIG_cfg cfg  ) 

Extract one or more nodes from the C/R fabric, possibly powering off said node at the same time.

Parameters:
cfg Pointer to a PIG configuration structure
Return values:
PIG_INMUD Success
PIG_CRLSMALL Couldn't initialize C/R list
LEM_xxxxx Various LEM/LCBD errors

References _PIG_tem::cal, _PIG_state::cru, getState(), _PIG_state::pdu, readCruState(), readPduState(), saveState(), _PIG_cfg::tem, and _PIG_tem::tkr.

unsigned PIG_get_pdus ( void   ) 

Get PDUs present.

Returns a two bit mask indicating the PDU(s) present in the C/R fabric

Returns:
PDU mask

References _PIG_cruState::command, readCruState(), and _PIG_cruState::response.

unsigned PIG_insert ( PIG_cfg cfg  ) 

Insert one or more nodes into the C/R fabric, possibly powering on said node on at the same time.

Parameters:
cfg Pointer to a PIG configuration structure
Return values:
PIG_INMUD Success
PIG_CRLSMALL Couldn't initialize C/R list
LEM_xxxxx Various LEM/LCBD errors

References _PIG_tem::cal, _PIG_state::cru, getState(), _PIG_state::pdu, readCruState(), readPduState(), saveState(), _PIG_cfg::tem, and _PIG_tem::tkr.

unsigned PIG_order_EPU ( unsigned  order[PIG_N_EPU]  ) 

Change the power-on order of the EPUs from the default to order.

Parameters:
order Array of EPU ids specifying the power on order
Return values:
PIG_INMUD Success
PIG_BADORD Array of IDs contains duplicate or out of range values

References epu_order.

unsigned PIG_order_FREE ( unsigned  order[PIG_N_FREE]  ) 

Change the power-on order of the FREE boards from the default to order.

Parameters:
order Array of FREE ids specifying the power on order
Return values:
PIG_INMUD Success
PIG_BADORD Array of IDs contains duplicate or out of range values

References free_order.

unsigned PIG_order_TEM ( unsigned  order[PIG_N_TEM]  ) 

Change the power-on order of the TEMs from the default to order.

Parameters:
order Array of TEM ids specifying the power on order
Return values:
PIG_INMUD Success
PIG_BADORD Array of IDs contains duplicate or out of range values

References tem_order.

unsigned PIG_safe ( void   ) 

void PIG_set_epu_delay ( unsigned  delay  ) 

Set the delay after EPU power on.

Parameters:
delay Time (in 100ths of a second) to wait after powering on an EPU

References pig_epu_delay.

void PIG_set_off_delay ( unsigned  delay  ) 

Set the delay after power-off of a component.

Parameters:
delay Time (in 100ths of a second) to wait after powering off a component

References pig_off_delay.

void PIG_set_on_delay ( unsigned  delay  ) 

Set the delay after power-on of a component.

Parameters:
delay Time (in 100ths of a second) to wait after powering on a component

References pig_on_delay.

unsigned PIG_shed ( void   ) 

Shed the LAT power load.

This routine powers down all the components of the LAT.

Return values:
PIG_INMUD Success
PIG_CRLSMALL Couldn't initialize C/R list
LEM_xxxxx Various LEM/LCBD errors

References PIG_extract_evt(), and PIG_safe().


Variable Documentation

unsigned free_order[PIG_N_FREE] [static]

Initial value:

 {0x0, 0x1, 0x2, 0x3, 0x4, 0x5,
                                          0x6, 0x7, 0x8, 0x9, 0xa, 0xb}
Specify the order in which to power the FREE boards.

Referenced by PIG_order_FREE().

unsigned tem_order[PIG_N_TEM] [static]

Initial value:

 {0x5, 0x6, 0x9, 0xa, 0xc, 0xd, 0xe, 0x1,
                                        0x2, 0x3, 0x7, 0xb, 0xf, 0x0, 0x4, 0x8}
Specify the order in which to power on the tems.

Referenced by PIG_order_TEM().


Generated on Tue Nov 29 18:55:56 2011 by  doxygen 1.5.8