Skip to content

Commit

Permalink
Merge pull request #964 from jphickey/fix-909-extern-defs
Browse files Browse the repository at this point in the history
Fix #909, reorganize ES public API + msg definitions
  • Loading branch information
astrogeco authored Oct 30, 2020
2 parents 2e8b9b6 + f9f18a7 commit 398471a
Show file tree
Hide file tree
Showing 11 changed files with 329 additions and 242 deletions.
23 changes: 22 additions & 1 deletion cmake/sample_defs/sample_mission_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,27 @@
*/
#define CFE_MISSION_ES_PERF_MAX_IDS 128

/** \cfeescfg Maximum number of block sizes in pool structures
**
** \par Description:
** The upper limit for the number of block sizes supported in the generic
** pool implementation, which in turn implements the memory pools and CDS.
** This definition is used as the array size with the pool stats structure,
** and therefore should be consistent across all CPUs in a mission, as well
** as with the ground station.
**
** There is also a platform-specific limit which may be fewer than this
** value.
**
** \par Limits:
** Must be at least one. No specific upper limit, but the number is
** anticipated to be reasonably small (i.e. tens, not hundreds). Large
** values have not been tested.
**
**
*/
#define CFE_MISSION_ES_POOL_MAX_BUCKETS 17

/**
** \cfetblcfg Maximum Length of Full Table Name in messages
**
Expand Down Expand Up @@ -589,7 +610,7 @@
** This value should be kept as a multiple of 4, to maintain alignment of
** any possible neighboring fields without implicit padding.
*/
#define CFE_MISSION_ES_CDS_MAX_NAME_LEN (CFE_MISSION_ES_CDS_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 4)
#define CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN (CFE_MISSION_ES_CDS_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 4)



Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/es/cfe_es_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, CFE_ES_CDS_Offset_t B
CFE_ES_ResourceID_t ThisAppId;

char AppName[OS_MAX_API_NAME] = {"UNKNOWN"};
char CDSName[CFE_ES_CDS_MAX_FULL_NAME_LEN] = {""};
char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN] = {""};

/* Initialize output to safe value, in case this fails */
*CDSHandlePtr = CFE_ES_RESOURCEID_UNDEFINED;
Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/es/cfe_es_cds.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ typedef struct
CFE_ES_ResourceID_t BlockID; /**< Abstract ID associated with this CDS block */
CFE_ES_CDS_Offset_t BlockOffset; /**< Start offset of the block in CDS memory */
CFE_ES_CDS_Offset_t BlockSize; /**< Size, in bytes, of the CDS memory block */
char Name[CFE_ES_CDS_MAX_FULL_NAME_LEN];
char Name[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN];
bool Table; /**< \brief Flag that indicates whether CDS contains a Critical Table */
} CFE_ES_CDS_RegRec_t;

Expand Down
12 changes: 6 additions & 6 deletions fsw/cfe-core/src/es/cfe_es_mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
** Type Definitions
*/

const CFE_ES_MemOffset_t CFE_ES_MemPoolDefSize[CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES] =
const CFE_ES_MemOffset_t CFE_ES_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] =
{
CFE_PLATFORM_ES_MAX_BLOCK_SIZE,
CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16,
Expand Down Expand Up @@ -138,7 +138,7 @@ int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID,
uint8 *MemPtr,
CFE_ES_MemOffset_t Size )
{
return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES,
return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS,
&CFE_ES_MemPoolDefSize[0],CFE_ES_NO_MUTEX);
}

Expand All @@ -149,7 +149,7 @@ int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID,
uint8 *MemPtr,
CFE_ES_MemOffset_t Size )
{
return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES,
return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS,
&CFE_ES_MemPoolDefSize[0],CFE_ES_USE_MUTEX);
}

Expand Down Expand Up @@ -195,9 +195,9 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID,
if (BlockSizes == NULL)
{
BlockSizes = CFE_ES_MemPoolDefSize;
if (NumBlockSizes == 0 || NumBlockSizes > CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES)
if (NumBlockSizes == 0 || NumBlockSizes > CFE_PLATFORM_ES_POOL_MAX_BUCKETS)
{
NumBlockSizes = CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES;
NumBlockSizes = CFE_PLATFORM_ES_POOL_MAX_BUCKETS;
}
}

Expand Down Expand Up @@ -636,7 +636,7 @@ int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr,
&BufPtr->NumBlocksRequested,
&BufPtr->CheckErrCtr);

for (Idx = 0; Idx < CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES; ++Idx)
for (Idx = 0; Idx < CFE_MISSION_ES_POOL_MAX_BUCKETS; ++Idx)
{
CFE_ES_GenPoolGetBucketUsage(&PoolRecPtr->Pool, NumBuckets,
&BufPtr->BlockStats[Idx]);
Expand Down
9 changes: 3 additions & 6 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -1727,10 +1727,10 @@ int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDS_t *data)
{
int32 Status;
const CFE_ES_DeleteCDSCmd_Payload_t *cmd = &data->Payload;
char LocalCdsName[CFE_ES_CDS_MAX_FULL_NAME_LEN];
char LocalCdsName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN];

CFE_SB_MessageStringGet(LocalCdsName, (char *)cmd->CdsName, NULL,
CFE_ES_CDS_MAX_FULL_NAME_LEN, sizeof(cmd->CdsName));
CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN, sizeof(cmd->CdsName));

Status = CFE_ES_DeleteCDS(LocalCdsName, false);

Expand Down Expand Up @@ -1874,14 +1874,11 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data)
if ( CFE_ES_CDSBlockRecordIsUsed(RegRecPtr) )
{
/* Fill CDS Registry Dump Record with relevant information */
memset(&DumpRecord, 0, sizeof(DumpRecord));
DumpRecord.Size = CFE_ES_CDSBlockRecordGetUserSize(RegRecPtr);
DumpRecord.Handle = CFE_ES_CDSBlockRecordGetID(RegRecPtr);
DumpRecord.Table = RegRecPtr->Table;
DumpRecord.ByteAlignSpare1 = 0;

/* strncpy will zero out any unused buffer - memset not necessary */
strncpy(DumpRecord.Name, RegRecPtr->Name, sizeof(DumpRecord.Name)-1);
DumpRecord.Name[sizeof(DumpRecord.Name)-1] = 0;

/* Output Registry Dump Record to Registry Dump File */
Status = OS_write(FileDescriptor,
Expand Down
4 changes: 2 additions & 2 deletions fsw/cfe-core/src/es/cfe_es_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@
#if ((CFE_MISSION_ES_CDS_MAX_NAME_LENGTH % 4) != 0)
#error CFE_MISSION_ES_CDS_MAX_NAME_LENGTH must be a multiple of 4
#endif
#if ((CFE_MISSION_ES_CDS_MAX_NAME_LEN % 4) != 0)
#error CFE_MISSION_ES_CDS_MAX_NAME_LEN must be a multiple of 4
#if ((CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN % 4) != 0)
#error CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN must be a multiple of 4
#endif


Expand Down
Loading

0 comments on commit 398471a

Please sign in to comment.