GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LIM / V1-22-4 > lim / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

LIM_sc.c File Reference

Handle the interface with the spacecraft. More...

#include <string.h>
#include <LIM/LIM_cmddefs.h>
#include <LIM/LIM_pubdefs.h>
#include <LIM/LIM_msgs.h>
#include <LIM/LIM_tlmdefs.h>
#include <LIM/LIM_SC_cmddefs.h>
#include <PBS/MBA.h>
#include <PBS/WCT.h>
#include <PBS/WUT.h>
#include <LIM_action.h>
#include <LIM_bulk.h>
#include <LIM_pkt_send.h>
#include <LIM_sc.h>
#include <LIM_task.h>

Classes

struct  _LIM_Sc
 State information for a spacecraft interface object. More...

Defines

#define LIM_SC_VALID_KEY   (('L'<<24)+('S'<<16)+('C'<<8)+'I')
 Value indicating the spacecraft interface object state is valid.
#define LIM_APID_SC_SLEW_REQ   (0x600)

Functions

static unsigned int lim_sc_check (LIM_Sc *object_p)
 Validate a spacecraft interface object pointer.
static unsigned int lim_sc_change_state (LIM_Sc *object_p, int new_pending, int new_active, unsigned int new_start_sec)
 Change the PENDING, ACTIVE, and START_SEC values for an object.
static WUT_cb_status lim_sc_wut_handler (void *prm, WUT_tmr *wut)
 Handle wake-up timer expiration.
unsigned int LIM_sc_new (LIM_Sc **object_pp, LIM_Task *task_p, LIM_Bulk *bulk_p, LIM_Action *action_p, LIM_Pkt_Send *pkt_slew_req_cmd_p, LIM_Pkt_Send *pkt_slew_req_tlm_p, LIM_Pkt_Send *pkt_slew_rsp_tlm_p)
 Create and initialize a new spacecraft interface object.
unsigned int LIM_sc_delete (LIM_Sc *object_p)
 Shutdown and delete a spacecraft interface object.
int LIM_sc_rep_is_active (LIM_Sc *object_p)
 Return the ACTIVE status of a repoint.
int LIM_sc_rep_req_is_pending (LIM_Sc *object_p)
 Return the PENDING status of a repoint request.
unsigned int LIM_sc_remain_sec (LIM_Sc *object_p)
 Return the number of seconds remaining in a repoint period.
static unsigned int lim_sc_expire (LIM_Sc *object_p)
 End a repoint period.
unsigned int LIM_sc_handle_bulk (LIM_Sc *object_p, const ITC_QueueItem *qitem_p)
 Handle a message on the BULK queue.
unsigned int LIM_sc_handle_grb_idle (LIM_Sc *object_p)
 Handle a transition to the GRB-Idle state.
unsigned int LIM_sc_send_slew_request (LIM_Sc *object_p, LIM_Action_Id action, unsigned int tran_id, unsigned int dwell_time, double ra, double dec)
 Send a Slew-Request command to the spacecraft.
unsigned int LIM_sc_handle_slew_response (LIM_Sc *object_p, const ITC_QueueItem *qitem_p)
 Handle a Slew-Request-Reply message.


Detailed Description

Handle the interface with the spacecraft.

**  CVS $Id: LIM_sc.c,v 1.15 2011/03/29 21:20:29 apw Exp $
**  

Function Documentation

unsigned int lim_sc_change_state ( LIM_Sc object_p,
int  new_pending,
int  new_active,
unsigned int  new_start_sec 
) [static]

Change the PENDING, ACTIVE, and START_SEC values for an object.

Parameters:
object_p Pointer to spacecraft interface object.
new_pending New PENDING status.
new_active New ACTIVE status.
new_start_sec New START_SEC value.
Returns:
MSG code.

References _LIM_Sc::action_p, LIM_ACTION_REP_REQ_STATE_CHANGE, LIM_action_report(), LIM_task_lock_access(), LIM_task_unlock_access(), _LIM_Sc::rep_req_pending, _LIM_Sc::start_sec, _LIM_Sc::task_p, and _LIM_Sc::wut_active.

Referenced by lim_sc_expire(), LIM_sc_handle_slew_response(), and LIM_sc_send_slew_request().

unsigned int lim_sc_check ( LIM_Sc object_p  )  [static]

Validate a spacecraft interface object pointer.

Parameters:
object_p Pointer to spacecraft interface object.
Returns:
MSG code.

References _LIM_Sc::key, and LIM_SC_VALID_KEY.

Referenced by LIM_sc_delete(), LIM_sc_handle_bulk(), LIM_sc_handle_grb_idle(), LIM_sc_handle_slew_response(), LIM_sc_remain_sec(), LIM_sc_rep_is_active(), LIM_sc_rep_req_is_pending(), LIM_sc_send_slew_request(), and lim_sc_wut_handler().

unsigned int LIM_sc_delete ( LIM_Sc object_p  ) 

Shutdown and delete a spacecraft interface object.

Parameters:
object_p Pointer to object.
Returns:
MSG code.

References _LIM_Sc::key, lim_sc_check(), and _LIM_Sc::wut.

Referenced by LIM_mode_delete(), and LIM_sc_new().

unsigned int lim_sc_expire ( LIM_Sc object_p  )  [static]

End a repoint period.

Parameters:
object_p Pointer to spacecraft interface object.
Returns:
MSG code.

References _LIM_Sc::expired, lim_sc_change_state(), and _LIM_Sc::wut.

Referenced by LIM_sc_handle_bulk(), and LIM_sc_handle_grb_idle().

