Skip to content
Merged
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
1 change: 1 addition & 0 deletions config/default_sample_app_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

/***********************************************************************/
#define SAMPLE_APP_PIPE_DEPTH 32 /* Depth of the Command Pipe for Application */
#define SAMPLE_APP_PIPE_NAME "SAMPLE_APP_CMD_PIPE"

#define SAMPLE_APP_NUMBER_OF_TABLES 1 /* Number of Example Table(s) */

Expand Down
10 changes: 1 addition & 9 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ CFE_Status_t SAMPLE_APP_Init(void)

SAMPLE_APP_Data.RunStatus = CFE_ES_RunStatus_APP_RUN;

/*
** Initialize app configuration data
*/
SAMPLE_APP_Data.PipeDepth = SAMPLE_APP_PIPE_DEPTH;

strncpy(SAMPLE_APP_Data.PipeName, "SAMPLE_APP_CMD_PIPE", sizeof(SAMPLE_APP_Data.PipeName));
SAMPLE_APP_Data.PipeName[sizeof(SAMPLE_APP_Data.PipeName) - 1] = 0;

/*
** Register the events
*/
Expand All @@ -144,7 +136,7 @@ CFE_Status_t SAMPLE_APP_Init(void)
/*
** Create Software Bus message pipe.
*/
status = CFE_SB_CreatePipe(&SAMPLE_APP_Data.CommandPipe, SAMPLE_APP_Data.PipeDepth, SAMPLE_APP_Data.PipeName);
status = CFE_SB_CreatePipe(&SAMPLE_APP_Data.CommandPipe, SAMPLE_APP_PIPE_DEPTH, SAMPLE_APP_PIPE_NAME);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(SAMPLE_APP_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,
Expand Down
6 changes: 0 additions & 6 deletions fsw/src/sample_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ typedef struct
*/
CFE_SB_PipeId_t CommandPipe;

/*
** Initialization data (not reported in housekeeping)...
*/
char PipeName[CFE_MISSION_MAX_API_LEN];
uint16 PipeDepth;

CFE_TBL_Handle_t TblHandles[SAMPLE_APP_NUMBER_OF_TABLES];
} SAMPLE_APP_Data_t;

Expand Down
44 changes: 23 additions & 21 deletions fsw/src/sample_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,37 +111,38 @@ CFE_Status_t SAMPLE_APP_ResetCountersCmd(const SAMPLE_APP_ResetCountersCmd_t *Ms
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
{
CFE_Status_t status;
CFE_Status_t Status;
void * TblAddr;
SAMPLE_APP_ExampleTable_t *TblPtr;
const char * TableName = "SAMPLE_APP.ExampleTable";

/* Sample Use of Example Table */

status = CFE_TBL_GetAddress(&TblAddr, SAMPLE_APP_Data.TblHandles[0]);

if (status < CFE_SUCCESS)
SAMPLE_APP_Data.CmdCounter++;
Status = CFE_TBL_GetAddress(&TblAddr, SAMPLE_APP_Data.TblHandles[0]);
if (Status < CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Sample App: Fail to get table address: 0x%08lx", (unsigned long)status);
return status;
CFE_ES_WriteToSysLog("Sample App: Fail to get table address: 0x%08lx", (unsigned long)Status);
}

TblPtr = TblAddr;
CFE_ES_WriteToSysLog("Sample App: Example Table Value 1: %d Value 2: %d", TblPtr->Int1, TblPtr->Int2);

SAMPLE_APP_GetCrc(TableName);

status = CFE_TBL_ReleaseAddress(SAMPLE_APP_Data.TblHandles[0]);
if (status != CFE_SUCCESS)
else
{
CFE_ES_WriteToSysLog("Sample App: Fail to release table address: 0x%08lx", (unsigned long)status);
return status;
TblPtr = TblAddr;
CFE_ES_WriteToSysLog("Sample App: Example Table Value 1: %d Value 2: %d", TblPtr->Int1, TblPtr->Int2);

SAMPLE_APP_GetCrc(TableName);

Status = CFE_TBL_ReleaseAddress(SAMPLE_APP_Data.TblHandles[0]);
if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Sample App: Fail to release table address: 0x%08lx", (unsigned long)Status);
}
else
{
/* Invoke a function provided by SAMPLE_APP_LIB */
SAMPLE_LIB_Function();
}
}

/* Invoke a function provided by SAMPLE_APP_LIB */
SAMPLE_LIB_Function();

return CFE_SUCCESS;
return Status;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
Expand All @@ -151,6 +152,7 @@ CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
CFE_Status_t SAMPLE_APP_DisplayParamCmd(const SAMPLE_APP_DisplayParamCmd_t *Msg)
{
SAMPLE_APP_Data.CmdCounter++;
CFE_EVS_SendEvent(SAMPLE_APP_VALUE_INF_EID, CFE_EVS_EventType_INFORMATION,
"SAMPLE_APP: ValU32=%lu, ValI16=%d, ValStr=%s", (unsigned long)Msg->Payload.ValU32,
(int)Msg->Payload.ValI16, Msg->Payload.ValStr);
Expand Down
Loading