Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 60 additions & 110 deletions fsw/inc/lc_eventids.h

Large diffs are not rendered by default.

624 changes: 185 additions & 439 deletions fsw/src/lc_app.c

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions fsw/src/lc_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
* \name LC CDS Buffer Strings
* \{
*/
#define LC_WRT_CDSNAME "LC_CDS_WRT"
#define LC_ART_CDSNAME "LC_CDS_ART"
#define LC_APPDATA_CDSNAME "LC_CDS_AppData"
#define LC_CDS_NAME "LC_CDS"
/**\}*/

/**
Expand Down Expand Up @@ -126,6 +124,15 @@ typedef struct LC_MListTag
* Type Definitions
************************************************************************/

typedef struct
{
LC_HkPacket_t HkPacket; /**< \brief Housekeeping telemetry packet */
LC_WRTEntry_t *WRTPtr; /**< \brief Watchpoint Results Table Pointer */
LC_ARTEntry_t *ARTPtr; /**< \brief Actionpoint Results Table Pointer */
LC_WDTEntry_t *WDTPtr; /**< \brief Watchpoint Definition Table Pointer */
LC_ADTEntry_t *ADTPtr; /**< \brief Actionpoint Definition Table Pointer */
} LC_CDS_Data_t;

/**
* \brief LC Operational Data Structure
*
Expand All @@ -147,10 +154,8 @@ typedef struct
CFE_TBL_Handle_t WRTHandle; /**< \brief Watchpoint Results Table Handle */
CFE_TBL_Handle_t ARTHandle; /**< \brief Actionpoint Results Table Handle */

CFE_ES_CDSHandle_t WRTDataCDSHandle; /**< \brief Watchpoint Results Table CDS Handle */
CFE_ES_CDSHandle_t ARTDataCDSHandle; /**< \brief Actionpoint Results Table CDS Handle */

CFE_ES_CDSHandle_t AppDataCDSHandle; /**< \brief Application Data CDS Handle */
CFE_ES_CDSHandle_t CDS_Handle; /**< \brief LC CDS Handle */
LC_CDS_Data_t CDS_Data; /**< \brief Data structure to interface with CDS */

uint16 WatchpointCount; /**< \brief Count of in-use watchpoints defined
in the Watchpoint Definition Table */
Expand All @@ -160,8 +165,6 @@ typedef struct

LC_HkPacket_t HkPacket; /**< \brief Housekeeping telemetry packet */

uint32 TableResults; /**< \brief Table and CDS initialization results */

LC_MessageList_t *HashTable[LC_HASH_TABLE_ENTRIES]; /**< \brief Each entry in the hash
table is a linked list
of all the MessageID's
Expand Down Expand Up @@ -336,7 +339,7 @@ CFE_Status_t LC_CreateDefinitionTables(void);
*
* \sa #LC_TableInit
*/
CFE_Status_t LC_CreateTaskCDS(void);
CFE_Status_t LC_GetCDS_Data(void);

/**
* \brief Load Default Table Values
Expand Down
87 changes: 29 additions & 58 deletions fsw/src/lc_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,58 +113,40 @@ CFE_Status_t LC_ManageTables(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

CFE_Status_t LC_UpdateTaskCDS(void)
CFE_Status_t LC_SetCDS_Data(void)
{
CFE_Status_t Result;

/*
** Copy the watchpoint results table (WRT) data to CDS
*/
Result = CFE_ES_CopyToCDS(LC_OperData.WRTDataCDSHandle, LC_OperData.WRTPtr);

if (Result != CFE_SUCCESS)
{
CFE_EVS_SendEvent(LC_WRT_NO_SAVE_ERR_EID,
CFE_EVS_EventType_ERROR,
"Unable to update watchpoint results in CDS, RC=0x%08X",
(unsigned int)Result);
return Result;
}
CFE_Status_t Status;

/*
** Copy the actionpoint results table (ART) data to CDS
*/
Result = CFE_ES_CopyToCDS(LC_OperData.ARTDataCDSHandle, LC_OperData.ARTPtr);
Status = CFE_SUCCESS;

if (Result != CFE_SUCCESS)
/* Check whether previous CDS operations were successful */
if (LC_OperData.CDS_Handle != 0 && LC_OperData.HaveActiveCDS)
{
CFE_EVS_SendEvent(LC_ART_NO_SAVE_ERR_EID,
CFE_EVS_EventType_ERROR,
"Unable to update actionpoint results in CDS, RC=0x%08X",
(unsigned int)Result);
return Result;
}

/*
** Set the "data has been saved" indicator
*/
LC_AppData.CDSSavedOnExit = LC_CDS_SAVED;

/*
** Copy the global application data structure to CDS
*/
Result = CFE_ES_CopyToCDS(LC_OperData.AppDataCDSHandle, &LC_AppData);
/* Update CDS data */
memcpy(&(LC_OperData.CDS_Data.HkPacket), &(LC_OperData.HkPacket), sizeof(LC_HkPacket_t));
LC_OperData.CDS_Data.WDTPtr = LC_OperData.WDTPtr;
LC_OperData.CDS_Data.WRTPtr = LC_OperData.WRTPtr;
LC_OperData.CDS_Data.ADTPtr = LC_OperData.ADTPtr;
LC_OperData.CDS_Data.ARTPtr = LC_OperData.ARTPtr;

/* Copy the CDS data to CDS */
Status = CFE_ES_CopyToCDS(LC_OperData.CDS_Handle, &(LC_OperData.CDS_Data));
if (Status != CFE_SUCCESS)
{
/* Clear out the CDS handle to prevent future use */
LC_OperData.CDS_Handle = 0;
LC_OperData.HaveActiveCDS = false;
CFE_EVS_SendEvent(LC_CDS_NO_SAVE_ERR_EID,
CFE_EVS_EventType_ERROR,
"Unable to update CDS data results in CDS, RC=0x%08X",
(unsigned int)Status);
}

if (Result != CFE_SUCCESS)
{
CFE_EVS_SendEvent(LC_APP_NO_SAVE_START_ERR_EID,
CFE_EVS_EventType_ERROR,
"Unable to update application data in CDS, RC=0x%08X",
(unsigned int)Result);
return Result;
/* Set the "data has been saved" indicator */
LC_AppData.CDSSavedOnExit = LC_CDS_SAVED;
}

return CFE_SUCCESS;
return Status;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -182,20 +164,9 @@ CFE_Status_t LC_PerformMaintenance(void)
** (an error here is fatal - LC must be able to access its tables)
*/
Result = LC_ManageTables();

if (Result == CFE_SUCCESS)
if (Result == CFE_SUCCESS && LC_OperData.HaveActiveCDS)
{
if (LC_OperData.HaveActiveCDS)
{
/*
** If CDS is enabled - update the 3 CDS areas managed by LC
** (continue, but disable CDS if unable to update all 3)
*/
if (LC_UpdateTaskCDS() != CFE_SUCCESS)
{
LC_OperData.HaveActiveCDS = false;
}
}
LC_SetCDS_Data();
}

return Result;
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/lc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CFE_Status_t LC_ManageTables(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
CFE_Status_t LC_UpdateTaskCDS(void);
CFE_Status_t LC_SetCDS_Data(void);

/**
* \brief Perform Routine Maintenance
Expand Down
Loading
Loading