unsigned int LIM_sc_handle_bulk ( LIM_Sc object_p,
const ITC_QueueItem *  qitem_p 
)

Handle a message on the BULK queue.

Parameters:
object_p Pointer to spacecraft interface object.
qitem_p Pointer to queue item containing the message.
Returns:
MSG code.

References _LIM_Sc::expired, lim_sc_check(), and lim_sc_expire().

Referenced by lim_mode_bulk().

unsigned int LIM_sc_handle_grb_idle ( LIM_Sc object_p  ) 

Handle a transition to the GRB-Idle state.

Parameters:
object_p Pointer to spacecraft interface object.
Returns:
MSG code.

References lim_sc_check(), lim_sc_expire(), _LIM_Sc::rep_req_pending, and _LIM_Sc::wut_active.

Referenced by lim_arr_set_grb_idle().

unsigned int LIM_sc_handle_slew_response ( LIM_Sc object_p,
const ITC_QueueItem *  qitem_p 
)

unsigned int LIM_sc_new ( LIM_Sc **  object_pp,
LIM_Task task_p,
LIM_Bulk bulk_p,
LIM_Action action_p,
LIM_Pkt_Send pkt_slew_req_cmd_p,
LIM_Pkt_Send pkt_slew_req_tlm_p,
LIM_Pkt_Send pkt_slew_rsp_tlm_p 
)

Create and initialize a new spacecraft interface object.

Parameters:
object_pp Location to return pointer to new object.
task_p Ptr to a task object.
bulk_p Ptr to a bulk queue object.
action_p Ptr to an action reporting object.
pkt_slew_req_cmd_p Ptr to Slew-Request cmd pkt send object.
pkt_slew_req_tlm_p Ptr to Slew-Request tlm pkt send object.
pkt_slew_rsp_tlm_p Ptr to Slew-Request resp tlm pkt send object.
Returns:
MSG code.

References _LIM_Sc::action_p, _LIM_Sc::bulk_p, _LIM_Sc::key, LIM_pkt_set_info(), LIM_REPOINT_REQUEST_TLM_APID, LIM_REPOINT_RESPONSE_TLM_APID, LIM_sc_delete(), LIM_SC_VALID_KEY, _LIM_Sc::pkt_slew_req_cmd_p, _LIM_Sc::pkt_slew_req_tlm_p, _LIM_Sc::pkt_slew_rsp_tlm_p, _LIM_Sc::rep_req_pending, _LIM_Sc::task_p, _LIM_Sc::wut, and _LIM_Sc::wut_active.

Referenced by LIM_mode_new().

unsigned int LIM_sc_remain_sec ( LIM_Sc object_p  ) 

Return the number of seconds remaining in a repoint period.

Parameters:
object_p Pointer to spacecraft interface object.
Returns:
Number of seconds remaining in the repoint period.

References lim_sc_check(), _LIM_Sc::rep_req_dwell, _LIM_Sc::start_sec, and _LIM_Sc::wut_active.

Referenced by LIM_mode_get_info().

int LIM_sc_rep_is_active ( LIM_Sc object_p  ) 

Return the ACTIVE status of a repoint.

Parameters:
object_p Pointer to object.
Returns:
MSG code.

References lim_sc_check(), and _LIM_Sc::wut_active.

Referenced by LIM_arr_handle_bulk(), and LIM_arr_handle_response().

int LIM_sc_rep_req_is_pending ( LIM_Sc object_p  ) 

Return the PENDING status of a repoint request.

Parameters:
object_p Pointer to object.
Returns:
MSG code.

References lim_sc_check(), and _LIM_Sc::rep_req_pending.

Referenced by LIM_arr_handle_closeout(), LIM_arr_handle_finished(), and LIM_mode_get_info().

unsigned int LIM_sc_send_slew_request ( LIM_Sc object_p,
LIM_Action_Id  action,
unsigned int  tran_id,
unsigned int  dwell_time,
double  ra,
double  dec 
)

Send a Slew-Request command to the spacecraft.

Parameters:
object_p Pointer to spacecraft interface object.
action Action to report.
tran_id Transaction ID value for the command.
dwell_time Dwell Time value for the command.
ra RA value for the command.
dec DEC value for the command.
Returns:
MSG code.

References _LIM_Sc::action_p, _LIM_Repoint_Request_Tlm::dwell_time, LIM_action_report(), LIM_pkt_send_cmd(), LIM_pkt_send_tlm(), lim_sc_change_state(), lim_sc_check(), _LIM_Repoint_Request_Tlm::loc_dec, _LIM_Repoint_Request_Tlm::loc_ra, _LIM_Sc::pkt_slew_req_cmd_p, _LIM_Sc::pkt_slew_req_tlm_p, _LIM_Sc::rep_req_dec, _LIM_Sc::rep_req_dwell, _LIM_Sc::rep_req_pending, _LIM_Sc::rep_req_ra, _LIM_Sc::rep_req_tran_id, _LIM_Repoint_Request_Tlm::tran_id, and _LIM_Sc::wut_active.

Referenced by LIM_arr_handle_confirmed(), and LIM_gbm_handle_repoint().

WUT_cb_status lim_sc_wut_handler ( void *  prm,
WUT_tmr *  wut 
) [static]

Handle wake-up timer expiration.

Parameters:
prm Pointer to S/C interface object.
wut Pointer to wake-up timer.
Returns:
WUT status.

References _LIM_Sc::bulk_p, _LIM_Sc::expired, LIM_bulk_send(), and lim_sc_check().

Referenced by LIM_sc_handle_slew_response().


Generated on Wed Nov 21 21:17:41 2012 by  doxygen 1.5.8