Skip to content

Commit

Permalink
Merge pull request #975 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate 2020-10-27
  • Loading branch information
astrogeco authored Oct 28, 2020
2 parents 3077251 + c44b60e commit e0d1ce8
Show file tree
Hide file tree
Showing 38 changed files with 3,473 additions and 2,269 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: 6.8.0-rc1+dev150

- Provide new Library API similar to App API
- Allows the existing CFE_ES_AppInfo_t structure to be extended to libraries as well as applications by introducing a new value (3) for the Type field.
- Allows Libraries to be queried via API calls similar to App API.
- Extends the Query All/Query One commands to operate on Libraries or Applications.
- Breaks up the monolithic AppCreate and LoadLibrary functions and have these call subroutines that operate on the common components.
- Fix race conditions in app request processing state machine.
- Adds SBR module which includes message map and routing table. The access APIs are on the SB side which still owns the destination logic
- Removes passing of route index or pointers being. Everything is now based on route and message id
- Oversized the hash message map (4x) to minimize collisions
- Hash designed for 32 bit, a change in CFE_SB_MsgId_Atom_t size may require implementation updates
- Adds debug event for collisions during add
- Dropped routing push/pop, dropped "key" in direct implementation
- Deletes unused code CFE_SB_FindGlobalMsgIdCnt
- Fixes variable declaration violations of coding standard
- Individual events for deleting destinations when deleting a pipe removed to avoid a race condition around a 10-20% performance hit to hash via rough comparison on a linux box, no memory impact
- See <https://github.com/nasa/cFE/pull/975>

### Development Build: 6.8.0-rc1+dev139

- For all resource types which have names, IDs are not re-issued after deletion, helping ensure safety as previously deleted IDs will not validate. Provides a consistent Name-ID translation API for all resource types. Enforces consistent argument/name validation on all resource types, and also enforces name uniqueness where relevant.
Expand Down
1 change: 1 addition & 0 deletions cmake/mission_defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(MISSION_CORE_MODULES
"osal"
"psp"
"msg"
"sbr"
)

# The "MISSION_GLOBAL_APPLIST" is a set of apps/libs that will be built
Expand Down
6 changes: 5 additions & 1 deletion cmake/sample_defs/cpu1_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
** regarding this parameter, send an SB command to 'Send Statistics Pkt'.
**
** \par Limits
** This parameter has a lower limit of 1 and an upper limit of 1024.
** This must be a power of two if software bus message routing hash implementation
** is being used. Lower than 64 will cause unit test failures, and
** telemetry reporting is impacted below 32. There is no hard
** upper limit, but impacts memory footprint. For software bus message routing
** search implementation the number of msg ids subscribed to impacts performance.
**
*/
#define CFE_PLATFORM_SB_MAX_MSG_IDS 256
Expand Down
260 changes: 211 additions & 49 deletions fsw/cfe-core/src/es/cfe_es_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ int32 CFE_ES_ReloadApp(CFE_ES_ResourceID_t AppID, const char *AppFileName)
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Reload Application %s Initiated. New filename = %s\n",
CFE_ES_AppRecordGetName(AppRecPtr), AppFileName);
strncpy((char *)AppRecPtr->StartParams.FileName, AppFileName, OS_MAX_PATH_LEN);
strncpy(AppRecPtr->StartParams.BasicInfo.FileName, AppFileName, OS_MAX_PATH_LEN);
AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD;
}
else
Expand Down Expand Up @@ -965,8 +965,10 @@ int32 CFE_ES_GetTaskName(char *TaskName, CFE_ES_ResourceID_t TaskId, uint32 Buff
*/
int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_ResourceID_t AppId)
{
int32 ReturnCode = CFE_SUCCESS;
CFE_ES_AppRecord_t *AppRecPtr;
CFE_ES_TaskRecord_t *TaskRecPtr;
int32 Status;
uint32 i;

if ( AppInfo == NULL )
{
Expand All @@ -976,73 +978,233 @@ int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_ResourceID_t AppId)

memset(AppInfo, 0, sizeof(*AppInfo));

/*
** Get App Record
*/
AppRecPtr = CFE_ES_LocateAppRecordByID(AppId);
if ( AppRecPtr == NULL )

CFE_ES_LockSharedData(__func__,__LINE__);

if ( !CFE_ES_AppRecordIsMatch(AppRecPtr, AppId) )
{
CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: App ID Invalid: %lu\n",
/*
* Log a message if called with an invalid ID.
*/
CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: App ID not active: %lu\n",
CFE_ES_ResourceID_ToInteger(AppId));
return CFE_ES_ERR_RESOURCEID_NOT_VALID;
}

