Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cFE Integration candidate: 2021-01-19 #1109

Merged
merged 40 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ad74393
Fix #1074, Refactor CFE_TIME_RegisterSynchCallback
skliper Jan 7, 2021
73717b8
Fix #449, Add OS_printf to CFE_ES_SYSLOG_APPEND
skliper Jan 7, 2021
778aafb
Fix #488, Pad msg headers to 64 bit
skliper Jan 7, 2021
856c88a
Fix #903, Add CFE_SB_GetUserData padding check
skliper Sep 23, 2020
1b31bd9
Fix #877, Remove duplicate CFE_MISSION_REV define
skliper Jan 11, 2021
483b7c0
Fix #901, Remove UT_CheckForOpenSockets references
skliper Jan 11, 2021
a32ed2a
Fix #904, Update cpuname targets.cmake documentation
skliper Jan 11, 2021
ad9ae56
Fix #1090, UT event check bounds
jphickey Jan 12, 2021
266ed95
Fix #1052, Refactor UT_ClearForceFail to UT_ClearDefaultReturnValue
zanzaben Jan 4, 2021
63b4347
Fix #1068, Create Security Policy
arielswalker Dec 17, 2020
3852145
Fix #933, Remove SenderReporting from SB global
skliper Jan 14, 2021
6b5f77a
Fix #985, globalize "resource ID" definitions
jphickey Jan 12, 2021
b17cd1e
Fix #1073, refactor SB API for proper global locks
jphickey Jan 12, 2021
21bf38a
Fix #945, Finish CFE_PLATFORM_ES_PERF_MAX_IDS removal
skliper Jan 19, 2021
d1c5ab0
Fix #954, Handle debug events in unit test
skliper Jan 19, 2021
fc97a62
Fix #955, Remove OS_printf stub count checks in UT
skliper Jan 19, 2021
4d406db
Merge pull request #1048 from ArielSAdamsNASA/main
astrogeco Jan 21, 2021
8559cf3
Merge pull request #1086 from skliper/fix904-cpuname_doc
astrogeco Jan 21, 2021
0658a01
Merge pull request #1091 from jphickey/fix-1090-ut-eventcheck-bounds
astrogeco Jan 21, 2021
bd87123
Merge pull request #1076 from skliper/fix449-consistent_log
astrogeco Jan 21, 2021
f9abb48
Merge pull request #1099 from skliper/fix933-rm_senderreporting
astrogeco Jan 21, 2021
9f8a776
Merge pull request #1106 from skliper/fix954-test_w_debug_events
astrogeco Jan 21, 2021
c403d0e
Merge pull request #1085 from skliper/fix901-rm-ut-checkforopensockets
astrogeco Jan 21, 2021
6618ce1
Merge pull request #1053 from zanzaben/fix1052_Rename_UT_ClearForceFail
astrogeco Jan 22, 2021
6ca043d
Merge pull request #905 from skliper/fix903-getuserdata-padcheck
astrogeco Jan 25, 2021
a68947e
Merge pull request #1077 from skliper/fix488-header_alignment
astrogeco Jan 25, 2021
c9f9d42
Merge pull request #1075 from skliper/fix1074-multiple_returns
astrogeco Jan 25, 2021
95ec2da
Merge pull request #1092 from jphickey/fix-1073-sb-locking
astrogeco Jan 25, 2021
1927e61
Merge pull request #1107 from skliper/fix955-os_printf_count
astrogeco Jan 25, 2021
5b1d054
Merge pull request #1084 from skliper/fix877-one_missionrev_2_rule_th…
astrogeco Jan 25, 2021
cc514bc
Merge pull request #1104 from skliper/fix945-platform_perf_max_id
astrogeco Jan 25, 2021
28c746c
Fix #1089, Cleanup strncpy use - unit tests
skliper Jan 12, 2021
5edcf20
Fix #1089, Cleanup strncpy use - main code
skliper Jan 13, 2021
26a0e06
Fix #932, Update UT for CFE_MISSION* string sizing
skliper Jan 14, 2021
a4aa481
Merge pull request #1098 from skliper/fix1089-clean_strncpy
astrogeco Jan 25, 2021
137768d
Fix #982, use separate pipe info data struct
jphickey Jan 15, 2021
79cfde6
Merge pull request #1102 from jphickey/fix-982-separate-pipeinfo
astrogeco Jan 26, 2021
383438d
Fix #1134, Add UtDebug output to CFE_ES_WriteToSysLog stub
skliper Jan 26, 2021
a991e96
Merge pull request #1135 from skliper/fix1134-writetosyslog_utdebug
astrogeco Jan 26, 2021
f221911
Bump to v6.8.0-rc1+dev290
astrogeco Jan 27, 2021
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
Prev Previous commit
Next Next commit
Fix #985, globalize "resource ID" definitions
Move certain definitions related to the CFE_ES_ResourceID_t type
into the global CFE include files.  This introduces two new headers:

