Skip to content

Commit

Permalink
Fix nasa#909, reorganize ES public API + msg definitions
Browse files Browse the repository at this point in the history
Put all ES typedefs which are shared across API and telemetry
messages into the "cfe_es_extern_typedefs.h" file.

Put all ES typedefs which define the telemetry interface
into the "cfe_es_msg.h" file.  Also include structures which
define the output of commands that write data files into this
group (query all apps, query all tasks, query all CDS).

Removes some localized definitions and replace with MISSION
scope definitions where appropriate/necessary.
  • Loading branch information
jphickey committed Oct 26, 2020
1 parent 3077251 commit e6296e6
Show file tree
Hide file tree
Showing 10 changed files with 324 additions and 234 deletions.
21 changes: 21 additions & 0 deletions 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
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 @@ -1544,7 +1544,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_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_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
4 changes: 2 additions & 2 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -1680,10 +1680,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_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_NAME_LEN, sizeof(cmd->CdsName));

Status = CFE_ES_DeleteCDS(LocalCdsName, false);

Expand Down
Loading

0 comments on commit e6296e6

Please sign in to comment.