Status = CFE_ES_ERR_RESOURCEID_NOT_VALID;
}
else
{
AppInfo->AppId = AppId;
AppInfo->Type = AppRecPtr->Type;

CFE_ES_CopyModuleBasicInfo(&AppRecPtr->StartParams.BasicInfo, AppInfo);
CFE_ES_CopyModuleStatusInfo(&AppRecPtr->ModuleInfo, AppInfo);

AppInfo->StackSize = AppRecPtr->StartParams.StackSize;
AppInfo->ExceptionAction = AppRecPtr->StartParams.ExceptionAction;
AppInfo->Priority = AppRecPtr->StartParams.Priority;
AppInfo->MainTaskId = AppRecPtr->MainTaskId;

/*
** Calculate the number of child tasks
*/
AppInfo->NumOfChildTasks = 0;
TaskRecPtr = CFE_ES_Global.TaskTable;
for (i=0; i<OS_MAX_TASKS; i++ )
{
if ( CFE_ES_TaskRecordIsUsed(TaskRecPtr) &&
CFE_ES_ResourceID_Equal(TaskRecPtr->AppId, AppId))
{
if (CFE_ES_ResourceID_Equal(CFE_ES_TaskRecordGetID(TaskRecPtr), AppInfo->MainTaskId))
{
/* This is the main task - capture its name and execution count */
AppInfo->ExecutionCounter = TaskRecPtr->ExecutionCounter;
strncpy(AppInfo->MainTaskName, TaskRecPtr->TaskName,
sizeof(AppInfo->MainTaskName) - 1);
AppInfo->MainTaskName[sizeof(AppInfo->MainTaskName) - 1] = '\0';
}
else
{
/* This is a child task, no extra info, just increment count */
++AppInfo->NumOfChildTasks;
}
}
++TaskRecPtr;
}

Status = CFE_SUCCESS;
}

CFE_ES_UnlockSharedData(__func__,__LINE__);

/*
* Note - cannot check if the AppID is active here,
* as the table is not locked. The internal function
* should lock and check.
*/
ReturnCode = CFE_ES_GetAppInfoInternal(AppRecPtr, AppInfo);
if (ReturnCode != CFE_SUCCESS)
** Get the address information from the OSAL
*/
if (Status == CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: App ID Not Active: %lu\n",
CFE_ES_ResourceID_ToInteger(AppId));
CFE_ES_CopyModuleAddressInfo(AppInfo->ModuleId, AppInfo);
}

return(ReturnCode);
return Status;
}

/*
** Function: CFE_ES_GetLibInfo - See API and header file for details
*/
int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_ResourceID_t LibId)
{
int32 Status;
CFE_ES_LibRecord_t *LibRecPtr;

if ( LibInfo == NULL )
{
CFE_ES_WriteToSysLog("CFE_ES_GetLibInfo: Invalid Parameter ( Null Pointer )\n");
return CFE_ES_ERR_BUFFER;
}

LibRecPtr = CFE_ES_LocateLibRecordByID(LibId);

CFE_ES_LockSharedData(__func__,__LINE__);

if ( !CFE_ES_LibRecordIsMatch(LibRecPtr, LibId) )
{
/*
* Log a message if called with an invalid ID.
*/
CFE_ES_SysLogWrite_Unsync("CFE_ES_GetLibInfo: Lib ID not active: %lu\n",
CFE_ES_ResourceID_ToInteger(LibId));

Status = CFE_ES_ERR_RESOURCEID_NOT_VALID;
}
else
{
LibInfo->AppId = CFE_ES_LibRecordGetID(LibRecPtr);;
LibInfo->Type = CFE_ES_AppType_LIBRARY;

CFE_ES_CopyModuleBasicInfo(&LibRecPtr->BasicInfo, LibInfo);
CFE_ES_CopyModuleStatusInfo(&LibRecPtr->ModuleInfo, LibInfo);

Status = CFE_SUCCESS;
}

CFE_ES_UnlockSharedData(__func__,__LINE__);

/*
** Get the address information from the OSAL
*/
if (Status == CFE_SUCCESS)
{
CFE_ES_CopyModuleAddressInfo(LibInfo->ModuleId, LibInfo);
}

return Status;
}

