From 3aacc3105344f3541b021e7a6461f91c88f87bc9 Mon Sep 17 00:00:00 2001 From: Alan Cudmore Date: Wed, 25 Nov 2020 11:43:29 -0500 Subject: [PATCH 01/10] Fix #914 - Add toolchain file for RTEMS 5.1/pc-rtems --- .../toolchain-i686-rtems4.11.cmake | 3 +- cmake/sample_defs/toolchain-i686-rtems5.cmake | 83 +++++++++++++++++++ 2 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 cmake/sample_defs/toolchain-i686-rtems5.cmake diff --git a/cmake/sample_defs/toolchain-i686-rtems4.11.cmake b/cmake/sample_defs/toolchain-i686-rtems4.11.cmake index dd6d091b2..fb0945629 100644 --- a/cmake/sample_defs/toolchain-i686-rtems4.11.cmake +++ b/cmake/sample_defs/toolchain-i686-rtems4.11.cmake @@ -42,8 +42,7 @@ SET(CMAKE_AR "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ar") SET(CMAKE_OBJDUMP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objdump") SET(CMAKE_OBJCOPY "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objcopy") -# Note that CEXP is not a shared library loader - it will not support code compiled with -fPIC -# Also exception handling is very iffy. These two options disable eh_frame creation. +# Exception handling is very iffy. These two options disable eh_frame creation. set(CMAKE_C_COMPILE_OPTIONS_PIC -fno-exceptions -fno-asynchronous-unwind-tables) # search for programs in the build host directories diff --git a/cmake/sample_defs/toolchain-i686-rtems5.cmake b/cmake/sample_defs/toolchain-i686-rtems5.cmake new file mode 100644 index 000000000..6c2205a73 --- /dev/null +++ b/cmake/sample_defs/toolchain-i686-rtems5.cmake @@ -0,0 +1,83 @@ +# This example toolchain file describes the cross compiler to use for +# the target architecture indicated in the configuration file. + +# In this sample application, the cross toolchain is configured to +# use a compiler for the RTEMS operating system targeting the "pc686" BSP + +# Note that to use this, the "RTEMS" platform module may need to be added +# to the system-wide CMake installation as a default CMake does not yet +# recognize RTEMS as a system name. An example of this is distributed with +# the pc-rtems PSP. + +# Basic cross system configuration +set(CMAKE_SYSTEM_NAME RTEMS) +set(CMAKE_SYSTEM_PROCESSOR i386) +set(CMAKE_SYSTEM_VERSION 5) + +# The TOOLS and BSP are allowed to be installed in different locations. +# If the README was followed they will both be installed under $HOME +# By default it is assumed the BSP is installed to the same directory as the tools +SET(RTEMS_TOOLS_PREFIX "$ENV{HOME}/rtems-${CMAKE_SYSTEM_VERSION}" CACHE PATH + "RTEMS tools install directory") +SET(RTEMS_BSP_PREFIX "${RTEMS_TOOLS_PREFIX}" CACHE PATH + "RTEMS BSP install directory") + +# The BSP that will be used for this build +set(RTEMS_BSP "pc686") + +# specify the cross compiler - adjust accord to compiler installation +# This uses the compiler-wrapper toolchain that buildroot produces +SET(SDKHOSTBINDIR "${RTEMS_TOOLS_PREFIX}/bin") +set(TARGETPREFIX "${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}-") +set(RTEMS_BSP_C_FLAGS "-march=i686 -mtune=i686 -fno-common") +set(RTEMS_BSP_CXX_FLAGS ${RTEMS_BSP_C_FLAGS}) + + +SET(CMAKE_C_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}gcc") +SET(CMAKE_CXX_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}g++") +SET(CMAKE_LINKER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ld") +SET(CMAKE_ASM_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}as") +SET(CMAKE_STRIP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}strip") +SET(CMAKE_NM "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}nm") +SET(CMAKE_AR "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ar") +SET(CMAKE_OBJDUMP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objdump") +SET(CMAKE_OBJCOPY "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objcopy") + +# Exception handling is very iffy. These two options disable eh_frame creation. +set(CMAKE_C_COMPILE_OPTIONS_PIC -fno-exceptions -fno-asynchronous-unwind-tables) + +# Link libraries needed for an RTEMS 5.x executable +# This was handled by the bsp_specs file in 4.11 +set(LINK_LIBRARIES "-lrtemsdefaultconfig -lrtemsbsp -lrtemscpu") + +# search for programs in the build host directories +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + +# for libraries and headers in the target directories +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +SET(CMAKE_PREFIX_PATH /) + +# these settings are specific to cFE/OSAL and determines which +# abstraction layers are built when using this toolchain +SET(CFE_SYSTEM_PSPNAME pc-rtems) +SET(OSAL_SYSTEM_BSPTYPE pc-rtems) +SET(OSAL_SYSTEM_OSTYPE rtems) + +# This is for RTEMS 5 specific ifdefs needed by the OSAL +ADD_DEFINITIONS(-D_RTEMS_5_) + +# Info regarding the RELOCADDR: +#+--------------------------------------------------------------------------+ +#| Set the value of RELOCADDR to the address where you want your image to +#| load. If you'll be using GRUB to load the images it will have to be >= +#| 0x100000 (1024K). If you are using NetBoot to load the images it can be +#| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory +#| top is of course another limit. Make sure there is enough space before the +#| upper memory limits for the image and the memory allocated by it to fit. +#| Make sure the value you choose is aligned to 4 bytes. +#+--------------------------------------------------------------------------+ +set(RTEMS_RELOCADDR 0x00100000) + + From 1f8f082f0695a0776a7c4784fc1f1d8337a99737 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 18 Nov 2020 11:23:27 -0500 Subject: [PATCH 02/10] Fix #1021, use void* for pool buffer pointers Using void* instead of uint32* here makes the interface easier to use and may avoid some nuisance alignment warnings. --- fsw/cfe-core/src/es/cfe_es_mempool.c | 11 ++++---- fsw/cfe-core/src/inc/cfe_es.h | 34 ++++++++++++++++++++++--- fsw/cfe-core/src/sb/cfe_sb_api.c | 16 ++++++------ fsw/cfe-core/src/sb/cfe_sb_buf.c | 8 +++--- fsw/cfe-core/src/sb/cfe_sb_task.c | 6 ++--- fsw/cfe-core/src/tbl/cfe_tbl_api.c | 4 +-- fsw/cfe-core/src/tbl/cfe_tbl_internal.c | 2 +- fsw/cfe-core/unit-test/es_UT.c | 20 +++++++-------- fsw/cfe-core/ut-stubs/ut_es_stubs.c | 12 ++++----- 9 files changed, 70 insertions(+), 43 deletions(-) diff --git a/fsw/cfe-core/src/es/cfe_es_mempool.c b/fsw/cfe-core/src/es/cfe_es_mempool.c index 9ccda8337..1f32588dd 100644 --- a/fsw/cfe-core/src/es/cfe_es_mempool.c +++ b/fsw/cfe-core/src/es/cfe_es_mempool.c @@ -390,7 +390,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) ** Purpose: ** CFE_ES_GetPoolBuf allocates a block from the memory pool. */ -int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, +int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t Handle, size_t Size ) { @@ -444,9 +444,8 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, } - /* Compute the actual buffer address. - * It is returned as uint32* for historical reasons. */ - *BufPtr = (uint32*)(PoolRecPtr->BaseAddr + DataOffset); + /* Compute the actual buffer address. */ + *BufPtr = CFE_ES_MEMPOOLBUF_C(PoolRecPtr->BaseAddr + DataOffset); return (int32)Size; } @@ -455,7 +454,7 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, ** CFE_ES_GetPoolBufInfo gets the size of the specified block (if it exists). */ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, - uint32 * BufPtr) + CFE_ES_MemPoolBuf_t BufPtr) { int32 Status; CFE_ES_MemPoolRecord_t *PoolRecPtr; @@ -509,7 +508,7 @@ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, ** CFE_ES_putPoolBuf returns a block back to the memory pool. */ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, - uint32 * BufPtr) + CFE_ES_MemPoolBuf_t BufPtr) { CFE_ES_MemPoolRecord_t *PoolRecPtr; size_t DataSize; diff --git a/fsw/cfe-core/src/inc/cfe_es.h b/fsw/cfe-core/src/inc/cfe_es.h index 28457d0bf..244a76510 100644 --- a/fsw/cfe-core/src/inc/cfe_es.h +++ b/fsw/cfe-core/src/inc/cfe_es.h @@ -175,6 +175,34 @@ typedef union CFE_ES_PoolAlign */ #define CFE_ES_STATIC_POOL_TYPE(size) union { CFE_ES_PoolAlign_t Align; uint8 Data[size]; } +/** + * @brief Pointer type used for memory pool API + * + * This is used in the Get/Put API calls to refer to a pool buffer. + * + * This pointer is expected to be type cast to the real object + * type after getting a new buffer. Using void* allows this + * type conversion to occur easily. + * + * @note Older versions of CFE implemented the API using a uint32*, + * which required explicit type casting everywhere it was called. + * Although the API type is now void* to make usage easier, the + * pool buffers are aligned to machine requirements - typically 64 bits. + */ +typedef void* CFE_ES_MemPoolBuf_t; + +/** + * @brief Conversion macro to create buffer pointer from another type + * + * In cases where the actual buffer pointer is computed, this macro + * aids in converting the computed address (typically an OSAL "cpuaddr" + * type) into a buffer pointer. + * + * @note Any address calculation needs to take machine alignment + * requirements into account. + */ +#define CFE_ES_MEMPOOLBUF_C(x) ((CFE_ES_MemPoolBuf_t)(x)) + /*****************************************************************************/ /* ** Exported Functions @@ -1508,7 +1536,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID); ** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_GetPoolBufInfo ** ******************************************************************************/ -int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size); +int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size); /*****************************************************************************/ /** @@ -1532,7 +1560,7 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size) ** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_PutPoolBuf ** ******************************************************************************/ -CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, uint32 *BufPtr); +CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr); /*****************************************************************************/ /** @@ -1554,7 +1582,7 @@ CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, uint32 *BufPtr); ** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_GetPoolBufInfo ** ******************************************************************************/ -int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, uint32 *BufPtr); +int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr); /*****************************************************************************/ /** diff --git a/fsw/cfe-core/src/sb/cfe_sb_api.c b/fsw/cfe-core/src/sb/cfe_sb_api.c index c7f2dbbe1..e1c6570ef 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_api.c +++ b/fsw/cfe-core/src/sb/cfe_sb_api.c @@ -1597,7 +1597,7 @@ CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, CFE_SB_LockSharedData(__func__,__LINE__); /* Allocate a new zero copy descriptor from the SB memory pool.*/ - stat1 = CFE_ES_GetPoolBuf((uint32 **)&zcd, CFE_SB.Mem.PoolHdl, sizeof(CFE_SB_ZeroCopyD_t)); + stat1 = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t*)&zcd, CFE_SB.Mem.PoolHdl, sizeof(CFE_SB_ZeroCopyD_t)); if(stat1 < 0){ CFE_SB_UnlockSharedData(__func__,__LINE__); return NULL; @@ -1611,10 +1611,10 @@ CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, }/* end if */ /* Allocate a new buffer (from the SB memory pool) to hold the message */ - stat1 = CFE_ES_GetPoolBuf((uint32 **)&bd, CFE_SB.Mem.PoolHdl, MsgSize + sizeof(CFE_SB_BufferD_t)); + stat1 = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t*)&bd, CFE_SB.Mem.PoolHdl, MsgSize + sizeof(CFE_SB_BufferD_t)); if((stat1 < 0)||(bd==NULL)){ /*deallocate the first buffer if the second buffer creation fails*/ - stat1 = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, (uint32 *)zcd); + stat1 = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, zcd); if(stat1 > 0){ CFE_SB.StatTlmMsg.Payload.MemInUse-=stat1; } @@ -1680,7 +1680,7 @@ int32 CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, { int32 Status; int32 Stat2; - cpuaddr Addr = (cpuaddr)Ptr2Release; + CFE_ES_MemPoolBuf_t BufAddr; Status = CFE_SB_ZeroCopyReleaseDesc(Ptr2Release, BufferHandle); @@ -1688,8 +1688,8 @@ int32 CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, if(Status == CFE_SUCCESS){ /* give the buffer back to the buffer pool */ - Stat2 = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, - (uint32 *) (Addr - sizeof(CFE_SB_BufferD_t))); + BufAddr = CFE_ES_MEMPOOLBUF_C((cpuaddr)Ptr2Release - sizeof(CFE_SB_BufferD_t)); + Stat2 = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, BufAddr); if(Stat2 > 0){ /* Substract the size of the actual buffer from the Memory in use ctr */ CFE_SB.StatTlmMsg.Payload.MemInUse-=Stat2; @@ -1735,7 +1735,7 @@ int32 CFE_SB_ZeroCopyReleaseDesc(CFE_MSG_Message_t *Ptr2Release, CFE_SB_LockSharedData(__func__,__LINE__); - Stat = CFE_ES_GetPoolBufInfo(CFE_SB.Mem.PoolHdl, (uint32 *)zcd); + Stat = CFE_ES_GetPoolBufInfo(CFE_SB.Mem.PoolHdl, zcd); if((Ptr2Release == NULL) || (Stat < 0) || (zcd->Buffer != (void *)Ptr2Release)){ CFE_SB_UnlockSharedData(__func__,__LINE__); @@ -1754,7 +1754,7 @@ int32 CFE_SB_ZeroCopyReleaseDesc(CFE_MSG_Message_t *Ptr2Release, } /* give the descriptor back to the buffer pool */ - Stat = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, (uint32 *)zcd); + Stat = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, zcd); if(Stat > 0){ /* Substract the size of the actual buffer from the Memory in use ctr */ CFE_SB.StatTlmMsg.Payload.MemInUse-=Stat; diff --git a/fsw/cfe-core/src/sb/cfe_sb_buf.c b/fsw/cfe-core/src/sb/cfe_sb_buf.c index 966f16125..e213a12e6 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_buf.c +++ b/fsw/cfe-core/src/sb/cfe_sb_buf.c @@ -63,7 +63,7 @@ CFE_SB_BufferD_t * CFE_SB_GetBufferFromPool(CFE_SB_MsgId_t MsgId, size_t Size) { CFE_SB_BufferD_t *bd = NULL; /* Allocate a new buffer descriptor from the SB memory pool.*/ - stat1 = CFE_ES_GetPoolBuf((uint32 **)&bd, CFE_SB.Mem.PoolHdl, Size + sizeof(CFE_SB_BufferD_t)); + stat1 = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t*)&bd, CFE_SB.Mem.PoolHdl, Size + sizeof(CFE_SB_BufferD_t)); if(stat1 < 0){ return NULL; } @@ -144,7 +144,7 @@ int32 CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd){ int32 Stat; /* give the buf descriptor back to the buf descriptor pool */ - Stat = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, (uint32 *)bd); + Stat = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, bd); if(Stat > 0){ CFE_SB.StatTlmMsg.Payload.SBBuffersInUse--; /* Substract the size of a buffer descriptor from the Memory in use ctr */ @@ -212,7 +212,7 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestinationBlk(void) CFE_SB_DestinationD_t *Dest = NULL; /* Allocate a new destination descriptor from the SB memory pool.*/ - Stat = CFE_ES_GetPoolBuf((uint32 **)&Dest, CFE_SB.Mem.PoolHdl, sizeof(CFE_SB_DestinationD_t)); + Stat = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t*)&Dest, CFE_SB.Mem.PoolHdl, sizeof(CFE_SB_DestinationD_t)); if(Stat < 0){ return NULL; } @@ -250,7 +250,7 @@ int32 CFE_SB_PutDestinationBlk(CFE_SB_DestinationD_t *Dest) }/* end if */ /* give the destination block back to the SB memory pool */ - Stat = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, (uint32 *)Dest); + Stat = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, Dest); if(Stat > 0){ /* Substract the size of the destination block from the Memory in use ctr */ CFE_SB.StatTlmMsg.Payload.MemInUse-=Stat; diff --git a/fsw/cfe-core/src/sb/cfe_sb_task.c b/fsw/cfe-core/src/sb/cfe_sb_task.c index 825475770..a6aff96e2 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_task.c +++ b/fsw/cfe-core/src/sb/cfe_sb_task.c @@ -144,7 +144,7 @@ void CFE_SB_TaskMain(void) int32 CFE_SB_AppInit(void){ uint32 CfgFileEventsToFilter = 0; - uint32 *TmpPtr = NULL; + CFE_ES_MemPoolBuf_t TmpPtr; int32 Status; Status = CFE_ES_RegisterApp(); @@ -278,7 +278,7 @@ int32 CFE_SB_AppInit(void){ /* Ensure a ground commanded reset does not get blocked if SB mem pool */ /* becomes fully configured (DCR6772) */ - Status = CFE_ES_GetPoolBuf((uint32 **)&TmpPtr, CFE_SB.Mem.PoolHdl, + Status = CFE_ES_GetPoolBuf(&TmpPtr, CFE_SB.Mem.PoolHdl, sizeof(CFE_ES_Restart_t)); if(Status < 0){ @@ -288,7 +288,7 @@ int32 CFE_SB_AppInit(void){ /* Return mem block used on previous call,the actual memory is not needed.*/ /* The SB mem pool is now configured with a block size for the reset cmd. */ - Status = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, (uint32 *)TmpPtr); + Status = CFE_ES_PutPoolBuf(CFE_SB.Mem.PoolHdl, TmpPtr); if(Status < 0){ CFE_ES_WriteToSysLog("SB:Init error, PutPool Failed:RC=0x%08X\n",(unsigned int)Status); diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_api.c b/fsw/cfe-core/src/tbl/cfe_tbl_api.c index 32e7176fe..7d261ec31 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_api.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_api.c @@ -255,7 +255,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, RegRecPtr->UserDefAddr = false; /* Allocate the memory buffer(s) for the table and inactive table, if necessary */ - Status = CFE_ES_GetPoolBuf((uint32 **)&RegRecPtr->Buffers[0].BufferPtr, + Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[0].BufferPtr, CFE_TBL_TaskData.Buf.PoolHdl, Size); if(Status < 0) @@ -281,7 +281,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, ((Status & CFE_SEVERITY_BITMASK) != CFE_SEVERITY_ERROR)) { /* Allocate memory for the dedicated secondary buffer */ - Status = CFE_ES_GetPoolBuf((uint32 **)&RegRecPtr->Buffers[1].BufferPtr, + Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[1].BufferPtr, CFE_TBL_TaskData.Buf.PoolHdl, Size); if(Status < 0) diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c index d86234bb8..e2ae1cb99 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c @@ -169,7 +169,7 @@ int32 CFE_TBL_EarlyInit (void) do { /* Allocate memory for shared load buffers */ - Status = CFE_ES_GetPoolBuf((uint32 **)&CFE_TBL_TaskData.LoadBuffs[j].BufferPtr, + Status = CFE_ES_GetPoolBuf(&CFE_TBL_TaskData.LoadBuffs[j].BufferPtr, CFE_TBL_TaskData.Buf.PoolHdl, CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE); diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index 8d12e8a06..2398e35bc 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -6038,8 +6038,8 @@ void TestESMempool(void) CFE_ES_MemHandle_t PoolID2; /* Poo1 2 handle, with mutex */ uint8 Buffer1[1024]; uint8 Buffer2[1024]; - uint32 *addressp1 = NULL; /* Pool 1 buffer address */ - uint32 *addressp2 = NULL; /* Pool 2 buffer address */ + CFE_ES_MemPoolBuf_t addressp1 = CFE_ES_MEMPOOLBUF_C(0); /* Pool 1 buffer address */ + CFE_ES_MemPoolBuf_t addressp2 = CFE_ES_MEMPOOLBUF_C(0); /* Pool 2 buffer address */ CFE_ES_MemPoolRecord_t *PoolPtr; CFE_ES_MemPoolStats_t Stats; size_t BlockSizes[CFE_PLATFORM_ES_POOL_MAX_BUCKETS+2]; @@ -6085,12 +6085,12 @@ void TestESMempool(void) /* Test successfully allocating a pool buffer */ UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf((uint32 **) &addressp1, PoolID1, 256) > 0, + CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [1]; successful"); UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf((uint32 **) &addressp2, PoolID2, 256) > 0, + CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [2]; successful"); @@ -6195,7 +6195,7 @@ void TestESMempool(void) /* Test returning a pool buffer using an invalid memory block */ UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, - addressp2 - 10) == CFE_ES_BUFFER_NOT_IN_POOL, + CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)) == CFE_ES_BUFFER_NOT_IN_POOL, "CFE_ES_PutPoolBuf", "Invalid memory block"); @@ -6361,12 +6361,12 @@ void TestESMempool(void) * subsequent tests */ UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf((uint32 **) &addressp1, PoolID1, 256) > 0, + CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf((uint32 **) &addressp2, PoolID2, 256) > 0, + CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); @@ -6481,12 +6481,12 @@ void TestESMempool(void) * subsequent tests */ UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf((uint32 **) &addressp1, PoolID1, 256) > 0, + CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf((uint32 **) &addressp2, PoolID2, 256) > 0, + CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); @@ -6602,7 +6602,7 @@ void TestESMempool(void) /* Test getting the size of a pool buffer that is not in the pool */ UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, - (uint32 *) addressp1 + 100) == + CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)) == CFE_ES_BUFFER_NOT_IN_POOL, "CFE_ES_GetPoolBufInfo", "Invalid pool buffer"); diff --git a/fsw/cfe-core/ut-stubs/ut_es_stubs.c b/fsw/cfe-core/ut-stubs/ut_es_stubs.c index 6bd242975..6f7ad94e7 100644 --- a/fsw/cfe-core/ut-stubs/ut_es_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_es_stubs.c @@ -451,7 +451,7 @@ int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) ** value (0xffffffff if Size exceeds maximum value allowed). ** ******************************************************************************/ -int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size) +int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetPoolBuf), BufPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBuf), PoolID); @@ -504,7 +504,7 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size) if (PositionEnd <= PoolSize) { - *BufPtr = (uint32 *)BufAddrStart; + *BufPtr = CFE_ES_MEMPOOLBUF_C(BufAddrStart); memset((void*)BufAddrStart, 0x55, Size); /* @@ -690,10 +690,10 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) ** Returns either a user-defined status flag, 16, or -1. ** ******************************************************************************/ -int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, uint32 *BufPtr) +int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PutPoolBuf), PoolID); - UT_Stub_RegisterContext(UT_KEY(CFE_ES_PutPoolBuf), BufPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_PutPoolBuf), BufPtr); int32 status; @@ -722,10 +722,10 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, uint32 *BufPtr) ** Returns either a user-defined status flag or 16. ** ******************************************************************************/ -int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, uint32 *BufPtr) +int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBufInfo), PoolID); - UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetPoolBufInfo), BufPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBufInfo), BufPtr); int32 status; From 9eea99ad1ec2c86120fb5e1facdbf9312f82e51f Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 30 Nov 2020 10:28:46 -0500 Subject: [PATCH 03/10] Fix #1009, Alignment pattern - documentation - Documentation updates for applying the alignment pattern - Added Cmd to all command types - Updated example code - Converted Syslog to SysLog for consistency - CFE_SB_RcvMsg now CFE_SB_ReceiveBuffer - Replaced references to deprecated CFE_SB API's with MSG API's --- docs/cFE Application Developers Guide.md | 194 ++++++++++++----------- docs/src/cfe_api.dox | 8 +- docs/src/cfe_es.dox | 2 +- docs/src/cfe_sb.dox | 74 +++++---- 4 files changed, 138 insertions(+), 140 deletions(-) diff --git a/docs/cFE Application Developers Guide.md b/docs/cFE Application Developers Guide.md index 9b8c177af..ee89071da 100644 --- a/docs/cFE Application Developers Guide.md +++ b/docs/cFE Application Developers Guide.md @@ -1080,21 +1080,17 @@ void SAMPLE_TaskMain(void) /* ** Wait for the next Software Bus message */ - Status = CFE_SB_RcvMsg( &SAMPLE_TaskData.MsgPtr, - SAMPLE_TaskData.CmdPipe, - CFE_SB_PEND_FOREVER ); + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, SAMPLE_TaskData.CmdPipe, CFE_SB_PEND_FOREVER); if (Status == CFE_SUCCESS) { /* ** Process Software Bus message */ - SAMPLE_TaskPipe(CFE_TBL_TaskData.MsgPtr); + SAMPLE_TaskPipe(SBBufPtr); /* Update Critical Data Store */ - CFE_ES_CopyToCDS(SAMPLE_TaskData.MyCDSHandle, - &SAMPLE_MyCDSDataType_t); - + CFE_ES_CopyToCDS(SAMPLE_TaskData.MyCDSHandle, &SAMPLE_MyCDSDataType_t); } } CFE_EVS_SendEvent(CFE_TBL_EXIT_ERR_EID, CFE_EVS_ERROR, @@ -1216,7 +1212,7 @@ FILE: xx_app.c void XX_AppMain(void) { uint32 RunStatus = CFE_ES_RunStatus_APP_RUN; - CFE_MSG_Message_t *MsgPtr; + CFE_SB_Buffer_t *SBBufPtr; int32 Result = CFE_SUCCESS; /* Register application */ @@ -1250,7 +1246,7 @@ void XX_AppMain(void) CFE_ES_PerfLogExit(XX_APPMAIN_PERF_ID); /* Wait for the next Software Bus message */ - Result = CFE_SB_RcvMsg(&MsgPtr, XX_GlobalData.CmdPipe, CFE_SB_PEND_FOREVER); + Result = CFE_SB_ReceiveBuffer(&SBBufPtr, XX_GlobalData.CmdPipe, CFE_SB_PEND_FOREVER); /* Performance Log (start time counter) */ CFE_ES_PerfLogEntry(XX_APPMAIN_PERF_ID); @@ -1258,7 +1254,7 @@ void XX_AppMain(void) if (Result == CFE_SUCCESS) { /* Process Software Bus message */ - XX_ProcessPkt(MsgPtr); + XX_ProcessPkt(SBBufPtr); } else { @@ -1612,7 +1608,7 @@ FILE: sample_app.h */ typedef struct { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + CFE_MSG_TelemetryHeader_t TlmHeader; /* ** Task command interface counters... @@ -1646,17 +1642,17 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */ int32 Status; ... - Status = CFE_MSG_Init(&SAMPLE_AppData.HkPacket, /* Address of SB Message Data Buffer */ - SAMPLE_HK_TLM_MID, /* SB Message ID associated with Data */ - sizeof(SAMPLE_HkPacket_t)); /* Size of Buffer */ + Status = CFE_MSG_Init(&SAMPLE_AppData.HkPacket.TlmHeader.Msg, /* Address of SB Message Data Buffer */ + SAMPLE_HK_TLM_MID, /* SB Message ID associated with Data */ + sizeof(SAMPLE_AppData.HkPacket)); /* Size of Buffer */ ... } ``` In this example, the Developer has allocated space for the SB Message -header in their structure using the CFE_SB_TLM_HDR_SIZE macro. If +header in their structure using the CFE_MSG_TelemetryHeader_t type. If the SB Message was to be a command message, it would have been important -for the Developer to have used the CFE_SB_CMD_HDR_SIZE macro +for the Developer to have used the CFE_MSG_CommandHeader_t macro instead. The CFE_MSG_Init API call formats the Message Header @@ -1671,38 +1667,44 @@ of the Application's interface. This makes it much simpler to port the Application to another mission where SB Message IDs may need to be renumbered. -##### 6.5.1 Software Bus Message Header Types +##### 6.5.1 Message Header Types -The SB support two main types of headers: command headers and telemetry -headers. In the CCSDS implementation of the SB, the command and telemetry +The Message module supports two main types of headers: command headers and telemetry +headers. In the CCSDS implementation, the command and telemetry headers share the same CCSDS primary header structure but have different secondary header structures. The secondary header structures are -shown below. Note that all SB messages must have a secondary header. +shown below. Note that all messages must have a secondary header, a message +containing just a CFE_MSG_Message_t is invalid per the CCSDS standard. ``` -typedef struct { +typedef struct +{ - uint16 Command; /* command secondary header */ - /* bits shift ------------ description ---------------- */ - /* 0x00FF 0 : checksum, calculated by ground system */ - /* 0x7F00 8 : command function code */ - /* 0x8000 15 : reserved, set to 0 */ + uint8 FunctionCode; /**< \brief Command Function Code */ + /* bits shift ---------description-------- */ + /* 0x7F 0 Command function code */ + /* 0x80 7 Reserved */ -} CCSDS_CmdSecHdr_t; + uint8 Checksum; /**< \brief Command checksum (all bits, 0xFF) */ -typedef struct { +} CFE_MSG_CommandSecondaryHeader_t; - uint8 Time[CCSDS_TIME_SIZE]; +/** + * \brief cFS telemetry secondary header + */ +typedef struct +{ -} CCSDS_TlmSecHdr_t; + uint8 Time[6]; /**< \brief Time, big endian: 4 byte seconds, 2 byte subseconds */ +} CFE_MSG_TelemetrySecondaryHeader_t; ``` -The sizes of command and telemetry message headers are defined by -CFE_SB_CMD_HDR_SIZE and CFE_SB_TLM_HDR_SIZE respectively. +The sizes of command and telemetry message headers can be calculated using +sizeof(CFE_MSG_CommandHeader_t) and sizeof(CFE_MSG_TelemetryHeader_t) respectively. -It is important to note that some SB API calls assume the presence of a -particular header type and will not work properly if the other header type +It is important to note that some API calls require the presence of a +particular header type and will return an error if the other header type is present instead. The following section provides more detail. ##### 6.5.2 Setting Message Header Information @@ -1714,14 +1716,14 @@ functions are only applicable to a specific header type. Additional information on modifying specific header types is provided in the following subsections. -| **SB Message Header Field** | **API for Modifying the Header Field** | **Applicability** | -| ---------------------------:| --------------------------------------:| -------------------:| -| Message ID | CFE_MSG_SetMsgId | Command & Telemetry | -| Total Message Length | CFE_MSG_SetSize | Command & Telemetry | -| Command Code | CFE_MSG_SetFcnCode | Command Only | -| Checksum | CFE_MSG_GenerateChecksum | Command Only | -| Time | CFE_SB_TimeStampMsg | Telemetry Only | -| Time | CFE_MSG_SetMsgTime | Telemetry Only | +| **SB Message Header Field** | **API for Modifying the Header Field** | +| ---------------------------:| --------------------------------------:| +| Message ID | CFE_MSG_SetMsgId | +| Total Message Length | CFE_MSG_SetSize | +| Command Code | CFE_MSG_SetFcnCode | +| Checksum | CFE_MSG_GenerateChecksum | +| Time | CFE_SB_TimeStampMsg | +| Time | CFE_MSG_SetMsgTime | Applications shall always use these functions to manipulate the Message Header. The structure of the Message Header may change from @@ -1760,12 +1762,12 @@ Applications are portable to future missions. The following table identifies the fields of the Message Header and the appropriate API for extracting that field from the header: -| **SB Message Header Field** | **API for Reading the Header Field** | **Applicability** | -|:----------------------------|:-------------------------------------|:--------------------| -| Message ID | CFE_MSG_GetMsgId | Command & Telemetry | -| Message Time | CFE_MSG_GetTime | Imp. Dependent | -| Total Message Length | CFE_MSG_GetSize | Command & Telemetry | -| Command Code | CFE_MSG_GetFcnCode | Command Only | +| **SB Message Header Field** | **API for Reading the Header Field** | +|:----------------------------|:-------------------------------------| +| Message ID | CFE_MSG_GetMsgId | +| Message Time | CFE_MSG_GetTime | +| Total Message Length | CFE_MSG_GetSize | +| Command Code | CFE_MSG_GetFcnCode | There are other APIs based on selected implementation. The full list is available in the user's guide. @@ -1783,9 +1785,8 @@ The preference is to use the actual packet structure when available. #### 6.6 Sending Software Bus Messages After an SB message has been created (see Section 6.5) and its contents -have been set to the appropriate values, the application can call -CFE_SB_SendMsg() to send the message on the SB. An example of this is -shown below: +have been set to the appropriate values, the application can then +send the message on the SB. An example of this is shown below: ``` FILE: sample_app.c @@ -1795,23 +1796,23 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */ ... { ... - /* - ** Get command execution counters and put them into housekeeping SB Message - */ - SAMPLE_AppData.HkPacket.CmdCounter = SAMPLE_AppData.CmdCounter; - SAMPLE_AppData.HkPacket.ErrCounter = SAMPLE_AppData.ErrCounter; + /* + ** Get command execution counters... + */ + SAMPLE_APP_Data.HkTlm.Payload.CommandErrorCounter = SAMPLE_APP_Data.ErrCounter; + SAMPLE_APP_Data.HkTlm.Payload.CommandCounter = SAMPLE_APP_Data.CmdCounter; - /* - ** Send housekeeping SB Message after time tagging it with current time - */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &SAMPLE_AppData.HkPacket); - CFE_SB_SendMsg((CFE_MSG_Message_t *) &SAMPLE_AppData.HkPacket); + /* + ** Send housekeeping telemetry packet... + */ + CFE_SB_TimeStampMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg); + CFE_SB_TransmitMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, true); ... } ``` #### 6.7 Receiving Software Bus Messages -To receive a SB Message, an application calls CFE_SB_RcvMsg. Since most +To receive a SB Message, an application calls CFE_SB_ReceiveBuffer. Since most applications are message-driven, this typically occurs in an application's main execution loop. An example of this is shown below. @@ -1821,7 +1822,6 @@ FILE: sample_app.h typedef struct { ... - CFE_MSG_Message_t *MsgPtr; CFE_SB_PipeId_t CmdPipe; ... } SAMPLE_AppData_t; @@ -1830,13 +1830,15 @@ typedef struct FILE: sample_app.c { + ... + CFE_SB_Buffer_t *SBBufPtr; ... while (TRUE) { /* ** Wait for the next Software Bus message... */ - SB_Status = CFE_SB_RcvMsg(&SAMPLE_AppData.MsgPtr, + SB_Status = CFE_SB_ReceiveBuffer(&SBBufPtr, SAMPLE_AppData.CmdPipe, CFE_SB_PEND_FOREVER); @@ -1845,7 +1847,7 @@ FILE: sample_app.c /* ** Process Software Bus message... */ - SAMPLE_AppPipe(SAMPLE_AppData.MsgPtr); + SAMPLE_AppPipe(SBBufPtr); } } } @@ -1853,7 +1855,7 @@ FILE: sample_app.c In the above example, the Application will pend on the SAMPLE_AppData.CmdPipe until an SB Message arrives. A pointer to the next SB -Message in the Pipe will be returned in SAMPLE_AppData.MsgPtr. +message in the Pipe will be returned in SBBufPtr. Alternatively, the Application could have chosen to pend with a timeout (by providing a numerical argument in place of CFE_SB_PEND_FOREVER) or to quickly @@ -1862,7 +1864,7 @@ CFE_SB_PEND_FOREVER). If a SB Message fails to arrive within the specified timeout period, the cFE will return the CFE_SB_TIME_OUT status code. If the Pipe does not have -any data present when the CFE_SB_RcvMsg API is called, the cFE will return +any data present when the CFE_SB_ReceiveBuffer API is called, the cFE will return a CFE_SB_NO_MESSAGE status code. After a message is received, the SB Message Header accessor functions (as @@ -1870,35 +1872,32 @@ described in Section 6.5.3) should be used to identify the message so that the application can react to it appropriately. -#### 6.8 Improving Message Transfer Performance for Large SB Messages +#### 6.8 Improving Message Transfer Performance for Large Messages Occasionally, there is a need for large quantities of data to be passed between Applications that are on the same processor (e.g.- Science data analysis and/or compression algorithms along with the science data -acquisition Application). The drawback to using the standard -communication protocol described above is that SB Messages are copied -from the sending Application data space into the SB data space. If the -copy is too time consuming, the Developer can choose to implement a +acquisition Application). The drawback to using CFE_SB_TransmitMsg +is that the message is copied into a SB Buffer. If the +copy is too time consuming, the Developer can choose to utilize the "Zero Copy" protocol. -The first step in implementing the "Zero Copy" protocol, is to acquire a -data space that can be shared between the two Applications. This is -accomplished with the CFE_SB_ZeroCopyGetPtr API call. The -CFE_SB_ZeroCopyGetPtr function returns a pointer to an area of memory -that can contain the desired SB Message. +The application can request a buffer from SB utilizing +CFE_SB_ZeroCopyGetPtr, then write the message data directly to the +buffer that can be sent directly (without a copy) by SB. -Once an Application has formatted and filled the SB Message with the -appropriate data, the Application calls the CFE_SB_ZeroCopySend API. +Once an Application has formatted and filled the SB buffer with the +appropriate data, transmit the buffer using CFE_SB_TransmitBuffer. The SB then identifies the Application(s) that have subscribed to this -data and places a pointer to the SB Message Buffer in their Pipe(s). -**The pointer to the SB Message is no longer valid once the Application -calls the CFE_SB_ZeroCopySend API.** Applications should not -assume the SB Message Buffer pointer is accessible once the SB Message +data and places a pointer to the SB Buffer in their Pipe(s). +**The pointer to the SB Buffer is no longer valid once the Application +calls the CFE_SB_TransmitBuffer API.** Applications should not +assume the SB Buffer pointer is accessible once the buffer has been sent. If an Application has called the CFE_SB_ZeroCopyGetPtr API call and then later determines that it is not going to send the SB Message, it -shall free the allocated SB Message space by calling the +shall free the allocated buffer by calling the CFE_SB_ZeroCopyReleasePtr API. An example of the "Zero Copy" protocol is shown below: @@ -1920,7 +1919,7 @@ FILE: sample_app.h */ typedef struct { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + CFE_MSG_CommandHeader_t TlmHeader; /* ** Task command interface counters... @@ -1929,14 +1928,17 @@ typedef struct } SAMPLE_BigPkt_t; -/* Define Msg Length for SAMPLE’s Big Pkt */ -#define SAMPLE_BIGPKT_MSGLEN sizeof(SAMPLE_BigPkt_t) +typedef union +{ + CFE_SB_Buffer_t SBBuf; + SAMPLE_BigPkt_t Pkt; +} SAMPLE_BigPkt_Buffer_t; + ... typedef struct { ... - ... - SAMPLE_BigPkt_t *BigPktPtr; /* Declare instance of Big Packet */ + SAMPLE_BigPkt_Buffer_t *BigPktBuf; /* Declare instance of Big Packet */ ... } SAMPLE_AppData_t; @@ -1949,10 +1951,10 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */ /* ** Get a SB Message block of memory and initialize it */ - SAMPLE_AppData.BigPktPtr = (SAMPLE_BigPkt_t *)CFE_SB_ZeroCopyGetPtr(SAMPLE_BIGPKT_MSGLEN); - CFE_MSG_Init((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr, - SAMPLE_BIG_TLM_MID, - SAMPLE_BIGPKT_MSGLEN); + SAMPLE_AppData.BigPktBuf = (SAMPLE_BigPkt_Buffer_t *)CFE_SB_ZeroCopyGetPtr(sizeof(SAMPLE_BigPkt_t), + &BufferHandle); + CFE_MSG_Init(SAMPLE_AppData.BigPktBuf->Pkt.TlmHeader.Msg, SAMPLE_BIG_TLM_MID, + sizeof(SAMPLE_AppData.BigPktBuf->Pkt); /* ** ...Fill Packet with Data... @@ -1961,9 +1963,9 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */ /* ** Send SB Message after time tagging it with current time */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr); - CFE_SB_ZeroCopySend((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr); - /* SAMPLE_AppData.BigPktPtr is no longer a valid pointer */ + CFE_SB_TimeStampMsg(&SAMPLE_AppData.BigPktBuf->Pkt.TlmHeader.Msg); + CFE_SB_TransmitBuffer(SAMPLE_AppData.BigPktBuf, BufferHandle, true); + /* SAMPLE_AppData.BigPktBuf is no longer a valid pointer */ ... } ``` diff --git a/docs/src/cfe_api.dox b/docs/src/cfe_api.dox index 1203383d5..cfeafb50b 100644 --- a/docs/src/cfe_api.dox +++ b/docs/src/cfe_api.dox @@ -133,16 +133,14 @@
  • \ref CFEAPISBMessage
      -
    • #CFE_SB_SendMsg - \copybrief CFE_SB_SendMsg -
    • #CFE_SB_PassMsg - \copybrief CFE_SB_PassMsg -
    • #CFE_SB_RcvMsg - \copybrief CFE_SB_RcvMsg +
    • #CFE_SB_TransmitMsg - \copybrief CFE_SB_TransmitMsg +
    • #CFE_SB_ReceiveBuffer - \copybrief CFE_SB_ReceiveBuffer
  • \ref CFEAPISBZeroCopy
    • #CFE_SB_ZeroCopyGetPtr - \copybrief CFE_SB_ZeroCopyGetPtr
    • #CFE_SB_ZeroCopyReleasePtr - \copybrief CFE_SB_ZeroCopyReleasePtr -
    • #CFE_SB_ZeroCopySend - \copybrief CFE_SB_ZeroCopySend -
    • #CFE_SB_ZeroCopyPass - \copybrief CFE_SB_ZeroCopyPass +
    • #CFE_SB_TransmitBuffer - \copybrief CFE_SB_TransmitBuffer
  • \ref CFEAPISBSetMessage
      diff --git a/docs/src/cfe_es.dox b/docs/src/cfe_es.dox index 3faa02440..b08bf4073 100644 --- a/docs/src/cfe_es.dox +++ b/docs/src/cfe_es.dox @@ -304,7 +304,7 @@ the startup script. The format of the Start Application command, is defined in the - structure #CFE_ES_StartApp_t. The members of the structure + structure #CFE_ES_StartAppCmd_t. The members of the structure include, application name, entry point, filename, stack size, load address, exception action and priority. diff --git a/docs/src/cfe_sb.dox b/docs/src/cfe_sb.dox index bf1587eab..f81601122 100644 --- a/docs/src/cfe_sb.dox +++ b/docs/src/cfe_sb.dox @@ -166,7 +166,7 @@ buffer descriptor (CFE_SB_BufferD_t) and one for the size of the packet. Both buffers are returned to the pool when the message has been received by all recipients. More precisely, if there is one recipient for a message, the message buffers will be released - on the following call to cFE_SB_RcvMsg for the pipe that received the message. + on the following call to CFE_SB_ReceiveBuffer for the pipe that received the buffer. Also when subscriptions are received through the subscribe API's, the software bus allocates a subscription block (CFE_SB_DestinationD_t) from the pool. The subscription @@ -292,20 +292,21 @@ The sequence counter for command messages is not altered by the software bus. - For telemetry messages sent with the #CFE_SB_SendMsg API, the software bus populates the packet sequence - header field for all messages. The first time a telemetry message is sent with a new Message ID, - the sequence counter field in the header is set to a value of one. For subsequent - sends of a message, the sequence counter is incremented by one regardless of the number of - destinations for the packet. After a rollover condition the sequence counter will be a - value of zero for one instance. The sequence counter is incremented in the #CFE_SB_SendMsg - API after all the checks have passed prior to the actual sending of the message. This - includes the parameter checks and the memory allocation check. - Note: The count is incremented regardless of whether there are any subscribers. - - For telemetry messages sent with the #CFE_SB_PassMsg API the sequence counter is not incremented. - This method of message delivery is recommended for situations - where the sender did not generate the packet, such as a network interface application - passing a packet from a remote system to the local software bus. + For a telemetry message, the behavior is controlled via input parameters or API selection + when sending the command. When enabled, the software bus will populate the packet sequence + counter using an internal counter that gets intialized upon the first subscription to the + message (first message will have a packet sequence counter value of 1). From that point on + each send request will increment the counter by one, regardless of the number of destinations + or if there is an active subscription. + + After a rollover condition the sequence counter will be a value of zero for one instance. + The sequence counter is incremented after all the checks have passed prior to the actual + sending of the message. This includes the parameter checks and the memory allocation check. + + When disabled, the original message will not be altered. This method of message delivery + is recommended for situations where the sender did not generate the packet, + such as a network interface application passing a packet from a remote system to the local + software bus. Next: \ref cfesbugmsgpipeerr
      Prev: \ref cfesbugrouting
      @@ -369,15 +370,14 @@ There is one case in which events are filtered by the software bus instead of event services. This occurs when the software bus needs to suppress events so that a fatal recursive event - condition does not transpire. Because the #CFE_SB_SendMsg API is a library function that - calls #CFE_EVS_SendEvent, and #CFE_EVS_SendEvent is a library function that calls #CFE_SB_SendMsg, + condition does not transpire. Because error cases encountered when sending a message generate + an event, and events cause a message to be sent a calling sequence could cause a stack overflow if the recursion is not properly terminated. The cFE software bus detects this condition and properly terminates the recursion. This is done by using a set of flags (one flag per event in the Send API) which determine whether - an API has relinquished its stack. If the #CFE_SB_SendMsg needs to send an event that may - cause recursion, the flag is set and the event is sent. #CFE_EVS_SendEvent then calls #CFE_SB_SendMsg - in the same thread. If the second call to #CFE_SB_SendMsg needs to send that same event again, - it finds that the flag is set and the #CFE_EVS_SendEvent call is bypassed, terminating the + an API has relinquished its stack. If the software bus needs to send an event that may + cause recursion, the flag is set and the event is sent. If sending the event would cause + the same event again, the event call will be bypassed, terminating the recursion. The result is that the user will see only one event instead of the many events that would normally occur without the protection. The heritage software bus did not have this condition because it stored events in the software bus event log and another thread @@ -508,31 +508,29 @@ How many copies of the message are performed in a typical message delivery?   There is a single copy of the message performed during a typical delivery. - During the #CFE_SB_SendMsg API, the software bus copies the message from the - callers memory space to the software bus memory space. The #CFE_SB_RcvMsg API - gives the user a pointer to the message in the software bus memory space. This + When transmitting a message, the software bus copies the message from the + callers memory space into a buffer in the software bus memory space. + The #CFE_SB_ReceiveBuffer API gives the user back a pointer to the buffer. This is equivalent to the copy mode send and pointer mode receive in the heritage software bus used on WMAP, ST5, SDO etc. (Q) - When does the software bus free the message buffer during a typical message - delivery process? Or how long is the message, and the pointer to the message - in the #CFE_SB_RcvMsg valid? + When does the software bus free the buffer during a typical message + delivery process? Or how long is the message, and the pointer to the buffer + in the #CFE_SB_ReceiveBuffer valid?   - After receiving a message by calling #CFE_SB_RcvMsg, the message received stays - in the software bus memory until the next call to #CFE_SB_RcvMsg with the same - Pipe Id. This means that the message pointer given by the software bus to the - caller of #CFE_SB_RcvMsg is valid until the next call to #CFE_SB_RcvMsg with the - same pipe id. If the caller needs the message longer than the next call to - #CFE_SB_RcvMsg, the caller must copy the message to its memory space. + After receiving a buffer by calling #CFE_SB_ReceiveBuffer, the buffer received is valid + until the next call to #CFE_SB_ReceiveBuffer with the same Pipe Id. + If the caller needs the message longer than the next call to + #CFE_SB_ReceiveBuffer, the caller must copy the message to its memory space. (Q) - The first parameter in the #CFE_SB_RcvMsg API is a pointer to a pointer which + The first parameter in the #CFE_SB_ReceiveBuffer API is a pointer to a pointer which can get confusing. How can I be sure that the correct address is given for this parameter.   - Typically a caller declares a ptr of type CFE_MSG_Message_t (i.e. CFE_MSG_Message_t *Ptr) + Typically a caller declares a ptr of type CFE_SB_Buffer_t (i.e. CFE_SB_Buffer_t *Ptr) then gives the address of that pointer (&Ptr) as this parameter. After a successful - call to #CFE_SB_RcvMsg, Ptr will point to the first byte of the software bus message - header. This should be used as a read-only pointer. In systems with an MMU, writes + call to #CFE_SB_ReceiveBuffer, Ptr will point to the first byte of the software bus + buffer. This should be used as a read-only pointer. In systems with an MMU, writes to this pointer may cause a memory protection fault. (Q) Why am I not seeing expected Message Limit error events or Pipe Overflow events? @@ -569,7 +567,7 @@ will ensure seamless integration when the software bus is expanded to support inter-processor communication. (Q) - Can I confirm my software bus message was delivered? + Can I confirm my software bus buffer was delivered?   There is no built in mechanism for confirming delivery (it could span systems). This could be accomplished by generating a response message from the receiver. From 7a30cbe2bbf231692ffbbb90c0f53028998e0b80 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 30 Nov 2020 10:36:03 -0500 Subject: [PATCH 04/10] Fix #1009, Alignment pattern - Msg module updates - CFE_MSG_Message_t no longer worst case alignment - CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t now contain the base message type, CFE_MSG_Message_t - Fixed size type issue in CFE_MSG_ComputeChecksum - Replaced CFE_SB_TlmHdr_t and CFE_SB_CmdHdr_t with CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t --- .../msg/mission_inc/default_cfe_msg_hdr_pri.h | 27 +++++---- .../mission_inc/default_cfe_msg_hdr_priext.h | 27 +++++---- modules/msg/src/cfe_msg_sechdr_checksum.c | 2 +- .../test_cfe_msg_checksum.c | 6 +- .../msg/unit-test-coverage/test_cfe_msg_fc.c | 10 ++-- .../unit-test-coverage/test_cfe_msg_init.c | 55 ++++++++++--------- .../unit-test-coverage/test_cfe_msg_time.c | 10 ++-- 7 files changed, 68 insertions(+), 69 deletions(-) diff --git a/modules/msg/mission_inc/default_cfe_msg_hdr_pri.h b/modules/msg/mission_inc/default_cfe_msg_hdr_pri.h index d422106db..0e8558d5d 100644 --- a/modules/msg/mission_inc/default_cfe_msg_hdr_pri.h +++ b/modules/msg/mission_inc/default_cfe_msg_hdr_pri.h @@ -54,14 +54,23 @@ typedef struct CCSDS_PrimaryHeader_t Pri; /**< \brief CCSDS Primary Header */ } CCSDS_SpacePacket_t; +/** + * \brief cFS generic base message + */ +typedef union +{ + CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ + uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */ +} CFE_MSG_Message_t; + /** * \brief cFS command header */ typedef struct { - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */ - CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */ + CFE_MSG_Message_t Msg; /**< \brief Base message */ + CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */ } CFE_MSG_CommandHeader_t; @@ -71,19 +80,9 @@ typedef struct typedef struct { - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */ - CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */ + CFE_MSG_Message_t Msg; /**< \brief Base message */ + CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */ } CFE_MSG_TelemetryHeader_t; -/** - * \brief cFS Generic packet header - */ -typedef union -{ - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ - uint32 Align; /**< \brief Force 32-bit alignment */ - uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */ -} CFE_MSG_Message_t; - #endif /* _cfe_msg_hdr_ */ diff --git a/modules/msg/mission_inc/default_cfe_msg_hdr_priext.h b/modules/msg/mission_inc/default_cfe_msg_hdr_priext.h index 652925269..aa401bd8b 100644 --- a/modules/msg/mission_inc/default_cfe_msg_hdr_priext.h +++ b/modules/msg/mission_inc/default_cfe_msg_hdr_priext.h @@ -55,14 +55,23 @@ typedef struct CCSDS_ExtendedHeader_t Ext; /**< \brief CCSDS Extended Header */ } CCSDS_SpacePacket_t; +/** + * \brief cFS generic base message + */ +typedef union +{ + CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ + uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */ +} CFE_MSG_Message_t; + /** * \brief cFS command header */ typedef struct { - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */ - CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */ + CFE_MSG_Message_t Msg; /**< \brief Base message */ + CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */ } CFE_MSG_CommandHeader_t; @@ -72,19 +81,9 @@ typedef struct typedef struct { - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */ - CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */ + CFE_MSG_Message_t Msg; /**< \brief Base message */ + CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */ } CFE_MSG_TelemetryHeader_t; -/** - * \brief cFS Generic packet header - */ -typedef union -{ - CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */ - uint32 Align; /**< \brief Force 32-bit alignment */ - uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */ -} CFE_MSG_Message_t; - #endif /* _cfe_msg_hdr_ */ diff --git a/modules/msg/src/cfe_msg_sechdr_checksum.c b/modules/msg/src/cfe_msg_sechdr_checksum.c index ceb8ef0b9..a958250ab 100644 --- a/modules/msg/src/cfe_msg_sechdr_checksum.c +++ b/modules/msg/src/cfe_msg_sechdr_checksum.c @@ -35,7 +35,7 @@ CFE_MSG_Checksum_t CFE_MSG_ComputeCheckSum(const CFE_MSG_Message_t *MsgPtr) { - uint32 PktLen = 0; + CFE_MSG_Size_t PktLen = 0; const uint8 * BytePtr = MsgPtr->Byte; CFE_MSG_Checksum_t chksum = 0xFF; diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c b/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c index b4bdfe7f0..304b171df 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_checksum.c @@ -36,9 +36,9 @@ void Test_MSG_Checksum(void) { - CFE_SB_CmdHdr_t cmd; - CFE_MSG_Message_t *msgptr = (CFE_MSG_Message_t *)&cmd; - bool actual; + CFE_MSG_CommandHeader_t cmd; + CFE_MSG_Message_t *msgptr = &cmd.Msg; + bool actual; UtPrintf("Bad parameter tests, Null pointers"); memset(&cmd, 0, sizeof(cmd)); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_fc.c b/modules/msg/unit-test-coverage/test_cfe_msg_fc.c index 56f6c851d..664fa4b1e 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_fc.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_fc.c @@ -41,11 +41,11 @@ void Test_MSG_FcnCode(void) { - CFE_SB_CmdHdr_t cmd; - CFE_MSG_Message_t *msgptr = (CFE_MSG_Message_t *)&cmd; - CFE_MSG_FcnCode_t input[] = {0, TEST_FCNCODE_MAX / 2, TEST_FCNCODE_MAX}; - CFE_MSG_FcnCode_t actual = TEST_FCNCODE_MAX; - int i; + CFE_MSG_CommandHeader_t cmd; + CFE_MSG_Message_t *msgptr = &cmd.Msg; + CFE_MSG_FcnCode_t input[] = {0, TEST_FCNCODE_MAX / 2, TEST_FCNCODE_MAX}; + CFE_MSG_FcnCode_t actual = TEST_FCNCODE_MAX; + int i; UtPrintf("Bad parameter tests, Null pointers, invalid (max valid + 1, max)"); memset(&cmd, 0, sizeof(cmd)); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_init.c b/modules/msg/unit-test-coverage/test_cfe_msg_init.c index 33964762e..143ab6548 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_init.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_init.c @@ -43,7 +43,7 @@ void Test_MSG_Init(void) { - CFE_MSG_Message_t msg; + CFE_MSG_CommandHeader_t cmd; CFE_MSG_Size_t size; CFE_SB_MsgId_Atom_t msgidval_exp; CFE_SB_MsgId_t msgid_act; @@ -54,28 +54,28 @@ void Test_MSG_Init(void) bool is_v1; UtPrintf("Bad parameter tests, Null pointer, invalid size, invalid msgid"); - ASSERT_EQ(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(msg)), CFE_MSG_BAD_ARGUMENT); - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(0), 0), CFE_MSG_BAD_ARGUMENT); - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(msg)), + ASSERT_EQ(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + ASSERT_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(0), 0), CFE_MSG_BAD_ARGUMENT); + ASSERT_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(-1), sizeof(msg)), CFE_MSG_BAD_ARGUMENT); + ASSERT_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(-1), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); UtPrintf("Set to all F's, msgid value = 0"); - memset(&msg, 0xFF, sizeof(msg)); + memset(&cmd, 0xFF, sizeof(cmd)); msgidval_exp = 0; - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, 0); - ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid_act), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd)), CFE_SUCCESS); + Test_MSG_PrintMsg(&cmd.Msg, 0); + ASSERT_EQ(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); - ASSERT_EQ(CFE_MSG_GetSize(&msg, &size), CFE_SUCCESS); - ASSERT_EQ(size, sizeof(msg)); - ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&msg, &segflag), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetSize(&cmd.Msg, &size), CFE_SUCCESS); + ASSERT_EQ(size, sizeof(cmd)); + ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag), CFE_SUCCESS); ASSERT_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); - ASSERT_EQ(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); - ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS); - ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetApId(&cmd.Msg, &apid), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec), CFE_SUCCESS); /* A zero msgid will set hassec to false for v1 */ is_v1 = !hassec; @@ -92,25 +92,25 @@ void Test_MSG_Init(void) } /* Confirm the rest of the fields not already explicitly checked */ - ASSERT_EQ(Test_MSG_Pri_NotZero(&msg) & ~(MSG_APID_FLAG | MSG_HDRVER_FLAG | MSG_HASSEC_FLAG), + ASSERT_EQ(Test_MSG_Pri_NotZero(&cmd.Msg) & ~(MSG_APID_FLAG | MSG_HDRVER_FLAG | MSG_HASSEC_FLAG), MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); UtPrintf("Set to all 0, max msgid value"); - memset(&msg, 0, sizeof(msg)); + memset(&cmd, 0, sizeof(cmd)); msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, 0); - ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid_act), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd)), CFE_SUCCESS); + Test_MSG_PrintMsg(&cmd.Msg, 0); + ASSERT_EQ(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); - ASSERT_EQ(CFE_MSG_GetSize(&msg, &size), CFE_SUCCESS); - ASSERT_EQ(size, sizeof(msg)); - ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&msg, &segflag), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetSize(&cmd.Msg, &size), CFE_SUCCESS); + ASSERT_EQ(size, sizeof(cmd)); + ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag), CFE_SUCCESS); ASSERT_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); - ASSERT_EQ(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); - ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS); - ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetApId(&cmd.Msg, &apid), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec), CFE_SUCCESS); ASSERT_EQ(hassec, true); if (!is_v1) { @@ -123,5 +123,6 @@ void Test_MSG_Init(void) ASSERT_EQ(hdrver, 0); } - ASSERT_EQ(Test_MSG_Pri_NotZero(&msg) & ~MSG_HDRVER_FLAG, MSG_APID_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG | MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); + ASSERT_EQ(Test_MSG_Pri_NotZero(&cmd.Msg) & ~MSG_HDRVER_FLAG, MSG_APID_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG | + MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); } diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_time.c b/modules/msg/unit-test-coverage/test_cfe_msg_time.c index c3ca7e312..cb57d372f 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_time.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_time.c @@ -36,11 +36,11 @@ void Test_MSG_Time(void) { - CFE_SB_TlmHdr_t tlm; - CFE_MSG_Message_t *msgptr = (CFE_MSG_Message_t *)&tlm; - CFE_TIME_SysTime_t input[] = {{0, 0}, {0x12345678, 0xABCDEF12}, {0xFFFFFFFF, 0xFFFFFFFF}}; - CFE_TIME_SysTime_t actual = {0xFFFFFFFF, 0xFFFFFFFF}; - int i; + CFE_MSG_TelemetryHeader_t tlm; + CFE_MSG_Message_t *msgptr = &tlm.Msg; + CFE_TIME_SysTime_t input[] = {{0, 0}, {0x12345678, 0xABCDEF12}, {0xFFFFFFFF, 0xFFFFFFFF}}; + CFE_TIME_SysTime_t actual = {0xFFFFFFFF, 0xFFFFFFFF}; + int i; UtPrintf("Bad parameter tests, Null pointers, no secondary header"); memset(&tlm, 0, sizeof(tlm)); From 2af337198722c70294454a7b081e80d52ac870d1 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 30 Nov 2020 10:43:52 -0500 Subject: [PATCH 05/10] Fix #1009, Alignment pattern - stub updates - Using CFE_SB_Buffer_t where appropriate - Replaced CFE_SB_CMD_HDR_SIZE and CFE_SB_TLM_HDR_SIZE with sizeof the appropriate type - Deprecated CFE_SB_SendMsg, CFE_SB_RcvMsg stubs - Added CFE_SB_TransmitBuffer, CFE_SB_TransmitMsg, and CFE_SB_ReceiveBuffer stubs --- fsw/cfe-core/ut-stubs/ut_sb_stubs.c | 154 ++++++++++++++++++++++------ 1 file changed, 125 insertions(+), 29 deletions(-) diff --git a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c index a5bff2103..f527c873c 100644 --- a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c @@ -282,7 +282,6 @@ int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName) if (status >= 0) { - /* TODO: add GetPipeName */ if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetPipeIdByName), (uint8*)PipeIdPtr, sizeof(*PipeIdPtr)) == sizeof(*PipeIdPtr)) { status = CFE_SUCCESS; @@ -403,7 +402,6 @@ void CFE_SB_InitMsg(void *MsgPtr, UT_Stub_CopyToLocal(UT_KEY(CFE_SB_InitMsg), (uint8*)MsgPtr, Length); } } -#endif /* CFE_OMIT_DEPRECATED_6_8 */ /*****************************************************************************/ /** @@ -418,10 +416,10 @@ void CFE_SB_InitMsg(void *MsgPtr, ** None ** ** \returns -** Returns CFE_SUCCESS on the first call, then -1 on the second. +** Returns CFE_SUCCESS or overridden unit test value ** ******************************************************************************/ -int32 CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, +int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut) { @@ -430,27 +428,124 @@ int32 CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_RcvMsg), TimeOut); int32 status; - static union + + status = UT_DEFAULT_IMPL(CFE_SB_RcvMsg); + + if (status >= 0) { - CFE_MSG_Message_t Msg; - uint8 Ext[CFE_MISSION_SB_MAX_SB_MSG_SIZE]; - } Buffer; + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_RcvMsg), (uint8*)BufPtr, sizeof(*BufPtr)); + } + return status; +} - status = UT_DEFAULT_IMPL(CFE_SB_RcvMsg); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ + +/*****************************************************************************/ +/** +** \brief CFE_SB_ReceiveBuffer stub function +** +** \par Description +** This function is used to mimic the response of the cFE SB function +** CFE_SB_ReceiveBuffer. By default it will return the TIMEOUT error response, +** unless the test setup sequence has indicated otherwise. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** Returns CFE_SUCCESS or overridden unit test value +** +******************************************************************************/ +int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, + CFE_SB_PipeId_t PipeId, + int32 TimeOut) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_ReceiveBuffer), BufPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ReceiveBuffer), PipeId); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ReceiveBuffer), TimeOut); + + int32 status; + + status = UT_DEFAULT_IMPL(CFE_SB_ReceiveBuffer); if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_RcvMsg), (uint8*)BufPtr, sizeof(*BufPtr)) < sizeof(*BufPtr)) - { - memset(&Buffer, 0, sizeof(Buffer)); - *BufPtr = &Buffer.Msg; - } + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_ReceiveBuffer), (uint8*)BufPtr, sizeof(*BufPtr)); } return status; } +/*****************************************************************************/ +/** +** \brief CFE_SB_TransmitMsg stub function +** +** \par Description +** This function is implements the stub version of the real implementation. +** Adds the message pointer value to the test buffer if status is +** positive +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** Returns CFE_SUCCESS or overridden unit test value +** +******************************************************************************/ +int32 CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_TransmitMsg), MsgPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_TransmitMsg), IncrementSequenceCount); + + int32 status = CFE_SUCCESS; + + status = UT_DEFAULT_IMPL(CFE_SB_TransmitMsg); + + if (status >= 0) + { + UT_Stub_CopyFromLocal(UT_KEY(CFE_SB_TransmitMsg), &MsgPtr, sizeof(MsgPtr)); + } + + return status; +} + +/*****************************************************************************/ +/** +** \brief CFE_SB_TransmitBuffer stub function +** +** \par Description +** This function is implements the stub version of the real implementation. +** Adds the buffer pointer value to the test buffer if status is +** positive +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** Returns CFE_SUCCESS or overridden unit test value +** +******************************************************************************/ +int32 CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t ZeroCopyHandle, + bool IncrementSequenceCount) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_SB_TransmitBuffer), BufPtr); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_TransmitBuffer), ZeroCopyHandle); + UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_TransmitBuffer), IncrementSequenceCount); + + int32 status = CFE_SUCCESS; + + status = UT_DEFAULT_IMPL(CFE_SB_TransmitBuffer); + + if (status >= 0) + { + UT_Stub_CopyFromLocal(UT_KEY(CFE_SB_TransmitBuffer), &BufPtr, sizeof(BufPtr)); + } + + return status; +} + +#ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ /** ** \brief CFE_SB_SendMsg stub function @@ -497,8 +592,6 @@ int32 CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr) return status; } -#ifndef CFE_OMIT_DEPRECATED_6_8 - /*****************************************************************************/ /** ** \brief CFE_SB_SetCmdCode stub function @@ -940,11 +1033,11 @@ void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) BytePtr = (uint8 *)MsgPtr; if ((MsgPtr->Byte[0] & 0x10) != 0) { - HdrSize = CFE_SB_CMD_HDR_SIZE; + HdrSize = sizeof(CFE_MSG_CommandHeader_t); } else { - HdrSize = CFE_SB_TLM_HDR_SIZE; + HdrSize = sizeof(CFE_MSG_TelemetryHeader_t); } Result = (BytePtr + HdrSize); @@ -1082,27 +1175,28 @@ int32 CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) return status; } -CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, CFE_SB_ZeroCopyHandle_t *BufferHandle) +CFE_SB_Buffer_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, CFE_SB_ZeroCopyHandle_t *BufferHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyGetPtr), MsgSize); UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyGetPtr), BufferHandle); int32 status; - CFE_MSG_Message_t *MsgPtr; + CFE_SB_Buffer_t *SBBufPtr = NULL; - MsgPtr = NULL; status = UT_DEFAULT_IMPL(CFE_SB_ZeroCopyGetPtr); + if (status == CFE_SUCCESS) { - UT_Stub_CopyToLocal(UT_KEY(CFE_SB_ZeroCopyGetPtr), &MsgPtr, sizeof(MsgPtr)); + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_ZeroCopyGetPtr), &SBBufPtr, sizeof(SBBufPtr)); } - return MsgPtr; + return SBBufPtr; } -int32 CFE_SB_ZeroCopyPass(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) +#ifndef CFE_OMIT_DEPRECATED_6_8 +int32 CFE_SB_ZeroCopyPass(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { - UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyPass), MsgPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyPass), BufPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyPass), BufferHandle); int32 status; @@ -1111,8 +1205,9 @@ int32 CFE_SB_ZeroCopyPass(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t Buf return status; } +#endif -int32 CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle) +int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyReleasePtr), Ptr2Release); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyReleasePtr), BufferHandle); @@ -1124,9 +1219,10 @@ int32 CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, CFE_SB_ZeroCopyH return status; } -int32 CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) +#ifndef CFE_OMIT_DEPRECATED_6_8 +int32 CFE_SB_ZeroCopySend(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { - UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopySend), MsgPtr); + UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopySend), BufPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopySend), BufferHandle); int32 status; @@ -1135,4 +1231,4 @@ int32 CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t Buf return status; } - +#endif From 95c25e541777ef3a5c1b632703e6a0306faec5d8 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 30 Nov 2020 10:48:59 -0500 Subject: [PATCH 06/10] Fix #1009, Alignment pattern - unit tests - Replaced CFE_SB_SendMsg and CFE_SB_PassMsg with CFE_SB_TransmitMsg - Replaced CFE_SB_ZeroCopySend and CFE_SB_ZeroCopyPass with CFE_SB_TransmitBuffer - Replaced CFE_SB_RcvMsg with CFE_SB_ReceiveBuffer - Used CFE_SB_Buffer_t and CFE_MSG_Message_t where appropriate - Added Cmd to all command types - Changed Syslog to SysLog for consistency - Removed "see also" blocks in documentation, APIs are already grouped and these typically don't add anything useful (simplifies maintenance) --- fsw/cfe-core/unit-test/CMakeLists.txt | 2 +- fsw/cfe-core/unit-test/es_UT.c | 232 +++---- fsw/cfe-core/unit-test/es_UT.h | 77 --- fsw/cfe-core/unit-test/evs_UT.c | 42 +- fsw/cfe-core/unit-test/evs_UT.h | 83 --- fsw/cfe-core/unit-test/sb_UT.c | 912 +++++++++++++------------- fsw/cfe-core/unit-test/sb_UT.h | 142 ++-- fsw/cfe-core/unit-test/tbl_UT.c | 46 +- fsw/cfe-core/unit-test/tbl_UT.h | 12 +- fsw/cfe-core/unit-test/time_UT.c | 36 +- fsw/cfe-core/unit-test/time_UT.h | 71 -- fsw/cfe-core/unit-test/ut_support.c | 21 +- fsw/cfe-core/unit-test/ut_support.h | 2 +- 13 files changed, 727 insertions(+), 951 deletions(-) diff --git a/fsw/cfe-core/unit-test/CMakeLists.txt b/fsw/cfe-core/unit-test/CMakeLists.txt index 7e79e5c69..9df8b60af 100644 --- a/fsw/cfe-core/unit-test/CMakeLists.txt +++ b/fsw/cfe-core/unit-test/CMakeLists.txt @@ -71,7 +71,7 @@ foreach(MODULE ${CFE_CORE_MODULES}) ${UT_COVERAGE_LINK_FLAGS} ut_cfe-core_support ut_cfe-core_stubs - sbr # TODO remove this + sbr # Will be removed when sbr stubs are implemented ut_assert) add_test(${UT_TARGET_NAME}_UT ${UT_TARGET_NAME}_UT) diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index 2398e35bc..ea34716e0 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -2624,23 +2624,26 @@ void TestTask(void) osal_id_t UT_ContextTask; union { - CFE_MSG_Message_t Msg; - CFE_ES_NoArgsCmd_t NoArgsCmd; - CFE_ES_Restart_t RestartCmd; - CFE_ES_StartApp_t StartAppCmd; - CFE_ES_StopApp_t StopAppCmd; - CFE_ES_RestartApp_t RestartAppCmd; - CFE_ES_ReloadApp_t ReloadAppCmd; - CFE_ES_QueryOne_t QueryOneCmd; - CFE_ES_QueryAll_t QueryAllCmd; - CFE_ES_OverWriteSyslog_t OverwriteSysLogCmd; - CFE_ES_WriteSyslog_t WriteSyslogCmd; - CFE_ES_WriteERLog_t WriteERlogCmd; - CFE_ES_SetMaxPRCount_t SetMaxPRCountCmd; - CFE_ES_DeleteCDS_t DeleteCDSCmd; - CFE_ES_SendMemPoolStats_t TlmPoolStatsCmd; - CFE_ES_DumpCDSRegistry_t DumpCDSRegCmd; - CFE_ES_QueryAllTasks_t QueryAllTasksCmd; + CFE_MSG_Message_t Msg; + CFE_ES_NoArgsCmd_t NoArgsCmd; + CFE_ES_ClearSysLogCmd_t ClearSysLogCmd; + CFE_ES_ClearERLogCmd_t ClearERLogCmd; + CFE_ES_ResetPRCountCmd_t ResetPRCountCmd; + CFE_ES_RestartCmd_t RestartCmd; + CFE_ES_StartAppCmd_t StartAppCmd; + CFE_ES_StopAppCmd_t StopAppCmd; + CFE_ES_RestartAppCmd_t RestartAppCmd; + CFE_ES_ReloadAppCmd_t ReloadAppCmd; + CFE_ES_QueryOneCmd_t QueryOneCmd; + CFE_ES_QueryAllCmd_t QueryAllCmd; + CFE_ES_OverWriteSysLogCmd_t OverwriteSysLogCmd; + CFE_ES_WriteSysLogCmd_t WriteSysLogCmd; + CFE_ES_WriteERLogCmd_t WriteERLogCmd; + CFE_ES_SetMaxPRCountCmd_t SetMaxPRCountCmd; + CFE_ES_DeleteCDSCmd_t DeleteCDSCmd; + CFE_ES_SendMemPoolStatsCmd_t SendMemPoolStatsCmd; + CFE_ES_DumpCDSRegistryCmd_t DumpCDSRegistryCmd; + CFE_ES_QueryAllTasksCmd_t QueryAllTasksCmd; } CmdBuf; CFE_ES_AppRecord_t *UtAppRecPtr; CFE_ES_TaskRecord_t *UtTaskRecPtr; @@ -2851,7 +2854,7 @@ void TestTask(void) /* Test cFE restart with bad restart type */ ES_ResetUnitTest(); CmdBuf.RestartCmd.Payload.RestartType = 4524; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_Restart_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_BOOT_ERR_EID), @@ -2870,7 +2873,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(8192); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), @@ -2880,7 +2883,7 @@ void TestTask(void) /* Test app create with an OS task create failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_ERR_EID), @@ -2899,7 +2902,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INVALID_FILENAME_ERR_EID), @@ -2918,7 +2921,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID), @@ -2937,7 +2940,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_NULL_APP_NAME_ERR_EID), @@ -2956,7 +2959,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = 255; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_EXC_ACTION_ERR_EID), @@ -2975,7 +2978,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(0); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), @@ -2994,7 +2997,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 1000; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_PRIORITY_ERR_EID), @@ -3006,7 +3009,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.StopAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.StopAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StopApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_DBG_EID), @@ -3016,7 +3019,7 @@ void TestTask(void) /* Test app stop failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StopApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR1_EID), @@ -3028,7 +3031,7 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); strncpy((char *) CmdBuf.StopAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.StopAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StopApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR2_EID), @@ -3041,7 +3044,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_RestartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_DBG_EID), @@ -3053,7 +3056,7 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); strncpy((char *) CmdBuf.RestartAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_RestartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR2_EID), @@ -3066,7 +3069,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_RestartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR1_EID), @@ -3081,7 +3084,7 @@ void TestTask(void) sizeof(CmdBuf.ReloadAppCmd.Payload.AppFileName)); strncpy((char *) CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_ReloadApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_DBG_EID), @@ -3093,7 +3096,7 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); strncpy((char *) CmdBuf.ReloadAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_ReloadApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR2_EID), @@ -3106,7 +3109,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_ReloadApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR1_EID), @@ -3119,23 +3122,21 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.QueryOneCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryOne_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_APP_EID), "CFE_ES_QueryOneCmd", "Query application - success"); - /* Test telemetry packet request for single app data with failure of - * CFE_SB_SendMsg - */ + /* Test telemetry packet request for single app data with send message failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.QueryOneCmd.Payload.Application)); - UT_SetDeferredRetcode(UT_KEY(CFE_SB_SendMsg), 1, -1); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryOne_t), + UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, -1); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_ERR_EID), @@ -3148,7 +3149,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.QueryOneCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.QueryOneCmd.Payload.Application)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryOne_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_APPID_ERR_EID), @@ -3161,7 +3162,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); strncpy((char *) CmdBuf.QueryAllCmd.Payload.FileName, "AllFilename", sizeof(CmdBuf.QueryAllCmd.Payload.FileName)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), @@ -3171,7 +3172,7 @@ void TestTask(void) /* Test write of all app data to file with a null file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), @@ -3182,7 +3183,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_WRHDR_ERR_EID), @@ -3194,7 +3195,7 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKWR_ERR_EID), @@ -3206,7 +3207,7 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_OSCREATE_ERR_EID), @@ -3217,7 +3218,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAllTasks_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_EID), @@ -3230,7 +3231,7 @@ void TestTask(void) strncpy((char *) CmdBuf.QueryAllTasksCmd.Payload.FileName, "filename", sizeof(CmdBuf.QueryAllTasksCmd.Payload.FileName)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAllTasks_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WRHDR_ERR_EID), @@ -3242,7 +3243,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAllTasks_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WR_ERR_EID), @@ -3253,7 +3254,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAllTasks_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_OSCREATE_ERR_EID), @@ -3263,70 +3264,71 @@ void TestTask(void) /* Test successful clearing of the system log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_ClearSyslog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ClearSysLogCmd), UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG1_INF_EID), - "CFE_ES_ClearSyslogCmd", + "CFE_ES_ClearSysLogCmd", "Clear ES log data"); /* Test successful overwriting of the system log using discard mode */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_OverWriteSyslog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), - "CFE_ES_OverWriteSyslogCmd", + "CFE_ES_OverWriteSysLogCmd", "Overwrite system log received (discard mode)"); /* Test overwriting the system log using an invalid mode */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.OverwriteSysLogCmd.Payload.Mode = 255; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_OverWriteSyslog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERR_SYSLOGMODE_EID), - "CFE_ES_OverWriteSyslogCmd", + "CFE_ES_OverWriteSysLogCmd", "Overwrite system log using invalid mode"); /* Test successful writing of the system log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy((char *) CmdBuf.WriteSyslogCmd.Payload.FileName, "filename", - sizeof(CmdBuf.WriteSyslogCmd.Payload.FileName)); + strncpy((char *) CmdBuf.WriteSysLogCmd.Payload.FileName, "filename", + sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName)); CFE_ES_TaskData.HkPacket.Payload.SysLogEntries = 123; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteSyslog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_EID), - "CFE_ES_WriteSyslogCmd", + "CFE_ES_WriteSysLogCmd", "Write system log; success"); /* Test writing the system log using a null file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CmdBuf.WriteSyslogCmd.Payload.FileName[0] = '\0'; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteSyslog_t), + CmdBuf.WriteSysLogCmd.Payload.FileName[0] = '\0'; + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_EID), - "CFE_ES_WriteSyslogCmd", + "CFE_ES_WriteSysLogCmd", "Write system log; null file name"); /* Test writing the system log with an OS create failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - strncpy((char *) CmdBuf.WriteSyslogCmd.Payload.FileName, "", - sizeof(CmdBuf.WriteSyslogCmd.Payload.FileName)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteSyslog_t), + UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + strncpy((char *) CmdBuf.WriteSysLogCmd.Payload.FileName, "", + sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName)); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_ERR_EID), - "CFE_ES_WriteSyslogCmd", + "CFE_ES_WriteSysLogCmd", "Write system log; OS create"); /* Test writing the system log with an OS write failure */ @@ -3337,29 +3339,29 @@ void TestTask(void) sizeof(CFE_ES_ResetDataPtr->SystemLog), "0000-000-00:00:00.00000 Test Message\n"); CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; - strncpy((char *) CmdBuf.WriteSyslogCmd.Payload.FileName, "", - sizeof(CmdBuf.WriteSyslogCmd.Payload.FileName)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteSyslog_t), + strncpy((char *) CmdBuf.WriteSysLogCmd.Payload.FileName, "", + sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName)); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "CFE_ES_WriteSyslogCmd", + "CFE_ES_WriteSysLogCmd", "Write system log; OS write"); /* Test writing the system log with a write header failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteSyslog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "CFE_ES_WriteSyslogCmd", + "CFE_ES_WriteSysLogCmd", "Write system log; write header"); /* Test successful clearing of the E&R log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_ClearERLog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ClearERLogCmd), UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG1_INF_EID), @@ -3371,10 +3373,10 @@ void TestTask(void) * this just sets a flag for the background task */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.WriteERlogCmd.Payload.FileName, "filename", - sizeof(CmdBuf.WriteERlogCmd.Payload.FileName)); + strncpy(CmdBuf.WriteERLogCmd.Payload.FileName, "filename", + sizeof(CmdBuf.WriteERLogCmd.Payload.FileName)); CFE_ES_TaskData.BackgroundERLogDumpState.IsPending = false; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteERLog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); UT_Report(__FILE__, __LINE__, CFE_ES_TaskData.BackgroundERLogDumpState.IsPending, @@ -3387,7 +3389,7 @@ void TestTask(void) /* sending the same command a second time should fail with an event * indicating a file write is already pending. */ - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_WriteERLog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), @@ -3534,7 +3536,7 @@ void TestTask(void) /* Test resetting and setting the max for the processor reset count */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_ResetPRCount_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ResetPRCountCmd), UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESET_PR_COUNT_EID), @@ -3545,7 +3547,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.SetMaxPRCountCmd.Payload.MaxPRCount = 3; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SetMaxPRCount_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SetMaxPRCountCmd), UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SET_MAX_PR_COUNT_EID), @@ -3560,7 +3562,7 @@ void TestTask(void) strncpy(CmdBuf.DeleteCDSCmd.Payload.CdsName, "CFE_ES.CDS_NAME", sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DeleteCDS_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETE_ERR_EID), @@ -3571,7 +3573,7 @@ void TestTask(void) /* NOTE - reuse command from previous test */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DeleteCDS_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETE_TBL_ERR_EID), @@ -3584,7 +3586,7 @@ void TestTask(void) ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); /* Set up the block to read what we need to from the CDS */ - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DeleteCDS_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETED_INFO_EID), @@ -3595,7 +3597,7 @@ void TestTask(void) ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DeleteCDS_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_OWNER_ACTIVE_EID), @@ -3607,7 +3609,7 @@ void TestTask(void) ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, &UtCDSRegRecPtr); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_BAD", NULL, NULL); CFE_ES_CDSBlockRecordSetFree(UtCDSRegRecPtr); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DeleteCDS_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_NAME_ERR_EID), @@ -3617,7 +3619,7 @@ void TestTask(void) /* Test successful dump of CDS to file using the default dump file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DumpCDSRegistry_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), @@ -3628,7 +3630,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DumpCDSRegistry_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_WRITE_CFE_HDR_ERR_EID), @@ -3639,7 +3641,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DumpCDSRegistry_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CREATING_CDS_DUMP_ERR_EID), @@ -3651,7 +3653,7 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DumpCDSRegistry_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DUMP_ERR_EID), @@ -3661,7 +3663,7 @@ void TestTask(void) /* Test telemetry pool statistics retrieval with an invalid handle */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SendMemPoolStats_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendMemPoolStatsCmd), UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_INVALID_POOL_HANDLE_ERR_EID), @@ -3671,8 +3673,8 @@ void TestTask(void) /* Test successful telemetry pool statistics retrieval */ ES_ResetUnitTest(); ES_UT_SetupMemPoolId(&UtPoolRecPtr); - CmdBuf.TlmPoolStatsCmd.Payload.PoolHandle = CFE_ES_MemPoolRecordGetID(UtPoolRecPtr); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SendMemPoolStats_t), + CmdBuf.SendMemPoolStatsCmd.Payload.PoolHandle = CFE_ES_MemPoolRecordGetID(UtPoolRecPtr); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendMemPoolStatsCmd), UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TLM_POOL_STATS_INFO_EID), @@ -3719,7 +3721,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_POWERON; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_Restart_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_BOOT_ERR_EID), @@ -3751,7 +3753,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_PROC_RESTART; CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(CFE_PLATFORM_ES_DEFAULT_STACK_SIZE); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), @@ -3817,7 +3819,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAll_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), @@ -3839,7 +3841,7 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_QueryAllTasks_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_EID), @@ -3854,7 +3856,7 @@ void TestTask(void) UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_ClearSyslogCmd", + "CFE_ES_ClearSysLogCmd", "Clear system log command; invalid command length"); /* Test sending a request to overwrite the system log with an @@ -3865,7 +3867,7 @@ void TestTask(void) UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_OverwriteSyslogCmd", + "CFE_ES_OverwriteSysLogCmd", "Overwrite system log command; invalid command length"); /* Test sending a request to write the system log with an @@ -3876,18 +3878,18 @@ void TestTask(void) UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_WriteSyslogCmd", + "CFE_ES_WriteSysLogCmd", "Write system log command; invalid command length"); /* Test successful overwriting of the system log using overwrite mode */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_OverWriteSyslog_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), - "CFE_ES_OverWriteSyslogCmd", + "CFE_ES_OverWriteSysLogCmd", "Overwrite system log received (overwrite mode)"); /* Test sending a request to write the error log with an @@ -3951,9 +3953,9 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); - strncpy(CmdBuf.DumpCDSRegCmd.Payload.DumpFilename, "DumpFile", - sizeof(CmdBuf.DumpCDSRegCmd.Payload.DumpFilename)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_DumpCDSRegistry_t), + strncpy(CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename, "DumpFile", + sizeof(CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename)); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), @@ -3965,11 +3967,11 @@ void TestPerf(void) { union { - CFE_MSG_Message_t Msg; - CFE_ES_StartPerfData_t PerfStartCmd; - CFE_ES_StopPerfData_t PerfStopCmd; - CFE_ES_SetPerfFilterMask_t PerfSetFilterMaskCmd; - CFE_ES_SetPerfTriggerMask_t PerfSetTrigMaskCmd; + CFE_MSG_Message_t Msg; + CFE_ES_StartPerfDataCmd_t PerfStartCmd; + CFE_ES_StopPerfDataCmd_t PerfStopCmd; + CFE_ES_SetPerfFilterMaskCmd_t PerfSetFilterMaskCmd; + CFE_ES_SetPerfTriggerMaskCmd_t PerfSetTrigMaskCmd; } CmdBuf; UtPrintf("Begin Test Performance Log"); @@ -4123,7 +4125,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SetPerfFilterMask_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetFilterMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKERR_EID), @@ -4135,7 +4137,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK / 2; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SetPerfFilterMask_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetFilterMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), @@ -4147,7 +4149,7 @@ void TestPerf(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = 0; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SetPerfTriggerMask_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), @@ -4161,7 +4163,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK - 1; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SetPerfTriggerMask_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), @@ -4175,7 +4177,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK + 1; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_SetPerfTriggerMask_t), + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKERR_EID), diff --git a/fsw/cfe-core/unit-test/es_UT.h b/fsw/cfe-core/unit-test/es_UT.h index c33b5546c..307d59841 100644 --- a/fsw/cfe-core/unit-test/es_UT.h +++ b/fsw/cfe-core/unit-test/es_UT.h @@ -82,12 +82,6 @@ ** ** \returns ** This function does not return a value. -** -** \sa #UT_Init, #UT_SetCDSSize, #UT_SetSizeofESResetArea -** \sa #UT_SetStatusBSPResetArea, #UT_SetReadBuffer, #UT_SetRtnCode -** \sa #UT_SetDummyFuncRtn, #UT_SetBSPloadAppFileResult, #CFE_ES_Main -** \sa #UT_Report -** ******************************************************************************/ void TestInit(void); @@ -108,12 +102,6 @@ void TestInit(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_SetRtnCode, #UT_SetOSFail, #CFE_ES_Main, #UT_Report -** \sa #CFE_ES_SetupResetVariables, #UT_SetStatusBSPResetArea -** \sa #UT_SetSizeofESResetArea, #CFE_ES_InitializeFileSystems, #UT_SetBSPFail -** \sa #CFE_ES_CreateObjects -** ******************************************************************************/ void TestStartupErrorPaths(void); @@ -132,14 +120,6 @@ void TestStartupErrorPaths(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_SetReadBuffer, #UT_SetRtnCode, #CFE_ES_StartApplications -** \sa #UT_Report, #UT_SetOSFail, #CFE_ES_ParseFileEntry -** \sa #UT_SetBSPloadAppFileResult, #CFE_ES_AppCreate, #UT_SetDummyFuncRtn -** \sa #CFE_ES_LoadLibrary, #CFE_ES_ScanAppTable, #CFE_ES_ProcessControlRequest -** \sa #CFE_ES_GetAppInfo, #CFE_ES_CleanUpApp -** \sa #CFE_ES_CleanupTaskResources -** ******************************************************************************/ void TestApps(void); @@ -158,9 +138,6 @@ void TestApps(void); ** ** \returns ** This function does not return a value. -** -** \sa #CFE_ES_WriteToERLog, #UT_Report -** ******************************************************************************/ void TestERLog(void); @@ -178,19 +155,6 @@ void TestERLog(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_SetRtnCode, #CFE_ES_TaskMain, #UT_Report, #UT_SetOSFail -** \sa #CFE_ES_TaskInit, #UT_SetSBTotalMsgLen, #UT_SendMsg -** \sa #UT_SetBSPloadAppFileResult, #UT_SetStatusBSPResetArea -** \sa #CFE_ES_HousekeepingCmd, #CFE_ES_NoopCmd, #CFE_ES_ResetCountersCmd -** \sa #CFE_ES_RestartCmd, #CFE_ES_StartAppCmd -** \sa #CFE_ES_StopAppCmd, #CFE_ES_RestartAppCmd, #CFE_ES_ReloadAppCmd -** \sa #CFE_ES_QueryOneCmd, #CFE_ES_QueryAllCmd, #CFE_ES_QueryAllTasksCmd -** \sa #CFE_ES_ClearSyslogCmd, #CFE_ES_OverWriteSyslogCmd -** \sa #CFE_ES_WriteSyslogCmd, #CFE_ES_ClearERLogCmd, #CFE_ES_WriteERLogCmd -** \sa #CFE_ES_ResetPRCountCmd, #CFE_ES_SetMaxPRCountCmd, #CFE_ES_DeleteCDSCmd -** \sa #CFE_ES_DumpCDSRegistryCmd, #CFE_ES_SendMemPoolStatsCmd, #CFE_ES_TaskPipe -** ******************************************************************************/ void TestTask(void); @@ -207,7 +171,6 @@ void TestTask(void); ** ** \returns ** This function does not return a value. -** ******************************************************************************/ void TestBackground(void); @@ -224,13 +187,6 @@ void TestBackground(void); ** ** \returns ** This function does not return a value. -** -** \sa #CFE_ES_SetupPerfVariables, #UT_Report, #UT_SetRtnCode -** \sa #UT_SetSBTotalMsgLen, #UT_SendMsg, #UT_SetBSPloadAppFileResult -** \sa #CFE_ES_PerfLogDump, #CFE_ES_PerfLogAdd, #CFE_ES_StartPerfDataCmd -** \sa #CFE_ES_StopPerfDataCmd, #CFE_ES_SetPerfFilterMaskCmd -** \sa #CFE_ES_SetPerfTriggerMaskCmd, #CFE_ES_PerfLogDump, #CFE_ES_PerfLogAdd -** ******************************************************************************/ void TestPerf(void); @@ -246,20 +202,6 @@ void TestPerf(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_SetRtnCode, #CFE_ES_ResetCFE, #UT_Report -** \sa #CFE_ES_GetResetType, #CFE_ES_RestartApp, #CFE_ES_ReloadApp -** \sa #CFE_ES_DeleteApp, #CFE_ES_ExitApp, #CFE_ES_RunLoop -** \sa #CFE_ES_RegisterApp, #CFE_ES_GetAppID, #CFE_ES_GetAppName -** \sa #CFE_ES_GetTaskInfo, #CFE_ES_CreateChildTask, #CFE_ES_DeleteChildTask -** \sa #CFE_ES_ExitChildTask, #CFE_ES_RegisterChildTask, #CFE_ES_WriteToSysLog -** \sa #CFE_ES_CalculateCRC, #CFE_ES_WaitForStartupSync, #CFE_ES_ProcessCoreException -** \sa #UT_SetBSPFail, #CFE_ES_RegisterCDS, #CFE_ES_CopyToCDS -** \sa #CFE_ES_RestoreFromCDS, #CFE_ES_LockSharedData, #CFE_ES_UnlockSharedData -** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_GetGenCounterIDByName -** \sa #CFE_ES_DeleteGenCounter, #CFE_ES_IncrementGenCounter -** \sa #CFE_ES_GetGenCount, #CFE_ES_SetGenCount -** ******************************************************************************/ void TestAPI(void); @@ -276,13 +218,6 @@ void TestAPI(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_Report, #CFE_ES_CDS_ValidateAppID -** \sa #UT_SetBSPFail, #CFE_ES_RebuildCDS, #UT_SetRtnCode -** \sa #CFE_ES_InitCDSRegistry, #UT_SetCDSSize, #CFE_ES_CDS_EarlyInit -** \sa #UT_SetCDSBSPCheckValidity, #CFE_ES_ValidateCDS, #UT_SetCDSReadGoodEnd -** \sa #CFE_ES_InitCDSSignatures, #CFE_ES_RebuildCDS, #CFE_ES_DeleteCDS -** ******************************************************************************/ void TestCDS(void); @@ -300,12 +235,6 @@ void TestCDS(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_Report, #CFE_ES_CreateCDSPool -** \sa #CFE_ES_RebuildCDSPool, #UT_SetRtnCode, #UT_SetBSPFail -** \sa #CFE_ES_GetCDSBlock, #CFE_ES_PutCDSBlock, #CFE_ES_CDSBlockWrite -** \sa #CFE_ES_CDSBlockRead -** ******************************************************************************/ void TestCDSMempool(void); @@ -323,12 +252,6 @@ void TestCDSMempool(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_Report, #CFE_ES_PoolCreateNoSem -** \sa #CFE_ES_PoolCreate, #CFE_ES_GetPoolBuf, #CFE_ES_GetPoolBufInfo -** \sa #CFE_ES_PutPoolBuf, #CFE_ES_ValidateHandle, #UT_SetRtnCode -** \sa #CFE_ES_GetMemPoolStats, #CFE_ES_PoolCreateEx, #CFE_ES_PoolCreateNoSem -** ******************************************************************************/ void TestESMempool(void); diff --git a/fsw/cfe-core/unit-test/evs_UT.c b/fsw/cfe-core/unit-test/evs_UT.c index 7a84c2a6e..b68e24efe 100644 --- a/fsw/cfe-core/unit-test/evs_UT.c +++ b/fsw/cfe-core/unit-test/evs_UT.c @@ -231,12 +231,12 @@ static void UT_EVS_DoDispatchCheckEvents_Impl(void *MsgPtr, uint32 MsgSize, EventCapture->EventID = 0xFFFF; SnapshotData.SnapshotBuffer = &EventCapture->EventID; - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &SnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &SnapshotData); UT_CallTaskPipe(CFE_EVS_ProcessCommandPacket, (CFE_MSG_Message_t *)MsgPtr, MsgSize, DispatchId); EventCapture->Count += SnapshotData.Count; /* be sure to clear the hook function since the SnapshotData is going out of scope */ - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), NULL, NULL); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), NULL, NULL); } static void UT_EVS_DoDispatchCheckEvents(void *MsgPtr, uint32 MsgSize, @@ -258,12 +258,12 @@ static void UT_EVS_DoGenericCheckEvents(void (*Func)(void), UT_EVS_EventCapture_ EventCapture->EventID = -1; SnapshotData.SnapshotBuffer = &EventCapture->EventID; - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &SnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &SnapshotData); Func(); EventCapture->Count += SnapshotData.Count; /* be sure to clear the hook function since the SnapshotData is going out of scope */ - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), NULL, NULL); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), NULL, NULL); } /* @@ -910,7 +910,7 @@ void Test_Format(void) int16 EventID[2]; CFE_TIME_SysTime_t time = {0, 0}; - CFE_EVS_SetEventFormatMode_t modecmd; + CFE_EVS_SetEventFormatModeCmd_t modecmd; CFE_EVS_AppNameBitMaskCmd_t appbitcmd; CFE_EVS_PacketID_t CapturedMsg; UT_SoftwareBusSnapshot_Entry_t LongFmtSnapshotData = @@ -981,12 +981,12 @@ void Test_Format(void) UtPrintf("Test for short event sent when configured to do so "); UT_InitData(); UT_SetHookFunction(UT_KEY(CFE_MSG_Init), UT_EVS_MSGInitHook, &MsgData); - UT_SetDataBuffer(UT_KEY(CFE_SB_SendMsg), &MsgSend, sizeof(MsgSend), false); + UT_SetDataBuffer(UT_KEY(CFE_SB_TransmitMsg), &MsgSend, sizeof(MsgSend), false); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Short format check 1"); /* Note implementation initializes both short and long message */ ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_Init)), 2); - ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_SB_SendMsg)), 1); + ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 1); ASSERT_TRUE(CFE_SB_MsgId_Equal(MsgData.MsgId, ShortFmtSnapshotData.MsgId)); ASSERT_TRUE(!CFE_SB_MsgId_Equal(MsgData.MsgId, LongFmtSnapshotData.MsgId)); @@ -1011,7 +1011,7 @@ void Test_Format(void) */ UT_InitData(); memset(&CapturedMsg, 0xFF, sizeof(CapturedMsg)); - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &LongFmtSnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LongFmtSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Long format check (SendEvent)"); EventID[0] = CapturedMsg.EventID; memset(&CapturedMsg, 0xFF, sizeof(CapturedMsg)); @@ -1098,7 +1098,7 @@ void Test_Ports(void) /* Test that ports are enabled by sending a message */ UT_InitData(); - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"); UT_Report(__FILE__, __LINE__, LocalSnapshotData.Count == 1 && @@ -1216,9 +1216,9 @@ void Test_Logging(void) char tmpString[100]; union { - CFE_EVS_NoArgsCmd_t cmd; - CFE_EVS_SetLogMode_t modecmd; - CFE_EVS_WriteLogDataFile_t logfilecmd; + CFE_EVS_NoArgsCmd_t cmd; + CFE_EVS_SetLogModeCmd_t modecmd; + CFE_EVS_WriteLogDataFileCmd_t logfilecmd; } CmdBuf; cpuaddr TempAddr; CFE_ES_ResetData_t *CFE_EVS_ResetDataPtr; @@ -1432,9 +1432,9 @@ void Test_WriteApp(void) { union { - CFE_EVS_NoArgsCmd_t cmd; - CFE_EVS_WriteAppDataFile_t AppDataCmd; - CFE_EVS_AppNameBitMaskCmd_t appbitcmd; + CFE_EVS_NoArgsCmd_t cmd; + CFE_EVS_WriteAppDataFileCmd_t AppDataCmd; + CFE_EVS_AppNameBitMaskCmd_t appbitcmd; } CmdBuf; UtPrintf("Begin Test Write App"); @@ -1964,7 +1964,7 @@ void Test_EventCmd(void) &UT_EVS_EventBuf); LocalSnapshotData.Count = 0; - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_DEBUG, "FAIL : Debug message disabled"); EventCount[0] = LocalSnapshotData.Count; CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAIL : Info message disabled"); @@ -1986,7 +1986,7 @@ void Test_EventCmd(void) UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_DEBUG, "Debug message enabled"); EventCount[0] = LocalSnapshotData.Count; CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Info message enabled"); @@ -2666,8 +2666,8 @@ void Test_Misc(void) { CFE_MSG_Message_t msg; CFE_EVS_NoArgsCmd_t cmd; - CFE_EVS_SetLogMode_t modecmd; - CFE_EVS_WriteLogDataFile_t writelogdatacmd; + CFE_EVS_SetLogModeCmd_t modecmd; + CFE_EVS_WriteLogDataFileCmd_t writelogdatacmd; } PktBuf; CFE_ES_ResourceID_t AppID; @@ -2711,7 +2711,7 @@ void Test_Misc(void) UT_InitData(); CFE_EVS_GlobalData.EVS_TlmPkt.Payload.LogEnabled = true; HK_SnapshotData.Count = 0; - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); UT_CallTaskPipe(CFE_EVS_ProcessCommandPacket, &PktBuf.msg, sizeof(PktBuf.cmd), UT_TPID_CFE_EVS_SEND_HK); UT_Report(__FILE__, __LINE__, @@ -2737,7 +2737,7 @@ void Test_Misc(void) UT_InitData(); CFE_EVS_GlobalData.EVS_TlmPkt.Payload.LogEnabled = false; HK_SnapshotData.Count = 0; - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); UT_CallTaskPipe(CFE_EVS_ProcessCommandPacket, &PktBuf.msg, sizeof(PktBuf.cmd), UT_TPID_CFE_EVS_SEND_HK); UT_Report(__FILE__, __LINE__, diff --git a/fsw/cfe-core/unit-test/evs_UT.h b/fsw/cfe-core/unit-test/evs_UT.h index 8f14832bf..60279984f 100644 --- a/fsw/cfe-core/unit-test/evs_UT.h +++ b/fsw/cfe-core/unit-test/evs_UT.h @@ -70,12 +70,6 @@ ** ** \returns ** This function does not return a value. -** -** \sa UT_InitData, #UT_SetSizeofESResetArea, #UT_SetRtnCode -** \sa #CFE_EVS_EarlyInit, #UT_Report, #CFE_EVS_TaskMain -** \sa #UT_SetStatusBSPResetArea, #UT_SetAppID, #UT_SendMsg -** \sa #UT_SetSBTotalMsgLen -** ******************************************************************************/ void Test_Init(void); @@ -91,12 +85,6 @@ void Test_Init(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetAppID, #UT_Report, #CFE_EVS_Register -** \sa #CFE_EVS_SendEvent, #CFE_EVS_SendTimedEvent, #CFE_EVS_SendEventWithAppID -** \sa #CFE_EVS_ResetFilter, #CFE_EVS_ResetAllFilters, #CFE_EVS_CleanUpApp -** \sa #CFE_EVS_EnableAppEventTypesCmd, #CFE_EVS_DisablePortsCmd -** ******************************************************************************/ void Test_IllegalAppID(void); @@ -112,12 +100,6 @@ void Test_IllegalAppID(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_EVS_Unregister, #UT_Report -** \sa #CFE_EVS_SendEvent, #CFE_EVS_ResetFilter, #CFE_EVS_ResetAllFilters -** \sa #CFE_EVS_SendEventWithAppID, #CFE_EVS_SendTimedEvent -** \sa #CFE_EVS_CleanUpApp, #CFE_EVS_Register -** ******************************************************************************/ void Test_UnregisteredApp(void); @@ -133,11 +115,6 @@ void Test_UnregisteredApp(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_Report, #CFE_EVS_Register -** \sa #UT_SetPutPoolFail, #UT_SetRtnCode, #CFE_EVS_Unregister -** \sa #CFE_EVS_SendEvent, #CFE_ES_GetAppID -** ******************************************************************************/ void Test_FilterRegistration(void); @@ -153,10 +130,6 @@ void Test_FilterRegistration(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_Report, #CFE_EVS_Register -** \sa #CFE_EVS_ResetFilter, #CFE_EVS_ResetAllFilters -** ******************************************************************************/ void Test_FilterReset(void); @@ -174,12 +147,6 @@ void Test_FilterReset(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetSBTotalMsgLen, #UT_SendMsg, #UT_Report -** \sa #CFE_EVS_SendEvent, #UT_SetRtnCode, #CFE_EVS_SendTimedEvent -** \sa #CFE_EVS_SendEventWithAppID, #CFE_EVS_EnableAppEventTypesCmd -** \sa #CFE_EVS_SetEventFormatModeCmd -** ******************************************************************************/ void Test_Format(void); @@ -195,11 +162,6 @@ void Test_Format(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetRtnCode, #UT_SetSBTotalMsgLen -** \sa #UT_SendMsg, #UT_Report, #CFE_EVS_SendEvent, #CFE_EVS_EnablePortsCmd -** \sa #CFE_EVS_DisablePortsCmd -** ******************************************************************************/ void Test_Ports(void); @@ -215,13 +177,6 @@ void Test_Ports(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetSBTotalMsgLen, #UT_SendMsg -** \sa #UT_Report, #UT_SetSizeofESResetArea, #UT_SetRtnCode -** \sa #CFE_PSP_GetResetArea, #CFE_EVS_SendEvent, #UT_SetOSFail -** \sa #CFE_EVS_SetLogModeCmd, #CFE_EVS_WriteLogDataFileCmd, #EVS_ClearLog -** \sa #CFE_EVS_ProcessGroundCommand -** ******************************************************************************/ void Test_Logging(void); @@ -237,11 +192,6 @@ void Test_Logging(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetSBTotalMsgLen, #UT_SendMsg -** \sa #UT_Report, #UT_SetOSFail, #CFE_EVS_EnableAppEventTypesCmd -** \sa #CFE_EVS_ResetCountersCmd, #CFE_EVS_WriteAppDataFileCmd -** ******************************************************************************/ void Test_WriteApp(void); @@ -259,15 +209,6 @@ void Test_WriteApp(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetSBTotalMsgLen, #UT_SendMsg -** \sa #UT_Report, #CFE_EVS_DisableAppEventTypesCmd -** \sa #CFE_EVS_EnableAppEventTypesCmd, #CFE_EVS_EnableAppEventsCmd -** \sa #CFE_EVS_DisableAppEventsCmd, #CFE_EVS_ResetAppEventCounterCmd -** \sa #CFE_EVS_AddEventFilterCmd, #CFE_EVS_DeleteEventFilterCmd -** \sa #CFE_EVS_SetFilterMaskCmd, #CFE_EVS_ResetFilterCmd -** \sa #CFE_EVS_ResetAllFiltersCmd, #CFE_EVS_DisableAppEventTypesCmd -** ******************************************************************************/ void Test_BadAppCmd(void); @@ -283,13 +224,6 @@ void Test_BadAppCmd(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetSBTotalMsgLen, #UT_SendMsg -** \sa #CFE_EVS_SendEvent, #UT_Report, #CFE_EVS_DisableAppEventTypesCmd -** \sa #CFE_EVS_EnableAppEventTypesCmd, #CFE_EVS_DisableAppEventsCmd -** \sa #CFE_EVS_EnableAppEventsCmd, #CFE_EVS_DisableEventTypesCmd -** \sa #CFE_EVS_EnableEventTypesCmd, #CFE_EVS_ResetAppEventCounterCmd -** ******************************************************************************/ void Test_EventCmd(void); @@ -305,13 +239,6 @@ void Test_EventCmd(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetSBTotalMsgLen, #UT_SendMsg -** \sa #UT_Report, #CFE_EVS_Register, #CFE_EVS_EnableAppEventTypesCmd -** \sa #CFE_EVS_DeleteEventFilterCmd, #CFE_EVS_SetFilterMaskCmd -** \sa #CFE_EVS_ResetFilterCmd, #CFE_EVS_ResetAllFiltersCmd -** \sa #CFE_EVS_AddEventFilterCmd -** ******************************************************************************/ void Test_FilterCmd(void); @@ -329,10 +256,6 @@ void Test_FilterCmd(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetSBTotalMsgLen, #UT_SendMsg -** \sa #UT_Report, #CFE_EVS_ProcessGroundCommand, #CFE_EVS_VerifyCmdLength -** ******************************************************************************/ void Test_InvalidCmd(void); @@ -348,12 +271,6 @@ void Test_InvalidCmd(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_Report, #EVS_GetApplicationInfo -** \sa #UT_SetSBTotalMsgLen, #UT_SendMsg, #CFE_EVS_CleanUpApp -** \sa #CFE_EVS_Register, #CFE_EVS_WriteLogDataFileCmd, #CFE_EVS_SetLogModeCmd -** \sa #CFE_EVS_ReportHousekeepingCmd -** ******************************************************************************/ void Test_Misc(void); diff --git a/fsw/cfe-core/unit-test/sb_UT.c b/fsw/cfe-core/unit-test/sb_UT.c index f0b44c86d..e7522dd6d 100644 --- a/fsw/cfe-core/unit-test/sb_UT.c +++ b/fsw/cfe-core/unit-test/sb_UT.c @@ -141,8 +141,8 @@ void UtTest_Setup(void) Test_GetPipeIdByName_API(); Test_Subscribe_API(); Test_Unsubscribe_API(); - Test_SendMsg_API(); - Test_RcvMsg_API(); + Test_TransmitMsg_API(); + Test_ReceiveBuffer_API(); SB_UT_ADD_SUBTEST(Test_CleanupApp_API); Test_SB_Utils(); @@ -415,16 +415,19 @@ void Test_SB_Cmds(void) */ void Test_SB_Cmds_Noop(void) { - CFE_SB_CmdHdr_t NoParamCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_NoopCmd_t Cmd; + } Noop; CFE_MSG_FcnCode_t FcnCode = CFE_SB_NOOP_CC; CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(NoParamCmd); + CFE_MSG_Size_t Size = sizeof(Noop.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&Noop.SBBuf); EVTCNT(1); @@ -437,16 +440,19 @@ void Test_SB_Cmds_Noop(void) */ void Test_SB_Cmds_RstCtrs(void) { - CFE_SB_CmdHdr_t NoParamCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_ResetCountersCmd_t Cmd; + } ResetCounters; CFE_MSG_FcnCode_t FcnCode = CFE_SB_RESET_COUNTERS_CC; CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(NoParamCmd); + CFE_MSG_Size_t Size = sizeof(ResetCounters.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&ResetCounters.SBBuf); EVTCNT(1); @@ -459,12 +465,16 @@ void Test_SB_Cmds_RstCtrs(void) */ void Test_SB_Cmds_Stats(void) { - CFE_SB_CmdHdr_t NoParamCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendSbStatsCmd_t Cmd; + } SendSbStats; CFE_MSG_FcnCode_t FcnCode; CFE_SB_MsgId_t MsgId; CFE_MSG_Size_t Size; - /* For internal SendMsg call */ + /* For internal TransmitMsg call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID); Size = sizeof(CFE_SB.StatTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -472,14 +482,13 @@ void Test_SB_Cmds_Stats(void) /* For Generic command processing */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - Size = sizeof(NoParamCmd); + Size = sizeof(SendSbStats.Cmd); FcnCode = CFE_SB_SEND_SB_STATS_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendSbStats.SBBuf); /* No subs event and command processing event */ EVTCNT(2); @@ -493,23 +502,25 @@ void Test_SB_Cmds_Stats(void) */ void Test_SB_Cmds_RoutingInfoDef(void) { - CFE_SB_PipeId_t PipeId = 0; - CFE_SB_WriteFileInfoCmd_t WriteFileCmd; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_ROUTING_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteFileCmd); + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendRoutingInfoCmd_t Cmd; + } SendRoutingInfo; + CFE_SB_PipeId_t PipeId = 0; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_ROUTING_INFO_CC; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(SendRoutingInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy((char *)WriteFileCmd.Payload.Filename, "", sizeof(WriteFileCmd.Payload.Filename)); + strncpy((char *)SendRoutingInfo.Cmd.Payload.Filename, "", sizeof(SendRoutingInfo.Cmd.Payload.Filename)); /* Make some routing info by calling CFE_SB_AppInit */ SETUP(CFE_SB_AppInit()); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &WriteFileCmd; - - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendRoutingInfo.SBBuf); EVTCNT(12); @@ -530,18 +541,22 @@ void Test_SB_Cmds_RoutingInfoDef(void) */ void Test_SB_Cmds_RoutingInfoSpec(void) { - CFE_SB_WriteFileInfoCmd_t WriteFileCmd; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_ROUTING_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteFileCmd); + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendRoutingInfoCmd_t Cmd; + } SendRoutingInfo; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_ROUTING_INFO_CC; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(SendRoutingInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy((char *)WriteFileCmd.Payload.Filename, "RoutingTstFile", sizeof(WriteFileCmd.Payload.Filename)); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &WriteFileCmd; + strncpy((char *)SendRoutingInfo.Cmd.Payload.Filename, "RoutingTstFile", + sizeof(SendRoutingInfo.Cmd.Payload.Filename)); - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendRoutingInfo.SBBuf); EVTCNT(1); @@ -554,21 +569,25 @@ void Test_SB_Cmds_RoutingInfoSpec(void) */ void Test_SB_Cmds_RoutingInfoCreateFail(void) { - CFE_SB_WriteFileInfoCmd_t WriteFileCmd; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_ROUTING_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteFileCmd); + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendRoutingInfoCmd_t Cmd; + } SendRoutingInfo; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_ROUTING_INFO_CC; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(SendRoutingInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy((char *)WriteFileCmd.Payload.Filename, "RoutingTstFile", sizeof(WriteFileCmd.Payload.Filename)); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &WriteFileCmd; + strncpy((char *)SendRoutingInfo.Cmd.Payload.Filename, "RoutingTstFile", + sizeof(SendRoutingInfo.Cmd.Payload.Filename)); /* Make function CFE_SB_SendRtgInfo return CFE_SB_FILE_IO_ERR */ UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendRoutingInfo.SBBuf); EVTCNT(1); @@ -625,27 +644,30 @@ void Test_SB_Cmds_RoutingInfoWriteFail(void) */ void Test_SB_Cmds_PipeInfoDef(void) { - CFE_SB_WriteFileInfoCmd_t WriteFileCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendPipeInfoCmd_t Cmd; + } SendPipeInfo; CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; CFE_SB_PipeId_t PipeId3; uint16 PipeDepth = 10; CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_PIPE_INFO_CC; CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteFileCmd); + CFE_MSG_Size_t Size = sizeof(SendPipeInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy((char *)WriteFileCmd.Payload.Filename, "", sizeof(WriteFileCmd.Payload.Filename)); + strncpy((char *)SendPipeInfo.Cmd.Payload.Filename, "", sizeof(SendPipeInfo.Cmd.Payload.Filename)); /* Create some pipe info */ SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "TestPipe2")); SETUP(CFE_SB_CreatePipe(&PipeId3, PipeDepth, "TestPipe3")); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &WriteFileCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendPipeInfo.SBBuf); EVTCNT(4); @@ -663,17 +685,21 @@ void Test_SB_Cmds_PipeInfoDef(void) */ void Test_SB_Cmds_PipeInfoSpec(void) { - CFE_SB_WriteFileInfoCmd_t WriteFileCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendPipeInfoCmd_t Cmd; + } SendPipeInfo; CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_PIPE_INFO_CC; CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteFileCmd); + CFE_MSG_Size_t Size = sizeof(SendPipeInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy((char *)WriteFileCmd.Payload.Filename, "PipeTstFile", sizeof(WriteFileCmd.Payload.Filename)); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &WriteFileCmd; - CFE_SB_ProcessCmdPipePkt(); + strncpy((char *)SendPipeInfo.Cmd.Payload.Filename, "PipeTstFile", + sizeof(SendPipeInfo.Cmd.Payload.Filename)); + CFE_SB_ProcessCmdPipePkt(&SendPipeInfo.SBBuf); EVTCNT(1); @@ -744,7 +770,11 @@ void Test_SB_Cmds_PipeInfoWriteFail(void) */ void Test_SB_Cmds_MapInfoDef(void) { - CFE_SB_WriteFileInfoCmd_t WriteFileCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendMapInfoCmd_t Cmd; + } SendMapInfo; CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; CFE_SB_PipeId_t PipeId3; @@ -757,12 +787,12 @@ void Test_SB_Cmds_MapInfoDef(void) uint16 PipeDepth = 10; CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_MAP_INFO_CC; CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteFileCmd); + CFE_MSG_Size_t Size = sizeof(SendMapInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy((char *)WriteFileCmd.Payload.Filename, "", sizeof(WriteFileCmd.Payload.Filename)); + strncpy((char *)SendMapInfo.Cmd.Payload.Filename, "", sizeof(SendMapInfo.Cmd.Payload.Filename)); /* Create some map info */ SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); @@ -775,9 +805,8 @@ void Test_SB_Cmds_MapInfoDef(void) SETUP(CFE_SB_Subscribe(MsgId3, PipeId3)); SETUP(CFE_SB_Subscribe(MsgId4, PipeId3)); SETUP(CFE_SB_Subscribe(MsgId5, PipeId2)); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &WriteFileCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendMapInfo.SBBuf); EVTCNT(18); @@ -798,17 +827,22 @@ void Test_SB_Cmds_MapInfoDef(void) */ void Test_SB_Cmds_MapInfoSpec(void) { - CFE_SB_WriteFileInfoCmd_t WriteFileCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendMapInfoCmd_t Cmd; + } SendMapInfo; CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_MAP_INFO_CC; CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteFileCmd); + CFE_MSG_Size_t Size = sizeof(SendMapInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy((char *)WriteFileCmd.Payload.Filename, "MapTstFile", sizeof(WriteFileCmd.Payload.Filename)); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &WriteFileCmd; - CFE_SB_ProcessCmdPipePkt(); + strncpy((char *)SendMapInfo.Cmd.Payload.Filename, "MapTstFile", + sizeof(SendMapInfo.Cmd.Payload.Filename)); + + CFE_SB_ProcessCmdPipePkt(&SendMapInfo.SBBuf); EVTCNT(1); @@ -895,13 +929,18 @@ void Test_SB_Cmds_MapInfoWriteFail(void) */ void Test_SB_Cmds_EnRouteValParam(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_EnableRouteCmd_t Cmd; + } EnableRoute; CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -909,11 +948,10 @@ void Test_SB_Cmds_EnRouteValParam(void) SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "EnRouteTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - EnDisRouteCmd.Payload.MsgId = MsgId; - EnDisRouteCmd.Payload.Pipe = PipeId; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + EnableRoute.Cmd.Payload.MsgId = MsgId; + EnableRoute.Cmd.Payload.Pipe = PipeId; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); EVTCNT(4); @@ -932,14 +970,18 @@ void Test_SB_Cmds_EnRouteValParam(void) */ void Test_SB_Cmds_EnRouteNonExist(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_EnableRouteCmd_t Cmd; + } EnableRoute; CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -948,11 +990,10 @@ void Test_SB_Cmds_EnRouteNonExist(void) SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "EnRouteTestPipe1")); SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "EnRouteTestPipe2")); SETUP(CFE_SB_Subscribe(MsgId, PipeId1)); - EnDisRouteCmd.Payload.MsgId = MsgId; - EnDisRouteCmd.Payload.Pipe = PipeId2; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + EnableRoute.Cmd.Payload.MsgId = MsgId; + EnableRoute.Cmd.Payload.Pipe = PipeId2; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); EVTCNT(5); @@ -970,20 +1011,23 @@ void Test_SB_Cmds_EnRouteNonExist(void) */ void Test_SB_Cmds_EnRouteInvParam(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_EnableRouteCmd_t Cmd; + } EnableRoute; CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - EnDisRouteCmd.Payload.MsgId = SB_UT_LAST_VALID_MID; - EnDisRouteCmd.Payload.Pipe = 3; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + EnableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; + EnableRoute.Cmd.Payload.Pipe = 3; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); EVTCNT(1); @@ -996,20 +1040,23 @@ void Test_SB_Cmds_EnRouteInvParam(void) */ void Test_SB_Cmds_EnRouteInvParam2(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_EnableRouteCmd_t Cmd; + } EnableRoute; CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - EnDisRouteCmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; - EnDisRouteCmd.Payload.Pipe = 3; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + EnableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; + EnableRoute.Cmd.Payload.Pipe = 3; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); EVTCNT(1); @@ -1023,20 +1070,23 @@ void Test_SB_Cmds_EnRouteInvParam2(void) */ void Test_SB_Cmds_EnRouteInvParam3(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_EnableRouteCmd_t Cmd; + } EnableRoute; CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - EnDisRouteCmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; - EnDisRouteCmd.Payload.Pipe = 0; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + EnableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; + EnableRoute.Cmd.Payload.Pipe = 0; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); EVTCNT(1); @@ -1049,13 +1099,17 @@ void Test_SB_Cmds_EnRouteInvParam3(void) */ void Test_SB_Cmds_DisRouteValParam(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_DisableRouteCmd_t Cmd; + } DisableRoute; CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -1063,10 +1117,10 @@ void Test_SB_Cmds_DisRouteValParam(void) SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "DisRouteTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - EnDisRouteCmd.Payload.MsgId = MsgId; - EnDisRouteCmd.Payload.Pipe = PipeId; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; - CFE_SB_ProcessCmdPipePkt(); + DisableRoute.Cmd.Payload.MsgId = MsgId; + DisableRoute.Cmd.Payload.Pipe = PipeId; + + CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); EVTCNT(4); @@ -1085,13 +1139,17 @@ void Test_SB_Cmds_DisRouteValParam(void) */ void Test_SB_Cmds_DisRouteNonExist(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_DisableRouteCmd_t Cmd; + } DisableRoute; CFE_SB_PipeId_t PipeId1, PipeId2; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 5; CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -1100,11 +1158,10 @@ void Test_SB_Cmds_DisRouteNonExist(void) SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "DisRouteTestPipe1")); SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "DisRouteTestPipe2")); SETUP(CFE_SB_Subscribe(MsgId, PipeId1)); - EnDisRouteCmd.Payload.MsgId = MsgId; - EnDisRouteCmd.Payload.Pipe = PipeId2; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + DisableRoute.Cmd.Payload.MsgId = MsgId; + DisableRoute.Cmd.Payload.Pipe = PipeId2; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); EVTCNT(5); @@ -1122,20 +1179,23 @@ void Test_SB_Cmds_DisRouteNonExist(void) */ void Test_SB_Cmds_DisRouteInvParam(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_DisableRouteCmd_t Cmd; + } DisableRoute; CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - EnDisRouteCmd.Payload.MsgId = SB_UT_LAST_VALID_MID; - EnDisRouteCmd.Payload.Pipe = 3; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + DisableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; + DisableRoute.Cmd.Payload.Pipe = 3; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); EVTCNT(1); @@ -1148,20 +1208,23 @@ void Test_SB_Cmds_DisRouteInvParam(void) */ void Test_SB_Cmds_DisRouteInvParam2(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_DisableRouteCmd_t Cmd; + } DisableRoute; CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - EnDisRouteCmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; - EnDisRouteCmd.Payload.Pipe = 3; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + DisableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; + DisableRoute.Cmd.Payload.Pipe = 3; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); EVTCNT(1); @@ -1175,20 +1238,23 @@ void Test_SB_Cmds_DisRouteInvParam2(void) */ void Test_SB_Cmds_DisRouteInvParam3(void) { - CFE_SB_RouteCmd_t EnDisRouteCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_DisableRouteCmd_t Cmd; + } DisableRoute; CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnDisRouteCmd); + CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - EnDisRouteCmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; - EnDisRouteCmd.Payload.Pipe = 0; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnDisRouteCmd; + DisableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; + DisableRoute.Cmd.Payload.Pipe = 0; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); EVTCNT(1); @@ -1201,11 +1267,15 @@ void Test_SB_Cmds_DisRouteInvParam3(void) */ void Test_SB_Cmds_SendHK(void) { - CFE_SB_CmdHdr_t NoParamCmd; - CFE_SB_MsgId_t MsgIdCmd; - CFE_MSG_Size_t Size; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_MSG_CommandHeader_t Cmd; + } Housekeeping; + CFE_SB_MsgId_t MsgIdCmd; + CFE_MSG_Size_t Size; - /* For internal SendMsg call */ + /* For internal TransmitMsg call */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); Size = sizeof(CFE_SB.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1214,9 +1284,8 @@ void Test_SB_Cmds_SendHK(void) /* For HK command processing */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&Housekeeping.SBBuf); EVTCNT(1); @@ -1230,19 +1299,22 @@ void Test_SB_Cmds_SendHK(void) */ void Test_SB_Cmds_SendPrevSubs(void) { - CFE_SB_SendPrevSubs_t NoParamCmd; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_MsgId_t MsgId = SB_UT_BARE_TLM_MID3; - uint16 MsgLim = 4; - uint16 PipeDepth = 50; - int32 i; - int32 NumEvts; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_PREV_SUBS_CC; - CFE_SB_MsgId_t MsgIdCmd; - CFE_MSG_Size_t Size; - - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_SendPrevSubsCmd_t Cmd; + } SendPrevSubs; + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_MsgId_t MsgId = SB_UT_BARE_TLM_MID3; + uint16 MsgLim = 4; + uint16 PipeDepth = 50; + int32 i; + int32 NumEvts; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_PREV_SUBS_CC; + CFE_SB_MsgId_t MsgIdCmd; + CFE_MSG_Size_t Size; + SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "TestPipe2")); NumEvts = 2; /* one for each pipe create */ @@ -1267,7 +1339,7 @@ void Test_SB_Cmds_SendPrevSubs(void) SETUP(CFE_SB_SubscribeLocal(MsgId, PipeId2, MsgLim)); - /* For 3 internal SendMsg calls */ + /* For 3 internal TransmitMsg calls */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); Size = sizeof(CFE_SB.PrevSubMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1279,12 +1351,12 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Set buffers for gets */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - Size = sizeof(CFE_SB_SendPrevSubs_t); + Size = sizeof(SendPrevSubs.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendPrevSubs.SBBuf); NumEvts += 8; /* +2 for the subscribe, +6 for the SEND_PREV_SUBS_CC */ @@ -1309,7 +1381,7 @@ void Test_SB_Cmds_SendPrevSubs(void) SETUP(CFE_SB_SubscribeLocal(MsgId, PipeId2, MsgLim)); - /* For 3 internal SendMsg calls */ + /* For 3 internal TransmitMsg calls */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); Size = sizeof(CFE_SB.PrevSubMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1321,12 +1393,12 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Set buffers for gets */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - Size = sizeof(CFE_SB_SendPrevSubs_t); + Size = sizeof(SendPrevSubs.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&SendPrevSubs.SBBuf); NumEvts += 8; /* +2 for the subscribe, +6 for the SEND_PREV_SUBS_CC */ @@ -1355,17 +1427,20 @@ void Test_SB_Cmds_SendPrevSubs(void) */ void Test_SB_Cmds_SubRptOn(void) { - CFE_SB_CmdHdr_t NoParamCmd; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_SUB_REPORTING_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - CFE_MSG_Size_t Size = sizeof(NoParamCmd); + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_EnableSubReportingCmd_t Cmd; + } EnableSubReporting; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_SUB_REPORTING_CC; + CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); + CFE_MSG_Size_t Size = sizeof(EnableSubReporting.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&EnableSubReporting.SBBuf); EVTCNT(0); @@ -1376,17 +1451,20 @@ void Test_SB_Cmds_SubRptOn(void) */ void Test_SB_Cmds_SubRptOff(void) { - CFE_SB_CmdHdr_t NoParamCmd; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_SUB_REPORTING_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - CFE_MSG_Size_t Size = sizeof(NoParamCmd); + union + { + CFE_SB_Buffer_t SBBuf; + CFE_SB_DisableSubReportingCmd_t Cmd; + } DisableSubReporting; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_SUB_REPORTING_CC; + CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); + CFE_MSG_Size_t Size = sizeof(DisableSubReporting.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&DisableSubReporting.SBBuf); EVTCNT(0); @@ -1397,7 +1475,6 @@ void Test_SB_Cmds_SubRptOff(void) */ void Test_SB_Cmds_CmdUnexpCmdCode(void) { - CFE_SB_CmdHdr_t NoParamCmd; CFE_MSG_FcnCode_t FcnCode = 99; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); @@ -1406,8 +1483,7 @@ void Test_SB_Cmds_CmdUnexpCmdCode(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); /* Use a command code known to be invalid */ - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); EVTCNT(1); EVTSENT(CFE_SB_BAD_CMD_CODE_EID); @@ -1418,7 +1494,6 @@ void Test_SB_Cmds_CmdUnexpCmdCode(void) */ void Test_SB_Cmds_SubRptUnexpCmdCode(void) { - CFE_SB_CmdHdr_t NoParamCmd; CFE_MSG_FcnCode_t FcnCode = 99; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); @@ -1428,8 +1503,7 @@ void Test_SB_Cmds_SubRptUnexpCmdCode(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); /* Use a command code known to be invalid */ - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); EVTCNT(1); @@ -1445,10 +1519,9 @@ void Test_SB_Cmds_BadCmdLength(void) /* * Just choosing "EnableRoute" command here as it has a non-empty payload */ - CFE_SB_EnableRoute_t EnableRouteCmd; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnableRouteCmd) - 1; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; + CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(CFE_SB_EnableRouteCmd_t) - 1; /* Second GetMsgId and GetFcnCode are for reporting */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1457,8 +1530,7 @@ void Test_SB_Cmds_BadCmdLength(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &EnableRouteCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); EVTCNT(1); @@ -1472,12 +1544,10 @@ void Test_SB_Cmds_BadCmdLength(void) void Test_SB_Cmds_UnexpMsgId(void) { CFE_SB_MsgId_t MsgIdCmd = SB_UT_TLM_MID; - CFE_SB_CmdHdr_t NoParamCmd; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); EVTCNT(1); @@ -2264,16 +2334,16 @@ void Test_Subscribe_MaxMsgIdCount(void) */ void Test_Subscribe_SendPrevSubs(void) { - CFE_SB_PipeId_t PipeId0; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; - CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; - CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; - uint16 PipeDepth = 50; - CFE_SB_SendPrevSubs_t SendPrevSubsMsg; - CFE_SB_MsgId_t MsgIdCmd; - CFE_MSG_Size_t Size; + CFE_SB_PipeId_t PipeId0; + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; + uint16 PipeDepth = 50; + CFE_SB_SendPrevSubsCmd_t SendPrevSubsMsg; + CFE_SB_MsgId_t MsgIdCmd; + CFE_MSG_Size_t Size; /* note that the message is not currently used or required, * but creating one and initializing it for completeness, in @@ -2290,7 +2360,7 @@ void Test_Subscribe_SendPrevSubs(void) SETUP(CFE_SB_Subscribe(MsgId2, PipeId1)); SETUP(CFE_SB_Subscribe(MsgId0, PipeId2)); - /* For internal SendMsg call */ + /* For internal TransmitMsg call */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); Size = sizeof(CFE_SB.PrevSubMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -2341,7 +2411,7 @@ void Test_Subscribe_SubscriptionReporting(void) /* Enable subscription reporting */ CFE_SB_SetSubscriptionReporting(CFE_SB_ENABLE); - /* For internal SendMsg call that will report subscription */ + /* For internal TransmitMsg call that will report subscription */ MsgIdRpt = CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID); Size = sizeof(CFE_SB.SubRprtMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdRpt, sizeof(MsgIdRpt), false); @@ -2665,7 +2735,7 @@ void Test_Unsubscribe_GetDestPtr(void) SETUP(CFE_SB_Subscribe(MsgId, TestPipe2)); SETUP(CFE_SB_Unsubscribe(MsgId, TestPipe2)); - /* TODO for now just get route id and use it, will need update when stubbed */ + /* For now just get route id and use it, will need update when stubbed */ RouteId = CFE_SBR_GetRouteId(MsgId); ASSERT_TRUE(CFE_SB_GetDestPtr(RouteId, TestPipe2) == NULL); @@ -2681,91 +2751,88 @@ void Test_Unsubscribe_GetDestPtr(void) /* ** Function for calling SB send message API test functions */ -void Test_SendMsg_API(void) -{ - SB_UT_ADD_SUBTEST(Test_SendMsg_NullPtr); - SB_UT_ADD_SUBTEST(Test_SendMsg_NoSubscribers); - SB_UT_ADD_SUBTEST(Test_SendMsg_MaxMsgSizePlusOne); - SB_UT_ADD_SUBTEST(Test_SendMsg_BasicSend); - SB_UT_ADD_SUBTEST(Test_SendMsg_SequenceCount); - SB_UT_ADD_SUBTEST(Test_SendMsg_QueuePutError); - SB_UT_ADD_SUBTEST(Test_SendMsg_PipeFull); - SB_UT_ADD_SUBTEST(Test_SendMsg_MsgLimitExceeded); - SB_UT_ADD_SUBTEST(Test_SendMsg_GetPoolBufErr); - SB_UT_ADD_SUBTEST(Test_SendMsg_ZeroCopyGetPtr); - SB_UT_ADD_SUBTEST(Test_SendMsg_ZeroCopySend); - SB_UT_ADD_SUBTEST(Test_SendMsg_ZeroCopyPass); - SB_UT_ADD_SUBTEST(Test_SendMsg_ZeroCopyReleasePtr); - SB_UT_ADD_SUBTEST(Test_SendMsg_DisabledDestination); - SB_UT_ADD_SUBTEST(Test_SendMsg_SendWithMetadata); - SB_UT_ADD_SUBTEST(Test_SendMsg_MaxMsgSizePlusOne_ZeroCopy); - SB_UT_ADD_SUBTEST(Test_SendMsg_NoSubscribers_ZeroCopy); -} /* end Test_SendMsg_API */ +void Test_TransmitMsg_API(void) +{ + SB_UT_ADD_SUBTEST(Test_TransmitMsg_NullPtr); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_NoSubscribers); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_MaxMsgSizePlusOne); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_BasicSend); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_SequenceCount); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_QueuePutError); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_PipeFull); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_MsgLimitExceeded); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_GetPoolBufErr); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_ZeroCopyGetPtr); + SB_UT_ADD_SUBTEST(Test_TransmitBuffer_IncrementSeqCnt); + SB_UT_ADD_SUBTEST(Test_TransmitBuffer_NoIncrement); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_ZeroCopyReleasePtr); + SB_UT_ADD_SUBTEST(Test_TransmitMsg_DisabledDestination); + SB_UT_ADD_SUBTEST(Test_TransmitBufferFull); + SB_UT_ADD_SUBTEST(Test_TransmitMsgValidate_MaxMsgSizePlusOne); + SB_UT_ADD_SUBTEST(Test_TransmitMsgValidate_NoSubscribers); +} /* end Test_TransmitMsg_API */ /* ** Test response to sending a null message on the software bus */ -void Test_SendMsg_NullPtr(void) +void Test_TransmitMsg_NullPtr(void) { - ASSERT_EQ(CFE_SB_SendMsg(NULL), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_TransmitMsg(NULL, true), CFE_SB_BAD_ARGUMENT); EVTCNT(1); EVTSENT(CFE_SB_SEND_BAD_ARG_EID); -} /* end Test_SendMsg_NullPtr */ +} /* end Test_TransmitMsg_NullPtr */ /* ** Test response to sending a message which has no subscribers */ -void Test_SendMsg_NoSubscribers(void) +void Test_TransmitMsg_NoSubscribers(void) { CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; CFE_MSG_Size_t Size = sizeof(TlmPkt); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(1); EVTSENT(CFE_SB_SEND_NO_SUBS_EID); -} /* end Test_SendMsg_NoSubscribers */ +} /* end Test_TransmitMsg_NoSubscribers */ /* ** Test response to sending a message with the message size larger than allowed */ -void Test_SendMsg_MaxMsgSizePlusOne(void) +void Test_TransmitMsg_MaxMsgSizePlusOne(void) { CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; CFE_MSG_Size_t Size = CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - ASSERT_EQ(CFE_SB_SendMsg(TlmPktPtr), CFE_SB_MSG_TOO_BIG); + ASSERT_EQ(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_MSG_TOO_BIG); EVTCNT(1); EVTSENT(CFE_SB_MSG_TOO_BIG_EID); -} /* end Test_SendMsg_MaxMsgSizePlusOne */ +} /* end Test_TransmitMsg_MaxMsgSizePlusOne */ /* ** Test successfully sending a message on the software bus */ -void Test_SendMsg_BasicSend(void) +void Test_TransmitMsg_BasicSend(void) { CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 2; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -2777,13 +2844,13 @@ void Test_SendMsg_BasicSend(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(3); TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_BasicSend */ +} /* end Test_TransmitMsg_BasicSend */ /* Sequence count hook */ static int32 UT_CheckSetSequenceCount(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) @@ -2798,12 +2865,11 @@ static int32 UT_CheckSetSequenceCount(void *UserObj, int32 StubRetcode, uint32 C /* ** Test successful send/receive for packet sequence count */ -void Test_SendMsg_SequenceCount(void) +void Test_TransmitMsg_SequenceCount(void) { CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; uint32 PipeDepth = 10; @@ -2818,14 +2884,14 @@ void Test_SendMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - SETUP(CFE_SB_SendMsg(TlmPktPtr)); + SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 1); ASSERT_EQ(SeqCnt, 1); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - ASSERT(CFE_SB_PassMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, false)); /* Assert sequence count wasn't set */ ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 1); @@ -2833,7 +2899,7 @@ void Test_SendMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); ASSERT_EQ(SeqCnt, 2); ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 2); @@ -2845,7 +2911,7 @@ void Test_SendMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - SETUP(CFE_SB_SendMsg(TlmPktPtr)); /* increment to 3 */ + SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); /* increment to 3 */ ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 3); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); /* resubscribe so we can receive a msg */ @@ -2853,23 +2919,22 @@ void Test_SendMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - SETUP(CFE_SB_SendMsg(TlmPktPtr)); /* increment to 4 */ + SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); /* increment to 4 */ ASSERT_EQ(SeqCnt, 4); ASSERT_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 4); TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_SequenceCount */ +} /* end Test_TransmitMsg_SequenceCount */ /* ** Test send message response to a socket queue 'put' error */ -void Test_SendMsg_QueuePutError(void) +void Test_TransmitMsg_QueuePutError(void) { CFE_SB_PipeId_t PipeId4Error; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 2; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -2881,7 +2946,7 @@ void Test_SendMsg_QueuePutError(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(5); @@ -2889,17 +2954,16 @@ void Test_SendMsg_QueuePutError(void) TEARDOWN(CFE_SB_DeletePipe(PipeId4Error)); -} /* end Test_SendMsg_QueuePutError */ +} /* end Test_TransmitMsg_QueuePutError */ /* ** Test send message response when the socket queue is full */ -void Test_SendMsg_PipeFull(void) +void Test_TransmitMsg_PipeFull(void) { CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 1; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -2911,7 +2975,7 @@ void Test_SendMsg_PipeFull(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* This send should pass */ - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); /* Tell the QueuePut stub to return OS_QUEUE_FULL on its next call */ UT_SetDeferredRetcode(UT_KEY(OS_QueuePut), 1, OS_QUEUE_FULL); @@ -2920,8 +2984,8 @@ void Test_SendMsg_PipeFull(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - /* Pipe overflow causes SendMsg to return CFE_SUCCESS */ - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + /* Pipe overflow causes TransmitMsg to return CFE_SUCCESS */ + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(5); @@ -2929,17 +2993,16 @@ void Test_SendMsg_PipeFull(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_PipeFull */ +} /* end Test_TransmitMsg_PipeFull */ /* ** Test send message response to too many messages sent to the pipe */ -void Test_SendMsg_MsgLimitExceeded(void) +void Test_TransmitMsg_MsgLimitExceeded(void) { CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 5; CFE_MSG_Size_t Size = sizeof(TlmPkt); CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -2954,7 +3017,7 @@ void Test_SendMsg_MsgLimitExceeded(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* First send should pass */ - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -2963,7 +3026,7 @@ void Test_SendMsg_MsgLimitExceeded(void) /* This send should produce a MsgId to Pipe Limit Exceeded message, but * return success */ - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(5); @@ -2971,17 +3034,16 @@ void Test_SendMsg_MsgLimitExceeded(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_MsgLimitExceeded */ +} /* end Test_TransmitMsg_MsgLimitExceeded */ /* ** Test send message response to a buffer descriptor allocation failure */ -void Test_SendMsg_GetPoolBufErr(void) +void Test_TransmitMsg_GetPoolBufErr(void) { CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth; CFE_MSG_Size_t Size = sizeof(TlmPkt); @@ -2995,7 +3057,7 @@ void Test_SendMsg_GetPoolBufErr(void) * allocation failed) */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); - ASSERT_EQ(CFE_SB_SendMsg(TlmPktPtr), CFE_SB_BUF_ALOC_ERR); + ASSERT_EQ(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_BUF_ALOC_ERR); EVTCNT(4); @@ -3003,13 +3065,13 @@ void Test_SendMsg_GetPoolBufErr(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_GetPoolBufErr */ +} /* end Test_TransmitMsg_GetPoolBufErr */ /* ** Test getting a pointer to a buffer for zero copy mode with buffer ** allocation failures */ -void Test_SendMsg_ZeroCopyGetPtr(void) +void Test_TransmitMsg_ZeroCopyGetPtr(void) { CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl; uint16 MsgSize = 10; @@ -3054,18 +3116,18 @@ void Test_SendMsg_ZeroCopyGetPtr(void) EVTCNT(0); -} /* end Test_SendMsg_ZeroCopyGetPtr */ +} /* end Test_TransmitMsg_ZeroCopyGetPtr */ /* ** Test successfully sending a message in zero copy mode (telemetry source ** sequence count increments) */ -void Test_SendMsg_ZeroCopySend(void) +void Test_TransmitBuffer_IncrementSeqCnt(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SendPtr = NULL; + CFE_SB_Buffer_t *ReceivePtr = NULL; CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - CFE_MSG_Message_t *ZeroCpyMsgPtr = NULL; uint32 PipeDepth = 10; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl = 0; CFE_MSG_SequenceCount_t SeqCnt; @@ -3079,26 +3141,26 @@ void Test_SendMsg_ZeroCopySend(void) SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - ZeroCpyMsgPtr = CFE_SB_ZeroCopyGetPtr(sizeof(SB_UT_Test_Tlm_t),&ZeroCpyBufHndl); - if (ZeroCpyMsgPtr == NULL) + SendPtr = CFE_SB_ZeroCopyGetPtr(sizeof(SB_UT_Test_Tlm_t), &ZeroCpyBufHndl); + if (SendPtr == NULL) { UtAssert_Failed("Unexpected NULL pointer returned from ZeroCopyGetPtr"); } /* Test response to a get pool information error */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBufInfo), 1, -1); - ASSERT_EQ(CFE_SB_ZeroCopySend(ZeroCpyMsgPtr, ZeroCpyBufHndl), CFE_SB_BUFFER_INVALID); + ASSERT_EQ(CFE_SB_TransmitBuffer(SendPtr, ZeroCpyBufHndl, true), CFE_SB_BUFFER_INVALID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* Test a successful zero copy send */ - ASSERT(CFE_SB_ZeroCopySend(ZeroCpyMsgPtr, ZeroCpyBufHndl)); + ASSERT(CFE_SB_TransmitBuffer(SendPtr, ZeroCpyBufHndl, true)); - ASSERT(CFE_SB_RcvMsg(&PtrToMsg, PipeId, CFE_SB_PEND_FOREVER)); + ASSERT(CFE_SB_ReceiveBuffer(&ReceivePtr, PipeId, CFE_SB_PEND_FOREVER)); - ASSERT_TRUE(PtrToMsg != NULL); + ASSERT_TRUE(SendPtr == ReceivePtr); ASSERT_EQ(SeqCnt, 1); @@ -3108,18 +3170,18 @@ void Test_SendMsg_ZeroCopySend(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_ZeroCopySend */ +} /* ** Test successfully sending a message in zero copy mode (telemetry source ** sequence count is unchanged) */ -void Test_SendMsg_ZeroCopyPass(void) +void Test_TransmitBuffer_NoIncrement(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SendPtr = NULL; + CFE_SB_Buffer_t *ReceivePtr = NULL; CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - CFE_MSG_Message_t *ZeroCpyMsgPtr = NULL; uint32 PipeDepth = 10; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl = 0; CFE_MSG_SequenceCount_t SeqCnt = 22; @@ -3132,27 +3194,26 @@ void Test_SendMsg_ZeroCopyPass(void) SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "ZeroCpyPassTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - ZeroCpyMsgPtr = CFE_SB_ZeroCopyGetPtr(sizeof(SB_UT_Test_Tlm_t), - &ZeroCpyBufHndl); + SendPtr = CFE_SB_ZeroCopyGetPtr(sizeof(SB_UT_Test_Tlm_t), &ZeroCpyBufHndl); - if (ZeroCpyMsgPtr == NULL) + if (SendPtr == NULL) { UtAssert_Failed("Unexpected NULL pointer returned from ZeroCopyGetPtr"); } /* Test response to a get pool information error */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBufInfo), 1, -1); - ASSERT_EQ(CFE_SB_ZeroCopyPass(ZeroCpyMsgPtr, ZeroCpyBufHndl), CFE_SB_BUFFER_INVALID); + ASSERT_EQ(CFE_SB_TransmitBuffer(SendPtr, ZeroCpyBufHndl, false), CFE_SB_BUFFER_INVALID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* Test a successful zero copy pass */ - ASSERT(CFE_SB_ZeroCopyPass(ZeroCpyMsgPtr, ZeroCpyBufHndl)); - ASSERT(CFE_SB_RcvMsg(&PtrToMsg, PipeId, CFE_SB_PEND_FOREVER)); + ASSERT(CFE_SB_TransmitBuffer(SendPtr, ZeroCpyBufHndl, false)); + ASSERT(CFE_SB_ReceiveBuffer(&ReceivePtr, PipeId, CFE_SB_PEND_FOREVER)); - ASSERT_TRUE(PtrToMsg != NULL); + ASSERT_TRUE(SendPtr == ReceivePtr); ASSERT_EQ(SeqCnt, 22); EVTCNT(3); @@ -3161,16 +3222,16 @@ void Test_SendMsg_ZeroCopyPass(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_ZeroCopyPass */ +} /* ** Test releasing a pointer to a buffer for zero copy mode */ -void Test_SendMsg_ZeroCopyReleasePtr(void) +void Test_TransmitMsg_ZeroCopyReleasePtr(void) { - CFE_MSG_Message_t *ZeroCpyMsgPtr1 = NULL; - CFE_MSG_Message_t *ZeroCpyMsgPtr2 = NULL; - CFE_MSG_Message_t *ZeroCpyMsgPtr3 = NULL; + CFE_SB_Buffer_t *ZeroCpyMsgPtr1 = NULL; + CFE_SB_Buffer_t *ZeroCpyMsgPtr2 = NULL; + CFE_SB_Buffer_t *ZeroCpyMsgPtr3 = NULL; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl1 = 0; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl2 = 0; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl3 = 0; @@ -3189,7 +3250,7 @@ void Test_SendMsg_ZeroCopyReleasePtr(void) ASSERT_EQ(CFE_SB_ZeroCopyReleasePtr(NULL, ZeroCpyBufHndl2), CFE_SB_BUFFER_INVALID); /* Test response to an invalid message pointer */ - ASSERT_EQ(CFE_SB_ZeroCopyReleasePtr((CFE_MSG_Message_t *) 0x1234, + ASSERT_EQ(CFE_SB_ZeroCopyReleasePtr((CFE_SB_Buffer_t *) 0x1234, ZeroCpyBufHndl2), CFE_SB_BUFFER_INVALID); /* Test path when return the descriptor to the pool fails in @@ -3212,17 +3273,16 @@ void Test_SendMsg_ZeroCopyReleasePtr(void) EVTCNT(0); -} /* end Test_SendMsg_ZeroCopyReleasePtr */ +} /* end Test_TransmitMsg_ZeroCopyReleasePtr */ /* ** Test send message response with the destination disabled */ -void Test_SendMsg_DisabledDestination(void) +void Test_TransmitMsg_DisabledDestination(void) { CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; CFE_SB_DestinationD_t *DestPtr; int32 PipeDepth; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; @@ -3242,7 +3302,7 @@ void Test_SendMsg_DisabledDestination(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(3); @@ -3250,164 +3310,132 @@ void Test_SendMsg_DisabledDestination(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_DisabledDestination */ +} /* end Test_TransmitMsg_DisabledDestination */ /* -** Test successfully sending a message with the metadata +** Test successful CFE_SB_TransmitBufferFull */ -void Test_SendMsg_SendWithMetadata(void) +void Test_TransmitBufferFull(void) { - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - - struct - { - /* To exercise the CFE_SB_SEND_ZEROCOPY feature, - * the packet data must already be enclosed in a - * buffer descriptor - */ - CFE_SB_BufferD_t BufDesc; - SB_UT_Test_Tlm_t TlmPkt; - } TlmPktBufDesc; - - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPktBufDesc.TlmPkt; - int32 PipeDepth; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPktBufDesc.TlmPkt); + CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_BufferD_t SBBufD; + CFE_MSG_Message_t Msg; + int32 PipeDepth; + CFE_SBR_RouteId_t RouteId; - memset(&TlmPktBufDesc, 0, sizeof(TlmPktBufDesc)); + SBBufD.Buffer = &Msg; PipeDepth = 2; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); + RouteId = CFE_SBR_GetRouteId(MsgId); - ASSERT(CFE_SB_SendMsgFull(TlmPktPtr, CFE_SB_DO_NOT_INCREMENT, - CFE_SB_SEND_ZEROCOPY)); + ASSERT(CFE_SB_TransmitBufferFull(&SBBufD, RouteId, MsgId)); EVTCNT(3); TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SendMsg_SendWithMetadata */ +} /* end Test_TransmitBufferFull */ /* ** Test response to sending a message with the message size larger than allowed -** and ZeroCopy is set */ -void Test_SendMsg_MaxMsgSizePlusOne_ZeroCopy(void) +void Test_TransmitMsgValidate_MaxMsgSizePlusOne(void) { - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1; - - TlmPktPtr = CFE_SB_ZeroCopyGetPtr(sizeof(SB_UT_Test_Tlm_t), - (CFE_SB_ZeroCopyHandle_t *) &TlmPkt); - if (TlmPktPtr == NULL) - { - UtAssert_Failed("Unexpected NULL pointer returned from ZeroCopyGetPtr"); - } - else - { - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_MsgId_t MsgIdRtn; + SB_UT_Test_Tlm_t TlmPkt; + CFE_MSG_Size_t Size = CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1; + CFE_MSG_Size_t SizeRtn; + CFE_SBR_RouteId_t RouteIdRtn; - ASSERT_EQ(CFE_SB_SendMsgFull(TlmPktPtr, CFE_SB_INCREMENT_TLM, - CFE_SB_SEND_ZEROCOPY), CFE_SB_MSG_TOO_BIG); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - } + ASSERT_EQ(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn), CFE_SB_MSG_TOO_BIG); + ASSERT_EQ(CFE_SB_MsgIdToValue(MsgIdRtn), CFE_SB_MsgIdToValue(MsgId)); + ASSERT_EQ(SizeRtn, Size); EVTCNT(1); EVTSENT(CFE_SB_MSG_TOO_BIG_EID); -} /* end Test_SendMsg_MaxMsgSizePlusOne_ZeroCopy */ +} /* -** Test response to sending a message which has no subscribers and ZeroCopy is -** set +** Test response to sending a message which has no subscribers */ -void Test_SendMsg_NoSubscribers_ZeroCopy(void) +void Test_TransmitMsgValidate_NoSubscribers(void) { CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_MsgId_t MsgIdRtn; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_MSG_Size_t SizeRtn; + CFE_SBR_RouteId_t RouteIdRtn; - TlmPktPtr = CFE_SB_ZeroCopyGetPtr(sizeof(SB_UT_Test_Tlm_t), - (CFE_SB_ZeroCopyHandle_t *) &TlmPkt); - if (TlmPktPtr == NULL) - { - UtAssert_Failed("Unexpected NULL pointer returned from ZeroCopyGetPtr"); - } - else - { - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - ASSERT(CFE_SB_SendMsgFull(TlmPktPtr, CFE_SB_INCREMENT_TLM, - CFE_SB_SEND_ZEROCOPY)); - } + ASSERT(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn)); + ASSERT_EQ(CFE_SB_MsgIdToValue(MsgIdRtn), CFE_SB_MsgIdToValue(MsgId)); + ASSERT_EQ(SizeRtn, Size); + ASSERT_TRUE(!CFE_SBR_IsValidRouteId(RouteIdRtn)); EVTCNT(1); EVTSENT(CFE_SB_SEND_NO_SUBS_EID); -} /* end Test_SendMsg_NoSubscribers_ZeroCopy */ +} /* ** Function for calling SB receive message API test functions */ -void Test_RcvMsg_API(void) +void Test_ReceiveBuffer_API(void) { - SB_UT_ADD_SUBTEST(Test_RcvMsg_InvalidPipeId); - SB_UT_ADD_SUBTEST(Test_RcvMsg_InvalidTimeout); - SB_UT_ADD_SUBTEST(Test_RcvMsg_Poll); - SB_UT_ADD_SUBTEST(Test_RcvMsg_Timeout); - SB_UT_ADD_SUBTEST(Test_RcvMsg_PipeReadError); - SB_UT_ADD_SUBTEST(Test_RcvMsg_PendForever); - SB_UT_ADD_SUBTEST(Test_RcvMsg_InvalidBufferPtr); -} /* end Test_RcvMsg_API */ + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_InvalidPipeId); + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_InvalidTimeout); + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_Poll); + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_Timeout); + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_PipeReadError); + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_PendForever); + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_InvalidBufferPtr); +} /* end Test_ReceiveBuffer_API */ /* ** Test receiving a message from the software bus with an invalid pipe ID */ -void Test_RcvMsg_InvalidPipeId(void) +void Test_ReceiveBuffer_InvalidPipeId(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SBBufPtr; CFE_SB_PipeId_t InvalidPipeId = 20; CFE_SB.PipeTbl[InvalidPipeId].InUse = CFE_SB_NOT_IN_USE; - ASSERT_EQ(CFE_SB_RcvMsg(&PtrToMsg, InvalidPipeId, CFE_SB_POLL), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, InvalidPipeId, CFE_SB_POLL), CFE_SB_BAD_ARGUMENT); EVTCNT(1); EVTSENT(CFE_SB_BAD_PIPEID_EID); -} /* end Test_RcvMsg_InvalidPipeId */ +} /* end Test_ReceiveBuffer_InvalidPipeId */ /* ** Test receiving a message response to invalid timeout value (< -1) */ -void Test_RcvMsg_InvalidTimeout(void) +void Test_ReceiveBuffer_InvalidTimeout(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SBBufPtr; CFE_SB_PipeId_t PipeId; uint32 PipeDepth = 10; int32 TimeOut = -5; - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); + SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); - ASSERT_EQ(CFE_SB_RcvMsg(&PtrToMsg, PipeId, TimeOut), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, TimeOut), CFE_SB_BAD_ARGUMENT); EVTCNT(2); @@ -3415,20 +3443,20 @@ void Test_RcvMsg_InvalidTimeout(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_RcvMsg_InvalidTimeout */ +} /* end Test_ReceiveBuffer_InvalidTimeout */ /* ** Test receiving a message response when there is no message on the queue */ -void Test_RcvMsg_Poll(void) +void Test_ReceiveBuffer_Poll(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SBBufPtr; CFE_SB_PipeId_t PipeId; uint32 PipeDepth = 10; - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); + SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); - ASSERT_EQ(CFE_SB_RcvMsg(&PtrToMsg, PipeId, CFE_SB_POLL), CFE_SB_NO_MESSAGE); + ASSERT_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_POLL), CFE_SB_NO_MESSAGE); EVTCNT(1); @@ -3436,22 +3464,22 @@ void Test_RcvMsg_Poll(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_RcvMsg_Poll */ +} /* end Test_ReceiveBuffer_Poll */ /* ** Test receiving a message response to a timeout */ -void Test_RcvMsg_Timeout(void) +void Test_ReceiveBuffer_Timeout(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SBBufPtr; CFE_SB_PipeId_t PipeId; uint32 PipeDepth = 10; int32 TimeOut = 200; - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); + SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); UT_SetDeferredRetcode(UT_KEY(OS_QueueGet), 1, OS_QUEUE_TIMEOUT); - ASSERT_EQ(CFE_SB_RcvMsg(&PtrToMsg, PipeId, TimeOut), CFE_SB_TIME_OUT); + ASSERT_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, TimeOut), CFE_SB_TIME_OUT); EVTCNT(1); @@ -3459,20 +3487,20 @@ void Test_RcvMsg_Timeout(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_RcvMsg_Timeout */ +} /* end Test_ReceiveBuffer_Timeout */ /* ** Test receiving a message response to a pipe read error */ -void Test_RcvMsg_PipeReadError(void) +void Test_ReceiveBuffer_PipeReadError(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SBBufPtr; CFE_SB_PipeId_t PipeId; uint32 PipeDepth = 10; - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); + SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); UT_SetDeferredRetcode(UT_KEY(OS_QueueGet), 1, OS_ERROR); - ASSERT_EQ(CFE_SB_RcvMsg(&PtrToMsg, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_PIPE_RD_ERR); + ASSERT_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_PIPE_RD_ERR); EVTCNT(3); @@ -3480,33 +3508,32 @@ void Test_RcvMsg_PipeReadError(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_RcvMsg_PipeReadError */ +} /* end Test_ReceiveBuffer_PipeReadError */ /* ** Test receiving a message response to a "pend forever" timeout */ -void Test_RcvMsg_PendForever(void) +void Test_ReceiveBuffer_PendForever(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SBBufPtr; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; CFE_SB_PipeId_t PipeId; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; CFE_SB_PipeD_t *PipeDscPtr; uint32 PipeDepth = 10; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); + SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - SETUP(CFE_SB_SendMsg(TlmPktPtr)); + SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); - ASSERT(CFE_SB_RcvMsg(&PtrToMsg, PipeId, CFE_SB_PEND_FOREVER)); + ASSERT(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER)); - ASSERT_TRUE(PtrToMsg != NULL); + ASSERT_TRUE(SBBufPtr != NULL); EVTCNT(3); @@ -3518,7 +3545,7 @@ void Test_RcvMsg_PendForever(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_RcvMsg_PendForever */ +} /* end Test_ReceiveBuffer_PendForever */ /* ** Test releasing zero copy buffers for all pipes owned by a given app ID @@ -3563,14 +3590,14 @@ void Test_CleanupApp_API(void) /* ** Test receiving a message response to invalid buffer pointer (null) */ -void Test_RcvMsg_InvalidBufferPtr(void) +void Test_ReceiveBuffer_InvalidBufferPtr(void) { CFE_SB_PipeId_t PipeId; uint32 PipeDepth = 10; - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); + SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); - ASSERT_EQ(CFE_SB_RcvMsg(NULL, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_ReceiveBuffer(NULL, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_BAD_ARGUMENT); EVTCNT(2); @@ -3578,7 +3605,7 @@ void Test_RcvMsg_InvalidBufferPtr(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_RcvMsg_InvalidBufferPtr */ +} /* end Test_ReceiveBuffer_InvalidBufferPtr */ /* ** Test SB Utility APIs @@ -3605,20 +3632,20 @@ void Test_CFE_SB_MsgHdrSize(void) type = CFE_MSG_Type_Invalid; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - ASSERT_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CCSDS_SpacePacket_t)); + ASSERT_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_Message_t)); /* Has secondary, tlm type */ hassec = true; type = CFE_MSG_Type_Tlm; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - ASSERT_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_SB_TlmHdr_t)); + ASSERT_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_TelemetryHeader_t)); /* Has secondary, cmd type */ type = CFE_MSG_Type_Cmd; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - ASSERT_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_SB_CmdHdr_t)); + ASSERT_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_CommandHeader_t)); /* Has secondary, invalid type */ type = CFE_MSG_Type_Invalid; @@ -3700,12 +3727,12 @@ void Test_SB_SpecialCases(void) SB_UT_ADD_SUBTEST(Test_CFE_SB_GetPipeIdx); SB_UT_ADD_SUBTEST(Test_CFE_SB_Buffers); SB_UT_ADD_SUBTEST(Test_CFE_SB_BadPipeInfo); - SB_UT_ADD_SUBTEST(Test_SB_SendMsgPaths_Nominal); - SB_UT_ADD_SUBTEST(Test_SB_SendMsgPaths_LimitErr); - SB_UT_ADD_SUBTEST(Test_SB_SendMsgPaths_FullErr); - SB_UT_ADD_SUBTEST(Test_SB_SendMsgPaths_WriteErr); - SB_UT_ADD_SUBTEST(Test_SB_SendMsgPaths_IgnoreOpt); - SB_UT_ADD_SUBTEST(Test_RcvMsg_UnsubResubPath); + SB_UT_ADD_SUBTEST(Test_SB_TransmitMsgPaths_Nominal); + SB_UT_ADD_SUBTEST(Test_SB_TransmitMsgPaths_LimitErr); + SB_UT_ADD_SUBTEST(Test_SB_TransmitMsgPaths_FullErr); + SB_UT_ADD_SUBTEST(Test_SB_TransmitMsgPaths_WriteErr); + SB_UT_ADD_SUBTEST(Test_SB_TransmitMsgPaths_IgnoreOpt); + SB_UT_ADD_SUBTEST(Test_ReceiveBuffer_UnsubResubPath); SB_UT_ADD_SUBTEST(Test_MessageString); } /* end Test_SB_SpecialCases */ @@ -3858,18 +3885,21 @@ void Test_CFE_SB_BadPipeInfo(void) /* ** Test send housekeeping information command */ -void Test_SB_SendMsgPaths_Nominal(void) +void Test_SB_TransmitMsgPaths_Nominal(void) { - CFE_SB_CmdHdr_t NoParamCmd; - CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; - SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; - int32 PipeDepth = 2; - CFE_MSG_Size_t Size; - CFE_MSG_Type_t Type; + union + { + CFE_SB_Buffer_t SBBuf; + CFE_MSG_CommandHeader_t Cmd; + } Housekeeping; + CFE_SB_MsgId_t MsgId; + CFE_SB_PipeId_t PipeId; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 2; + CFE_MSG_Size_t Size; + CFE_MSG_Type_t Type; - /* For internal SendMsg call */ + /* For internal send message call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); Size = sizeof(CFE_SB.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -3881,9 +3911,8 @@ void Test_SB_SendMsgPaths_Nominal(void) /* Repress sending the no subscriptions event and process request */ CFE_SB.HKTlmMsg.Payload.NoSubscribersCounter = 0; - CFE_SB.CmdPipePktPtr = (CFE_MSG_Message_t *) &NoParamCmd; CFE_SB.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_SEND_NO_SUBS_EID_BIT); - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&Housekeeping.SBBuf); /* The no subs event should not be in history but count should increment */ ASSERT_TRUE(!UT_EventIsInHistory(CFE_SB_SEND_NO_SUBS_EID)); @@ -3893,7 +3922,7 @@ void Test_SB_SendMsgPaths_Nominal(void) CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter = 0; CFE_SB.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_GET_BUF_ERR_EID_BIT); - /* For internal SendMsg call */ + /* For internal send message call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); Size = sizeof(CFE_SB.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -3904,7 +3933,7 @@ void Test_SB_SendMsgPaths_Nominal(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(&Housekeeping.SBBuf); ASSERT_EQ(CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter, 0); ASSERT_TRUE(!UT_EventIsInHistory(CFE_SB_GET_BUF_ERR_EID)); @@ -3927,19 +3956,18 @@ void Test_SB_SendMsgPaths_Nominal(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(3); TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SB_SendMsgPaths */ +} /* end Test_SB_TransmitMsgPaths */ -void Test_SB_SendMsgPaths_LimitErr(void) +void Test_SB_TransmitMsgPaths_LimitErr(void) { CFE_SB_MsgId_t MsgId; CFE_SB_PipeId_t PipeId; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); @@ -3956,29 +3984,28 @@ void Test_SB_SendMsgPaths_LimitErr(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* First send should pass */ - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_SB.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_MSGID_LIM_ERR_EID_BIT); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); CFE_SB.StopRecurseFlags[1] = 0; ASSERT_TRUE(!UT_EventIsInHistory(CFE_SB_MSGID_LIM_ERR_EID)); TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SB_SendMsgPaths */ +} /* end Test_SB_TransmitMsgPaths */ -void Test_SB_SendMsgPaths_FullErr(void) +void Test_SB_TransmitMsgPaths_FullErr(void) { CFE_SB_MsgId_t MsgId; CFE_SB_PipeId_t PipeId; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); @@ -3993,7 +4020,7 @@ void Test_SB_SendMsgPaths_FullErr(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* This send should pass */ - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -4002,7 +4029,7 @@ void Test_SB_SendMsgPaths_FullErr(void) /* Tell the QueuePut stub to return OS_QUEUE_FULL on its next call */ UT_SetDeferredRetcode(UT_KEY(OS_QueuePut), 1, OS_QUEUE_FULL); CFE_SB.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_Q_FULL_ERR_EID_BIT); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); CFE_SB.StopRecurseFlags[1] = 0; ASSERT_TRUE(!UT_EventIsInHistory(CFE_SB_Q_FULL_ERR_EID_BIT)); @@ -4010,14 +4037,13 @@ void Test_SB_SendMsgPaths_FullErr(void) EVTCNT(3); TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SB_SendMsgPaths */ +} /* end Test_SB_TransmitMsgPaths */ -void Test_SB_SendMsgPaths_WriteErr(void) +void Test_SB_TransmitMsgPaths_WriteErr(void) { CFE_SB_MsgId_t MsgId; CFE_SB_PipeId_t PipeId; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); @@ -4033,14 +4059,14 @@ void Test_SB_SendMsgPaths_WriteErr(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_SB.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_Q_WR_ERR_EID_BIT); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); CFE_SB.StopRecurseFlags[1] = 0; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); EVTCNT(3); @@ -4048,14 +4074,13 @@ void Test_SB_SendMsgPaths_WriteErr(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SB_SendMsgPaths */ +} /* end Test_SB_TransmitMsgPaths */ -void Test_SB_SendMsgPaths_IgnoreOpt(void) +void Test_SB_TransmitMsgPaths_IgnoreOpt(void) { CFE_SB_MsgId_t MsgId; CFE_SB_PipeId_t PipeId; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; int32 PipeDepth = 2; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); @@ -4071,41 +4096,40 @@ void Test_SB_SendMsgPaths_IgnoreOpt(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* Test skipping this pipe and the send should pass */ - ASSERT(CFE_SB_SendMsg(TlmPktPtr)); + ASSERT(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); TEARDOWN(CFE_SB_SetPipeOpts(PipeId, 0)); TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_SB_SendMsgPaths */ +} /* end Test_SB_TransmitMsgPaths */ /* ** Test receiving a message response to a unsubscribing to message, then ** resubscribing to it while it's in the pipe */ -void Test_RcvMsg_UnsubResubPath(void) +void Test_ReceiveBuffer_UnsubResubPath(void) { - CFE_MSG_Message_t *PtrToMsg; + CFE_SB_Buffer_t *SBBufPtr; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; CFE_SB_PipeId_t PipeId; SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Message_t *TlmPktPtr = (CFE_MSG_Message_t *) &TlmPkt; uint32 PipeDepth = 10; CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; CFE_MSG_Size_t Size = sizeof(TlmPkt); - SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe")); + SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - SETUP(CFE_SB_SendMsg(TlmPktPtr)); + SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); SETUP(CFE_SB_Unsubscribe(MsgId, PipeId)); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - ASSERT(CFE_SB_RcvMsg(&PtrToMsg, PipeId, CFE_SB_PEND_FOREVER)); + ASSERT(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER)); - ASSERT_TRUE(PtrToMsg != NULL); + ASSERT_TRUE(SBBufPtr != NULL); EVTCNT(6); @@ -4113,7 +4137,7 @@ void Test_RcvMsg_UnsubResubPath(void) TEARDOWN(CFE_SB_DeletePipe(PipeId)); -} /* end Test_RcvMsg_UnsubResubPath */ +} /* end Test_ReceiveBuffer_UnsubResubPath */ /* ** Test the paths through the MessageStringSet and MessageStringGet functions diff --git a/fsw/cfe-core/unit-test/sb_UT.h b/fsw/cfe-core/unit-test/sb_UT.h index ffb126684..1420e762a 100644 --- a/fsw/cfe-core/unit-test/sb_UT.h +++ b/fsw/cfe-core/unit-test/sb_UT.h @@ -52,34 +52,34 @@ ** Structures */ typedef struct { - CFE_SB_CmdHdr_t Hdr; - uint32 Cmd32Param1; - uint16 Cmd16Param1; - uint16 Cmd16Param2; - uint8 Cmd8Param1; - uint8 Cmd8Param2; - uint8 Cmd8Param3; - uint8 Cmd8Param4; + CFE_MSG_CommandHeader_t Hdr; + uint32 Cmd32Param1; + uint16 Cmd16Param1; + uint16 Cmd16Param2; + uint8 Cmd8Param1; + uint8 Cmd8Param2; + uint8 Cmd8Param3; + uint8 Cmd8Param4; } SB_UT_Test_Cmd_t; typedef struct { - CFE_SB_TlmHdr_t Hdr; - uint32 Tlm32Param1; - uint16 Tlm16Param1; - uint16 Tlm16Param2; - uint8 Tlm8Param1; - uint8 Tlm8Param2; - uint8 Tlm8Param3; - uint8 Tlm8Param4; + CFE_MSG_TelemetryHeader_t Hdr; + uint32 Tlm32Param1; + uint16 Tlm16Param1; + uint16 Tlm16Param2; + uint8 Tlm8Param1; + uint8 Tlm8Param2; + uint8 Tlm8Param3; + uint8 Tlm8Param4; } SB_UT_Test_Tlm_t; typedef struct { - CFE_MSG_Message_t Pri; /* 6 bytes */ - uint8 Tlm8Param1; - uint8 Tlm8Param2; - uint32 Tlm32Param1; - uint16 Tlm16Param1; - uint16 Tlm16Param2; + CFE_MSG_Message_t Pri; + uint8 Tlm8Param1; + uint8 Tlm8Param2; + uint32 Tlm32Param1; + uint16 Tlm16Param1; + uint16 Tlm16Param2; } SB_UT_TstPktWoSecHdr_t; #define SB_UT_CMD_MID_VALUE_BASE CFE_PLATFORM_CMD_MID_BASE + 1 @@ -1860,7 +1860,7 @@ void Test_Unsubscribe_GetDestPtr(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_API(void); +void Test_TransmitMsg_API(void); /*****************************************************************************/ /** @@ -1876,7 +1876,7 @@ void Test_SendMsg_API(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_NullPtr(void); +void Test_TransmitMsg_NullPtr(void); /*****************************************************************************/ /** @@ -1892,7 +1892,7 @@ void Test_SendMsg_NullPtr(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_InvalidMsgId(void); +void Test_TransmitMsg_InvalidMsgId(void); /*****************************************************************************/ /** @@ -1908,7 +1908,7 @@ void Test_SendMsg_InvalidMsgId(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_NoSubscribers(void); +void Test_TransmitMsg_NoSubscribers(void); /*****************************************************************************/ /** @@ -1925,7 +1925,7 @@ void Test_SendMsg_NoSubscribers(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_MaxMsgSizePlusOne(void); +void Test_TransmitMsg_MaxMsgSizePlusOne(void); /*****************************************************************************/ /** @@ -1941,7 +1941,7 @@ void Test_SendMsg_MaxMsgSizePlusOne(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_BasicSend(void); +void Test_TransmitMsg_BasicSend(void); /*****************************************************************************/ /** @@ -1957,7 +1957,7 @@ void Test_SendMsg_BasicSend(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_SequenceCount(void); +void Test_TransmitMsg_SequenceCount(void); /*****************************************************************************/ /** @@ -1973,7 +1973,7 @@ void Test_SendMsg_SequenceCount(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_QueuePutError(void); +void Test_TransmitMsg_QueuePutError(void); /*****************************************************************************/ /** @@ -1989,7 +1989,7 @@ void Test_SendMsg_QueuePutError(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_PipeFull(void); +void Test_TransmitMsg_PipeFull(void); /*****************************************************************************/ /** @@ -2005,7 +2005,7 @@ void Test_SendMsg_PipeFull(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_MsgLimitExceeded(void); +void Test_TransmitMsg_MsgLimitExceeded(void); /*****************************************************************************/ /** @@ -2021,7 +2021,7 @@ void Test_SendMsg_MsgLimitExceeded(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_GetPoolBufErr(void); +void Test_TransmitMsg_GetPoolBufErr(void); /*****************************************************************************/ /** @@ -2038,7 +2038,7 @@ void Test_SendMsg_GetPoolBufErr(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_ZeroCopyGetPtr(void); +void Test_TransmitMsg_ZeroCopyGetPtr(void); /*****************************************************************************/ /** @@ -2055,7 +2055,7 @@ void Test_SendMsg_ZeroCopyGetPtr(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_ZeroCopySend(void); +void Test_TransmitBuffer_IncrementSeqCnt(void); /*****************************************************************************/ /** @@ -2072,7 +2072,7 @@ void Test_SendMsg_ZeroCopySend(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_ZeroCopyPass(void); +void Test_TransmitBuffer_NoIncrement(void); /*****************************************************************************/ /** @@ -2088,7 +2088,7 @@ void Test_SendMsg_ZeroCopyPass(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_ZeroCopyReleasePtr(void); +void Test_TransmitMsg_ZeroCopyReleasePtr(void); /*****************************************************************************/ /** @@ -2104,11 +2104,11 @@ void Test_SendMsg_ZeroCopyReleasePtr(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_DisabledDestination(void); +void Test_TransmitMsg_DisabledDestination(void); /*****************************************************************************/ /** -** \brief Test successfully sending a message with the metadata +** \brief Test successful CFE_SB_TransmitBufferFull ** ** \par Description ** This function tests successfully sending a message with the metadata. @@ -2119,29 +2119,11 @@ void Test_SendMsg_DisabledDestination(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_SendWithMetadata(void); +void Test_TransmitBufferFull(void); /*****************************************************************************/ /** -** \brief Test response to sending a message with an invalid ID and ZeroCopy is -** set -** -** \par Description -** This function tests the response to sending a message with an invalid -** ID. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \returns -** This function does not return a value. -******************************************************************************/ -void Test_SendMsg_InvalidMsgId_ZeroCopy(void); - -/*****************************************************************************/ -/** -** \brief Test response to sending a message which has no subscribers and -** ZeroCopy is set +** \brief Test response to sending a message which has no subscribers ** ** \par Description ** This function tests the response to sending a message which has no @@ -2153,12 +2135,12 @@ void Test_SendMsg_InvalidMsgId_ZeroCopy(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_NoSubscribers_ZeroCopy(void); +void Test_TransmitMsgValidate_NoSubscribers(void); /*****************************************************************************/ /** ** \brief Test response to sending a message with the message size larger -** than allowed and ZeroCopy is set +** than allowed ** ** \par Description ** This function tests the response to sending a message with the @@ -2170,7 +2152,7 @@ void Test_SendMsg_NoSubscribers_ZeroCopy(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SendMsg_MaxMsgSizePlusOne_ZeroCopy(void); +void Test_TransmitMsgValidate_MaxMsgSizePlusOne(void); /*****************************************************************************/ /** @@ -2185,7 +2167,7 @@ void Test_SendMsg_MaxMsgSizePlusOne_ZeroCopy(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_API(void); +void Test_ReceiveBuffer_API(void); /*****************************************************************************/ /** @@ -2202,7 +2184,7 @@ void Test_RcvMsg_API(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_InvalidPipeId(void); +void Test_ReceiveBuffer_InvalidPipeId(void); /*****************************************************************************/ /** @@ -2218,7 +2200,7 @@ void Test_RcvMsg_InvalidPipeId(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_InvalidTimeout(void); +void Test_ReceiveBuffer_InvalidTimeout(void); /*****************************************************************************/ /** @@ -2235,7 +2217,7 @@ void Test_RcvMsg_InvalidTimeout(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_Poll(void); +void Test_ReceiveBuffer_Poll(void); /*****************************************************************************/ /** @@ -2250,7 +2232,7 @@ void Test_RcvMsg_Poll(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_Timeout(void); +void Test_ReceiveBuffer_Timeout(void); /*****************************************************************************/ /** @@ -2266,7 +2248,7 @@ void Test_RcvMsg_Timeout(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_PipeReadError(void); +void Test_ReceiveBuffer_PipeReadError(void); /*****************************************************************************/ /** @@ -2282,7 +2264,7 @@ void Test_RcvMsg_PipeReadError(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_PendForever(void); +void Test_ReceiveBuffer_PendForever(void); /*****************************************************************************/ /** @@ -2298,7 +2280,7 @@ void Test_RcvMsg_PendForever(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_InvalidBufferPtr(void); +void Test_ReceiveBuffer_InvalidBufferPtr(void); /*****************************************************************************/ /** @@ -2508,10 +2490,10 @@ void Test_CFE_SB_BadPipeInfo(void); /*****************************************************************************/ /** -** \brief Test SendMsgFull function paths +** \brief Test TransmitMsgFull function paths ** ** \par Description -** This function tests branch paths in the SendMsgFull function. +** This function tests branch paths in the TransmitMsgFull function. ** ** \par Assumptions, External Events, and Notes: ** None @@ -2519,18 +2501,18 @@ void Test_CFE_SB_BadPipeInfo(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_SB_SendMsgPaths_Nominal(void); -void Test_SB_SendMsgPaths_LimitErr(void); -void Test_SB_SendMsgPaths_FullErr(void); -void Test_SB_SendMsgPaths_WriteErr(void); -void Test_SB_SendMsgPaths_IgnoreOpt(void); +void Test_SB_TransmitMsgPaths_Nominal(void); +void Test_SB_TransmitMsgPaths_LimitErr(void); +void Test_SB_TransmitMsgPaths_FullErr(void); +void Test_SB_TransmitMsgPaths_WriteErr(void); +void Test_SB_TransmitMsgPaths_IgnoreOpt(void); /*****************************************************************************/ /** -** \brief Test RcvMsg function unsubscribe/resubscribe path +** \brief Test ReceiveBuffer function unsubscribe/resubscribe path ** ** \par Description -** This function tests the branch path in the RcvMsg function when a +** This function tests the branch path in the ReceiveBuffer function when a ** message in the pipe is unsubscribed, then resubscribed. ** ** \par Assumptions, External Events, and Notes: @@ -2539,7 +2521,7 @@ void Test_SB_SendMsgPaths_IgnoreOpt(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void Test_RcvMsg_UnsubResubPath(void); +void Test_ReceiveBuffer_UnsubResubPath(void); /*****************************************************************************/ /** diff --git a/fsw/cfe-core/unit-test/tbl_UT.c b/fsw/cfe-core/unit-test/tbl_UT.c index 5c486aa95..ad413dfda 100644 --- a/fsw/cfe-core/unit-test/tbl_UT.c +++ b/fsw/cfe-core/unit-test/tbl_UT.c @@ -455,8 +455,8 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) */ void Test_CFE_TBL_DeleteCDSCmd(void) { - int j, k; - CFE_TBL_DeleteCDS_t DelCDSCmd; + int j, k; + CFE_TBL_DeleteCDSCmd_t DelCDSCmd; UtPrintf("Begin Test Delete CDS Command"); @@ -544,7 +544,7 @@ void Test_CFE_TBL_DeleteCDSCmd(void) */ void Test_CFE_TBL_TlmRegCmd(void) { - CFE_TBL_SendRegistry_t TlmRegCmd; + CFE_TBL_SendRegistryCmd_t TlmRegCmd; UtPrintf("Begin Test Telemetry Registry Command"); @@ -579,8 +579,8 @@ void Test_CFE_TBL_TlmRegCmd(void) */ void Test_CFE_TBL_AbortLoadCmd(void) { - int load = (int) CFE_TBL_TaskData.Registry[0].LoadInProgress; - CFE_TBL_AbortLoad_t AbortLdCmd; + int load = (int) CFE_TBL_TaskData.Registry[0].LoadInProgress; + CFE_TBL_AbortLoadCmd_t AbortLdCmd; UtPrintf("Begin Test Abort Load Command"); @@ -652,7 +652,7 @@ void Test_CFE_TBL_ActivateCmd(void) { int load = (int) CFE_TBL_TaskData.Registry[0].LoadInProgress; uint8 dump = CFE_TBL_TaskData.Registry[0].DumpOnly; - CFE_TBL_Activate_t ActivateCmd; + CFE_TBL_ActivateCmd_t ActivateCmd; UtPrintf("Begin Test Activate Command"); @@ -715,7 +715,7 @@ void Test_CFE_TBL_ActivateCmd(void) * progress, and a notification message should be sent */ UT_InitData(); - UT_SetDeferredRetcode(UT_KEY(CFE_SB_SendMsg), 1, CFE_SB_INTERNAL_ERR); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); CFE_TBL_TaskData.Registry[0].NotifyByMsg = true; CFE_TBL_TaskData.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; UT_Report(__FILE__, __LINE__, @@ -831,7 +831,7 @@ void Test_CFE_TBL_ValidateCmd(void) int i; uint8 Buff; uint8 *BuffPtr = &Buff; - CFE_TBL_Validate_t ValidateCmd; + CFE_TBL_ValidateCmd_t ValidateCmd; CFE_TBL_CallbackFuncPtr_t ValFuncPtr = (CFE_TBL_CallbackFuncPtr_t) ((unsigned long ) &UT_InitializeTableRegistryNames); @@ -937,7 +937,7 @@ void Test_CFE_TBL_ValidateCmd(void) * notification message should be sent */ UT_InitData(); - UT_SetDeferredRetcode(UT_KEY(CFE_SB_SendMsg), 1, CFE_SB_INTERNAL_ERR); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); CFE_TBL_TaskData.Registry[0].NotifyByMsg = true; CFE_TBL_TaskData.Registry[0].DoubleBuffered = false; CFE_TBL_TaskData.LoadBuffs[CFE_TBL_TaskData.Registry[0].LoadInProgress].BufferPtr = BuffPtr; @@ -1135,9 +1135,9 @@ void Test_CFE_TBL_GetHkData(void) */ void Test_CFE_TBL_DumpRegCmd(void) { - int q; - CFE_TBL_DumpRegistry_t DumpRegCmd; - CFE_ES_ResourceID_t AppID; + int q; + CFE_TBL_DumpRegistryCmd_t DumpRegCmd; + CFE_ES_ResourceID_t AppID; /* Get the AppID being used for UT */ CFE_ES_GetAppID(&AppID); @@ -1228,11 +1228,11 @@ void Test_CFE_TBL_DumpRegCmd(void) */ void Test_CFE_TBL_DumpCmd(void) { - int i, k, u; - uint8 Buff; + int i, k, u; + uint8 Buff; uint8 *BuffPtr = &Buff; - CFE_TBL_LoadBuff_t Load = {0}; - CFE_TBL_Dump_t DumpCmd; + CFE_TBL_LoadBuff_t Load = {0}; + CFE_TBL_DumpCmd_t DumpCmd; CFE_ES_ResourceID_t AppID; CFE_ES_GetAppID(&AppID); @@ -1277,7 +1277,7 @@ void Test_CFE_TBL_DumpCmd(void) CFE_TBL_TaskData.Registry[2].DoubleBuffered = false; CFE_TBL_TaskData.LoadBuffs[CFE_TBL_TaskData.Registry[2].LoadInProgress] = Load; CFE_TBL_TaskData.Registry[2].NotifyByMsg = true; - UT_SetDeferredRetcode(UT_KEY(CFE_SB_SendMsg), 1, CFE_SB_INTERNAL_ERR); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_CMD_CTR, @@ -1406,11 +1406,11 @@ void Test_CFE_TBL_DumpCmd(void) */ void Test_CFE_TBL_LoadCmd(void) { - int i, j; - CFE_TBL_File_Hdr_t TblFileHeader; - CFE_FS_Header_t StdFileHeader; - CFE_TBL_LoadBuff_t BufferPtr = CFE_TBL_TaskData.LoadBuffs[0]; - CFE_TBL_Load_t LoadCmd; + int i, j; + CFE_TBL_File_Hdr_t TblFileHeader; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_LoadBuff_t BufferPtr = CFE_TBL_TaskData.LoadBuffs[0]; + CFE_TBL_LoadCmd_t LoadCmd; CFE_ES_ResourceID_t AppID; CFE_ES_GetAppID(&AppID); @@ -1686,7 +1686,7 @@ void Test_CFE_TBL_HousekeepingCmd(void) CFE_TBL_TaskData.DumpControlBlocks[i].State = CFE_TBL_DUMP_PENDING; } - UT_SetDeferredRetcode(UT_KEY(CFE_SB_SendMsg), 1, CFE_SUCCESS - 1); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SUCCESS - 1); CFE_TBL_TaskData.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, diff --git a/fsw/cfe-core/unit-test/tbl_UT.h b/fsw/cfe-core/unit-test/tbl_UT.h index b8044c0da..2b8884b5f 100644 --- a/fsw/cfe-core/unit-test/tbl_UT.h +++ b/fsw/cfe-core/unit-test/tbl_UT.h @@ -74,7 +74,7 @@ typedef struct /*****************************************************************************/ /** -** \brief Initialize the registry +** \brief Initialize the registry names ** ** \par Description ** Fill the whole table registry with known table names in order to @@ -86,7 +86,6 @@ typedef struct ** ** \returns ** This function does not return a value. -** ******************************************************************************/ void UT_InitializeTableRegistryNames(void); @@ -94,15 +93,6 @@ void UT_InitializeTableRegistryNames(void); /** ** \brief Initialize table registry values ** -** \par Description -** This function serves as a pass-through for messages coming from the -** CFE_SB_SendMsg() stub function. By using a common pass-through -** function name, the stub can be generic for all of the tests for the -** various services (i.e., EVS, TBL, etc.). -** -** \par Assumptions, External Events, and Notes: -** None -** ** \returns ** This function does not return a value. ******************************************************************************/ diff --git a/fsw/cfe-core/unit-test/time_UT.c b/fsw/cfe-core/unit-test/time_UT.c index 6fdc94b3f..79455f147 100644 --- a/fsw/cfe-core/unit-test/time_UT.c +++ b/fsw/cfe-core/unit-test/time_UT.c @@ -1741,24 +1741,24 @@ void Test_PipeCmds(void) union { CFE_MSG_Message_t message; - CFE_SB_CmdHdr_t cmd; + CFE_MSG_CommandHeader_t cmd; CFE_TIME_ToneDataCmd_t tonedatacmd; - CFE_TIME_Noop_t noopcmd; - CFE_TIME_ResetCounters_t resetcountercmd; - CFE_TIME_SendDiagnosticTlm_t diagtlmcmd; - CFE_TIME_SetState_t statecmd; - CFE_TIME_SetSource_t sourcecmd; - CFE_TIME_SetSignal_t signalcmd; - CFE_TIME_AddDelay_t adddelaycmd; - CFE_TIME_SubDelay_t subdelaycmd; - CFE_TIME_SetTime_t settimecmd; - CFE_TIME_SetMET_t setmetcmd; - CFE_TIME_SetSTCF_t setstcfcmd; - CFE_TIME_SetLeapSeconds_t leapscmd; - CFE_TIME_AddAdjust_t addadjcmd; - CFE_TIME_SubAdjust_t subadjcmd; - CFE_TIME_Add1HZAdjustment_t add1hzadjcmd; - CFE_TIME_Sub1HZAdjustment_t sub1hzadjcmd; + CFE_TIME_NoopCmd_t noopcmd; + CFE_TIME_ResetCountersCmd_t resetcountercmd; + CFE_TIME_SendDiagnosticCmd_t diagtlmcmd; + CFE_TIME_SetStateCmd_t statecmd; + CFE_TIME_SetSourceCmd_t sourcecmd; + CFE_TIME_SetSignalCmd_t signalcmd; + CFE_TIME_AddDelayCmd_t adddelaycmd; + CFE_TIME_SubDelayCmd_t subdelaycmd; + CFE_TIME_SetTimeCmd_t settimecmd; + CFE_TIME_SetMETCmd_t setmetcmd; + CFE_TIME_SetSTCFCmd_t setstcfcmd; + CFE_TIME_SetLeapSecondsCmd_t leapscmd; + CFE_TIME_AddAdjustCmd_t addadjcmd; + CFE_TIME_SubAdjustCmd_t subadjcmd; + CFE_TIME_Add1HZAdjustmentCmd_t add1hzadjcmd; + CFE_TIME_Sub1HZAdjustmentCmd_t sub1hzadjcmd; } CmdBuf; UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = @@ -1776,7 +1776,7 @@ void Test_PipeCmds(void) /* Test sending the housekeeping telemetry request command */ UT_InitData(); - UT_SetHookFunction(UT_KEY(CFE_SB_SendMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); + UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_SEND_HK); UT_Report(__FILE__, __LINE__, diff --git a/fsw/cfe-core/unit-test/time_UT.h b/fsw/cfe-core/unit-test/time_UT.h index e55170d13..c6300c762 100644 --- a/fsw/cfe-core/unit-test/time_UT.h +++ b/fsw/cfe-core/unit-test/time_UT.h @@ -66,9 +66,6 @@ ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, CFE_TIME_TaskMain, #UT_Report, #UT_SetRtnCode -** ******************************************************************************/ void Test_Main(void); @@ -86,10 +83,6 @@ void Test_Main(void); ** ** \returns ** This function does not return a value. -** -** \sa #CFE_TIME_EarlyInit, #UT_InitData, #UT_Report, -** \sa #CFE_TIME_TaskInit, #UT_SetRtnCode -** ******************************************************************************/ void Test_Init(void); @@ -105,13 +98,6 @@ void Test_Init(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetBSP_Time, #CFE_TIME_Print, -** \sa #CFE_TIME_GetMET, #UT_Report, #CFE_TIME_GetMETseconds, -** \sa #CFE_TIME_GetMETsubsecs, #CFE_TIME_Micro2SubSecs, -** \sa #CFE_TIME_GetLeapSeconds, #CFE_TIME_GetTAI, #CFE_TIME_GetUTC, -** \sa #CFE_TIME_GetSTCF, #CFE_TIME_GetClockState, #CFE_TIME_GetClockInfo -** ******************************************************************************/ void Test_GetTime(void); @@ -127,10 +113,6 @@ void Test_GetTime(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_Add, #UT_Report, #CFE_TIME_Subtract, -** \sa #CFE_TIME_Compare -** ******************************************************************************/ void Test_TimeOp(void); @@ -146,10 +128,6 @@ void Test_TimeOp(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_Print, #CFE_TIME_MET2SCTime, -** \sa #UT_Report, #CFE_TIME_Sub2MicroSecs, #CFE_TIME_Micro2SubSecs -** ******************************************************************************/ void Test_ConvertTime(void); @@ -167,9 +145,6 @@ void Test_ConvertTime(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_Print, #UT_Report -** ******************************************************************************/ void Test_Print(void); @@ -187,7 +162,6 @@ void Test_Print(void); ** ** \returns ** This function returns CFE_SUCCESS -** ******************************************************************************/ int32 ut_time_MyCallbackFunc(void); @@ -210,9 +184,6 @@ int32 ut_time_MyCallbackFunc(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_RegisterSynchCallback, #UT_Report -** ******************************************************************************/ void Test_RegisterSyncCallback(bool reportResults); @@ -229,9 +200,6 @@ void Test_RegisterSyncCallback(bool reportResults); ** ** \returns ** This function does not return a value. -** -** \sa #Test_RegisterSyncCallback -** ******************************************************************************/ void Test_RegisterSyncCallbackTrue(void); @@ -247,10 +215,6 @@ void Test_RegisterSyncCallbackTrue(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetBSP_Time, #CFE_TIME_ExternalTone, -** \sa #UT_Report -** ******************************************************************************/ void Test_ExternalTone(void); @@ -266,10 +230,6 @@ void Test_ExternalTone(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_ExternalMET, #UT_Report, -** \sa #CFE_TIME_ExternalGPS, #CFE_TIME_ExternalTime -** ******************************************************************************/ void Test_External(void); @@ -285,9 +245,6 @@ void Test_External(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SendMsg, #UT_Report, #UT_SetBSP_Time -** ******************************************************************************/ void Test_PipeCmds(void); @@ -303,10 +260,6 @@ void Test_PipeCmds(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetStatusBSPResetArea, -** \sa #CFE_TIME_QueryResetVars, #CFE_TIME_UpdateResetVars, #UT_Report -** ******************************************************************************/ void Test_ResetArea(void); @@ -322,10 +275,6 @@ void Test_ResetArea(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_Report, #CFE_TIME_CalculateState, -** \sa #CFE_TIME_SetState, #CFE_TIME_GetStateFlags -** ******************************************************************************/ void Test_State(void); @@ -341,10 +290,6 @@ void Test_State(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #UT_SetBSP_Time, #CFE_TIME_GetReference, -** \sa #UT_Report -** ******************************************************************************/ void Test_GetReference(void); @@ -361,10 +306,6 @@ void Test_GetReference(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_SetState, #UT_SetBSP_Time, -** \sa #UT_Report, #CFE_TIME_ToneSend, #CFE_TIME_ToneVerify, CFE_TIME_SetState, -** ******************************************************************************/ void Test_Tone(void); @@ -382,11 +323,6 @@ void Test_Tone(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_Set1HzAdj, #CFE_TIME_Local1HzISR, -** \sa #UT_Report, #UT_SetBSP_Time, #UT_SetBinSemFail, #CFE_TIME_Local1HzTask, -** \sa #CFE_TIME_Tone1HzTask -** ******************************************************************************/ void Test_1Hz(void); @@ -402,9 +338,6 @@ void Test_1Hz(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #CFE_TIME_UnregisterSynchCallback, #UT_Report -** ******************************************************************************/ void Test_UnregisterSynchCallback(void); @@ -420,10 +353,6 @@ void Test_UnregisterSynchCallback(void); ** ** \returns ** This function does not return a value. -** -** \sa #UT_InitData, #Test_RegisterSyncCallback, -** \sa #CFE_TIME_CleanUpApp, #CFE_TIME_UnregisterSynchCallback, #UT_Report -** ******************************************************************************/ void Test_CleanUpApp(void); diff --git a/fsw/cfe-core/unit-test/ut_support.c b/fsw/cfe-core/unit-test/ut_support.c index 9a2fd8e80..7c545dcc3 100644 --- a/fsw/cfe-core/unit-test/ut_support.c +++ b/fsw/cfe-core/unit-test/ut_support.c @@ -151,7 +151,7 @@ void UT_InitData(void) UT_SetCDSSize(UT_LastCDSSize); /* - * Set up for the CFE_SB_RcvMsg() call. + * Set up for the CFE_SB_ReceiveBuffer() call. * * The existing test cases assume that this will return success once, * followed by a timeout response followed by a different error. @@ -159,11 +159,11 @@ void UT_InitData(void) * Specific test cases may provide an actual message buffer to return for * the first call, or they may override this default behavior entirely. * - * The default behavior of the CFE_SB_RcvMsg stub is to return success with a zero-ed out + * The default behavior of the CFE_SB_ReceiveBuffer stub is to return success with a zero-ed out * buffer returned to the caller. */ - UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 2, CFE_SB_TIME_OUT); - UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 3, -1); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_ReceiveBuffer), 2, CFE_SB_TIME_OUT); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_ReceiveBuffer), 3, -1); /* * Set up CFE_ES_GetAppName() and friends @@ -215,9 +215,18 @@ void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, ** This first sets up the various stubs according to the test case, ** then invokes the pipe function. */ -void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_MSG_Message_t *), CFE_MSG_Message_t *MsgPtr, uint32 MsgSize, +void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t *MsgPtr, size_t MsgSize, UT_TaskPipeDispatchId_t DispatchId) { + union + { + CFE_SB_Buffer_t Buf; + uint8 Bytes[CFE_MISSION_SB_MAX_SB_MSG_SIZE]; + } SBBuf; + + /* Copy message into aligned SB buffer */ + memcpy(SBBuf.Bytes, MsgPtr, MsgSize); + /* Set up for the typical task pipe related calls */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &DispatchId.MsgId, sizeof(DispatchId.MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &MsgSize, sizeof(MsgSize), false); @@ -233,7 +242,7 @@ void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_MSG_Message_t *), CFE_MSG_Message_ /* * Finally, call the actual task pipe requested. */ - TaskPipeFunc(MsgPtr); + TaskPipeFunc(&SBBuf.Buf); } int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) diff --git a/fsw/cfe-core/unit-test/ut_support.h b/fsw/cfe-core/unit-test/ut_support.h index 43593079f..6878077e5 100644 --- a/fsw/cfe-core/unit-test/ut_support.h +++ b/fsw/cfe-core/unit-test/ut_support.h @@ -280,7 +280,7 @@ void UT_ReportFailures(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_MSG_Message_t*), CFE_MSG_Message_t *MsgPtr, uint32 MsgSize, +void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t*), CFE_MSG_Message_t *MsgPtr, size_t MsgSize, UT_TaskPipeDispatchId_t DispatchId); /*****************************************************************************/ From d127a160ca48723359ff610ae3c5b2bb668ad729 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 30 Nov 2020 10:57:26 -0500 Subject: [PATCH 07/10] Fix #1009, Alignment pattern - core updates - Added CFE_SB_TransmitMsg, CFE_SB_TransmitBuffer, CFE_SB_ReceiveBuffer (partial #1019 fix) - Replace CFE_SB_RcvMsg with CFE_SB_ReceiveBuffer - Deprecated CFE_SB_SendMsg, CFE_SB_PassMsg, CFE_SB_RcvMsg CFE_SB_ZeroCopyPass, CFE_SB_ZeroCopySend - Use CFE_SB_Buffer_t for receiving and casting to command types - Use CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t in command and telemetry type definitions - Use CFE_SB_TransmitMsg to copy the command and telemetry into a CFE_SB_Buffer_t and send it where needed - Avoids need to create send buffers within the app (or union the packet types with CFE_SB_Buffer_t) - Eliminates references to CFE_SB_CmdHdr_t and CFE_SB_TlmHdr_t that formerly enforced alignment since these had potential to change the actual packet sizes - No need to cast to CFE_MSG_Message_t anywhere since it's available in the CFE_SB_Buffer_t union - CFE_MSG_Size_t redefined as size_t to simplify future transition - Replaced Syslog with SysLog for consistency - Added Cmd to all command typedefs - Replaced CFE_SB_CMD_HDR_SIZE and CFE_SB_TLM_HDR_SIZE with sizeof the appropriate type --- fsw/cfe-core/src/es/cfe_es_log.h | 6 +- fsw/cfe-core/src/es/cfe_es_perf.c | 8 +- fsw/cfe-core/src/es/cfe_es_syslog.c | 2 +- fsw/cfe-core/src/es/cfe_es_task.c | 190 ++++++----- fsw/cfe-core/src/es/cfe_es_task.h | 65 ++-- fsw/cfe-core/src/es/cfe_es_verify.h | 2 +- fsw/cfe-core/src/evs/cfe_evs_log.c | 4 +- fsw/cfe-core/src/evs/cfe_evs_log.h | 4 +- fsw/cfe-core/src/evs/cfe_evs_task.c | 152 ++++----- fsw/cfe-core/src/evs/cfe_evs_task.h | 42 +-- fsw/cfe-core/src/evs/cfe_evs_utils.c | 12 +- fsw/cfe-core/src/inc/cfe_error.h | 9 +- fsw/cfe-core/src/inc/cfe_es_msg.h | 263 +++++++++------- fsw/cfe-core/src/inc/cfe_evs.h | 6 +- fsw/cfe-core/src/inc/cfe_evs_msg.h | 197 +++++++----- fsw/cfe-core/src/inc/cfe_msg_typedefs.h | 2 +- fsw/cfe-core/src/inc/cfe_sb.h | 216 ++++++++----- fsw/cfe-core/src/inc/cfe_sb_events.h | 22 +- fsw/cfe-core/src/inc/cfe_sb_msg.h | 82 ++--- fsw/cfe-core/src/inc/cfe_tbl_events.h | 4 +- fsw/cfe-core/src/inc/cfe_tbl_msg.h | 150 +++++---- fsw/cfe-core/src/inc/cfe_time_msg.h | 216 ++++++------- fsw/cfe-core/src/sb/cfe_sb_api.c | 382 +++++++++++++---------- fsw/cfe-core/src/sb/cfe_sb_init.c | 2 +- fsw/cfe-core/src/sb/cfe_sb_priv.c | 2 +- fsw/cfe-core/src/sb/cfe_sb_priv.h | 58 ++-- fsw/cfe-core/src/sb/cfe_sb_task.c | 110 +++---- fsw/cfe-core/src/sb/cfe_sb_util.c | 4 +- fsw/cfe-core/src/tbl/cfe_tbl_internal.c | 14 +- fsw/cfe-core/src/tbl/cfe_tbl_task.c | 45 +-- fsw/cfe-core/src/tbl/cfe_tbl_task.h | 3 +- fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c | 30 +- fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h | 22 +- fsw/cfe-core/src/time/cfe_time_task.c | 181 +++++------ fsw/cfe-core/src/time/cfe_time_tone.c | 14 +- fsw/cfe-core/src/time/cfe_time_utils.c | 16 +- fsw/cfe-core/src/time/cfe_time_utils.h | 7 +- 37 files changed, 1379 insertions(+), 1165 deletions(-) diff --git a/fsw/cfe-core/src/es/cfe_es_log.h b/fsw/cfe-core/src/es/cfe_es_log.h index 147496ae3..fd92aa60d 100644 --- a/fsw/cfe-core/src/es/cfe_es_log.h +++ b/fsw/cfe-core/src/es/cfe_es_log.h @@ -75,7 +75,7 @@ * first significantly decreases the amount of time that the syslog is locked after * a file dump is requested. * - * This buffer also reflects the Syslog "burst size" that is guaranteed to be + * This buffer also reflects the SysLog "burst size" that is guaranteed to be * safe for concurrent writes and reads/dump operations. If applications Log more than * this amount of data in less time than it takes to write this amount of data to disk, * then some log messages may be corrupt or lost in the output file. @@ -121,7 +121,7 @@ */ /** - * \brief Buffer structure for reading data out of the Syslog + * \brief Buffer structure for reading data out of the SysLog * * Access to the syslog must be synchronized, so it is not possible to * directly access the contents. This structure keeps the state of @@ -309,7 +309,7 @@ void CFE_ES_SysLog_snprintf(char *Buffer, size_t BufferSize, const char *SpecStr * * A snapshot of the log indices is taken at the beginning of the writing * process. Additional log entries added after this (e.g. from applications - * calling CFE_ES_WriteToSyslog() after starting a syslog dump) will not be + * calling CFE_ES_WriteToSysLog() after starting a syslog dump) will not be * included in the dump file. * * Note that preference is given to the realtime application threads over diff --git a/fsw/cfe-core/src/es/cfe_es_perf.c b/fsw/cfe-core/src/es/cfe_es_perf.c index 518e4b55f..a4b47104c 100644 --- a/fsw/cfe-core/src/es/cfe_es_perf.c +++ b/fsw/cfe-core/src/es/cfe_es_perf.c @@ -158,7 +158,7 @@ uint32 CFE_ES_GetPerfLogDumpRemaining(void) /* CFE_ES_StartPerfDataCmd() -- */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfData_t *data) +int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_t *data) { const CFE_ES_StartPerfCmd_Payload_t *CmdPtr = &data->Payload; CFE_ES_PerfDumpGlobal_t *PerfDumpState = &CFE_ES_TaskData.BackgroundPerfDumpState; @@ -214,7 +214,7 @@ int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfData_t *data) /* CFE_ES_StopPerfDataCmd() -- */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfData_t *data) +int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfDataCmd_t *data) { const CFE_ES_StopPerfCmd_Payload_t *CmdPtr = &data->Payload; CFE_ES_PerfDumpGlobal_t *PerfDumpState = &CFE_ES_TaskData.BackgroundPerfDumpState; @@ -496,7 +496,7 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) /* CFE_ES_SetPerfFilterMaskCmd() -- */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMask_t *data) +int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMaskCmd_t *data) { const CFE_ES_SetPerfFilterMaskCmd_Payload_t *cmd = &data->Payload; @@ -526,7 +526,7 @@ int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMask_t *data) /* CFE_ES_SetPerfTriggerMaskCmd() -- */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMask_t *data) +int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMaskCmd_t *data) { const CFE_ES_SetPerfTrigMaskCmd_Payload_t *cmd = &data->Payload; diff --git a/fsw/cfe-core/src/es/cfe_es_syslog.c b/fsw/cfe-core/src/es/cfe_es_syslog.c index 5bb929348..1da1738af 100644 --- a/fsw/cfe-core/src/es/cfe_es_syslog.c +++ b/fsw/cfe-core/src/es/cfe_es_syslog.c @@ -33,7 +33,7 @@ ** ** Some functions have EXTERNAL SYNC REQUIREMENTS ** -** Syslog functions marked with "Unsync" in their name are designated +** SysLog functions marked with "Unsync" in their name are designated ** as functions which are _not_ safe to be called concurrently by multiple ** threads, and also do _not_ implement any locking or protection. These ** functions expect the caller to perform all thread synchronization before diff --git a/fsw/cfe-core/src/es/cfe_es_task.c b/fsw/cfe-core/src/es/cfe_es_task.c index 05bd7ae5e..c852c7614 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.c +++ b/fsw/cfe-core/src/es/cfe_es_task.c @@ -79,9 +79,9 @@ CFE_ES_TaskData_t CFE_ES_TaskData; void CFE_ES_TaskMain(void) { - int32 Status; - uint32 AppRunStatus = CFE_ES_RunStatus_APP_RUN; - + int32 Status; + uint32 AppRunStatus = CFE_ES_RunStatus_APP_RUN; + CFE_SB_Buffer_t *SBBufPtr; /* ** Performance Time Stamp Entry @@ -136,9 +136,7 @@ void CFE_ES_TaskMain(void) /* ** Wait for the next Software Bus message. */ - Status = CFE_SB_RcvMsg(&CFE_ES_TaskData.MsgPtr, - CFE_ES_TaskData.CmdPipe, - CFE_SB_PEND_FOREVER); + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_ES_TaskData.CmdPipe, CFE_SB_PEND_FOREVER); /* ** Performance Time Stamp Entry @@ -148,9 +146,9 @@ void CFE_ES_TaskMain(void) if (Status == CFE_SUCCESS) { /* - ** Process Software Bus message. + ** Process message. */ - CFE_ES_TaskPipe(CFE_ES_TaskData.MsgPtr); + CFE_ES_TaskPipe(SBBufPtr); /* * Wake up the background task, which includes the @@ -252,21 +250,21 @@ int32 CFE_ES_TaskInit(void) /* ** Initialize housekeeping packet (clear user data area) */ - CFE_MSG_Init(&CFE_ES_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_ES_TaskData.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID), sizeof(CFE_ES_TaskData.HkPacket)); /* ** Initialize single application telemetry packet */ - CFE_MSG_Init(&CFE_ES_TaskData.OneAppPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID), sizeof(CFE_ES_TaskData.OneAppPacket)); /* ** Initialize memory pool statistics telemetry packet */ - CFE_MSG_Init(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), sizeof(CFE_ES_TaskData.MemStatsPacket)); @@ -434,19 +432,19 @@ int32 CFE_ES_TaskInit(void) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr) +void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; - CFE_MSG_GetMsgId(MsgPtr, &MessageID); + CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); switch (CFE_SB_MsgIdToValue(MessageID)) { /* ** Housekeeping telemetry request */ case CFE_ES_SEND_HK_MID: - CFE_ES_HousekeepingCmd((CFE_SB_CmdHdr_t*)MsgPtr); + CFE_ES_HousekeepingCmd((CFE_MSG_CommandHeader_t *)SBBufPtr); break; /* @@ -454,174 +452,174 @@ void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr) */ case CFE_ES_CMD_MID: - CFE_MSG_GetFcnCode(MsgPtr, &CommandCode); + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode); switch (CommandCode) { case CFE_ES_NOOP_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_Noop_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_NoopCmd_t))) { - CFE_ES_NoopCmd((CFE_ES_Noop_t*)MsgPtr); + CFE_ES_NoopCmd((CFE_ES_NoopCmd_t*)SBBufPtr); } break; case CFE_ES_RESET_COUNTERS_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ResetCounters_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetCountersCmd_t))) { - CFE_ES_ResetCountersCmd((CFE_ES_ResetCounters_t*)MsgPtr); + CFE_ES_ResetCountersCmd((CFE_ES_ResetCountersCmd_t*)SBBufPtr); } break; case CFE_ES_RESTART_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_Restart_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartCmd_t))) { - CFE_ES_RestartCmd((CFE_ES_Restart_t*)MsgPtr); + CFE_ES_RestartCmd((CFE_ES_RestartCmd_t*)SBBufPtr); } break; case CFE_ES_START_APP_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StartApp_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartAppCmd_t))) { - CFE_ES_StartAppCmd((CFE_ES_StartApp_t*)MsgPtr); + CFE_ES_StartAppCmd((CFE_ES_StartAppCmd_t*)SBBufPtr); } break; case CFE_ES_STOP_APP_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StopApp_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopAppCmd_t))) { - CFE_ES_StopAppCmd((CFE_ES_StopApp_t*)MsgPtr); + CFE_ES_StopAppCmd((CFE_ES_StopAppCmd_t*)SBBufPtr); } break; case CFE_ES_RESTART_APP_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_RestartApp_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartAppCmd_t))) { - CFE_ES_RestartAppCmd((CFE_ES_RestartApp_t*)MsgPtr); + CFE_ES_RestartAppCmd((CFE_ES_RestartAppCmd_t*)SBBufPtr); } break; case CFE_ES_RELOAD_APP_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ReloadApp_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ReloadAppCmd_t))) { - CFE_ES_ReloadAppCmd((CFE_ES_ReloadApp_t*)MsgPtr); + CFE_ES_ReloadAppCmd((CFE_ES_ReloadAppCmd_t*)SBBufPtr); } break; case CFE_ES_QUERY_ONE_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_QueryOne_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryOneCmd_t))) { - CFE_ES_QueryOneCmd((CFE_ES_QueryOne_t*)MsgPtr); + CFE_ES_QueryOneCmd((CFE_ES_QueryOneCmd_t*)SBBufPtr); } break; case CFE_ES_QUERY_ALL_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_QueryAll_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllCmd_t))) { - CFE_ES_QueryAllCmd((CFE_ES_QueryAll_t*)MsgPtr); + CFE_ES_QueryAllCmd((CFE_ES_QueryAllCmd_t*)SBBufPtr); } break; case CFE_ES_QUERY_ALL_TASKS_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_QueryAllTasks_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllTasksCmd_t))) { - CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasks_t*)MsgPtr); + CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasksCmd_t*)SBBufPtr); } break; case CFE_ES_CLEAR_SYSLOG_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ClearSyslog_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearSysLogCmd_t))) { - CFE_ES_ClearSyslogCmd((CFE_ES_ClearSyslog_t*)MsgPtr); + CFE_ES_ClearSysLogCmd((CFE_ES_ClearSysLogCmd_t*)SBBufPtr); } break; case CFE_ES_WRITE_SYSLOG_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_WriteSyslog_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteSysLogCmd_t))) { - CFE_ES_WriteSyslogCmd((CFE_ES_WriteSyslog_t*)MsgPtr); + CFE_ES_WriteSysLogCmd((CFE_ES_WriteSysLogCmd_t*)SBBufPtr); } break; case CFE_ES_OVER_WRITE_SYSLOG_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_OverWriteSyslog_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_OverWriteSysLogCmd_t))) { - CFE_ES_OverWriteSyslogCmd((CFE_ES_OverWriteSyslog_t*)MsgPtr); + CFE_ES_OverWriteSysLogCmd((CFE_ES_OverWriteSysLogCmd_t*)SBBufPtr); } break; case CFE_ES_CLEAR_ER_LOG_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ClearERLog_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearERLogCmd_t))) { - CFE_ES_ClearERLogCmd((CFE_ES_ClearERLog_t*)MsgPtr); + CFE_ES_ClearERLogCmd((CFE_ES_ClearERLogCmd_t*)SBBufPtr); } break; case CFE_ES_WRITE_ER_LOG_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_WriteERLog_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteERLogCmd_t))) { - CFE_ES_WriteERLogCmd((CFE_ES_WriteERLog_t*)MsgPtr); + CFE_ES_WriteERLogCmd((CFE_ES_WriteERLogCmd_t*)SBBufPtr); } break; case CFE_ES_START_PERF_DATA_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StartPerfData_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartPerfDataCmd_t))) { - CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfData_t*)MsgPtr); + CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfDataCmd_t*)SBBufPtr); } break; case CFE_ES_STOP_PERF_DATA_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StopPerfData_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopPerfDataCmd_t))) { - CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfData_t*)MsgPtr); + CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfDataCmd_t*)SBBufPtr); } break; case CFE_ES_SET_PERF_FILTER_MASK_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SetPerfFilterMask_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfFilterMaskCmd_t))) { - CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMask_t*)MsgPtr); + CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMaskCmd_t*)SBBufPtr); } break; case CFE_ES_SET_PERF_TRIGGER_MASK_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SetPerfTriggerMask_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfTriggerMaskCmd_t))) { - CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMask_t*)MsgPtr); + CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMaskCmd_t*)SBBufPtr); } break; case CFE_ES_RESET_PR_COUNT_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ResetPRCount_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetPRCountCmd_t))) { - CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCount_t*)MsgPtr); + CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCountCmd_t*)SBBufPtr); } break; case CFE_ES_SET_MAX_PR_COUNT_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SetMaxPRCount_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetMaxPRCountCmd_t))) { - CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCount_t*)MsgPtr); + CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCountCmd_t*)SBBufPtr); } break; case CFE_ES_DELETE_CDS_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_DeleteCDS_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DeleteCDSCmd_t))) { - CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDS_t*)MsgPtr); + CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDSCmd_t*)SBBufPtr); } break; case CFE_ES_SEND_MEM_POOL_STATS_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SendMemPoolStats_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SendMemPoolStatsCmd_t))) { - CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStats_t*)MsgPtr); + CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStatsCmd_t*)SBBufPtr); } break; case CFE_ES_DUMP_CDS_REGISTRY_CC: - if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_DumpCDSRegistry_t))) + if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DumpCDSRegistryCmd_t))) { - CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistry_t*)MsgPtr); + CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistryCmd_t*)SBBufPtr); } break; @@ -652,7 +650,7 @@ void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) +int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) { OS_heap_prop_t HeapProp; int32 stat; @@ -746,8 +744,8 @@ int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send housekeeping telemetry packet. */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.HkPacket); - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.HkPacket); + CFE_SB_TimeStampMsg(&CFE_ES_TaskData.HkPacket.TlmHeader.Msg); + CFE_SB_TransmitMsg(&CFE_ES_TaskData.HkPacket.TlmHeader.Msg, true); /* ** This command does not affect the command execution counter. @@ -763,7 +761,7 @@ int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_NoopCmd(const CFE_ES_Noop_t *Cmd) +int32 CFE_ES_NoopCmd(const CFE_ES_NoopCmd_t *Cmd) { /* ** Advertise the build and version information with the no-op command @@ -804,7 +802,7 @@ int32 CFE_ES_NoopCmd(const CFE_ES_Noop_t *Cmd) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCounters_t *data) +int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCountersCmd_t *data) { CFE_ES_TaskData.CommandCounter = 0; CFE_ES_TaskData.CommandErrorCounter = 0; @@ -825,7 +823,7 @@ int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCounters_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_RestartCmd(const CFE_ES_Restart_t *data) +int32 CFE_ES_RestartCmd(const CFE_ES_RestartCmd_t *data) { const CFE_ES_RestartCmd_Payload_t *cmd = &data->Payload; @@ -854,7 +852,7 @@ int32 CFE_ES_RestartCmd(const CFE_ES_Restart_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data) +int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) { const CFE_ES_StartAppCmd_Payload_t *cmd = &data->Payload; CFE_ES_ResourceID_t AppID; @@ -966,7 +964,7 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_StopAppCmd(const CFE_ES_StopApp_t *data) +int32 CFE_ES_StopAppCmd(const CFE_ES_StopAppCmd_t *data) { const CFE_ES_AppNameCmd_Payload_t *cmd = &data->Payload; char LocalApp[OS_MAX_API_NAME]; @@ -1020,7 +1018,7 @@ int32 CFE_ES_StopAppCmd(const CFE_ES_StopApp_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartApp_t *data) +int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartAppCmd_t *data) { const CFE_ES_AppNameCmd_Payload_t *cmd = &data->Payload; char LocalApp[OS_MAX_API_NAME]; @@ -1070,7 +1068,7 @@ int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartApp_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadApp_t *data) +int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadAppCmd_t *data) { const CFE_ES_AppReloadCmd_Payload_t *cmd = &data->Payload; char LocalApp[OS_MAX_API_NAME]; @@ -1124,7 +1122,7 @@ int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadApp_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data) +int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data) { const CFE_ES_AppNameCmd_Payload_t *cmd = &data->Payload; char LocalApp[OS_MAX_API_NAME]; @@ -1154,8 +1152,8 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data) /* ** Send application status telemetry packet. */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.OneAppPacket); - Result = CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.OneAppPacket); + CFE_SB_TimeStampMsg(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg); + Result = CFE_SB_TransmitMsg(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg, true); if ( Result == CFE_SUCCESS ) { CFE_ES_TaskData.CommandCounter++; @@ -1187,7 +1185,7 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAll_t *data) +int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) { CFE_FS_Header_t FileHeader; osal_id_t FileDescriptor; @@ -1346,7 +1344,7 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAll_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasks_t *data) +int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) { CFE_FS_Header_t FileHeader; osal_id_t FileDescriptor; @@ -1488,11 +1486,11 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasks_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* CFE_ES_ClearSyslogCmd() -- Clear executive services system log */ +/* CFE_ES_ClearSysLogCmd() -- Clear executive services system log */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_ClearSyslogCmd(const CFE_ES_ClearSyslog_t *data) +int32 CFE_ES_ClearSysLogCmd(const CFE_ES_ClearSysLogCmd_t *data) { /* ** Clear syslog index and memory area @@ -1510,15 +1508,15 @@ int32 CFE_ES_ClearSyslogCmd(const CFE_ES_ClearSyslog_t *data) "Cleared Executive Services log data"); return CFE_SUCCESS; -} /* End of CFE_ES_ClearSyslogCmd() */ +} /* End of CFE_ES_ClearSysLogCmd() */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* CFE_ES_OverWriteSyslogCmd() -- set syslog mode */ +/* CFE_ES_OverWriteSysLogCmd() -- set syslog mode */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_OverWriteSyslogCmd(const CFE_ES_OverWriteSyslog_t *data) +int32 CFE_ES_OverWriteSysLogCmd(const CFE_ES_OverWriteSysLogCmd_t *data) { int32 Status; const CFE_ES_OverWriteSysLogCmd_Payload_t *CmdPtr = &data->Payload; @@ -1543,16 +1541,16 @@ int32 CFE_ES_OverWriteSyslogCmd(const CFE_ES_OverWriteSyslog_t *data) } return CFE_SUCCESS; -} /* End CFE_ES_OverWriteSyslogCmd() */ +} /* End CFE_ES_OverWriteSysLogCmd() */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* CFE_ES_WriteSyslogCmd() -- Process Cmd to write ES System Log to file */ +/* CFE_ES_WriteSysLogCmd() -- Process Cmd to write ES System Log to file */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_WriteSyslogCmd(const CFE_ES_WriteSyslog_t *data) +int32 CFE_ES_WriteSysLogCmd(const CFE_ES_WriteSysLogCmd_t *data) { const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; int32 Stat; @@ -1573,7 +1571,7 @@ int32 CFE_ES_WriteSyslogCmd(const CFE_ES_WriteSyslog_t *data) }/* end if */ return CFE_SUCCESS; -}/* end CFE_ES_WriteSyslogCmd */ +}/* end CFE_ES_WriteSysLogCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -1582,7 +1580,7 @@ int32 CFE_ES_WriteSyslogCmd(const CFE_ES_WriteSyslog_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLog_t *data) +int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLogCmd_t *data) { /* ** Clear ER log data buffer @@ -1617,7 +1615,7 @@ int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLog_t *data) /* log to a file. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLog_t *data) +int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLogCmd_t *data) { const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; @@ -1688,7 +1686,7 @@ bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_ResetPRCountCmd(const CFE_ES_ResetPRCount_t *data) +int32 CFE_ES_ResetPRCountCmd(const CFE_ES_ResetPRCountCmd_t *data) { /* ** Reset the processor reset count @@ -1712,7 +1710,7 @@ int32 CFE_ES_ResetPRCountCmd(const CFE_ES_ResetPRCount_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCount_t *data) +int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCountCmd_t *data) { const CFE_ES_SetMaxPRCountCmd_Payload_t *cmd = &data->Payload; @@ -1738,7 +1736,7 @@ int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCount_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDS_t *data) +int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDSCmd_t *data) { int32 Status; const CFE_ES_DeleteCDSCmd_Payload_t *cmd = &data->Payload; @@ -1799,7 +1797,7 @@ int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDS_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStats_t *data) +int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data) { const CFE_ES_SendMemPoolStatsCmd_Payload_t *Cmd; CFE_ES_MemHandle_t MemHandle; @@ -1822,8 +1820,8 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStats_t *data) /* ** Send memory statistics telemetry packet. */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.MemStatsPacket); - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.MemStatsPacket); + CFE_SB_TimeStampMsg(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.Msg); + CFE_SB_TransmitMsg(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.Msg, true); CFE_ES_TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_TLM_POOL_STATS_INFO_EID, CFE_EVS_EventType_DEBUG, @@ -1847,7 +1845,7 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStats_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data) +int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) { CFE_FS_Header_t StdFileHeader; osal_id_t FileDescriptor; diff --git a/fsw/cfe-core/src/es/cfe_es_task.h b/fsw/cfe-core/src/es/cfe_es_task.h index 670305ccb..22270cc50 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.h +++ b/fsw/cfe-core/src/es/cfe_es_task.h @@ -89,8 +89,6 @@ typedef struct char DataFileName[OS_MAX_PATH_LEN]; } CFE_ES_BackgroundLogDumpGlobal_t; - - /* ** Type definition (ES task global data) */ @@ -103,24 +101,23 @@ typedef struct uint8 CommandErrorCounter; /* - ** ES Task housekeeping telemetry packet + ** ES Task housekeeping telemetry */ - CFE_ES_HousekeepingTlm_t HkPacket; + CFE_ES_HousekeepingTlm_t HkPacket; /* - ** Single application telemetry packet + ** Single application telemetry */ - CFE_ES_OneAppTlm_t OneAppPacket; + CFE_ES_OneAppTlm_t OneAppPacket; /* - ** Single application telemetry packet + ** Memory statistics telemetry */ CFE_ES_MemStatsTlm_t MemStatsPacket; /* ** ES Task operational data (not reported in housekeeping) */ - CFE_MSG_Message_t *MsgPtr; CFE_SB_PipeId_t CmdPipe; /* @@ -160,7 +157,7 @@ extern CFE_ES_TaskData_t CFE_ES_TaskData; */ void CFE_ES_TaskMain(void); int32 CFE_ES_TaskInit(void); -void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr); +void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr); /* @@ -174,31 +171,31 @@ void CFE_ES_BackgroundCleanup(void); /* ** ES Task message dispatch functions */ -int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data); -int32 CFE_ES_NoopCmd(const CFE_ES_Noop_t *Cmd); -int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCounters_t *data); -int32 CFE_ES_RestartCmd(const CFE_ES_Restart_t *data); -int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data); -int32 CFE_ES_StopAppCmd(const CFE_ES_StopApp_t *data); -int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartApp_t *data); -int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadApp_t *data); -int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data); -int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAll_t *data); -int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasks_t *data); -int32 CFE_ES_ClearSyslogCmd(const CFE_ES_ClearSyslog_t *data); -int32 CFE_ES_OverWriteSyslogCmd(const CFE_ES_OverWriteSyslog_t *data); -int32 CFE_ES_WriteSyslogCmd(const CFE_ES_WriteSyslog_t *data); -int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLog_t *data); -int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLog_t *data); -int32 CFE_ES_ResetPRCountCmd(const CFE_ES_ResetPRCount_t *data); -int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCount_t *data); -int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDS_t *data); -int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfData_t *data); -int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfData_t *data); -int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMask_t *data); -int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMask_t *data); -int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStats_t *data); -int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data); +int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data); +int32 CFE_ES_NoopCmd(const CFE_ES_NoopCmd_t *Cmd); +int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCountersCmd_t *data); +int32 CFE_ES_RestartCmd(const CFE_ES_RestartCmd_t *data); +int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data); +int32 CFE_ES_StopAppCmd(const CFE_ES_StopAppCmd_t *data); +int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartAppCmd_t *data); +int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadAppCmd_t *data); +int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data); +int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data); +int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data); +int32 CFE_ES_ClearSysLogCmd(const CFE_ES_ClearSysLogCmd_t *data); +int32 CFE_ES_OverWriteSysLogCmd(const CFE_ES_OverWriteSysLogCmd_t *data); +int32 CFE_ES_WriteSysLogCmd(const CFE_ES_WriteSysLogCmd_t *data); +int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLogCmd_t *data); +int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLogCmd_t *data); +int32 CFE_ES_ResetPRCountCmd(const CFE_ES_ResetPRCountCmd_t *data); +int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCountCmd_t *data); +int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDSCmd_t *data); +int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_t *data); +int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfDataCmd_t *data); +int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMaskCmd_t *data); +int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMaskCmd_t *data); +int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data); +int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data); /* ** Message Handler Helper Functions diff --git a/fsw/cfe-core/src/es/cfe_es_verify.h b/fsw/cfe-core/src/es/cfe_es_verify.h index 8434e077c..b27beafbc 100644 --- a/fsw/cfe-core/src/es/cfe_es_verify.h +++ b/fsw/cfe-core/src/es/cfe_es_verify.h @@ -145,7 +145,7 @@ #endif /* -** Syslog mode +** SysLog mode */ #if CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE < 0 #error CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE cannot be less than 0! diff --git a/fsw/cfe-core/src/evs/cfe_evs_log.c b/fsw/cfe-core/src/evs/cfe_evs_log.c index e6c091203..b3583b2bf 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_log.c +++ b/fsw/cfe-core/src/evs/cfe_evs_log.c @@ -148,7 +148,7 @@ void EVS_ClearLog ( void ) ** Assumptions and Notes: ** */ -int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFile_t *data) +int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data) { const CFE_EVS_LogFileCmd_Payload_t *CmdPtr = &data->Payload; int32 Result; @@ -269,7 +269,7 @@ int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFile_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_SetLogModeCmd(const CFE_EVS_SetLogMode_t *data) +int32 CFE_EVS_SetLogModeCmd(const CFE_EVS_SetLogModeCmd_t *data) { const CFE_EVS_SetLogMode_Payload_t *CmdPtr = &data->Payload; int32 Status; diff --git a/fsw/cfe-core/src/evs/cfe_evs_log.h b/fsw/cfe-core/src/evs/cfe_evs_log.h index 9b05d7a74..736d7c919 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_log.h +++ b/fsw/cfe-core/src/evs/cfe_evs_log.h @@ -55,7 +55,7 @@ void EVS_AddLog ( CFE_EVS_LongEventTlm_t *EVS_PktPtr ); void EVS_ClearLog ( void ); -int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFile_t *data); -int32 CFE_EVS_SetLogModeCmd(const CFE_EVS_SetLogMode_t *data); +int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data); +int32 CFE_EVS_SetLogModeCmd(const CFE_EVS_SetLogModeCmd_t *data); #endif /* _cfe_evs_log_ */ diff --git a/fsw/cfe-core/src/evs/cfe_evs_task.c b/fsw/cfe-core/src/evs/cfe_evs_task.c index 8ac772f0c..e47e449ae 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_task.c +++ b/fsw/cfe-core/src/evs/cfe_evs_task.c @@ -53,7 +53,7 @@ CFE_EVS_GlobalData_t CFE_EVS_GlobalData; /* ** Local function prototypes. */ -void CFE_EVS_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId); +void CFE_EVS_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr, CFE_SB_MsgId_t MsgId); bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); /* Function Definitions */ @@ -86,7 +86,7 @@ int32 CFE_EVS_EarlyInit ( void ) memset(&CFE_EVS_GlobalData, 0, sizeof(CFE_EVS_GlobalData_t)); /* Initialize housekeeping packet */ - CFE_MSG_Init(&CFE_EVS_GlobalData.EVS_TlmPkt.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), + CFE_MSG_Init(&CFE_EVS_GlobalData.EVS_TlmPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), sizeof(CFE_EVS_GlobalData.EVS_TlmPkt)); /* Elements stored in the hk packet that have non-zero default values */ @@ -213,7 +213,7 @@ int32 CFE_EVS_CleanUpApp(CFE_ES_ResourceID_t AppID) void CFE_EVS_TaskMain(void) { int32 Status; - CFE_MSG_Message_t *MsgPtr; /* Pointer to SB message */ + CFE_SB_Buffer_t *SBBufPtr; CFE_ES_PerfLogEntry(CFE_MISSION_EVS_MAIN_PERF_ID); @@ -244,7 +244,7 @@ void CFE_EVS_TaskMain(void) CFE_ES_PerfLogExit(CFE_MISSION_EVS_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_RcvMsg(&MsgPtr, + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_EVS_GlobalData.EVS_CommandPipe, CFE_SB_PEND_FOREVER); @@ -253,14 +253,14 @@ void CFE_EVS_TaskMain(void) if (Status == CFE_SUCCESS) { /* Process cmd pipe msg */ - CFE_EVS_ProcessCommandPacket(MsgPtr); + CFE_EVS_ProcessCommandPacket(SBBufPtr); }else{ CFE_ES_WriteToSysLog("EVS:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); }/* end if */ }/* end while */ - /* while loop exits only if CFE_SB_RcvMsg returns error */ + /* while loop exits only if CFE_SB_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); } /* end CFE_EVS_TaskMain */ @@ -352,23 +352,23 @@ int32 CFE_EVS_TaskInit ( void ) ** Assumptions and Notes: ** */ -void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr) +void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; - CFE_MSG_GetMsgId(MsgPtr, &MessageID); + CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); /* Process all SB messages */ switch (CFE_SB_MsgIdToValue(MessageID)) { case CFE_EVS_CMD_MID: /* EVS task specific command */ - CFE_EVS_ProcessGroundCommand(MsgPtr, MessageID); + CFE_EVS_ProcessGroundCommand(SBBufPtr, MessageID); break; case CFE_EVS_SEND_HK_MID: /* Housekeeping request */ - CFE_EVS_ReportHousekeepingCmd((CFE_SB_CmdHdr_t*)MsgPtr); + CFE_EVS_ReportHousekeepingCmd((CFE_MSG_CommandHeader_t *)SBBufPtr); break; default: @@ -396,182 +396,182 @@ void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr) ** Assumptions and Notes: ** */ -void CFE_EVS_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) +void CFE_EVS_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr, CFE_SB_MsgId_t MsgId) { /* status will get reset if it passes length check */ int32 Status = CFE_STATUS_WRONG_MSG_LENGTH; CFE_MSG_FcnCode_t FcnCode = 0; - CFE_MSG_GetFcnCode(MsgPtr, &FcnCode); + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); /* Process "known" EVS task ground commands */ switch (FcnCode) { case CFE_EVS_NOOP_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_Noop_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_NoopCmd_t))) { - Status = CFE_EVS_NoopCmd((CFE_EVS_Noop_t*)MsgPtr); + Status = CFE_EVS_NoopCmd((CFE_EVS_NoopCmd_t*)SBBufPtr); } break; case CFE_EVS_RESET_COUNTERS_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetCounters_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetCountersCmd_t))) { - Status = CFE_EVS_ResetCountersCmd((CFE_EVS_ResetCounters_t*)MsgPtr); + Status = CFE_EVS_ResetCountersCmd((CFE_EVS_ResetCountersCmd_t*)SBBufPtr); } break; case CFE_EVS_ENABLE_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnableEventType_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableEventTypeCmd_t))) { - Status = CFE_EVS_EnableEventTypeCmd((CFE_EVS_EnableEventType_t*)MsgPtr); + Status = CFE_EVS_EnableEventTypeCmd((CFE_EVS_EnableEventTypeCmd_t*)SBBufPtr); } break; case CFE_EVS_DISABLE_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisableEventType_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableEventTypeCmd_t))) { - Status = CFE_EVS_DisableEventTypeCmd((CFE_EVS_DisableEventType_t*)MsgPtr); + Status = CFE_EVS_DisableEventTypeCmd((CFE_EVS_DisableEventTypeCmd_t*)SBBufPtr); } break; case CFE_EVS_SET_EVENT_FORMAT_MODE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_SetEventFormatMode_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetEventFormatModeCmd_t))) { - Status = CFE_EVS_SetEventFormatModeCmd((CFE_EVS_SetEventFormatMode_t*)MsgPtr); + Status = CFE_EVS_SetEventFormatModeCmd((CFE_EVS_SetEventFormatModeCmd_t*)SBBufPtr); } break; case CFE_EVS_ENABLE_APP_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnableAppEventType_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableAppEventTypeCmd_t))) { - Status = CFE_EVS_EnableAppEventTypeCmd((CFE_EVS_EnableAppEventType_t*)MsgPtr); + Status = CFE_EVS_EnableAppEventTypeCmd((CFE_EVS_EnableAppEventTypeCmd_t*)SBBufPtr); } break; case CFE_EVS_DISABLE_APP_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisableAppEventType_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableAppEventTypeCmd_t))) { - Status = CFE_EVS_DisableAppEventTypeCmd((CFE_EVS_DisableAppEventType_t*)MsgPtr); + Status = CFE_EVS_DisableAppEventTypeCmd((CFE_EVS_DisableAppEventTypeCmd_t*)SBBufPtr); } break; case CFE_EVS_ENABLE_APP_EVENTS_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnableAppEvents_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableAppEventsCmd_t))) { - Status = CFE_EVS_EnableAppEventsCmd((CFE_EVS_EnableAppEvents_t*)MsgPtr); + Status = CFE_EVS_EnableAppEventsCmd((CFE_EVS_EnableAppEventsCmd_t*)SBBufPtr); } break; case CFE_EVS_DISABLE_APP_EVENTS_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisableAppEvents_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableAppEventsCmd_t))) { - Status = CFE_EVS_DisableAppEventsCmd((CFE_EVS_DisableAppEvents_t*)MsgPtr); + Status = CFE_EVS_DisableAppEventsCmd((CFE_EVS_DisableAppEventsCmd_t*)SBBufPtr); } break; case CFE_EVS_RESET_APP_COUNTER_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetAppCounter_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetAppCounterCmd_t))) { - Status = CFE_EVS_ResetAppCounterCmd((CFE_EVS_ResetAppCounter_t*)MsgPtr); + Status = CFE_EVS_ResetAppCounterCmd((CFE_EVS_ResetAppCounterCmd_t*)SBBufPtr); } break; case CFE_EVS_SET_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_SetFilter_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetFilterCmd_t))) { - Status = CFE_EVS_SetFilterCmd((CFE_EVS_SetFilter_t*)MsgPtr); + Status = CFE_EVS_SetFilterCmd((CFE_EVS_SetFilterCmd_t*)SBBufPtr); } break; case CFE_EVS_ENABLE_PORTS_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnablePorts_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnablePortsCmd_t))) { - Status = CFE_EVS_EnablePortsCmd((CFE_EVS_EnablePorts_t*)MsgPtr); + Status = CFE_EVS_EnablePortsCmd((CFE_EVS_EnablePortsCmd_t*)SBBufPtr); } break; case CFE_EVS_DISABLE_PORTS_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisablePorts_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisablePortsCmd_t))) { - Status = CFE_EVS_DisablePortsCmd((CFE_EVS_DisablePorts_t*)MsgPtr); + Status = CFE_EVS_DisablePortsCmd((CFE_EVS_DisablePortsCmd_t*)SBBufPtr); } break; case CFE_EVS_RESET_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetFilter_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetFilterCmd_t))) { - Status = CFE_EVS_ResetFilterCmd((CFE_EVS_ResetFilter_t*)MsgPtr); + Status = CFE_EVS_ResetFilterCmd((CFE_EVS_ResetFilterCmd_t*)SBBufPtr); } break; case CFE_EVS_RESET_ALL_FILTERS_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetAllFilters_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetAllFiltersCmd_t))) { - Status = CFE_EVS_ResetAllFiltersCmd((CFE_EVS_ResetAllFilters_t*)MsgPtr); + Status = CFE_EVS_ResetAllFiltersCmd((CFE_EVS_ResetAllFiltersCmd_t*)SBBufPtr); } break; case CFE_EVS_ADD_EVENT_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_AddEventFilter_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_AddEventFilterCmd_t))) { - Status = CFE_EVS_AddEventFilterCmd((CFE_EVS_AddEventFilter_t*)MsgPtr); + Status = CFE_EVS_AddEventFilterCmd((CFE_EVS_AddEventFilterCmd_t*)SBBufPtr); } break; case CFE_EVS_DELETE_EVENT_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DeleteEventFilter_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DeleteEventFilterCmd_t))) { - Status = CFE_EVS_DeleteEventFilterCmd((CFE_EVS_DeleteEventFilter_t*)MsgPtr); + Status = CFE_EVS_DeleteEventFilterCmd((CFE_EVS_DeleteEventFilterCmd_t*)SBBufPtr); } break; case CFE_EVS_WRITE_APP_DATA_FILE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_WriteAppDataFile_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_WriteAppDataFileCmd_t))) { - Status = CFE_EVS_WriteAppDataFileCmd((CFE_EVS_WriteAppDataFile_t*)MsgPtr); + Status = CFE_EVS_WriteAppDataFileCmd((CFE_EVS_WriteAppDataFileCmd_t*)SBBufPtr); } break; case CFE_EVS_SET_LOG_MODE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_SetLogMode_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetLogModeCmd_t))) { - Status = CFE_EVS_SetLogModeCmd((CFE_EVS_SetLogMode_t*)MsgPtr); + Status = CFE_EVS_SetLogModeCmd((CFE_EVS_SetLogModeCmd_t*)SBBufPtr); } break; case CFE_EVS_CLEAR_LOG_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ClearLog_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ClearLogCmd_t))) { - Status = CFE_EVS_ClearLogCmd((CFE_EVS_ClearLog_t *)MsgPtr); + Status = CFE_EVS_ClearLogCmd((CFE_EVS_ClearLogCmd_t *)SBBufPtr); } break; case CFE_EVS_WRITE_LOG_DATA_FILE_CC: - if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_WriteLogDataFile_t))) + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_WriteLogDataFileCmd_t))) { - Status = CFE_EVS_WriteLogDataFileCmd((CFE_EVS_WriteLogDataFile_t*)MsgPtr); + Status = CFE_EVS_WriteLogDataFileCmd((CFE_EVS_WriteLogDataFileCmd_t*)SBBufPtr); } break; @@ -649,7 +649,7 @@ bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) ** Assumptions and Notes: ** */ -int32 CFE_EVS_NoopCmd(const CFE_EVS_Noop_t *data) +int32 CFE_EVS_NoopCmd(const CFE_EVS_NoopCmd_t *data) { EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION,"No-op command. %s", CFE_VERSION_STRING); @@ -666,7 +666,7 @@ int32 CFE_EVS_NoopCmd(const CFE_EVS_Noop_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLog_t *data) +int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLogCmd_t *data) { int32 Status; @@ -694,7 +694,7 @@ int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLog_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data) +int32 CFE_EVS_ReportHousekeepingCmd (const CFE_MSG_CommandHeader_t *data) { uint32 i, j; EVS_AppData_t *AppDataPtr; @@ -732,9 +732,9 @@ int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data) AppTlmDataPtr->AppMessageSentCounter = 0; } - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_EVS_GlobalData.EVS_TlmPkt); + CFE_SB_TimeStampMsg(&CFE_EVS_GlobalData.EVS_TlmPkt.TlmHeader.Msg); - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_EVS_GlobalData.EVS_TlmPkt); + CFE_SB_TransmitMsg(&CFE_EVS_GlobalData.EVS_TlmPkt.TlmHeader.Msg, true); return CFE_STATUS_NO_COUNTER_INCREMENT; } /* End of CFE_EVS_ReportHousekeepingCmd() */ @@ -751,7 +751,7 @@ int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCounters_t *data) +int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCountersCmd_t *data) { /* Status of commands processed by EVS task */ CFE_EVS_GlobalData.EVS_TlmPkt.Payload.CommandCounter = 0; @@ -781,7 +781,7 @@ int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCounters_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_SetFilterCmd(const CFE_EVS_SetFilter_t *data) +int32 CFE_EVS_SetFilterCmd(const CFE_EVS_SetFilterCmd_t *data) { const CFE_EVS_AppNameEventIDMaskCmd_Payload_t *CmdPtr = &data->Payload; EVS_BinFilter_t *FilterPtr; @@ -858,7 +858,7 @@ int32 CFE_EVS_SetFilterCmd(const CFE_EVS_SetFilter_t *data) ** Shifting is done so the value not masked off is placed in the ones spot: ** necessary for comparing with true. */ -int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePorts_t *data) +int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePortsCmd_t *data) { const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; int32 ReturnCode; @@ -914,7 +914,7 @@ int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePorts_t *data) ** Shifting is done so the value not masked off is placed in the ones spot: ** necessary for comparing with true. */ -int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePorts_t *data) +int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePortsCmd_t *data) { const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; int32 ReturnCode; @@ -972,7 +972,7 @@ int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePorts_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_EnableEventTypeCmd(const CFE_EVS_EnableEventType_t *data) +int32 CFE_EVS_EnableEventTypeCmd(const CFE_EVS_EnableEventTypeCmd_t *data) { uint32 i; const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; @@ -1023,7 +1023,7 @@ int32 CFE_EVS_EnableEventTypeCmd(const CFE_EVS_EnableEventType_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_DisableEventTypeCmd(const CFE_EVS_DisableEventType_t *data) +int32 CFE_EVS_DisableEventTypeCmd(const CFE_EVS_DisableEventTypeCmd_t *data) { uint32 i; const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; @@ -1075,7 +1075,7 @@ int32 CFE_EVS_DisableEventTypeCmd(const CFE_EVS_DisableEventType_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_SetEventFormatModeCmd(const CFE_EVS_SetEventFormatMode_t *data) +int32 CFE_EVS_SetEventFormatModeCmd(const CFE_EVS_SetEventFormatModeCmd_t *data) { const CFE_EVS_SetEventFormatMode_Payload_t *CmdPtr = &data->Payload; int32 Status; @@ -1113,7 +1113,7 @@ int32 CFE_EVS_SetEventFormatModeCmd(const CFE_EVS_SetEventFormatMode_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_EnableAppEventTypeCmd(const CFE_EVS_EnableAppEventType_t *data) +int32 CFE_EVS_EnableAppEventTypeCmd(const CFE_EVS_EnableAppEventTypeCmd_t *data) { const CFE_EVS_AppNameBitMaskCmd_Payload_t *CmdPtr = &data->Payload; EVS_AppData_t *AppDataPtr; @@ -1188,7 +1188,7 @@ int32 CFE_EVS_EnableAppEventTypeCmd(const CFE_EVS_EnableAppEventType_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_DisableAppEventTypeCmd(const CFE_EVS_DisableAppEventType_t *data) +int32 CFE_EVS_DisableAppEventTypeCmd(const CFE_EVS_DisableAppEventTypeCmd_t *data) { EVS_AppData_t *AppDataPtr; const CFE_EVS_AppNameBitMaskCmd_Payload_t *CmdPtr = &data->Payload; @@ -1262,7 +1262,7 @@ int32 CFE_EVS_DisableAppEventTypeCmd(const CFE_EVS_DisableAppEventType_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEvents_t *data) +int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEventsCmd_t *data) { EVS_AppData_t *AppDataPtr; const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; @@ -1321,7 +1321,7 @@ int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEvents_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_DisableAppEventsCmd(const CFE_EVS_DisableAppEvents_t *data) +int32 CFE_EVS_DisableAppEventsCmd(const CFE_EVS_DisableAppEventsCmd_t *data) { EVS_AppData_t *AppDataPtr; const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; @@ -1381,7 +1381,7 @@ int32 CFE_EVS_DisableAppEventsCmd(const CFE_EVS_DisableAppEvents_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_ResetAppCounterCmd(const CFE_EVS_ResetAppCounter_t *data) +int32 CFE_EVS_ResetAppCounterCmd(const CFE_EVS_ResetAppCounterCmd_t *data) { EVS_AppData_t *AppDataPtr; const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; @@ -1441,7 +1441,7 @@ int32 CFE_EVS_ResetAppCounterCmd(const CFE_EVS_ResetAppCounter_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_ResetFilterCmd(const CFE_EVS_ResetFilter_t *data) +int32 CFE_EVS_ResetFilterCmd(const CFE_EVS_ResetFilterCmd_t *data) { const CFE_EVS_AppNameEventIDCmd_Payload_t *CmdPtr = &data->Payload; EVS_BinFilter_t *FilterPtr; @@ -1515,7 +1515,7 @@ int32 CFE_EVS_ResetFilterCmd(const CFE_EVS_ResetFilter_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_ResetAllFiltersCmd(const CFE_EVS_ResetAllFilters_t *data) +int32 CFE_EVS_ResetAllFiltersCmd(const CFE_EVS_ResetAllFiltersCmd_t *data) { EVS_AppData_t *AppDataPtr; const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; @@ -1578,7 +1578,7 @@ int32 CFE_EVS_ResetAllFiltersCmd(const CFE_EVS_ResetAllFilters_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_AddEventFilterCmd(const CFE_EVS_AddEventFilter_t *data) +int32 CFE_EVS_AddEventFilterCmd(const CFE_EVS_AddEventFilterCmd_t *data) { const CFE_EVS_AppNameEventIDMaskCmd_Payload_t *CmdPtr = &data->Payload; EVS_BinFilter_t *FilterPtr; @@ -1671,7 +1671,7 @@ int32 CFE_EVS_AddEventFilterCmd(const CFE_EVS_AddEventFilter_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_DeleteEventFilterCmd(const CFE_EVS_DeleteEventFilter_t *data) +int32 CFE_EVS_DeleteEventFilterCmd(const CFE_EVS_DeleteEventFilterCmd_t *data) { const CFE_EVS_AppNameEventIDCmd_Payload_t *CmdPtr = &data->Payload; EVS_BinFilter_t *FilterPtr; @@ -1749,7 +1749,7 @@ int32 CFE_EVS_DeleteEventFilterCmd(const CFE_EVS_DeleteEventFilter_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_WriteAppDataFileCmd(const CFE_EVS_WriteAppDataFile_t *data) +int32 CFE_EVS_WriteAppDataFileCmd(const CFE_EVS_WriteAppDataFileCmd_t *data) { int32 Result; osal_id_t FileHandle; diff --git a/fsw/cfe-core/src/evs/cfe_evs_task.h b/fsw/cfe-core/src/evs/cfe_evs_task.h index bf6007f3b..40a5e3aea 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_task.h +++ b/fsw/cfe-core/src/evs/cfe_evs_task.h @@ -140,31 +140,31 @@ extern CFE_EVS_GlobalData_t CFE_EVS_GlobalData; * Functions used within this module and by the unit test */ extern int32 CFE_EVS_TaskInit (void); -extern void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr); +extern void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr); /* * EVS Message Handler Functions */ -int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data); -int32 CFE_EVS_NoopCmd(const CFE_EVS_Noop_t *data); -int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLog_t *data); -int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCounters_t *data); -int32 CFE_EVS_SetFilterCmd(const CFE_EVS_SetFilter_t *data); -int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePorts_t *data); -int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePorts_t *data); -int32 CFE_EVS_EnableEventTypeCmd(const CFE_EVS_EnableEventType_t *data); -int32 CFE_EVS_DisableEventTypeCmd(const CFE_EVS_DisableEventType_t *data); -int32 CFE_EVS_SetEventFormatModeCmd(const CFE_EVS_SetEventFormatMode_t *data); -int32 CFE_EVS_EnableAppEventTypeCmd(const CFE_EVS_EnableAppEventType_t *data); -int32 CFE_EVS_DisableAppEventTypeCmd(const CFE_EVS_DisableAppEventType_t *data); -int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEvents_t *data); -int32 CFE_EVS_DisableAppEventsCmd(const CFE_EVS_DisableAppEvents_t *data); -int32 CFE_EVS_ResetAppCounterCmd(const CFE_EVS_ResetAppCounter_t *data); -int32 CFE_EVS_ResetFilterCmd(const CFE_EVS_ResetFilter_t *data); -int32 CFE_EVS_AddEventFilterCmd(const CFE_EVS_AddEventFilter_t *data); -int32 CFE_EVS_DeleteEventFilterCmd(const CFE_EVS_DeleteEventFilter_t *data); -int32 CFE_EVS_WriteAppDataFileCmd(const CFE_EVS_WriteAppDataFile_t *data); -int32 CFE_EVS_ResetAllFiltersCmd(const CFE_EVS_ResetAllFilters_t *data); +int32 CFE_EVS_ReportHousekeepingCmd(const CFE_MSG_CommandHeader_t *data); +int32 CFE_EVS_NoopCmd(const CFE_EVS_NoopCmd_t *data); +int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLogCmd_t *data); +int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCountersCmd_t *data); +int32 CFE_EVS_SetFilterCmd(const CFE_EVS_SetFilterCmd_t *data); +int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePortsCmd_t *data); +int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePortsCmd_t *data); +int32 CFE_EVS_EnableEventTypeCmd(const CFE_EVS_EnableEventTypeCmd_t *data); +int32 CFE_EVS_DisableEventTypeCmd(const CFE_EVS_DisableEventTypeCmd_t *data); +int32 CFE_EVS_SetEventFormatModeCmd(const CFE_EVS_SetEventFormatModeCmd_t *data); +int32 CFE_EVS_EnableAppEventTypeCmd(const CFE_EVS_EnableAppEventTypeCmd_t *data); +int32 CFE_EVS_DisableAppEventTypeCmd(const CFE_EVS_DisableAppEventTypeCmd_t *data); +int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEventsCmd_t *data); +int32 CFE_EVS_DisableAppEventsCmd(const CFE_EVS_DisableAppEventsCmd_t *data); +int32 CFE_EVS_ResetAppCounterCmd(const CFE_EVS_ResetAppCounterCmd_t *data); +int32 CFE_EVS_ResetFilterCmd(const CFE_EVS_ResetFilterCmd_t *data); +int32 CFE_EVS_AddEventFilterCmd(const CFE_EVS_AddEventFilterCmd_t *data); +int32 CFE_EVS_DeleteEventFilterCmd(const CFE_EVS_DeleteEventFilterCmd_t *data); +int32 CFE_EVS_WriteAppDataFileCmd(const CFE_EVS_WriteAppDataFileCmd_t *data); +int32 CFE_EVS_ResetAllFiltersCmd(const CFE_EVS_ResetAllFiltersCmd_t *data); #endif /* _cfe_evs_task_ */ diff --git a/fsw/cfe-core/src/evs/cfe_evs_utils.c b/fsw/cfe-core/src/evs/cfe_evs_utils.c index 74993f862..c1cb9b25d 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_utils.c +++ b/fsw/cfe-core/src/evs/cfe_evs_utils.c @@ -404,7 +404,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 int ExpandedLength; /* Initialize EVS event packets */ - CFE_MSG_Init(&LongEventTlm.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), + CFE_MSG_Init(&LongEventTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), sizeof(LongEventTlm)); LongEventTlm.Payload.PacketID.EventID = EventID; LongEventTlm.Payload.PacketID.EventType = EventType; @@ -428,7 +428,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 LongEventTlm.Payload.PacketID.ProcessorID = CFE_PSP_GetProcessorId(); /* Set the packet timestamp */ - CFE_MSG_SetMsgTime((CFE_MSG_Message_t *) &LongEventTlm, *TimeStamp); + CFE_MSG_SetMsgTime(&LongEventTlm.TlmHeader.Msg, *TimeStamp); /* Write event to the event log */ EVS_AddLog(&LongEventTlm); @@ -439,7 +439,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 if (CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_LONG) { /* Send long event via SoftwareBus */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &LongEventTlm); + CFE_SB_TransmitMsg(&LongEventTlm.TlmHeader.Msg, true); } else if (CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_SHORT) { @@ -449,11 +449,11 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 * * This goes out on a separate message ID. */ - CFE_MSG_Init(&ShortEventTlm.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), + CFE_MSG_Init(&ShortEventTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), sizeof(ShortEventTlm)); - CFE_MSG_SetMsgTime((CFE_MSG_Message_t *) &ShortEventTlm, *TimeStamp); + CFE_MSG_SetMsgTime(&ShortEventTlm.TlmHeader.Msg, *TimeStamp); ShortEventTlm.Payload.PacketID = LongEventTlm.Payload.PacketID; - CFE_SB_SendMsg((CFE_MSG_Message_t *) &ShortEventTlm); + CFE_SB_TransmitMsg(&ShortEventTlm.TlmHeader.Msg, true); } /* Increment message send counters (prevent rollover) */ diff --git a/fsw/cfe-core/src/inc/cfe_error.h b/fsw/cfe-core/src/inc/cfe_error.h index b561c2bfa..872c89f03 100644 --- a/fsw/cfe-core/src/inc/cfe_error.h +++ b/fsw/cfe-core/src/inc/cfe_error.h @@ -717,7 +717,7 @@ typedef int32 CFE_Status_t; /** * @brief Time Out * - * In #CFE_SB_RcvMsg, this return value indicates that a packet has not + * In #CFE_SB_ReceiveBuffer, this return value indicates that a packet has not * been received in the time given in the "timeout" parameter. * */ @@ -727,7 +727,7 @@ typedef int32 CFE_Status_t; /** * @brief No Message * - * When "Polling" a pipe for a message in #CFE_SB_RcvMsg, this return + * When "Polling" a pipe for a message in #CFE_SB_ReceiveBuffer, this return * value indicates that there was not a message on the pipe. * */ @@ -796,9 +796,8 @@ typedef int32 CFE_Status_t; /** * @brief Buffer Allocation Error * - * This error code will be returned from #CFE_SB_SendMsg when the memory - * in the SB message buffer pool has been depleted. The amount of memory - * in the pool is dictated by the configuration parameter + * Returned when the memory in the SB message buffer pool has been depleted. + * The amount of memory in the pool is dictated by the configuration parameter * #CFE_PLATFORM_SB_BUF_MEMORY_BYTES specified in the cfe_platform_cfg.h file. Also * the memory statistics, including current utilization figures and high * water marks for the SB Buffer memory pool can be monitored by sending diff --git a/fsw/cfe-core/src/inc/cfe_es_msg.h b/fsw/cfe-core/src/inc/cfe_es_msg.h index 96fdc420b..7748b52df 100644 --- a/fsw/cfe-core/src/inc/cfe_es_msg.h +++ b/fsw/cfe-core/src/inc/cfe_es_msg.h @@ -39,8 +39,6 @@ ** Includes */ #include "cfe_es_extern_typedefs.h" - -/* The CFE_SB_CMD_HDR_SIZE and CFE_SB_TLM_HDR_SIZE are defined by cfe_sb.h */ #include "cfe_sb.h" /* @@ -58,7 +56,7 @@ ** \cfecmdmnemonic \ES_NOOP ** ** \par Command Structure -** #CFE_ES_NoArgsCmd_t +** #CFE_ES_NoopCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -94,7 +92,7 @@ ** \cfecmdmnemonic \ES_RESETCTRS ** ** \par Command Structure -** #CFE_ES_NoArgsCmd_t +** #CFE_ES_ResetCountersCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -138,7 +136,7 @@ ** \cfecmdmnemonic \ES_RESET ** ** \par Command Structure -** #CFE_ES_RestartCmd_Payload_t +** #CFE_ES_RestartCmd_t ** ** \par Command Verification ** Successful execution of this command (as a Processor Reset) @@ -182,7 +180,7 @@ ** \cfecmdmnemonic \ES_STARTAPP ** ** \par Command Structure -** #CFE_ES_StartApp_t +** #CFE_ES_StartAppCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -232,7 +230,7 @@ ** \cfecmdmnemonic \ES_STOPAPP ** ** \par Command Structure -** #CFE_ES_AppNameCmd_t +** #CFE_ES_StopAppCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -279,7 +277,7 @@ ** \cfecmdmnemonic \ES_RESTARTAPP ** ** \par Command Structure -** #CFE_ES_AppNameCmd_t +** #CFE_ES_RestartAppCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -325,7 +323,7 @@ ** \cfecmdmnemonic \ES_RELOADAPP ** ** \par Command Structure -** #CFE_ES_ReloadApp_t +** #CFE_ES_ReloadAppCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -367,7 +365,7 @@ ** \cfecmdmnemonic \ES_QUERYAPP ** ** \par Command Structure -** #CFE_ES_AppNameCmd_t +** #CFE_ES_QueryOneCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -405,7 +403,7 @@ ** \cfecmdmnemonic \ES_WRITEAPPINFO2FILE ** ** \par Command Structure -** #CFE_ES_FileNameCmd_t +** #CFE_ES_QueryAllCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -446,7 +444,7 @@ ** \cfecmdmnemonic \ES_CLEARSYSLOG ** ** \par Command Structure -** #CFE_ES_NoArgsCmd_t +** #CFE_ES_ClearSysLogCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -485,7 +483,7 @@ ** \cfecmdmnemonic \ES_WRITESYSLOG2FILE ** ** \par Command Structure -** #CFE_ES_FileNameCmd_t +** #CFE_ES_WriteSysLogCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -528,7 +526,7 @@ ** \cfecmdmnemonic \ES_CLEARERLOG ** ** \par Command Structure -** #CFE_ES_NoArgsCmd_t +** #CFE_ES_ClearERLogCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -565,7 +563,7 @@ ** \cfecmdmnemonic \ES_WRITEERLOG2FILE ** ** \par Command Structure -** #CFE_ES_FileNameCmd_t +** #CFE_ES_WriteERLogCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -606,7 +604,7 @@ ** \cfecmdmnemonic \ES_STARTLADATA ** ** \par Command Structure -** #CFE_ES_StartPerfData_t +** #CFE_ES_StartPerfDataCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -652,7 +650,7 @@ ** \cfecmdmnemonic \ES_STOPLADATA ** ** \par Command Structure -** #CFE_ES_StopPerfData_t +** #CFE_ES_StopPerfDataCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -695,7 +693,7 @@ ** \cfecmdmnemonic \ES_LAFILTERMASK ** ** \par Command Structure -** #CFE_ES_SetPerfFilterMask_t +** #CFE_ES_SetPerfFilterMaskCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -733,7 +731,7 @@ ** \cfecmdmnemonic \ES_LATRIGGERMASK ** ** \par Command Structure -** #CFE_ES_SetPerfTriggerMask_t +** #CFE_ES_SetPerfTriggerMaskCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -773,7 +771,7 @@ ** \cfecmdmnemonic \ES_OVERWRITESYSLOGMODE ** ** \par Command Structure -** #CFE_ES_OverWriteSyslog_t +** #CFE_ES_OverWriteSysLogCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -815,7 +813,7 @@ ** \cfecmdmnemonic \ES_RESETPRCNT ** ** \par Command Structure -** #CFE_ES_NoArgsCmd_t +** #CFE_ES_ResetPRCountCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -853,7 +851,7 @@ ** \cfecmdmnemonic \ES_SETMAXPRCNT ** ** \par Command Structure -** #CFE_ES_SetMaxPRCount_t +** #CFE_ES_SetMaxPRCountCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -894,7 +892,7 @@ ** \cfecmdmnemonic \ES_DELETECDS ** ** \par Command Structure -** #CFE_ES_DeleteCDS_t +** #CFE_ES_DeleteCDSCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -937,7 +935,7 @@ ** \cfecmdmnemonic \ES_TLMPOOLSTATS ** ** \par Command Structure -** #CFE_ES_SendMemPoolStats_t +** #CFE_ES_SendMemPoolStatsCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -979,7 +977,7 @@ ** \cfecmdmnemonic \ES_DUMPCDSREG ** ** \par Command Structure -** #CFE_ES_DumpCDSRegistry_t +** #CFE_ES_DumpCDSRegistryCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -1020,7 +1018,7 @@ ** \cfecmdmnemonic \ES_WRITETASKINFO2FILE ** ** \par Command Structure -** #CFE_ES_FileNameCmd_t +** #CFE_ES_QueryAllTasksCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -1072,8 +1070,7 @@ */ typedef struct CFE_ES_NoArgsCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } CFE_ES_NoArgsCmd_t; /* @@ -1083,14 +1080,14 @@ typedef struct CFE_ES_NoArgsCmd * allows them to change independently in the future without changing the prototype * of the handler function. */ -typedef CFE_ES_NoArgsCmd_t CFE_ES_Noop_t; -typedef CFE_ES_NoArgsCmd_t CFE_ES_ResetCounters_t; -typedef CFE_ES_NoArgsCmd_t CFE_ES_ClearSyslog_t; -typedef CFE_ES_NoArgsCmd_t CFE_ES_ClearERLog_t; -typedef CFE_ES_NoArgsCmd_t CFE_ES_ResetPRCount_t; +typedef CFE_ES_NoArgsCmd_t CFE_ES_NoopCmd_t; +typedef CFE_ES_NoArgsCmd_t CFE_ES_ResetCountersCmd_t; +typedef CFE_ES_NoArgsCmd_t CFE_ES_ClearSysLogCmd_t; +typedef CFE_ES_NoArgsCmd_t CFE_ES_ClearERLogCmd_t; +typedef CFE_ES_NoArgsCmd_t CFE_ES_ResetPRCountCmd_t; /** -** \brief Restart cFE Command +** \brief Restart cFE Command Payload ** ** For command details, see #CFE_ES_RESTART_CC ** @@ -1101,15 +1098,17 @@ typedef struct CFE_ES_RestartCmd_Payload or #CFE_PSP_RST_TYPE_POWERON=Power-On Reset */ } CFE_ES_RestartCmd_Payload_t; -typedef struct CFE_ES_Restart +/** + * \brief Restart cFE Command + */ +typedef struct CFE_ES_RestartCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_RestartCmd_Payload_t Payload; -} CFE_ES_Restart_t; - + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_RestartCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_RestartCmd_t; /** -** \brief Payload format for commands which accept a single file name +** \brief Generic file name command payload ** ** This format is shared by several executive services commands. ** For command details, see #CFE_ES_QUERY_ALL_CC, #CFE_ES_QUERY_ALL_TASKS_CC, @@ -1122,23 +1121,26 @@ typedef struct CFE_ES_FileNameCmd_Payload filename of file in which Application data is to be dumped */ } CFE_ES_FileNameCmd_Payload_t; +/** + * \brief Generic file name command + */ typedef struct CFE_ES_FileNameCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_FileNameCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_FileNameCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_FileNameCmd_t; /* * Unique typedefs for each of the commands that utilize the FileNameCmd * packet format */ -typedef CFE_ES_FileNameCmd_t CFE_ES_QueryAll_t; -typedef CFE_ES_FileNameCmd_t CFE_ES_QueryAllTasks_t; -typedef CFE_ES_FileNameCmd_t CFE_ES_WriteSyslog_t; -typedef CFE_ES_FileNameCmd_t CFE_ES_WriteERLog_t; +typedef CFE_ES_FileNameCmd_t CFE_ES_QueryAllCmd_t; +typedef CFE_ES_FileNameCmd_t CFE_ES_QueryAllTasksCmd_t; +typedef CFE_ES_FileNameCmd_t CFE_ES_WriteSysLogCmd_t; +typedef CFE_ES_FileNameCmd_t CFE_ES_WriteERLogCmd_t; /** -** \brief Overwrite/Discard System Log Configuration Command +** \brief Overwrite/Discard System Log Configuration Command Payload ** ** For command details, see #CFE_ES_OVER_WRITE_SYSLOG_CC ** @@ -1150,14 +1152,17 @@ typedef struct CFE_ES_OverWriteSysLogCmd_Payload } CFE_ES_OverWriteSysLogCmd_Payload_t; -typedef struct CFE_ES_OverWriteSyslog +/** + * \brief Overwrite/Discard System Log Configuration Command Payload + */ +typedef struct CFE_ES_OverWriteSysLogCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_OverWriteSysLogCmd_Payload_t Payload; -} CFE_ES_OverWriteSyslog_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_OverWriteSysLogCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_OverWriteSysLogCmd_t; /** -** \brief Start Application Command +** \brief Start Application Command Payload ** ** For command details, see #CFE_ES_START_APP_CC ** @@ -1179,14 +1184,17 @@ typedef struct CFE_ES_StartAppCmd_Payload } CFE_ES_StartAppCmd_Payload_t; +/** + * \brief Start Application Command + */ typedef struct CFE_ES_StartApp { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_StartAppCmd_Payload_t Payload; -} CFE_ES_StartApp_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_StartAppCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_StartAppCmd_t; /** -** \brief Command Structure for Commands requiring just an Application Name +** \brief Generic application name command payload ** ** For command details, see #CFE_ES_STOP_APP_CC, #CFE_ES_RESTART_APP_CC, #CFE_ES_QUERY_ONE_CC ** @@ -1196,10 +1204,13 @@ typedef struct CFE_ES_AppNameCmd_Payload char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief ASCII text string containing Application Name */ } CFE_ES_AppNameCmd_Payload_t; +/** + * \brief Generic application name command + */ typedef struct CFE_ES_AppNameCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_AppNameCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_AppNameCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_AppNameCmd_t; /* @@ -1207,12 +1218,12 @@ typedef struct CFE_ES_AppNameCmd * Create a separate typedef for each one so they can all evolve independently * without affecting the prototype. */ -typedef CFE_ES_AppNameCmd_t CFE_ES_StopApp_t; -typedef CFE_ES_AppNameCmd_t CFE_ES_RestartApp_t; -typedef CFE_ES_AppNameCmd_t CFE_ES_QueryOne_t; +typedef CFE_ES_AppNameCmd_t CFE_ES_StopAppCmd_t; +typedef CFE_ES_AppNameCmd_t CFE_ES_RestartAppCmd_t; +typedef CFE_ES_AppNameCmd_t CFE_ES_QueryOneCmd_t; /** -** \brief Reload Application Command +** \brief Reload Application Command Payload ** ** For command details, see #CFE_ES_RELOAD_APP_CC ** @@ -1224,14 +1235,17 @@ typedef struct CFE_ES_AppReloadCmd_Payload executable image */ } CFE_ES_AppReloadCmd_Payload_t; -typedef struct CFE_ES_ReloadApp +/** + * \brief Reload Application Command + */ +typedef struct CFE_ES_ReloadAppCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_AppReloadCmd_Payload_t Payload; -} CFE_ES_ReloadApp_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_AppReloadCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_ReloadAppCmd_t; /** -** \brief Set Maximum Processor Reset Count Command +** \brief Set Maximum Processor Reset Count Command Payload ** ** For command details, see #CFE_ES_SET_MAX_PR_COUNT_CC ** @@ -1242,14 +1256,17 @@ typedef struct CFE_ES_SetMaxPRCountCmd_Payload an automatic Power-On Reset is performed */ } CFE_ES_SetMaxPRCountCmd_Payload_t; -typedef struct CFE_ES_SetMaxPRCount +/** + * \brief Set Maximum Processor Reset Count Command + */ +typedef struct CFE_ES_SetMaxPRCountCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_SetMaxPRCountCmd_Payload_t Payload; -} CFE_ES_SetMaxPRCount_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_SetMaxPRCountCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_SetMaxPRCountCmd_t; /** -** \brief Delete Critical Data Store Command +** \brief Delete Critical Data Store Command Payload ** ** For command details, see #CFE_ES_DELETE_CDS_CC ** @@ -1260,14 +1277,17 @@ typedef struct CFE_ES_DeleteCDSCmd_Payload } CFE_ES_DeleteCDSCmd_Payload_t; -typedef struct CFE_ES_DeleteCDS +/** + * \brief Delete Critical Data Store Command + */ +typedef struct CFE_ES_DeleteCDSCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_DeleteCDSCmd_Payload_t Payload; -} CFE_ES_DeleteCDS_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_DeleteCDSCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_DeleteCDSCmd_t; /** -** \brief Start Performance Analyzer Command +** \brief Start Performance Analyzer Command Payload ** ** For command details, see #CFE_ES_START_PERF_DATA_CC ** @@ -1277,14 +1297,17 @@ typedef struct CFE_ES_StartPerfCmd_Payload uint32 TriggerMode; /**< \brief Desired trigger position (Start, Center, End) */ } CFE_ES_StartPerfCmd_Payload_t; -typedef struct CFE_ES_StartPerfData +/** + * \brief Start Performance Analyzer Command + */ +typedef struct CFE_ES_StartPerfDataCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_StartPerfCmd_Payload_t Payload; -} CFE_ES_StartPerfData_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_StartPerfCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_StartPerfDataCmd_t; /** -** \brief Stop Performance Analyzer Command +** \brief Stop Performance Analyzer Command Payload ** ** For command details, see #CFE_ES_STOP_PERF_DATA_CC ** @@ -1295,15 +1318,18 @@ typedef struct CFE_ES_StopPerfCmd_Payload of file Performance Analyzer data is to be written */ } CFE_ES_StopPerfCmd_Payload_t; -typedef struct CFE_ES_StopPerfData +/** + * \brief Stop Performance Analyzer Command + */ +typedef struct CFE_ES_StopPerfDataCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_StopPerfCmd_Payload_t Payload; -} CFE_ES_StopPerfData_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_StopPerfCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_StopPerfDataCmd_t; /** -** \brief Set Performance Analyzer Filter Mask Command +** \brief Set Performance Analyzer Filter Mask Command Payload ** ** For command details, see #CFE_ES_SET_PERF_FILTER_MASK_CC ** @@ -1315,14 +1341,17 @@ typedef struct CFE_ES_SetPerfFilterMaskCmd_Payload } CFE_ES_SetPerfFilterMaskCmd_Payload_t; -typedef struct CFE_ES_SetPerfFilterMask +/** + * \brief Set Performance Analyzer Filter Mask Command + */ +typedef struct CFE_ES_SetPerfFilterMaskCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_SetPerfFilterMaskCmd_Payload_t Payload; -} CFE_ES_SetPerfFilterMask_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_SetPerfFilterMaskCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_SetPerfFilterMaskCmd_t; /** -** \brief Set Performance Analyzer Trigger Mask Command +** \brief Set Performance Analyzer Trigger Mask Command Payload ** ** For command details, see #CFE_ES_SET_PERF_TRIGGER_MASK_CC ** @@ -1334,14 +1363,17 @@ typedef struct CFE_ES_SetPerfTrigMaskCmd_Payload } CFE_ES_SetPerfTrigMaskCmd_Payload_t; -typedef struct CFE_ES_SetPerfTriggerMask +/** + * \brief Set Performance Analyzer Trigger Mask Command + */ +typedef struct CFE_ES_SetPerfTriggerMaskCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_SetPerfTrigMaskCmd_Payload_t Payload; -} CFE_ES_SetPerfTriggerMask_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_SetPerfTrigMaskCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_SetPerfTriggerMaskCmd_t; /** -** \brief Telemeter Memory Pool Statistics Command +** \brief Send Memory Pool Statistics Command Payload ** ** For command details, see #CFE_ES_SEND_MEM_POOL_STATS_CC ** @@ -1353,14 +1385,17 @@ typedef struct CFE_ES_SendMemPoolStatsCmd_Payload } CFE_ES_SendMemPoolStatsCmd_Payload_t; -typedef struct CFE_ES_SendMemPoolStats +/** + * \brief Send Memory Pool Statistics Command + */ +typedef struct CFE_ES_SendMemPoolStatsCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_SendMemPoolStatsCmd_Payload_t Payload; -} CFE_ES_SendMemPoolStats_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_SendMemPoolStatsCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_SendMemPoolStatsCmd_t; /** -** \brief Dump CDS Registry Command +** \brief Dump CDS Registry Command Payload ** ** For command details, see #CFE_ES_DUMP_CDS_REGISTRY_CC ** @@ -1371,12 +1406,14 @@ typedef struct CFE_ES_DumpCDSRegistryCmd_Payload of file CDS Registry is to be written */ } CFE_ES_DumpCDSRegistryCmd_Payload_t; -typedef struct CFE_ES_DumpCDSRegistry +/** + * \brief Dump CDS Registry Command + */ +typedef struct CFE_ES_DumpCDSRegistryCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_ES_DumpCDSRegistryCmd_Payload_t Payload; - -} CFE_ES_DumpCDSRegistry_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_ES_DumpCDSRegistryCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_ES_DumpCDSRegistryCmd_t; /*************************************************************************/ @@ -1529,8 +1566,8 @@ typedef struct CFE_ES_OneAppTlm_Payload typedef struct CFE_ES_OneAppTlm { - CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_ES_OneAppTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_ES_OneAppTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_ES_OneAppTlm_t; /** @@ -1545,8 +1582,8 @@ typedef struct CFE_ES_PoolStatsTlm_Payload typedef struct CFE_ES_MemStatsTlm { - CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_ES_PoolStatsTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_ES_PoolStatsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_ES_MemStatsTlm_t; /*************************************************************************/ @@ -1642,8 +1679,8 @@ typedef struct CFE_ES_HousekeepingTlm_Payload typedef struct CFE_ES_HousekeepingTlm { - CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_ES_HousekeepingTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_ES_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_ES_HousekeepingTlm_t; diff --git a/fsw/cfe-core/src/inc/cfe_evs.h b/fsw/cfe-core/src/inc/cfe_evs.h index 044c5b539..9b0a62517 100644 --- a/fsw/cfe-core/src/inc/cfe_evs.h +++ b/fsw/cfe-core/src/inc/cfe_evs.h @@ -214,7 +214,7 @@ CFE_Status_t CFE_EVS_Unregister( void ); ** in the format string; they will mess up the formatting when the events are ** displayed on the ground system. ** -** \return Execution status below or from #CFE_ES_GetAppID/#CFE_SB_SendMsg, see \ref CFEReturnCodes +** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED ** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID @@ -265,7 +265,7 @@ CFE_Status_t CFE_EVS_SendEvent (uint16 EventID, ** in the format string; they will mess up the formatting when the events are ** displayed on the ground system. ** -** \return Execution status below or from #CFE_ES_GetAppID/#CFE_SB_SendMsg, see \ref CFEReturnCodes +** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED ** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID @@ -317,7 +317,7 @@ CFE_Status_t CFE_EVS_SendEventWithAppID (uint16 EventID, ** in the format string; they will mess up the formatting when the events are ** displayed on the ground system. ** -** \return Execution status below or from #CFE_ES_GetAppID/#CFE_SB_SendMsg, see \ref CFEReturnCodes +** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED ** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID diff --git a/fsw/cfe-core/src/inc/cfe_evs_msg.h b/fsw/cfe-core/src/inc/cfe_evs_msg.h index 63c9496ef..5bbc90761 100644 --- a/fsw/cfe-core/src/inc/cfe_evs_msg.h +++ b/fsw/cfe-core/src/inc/cfe_evs_msg.h @@ -56,7 +56,7 @@ ** \cfecmdmnemonic \EVS_NOOP ** ** \par Command Structure -** #CFE_TBL_NoArgsCmd_t +** #CFE_EVS_NoopCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -90,7 +90,7 @@ ** \cfecmdmnemonic \EVS_RESETCTRS ** ** \par Command Structure -** #CFE_TBL_NoArgsCmd_t +** #CFE_EVS_ResetCountersCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -128,7 +128,7 @@ ** \cfecmdmnemonic \EVS_ENAEVENTTYPE ** ** \par Command Structure -** #CFE_EVS_BitMaskCmd_t +** #CFE_EVS_EnableEventTypeCmd_t ** The following bit positions apply to structure member named 'BitMask'. ** Bit 0 - Debug ** Bit 1 - Informational @@ -177,7 +177,7 @@ ** \cfecmdmnemonic \EVS_DISEVENTTYPE ** ** \par Command Structure -** #CFE_EVS_BitMaskCmd_t +** #CFE_EVS_DisableEventTypeCmd_t ** The following bit positions apply to structure member named 'BitMask'. ** Bit 0 - Debug ** Bit 1 - Informational @@ -235,7 +235,7 @@ ** \cfecmdmnemonic \EVS_SETEVTFMT ** ** \par Command Structure -** #CFE_EVS_SetLogMode_t +** #CFE_EVS_SetEventFormatModeCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -278,7 +278,7 @@ ** \cfecmdmnemonic \EVS_ENAAPPEVTTYPE ** ** \par Command Structure -** #CFE_EVS_AppNameBitMaskCmd_t +** #CFE_EVS_EnableAppEventTypeCmd_t ** The following bit positions apply to structure member named 'BitMask'. ** Bit 0 - Debug ** Bit 1 - Informational @@ -330,7 +330,7 @@ ** \cfecmdmnemonic \EVS_DISAPPEVTTYPE ** ** \par Command Structure -** #CFE_EVS_AppNameBitMaskCmd_t +** #CFE_EVS_DisableAppEventTypeCmd_t ** The following bit positions apply to structure member named 'BitMask'. ** Bit 0 - Debug ** Bit 1 - Informational @@ -379,7 +379,7 @@ ** \cfecmdmnemonic \EVS_ENAAPPEVGEN ** ** \par Command Structure -** #CFE_EVS_AppNameCmd_t +** #CFE_EVS_EnableAppEventsCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -420,7 +420,7 @@ ** \cfecmdmnemonic \EVS_DISAPPEVGEN ** ** \par Command Structure -** #CFE_EVS_AppNameCmd_t +** #CFE_EVS_DisableAppEventsCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -461,7 +461,7 @@ ** \cfecmdmnemonic \EVS_RSTAPPCTRS ** ** \par Command Structure -** #CFE_EVS_AppNameCmd_t +** #CFE_EVS_ResetAppCounterCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -500,7 +500,7 @@ ** \cfecmdmnemonic \EVS_SETBINFLTRMASK ** ** \par Command Structure -** #CFE_EVS_AppNameEventIDMaskCmd_t +** #CFE_EVS_SetFilterCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -539,7 +539,7 @@ ** \cfecmdmnemonic \EVS_ENAPORT ** ** \par Command Structure -** #CFE_EVS_BitMaskCmd_t +** #CFE_EVS_EnablePortsCmd_t ** The following bit positions apply to structure member named 'BitMask'. ** Bit 0 - Port 1 ** Bit 1 - Port 2 @@ -579,7 +579,7 @@ ** \cfecmdmnemonic \EVS_DISPORT ** ** \par Command Structure -** #CFE_EVS_BitMaskCmd_t +** #CFE_EVS_DisablePortsCmd_t ** The following bit positions apply to structure member named 'BitMask'. ** Bit 0 - Port 1 ** Bit 1 - Port 2 @@ -621,7 +621,7 @@ ** \cfecmdmnemonic \EVS_RSTBINFLTRCTR ** ** \par Command Structure -** #CFE_EVS_AppNameEventIDCmd_t +** #CFE_EVS_ResetFilterCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -657,7 +657,7 @@ ** \cfecmdmnemonic \EVS_RSTALLFLTRS ** ** \par Command Structure -** #CFE_EVS_AppNameCmd_t +** #CFE_EVS_ResetAllFiltersCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -693,7 +693,7 @@ ** \cfecmdmnemonic \EVS_ADDEVTFLTR ** ** \par Command Structure -** #CFE_EVS_AppNameEventIDMaskCmd_t +** #CFE_EVS_AddEventFilterCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -729,7 +729,7 @@ ** \cfecmdmnemonic \EVS_DELEVTFLTR ** ** \par Command Structure -** #CFE_EVS_AppNameEventIDCmd_t +** #CFE_EVS_DeleteEventFilterCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -765,7 +765,7 @@ ** \cfecmdmnemonic \EVS_WRITEAPPDATA2FILE ** ** \par Command Structure -** #CFE_EVS_WriteAppDataFile_t +** #CFE_EVS_WriteAppDataFileCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -800,7 +800,7 @@ ** \cfecmdmnemonic \EVS_WRITELOG2FILE ** ** \par Command Structure -** #CFE_EVS_WriteLogDataFile_t +** #CFE_EVS_WriteLogDataFileCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -833,7 +833,7 @@ ** \cfecmdmnemonic \EVS_SETLOGMODE ** ** \par Command Structure -** #CFE_EVS_SetLogMode_t +** #CFE_EVS_SetLogModeCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -869,7 +869,7 @@ ** \cfecmdmnemonic \EVS_CLRLOG ** ** \par Command Structure -** #CFE_TBL_NoArgsCmd_t +** #CFE_EVS_ClearLogCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -919,7 +919,7 @@ ** \brief Command with no additional arguments **/ typedef struct CFE_EVS_NoArgsCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } CFE_EVS_NoArgsCmd_t; /* @@ -927,28 +927,31 @@ typedef struct CFE_EVS_NoArgsCmd { * Create a unique type for each one so the prototypes will follow the naming pattern, * allowing each command to evolve independently. */ -typedef CFE_EVS_NoArgsCmd_t CFE_EVS_Noop_t; -typedef CFE_EVS_NoArgsCmd_t CFE_EVS_ResetCounters_t; -typedef CFE_EVS_NoArgsCmd_t CFE_EVS_ClearLog_t; +typedef CFE_EVS_NoArgsCmd_t CFE_EVS_NoopCmd_t; +typedef CFE_EVS_NoArgsCmd_t CFE_EVS_ResetCountersCmd_t; +typedef CFE_EVS_NoArgsCmd_t CFE_EVS_ClearLogCmd_t; /** -** \brief Write Event Log to File Command +** \brief Write Event Log to File Command Payload ** ** For command details, see #CFE_EVS_WRITE_LOG_DATA_FILE_CC ** **/ typedef struct CFE_EVS_LogFileCmd_Payload { - char LogFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename where log data is to be written */ + char LogFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename where log data is to be written */ } CFE_EVS_LogFileCmd_Payload_t; -typedef struct CFE_EVS_WriteLogDataFile { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_LogFileCmd_Payload_t Payload; -} CFE_EVS_WriteLogDataFile_t; +/** + * \brief Write Event Log to File Command + */ +typedef struct CFE_EVS_WriteLogDataFileCmd { + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_LogFileCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_EVS_WriteLogDataFileCmd_t; /** -** \brief Write Event Services Application Information to File Command +** \brief Write Event Services Application Information to File Command Payload ** ** For command details, see #CFE_EVS_WRITE_APP_DATA_FILE_CC ** @@ -957,31 +960,37 @@ typedef struct CFE_EVS_AppDataCmd_Payload { char AppDataFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename where applicaton data is to be written */ } CFE_EVS_AppDataCmd_Payload_t; -typedef struct CFE_EVS_WriteAppDataFile { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_AppDataCmd_Payload_t Payload; -} CFE_EVS_WriteAppDataFile_t; +/** + * \brief Write Event Services Application Information to File Command + */ +typedef struct CFE_EVS_WriteAppDataFileCmd { + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_AppDataCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_EVS_WriteAppDataFileCmd_t; /** -** \brief Set Event Format Mode or Set Log Mode Commands +** \brief Set Log Mode Command Payload ** -** For command details, see #CFE_EVS_SET_EVENT_FORMAT_MODE_CC and/or #CFE_EVS_SET_LOG_MODE_CC +** For command details, see #CFE_EVS_SET_LOG_MODE_CC ** **/ typedef struct CFE_EVS_SetLogMode_Payload { CFE_EVS_LogMode_Enum_t LogMode; /**< \brief Mode to use in the command*/ - uint8 Spare; /**< \brief Pad to even byte*/ + uint8 Spare; /**< \brief Pad to even byte*/ } CFE_EVS_SetLogMode_Payload_t; -typedef struct CFE_EVS_SetLogMode { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_SetLogMode_Payload_t Payload; -} CFE_EVS_SetLogMode_t; +/** + * \brief Set Log Mode Command + */ +typedef struct CFE_EVS_SetLogModeCmd { + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_SetLogMode_Payload_t Payload; /**< \brief Command payload */ +} CFE_EVS_SetLogModeCmd_t; /** -** \brief Set Event Format Mode or Set Log Mode Commands +** \brief Set Event Format Mode Command Payload ** -** For command details, see #CFE_EVS_SET_EVENT_FORMAT_MODE_CC and/or #CFE_EVS_SET_LOG_MODE_CC +** For command details, see #CFE_EVS_SET_EVENT_FORMAT_MODE_CC ** **/ typedef struct CFE_EVS_SetEventFormatCode_Payload { @@ -989,13 +998,16 @@ typedef struct CFE_EVS_SetEventFormatCode_Payload { uint8 Spare; /**< \brief Pad to even byte*/ } CFE_EVS_SetEventFormatMode_Payload_t; -typedef struct CFE_EVS_SetEventFormatMode { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_SetEventFormatMode_Payload_t Payload; -} CFE_EVS_SetEventFormatMode_t; +/** + * \brief Set Event Format Mode Command + */ +typedef struct CFE_EVS_SetEventFormatModeCmd { + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_SetEventFormatMode_Payload_t Payload; /**< \brief Command payload */ +} CFE_EVS_SetEventFormatModeCmd_t; /** -** \brief Enable/Disable Events or Ports Commands +** \brief Generic Bitmask Command Payload ** ** For command details, see #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, ** #CFE_EVS_ENABLE_PORTS_CC and/or #CFE_EVS_DISABLE_PORTS_CC @@ -1006,9 +1018,12 @@ typedef struct CFE_EVS_BitMaskCmd_Payload { uint8 Spare; /**< \brief Pad to even byte*/ } CFE_EVS_BitMaskCmd_Payload_t; +/** + * \brief Generic Bitmask Command + */ typedef struct CFE_EVS_BitMaskCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_BitMaskCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_BitMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_BitMaskCmd_t; /* @@ -1016,13 +1031,13 @@ typedef struct CFE_EVS_BitMaskCmd { * Create a unique type for each one so the prototypes will follow the naming pattern, * allowing each command to evolve independently. */ -typedef CFE_EVS_BitMaskCmd_t CFE_EVS_EnablePorts_t; -typedef CFE_EVS_BitMaskCmd_t CFE_EVS_DisablePorts_t; -typedef CFE_EVS_BitMaskCmd_t CFE_EVS_EnableEventType_t; -typedef CFE_EVS_BitMaskCmd_t CFE_EVS_DisableEventType_t; +typedef CFE_EVS_BitMaskCmd_t CFE_EVS_EnablePortsCmd_t; +typedef CFE_EVS_BitMaskCmd_t CFE_EVS_DisablePortsCmd_t; +typedef CFE_EVS_BitMaskCmd_t CFE_EVS_EnableEventTypeCmd_t; +typedef CFE_EVS_BitMaskCmd_t CFE_EVS_DisableEventTypeCmd_t; /** -** \brief Enable/Disable Application Events or Reset One or All Filter Counters +** \brief Generic App Name Command Payload ** ** For command details, see #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC, ** #CFE_EVS_RESET_APP_COUNTER_CC and/or #CFE_EVS_RESET_ALL_FILTERS_CC @@ -1032,9 +1047,12 @@ typedef struct CFE_EVS_AppNameCmd_Payload { char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ } CFE_EVS_AppNameCmd_Payload_t; +/** + * \brief Generic App Name Command + */ typedef struct CFE_EVS_AppNameCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_AppNameCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_AppNameCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameCmd_t; /* @@ -1042,15 +1060,15 @@ typedef struct CFE_EVS_AppNameCmd { * Create a unique type for each one so the prototypes will follow the naming pattern, * allowing each command to evolve independently. */ -typedef CFE_EVS_AppNameCmd_t CFE_EVS_EnableAppEvents_t; -typedef CFE_EVS_AppNameCmd_t CFE_EVS_DisableAppEvents_t; -typedef CFE_EVS_AppNameCmd_t CFE_EVS_ResetAppCounter_t; -typedef CFE_EVS_AppNameCmd_t CFE_EVS_ResetAllFilters_t; +typedef CFE_EVS_AppNameCmd_t CFE_EVS_EnableAppEventsCmd_t; +typedef CFE_EVS_AppNameCmd_t CFE_EVS_DisableAppEventsCmd_t; +typedef CFE_EVS_AppNameCmd_t CFE_EVS_ResetAppCounterCmd_t; +typedef CFE_EVS_AppNameCmd_t CFE_EVS_ResetAllFiltersCmd_t; /** -** \brief Reset an Event Filter for an Application +** \brief Generic App Name and Event ID Command Payload ** -** For command details, see #CFE_EVS_RESET_FILTER_CC +** For command details, see #CFE_EVS_RESET_FILTER_CC and #CFE_EVS_DELETE_EVENT_FILTER_CC ** **/ typedef struct CFE_EVS_AppNameEventIDCmd_Payload { @@ -1058,9 +1076,12 @@ typedef struct CFE_EVS_AppNameEventIDCmd_Payload { uint16 EventID; /**< \brief Event ID to use in the command*/ } CFE_EVS_AppNameEventIDCmd_Payload_t; +/** + * \brief Generic App Name and Event ID Command + */ typedef struct CFE_EVS_AppNameEventIDCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_AppNameEventIDCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_AppNameEventIDCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameEventIDCmd_t; /* @@ -1068,11 +1089,11 @@ typedef struct CFE_EVS_AppNameEventIDCmd { * Create a unique type for each one so the prototypes will follow the naming pattern, * allowing each command to evolve independently. */ -typedef CFE_EVS_AppNameEventIDCmd_t CFE_EVS_ResetFilter_t; -typedef CFE_EVS_AppNameEventIDCmd_t CFE_EVS_DeleteEventFilter_t; +typedef CFE_EVS_AppNameEventIDCmd_t CFE_EVS_ResetFilterCmd_t; +typedef CFE_EVS_AppNameEventIDCmd_t CFE_EVS_DeleteEventFilterCmd_t; /** -** \brief Enable/Disable an Event Type for an Application +** \brief Generic App Name and Bitmask Command Payload ** ** For command details, see #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC and/or #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC ** @@ -1083,9 +1104,12 @@ typedef struct CFE_EVS_AppNameBitMaskCmd_Payload { uint8 Spare; /**< \brief Pad to even byte*/ } CFE_EVS_AppNameBitMaskCmd_Payload_t; +/** + * \brief Generic App Name and Bitmask Command + */ typedef struct CFE_EVS_AppNameBitMaskCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_AppNameBitMaskCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_AppNameBitMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameBitMaskCmd_t; /* @@ -1093,11 +1117,11 @@ typedef struct CFE_EVS_AppNameBitMaskCmd { * Create a unique type for each one so the prototypes will follow the naming pattern, * allowing each command to evolve independently. */ -typedef CFE_EVS_AppNameBitMaskCmd_t CFE_EVS_EnableAppEventType_t; -typedef CFE_EVS_AppNameBitMaskCmd_t CFE_EVS_DisableAppEventType_t; +typedef CFE_EVS_AppNameBitMaskCmd_t CFE_EVS_EnableAppEventTypeCmd_t; +typedef CFE_EVS_AppNameBitMaskCmd_t CFE_EVS_DisableAppEventTypeCmd_t; /** -** \brief Set, Add or Delete an Event Filter for an Application +** \brief Generic App Name, Event ID, Mask Command Payload ** ** For command details, see #CFE_EVS_SET_FILTER_CC, #CFE_EVS_ADD_EVENT_FILTER_CC ** and/or #CFE_EVS_DELETE_EVENT_FILTER_CC @@ -1109,9 +1133,12 @@ typedef struct CFE_EVS_AppNameEventIDMaskCmd_Payload { uint16 Mask; /**< \brief Mask to use in the command */ } CFE_EVS_AppNameEventIDMaskCmd_Payload_t; +/** + * \brief Generic App Name, Event ID, Mask Command + */ typedef struct CFE_EVS_AppNameEventIDMaskCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_EVS_AppNameEventIDMaskCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_AppNameEventIDMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameEventIDMaskCmd_t; /* @@ -1119,8 +1146,8 @@ typedef struct CFE_EVS_AppNameEventIDMaskCmd { * Create a unique type for each one so the prototypes will follow the naming pattern, * allowing each command to evolve independently. */ -typedef CFE_EVS_AppNameEventIDMaskCmd_t CFE_EVS_AddEventFilter_t; -typedef CFE_EVS_AppNameEventIDMaskCmd_t CFE_EVS_SetFilter_t; +typedef CFE_EVS_AppNameEventIDMaskCmd_t CFE_EVS_AddEventFilterCmd_t; +typedef CFE_EVS_AppNameEventIDMaskCmd_t CFE_EVS_SetFilterCmd_t; /*************************************************************************/ /**********************************/ @@ -1181,8 +1208,8 @@ typedef struct CFE_EVS_HousekeepingTlm_Payload { } CFE_EVS_HousekeepingTlm_Payload_t; typedef struct CFE_EVS_HousekeepingTlm { - CFE_SB_TlmHdr_t TlmHeader; - CFE_EVS_HousekeepingTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_EVS_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_HousekeepingTlm_t; /** Telemetry packet structures */ @@ -1224,14 +1251,14 @@ typedef struct CFE_EVS_ShortEventTlm_Payload { } CFE_EVS_ShortEventTlm_Payload_t; typedef struct CFE_EVS_LongEventTlm { - CFE_SB_TlmHdr_t TlmHeader; - CFE_EVS_LongEventTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_EVS_LongEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_LongEventTlm_t; typedef struct CFE_EVS_ShortEventTlm { - CFE_SB_TlmHdr_t TlmHeader; - CFE_EVS_ShortEventTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_EVS_ShortEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_ShortEventTlm_t; diff --git a/fsw/cfe-core/src/inc/cfe_msg_typedefs.h b/fsw/cfe-core/src/inc/cfe_msg_typedefs.h index c30454ad4..4df7bfd41 100644 --- a/fsw/cfe-core/src/inc/cfe_msg_typedefs.h +++ b/fsw/cfe-core/src/inc/cfe_msg_typedefs.h @@ -43,7 +43,7 @@ /* * Types */ -typedef uint32 CFE_MSG_Size_t; /**< \brief Message size (CCSDS needs uint32 for max size) */ +typedef size_t CFE_MSG_Size_t; /**< \brief Message size (CCSDS needs uint32 for max size) */ typedef uint32 CFE_MSG_Checksum_t; /**< \brief Message checksum (Oversized to avoid redefine) */ typedef uint16 CFE_MSG_FcnCode_t; /**< \brief Message function code */ typedef uint16 CFE_MSG_HeaderVersion_t; /**< \brief Message header version */ diff --git a/fsw/cfe-core/src/inc/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index e81d5c794..551fd71b5 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -48,8 +48,8 @@ /* ** Defines */ -#define CFE_SB_POLL 0 /**< \brief Option used with #CFE_SB_RcvMsg to request immediate pipe status */ -#define CFE_SB_PEND_FOREVER -1 /**< \brief Option used with #CFE_SB_RcvMsg to force a wait for next message */ +#define CFE_SB_POLL 0 /**< \brief Option used with #CFE_SB_ReceiveBuffer to request immediate pipe status */ +#define CFE_SB_PEND_FOREVER -1 /**< \brief Option used with #CFE_SB_ReceiveBuffer to force a wait for next message */ #define CFE_SB_SUB_ENTRIES_PER_PKT 20 /**< \brief Configuration parameter used by SBN App */ #define CFE_SB_SUBSCRIPTION 0 /**< \brief Subtype specifier used in #CFE_SB_SingleSubscriptionTlm_t by SBN App */ #define CFE_SB_UNSUBSCRIPTION 1 /**< \brief Subtype specified used in #CFE_SB_SingleSubscriptionTlm_t by SBN App */ @@ -131,29 +131,30 @@ ** Type Definitions */ -#ifndef CFE_OMIT_DEPRECATED_6_8 /** \brief Software Bus generic message */ -typedef CFE_MSG_Message_t CFE_SB_Msg_t; -#endif /* CFE_OMIT_DEPRECATED_6_8 */ +typedef union CFE_SB_Msg { + CFE_MSG_Message_t Msg; /**< \brief Base message type without enforced alignment */ + long long int LongInt; /**< \brief Align to support Long Integer */ + long double LongDouble; /**< \brief Align to support Long Double */ +} CFE_SB_Buffer_t; -/** \brief Aligned Software Bus command header */ -typedef union CFE_SB_CmdHdr { - CFE_MSG_CommandHeader_t Cmd; - CFE_MSG_Message_t BaseMsg; -} CFE_SB_CmdHdr_t; +#ifndef CFE_OMIT_DEPRECATED_6_8 +/** \brief Deperecated type to minimize required changes */ +typedef CFE_SB_Buffer_t CFE_SB_Msg_t; -/** \brief Aligned Software Bus telemetry header */ -typedef union CFE_SB_TlmHdr { - CFE_MSG_TelemetryHeader_t Tlm; - CFE_MSG_Message_t BaseMsg; -} CFE_SB_TlmHdr_t; +/** \brief Deperecated type to minimize required changes */ +typedef CFE_MSG_CommandHeader_t CFE_SB_CmdHdr_t; -#define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_SB_CmdHdr_t))/**< \brief Size of #CFE_SB_CmdHdr_t in bytes */ -#define CFE_SB_TLM_HDR_SIZE (sizeof(CFE_SB_TlmHdr_t))/**< \brief Size of #CFE_SB_TlmHdr_t in bytes */ +/** \brief Deperecated type to minimize required changes */ +typedef CFE_MSG_TelemetryHeader_t CFE_SB_TlmHdr_t; + +#define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_MSG_CommandHeader_t))/**< \brief Size of command header */ +#define CFE_SB_TLM_HDR_SIZE (sizeof(CFE_MSG_TelemetryHeader_t))/**< \brief Size of telemetry header */ +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /** \brief CFE_SB_TimeOut_t to primitive type definition ** -** Internally used by SB in the #CFE_SB_RcvMsg API. Translated from the +** Internally used by SB in the #CFE_SB_ReceiveBuffer API. Translated from the ** input parmater named TimeOut which specifies the maximum time in ** milliseconds that the caller wants to wait for a message. */ @@ -513,7 +514,40 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI /*****************************************************************************/ /** -** \brief Send a software bus message +** \brief Transmit a message +** +** \par Description +** This routine copies the specified message into a software bus +** buffer which is then transmitted to all subscribers. The +** software bus will read the message ID from the message header to +** determine which pipes should receive the message. +** +** \par Assumptions, External Events, and Notes: +** - This routine will not normally wait for the receiver tasks to +** process the message before returning control to the caller's task. +** - However, if a higher priority task is pending and subscribed to +** this message, that task may get to run before returning +** control to the caller. +** +** \param[in] MsgPtr A pointer to the message to be sent. This must point +** to the first byte of the message header. +** \param[in] IncrementSequenceCount Boolean to increment the internally tracked +** sequence count and update the message if the +** buffer contains a telemetry message +** +** \return Execution status, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_SB_BAD_ARGUMENT \copybrief CFE_SB_BAD_ARGUMENT +** \retval #CFE_SB_MSG_TOO_BIG \copybrief CFE_SB_MSG_TOO_BIG +** \retval #CFE_SB_BUF_ALOC_ERR \copybrief CFE_SB_BUF_ALOC_ERR +**/ +CFE_Status_t CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount); + +#ifndef CFE_OMIT_DEPRECATED_6_8 +/*****************************************************************************/ +/** +** \brief DEPRECATED: Send a software bus message +** \deprecated Use CFE_SB_TransmitMsg ** ** \par Description ** This routine sends the specified message to all subscribers. The @@ -524,8 +558,8 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI ** - This routine will not normally wait for the receiver tasks to ** process the message before returning control to the caller's task. ** - However, if a higher priority task is pending and subscribed to -** this message, that task may get to run before #CFE_SB_SendMsg -** returns control to the caller. +** this message, that task may get to run before returning +** control to the caller. ** - This function tracks and increments the source sequence counter ** of a telemetry message. ** @@ -537,14 +571,13 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI ** \retval #CFE_SB_BAD_ARGUMENT \copybrief CFE_SB_BAD_ARGUMENT ** \retval #CFE_SB_MSG_TOO_BIG \copybrief CFE_SB_MSG_TOO_BIG ** \retval #CFE_SB_BUF_ALOC_ERR \copybrief CFE_SB_BUF_ALOC_ERR -** -** \sa #CFE_SB_RcvMsg, #CFE_SB_ZeroCopySend, #CFE_SB_PassMsg **/ CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** -** \brief Passes a software bus message +** \brief DEPRECATED: Passes a software bus message +** \deprecated Use CFE_SB_TransmitMsg ** ** \par Description ** This routine sends the specified message to all subscribers. The @@ -558,8 +591,7 @@ CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr); ** - However, if a higher priority task is pending and subscribed to ** this message, that task may get to run before #CFE_SB_PassMsg ** returns control to the caller. -** - Unlike #CFE_SB_SendMsg this routine will preserve the source -** sequence counter in a telemetry message. +** - This routine will not modify the sequence counter in the message. ** ** \param[in] MsgPtr A pointer to the message to be sent. This must point ** to the first byte of the message header. @@ -569,10 +601,9 @@ CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr); ** \retval #CFE_SB_BAD_ARGUMENT \copybrief CFE_SB_BAD_ARGUMENT ** \retval #CFE_SB_MSG_TOO_BIG \copybrief CFE_SB_MSG_TOO_BIG ** \retval #CFE_SB_BUF_ALOC_ERR \copybrief CFE_SB_BUF_ALOC_ERR -** -** \sa #CFE_SB_RcvMsg, #CFE_SB_ZeroCopySend, #CFE_SB_SendMsg **/ CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /*****************************************************************************/ /** @@ -588,18 +619,16 @@ CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr); ** random. Therefore, it is recommended that the return code be tested ** for CFE_SUCCESS before processing the message. ** -** \param[in, out] BufPtr A pointer to a message pointer. -** Typically a caller declares a ptr of type CFE_MSG_Message_t -** (i.e. CFE_MSG_Message_t *Ptr) then gives the address of that +** \param[in, out] BufPtr A pointer to the software bus buffer to receive to. +** Typically a caller declares a ptr of type CFE_SB_Buffer_t +** (i.e. CFE_SB_Buffer_t *Ptr) then gives the address of that ** pointer (&Ptr) as this parmeter. After a successful ** receipt of a message, *BufPtr will point to the first -** byte of the software bus message header. This should be +** byte of the software bus buffer. This should be ** used as a read-only pointer (in systems with an MMU, ** writes to this pointer may cause a memory protection fault). ** The *BufPtr is valid only until the next call to -** CFE_SB_RcvMsg for the same pipe. \n *BufPtr is a pointer -** to the message obtained from the pipe. Valid -** only until the next call to CFE_SB_RcvMsg for the same pipe. +** CFE_SB_ReceiveBuffer for the same pipe. ** ** \param[in] PipeId The pipe ID of the pipe containing the message to be obtained. ** @@ -614,13 +643,19 @@ CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr); ** \retval #CFE_SB_TIME_OUT \copybrief CFE_SB_TIME_OUT ** \retval #CFE_SB_PIPE_RD_ERR \copybrief CFE_SB_PIPE_RD_ERR ** \retval #CFE_SB_NO_MESSAGE \copybrief CFE_SB_NO_MESSAGE -** -** \sa #CFE_SB_SendMsg, #CFE_SB_ZeroCopySend **/ -CFE_Status_t CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut); +CFE_Status_t CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut); + +#if CFE_OMIT_DEPRECATED_6_8 +/** + * \brief DEPRECATED: receive buffer + * \deprecated use CFE_SB_ReceiveBuffer + */ +CFE_Status_t CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /**@}*/ -/** @defgroup CFEAPISBZeroCopy cFE Zero Copy Message APIs +/** @defgroup CFEAPISBZeroCopy cFE Zero Copy APIs * @{ */ @@ -632,20 +667,20 @@ CFE_Status_t CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, CFE_SB_PipeId_t PipeId, ** This routine can be used to get a pointer to one of the software bus' ** internal memory buffers that are used for sending messages. The caller ** can use this memory buffer to build an SB message, then send it using -** the #CFE_SB_ZeroCopySend function. This interface is more complicated -** than the normal #CFE_SB_ZeroCopySend interface, but it avoids an extra +** the #CFE_SB_TransmitBuffer function. This interface is more complicated +** than the normal #CFE_SB_TransmitMsg interface, but it avoids an extra ** copy of the message from the user's memory buffer to the software bus ** internal buffer. The "zero copy" interface can be used to improve ** performance in high-rate, high-volume software bus traffic. ** ** \par Assumptions, External Events, and Notes: ** -# The pointer returned by #CFE_SB_ZeroCopyGetPtr is only good for one -** call to #CFE_SB_ZeroCopySend. +** call to #CFE_SB_TransmitBuffer. ** -# Applications should be written as if #CFE_SB_ZeroCopyGetPtr is -** equivalent to a \c malloc() and #CFE_SB_ZeroCopySend is equivalent to +** equivalent to a \c malloc() and #CFE_SB_TransmitBuffer is equivalent to ** a \c free(). ** -# Applications must not de-reference the message pointer (for reading -** or writing) after the call to #CFE_SB_ZeroCopySend. +** or writing) after the call to #CFE_SB_TransmitBuffer. ** ** \param[in] MsgSize The size of the SB message buffer the caller wants ** (including the SB message header). @@ -653,13 +688,11 @@ CFE_Status_t CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, CFE_SB_PipeId_t PipeId, ** \param[out] BufferHandle A handle that must be supplied when sending or releasing ** in zero copy mode. ** -** \return A pointer to a memory buffer that can be used to build one SB message -** for use with #CFE_SB_ZeroCopySend. -** -** \sa #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopySend +** \return A pointer to a memory buffer that message data can be written to +** for use with #CFE_SB_TransmitBuffer. **/ -CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, - CFE_SB_ZeroCopyHandle_t *BufferHandle); +CFE_SB_Buffer_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, + CFE_SB_ZeroCopyHandle_t *BufferHandle); /*****************************************************************************/ /** @@ -673,11 +706,11 @@ CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, ** -# This function is not needed for normal "zero copy" transfers. It ** is needed only for cleanup when an application gets a pointer using ** #CFE_SB_ZeroCopyGetPtr, but (due to some error condition) never uses -** that pointer for a #CFE_SB_ZeroCopySend +** that pointer for a #CFE_SB_TransmitBuffer ** ** \param[in] Ptr2Release A pointer to the SB internal buffer. This must be a ** pointer returned by a call to #CFE_SB_ZeroCopyGetPtr, -** but never used in a call to #CFE_SB_ZeroCopySend. +** but never used in a call to #CFE_SB_TransmitBuffer. ** ** \param[in] BufferHandle This must be the handle supplied with the pointer ** when #CFE_SB_ZeroCopyGetPtr was called. @@ -685,37 +718,78 @@ CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_SB_BUFFER_INVALID \copybrief CFE_SB_BUFFER_INVALID +**/ +CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); + +/*****************************************************************************/ +/** +** \brief Transmit a buffer +** +** \par Description +** This routine sends a message that has been created directly in an +** internal SB message buffer by an application (after a call to +** #CFE_SB_ZeroCopyGetPtr). This interface is more complicated than +** the normal #CFE_SB_TransmitMsg interface, but it avoids an extra copy of +** the message from the user's memory buffer to the software bus +** internal buffer. The "zero copy" interface can be used to improve +** performance in high-rate, high-volume software bus traffic. ** -** \sa #CFE_SB_ZeroCopyGetPtr, #CFE_SB_ZeroCopySend +** \par Assumptions, External Events, and Notes: +** -# The pointer returned by #CFE_SB_ZeroCopyGetPtr is only good for +** one call to #CFE_SB_TransmitBuffer. +** -# Callers must not use the same SB message buffer for multiple sends. +** -# Applications should be written as if #CFE_SB_ZeroCopyGetPtr is +** equivalent to a \c malloc() and #CFE_SB_TransmitBuffer is equivalent +** to a \c free(). +** -# Applications must not de-reference the message pointer (for reading +** or writing) after the call to #CFE_SB_TransmitBuffer. +** -# This function will increment and apply the internally tracked +** sequence counter if set to do so. +** +** \param[in] BufPtr A pointer to the buffer to be sent. +** \param[in] ZeroCopyHandle The handle supplied by the #CFE_SB_ZeroCopyGetPtr call +** \param[in] IncrementSequenceCount Boolean to increment the internally tracked +** sequence count and update the message if the +** buffer contains a telemetry message +** +** \return Execution status, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_SB_BAD_ARGUMENT \copybrief CFE_SB_BAD_ARGUMENT +** \retval #CFE_SB_MSG_TOO_BIG \copybrief CFE_SB_MSG_TOO_BIG +** \retval #CFE_SB_BUF_ALOC_ERR \copybrief CFE_SB_BUF_ALOC_ERR **/ -CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); +CFE_Status_t CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, + CFE_SB_ZeroCopyHandle_t ZeroCopyHandle, + bool IncrementSequenceCount); +#ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ /** -** \brief Send an SB message in "zero copy" mode. +** \brief DEPRECATED: Send an SB message in "zero copy" mode. +** \deprecated use CFE_SB_TransmitBuffer ** ** \par Description ** This routine sends a message that has been created directly in an ** internal SB message buffer by an application (after a call to ** #CFE_SB_ZeroCopyGetPtr). This interface is more complicated than -** the normal #CFE_SB_SendMsg interface, but it avoids an extra copy of +** the normal #CFE_SB_TransmitMsg interface, but it avoids an extra copy of ** the message from the user's memory buffer to the software bus ** internal buffer. The "zero copy" interface can be used to improve ** performance in high-rate, high-volume software bus traffic. ** ** \par Assumptions, External Events, and Notes: ** -# The pointer returned by #CFE_SB_ZeroCopyGetPtr is only good for -** one call to #CFE_SB_ZeroCopySend. +** one call to #CFE_SB_TransmitBuffer. ** -# Callers must not use the same SB message buffer for multiple sends. ** -# Applications should be written as if #CFE_SB_ZeroCopyGetPtr is -** equivalent to a \c malloc() and #CFE_SB_ZeroCopySend is equivalent +** equivalent to a \c malloc() and #CFE_SB_TransmitBuffer is equivalent ** to a \c free(). ** -# Applications must not de-reference the message pointer (for reading -** or writing) after the call to #CFE_SB_ZeroCopySend. +** or writing) after the call to #CFE_SB_TransmitBuffer. ** -# This function tracks and increments the source sequence counter ** of a telemetry message. ** -** \param[in] MsgPtr A pointer to the SB message to be sent. +** \param[in] BufPtr A pointer to the SB buffer to be sent. ** ** \param[in] BufferHandle The handle supplied with the #CFE_SB_ZeroCopyGetPtr call. ** @@ -725,20 +799,19 @@ CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, CFE_SB_Ze ** \retval #CFE_SB_MSG_TOO_BIG \copybrief CFE_SB_MSG_TOO_BIG ** \retval #CFE_SB_BUF_ALOC_ERR \copybrief CFE_SB_BUF_ALOC_ERR ** \retval #CFE_SB_BUFFER_INVALID \copybrief CFE_SB_BUFFER_INVALID -** -** \sa #CFE_SB_SendMsg, #CFE_SB_RcvMsg, #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopyGetPtr **/ -CFE_Status_t CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); +CFE_Status_t CFE_SB_ZeroCopySend(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); /*****************************************************************************/ /** -** \brief Pass an SB message in "zero copy" mode. +** \brief DEPRECATED: Pass an SB message in "zero copy" mode. +** \deprecated use CFE_SB_TransmitBuffer ** ** \par Description ** This routine sends a message that has been created directly in an ** internal SB message buffer by an application (after a call to ** #CFE_SB_ZeroCopyGetPtr). This interface is more complicated than -** the normal #CFE_SB_SendMsg interface, but it avoids an extra copy of +** the normal #CFE_SB_TransmitMsg interface, but it avoids an extra copy of ** the message from the user's memory buffer to the software bus ** internal buffer. The "zero copy" interface can be used to improve ** performance in high-rate, high-volume software bus traffic. This @@ -747,17 +820,17 @@ CFE_Status_t CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandl ** ** \par Assumptions, External Events, and Notes: ** -# The pointer returned by #CFE_SB_ZeroCopyGetPtr is only good for -** one call to #CFE_SB_ZeroCopySend or #CFE_SB_ZeroCopyPass. +** one call to #CFE_SB_TransmitBuffer or #CFE_SB_ZeroCopyPass. ** -# Callers must not use the same SB message buffer for multiple sends. ** -# Applications should be written as if #CFE_SB_ZeroCopyGetPtr is ** equivalent to a \c malloc() and #CFE_SB_ZeroCopyPass is equivalent ** to a \c free(). ** -# Applications must not de-reference the message pointer (for reading ** or writing) after the call to #CFE_SB_ZeroCopyPass. -** -# Unlike #CFE_SB_ZeroCopySend this routine will preserve the source -** sequence counter in a telemetry message. +** -# This routine will not modify the sequence counter in a telemetry +** message ** -** \param[in] MsgPtr A pointer to the SB message to be sent. +** \param[in] BufPtr A pointer to the SB buffer to be sent. ** ** \param[in] BufferHandle The handle supplied with the #CFE_SB_ZeroCopyGetPtr call. ** @@ -767,11 +840,10 @@ CFE_Status_t CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandl ** \retval #CFE_SB_MSG_TOO_BIG \copybrief CFE_SB_MSG_TOO_BIG ** \retval #CFE_SB_BUF_ALOC_ERR \copybrief CFE_SB_BUF_ALOC_ERR ** \retval #CFE_SB_BUFFER_INVALID \copybrief CFE_SB_BUFFER_INVALID -** -** \sa #CFE_SB_PassMsg, #CFE_SB_ZeroCopySend, #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopyGetPtr **/ -CFE_Status_t CFE_SB_ZeroCopyPass(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); +CFE_Status_t CFE_SB_ZeroCopyPass(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); /**@}*/ +#endif /** @defgroup CFEAPISBSetMessage cFE Setting Message Characteristics APIs * @{ diff --git a/fsw/cfe-core/src/inc/cfe_sb_events.h b/fsw/cfe-core/src/inc/cfe_sb_events.h index 464d4a519..87ac2798c 100644 --- a/fsw/cfe-core/src/inc/cfe_sb_events.h +++ b/fsw/cfe-core/src/inc/cfe_sb_events.h @@ -361,7 +361,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API receives an +** This error event message is issued when a transmit API receives an ** invalid (possibly NULL) ptr as an argument. **/ #define CFE_SB_SEND_BAD_ARG_EID 13 @@ -373,7 +373,7 @@ ** ** \par Cause: ** -** This info event message is issued when the #CFE_SB_SendMsg API is called and there +** This info event message is issued when a transmit API is called and there ** are no subscribers (therefore no destinations) for the message to be sent. Each ** time the SB detects this situation, the corresponding SB telemetry point is ** incremented.. @@ -391,7 +391,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API is called and the +** This error event message is issued when a transmit API is called and the ** packet length field in the message header implies that the message size exceeds ** the max size defined by mission cfg param #CFE_MISSION_SB_MAX_SB_MSG_SIZE. The request to ** send the message is denied, there is no partial packet sent. @@ -405,7 +405,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API fails to receive +** This error event message is issued when a transmit API fails to receive ** the necessary buffer memory from the ES memory pool. This could be an indication ** that the cfg param #CFE_PLATFORM_SB_BUF_MEMORY_BYTES is set too low. To check this, send SB ** cmd to dump the SB statistics pkt and view the buffer memory parameters. @@ -419,7 +419,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API cannot route the +** This error event message is issued when a transmit API cannot route the ** MsgId (displayed in event) to the pipe (displayed in the event) because the pipe ** currently contains the maximum number of messages of this type (MsgId). This is ** typically an indication that the receiver is not reading its pipe fast enough, or @@ -439,7 +439,7 @@ ** \par Cause: ** ** This error event message is issued when an invalid paramter is passed into the -** #CFE_SB_RcvMsg API. Two possibile problems would be the first parameter (*BufPtr) +** #CFE_SB_ReceiveBuffer API. Two possibile problems would be the first parameter (*BufPtr) ** being NULL or the third paramter (TimeOut) being less than -1. **/ #define CFE_SB_RCV_BAD_ARG_EID 18 @@ -452,7 +452,7 @@ ** \par Cause: ** ** This error event message is issued when an invalid PipeId is passed into the -** #CFE_SB_RcvMsg API. The SB Pipe Table shows all valid PipeIds and may be viewed +** #CFE_SB_ReceiveBuffer API. The SB Pipe Table shows all valid PipeIds and may be viewed ** for verification. **/ #define CFE_SB_BAD_PIPEID_EID 19 @@ -479,7 +479,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API is called and +** This error event message is issued when a transmit API is called and ** the SB discovers that the message to send has a msg id that is invalid. It may be ** due to a msg id that is greater than cfg parameter #CFE_PLATFORM_SB_HIGHEST_VALID_MSGID **/ @@ -519,7 +519,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API is called and +** This error event message is issued when a transmit API is called and ** encounters an error when attempting to write the msg to the destination pipe ** (which is an underlying queue). This could indicate that the owner of the pipe is ** not readings its messages fast enough or at all. It may also mean that the @@ -535,7 +535,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API is called and +** This error event message is issued when a transmit API is called and ** encounters an error when attempting to write the msg to the destination pipe ** (which is an underlying queue). More precisely, the OS API #OS_QueuePut has ** returned an unexpected error. The return code is displayed in the event. For @@ -551,7 +551,7 @@ ** ** \par Cause: ** -** This error event message is issued when the #CFE_SB_SendMsg API is called and +** This error event message is issued when a transmit API is called and ** encounters an error when attempting to read the msg from the destination pipe ** (which is an underlying queue). More precisely, the OS API #OS_QueueGet has ** returned an unexpected error. The return code is displayed in the event. For diff --git a/fsw/cfe-core/src/inc/cfe_sb_msg.h b/fsw/cfe-core/src/inc/cfe_sb_msg.h index 03407b0c9..cdf37ccef 100644 --- a/fsw/cfe-core/src/inc/cfe_sb_msg.h +++ b/fsw/cfe-core/src/inc/cfe_sb_msg.h @@ -54,7 +54,7 @@ ** \cfecmdmnemonic \SB_NOOP ** ** \par Command Structure -** #CFE_SB_CmdHdr_t +** #CFE_SB_NoopCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -88,7 +88,7 @@ ** \cfecmdmnemonic \SB_RESETCTRS ** ** \par Command Structure -** #CFE_SB_CmdHdr_t +** #CFE_SB_ResetCountersCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -125,7 +125,7 @@ ** \cfecmdmnemonic \SB_DUMPSTATS ** ** \par Command Structure -** #CFE_SB_CmdHdr_t +** #CFE_SB_SendSbStatsCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -164,7 +164,7 @@ ** \cfecmdmnemonic \SB_WRITEROUTING2FILE ** ** \par Command Structure -** #CFE_SB_WriteFileInfoCmd_t +** #CFE_SB_SendRoutingInfoCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -205,7 +205,7 @@ ** \cfecmdmnemonic \SB_ENAROUTE ** ** \par Command Structure -** #CFE_SB_RouteCmd_t +** #CFE_SB_EnableRouteCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -243,7 +243,7 @@ ** \cfecmdmnemonic \SB_DISROUTE ** ** \par Command Structure -** #CFE_SB_RouteCmd_t +** #CFE_SB_DisableRouteCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -291,7 +291,7 @@ ** \cfecmdmnemonic \SB_WRITEPIPE2FILE ** ** \par Command Structure -** #CFE_SB_WriteFileInfoCmd_t +** #CFE_SB_SendPipeInfoCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -336,7 +336,7 @@ ** \cfecmdmnemonic \SB_WRITEMAP2FILE ** ** \par Command Structure -** #CFE_SB_WriteFileInfoCmd_t +** #CFE_SB_SendMapInfoCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -380,7 +380,7 @@ ** \cfecmdmnemonic \SB_ENASUBRPTG ** ** \par Command Structure -** #CFE_SB_CmdHdr_t +** #CFE_SB_EnableSubReportingCmd_t ** ** \par Command Verification ** Successful execution of this command will result in the sending @@ -413,7 +413,7 @@ ** \cfecmdmnemonic \SB_DISSUBRPTG ** ** \par Command Structure -** #CFE_SB_CmdHdr_t +** #CFE_SB_DisableSubReportingCmd_t ** ** \par Command Verification ** Successful execution of this command will result in the suppression @@ -445,7 +445,7 @@ ** \cfecmdmnemonic \SB_SENDPREVSUBS ** ** \par Command Structure -** #CFE_SB_CmdHdr_t +** #CFE_SB_SendPrevSubsCmd_t ** ** \par Command Verification ** Successful execution of this command will result in a series @@ -472,19 +472,19 @@ * SB Messages which have no payload are each * given unique typedefs to follow the command handler convention * - * For the SB application these is mapped to the CFE_SB_CmdHdr_t type, + * For the SB application these is mapped to the CFE_MSG_CommandHeader_t type, * as they contain only a primary + command header. */ -typedef CFE_SB_CmdHdr_t CFE_SB_Noop_t; -typedef CFE_SB_CmdHdr_t CFE_SB_ResetCounters_t; -typedef CFE_SB_CmdHdr_t CFE_SB_EnableSubReporting_t; -typedef CFE_SB_CmdHdr_t CFE_SB_DisableSubReporting_t; -typedef CFE_SB_CmdHdr_t CFE_SB_SendSbStats_t; -typedef CFE_SB_CmdHdr_t CFE_SB_SendPrevSubs_t; +typedef CFE_MSG_CommandHeader_t CFE_SB_NoopCmd_t; +typedef CFE_MSG_CommandHeader_t CFE_SB_ResetCountersCmd_t; +typedef CFE_MSG_CommandHeader_t CFE_SB_EnableSubReportingCmd_t; +typedef CFE_MSG_CommandHeader_t CFE_SB_DisableSubReportingCmd_t; +typedef CFE_MSG_CommandHeader_t CFE_SB_SendSbStatsCmd_t; +typedef CFE_MSG_CommandHeader_t CFE_SB_SendPrevSubsCmd_t; /** -** \brief Write File Info Commands +** \brief Write File Info Command Payload ** ** This structure contains a generic definition used by three SB commands, ** 'Write Routing Info to File' #CFE_SB_SEND_ROUTING_INFO_CC, @@ -495,20 +495,23 @@ typedef struct CFE_SB_WriteFileInfoCmd_Payload { char Filename[CFE_MISSION_MAX_PATH_LEN];/**< \brief Path and Filename of data to be loaded */ } CFE_SB_WriteFileInfoCmd_Payload_t; +/** + * \brief Write File Info Command + */ typedef struct CFE_SB_WriteFileInfoCmd { - CFE_SB_CmdHdr_t Hdr;/**< \brief cFE Software Bus Command Message Header #CFE_SB_CmdHdr_t */ - CFE_SB_WriteFileInfoCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t Hdr; /**< \brief Command header */ + CFE_SB_WriteFileInfoCmd_Payload_t Payload; /**< \brief Command payload */ }CFE_SB_WriteFileInfoCmd_t; /* * Create a unique typedef for each of the commands that share this format. */ -typedef CFE_SB_WriteFileInfoCmd_t CFE_SB_SendRoutingInfo_t; -typedef CFE_SB_WriteFileInfoCmd_t CFE_SB_SendPipeInfo_t; -typedef CFE_SB_WriteFileInfoCmd_t CFE_SB_SendMapInfo_t; +typedef CFE_SB_WriteFileInfoCmd_t CFE_SB_SendRoutingInfoCmd_t; +typedef CFE_SB_WriteFileInfoCmd_t CFE_SB_SendPipeInfoCmd_t; +typedef CFE_SB_WriteFileInfoCmd_t CFE_SB_SendMapInfoCmd_t; /** -** \brief Enable/Disable Route Commands +** \brief Enable/Disable Route Command Payload ** ** This structure contains a definition used by two SB commands, ** 'Enable Route' #CFE_SB_ENABLE_ROUTE_CC and 'Disable Route' #CFE_SB_DISABLE_ROUTE_CC. @@ -522,16 +525,19 @@ typedef struct CFE_SB_RouteCmd_Payload { uint8 Spare;/**<\brief Spare byte to make command even number of bytes */ } CFE_SB_RouteCmd_Payload_t; +/** + * \brief Enable/Disable Route Command + */ typedef struct CFE_SB_RouteCmd { - CFE_SB_CmdHdr_t Hdr;/**< \brief cFE Software Bus Command Message Header #CFE_SB_CmdHdr_t */ - CFE_SB_RouteCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t Hdr; /**< \brief Command header */ + CFE_SB_RouteCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_SB_RouteCmd_t; /* * Create a unique typedef for each of the commands that share this format. */ -typedef CFE_SB_RouteCmd_t CFE_SB_EnableRoute_t; -typedef CFE_SB_RouteCmd_t CFE_SB_DisableRoute_t; +typedef CFE_SB_RouteCmd_t CFE_SB_EnableRouteCmd_t; +typedef CFE_SB_RouteCmd_t CFE_SB_DisableRouteCmd_t; /**************************** ** SB Telemetry Formats ** @@ -584,8 +590,8 @@ typedef struct CFE_SB_HousekeepingTlm_Payload { } CFE_SB_HousekeepingTlm_Payload_t; typedef struct CFE_SB_HousekeepingTlm { - CFE_SB_TlmHdr_t Hdr;/**< \brief cFE Software Bus Telemetry Message Header */ - CFE_SB_HousekeepingTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ + CFE_SB_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_HousekeepingTlm_t; @@ -612,7 +618,7 @@ typedef struct CFE_SB_PipeDepthStats { /** ** \cfesbtlm SB Statistics Telemetry Packet ** -** SB Statistics packet sent (via CFE_SB_SendMsg) in response to #CFE_SB_SEND_SB_STATS_CC +** SB Statistics packet sent in response to #CFE_SB_SEND_SB_STATS_CC */ typedef struct CFE_SB_StatsTlm_Payload { @@ -657,8 +663,8 @@ typedef struct CFE_SB_StatsTlm_Payload { } CFE_SB_StatsTlm_Payload_t; typedef struct CFE_SB_StatsTlm { - CFE_SB_TlmHdr_t Hdr;/**< \brief cFE Software Bus Telemetry Message Header */ - CFE_SB_StatsTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ + CFE_SB_StatsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_StatsTlm_t; @@ -708,8 +714,8 @@ typedef struct CFE_SB_SingleSubscriptionTlm_Payload { } CFE_SB_SingleSubscriptionTlm_Payload_t; typedef struct CFE_SB_SingleSubscriptionTlm { - CFE_SB_TlmHdr_t Hdr;/**< \brief cFE Software Bus Telemetry Message Header */ - CFE_SB_SingleSubscriptionTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ + CFE_SB_SingleSubscriptionTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_SingleSubscriptionTlm_t; @@ -748,8 +754,8 @@ typedef struct CFE_SB_AllSubscriptionsTlm_Payload { } CFE_SB_AllSubscriptionsTlm_Payload_t; typedef struct CFE_SB_AllSubscriptionsTlm { - CFE_SB_TlmHdr_t Hdr;/**< \brief cFE Software Bus Telemetry Message Header */ - CFE_SB_AllSubscriptionsTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ + CFE_SB_AllSubscriptionsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_AllSubscriptionsTlm_t; diff --git a/fsw/cfe-core/src/inc/cfe_tbl_events.h b/fsw/cfe-core/src/inc/cfe_tbl_events.h index 6a40b6a45..e35245024 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl_events.h +++ b/fsw/cfe-core/src/inc/cfe_tbl_events.h @@ -365,7 +365,7 @@ ** This event message is generated when failure occurs while attempting to send the ** Housekeeping Message over the Software Bus. ** -** The \c Status field of the event message contains the error code returned by #CFE_SB_SendMsg. +** The \c Status field of the event message contains the error code. **/ #define CFE_TBL_FAIL_HK_SEND_ERR_EID 56 @@ -838,7 +838,7 @@ ** ** The \c MsgId is the message ID of the table management notification message that was attempted to be sent, ** the \c CC is the command code, the \c Param is the application specified command parameter and the \c Status -** is the error code returned by the #CFE_SB_SendMsg API call. +** is the error code returned. **/ #define CFE_TBL_FAIL_NOTIFY_SEND_ERR_EID 89 /** \} */ diff --git a/fsw/cfe-core/src/inc/cfe_tbl_msg.h b/fsw/cfe-core/src/inc/cfe_tbl_msg.h index 3ae7bd792..e4d83d211 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl_msg.h +++ b/fsw/cfe-core/src/inc/cfe_tbl_msg.h @@ -58,7 +58,7 @@ ** \cfecmdmnemonic \TBL_NOOP ** ** \par Command Structure -** #CFE_TBL_NoArgsCmd_t +** #CFE_TBL_NoopCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -95,7 +95,7 @@ ** \cfecmdmnemonic \TBL_RESETCTRS ** ** \par Command Structure -** #CFE_TBL_NoArgsCmd_t +** #CFE_TBL_ResetCountersCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -130,7 +130,7 @@ ** \cfecmdmnemonic \TBL_LOAD ** ** \par Command Structure -** #CFE_TBL_Load_t +** #CFE_TBL_LoadCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with @@ -184,7 +184,7 @@ ** \cfecmdmnemonic \TBL_DUMP ** ** \par Command Structure -** #CFE_TBL_Dump_t +** #CFE_TBL_DumpCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -230,7 +230,7 @@ ** \cfecmdmnemonic \TBL_VALIDATE ** ** \par Command Structure -** #CFE_TBL_Validate_t +** #CFE_TBL_ValidateCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the following @@ -286,7 +286,7 @@ ** \cfecmdmnemonic \TBL_ACTIVATE ** ** \par Command Structure -** #CFE_TBL_Activate_t +** #CFE_TBL_ActivateCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -326,7 +326,7 @@ ** \cfecmdmnemonic \TBL_WRITEREG2FILE ** ** \par Command Structure -** #CFE_TBL_DumpRegistry_t +** #CFE_TBL_DumpRegistryCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -366,7 +366,7 @@ ** \cfecmdmnemonic \TBL_TLMREG ** ** \par Command Structure -** #CFE_TBL_DumpRegistry_t +** #CFE_TBL_SendRegistryCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -405,7 +405,7 @@ ** \cfecmdmnemonic \TBL_DELETECDS ** ** \par Command Structure -** #CFE_TBL_DeleteCDS_t +** #CFE_TBL_DeleteCDSCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -448,7 +448,7 @@ ** \cfecmdmnemonic \TBL_LOADABORT ** ** \par Command Structure -** #CFE_TBL_AbortLoad_t +** #CFE_TBL_AbortLoadCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -492,8 +492,7 @@ */ typedef struct CFE_TBL_NoArgsCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } CFE_TBL_NoArgsCmd_t; /* @@ -501,30 +500,31 @@ typedef struct CFE_TBL_NoArgsCmd * Allows each command to evolve independently, while following the command * handler prototype convention */ -typedef CFE_TBL_NoArgsCmd_t CFE_TBL_Noop_t; -typedef CFE_TBL_NoArgsCmd_t CFE_TBL_ResetCounters_t; +typedef CFE_TBL_NoArgsCmd_t CFE_TBL_NoopCmd_t; +typedef CFE_TBL_NoArgsCmd_t CFE_TBL_ResetCountersCmd_t; /** -** \brief Load Table Command +** \brief Load Table Command Payload ** ** For command details, see #CFE_TBL_LOAD_CC ** **/ typedef struct CFE_TBL_LoadCmd_Payload { - char LoadFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename (and path) of data to be loaded */ - /**< ASCII Character string containing full path - filename for file to be loaded */ + char LoadFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename (and path) of data to be loaded */ } CFE_TBL_LoadCmd_Payload_t; -typedef struct CFE_TBL_Load +/** + * \brief Load Table Command + */ +typedef struct CFE_TBL_LoadCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_LoadCmd_Payload_t Payload; -} CFE_TBL_Load_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_LoadCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TBL_LoadCmd_t; /** -** \brief Dump Table Command +** \brief Dump Table Command Payload ** ** For command details, see #CFE_TBL_DUMP_CC */ @@ -544,14 +544,17 @@ typedef struct CFE_TBL_DumpCmd_Payload where data is to be dumped */ } CFE_TBL_DumpCmd_Payload_t; +/** + * /brief Dump Table Command + */ typedef struct CFE_TBL_DumpCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_DumpCmd_Payload_t Payload; -} CFE_TBL_Dump_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_DumpCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TBL_DumpCmd_t; /** -** \brief Validate Table Command +** \brief Validate Table Command Payload ** ** For command details, see #CFE_TBL_VALIDATE_CC */ @@ -568,14 +571,17 @@ typedef struct CFE_TBL_ValidateCmd_Payload identifier of table to be validated */ } CFE_TBL_ValidateCmd_Payload_t; -typedef struct CFE_TBL_Validate +/** + * \brief Validate Table Command + */ +typedef struct CFE_TBL_ValidateCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_ValidateCmd_Payload_t Payload; -} CFE_TBL_Validate_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_ValidateCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TBL_ValidateCmd_t; /** -** \brief Activate Table Command +** \brief Activate Table Command Payload ** ** For command details, see #CFE_TBL_ACTIVATE_CC */ @@ -586,14 +592,17 @@ typedef struct CFE_TBL_ActivateCmd_Payload identifier of table to be activated */ } CFE_TBL_ActivateCmd_Payload_t; -typedef struct CFE_TBL_Activate +/** + * \brief Activate Table Command + */ +typedef struct CFE_TBL_ActivateCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_ActivateCmd_Payload_t Payload; -} CFE_TBL_Activate_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_ActivateCmd_Payload_t Payload; /**< \brief Command paylod */ +} CFE_TBL_ActivateCmd_t; /** -** \brief Dump Registry Command +** \brief Dump Registry Command Payload ** ** For command details, see #CFE_TBL_DUMP_REGISTRY_CC */ @@ -605,14 +614,17 @@ typedef struct CFE_TBL_DumpRegistryCmd_Payload where registry is to be dumped */ } CFE_TBL_DumpRegistryCmd_Payload_t; -typedef struct CFE_TBL_DumpRegistry +/** + * \brief Dump Registry Command + */ +typedef struct CFE_TBL_DumpRegistryCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_DumpRegistryCmd_Payload_t Payload; -} CFE_TBL_DumpRegistry_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_DumpRegistryCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TBL_DumpRegistryCmd_t; /** -** \brief Telemeter Table Registry Entry Command +** \brief Send Table Registry Command Payload ** ** For command details, see #CFE_TBL_SEND_REGISTRY_CC */ @@ -625,14 +637,17 @@ typedef struct CFE_TBL_SendRegistryCmd_Payload to be telemetered via #CFE_TBL_TableRegistryTlm_t */ } CFE_TBL_SendRegistryCmd_Payload_t; -typedef struct CFE_TBL_SendRegistry +/** + * \brief Send Table Registry Command + */ +typedef struct CFE_TBL_SendRegistryCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_SendRegistryCmd_Payload_t Payload; -} CFE_TBL_SendRegistry_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_SendRegistryCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TBL_SendRegistryCmd_t; /** -** \brief Delete Critical Table CDS Command +** \brief Delete Critical Table CDS Command Payload ** ** For command details, see #CFE_TBL_DELETE_CDS_CC */ @@ -645,14 +660,17 @@ typedef struct CFE_TBL_DelCDSCmd_Payload CDS is to be deleted */ } CFE_TBL_DelCDSCmd_Payload_t; -typedef struct CFE_TBL_DeleteCDS +/** + * \brief Delete Critical Table CDS Command + */ +typedef struct CFE_TBL_DeleteCDSCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_DelCDSCmd_Payload_t Payload; -} CFE_TBL_DeleteCDS_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_DelCDSCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TBL_DeleteCDSCmd_t; /** -** \brief Abort Load Command +** \brief Abort Load Command Payload ** ** For command details, see #CFE_TBL_ABORT_LOAD_CC */ @@ -663,11 +681,14 @@ typedef struct CFE_TBL_AbortLoadCmd_Payload identifier of a table whose load is to be aborted */ } CFE_TBL_AbortLoadCmd_Payload_t; -typedef struct CFE_TBL_AbortLoad +/** + * \brief Abort Load Command + */ +typedef struct CFE_TBL_AbortLoadCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_AbortLoadCmd_Payload_t Payload; -} CFE_TBL_AbortLoad_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_AbortLoadCmd_Payload_t Payload; /**< \brief Command paylod */ +} CFE_TBL_AbortLoadCmd_t; /*************************************************************************/ @@ -675,7 +696,7 @@ typedef struct CFE_TBL_AbortLoad /* Generated Command Message Data Formats */ /******************************************/ /** -** \brief Table Management Notification Message +** \brief Table Management Notification Command Payload ** ** \par Description ** Whenever an application that owns a table calls the #CFE_TBL_NotifyByMessage API @@ -688,10 +709,13 @@ typedef struct CFE_TBL_NotifyCmd_Payload uint32 Parameter; /**< \brief Application specified command parameter */ } CFE_TBL_NotifyCmd_Payload_t; +/** + * /brief Table Management Notification Command + */ typedef struct CFE_TBL_NotifyCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; /**< \brief cFE Software Bus Command Message Header */ - CFE_TBL_NotifyCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TBL_NotifyCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_NotifyCmd_t; /*************************************************************************/ @@ -762,8 +786,8 @@ typedef struct CFE_TBL_HousekeepingTlm_Payload typedef struct CFE_TBL_HousekeepingTlm { - CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_TBL_HousekeepingTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_TBL_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TBL_HousekeepingTlm_t; @@ -810,8 +834,8 @@ typedef struct CFE_TBL_TblRegPacket_Payload typedef struct CFE_TBL_TableRegistryTlm { - CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_TBL_TblRegPacket_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_TBL_TblRegPacket_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TBL_TableRegistryTlm_t; diff --git a/fsw/cfe-core/src/inc/cfe_time_msg.h b/fsw/cfe-core/src/inc/cfe_time_msg.h index e0f2b7b12..2345a05b8 100644 --- a/fsw/cfe-core/src/inc/cfe_time_msg.h +++ b/fsw/cfe-core/src/inc/cfe_time_msg.h @@ -58,7 +58,7 @@ ** \cfecmdmnemonic \TIME_NOOP ** ** \par Command Structure -** #CFE_TIME_NoArgsCmd_t +** #CFE_TIME_NoopCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -102,7 +102,7 @@ ** \cfecmdmnemonic \TIME_RESETCTRS ** ** \par Command Structure -** #CFE_TIME_NoArgsCmd_t +** #CFE_TIME_ResetCountersCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -135,7 +135,7 @@ ** \cfecmdmnemonic \TIME_REQUESTDIAG ** ** \par Command Structure -** #CFE_TIME_NoArgsCmd_t +** #CFE_TIME_SendDiagnosticCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -182,7 +182,7 @@ ** \cfecmdmnemonic \TIME_SETSOURCE ** ** \par Command Structure -** #CFE_TIME_SetSource_t +** #CFE_TIME_SetSourceCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -233,7 +233,7 @@ ** \cfecmdmnemonic \TIME_SETSTATE ** ** \par Command Structure -** #CFE_TIME_SetState_t +** #CFE_TIME_SetStateCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -276,7 +276,7 @@ ** \cfecmdmnemonic \TIME_ADDCLOCKLAT ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_AddDelayCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -314,7 +314,7 @@ ** \cfecmdmnemonic \TIME_SUBCLOCKLAT ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_SubDelayCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -359,7 +359,7 @@ ** \cfecmdmnemonic \TIME_SETCLOCK ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_SetTimeCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -399,7 +399,7 @@ ** \cfecmdmnemonic \TIME_SETCLOCKMET ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_SetMETCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -436,7 +436,7 @@ ** \cfecmdmnemonic \TIME_SETCLOCKSTCF ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_SetSTCFCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -473,7 +473,7 @@ ** \cfecmdmnemonic \TIME_SETCLOCKLEAP ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_SetLeapSecondsCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -506,7 +506,7 @@ ** \cfecmdmnemonic \TIME_ADDSTCFADJ ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_AddAdjustCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -540,7 +540,7 @@ ** \cfecmdmnemonic \TIME_SUBSTCFADJ ** ** \par Command Structure -** #CFE_TIME_TimeCmd_t +** #CFE_TIME_SubAdjustCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -587,7 +587,7 @@ ** \cfecmdmnemonic \TIME_ADD1HZSTCF ** ** \par Command Structure -** #CFE_TIME_Add1HZAdjustment_t +** #CFE_TIME_Add1HZAdjustmentCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -633,7 +633,7 @@ ** \cfecmdmnemonic \TIME_SUB1HZSTCF ** ** \par Command Structure -** #CFE_TIME_Sub1HZAdjustment_t +** #CFE_TIME_Sub1HZAdjustmentCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -675,7 +675,7 @@ ** \cfecmdmnemonic \TIME_SETSIGNAL ** ** \par Command Structure -** #CFE_TIME_SetSignal_t +** #CFE_TIME_SetSignalCmd_t ** ** \par Command Verification ** Successful execution of this command may be verified with the @@ -723,12 +723,12 @@ /*************************************************************************/ -/* -** Type definition (generic "no arguments" command)... -*/ +/** + * \brief Generic no argument command + */ typedef struct CFE_TIME_NoArgsCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } CFE_TIME_NoArgsCmd_t; @@ -737,28 +737,33 @@ typedef struct CFE_TIME_NoArgsCmd * This follows the convention for command handler prototypes and allows * each one to independently evolve as necessary. */ -typedef CFE_TIME_NoArgsCmd_t CFE_TIME_Noop_t; -typedef CFE_TIME_NoArgsCmd_t CFE_TIME_ResetCounters_t; -typedef CFE_TIME_NoArgsCmd_t CFE_TIME_SendDiagnosticTlm_t; - -/* -** Type definition (leap seconds command)... -*/ +typedef CFE_TIME_NoArgsCmd_t CFE_TIME_NoopCmd_t; +typedef CFE_TIME_NoArgsCmd_t CFE_TIME_ResetCountersCmd_t; +typedef CFE_TIME_NoArgsCmd_t CFE_TIME_SendDiagnosticCmd_t; +typedef CFE_TIME_NoArgsCmd_t CFE_TIME_1HzCmd_t; +typedef CFE_TIME_NoArgsCmd_t CFE_TIME_ToneSignalCmd_t; +typedef CFE_TIME_NoArgsCmd_t CFE_TIME_FakeToneCmd_t; + +/** + * \brief Set leap seconds command payload + */ typedef struct CFE_TIME_LeapsCmd_Payload { int16 LeapSeconds; } CFE_TIME_LeapsCmd_Payload_t; -typedef struct CFE_TIME_SetLeapSeconds +/** + * \brief Set leap seconds command + */ +typedef struct CFE_TIME_SetLeapSecondsCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_TIME_LeapsCmd_Payload_t Payload; -} CFE_TIME_SetLeapSeconds_t; - + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_LeapsCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TIME_SetLeapSecondsCmd_t; -/* -** Type definition (clock state command)... -*/ +/** + * \brief Set clock state command payload + */ typedef struct CFE_TIME_StateCmd_Payload { int16 ClockState; /**< \brief #CFE_TIME_ClockState_INVALID=Spacecraft time has not been accurately set, @@ -767,16 +772,19 @@ typedef struct CFE_TIME_StateCmd_Payload /**< Selects the current clock state */ } CFE_TIME_StateCmd_Payload_t; +/** + * \brief Set clock state command + */ typedef struct CFE_TIME_SetStateCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_TIME_StateCmd_Payload_t Payload; -} CFE_TIME_SetState_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_StateCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TIME_SetStateCmd_t; -/* -** Type definition (time data source command)... -*/ +/** + * \brief Set time data source command payload + */ typedef struct CFE_TIME_SourceCmd_Payload { int16 TimeSource; /**< \brief #CFE_TIME_SourceSelect_INTERNAL=Internal Source, @@ -784,16 +792,18 @@ typedef struct CFE_TIME_SourceCmd_Payload /**< Selects either the "Internal" and "External" clock source */ } CFE_TIME_SourceCmd_Payload_t; -typedef struct CFE_TIME_SetSource +/** + * \brief Set time data source command + */ +typedef struct CFE_TIME_SetSourceCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_TIME_SourceCmd_Payload_t Payload; -} CFE_TIME_SetSource_t; - + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_SourceCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TIME_SetSourceCmd_t; -/* -** Type definition (tone signal source command)... -*/ +/** + * \brief Set tone signal source command payload + */ typedef struct CFE_TIME_SignalCmd_Payload { int16 ToneSource; /**< \brief #CFE_TIME_ToneSignalSelect_PRIMARY=Primary Source, @@ -801,27 +811,32 @@ typedef struct CFE_TIME_SignalCmd_Payload /**< Selects either the "Primary" or "Redundant" tone signal source */ } CFE_TIME_SignalCmd_Payload_t; -typedef struct CFE_TIME_SetSignal +/** + * \brief Set tone signal source command + */ +typedef struct CFE_TIME_SetSignalCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_TIME_SignalCmd_Payload_t Payload; - -} CFE_TIME_SetSignal_t; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_SignalCmd_Payload_t Payload; /**< \brief Command payload */ +} CFE_TIME_SetSignalCmd_t; -/* -** Type definition (generic "time argument" command)... -*/ +/** + * \brief Generic seconds, microseconds command payload + */ typedef struct CFE_TIME_TimeCmd_Payload { uint32 Seconds; uint32 MicroSeconds; } CFE_TIME_TimeCmd_Payload_t; +/** + * \brief Generic seconds, microseconds argument command + */ typedef struct CFE_TIME_TimeCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_TIME_TimeCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_TimeCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_TimeCmd_t; /* @@ -829,18 +844,18 @@ typedef struct CFE_TIME_TimeCmd * This follows the convention for command handler prototypes and allows * each one to independently evolve as necessary. */ -typedef CFE_TIME_TimeCmd_t CFE_TIME_AddDelay_t; -typedef CFE_TIME_TimeCmd_t CFE_TIME_SubDelay_t; -typedef CFE_TIME_TimeCmd_t CFE_TIME_SetMET_t; -typedef CFE_TIME_TimeCmd_t CFE_TIME_SetSTCF_t; -typedef CFE_TIME_TimeCmd_t CFE_TIME_AddAdjust_t; -typedef CFE_TIME_TimeCmd_t CFE_TIME_SubAdjust_t; -typedef CFE_TIME_TimeCmd_t CFE_TIME_SetTime_t; +typedef CFE_TIME_TimeCmd_t CFE_TIME_AddDelayCmd_t; +typedef CFE_TIME_TimeCmd_t CFE_TIME_SubDelayCmd_t; +typedef CFE_TIME_TimeCmd_t CFE_TIME_SetMETCmd_t; +typedef CFE_TIME_TimeCmd_t CFE_TIME_SetSTCFCmd_t; +typedef CFE_TIME_TimeCmd_t CFE_TIME_AddAdjustCmd_t; +typedef CFE_TIME_TimeCmd_t CFE_TIME_SubAdjustCmd_t; +typedef CFE_TIME_TimeCmd_t CFE_TIME_SetTimeCmd_t; -/* -** Type definition (1Hz STCF adjustment "time argument" command)... -*/ +/** + * \brief Generic seconds, subseconds command payload + */ typedef struct CFE_TIME_OneHzAdjustmentCmd_Payload { uint32 Seconds; @@ -848,11 +863,13 @@ typedef struct CFE_TIME_OneHzAdjustmentCmd_Payload } CFE_TIME_OneHzAdjustmentCmd_Payload_t; +/** + * \brief Generic seconds, subseconds adjustment command + */ typedef struct CFE_TIME_OneHzAdjustmentCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_TIME_OneHzAdjustmentCmd_Payload_t Payload; - + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_OneHzAdjustmentCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_OneHzAdjustmentCmd_t; /* @@ -860,42 +877,12 @@ typedef struct CFE_TIME_OneHzAdjustmentCmd * This follows the convention for command handler prototypes and allows * each one to independently evolve as necessary. */ -typedef CFE_TIME_OneHzAdjustmentCmd_t CFE_TIME_Add1HZAdjustment_t; -typedef CFE_TIME_OneHzAdjustmentCmd_t CFE_TIME_Sub1HZAdjustment_t; - -/* -** Type definition (local 1Hz wake-up command)... -*/ -typedef struct CFE_TIME_1HzCmd -{ - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - -} CFE_TIME_1HzCmd_t; - +typedef CFE_TIME_OneHzAdjustmentCmd_t CFE_TIME_Add1HZAdjustmentCmd_t; +typedef CFE_TIME_OneHzAdjustmentCmd_t CFE_TIME_Sub1HZAdjustmentCmd_t; -/* -** Type definition (time at the tone signal command)... -*/ -typedef struct CFE_TIME_ToneSignalCmd -{ - CFE_SB_CmdHdr_t CmdHeader; - -} CFE_TIME_ToneSignalCmd_t; - - -/* -** Type definition ("fake" time at the tone signal command)... -*/ -typedef struct CFE_TIME_FakeToneCmd -{ - CFE_SB_CmdHdr_t CmdHeader; - -} CFE_TIME_FakeToneCmd_t; - - -/* -** Type definition (time at the tone data command)... -*/ +/** + * \brief Time at tone data command payload + */ typedef struct CFE_TIME_ToneDataCmd_Payload { CFE_TIME_SysTime_t AtToneMET; /**< \brief MET at time of tone */ @@ -904,10 +891,13 @@ typedef struct CFE_TIME_ToneDataCmd_Payload int16 AtToneState; /**< \brief Clock state at time of tone */ } CFE_TIME_ToneDataCmd_Payload_t; +/** + * \brief Time at tone data command + */ typedef struct CFE_TIME_ToneDataCmd { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - CFE_TIME_ToneDataCmd_Payload_t Payload; + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_ToneDataCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_ToneDataCmd_t; @@ -977,8 +967,8 @@ typedef struct CFE_TIME_HousekeepingTlm_Payload typedef struct CFE_TIME_HousekeepingTlm { - CFE_SB_TlmHdr_t TlmHeader; - CFE_TIME_HousekeepingTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_TIME_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TIME_HousekeepingTlm_t; @@ -1135,8 +1125,8 @@ typedef struct CFE_TIME_DiagnosticTlm_Payload typedef struct CFE_TIME_DiagnosticTlm { - CFE_SB_TlmHdr_t TlmHeader; - CFE_TIME_DiagnosticTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_TIME_DiagnosticTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TIME_DiagnosticTlm_t; diff --git a/fsw/cfe-core/src/sb/cfe_sb_api.c b/fsw/cfe-core/src/sb/cfe_sb_api.c index e1c6570ef..62fd41809 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_api.c +++ b/fsw/cfe-core/src/sb/cfe_sb_api.c @@ -293,7 +293,7 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_ResourceID_t AppId) int32 Stat; CFE_ES_ResourceID_t Owner; CFE_ES_ResourceID_t TskId; - CFE_MSG_Message_t *PipeMsgPtr; + CFE_SB_Buffer_t *BufPtr; char FullName[(OS_MAX_API_NAME * 2)]; CFE_SB_RemovePipeCallback_t Args; @@ -346,7 +346,7 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_ResourceID_t AppId) /* this step will free the memory used to store the message */ do{ CFE_SB_UnlockSharedData(__func__,__LINE__); - Stat = CFE_SB_RcvMsg(&PipeMsgPtr,PipeId,CFE_SB_POLL); + Stat = CFE_SB_ReceiveBuffer(&BufPtr,PipeId,CFE_SB_POLL); CFE_SB_LockSharedData(__func__,__LINE__); }while(Stat == CFE_SUCCESS); @@ -876,7 +876,7 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB.SubRprtMsg.Payload.Qos.Reliability = Quality.Reliability; CFE_SB.SubRprtMsg.Payload.SubType = CFE_SB_SUBSCRIPTION; CFE_SB_UnlockSharedData(__func__,__LINE__); - Stat = CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.SubRprtMsg); + Stat = CFE_SB_TransmitMsg(&CFE_SB.SubRprtMsg.Hdr.Msg, true); CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RPT_EID,CFE_EVS_EventType_DEBUG,CFE_SB.AppId, "Sending Subscription Report Msg=0x%x,Pipe=%d,Stat=0x%x", (unsigned int)CFE_SB_MsgIdToValue(MsgId), @@ -1099,21 +1099,87 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, return CFE_SUCCESS; }/* end CFE_SB_UnsubscribeFull */ +/* + * Function CFE_SB_TransmitMsg - See API and header file for details + */ +int32 CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount) +{ + int32 Status; + CFE_MSG_Size_t Size = 0; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + CFE_ES_ResourceID_t TskId; + char FullName[(OS_MAX_API_NAME * 2)]; + CFE_SB_BufferD_t *BufDscPtr; + CFE_SBR_RouteId_t RouteId; + CFE_MSG_Type_t MsgType; + + /* Get task id for events and Sender Info*/ + CFE_ES_GetTaskID(&TskId); + + Status = CFE_SB_TransmitMsgValidate(MsgPtr, &MsgId, &Size, &RouteId); + + /* Copy into buffer and send if route exists */ + if (Status == CFE_SUCCESS && CFE_SBR_IsValidRouteId(RouteId)) + { + /* Get buffer */ + BufDscPtr = CFE_SB_GetBufferFromPool(MsgId, Size); + if (BufDscPtr == NULL) + { + /* Determine if event can be sent without causing recursive event problem */ + if(CFE_SB_RequestToSendEvent(TskId,CFE_SB_GET_BUF_ERR_EID_BIT) == CFE_SB_GRANTED) + { + CFE_EVS_SendEventWithAppID(CFE_SB_GET_BUF_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, + "Send Err:Request for Buffer Failed. MsgId 0x%x,app %s,size %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + CFE_SB_GetAppTskName(TskId,FullName),(int)Size); + + /* clear the bit so the task may send this event again */ + CFE_SB_FinishSendEvent(TskId,CFE_SB_GET_BUF_ERR_EID_BIT); + } + + Status = CFE_SB_BUF_ALOC_ERR; + } + else + { + /* For Tlm packets, increment the seq count if requested */ + CFE_MSG_GetType(MsgPtr, &MsgType); + if((MsgType == CFE_MSG_Type_Tlm) && IncrementSequenceCount) + { + CFE_SBR_IncrementSequenceCounter(RouteId); + CFE_MSG_SetSequenceCount(MsgPtr, CFE_SBR_GetSequenceCounter(RouteId)); + } + + /* Copy data into buffer and transmit */ + memcpy(BufDscPtr->Buffer, MsgPtr, Size); + Status = CFE_SB_TransmitBufferFull(BufDscPtr, RouteId, MsgId); + } + } + + if (Status != CFE_SUCCESS) + { + /* Increment error counter (inside lock) if not success */ + CFE_SB_LockSharedData(__func__, __LINE__); + CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter++; + CFE_SB_UnlockSharedData(__func__, __LINE__); + } + + return Status; +} + +#ifndef CFE_OMIT_DEPRECATED_6_8 /* * Function: CFE_SB_SendMsg - See API and header file for details */ int32 CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr) { - int32 Status = 0; + int32 Status = 0; - Status = CFE_SB_SendMsgFull(MsgPtr,CFE_SB_INCREMENT_TLM,CFE_SB_SEND_ONECOPY); + Status = CFE_SB_TransmitMsg(MsgPtr, true); return Status; }/* end CFE_SB_SendMsg */ - - /* * Function: CFE_SB_PassMsg - See API and header file for details */ @@ -1121,190 +1187,124 @@ int32 CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr) { int32 Status = 0; - Status = CFE_SB_SendMsgFull(MsgPtr,CFE_SB_DO_NOT_INCREMENT,CFE_SB_SEND_ONECOPY); + Status = CFE_SB_TransmitMsg(MsgPtr, false); return Status; }/* end CFE_SB_PassMsg */ +#endif /* CFE_OMIT_DEPRECATED_6_8 */ - - -/****************************************************************************** -** Name: CFE_SB_SendMsgFull -** -** Purpose: API used to send a message on the software bus. -** -** Assumptions, External Events, and Notes: -** -** Note: This function increments and tracks the source sequence -** counter for all telemetry messages. -** -** Date Written: -** 04/25/2005 -** -** Input Arguments: -** MsgPtr -** TlmCntIncrements -** CopyMode -** -** Output Arguments: -** None -** -** Return Values: -** Status -** -******************************************************************************/ -int32 CFE_SB_SendMsgFull(CFE_MSG_Message_t *MsgPtr, - uint32 TlmCntIncrements, - uint32 CopyMode) +/*****************************************************************************/ +/** + * \brief Internal routine to validate a transmit message before sending + * + * \param[in] MsgPtr Pointer to the message to validate + * \param[out] MsgIdPtr Message Id of message + * \param[out] SizePtr Size of message + * \param[out] RouteIdPtr Route ID of the message (invalid if none) + */ +int32 CFE_SB_TransmitMsgValidate(CFE_MSG_Message_t *MsgPtr, + CFE_SB_MsgId_t *MsgIdPtr, + CFE_MSG_Size_t *SizePtr, + CFE_SBR_RouteId_t *RouteIdPtr) { - CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; - int32 Status; - CFE_SB_DestinationD_t *DestPtr = NULL; - CFE_SB_PipeD_t *PipeDscPtr; - CFE_SBR_RouteId_t RouteId; - CFE_SB_BufferD_t *BufDscPtr; - CFE_MSG_Size_t TotalMsgSize = 0; - CFE_ES_ResourceID_t AppId; CFE_ES_ResourceID_t TskId; - uint32 i; char FullName[(OS_MAX_API_NAME * 2)]; - CFE_SB_EventBuf_t SBSndErr; - char PipeName[OS_MAX_API_NAME] = {'\0'}; - CFE_SB_PipeDepthStats_t *StatObj; - CFE_MSG_Type_t MsgType = CFE_MSG_Type_Invalid; - - SBSndErr.EvtsToSnd = 0; - - /* get app id for loopback testing */ - CFE_ES_GetAppID(&AppId); /* get task id for events and Sender Info*/ CFE_ES_GetTaskID(&TskId); /* check input parameter */ - if(MsgPtr == NULL){ - CFE_SB_LockSharedData(__func__,__LINE__); - CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter++; - CFE_SB_UnlockSharedData(__func__,__LINE__); + if(MsgPtr == NULL) + { CFE_EVS_SendEventWithAppID(CFE_SB_SEND_BAD_ARG_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Send Err:Bad input argument,Arg 0x%lx,App %s", (unsigned long)MsgPtr,CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SB_BAD_ARGUMENT; }/* end if */ - CFE_MSG_GetMsgId(MsgPtr, &MsgId); + CFE_MSG_GetMsgId(MsgPtr, MsgIdPtr); /* validate the msgid in the message */ - if(!CFE_SB_IsValidMsgId(MsgId)) + if(!CFE_SB_IsValidMsgId(*MsgIdPtr)) { - CFE_SB_LockSharedData(__func__,__LINE__); - CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter++; - if (CopyMode == CFE_SB_SEND_ZEROCOPY) - { - BufDscPtr = CFE_SB_GetBufferFromCaller(MsgId, MsgPtr); - CFE_SB_DecrBufUseCnt(BufDscPtr); - } - CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_SEND_INV_MSGID_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Send Err:Invalid MsgId(0x%x)in msg,App %s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SB_BAD_ARGUMENT; }/* end if */ - CFE_MSG_GetSize(MsgPtr, &TotalMsgSize); + CFE_MSG_GetSize(MsgPtr, SizePtr); /* Verify the size of the pkt is < or = the mission defined max */ - if(TotalMsgSize > CFE_MISSION_SB_MAX_SB_MSG_SIZE){ - CFE_SB_LockSharedData(__func__,__LINE__); - CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter++; - if (CopyMode == CFE_SB_SEND_ZEROCOPY) - { - BufDscPtr = CFE_SB_GetBufferFromCaller(MsgId, MsgPtr); - CFE_SB_DecrBufUseCnt(BufDscPtr); - } - CFE_SB_UnlockSharedData(__func__,__LINE__); + if(*SizePtr > CFE_MISSION_SB_MAX_SB_MSG_SIZE) + { CFE_EVS_SendEventWithAppID(CFE_SB_MSG_TOO_BIG_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Send Err:Msg Too Big MsgId=0x%x,app=%s,size=%d,MaxSz=%d", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_SB_GetAppTskName(TskId,FullName),(int)TotalMsgSize,CFE_MISSION_SB_MAX_SB_MSG_SIZE); + (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), + CFE_SB_GetAppTskName(TskId,FullName),(int)*SizePtr,CFE_MISSION_SB_MAX_SB_MSG_SIZE); return CFE_SB_MSG_TOO_BIG; }/* end if */ - /* take semaphore to prevent a task switch during this call */ - CFE_SB_LockSharedData(__func__,__LINE__); - - /* Get the routing pointer */ - RouteId = CFE_SBR_GetRouteId(MsgId); + /* Get the routing id */ + *RouteIdPtr = CFE_SBR_GetRouteId(*MsgIdPtr); /* if there have been no subscriptions for this pkt, */ /* increment the dropped pkt cnt, send event and return success */ - if(!CFE_SBR_IsValidRouteId(RouteId)){ + if(!CFE_SBR_IsValidRouteId(*RouteIdPtr)){ CFE_SB.HKTlmMsg.Payload.NoSubscribersCounter++; - if (CopyMode == CFE_SB_SEND_ZEROCOPY){ - BufDscPtr = CFE_SB_GetBufferFromCaller(MsgId, MsgPtr); - CFE_SB_DecrBufUseCnt(BufDscPtr); - } - - CFE_SB_UnlockSharedData(__func__,__LINE__); - /* Determine if event can be sent without causing recursive event problem */ if(CFE_SB_RequestToSendEvent(TskId,CFE_SB_SEND_NO_SUBS_EID_BIT) == CFE_SB_GRANTED){ CFE_EVS_SendEventWithAppID(CFE_SB_SEND_NO_SUBS_EID,CFE_EVS_EventType_INFORMATION,CFE_SB.AppId, "No subscribers for MsgId 0x%x,sender %s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), CFE_SB_GetAppTskName(TskId,FullName)); /* clear the bit so the task may send this event again */ CFE_SB_FinishSendEvent(TskId,CFE_SB_SEND_NO_SUBS_EID_BIT); }/* end if */ - return CFE_SUCCESS; }/* end if */ - /* Allocate a new buffer. */ - if (CopyMode == CFE_SB_SEND_ZEROCOPY){ - BufDscPtr = CFE_SB_GetBufferFromCaller(MsgId, MsgPtr); - } - else{ - BufDscPtr = CFE_SB_GetBufferFromPool(MsgId, TotalMsgSize); - } - if (BufDscPtr == NULL){ - CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter++; - CFE_SB_UnlockSharedData(__func__,__LINE__); - - /* Determine if event can be sent without causing recursive event problem */ - if(CFE_SB_RequestToSendEvent(TskId,CFE_SB_GET_BUF_ERR_EID_BIT) == CFE_SB_GRANTED){ - - CFE_EVS_SendEventWithAppID(CFE_SB_GET_BUF_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, - "Send Err:Request for Buffer Failed. MsgId 0x%x,app %s,size %d", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_SB_GetAppTskName(TskId,FullName),(int)TotalMsgSize); + return CFE_SUCCESS; +} - /* clear the bit so the task may send this event again */ - CFE_SB_FinishSendEvent(TskId,CFE_SB_GET_BUF_ERR_EID_BIT); - }/* end if */ +/*****************************************************************************/ +/** + * \brief Internal routine implements full send logic + * + * \param[in] BufDscPtr Pointer to the buffer description from the memory pool, + * released prior to return + * \param[in] RouteId Route to send to + * \param[in] MsgId Message Id that is being sent + */ +int32 CFE_SB_TransmitBufferFull(CFE_SB_BufferD_t *BufDscPtr, + CFE_SBR_RouteId_t RouteId, + CFE_SB_MsgId_t MsgId) +{ + CFE_ES_ResourceID_t AppId; + CFE_ES_ResourceID_t TskId; + CFE_SB_DestinationD_t *DestPtr; + CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_EventBuf_t SBSndErr = {0}; + char PipeName[OS_MAX_API_NAME] = {'\0'}; + CFE_SB_PipeDepthStats_t *StatObj; + int32 Status; + uint32 i; + char FullName[(OS_MAX_API_NAME * 2)]; - return CFE_SB_BUF_ALOC_ERR; - }/* end if */ + /* get app id for loopback testing */ + CFE_ES_GetAppID(&AppId); - /* Copy the packet into the SB memory space */ - if (CopyMode != CFE_SB_SEND_ZEROCOPY){ - /* Copy the packet into the SB memory space */ - memcpy( BufDscPtr->Buffer, MsgPtr, TotalMsgSize ); - } + /* get task id for events and Sender Info*/ + CFE_ES_GetTaskID(&TskId); - /* For Tlm packets, increment the seq count if requested */ - CFE_MSG_GetType(MsgPtr, &MsgType); - if((MsgType == CFE_MSG_Type_Tlm) && - (TlmCntIncrements==CFE_SB_INCREMENT_TLM)){ - CFE_SBR_IncrementSequenceCounter(RouteId); - CFE_MSG_SetSequenceCount((CFE_MSG_Message_t *)BufDscPtr->Buffer, CFE_SBR_GetSequenceCounter(RouteId)); - }/* end if */ + /* take semaphore to prevent a task switch during processing */ + CFE_SB_LockSharedData(__func__,__LINE__); /* Send the packet to all destinations */ for(DestPtr = CFE_SBR_GetDestListHeadPtr(RouteId); DestPtr != NULL; DestPtr = DestPtr->Next) @@ -1453,16 +1453,23 @@ int32 CFE_SB_SendMsgFull(CFE_MSG_Message_t *MsgPtr, return CFE_SUCCESS; -}/* end CFE_SB_SendMsgFull */ - +} +#if CFE_OMIT_DEPRECATED_6_8 +int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, + CFE_SB_PipeId_t PipeId, + int32 TimeOut) +{ + return CFE_SB_ReceiveBuffer(BufPtr, PipeId, TimeOut); +} +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /* - * Function: CFE_SB_RcvMsg - See API and header file for details + * Function: CFE_SB_ReceiveBuffer - See API and header file for details */ -int32 CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, - CFE_SB_PipeId_t PipeId, - int32 TimeOut) +int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, + CFE_SB_PipeId_t PipeId, + int32 TimeOut) { int32 Status; CFE_SB_BufferD_t *Message; @@ -1532,12 +1539,12 @@ int32 CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, /* ** Load the pipe tables 'CurrentBuff' with the buffer descriptor ** ptr corresponding to the message just read. This is done so that - ** the buffer can be released on the next RcvMsg call for this pipe. + ** the buffer can be released on the next receive call for this pipe. */ PipeDscPtr->CurrentBuff = Message; /* Set the Receivers pointer to the address of the actual message */ - *BufPtr = (CFE_MSG_Message_t*) Message->Buffer; + *BufPtr = (CFE_SB_Buffer_t *) Message->Buffer; /* get pointer to destination to be used in decrementing msg limit cnt*/ RouteId = CFE_SBR_GetRouteId(PipeDscPtr->CurrentBuff->MsgId); @@ -1579,14 +1586,14 @@ int32 CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, */ return Status; -}/* end CFE_SB_RcvMsg */ +} /* * Function: CFE_SB_ZeroCopyGetPtr - See API and header file for details */ -CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, - CFE_SB_ZeroCopyHandle_t *BufferHandle) +CFE_SB_Buffer_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, + CFE_SB_ZeroCopyHandle_t *BufferHandle) { int32 stat1; CFE_ES_ResourceID_t AppId; @@ -1667,7 +1674,7 @@ CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, bd->Size = MsgSize; bd->Buffer = (void *)address; - return (CFE_MSG_Message_t *)address; + return (CFE_SB_Buffer_t *)address; }/* CFE_SB_ZeroCopyGetPtr */ @@ -1675,7 +1682,7 @@ CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, /* * Function: CFE_SB_ZeroCopyReleasePtr - See API and header file for details */ -int32 CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, +int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle) { int32 Status; @@ -1727,7 +1734,7 @@ int32 CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, ** Status ** ******************************************************************************/ -int32 CFE_SB_ZeroCopyReleaseDesc(CFE_MSG_Message_t *Ptr2Release, +int32 CFE_SB_ZeroCopyReleaseDesc(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle) { int32 Stat; @@ -1766,20 +1773,75 @@ int32 CFE_SB_ZeroCopyReleaseDesc(CFE_MSG_Message_t *Ptr2Release, }/* end CFE_SB_ZeroCopyReleaseDesc */ +/* + * Function CFE_SB_TransmitBuffer - See API and header file for details + */ +int32 CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, + CFE_SB_ZeroCopyHandle_t ZeroCopyHandle, + bool IncrementSequenceCount) +{ + int32 Status; + CFE_MSG_Size_t Size = 0; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + CFE_SB_BufferD_t *BufDscPtr; + CFE_SBR_RouteId_t RouteId; + CFE_MSG_Type_t MsgType; + + /* Release zero copy handle */ + Status = CFE_SB_ZeroCopyReleaseDesc(BufPtr, ZeroCopyHandle); + + if (Status == CFE_SUCCESS) + { + Status = CFE_SB_TransmitMsgValidate(&BufPtr->Msg, &MsgId, &Size, &RouteId); + + /* Send if route exists */ + if (Status == CFE_SUCCESS) + { + /* Get buffer descriptor pointer */ + BufDscPtr = CFE_SB_GetBufferFromCaller(MsgId, BufPtr); + + if(CFE_SBR_IsValidRouteId(RouteId)) + { + /* For Tlm packets, increment the seq count if requested */ + CFE_MSG_GetType(&BufPtr->Msg, &MsgType); + if((MsgType == CFE_MSG_Type_Tlm) && IncrementSequenceCount) + { + CFE_SBR_IncrementSequenceCounter(RouteId); + CFE_MSG_SetSequenceCount(&BufPtr->Msg, CFE_SBR_GetSequenceCounter(RouteId)); + } + + Status = CFE_SB_TransmitBufferFull(BufDscPtr, RouteId, MsgId); + } + else + { + /* Decrement use count if transmit buffer full not called */ + CFE_SB_LockSharedData(__func__, __LINE__); + CFE_SB_DecrBufUseCnt(BufDscPtr); + CFE_SB_UnlockSharedData(__func__, __LINE__); + } + } + else + { + /* Increment send error counter for validation failure */ + CFE_SB_LockSharedData(__func__, __LINE__); + CFE_SB.HKTlmMsg.Payload.MsgSendErrorCounter++; + CFE_SB_UnlockSharedData(__func__, __LINE__); + } + } + + return Status; +} +#ifndef CFE_OMIT_DEPRECATED_6_8 /* * Function: CFE_SB_ZeroCopySend - See API and header file for details */ -int32 CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, +int32 CFE_SB_ZeroCopySend(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { - int32 Status = 0; - - Status = CFE_SB_ZeroCopyReleaseDesc(MsgPtr, BufferHandle); + int32 Status = 0; - if(Status == CFE_SUCCESS){ - Status = CFE_SB_SendMsgFull(MsgPtr,CFE_SB_INCREMENT_TLM,CFE_SB_SEND_ZEROCOPY); - } + Status = CFE_SB_TransmitBuffer(BufPtr, BufferHandle, true); return Status; @@ -1789,21 +1851,17 @@ int32 CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, /* * Function: CFE_SB_ZeroCopyPass - See API and header file for details */ -int32 CFE_SB_ZeroCopyPass(CFE_MSG_Message_t *MsgPtr, +int32 CFE_SB_ZeroCopyPass(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { - int32 Status = 0; + int32 Status = 0; - Status = CFE_SB_ZeroCopyReleaseDesc(MsgPtr, BufferHandle); - - if(Status == CFE_SUCCESS){ - Status = CFE_SB_SendMsgFull(MsgPtr,CFE_SB_DO_NOT_INCREMENT,CFE_SB_SEND_ZEROCOPY); - } + Status = CFE_SB_TransmitBuffer(BufPtr, BufferHandle, false); return Status; }/* end CFE_SB_ZeroCopyPass */ - +#endif /****************************************************************************** ** Function: CFE_SB_ReadQueue() diff --git a/fsw/cfe-core/src/sb/cfe_sb_init.c b/fsw/cfe-core/src/sb/cfe_sb_init.c index 374430251..e9a35cfb4 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_init.c +++ b/fsw/cfe-core/src/sb/cfe_sb_init.c @@ -116,7 +116,7 @@ int32 CFE_SB_EarlyInit (void) { CFE_SBR_Init(); /* Initialize the SB Statistics Pkt */ - CFE_MSG_Init(&CFE_SB.StatTlmMsg.Hdr.BaseMsg, + CFE_MSG_Init(&CFE_SB.StatTlmMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), sizeof(CFE_SB.StatTlmMsg)); diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.c b/fsw/cfe-core/src/sb/cfe_sb_priv.c index f6eeb5623..80ba52c2b 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.c +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.c @@ -608,7 +608,7 @@ int32 CFE_SB_ZeroCopyReleaseAppId(CFE_ES_ResourceID_t AppId) prev = (CFE_SB_ZeroCopyD_t *) (zcd->Prev); if( CFE_ES_ResourceID_Equal(zcd->AppID, AppId) ) { - CFE_SB_ZeroCopyReleasePtr((CFE_MSG_Message_t *) zcd->Buffer, (CFE_SB_ZeroCopyHandle_t) zcd); + CFE_SB_ZeroCopyReleasePtr((CFE_SB_Buffer_t *) zcd->Buffer, (CFE_SB_ZeroCopyHandle_t) zcd); } zcd = prev; } diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.h b/fsw/cfe-core/src/sb/cfe_sb_priv.h index 944db2ba8..a70d658fe 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.h +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.h @@ -194,7 +194,6 @@ typedef struct CFE_SB_HousekeepingTlm_t HKTlmMsg; CFE_SB_StatsTlm_t StatTlmMsg; CFE_SB_PipeId_t CmdPipe; - CFE_MSG_Message_t *CmdPipePktPtr; CFE_SB_MemParams_t Mem; CFE_SB_AllSubscriptionsTlm_t PrevSubMsg; CFE_SB_SingleSubscriptionTlm_t SubRprtMsg; @@ -245,7 +244,7 @@ int32 CFE_SB_WriteQueue(CFE_SB_PipeD_t *pd,uint32 TskId, const CFE_SB_BufferD_t *bd,CFE_SB_MsgId_t MsgId ); uint8 CFE_SB_GetPipeIdx(CFE_SB_PipeId_t PipeId); int32 CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd); -void CFE_SB_ProcessCmdPipePkt(void); +void CFE_SB_ProcessCmdPipePkt(CFE_SB_Buffer_t *SBBufPtr); void CFE_SB_ResetCounters(void); void CFE_SB_SetMsgSeqCnt(CFE_MSG_Message_t *MsgPtr,uint32 Count); char *CFE_SB_GetAppTskName(CFE_ES_ResourceID_t TaskId, char* FullName); @@ -266,11 +265,17 @@ int32 CFE_SB_UnsubscribeWithAppId(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint8 Scope, CFE_ES_ResourceID_t AppId); -int32 CFE_SB_SendMsgFull(CFE_MSG_Message_t *MsgPtr, uint32 TlmCntIncrements, uint32 CopyMode); +int32 CFE_SB_TransmitBufferFull(CFE_SB_BufferD_t *BufDscPtr, + CFE_SBR_RouteId_t RouteId, + CFE_SB_MsgId_t MsgId); +int32 CFE_SB_TransmitMsgValidate(CFE_MSG_Message_t *MsgPtr, + CFE_SB_MsgId_t *MsgIdPtr, + CFE_MSG_Size_t *SizePtr, + CFE_SBR_RouteId_t *RouteIdPtr); int32 CFE_SB_SendRtgInfo(const char *Filename); int32 CFE_SB_SendPipeInfo(const char *Filename); int32 CFE_SB_SendMapInfo(const char *Filename); -int32 CFE_SB_ZeroCopyReleaseDesc(CFE_MSG_Message_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); +int32 CFE_SB_ZeroCopyReleaseDesc(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); int32 CFE_SB_ZeroCopyReleaseAppId(CFE_ES_ResourceID_t AppId); int32 CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd); int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId); @@ -335,27 +340,26 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI /*****************************************************************************/ /** -** \brief Get the size of a software bus message header. +** \brief Get the size of a message header. ** ** \par Description -** This routine returns the number of bytes in a software bus message header. -** This can be used for sizing buffers that need to store SB messages. SB -** message header formats can be different for each deployment of the cFE. -** So, applications should use this function and avoid hard coding their buffer -** sizes. +** This routine is a best guess of the message header size based off type +** information and the local message implementation. +** If a different header implementation was used to generate the message +** the returned size may not be correct. Critical functionality should +** use the real message structure or otherwise confirm header implementation +** matches expectations prior to using this API. ** ** \par Assumptions, External Events, and Notes: -** - For statically defined messages, a function call will not work. The -** macros #CFE_SB_CMD_HDR_SIZE and #CFE_SB_TLM_HDR_SIZE are available for use -** in static message buffer sizing or structure definitions. +** - Utilize CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t for +** defining message structures. ** ** \param[in] *MsgPtr The message ID to calculate header size for. The size of the message ** header may depend on the MsgId in some implementations. For example, ** if SB messages are implemented as CCSDS packets, the size of the header ** is different for command vs. telemetry packets. ** -** \returns The number of bytes in the software bus message header for -** messages with the given \c MsgId. +** \returns Estimated number of bytes in the message header for the given message **/ size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr); @@ -363,18 +367,18 @@ size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr); /* * Software Bus Message Handler Function prototypes */ -int32 CFE_SB_NoopCmd(const CFE_SB_Noop_t *data); -int32 CFE_SB_ResetCountersCmd(const CFE_SB_ResetCounters_t *data); -int32 CFE_SB_EnableSubReportingCmd(const CFE_SB_EnableSubReporting_t *data); -int32 CFE_SB_DisableSubReportingCmd(const CFE_SB_DisableSubReporting_t *data); -int32 CFE_SB_SendHKTlmCmd(const CFE_SB_CmdHdr_t *data); -int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRoute_t *data); -int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRoute_t *data); -int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStats_t *data); -int32 CFE_SB_SendRoutingInfoCmd(const CFE_SB_SendRoutingInfo_t *data); -int32 CFE_SB_SendPipeInfoCmd(const CFE_SB_SendPipeInfo_t *data); -int32 CFE_SB_SendMapInfoCmd(const CFE_SB_SendMapInfo_t *data); -int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubs_t *data); +int32 CFE_SB_NoopCmd(const CFE_SB_NoopCmd_t *data); +int32 CFE_SB_ResetCountersCmd(const CFE_SB_ResetCountersCmd_t *data); +int32 CFE_SB_EnableSubReportingCmd(const CFE_SB_EnableSubReportingCmd_t *data); +int32 CFE_SB_DisableSubReportingCmd(const CFE_SB_DisableSubReportingCmd_t *data); +int32 CFE_SB_SendHKTlmCmd(const CFE_MSG_CommandHeader_t *data); +int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data); +int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data); +int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStatsCmd_t *data); +int32 CFE_SB_SendRoutingInfoCmd(const CFE_SB_SendRoutingInfoCmd_t *data); +int32 CFE_SB_SendPipeInfoCmd(const CFE_SB_SendPipeInfoCmd_t *data); +int32 CFE_SB_SendMapInfoCmd(const CFE_SB_SendMapInfoCmd_t *data); +int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data); /* diff --git a/fsw/cfe-core/src/sb/cfe_sb_task.c b/fsw/cfe-core/src/sb/cfe_sb_task.c index a6aff96e2..003f3c0f5 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_task.c +++ b/fsw/cfe-core/src/sb/cfe_sb_task.c @@ -72,7 +72,8 @@ typedef struct */ void CFE_SB_TaskMain(void) { - int32 Status; + int32 Status; + CFE_SB_Buffer_t *SBBufPtr; CFE_ES_PerfLogEntry(CFE_MISSION_SB_MAIN_PERF_ID); @@ -103,7 +104,7 @@ void CFE_SB_TaskMain(void) CFE_ES_PerfLogExit(CFE_MISSION_SB_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_RcvMsg(&CFE_SB.CmdPipePktPtr, + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_SB.CmdPipe, CFE_SB_PEND_FOREVER); @@ -112,14 +113,14 @@ void CFE_SB_TaskMain(void) if(Status == CFE_SUCCESS) { /* Process cmd pipe msg */ - CFE_SB_ProcessCmdPipePkt(); + CFE_SB_ProcessCmdPipePkt(SBBufPtr); }else{ CFE_ES_WriteToSysLog("SB:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); }/* end if */ }/* end while */ - /* while loop exits only if CFE_SB_RcvMsg returns error */ + /* while loop exits only if CFE_SB_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); }/* end CFE_SB_TaskMain */ @@ -224,15 +225,15 @@ int32 CFE_SB_AppInit(void){ CFE_ES_WriteToSysLog("SB:Registered %d events for filtering\n",(int)CfgFileEventsToFilter); - CFE_MSG_Init(&CFE_SB.HKTlmMsg.Hdr.BaseMsg, + CFE_MSG_Init(&CFE_SB.HKTlmMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), sizeof(CFE_SB.HKTlmMsg)); - CFE_MSG_Init(&CFE_SB.PrevSubMsg.Hdr.BaseMsg, + CFE_MSG_Init(&CFE_SB.PrevSubMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), sizeof(CFE_SB.PrevSubMsg)); - CFE_MSG_Init(&CFE_SB.SubRprtMsg.Hdr.BaseMsg, + CFE_MSG_Init(&CFE_SB.SubRprtMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), sizeof(CFE_SB.SubRprtMsg)); @@ -279,7 +280,7 @@ int32 CFE_SB_AppInit(void){ /* Ensure a ground commanded reset does not get blocked if SB mem pool */ /* becomes fully configured (DCR6772) */ Status = CFE_ES_GetPoolBuf(&TmpPtr, CFE_SB.Mem.PoolHdl, - sizeof(CFE_ES_Restart_t)); + sizeof(CFE_ES_RestartCmd_t)); if(Status < 0){ CFE_ES_WriteToSysLog("SB:Init error, GetPool Failed:RC=0x%08X\n",(unsigned int)Status); @@ -358,46 +359,47 @@ bool CFE_SB_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) ** Function to control actions when an SB command is received. ** ** Arguments: -** none +** Software bus buffer pointer ** ** Return: ** none */ -void CFE_SB_ProcessCmdPipePkt(void) { +void CFE_SB_ProcessCmdPipePkt(CFE_SB_Buffer_t *SBBufPtr) +{ CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t FcnCode = 0; - CFE_MSG_GetMsgId(CFE_SB.CmdPipePktPtr, &MessageID); + CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); switch(CFE_SB_MsgIdToValue(MessageID)){ case CFE_SB_SEND_HK_MID: /* Note: Command counter not incremented for this command */ - CFE_SB_SendHKTlmCmd((CFE_SB_CmdHdr_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_SendHKTlmCmd((CFE_MSG_CommandHeader_t *)SBBufPtr); break; case CFE_SB_SUB_RPT_CTRL_MID: /* Note: Command counter not incremented for this command */ - CFE_MSG_GetFcnCode(CFE_SB.CmdPipePktPtr, &FcnCode); + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); switch (FcnCode) { case CFE_SB_SEND_PREV_SUBS_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_SendPrevSubs_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendPrevSubsCmd_t))) { - CFE_SB_SendPrevSubsCmd((CFE_SB_SendPrevSubs_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_SendPrevSubsCmd((CFE_SB_SendPrevSubsCmd_t *)SBBufPtr); } break; case CFE_SB_ENABLE_SUB_REPORTING_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_EnableSubReporting_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_EnableSubReportingCmd_t))) { - CFE_SB_EnableSubReportingCmd((CFE_SB_EnableSubReporting_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_EnableSubReportingCmd((CFE_SB_EnableSubReportingCmd_t *)SBBufPtr); } break; case CFE_SB_DISABLE_SUB_REPORTING_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_DisableSubReporting_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_DisableSubReportingCmd_t))) { - CFE_SB_DisableSubReportingCmd((CFE_SB_DisableSubReporting_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_DisableSubReportingCmd((CFE_SB_DisableSubReportingCmd_t *)SBBufPtr); } break; @@ -410,62 +412,62 @@ void CFE_SB_ProcessCmdPipePkt(void) { break; case CFE_SB_CMD_MID: - CFE_MSG_GetFcnCode(CFE_SB.CmdPipePktPtr, &FcnCode); + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); switch (FcnCode) { case CFE_SB_NOOP_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_Noop_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_NoopCmd_t))) { - CFE_SB_NoopCmd((CFE_SB_Noop_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_NoopCmd((CFE_SB_NoopCmd_t *)SBBufPtr); } break; case CFE_SB_RESET_COUNTERS_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_ResetCounters_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_ResetCountersCmd_t))) { /* Note: Command counter not incremented for this command */ - CFE_SB_ResetCountersCmd((CFE_SB_ResetCounters_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_ResetCountersCmd((CFE_SB_ResetCountersCmd_t *)SBBufPtr); } break; case CFE_SB_SEND_SB_STATS_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_SendSbStats_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendSbStatsCmd_t))) { - CFE_SB_SendStatsCmd((CFE_SB_SendSbStats_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_SendStatsCmd((CFE_SB_SendSbStatsCmd_t *)SBBufPtr); } break; case CFE_SB_SEND_ROUTING_INFO_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_SendRoutingInfo_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendRoutingInfoCmd_t))) { - CFE_SB_SendRoutingInfoCmd((CFE_SB_SendRoutingInfo_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_SendRoutingInfoCmd((CFE_SB_SendRoutingInfoCmd_t *)SBBufPtr); } break; case CFE_SB_ENABLE_ROUTE_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_EnableRoute_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_EnableRouteCmd_t))) { - CFE_SB_EnableRouteCmd((CFE_SB_EnableRoute_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_EnableRouteCmd((CFE_SB_EnableRouteCmd_t *)SBBufPtr); } break; case CFE_SB_DISABLE_ROUTE_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_DisableRoute_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_DisableRouteCmd_t))) { - CFE_SB_DisableRouteCmd((CFE_SB_DisableRoute_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_DisableRouteCmd((CFE_SB_DisableRouteCmd_t *)SBBufPtr); } break; case CFE_SB_SEND_PIPE_INFO_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_SendPipeInfo_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendPipeInfoCmd_t))) { - CFE_SB_SendPipeInfoCmd((CFE_SB_SendPipeInfo_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_SendPipeInfoCmd((CFE_SB_SendPipeInfoCmd_t *)SBBufPtr); } break; case CFE_SB_SEND_MAP_INFO_CC: - if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_SendMapInfo_t))) + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendMapInfoCmd_t))) { - CFE_SB_SendMapInfoCmd((CFE_SB_SendMapInfo_t *)CFE_SB.CmdPipePktPtr); + CFE_SB_SendMapInfoCmd((CFE_SB_SendMapInfoCmd_t *)SBBufPtr); } break; @@ -497,7 +499,7 @@ void CFE_SB_ProcessCmdPipePkt(void) { ** Handler function the SB command ** */ -int32 CFE_SB_NoopCmd(const CFE_SB_Noop_t *data) +int32 CFE_SB_NoopCmd(const CFE_SB_NoopCmd_t *data) { CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID,CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd. %s", CFE_VERSION_STRING); @@ -513,7 +515,7 @@ int32 CFE_SB_NoopCmd(const CFE_SB_Noop_t *data) ** Handler function the SB command ** */ -int32 CFE_SB_ResetCountersCmd(const CFE_SB_ResetCounters_t *data) +int32 CFE_SB_ResetCountersCmd(const CFE_SB_ResetCountersCmd_t *data) { CFE_EVS_SendEvent(CFE_SB_CMD1_RCVD_EID,CFE_EVS_EventType_DEBUG, "Reset Counters Cmd Rcvd"); @@ -530,7 +532,7 @@ int32 CFE_SB_ResetCountersCmd(const CFE_SB_ResetCounters_t *data) ** Handler function the SB command ** */ -int32 CFE_SB_EnableSubReportingCmd(const CFE_SB_EnableSubReporting_t *data) +int32 CFE_SB_EnableSubReportingCmd(const CFE_SB_EnableSubReportingCmd_t *data) { CFE_SB_SetSubscriptionReporting(CFE_SB_ENABLE); return CFE_SUCCESS; @@ -543,7 +545,7 @@ int32 CFE_SB_EnableSubReportingCmd(const CFE_SB_EnableSubReporting_t *data) ** Handler function the SB command ** */ -int32 CFE_SB_DisableSubReportingCmd(const CFE_SB_DisableSubReporting_t *data) +int32 CFE_SB_DisableSubReportingCmd(const CFE_SB_DisableSubReportingCmd_t *data) { CFE_SB_SetSubscriptionReporting(CFE_SB_DISABLE); return CFE_SUCCESS; @@ -565,13 +567,13 @@ int32 CFE_SB_DisableSubReportingCmd(const CFE_SB_DisableSubReporting_t *data) ** Return: ** none */ -int32 CFE_SB_SendHKTlmCmd(const CFE_SB_CmdHdr_t *data) +int32 CFE_SB_SendHKTlmCmd(const CFE_MSG_CommandHeader_t *data) { CFE_SB.HKTlmMsg.Payload.MemInUse = CFE_SB.StatTlmMsg.Payload.MemInUse; CFE_SB.HKTlmMsg.Payload.UnmarkedMem = CFE_PLATFORM_SB_BUF_MEMORY_BYTES - CFE_SB.StatTlmMsg.Payload.PeakMemInUse; - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_SB.HKTlmMsg); - CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.HKTlmMsg); + CFE_SB_TimeStampMsg(&CFE_SB.HKTlmMsg.Hdr.Msg); + CFE_SB_TransmitMsg(&CFE_SB.HKTlmMsg.Hdr.Msg, true); return CFE_SUCCESS; }/* end CFE_SB_SendHKTlmCmd */ @@ -622,7 +624,7 @@ void CFE_SB_ResetCounters(void){ ** Return: ** None */ -int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRoute_t *data) +int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) { CFE_SB_MsgId_t MsgId; CFE_SB_PipeId_t PipeId; @@ -687,7 +689,7 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRoute_t *data) ** Return: ** None */ -int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRoute_t *data) +int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) { CFE_SB_MsgId_t MsgId; CFE_SB_PipeId_t PipeId; @@ -749,11 +751,11 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRoute_t *data) ** Return: ** None */ -int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStats_t *data) +int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStatsCmd_t *data) { - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_SB.StatTlmMsg); - CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.StatTlmMsg); + CFE_SB_TimeStampMsg(&CFE_SB.StatTlmMsg.Hdr.Msg); + CFE_SB_TransmitMsg(&CFE_SB.StatTlmMsg.Hdr.Msg, true); CFE_EVS_SendEvent(CFE_SB_SND_STATS_EID,CFE_EVS_EventType_DEBUG, "Software Bus Statistics packet sent"); @@ -776,7 +778,7 @@ int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStats_t *data) ** Return: ** None */ -int32 CFE_SB_SendRoutingInfoCmd(const CFE_SB_SendRoutingInfo_t *data) +int32 CFE_SB_SendRoutingInfoCmd(const CFE_SB_SendRoutingInfoCmd_t *data) { const CFE_SB_WriteFileInfoCmd_Payload_t *ptr; char LocalFilename[OS_MAX_PATH_LEN]; @@ -806,7 +808,7 @@ int32 CFE_SB_SendRoutingInfoCmd(const CFE_SB_SendRoutingInfo_t *data) ** Return: ** None */ -int32 CFE_SB_SendPipeInfoCmd(const CFE_SB_SendPipeInfo_t *data) +int32 CFE_SB_SendPipeInfoCmd(const CFE_SB_SendPipeInfoCmd_t *data) { const CFE_SB_WriteFileInfoCmd_Payload_t *ptr; char LocalFilename[OS_MAX_PATH_LEN]; @@ -836,7 +838,7 @@ int32 CFE_SB_SendPipeInfoCmd(const CFE_SB_SendPipeInfo_t *data) ** Return: ** None */ -int32 CFE_SB_SendMapInfoCmd(const CFE_SB_SendMapInfo_t *data) +int32 CFE_SB_SendMapInfoCmd(const CFE_SB_SendMapInfoCmd_t *data) { const CFE_SB_WriteFileInfoCmd_Payload_t *ptr; char LocalFilename[OS_MAX_PATH_LEN]; @@ -1160,7 +1162,7 @@ void CFE_SB_SendRouteSub(CFE_SBR_RouteId_t RouteId, void *ArgPtr) if(CFE_SB.PrevSubMsg.Payload.Entries >= CFE_SB_SUB_ENTRIES_PER_PKT) { CFE_SB_UnlockSharedData(__func__,__LINE__); - status = CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.PrevSubMsg); + status = CFE_SB_TransmitMsg(&CFE_SB.PrevSubMsg.Hdr.Msg, true); CFE_EVS_SendEvent(CFE_SB_FULL_SUB_PKT_EID, CFE_EVS_EventType_DEBUG, "Full Sub Pkt %d Sent,Entries=%d,Stat=0x%x\n", (int)CFE_SB.PrevSubMsg.Payload.PktSegment, @@ -1199,7 +1201,7 @@ void CFE_SB_SendRouteSub(CFE_SBR_RouteId_t RouteId, void *ArgPtr) ** Return: ** None */ -int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubs_t *data) +int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data) { int32 status; @@ -1218,7 +1220,7 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubs_t *data) /* if pkt has any number of entries, send it as a partial pkt */ if(CFE_SB.PrevSubMsg.Payload.Entries > 0) { - status = CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.PrevSubMsg); + status = CFE_SB_TransmitMsg(&CFE_SB.PrevSubMsg.Hdr.Msg, true); CFE_EVS_SendEvent(CFE_SB_PART_SUB_PKT_EID, CFE_EVS_EventType_DEBUG, "Partial Sub Pkt %d Sent,Entries=%d,Stat=0x%x", (int)CFE_SB.PrevSubMsg.Payload.PktSegment, (int)CFE_SB.PrevSubMsg.Payload.Entries, diff --git a/fsw/cfe-core/src/sb/cfe_sb_util.c b/fsw/cfe-core/src/sb/cfe_sb_util.c index e1e43b127..654f5f47b 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_util.c @@ -86,11 +86,11 @@ size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr) } else if(type == CFE_MSG_Type_Cmd) { - size = sizeof(CFE_SB_CmdHdr_t); + size = sizeof(CFE_MSG_CommandHeader_t); } else if(type == CFE_MSG_Type_Tlm) { - size = sizeof(CFE_SB_TlmHdr_t); + size = sizeof(CFE_MSG_TelemetryHeader_t); } return size; diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c index e2ae1cb99..2ec3cf6e7 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c @@ -142,14 +142,14 @@ int32 CFE_TBL_EarlyInit (void) /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), sizeof(CFE_TBL_TaskData.HkPacket)); /* ** Initialize table registry report packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), sizeof(CFE_TBL_TaskData.TblRegPacket)); @@ -1511,18 +1511,18 @@ int32 CFE_TBL_SendNotificationMsg(CFE_TBL_RegistryRec_t *RegRecPtr) /* ** Initialize notification message packet (clear user data area)... */ - CFE_MSG_Init((CFE_MSG_Message_t *)&CFE_TBL_TaskData.NotifyMsg, + CFE_MSG_Init(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationMsgId, - sizeof(CFE_TBL_NotifyCmd_t)); + sizeof(CFE_TBL_TaskData.NotifyMsg)); /* Set the command code */ - CFE_MSG_SetFcnCode((CFE_MSG_Message_t *) &CFE_TBL_TaskData.NotifyMsg, RegRecPtr->NotificationCC); + CFE_MSG_SetFcnCode(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationCC); /* Set the command parameter */ CFE_TBL_TaskData.NotifyMsg.Payload.Parameter = RegRecPtr->NotificationParam; - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.NotifyMsg); - Status = CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.NotifyMsg); + CFE_SB_TimeStampMsg(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg); + Status = CFE_SB_TransmitMsg(&CFE_TBL_TaskData.NotifyMsg.CmdHeader.Msg, false); if (Status != CFE_SUCCESS) { diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task.c b/fsw/cfe-core/src/tbl/cfe_tbl_task.c index 828796f95..efea646f4 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task.c @@ -54,7 +54,7 @@ CFE_TBL_TaskData_t CFE_TBL_TaskData; * For generic message entries, which only have a MID and a handler function (no command payload) */ #define CFE_TBL_MESSAGE_ENTRY(mid,handlerfunc) \ - { CFE_SB_MSGID_WRAP_VALUE(mid), 0, sizeof(CFE_SB_CmdHdr_t), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_MSG_MSGTYPE } + { CFE_SB_MSGID_WRAP_VALUE(mid), 0, sizeof(CFE_MSG_CommandHeader_t), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_MSG_MSGTYPE } /* * Macros to assist in building the CFE_TBL_CmdHandlerTbl - @@ -71,16 +71,16 @@ const CFE_TBL_CmdHandlerTblRec_t CFE_TBL_CmdHandlerTbl[] = CFE_TBL_MESSAGE_ENTRY(CFE_TBL_SEND_HK_MID, CFE_TBL_HousekeepingCmd), /* command entries (everything else) */ - CFE_TBL_COMMAND_ENTRY( CFE_TBL_NOOP_CC, CFE_TBL_Noop_t, CFE_TBL_NoopCmd), - CFE_TBL_COMMAND_ENTRY(CFE_TBL_RESET_COUNTERS_CC,CFE_TBL_ResetCounters_t,CFE_TBL_ResetCountersCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_LOAD_CC, CFE_TBL_Load_t, CFE_TBL_LoadCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_DUMP_CC, CFE_TBL_Dump_t, CFE_TBL_DumpCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_VALIDATE_CC, CFE_TBL_Validate_t, CFE_TBL_ValidateCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_ACTIVATE_CC, CFE_TBL_Activate_t, CFE_TBL_ActivateCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_DUMP_REGISTRY_CC, CFE_TBL_DumpRegistry_t, CFE_TBL_DumpRegistryCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_SEND_REGISTRY_CC, CFE_TBL_SendRegistry_t, CFE_TBL_SendRegistryCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_DELETE_CDS_CC, CFE_TBL_DeleteCDS_t, CFE_TBL_DeleteCDSCmd), - CFE_TBL_COMMAND_ENTRY( CFE_TBL_ABORT_LOAD_CC, CFE_TBL_AbortLoad_t, CFE_TBL_AbortLoadCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_NOOP_CC, CFE_TBL_NoopCmd_t, CFE_TBL_NoopCmd), + CFE_TBL_COMMAND_ENTRY(CFE_TBL_RESET_COUNTERS_CC,CFE_TBL_ResetCountersCmd_t,CFE_TBL_ResetCountersCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_LOAD_CC, CFE_TBL_LoadCmd_t, CFE_TBL_LoadCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_DUMP_CC, CFE_TBL_DumpCmd_t, CFE_TBL_DumpCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_VALIDATE_CC, CFE_TBL_ValidateCmd_t, CFE_TBL_ValidateCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_ACTIVATE_CC, CFE_TBL_ActivateCmd_t, CFE_TBL_ActivateCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_DUMP_REGISTRY_CC, CFE_TBL_DumpRegistryCmd_t, CFE_TBL_DumpRegistryCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_SEND_REGISTRY_CC, CFE_TBL_SendRegistryCmd_t, CFE_TBL_SendRegistryCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_DELETE_CDS_CC, CFE_TBL_DeleteCDSCmd_t, CFE_TBL_DeleteCDSCmd), + CFE_TBL_COMMAND_ENTRY( CFE_TBL_ABORT_LOAD_CC, CFE_TBL_AbortLoadCmd_t, CFE_TBL_AbortLoadCmd), /* list terminator (keep last) */ { CFE_SB_MSGID_RESERVED, 0, 0, NULL, CFE_TBL_TERM_MSGTYPE } @@ -91,7 +91,8 @@ const CFE_TBL_CmdHandlerTblRec_t CFE_TBL_CmdHandlerTbl[] = void CFE_TBL_TaskMain(void) { - int32 Status; + int32 Status; + CFE_SB_Buffer_t *SBBufPtr; CFE_ES_PerfLogEntry(CFE_MISSION_TBL_MAIN_PERF_ID); @@ -122,7 +123,7 @@ void CFE_TBL_TaskMain(void) CFE_ES_PerfLogExit(CFE_MISSION_TBL_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_RcvMsg( &CFE_TBL_TaskData.MsgPtr, + Status = CFE_SB_ReceiveBuffer( &SBBufPtr, CFE_TBL_TaskData.CmdPipe, CFE_SB_PEND_FOREVER); @@ -131,14 +132,14 @@ void CFE_TBL_TaskMain(void) if (Status == CFE_SUCCESS) { /* Process cmd pipe msg */ - CFE_TBL_TaskPipe(CFE_TBL_TaskData.MsgPtr); + CFE_TBL_TaskPipe(SBBufPtr); }else{ CFE_ES_WriteToSysLog("TBL:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); }/* end if */ }/* end while */ - /* while loop exits only if CFE_SB_RcvMsg returns error */ + /* while loop exits only if CFE_SB_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); } /* end CFE_TBL_TaskMain() */ @@ -245,11 +246,11 @@ void CFE_TBL_InitData(void) strncpy(CFE_TBL_TaskData.PipeName, CFE_TBL_TASK_PIPE_NAME, 16); /* Initialize Packet Headers */ - CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), sizeof(CFE_TBL_TaskData.HkPacket)); - CFE_MSG_Init(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), sizeof(CFE_TBL_TaskData.TblRegPacket)); @@ -258,7 +259,7 @@ void CFE_TBL_InitData(void) /******************************************************************************/ -void CFE_TBL_TaskPipe(CFE_MSG_Message_t *MessagePtr) +void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; @@ -266,8 +267,8 @@ void CFE_TBL_TaskPipe(CFE_MSG_Message_t *MessagePtr) CFE_MSG_Size_t ActualLength = 0; CFE_TBL_CmdProcRet_t CmdStatus = CFE_TBL_INC_ERR_CTR; /* Assume a failed command */ - CFE_MSG_GetMsgId(MessagePtr, &MessageID); - CFE_MSG_GetFcnCode(MessagePtr, &CommandCode); + CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode); /* Search the Command Handler Table for a matching message */ CmdIndx = CFE_TBL_SearchCmdHndlrTbl(MessageID, CommandCode); @@ -276,11 +277,11 @@ void CFE_TBL_TaskPipe(CFE_MSG_Message_t *MessagePtr) if (CmdIndx >= 0) { /* Verify Message Length before processing */ - CFE_MSG_GetSize(MessagePtr, &ActualLength); + CFE_MSG_GetSize(&SBBufPtr->Msg, &ActualLength); if (ActualLength == CFE_TBL_CmdHandlerTbl[CmdIndx].ExpectedLength) { /* All checks have passed, call the appropriate message handler */ - CmdStatus = (CFE_TBL_CmdHandlerTbl[CmdIndx].MsgProcFuncPtr)(MessagePtr); + CmdStatus = (CFE_TBL_CmdHandlerTbl[CmdIndx].MsgProcFuncPtr)(SBBufPtr); } else /* Bad Message Length */ { diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task.h b/fsw/cfe-core/src/tbl/cfe_tbl_task.h index d2f2bf135..4e0f8fa2f 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task.h +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task.h @@ -308,7 +308,6 @@ typedef struct /* ** Task operational data (not reported in housekeeping)... */ - CFE_MSG_Message_t *MsgPtr; /**< \brief Pointer to most recently received command message */ CFE_SB_PipeId_t CmdPipe; /**< \brief Table Task command pipe ID as obtained from Software Bus */ /* @@ -404,7 +403,7 @@ int32 CFE_TBL_TaskInit(void); ** ** ******************************************************************************/ -void CFE_TBL_TaskPipe(CFE_MSG_Message_t *MessagePtr); +void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr); /*****************************************************************************/ /** diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c index 5f49c229d..32b286873 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c @@ -53,7 +53,7 @@ ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) +int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) { int32 Status; uint32 i; @@ -69,8 +69,8 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send housekeeping telemetry packet */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.HkPacket); - Status = CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.HkPacket); + CFE_SB_TimeStampMsg(&CFE_TBL_TaskData.HkPacket.TlmHeader.Msg); + Status = CFE_SB_TransmitMsg(&CFE_TBL_TaskData.HkPacket.TlmHeader.Msg, true); if (Status != CFE_SUCCESS) { @@ -88,8 +88,8 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send Table Registry Info Packet */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.TblRegPacket); - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.TblRegPacket); + CFE_SB_TimeStampMsg(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.Msg); + CFE_SB_TransmitMsg(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.Msg, true); /* Once the data has been sent, clear the index so that we don't send it again and again */ CFE_TBL_TaskData.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; @@ -325,7 +325,7 @@ void CFE_TBL_GetTblRegData(void) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_NoopCmd(const CFE_TBL_Noop_t *data) +int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data) { /* Acknowledge receipt of NOOP with Event Message */ CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command. %s", CFE_VERSION_STRING); @@ -342,7 +342,7 @@ int32 CFE_TBL_NoopCmd(const CFE_TBL_Noop_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCounters_t *data) +int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data) { CFE_TBL_TaskData.CommandCounter = 0; CFE_TBL_TaskData.CommandErrorCounter = 0; @@ -367,7 +367,7 @@ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCounters_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_LoadCmd(const CFE_TBL_Load_t *data) +int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ const CFE_TBL_LoadCmd_Payload_t *CmdPtr = &data->Payload; @@ -572,7 +572,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_Load_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_DumpCmd(const CFE_TBL_Dump_t *data) +int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ int16 RegIndex; @@ -865,7 +865,7 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_ValidateCmd(const CFE_TBL_Validate_t *data) +int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ int16 RegIndex; @@ -1023,7 +1023,7 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_Validate_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_ActivateCmd(const CFE_TBL_Activate_t *data) +int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ int16 RegIndex; @@ -1115,7 +1115,7 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_Activate_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistry_t *data) +int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ bool FileExistedPrev = false; @@ -1301,7 +1301,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistry_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistry_t *data) +int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ int16 RegIndex; @@ -1348,7 +1348,7 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistry_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDS_t *data) +int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ const CFE_TBL_DelCDSCmd_Payload_t *CmdPtr = &data->Payload; @@ -1446,7 +1446,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDS_t *data) ** NOTE: For complete prolog information, see 'cfe_tbl_task_cmds.h' ********************************************************************/ -int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoad_t *data) +int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ int16 RegIndex; diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h index 486f46cc7..ba3531cde 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h @@ -126,7 +126,7 @@ extern void CFE_TBL_GetTblRegData(void); ** ** \retval #CFE_TBL_DONT_INC_CTR \copydoc CFE_TBL_DONT_INC_CTR ******************************************************************************/ -int32 CFE_TBL_HousekeepingCmd(const CFE_SB_CmdHdr_t *data); +int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data); /*****************************************************************************/ /** @@ -143,7 +143,7 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_SB_CmdHdr_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_NoopCmd(const CFE_TBL_Noop_t *data); +int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data); /*****************************************************************************/ /** @@ -159,7 +159,7 @@ int32 CFE_TBL_NoopCmd(const CFE_TBL_Noop_t *data); ** ** \retval #CFE_TBL_DONT_INC_CTR \copydoc CFE_TBL_DONT_INC_CTR ******************************************************************************/ -int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCounters_t *data); +int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data); /*****************************************************************************/ /** @@ -177,7 +177,7 @@ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCounters_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_LoadCmd(const CFE_TBL_Load_t *data); +int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data); /*****************************************************************************/ /** @@ -195,7 +195,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_Load_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_DumpCmd(const CFE_TBL_Dump_t *data); +int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data); /*****************************************************************************/ /** @@ -214,7 +214,7 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_Dump_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_ValidateCmd(const CFE_TBL_Validate_t *data); +int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data); /*****************************************************************************/ /** @@ -232,7 +232,7 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_Validate_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_ActivateCmd(const CFE_TBL_Activate_t *data); +int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data); /*****************************************************************************/ /** @@ -249,7 +249,7 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_Activate_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistry_t *data); +int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data); /*****************************************************************************/ /** @@ -267,7 +267,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistry_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistry_t *data); +int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data); /*****************************************************************************/ /** @@ -284,7 +284,7 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistry_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDS_t *data); +int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data); /*****************************************************************************/ /** @@ -301,7 +301,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDS_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ -int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoad_t *data); +int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data); /*****************************************************************************/ diff --git a/fsw/cfe-core/src/time/cfe_time_task.c b/fsw/cfe-core/src/time/cfe_time_task.c index 24a8c65f1..702525bcd 100644 --- a/fsw/cfe-core/src/time/cfe_time_task.c +++ b/fsw/cfe-core/src/time/cfe_time_task.c @@ -46,12 +46,12 @@ CFE_TIME_TaskData_t CFE_TIME_TaskData; /* ** Command handler for "HK request"... */ -int32 CFE_TIME_HousekeepingCmd(const CFE_SB_CmdHdr_t *data); +int32 CFE_TIME_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data); /* ** Command handler for "tone signal detected"... */ -int32 CFE_TIME_ToneSignalCmd(const CFE_SB_CmdHdr_t *data); +int32 CFE_TIME_ToneSignalCmd(const CFE_TIME_ToneSignalCmd_t *data); /* ** Command handler for "time at the tone"... @@ -61,7 +61,7 @@ int32 CFE_TIME_ToneDataCmd(const CFE_TIME_ToneDataCmd_t *data); /* ** Command handler for 1Hz signal... */ -int32 CFE_TIME_OneHzCmd(const CFE_SB_CmdHdr_t *data); +int32 CFE_TIME_OneHzCmd(const CFE_TIME_1HzCmd_t *data); /* ** Command handler for "request time at the tone"... @@ -79,7 +79,7 @@ int32 CFE_TIME_OneHzCmd(const CFE_SB_CmdHdr_t *data); ** non-fake tone mode. */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) -int32 CFE_TIME_ToneSendCmd(const CFE_SB_CmdHdr_t *data); +int32 CFE_TIME_ToneSendCmd(const CFE_TIME_FakeToneCmd_t *data); #endif /* @@ -92,22 +92,22 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ /* ** Ground command handlers... */ -int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustment_t *data); -int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjust_t *data); -int32 CFE_TIME_AddDelayCmd(const CFE_TIME_AddDelay_t *data); -int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticTlm_t *data); -int32 CFE_TIME_NoopCmd(const CFE_TIME_Noop_t *data); -int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCounters_t *data); -int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSeconds_t *data); -int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMET_t *data); -int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignal_t *data); -int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSource_t *data); -int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetState_t *data); -int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCF_t *data); -int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTime_t *data); -int32 CFE_TIME_Sub1HZAdjustmentCmd(const CFE_TIME_Sub1HZAdjustment_t *data); -int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjust_t *data); -int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelay_t *data); +int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustmentCmd_t *data); +int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjustCmd_t *data); +int32 CFE_TIME_AddDelayCmd(const CFE_TIME_AddDelayCmd_t *data); +int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticCmd_t *data); +int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data); +int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCountersCmd_t *data); +int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data); +int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data); +int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data); +int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data); +int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetStateCmd_t *data); +int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data); +int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data); +int32 CFE_TIME_Sub1HZAdjustmentCmd(const CFE_TIME_Sub1HZAdjustmentCmd_t *data); +int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjustCmd_t *data); +int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelayCmd_t *data); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -135,7 +135,8 @@ int32 CFE_TIME_EarlyInit(void) void CFE_TIME_TaskMain(void) { - int32 Status; + int32 Status; + CFE_SB_Buffer_t *SBBufPtr; CFE_ES_PerfLogEntry(CFE_MISSION_TIME_MAIN_PERF_ID); @@ -167,7 +168,7 @@ void CFE_TIME_TaskMain(void) CFE_ES_PerfLogExit(CFE_MISSION_TIME_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_RcvMsg(&CFE_TIME_TaskData.MsgPtr, + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_TIME_TaskData.CmdPipe, CFE_SB_PEND_FOREVER); @@ -176,14 +177,14 @@ void CFE_TIME_TaskMain(void) if (Status == CFE_SUCCESS) { /* Process cmd pipe msg */ - CFE_TIME_TaskPipe(CFE_TIME_TaskData.MsgPtr); + CFE_TIME_TaskPipe(SBBufPtr); }else{ CFE_ES_WriteToSysLog("TIME:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); }/* end if */ }/* end while */ - /* while loop exits only if CFE_SB_RcvMsg returns error */ + /* while loop exits only if CFE_SB_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); } /* end CFE_TIME_TaskMain */ @@ -463,12 +464,12 @@ bool CFE_TIME_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) +void CFE_TIME_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; - CFE_MSG_GetMsgId(MsgPtr, &MessageID); + CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); switch (CFE_SB_MsgIdToValue(MessageID)) { @@ -476,28 +477,28 @@ void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) ** Housekeeping telemetry request... */ case CFE_TIME_SEND_HK_MID: - CFE_TIME_HousekeepingCmd((CFE_SB_CmdHdr_t *)MsgPtr); + CFE_TIME_HousekeepingCmd((CFE_MSG_CommandHeader_t *)SBBufPtr); break; /* ** Time at the tone "signal"... */ case CFE_TIME_TONE_CMD_MID: - CFE_TIME_ToneSignalCmd((CFE_SB_CmdHdr_t *)MsgPtr); + CFE_TIME_ToneSignalCmd((CFE_TIME_ToneSignalCmd_t *)SBBufPtr); break; /* ** Time at the tone "data"... */ case CFE_TIME_DATA_CMD_MID: - CFE_TIME_ToneDataCmd((CFE_TIME_ToneDataCmd_t *)MsgPtr); + CFE_TIME_ToneDataCmd((CFE_TIME_ToneDataCmd_t *)SBBufPtr); break; /* ** Run time state machine at 1Hz... */ case CFE_TIME_1HZ_CMD_MID: - CFE_TIME_OneHzCmd((CFE_SB_CmdHdr_t *)MsgPtr); + CFE_TIME_OneHzCmd((CFE_TIME_1HzCmd_t *)SBBufPtr); break; /* @@ -505,7 +506,7 @@ void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) case CFE_TIME_SEND_CMD_MID: - CFE_TIME_ToneSendCmd((CFE_SB_CmdHdr_t *)MsgPtr); + CFE_TIME_ToneSendCmd((CFE_TIME_FakeToneCmd_t *)SBBufPtr); break; #endif @@ -514,48 +515,48 @@ void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) */ case CFE_TIME_CMD_MID: - CFE_MSG_GetFcnCode(MsgPtr, &CommandCode); + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode); switch (CommandCode) { case CFE_TIME_NOOP_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_Noop_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_NoopCmd_t))) { - CFE_TIME_NoopCmd((CFE_TIME_Noop_t *)MsgPtr); + CFE_TIME_NoopCmd((CFE_TIME_NoopCmd_t *)SBBufPtr); } break; case CFE_TIME_RESET_COUNTERS_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_ResetCounters_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_ResetCountersCmd_t))) { - CFE_TIME_ResetCountersCmd((CFE_TIME_ResetCounters_t *)MsgPtr); + CFE_TIME_ResetCountersCmd((CFE_TIME_ResetCountersCmd_t *)SBBufPtr); } break; case CFE_TIME_SEND_DIAGNOSTIC_TLM_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SendDiagnosticTlm_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SendDiagnosticCmd_t))) { - CFE_TIME_SendDiagnosticTlm((CFE_TIME_SendDiagnosticTlm_t *)MsgPtr); + CFE_TIME_SendDiagnosticTlm((CFE_TIME_SendDiagnosticCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_STATE_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetState_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetStateCmd_t))) { - CFE_TIME_SetStateCmd((CFE_TIME_SetState_t *)MsgPtr); + CFE_TIME_SetStateCmd((CFE_TIME_SetStateCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_SOURCE_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetSource_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetSourceCmd_t))) { - CFE_TIME_SetSourceCmd((CFE_TIME_SetSource_t *)MsgPtr); + CFE_TIME_SetSourceCmd((CFE_TIME_SetSourceCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_SIGNAL_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetSignal_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetSignalCmd_t))) { - CFE_TIME_SetSignalCmd((CFE_TIME_SetSignal_t *)MsgPtr); + CFE_TIME_SetSignalCmd((CFE_TIME_SetSignalCmd_t *)SBBufPtr); } break; @@ -563,16 +564,16 @@ void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) ** Time Clients process "tone delay" commands... */ case CFE_TIME_ADD_DELAY_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_AddDelay_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_AddDelayCmd_t))) { - CFE_TIME_AddDelayCmd((CFE_TIME_AddDelay_t *)MsgPtr); + CFE_TIME_AddDelayCmd((CFE_TIME_AddDelayCmd_t *)SBBufPtr); } break; case CFE_TIME_SUB_DELAY_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SubDelay_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SubDelayCmd_t))) { - CFE_TIME_SubDelayCmd((CFE_TIME_SubDelay_t *)MsgPtr); + CFE_TIME_SubDelayCmd((CFE_TIME_SubDelayCmd_t *)SBBufPtr); } break; @@ -580,58 +581,58 @@ void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) ** Time Servers process "set time" commands... */ case CFE_TIME_SET_TIME_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetTime_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetTimeCmd_t))) { - CFE_TIME_SetTimeCmd((CFE_TIME_SetTime_t *)MsgPtr); + CFE_TIME_SetTimeCmd((CFE_TIME_SetTimeCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_MET_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetMET_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetMETCmd_t))) { - CFE_TIME_SetMETCmd((CFE_TIME_SetMET_t *)MsgPtr); + CFE_TIME_SetMETCmd((CFE_TIME_SetMETCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_STCF_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetSTCF_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetSTCFCmd_t))) { - CFE_TIME_SetSTCFCmd((CFE_TIME_SetSTCF_t *)MsgPtr); + CFE_TIME_SetSTCFCmd((CFE_TIME_SetSTCFCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_LEAP_SECONDS_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetLeapSeconds_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetLeapSecondsCmd_t))) { - CFE_TIME_SetLeapSecondsCmd((CFE_TIME_SetLeapSeconds_t *)MsgPtr); + CFE_TIME_SetLeapSecondsCmd((CFE_TIME_SetLeapSecondsCmd_t *)SBBufPtr); } break; case CFE_TIME_ADD_ADJUST_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_AddAdjust_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_AddAdjustCmd_t))) { - CFE_TIME_AddAdjustCmd((CFE_TIME_AddAdjust_t *)MsgPtr); + CFE_TIME_AddAdjustCmd((CFE_TIME_AddAdjustCmd_t *)SBBufPtr); } break; case CFE_TIME_SUB_ADJUST_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SubAdjust_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SubAdjustCmd_t))) { - CFE_TIME_SubAdjustCmd((CFE_TIME_SubAdjust_t *)MsgPtr); + CFE_TIME_SubAdjustCmd((CFE_TIME_SubAdjustCmd_t *)SBBufPtr); } break; case CFE_TIME_ADD_1HZ_ADJUSTMENT_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_Add1HZAdjustment_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_Add1HZAdjustmentCmd_t))) { - CFE_TIME_Add1HZAdjustmentCmd((CFE_TIME_Add1HZAdjustment_t *)MsgPtr); + CFE_TIME_Add1HZAdjustmentCmd((CFE_TIME_Add1HZAdjustmentCmd_t *)SBBufPtr); } break; case CFE_TIME_SUB_1HZ_ADJUSTMENT_CC: - if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_Sub1HZAdjustment_t))) + if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_Sub1HZAdjustmentCmd_t))) { - CFE_TIME_Sub1HZAdjustmentCmd((CFE_TIME_Sub1HZAdjustment_t *)MsgPtr); + CFE_TIME_Sub1HZAdjustmentCmd((CFE_TIME_Sub1HZAdjustmentCmd_t *)SBBufPtr); } break; @@ -670,7 +671,7 @@ void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) +int32 CFE_TIME_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) { CFE_TIME_Reference_t Reference; @@ -692,8 +693,8 @@ int32 CFE_TIME_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send housekeeping telemetry packet... */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.HkPacket); - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.HkPacket); + CFE_SB_TimeStampMsg(&CFE_TIME_TaskData.HkPacket.TlmHeader.Msg); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.HkPacket.TlmHeader.Msg, true); /* ** Note: we only increment the command execution counter when @@ -710,7 +711,7 @@ int32 CFE_TIME_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_ToneSignalCmd(const CFE_SB_CmdHdr_t *data) +int32 CFE_TIME_ToneSignalCmd(const CFE_TIME_ToneSignalCmd_t *data) { /* ** Indication that tone signal occurred recently... @@ -759,7 +760,7 @@ int32 CFE_TIME_ToneDataCmd(const CFE_TIME_ToneDataCmd_t *data) * as we do not need a separate MID for this job. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_OneHzCmd(const CFE_SB_CmdHdr_t *data) +int32 CFE_TIME_OneHzCmd(const CFE_TIME_1HzCmd_t *data) { /* * Run the state machine updates required at 1Hz. @@ -792,7 +793,7 @@ int32 CFE_TIME_OneHzCmd(const CFE_SB_CmdHdr_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) -int32 CFE_TIME_ToneSendCmd(const CFE_SB_CmdHdr_t *data) +int32 CFE_TIME_ToneSendCmd(const CFE_TIME_FakeToneCmd_t *data) { /* ** Request for "time at tone" data packet (probably scheduler)... @@ -814,7 +815,7 @@ int32 CFE_TIME_ToneSendCmd(const CFE_SB_CmdHdr_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_NoopCmd(const CFE_TIME_Noop_t *data) +int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data) { CFE_TIME_TaskData.CommandCounter++; @@ -833,7 +834,7 @@ int32 CFE_TIME_NoopCmd(const CFE_TIME_Noop_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCounters_t *data) +int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCountersCmd_t *data) { CFE_TIME_TaskData.CommandCounter = 0; @@ -876,20 +877,20 @@ int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCounters_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticTlm_t *data) +int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticCmd_t *data) { CFE_TIME_TaskData.CommandCounter++; /* - ** Collect housekeeping data from Time Services utilities... + ** Collect diagnostics data from Time Services utilities... */ CFE_TIME_GetDiagData(); /* - ** Send housekeeping telemetry packet... + ** Send diagnostics telemetry packet... */ - CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.DiagPacket); - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.DiagPacket); + CFE_SB_TimeStampMsg(&CFE_TIME_TaskData.DiagPacket.TlmHeader.Msg); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.DiagPacket.TlmHeader.Msg, true); CFE_EVS_SendEvent(CFE_TIME_DIAG_EID, CFE_EVS_EventType_DEBUG, "Request diagnostics command"); @@ -905,7 +906,7 @@ int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticTlm_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetState_t *data) +int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetStateCmd_t *data) { const CFE_TIME_StateCmd_Payload_t *CommandPtr = &data->Payload; const char *ClockStateText; @@ -957,7 +958,7 @@ int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetState_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSource_t *data) +int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) { const CFE_TIME_SourceCmd_Payload_t *CommandPtr = &data->Payload; @@ -1027,7 +1028,7 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSource_t *data) /* CFE_TIME_SetSignalCmd() -- Time task command (set tone source) */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignal_t *data) +int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) { const CFE_TIME_SignalCmd_Payload_t *CommandPtr = &data->Payload; @@ -1150,12 +1151,12 @@ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIM /* Wrapper around CFE_TIME_SetDelayImpl() for add/subtract operations */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_AddDelayCmd(const CFE_TIME_AddDelay_t *data) +int32 CFE_TIME_AddDelayCmd(const CFE_TIME_AddDelayCmd_t *data) { CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); return CFE_SUCCESS; } -int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelay_t *data) +int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelayCmd_t *data) { CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); return CFE_SUCCESS; @@ -1167,7 +1168,7 @@ int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelay_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTime_t *data) +int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data) { const CFE_TIME_TimeCmd_Payload_t *CommandPtr = &data->Payload; @@ -1226,7 +1227,7 @@ int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTime_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMET_t *data) +int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data) { const CFE_TIME_TimeCmd_Payload_t *CommandPtr = &data->Payload; @@ -1280,7 +1281,7 @@ int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMET_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCF_t *data) +int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) { const CFE_TIME_TimeCmd_Payload_t *CommandPtr = &data->Payload; @@ -1334,7 +1335,7 @@ int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCF_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSeconds_t *data) +int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data) { #if (CFE_PLATFORM_TIME_CFG_SERVER == true) @@ -1424,7 +1425,7 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjust_t *data) +int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjustCmd_t *data) { CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); return CFE_SUCCESS; @@ -1438,7 +1439,7 @@ int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjust_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjust_t *data) +int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjustCmd_t *data) { CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); return CFE_SUCCESS; @@ -1489,7 +1490,7 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustment_t *data) +int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustmentCmd_t *data) { CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); return CFE_SUCCESS; @@ -1503,7 +1504,7 @@ int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustment_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_TIME_Sub1HZAdjustmentCmd(const CFE_TIME_Sub1HZAdjustment_t *data) +int32 CFE_TIME_Sub1HZAdjustmentCmd(const CFE_TIME_Sub1HZAdjustmentCmd_t *data) { CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); return CFE_SUCCESS; diff --git a/fsw/cfe-core/src/time/cfe_time_tone.c b/fsw/cfe-core/src/time/cfe_time_tone.c index b5cfd312e..40b86f1b9 100644 --- a/fsw/cfe-core/src/time/cfe_time_tone.c +++ b/fsw/cfe-core/src/time/cfe_time_tone.c @@ -165,7 +165,7 @@ void CFE_TIME_ToneSend(void) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.ToneDataCmd.CmdHeader.Msg, false); /* ** Count of "time at the tone" commands sent with internal data... @@ -305,7 +305,7 @@ int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.ToneDataCmd.CmdHeader.Msg, false); /* ** Count of "time at the tone" commands sent with external data... @@ -459,7 +459,7 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.ToneDataCmd.CmdHeader.Msg, false); /* ** Count of "time at the tone" commands sent with external data... @@ -612,7 +612,7 @@ int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.ToneDataCmd.CmdHeader.Msg, false); /* ** Count of "time at the tone" commands sent with external data... @@ -1217,7 +1217,7 @@ void CFE_TIME_Tone1HzTask(void) /* ** Send tone signal command packet... */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneSignalCmd); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.ToneSignalCmd.CmdHeader.Msg, false); #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) /* @@ -1225,7 +1225,7 @@ void CFE_TIME_Tone1HzTask(void) ** to send the tone to other time clients. ** (this is done by scheduler in non-fake mode) */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneSendCmd); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.ToneSendCmd.CmdHeader.Msg, false); #endif /* @@ -1434,7 +1434,7 @@ void CFE_TIME_Local1HzTask(void) ** This used to be optional in previous CFE versions, but it is now required ** as TIME subscribes to this itself to do state machine tasks. */ - CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.Local1HzCmd); + CFE_SB_TransmitMsg(&CFE_TIME_TaskData.Local1HzCmd.CmdHeader.Msg, false); CFE_TIME_TaskData.LocalTaskCounter++; } diff --git a/fsw/cfe-core/src/time/cfe_time_utils.c b/fsw/cfe-core/src/time/cfe_time_utils.c index 0130d15f0..aeaeebeef 100644 --- a/fsw/cfe-core/src/time/cfe_time_utils.c +++ b/fsw/cfe-core/src/time/cfe_time_utils.c @@ -388,21 +388,21 @@ void CFE_TIME_InitData(void) /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TIME_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_TIME_TaskData.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), sizeof(CFE_TIME_TaskData.HkPacket)); /* ** Initialize diagnostic packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TIME_TaskData.DiagPacket.TlmHeader.BaseMsg, + CFE_MSG_Init(&CFE_TIME_TaskData.DiagPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), sizeof(CFE_TIME_TaskData.DiagPacket)); /* ** Initialize "time at the tone" signal command packet... */ - CFE_MSG_Init(&CFE_TIME_TaskData.ToneSignalCmd.CmdHeader.BaseMsg, + CFE_MSG_Init(&CFE_TIME_TaskData.ToneSignalCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), sizeof(CFE_TIME_TaskData.ToneSignalCmd)); @@ -410,7 +410,7 @@ void CFE_TIME_InitData(void) ** Initialize "time at the tone" data command packet... */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - CFE_MSG_Init((CFE_MSG_Message_t *)&CFE_TIME_TaskData.ToneDataCmd, + CFE_MSG_Init(&CFE_TIME_TaskData.ToneDataCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), sizeof(CFE_TIME_TaskData.ToneDataCmd)); #endif @@ -419,7 +419,7 @@ void CFE_TIME_InitData(void) ** Initialize simulated tone send message ("fake tone" mode only)... */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - CFE_MSG_Init(&CFE_TIME_TaskData.ToneSendCmd.BaseMsg, + CFE_MSG_Init(&CFE_TIME_TaskData.ToneSendCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), sizeof(CFE_TIME_TaskData.ToneSendCmd)); #endif @@ -427,9 +427,9 @@ void CFE_TIME_InitData(void) /* ** Initialize local 1Hz "wake-up" command packet (optional)... */ - CFE_MSG_Init((CFE_MSG_Message_t *)&CFE_TIME_TaskData.Local1HzCmd, - CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), - sizeof(CFE_TIME_TaskData.Local1HzCmd)); + CFE_MSG_Init(&CFE_TIME_TaskData.Local1HzCmd.CmdHeader.Msg, + CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), + sizeof(CFE_TIME_TaskData.Local1HzCmd)); return; diff --git a/fsw/cfe-core/src/time/cfe_time_utils.h b/fsw/cfe-core/src/time/cfe_time_utils.h index 34eac94c4..e5ee2267c 100644 --- a/fsw/cfe-core/src/time/cfe_time_utils.h +++ b/fsw/cfe-core/src/time/cfe_time_utils.h @@ -183,7 +183,6 @@ typedef struct /* ** Task operational data (not reported in housekeeping)... */ - CFE_MSG_Message_t *MsgPtr; CFE_SB_PipeId_t CmdPipe; /* @@ -277,7 +276,7 @@ typedef struct /* ** Local 1Hz wake-up command packet (not related to time at tone)... */ - CFE_SB_CmdHdr_t Local1HzCmd; + CFE_TIME_1HzCmd_t Local1HzCmd; /* ** Time at the tone command packets (sent by time servers)... @@ -294,7 +293,7 @@ typedef struct * "tone signal" message above. */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - CFE_SB_CmdHdr_t ToneSendCmd; + CFE_TIME_FakeToneCmd_t ToneSendCmd; #endif /* @@ -349,7 +348,7 @@ CFE_TIME_SysTime_t CFE_TIME_LatchClock(void); ** Function prototypes (Time Services utilities data)... */ int32 CFE_TIME_TaskInit (void); -void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr); +void CFE_TIME_TaskPipe(CFE_SB_Buffer_t *SBBufPtr); void CFE_TIME_InitData(void); void CFE_TIME_QueryResetVars(void); void CFE_TIME_UpdateResetVars(const CFE_TIME_Reference_t *Reference); From f4794fd97021857daf32940baed2983de6954b1a Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 2 Dec 2020 13:49:16 -0500 Subject: [PATCH 08/10] Fix #1009, Doc update from PR review --- docs/src/cfe_sb.dox | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/src/cfe_sb.dox b/docs/src/cfe_sb.dox index f81601122..0afc0c21e 100644 --- a/docs/src/cfe_sb.dox +++ b/docs/src/cfe_sb.dox @@ -292,8 +292,8 @@ The sequence counter for command messages is not altered by the software bus. - For a telemetry message, the behavior is controlled via input parameters or API selection - when sending the command. When enabled, the software bus will populate the packet sequence + For a telemetry message, the behavior is controlled via API input parameters when sending. + When enabled, the software bus will populate the packet sequence counter using an internal counter that gets intialized upon the first subscription to the message (first message will have a packet sequence counter value of 1). From that point on each send request will increment the counter by one, regardless of the number of destinations @@ -507,12 +507,18 @@ (Q) How many copies of the message are performed in a typical message delivery?   - There is a single copy of the message performed during a typical delivery. - When transmitting a message, the software bus copies the message from the - callers memory space into a buffer in the software bus memory space. - The #CFE_SB_ReceiveBuffer API gives the user back a pointer to the buffer. This - is equivalent to the copy mode send and pointer mode receive in the heritage - software bus used on WMAP, ST5, SDO etc. + There is a single copy of the message performed when sending a message + (from the callers memory space) using CFE_SB_TransmitMsg. + When transmitting the message, the software bus copies the message from the + callers memory space into a buffer in the software bus memory space. There + is also the option to request a buffer from SB, write directly to the buffer + and send via CFE_SB_TransmitBuffer. This is equivalent to the previous zero + copy implementation. + The #CFE_SB_ReceiveBuffer API gives the user back a pointer to the buffer. When + working with the buffers, the additional complexity to be aware of is the + buffer is only available to the app from the request to send (on the sending side), + or from the receive until the next receive on the same pipe on the receiving side. + If the data is required outside that scope, the app needs a local copy. (Q) When does the software bus free the buffer during a typical message delivery process? Or how long is the message, and the pointer to the buffer From 7c1bd8f642fa88a508773f8a8e05f83aee9abfdf Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Thu, 3 Dec 2020 09:35:31 -0500 Subject: [PATCH 09/10] Fix #1009, Remove extra UT_SetForceFail from merge --- fsw/cfe-core/unit-test/es_UT.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index ea34716e0..e6d36c73c 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -3321,7 +3321,6 @@ void TestTask(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); strncpy((char *) CmdBuf.WriteSysLogCmd.Payload.FileName, "", sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), From 7e4c4d905ada9f3442c6ddf0a3adb08755914873 Mon Sep 17 00:00:00 2001 From: Gerardo E Cruz-Ortiz <59618057+astrogeco@users.noreply.github.com> Date: Wed, 9 Dec 2020 14:31:59 -0500 Subject: [PATCH 10/10] Bump to v6.8.0-rc1+dev218 --- README.md | 11 +++++++++++ fsw/cfe-core/src/inc/cfe_version.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d059c898..13f70b9bb 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,17 @@ The detailed cFE user's guide can be viewed at + + ### Development Build: 6.8.0-rc1+dev204 - Backward compatible API change. Replace many uses of generic uint16 and uint32 with a more purpose-specific type. Replace all sizes with size_t across the API. diff --git a/fsw/cfe-core/src/inc/cfe_version.h b/fsw/cfe-core/src/inc/cfe_version.h index eaeb88ba1..cf3a9ed31 100644 --- a/fsw/cfe-core/src/inc/cfe_version.h +++ b/fsw/cfe-core/src/inc/cfe_version.h @@ -35,7 +35,7 @@ /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 204 /*!< Development Build: Number of commits since baseline */ +#define CFE_BUILD_NUMBER 218 /*!< Development Build: Number of commits since baseline */ #define CFE_BUILD_BASELINE "v6.8.0-rc1" /*!< Development Build: git tag that is the base for the current development */ /* Version Macro Definitions */