GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTS / V2-3-2 > cts_lcp_enet / sun-gcc
#include <string.h>
#include <PBI/Endianness.h>
#include <CCSDS/CCSDS_pkt.h>
#include <PBS/MBA.h>
#include <MSG/MSG_pubdefs.h>
#include <CTS/CTS_pubdefs.h>
#include <CTS/CTS_msgs.h>
#include <CTS_prvdefs.h>
Functions | |
static unsigned int | checkState (CTS_ControlState creq, CRX_ServiceType styp, CRX_ServiceState sreq, const char *func) |
Check the state of master and task control blocks. | |
static unsigned int | validType (CRX_ServiceType typ) |
Validate service type. | |
static void | CRX_recvCmd (void *prm) |
Dispatch telecommand packets arriving at the CTDB device. | |
unsigned int | CRX_createService (CRX_ServiceType typ, CRX_cb_Driver *rtn, void *prm) |
Create a CTDB (1553) receive service block. | |
unsigned int | CRX_deleteService (CRX_ServiceType typ) |
Delete a CTDB (1553) receive service block. | |
unsigned int | CRX_startService (CRX_ServiceType typ, TASK_attr *attr) |
Start a CTDB (1553) receive service. | |
unsigned int | CRX_stopService (CRX_ServiceType typ) |
Start a CTDB (1553) receive service. | |
Variables | |
const char * | CRX_svc_states [CRX_L_SVC_STATES] |
String constants for CRX service block states. | |
void * | CRX_svcTask [CRX_L_SVC_TYPES] |
Entry points for the receive tasks (by receive service type). |
CVS $Id: CRX_control.c,v 1.4 2011/03/28 23:55:13 apw Exp $
static unsigned int checkState | ( | CTS_ControlState | creq, | |
CRX_ServiceType | styp, | |||
CRX_ServiceState | sreq, | |||
const char * | func | |||
) | [inline, static] |
Check the state of master and task control blocks.
creq | (in) Required state of CTS master control block | |
styp | (in) Service types | |
sreq | (in) Required state of CRX service control block | |
func | (in) Name of function calling this routine |
CTS_CTLSTAT | CTS master control block not in state initialized | |
CTS_NOTINIT | CTS master control block does not exist | |
CTS_SUCCESS | Success | |
CTS_SVCSTAT | Service not in state undefined |
References _CRX_Service::chk, _CTS_Control::crx, CTS_ccb, CTS_ctl_states, _CTS_Control::mtx, _CRX_Service::state, and _CTS_Control::state.
unsigned int CRX_createService | ( | CRX_ServiceType | typ, | |
CRX_cb_Driver * | rtn, | |||
void * | prm | |||
) |
Create a CTDB (1553) receive service block.
typ | (in) Service type (command or telemetry) | |
rtn | (in) Dispatch callback routine | |
prm | (in) Dispatch callback routine parameter |
CTS_ALOCFAIL | Memory allocation failure | |
CTS_BADSTAT | Not in state "uninitialized" (bad state transition) | |
CTS_MUALOCFL | Cannot allocate a mutex | |
CTS_SUCCESS | Success |
References _CRX_Service::chk, _CTS_Control::cnt, _CTS_Control::crx, CTS_ccb, CTS_CTL_INITIALIZED, CTS_ctl_states, CTX_SVC_INITIALIZED, _CRX_Service::flg, _CTS_Control::mtx, _CRX_Service::prm, _CRX_Service::rtn, _CRX_Service::state, _CTS_Control::state, _CRX_Service::tcb, and validType().
Referenced by CTS_configure().
unsigned int CRX_deleteService | ( | CRX_ServiceType | typ | ) |
Delete a CTDB (1553) receive service block.
typ | (in) Service type (command or telemetry) |
CTS_BADSTAT | Not in state "uninitialized" (bad state transition) | |
CTS_SUCCESS | Success |
References checkState(), _CRX_Service::chk, _CTS_Control::cnt, _CTS_Control::crx, CTS_ccb, CTS_CTL_INITIALIZED, CTX_SVC_INITIALIZED, CTX_SVC_UNINITIALIZED, _CRX_Service::flg, _CTS_Control::mtx, _CRX_Service::prm, _CRX_Service::rtn, _CRX_Service::state, _CRX_Service::tcb, and validType().
Referenced by CTS_rundown().
static void CRX_recvCmd | ( | void * | prm | ) | [static] |
Dispatch telecommand packets arriving at the CTDB device.
prm | (in) User context parameter |
The only thing left to validate is the checksum (not done in the driver because it's running at interrupt level). If the checksum is OK, this routine calls the service routine set up during CRX initialization.
References CTS_ccb, _CTS_Control::dev, _CRX_Service::flg, _CTS_Device::loc, _CRX_Service::prm, and _CRX_Service::rtn.
unsigned int CRX_startService | ( | CRX_ServiceType | typ, | |
TASK_attr * | attr | |||
) |
Start a CTDB (1553) receive service.
typ | (in) Service type (command or telemetry) | |
attr | (in) Task attributes |
CTS_BADSTAT | Not in state "initialized" (bad state transition) | |
CTS_NOTINIT | Control block has not been allocated/initialized | |
CTS_SUCCESS | Success | |
CTS_TASKSTRT | Cannot start receive task |
References checkState(), _CTS_Control::crx, CRX_SVC_STARTED, CTS_ccb, CTS_CTL_INITIALIZED, CTX_SVC_INITIALIZED, _CTS_Control::dev, _CTS_Control::mtx, _CRX_Service::state, _CRX_Service::tcb, and validType().
Referenced by CTS_configure().
unsigned int CRX_stopService | ( | CRX_ServiceType | typ | ) |
Start a CTDB (1553) receive service.
typ | (in) Service type (command or telemetry) |
CTS_BADSTAT | Not in state "initialized" (bad state transition) | |
CTS_NOTINIT | Control block has not been allocated/initialized | |
CTS_SUCCESS | Success | |
CTS_TASKSTRT | Cannot start receive task |
References checkState(), _CTS_Control::crx, CTS_ccb, CTS_CTL_INITIALIZED, CTX_SVC_STARTED, _CRX_Service::flg, _CTS_Control::mtx, _CRX_Service::tcb, and validType().
Referenced by CTS_rundown().
static unsigned int validType | ( | CRX_ServiceType | typ | ) | [inline, static] |
Validate service type.
typ | (in) Service type |
CTS_RXTYPE | Invalid receive service type | |
CTS_SUCCESS | Success |
References CRX_TYP_CMD, and CRX_TYP_TLM.
Referenced by CRX_createService(), CRX_deleteService(), CRX_startService(), and CRX_stopService().
const char* CRX_svc_states[CRX_L_SVC_STATES] |
Initial value:
{ "uninitialized", "initialized", "started" }
Referenced by checkState().
void * CRX_svcTask[CRX_L_SVC_TYPES] |
Initial value:
{ &CRX_recvCmd, &CRX_recvTlm }