/*
** Function: CFE_ES_GetModuleInfo - See API and header file for details
*/
int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ES_ResourceID_t ResourceId)
{
uint32 ResourceType;
int32 Status;

ResourceType = CFE_ES_ResourceID_ToInteger(ResourceId);
ResourceType -= ResourceType & CFE_ES_RESOURCEID_MAX;
switch(ResourceType)
{
case CFE_ES_APPID_BASE:
Status = CFE_ES_GetAppInfo(ModuleInfo, ResourceId);
break;
case CFE_ES_LIBID_BASE:
Status = CFE_ES_GetLibInfo(ModuleInfo, ResourceId);
break;
default:
/*
* Log a message if called with an invalid ID.
*/
CFE_ES_WriteToSysLog("CFE_ES_GetModuleInfo: Resource ID not valid: %lu\n",
CFE_ES_ResourceID_ToInteger(ResourceId));
Status = CFE_ES_ERR_RESOURCEID_NOT_VALID;
break;

}

return(Status);

} /* End of CFE_ES_GetAppInfo() */
} /* End of CFE_ES_GetModuleInfo() */

/*
** Function: CFE_ES_GetTaskInfo - See API and header file for details
*/
int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_ResourceID_t TaskId)
{
CFE_ES_TaskRecord_t *TaskRecPtr;
int32 ReturnCode;
CFE_ES_TaskRecord_t *TaskRecPtr;
CFE_ES_AppRecord_t *AppRecPtr;
int32 Status;

if ( TaskInfo == NULL )
{
CFE_ES_WriteToSysLog("CFE_ES_GetTaskInfo: Invalid Parameter ( Null Pointer )\n");
return CFE_ES_ERR_BUFFER;
}
if ( TaskInfo == NULL )
{
CFE_ES_WriteToSysLog("CFE_ES_GetTaskInfo: Invalid Parameter ( Null Pointer )\n");
return CFE_ES_ERR_BUFFER;
}

memset(TaskInfo, 0, sizeof(*TaskInfo));
memset(TaskInfo, 0, sizeof(*TaskInfo));

/*
** Get Task Record
*/
TaskRecPtr = CFE_ES_LocateTaskRecordByID(TaskId);
if ( TaskRecPtr == NULL )
{
CFE_ES_WriteToSysLog("CFE_ES_GetTaskInfo: Task ID Not Valid: %lu\n",
CFE_ES_ResourceID_ToInteger(TaskId));
return CFE_ES_ERR_RESOURCEID_NOT_VALID;
}
TaskRecPtr = CFE_ES_LocateTaskRecordByID(TaskId);

/*
* Note - cannot check if the TaskID is active here,
* as the table is not locked. The internal function
* should lock and check.
*/
ReturnCode = CFE_ES_GetTaskInfoInternal(TaskRecPtr, TaskInfo);
if (ReturnCode != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("CFE_ES_GetTaskInfo: Task ID Not Active: %lu\n",
CFE_ES_ResourceID_ToInteger(TaskId));
}
CFE_ES_LockSharedData(__func__,__LINE__);

return(ReturnCode);
if ( !CFE_ES_TaskRecordIsMatch(TaskRecPtr, TaskId) )
{
/* task ID is bad */
Status = CFE_ES_ERR_RESOURCEID_NOT_VALID;
CFE_ES_SysLogWrite_Unsync("CFE_ES_GetTaskInfo: Task ID Not Active: %lu\n",
CFE_ES_ResourceID_ToInteger(TaskId));
}
else
{

/*
** Get the Application ID and Task Name
*/
TaskInfo->AppId = TaskRecPtr->AppId;
strncpy(TaskInfo->TaskName,
CFE_ES_TaskRecordGetName(TaskRecPtr),
sizeof(TaskInfo->TaskName)-1);
TaskInfo->TaskName[sizeof(TaskInfo->TaskName)-1] = '\0';

/*
** Store away the Task ID ( for the QueryAllTasks Cmd )
*/
TaskInfo->TaskId = CFE_ES_TaskRecordGetID(TaskRecPtr);

/*
** Get the Execution counter for the task
*/
TaskInfo->ExecutionCounter = TaskRecPtr->ExecutionCounter;

/*
** Get the Application Details
*/
AppRecPtr = CFE_ES_LocateAppRecordByID(TaskRecPtr->AppId);
if (CFE_ES_AppRecordIsMatch(AppRecPtr, TaskRecPtr->AppId))
{
strncpy(TaskInfo->AppName,
CFE_ES_AppRecordGetName(AppRecPtr),
sizeof(TaskInfo->AppName)-1);
TaskInfo->AppName[sizeof(TaskInfo->AppName)-1] = '\0';
Status = CFE_SUCCESS;
}
else
{
/* task ID was OK but parent app ID is bad */
Status = CFE_ES_ERR_RESOURCEID_NOT_VALID;
}
}

CFE_ES_UnlockSharedData(__func__,__LINE__);

return(Status);

} /* End of CFE_ES_GetTaskInfo() */

Expand Down
Loading

0 comments on commit e0d1ce8

Please sign in to comment.