cfe_resourceid.h (public)
cfe_resourceid_internal.h (private to CFE core apps)

This allows other CFE core apps, such as SB, to use the
CFE_ES_ResourceID_t using the same manipulators.
  • Loading branch information
jphickey committed Jan 15, 2021
commit 6b5f77a67eff0e756346df49db14472a5144406d
16 changes: 9 additions & 7 deletions fsw/cfe-core/src/es/cfe_es_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1877,9 +1877,11 @@ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle)
return CFE_ES_CDSBlockRead(RestoreToMemory, Handle);
} /* End of CFE_ES_RestoreFromCDS() */

/* end of file */


/*
** Function: CFE_ES_RegisterGenCounter
**
** Purpose: Allocates a generic counter resource and assigns ID
*/
int32 CFE_ES_RegisterGenCounter(CFE_ES_ResourceID_t *CounterIdPtr, const char *CounterName)
{
CFE_ES_GenCounterRecord_t *CountRecPtr;
Expand Down Expand Up @@ -1912,7 +1914,7 @@ int32 CFE_ES_RegisterGenCounter(CFE_ES_ResourceID_t *CounterIdPtr, const char *C
else
{
/* scan for a free slot */
PendingCounterId = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastCounterId, CFE_PLATFORM_ES_MAX_GEN_COUNTERS);
PendingCounterId = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastCounterId, CFE_PLATFORM_ES_MAX_GEN_COUNTERS, CFE_ES_CheckCounterIdSlotUsed);
CountRecPtr = CFE_ES_LocateCounterRecordByID(PendingCounterId);

if (CountRecPtr == NULL)
Expand Down Expand Up @@ -2108,7 +2110,7 @@ CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_ResourceID_t Cou
*/
int32 CFE_ES_AppID_ToIndex(CFE_ES_ResourceID_t AppID, uint32 *Idx)
{
return CFE_ES_ResourceID_ToIndex_Internal(
return CFE_ES_ResourceID_ToIndex(
CFE_ES_ResourceID_ToInteger(AppID) - CFE_ES_APPID_BASE,
CFE_PLATFORM_ES_MAX_APPLICATIONS,
Idx);
Expand All @@ -2120,7 +2122,7 @@ int32 CFE_ES_AppID_ToIndex(CFE_ES_ResourceID_t AppID, uint32 *Idx)
*/
int32 CFE_ES_LibID_ToIndex(CFE_ES_ResourceID_t LibId, uint32 *Idx)
{
return CFE_ES_ResourceID_ToIndex_Internal(
return CFE_ES_ResourceID_ToIndex(
CFE_ES_ResourceID_ToInteger(LibId) - CFE_ES_LIBID_BASE,
CFE_PLATFORM_ES_MAX_LIBRARIES,
Idx);
Expand Down Expand Up @@ -2160,7 +2162,7 @@ int32 CFE_ES_TaskID_ToIndex(CFE_ES_ResourceID_t TaskID, uint32 *Idx)
*/
int32 CFE_ES_CounterID_ToIndex(CFE_ES_ResourceID_t CounterId, uint32 *Idx)
{
return CFE_ES_ResourceID_ToIndex_Internal(
return CFE_ES_ResourceID_ToIndex(
CFE_ES_ResourceID_ToInteger(CounterId) - CFE_ES_COUNTID_BASE,
CFE_PLATFORM_ES_MAX_GEN_COUNTERS,
Idx);
Expand Down
5 changes: 3 additions & 2 deletions fsw/cfe-core/src/es/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ int32 CFE_ES_AppCreate(CFE_ES_ResourceID_t *ApplicationIdPtr,
else
{
/* scan for a free slot */
PendingAppId = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastAppId, CFE_PLATFORM_ES_MAX_APPLICATIONS);
PendingAppId = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastAppId, CFE_PLATFORM_ES_MAX_APPLICATIONS, CFE_ES_CheckAppIdSlotUsed);
AppRecPtr = CFE_ES_LocateAppRecordByID(PendingAppId);

if (AppRecPtr == NULL)
Expand Down Expand Up @@ -795,6 +795,7 @@ int32 CFE_ES_AppCreate(CFE_ES_ResourceID_t *ApplicationIdPtr,
return Status;

} /* End Function */

/*
**---------------------------------------------------------------------------------------
** Name: CFE_ES_LoadLibrary
Expand Down Expand Up @@ -864,7 +865,7 @@ int32 CFE_ES_LoadLibrary(CFE_ES_ResourceID_t *LibraryIdPtr,
else
{
/* scan for a free slot */
PendingLibId = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastLibId, CFE_PLATFORM_ES_MAX_LIBRARIES);
PendingLibId = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastLibId, CFE_PLATFORM_ES_MAX_LIBRARIES, CFE_ES_CheckLibIdSlotUsed);
LibSlotPtr = CFE_ES_LocateLibRecordByID(PendingLibId);

if (LibSlotPtr == NULL)
Expand Down
16 changes: 14 additions & 2 deletions fsw/cfe-core/src/es/cfe_es_cds.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,24 @@ int32 CFE_ES_CDS_EarlyInit(void)
/*******************************************************************/
int32 CFE_ES_CDSBlockID_ToIndex(CFE_ES_ResourceID_t BlockID, uint32 *Idx)
{
return CFE_ES_ResourceID_ToIndex_Internal(
return CFE_ES_ResourceID_ToIndex(
CFE_ES_ResourceID_ToInteger(BlockID) - CFE_ES_CDSBLOCKID_BASE,
CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES,
Idx);
}

/*---------------------------------------------------------------------------------------
* Function: CFE_ES_CheckCDSBlockIdSlotUsed
*
* Purpose: Helper function, Aids in allocating a new ID by checking if
* a given ID is available. Must be called while locked.
*---------------------------------------------------------------------------------------
*/
bool CFE_ES_CheckCDSBlockIdSlotUsed(CFE_ES_ResourceID_t CheckId)
{
return CFE_ES_CDSBlockRecordIsUsed(CFE_ES_LocateCDSBlockRecordByID(CheckId));
}

/*******************************************************************/
/*
* CFE_ES_LocateCDSBlockRecordByID
Expand Down Expand Up @@ -347,7 +359,7 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize,
else
{
/* scan for a free slot */
PendingBlockId = CFE_ES_FindNextAvailableId(CDS->LastCDSBlockId, CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES);
PendingBlockId = CFE_ES_FindNextAvailableId(CDS->LastCDSBlockId, CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES, CFE_ES_CheckCDSBlockIdSlotUsed);
RegRecPtr = CFE_ES_LocateCDSBlockRecordByID(PendingBlockId);

if (RegRecPtr != NULL)
Expand Down
14 changes: 14 additions & 0 deletions fsw/cfe-core/src/es/cfe_es_cds.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,20 @@ static inline size_t CFE_ES_CDSBlockRecordGetUserSize(const CFE_ES_CDS_RegRec_t
return (CDSBlockRecPtr->BlockSize - sizeof(CFE_ES_CDS_BlockHeader_t));
}

/**
* @brief Check if a CDS Block ID table slot is used
*
* Checks if a table slot is available for a potential new ID
* This is a helper function intended to be used with
* CFE_ES_FindNextAvailableID() for allocating new IDs
*
* As this dereferences fields within the record, global data must be
* locked prior to invoking this function.
*
* @param[in] CheckId pending/candidate Block ID to check
* @returns true if the table slot for the ID is occupied, false if available
*/
bool CFE_ES_CheckCDSBlockIdSlotUsed(CFE_ES_ResourceID_t CheckId);

/*****************************************************************************/
/**
Expand Down
16 changes: 14 additions & 2 deletions fsw/cfe-core/src/es/cfe_es_mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,24 @@ int32 CFE_ES_MemPoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offs

int32 CFE_ES_MemPoolID_ToIndex(CFE_ES_MemHandle_t PoolID, uint32 *Idx)
{
return CFE_ES_ResourceID_ToIndex_Internal(
return CFE_ES_ResourceID_ToIndex(
CFE_ES_ResourceID_ToInteger(PoolID) - CFE_ES_POOLID_BASE,
CFE_PLATFORM_ES_MAX_MEMORY_POOLS,
Idx);
}

/*---------------------------------------------------------------------------------------
* Function: CFE_ES_CheckMemPoolSlotUsed
*
* Purpose: Helper function, Aids in allocating a new ID by checking if
* a given table slot is available. Must be called while locked.
*---------------------------------------------------------------------------------------
*/
bool CFE_ES_CheckMemPoolSlotUsed(CFE_ES_ResourceID_t CheckId)
{
return CFE_ES_MemPoolRecordIsUsed(CFE_ES_LocateMemPoolRecordByID(CheckId));
}

CFE_ES_MemPoolRecord_t* CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID)
{
CFE_ES_MemPoolRecord_t *MemPoolRecPtr;
Expand Down Expand Up @@ -211,7 +223,7 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID,
CFE_ES_LockSharedData(__func__,__LINE__);

/* scan for a free slot */
PendingID = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastMemPoolId, CFE_PLATFORM_ES_MAX_MEMORY_POOLS);
PendingID = CFE_ES_FindNextAvailableId(CFE_ES_Global.LastMemPoolId, CFE_PLATFORM_ES_MAX_MEMORY_POOLS, CFE_ES_CheckMemPoolSlotUsed);
PoolRecPtr = CFE_ES_LocateMemPoolRecordByID(PendingID);

if (PoolRecPtr == NULL)
Expand Down
28 changes: 27 additions & 1 deletion fsw/cfe-core/src/es/cfe_es_mempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,38 @@ static inline void CFE_ES_MemPoolRecordSetFree(CFE_ES_MemPoolRecord_t *PoolRecPt
PoolRecPtr->PoolID = CFE_ES_RESOURCEID_UNDEFINED;
}


/**
* @brief Check if an Mem Pool record is a match for the given Pool ID
*
* This routine confirms that the previously-located record is valid
* and matches the expected Pool ID.
*
* As this dereferences fields within the record, global data must be
* locked prior to invoking this function.
*
* @param[in] PoolRecPtr pointer to Pool table entry
* @param[in] PoolID expected Pool ID
* @returns true if the entry matches the given pool ID
*/
static inline bool CFE_ES_MemPoolRecordIsMatch(const CFE_ES_MemPoolRecord_t *PoolRecPtr, CFE_ES_MemHandle_t PoolID)
{
return (PoolRecPtr != NULL && CFE_ES_ResourceID_Equal(PoolRecPtr->PoolID, PoolID));
}

/**
* @brief Check if a Pool ID table slot is used
*
* Checks if a table slot is available for a potential new ID
* This is a helper function intended to be used with
* CFE_ES_FindNextAvailableID() for allocating new IDs
*
* As this dereferences fields within the record, global data must be
* locked prior to invoking this function.
*
* @param[in] CheckId pending/candidate Pool ID to check
* @returns true if the table slot for the ID is occupied, false if available
*/
bool CFE_ES_CheckMemPoolSlotUsed(CFE_ES_ResourceID_t CheckId);


#endif /* _CFE_ES_MEMPOOL_H_ */
67 changes: 43 additions & 24 deletions fsw/cfe-core/src/es/cfe_es_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@

/*********************************************************************/
/*
* CFE_ES_ResourceID_ToIndex_Internal
* CFE_ES_ResourceID_ToIndex
*
* For complete API information, see prototype in header
*/
int32 CFE_ES_ResourceID_ToIndex_Internal(uint32 Serial, uint32 TableSize, uint32 *Idx)
int32 CFE_ES_ResourceID_ToIndex(uint32 Serial, uint32 TableSize, uint32 *Idx)
{
if (Idx == NULL)
{
Expand Down Expand Up @@ -94,7 +94,7 @@ CFE_ES_ResourceID_t CFE_ES_ResourceID_FromOSAL(osal_id_t id)
*
* For complete API information, see prototype in header
*/
CFE_ES_ResourceID_t CFE_ES_FindNextAvailableId(CFE_ES_ResourceID_t StartId, uint32 TableSize)
CFE_ES_ResourceID_t CFE_ES_FindNextAvailableId(CFE_ES_ResourceID_t StartId, uint32 TableSize, bool (*CheckFunc)(CFE_ES_ResourceID_t))
{
uint32 Serial;
uint32 Count;
Expand Down Expand Up @@ -124,27 +124,7 @@ CFE_ES_ResourceID_t CFE_ES_FindNextAvailableId(CFE_ES_ResourceID_t StartId, uint
}
CheckId = CFE_ES_ResourceID_FromInteger(ResourceType + Serial);

switch (ResourceType)
{
case CFE_ES_APPID_BASE:
IsTaken = CFE_ES_AppRecordIsUsed(CFE_ES_LocateAppRecordByID(CheckId));
break;
case CFE_ES_LIBID_BASE:
IsTaken = CFE_ES_LibRecordIsUsed(CFE_ES_LocateLibRecordByID(CheckId));
break;
case CFE_ES_COUNTID_BASE:
IsTaken = CFE_ES_CounterRecordIsUsed(CFE_ES_LocateCounterRecordByID(CheckId));
break;
case CFE_ES_POOLID_BASE:
IsTaken = CFE_ES_MemPoolRecordIsUsed(CFE_ES_LocateMemPoolRecordByID(CheckId));
break;
case CFE_ES_CDSBLOCKID_BASE:
IsTaken = CFE_ES_CDSBlockRecordIsUsed(CFE_ES_LocateCDSBlockRecordByID(CheckId));
break;
default:
/* do nothing, should never happen */
break;
}
IsTaken = CheckFunc(CheckId);
}
while (IsTaken);

Expand Down Expand Up @@ -430,4 +410,43 @@ CFE_ES_AppRecord_t *CFE_ES_GetAppRecordByContext(void)
return AppRecPtr;
}

/*
* ---------------------------------------------------------------------------------------
* Function: CFE_ES_CheckCounterIdSlotUsed
*
* Purpose: Helper function, Aids in allocating a new ID by checking if
* a given ID is available. Must be called while locked.
* ---------------------------------------------------------------------------------------
*/
bool CFE_ES_CheckCounterIdSlotUsed(CFE_ES_ResourceID_t CheckId)
{
return CFE_ES_CounterRecordIsUsed(CFE_ES_LocateCounterRecordByID(CheckId));
}

/*
*---------------------------------------------------------------------------------------
* Function: CFE_ES_CheckAppIdSlotUsed
*
* Purpose: Helper function, Aids in allocating a new ID by checking if
* a given ID is available. Must be called while locked.
*---------------------------------------------------------------------------------------
*/
bool CFE_ES_CheckAppIdSlotUsed(CFE_ES_ResourceID_t CheckId)
{
return CFE_ES_AppRecordIsUsed(CFE_ES_LocateAppRecordByID(CheckId));
}

/*
* ---------------------------------------------------------------------------------------
* Function: CFE_ES_CheckLibIdSlotUsed
*
* Purpose: Helper function, Aids in allocating a new ID by checking if
* a given ID is available. Must be called while locked.
* ---------------------------------------------------------------------------------------
*/
bool CFE_ES_CheckLibIdSlotUsed(CFE_ES_ResourceID_t CheckId)
{
return CFE_ES_LibRecordIsUsed(CFE_ES_LocateLibRecordByID(CheckId));
}


Loading