From fb783593b936172f4d5db08da6c831f95571adb6 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Wed, 10 Mar 2021 21:14:38 -0500 Subject: [PATCH 1/7] Fix #1130, Apply standard format Applies standard format using the .clang-format configuration from the cFS bundle Hand edits some files to account for comment splits --- cmake/sample_defs/cpu1_msgids.h | 64 +- cmake/sample_defs/cpu1_platform_cfg.h | 444 +- cmake/sample_defs/sample_mission_cfg.h | 170 +- cmake/sample_defs/sample_perfids.h | 32 +- cmake/target/inc/target_config.h | 112 +- cmake/target/src/target_config.c | 106 +- modules/cfe_testcase/src/es_test.c | 2 +- modules/core_api/fsw/inc/cfe.h | 28 +- modules/core_api/fsw/inc/cfe_endian.h | 12 +- modules/core_api/fsw/inc/cfe_error.h | 92 +- modules/core_api/fsw/inc/cfe_es.h | 242 +- .../core_api/fsw/inc/cfe_es_api_typedefs.h | 64 +- .../core_api/fsw/inc/cfe_es_core_internal.h | 17 +- .../core_api/fsw/inc/cfe_es_extern_typedefs.h | 486 +- modules/core_api/fsw/inc/cfe_evs.h | 223 +- .../core_api/fsw/inc/cfe_evs_api_typedefs.h | 41 +- .../core_api/fsw/inc/cfe_evs_core_internal.h | 13 +- .../fsw/inc/cfe_evs_extern_typedefs.h | 135 +- modules/core_api/fsw/inc/cfe_fs.h | 58 +- .../core_api/fsw/inc/cfe_fs_api_typedefs.h | 36 +- .../core_api/fsw/inc/cfe_fs_core_internal.h | 4 +- .../core_api/fsw/inc/cfe_fs_extern_typedefs.h | 339 +- .../core_api/fsw/inc/cfe_msg_api_typedefs.h | 7 +- modules/core_api/fsw/inc/cfe_resourceid.h | 41 +- .../fsw/inc/cfe_resourceid_api_typedefs.h | 12 +- modules/core_api/fsw/inc/cfe_sb.h | 66 +- .../core_api/fsw/inc/cfe_sb_api_typedefs.h | 62 +- .../core_api/fsw/inc/cfe_sb_core_internal.h | 9 +- .../core_api/fsw/inc/cfe_sb_extern_typedefs.h | 56 +- modules/core_api/fsw/inc/cfe_tbl.h | 386 +- .../core_api/fsw/inc/cfe_tbl_api_typedefs.h | 67 +- .../core_api/fsw/inc/cfe_tbl_core_internal.h | 9 +- .../fsw/inc/cfe_tbl_extern_typedefs.h | 36 +- modules/core_api/fsw/inc/cfe_tbl_filedef.h | 32 +- modules/core_api/fsw/inc/cfe_time.h | 328 +- .../core_api/fsw/inc/cfe_time_api_typedefs.h | 14 +- .../core_api/fsw/inc/cfe_time_core_internal.h | 6 +- .../fsw/inc/cfe_time_extern_typedefs.h | 273 +- modules/core_api/fsw/inc/cfe_version.h | 27 +- modules/core_api/ut-stubs/src/ut_es_stubs.c | 161 +- modules/core_api/ut-stubs/src/ut_evs_stubs.c | 41 +- modules/core_api/ut-stubs/src/ut_fs_stubs.c | 65 +- .../ut-stubs/src/ut_resourceid_stubs.c | 5 +- modules/core_api/ut-stubs/src/ut_sb_stubs.c | 129 +- modules/core_api/ut-stubs/src/ut_tbl_stubs.c | 53 +- modules/core_api/ut-stubs/src/ut_time_stubs.c | 61 +- .../fsw/inc/cfe_core_resourceid_basevalues.h | 30 +- .../fsw/inc/cfe_es_erlog_typedef.h | 53 +- .../fsw/inc/cfe_es_perfdata_typedef.h | 54 +- .../fsw/inc/cfe_es_resetdata_typedef.h | 99 +- .../fsw/inc/cfe_evs_log_typedef.h | 19 +- .../fsw/inc/cfe_sb_destination_typedef.h | 20 +- .../fsw/inc/cfe_sbr_api_typedefs.h | 2 - .../fsw/inc/cfe_time_resetvars_typedef.h | 15 +- .../ut-stubs/inc/ut_osprintf_stubs.h | 1 - .../core_private/ut-stubs/inc/ut_support.h | 58 +- .../ut-stubs/src/ut_osprintf_stubs.c | 248 +- .../core_private/ut-stubs/src/ut_support.c | 147 +- modules/es/fsw/inc/cfe_es_events.h | 462 +- modules/es/fsw/inc/cfe_es_msg.h | 585 ++- modules/es/fsw/src/cfe_es_api.c | 1984 ++++---- modules/es/fsw/src/cfe_es_apps.c | 1712 ++++--- modules/es/fsw/src/cfe_es_apps.h | 43 +- modules/es/fsw/src/cfe_es_backgroundtask.c | 111 +- modules/es/fsw/src/cfe_es_cds.c | 300 +- modules/es/fsw/src/cfe_es_cds.h | 111 +- modules/es/fsw/src/cfe_es_cds_mempool.c | 138 +- modules/es/fsw/src/cfe_es_cds_mempool.h | 12 +- modules/es/fsw/src/cfe_es_erlog.c | 290 +- modules/es/fsw/src/cfe_es_generic_pool.c | 233 +- modules/es/fsw/src/cfe_es_generic_pool.h | 112 +- modules/es/fsw/src/cfe_es_global.h | 145 +- modules/es/fsw/src/cfe_es_log.h | 63 +- modules/es/fsw/src/cfe_es_mempool.c | 266 +- modules/es/fsw/src/cfe_es_mempool.h | 12 +- modules/es/fsw/src/cfe_es_module_all.h | 5 +- modules/es/fsw/src/cfe_es_objtab.c | 217 +- modules/es/fsw/src/cfe_es_perf.c | 406 +- modules/es/fsw/src/cfe_es_perf.h | 50 +- modules/es/fsw/src/cfe_es_resource.c | 165 +- modules/es/fsw/src/cfe_es_resource.h | 46 +- modules/es/fsw/src/cfe_es_start.c | 1460 +++--- modules/es/fsw/src/cfe_es_start.h | 37 +- modules/es/fsw/src/cfe_es_syslog.c | 100 +- modules/es/fsw/src/cfe_es_task.c | 763 ++- modules/es/fsw/src/cfe_es_task.h | 104 +- modules/es/fsw/src/cfe_es_verify.h | 206 +- modules/es/ut-coverage/es_UT.c | 4369 ++++++----------- modules/es/ut-coverage/es_UT.h | 14 +- modules/evs/fsw/inc/cfe_evs_events.h | 196 +- modules/evs/fsw/inc/cfe_evs_msg.h | 625 +-- modules/evs/fsw/src/cfe_evs.c | 449 +- modules/evs/fsw/src/cfe_evs_log.c | 163 +- modules/evs/fsw/src/cfe_evs_log.h | 16 +- modules/evs/fsw/src/cfe_evs_module_all.h | 17 +- modules/evs/fsw/src/cfe_evs_task.c | 2237 ++++----- modules/evs/fsw/src/cfe_evs_task.h | 95 +- modules/evs/fsw/src/cfe_evs_utils.c | 609 ++- modules/evs/fsw/src/cfe_evs_utils.h | 23 +- modules/evs/fsw/src/cfe_evs_verify.h | 17 +- modules/evs/ut-coverage/evs_UT.c | 2034 +++----- modules/evs/ut-coverage/evs_UT.h | 28 +- modules/fs/fsw/src/cfe_fs_api.c | 390 +- modules/fs/fsw/src/cfe_fs_module_all.h | 5 +- modules/fs/fsw/src/cfe_fs_priv.c | 58 +- modules/fs/fsw/src/cfe_fs_priv.h | 39 +- modules/fs/ut-coverage/fs_UT.c | 302 +- modules/msg/fsw/inc/ccsds_hdr.h | 54 +- .../msg/option_inc/default_cfe_msg_hdr_pri.h | 10 +- .../option_inc/default_cfe_msg_hdr_priext.h | 4 +- .../msg/ut-coverage/test_cfe_msg_ccsdsext.c | 1 - .../msg/ut-coverage/test_cfe_msg_checksum.c | 2 +- modules/msg/ut-coverage/test_cfe_msg_fc.c | 2 +- modules/msg/ut-coverage/test_cfe_msg_init.c | 4 +- modules/msg/ut-coverage/test_cfe_msg_time.c | 2 +- .../resourceid/fsw/src/cfe_resourceid_api.c | 5 +- .../cfe_resourceid_osal_compatible.h | 2 - .../option_inc/cfe_resourceid_simple.h | 3 - .../option_inc/cfe_resourceid_strict.h | 8 +- .../ut-coverage/test_cfe_resourceid.c | 14 +- modules/sb/fsw/inc/cfe_sb_events.h | 147 +- modules/sb/fsw/inc/cfe_sb_msg.h | 339 +- modules/sb/fsw/src/cfe_sb_api.c | 1207 +++-- modules/sb/fsw/src/cfe_sb_buf.c | 65 +- modules/sb/fsw/src/cfe_sb_init.c | 89 +- modules/sb/fsw/src/cfe_sb_module_all.h | 5 +- modules/sb/fsw/src/cfe_sb_msg_id_util.c | 34 +- modules/sb/fsw/src/cfe_sb_priv.c | 207 +- modules/sb/fsw/src/cfe_sb_priv.h | 302 +- modules/sb/fsw/src/cfe_sb_task.c | 962 ++-- modules/sb/fsw/src/cfe_sb_util.c | 110 +- modules/sb/fsw/src/cfe_sb_verify.h | 61 +- modules/sb/ut-coverage/sb_UT.c | 959 ++-- modules/sb/ut-coverage/sb_UT.h | 58 +- modules/sbr/fsw/src/cfe_sbr_priv.h | 1 - modules/tbl/fsw/inc/cfe_tbl_events.h | 279 +- modules/tbl/fsw/inc/cfe_tbl_msg.h | 491 +- modules/tbl/fsw/src/cfe_tbl_api.c | 696 ++- modules/tbl/fsw/src/cfe_tbl_internal.c | 547 +-- modules/tbl/fsw/src/cfe_tbl_internal.h | 205 +- modules/tbl/fsw/src/cfe_tbl_module_all.h | 6 +- modules/tbl/fsw/src/cfe_tbl_task.c | 189 +- modules/tbl/fsw/src/cfe_tbl_task.h | 367 +- modules/tbl/fsw/src/cfe_tbl_task_cmds.c | 830 ++-- modules/tbl/fsw/src/cfe_tbl_task_cmds.h | 65 +- modules/tbl/fsw/src/cfe_tbl_verify.h | 41 +- modules/tbl/ut-coverage/tbl_UT.c | 3332 +++++-------- modules/tbl/ut-coverage/tbl_UT.h | 1 - modules/time/fsw/inc/cfe_time_events.h | 189 +- modules/time/fsw/inc/cfe_time_msg.h | 667 ++- modules/time/fsw/src/cfe_time_api.c | 214 +- modules/time/fsw/src/cfe_time_module_all.h | 9 +- modules/time/fsw/src/cfe_time_task.c | 631 ++- modules/time/fsw/src/cfe_time_tone.c | 600 +-- modules/time/fsw/src/cfe_time_utils.c | 333 +- modules/time/fsw/src/cfe_time_utils.h | 402 +- modules/time/fsw/src/cfe_time_verify.h | 143 +- modules/time/ut-coverage/time_UT.c | 2363 ++++----- 158 files changed, 19547 insertions(+), 24946 deletions(-) diff --git a/cmake/sample_defs/cpu1_msgids.h b/cmake/sample_defs/cpu1_msgids.h index 983448ac5..aa9a52098 100644 --- a/cmake/sample_defs/cpu1_msgids.h +++ b/cmake/sample_defs/cpu1_msgids.h @@ -85,50 +85,48 @@ /* ** cFE Command Message Id's */ -#define CFE_EVS_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_EVS_CMD_MSG /* 0x1801 */ - /* Message ID 0x1802 is available */ -#define CFE_SB_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_SB_CMD_MSG /* 0x1803 */ -#define CFE_TBL_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TBL_CMD_MSG /* 0x1804 */ -#define CFE_TIME_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_CMD_MSG /* 0x1805 */ -#define CFE_ES_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_ES_CMD_MSG /* 0x1806 */ +#define CFE_EVS_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_EVS_CMD_MSG /* 0x1801 */ + /* Message ID 0x1802 is available */ +#define CFE_SB_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_SB_CMD_MSG /* 0x1803 */ +#define CFE_TBL_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TBL_CMD_MSG /* 0x1804 */ +#define CFE_TIME_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_CMD_MSG /* 0x1805 */ +#define CFE_ES_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_ES_CMD_MSG /* 0x1806 */ -#define CFE_ES_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_ES_SEND_HK_MSG /* 0x1808 */ -#define CFE_EVS_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_EVS_SEND_HK_MSG /* 0x1809 */ - /* Message ID 0x180A is available */ -#define CFE_SB_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_SB_SEND_HK_MSG /* 0x180B */ -#define CFE_TBL_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TBL_SEND_HK_MSG /* 0x180C */ -#define CFE_TIME_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_SEND_HK_MSG /* 0x180D */ +#define CFE_ES_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_ES_SEND_HK_MSG /* 0x1808 */ +#define CFE_EVS_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_EVS_SEND_HK_MSG /* 0x1809 */ +/* Message ID 0x180A is available */ +#define CFE_SB_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_SB_SEND_HK_MSG /* 0x180B */ +#define CFE_TBL_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TBL_SEND_HK_MSG /* 0x180C */ +#define CFE_TIME_SEND_HK_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_SEND_HK_MSG /* 0x180D */ #define CFE_SB_SUB_RPT_CTRL_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_SB_SUB_RPT_CTRL_MSG /* 0x180E */ -#define CFE_TIME_TONE_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_TONE_CMD_MSG /* 0x1810 */ -#define CFE_TIME_1HZ_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_1HZ_CMD_MSG /* 0x1811 */ - +#define CFE_TIME_TONE_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_TONE_CMD_MSG /* 0x1810 */ +#define CFE_TIME_1HZ_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TIME_1HZ_CMD_MSG /* 0x1811 */ /* ** cFE Global Command Message Id's */ -#define CFE_TIME_DATA_CMD_MID CFE_PLATFORM_CMD_MID_BASE_GLOB + CFE_MISSION_TIME_DATA_CMD_MSG /* 0x1860 */ -#define CFE_TIME_SEND_CMD_MID CFE_PLATFORM_CMD_MID_BASE_GLOB + CFE_MISSION_TIME_SEND_CMD_MSG /* 0x1862 */ - +#define CFE_TIME_DATA_CMD_MID CFE_PLATFORM_CMD_MID_BASE_GLOB + CFE_MISSION_TIME_DATA_CMD_MSG /* 0x1860 */ +#define CFE_TIME_SEND_CMD_MID CFE_PLATFORM_CMD_MID_BASE_GLOB + CFE_MISSION_TIME_SEND_CMD_MSG /* 0x1862 */ /* ** CFE Telemetry Message Id's */ -#define CFE_ES_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_ES_HK_TLM_MSG /* 0x0800 */ -#define CFE_EVS_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_EVS_HK_TLM_MSG /* 0x0801 */ - /* Message ID 0x0802 is available */ -#define CFE_SB_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_HK_TLM_MSG /* 0x0803 */ -#define CFE_TBL_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TBL_HK_TLM_MSG /* 0x0804 */ -#define CFE_TIME_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TIME_HK_TLM_MSG /* 0x0805 */ -#define CFE_TIME_DIAG_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TIME_DIAG_TLM_MSG /* 0x0806 */ -#define CFE_EVS_LONG_EVENT_MSG_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_EVS_LONG_EVENT_MSG_MSG /* 0x0808 */ -#define CFE_EVS_SHORT_EVENT_MSG_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_EVS_SHORT_EVENT_MSG_MSG /* 0x0809 */ -#define CFE_SB_STATS_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_STATS_TLM_MSG /* 0x080A */ -#define CFE_ES_APP_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_ES_APP_TLM_MSG /* 0x080B */ -#define CFE_TBL_REG_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TBL_REG_TLM_MSG /* 0x080C */ -#define CFE_SB_ALLSUBS_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_ALLSUBS_TLM_MSG /* 0x080D */ -#define CFE_SB_ONESUB_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_ONESUB_TLM_MSG /* 0x080E */ -#define CFE_ES_MEMSTATS_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_ES_MEMSTATS_TLM_MSG /* 0x0810 */ +#define CFE_ES_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_ES_HK_TLM_MSG /* 0x0800 */ +#define CFE_EVS_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_EVS_HK_TLM_MSG /* 0x0801 */ + /* Message ID 0x0802 is available */ +#define CFE_SB_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_HK_TLM_MSG /* 0x0803 */ +#define CFE_TBL_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TBL_HK_TLM_MSG /* 0x0804 */ +#define CFE_TIME_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TIME_HK_TLM_MSG /* 0x0805 */ +#define CFE_TIME_DIAG_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TIME_DIAG_TLM_MSG /* 0x0806 */ +#define CFE_EVS_LONG_EVENT_MSG_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_EVS_LONG_EVENT_MSG_MSG /* 0x0808 */ +#define CFE_EVS_SHORT_EVENT_MSG_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_EVS_SHORT_EVENT_MSG_MSG /* 0x0809 */ +#define CFE_SB_STATS_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_STATS_TLM_MSG /* 0x080A */ +#define CFE_ES_APP_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_ES_APP_TLM_MSG /* 0x080B */ +#define CFE_TBL_REG_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TBL_REG_TLM_MSG /* 0x080C */ +#define CFE_SB_ALLSUBS_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_ALLSUBS_TLM_MSG /* 0x080D */ +#define CFE_SB_ONESUB_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_SB_ONESUB_TLM_MSG /* 0x080E */ +#define CFE_ES_MEMSTATS_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_ES_MEMSTATS_TLM_MSG /* 0x0810 */ #endif diff --git a/cmake/sample_defs/cpu1_platform_cfg.h b/cmake/sample_defs/cpu1_platform_cfg.h index 92cf6efa8..49bf9ed4c 100644 --- a/cmake/sample_defs/cpu1_platform_cfg.h +++ b/cmake/sample_defs/cpu1_platform_cfg.h @@ -23,7 +23,7 @@ ** ** Purpose: ** This header file contains the platform configuration parameters. -** +** ** Notes: ** The impact of changing these configurations from their default value is ** not yet documented. Changing these values may impact the performance @@ -36,18 +36,17 @@ #ifndef _cfe_platform_cfg_ #define _cfe_platform_cfg_ - /** ** \cfeescfg Default virtual path for persistent storage ** ** \par Description: ** This configures the default location in the virtual file system -** for persistent/non-volatile storage. Files such as the startup -** script, app/library dynamic modules, and configuration tables are +** for persistent/non-volatile storage. Files such as the startup +** script, app/library dynamic modules, and configuration tables are ** expected to be stored in this directory. ** */ -#define CFE_PLATFORM_ES_NONVOL_DISK_MOUNT_STRING "/cf" +#define CFE_PLATFORM_ES_NONVOL_DISK_MOUNT_STRING "/cf" /** ** \cfeescfg Default virtual path for volatile storage @@ -63,7 +62,7 @@ ** Multiple separators can be used with the posix or RTEMS ports. ** */ -#define CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING "/ram" +#define CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING "/ram" /** ** \cfesbcfg Maximum Number of Unique Message IDs SB Routing Table can hold @@ -83,8 +82,7 @@ ** search implementation the number of msg ids subscribed to impacts performance. ** */ -#define CFE_PLATFORM_SB_MAX_MSG_IDS 256 - +#define CFE_PLATFORM_SB_MAX_MSG_IDS 256 /** ** \cfesbcfg Maximum Number of Unique Pipes SB Routing Table can hold @@ -101,8 +99,7 @@ ** or equal to OS_MAX_QUEUES. ** */ -#define CFE_PLATFORM_SB_MAX_PIPES 64 - +#define CFE_PLATFORM_SB_MAX_PIPES 64 /** ** \cfesbcfg Maximum Number of unique local destinations a single MsgId can have @@ -118,8 +115,7 @@ ** configuration are defined by a 16 bit data word. ** */ -#define CFE_PLATFORM_SB_MAX_DEST_PER_PKT 16 - +#define CFE_PLATFORM_SB_MAX_DEST_PER_PKT 16 /** ** \cfesbcfg Default Subscription Message Limit @@ -134,8 +130,7 @@ ** This parameter has a lower limit of 4 and an upper limit of 65535. ** */ -#define CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT 4 - +#define CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT 4 /** ** \cfesbcfg Size of the SB buffer memory pool @@ -157,7 +152,7 @@ ** This parameter has a lower limit of 512 and an upper limit of UINT_MAX (4 Gigabytes). ** */ -#define CFE_PLATFORM_SB_BUF_MEMORY_BYTES 524288 +#define CFE_PLATFORM_SB_BUF_MEMORY_BYTES 524288 /** ** \cfesbcfg Highest Valid Message Id @@ -183,7 +178,7 @@ ** the range selected here does not impact message map memory use, so it's ** resonable to use up to the full range supported by the message ID implementation. */ -#define CFE_PLATFORM_SB_HIGHEST_VALID_MSGID 0x1FFF +#define CFE_PLATFORM_SB_HIGHEST_VALID_MSGID 0x1FFF /** ** \cfesbcfg Platform Endian Indicator @@ -208,8 +203,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_SB_DEFAULT_ROUTING_FILENAME "/ram/cfe_sb_route.dat" - +#define CFE_PLATFORM_SB_DEFAULT_ROUTING_FILENAME "/ram/cfe_sb_route.dat" /** ** \cfesbcfg Default Pipe Information Filename @@ -223,8 +217,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_SB_DEFAULT_PIPE_FILENAME "/ram/cfe_sb_pipe.dat" - +#define CFE_PLATFORM_SB_DEFAULT_PIPE_FILENAME "/ram/cfe_sb_pipe.dat" /** ** \cfesbcfg Default Message Map Filename @@ -241,8 +234,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_SB_DEFAULT_MAP_FILENAME "/ram/cfe_sb_msgmap.dat" - +#define CFE_PLATFORM_SB_DEFAULT_MAP_FILENAME "/ram/cfe_sb_msgmap.dat" /** ** \cfesbcfg SB Event Filtering @@ -259,30 +251,29 @@ ** This filtering applies only to SB events. ** These parameters have a lower limit of 0 and an upper limit of 65535. */ -#define CFE_PLATFORM_SB_FILTERED_EVENT1 CFE_SB_SEND_NO_SUBS_EID -#define CFE_PLATFORM_SB_FILTER_MASK1 CFE_EVS_FIRST_4_STOP - -#define CFE_PLATFORM_SB_FILTERED_EVENT2 CFE_SB_DUP_SUBSCRIP_EID -#define CFE_PLATFORM_SB_FILTER_MASK2 CFE_EVS_FIRST_4_STOP +#define CFE_PLATFORM_SB_FILTERED_EVENT1 CFE_SB_SEND_NO_SUBS_EID +#define CFE_PLATFORM_SB_FILTER_MASK1 CFE_EVS_FIRST_4_STOP -#define CFE_PLATFORM_SB_FILTERED_EVENT3 CFE_SB_MSGID_LIM_ERR_EID -#define CFE_PLATFORM_SB_FILTER_MASK3 CFE_EVS_FIRST_16_STOP +#define CFE_PLATFORM_SB_FILTERED_EVENT2 CFE_SB_DUP_SUBSCRIP_EID +#define CFE_PLATFORM_SB_FILTER_MASK2 CFE_EVS_FIRST_4_STOP -#define CFE_PLATFORM_SB_FILTERED_EVENT4 CFE_SB_Q_FULL_ERR_EID -#define CFE_PLATFORM_SB_FILTER_MASK4 CFE_EVS_FIRST_16_STOP +#define CFE_PLATFORM_SB_FILTERED_EVENT3 CFE_SB_MSGID_LIM_ERR_EID +#define CFE_PLATFORM_SB_FILTER_MASK3 CFE_EVS_FIRST_16_STOP -#define CFE_PLATFORM_SB_FILTERED_EVENT5 0 -#define CFE_PLATFORM_SB_FILTER_MASK5 CFE_EVS_NO_FILTER +#define CFE_PLATFORM_SB_FILTERED_EVENT4 CFE_SB_Q_FULL_ERR_EID +#define CFE_PLATFORM_SB_FILTER_MASK4 CFE_EVS_FIRST_16_STOP -#define CFE_PLATFORM_SB_FILTERED_EVENT6 0 -#define CFE_PLATFORM_SB_FILTER_MASK6 CFE_EVS_NO_FILTER +#define CFE_PLATFORM_SB_FILTERED_EVENT5 0 +#define CFE_PLATFORM_SB_FILTER_MASK5 CFE_EVS_NO_FILTER -#define CFE_PLATFORM_SB_FILTERED_EVENT7 0 -#define CFE_PLATFORM_SB_FILTER_MASK7 CFE_EVS_NO_FILTER +#define CFE_PLATFORM_SB_FILTERED_EVENT6 0 +#define CFE_PLATFORM_SB_FILTER_MASK6 CFE_EVS_NO_FILTER -#define CFE_PLATFORM_SB_FILTERED_EVENT8 0 -#define CFE_PLATFORM_SB_FILTER_MASK8 CFE_EVS_NO_FILTER +#define CFE_PLATFORM_SB_FILTERED_EVENT7 0 +#define CFE_PLATFORM_SB_FILTER_MASK7 CFE_EVS_NO_FILTER +#define CFE_PLATFORM_SB_FILTERED_EVENT8 0 +#define CFE_PLATFORM_SB_FILTER_MASK8 CFE_EVS_NO_FILTER /** ** \cfeescfg Define SB Memory Pool Block Sizes @@ -295,23 +286,23 @@ ** The number of block sizes defined cannot exceed ** #CFE_PLATFORM_ES_POOL_MAX_BUCKETS */ -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 8 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 16 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 20 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 36 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 64 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 96 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 128 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 160 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 256 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 512 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 1024 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 2048 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 4096 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 8192 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 16384 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 32768 -#define CFE_PLATFORM_SB_MAX_BLOCK_SIZE (CFE_MISSION_SB_MAX_SB_MSG_SIZE + 40) +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 8 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 16 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 20 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 36 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 64 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 96 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 128 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 160 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 256 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 512 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 1024 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 2048 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 4096 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 8192 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 16384 +#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 32768 +#define CFE_PLATFORM_SB_MAX_BLOCK_SIZE (CFE_MISSION_SB_MAX_SB_MSG_SIZE + 40) /** ** \cfetimecfg Time Server or Time Client Selection @@ -325,9 +316,8 @@ ** Enable one, and only one by defining either CFE_PLATFORM_TIME_CFG_SERVER or ** CFE_PLATFORM_TIME_CFG_CLIENT AS true. The other must be defined as false. */ -#define CFE_PLATFORM_TIME_CFG_SERVER true -#define CFE_PLATFORM_TIME_CFG_CLIENT false - +#define CFE_PLATFORM_TIME_CFG_SERVER true +#define CFE_PLATFORM_TIME_CFG_CLIENT false /** ** \cfetimecfg Time Tone In Big-Endian Order @@ -341,7 +331,6 @@ */ #undef CFE_PLATFORM_TIME_CFG_BIGENDIAN - /** ** \cfetimecfg Local MET or Virtual MET Selection for Time Servers ** @@ -360,8 +349,7 @@ ** \par Limits ** Only applies if #CFE_PLATFORM_TIME_CFG_SERVER is set to true. */ -#define CFE_PLATFORM_TIME_CFG_VIRTUAL true - +#define CFE_PLATFORM_TIME_CFG_VIRTUAL true /** ** \cfetimecfg Include or Exclude the Primary/Redundant Tone Selection Cmd @@ -376,8 +364,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_TIME_CFG_SIGNAL false - +#define CFE_PLATFORM_TIME_CFG_SIGNAL false /** ** \cfetimecfg Include or Exclude the Internal/External Time Source Selection Cmd @@ -397,8 +384,7 @@ ** \par Limits ** Only applies if #CFE_PLATFORM_TIME_CFG_SERVER is set to true. */ -#define CFE_PLATFORM_TIME_CFG_SOURCE false - +#define CFE_PLATFORM_TIME_CFG_SOURCE false /** ** \cfetimecfg Choose the External Time Source for Server only @@ -414,10 +400,9 @@ ** #CFE_PLATFORM_TIME_CFG_SRC_MET, #CFE_PLATFORM_TIME_CFG_SRC_GPS, #CFE_PLATFORM_TIME_CFG_SRC_TIME ** -# Only applies if #CFE_PLATFORM_TIME_CFG_SERVER is set to true. */ -#define CFE_PLATFORM_TIME_CFG_SRC_MET false -#define CFE_PLATFORM_TIME_CFG_SRC_GPS false -#define CFE_PLATFORM_TIME_CFG_SRC_TIME false - +#define CFE_PLATFORM_TIME_CFG_SRC_MET false +#define CFE_PLATFORM_TIME_CFG_SRC_GPS false +#define CFE_PLATFORM_TIME_CFG_SRC_TIME false /** ** \cfetimecfg Define the Max Delta Limits for Time Servers using an Ext Time Source @@ -436,9 +421,8 @@ ** Applies only if both #CFE_PLATFORM_TIME_CFG_SERVER and #CFE_PLATFORM_TIME_CFG_SOURCE are set ** to true. */ -#define CFE_PLATFORM_TIME_MAX_DELTA_SECS 0 -#define CFE_PLATFORM_TIME_MAX_DELTA_SUBS 500000 - +#define CFE_PLATFORM_TIME_MAX_DELTA_SECS 0 +#define CFE_PLATFORM_TIME_MAX_DELTA_SUBS 500000 /** ** \cfetimecfg Define the Local Clock Rollover Value in seconds and subseconds @@ -450,9 +434,8 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_TIME_MAX_LOCAL_SECS 27 -#define CFE_PLATFORM_TIME_MAX_LOCAL_SUBS 0 - +#define CFE_PLATFORM_TIME_MAX_LOCAL_SECS 27 +#define CFE_PLATFORM_TIME_MAX_LOCAL_SUBS 0 /** ** \cfetimecfg Define Timing Limits From One Tone To The Next @@ -466,9 +449,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_TIME_CFG_TONE_LIMIT 20000 - - +#define CFE_PLATFORM_TIME_CFG_TONE_LIMIT 20000 /** ** \cfetimecfg Define Time to Start Flywheel Since Last Tone @@ -480,8 +461,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_TIME_CFG_START_FLY 2 - +#define CFE_PLATFORM_TIME_CFG_START_FLY 2 /** ** \cfetimecfg Define Periodic Time to Update Local Clock Tone Latch @@ -494,8 +474,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_TIME_CFG_LATCH_FLY 8 - +#define CFE_PLATFORM_TIME_CFG_LATCH_FLY 8 /** ** \cfeescfg Define Max Number of Applications @@ -513,7 +492,6 @@ */ #define CFE_PLATFORM_ES_MAX_APPLICATIONS 32 - /** ** \cfeescfg Define Max Number of Shared libraries ** @@ -553,8 +531,7 @@ ** in the error log. Any context information beyond this size will ** be truncated. */ -#define CFE_PLATFORM_ES_ER_LOG_MAX_CONTEXT_SIZE 256 - +#define CFE_PLATFORM_ES_ER_LOG_MAX_CONTEXT_SIZE 256 /** ** \cfeescfg Define Size of the cFE System Log. @@ -569,8 +546,7 @@ ** however, the maximum system log size is system dependent and should be ** verified. */ -#define CFE_PLATFORM_ES_SYSTEM_LOG_SIZE 3072 - +#define CFE_PLATFORM_ES_SYSTEM_LOG_SIZE 3072 /** ** \cfeescfg Define Number of entries in the ES Object table @@ -584,8 +560,7 @@ ** however, the maximum object table size is system dependent and should be ** verified. */ -#define CFE_PLATFORM_ES_OBJECT_TABLE_SIZE 30 - +#define CFE_PLATFORM_ES_OBJECT_TABLE_SIZE 30 /** ** \cfeescfg Define Max Number of Generic Counters @@ -596,8 +571,7 @@ ** \par Limits ** This parameter has a lower limit of 1 and an upper limit of 65535. */ -#define CFE_PLATFORM_ES_MAX_GEN_COUNTERS 8 - +#define CFE_PLATFORM_ES_MAX_GEN_COUNTERS 8 /** ** \cfeescfg Define ES Application Control Scan Rate @@ -618,7 +592,6 @@ */ #define CFE_PLATFORM_ES_APP_SCAN_RATE 1000 - /** ** \cfeescfg Define ES Application Kill Timeout ** @@ -648,7 +621,6 @@ */ #define CFE_PLATFORM_ES_APP_KILL_TIMEOUT 5 - /** ** \cfeescfg ES Ram Disk Sector Size ** @@ -665,8 +637,7 @@ ** however, the maximum RAM disk sector size is system dependent and should be ** verified. */ -#define CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE 512 - +#define CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE 512 /** ** \cfeescfg ES Ram Disk Number of Sectors @@ -684,7 +655,7 @@ ** however, the maximum number of RAM sectors is system dependent and should be ** verified. */ -#define CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS 4096 +#define CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS 4096 /** ** \cfeescfg Percentage of Ram Disk Reserved for Decompressing Apps @@ -710,7 +681,6 @@ */ #define CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED 30 - /** ** \cfeescfg Define Critical Data Store Size ** @@ -726,8 +696,7 @@ ** There is a lower limit of 8192 and an upper limit of UINT_MAX (4 Gigabytes) ** on this configuration paramater. */ -#define CFE_PLATFORM_ES_CDS_SIZE ( 128 * 1024 ) - +#define CFE_PLATFORM_ES_CDS_SIZE (128 * 1024) /** ** \cfeescfg Define User Reserved Memory Size @@ -747,8 +716,7 @@ ** There is a lower limit of 1024 and an upper limit of UINT_MAX (4 Gigabytes) ** on this configuration paramater. */ -#define CFE_PLATFORM_ES_USER_RESERVED_SIZE ( 1024 * 1024 ) - +#define CFE_PLATFORM_ES_USER_RESERVED_SIZE (1024 * 1024) /** ** \cfeescfg Define ES Reset Area Size @@ -771,7 +739,7 @@ ** There is a lower limit of 153600 (150KBytes) and an upper limit of UINT_MAX ** (4 Gigabytes) on this configuration paramater. */ -#define CFE_PLATFORM_ES_RESET_AREA_SIZE ( 170 * 1024 ) +#define CFE_PLATFORM_ES_RESET_AREA_SIZE (170 * 1024) /** ** \cfeescfg Define Memory Pool Alignment Size @@ -790,8 +758,7 @@ ** \par Limits ** This must always be a power of 2, as it is used as a binary address mask. */ -#define CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN 4 - +#define CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN 4 /** ** \cfeescfg ES Nonvolatile Startup Filename @@ -805,8 +772,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_NONVOL_STARTUP_FILE "/cf/cfe_es_startup.scr" - +#define CFE_PLATFORM_ES_NONVOL_STARTUP_FILE "/cf/cfe_es_startup.scr" /** ** \cfeescfg ES Volatile Startup Filename @@ -820,7 +786,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE "/ram/cfe_es_startup.scr" +#define CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE "/ram/cfe_es_startup.scr" /** ** \cfeescfg Default Application Information Filename @@ -835,7 +801,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE "/ram/cfe_es_app_info.log" +#define CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE "/ram/cfe_es_app_info.log" /** ** \cfeescfg Default Application Information Filename @@ -850,7 +816,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE "/ram/cfe_es_taskinfo.log" +#define CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE "/ram/cfe_es_taskinfo.log" /** ** \cfeescfg Default System Log Filename @@ -866,7 +832,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE "/ram/cfe_es_syslog.log" +#define CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE "/ram/cfe_es_syslog.log" /** ** \cfeescfg Default Exception and Reset (ER) Log Filename @@ -881,7 +847,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE "/ram/cfe_erlog.log" +#define CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE "/ram/cfe_erlog.log" /** ** \cfeescfg Default Performance Data Filename @@ -895,8 +861,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME "/ram/cfe_es_perf.dat" - +#define CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME "/ram/cfe_es_perf.dat" /** ** \cfeescfg Default Critical Data Store Registry Filename @@ -910,7 +875,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE "/ram/cfe_cds_reg.log" +#define CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE "/ram/cfe_cds_reg.log" /** ** \cfeescfg Define Default System Log Mode following Power On Reset @@ -928,7 +893,7 @@ ** There is a lower limit of 0 and an upper limit of 1 on this configuration ** paramater. */ -#define CFE_PLATFORM_ES_DEFAULT_POR_SYSLOG_MODE 0 +#define CFE_PLATFORM_ES_DEFAULT_POR_SYSLOG_MODE 0 /** ** \cfeescfg Define Default System Log Mode following Processor Reset @@ -946,7 +911,7 @@ ** There is a lower limit of 0 and an upper limit of 1 on this configuration ** paramater. */ -#define CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE 1 +#define CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE 1 /** ** \cfeescfg Define Max Size of Performance Data Buffer @@ -962,102 +927,100 @@ ** The units are number of entries. An entry is defined by a 32 bit data word followed ** by a 64 bit time stamp. */ -#define CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE 10000 - +#define CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE 10000 /** ** \cfeescfg Define Filter Mask Setting for Disabling All Performance Entries ** ** \par Description: ** Defines the filter mask for disabling all performance entries. The value is a -** bit mask. For each bit, 0 means the corresponding entry is disabled and +** bit mask. For each bit, 0 means the corresponding entry is disabled and ** 1 means it is enabled. */ -#define CFE_PLATFORM_ES_PERF_FILTMASK_NONE 0 +#define CFE_PLATFORM_ES_PERF_FILTMASK_NONE 0 /** ** \cfeescfg Define Filter Mask Setting for Enabling All Performance Entries ** ** \par Description: ** Defines the filter mask for enabling all performance entries. The value is a -** bit mask. For each bit, 0 means the corresponding entry is disabled and +** bit mask. For each bit, 0 means the corresponding entry is disabled and ** 1 means it is enabled. */ -#define CFE_PLATFORM_ES_PERF_FILTMASK_ALL ~CFE_PLATFORM_ES_PERF_FILTMASK_NONE +#define CFE_PLATFORM_ES_PERF_FILTMASK_ALL ~CFE_PLATFORM_ES_PERF_FILTMASK_NONE /** ** \cfeescfg Define Default Filter Mask Setting for Performance Data Buffer ** ** \par Description: ** Defines the default filter mask for the performance data buffer. The value is a -** bit mask. For each bit, 0 means the corresponding entry is disabled and 1 +** bit mask. For each bit, 0 means the corresponding entry is disabled and 1 ** means it is enabled. ** */ -#define CFE_PLATFORM_ES_PERF_FILTMASK_INIT CFE_PLATFORM_ES_PERF_FILTMASK_ALL - +#define CFE_PLATFORM_ES_PERF_FILTMASK_INIT CFE_PLATFORM_ES_PERF_FILTMASK_ALL /** ** \cfeescfg Define Default Filter Trigger Setting for Disabling All Performance Entries ** ** \par Description: -** Defines the default trigger mask for disabling all performance data entries. The value -** is a bit mask. For each bit, 0 means the trigger for the corresponding entry is +** Defines the default trigger mask for disabling all performance data entries. The value +** is a bit mask. For each bit, 0 means the trigger for the corresponding entry is ** disabled and 1 means it is enabled. ** */ -#define CFE_PLATFORM_ES_PERF_TRIGMASK_NONE 0 +#define CFE_PLATFORM_ES_PERF_TRIGMASK_NONE 0 /** ** \cfeescfg Define Filter Trigger Setting for Enabling All Performance Entries ** ** \par Description: -** Defines the trigger mask for enabling all performance data entries. The value is -** a bit mask. For each bit, 0 means the trigger for the corresponding entry is +** Defines the trigger mask for enabling all performance data entries. The value is +** a bit mask. For each bit, 0 means the trigger for the corresponding entry is ** disabled and 1 means it is enabled. ** */ -#define CFE_PLATFORM_ES_PERF_TRIGMASK_ALL ~CFE_PLATFORM_ES_PERF_TRIGMASK_NONE +#define CFE_PLATFORM_ES_PERF_TRIGMASK_ALL ~CFE_PLATFORM_ES_PERF_TRIGMASK_NONE /** ** \cfeescfg Define Default Filter Trigger Setting for Performance Data Buffer ** ** \par Description: ** Defines the default trigger mask for the performance data buffer. The value is a -** 32-bit mask. For each bit, 0 means the trigger for the corresponding entry is +** 32-bit mask. For each bit, 0 means the trigger for the corresponding entry is ** disabled and 1 means it is enabled. ** */ -#define CFE_PLATFORM_ES_PERF_TRIGMASK_INIT CFE_PLATFORM_ES_PERF_TRIGMASK_NONE +#define CFE_PLATFORM_ES_PERF_TRIGMASK_INIT CFE_PLATFORM_ES_PERF_TRIGMASK_NONE /** ** \cfeescfg Define Performance Analyzer Child Task Priority ** ** \par Description: ** This parameter defines the priority of the child task spawed by the -** Executive Services to write performance data to a file. Lower numbers -** are higher priority, with 1 being the highest priority in the case of a -** child task. +** Executive Services to write performance data to a file. Lower numbers +** are higher priority, with 1 being the highest priority in the case of a +** child task. ** ** \par Limits ** Valid range for a child task is 1 to 255 however, the priority cannot ** be higher (lower number) than the ES parent application priority. */ -#define CFE_PLATFORM_ES_PERF_CHILD_PRIORITY 200 +#define CFE_PLATFORM_ES_PERF_CHILD_PRIORITY 200 /** ** \cfeescfg Define Performance Analyzer Child Task Stack Size ** ** \par Description: ** This parameter defines the stack size of the child task spawed by the -** Executive Services to write performance data to a file. +** Executive Services to write performance data to a file. ** ** \par Limits ** It is recommended this parameter be greater than or equal to 4KB. This parameter ** is limited by the maximum value allowed by the data type. In this case, the data ** type is an unsigned 32-bit integer, so the valid range is 0 to 0xFFFFFFFF. */ -#define CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE 4096 +#define CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE 4096 /** ** \cfeescfg Define Performance Analyzer Child Task Delay @@ -1065,24 +1028,24 @@ ** \par Description: ** This parameter defines the delay time (in milliseconds) between performance ** data file writes performed by the Executive Services Performace Analyzer -** Child Task. +** Child Task. ** ** \par Limits ** It is recommended this parameter be greater than or equal to 20ms. This parameter ** is limited by the maximum value allowed by the data type. In this case, the data ** type is an unsigned 32-bit integer, so the valid range is 0 to 0xFFFFFFFF. */ -#define CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY 20 +#define CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY 20 /** ** \cfeescfg Define Performance Analyzer Child Task Number of Entries Between Delay ** ** \par Description: -** This parameter defines the number of performace analyzer entries the Performace -** Analyzer Child Task will write to the file between delays. +** This parameter defines the number of performace analyzer entries the Performace +** Analyzer Child Task will write to the file between delays. ** */ -#define CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS 50 +#define CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS 50 /** ** \cfeescfg Define Default Stack Size for an Application @@ -1109,7 +1072,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_EVS_START_TASK_PRIORITY 61 +#define CFE_PLATFORM_EVS_START_TASK_PRIORITY 61 /** ** \cfeescfg Define EVS Task Stack Size @@ -1124,7 +1087,7 @@ ** tools for measuring the amount of stack used by a task during operation. It ** is always a good idea to verify that no more than 1/2 of the stack is used. */ -#define CFE_PLATFORM_EVS_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE +#define CFE_PLATFORM_EVS_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE /** ** \cfeescfg Define SB Task Priority @@ -1135,7 +1098,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_SB_START_TASK_PRIORITY 64 +#define CFE_PLATFORM_SB_START_TASK_PRIORITY 64 /** ** \cfeescfg Define SB Task Stack Size @@ -1150,7 +1113,7 @@ ** tools for measuring the amount of stack used by a task during operation. It ** is always a good idea to verify that no more than 1/2 of the stack is used. */ -#define CFE_PLATFORM_SB_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE +#define CFE_PLATFORM_SB_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE /** ** \cfeescfg Define ES Task Priority @@ -1161,7 +1124,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_ES_START_TASK_PRIORITY 68 +#define CFE_PLATFORM_ES_START_TASK_PRIORITY 68 /** ** \cfeescfg Define ES Task Stack Size @@ -1176,7 +1139,7 @@ ** tools for measuring the amount of stack used by a task during operation. It ** is always a good idea to verify that no more than 1/2 of the stack is used. */ -#define CFE_PLATFORM_ES_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE +#define CFE_PLATFORM_ES_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE /** ** \cfetimecfg Define TIME Task Priorities @@ -1191,9 +1154,9 @@ ** configuration paramaters. Remember that the meaning of each task ** priority is inverted -- a "lower" number has a "higher" priority. */ -#define CFE_PLATFORM_TIME_START_TASK_PRIORITY 60 -#define CFE_PLATFORM_TIME_TONE_TASK_PRIORITY 25 -#define CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY 25 +#define CFE_PLATFORM_TIME_START_TASK_PRIORITY 60 +#define CFE_PLATFORM_TIME_TONE_TASK_PRIORITY 25 +#define CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY 25 /** ** \cfetimecfg Define TIME Task Stack Sizes @@ -1210,9 +1173,9 @@ ** tools for measuring the amount of stack used by a task during operation. It ** is always a good idea to verify that no more than 1/2 of the stack is used. */ -#define CFE_PLATFORM_TIME_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE -#define CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE 4096 -#define CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE 8192 +#define CFE_PLATFORM_TIME_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE +#define CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE 4096 +#define CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE 8192 /** ** \cfeescfg Define TBL Task Priority @@ -1223,7 +1186,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_PLATFORM_TBL_START_TASK_PRIORITY 70 +#define CFE_PLATFORM_TBL_START_TASK_PRIORITY 70 /** ** \cfeescfg Define TBL Task Stack Size @@ -1238,7 +1201,7 @@ ** tools for measuring the amount of stack used by a task during operation. It ** is always a good idea to verify that no more than 1/2 of the stack is used. */ -#define CFE_PLATFORM_TBL_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE +#define CFE_PLATFORM_TBL_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE /** ** \cfeescfg Define Maximum Number of Registered CDS Blocks @@ -1251,8 +1214,7 @@ ** however, the maximum number of CDS entries is system dependent and ** should be verified. */ -#define CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES 512 - +#define CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES 512 /** ** \cfeescfg Define Number of Processor Resets Before a Power On Reset @@ -1267,8 +1229,7 @@ ** however, the maximum number of processor resets may be system dependent and ** should be verified. */ -#define CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS 2 - +#define CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS 2 /** \cfeescfg Maximum number of block sizes in pool structures ** @@ -1282,8 +1243,8 @@ ** values have not been tested. ** ** The ES and CDS block size lists must correlate with this value - */ -#define CFE_PLATFORM_ES_POOL_MAX_BUCKETS 17 +*/ +#define CFE_PLATFORM_ES_POOL_MAX_BUCKETS 17 /** \cfeescfg Maximum number of memory pools ** @@ -1300,9 +1261,8 @@ ** \par Limits: ** Must be at least 2 to support CFE core - SB and TBL pools. No ** specific upper limit. - */ -#define CFE_PLATFORM_ES_MAX_MEMORY_POOLS 10 - +*/ +#define CFE_PLATFORM_ES_MAX_MEMORY_POOLS 10 /** ** \cfeescfg Define Default ES Memory Pool Block Sizes @@ -1321,24 +1281,23 @@ ** Services have been removed from the CFE, the table size limits are still ** enforced although the table size definitions may be reduced. */ -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 8 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 16 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 32 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 48 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 64 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 96 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 128 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 160 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 256 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 512 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 1024 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 2048 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 4096 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 8192 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 16384 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 32768 -#define CFE_PLATFORM_ES_MAX_BLOCK_SIZE 80000 - +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 8 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 16 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 32 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 48 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 64 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 96 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 128 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 160 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 256 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 512 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 1024 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 2048 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 4096 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 8192 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 16384 +#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 32768 +#define CFE_PLATFORM_ES_MAX_BLOCK_SIZE 80000 /** ** \cfeescfg Define ES Critical Data Store Memory Pool Block Sizes @@ -1349,25 +1308,23 @@ ** \par Limits ** These sizes MUST be increasing and MUST be an integral multiple of 4. */ -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 8 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 16 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 32 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 48 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 64 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 96 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 128 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 160 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 256 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 512 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 1024 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 2048 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 4096 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 8192 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 16384 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 32768 -#define CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE 80000 - - +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 8 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 16 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 32 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 48 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 64 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 96 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 128 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 160 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 256 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 512 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 1024 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 2048 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 4096 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 8192 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 16384 +#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 32768 +#define CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE 80000 /** ** \cfeevscfg Define Maximum Number of Event Filters per Application @@ -1380,8 +1337,7 @@ ** the maximum number of event filters is system dependent and should be ** verified. */ -#define CFE_PLATFORM_EVS_MAX_EVENT_FILTERS 8 - +#define CFE_PLATFORM_EVS_MAX_EVENT_FILTERS 8 /** ** \cfeevscfg Default Event Log Filename @@ -1395,8 +1351,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_EVS_DEFAULT_LOG_FILE "/ram/cfe_evs.log" - +#define CFE_PLATFORM_EVS_DEFAULT_LOG_FILE "/ram/cfe_evs.log" /** ** \cfeevscfg Maximum Number of Events in EVS Local Event Log @@ -1408,8 +1363,7 @@ ** There are no restrictions on the lower and upper limits however, ** the maximum log size is system dependent and should be verified. */ -#define CFE_PLATFORM_EVS_LOG_MAX 20 - +#define CFE_PLATFORM_EVS_LOG_MAX 20 /** ** \cfeevscfg Default EVS Application Data Filename @@ -1424,8 +1378,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_EVS_DEFAULT_APP_DATA_FILE "/ram/cfe_evs_app.dat" - +#define CFE_PLATFORM_EVS_DEFAULT_APP_DATA_FILE "/ram/cfe_evs_app.dat" /** ** \cfeevscfg Default EVS Output Port State @@ -1439,8 +1392,7 @@ ** \par Limits ** The valid settings are 0x0 to 0xF. */ -#define CFE_PLATFORM_EVS_PORT_DEFAULT 0x0001 - +#define CFE_PLATFORM_EVS_PORT_DEFAULT 0x0001 /** ** \cfeevscfg Default EVS Event Type Filter Mask @@ -1457,9 +1409,7 @@ ** \par Limits ** The valid settings are 0x0 to 0xF. */ -#define CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG 0xE - - +#define CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG 0xE /** ** \cfeevscfg Default EVS Local Event Log Mode @@ -1475,8 +1425,7 @@ ** \par Limits ** The valid settings are 0 or 1 */ -#define CFE_PLATFORM_EVS_DEFAULT_LOG_MODE 1 - +#define CFE_PLATFORM_EVS_DEFAULT_LOG_MODE 1 /** ** \cfeevscfg Default EVS Message Format Mode @@ -1491,8 +1440,6 @@ */ #define CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE CFE_EVS_MsgFormat_LONG - - /* Platform Configuration Parameters for Table Service (TBL) */ /** @@ -1507,7 +1454,7 @@ ** \par Limits ** The cFE does not place a limit on the size of this parameter. */ -#define CFE_PLATFORM_TBL_BUF_MEMORY_BYTES 524288 +#define CFE_PLATFORM_TBL_BUF_MEMORY_BYTES 524288 /** ** \cfetblcfg Maximum Size Allowed for a Double Buffered Table @@ -1519,7 +1466,7 @@ ** The cFE does not place a limit on the size of this parameter but it must be ** less than half of #CFE_PLATFORM_TBL_BUF_MEMORY_BYTES. */ -#define CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE 16384 +#define CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE 16384 /** ** \cfetblcfg Maximum Size Allowed for a Single Buffered Table @@ -1535,7 +1482,7 @@ ** small enough to allow for #CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS number of tables ** to fit into #CFE_PLATFORM_TBL_BUF_MEMORY_BYTES. */ -#define CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE 16384 +#define CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE 16384 /** ** \cfetblcfg Maximum Number of Tables Allowed to be Registered @@ -1548,7 +1495,7 @@ ** determines the size of the Table Registry. An excessively high number will waste ** memory. */ -#define CFE_PLATFORM_TBL_MAX_NUM_TABLES 128 +#define CFE_PLATFORM_TBL_MAX_NUM_TABLES 128 /** ** \cfetblcfg Maximum Number of Critical Tables that can be Registered @@ -1562,7 +1509,7 @@ ** Data Store. An excessively high number will waste Critical Data Store memory. Therefore, ** this number must not exceed the value defined in CFE_ES_CDS_MAX_CRITICAL_TABLES. */ -#define CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES 32 +#define CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES 32 /** ** \cfetblcfg Maximum Number of Table Handles @@ -1575,7 +1522,7 @@ ** the number of tables (#CFE_PLATFORM_TBL_MAX_NUM_TABLES) and should be set higher if tables ** are shared between applications. */ -#define CFE_PLATFORM_TBL_MAX_NUM_HANDLES 256 +#define CFE_PLATFORM_TBL_MAX_NUM_HANDLES 256 /** ** \cfetblcfg Maximum Number of Simultaneous Loads to Support @@ -1590,7 +1537,7 @@ ** degrade system performance and waste memory. A number less than 5 is ** suggested but not required. */ -#define CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS 4 +#define CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS 4 /** ** \cfetblcfg Maximum Number of Simultaneous Table Validations @@ -1608,7 +1555,7 @@ ** degrade system performance and waste memory. A number less than 20 is ** suggested but not required. */ -#define CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS 10 +#define CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS 10 /** ** \cfetblcfg Default Filename for a Table Registry Dump @@ -1621,7 +1568,7 @@ ** The length of each string, including the NULL terminator cannot exceed the ** #OS_MAX_PATH_LEN value. */ -#define CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE "/ram/cfe_tbl_reg.log" +#define CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE "/ram/cfe_tbl_reg.log" /** ** \cfetblcfg Number of Spacecraft ID's specified for validation @@ -1640,14 +1587,11 @@ ** This number must be greater than or equal to zero and ** less than or equal to 2. */ -#define CFE_PLATFORM_TBL_VALID_SCID_COUNT 0 +#define CFE_PLATFORM_TBL_VALID_SCID_COUNT 0 /* macro to construct 32 bit value from 4 chars */ -#define CFE_PLATFORM_TBL_U32FROM4CHARS( _C1, _C2, _C3, _C4 ) \ - ( (uint32)(_C1) << 24 | \ - (uint32)(_C2) << 16 | \ - (uint32)(_C3) << 8 | \ - (uint32)(_C4) ) +#define CFE_PLATFORM_TBL_U32FROM4CHARS(_C1, _C2, _C3, _C4) \ + ((uint32)(_C1) << 24 | (uint32)(_C2) << 16 | (uint32)(_C3) << 8 | (uint32)(_C4)) /** ** \cfetblcfg Spacecraft ID values used for table load validation @@ -1661,8 +1605,8 @@ ** \par Limits ** This value can be any 32 bit unsigned integer. */ -#define CFE_PLATFORM_TBL_VALID_SCID_1 (0x42) -#define CFE_PLATFORM_TBL_VALID_SCID_2 (CFE_PLATFORM_TBL_U32FROM4CHARS('a', 'b', 'c', 'd')) +#define CFE_PLATFORM_TBL_VALID_SCID_1 (0x42) +#define CFE_PLATFORM_TBL_VALID_SCID_2 (CFE_PLATFORM_TBL_U32FROM4CHARS('a', 'b', 'c', 'd')) /** ** \cfetblcfg Number of Processor ID's specified for validation @@ -1681,7 +1625,7 @@ ** This number must be greater than or equal to zero and ** less than or equal to 4. */ -#define CFE_PLATFORM_TBL_VALID_PRID_COUNT 0 +#define CFE_PLATFORM_TBL_VALID_PRID_COUNT 0 /** ** \cfetblcfg Processor ID values used for table load validation @@ -1695,10 +1639,10 @@ ** \par Limits ** This value can be any 32 bit unsigned integer. */ -#define CFE_PLATFORM_TBL_VALID_PRID_1 (1) -#define CFE_PLATFORM_TBL_VALID_PRID_2 (CFE_PLATFORM_TBL_U32FROM4CHARS('a', 'b', 'c', 'd')) -#define CFE_PLATFORM_TBL_VALID_PRID_3 0 -#define CFE_PLATFORM_TBL_VALID_PRID_4 0 +#define CFE_PLATFORM_TBL_VALID_PRID_1 (1) +#define CFE_PLATFORM_TBL_VALID_PRID_2 (CFE_PLATFORM_TBL_U32FROM4CHARS('a', 'b', 'c', 'd')) +#define CFE_PLATFORM_TBL_VALID_PRID_3 0 +#define CFE_PLATFORM_TBL_VALID_PRID_4 0 /** \cfeescfg Poll timer for startup sync delay ** @@ -1720,7 +1664,7 @@ ** Must be defined as an integer value that is greater than ** or equal to zero. */ -#define CFE_PLATFORM_ES_STARTUP_SYNC_POLL_MSEC 50 +#define CFE_PLATFORM_ES_STARTUP_SYNC_POLL_MSEC 50 /** \cfeescfg CFE core application startup timeout ** @@ -1744,7 +1688,7 @@ ** or equal to zero. ** */ -#define CFE_PLATFORM_CORE_MAX_STARTUP_MSEC 30000 +#define CFE_PLATFORM_CORE_MAX_STARTUP_MSEC 30000 /** \cfeescfg Startup script timeout ** @@ -1761,9 +1705,7 @@ ** \par Limits: ** Must be defined as an integer value that is greater than ** or equal to zero. - */ -#define CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC 1000 - - -#endif /* _cfe_platform_cfg_ */ +*/ +#define CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC 1000 +#endif /* _cfe_platform_cfg_ */ diff --git a/cmake/sample_defs/sample_mission_cfg.h b/cmake/sample_defs/sample_mission_cfg.h index 7f8b7e895..e0ecdca87 100644 --- a/cmake/sample_defs/sample_mission_cfg.h +++ b/cmake/sample_defs/sample_mission_cfg.h @@ -24,7 +24,7 @@ ** Purpose: ** This header file contains the mission configuration parameters and ** typedefs with mission scope. -** +** ** Notes: ** The impact of changing these configurations from their default value is ** not yet documented. Changing these values may impact the performance @@ -37,7 +37,6 @@ #ifndef _cfe_mission_cfg_ #define _cfe_mission_cfg_ - /** ** \cfesbcfg Maximum SB Message Size ** @@ -53,8 +52,7 @@ ** system dependent and should be verified. Total message size values that are ** checked against this configuration are defined by a 16 bit data word. */ -#define CFE_MISSION_SB_MAX_SB_MSG_SIZE 32768 - +#define CFE_MISSION_SB_MAX_SB_MSG_SIZE 32768 /** ** \cfetimecfg Default Time Format @@ -74,9 +72,8 @@ ** if CFE_MISSION_TIME_CFG_DEFAULT_TAI is defined as false then CFE_MISSION_TIME_CFG_DEFAULT_UTC must be ** defined as true. */ -#define CFE_MISSION_TIME_CFG_DEFAULT_TAI true -#define CFE_MISSION_TIME_CFG_DEFAULT_UTC false - +#define CFE_MISSION_TIME_CFG_DEFAULT_TAI true +#define CFE_MISSION_TIME_CFG_DEFAULT_UTC false /** ** \cfetimecfg Default Time Format @@ -89,8 +86,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_MISSION_TIME_CFG_FAKE_TONE true - +#define CFE_MISSION_TIME_CFG_FAKE_TONE true /** ** \cfetimecfg Default Time and Tone Order @@ -113,8 +109,8 @@ ** Either CFE_MISSION_TIME_AT_TONE_WAS or CFE_MISSION_TIME_AT_TONE_WILL_BE must be set to true. ** They may not both be true and they may not both be false. */ -#define CFE_MISSION_TIME_AT_TONE_WAS true -#define CFE_MISSION_TIME_AT_TONE_WILL_BE false +#define CFE_MISSION_TIME_AT_TONE_WAS true +#define CFE_MISSION_TIME_AT_TONE_WILL_BE false /** ** \cfetimecfg Min and Max Time Elapsed @@ -139,9 +135,8 @@ ** \par Limits ** 0 to 999,999 decimal */ -#define CFE_MISSION_TIME_MIN_ELAPSED 0 -#define CFE_MISSION_TIME_MAX_ELAPSED 200000 - +#define CFE_MISSION_TIME_MIN_ELAPSED 0 +#define CFE_MISSION_TIME_MAX_ELAPSED 200000 /** ** \cfetimecfg Default Time Values @@ -166,17 +161,16 @@ ** \par Limits ** Not Applicable */ -#define CFE_MISSION_TIME_DEF_MET_SECS 1000 -#define CFE_MISSION_TIME_DEF_MET_SUBS 0 +#define CFE_MISSION_TIME_DEF_MET_SECS 1000 +#define CFE_MISSION_TIME_DEF_MET_SUBS 0 -#define CFE_MISSION_TIME_DEF_STCF_SECS 1000000 -#define CFE_MISSION_TIME_DEF_STCF_SUBS 0 +#define CFE_MISSION_TIME_DEF_STCF_SECS 1000000 +#define CFE_MISSION_TIME_DEF_STCF_SUBS 0 -#define CFE_MISSION_TIME_DEF_LEAPS 37 - -#define CFE_MISSION_TIME_DEF_DELAY_SECS 0 -#define CFE_MISSION_TIME_DEF_DELAY_SUBS 1000 +#define CFE_MISSION_TIME_DEF_LEAPS 37 +#define CFE_MISSION_TIME_DEF_DELAY_SECS 0 +#define CFE_MISSION_TIME_DEF_DELAY_SUBS 1000 /** ** \cfetimecfg Default EPOCH Values @@ -192,12 +186,11 @@ ** Minute - 0 to 59 ** Second - 0 to 59 */ -#define CFE_MISSION_TIME_EPOCH_YEAR 1980 -#define CFE_MISSION_TIME_EPOCH_DAY 1 -#define CFE_MISSION_TIME_EPOCH_HOUR 0 -#define CFE_MISSION_TIME_EPOCH_MINUTE 0 -#define CFE_MISSION_TIME_EPOCH_SECOND 0 - +#define CFE_MISSION_TIME_EPOCH_YEAR 1980 +#define CFE_MISSION_TIME_EPOCH_DAY 1 +#define CFE_MISSION_TIME_EPOCH_HOUR 0 +#define CFE_MISSION_TIME_EPOCH_MINUTE 0 +#define CFE_MISSION_TIME_EPOCH_SECOND 0 /** ** \cfetimecfg Time File System Factor @@ -235,8 +228,7 @@ ** \par Limits ** Not Applicable */ -#define CFE_MISSION_TIME_FS_FACTOR 789004800 - +#define CFE_MISSION_TIME_FS_FACTOR 789004800 /** ** \cfeescfg Maximum Length of CDS Name @@ -253,9 +245,7 @@ ** any possible neighboring fields without implicit padding. ** */ -#define CFE_MISSION_ES_CDS_MAX_NAME_LENGTH 16 - - +#define CFE_MISSION_ES_CDS_MAX_NAME_LENGTH 16 /** ** \cfeevscfg Maximum Event Message Length @@ -269,14 +259,15 @@ ** \par Limits ** Not Applicable */ -#define CFE_MISSION_EVS_MAX_MESSAGE_LENGTH 122 - +#define CFE_MISSION_EVS_MAX_MESSAGE_LENGTH 122 /** \name Checksum/CRC algorithm identifiers */ /** \{ */ -#define CFE_MISSION_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */ -#define CFE_MISSION_ES_CRC_16 2 /**< \brief CRC (16 bit additive - returns 32 bit total) */ -#define CFE_MISSION_ES_CRC_32 3 /**< \brief CRC (32 bit additive - returns 32 bit total) (Currently not implemented) */ +#define CFE_MISSION_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */ +#define CFE_MISSION_ES_CRC_16 2 /**< \brief CRC (16 bit additive - returns 32 bit total) */ +#define CFE_MISSION_ES_CRC_32 \ + 3 /**< \brief CRC (32 bit additive - returns 32 bit total) (Currently not implemented) \ + */ /** \} */ /** @@ -290,8 +281,7 @@ ** \par Limits ** Currently only CFE_MISSION_ES_CRC_16 is supported (see #CFE_MISSION_ES_CRC_16) */ -#define CFE_MISSION_ES_DEFAULT_CRC CFE_MISSION_ES_CRC_16 - +#define CFE_MISSION_ES_DEFAULT_CRC CFE_MISSION_ES_CRC_16 /** ** \cfetblcfg Maximum Table Name Length @@ -307,8 +297,7 @@ ** This value should be kept as a multiple of 4, to maintain alignment of ** any possible neighboring fields without implicit padding. */ -#define CFE_MISSION_TBL_MAX_NAME_LENGTH 16 - +#define CFE_MISSION_TBL_MAX_NAME_LENGTH 16 /** ** \cfemissioncfg cFE Portable Message Numbers for Commands @@ -321,25 +310,24 @@ ** \par Limits ** Not Applicable */ -#define CFE_MISSION_EVS_CMD_MSG 1 - /* Offset 2 is available */ -#define CFE_MISSION_SB_CMD_MSG 3 -#define CFE_MISSION_TBL_CMD_MSG 4 -#define CFE_MISSION_TIME_CMD_MSG 5 -#define CFE_MISSION_ES_CMD_MSG 6 - -#define CFE_MISSION_ES_SEND_HK_MSG 8 -#define CFE_MISSION_EVS_SEND_HK_MSG 9 - /* Offset 10 is available */ -#define CFE_MISSION_SB_SEND_HK_MSG 11 -#define CFE_MISSION_TBL_SEND_HK_MSG 12 -#define CFE_MISSION_TIME_SEND_HK_MSG 13 +#define CFE_MISSION_EVS_CMD_MSG 1 +/* Offset 2 is available */ +#define CFE_MISSION_SB_CMD_MSG 3 +#define CFE_MISSION_TBL_CMD_MSG 4 +#define CFE_MISSION_TIME_CMD_MSG 5 +#define CFE_MISSION_ES_CMD_MSG 6 + +#define CFE_MISSION_ES_SEND_HK_MSG 8 +#define CFE_MISSION_EVS_SEND_HK_MSG 9 +/* Offset 10 is available */ +#define CFE_MISSION_SB_SEND_HK_MSG 11 +#define CFE_MISSION_TBL_SEND_HK_MSG 12 +#define CFE_MISSION_TIME_SEND_HK_MSG 13 #define CFE_MISSION_SB_SUB_RPT_CTRL_MSG 14 -#define CFE_MISSION_TIME_TONE_CMD_MSG 16 -#define CFE_MISSION_TIME_1HZ_CMD_MSG 17 - +#define CFE_MISSION_TIME_TONE_CMD_MSG 16 +#define CFE_MISSION_TIME_1HZ_CMD_MSG 17 /** ** \cfemissioncfg cFE Portable Message Numbers for Global Messages @@ -352,9 +340,8 @@ ** \par Limits ** Not Applicable */ -#define CFE_MISSION_TIME_DATA_CMD_MSG 0 -#define CFE_MISSION_TIME_SEND_CMD_MSG 2 - +#define CFE_MISSION_TIME_DATA_CMD_MSG 0 +#define CFE_MISSION_TIME_SEND_CMD_MSG 2 /** ** \cfemissioncfg cFE Portable Message Numbers for Telemetry @@ -367,22 +354,22 @@ ** \par Limits ** Not Applicable */ -#define CFE_MISSION_ES_HK_TLM_MSG 0 -#define CFE_MISSION_EVS_HK_TLM_MSG 1 - /* Offset 2 is available */ -#define CFE_MISSION_SB_HK_TLM_MSG 3 -#define CFE_MISSION_TBL_HK_TLM_MSG 4 -#define CFE_MISSION_TIME_HK_TLM_MSG 5 -#define CFE_MISSION_TIME_DIAG_TLM_MSG 6 - -#define CFE_MISSION_EVS_LONG_EVENT_MSG_MSG 8 -#define CFE_MISSION_EVS_SHORT_EVENT_MSG_MSG 9 -#define CFE_MISSION_SB_STATS_TLM_MSG 10 -#define CFE_MISSION_ES_APP_TLM_MSG 11 -#define CFE_MISSION_TBL_REG_TLM_MSG 12 -#define CFE_MISSION_SB_ALLSUBS_TLM_MSG 13 -#define CFE_MISSION_SB_ONESUB_TLM_MSG 14 -#define CFE_MISSION_ES_MEMSTATS_TLM_MSG 16 +#define CFE_MISSION_ES_HK_TLM_MSG 0 +#define CFE_MISSION_EVS_HK_TLM_MSG 1 +/* Offset 2 is available */ +#define CFE_MISSION_SB_HK_TLM_MSG 3 +#define CFE_MISSION_TBL_HK_TLM_MSG 4 +#define CFE_MISSION_TIME_HK_TLM_MSG 5 +#define CFE_MISSION_TIME_DIAG_TLM_MSG 6 + +#define CFE_MISSION_EVS_LONG_EVENT_MSG_MSG 8 +#define CFE_MISSION_EVS_SHORT_EVENT_MSG_MSG 9 +#define CFE_MISSION_SB_STATS_TLM_MSG 10 +#define CFE_MISSION_ES_APP_TLM_MSG 11 +#define CFE_MISSION_TBL_REG_TLM_MSG 12 +#define CFE_MISSION_SB_ALLSUBS_TLM_MSG 13 +#define CFE_MISSION_SB_ONESUB_TLM_MSG 14 +#define CFE_MISSION_ES_MEMSTATS_TLM_MSG 16 /** ** \cfeescfg Mission Max Apps in a message @@ -398,7 +385,7 @@ ** Note this affects the size of messages, so it must not cause any message ** to exceed the max length. */ -#define CFE_MISSION_ES_MAX_APPLICATIONS 16 +#define CFE_MISSION_ES_MAX_APPLICATIONS 16 /** ** \cfeescfg Define Max Number of Performance IDs for messages @@ -415,7 +402,7 @@ ** to exceed the max length. ** */ -#define CFE_MISSION_ES_PERF_MAX_IDS 128 +#define CFE_MISSION_ES_PERF_MAX_IDS 128 /** \cfeescfg Maximum number of block sizes in pool structures ** @@ -435,8 +422,8 @@ ** values have not been tested. ** ** - */ -#define CFE_MISSION_ES_POOL_MAX_BUCKETS 17 +*/ +#define CFE_MISSION_ES_POOL_MAX_BUCKETS 17 /** ** \cfetblcfg Maximum Length of Full Table Name in messages @@ -456,7 +443,7 @@ ** This value should be kept as a multiple of 4, to maintain alignment of ** any possible neighboring fields without implicit padding. */ -#define CFE_MISSION_TBL_MAX_FULL_NAME_LEN (CFE_MISSION_TBL_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 4) +#define CFE_MISSION_TBL_MAX_FULL_NAME_LEN (CFE_MISSION_TBL_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 4) /** ** \cfesbcfg Maximum Number of pipes that SB command/telemetry messages may hold @@ -466,15 +453,14 @@ ** ** This affects the layout of command/telemetry messages but does not affect run ** time behavior or internal allocation. -** +** ** \par Limits ** All CPUs within the same SB domain (mission) must share the same definition ** Note this affects the size of messages, so it must not cause any message ** to exceed the max length. ** */ -#define CFE_MISSION_SB_MAX_PIPES 64 - +#define CFE_MISSION_SB_MAX_PIPES 64 /** ** \cfemissioncfg cFE Maximum length for pathnames within data exchange structures @@ -491,7 +477,7 @@ ** internal allocation may use the platform-specific OS_MAX_PATH_LEN value. ** ** This length must include an extra character for NULL termination. -** +** ** \par Limits ** All CPUs within the same SB domain (mission) and ground tools must share the ** same definition. @@ -501,7 +487,7 @@ ** This value should be kept as a multiple of 4, to maintain alignment of ** any possible neighboring fields without implicit padding. */ -#define CFE_MISSION_MAX_PATH_LEN 64 +#define CFE_MISSION_MAX_PATH_LEN 64 /** ** \cfemissioncfg cFE Maximum length for filenames within data exchange structures @@ -528,7 +514,7 @@ ** This value should be kept as a multiple of 4, to maintain alignment of ** any possible neighboring fields without implicit padding. */ -#define CFE_MISSION_MAX_FILE_LEN 20 +#define CFE_MISSION_MAX_FILE_LEN 20 /** ** \cfemissioncfg cFE Maximum length for API names within data exchange structures @@ -554,7 +540,7 @@ ** This value should be kept as a multiple of 4, to maintain alignment of ** any possible neighboring fields without implicit padding. */ -#define CFE_MISSION_MAX_API_LEN 20 +#define CFE_MISSION_MAX_API_LEN 20 /** ** \cfeescfg Maximum Length of Full CDS Name in messages @@ -574,10 +560,6 @@ ** This value should be kept as a multiple of 4, to maintain alignment of ** any possible neighboring fields without implicit padding. */ -#define CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN (CFE_MISSION_ES_CDS_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 4) - - +#define CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN (CFE_MISSION_ES_CDS_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 4) #endif /* _cfe_mission_cfg_ */ - - diff --git a/cmake/sample_defs/sample_perfids.h b/cmake/sample_defs/sample_perfids.h index f721b55a1..3a99b612c 100644 --- a/cmake/sample_defs/sample_perfids.h +++ b/cmake/sample_defs/sample_perfids.h @@ -37,29 +37,25 @@ #ifndef _cfe_perfids_ #define _cfe_perfids_ - -#define CFE_MISSION_ES_PERF_EXIT_BIT 31 /**< \brief bit (31) is reserved by the perf utilities */ +#define CFE_MISSION_ES_PERF_EXIT_BIT 31 /**< \brief bit (31) is reserved by the perf utilities */ /** \name cFE Performance Monitor IDs (Reserved IDs 0-31) */ /** \{ */ -#define CFE_MISSION_ES_MAIN_PERF_ID 1 /**< \brief Performance ID for Executive Services Task */ -#define CFE_MISSION_EVS_MAIN_PERF_ID 2 /**< \brief Performance ID for Events Services Task */ -#define CFE_MISSION_TBL_MAIN_PERF_ID 3 /**< \brief Performance ID for Table Services Task */ -#define CFE_MISSION_SB_MAIN_PERF_ID 4 /**< \brief Performance ID for Software Bus Services Task */ -#define CFE_MISSION_SB_MSG_LIM_PERF_ID 5 /**< \brief Performance ID for Software Bus Msg Limit Errors */ -#define CFE_MISSION_SB_PIPE_OFLOW_PERF_ID 27 /**< \brief Performance ID for Software Bus Pipe Overflow Errors */ - +#define CFE_MISSION_ES_MAIN_PERF_ID 1 /**< \brief Performance ID for Executive Services Task */ +#define CFE_MISSION_EVS_MAIN_PERF_ID 2 /**< \brief Performance ID for Events Services Task */ +#define CFE_MISSION_TBL_MAIN_PERF_ID 3 /**< \brief Performance ID for Table Services Task */ +#define CFE_MISSION_SB_MAIN_PERF_ID 4 /**< \brief Performance ID for Software Bus Services Task */ +#define CFE_MISSION_SB_MSG_LIM_PERF_ID 5 /**< \brief Performance ID for Software Bus Msg Limit Errors */ +#define CFE_MISSION_SB_PIPE_OFLOW_PERF_ID 27 /**< \brief Performance ID for Software Bus Pipe Overflow Errors */ -#define CFE_MISSION_TIME_MAIN_PERF_ID 6 /**< \brief Performance ID for Time Services Task */ -#define CFE_MISSION_TIME_TONE1HZISR_PERF_ID 7 /**< \brief Performance ID for 1 Hz Tone ISR */ -#define CFE_MISSION_TIME_LOCAL1HZISR_PERF_ID 8 /**< \brief Performance ID for 1 Hz Local ISR */ - -#define CFE_MISSION_TIME_SENDMET_PERF_ID 9 /**< \brief Performance ID for Time ToneSendMET */ -#define CFE_MISSION_TIME_LOCAL1HZTASK_PERF_ID 10 /**< \brief Performance ID for 1 Hz Local Task */ -#define CFE_MISSION_TIME_TONE1HZTASK_PERF_ID 11 /**< \brief Performance ID for 1 Hz Tone Task */ +#define CFE_MISSION_TIME_MAIN_PERF_ID 6 /**< \brief Performance ID for Time Services Task */ +#define CFE_MISSION_TIME_TONE1HZISR_PERF_ID 7 /**< \brief Performance ID for 1 Hz Tone ISR */ +#define CFE_MISSION_TIME_LOCAL1HZISR_PERF_ID 8 /**< \brief Performance ID for 1 Hz Local ISR */ +#define CFE_MISSION_TIME_SENDMET_PERF_ID 9 /**< \brief Performance ID for Time ToneSendMET */ +#define CFE_MISSION_TIME_LOCAL1HZTASK_PERF_ID 10 /**< \brief Performance ID for 1 Hz Local Task */ +#define CFE_MISSION_TIME_TONE1HZTASK_PERF_ID 11 /**< \brief Performance ID for 1 Hz Tone Task */ /** \} */ - -#endif /* _cfe_perfids_ */ +#endif /* _cfe_perfids_ */ diff --git a/cmake/target/inc/target_config.h b/cmake/target/inc/target_config.h index dd05c1706..a256315bd 100644 --- a/cmake/target/inc/target_config.h +++ b/cmake/target/inc/target_config.h @@ -49,7 +49,6 @@ typedef void (*System_MainFunc_t)(uint32 StartType, uint32 StartSubtype, uint32 */ typedef void (*System_1HzISRFunc_t)(void); - /** * Prototype for notification function implemented in CFE ES * The PSP should call this when exceptions occur. @@ -72,8 +71,8 @@ typedef const void CFE_StaticModuleApi_t; */ typedef const struct { - const char *Name; - CFE_StaticModuleApi_t *Api; + const char * Name; + CFE_StaticModuleApi_t *Api; } CFE_StaticModuleLoadEntry_t; /** @@ -85,7 +84,6 @@ typedef const struct const char *Name; } CFE_ConfigName_t; - /** * A record containing a configuration key-value pair * The data are simple strings defined at compile time, and @@ -102,44 +100,44 @@ typedef const struct */ typedef const struct { - /** - * 1Hz ISR entry point. Called from PSP once per second on HW clock. - */ - System_1HzISRFunc_t System1HzISR; - - /** - * Main CFE entry point. Called from PSP startup code. - */ - System_MainFunc_t SystemMain; - - /** - * Notification function. Called from PSP after async event handling. - */ - System_NotifyFunc_t SystemNotify; - - /* - * Sizes of memory segments required by the CFE based on the current config - */ - uint32 CdsSize; /***< CDS segment size */ - uint32 ResetAreaSize; /***< Reset area segment size */ - uint32 UserReservedSize; /***< User reserved area segment size */ - uint32 RamDiskSectorSize; /***< RAM disk sector size */ - uint32 RamDiskTotalSectors; /***< RAM disk number of sectors */ - - /** - * Default value for nonvolatile file system mount point - */ - const char *NonvolMountPoint; - - /** - * Default value for volatile file system mount point - */ - const char *RamdiskMountPoint; - - /** - * File name of startup script - */ - const char *NonvolStartupFile; + /** + * 1Hz ISR entry point. Called from PSP once per second on HW clock. + */ + System_1HzISRFunc_t System1HzISR; + + /** + * Main CFE entry point. Called from PSP startup code. + */ + System_MainFunc_t SystemMain; + + /** + * Notification function. Called from PSP after async event handling. + */ + System_NotifyFunc_t SystemNotify; + + /* + * Sizes of memory segments required by the CFE based on the current config + */ + uint32 CdsSize; /***< CDS segment size */ + uint32 ResetAreaSize; /***< Reset area segment size */ + uint32 UserReservedSize; /***< User reserved area segment size */ + uint32 RamDiskSectorSize; /***< RAM disk sector size */ + uint32 RamDiskTotalSectors; /***< RAM disk number of sectors */ + + /** + * Default value for nonvolatile file system mount point + */ + const char *NonvolMountPoint; + + /** + * Default value for volatile file system mount point + */ + const char *RamdiskMountPoint; + + /** + * File name of startup script + */ + const char *NonvolStartupFile; } Target_CfeConfigData; @@ -160,7 +158,7 @@ extern Target_CfeConfigData GLOBAL_CFE_CONFIGDATA; */ typedef const struct { - const char *MissionName; /**< The Mission Name from confguration */ + const char *MissionName; /**< The Mission Name from confguration */ /* * Note: the version strings in these fields should reflect the administratively-assigned @@ -175,38 +173,40 @@ typedef const struct const char *CfeVersion; /**< Version string from CFE source tree at build time */ const char *OsalVersion; /**< Version string from OSAL source tree at build time */ - const char *Config; /**< Configuration used for build */ + const char *Config; /**< Configuration used for build */ /* * Note: date and user info have been moved into the BuildEnvironment below, * but these members must exist in this structure (for now) for compatibility. * These pointers will be NULL at runtime. */ - const char *Date; /**< Not set. Get value from BuildEnvironment instead. */ - const char *User; /**< Not set. Get value from BuildEnvironment instead. */ + const char *Date; /**< Not set. Get value from BuildEnvironment instead. */ + const char *User; /**< Not set. Get value from BuildEnvironment instead. */ /* * Default values for CPU ID and CPU Name */ - const char *Default_CpuName; /**< Compile-time value for CPU name */ - uint16 Default_CpuId; /**< Compile-time value for CPU number */ - uint16 Default_SpacecraftId; /**< Compile-time value for Spacecraft ID (mission-wide) */ + const char *Default_CpuName; /**< Compile-time value for CPU name */ + uint16 Default_CpuId; /**< Compile-time value for CPU number */ + uint16 Default_SpacecraftId; /**< Compile-time value for Spacecraft ID (mission-wide) */ const char *Default_ModuleExtension; /**< Default system extension for dynamic modules */ const char *Default_CoreFilename; /**< Default file name for CFE core executable/library */ - Target_CfeConfigData *CfeConfig; /**< CFE configuration sub-structure */ - Target_PspConfigData *PspConfig; /**< PSP configuration sub-structure */ - CFE_StaticModuleLoadEntry_t *PspModuleList; /**< List of PSP modules (API structures) statically linked into the core EXE */ + Target_CfeConfigData *CfeConfig; /**< CFE configuration sub-structure */ + Target_PspConfigData *PspConfig; /**< PSP configuration sub-structure */ + CFE_StaticModuleLoadEntry_t + *PspModuleList; /**< List of PSP modules (API structures) statically linked into the core EXE */ - CFE_ConfigKeyValue_t *BuildEnvironment; /**< Environment details of build system at the last time CFE core was built */ + CFE_ConfigKeyValue_t + *BuildEnvironment; /**< Environment details of build system at the last time CFE core was built */ CFE_ConfigKeyValue_t *ModuleVersionList; /**< List of module versions at the last time CFE core was built */ - CFE_ConfigName_t *CoreModuleList; /**< List of CFE core support module names that are statically linked */ - CFE_ConfigName_t *StaticAppList; /**< List of additional CFS Applications that are statically linked into this binary */ + CFE_ConfigName_t * CoreModuleList; /**< List of CFE core support module names that are statically linked */ + CFE_ConfigName_t + *StaticAppList; /**< List of additional CFS Applications that are statically linked into this binary */ } Target_ConfigData; - /** * Extern reference to global config struct. * This object is always instantiated within this module diff --git a/cmake/target/src/target_config.c b/cmake/target/src/target_config.c index d9d95f88b..03f58796d 100644 --- a/cmake/target/src/target_config.c +++ b/cmake/target/src/target_config.c @@ -38,28 +38,27 @@ #include "cfe_es.h" #include "cfe_time.h" #include "cfe_es_resetdata_typedef.h" -#include "cfe_version.h" /* for CFE_VERSION_STRING */ -#include "osapi-version.h" /* for OS_VERSION_STRING */ - +#include "cfe_version.h" /* for CFE_VERSION_STRING */ +#include "osapi-version.h" /* for OS_VERSION_STRING */ #ifndef CFE_CPU_NAME_VALUE -#define CFE_CPU_NAME_VALUE "unknown" +#define CFE_CPU_NAME_VALUE "unknown" #endif #ifndef CFE_CPU_ID_VALUE -#define CFE_CPU_ID_VALUE 0 +#define CFE_CPU_ID_VALUE 0 #endif #ifndef CFE_SPACECRAFT_ID_VALUE -#define CFE_SPACECRAFT_ID_VALUE 0x42 +#define CFE_SPACECRAFT_ID_VALUE 0x42 #endif #ifndef CFE_DEFAULT_MODULE_EXTENSION -#define CFE_DEFAULT_MODULE_EXTENSION "" +#define CFE_DEFAULT_MODULE_EXTENSION "" #endif #ifndef CFE_DEFAULT_CORE_FILENAME -#define CFE_DEFAULT_CORE_FILENAME "" +#define CFE_DEFAULT_CORE_FILENAME "" #endif /* @@ -68,8 +67,8 @@ * the data, which is then compiled and linked with this file. */ -extern const char CFE_MISSION_NAME[]; /**< Name of CFE mission */ -extern const char CFE_MISSION_CONFIG[]; /**< Configuration name used for build */ +extern const char CFE_MISSION_NAME[]; /**< Name of CFE mission */ +extern const char CFE_MISSION_CONFIG[]; /**< Configuration name used for build */ /** * A list of modules which are statically linked into CFE core. @@ -130,36 +129,33 @@ extern CFE_ConfigKeyValue_t CFE_MODULE_VERSION_TABLE[]; */ extern CFE_StaticModuleLoadEntry_t CFE_PSP_MODULE_LIST[]; - /** * A structure that encapsulates all the CFE static configuration */ -Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = -{ - /* - * Entry points to CFE code called by the PSP - */ - .System1HzISR = CFE_TIME_Local1HzISR, - .SystemMain = CFE_ES_Main, - .SystemNotify = CFE_ES_ProcessAsyncEvent, - - /* - * Default values for various file paths - */ - .NonvolMountPoint = CFE_PLATFORM_ES_NONVOL_DISK_MOUNT_STRING, - .RamdiskMountPoint = CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING, - .NonvolStartupFile = CFE_PLATFORM_ES_NONVOL_STARTUP_FILE, - - /* - * Sizes of other memory segments - */ - .CdsSize = CFE_PLATFORM_ES_CDS_SIZE, - .ResetAreaSize = sizeof(CFE_ES_ResetData_t), - .UserReservedSize = CFE_PLATFORM_ES_USER_RESERVED_SIZE, - - .RamDiskSectorSize = CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, - .RamDiskTotalSectors = CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS -}; +Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { + /* + * Entry points to CFE code called by the PSP + */ + .System1HzISR = CFE_TIME_Local1HzISR, + .SystemMain = CFE_ES_Main, + .SystemNotify = CFE_ES_ProcessAsyncEvent, + + /* + * Default values for various file paths + */ + .NonvolMountPoint = CFE_PLATFORM_ES_NONVOL_DISK_MOUNT_STRING, + .RamdiskMountPoint = CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING, + .NonvolStartupFile = CFE_PLATFORM_ES_NONVOL_STARTUP_FILE, + + /* + * Sizes of other memory segments + */ + .CdsSize = CFE_PLATFORM_ES_CDS_SIZE, + .ResetAreaSize = sizeof(CFE_ES_ResetData_t), + .UserReservedSize = CFE_PLATFORM_ES_USER_RESERVED_SIZE, + + .RamDiskSectorSize = CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, + .RamDiskTotalSectors = CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS}; /** * Instantiation of global system-wide configuration struct @@ -167,23 +163,21 @@ Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = * configuration structures. Everything will be linked together * in the final executable. */ -Target_ConfigData GLOBAL_CONFIGDATA = -{ - .MissionName = CFE_MISSION_NAME, - .CfeVersion = CFE_SRC_VERSION, - .OsalVersion = OS_VERSION, - .Config = CFE_MISSION_CONFIG, - .Default_CpuName = CFE_CPU_NAME_VALUE, - .Default_CpuId = CFE_CPU_ID_VALUE, - .Default_SpacecraftId = CFE_SPACECRAFT_ID_VALUE, - .Default_ModuleExtension = CFE_DEFAULT_MODULE_EXTENSION, - .Default_CoreFilename = CFE_DEFAULT_CORE_FILENAME, - .CfeConfig = &GLOBAL_CFE_CONFIGDATA, - .PspConfig = &GLOBAL_PSP_CONFIGDATA, - .PspModuleList = CFE_PSP_MODULE_LIST, - .BuildEnvironment = CFE_BUILD_ENV_TABLE, - .ModuleVersionList = CFE_MODULE_VERSION_TABLE, - .CoreModuleList = CFE_CORE_MODULE_LIST, - .StaticAppList = CFE_STATIC_APP_LIST, +Target_ConfigData GLOBAL_CONFIGDATA = { + .MissionName = CFE_MISSION_NAME, + .CfeVersion = CFE_SRC_VERSION, + .OsalVersion = OS_VERSION, + .Config = CFE_MISSION_CONFIG, + .Default_CpuName = CFE_CPU_NAME_VALUE, + .Default_CpuId = CFE_CPU_ID_VALUE, + .Default_SpacecraftId = CFE_SPACECRAFT_ID_VALUE, + .Default_ModuleExtension = CFE_DEFAULT_MODULE_EXTENSION, + .Default_CoreFilename = CFE_DEFAULT_CORE_FILENAME, + .CfeConfig = &GLOBAL_CFE_CONFIGDATA, + .PspConfig = &GLOBAL_PSP_CONFIGDATA, + .PspModuleList = CFE_PSP_MODULE_LIST, + .BuildEnvironment = CFE_BUILD_ENV_TABLE, + .ModuleVersionList = CFE_MODULE_VERSION_TABLE, + .CoreModuleList = CFE_CORE_MODULE_LIST, + .StaticAppList = CFE_STATIC_APP_LIST, }; - diff --git a/modules/cfe_testcase/src/es_test.c b/modules/cfe_testcase/src/es_test.c index f98f7bf2d..f4cef1f40 100644 --- a/modules/cfe_testcase/src/es_test.c +++ b/modules/cfe_testcase/src/es_test.c @@ -36,7 +36,7 @@ void ES_Test_AppId(void) { CFE_ES_AppId_t AppId; - char AppNameBuf[OS_MAX_API_NAME + 4]; + char AppNameBuf[OS_MAX_API_NAME + 4]; UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, AppId, sizeof(AppNameBuf)), CFE_SUCCESS); diff --git a/modules/core_api/fsw/inc/cfe.h b/modules/core_api/fsw/inc/cfe.h index d3a62f206..41a6700ea 100644 --- a/modules/core_api/fsw/inc/cfe.h +++ b/modules/core_api/fsw/inc/cfe.h @@ -39,24 +39,24 @@ #ifndef CFE_H #define CFE_H -#include "common_types.h" /* Define basic data types */ +#include "common_types.h" /* Define basic data types */ -#include "osapi.h" /* Define OS API function prototypes */ +#include "osapi.h" /* Define OS API function prototypes */ -#include "cfe_mission_cfg.h" /* Define mission configuration parameters */ +#include "cfe_mission_cfg.h" /* Define mission configuration parameters */ -#include "cfe_error.h" /* Define common cFE error codes */ +#include "cfe_error.h" /* Define common cFE error codes */ -#include "cfe_es.h" /* Define Executive Service API */ -#include "cfe_evs.h" /* Define Event Service API */ -#include "cfe_fs.h" /* Define File Service API */ -#include "cfe_sb.h" /* Define Software Bus API */ -#include "cfe_time.h" /* Define Time Service API */ -#include "cfe_tbl.h" /* Define Table Service API */ +#include "cfe_es.h" /* Define Executive Service API */ +#include "cfe_evs.h" /* Define Event Service API */ +#include "cfe_fs.h" /* Define File Service API */ +#include "cfe_sb.h" /* Define Software Bus API */ +#include "cfe_time.h" /* Define Time Service API */ +#include "cfe_tbl.h" /* Define Table Service API */ -#include "cfe_msg.h" /* Define Message API */ -#include "cfe_resourceid.h" /* Define ResourceID API */ +#include "cfe_msg.h" /* Define Message API */ +#include "cfe_resourceid.h" /* Define ResourceID API */ -#include "cfe_psp.h" /* Define Platform Support Package API */ +#include "cfe_psp.h" /* Define Platform Support Package API */ -#endif /* CFE_H */ +#endif /* CFE_H */ diff --git a/modules/core_api/fsw/inc/cfe_endian.h b/modules/core_api/fsw/inc/cfe_endian.h index b43af6cbb..fd425c40a 100644 --- a/modules/core_api/fsw/inc/cfe_endian.h +++ b/modules/core_api/fsw/inc/cfe_endian.h @@ -34,14 +34,14 @@ */ #include "common_types.h" - /* Macro to convert 16/32 bit types from platform "endianness" to Big Endian */ #ifdef SOFTWARE_BIG_BIT_ORDER - #define CFE_MAKE_BIG16(n) (n) - #define CFE_MAKE_BIG32(n) (n) +#define CFE_MAKE_BIG16(n) (n) +#define CFE_MAKE_BIG32(n) (n) #else - #define CFE_MAKE_BIG16(n) ( (((n) << 8) & 0xFF00) | (((n) >> 8) & 0x00FF) ) - #define CFE_MAKE_BIG32(n) ( (((n) << 24) & 0xFF000000) | (((n) << 8) & 0x00FF0000) | (((n) >> 8) & 0x0000FF00) | (((n) >> 24) & 0x000000FF) ) +#define CFE_MAKE_BIG16(n) ((((n) << 8) & 0xFF00) | (((n) >> 8) & 0x00FF)) +#define CFE_MAKE_BIG32(n) \ + ((((n) << 24) & 0xFF000000) | (((n) << 8) & 0x00FF0000) | (((n) >> 8) & 0x0000FF00) | (((n) >> 24) & 0x000000FF)) #endif -#endif /* CFE_ENDIAN_H */ +#endif /* CFE_ENDIAN_H */ diff --git a/modules/core_api/fsw/inc/cfe_error.h b/modules/core_api/fsw/inc/cfe_error.h index 657bbc98b..2e9331e0a 100644 --- a/modules/core_api/fsw/inc/cfe_error.h +++ b/modules/core_api/fsw/inc/cfe_error.h @@ -93,21 +93,21 @@ typedef int32 CFE_Status_t; #define CFE_SEVERITY_BITMASK ((CFE_Status_t)0xc0000000) /**< @brief Error Severity Bitmask */ #define CFE_SEVERITY_SUCCESS ((CFE_Status_t)0x00000000) /**< @brief Severity Success */ -#define CFE_SEVERITY_INFO ((CFE_Status_t)0x40000000) /**< @brief Severity Info */ -#define CFE_SEVERITY_ERROR ((CFE_Status_t)0xc0000000) /**< @brief Severity Error */ +#define CFE_SEVERITY_INFO ((CFE_Status_t)0x40000000) /**< @brief Severity Info */ +#define CFE_SEVERITY_ERROR ((CFE_Status_t)0xc0000000) /**< @brief Severity Error */ /* ** cFE Service Identifiers */ #define CFE_SERVICE_BITMASK ((CFE_Status_t)0x0e000000) /**< @brief Error Service Bitmask */ -#define CFE_EVENTS_SERVICE ((CFE_Status_t)0x02000000) /**< @brief Event Service */ -#define CFE_EXECUTIVE_SERVICE ((CFE_Status_t)0x04000000) /**< @brief Executive Service */ -#define CFE_FILE_SERVICE ((CFE_Status_t)0x06000000) /**< @brief File Service */ -#define CFE_GENERIC_SERVICE ((CFE_Status_t)0x08000000) /**< @brief Generic Service */ +#define CFE_EVENTS_SERVICE ((CFE_Status_t)0x02000000) /**< @brief Event Service */ +#define CFE_EXECUTIVE_SERVICE ((CFE_Status_t)0x04000000) /**< @brief Executive Service */ +#define CFE_FILE_SERVICE ((CFE_Status_t)0x06000000) /**< @brief File Service */ +#define CFE_GENERIC_SERVICE ((CFE_Status_t)0x08000000) /**< @brief Generic Service */ #define CFE_SOFTWARE_BUS_SERVICE ((CFE_Status_t)0x0a000000) /**< @brief Software Bus Service */ -#define CFE_TABLE_SERVICE ((CFE_Status_t)0x0c000000) /**< @brief Table Service */ -#define CFE_TIME_SERVICE ((CFE_Status_t)0x0e000000) /**< @brief Time Service */ +#define CFE_TABLE_SERVICE ((CFE_Status_t)0x0c000000) /**< @brief Table Service */ +#define CFE_TIME_SERVICE ((CFE_Status_t)0x0e000000) /**< @brief Time Service */ /* ************* COMMON STATUS CODES ************* @@ -164,7 +164,7 @@ typedef int32 CFE_Status_t; * * This error indicates that the operation failed for * some reason outside the scope of CFE. The real failure may - * have been in OSAL, PSP, or another dependent library. + * have been in OSAL, PSP, or another dependent library. * * Details of the original failure should be written to syslog * and/or a system event before returning this error. @@ -178,7 +178,7 @@ typedef int32 CFE_Status_t; * limit has been reached. No more requests can be made until * the current request(s) complete. */ -#define CFE_STATUS_REQUEST_ALREADY_PENDING ((int32)0xc8000006) +#define CFE_STATUS_REQUEST_ALREADY_PENDING ((int32)0xc8000006) /** * @brief Not Implemented @@ -352,7 +352,7 @@ typedef int32 CFE_Status_t; */ #define CFE_ES_BAD_ARGUMENT ((CFE_Status_t)0xc400000a) -/** +/** * @brief Child Task Register Error * * Errors occured when trying to register a child task. @@ -360,7 +360,7 @@ typedef int32 CFE_Status_t; */ #define CFE_ES_ERR_CHILD_TASK_REGISTER ((CFE_Status_t)0xc400000b) -/** +/** * @brief Shell Command Error * * Error occured ehen trying to pass a system call to the OS shell @@ -539,9 +539,9 @@ typedef int32 CFE_Status_t; /** * @brief Application Cleanup Error * - * Occurs when an attempt was made to Clean Up an application + * Occurs when an attempt was made to Clean Up an application * which involves calling Table, EVS, and SB cleanup functions, then - * deleting all ES resources, child tasks, and unloading the + * deleting all ES resources, child tasks, and unloading the * object module. The approach here is to keep going even though one * of these steps had an error. There will be syslog messages detailing * each problem. @@ -656,7 +656,7 @@ typedef int32 CFE_Status_t; /** * @brief Bad Argument * - * A parameter given by a caller to a File Services API did not pass + * A parameter given by a caller to a File Services API did not pass * validation checks. * */ @@ -714,7 +714,7 @@ typedef int32 CFE_Status_t; /** * @brief Bad Argument * - * A parameter given by a caller to a Software Bus API did not pass + * A parameter given by a caller to a Software Bus API did not pass * validation checks. * */ @@ -723,9 +723,9 @@ typedef int32 CFE_Status_t; /** * @brief Max Pipes Met * - * This error code will be returned from #CFE_SB_CreatePipe when the - * SB cannot accomodate the request to create a pipe because the maximum - * number of pipes (#CFE_PLATFORM_SB_MAX_PIPES) are in use. This configuration + * This error code will be returned from #CFE_SB_CreatePipe when the + * SB cannot accomodate the request to create a pipe because the maximum + * number of pipes (#CFE_PLATFORM_SB_MAX_PIPES) are in use. This configuration * parameter is defined in the cfe_platform_cfg.h file. * */ @@ -734,10 +734,10 @@ typedef int32 CFE_Status_t; /** * @brief Pipe Create Error * - * The maximum number of queues(#OS_MAX_QUEUES) are in use. Or possibly a + * The maximum number of queues(#OS_MAX_QUEUES) are in use. Or possibly a * lower level problem with creating the underlying queue has occurred - * such as a lack of memory. If the latter is the problem, the status - * code displayed in the event must be tracked. + * such as a lack of memory. If the latter is the problem, the status + * code displayed in the event must be tracked. * */ #define CFE_SB_PIPE_CR_ERR ((CFE_Status_t)0xca000005) @@ -746,7 +746,7 @@ typedef int32 CFE_Status_t; * @brief Pipe Read Error * * This return value indicates an error at the Queue read level. This - * error typically cannot be corrected by the caller. Some possible + * error typically cannot be corrected by the caller. Some possible * causes are: queue was not properly initialized or created, the number * of bytes read from the queue was not the number of bytes requested in * the read. The queue id is invalid. Similar errors regarding the pipe @@ -758,8 +758,8 @@ typedef int32 CFE_Status_t; /** * @brief Message Too Big * - * The size field in the message header indicates the message exceeds the - * max Software Bus message size. The max size is defined by + * The size field in the message header indicates the message exceeds the + * max Software Bus message size. The max size is defined by * configuration parameter #CFE_MISSION_SB_MAX_SB_MSG_SIZE in cfe_mission_cfg.h * */ @@ -770,9 +770,9 @@ typedef int32 CFE_Status_t; * * 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 + * #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 * a Software Bus command to send the SB statistics packet. * */ @@ -792,9 +792,9 @@ typedef int32 CFE_Status_t; * @brief Max Destinations Met * * Will be returned when calling one of the SB subscription API's if the - * SB routing table cannot accomodate another destination for a - * particular the given message ID. This occurs when the number of - * destinations in use meets the platform configuration parameter + * SB routing table cannot accomodate another destination for a + * particular the given message ID. This occurs when the number of + * destinations in use meets the platform configuration parameter * #CFE_PLATFORM_SB_MAX_DEST_PER_PKT. * */ @@ -812,8 +812,8 @@ typedef int32 CFE_Status_t; /** * @brief Internal Error * - * This error code will be returned by the #CFE_SB_Subscribe API if the - * code detects an internal index is out of range. The most likely + * This error code will be returned by the #CFE_SB_Subscribe API if the + * code detects an internal index is out of range. The most likely * cause would be a Single Event Upset. * */ @@ -841,7 +841,7 @@ typedef int32 CFE_Status_t; /** * @brief No Message Recieved * - * When trying to determine the last senders ID, this return + * When trying to determine the last senders ID, this return * value indicates that there was not a message recived on the pipe. * */ @@ -872,7 +872,7 @@ typedef int32 CFE_Status_t; */ #define CFE_TBL_ERR_INVALID_HANDLE ((CFE_Status_t)0xcc000001) -/** +/** * @brief Invalid Name * * The calling Application attempted to register a table whose @@ -922,7 +922,7 @@ typedef int32 CFE_Status_t; * @brief Duplicate Warning * * This is an error that the registration is trying to replace - * an existing table with the same name. The previous table + * an existing table with the same name. The previous table * stays in place and the new table is rejected. * */ @@ -1230,7 +1230,7 @@ typedef int32 CFE_Status_t; * contents were discovered in the Critical Data Store. The discovered * contents were copied back into the newly registered table as the * table's initial contents.
- * \b NOTE: In this situation, the contents of the table are \b NOT + * \b NOTE: In this situation, the contents of the table are \b NOT * validated using the table's validation function. * */ @@ -1276,16 +1276,16 @@ typedef int32 CFE_Status_t; ** Error code indicating that the TBL file could not be ** opened by the OS. */ -#define CFE_TBL_ERR_ACCESS ((CFE_Status_t)0xcc00002c) +#define CFE_TBL_ERR_ACCESS ((CFE_Status_t)0xcc00002c) /** * @brief Bad Argument * - * A parameter given by a caller to a Table API did not pass + * A parameter given by a caller to a Table API did not pass * validation checks. * */ -#define CFE_TBL_BAD_ARGUMENT ((CFE_Status_t)0xcc00002d) +#define CFE_TBL_BAD_ARGUMENT ((CFE_Status_t)0xcc00002d) /** * @brief Not Implemented @@ -1364,19 +1364,19 @@ typedef int32 CFE_Status_t; /** * @brief Bad Argument * - * A parameter given by a caller to a TIME Services API did not pass + * A parameter given by a caller to a TIME Services API did not pass * validation checks. * */ -#define CFE_TIME_BAD_ARGUMENT ((CFE_Status_t)0xce000005) +#define CFE_TIME_BAD_ARGUMENT ((CFE_Status_t)0xce000005) /**@}*/ /* Compatibility for error names which have been updated */ #ifndef CFE_OMIT_DEPRECATED_6_8 -#define CFE_ES_ERR_TASKID CFE_ES_ERR_RESOURCEID_NOT_VALID -#define CFE_ES_ERR_APPID CFE_ES_ERR_RESOURCEID_NOT_VALID -#define CFE_ES_ERR_MEM_HANDLE CFE_ES_ERR_RESOURCEID_NOT_VALID -#define CFE_ES_ERR_APPNAME CFE_ES_ERR_NAME_NOT_FOUND +#define CFE_ES_ERR_TASKID CFE_ES_ERR_RESOURCEID_NOT_VALID +#define CFE_ES_ERR_APPID CFE_ES_ERR_RESOURCEID_NOT_VALID +#define CFE_ES_ERR_MEM_HANDLE CFE_ES_ERR_RESOURCEID_NOT_VALID +#define CFE_ES_ERR_APPNAME CFE_ES_ERR_NAME_NOT_FOUND #define CFE_ES_CDS_NOT_FOUND_ERR CFE_ES_ERR_NAME_NOT_FOUND #define CFE_ES_CDS_REGISTRY_FULL CFE_ES_NO_RESOURCE_IDS_AVAILABLE #endif diff --git a/modules/core_api/fsw/inc/cfe_es.h b/modules/core_api/fsw/inc/cfe_es.h index ed4df5b3d..d69d4ef02 100644 --- a/modules/core_api/fsw/inc/cfe_es.h +++ b/modules/core_api/fsw/inc/cfe_es.h @@ -36,30 +36,29 @@ #define CFE_ES_API_H /* -** Includes +** Includes */ #include "common_types.h" #include "cfe_error.h" #include "cfe_es_api_typedefs.h" - -/* +/* ** The OS_PRINTF macro may be defined by OSAL to enable ** printf-style argument checking. If using a version of OSAL ** that does not define this then define it as a no-op. */ #ifndef OS_PRINTF -#define OS_PRINTF(m,n) +#define OS_PRINTF(m, n) #endif /* ** Macro Definitions */ -#define CFE_ES_DBIT(x) (1L << (x)) /* Places a one at bit positions 0 thru 31 */ -#define CFE_ES_DTEST(i,x) (((i) & CFE_ES_DBIT(x)) != 0) /* true iff bit x of i is set */ -#define CFE_ES_TEST_LONG_MASK(m,s) (CFE_ES_DTEST(m[(s)/32],(s)%32)) /* Test a bit within an array of 32-bit integers. */ - +#define CFE_ES_DBIT(x) (1L << (x)) /* Places a one at bit positions 0 thru 31 */ +#define CFE_ES_DTEST(i, x) (((i)&CFE_ES_DBIT(x)) != 0) /* true iff bit x of i is set */ +#define CFE_ES_TEST_LONG_MASK(m, s) \ + (CFE_ES_DTEST(m[(s) / 32], (s) % 32)) /* Test a bit within an array of 32-bit integers. */ /*****************************************************************************/ /* @@ -174,7 +173,6 @@ CFE_Status_t CFE_ES_CounterID_ToIndex(CFE_ES_CounterId_t CounterID, uint32 *Idx) /** @} */ - /*****************************************************************************/ /** @defgroup CFEAPIESEntryExit cFE Entry/Exit APIs @@ -204,7 +202,7 @@ CFE_Status_t CFE_ES_CounterID_ToIndex(CFE_ES_CounterId_t CounterID, uint32 *Idx) ** \sa #CFE_ES_ResetCFE ** ******************************************************************************/ -void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId , const char *StartFilePath ); +void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const char *StartFilePath); /*****************************************************************************/ /** @@ -219,8 +217,9 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId , const ch ** None ** ** \param[in] ResetType Identifies the type of reset desired. Allowable settings are: -** \arg #CFE_PSP_RST_TYPE_POWERON - Causes all memory to be cleared -** \arg #CFE_PSP_RST_TYPE_PROCESSOR - Attempts to retain volatile disk, critical data store and user reserved memory. +** \arg #CFE_PSP_RST_TYPE_POWERON - Causes all memory to be cleared +** \arg #CFE_PSP_RST_TYPE_PROCESSOR - Attempts to retain volatile disk, critical data store +** and user reserved memory. ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -230,7 +229,7 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId , const ch ** \sa #CFE_ES_Main ** ******************************************************************************/ -CFE_Status_t CFE_ES_ResetCFE(uint32 ResetType); +CFE_Status_t CFE_ES_ResetCFE(uint32 ResetType); /**@}*/ /** @defgroup CFEAPIESAppControl cFE Application Control APIs @@ -340,14 +339,13 @@ CFE_Status_t CFE_ES_DeleteApp(CFE_ES_AppId_t AppID); \arg #CFE_ES_RunStatus_APP_ERROR - \copybrief CFE_ES_RunStatus_APP_ERROR \arg #CFE_ES_RunStatus_CORE_APP_INIT_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_INIT_ERROR \arg #CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR -** +** ** ** \sa #CFE_ES_RunLoop, #CFE_ES_RegisterApp ** ******************************************************************************/ void CFE_ES_ExitApp(uint32 ExitStatus); - /*****************************************************************************/ /** ** \brief Check for Exit, Restart, or Reload commands @@ -423,14 +421,14 @@ CFE_Status_t CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMill ** \par Assumptions, External Events, and Notes: ** This API should only be called as the last item of an Apps initialization. ** In addition, this API should only be called by an App that is started -** from the ES Startup file. It should not be used by an App that is +** from the ES Startup file. It should not be used by an App that is ** started after the system is running. ( Although it will cause no harm ) ** ** \param[in] TimeOutMilliseconds The timeout value in Milliseconds. ** This parameter must be at least 1000. Lower values -** will be rounded up. There is not an option to +** will be rounded up. There is not an option to ** wait indefinitely to avoid hanging a critical -** application because a non-critical app did not start. +** application because a non-critical app did not start. ** ** ** \sa #CFE_ES_RunLoop @@ -473,7 +471,7 @@ CFE_Status_t CFE_ES_RegisterApp(void); ** \sa #CFE_ES_RunLoop ** ******************************************************************************/ -void CFE_ES_IncrementTaskCounter(void); +void CFE_ES_IncrementTaskCounter(void); /**@}*/ /** @defgroup CFEAPIESInfo cFE Information APIs @@ -494,8 +492,10 @@ void CFE_ES_IncrementTaskCounter(void); ** None ** ** \param[in, out] ResetSubtypePtr Pointer to \c uint32 type variable in which the Reset Sub-Type will be stored. -** The caller can set this pointer to NULL if the Sub-Type is of no interest. \n *ResetSubtypePtr If the provided pointer was not \c NULL, the Reset Sub-Type is stored at the given address. -** For a list of possible Sub-Type values, see \link #CFE_PSP_RST_SUBTYPE_POWER_CYCLE "Reset Sub-Types" \endlink. +** The caller can set this pointer to NULL if the Sub-Type is of no interest. \n +** ResetSubtypePtr If the provided pointer was not \c NULL, the Reset Sub-Type is +** stored at the given address. For a list of possible Sub-Type values, see \link +** #CFE_PSP_RST_SUBTYPE_POWER_CYCLE "Reset Sub-Types" \endlink. ** ** ** \return Processor reset type @@ -512,7 +512,7 @@ int32 CFE_ES_GetResetType(uint32 *ResetSubtypePtr); ** \brief Get an Application ID for the calling Application ** ** \par Description -** This routine retrieves the cFE Application ID for the calling Application. +** This routine retrieves the cFE Application ID for the calling Application. ** ** \par Assumptions, External Events, and Notes: ** NOTE: \b All tasks associated with the Application would return the same Application ID. @@ -560,7 +560,7 @@ CFE_Status_t CFE_ES_GetTaskID(CFE_ES_TaskId_t *TaskIdPtr); ** ** \par Description ** This routine retrieves the cFE Application ID associated with a -** specified Application name. +** specified Application name. ** ** \par Assumptions, External Events, and Notes: ** None @@ -670,8 +670,8 @@ CFE_Status_t CFE_ES_GetLibName(char *LibName, CFE_ES_LibId_t LibId, size_t Buffe ** ** \par Description ** This routine retrieves the information about an App associated with a -** specified App ID. The information includes all of the information ES -** maintains for an application ( documented in the CFE_ES_AppInfo_t type ) +** specified App ID. The information includes all of the information ES +** maintains for an application ( documented in the CFE_ES_AppInfo_t type ) ** ** \par Assumptions, External Events, and Notes: ** None @@ -697,15 +697,15 @@ CFE_Status_t CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId); ** ** \par Description ** This routine retrieves the information about a Task associated with a -** specified Task ID. The information includes Task Name, and Parent/Creator +** specified Task ID. The information includes Task Name, and Parent/Creator ** Application ID. ** ** \par Assumptions, External Events, and Notes: ** None ** -** \param[out] TaskInfo Pointer to a \c CFE_ES_TaskInfo_t structure that holds the specific -** task information. *TaskInfo is the filled out \c CFE_ES_TaskInfo_t structure containing the -** Task Name, Parent App Name, Parent App ID among other fields. +** \param[out] TaskInfo Pointer to a \c CFE_ES_TaskInfo_t structure that holds the specific +** task information. *TaskInfo is the filled out \c CFE_ES_TaskInfo_t structure containing +** the Task Name, Parent App Name, Parent App ID among other fields. ** ** \param[in] TaskId Application ID of Application whose name is being requested. ** @@ -799,7 +799,7 @@ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t Resour ** ** \par Description ** This routine registers a cFE Child task and associates it with its parent -** cFE Application. +** cFE Application. ** ** \par Assumptions, External Events, and Notes: ** NOTE: This API \b MUST be called by the Child Task before any other cFE API calls are made. @@ -811,36 +811,37 @@ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t Resour ** \sa #CFE_ES_CreateChildTask, #CFE_ES_DeleteChildTask, #CFE_ES_ExitChildTask ** ******************************************************************************/ -CFE_Status_t CFE_ES_RegisterChildTask(void); +CFE_Status_t CFE_ES_RegisterChildTask(void); /*****************************************************************************/ /** ** \brief Creates a new task under an existing Application ** ** \par Description -** This routine creates a new task (a separate execution thread) owned by the calling Application. +** This routine creates a new task (a separate execution thread) owned by the calling Application. ** ** \par Assumptions, External Events, and Notes: ** None ** -** \param[in, out] TaskIdPtr A pointer to a variable that will be filled in with the new task's ID. *TaskIdPtr is the Task ID of the newly created child task. +** \param[in, out] TaskIdPtr A pointer to a variable that will be filled in with the new task's ID. *TaskIdPtr is +** the Task ID of the newly created child task. ** -** \param[in] TaskName A pointer to a string containing the desired name of the new task. +** \param[in] TaskName A pointer to a string containing the desired name of the new task. ** This can be up to #OS_MAX_API_NAME characters, including the trailing null. ** -** \param[in] FunctionPtr A pointer to the function that will be spawned as a new task. This function -** must have the following signature: uint32 function(void). Input parameters +** \param[in] FunctionPtr A pointer to the function that will be spawned as a new task. This function +** must have the following signature: uint32 function(void). Input parameters ** for the new task are not supported. ** -** \param[in] StackPtr A pointer to the location where the child task's stack pointer should start. +** \param[in] StackPtr A pointer to the location where the child task's stack pointer should start. ** NOTE: Not all underlying operating systems support this parameter. ** The CFE_ES_TASK_STACK_ALLOCATE constant may be passed to indicate that the ** stack should be dynamically allocated. ** ** \param[in] StackSize The number of bytes to allocate for the new task's stack. ** -** \param[in] Priority The priority for the new task. Lower numbers are higher priority, with 0 being -** the highest priority. Applications cannot create tasks with a higher priority +** \param[in] Priority The priority for the new task. Lower numbers are higher priority, with 0 being +** the highest priority. Applications cannot create tasks with a higher priority ** (lower number) than their own priority. ** ** \param[in] Flags Reserved for future expansion. @@ -852,13 +853,9 @@ CFE_Status_t CFE_ES_RegisterChildTask(void); ** \sa #CFE_ES_RegisterChildTask, #CFE_ES_DeleteChildTask, #CFE_ES_ExitChildTask ** ******************************************************************************/ -CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, - const char *TaskName, - CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, - CFE_ES_StackPointer_t StackPtr, - size_t StackSize, - CFE_ES_TaskPriority_Atom_t Priority, - uint32 Flags); +CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, + CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, CFE_ES_StackPointer_t StackPtr, + size_t StackSize, CFE_ES_TaskPriority_Atom_t Priority, uint32 Flags); /*****************************************************************************/ /** @@ -926,7 +923,8 @@ CFE_Status_t CFE_ES_GetTaskName(char *TaskName, CFE_ES_TaskId_t TaskId, size_t B ** \par Assumptions, External Events, and Notes: ** None ** -** \param[in] TaskId The task ID previously obtained when the Child Task was created with the #CFE_ES_CreateChildTask API. +** \param[in] TaskId The task ID previously obtained when the Child Task was created with the +*#CFE_ES_CreateChildTask API. ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -942,7 +940,7 @@ CFE_Status_t CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId); ** \brief Exits a child task ** ** \par Description -** This routine allows the current executing child task to exit and +** This routine allows the current executing child task to exit and ** be deleted by ES. ** ** \par Assumptions, External Events, and Notes: @@ -968,35 +966,34 @@ void CFE_ES_ExitChildTask(void); ** ** \par Description ** Normally the ES background task wakes up at a periodic interval. -** Whenever new background work is added, this can be used to wake the task early, +** Whenever new background work is added, this can be used to wake the task early, ** which may reduce the delay between adding the job and the job getting processed. ** ** \par Assumptions, External Events, and Notes: ** Note the amount of work that the background task will perform is pro-rated ** based on the amount of time elapsed since the last wakeup. Waking the task -** early will not cause the background task to do more work than it otherwise +** early will not cause the background task to do more work than it otherwise ** would - it just reduces the delay before work starts initially. ** ** ******************************************************************************/ -void CFE_ES_BackgroundWakeup(void); - +void CFE_ES_BackgroundWakeup(void); /*****************************************************************************/ /** ** \brief Write a string to the cFE System Log ** ** \par Description -** This routine writes a formatted string to the cFE system log. This -** can be used to record very low-level errors that can't be reported -** using the Event Services. This function is used in place of printf -** for flight software. It should be used for significant startup events, -** critical errors, and conditionally compiled debug software. +** This routine writes a formatted string to the cFE system log. This +** can be used to record very low-level errors that can't be reported +** using the Event Services. This function is used in place of printf +** for flight software. It should be used for significant startup events, +** critical errors, and conditionally compiled debug software. ** ** \par Assumptions, External Events, and Notes: ** None ** -** \param[in] SpecStringPtr The format string for the log message. +** \param[in] SpecStringPtr The format string for the log message. ** This is similar to the format string for a printf() call. ** ** \return Execution status, see \ref CFEReturnCodes @@ -1004,7 +1001,7 @@ void CFE_ES_BackgroundWakeup(void); ** \retval #CFE_ES_ERR_SYS_LOG_FULL \copybrief CFE_ES_ERR_SYS_LOG_FULL ** ******************************************************************************/ -CFE_Status_t CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1,2); +CFE_Status_t CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1, 2); /*****************************************************************************/ /** @@ -1012,7 +1009,7 @@ CFE_Status_t CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1,2) ** ** \par Description ** This routine calculates a cyclic redundancy check (CRC) on a block of memory. The CRC algorithm -** used is determined by the last parameter. +** used is determined by the last parameter. ** ** \par Assumptions, External Events, and Notes: ** None @@ -1069,17 +1066,18 @@ void CFE_ES_ProcessAsyncEvent(void); ** ** \par Description ** This routine allocates a block of memory in the Critical Data Store and associates it with -** the calling Application. The memory can survive an Application restart as well as a Processor Reset. +** the calling Application. The memory can survive an Application restart as well as a Processor Reset. ** ** \par Assumptions, External Events, and Notes: ** None ** -** \param[in, out] HandlePtr Pointer Application's variable that will contain the CDS Memory Block Handle. *HandlePtr is the handle of the CDS block that can be used in -** #CFE_ES_CopyToCDS and #CFE_ES_RestoreFromCDS. +** \param[in, out] HandlePtr Pointer Application's variable that will contain the CDS Memory Block Handle. +** HandlePtr is the handle of the CDS block that can be used in +** #CFE_ES_CopyToCDS and #CFE_ES_RestoreFromCDS. ** ** \param[in] BlockSize The number of bytes needed in the CDS. ** -** \param[in] Name A pointer to a character string containing an application +** \param[in] Name A pointer to a character string containing an application ** unique name of #CFE_MISSION_ES_CDS_MAX_NAME_LENGTH characters or less. ** ** @@ -1151,7 +1149,6 @@ CFE_Status_t CFE_ES_GetCDSBlockIDByName(CFE_ES_CDSHandle_t *BlockIdPtr, const ch ******************************************************************************/ CFE_Status_t CFE_ES_GetCDSBlockName(char *BlockName, CFE_ES_CDSHandle_t BlockId, size_t BufferLength); - /*****************************************************************************/ /** ** \brief Save a block of data in the Critical Data Store (CDS) @@ -1185,7 +1182,7 @@ CFE_Status_t CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy); ** This routine copies data from the Critical Data Store identified with the \c Handle into ** the area of memory pointed to by the \c RestoreToMemory pointer. The area of memory to ** be copied into must be at least as big as the size specified when registering the CDS. -** The recovery will indicate an error if the data integrity check maintained by the CDS +** The recovery will indicate an error if the data integrity check maintained by the CDS ** indicates the contents of the CDS have changed. However, the contents will still be ** copied into the specified area of memory. ** @@ -1194,7 +1191,8 @@ CFE_Status_t CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy); ** ** \param[in] Handle The handle of the CDS block that was previously obtained from #CFE_ES_RegisterCDS. ** -** \param[in, out] RestoreToMemory A Pointer to the block of memory that is to be restored with the contents of the CDS. *RestoreToMemory is the contents of the specified CDS. +** \param[in, out] RestoreToMemory A Pointer to the block of memory that is to be restored with the contents of +** the CDS. *RestoreToMemory is the contents of the specified CDS. ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -1217,14 +1215,15 @@ CFE_Status_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Han ** ** \par Description ** This routine initializes a pool of memory supplied by the calling application. When a memory pool -** created by this routine is processed, no mutex handling is performed. +** created by this routine is processed, no mutex handling is performed. ** ** \par Assumptions, External Events, and Notes: ** -# The size of the pool must be an integral number of 32-bit words ** -# The start address of the pool must be 32-bit aligned ** -# 168 bytes are used for internal bookkeeping, therefore, they will not be available for allocation. ** -** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in. *PoolID is the memory pool handle. +** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in. +** PoolID is the memory pool handle. ** ** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must ** be on a 32-bit boundary. @@ -1246,14 +1245,15 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s ** ** \par Description ** This routine initializes a pool of memory supplied by the calling application. When a memory pool -** created by this routine is processed, mutex handling will be performed. +** created by this routine is processed, mutex handling will be performed. ** ** \par Assumptions, External Events, and Notes: ** -# The size of the pool must be an integral number of 32-bit words ** -# The start address of the pool must be 32-bit aligned ** -# 168 bytes are used for internal bookkeeping, therefore, they will not be available for allocation. ** -** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in. *PoolID is the memory pool handle. +** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in. +** PoolID is the memory pool handle. ** ** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must ** be on a 32-bit boundary. @@ -1274,29 +1274,31 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t ** \brief Initializes a memory pool created by an application with application specified block sizes. ** ** \par Description -** This routine initializes a pool of memory supplied by the calling application. +** This routine initializes a pool of memory supplied by the calling application. ** ** \par Assumptions, External Events, and Notes: ** -# The size of the pool must be an integral number of 32-bit words ** -# The start address of the pool must be 32-bit aligned ** -# 168 bytes are used for internal bookkeeping, therefore, they will not be available for allocation. ** -** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in. *PoolID is the memory pool handle. +** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in. +** PoolID is the memory pool handle. ** ** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must ** be on a 32-bit boundary. ** -** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit words. +** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit +** words. ** ** \param[in] NumBlockSizes The number of different block sizes specified in the \c BlockSizes array. If set equal to ** zero or if greater than 17, then default block sizes are used. ** ** \param[in] BlockSizes Pointer to an array of sizes to be used instead of the default block sizes specified by -** #CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 through #CFE_PLATFORM_ES_MAX_BLOCK_SIZE. If the pointer is equal to NULL, -** the default block sizes are used. +** #CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 through #CFE_PLATFORM_ES_MAX_BLOCK_SIZE. If the +** pointer is equal to NULL, the default block sizes are used. ** -** \param[in] UseMutex Flag indicating whether the new memory pool will be processing with mutex handling or not. -** Valid parameter values are #CFE_ES_USE_MUTEX and #CFE_ES_NO_MUTEX +** \param[in] UseMutex Flag indicating whether the new memory pool will be processing with mutex handling or +** not. Valid parameter values are #CFE_ES_USE_MUTEX and #CFE_ES_NO_MUTEX ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -1305,13 +1307,8 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t ** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats ** ******************************************************************************/ -CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, - uint8 *MemPtr, - size_t Size, - uint16 NumBlockSizes, - const size_t *BlockSizes, - bool UseMutex ); - +CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes, + const size_t *BlockSizes, bool UseMutex); /*****************************************************************************/ /** @@ -1337,18 +1334,18 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, ******************************************************************************/ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID); - /*****************************************************************************/ /** ** \brief Gets a buffer from the memory pool created by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem ** ** \par Description -** This routine obtains a block of memory from the memory pool supplied by the calling application. +** This routine obtains a block of memory from the memory pool supplied by the calling application. ** ** \par Assumptions, External Events, and Notes: ** -# The size allocated from the memory pool is, at a minimum, 12 bytes more than requested. ** -** \param[in, out] BufPtr A pointer to the Application's pointer in which will be stored the address of the allocated memory buffer. *BufPtr is the address of the requested buffer. +** \param[in, out] BufPtr A pointer to the Application's pointer in which will be stored the address of the +** allocated memory buffer. *BufPtr is the address of the requested buffer. ** ** \param[in] PoolID The handle to the memory pool as returned by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem. ** @@ -1358,7 +1355,8 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID); ** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID ** \retval #CFE_ES_ERR_MEM_BLOCK_SIZE \copybrief CFE_ES_ERR_MEM_BLOCK_SIZE ** -** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_GetPoolBufInfo +** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats, +*#CFE_ES_GetPoolBufInfo ** ******************************************************************************/ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size); @@ -1368,7 +1366,7 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, ** \brief Gets info on a buffer previously allocated via #CFE_ES_GetPoolBuf ** ** \par Description -** This routine gets info on a buffer in the memory pool. +** This routine gets info on a buffer in the memory pool. ** ** \par Assumptions, External Events, and Notes: ** None @@ -1382,7 +1380,8 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, ** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID ** \retval #CFE_ES_BUFFER_NOT_IN_POOL \copybrief CFE_ES_BUFFER_NOT_IN_POOL ** -** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_PutPoolBuf +** \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, CFE_ES_MemPoolBuf_t BufPtr); @@ -1392,7 +1391,7 @@ CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_ ** \brief Releases a buffer from the memory pool that was previously allocated via #CFE_ES_GetPoolBuf ** ** \par Description -** This routine releases a buffer back into the memory pool. +** This routine releases a buffer back into the memory pool. ** ** \par Assumptions, External Events, and Notes: ** None @@ -1404,7 +1403,8 @@ CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_ ** \return Bytes released, or error code \ref CFEReturnCodes ** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID ** -** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_GetPoolBufInfo +** \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, CFE_ES_MemPoolBuf_t BufPtr); @@ -1416,13 +1416,14 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr); ** \par Description ** This routine fills the #CFE_ES_MemPoolStats_t data structure with the statistics ** maintained by the memory pool software. These statistics can then be telemetered -** by the calling Application. +** by the calling Application. ** ** \par Assumptions, External Events, and Notes: ** None ** -** \param[in, out] BufPtr Pointer to #CFE_ES_MemPoolStats_t data structure to be -** filled with memory statistics. *BufPtr is the Memory Pool Statistics stored in given data structure. +** \param[in, out] BufPtr Pointer to #CFE_ES_MemPoolStats_t data structure to be +** filled with memory statistics. *BufPtr is the Memory Pool Statistics stored in given +** data structure. ** ** \param[in] Handle The handle to the memory pool whose statistics are desired. ** @@ -1434,7 +1435,7 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr); ** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf ** ******************************************************************************/ -CFE_Status_t CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHandle_t Handle); +CFE_Status_t CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHandle_t Handle); /**@}*/ /** @defgroup CFEAPIESPerfMon cFE Performance Monitor APIs @@ -1446,9 +1447,9 @@ CFE_Status_t CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHan ** \brief Entry marker for use with Software Performance Analysis Tool. ** ** \par Description -** This macro logs the entry or start event/marker for the specified -** entry \c id. This macro, in conjunction with the #CFE_ES_PerfLogExit, -** is used by the Software Performance Analysis tool (see section 5.15). +** This macro logs the entry or start event/marker for the specified +** entry \c id. This macro, in conjunction with the #CFE_ES_PerfLogExit, +** is used by the Software Performance Analysis tool (see section 5.15). ** ** \par Assumptions, External Events, and Notes: ** None @@ -1465,9 +1466,9 @@ CFE_Status_t CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHan ** \brief Exit marker for use with Software Performance Analysis Tool. ** ** \par Description -** This macro logs the exit or end event/marker for the specified -** entry \c id. This macro, in conjunction with the #CFE_ES_PerfLogEntry, -** is used by the Software Performance Analysis tool (see section 5.15). +** This macro logs the exit or end event/marker for the specified +** entry \c id. This macro, in conjunction with the #CFE_ES_PerfLogEntry, +** is used by the Software Performance Analysis tool (see section 5.15). ** ** \par Assumptions, External Events, and Notes: ** None @@ -1479,15 +1480,14 @@ CFE_Status_t CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHan ******************************************************************************/ #define CFE_ES_PerfLogExit(id) (CFE_ES_PerfLogAdd(id, 1)) - /*****************************************************************************/ /** ** \brief Function called by #CFE_ES_PerfLogEntry and #CFE_ES_PerfLogExit macros ** ** \par Description -** This function logs the entry and exit marker for the specified -** \c id. This function is used by the Software Performance Analysis -** tool (see section 5.15). +** This function logs the entry and exit marker for the specified +** \c id. This function is used by the Software Performance Analysis +** tool (see section 5.15). ** ** \par Assumptions, External Events, and Notes: ** None @@ -1510,7 +1510,7 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit); ** \brief Register a generic counter ** ** \par Description -** This routine registers a generic counter. +** This routine registers a generic counter. ** ** \par Assumptions, External Events, and Notes: ** None. @@ -1523,7 +1523,8 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit); ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT ** -** \sa #CFE_ES_IncrementGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName +** \sa #CFE_ES_IncrementGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, +*#CFE_ES_GetGenCounterIDByName ** ******************************************************************************/ CFE_Status_t CFE_ES_RegisterGenCounter(CFE_ES_CounterId_t *CounterIdPtr, const char *CounterName); @@ -1533,7 +1534,7 @@ CFE_Status_t CFE_ES_RegisterGenCounter(CFE_ES_CounterId_t *CounterIdPtr, const c ** \brief Delete a generic counter ** ** \par Description -** This routine deletes a previously registered generic counter. +** This routine deletes a previously registered generic counter. ** ** \par Assumptions, External Events, and Notes: ** None. @@ -1544,7 +1545,8 @@ CFE_Status_t CFE_ES_RegisterGenCounter(CFE_ES_CounterId_t *CounterIdPtr, const c ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT ** -** \sa #CFE_ES_IncrementGenCounter, #CFE_ES_RegisterGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName +** \sa #CFE_ES_IncrementGenCounter, #CFE_ES_RegisterGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, +*#CFE_ES_GetGenCounterIDByName ** ******************************************************************************/ CFE_Status_t CFE_ES_DeleteGenCounter(CFE_ES_CounterId_t CounterId); @@ -1554,7 +1556,7 @@ CFE_Status_t CFE_ES_DeleteGenCounter(CFE_ES_CounterId_t CounterId); ** \brief Increments the specified generic counter ** ** \par Description -** This routine increments the specified generic counter. +** This routine increments the specified generic counter. ** ** \par Assumptions, External Events, and Notes: ** None. @@ -1565,7 +1567,8 @@ CFE_Status_t CFE_ES_DeleteGenCounter(CFE_ES_CounterId_t CounterId); ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT ** -** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName +** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, +*#CFE_ES_GetGenCounterIDByName ** ******************************************************************************/ CFE_Status_t CFE_ES_IncrementGenCounter(CFE_ES_CounterId_t CounterId); @@ -1575,7 +1578,7 @@ CFE_Status_t CFE_ES_IncrementGenCounter(CFE_ES_CounterId_t CounterId); ** \brief Set the specified generic counter ** ** \par Description -** This routine sets the specified generic counter to the specified value. +** This routine sets the specified generic counter to the specified value. ** ** \par Assumptions, External Events, and Notes: ** None. @@ -1588,7 +1591,8 @@ CFE_Status_t CFE_ES_IncrementGenCounter(CFE_ES_CounterId_t CounterId); ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT ** -** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_IncrementGenCounter, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName +** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_IncrementGenCounter, #CFE_ES_GetGenCount, +*#CFE_ES_GetGenCounterIDByName ** ******************************************************************************/ CFE_Status_t CFE_ES_SetGenCount(CFE_ES_CounterId_t CounterId, uint32 Count); @@ -1598,7 +1602,7 @@ CFE_Status_t CFE_ES_SetGenCount(CFE_ES_CounterId_t CounterId, uint32 Count); ** \brief Get the specified generic counter count ** ** \par Description -** This routine gets the value of a generic counter. +** This routine gets the value of a generic counter. ** ** \par Assumptions, External Events, and Notes: ** None. @@ -1611,12 +1615,12 @@ CFE_Status_t CFE_ES_SetGenCount(CFE_ES_CounterId_t CounterId, uint32 Count); ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_ES_BAD_ARGUMENT \copybrief CFE_ES_BAD_ARGUMENT ** -** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_IncrementGenCounter, #CFE_ES_GetGenCounterIDByName +** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_IncrementGenCounter, +*#CFE_ES_GetGenCounterIDByName ** ******************************************************************************/ CFE_Status_t CFE_ES_GetGenCount(CFE_ES_CounterId_t CounterId, uint32 *Count); - /*****************************************************************************/ /** ** \brief Get the Id associated with a generic counter name @@ -1672,4 +1676,4 @@ CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_CounterId_t Coun /**@}*/ -#endif /* CFE_ES_API_H */ +#endif /* CFE_ES_API_H */ diff --git a/modules/core_api/fsw/inc/cfe_es_api_typedefs.h b/modules/core_api/fsw/inc/cfe_es_api_typedefs.h index 4912aa70c..6c01ddd96 100644 --- a/modules/core_api/fsw/inc/cfe_es_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_es_api_typedefs.h @@ -36,13 +36,11 @@ #define CFE_ES_ABSTRACT_TYPES_H /* -** Includes +** Includes */ #include "common_types.h" #include "cfe_es_extern_typedefs.h" - - /* ** Note about reset type and subtypes: ** @@ -58,10 +56,9 @@ */ /** \name Reset Type extensions */ /** \{ */ -#define CFE_ES_APP_RESTART CFE_PSP_RST_TYPE_MAX /**< Application only was reset (extend the PSP enumeration here) */ +#define CFE_ES_APP_RESTART CFE_PSP_RST_TYPE_MAX /**< Application only was reset (extend the PSP enumeration here) */ /** \} */ - /*****************************************************************************/ /* ** Type Definitions @@ -71,11 +68,12 @@ ** Entry Function Prototypes */ typedef void (*CFE_ES_TaskEntryFuncPtr_t)(void); /**< \brief Required Prototype of Task Main Functions */ -typedef int32 (*CFE_ES_LibraryEntryFuncPtr_t)(CFE_ES_LibId_t LibId); /**< \brief Required Prototype of Library Initialization Functions */ +typedef int32 (*CFE_ES_LibraryEntryFuncPtr_t)( + CFE_ES_LibId_t LibId); /**< \brief Required Prototype of Library Initialization Functions */ /** * \brief Compatible typedef for ES child task entry point. - * + * * All ES task functions (main + child) use the same entry point type. */ typedef CFE_ES_TaskEntryFuncPtr_t CFE_ES_ChildTaskMainFuncPtr_t; @@ -85,7 +83,7 @@ typedef CFE_ES_TaskEntryFuncPtr_t CFE_ES_ChildTaskMainFuncPtr_t; * * This type is used in the CFE ES task API. */ -typedef void* CFE_ES_StackPointer_t; /* aka osal_stackptr_t in proposed OSAL change */ +typedef void *CFE_ES_StackPointer_t; /* aka osal_stackptr_t in proposed OSAL change */ /** * \brief Pool Alignement @@ -98,8 +96,8 @@ typedef union CFE_ES_PoolAlign { void *Ptr; /**< \brief Aligned pointer */ /* note -- native types (int/double) are intentional here */ - long long int LongInt; /**< \brief Aligned Long Integer */ - long double LongDouble; /**< \brief Aligned Long Double */ + long long int LongInt; /**< \brief Aligned Long Integer */ + long double LongDouble; /**< \brief Aligned Long Double */ } CFE_ES_PoolAlign_t; /** @@ -109,8 +107,12 @@ typedef union CFE_ES_PoolAlign * This resolves to a union type that contains a member called "Data" that will * be correctly aligned to be a memory pool and sized according to the argument. */ -#define CFE_ES_STATIC_POOL_TYPE(size) union { CFE_ES_PoolAlign_t Align; uint8 Data[size]; } - +#define CFE_ES_STATIC_POOL_TYPE(size) \ + union \ + { \ + CFE_ES_PoolAlign_t Align; \ + uint8 Data[size]; \ + } /** * @brief Pointer type used for memory pool API @@ -126,7 +128,7 @@ typedef union CFE_ES_PoolAlign * 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; +typedef void *CFE_ES_MemPoolBuf_t; /** * @brief Conversion macro to create buffer pointer from another type @@ -150,27 +152,27 @@ typedef void* CFE_ES_MemPoolBuf_t; * and convert it to the corresponding resource-specific type. * * These should only be used when with the resource ID constants, - * or where the code has confirmed or is determining the generic + * or where the code has confirmed or is determining the generic * identifier does correspond to a resource of that type. */ -#define CFE_ES_APPID_C(val) ((CFE_ES_AppId_t)CFE_RESOURCEID_WRAP(val)) -#define CFE_ES_TASKID_C(val) ((CFE_ES_TaskId_t)CFE_RESOURCEID_WRAP(val)) -#define CFE_ES_LIBID_C(val) ((CFE_ES_LibId_t)CFE_RESOURCEID_WRAP(val)) -#define CFE_ES_COUNTERID_C(val) ((CFE_ES_CounterId_t)CFE_RESOURCEID_WRAP(val)) -#define CFE_ES_MEMHANDLE_C(val) ((CFE_ES_MemHandle_t)CFE_RESOURCEID_WRAP(val)) -#define CFE_ES_CDSHANDLE_C(val) ((CFE_ES_CDSHandle_t)CFE_RESOURCEID_WRAP(val)) +#define CFE_ES_APPID_C(val) ((CFE_ES_AppId_t)CFE_RESOURCEID_WRAP(val)) +#define CFE_ES_TASKID_C(val) ((CFE_ES_TaskId_t)CFE_RESOURCEID_WRAP(val)) +#define CFE_ES_LIBID_C(val) ((CFE_ES_LibId_t)CFE_RESOURCEID_WRAP(val)) +#define CFE_ES_COUNTERID_C(val) ((CFE_ES_CounterId_t)CFE_RESOURCEID_WRAP(val)) +#define CFE_ES_MEMHANDLE_C(val) ((CFE_ES_MemHandle_t)CFE_RESOURCEID_WRAP(val)) +#define CFE_ES_CDSHANDLE_C(val) ((CFE_ES_CDSHandle_t)CFE_RESOURCEID_WRAP(val)) /** \} */ /** \name Type-specific initalizers for "undefined" resource IDs */ /** \{ */ -#define CFE_ES_APPID_UNDEFINED CFE_ES_APPID_C(CFE_RESOURCEID_UNDEFINED) -#define CFE_ES_TASKID_UNDEFINED CFE_ES_TASKID_C(CFE_RESOURCEID_UNDEFINED) -#define CFE_ES_LIBID_UNDEFINED CFE_ES_LIBID_C(CFE_RESOURCEID_UNDEFINED) -#define CFE_ES_COUNTERID_UNDEFINED CFE_ES_COUNTERID_C(CFE_RESOURCEID_UNDEFINED) -#define CFE_ES_MEMHANDLE_UNDEFINED CFE_ES_MEMHANDLE_C(CFE_RESOURCEID_UNDEFINED) -#define CFE_ES_CDS_BAD_HANDLE CFE_ES_CDSHANDLE_C(CFE_RESOURCEID_UNDEFINED) +#define CFE_ES_APPID_UNDEFINED CFE_ES_APPID_C(CFE_RESOURCEID_UNDEFINED) +#define CFE_ES_TASKID_UNDEFINED CFE_ES_TASKID_C(CFE_RESOURCEID_UNDEFINED) +#define CFE_ES_LIBID_UNDEFINED CFE_ES_LIBID_C(CFE_RESOURCEID_UNDEFINED) +#define CFE_ES_COUNTERID_UNDEFINED CFE_ES_COUNTERID_C(CFE_RESOURCEID_UNDEFINED) +#define CFE_ES_MEMHANDLE_UNDEFINED CFE_ES_MEMHANDLE_C(CFE_RESOURCEID_UNDEFINED) +#define CFE_ES_CDS_BAD_HANDLE CFE_ES_CDSHANDLE_C(CFE_RESOURCEID_UNDEFINED) /** \} */ /** \name Task Stack Constants */ @@ -182,12 +184,10 @@ typedef void* CFE_ES_MemPoolBuf_t; * This value may be supplied as the Stack Pointer argument to CFE_ES_ChildTaskCreate() * to indicate that the stack should be dynamically allocated. */ -#define CFE_ES_TASK_STACK_ALLOCATE NULL /* aka OS_TASK_STACK_ALLOCATE in proposed OSAL change */ +#define CFE_ES_TASK_STACK_ALLOCATE NULL /* aka OS_TASK_STACK_ALLOCATE in proposed OSAL change */ /** \} */ -#define CFE_ES_NO_MUTEX false /**< \brief Indicates that the memory pool selection will not use a semaphore */ -#define CFE_ES_USE_MUTEX true /**< \brief Indicates that the memory pool selection will use a semaphore */ - - +#define CFE_ES_NO_MUTEX false /**< \brief Indicates that the memory pool selection will not use a semaphore */ +#define CFE_ES_USE_MUTEX true /**< \brief Indicates that the memory pool selection will use a semaphore */ -#endif /* CFE_ES_ABSTRACT_TYPES_H */ +#endif /* CFE_ES_ABSTRACT_TYPES_H */ diff --git a/modules/core_api/fsw/inc/cfe_es_core_internal.h b/modules/core_api/fsw/inc/cfe_es_core_internal.h index 67f9b2b81..8c9e5dec0 100644 --- a/modules/core_api/fsw/inc/cfe_es_core_internal.h +++ b/modules/core_api/fsw/inc/cfe_es_core_internal.h @@ -39,7 +39,7 @@ #include "cfe_es_extern_typedefs.h" /* - * The internal APIs prototyped within this block are only intended to be invoked from + * The internal APIs prototyped within this block are only intended to be invoked from * other CFE core apps. They still need to be prototyped in the shared header such that * they can be called from other core modules, but applications should not call these. */ @@ -48,7 +48,6 @@ * @{ */ - /*****************************************************************************/ /** ** \brief Entry Point for cFE Core Application @@ -59,11 +58,10 @@ ** \par Assumptions, External Events, and Notes: ** None ** -** +** ******************************************************************************/ extern void CFE_ES_TaskMain(void); - /*****************************************************************************/ /** ** \brief Initializes the cFE core module API Library @@ -77,7 +75,6 @@ extern void CFE_ES_TaskMain(void); ******************************************************************************/ extern int32 CFE_ES_CDS_EarlyInit(void); - /*****************************************************************************/ /** ** \brief Reserve space (or re-obtain previously reserved space) in the Critical Data Store (CDS) @@ -92,7 +89,9 @@ extern int32 CFE_ES_CDS_EarlyInit(void); ** -# This function assumes input parameters are error free and have met size/value restrictions. ** -# The calling function is responsible for issuing any event messages associated with errors. ** -** \param[in, out] HandlePtr Pointer Application's variable that will contain the CDS Memory Block Handle. *HandlePtr is the handle of the CDS block that can be used in #CFE_ES_CopyToCDS and #CFE_ES_RestoreFromCDS. +** \param[in, out] HandlePtr Pointer Application's variable that will contain the CDS Memory Block Handle. +** HandlePtr is the handle of the CDS block that can be used in #CFE_ES_CopyToCDS and +** #CFE_ES_RestoreFromCDS. ** ** \param[in] UserBlockSize The number of bytes needed in the CDS. ** @@ -132,10 +131,8 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, ** \return Any of the return values from CFE_ES_GenPoolPutBlock ** ******************************************************************************/ -int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices); - +int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices); /**@}*/ - -#endif /* CFE_ES_CORE_INTERNAL_H */ +#endif /* CFE_ES_CORE_INTERNAL_H */ diff --git a/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h index 9bc37a8c9..a4e2af204 100644 --- a/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h @@ -41,15 +41,15 @@ enum CFE_ES_LogMode { - /** - * @brief Overwrite Log Mode - */ - CFE_ES_LogMode_OVERWRITE = 0, - - /** - * @brief Discard Log Mode - */ - CFE_ES_LogMode_DISCARD = 1 + /** + * @brief Overwrite Log Mode + */ + CFE_ES_LogMode_OVERWRITE = 0, + + /** + * @brief Discard Log Mode + */ + CFE_ES_LogMode_DISCARD = 1 }; /** @@ -58,8 +58,7 @@ enum CFE_ES_LogMode * * @sa enum CFE_ES_LogMode */ -typedef uint8 CFE_ES_LogMode_Enum_t; - +typedef uint8 CFE_ES_LogMode_Enum_t; /** * @brief Label definitions associated with CFE_ES_ExceptionAction_Enum_t @@ -67,15 +66,15 @@ typedef uint8 CFE_ES_LogMode_Enum_t; enum CFE_ES_ExceptionAction { - /** - * @brief Restart application if exception occurs - */ - CFE_ES_ExceptionAction_RESTART_APP = 0, + /** + * @brief Restart application if exception occurs + */ + CFE_ES_ExceptionAction_RESTART_APP = 0, - /** - * @brief Restart processor if exception occurs - */ - CFE_ES_ExceptionAction_PROC_RESTART = 1 + /** + * @brief Restart processor if exception occurs + */ + CFE_ES_ExceptionAction_PROC_RESTART = 1 }; /** @@ -84,8 +83,7 @@ enum CFE_ES_ExceptionAction * * @sa enum CFE_ES_ExceptionAction */ -typedef uint8 CFE_ES_ExceptionAction_Enum_t; - +typedef uint8 CFE_ES_ExceptionAction_Enum_t; /** * @brief Label definitions associated with CFE_ES_AppType_Enum_t @@ -93,20 +91,20 @@ typedef uint8 CFE_ES_ExceptionAction_ enum CFE_ES_AppType { - /** - * @brief CFE core application - */ - CFE_ES_AppType_CORE = 1, + /** + * @brief CFE core application + */ + CFE_ES_AppType_CORE = 1, - /** - * @brief CFE external application - */ - CFE_ES_AppType_EXTERNAL = 2, + /** + * @brief CFE external application + */ + CFE_ES_AppType_EXTERNAL = 2, - /** - * @brief CFE library - */ - CFE_ES_AppType_LIBRARY = 3 + /** + * @brief CFE library + */ + CFE_ES_AppType_LIBRARY = 3 }; /** @@ -115,8 +113,7 @@ enum CFE_ES_AppType * * @sa enum CFE_ES_AppType */ -typedef uint8 CFE_ES_AppType_Enum_t; - +typedef uint8 CFE_ES_AppType_Enum_t; /** * @brief Label definitions associated with CFE_ES_RunStatus_Enum_t @@ -126,57 +123,57 @@ enum CFE_ES_RunStatus /** * @brief Reserved value, should not be used */ - CFE_ES_RunStatus_UNDEFINED = 0, - - /** - * @brief Indicates that the Application should continue to run - */ - CFE_ES_RunStatus_APP_RUN = 1, - - /** - * @brief Indicates that the Application wants to exit normally - */ - CFE_ES_RunStatus_APP_EXIT = 2, - - /** - * @brief Indicates that the Application is quitting with an error - */ - CFE_ES_RunStatus_APP_ERROR = 3, - - /** - * @brief The cFE App caused an exception - */ - CFE_ES_RunStatus_SYS_EXCEPTION = 4, - - /** - * @brief The system is requesting a restart of the cFE App - */ - CFE_ES_RunStatus_SYS_RESTART = 5, - - /** - * @brief The system is requesting a reload of the cFE App - */ - CFE_ES_RunStatus_SYS_RELOAD = 6, - - /** - * @brief The system is requesting that the cFE App is stopped - */ - CFE_ES_RunStatus_SYS_DELETE = 7, - - /** - * @brief Indicates that the Core Application could not Init - */ - CFE_ES_RunStatus_CORE_APP_INIT_ERROR = 8, - - /** - * @brief Indicates that the Core Application had a runtime failure - */ - CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR = 9, - - /** - * @brief Reserved value, marker for the maximum state - */ - CFE_ES_RunStatus_MAX + CFE_ES_RunStatus_UNDEFINED = 0, + + /** + * @brief Indicates that the Application should continue to run + */ + CFE_ES_RunStatus_APP_RUN = 1, + + /** + * @brief Indicates that the Application wants to exit normally + */ + CFE_ES_RunStatus_APP_EXIT = 2, + + /** + * @brief Indicates that the Application is quitting with an error + */ + CFE_ES_RunStatus_APP_ERROR = 3, + + /** + * @brief The cFE App caused an exception + */ + CFE_ES_RunStatus_SYS_EXCEPTION = 4, + + /** + * @brief The system is requesting a restart of the cFE App + */ + CFE_ES_RunStatus_SYS_RESTART = 5, + + /** + * @brief The system is requesting a reload of the cFE App + */ + CFE_ES_RunStatus_SYS_RELOAD = 6, + + /** + * @brief The system is requesting that the cFE App is stopped + */ + CFE_ES_RunStatus_SYS_DELETE = 7, + + /** + * @brief Indicates that the Core Application could not Init + */ + CFE_ES_RunStatus_CORE_APP_INIT_ERROR = 8, + + /** + * @brief Indicates that the Core Application had a runtime failure + */ + CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR = 9, + + /** + * @brief Reserved value, marker for the maximum state + */ + CFE_ES_RunStatus_MAX }; @@ -186,8 +183,7 @@ enum CFE_ES_RunStatus * * @sa enum CFE_ES_RunStatus */ -typedef uint32 CFE_ES_RunStatus_Enum_t; - +typedef uint32 CFE_ES_RunStatus_Enum_t; /** * @brief Label definitions associated with CFE_ES_SystemState_Enum_t @@ -195,45 +191,45 @@ typedef uint32 CFE_ES_RunStatus_Enum_t enum CFE_ES_SystemState { - /** - * @brief reserved - */ - CFE_ES_SystemState_UNDEFINED = 0, - - /** - * @brief single threaded mode while setting up CFE itself - */ - CFE_ES_SystemState_EARLY_INIT = 1, - - /** - * @brief core apps (CFE_ES_ObjectTable) are starting (multi-threaded) - */ - CFE_ES_SystemState_CORE_STARTUP = 2, - - /** - * @brief core is ready, starting other external apps/libraries (if any) - */ - CFE_ES_SystemState_CORE_READY = 3, - - /** - * @brief startup apps have all completed their early init, but not necessarily operational yet - */ - CFE_ES_SystemState_APPS_INIT = 4, - - /** - * @brief normal operation mode; all apps are RUNNING - */ - CFE_ES_SystemState_OPERATIONAL = 5, - - /** - * @brief reserved for future use, all apps would be STOPPED - */ - CFE_ES_SystemState_SHUTDOWN = 6, - - /** - * @brief Reserved value, marker for the maximum state - */ - CFE_ES_SystemState_MAX + /** + * @brief reserved + */ + CFE_ES_SystemState_UNDEFINED = 0, + + /** + * @brief single threaded mode while setting up CFE itself + */ + CFE_ES_SystemState_EARLY_INIT = 1, + + /** + * @brief core apps (CFE_ES_ObjectTable) are starting (multi-threaded) + */ + CFE_ES_SystemState_CORE_STARTUP = 2, + + /** + * @brief core is ready, starting other external apps/libraries (if any) + */ + CFE_ES_SystemState_CORE_READY = 3, + + /** + * @brief startup apps have all completed their early init, but not necessarily operational yet + */ + CFE_ES_SystemState_APPS_INIT = 4, + + /** + * @brief normal operation mode; all apps are RUNNING + */ + CFE_ES_SystemState_OPERATIONAL = 5, + + /** + * @brief reserved for future use, all apps would be STOPPED + */ + CFE_ES_SystemState_SHUTDOWN = 6, + + /** + * @brief Reserved value, marker for the maximum state + */ + CFE_ES_SystemState_MAX }; /** @@ -246,9 +242,7 @@ enum CFE_ES_SystemState * * @sa enum CFE_ES_SystemState */ -typedef uint32 CFE_ES_SystemState_Enum_t; - - +typedef uint32 CFE_ES_SystemState_Enum_t; /** * @brief Label definitions associated with CFE_ES_LogEntryType_Enum_t @@ -256,15 +250,15 @@ typedef uint32 CFE_ES_SystemState_Enum enum CFE_ES_LogEntryType { - /** - * @brief Log entry from a core subsystem - */ - CFE_ES_LogEntryType_CORE = 1, + /** + * @brief Log entry from a core subsystem + */ + CFE_ES_LogEntryType_CORE = 1, - /** - * @brief Log entry from an application - */ - CFE_ES_LogEntryType_APPLICATION = 2 + /** + * @brief Log entry from an application + */ + CFE_ES_LogEntryType_APPLICATION = 2 }; /** @@ -273,8 +267,7 @@ enum CFE_ES_LogEntryType * * @sa enum CFE_ES_LogEntryType */ -typedef uint8 CFE_ES_LogEntryType_Enum_t; - +typedef uint8 CFE_ES_LogEntryType_Enum_t; /** * @brief Label definitions associated with CFE_ES_AppState_Enum_t @@ -282,40 +275,40 @@ typedef uint8 CFE_ES_LogEntryType_Enu enum CFE_ES_AppState { - /** - * @brief Initial state before app thread is started - */ - CFE_ES_AppState_UNDEFINED = 0, - - /** - * @brief App thread has started, app performing early initialization of its own data - */ - CFE_ES_AppState_EARLY_INIT = 1, - - /** - * @brief Early/Local initialization is complete. First sync point. - */ - CFE_ES_AppState_LATE_INIT = 2, - - /** - * @brief All initialization is complete. Second sync point. - */ - CFE_ES_AppState_RUNNING = 3, - - /** - * @brief Application is waiting on a Restart/Reload/Delete request - */ - CFE_ES_AppState_WAITING = 4, - - /** - * @brief Application is stopped - */ - CFE_ES_AppState_STOPPED = 5, - - /** - * @brief Reserved entry, marker for the maximum state - */ - CFE_ES_AppState_MAX + /** + * @brief Initial state before app thread is started + */ + CFE_ES_AppState_UNDEFINED = 0, + + /** + * @brief App thread has started, app performing early initialization of its own data + */ + CFE_ES_AppState_EARLY_INIT = 1, + + /** + * @brief Early/Local initialization is complete. First sync point. + */ + CFE_ES_AppState_LATE_INIT = 2, + + /** + * @brief All initialization is complete. Second sync point. + */ + CFE_ES_AppState_RUNNING = 3, + + /** + * @brief Application is waiting on a Restart/Reload/Delete request + */ + CFE_ES_AppState_WAITING = 4, + + /** + * @brief Application is stopped + */ + CFE_ES_AppState_STOPPED = 5, + + /** + * @brief Reserved entry, marker for the maximum state + */ + CFE_ES_AppState_MAX }; /** @@ -329,8 +322,7 @@ enum CFE_ES_AppState * * @sa enum CFE_ES_AppState */ -typedef uint32 CFE_ES_AppState_Enum_t; - +typedef uint32 CFE_ES_AppState_Enum_t; /** * @brief A type for Application IDs @@ -383,7 +375,7 @@ typedef CFE_RESOURCEID_BASE_TYPE CFE_ES_CDSHandle_t; * a wider type is used for backward compatibility * in binary formats of messages. */ -typedef uint16 CFE_ES_TaskPriority_Atom_t; +typedef uint16 CFE_ES_TaskPriority_Atom_t; /** * @brief Type used for memory sizes and offsets in commands and telemetry @@ -397,14 +389,13 @@ typedef uint16 CFE_ES_TaskPriority_Atom_t; * * In either case this must be an unsigned type. */ -typedef uint32 CFE_ES_MemOffset_t; +typedef uint32 CFE_ES_MemOffset_t; /* * A converter macro to use when initializing an CFE_ES_MemOffset_t * from an integer value of a different type. */ -#define CFE_ES_MEMOFFSET_C(x) ((CFE_ES_MemOffset_t)(x)) - +#define CFE_ES_MEMOFFSET_C(x) ((CFE_ES_MemOffset_t)(x)) /** * @brief Type used for memory addresses in command and telemetry messages @@ -435,69 +426,67 @@ typedef uint32 CFE_ES_MemAddress_t; * that it will fit into a 32-bit telemetry field. Obviously, the resulting * value is no longer usable as a memory address after this. */ -#define CFE_ES_MEMADDRESS_C(x) ((CFE_ES_MemAddress_t)((cpuaddr)(x) & 0xFFFFFFFF)) - +#define CFE_ES_MEMADDRESS_C(x) ((CFE_ES_MemAddress_t)((cpuaddr)(x)&0xFFFFFFFF)) -/* +/* * Data Sructures shared between API and Message (CMD/TLM) interfaces */ - /** * \brief Application Information * * Structure that is used to provide information about an app. * It is primarily used for the QueryOne and QueryAll Commands. - * + * * While this structure is primarily intended for Application info, * it can also represent Library information where only a subset of - * the information applies. + * the information applies. */ typedef struct CFE_ES_AppInfo { - CFE_ResourceId_t ResourceId; /**< \cfetlmmnemonic \ES_APP_ID - \brief Application or Library ID for this resource */ - uint32 Type; /**< \cfetlmmnemonic \ES_APPTYPE - \brief The type of App: CORE or EXTERNAL */ - - char Name[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \ES_APPNAME - \brief The Registered Name of the Application */ - char EntryPoint[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \ES_APPENTRYPT - \brief The Entry Point label for the Application */ - char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \ES_APPFILENAME - \brief The Filename of the file containing the Application */ - - CFE_ES_MemOffset_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE - \brief The Stack Size of the Application */ - uint32 AddressesAreValid; /**< \cfetlmmnemonic \ES_ADDRVALID - \brief Indicates that the Code, Data, and BSS addresses/sizes are valid */ - CFE_ES_MemAddress_t CodeAddress; /**< \cfetlmmnemonic \ES_CODEADDR - \brief The Address of the Application Code Segment*/ - CFE_ES_MemOffset_t CodeSize; /**< \cfetlmmnemonic \ES_CODESIZE - \brief The Code Size of the Application */ - CFE_ES_MemAddress_t DataAddress; /**< \cfetlmmnemonic \ES_DATAADDR - \brief The Address of the Application Data Segment*/ - CFE_ES_MemOffset_t DataSize; /**< \cfetlmmnemonic \ES_DATASIZE - \brief The Data Size of the Application */ - CFE_ES_MemAddress_t BSSAddress; /**< \cfetlmmnemonic \ES_BSSADDR - \brief The Address of the Application BSS Segment*/ - CFE_ES_MemOffset_t BSSSize; /**< \cfetlmmnemonic \ES_BSSSIZE - \brief The BSS Size of the Application */ - CFE_ES_MemAddress_t StartAddress; /**< \cfetlmmnemonic \ES_STARTADDR - \brief The Start Address of the Application */ - CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \cfetlmmnemonic \ES_EXCEPTNACTN - \brief What should occur if Application has an exception - (Restart Application OR Restart Processor) */ - CFE_ES_TaskPriority_Atom_t Priority; /**< \cfetlmmnemonic \ES_PRIORITY - \brief The Priority of the Application */ - CFE_ES_TaskId_t MainTaskId; /**< \cfetlmmnemonic \ES_MAINTASKID - \brief The Application's Main Task ID */ - uint32 ExecutionCounter; /**< \cfetlmmnemonic \ES_MAINTASKEXECNT - \brief The Application's Main Task Execution Counter */ - char MainTaskName[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \ES_MAINTASKNAME - \brief The Application's Main Task ID */ - uint32 NumOfChildTasks; /**< \cfetlmmnemonic \ES_CHILDTASKS - \brief Number of Child tasks for an App */ + CFE_ResourceId_t ResourceId; /**< \cfetlmmnemonic \ES_APP_ID + \brief Application or Library ID for this resource */ + uint32 Type; /**< \cfetlmmnemonic \ES_APPTYPE + \brief The type of App: CORE or EXTERNAL */ + + char Name[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \ES_APPNAME + \brief The Registered Name of the Application */ + char EntryPoint[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \ES_APPENTRYPT + \brief The Entry Point label for the Application */ + char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \ES_APPFILENAME + \brief The Filename of the file containing the Application */ + + CFE_ES_MemOffset_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE + \brief The Stack Size of the Application */ + uint32 AddressesAreValid; /**< \cfetlmmnemonic \ES_ADDRVALID + \brief Indicates that the Code, Data, and BSS addresses/sizes are valid */ + CFE_ES_MemAddress_t CodeAddress; /**< \cfetlmmnemonic \ES_CODEADDR + \brief The Address of the Application Code Segment*/ + CFE_ES_MemOffset_t CodeSize; /**< \cfetlmmnemonic \ES_CODESIZE + \brief The Code Size of the Application */ + CFE_ES_MemAddress_t DataAddress; /**< \cfetlmmnemonic \ES_DATAADDR + \brief The Address of the Application Data Segment*/ + CFE_ES_MemOffset_t DataSize; /**< \cfetlmmnemonic \ES_DATASIZE + \brief The Data Size of the Application */ + CFE_ES_MemAddress_t BSSAddress; /**< \cfetlmmnemonic \ES_BSSADDR + \brief The Address of the Application BSS Segment*/ + CFE_ES_MemOffset_t BSSSize; /**< \cfetlmmnemonic \ES_BSSSIZE + \brief The BSS Size of the Application */ + CFE_ES_MemAddress_t StartAddress; /**< \cfetlmmnemonic \ES_STARTADDR + \brief The Start Address of the Application */ + CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \cfetlmmnemonic \ES_EXCEPTNACTN + \brief What should occur if Application has an exception + (Restart Application OR Restart Processor) */ + CFE_ES_TaskPriority_Atom_t Priority; /**< \cfetlmmnemonic \ES_PRIORITY + \brief The Priority of the Application */ + CFE_ES_TaskId_t MainTaskId; /**< \cfetlmmnemonic \ES_MAINTASKID + \brief The Application's Main Task ID */ + uint32 ExecutionCounter; /**< \cfetlmmnemonic \ES_MAINTASKEXECNT + \brief The Application's Main Task Execution Counter */ + char MainTaskName[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \ES_MAINTASKNAME + \brief The Application's Main Task ID */ + uint32 NumOfChildTasks; /**< \cfetlmmnemonic \ES_CHILDTASKS + \brief Number of Child tasks for an App */ } CFE_ES_AppInfo_t; @@ -538,11 +527,11 @@ typedef struct CFE_ES_TaskInfo */ typedef struct CFE_ES_CDSRegDumpRec { - CFE_ES_CDSHandle_t Handle; /**< \brief Handle of CDS */ - CFE_ES_MemOffset_t Size; /**< \brief Size, in bytes, of the CDS memory block */ - bool Table; /**< \brief Flag that indicates whether CDS contains a Critical Table */ - char Name[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; /**< \brief Processor Unique Name of CDS */ - uint8 ByteAlignSpare[3]; /**< \brief Spare bytes to ensure structure size is multiple of 4 bytes */ + CFE_ES_CDSHandle_t Handle; /**< \brief Handle of CDS */ + CFE_ES_MemOffset_t Size; /**< \brief Size, in bytes, of the CDS memory block */ + bool Table; /**< \brief Flag that indicates whether CDS contains a Critical Table */ + char Name[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; /**< \brief Processor Unique Name of CDS */ + uint8 ByteAlignSpare[3]; /**< \brief Spare bytes to ensure structure size is multiple of 4 bytes */ } CFE_ES_CDSRegDumpRec_t; /** @@ -553,9 +542,9 @@ typedef struct CFE_ES_CDSRegDumpRec */ typedef struct CFE_ES_BlockStats { - CFE_ES_MemOffset_t BlockSize; /**< \brief Number of bytes in each of these blocks */ - uint32 NumCreated; /**< \brief Number of Memory Blocks of this size created */ - uint32 NumFree; /**< \brief Number of Memory Blocks of this size that are free */ + CFE_ES_MemOffset_t BlockSize; /**< \brief Number of bytes in each of these blocks */ + uint32 NumCreated; /**< \brief Number of Memory Blocks of this size created */ + uint32 NumFree; /**< \brief Number of Memory Blocks of this size that are free */ } CFE_ES_BlockStats_t; /** @@ -568,21 +557,18 @@ typedef struct CFE_ES_BlockStats */ typedef struct CFE_ES_MemPoolStats { - CFE_ES_MemOffset_t PoolSize; /**< \cfetlmmnemonic \ES_POOLSIZE - \brief Size of Memory Pool (in bytes) */ - uint32 NumBlocksRequested; /**< \cfetlmmnemonic \ES_BLKSREQ - \brief Number of times a memory block has been allocated */ - uint32 CheckErrCtr; /**< \cfetlmmnemonic \ES_BLKERRCTR - \brief Number of errors detected when freeing a memory block */ - CFE_ES_MemOffset_t NumFreeBytes; /**< \cfetlmmnemonic \ES_FREEBYTES - \brief Number of bytes never allocated to a block */ - CFE_ES_BlockStats_t BlockStats[CFE_MISSION_ES_POOL_MAX_BUCKETS]; /**< \cfetlmmnemonic \ES_BLKSTATS - \brief Contains stats on each block size */ + CFE_ES_MemOffset_t PoolSize; /**< \cfetlmmnemonic \ES_POOLSIZE + \brief Size of Memory Pool (in bytes) */ + uint32 NumBlocksRequested; /**< \cfetlmmnemonic \ES_BLKSREQ + \brief Number of times a memory block has been allocated */ + uint32 CheckErrCtr; /**< \cfetlmmnemonic \ES_BLKERRCTR + \brief Number of errors detected when freeing a memory block */ + CFE_ES_MemOffset_t NumFreeBytes; /**< \cfetlmmnemonic \ES_FREEBYTES + \brief Number of bytes never allocated to a block */ + CFE_ES_BlockStats_t BlockStats[CFE_MISSION_ES_POOL_MAX_BUCKETS]; /**< \cfetlmmnemonic \ES_BLKSTATS + \brief Contains stats on each block size */ } CFE_ES_MemPoolStats_t; - - #endif /* CFE_EDS_ENABLED_BUILD */ #endif /* _CFE_ES_EXTERN_TYPEDEFS_H_ */ - diff --git a/modules/core_api/fsw/inc/cfe_evs.h b/modules/core_api/fsw/inc/cfe_evs.h index 9546562c3..4c71ad27b 100644 --- a/modules/core_api/fsw/inc/cfe_evs.h +++ b/modules/core_api/fsw/inc/cfe_evs.h @@ -23,10 +23,10 @@ ** ** Title: Event Services API Application Library Header File ** -** Purpose: +** Purpose: ** Unit specification for Event services library functions and macros. ** -** Design Notes: +** Design Notes: ** ** References: ** Flight Software Branch C Coding Standard Version 1.0a @@ -36,22 +36,20 @@ #define CFE_EVS_API_H /********************************** Include Files ************************************/ -#include "common_types.h" /* Basic data types */ +#include "common_types.h" /* Basic data types */ #include "cfe_error.h" #include "cfe_evs_api_typedefs.h" #include "cfe_es_api_typedefs.h" #include "cfe_time_api_typedefs.h" - /* ** Utility macros to make for simpler/more compact/readable code. */ -#define CFE_EVS_Send(E,T,...) CFE_EVS_SendEvent((E), CFE_EVS_EventType_##T, __VA_ARGS__) -#define CFE_EVS_SendDbg(E,...) CFE_EVS_Send(E, DEBUG, __VA_ARGS__) -#define CFE_EVS_SendInfo(E,...) CFE_EVS_Send(E, INFORMATION, __VA_ARGS__) -#define CFE_EVS_SendErr(E,...) CFE_EVS_Send(E, ERROR, __VA_ARGS__) -#define CFE_EVS_SendCrit(E,...) CFE_EVS_Send(E, CRITICAL, __VA_ARGS__) - +#define CFE_EVS_Send(E, T, ...) CFE_EVS_SendEvent((E), CFE_EVS_EventType_##T, __VA_ARGS__) +#define CFE_EVS_SendDbg(E, ...) CFE_EVS_Send(E, DEBUG, __VA_ARGS__) +#define CFE_EVS_SendInfo(E, ...) CFE_EVS_Send(E, INFORMATION, __VA_ARGS__) +#define CFE_EVS_SendErr(E, ...) CFE_EVS_Send(E, ERROR, __VA_ARGS__) +#define CFE_EVS_SendCrit(E, ...) CFE_EVS_Send(E, CRITICAL, __VA_ARGS__) /****************** Function Prototypes **********************/ @@ -59,7 +57,7 @@ * @{ */ -/** +/** ** \brief Register an application for receiving event services ** ** \par Description @@ -73,13 +71,13 @@ ** filters registered by previous calls (filter registration is NOT cumulative). ** ** \par Assumptions, External Events, and Notes: -** Note: Event filters can be added, deleted or modified by ground commands. All filtering -** schemes include a default setting that results in no filtering (such as #CFE_EVS_NO_FILTER +** Note: Event filters can be added, deleted or modified by ground commands. All filtering +** schemes include a default setting that results in no filtering (such as #CFE_EVS_NO_FILTER ** for binary filters). ** ** Filter Scheme: Binary
** Code: CFE_EVS_EventFilter_BINARY
-** Filter Structure: +** Filter Structure: ** \code ** typedef struct CFE_EVS_BinFilter { ** uint16 EventID, @@ -87,15 +85,17 @@ ** } CFE_EVS_BinFilter_t; ** \endcode ** -** \param[in] Filters Pointer to an array of event message filters, or NULL if no filtering is desired. -** The structure of an event message filter depends on the FilterScheme selected. -** (see Filter Schemes mentioned above) +** \param[in] Filters Pointer to an array of event message filters, or NULL if no filtering is desired. +** The structure of an event message filter depends on the FilterScheme selected. +** (see Filter Schemes mentioned above) ** ** \param[in] NumFilteredEvents The number of event message filters included in this call. This must be less than -** or equal to the maximum number of events allowed per application (#CFE_PLATFORM_EVS_MAX_EVENT_FILTERS). +** or equal to the maximum number of events allowed per application +*(#CFE_PLATFORM_EVS_MAX_EVENT_FILTERS). ** -** \param[in] FilterScheme The event filtering scheme that this application will use. For the first implementation of -** the event services, only filter type #CFE_EVS_EventFilter_BINARY will be supported. +** \param[in] FilterScheme The event filtering scheme that this application will use. For the first +** implementation of the event services, only filter type #CFE_EVS_EventFilter_BINARY +** will be supported. ** ** \return Execution status below or from #CFE_ES_GetAppID, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -106,17 +106,17 @@ ** \sa #CFE_EVS_Unregister ** **/ -CFE_Status_t CFE_EVS_Register (const void *Filters, /* Pointer to an array of filters */ - uint16 NumFilteredEvents, /* How many elements in the array? */ - uint16 FilterScheme); /* Filtering Algorithm to be implemented */ +CFE_Status_t CFE_EVS_Register(const void *Filters, /* Pointer to an array of filters */ + uint16 NumFilteredEvents, /* How many elements in the array? */ + uint16 FilterScheme); /* Filtering Algorithm to be implemented */ -/** +/** ** \brief Cleanup internal structures used by the event manager for the calling Application. ** ** \par Description -** This routine un-registers the calling application from receiving event services -** and removes and deletes the calling applications filters and counters from the -** internal event service filter and counter tables if registered. Applications +** This routine un-registers the calling application from receiving event services +** and removes and deletes the calling applications filters and counters from the +** internal event service filter and counter tables if registered. Applications ** must call this routine as part of their orderly shutdown process. ** ** \par Assumptions, External Events, and Notes: @@ -130,20 +130,20 @@ CFE_Status_t CFE_EVS_Register (const void *Filters, /* Po ** \sa #CFE_EVS_Register ** **/ -CFE_Status_t CFE_EVS_Unregister( void ); +CFE_Status_t CFE_EVS_Unregister(void); /**@}*/ /** @defgroup CFEAPIEVSSend cFE Send Event APIs * @{ */ -/** +/** ** \brief Generate a software event. ** ** \par Description -** This routine generates a software event message. If the EventID is not filtered, -** the event will be sent as a software bus message, optionally logged in the local -** event log, and optionally sent as an ASCII text string out the enabled output port(s). +** This routine generates a software event message. If the EventID is not filtered, +** the event will be sent as a software bus message, optionally logged in the local +** event log, and optionally sent as an ASCII text string out the enabled output port(s). ** ** \par Assumptions, External Events, and Notes: ** This API only works within the context of a registered application or core service. @@ -151,24 +151,24 @@ CFE_Status_t CFE_EVS_Unregister( void ); ** in app initialization or if registration fails) #CFE_ES_WriteToSysLog can be used ** for reporting. ** -** \param[in] EventID A numeric literal used to uniquely identify an application event. -** The \c EventID is defined and supplied by the application sending the event. +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. ** ** \param[in] EventType A numeric literal used to classify an event, one of: -** \arg #CFE_EVS_EventType_DEBUG -** \arg #CFE_EVS_EventType_INFORMATION -** \arg #CFE_EVS_EventType_ERROR -** \arg #CFE_EVS_EventType_CRITICAL -** -** \param[in] Spec A pointer to a null terminated text string describing the output format -** for the event. This is the same type of format string used for the ANSI -** \c printf function. Nominally the post-conversion string is limited to 80 -** characters, but this limit is configurable through the parameter -** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. -** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format -** string unless your application will be running in a system that supports -** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) -** in the format string; they will mess up the formatting when the events are +** \arg #CFE_EVS_EventType_DEBUG +** \arg #CFE_EVS_EventType_INFORMATION +** \arg #CFE_EVS_EventType_ERROR +** \arg #CFE_EVS_EventType_CRITICAL +** +** \param[in] Spec A pointer to a null terminated text string describing the output format +** for the event. This is the same type of format string used for the ANSI +** \c printf function. Nominally the post-conversion string is limited to 80 +** characters, but this limit is configurable through the parameter +** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. +** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format +** string unless your application will be running in a system that supports +** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) +** in the format string; they will mess up the formatting when the events are ** displayed on the ground system. ** ** \return Execution status, see \ref CFEReturnCodes @@ -179,20 +179,17 @@ CFE_Status_t CFE_EVS_Unregister( void ); ** \sa #CFE_EVS_SendEventWithAppID, #CFE_EVS_SendTimedEvent ** **/ -CFE_Status_t CFE_EVS_SendEvent (uint16 EventID, - uint16 EventType, - const char *Spec, ... ) OS_PRINTF(3,4); - +CFE_Status_t CFE_EVS_SendEvent(uint16 EventID, uint16 EventType, const char *Spec, ...) OS_PRINTF(3, 4); -/** +/** ** \brief Generate a software event given the specified Application ID. ** ** \par Description -** This routine generates a software event message. If the EventID is not filtered, -** the event will be sent as a software bus message, optionally logged in the local -** event log, and optionally sent as an ASCII text string out the enabled output port(s). -** Note that this function should really only be used from within an API in order to -** preserve the context of an Application's event. In general, #CFE_EVS_SendEvent should be used. +** This routine generates a software event message. If the EventID is not filtered, +** the event will be sent as a software bus message, optionally logged in the local +** event log, and optionally sent as an ASCII text string out the enabled output port(s). +** Note that this function should really only be used from within an API in order to +** preserve the context of an Application's event. In general, #CFE_EVS_SendEvent should be used. ** ** \par Assumptions, External Events, and Notes: ** The Application ID must correspond to a registered application or core service. @@ -200,26 +197,26 @@ CFE_Status_t CFE_EVS_SendEvent (uint16 EventID, ** in app initialization or if registration fails) #CFE_ES_WriteToSysLog can be used ** for reporting. ** -** \param[in] EventID A numeric literal used to uniquely identify an application event. -** The \c EventID is defined and supplied by the application sending the event. +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. ** ** \param[in] EventType A numeric literal used to classify an event, one of: ** \arg #CFE_EVS_EventType_DEBUG ** \arg #CFE_EVS_EventType_INFORMATION ** \arg #CFE_EVS_EventType_ERROR ** \arg #CFE_EVS_EventType_CRITICAL -** -** \param[in] AppID The Application ID from which the event message should appear. -** -** \param[in] Spec A pointer to a null terminated text string describing the output format -** for the event. This is the same type of format string used for the ANSI -** \c printf function. Nominally the post-conversion string is limited to 80 -** characters, but this limit is configurable through the parameter -** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. -** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format -** string unless your application will be running in a system that supports -** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) -** in the format string; they will mess up the formatting when the events are +** +** \param[in] AppID The Application ID from which the event message should appear. +** +** \param[in] Spec A pointer to a null terminated text string describing the output format +** for the event. This is the same type of format string used for the ANSI +** \c printf function. Nominally the post-conversion string is limited to 80 +** characters, but this limit is configurable through the parameter +** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. +** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format +** string unless your application will be running in a system that supports +** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) +** in the format string; they will mess up the formatting when the events are ** displayed on the ground system. ** ** \return Execution status, see \ref CFEReturnCodes @@ -230,20 +227,17 @@ CFE_Status_t CFE_EVS_SendEvent (uint16 EventID, ** \sa #CFE_EVS_SendEvent, #CFE_EVS_SendTimedEvent ** **/ -CFE_Status_t CFE_EVS_SendEventWithAppID (uint16 EventID, - uint16 EventType, - CFE_ES_AppId_t AppID, - const char *Spec, ... ) OS_PRINTF(4,5); - +CFE_Status_t CFE_EVS_SendEventWithAppID(uint16 EventID, uint16 EventType, CFE_ES_AppId_t AppID, const char *Spec, ...) + OS_PRINTF(4, 5); -/** +/** ** \brief Generate a software event with a specific time tag. ** ** \par Description -** This routine is the same as #CFE_EVS_SendEvent except that the caller specifies the event time -** instead of having the EVS use the current spacecraft time. This routine should be used in -** situations where an error condition is detected at one time, but the event message is reported -** at a later time. +** This routine is the same as #CFE_EVS_SendEvent except that the caller specifies the event time +** instead of having the EVS use the current spacecraft time. This routine should be used in +** situations where an error condition is detected at one time, but the event message is reported +** at a later time. ** ** \par Assumptions, External Events, and Notes: ** This API only works within the context of a registered application or core service. @@ -251,27 +245,27 @@ CFE_Status_t CFE_EVS_SendEventWithAppID (uint16 EventID, ** in app initialization or if registration fails) #CFE_ES_WriteToSysLog can be used ** for reporting. ** -** \param[in] Time The time to include in the event. This will usually be a time returned -** by the function #CFE_TIME_GetTime. +** \param[in] Time The time to include in the event. This will usually be a time returned +** by the function #CFE_TIME_GetTime. ** -** \param[in] EventID A numeric literal used to uniquely identify an application event. -** The \c EventID is defined and supplied by the application sending the event. +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. ** ** \param[in] EventType A numeric literal used to classify an event, one of: -** \arg #CFE_EVS_EventType_DEBUG -** \arg #CFE_EVS_EventType_INFORMATION -** \arg #CFE_EVS_EventType_ERROR -** \arg #CFE_EVS_EventType_CRITICAL -** -** \param[in] Spec A pointer to a null terminated text string describing the output format -** for the event. This is the same type of format string used for the ANSI -** \c printf function. Nominally the post-conversion string is limited to 80 -** characters, but this limit is configurable through the parameter -** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. -** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format -** string unless your application will be running in a system that supports -** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) -** in the format string; they will mess up the formatting when the events are +** \arg #CFE_EVS_EventType_DEBUG +** \arg #CFE_EVS_EventType_INFORMATION +** \arg #CFE_EVS_EventType_ERROR +** \arg #CFE_EVS_EventType_CRITICAL +** +** \param[in] Spec A pointer to a null terminated text string describing the output format +** for the event. This is the same type of format string used for the ANSI +** \c printf function. Nominally the post-conversion string is limited to 80 +** characters, but this limit is configurable through the parameter +** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. +** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format +** string unless your application will be running in a system that supports +** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) +** in the format string; they will mess up the formatting when the events are ** displayed on the ground system. ** ** \return Execution status, see \ref CFEReturnCodes @@ -282,28 +276,26 @@ CFE_Status_t CFE_EVS_SendEventWithAppID (uint16 EventID, ** \sa #CFE_EVS_SendEvent, #CFE_EVS_SendEventWithAppID ** **/ -CFE_Status_t CFE_EVS_SendTimedEvent (CFE_TIME_SysTime_t Time, - uint16 EventID, - uint16 EventType, - const char *Spec, ... ) OS_PRINTF(4,5); +CFE_Status_t CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, uint16 EventID, uint16 EventType, const char *Spec, ...) + OS_PRINTF(4, 5); /**@}*/ /** @defgroup CFEAPIEVSResetFilter cFE Reset Event Filter APIs * @{ */ -/** +/** ** \brief Resets the calling application's event filter for a single event ID. ** ** \par Description -** The effect of resetting an event filter depends on the filter scheme. -** The #CFE_EVS_EventFilter_BINARY scheme resets the filter counter for the specified Event ID. +** The effect of resetting an event filter depends on the filter scheme. +** The #CFE_EVS_EventFilter_BINARY scheme resets the filter counter for the specified Event ID. ** ** \par Assumptions, External Events, and Notes: ** None ** -** \param[in] EventID A numeric literal used to uniquely identify an application event. -** The \c EventID is defined and supplied by the application sending the event. +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. ** ** \return Execution status below or from #CFE_ES_GetAppID, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -313,15 +305,14 @@ CFE_Status_t CFE_EVS_SendTimedEvent (CFE_TIME_SysTime_t Time, ** \sa #CFE_EVS_ResetAllFilters ** **/ -CFE_Status_t CFE_EVS_ResetFilter (int16 EventID); - +CFE_Status_t CFE_EVS_ResetFilter(int16 EventID); -/** +/** ** \brief Resets all of the calling application's event filters. ** ** \par Description -** This routine resets all the calling application's event filter counters to zero, providing a -** quick and convenient method for resetting event filters. +** This routine resets all the calling application's event filter counters to zero, providing a +** quick and convenient method for resetting event filters. ** ** \par Assumptions, External Events, and Notes: ** None @@ -334,7 +325,7 @@ CFE_Status_t CFE_EVS_ResetFilter (int16 EventID); ** \sa #CFE_EVS_ResetFilter ** **/ -CFE_Status_t CFE_EVS_ResetAllFilters ( void ); +CFE_Status_t CFE_EVS_ResetAllFilters(void); /**@}*/ -#endif /* CFE_EVS_API_H */ +#endif /* CFE_EVS_API_H */ diff --git a/modules/core_api/fsw/inc/cfe_evs_api_typedefs.h b/modules/core_api/fsw/inc/cfe_evs_api_typedefs.h index 427505193..ef2564caa 100644 --- a/modules/core_api/fsw/inc/cfe_evs_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_evs_api_typedefs.h @@ -23,10 +23,10 @@ ** ** Title: Event Services API Application Library Header File ** -** Purpose: +** Purpose: ** Unit specification for Event services library functions and macros. ** -** Design Notes: +** Design Notes: ** ** References: ** Flight Software Branch C Coding Standard Version 1.0a @@ -36,35 +36,32 @@ #define CFE_EVS_ABSTRACT_TYPES_H /********************************** Include Files ************************************/ -#include "common_types.h" /* Basic data types */ +#include "common_types.h" /* Basic data types */ #include "cfe_evs_extern_typedefs.h" /** \name Common Event Filter Mask Values */ /** \{ */ -#define CFE_EVS_NO_FILTER 0x0000 /**< \brief Stops any filtering. All messages are sent. */ -#define CFE_EVS_FIRST_ONE_STOP 0xFFFF /**< \brief Sends the first event. All remaining messages are filtered. */ -#define CFE_EVS_FIRST_TWO_STOP 0xFFFE /**< \brief Sends the first 2 events. All remaining messages are filtered. */ -#define CFE_EVS_FIRST_4_STOP 0xFFFC /**< \brief Sends the first 4 events. All remaining messages are filtered. */ -#define CFE_EVS_FIRST_8_STOP 0xFFF8 /**< \brief Sends the first 8 events. All remaining messages are filtered. */ -#define CFE_EVS_FIRST_16_STOP 0xFFF0 /**< \brief Sends the first 16 events. All remaining messages are filtered. */ -#define CFE_EVS_FIRST_32_STOP 0xFFE0 /**< \brief Sends the first 32 events. All remaining messages are filtered. */ -#define CFE_EVS_FIRST_64_STOP 0xFFC0 /**< \brief Sends the first 64 events. All remaining messages are filtered. */ -#define CFE_EVS_EVERY_OTHER_ONE 0x0001 /**< \brief Sends every other event. */ -#define CFE_EVS_EVERY_OTHER_TWO 0x0002 /**< \brief Sends two, filters one, sends two, filters one, etc */ -#define CFE_EVS_EVERY_FOURTH_ONE 0x0003 /**< \brief Sends every fourth event message. All others are filtered. */ +#define CFE_EVS_NO_FILTER 0x0000 /**< \brief Stops any filtering. All messages are sent. */ +#define CFE_EVS_FIRST_ONE_STOP 0xFFFF /**< \brief Sends the first event. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_TWO_STOP 0xFFFE /**< \brief Sends the first 2 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_4_STOP 0xFFFC /**< \brief Sends the first 4 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_8_STOP 0xFFF8 /**< \brief Sends the first 8 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_16_STOP 0xFFF0 /**< \brief Sends the first 16 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_32_STOP 0xFFE0 /**< \brief Sends the first 32 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_64_STOP 0xFFC0 /**< \brief Sends the first 64 events. All remaining messages are filtered. */ +#define CFE_EVS_EVERY_OTHER_ONE 0x0001 /**< \brief Sends every other event. */ +#define CFE_EVS_EVERY_OTHER_TWO 0x0002 /**< \brief Sends two, filters one, sends two, filters one, etc */ +#define CFE_EVS_EVERY_FOURTH_ONE 0x0003 /**< \brief Sends every fourth event message. All others are filtered. */ /** \} */ - - /****************** Structure Definitions *********************/ /** \brief Event message filter defintion structure */ -typedef struct CFE_EVS_BinFilter { - uint16 EventID; /**< \brief Numerical event identifier */ - uint16 Mask; /**< \brief Binary filter mask value */ +typedef struct CFE_EVS_BinFilter +{ + uint16 EventID; /**< \brief Numerical event identifier */ + uint16 Mask; /**< \brief Binary filter mask value */ } CFE_EVS_BinFilter_t; - - -#endif /* CFE_EVS_ABSTRACT_TYPES_H */ +#endif /* CFE_EVS_ABSTRACT_TYPES_H */ diff --git a/modules/core_api/fsw/inc/cfe_evs_core_internal.h b/modules/core_api/fsw/inc/cfe_evs_core_internal.h index 1c5cce4fc..55cd8f96e 100644 --- a/modules/core_api/fsw/inc/cfe_evs_core_internal.h +++ b/modules/core_api/fsw/inc/cfe_evs_core_internal.h @@ -23,10 +23,10 @@ ** ** Title: Event Services API Application Library Header File ** -** Purpose: +** Purpose: ** Unit specification for Event services library functions and macros. ** -** Design Notes: +** Design Notes: ** ** References: ** Flight Software Branch C Coding Standard Version 1.0a @@ -35,12 +35,11 @@ #ifndef CFE_EVS_CORE_INTERNAL_H #define CFE_EVS_CORE_INTERNAL_H - #include "common_types.h" #include "cfe_es_extern_typedefs.h" /* - * The internal APIs prototyped within this block are only intended to be invoked from + * The internal APIs prototyped within this block are only intended to be invoked from * other CFE core apps. They still need to be prototyped in the shared header such that * they can be called from other core modules, but applications should not call these. */ @@ -59,7 +58,7 @@ ** \par Assumptions, External Events, and Notes: ** None ** -** +** ******************************************************************************/ extern void CFE_EVS_TaskMain(void); @@ -88,8 +87,6 @@ extern int32 CFE_EVS_EarlyInit(void); ******************************************************************************/ extern int32 CFE_EVS_CleanUpApp(CFE_ES_AppId_t AppId); - /**@}*/ - -#endif /* CFE_EVS_CORE_INTERNAL_H */ +#endif /* CFE_EVS_CORE_INTERNAL_H */ diff --git a/modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h index e0b701427..6c12e737d 100644 --- a/modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h @@ -21,7 +21,7 @@ #ifndef _CFE_EVS_EXTERN_TYPEDEFS_H_ #define _CFE_EVS_EXTERN_TYPEDEFS_H_ -/* This header may be generated from an EDS file, +/* This header may be generated from an EDS file, * tools are available and the feature is enabled */ #ifdef CFE_EDS_ENABLED_BUILD @@ -39,15 +39,15 @@ enum CFE_EVS_MsgFormat { - /** - * @brief Short Format Messages - */ - CFE_EVS_MsgFormat_SHORT = 0, + /** + * @brief Short Format Messages + */ + CFE_EVS_MsgFormat_SHORT = 0, - /** - * @brief Long Format Messages - */ - CFE_EVS_MsgFormat_LONG = 1 + /** + * @brief Long Format Messages + */ + CFE_EVS_MsgFormat_LONG = 1 }; /** @@ -56,8 +56,7 @@ enum CFE_EVS_MsgFormat * * @sa enum CFE_EVS_MsgFormat */ -typedef uint8 CFE_EVS_MsgFormat_Enum_t; - +typedef uint8 CFE_EVS_MsgFormat_Enum_t; /** * @brief Label definitions associated with CFE_EVS_LogMode_Enum_t @@ -65,15 +64,15 @@ typedef uint8 CFE_EVS_MsgFormat_Enum_ enum CFE_EVS_LogMode { - /** - * @brief Overwrite Log Mode - */ - CFE_EVS_LogMode_OVERWRITE = 0, + /** + * @brief Overwrite Log Mode + */ + CFE_EVS_LogMode_OVERWRITE = 0, - /** - * @brief Discard Log Mode - */ - CFE_EVS_LogMode_DISCARD = 1 + /** + * @brief Discard Log Mode + */ + CFE_EVS_LogMode_DISCARD = 1 }; /** @@ -82,8 +81,7 @@ enum CFE_EVS_LogMode * * @sa enum CFE_EVS_LogMode */ -typedef uint8 CFE_EVS_LogMode_Enum_t; - +typedef uint8 CFE_EVS_LogMode_Enum_t; /** * @brief Label definitions associated with CFE_EVS_EventType_Enum_t @@ -91,25 +89,25 @@ typedef uint8 CFE_EVS_LogMode_Enum_t; enum CFE_EVS_EventType { - /** - * @brief Events that are intended only for debugging, not nominal operations - */ - CFE_EVS_EventType_DEBUG = 1, - - /** - * @brief Events that identify a state change or action that is not an error - */ - CFE_EVS_EventType_INFORMATION = 2, - - /** - * @brief Events that identify an error but are not catastrophic (e.g. - bad command - */ - CFE_EVS_EventType_ERROR = 3, - - /** - * @brief Events that identify errors that are unrecoverable autonomously - */ - CFE_EVS_EventType_CRITICAL = 4 + /** + * @brief Events that are intended only for debugging, not nominal operations + */ + CFE_EVS_EventType_DEBUG = 1, + + /** + * @brief Events that identify a state change or action that is not an error + */ + CFE_EVS_EventType_INFORMATION = 2, + + /** + * @brief Events that identify an error but are not catastrophic (e.g. - bad command + */ + CFE_EVS_EventType_ERROR = 3, + + /** + * @brief Events that identify errors that are unrecoverable autonomously + */ + CFE_EVS_EventType_CRITICAL = 4 }; /** @@ -118,8 +116,7 @@ enum CFE_EVS_EventType * * @sa enum CFE_EVS_EventType */ -typedef uint16 CFE_EVS_EventType_Enum_t; - +typedef uint16 CFE_EVS_EventType_Enum_t; /** * @brief Label definitions associated with CFE_EVS_EventFilter_Enum_t @@ -127,10 +124,10 @@ typedef uint16 CFE_EVS_EventType_Enum_ enum CFE_EVS_EventFilter { - /** - * @brief Binary event filter - */ - CFE_EVS_EventFilter_BINARY = 0 + /** + * @brief Binary event filter + */ + CFE_EVS_EventFilter_BINARY = 0 }; /** @@ -139,8 +136,7 @@ enum CFE_EVS_EventFilter * * @sa enum CFE_EVS_EventFilter */ -typedef uint8 CFE_EVS_EventFilter_Enum_t; - +typedef uint8 CFE_EVS_EventFilter_Enum_t; /** * @brief Label definitions associated with CFE_EVS_EventOutput_Enum_t @@ -148,25 +144,25 @@ typedef uint8 CFE_EVS_EventFilter_Enu enum CFE_EVS_EventOutput { - /** - * @brief Output Port 1 - */ - CFE_EVS_EventOutput_PORT1 = 1, - - /** - * @brief Output Port 2 - */ - CFE_EVS_EventOutput_PORT2 = 2, - - /** - * @brief Output Port 3 - */ - CFE_EVS_EventOutput_PORT3 = 3, - - /** - * @brief Output Port 4 - */ - CFE_EVS_EventOutput_PORT4 = 4 + /** + * @brief Output Port 1 + */ + CFE_EVS_EventOutput_PORT1 = 1, + + /** + * @brief Output Port 2 + */ + CFE_EVS_EventOutput_PORT2 = 2, + + /** + * @brief Output Port 3 + */ + CFE_EVS_EventOutput_PORT3 = 3, + + /** + * @brief Output Port 4 + */ + CFE_EVS_EventOutput_PORT4 = 4 }; /** @@ -175,11 +171,8 @@ enum CFE_EVS_EventOutput * * @sa enum CFE_EVS_EventOutput */ -typedef uint8 CFE_EVS_EventOutput_Enum_t; - - +typedef uint8 CFE_EVS_EventOutput_Enum_t; #endif /* CFE_EDS_ENABLED_BUILD */ #endif /* _CFE_EVS_EXTERN_TYPEDEFS_H_ */ - diff --git a/modules/core_api/fsw/inc/cfe_fs.h b/modules/core_api/fsw/inc/cfe_fs.h index dd7f8dcdc..e0cc06416 100644 --- a/modules/core_api/fsw/inc/cfe_fs.h +++ b/modules/core_api/fsw/inc/cfe_fs.h @@ -33,7 +33,6 @@ #ifndef _cfe_fs_ #define _cfe_fs_ - /* ** Required header files... */ @@ -44,7 +43,6 @@ #include "cfe_fs_api_typedefs.h" #include "cfe_fs_extern_typedefs.h" - /** @defgroup CFEAPIFSHeader cFE File Header Management APIs * @{ */ @@ -66,7 +64,8 @@ ** that is associated with the file whose header is to be read. ** ** \param[in, out] Hdr Pointer to a variable of type #CFE_FS_Header_t that will be -** filled with the contents of the Standard cFE File Header. *Hdr is the contents of the Standard cFE File Header for the specified file. +** filled with the contents of the Standard cFE File Header. *Hdr is the contents of the +** Standard cFE File Header for the specified file. ** ** \return Execution status, see \ref CFEReturnCodes ** @@ -110,10 +109,12 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 Sub ** -# \link #CFE_FS_Header_t::SpacecraftID \c SpacecraftID \endlink - Filled with the Spacecraft ID ** -# \link #CFE_FS_Header_t::ProcessorID \c ProcessorID \endlink - Filled with the Processor ID ** -# \link #CFE_FS_Header_t::ApplicationID \c ApplicationID \endlink - Filled with the Application ID -** -# \link #CFE_FS_Header_t::TimeSeconds \c TimeSeconds \endlink - Filled with the Time, in seconds, as obtained by #CFE_TIME_GetTime -** -# \link #CFE_FS_Header_t::TimeSubSeconds \c TimeSubSeconds \endlink - Filled with the Time, subseconds, as obtained by #CFE_TIME_GetTime -** -** +** -# \link #CFE_FS_Header_t::TimeSeconds \c TimeSeconds \endlink - Filled with the Time, in seconds, as obtained +** by #CFE_TIME_GetTime +** -# \link #CFE_FS_Header_t::TimeSubSeconds \c TimeSubSeconds \endlink - Filled with the Time, subseconds, as +** obtained by #CFE_TIME_GetTime +** +** ** \par Assumptions, External Events, and Notes: ** -# The File has already been successfully opened using #OS_OpenCreate and ** the caller has a legitimate File Descriptor. @@ -124,7 +125,8 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 Sub ** that is associated with the file whose header is to be read. ** ** \param[in, out] Hdr Pointer to a variable of type #CFE_FS_Header_t that will be -** filled with the contents of the Standard cFE File Header. *Hdr is the contents of the Standard cFE File Header for the specified file. +** filled with the contents of the Standard cFE File Header. *Hdr is the contents of the +** Standard cFE File Header for the specified file. ** ** \return Execution status, see \ref CFEReturnCodes ** @@ -154,12 +156,11 @@ CFE_Status_t CFE_FS_WriteHeader(osal_id_t FileDes, CFE_FS_Header_t *Hdr); ** to be put into the file's Standard cFE File Header. ** ** \return Execution status, see \ref CFEReturnCodes -** +** ******************************************************************************/ CFE_Status_t CFE_FS_SetTimestamp(osal_id_t FileDes, CFE_TIME_SysTime_t NewTimestamp); /**@}*/ - /** @defgroup CFEAPIFSUtil cFE File Utility APIs * @{ */ @@ -169,14 +170,14 @@ CFE_Status_t CFE_FS_SetTimestamp(osal_id_t FileDes, CFE_TIME_SysTime_t NewTimest ** \brief Get the default virtual mount point for a file category ** ** Certain classes of files generally reside in a common directory, mainly -** either the persistent storage (/cf typically) or ram disk (/ram typically). +** either the persistent storage (/cf typically) or ram disk (/ram typically). ** -** Ephemeral status files are generally in the ram disk while application +** Ephemeral status files are generally in the ram disk while application ** modules and scripts are generally in the persistent storage. ** -** This returns the expected directory for a given class of files in the form +** This returns the expected directory for a given class of files in the form ** of a virtual OSAL mount point string. -** +** ** \returns String containing the mount point, or NULL if unkown/invalid */ const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory); @@ -185,19 +186,18 @@ const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory); /** ** \brief Get the default filename extension for a file category ** -** Certain file types may have an extension that varies from system to system. -** This is primarily an issue for application modules which are ".so" on +** Certain file types may have an extension that varies from system to system. +** This is primarily an issue for application modules which are ".so" on ** Linux systems, ".dll" on Windows, ".o" on VxWorks, ".obj" on RTEMS, and so on. ** -** This uses a combination of compile-time configuration and hints from the +** This uses a combination of compile-time configuration and hints from the ** build environment to get the default/expected extension for a given file ** category. -** +** ** \returns String containing the extension, or NULL if unkown/invalid */ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory); - /*****************************************************************************/ /** ** \brief Parse a filename input from an input buffer into a local buffer @@ -232,23 +232,23 @@ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory); ** \return Execution status, see \ref CFEReturnCodes ** ******************************************************************************/ -int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize, size_t InputBufSize, - const char *DefaultInput, const char *DefaultPath, const char *DefaultExtension); - +int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize, + size_t InputBufSize, const char *DefaultInput, const char *DefaultPath, + const char *DefaultExtension); /*****************************************************************************/ /** ** \brief Parse a filename string from the user into a local buffer ** ** \par Description -** Simplified API for CFE_FS_ParseInputFileNameEx() where input is -** always known to be a non-empty, null terminated string and the fixed-length +** Simplified API for CFE_FS_ParseInputFileNameEx() where input is +** always known to be a non-empty, null terminated string and the fixed-length ** input buffer not needed. For instance this may be used where ** the input is a fixed string from cfe_platform_cfg.h or similar. ** ** \par Assumptions, External Events, and Notes: -** The parameters are organized such that this is basically like strncpy() with an -** extra argument, and existing file name accesses which use a direct copy can +** The parameters are organized such that this is basically like strncpy() with an +** extra argument, and existing file name accesses which use a direct copy can ** easily change to use this instead. ** ** \sa CFE_FS_ParseInputFileNameEx() @@ -262,8 +262,8 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s ** **--------------------------------------------------------------------------------------- */ -int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_t OutputBufSize, CFE_FS_FileCategory_t FileCategory); - +int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_t OutputBufSize, + CFE_FS_FileCategory_t FileCategory); /*****************************************************************************/ /** @@ -277,7 +277,7 @@ int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_ ** \par Assumptions, External Events, and Notes: ** -# The paths and filenames used here are the standard unix style ** filenames separated by "/" characters. -** -# The extracted filename (including terminator) is no longer than #OS_MAX_PATH_LEN +** -# The extracted filename (including terminator) is no longer than #OS_MAX_PATH_LEN ** ** \param[in] OriginalPath The original path. ** \param[out] FileNameOnly The filename that is extracted from the path. diff --git a/modules/core_api/fsw/inc/cfe_fs_api_typedefs.h b/modules/core_api/fsw/inc/cfe_fs_api_typedefs.h index 0349ab5a9..ae5450005 100644 --- a/modules/core_api/fsw/inc/cfe_fs_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_fs_api_typedefs.h @@ -33,7 +33,6 @@ #ifndef CFE_FS_ABSTRACT_TYPES_H #define CFE_FS_ABSTRACT_TYPES_H - /* ** Required header files... */ @@ -43,10 +42,10 @@ /** * \brief Generalized file types/categories known to FS - * + * * This defines different categories of files, where they * may reside in different default locations of the virtualized file system. - * + * * This is different from, and should not be confused with, the "SubType" * field in the FS header. This value is only used at runtime for FS APIs * and should not actually appear in any output file or message. @@ -66,7 +65,7 @@ typedef enum * Because FS is a library not an app, it does not have its own context or * event IDs. The file writer runs in the context of the ES background task * on behalf of whatever App requested the file write. - * + * * This is a list of abstract events associated with background file write jobs. * An app requesting the file write must supply a callback function to translate * these into its own event IDs for feedback (i.e. file complete, error conditions, etc). @@ -75,31 +74,30 @@ typedef enum { CFE_FS_FileWriteEvent_UNDEFINED, /* placeholder, no-op, keep as 0 */ - CFE_FS_FileWriteEvent_COMPLETE, /**< File is completed successfully */ - CFE_FS_FileWriteEvent_CREATE_ERROR, /**< Unable to create/open file */ - CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, /**< Unable to write FS header */ - CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, /**< Unable to write data record */ + CFE_FS_FileWriteEvent_COMPLETE, /**< File is completed successfully */ + CFE_FS_FileWriteEvent_CREATE_ERROR, /**< Unable to create/open file */ + CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, /**< Unable to write FS header */ + CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, /**< Unable to write data record */ CFE_FS_FileWriteEvent_MAX /* placeholder, no-op, keep last */ } CFE_FS_FileWriteEvent_t; - - /** * Data Getter routine provided by requester - * + * * Outputs a data block. Should return true if the file is complete (last record/EOF), otherwise return false. */ typedef bool (*CFE_FS_FileWriteGetData_t)(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize); /** * Event generator routine provided by requester - * + * * Invoked from certain points in the file write process. Implementation may invoke CFE_EVS_SendEvent() appropriately * to inform of progress. */ -typedef void (*CFE_FS_FileWriteOnEvent_t)(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position); +typedef void (*CFE_FS_FileWriteOnEvent_t)(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, + size_t BlockSize, size_t Position); /** * \brief External Metadata/State object associated with background file writes @@ -107,24 +105,22 @@ typedef void (*CFE_FS_FileWriteOnEvent_t)(void *Meta, CFE_FS_FileWriteEvent_t Ev * Applications intending to schedule background file write jobs should instantiate * this object in static/global data memory. This keeps track of the state of the * file write request(s). - */ + */ typedef struct CFE_FS_FileWriteMetaData { - volatile bool IsPending; /**< Whether request is pending (volatile as it may be checked outside lock) */ + volatile bool IsPending; /**< Whether request is pending (volatile as it may be checked outside lock) */ - char FileName[OS_MAX_PATH_LEN]; /**< Name of file to write */ + char FileName[OS_MAX_PATH_LEN]; /**< Name of file to write */ /* Data for FS header */ uint32 FileSubType; /**< Type of file to write (for FS header) */ char Description[CFE_FS_HDR_DESC_MAX_LEN]; /**< Description of file (for FS header) */ - CFE_FS_FileWriteGetData_t GetData; /**< Application callback to get a data record */ - CFE_FS_FileWriteOnEvent_t OnEvent; /**< Application callback for abstract event processing */ + CFE_FS_FileWriteGetData_t GetData; /**< Application callback to get a data record */ + CFE_FS_FileWriteOnEvent_t OnEvent; /**< Application callback for abstract event processing */ } CFE_FS_FileWriteMetaData_t; - - #endif /* CFE_FS_ABSTRACT_TYPES_H */ /************************/ diff --git a/modules/core_api/fsw/inc/cfe_fs_core_internal.h b/modules/core_api/fsw/inc/cfe_fs_core_internal.h index 66130226c..1a6670e8d 100644 --- a/modules/core_api/fsw/inc/cfe_fs_core_internal.h +++ b/modules/core_api/fsw/inc/cfe_fs_core_internal.h @@ -36,7 +36,7 @@ #include "common_types.h" /* - * The internal APIs prototyped within this block are only intended to be invoked from + * The internal APIs prototyped within this block are only intended to be invoked from * other CFE core apps. They still need to be prototyped in the shared header such that * they can be called from other core modules, but applications should not call these. */ @@ -58,10 +58,8 @@ ******************************************************************************/ extern int32 CFE_FS_EarlyInit(void); - /**@}*/ - #endif /* CFE_FS_CORE_INTERNAL_H */ /************************/ diff --git a/modules/core_api/fsw/inc/cfe_fs_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_fs_extern_typedefs.h index 55c539e6e..cce90fa7d 100644 --- a/modules/core_api/fsw/inc/cfe_fs_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_fs_extern_typedefs.h @@ -21,7 +21,7 @@ #ifndef _CFE_FS_EXTERN_TYPEDEFS_H_ #define _CFE_FS_EXTERN_TYPEDEFS_H_ -/* This header may be generated from an EDS file, +/* This header may be generated from an EDS file, * tools are available and the feature is enabled */ #ifdef CFE_EDS_ENABLED_BUILD @@ -42,11 +42,9 @@ * remains 32-bit aligned without the need for implicit padding bytes. */ -#define CFE_FS_HDR_DESC_MAX_LEN 32 /**< \brief Max length of description field in a standard cFE File Header */ - -#define CFE_FS_FILE_CONTENT_ID 0x63464531 /**< \brief Magic Number for cFE compliant files (= 'cFE1') */ - +#define CFE_FS_HDR_DESC_MAX_LEN 32 /**< \brief Max length of description field in a standard cFE File Header */ +#define CFE_FS_FILE_CONTENT_ID 0x63464531 /**< \brief Magic Number for cFE compliant files (= 'cFE1') */ /** * @brief Label definitions associated with CFE_FS_SubType_Enum_t @@ -54,157 +52,157 @@ enum CFE_FS_SubType { - /** - * @brief Executive Services Exception/Reset Log Type - * - * - * Executive Services Exception/Reset Log File which is generated in response to a - * \link #CFE_ES_WRITE_ER_LOG_CC \ES_WRITEERLOG2FILE \endlink - * command. - * - */ - CFE_FS_SubType_ES_ERLOG = 1, - - /** - * @brief Executive Services System Log Type - * - * - * Executive Services System Log File which is generated in response to a - * \link #CFE_ES_WRITE_SYSLOG_CC \ES_WRITESYSLOG2FILE \endlink - * command. - * - */ - CFE_FS_SubType_ES_SYSLOG = 2, - - /** - * @brief Executive Services Information on All Applications File - * - * - * Executive Services Information on All Applications File which is generated in response to a - * \link #CFE_ES_QUERY_ALL_CC \ES_WRITEAPPINFO2FILE \endlink - * command. - * - */ - CFE_FS_SubType_ES_QUERYALL = 3, - - /** - * @brief Executive Services Performance Data File - * - * - * Executive Services Performance Analyzer Data File which is generated in response to a - * \link #CFE_ES_STOP_PERF_DATA_CC \ES_STOPLADATA \endlink - * command. - * - */ - CFE_FS_SubType_ES_PERFDATA = 4, - - /** - * @brief Executive Services Shell Response File - * - * - * Executive Services Shell Response Data File which is generated in response to a - * shell command. - * - */ - CFE_FS_SubType_ES_SHELL = 5, - - /** - * @brief Executive Services Critical Data Store Registry Dump File - * - * - * Executive Services Critical Data Store Registry Dump File which is generated in response to a - * \link #CFE_ES_DUMP_CDS_REGISTRY_CC \ES_DUMPCDSREG \endlink - * command. - * - */ - CFE_FS_SubType_ES_CDS_REG = 6, - - /** - * @brief Table Services Registry Dump File - * - * - * Table Services Registry Dump File which is generated in response to a - * \link #CFE_TBL_DUMP_REGISTRY_CC \TBL_WRITEREG2FILE \endlink - * command. - * - */ - CFE_FS_SubType_TBL_REG = 9, - - /** - * @brief Table Services Table Image File - * - * - * Table Services Table Image File which is generated either on the ground or in response to a - * \link #CFE_TBL_DUMP_CC \TBL_DUMP \endlink command. - * - */ - CFE_FS_SubType_TBL_IMG = 8, - - /** - * @brief Event Services Application Data Dump File - * - * - * Event Services Application Data Dump File which is generated in response to a - * \link #CFE_EVS_WRITE_APP_DATA_FILE_CC \EVS_WRITEAPPDATA2FILE \endlink - * command. - * - */ - CFE_FS_SubType_EVS_APPDATA = 15, - - /** - * @brief Event Services Local Event Log Dump File - * - * - * Event Services Local Event Log Dump File which is generated in response to a - * \link #CFE_EVS_WRITE_LOG_DATA_FILE_CC \EVS_WRITELOG2FILE \endlink - * command. - * - */ - CFE_FS_SubType_EVS_EVENTLOG = 16, - - /** - * @brief Software Bus Pipe Data Dump File - * - * - * Software Bus Pipe Data Dump File which is generated in response to a - * \link #CFE_SB_WRITE_PIPE_INFO_CC \SB_WRITEPIPE2FILE \endlink - * command. - * - */ - CFE_FS_SubType_SB_PIPEDATA = 20, - - /** - * @brief Software Bus Message Routing Data Dump File - * - * - * Software Bus Message Routing Data Dump File which is generated in response to a - * \link #CFE_SB_WRITE_ROUTING_INFO_CC \SB_WRITEROUTING2FILE \endlink - * command. - * - */ - CFE_FS_SubType_SB_ROUTEDATA = 21, - - /** - * @brief Software Bus Message Mapping Data Dump File - * - * - * Software Bus Message Mapping Data Dump File which is generated in response to a - * \link #CFE_SB_WRITE_MAP_INFO_CC \SB_WRITEMAP2FILE \endlink - * command. - * - */ - CFE_FS_SubType_SB_MAPDATA = 22, - - /** - * @brief Executive Services Query All Tasks Data File - * - * - * Executive Services Query All Tasks Data File which is generated in response to a - * \link #CFE_ES_QUERY_ALL_TASKS_CC \ES_WRITETASKINFO2FILE \endlink - * command. - * - */ - CFE_FS_SubType_ES_QUERYALLTASKS = 23 + /** + * @brief Executive Services Exception/Reset Log Type + * + * + * Executive Services Exception/Reset Log File which is generated in response to a + * \link #CFE_ES_WRITE_ER_LOG_CC \ES_WRITEERLOG2FILE \endlink + * command. + * + */ + CFE_FS_SubType_ES_ERLOG = 1, + + /** + * @brief Executive Services System Log Type + * + * + * Executive Services System Log File which is generated in response to a + * \link #CFE_ES_WRITE_SYSLOG_CC \ES_WRITESYSLOG2FILE \endlink + * command. + * + */ + CFE_FS_SubType_ES_SYSLOG = 2, + + /** + * @brief Executive Services Information on All Applications File + * + * + * Executive Services Information on All Applications File which is generated in response to a + * \link #CFE_ES_QUERY_ALL_CC \ES_WRITEAPPINFO2FILE \endlink + * command. + * + */ + CFE_FS_SubType_ES_QUERYALL = 3, + + /** + * @brief Executive Services Performance Data File + * + * + * Executive Services Performance Analyzer Data File which is generated in response to a + * \link #CFE_ES_STOP_PERF_DATA_CC \ES_STOPLADATA \endlink + * command. + * + */ + CFE_FS_SubType_ES_PERFDATA = 4, + + /** + * @brief Executive Services Shell Response File + * + * + * Executive Services Shell Response Data File which is generated in response to a + * shell command. + * + */ + CFE_FS_SubType_ES_SHELL = 5, + + /** + * @brief Executive Services Critical Data Store Registry Dump File + * + * + * Executive Services Critical Data Store Registry Dump File which is generated in response to a + * \link #CFE_ES_DUMP_CDS_REGISTRY_CC \ES_DUMPCDSREG \endlink + * command. + * + */ + CFE_FS_SubType_ES_CDS_REG = 6, + + /** + * @brief Table Services Registry Dump File + * + * + * Table Services Registry Dump File which is generated in response to a + * \link #CFE_TBL_DUMP_REGISTRY_CC \TBL_WRITEREG2FILE \endlink + * command. + * + */ + CFE_FS_SubType_TBL_REG = 9, + + /** + * @brief Table Services Table Image File + * + * + * Table Services Table Image File which is generated either on the ground or in response to a + * \link #CFE_TBL_DUMP_CC \TBL_DUMP \endlink command. + * + */ + CFE_FS_SubType_TBL_IMG = 8, + + /** + * @brief Event Services Application Data Dump File + * + * + * Event Services Application Data Dump File which is generated in response to a + * \link #CFE_EVS_WRITE_APP_DATA_FILE_CC \EVS_WRITEAPPDATA2FILE \endlink + * command. + * + */ + CFE_FS_SubType_EVS_APPDATA = 15, + + /** + * @brief Event Services Local Event Log Dump File + * + * + * Event Services Local Event Log Dump File which is generated in response to a + * \link #CFE_EVS_WRITE_LOG_DATA_FILE_CC \EVS_WRITELOG2FILE \endlink + * command. + * + */ + CFE_FS_SubType_EVS_EVENTLOG = 16, + + /** + * @brief Software Bus Pipe Data Dump File + * + * + * Software Bus Pipe Data Dump File which is generated in response to a + * \link #CFE_SB_WRITE_PIPE_INFO_CC \SB_WRITEPIPE2FILE \endlink + * command. + * + */ + CFE_FS_SubType_SB_PIPEDATA = 20, + + /** + * @brief Software Bus Message Routing Data Dump File + * + * + * Software Bus Message Routing Data Dump File which is generated in response to a + * \link #CFE_SB_WRITE_ROUTING_INFO_CC \SB_WRITEROUTING2FILE \endlink + * command. + * + */ + CFE_FS_SubType_SB_ROUTEDATA = 21, + + /** + * @brief Software Bus Message Mapping Data Dump File + * + * + * Software Bus Message Mapping Data Dump File which is generated in response to a + * \link #CFE_SB_WRITE_MAP_INFO_CC \SB_WRITEMAP2FILE \endlink + * command. + * + */ + CFE_FS_SubType_SB_MAPDATA = 22, + + /** + * @brief Executive Services Query All Tasks Data File + * + * + * Executive Services Query All Tasks Data File which is generated in response to a + * \link #CFE_ES_QUERY_ALL_TASKS_CC \ES_WRITETASKINFO2FILE \endlink + * command. + * + */ + CFE_FS_SubType_ES_QUERYALLTASKS = 23 }; /** @@ -213,34 +211,29 @@ enum CFE_FS_SubType * * @sa enum CFE_FS_SubType */ -typedef uint32 CFE_FS_SubType_Enum_t; - +typedef uint32 CFE_FS_SubType_Enum_t; /** ** \brief Standard cFE File header structure definition */ typedef struct CFE_FS_Header { - uint32 ContentType; /**< \brief Identifies the content type (='cFE1'=0x63464531)*/ - uint32 SubType; /**< \brief Type of \c ContentType, if necessary */ - /**< Standard SubType definitions can be found - \link #CFE_FS_SubType_ES_ERLOG here \endlink */ - uint32 Length; /**< \brief Length of primary header */ - uint32 SpacecraftID; /**< \brief Spacecraft that generated the file */ - uint32 ProcessorID; /**< \brief Processor that generated the file */ - uint32 ApplicationID; /**< \brief Application that generated the file */ + uint32 ContentType; /**< \brief Identifies the content type (='cFE1'=0x63464531)*/ + uint32 SubType; /**< \brief Type of \c ContentType, if necessary */ + /**< Standard SubType definitions can be found + \link #CFE_FS_SubType_ES_ERLOG here \endlink */ + uint32 Length; /**< \brief Length of primary header */ + uint32 SpacecraftID; /**< \brief Spacecraft that generated the file */ + uint32 ProcessorID; /**< \brief Processor that generated the file */ + uint32 ApplicationID; /**< \brief Application that generated the file */ - uint32 TimeSeconds; /**< \brief File creation timestamp (seconds) */ - uint32 TimeSubSeconds; /**< \brief File creation timestamp (sub-seconds) */ + uint32 TimeSeconds; /**< \brief File creation timestamp (seconds) */ + uint32 TimeSubSeconds; /**< \brief File creation timestamp (sub-seconds) */ - char Description[CFE_FS_HDR_DESC_MAX_LEN]; /**< \brief File description */ + char Description[CFE_FS_HDR_DESC_MAX_LEN]; /**< \brief File description */ } CFE_FS_Header_t; - - - #endif /* CFE_EDS_ENABLED_BUILD */ #endif /* _CFE_FS_EXTERN_TYPEDEFS_H_ */ - diff --git a/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h b/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h index a2c5ee543..d444684e6 100644 --- a/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_msg_api_typedefs.h @@ -89,9 +89,9 @@ typedef enum CFE_MSG_PlaybackFlag /* * Abstract Message Base Types - * - * The concrete definition of these is provided by "cfe_msg_hdr.h" which is - * user-selectable depending on the actual desired message defintion. These + * + * The concrete definition of these is provided by "cfe_msg_hdr.h" which is + * user-selectable depending on the actual desired message defintion. These * abstract types are used in the API definition; the API is defined based * on these abstract types, independent of the actual message definition. */ @@ -111,5 +111,4 @@ typedef struct CFE_MSG_CommandHeader CFE_MSG_CommandHeader_t; */ typedef struct CFE_MSG_TelemetryHeader CFE_MSG_TelemetryHeader_t; - #endif /* _cfe_msg_typedefs_ */ diff --git a/modules/core_api/fsw/inc/cfe_resourceid.h b/modules/core_api/fsw/inc/cfe_resourceid.h index 12f2fef27..b94d27d1d 100644 --- a/modules/core_api/fsw/inc/cfe_resourceid.h +++ b/modules/core_api/fsw/inc/cfe_resourceid.h @@ -26,7 +26,7 @@ * * A CFE ES Resource ID is a common way to identify CFE-managed resources such * as apps, tasks, counters, memory pools, CDS blocks, and other entities. - * + * * Simple operations are provided as inline functions, which * should alleviate the need to do direct manipulation of resource IDs: * @@ -44,42 +44,40 @@ */ #include "cfe_resourceid_api_typedefs.h" - /** \name Resource ID test/conversion macros and inline functions */ /** \{ */ - /** * \brief Convert a derived (app-specific) ID directly into an "unsigned long" - * - * This generic routine is implemented as a macro so it is agnostic to the actual argument type, + * + * This generic routine is implemented as a macro so it is agnostic to the actual argument type, * and it will evaluate correctly so long as the argument type is based on the CFE_RESOURCEID_BASE_TYPE. - * + * * There is no inverse of this macro, as it depends on the actual derived type desired. * Applications needing to recreate an ID from an integer should use CFE_ResourceId_FromInteger() * combined with a cast/conversion to the correct/intended derived type, as needed. - * - * \note This evaluates as an "unsigned long" such that it can be used in + * + * \note This evaluates as an "unsigned long" such that it can be used in * printf()-style functions with the "%lx" modifier without extra casting, * as this is the most typical use-case for representing an ID as an integer. */ -#define CFE_RESOURCEID_TO_ULONG(id) CFE_ResourceId_ToInteger(CFE_RESOURCEID_UNWRAP(id)) +#define CFE_RESOURCEID_TO_ULONG(id) CFE_ResourceId_ToInteger(CFE_RESOURCEID_UNWRAP(id)) /** * \brief Determine if a derived (app-specific) ID is defined or not - * - * This generic routine is implemented as a macro so it is agnostic to the actual argument type, + * + * This generic routine is implemented as a macro so it is agnostic to the actual argument type, * and it will evaluate correctly so long as the argument type is based on the CFE_RESOURCEID_BASE_TYPE. */ -#define CFE_RESOURCEID_TEST_DEFINED(id) CFE_ResourceId_IsDefined(CFE_RESOURCEID_UNWRAP(id)) +#define CFE_RESOURCEID_TEST_DEFINED(id) CFE_ResourceId_IsDefined(CFE_RESOURCEID_UNWRAP(id)) /** * \brief Determine if two derived (app-specific) IDs are equal - * - * This generic routine is implemented as a macro so it is agnostic to the actual argument type, + * + * This generic routine is implemented as a macro so it is agnostic to the actual argument type, * and it will evaluate correctly so long as the argument type is based on the CFE_RESOURCEID_BASE_TYPE. */ -#define CFE_RESOURCEID_TEST_EQUAL(id1,id2) CFE_ResourceId_Equal(CFE_RESOURCEID_UNWRAP(id1), CFE_RESOURCEID_UNWRAP(id2)) +#define CFE_RESOURCEID_TEST_EQUAL(id1, id2) CFE_ResourceId_Equal(CFE_RESOURCEID_UNWRAP(id1), CFE_RESOURCEID_UNWRAP(id2)) /** * @brief Convert a resource ID to an integer. @@ -159,7 +157,6 @@ static inline bool CFE_ResourceId_IsDefined(CFE_ResourceId_t id) /** \} */ - /* * Non-inline API functions provided by the Resource ID module */ @@ -169,7 +166,7 @@ static inline bool CFE_ResourceId_IsDefined(CFE_ResourceId_t id) * * This masks out the ID serial number to obtain the base value, which is different * for each resource type. - * + * * @note The value is NOT shifted or otherwise adjusted. * * @param[in] ResourceId the resource ID to decode @@ -182,13 +179,12 @@ extern uint32 CFE_ResourceId_GetBase(CFE_ResourceId_t ResourceId); * * This masks out the ID base value to obtain the serial number, which is different * for each entity created. - * + * * @param[in] ResourceId the resource ID to decode * @returns The serial number associated with that ID */ extern uint32 CFE_ResourceId_GetSerial(CFE_ResourceId_t ResourceId); - /** * @brief Locate the next resource ID which does not map to an in-use table entry * @@ -206,7 +202,8 @@ extern uint32 CFE_ResourceId_GetSerial(CFE_ResourceId_t ResourceId); * @retval #CFE_RESOURCEID_UNDEFINED if no open slots. * */ -extern CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableSize, bool (*CheckFunc)(CFE_ResourceId_t) ); +extern CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableSize, + bool (*CheckFunc)(CFE_ResourceId_t)); /** * @brief Internal routine to aid in converting an ES resource ID to an array index @@ -219,6 +216,4 @@ extern CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 */ extern int32 CFE_ResourceId_ToIndex(CFE_ResourceId_t Id, uint32 BaseValue, uint32 TableSize, uint32 *Idx); - - -#endif /* CFE_RESOURCEID_H */ +#endif /* CFE_RESOURCEID_H */ diff --git a/modules/core_api/fsw/inc/cfe_resourceid_api_typedefs.h b/modules/core_api/fsw/inc/cfe_resourceid_api_typedefs.h index 89a03bf3e..77520b35e 100644 --- a/modules/core_api/fsw/inc/cfe_resourceid_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_resourceid_api_typedefs.h @@ -26,7 +26,7 @@ * * A CFE ES Resource ID is a common way to identify CFE-managed resources such * as apps, tasks, counters, memory pools, CDS blocks, and other entities. - * + * * Simple operations are provided as inline functions, which * should alleviate the need to do direct manipulation of resource IDs: * @@ -41,7 +41,7 @@ /* * The basic resource ID typedef - * + * * This is provided via the external resourceid library * and may be customized by the user/mission preferences. */ @@ -54,7 +54,6 @@ /** \name Resource ID predefined values */ /** \{ */ - /** * @brief A resource ID value that represents an undefined/unused resource * @@ -65,7 +64,7 @@ * type via standard functions like memset(), such that objects initialized * using this method will also be set to safe values. */ -#define CFE_RESOURCEID_UNDEFINED ((CFE_ResourceId_t) CFE_RESOURCEID_WRAP(0)) +#define CFE_RESOURCEID_UNDEFINED ((CFE_ResourceId_t)CFE_RESOURCEID_WRAP(0)) /** * @brief A resource ID value that represents a reserved entry @@ -74,9 +73,8 @@ * table entries that are not available for use. For instance, this may * be used while setting up an entry initially. */ -#define CFE_RESOURCEID_RESERVED ((CFE_ResourceId_t) CFE_RESOURCEID_WRAP(0xFFFFFFFF)) +#define CFE_RESOURCEID_RESERVED ((CFE_ResourceId_t)CFE_RESOURCEID_WRAP(0xFFFFFFFF)) /** \} */ - -#endif /* CFE_RESOURCEID_API_TYPEDEFS_H */ +#endif /* CFE_RESOURCEID_API_TYPEDEFS_H */ diff --git a/modules/core_api/fsw/inc/cfe_sb.h b/modules/core_api/fsw/inc/cfe_sb.h index 7c5d99af3..c673e5329 100644 --- a/modules/core_api/fsw/inc/cfe_sb.h +++ b/modules/core_api/fsw/inc/cfe_sb.h @@ -48,11 +48,10 @@ /* ** Macro Definitions */ -#define CFE_BIT(x) (1 << (x)) /**< \brief Places a one at bit positions 0 - 31*/ -#define CFE_SET(i,x) ((i) |= CFE_BIT(x)) /**< \brief Sets bit x of i */ -#define CFE_CLR(i,x) ((i) &= ~CFE_BIT(x)) /**< \brief Clears bit x of i */ -#define CFE_TST(i,x) (((i) & CFE_BIT(x)) != 0)/**< \brief true(non zero) if bit x of i is set */ - +#define CFE_BIT(x) (1 << (x)) /**< \brief Places a one at bit positions 0 - 31*/ +#define CFE_SET(i, x) ((i) |= CFE_BIT(x)) /**< \brief Sets bit x of i */ +#define CFE_CLR(i, x) ((i) &= ~CFE_BIT(x)) /**< \brief Clears bit x of i */ +#define CFE_TST(i, x) (((i)&CFE_BIT(x)) != 0) /**< \brief true(non zero) if bit x of i is set */ /****************** Function Prototypes **********************/ @@ -94,7 +93,7 @@ ** ** \sa #CFE_SB_DeletePipe #CFE_SB_GetPipeOpts #CFE_SB_SetPipeOpts #CFE_SB_GetPipeIdByName **/ -CFE_Status_t CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *PipeName); +CFE_Status_t CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *PipeName); /*****************************************************************************/ /** @@ -123,7 +122,7 @@ CFE_Status_t CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const ** ** \sa #CFE_SB_CreatePipe #CFE_SB_GetPipeOpts #CFE_SB_SetPipeOpts #CFE_SB_GetPipeIdByName **/ -CFE_Status_t CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId); +CFE_Status_t CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId); /** * @brief Obtain an index value correlating to an SB Pipe ID @@ -150,7 +149,6 @@ CFE_Status_t CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId); */ CFE_Status_t CFE_SB_PipeId_ToIndex(CFE_SB_PipeId_t PipeID, uint32 *Idx); - /*****************************************************************************/ /** ** \brief Set options on a pipe. @@ -169,7 +167,7 @@ CFE_Status_t CFE_SB_PipeId_ToIndex(CFE_SB_PipeId_t PipeID, uint32 *Idx); ** ** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_GetPipeOpts #CFE_SB_GetPipeIdByName #CFE_SB_PIPEOPTS_IGNOREMINE **/ -CFE_Status_t CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts); +CFE_Status_t CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts); /*****************************************************************************/ /** @@ -188,7 +186,7 @@ CFE_Status_t CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts); ** ** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_SetPipeOpts #CFE_SB_GetPipeIdByName #CFE_SB_PIPEOPTS_IGNOREMINE **/ -CFE_Status_t CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptPtr); +CFE_Status_t CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptPtr); /*****************************************************************************/ /** @@ -228,7 +226,7 @@ CFE_Status_t CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_P ** ** \sa #CFE_SB_CreatePipe #CFE_SB_DeletePipe #CFE_SB_SetPipeOpts #CFE_SB_PIPEOPTS_IGNOREMINE **/ -CFE_Status_t CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName); +CFE_Status_t CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName); /**@}*/ /** @defgroup CFEAPISBSubscription cFE Message Subscription Control APIs @@ -273,7 +271,7 @@ CFE_Status_t CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *Pip ** ** \sa #CFE_SB_Subscribe, #CFE_SB_SubscribeLocal, #CFE_SB_Unsubscribe, #CFE_SB_UnsubscribeLocal **/ -CFE_Status_t CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality, uint16 MsgLim); +CFE_Status_t CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality, uint16 MsgLim); /*****************************************************************************/ /** @@ -367,7 +365,7 @@ CFE_Status_t CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, ** ** \sa #CFE_SB_Subscribe, #CFE_SB_SubscribeEx, #CFE_SB_SubscribeLocal, #CFE_SB_UnsubscribeLocal **/ -CFE_Status_t CFE_SB_Unsubscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId); +CFE_Status_t CFE_SB_Unsubscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId); /*****************************************************************************/ /** @@ -428,7 +426,7 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI ** \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); +CFE_Status_t CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount); #ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ @@ -459,7 +457,7 @@ CFE_Status_t CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequen ** \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_SendMsg(CFE_MSG_Message_t *MsgPtr); +CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** @@ -489,7 +487,7 @@ CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr); ** \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_PassMsg(CFE_MSG_Message_t *MsgPtr); +CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr); #endif /* CFE_OMIT_DEPRECATED_6_8 */ /*****************************************************************************/ @@ -578,8 +576,7 @@ CFE_Status_t CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t PipeId, int ** \return A pointer to a memory buffer that message data can be written to ** for use with #CFE_SB_TransmitBuffer. **/ -CFE_SB_Buffer_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); /*****************************************************************************/ /** @@ -622,16 +619,16 @@ CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_Zero ** performance in high-rate, high-volume software bus traffic. ** ** \par Assumptions, External Events, and Notes: -** -# A handle returned by #CFE_SB_ZeroCopyGetPtr is "consumed" by -** a _successful_ call to #CFE_SB_TransmitBuffer. -** -# If this function returns CFE_SUCCESS, this indicates the zero copy handle is +** -# A handle returned by #CFE_SB_ZeroCopyGetPtr is "consumed" by +** a _successful_ call to #CFE_SB_TransmitBuffer. +** -# If this function returns CFE_SUCCESS, this indicates the zero copy handle is ** now owned by software bus, and is no longer owned by the calling application, ** and should not be re-used. ** -# Howver if this function fails (returns any error status) it does not change ** the state of the buffer at all, meaning the calling application still owns it. ** (a failure means the buffer is left in the same state it was before the call). ** -# Applications should be written as if #CFE_SB_ZeroCopyGetPtr is -** equivalent to a \c malloc() and a successful call to #CFE_SB_TransmitBuffer +** equivalent to a \c malloc() and a successful call to #CFE_SB_TransmitBuffer ** is equivalent to a \c free(). ** -# Applications must not de-reference the message pointer (for reading ** or writing) after a successful call to #CFE_SB_TransmitBuffer. @@ -650,8 +647,7 @@ CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_Zero ** \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_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, - CFE_SB_ZeroCopyHandle_t ZeroCopyHandle, +CFE_Status_t CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t ZeroCopyHandle, bool IncrementSequenceCount); #ifndef CFE_OMIT_DEPRECATED_6_8 @@ -769,10 +765,7 @@ CFE_Status_t CFE_SB_ZeroCopyPass(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_ ** \arg true - fill sequence count and packet data with zeroes. ** \arg false - leave sequence count and packet data unchanged. **/ -void CFE_SB_InitMsg(void *MsgPtr, - CFE_SB_MsgId_t MsgId, - size_t Length, - bool Clear ); +void CFE_SB_InitMsg(void *MsgPtr, CFE_SB_MsgId_t MsgId, size_t Length, bool Clear); /*****************************************************************************/ /** @@ -790,8 +783,7 @@ void CFE_SB_InitMsg(void *MsgPtr, ** ** \param[in] MsgId The message ID to put into the message header. **/ -void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, - CFE_SB_MsgId_t MsgId); +void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId); #endif /* CFE_OMIT_DEPRECATED_6_8 */ /*****************************************************************************/ @@ -814,7 +806,7 @@ void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, ** ** \param[in] DataLength The length to set (size of the user data, in bytes). **/ -void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr,size_t DataLength); +void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr, size_t DataLength); #ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ @@ -838,7 +830,7 @@ void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr,size_t DataLength); ** \param[in] TotalLength The length to set (total size of the message, in bytes, ** including headers). **/ -void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr,size_t TotalLength); +void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr, size_t TotalLength); /*****************************************************************************/ /** @@ -871,7 +863,6 @@ void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr,size_t TotalLength); CFE_Status_t CFE_SB_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t Time); #endif /* CFE_OMIT_DEPRECATED_6_8 */ - /*****************************************************************************/ /** ** \brief Sets the time field in a software bus message with the current spacecraft time. @@ -949,7 +940,8 @@ CFE_Status_t CFE_SB_SetCmdCode(CFE_MSG_Message_t *MsgPtr, uint16 CmdCode); ** \return Number of characters copied or error code, see \ref CFEReturnCodes ** */ -int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, size_t SourceMaxSize); +int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, + size_t SourceMaxSize); /**@}*/ /** @defgroup CFEAPIGetMessage cFE Getting Message Characteristics APIs @@ -1116,7 +1108,8 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_MSG_Message_t *MsgPtr); ** \return Number of characters copied or error code, see \ref CFEReturnCodes ** */ -int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, size_t DestMaxSize, size_t SourceMaxSize); +int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, + size_t DestMaxSize, size_t SourceMaxSize); /**@}*/ #ifndef CFE_OMIT_DEPRECATED_6_8 @@ -1214,7 +1207,6 @@ bool CFE_SB_ValidateChecksum(CFE_MSG_Message_t *MsgPtr); */ bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId); - /*****************************************************************************/ /** * \brief Identifies whether two #CFE_SB_MsgId_t values are equal @@ -1317,5 +1309,5 @@ uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId); /**@}*/ -#endif /* CFE_SB_API_H */ +#endif /* CFE_SB_API_H */ /*****************************************************************************/ diff --git a/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h b/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h index 942931395..3aca7caaf 100644 --- a/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h @@ -44,10 +44,10 @@ /* ** Defines */ -#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_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 */ +#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_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 */ /* ------------------------------------------------------ */ /* Macro Constants for use with the CFE_SB_MsgId_t type */ @@ -63,7 +63,7 @@ * * \sa CFE_SB_ValueToMsgId() */ -#define CFE_SB_MSGID_WRAP_VALUE(val) ((CFE_SB_MsgId_t)(val)) +#define CFE_SB_MSGID_WRAP_VALUE(val) ((CFE_SB_MsgId_t)(val)) /** * \brief Translation macro to convert to MsgId integer values from opaque/abstract API values @@ -75,7 +75,7 @@ * * \sa CFE_SB_MsgIdToValue() */ -#define CFE_SB_MSGID_UNWRAP_VALUE(mid) ((CFE_SB_MsgId_Atom_t)(mid)) +#define CFE_SB_MSGID_UNWRAP_VALUE(mid) ((CFE_SB_MsgId_Atom_t)(mid)) /** * \brief Reserved value for CFE_SB_MsgId_t that will not match any valid MsgId @@ -83,7 +83,7 @@ * This rvalue macro can be used for static/compile-time data initialization to ensure that * the initialized value does not alias to a valid MsgId object. */ -#define CFE_SB_MSGID_RESERVED CFE_SB_MSGID_WRAP_VALUE(-1) +#define CFE_SB_MSGID_RESERVED CFE_SB_MSGID_WRAP_VALUE(-1) /** * \brief A literal of the CFE_SB_MsgId_t type representing an invalid ID @@ -96,47 +96,47 @@ * purposes (rvalue), #CFE_SB_MSGID_RESERVED should be used instead. * However, in the current implementation, they are equivalent. */ -#define CFE_SB_INVALID_MSG_ID CFE_SB_MSGID_RESERVED +#define CFE_SB_INVALID_MSG_ID CFE_SB_MSGID_RESERVED #ifndef CFE_OMIT_DEPRECATED_6_8 /** * \defgroup CFESBPktTypeDefs cFE SB Packet Type Defines * \{ */ -#define CFE_SB_PKTTYPE_INVALID CFE_MSG_Type_Invalid /**< \brief #CFE_SB_GetPktType response if message type can not be determined */ -#define CFE_SB_PKTTYPE_CMD CFE_MSG_Type_Cmd /**< \brief #CFE_SB_GetPktType response for command packets */ -#define CFE_SB_PKTTYPE_TLM CFE_MSG_Type_Tlm /**< \brief #CFE_SB_GetPktType response for telemetry packets */ +#define CFE_SB_PKTTYPE_INVALID \ + CFE_MSG_Type_Invalid /**< \brief #CFE_SB_GetPktType response if message type can not be determined */ +#define CFE_SB_PKTTYPE_CMD CFE_MSG_Type_Cmd /**< \brief #CFE_SB_GetPktType response for command packets */ +#define CFE_SB_PKTTYPE_TLM CFE_MSG_Type_Tlm /**< \brief #CFE_SB_GetPktType response for telemetry packets */ /** \} */ #endif /* CFE_OMIT_DEPRECATED_6_8 */ -/** +/** * \brief Cast/Convert a generic CFE_ResourceId_t to a CFE_SB_PipeId_t - */ -#define CFE_SB_PIPEID_C(val) ((CFE_SB_PipeId_t)CFE_RESOURCEID_WRAP(val)) - + */ +#define CFE_SB_PIPEID_C(val) ((CFE_SB_PipeId_t)CFE_RESOURCEID_WRAP(val)) -/** +/** * \brief A CFE_SB_PipeId_t value which is always invalid - * + * * This may be used as a safe initializer for CFE_SB_PipeId_t values */ -#define CFE_SB_INVALID_PIPE CFE_SB_PIPEID_C(CFE_RESOURCEID_UNDEFINED) +#define CFE_SB_INVALID_PIPE CFE_SB_PIPEID_C(CFE_RESOURCEID_UNDEFINED) /* ** Pipe option bit fields. */ -#define CFE_SB_PIPEOPTS_IGNOREMINE 0x00000001 /**< \brief Messages sent by the app that owns this pipe will not be sent to this pipe. */ - +#define CFE_SB_PIPEOPTS_IGNOREMINE \ + 0x00000001 /**< \brief Messages sent by the app that owns this pipe will not be sent to this pipe. */ #define CFE_SB_DEFAULT_QOS ((CFE_SB_Qos_t) {0}) /**< \brief Default Qos macro */ - /* ** Type Definitions */ /** \brief Software Bus generic message */ -typedef union CFE_SB_Msg { +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 */ @@ -153,8 +153,8 @@ typedef CFE_MSG_CommandHeader_t CFE_SB_CmdHdr_t; /** \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 */ +#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 */ /** \brief Pointer to an SB Message */ typedef CFE_MSG_Message_t *CFE_SB_MsgPtr_t; @@ -170,21 +170,17 @@ typedef uint8 *CFE_SB_MsgPayloadPtr_t; */ typedef struct { - struct CFE_SB_BufferD* BufDscPtr; /* abstract descriptor reference (internal use) */ + struct CFE_SB_BufferD *BufDscPtr; /* abstract descriptor reference (internal use) */ } CFE_SB_ZeroCopyHandle_t; - #ifndef CFE_OMIT_DEPRECATED_6_8 -#define CFE_SB_Default_Qos CFE_SB_DEFAULT_QOS /**< \deprecated use CFE_SB_DEFAULT_QOS */ +#define CFE_SB_Default_Qos CFE_SB_DEFAULT_QOS /**< \deprecated use CFE_SB_DEFAULT_QOS */ -#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 */ +#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 */ - - - -#endif /* CFE_SB_API_TYPEDEFS_H */ +#endif /* CFE_SB_API_TYPEDEFS_H */ /*****************************************************************************/ diff --git a/modules/core_api/fsw/inc/cfe_sb_core_internal.h b/modules/core_api/fsw/inc/cfe_sb_core_internal.h index ac2e48e48..d1e90d10e 100644 --- a/modules/core_api/fsw/inc/cfe_sb_core_internal.h +++ b/modules/core_api/fsw/inc/cfe_sb_core_internal.h @@ -32,12 +32,11 @@ #ifndef CFE_SB_CORE_INTERNAL_H #define CFE_SB_CORE_INTERNAL_H - #include "common_types.h" #include "cfe_es_extern_typedefs.h" /* - * The internal APIs prototyped within this block are only intended to be invoked from + * The internal APIs prototyped within this block are only intended to be invoked from * other CFE core apps. They still need to be prototyped in the shared header such that * they can be called from other core modules, but applications should not call these. */ @@ -56,7 +55,7 @@ ** \par Assumptions, External Events, and Notes: ** None ** -** +** ******************************************************************************/ extern void CFE_SB_TaskMain(void); @@ -73,7 +72,6 @@ extern void CFE_SB_TaskMain(void); ******************************************************************************/ extern int32 CFE_SB_EarlyInit(void); - /*****************************************************************************/ /** ** \brief Removes SB resources associated with specified Application @@ -86,8 +84,7 @@ extern int32 CFE_SB_EarlyInit(void); ******************************************************************************/ extern int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId); - /**@}*/ -#endif /* CFE_SB_CORE_INTERNAL_H */ +#endif /* CFE_SB_CORE_INTERNAL_H */ /*****************************************************************************/ diff --git a/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h index 4db2ada5f..e1c0795a5 100644 --- a/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h @@ -21,7 +21,7 @@ #ifndef _CFE_SB_EXTERN_TYPEDEFS_H_ #define _CFE_SB_EXTERN_TYPEDEFS_H_ -/* This header may be generated from an EDS file, +/* This header may be generated from an EDS file, * tools are available and the feature is enabled */ #ifdef CFE_EDS_ENABLED_BUILD @@ -35,8 +35,7 @@ #include "cfe_mission_cfg.h" #include "cfe_resourceid_typedef.h" - -#define CFE_SB_SUB_ENTRIES_PER_PKT 20 /**< \brief Configuration parameter used by SBN App */ +#define CFE_SB_SUB_ENTRIES_PER_PKT 20 /**< \brief Configuration parameter used by SBN App */ /** * @brief Label definitions associated with CFE_SB_QosPriority_Enum_t @@ -44,15 +43,15 @@ enum CFE_SB_QosPriority { - /** - * @brief Normal priority level - */ - CFE_SB_QosPriority_LOW = 0, + /** + * @brief Normal priority level + */ + CFE_SB_QosPriority_LOW = 0, - /** - * @brief High priority - */ - CFE_SB_QosPriority_HIGH = 1 + /** + * @brief High priority + */ + CFE_SB_QosPriority_HIGH = 1 }; /** @@ -61,8 +60,7 @@ enum CFE_SB_QosPriority * * @sa enum CFE_SB_QosPriority */ -typedef uint8 CFE_SB_QosPriority_Enum_t; - +typedef uint8 CFE_SB_QosPriority_Enum_t; /** * @brief Label definitions associated with CFE_SB_QosReliability_Enum_t @@ -70,15 +68,15 @@ typedef uint8 CFE_SB_QosPriority_Enum enum CFE_SB_QosReliability { - /** - * @brief Normal (best-effort) reliability - */ - CFE_SB_QosReliability_LOW = 0, + /** + * @brief Normal (best-effort) reliability + */ + CFE_SB_QosReliability_LOW = 0, - /** - * @brief High reliability - */ - CFE_SB_QosReliability_HIGH = 1 + /** + * @brief High reliability + */ + CFE_SB_QosReliability_HIGH = 1 }; /** @@ -87,12 +85,12 @@ enum CFE_SB_QosReliability * * @sa enum CFE_SB_QosReliability */ -typedef uint8 CFE_SB_QosReliability_Enum_t; +typedef uint8 CFE_SB_QosReliability_Enum_t; /** * @brief An integer type that should be used for indexing into the Routing Table */ -typedef uint16 CFE_SB_RouteId_Atom_t; +typedef uint16 CFE_SB_RouteId_Atom_t; /** * @brief CFE_SB_MsgId_Atom_t primitive type definition @@ -127,13 +125,13 @@ typedef CFE_RESOURCEID_BASE_TYPE CFE_SB_PipeId_t; ** Currently an unused parameter in #CFE_SB_SubscribeEx ** Intended to be used for interprocessor communication only **/ -typedef struct { - uint8 Priority;/**< \brief Specify high(1) or low(0) message priority for off-board routing, currently unused */ - uint8 Reliability;/**< \brief Specify high(1) or low(0) message transfer reliability for off-board routing, currently unused */ -}CFE_SB_Qos_t; - +typedef struct +{ + uint8 Priority; /**< \brief Specify high(1) or low(0) message priority for off-board routing, currently unused */ + uint8 Reliability; /**< \brief Specify high(1) or low(0) message transfer reliability for off-board routing, + currently unused */ +} CFE_SB_Qos_t; #endif /* CFE_EDS_ENABLED_BUILD */ #endif /* _CFE_SB_EXTERN_TYPEDEFS_H_ */ - diff --git a/modules/core_api/fsw/inc/cfe_tbl.h b/modules/core_api/fsw/inc/cfe_tbl.h index 8952f21ed..5ea67bae8 100644 --- a/modules/core_api/fsw/inc/cfe_tbl.h +++ b/modules/core_api/fsw/inc/cfe_tbl.h @@ -39,12 +39,11 @@ #define CFE_TBL_API_H /********************* Include Files ************************/ -#include "common_types.h" /* Basic Data Types */ +#include "common_types.h" /* Basic Data Types */ #include "cfe_error.h" #include "cfe_tbl_api_typedefs.h" #include "cfe_sb_api_typedefs.h" - /*************************** Function Prototypes ******************************/ /** \defgroup CFEAPITBLRegistration cFE Registration APIs @@ -56,114 +55,120 @@ ** \brief Register a table with cFE to obtain Table Management Services ** ** \par Description -** When an application is created and initialized, it is responsible for creating its table images via -** the TBL API. The application must inform the Table Service of the table name, table size and selection +** When an application is created and initialized, it is responsible for creating its table images via +** the TBL API. The application must inform the Table Service of the table name, table size and selection ** of optional table features. ** ** \par Assumptions, External Events, and Notes: -** Note: This function call can block. Therefore, interrupt service routines should NOT create -** their own tables. An application should create any table(s) and provide the handle(s) +** Note: This function call can block. Therefore, interrupt service routines should NOT create +** their own tables. An application should create any table(s) and provide the handle(s) ** to the interrupt service routine. ** -** \param[in, out] TblHandlePtr a pointer to a #CFE_TBL_Handle_t type variable that will be assigned the -** table's handle. The table handle is required for other API calls when -** accessing the data contained in the table. *TblHandlePtr is the handle used to identify table to cFE when performing Table operations. -** This value is returned at the address specified by TblHandlePtr. +** \param[in, out] TblHandlePtr a pointer to a #CFE_TBL_Handle_t type variable that will be assigned the table's +** handle. The table handle is required for other API calls when accessing the data +** contained in the table. *TblHandlePtr is the handle used to identify table to cFE +** when performing Table operations. This value is returned at ddress specified by +** TblHandlePtr. ** -** \param[in] Name The application-specific name. This name will be combined with the name of the -** application to produce a processor specific name of the form -** "ApplicationName.TableName". The processor specific name will be used in commands +** \param[in] Name The application-specific name. This name will be combined with the name of the +** application to produce a processor specific name of the form +** "ApplicationName.TableName". The processor specific name will be used in commands ** for modifying or viewing the contents of the table. ** -** \param[in] Size The size, in bytes, of the table to be created. This is the size that will be -** allocated as a shared memory resource between the Table Management Service and +** \param[in] Size The size, in bytes, of the table to be created. This is the size that will be +** allocated as a shared memory resource between the Table Management Service and ** the calling application. ** -** \param[in] TblOptionFlags Flag bits indicating selected options for table. A bitwise OR of the following +** \param[in] TblOptionFlags Flag bits indicating selected options for table. A bitwise OR of the following ** option flags: -** \arg #CFE_TBL_OPT_DEFAULT - The default setting for table options is a -** combination of #CFE_TBL_OPT_SNGL_BUFFER and -** #CFE_TBL_OPT_LOAD_DUMP. See below for a -** description of these two options. This option -** is mutually exclusive with the -** #CFE_TBL_OPT_DBL_BUFFER, #CFE_TBL_OPT_DUMP_ONLY +** \arg #CFE_TBL_OPT_DEFAULT - The default setting for table options is a +** combination of #CFE_TBL_OPT_SNGL_BUFFER and +** #CFE_TBL_OPT_LOAD_DUMP. See below for a +** description of these two options. This option +** is mutually exclusive with the +** #CFE_TBL_OPT_DBL_BUFFER, #CFE_TBL_OPT_DUMP_ONLY ** and #CFE_TBL_OPT_USR_DEF_ADDR options. -** \arg #CFE_TBL_OPT_SNGL_BUFFER - When this option is selected, the table will use -** a shared session table for performing table -** modifications and a memory copy from the session -** table to the "active" table buffer will occur -** when the table is updated. This is the preferred -** option since it will minimize memory usage. -** This option is mutually exclusive with the +** \arg #CFE_TBL_OPT_SNGL_BUFFER - When this option is selected, the table will use +** a shared session table for performing table +** modifications and a memory copy from the session +** table to the "active" table buffer will occur +** when the table is updated. This is the preferred +** option since it will minimize memory usage. +** This option is mutually exclusive with the ** #CFE_TBL_OPT_DBL_BUFFER option -** \arg #CFE_TBL_OPT_DBL_BUFFER - When this option is selected, two instances of -** the table are created. One is considered the +** \arg #CFE_TBL_OPT_DBL_BUFFER - When this option is selected, two instances of +** the table are created. One is considered the ** "active" table and the other the "inactive" table. -** Whenever table modifications occur, they do not -** require the use of a common session table. -** Modifications occur in the "inactive" buffer. -** Then, when it is time to update the table, -** the pointer to the "active" table is changed to -** point to the "inactive" buffer thus making it -** the new "active" buffer. This feature is most -** useful for time critical applications (ie - -** interrupt service routines, etc). This option is -** mutually exclusive with the -** #CFE_TBL_OPT_SNGL_BUFFER and #CFE_TBL_OPT_DEFAULT +** Whenever table modifications occur, they do not +** require the use of a common session table. +** Modifications occur in the "inactive" buffer. +** Then, when it is time to update the table, +** the pointer to the "active" table is changed to +** point to the "inactive" buffer thus making it +** the new "active" buffer. This feature is most +** useful for time critical applications (ie - +** interrupt service routines, etc). This option is +** mutually exclusive with the +** #CFE_TBL_OPT_SNGL_BUFFER and #CFE_TBL_OPT_DEFAULT ** option. -** \arg #CFE_TBL_OPT_LOAD_DUMP - When this option is selected, the Table Service -** is allowed to perform all operations on the -** specified table. This option is mutually +** \arg #CFE_TBL_OPT_LOAD_DUMP - When this option is selected, the Table Service +** is allowed to perform all operations on the +** specified table. This option is mutually ** exclusive with the #CFE_TBL_OPT_DUMP_ONLY option. -** \arg #CFE_TBL_OPT_DUMP_ONLY - When this option is selected, the Table Service -** will not perform table loads to this table. This -** does not prevent, however, a task from writing -** to the table via an address obtained with the -** #CFE_TBL_GetAddress API function. This option is +** \arg #CFE_TBL_OPT_DUMP_ONLY - When this option is selected, the Table Service +** will not perform table loads to this table. This +** does not prevent, however, a task from writing +** to the table via an address obtained with the +** #CFE_TBL_GetAddress API function. This option is ** mutually exclusive with the #CFE_TBL_OPT_LOAD_DUMP -** and #CFE_TBL_OPT_DEFAULT options. If the Application wishes -** to specify their own block of memory as the Dump Only table, -** they need to also include the #CFE_TBL_OPT_USR_DEF_ADDR option -** explained below. -** \arg #CFE_TBL_OPT_NOT_USR_DEF - When this option is selected, Table Services allocates -** memory for the table and, in the case of a double buffered -** table, it allocates the same amount of memory again for the -** second buffer. This option is mutually exclusive with -** the #CFE_TBL_OPT_USR_DEF_ADDR option. -** \arg #CFE_TBL_OPT_USR_DEF_ADDR- When this option is selected, the Table Service -** will not allocate memory for the table. Table Services -** will require the Application to identify the location of the -** active table buffer via the #CFE_TBL_Load function. This -** option implies the #CFE_TBL_OPT_DUMP_ONLY and the -** #CFE_TBL_OPT_SNGL_BUFFER options and is mutually +** and #CFE_TBL_OPT_DEFAULT options. If the Application +** wishes to specify their own block of memory as the +** Dump Only table, they need to also include the +** #CFE_TBL_OPT_USR_DEF_ADDR option explained below. +** \arg #CFE_TBL_OPT_NOT_USR_DEF - When this option is selected, Table Services +** allocates memory for the table and, in the case of a +** double buffered table, it allocates the same amount +** of memory again for the second buffer. This option +** is mutually exclusive with the +** #CFE_TBL_OPT_USR_DEF_ADDR option. +** \arg #CFE_TBL_OPT_USR_DEF_ADDR- When this option is selected, the Table Service +** will not allocate memory for the table. Table +** Services will require the Application to identify +** the location of the active table buffer via the +** #CFE_TBL_Load function. This option implies the +** #CFE_TBL_OPT_DUMP_ONLY and the +** #CFE_TBL_OPT_SNGL_BUFFER options and is mutually ** exclusive of the #CFE_TBL_OPT_DBL_BUFFER option. -** \arg #CFE_TBL_OPT_CRITICAL- When this option is selected, the Table Service -** will automatically allocate space in the Critical Data Store (CDS) -** for the table and insure that the contents in the CDS are the same -** as the contents of the currently active buffer for the table. -** This option is mutually exclusive of the #CFE_TBL_OPT_USR_DEF_ADDR -** and #CFE_TBL_OPT_DUMP_ONLY options. It should also be noted that -** the use of this option with double buffered tables will prevent -** the update of the double buffered table from being quick and -** it could be blocked. Therefore, critical tables should not be -** updated by Interrupt Service Routines. -** -** \param[in] TblValidationFuncPtr is a pointer to a function that will be executed in the context of the Table -** Management Service when the contents of a table need to be validated. If set -** to NULL, then the Table Management Service will assume any data is valid. If -** the value is not NULL, it must be a pointer to a function with the following +** \arg #CFE_TBL_OPT_CRITICAL- When this option is selected, the Table Service +** will automatically allocate space in the Critical +** Data Store (CDS) for the table and insure that the +** contents in the CDS are the same +** as the contents of the currently active buffer for +** the table. This option is mutually exclusive of the +** #CFE_TBL_OPT_USR_DEF_ADDR and #CFE_TBL_OPT_DUMP_ONLY +** options. It should also be noted that the use of +** this option with double buffered tables will prevent +** the update of the double buffered table from being +** quick and it could be blocked. Therefore, critical +** tables should not be updated by Interrupt Service +** Routines. +** +** \param[in] TblValidationFuncPtr is a pointer to a function that will be executed in the context of the Table +** Management Service when the contents of a table need to be validated. If set +** to NULL, then the Table Management Service will assume any data is valid. If +** the value is not NULL, it must be a pointer to a function with the following ** prototype:
** int32 CallbackFunc(void *TblPtr);
** where
-** TblPtr will be a pointer to the table data that is to be verified. When the -** function returns #CFE_SUCCESS, the data is considered valid and ready for a commit. -** When the function returns a negative value, the data is considered invalid and an +** TblPtr will be a pointer to the table data that is to be verified. When the +** function returns #CFE_SUCCESS, the data is considered valid and ready for a commit. +** When the function returns a negative value, the data is considered invalid and an ** Event Message will be issued containing the returned value. If the function should ** return a positive number, the table is considered invalid and the return code is -** considered invalid. Validation functions \b must return either #CFE_SUCCESS or a negative -** number (whose value is at the developer's discretion). The validation function -** will be executed in the Application's context so that Event Messages describing the -** validation failure are possible from within the function. +** considered invalid. Validation functions \b must return either #CFE_SUCCESS or a +** negative number (whose value is at the developer's discretion). The validation +** function will be executed in the Application's context so that Event Messages +** describing the validation failure are possible from within the function. ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -178,37 +183,38 @@ ** ** \sa #CFE_TBL_Unregister, #CFE_TBL_Share **/ -CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, /* Returned Handle */ - const char *Name, /* Application specific name */ - size_t Size, /* Size, in bytes, of table */ - uint16 TblOptionFlags, /* Tbl Options Settings */ - CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr); /* Ptr to func that validates tbl */ +CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t * TblHandlePtr, /* Returned Handle */ + const char * Name, /* Application specific name */ + size_t Size, /* Size, in bytes, of table */ + uint16 TblOptionFlags, /* Tbl Options Settings */ + CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr); /* Ptr to func that validates tbl */ /*****************************************************************************/ /** ** \brief Obtain handle of table registered by another application ** ** \par Description -** After a table has been created, other applications can gain access -** to that table via the table handle. In order for two or more -** applications to share a table, the applications that do not create +** After a table has been created, other applications can gain access +** to that table via the table handle. In order for two or more +** applications to share a table, the applications that do not create ** the table must obtain the handle using this function. ** ** \par Assumptions, External Events, and Notes: ** None ** -** \param[in, out] TblHandlePtr A pointer to a #CFE_TBL_Handle_t type variable -** that will be assigned the table's handle. The -** table handle is required for other API calls -** when accessing the data contained in the table. *TblHandlePtr is the handle used to identify table to cFE when performing Table operations. +** \param[in, out] TblHandlePtr A pointer to a #CFE_TBL_Handle_t type variable +** that will be assigned the table's handle. The +** table handle is required for other API calls +** when accessing the data contained in the table. *TblHandlePtr is the handle used to +** identify table to cFE when performing Table operations. ** This value is returned at the address specified by TblHandlePtr. ** -** \param[in] TblName The processor specific name of the table. It is important to note -** that the processor specific table name is different from the table -** name specified in the #CFE_TBL_Register API call. The processor -** specific table name includes the name of the application that created -** the table. The name would be of the form "ApplicationName.TableName". -** An example of this would be "ACS.TamParams" for a table called "TamParams" +** \param[in] TblName The processor specific name of the table. It is important to note +** that the processor specific table name is different from the table +** name specified in the #CFE_TBL_Register API call. The processor +** specific table name includes the name of the application that created +** the table. The name would be of the form "ApplicationName.TableName". +** An example of this would be "ACS.TamParams" for a table called "TamParams" ** that was registered by the application called "ACS". ** ** \return Execution status, see \ref CFEReturnCodes @@ -227,10 +233,10 @@ CFE_Status_t CFE_TBL_Share(CFE_TBL_Handle_t *TblHandlePtr, const char *TblName); ** \brief Unregister a previously registered table and free associated resources ** ** \par Description -** When an application is being removed from the system, it should -** unregister those tables that it created. The application should -** call this function as a part of its cleanup process. The table -** will be removed from memory once all table addresses referencing +** When an application is being removed from the system, it should +** unregister those tables that it created. The application should +** call this function as a part of its cleanup process. The table +** will be removed from memory once all table addresses referencing ** it have been released. ** ** \par Assumptions, External Events, and Notes: @@ -246,9 +252,9 @@ CFE_Status_t CFE_TBL_Share(CFE_TBL_Handle_t *TblHandlePtr, const char *TblName); ** \retval #CFE_TBL_ERR_INVALID_HANDLE \copybrief CFE_TBL_ERR_INVALID_HANDLE ** ** \sa #CFE_TBL_Share, #CFE_TBL_Register -** +** ******************************************************************************/ -CFE_Status_t CFE_TBL_Unregister (CFE_TBL_Handle_t TblHandle); +CFE_Status_t CFE_TBL_Unregister(CFE_TBL_Handle_t TblHandle); /**@}*/ /** @defgroup CFEAPITBLManage cFE Manage Table Content APIs @@ -260,15 +266,15 @@ CFE_Status_t CFE_TBL_Unregister (CFE_TBL_Handle_t TblHandle); ** \brief Load a specified table with data from specified source ** ** \par Description -** Once an application has created a table (#CFE_TBL_Register), it must -** provide the values that initialize the contents of that table. The -** application accomplishes this with one of two different TBL API calls. -** This function call initializes the table with values that are held -** in a data structure. +** Once an application has created a table (#CFE_TBL_Register), it must +** provide the values that initialize the contents of that table. The +** application accomplishes this with one of two different TBL API calls. +** This function call initializes the table with values that are held +** in a data structure. ** ** \par Assumptions, External Events, and Notes: -** This function call can block. Therefore, interrupt service routines -** should NOT initialize their own tables. An application should initialize +** This function call can block. Therefore, interrupt service routines +** should NOT initialize their own tables. An application should initialize ** any table(s) prior to providing the handle(s) to the interrupt service routine. ** ** \param[in] TblHandle Handle, previously obtained from #CFE_TBL_Register or #CFE_TBL_Share, that @@ -277,8 +283,8 @@ CFE_Status_t CFE_TBL_Unregister (CFE_TBL_Handle_t TblHandle); ** \param[in] SrcType Flag indicating the nature of the given \c SrcDataPtr below. ** This value can be any one of the following: ** \arg #CFE_TBL_SRC_FILE - \copybrief CFE_TBL_SRC_FILE -** \arg #CFE_TBL_SRC_ADDRESS - \copybrief CFE_TBL_SRC_ADDRESS -** +** \arg #CFE_TBL_SRC_ADDRESS - \copybrief CFE_TBL_SRC_ADDRESS +** ** \param[in] SrcDataPtr Pointer to either a character string specifying a filename or ** a memory address of a block of binary data to be loaded into a table or, ** if the table was registered with the #CFE_TBL_OPT_USR_DEF_ADDR option, @@ -300,7 +306,7 @@ CFE_Status_t CFE_TBL_Unregister (CFE_TBL_Handle_t TblHandle); ** \retval #CFE_TBL_ERR_BAD_CONTENT_ID \copybrief CFE_TBL_ERR_BAD_CONTENT_ID ** \retval #CFE_TBL_ERR_PARTIAL_LOAD \copybrief CFE_TBL_ERR_PARTIAL_LOAD ** -** \sa #CFE_TBL_Update, #CFE_TBL_Validate, #CFE_TBL_Manage +** \sa #CFE_TBL_Update, #CFE_TBL_Validate, #CFE_TBL_Manage ** ******************************************************************************/ CFE_Status_t CFE_TBL_Load(CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, const void *SrcDataPtr); @@ -310,20 +316,20 @@ CFE_Status_t CFE_TBL_Load(CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, ** \brief Update contents of a specified table, if an update is pending ** ** \par Description -** An application is \b required to perform a periodic check for an update -** for all the tables that it creates. Typically, the application that -** created the table would call this function at the start or conclusion -** of any routine processing cycle or at regular intervals. To determine -** whether an update is pending prior to making this call, the Application -** can use the #CFE_TBL_GetStatus API first. If a table update is pending, +** An application is \b required to perform a periodic check for an update +** for all the tables that it creates. Typically, the application that +** created the table would call this function at the start or conclusion +** of any routine processing cycle or at regular intervals. To determine +** whether an update is pending prior to making this call, the Application +** can use the #CFE_TBL_GetStatus API first. If a table update is pending, ** it will take place during this function call. -** +** ** \par Assumptions, External Events, and Notes: ** None ** ** \param[in] TblHandle Handle, previously obtained from #CFE_TBL_Register or #CFE_TBL_Share, that ** identifies the Table to be updated. -** +** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_TBL_INFO_NO_UPDATE_PENDING \copybrief CFE_TBL_INFO_NO_UPDATE_PENDING @@ -422,7 +428,7 @@ CFE_Status_t CFE_TBL_Manage(CFE_TBL_Handle_t TblHandle); ** \sa #CFE_TBL_Manage ** ******************************************************************************/ -CFE_Status_t CFE_TBL_DumpToBuffer(CFE_TBL_Handle_t TblHandle); +CFE_Status_t CFE_TBL_DumpToBuffer(CFE_TBL_Handle_t TblHandle); /*****************************************************************************/ /** @@ -448,7 +454,7 @@ CFE_Status_t CFE_TBL_DumpToBuffer(CFE_TBL_Handle_t TblHandle); ** \sa #CFE_TBL_Manage ** ******************************************************************************/ -CFE_Status_t CFE_TBL_Modified(CFE_TBL_Handle_t TblHandle); +CFE_Status_t CFE_TBL_Modified(CFE_TBL_Handle_t TblHandle); /**@}*/ /** @defgroup CFEAPITBLAccess cFE Access Table Content APIs @@ -460,21 +466,21 @@ CFE_Status_t CFE_TBL_Modified(CFE_TBL_Handle_t TblHandle); ** \brief Obtain the current address of the contents of the specified table ** ** \par Description -** When a table has been created and initialized, it is available to -** any application that can identify it with its unique handle. In -** order to view the data contained in the table, an application must +** When a table has been created and initialized, it is available to +** any application that can identify it with its unique handle. In +** order to view the data contained in the table, an application must ** call this function or #CFE_TBL_GetAddresses. ** ** \par Assumptions, External Events, and Notes: -** -# This call can be a blocking call when the table is not double buffered -** and is shared with another application of lower priority that just happens -** to be in the middle of a table update of the specific table. If this occurs, -** the application performing the table update will automatically have its +** -# This call can be a blocking call when the table is not double buffered +** and is shared with another application of lower priority that just happens +** to be in the middle of a table update of the specific table. If this occurs, +** the application performing the table update will automatically have its ** priority elevated in order to release the resource as soon as possible. -** -# An application must always release the returned table address using the -** #CFE_TBL_ReleaseAddress or #CFE_TBL_ReleaseAddresses function prior to -** either a #CFE_TBL_Update call or any blocking call (e.g. - pending on software -** bus message, etc). Table updates cannot occur while table addresses have not +** -# An application must always release the returned table address using the +** #CFE_TBL_ReleaseAddress or #CFE_TBL_ReleaseAddresses function prior to +** either a #CFE_TBL_Update call or any blocking call (e.g. - pending on software +** bus message, etc). Table updates cannot occur while table addresses have not ** been released. ** -# #CFE_TBL_ERR_NEVER_LOADED will be returned if the table has never been ** loaded (either from file or from a block of memory), but the function @@ -482,9 +488,10 @@ CFE_Status_t CFE_TBL_Modified(CFE_TBL_Handle_t TblHandle); ** This pointer mush be released with the #CFE_TBL_ReleaseAddress API before ** the table can be loaded with data. ** -** \param[in, out] TblPtr The address of a pointer that will be loaded with the address of -** the first byte of the table. This pointer can then be typecast -** by the calling application to the appropriate table data structure. *TblPtr is the address of the first byte of data associated with the specified table. +** \param[in, out] TblPtr The address of a pointer that will be loaded with the address of +** the first byte of the table. This pointer can then be typecast +** by the calling application to the appropriate table data structure. *TblPtr is the address of +** the first byte of data associated with the specified table. ** ** \param[in] TblHandle Handle, previously obtained from #CFE_TBL_Register or #CFE_TBL_Share, that ** identifies the Table whose address is to be returned. @@ -508,13 +515,13 @@ CFE_Status_t CFE_TBL_GetAddress(void **TblPtr, CFE_TBL_Handle_t TblHandle); ** \brief Release previously obtained pointer to the contents of the specified table ** ** \par Description -** Each application is \b required to release a table address obtained through +** Each application is \b required to release a table address obtained through ** the #CFE_TBL_GetAddress function. ** ** \par Assumptions, External Events, and Notes: -** An application must always release the returned table address using the -** #CFE_TBL_ReleaseAddress function prior to either a #CFE_TBL_Update call -** or any blocking call (e.g. - pending on software bus message, etc). +** An application must always release the returned table address using the +** #CFE_TBL_ReleaseAddress function prior to either a #CFE_TBL_Update call +** or any blocking call (e.g. - pending on software bus message, etc). ** Table updates cannot occur while table addresses have not been released. ** ** \param[in] TblHandle Handle, previously obtained from #CFE_TBL_Register or #CFE_TBL_Share, that @@ -538,21 +545,21 @@ CFE_Status_t CFE_TBL_ReleaseAddress(CFE_TBL_Handle_t TblHandle); ** \brief Obtain the current addresses of an array of specified tables ** ** \par Description -** When a table has been created and initialized, it is available to -** any application that can identify it with its unique handle. In -** order to view the data contained in the table, an application must +** When a table has been created and initialized, it is available to +** any application that can identify it with its unique handle. In +** order to view the data contained in the table, an application must ** call this function or #CFE_TBL_GetAddresses. ** ** \par Assumptions, External Events, and Notes: -** -# This call can be a blocking call when the table is not double buffered -** and is shared with another application of lower priority that just happens -** to be in the middle of a table update of the specific table. If this occurs, -** the application performing the table update will automatically have its +** -# This call can be a blocking call when the table is not double buffered +** and is shared with another application of lower priority that just happens +** to be in the middle of a table update of the specific table. If this occurs, +** the application performing the table update will automatically have its ** priority elevated in order to release the resource as soon as possible. -** -# An application must always release the returned table address using the -** #CFE_TBL_ReleaseAddress or #CFE_TBL_ReleaseAddresses function prior to -** either a #CFE_TBL_Update call or any blocking call (e.g. - pending on software -** bus message, etc). Table updates cannot occur while table addresses have not +** -# An application must always release the returned table address using the +** #CFE_TBL_ReleaseAddress or #CFE_TBL_ReleaseAddresses function prior to +** either a #CFE_TBL_Update call or any blocking call (e.g. - pending on software +** bus message, etc). Table updates cannot occur while table addresses have not ** been released. ** -# #CFE_TBL_ERR_NEVER_LOADED will be returned if the table has never been ** loaded (either from file or from a block of memory), but the function @@ -561,8 +568,8 @@ CFE_Status_t CFE_TBL_ReleaseAddress(CFE_TBL_Handle_t TblHandle); ** the table can be loaded with data. ** ** \param[in, out] TblPtrs Array of Pointers to variables that calling Application -** wishes to hold the start addresses of the Tables. *TblPtrs is an array of addresses of the first byte of data associated with the -** specified tables. +** wishes to hold the start addresses of the Tables. *TblPtrs is an array of addresses of the +** first byte of data associated with the specified tables. ** ** \param[in] NumTables Size of TblPtrs and TblHandles arrays. ** @@ -588,13 +595,13 @@ CFE_Status_t CFE_TBL_GetAddresses(void **TblPtrs[], uint16 NumTables, const CFE_ ** \brief Release the addresses of an array of specified tables ** ** \par Description -** Each application is \b required to release a table address obtained through +** Each application is \b required to release a table address obtained through ** the #CFE_TBL_GetAddress function. ** ** \par Assumptions, External Events, and Notes: -** An application must always release the returned table address using the -** #CFE_TBL_ReleaseAddress function prior to either a #CFE_TBL_Update call -** or any blocking call (e.g. - pending on software bus message, etc). +** An application must always release the returned table address using the +** #CFE_TBL_ReleaseAddress function prior to either a #CFE_TBL_Update call +** or any blocking call (e.g. - pending on software bus message, etc). ** Table updates cannot occur while table addresses have not been released. ** ** \param[in] NumTables Size of TblHandles array. @@ -625,11 +632,11 @@ CFE_Status_t CFE_TBL_ReleaseAddresses(uint16 NumTables, const CFE_TBL_Handle_t T ** \brief Obtain current status of pending actions for a table. ** ** \par Description -** An application is \b required to perform a periodic check for an update -** or a validation request for all the tables that it creates. Typically, -** the application that created the table would call this function at the -** start or conclusion of any routine processing cycle. If a table update -** or validation request is pending, the Application should follow up with +** An application is \b required to perform a periodic check for an update +** or a validation request for all the tables that it creates. Typically, +** the application that created the table would call this function at the +** start or conclusion of any routine processing cycle. If a table update +** or validation request is pending, the Application should follow up with ** a call to #CFE_TBL_Update or #CFE_TBL_Validate respectively. ** ** \par Assumptions, External Events, and Notes: @@ -668,15 +675,16 @@ CFE_Status_t CFE_TBL_GetStatus(CFE_TBL_Handle_t TblHandle); ** None ** ** \param[in, out] TblInfoPtr A pointer to a CFE_TBL_Info_t data structure that is to be populated -** with table characteristics and information. *TblInfoPtr is the description of the tables characteristics and registry information stored in -** the #CFE_TBL_Info_t data structure format. -** -** \param[in] TblName The processor specific name of the table. It is important to note -** that the processor specific table name is different from the table -** name specified in the #CFE_TBL_Register API call. The processor -** specific table name includes the name of the application that created -** the table. The name would be of the form "ApplicationName.TableName". -** An example of this would be "ACS.TamParams" for a table called "TamParams" +** with table characteristics and information. *TblInfoPtr is the description of the tables +** characteristics and registry information stored in the #CFE_TBL_Info_t data structure +** format. +** +** \param[in] TblName The processor specific name of the table. It is important to note +** that the processor specific table name is different from the table +** name specified in the #CFE_TBL_Register API call. The processor +** specific table name includes the name of the application that created +** the table. The name would be of the form "ApplicationName.TableName". +** An example of this would be "ACS.TamParams" for a table called "TamParams" ** that was registered by the application called "ACS". ** ** \return Execution status, see \ref CFEReturnCodes @@ -707,17 +715,17 @@ CFE_Status_t CFE_TBL_GetInfo(CFE_TBL_Info_t *TblInfoPtr, const char *TblName); ** similar to how schedulers typically trigger application housekeeping messages. ** ** \param[in] TblHandle Handle of Table with which the message should be associated. -** +** ** \param[in] MsgId Message ID to be used in notification message sent by Table Services. -** -** \param[in] CommandCode Command Code value to be placed in secondary header of message +** +** \param[in] CommandCode Command Code value to be placed in secondary header of message ** sent by Table Services. -** -** \param[in] Parameter Application defined value to be passed as a parameter in the +** +** \param[in] Parameter Application defined value to be passed as a parameter in the ** message sent by Table Services. Suggested use includes an application's ** table index that allows the same MsgId and Command Code to be used for ** all table management notifications. -** +** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_TBL_ERR_BAD_APP_ID \copybrief CFE_TBL_ERR_BAD_APP_ID @@ -727,8 +735,8 @@ CFE_Status_t CFE_TBL_GetInfo(CFE_TBL_Info_t *TblInfoPtr, const char *TblName); ** \sa #CFE_TBL_Register ** ******************************************************************************/ -CFE_Status_t CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, CFE_MSG_FcnCode_t CommandCode, uint32 Parameter); +CFE_Status_t CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, CFE_MSG_FcnCode_t CommandCode, + uint32 Parameter); /**@}*/ - -#endif /* CFE_TBL_API_H */ +#endif /* CFE_TBL_API_H */ diff --git a/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h b/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h index 6707c6791..c3c7d7bc6 100644 --- a/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h @@ -39,31 +39,32 @@ #define CFE_TBL_ABSTRACT_TYPES_H /********************* Include Files ************************/ -#include "common_types.h" /* Basic Data Types */ +#include "common_types.h" /* Basic Data Types */ #include "cfe_tbl_extern_typedefs.h" #include "cfe_time_extern_typedefs.h" /** @defgroup CFETBLTypeOptions cFE Table Type Defines * @{ */ -#define CFE_TBL_OPT_BUFFER_MSK (0x0001) /**< \brief Table buffer mask */ -#define CFE_TBL_OPT_SNGL_BUFFER (0x0000) /**< \brief Single buffer table */ -#define CFE_TBL_OPT_DBL_BUFFER (0x0001) /**< \brief Double buffer table */ +#define CFE_TBL_OPT_BUFFER_MSK (0x0001) /**< \brief Table buffer mask */ +#define CFE_TBL_OPT_SNGL_BUFFER (0x0000) /**< \brief Single buffer table */ +#define CFE_TBL_OPT_DBL_BUFFER (0x0001) /**< \brief Double buffer table */ -#define CFE_TBL_OPT_LD_DMP_MSK (0x0002) /**< \brief Table load/dump mask */ -#define CFE_TBL_OPT_LOAD_DUMP (0x0000) /**< \brief Load/Dump table */ -#define CFE_TBL_OPT_DUMP_ONLY (0x0002) /**< \brief Dump only table */ +#define CFE_TBL_OPT_LD_DMP_MSK (0x0002) /**< \brief Table load/dump mask */ +#define CFE_TBL_OPT_LOAD_DUMP (0x0000) /**< \brief Load/Dump table */ +#define CFE_TBL_OPT_DUMP_ONLY (0x0002) /**< \brief Dump only table */ -#define CFE_TBL_OPT_USR_DEF_MSK (0x0004) /**< \brief Table user defined mask */ -#define CFE_TBL_OPT_NOT_USR_DEF (0x0000) /**< \brief Not user defined table */ -#define CFE_TBL_OPT_USR_DEF_ADDR (0x0006) /**< \brief User Defined table, @note Automatically includes #CFE_TBL_OPT_DUMP_ONLY option */ +#define CFE_TBL_OPT_USR_DEF_MSK (0x0004) /**< \brief Table user defined mask */ +#define CFE_TBL_OPT_NOT_USR_DEF (0x0000) /**< \brief Not user defined table */ +#define CFE_TBL_OPT_USR_DEF_ADDR \ + (0x0006) /**< \brief User Defined table, @note Automatically includes #CFE_TBL_OPT_DUMP_ONLY option */ #define CFE_TBL_OPT_CRITICAL_MSK (0x0008) /**< \brief Table critical mask */ #define CFE_TBL_OPT_NOT_CRITICAL (0x0000) /**< \brief Not critical table */ #define CFE_TBL_OPT_CRITICAL (0x0008) /**< \brief Critical table */ /** @brief Default table options */ -#define CFE_TBL_OPT_DEFAULT (CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP) +#define CFE_TBL_OPT_DEFAULT (CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP) /**@}*/ /** @@ -76,8 +77,7 @@ #define CFE_TBL_MAX_FULL_NAME_LEN (CFE_MISSION_TBL_MAX_FULL_NAME_LEN) /** \brief Bad table handle */ -#define CFE_TBL_BAD_TABLE_HANDLE (CFE_TBL_Handle_t) 0xFFFF - +#define CFE_TBL_BAD_TABLE_HANDLE (CFE_TBL_Handle_t)0xFFFF /****************** Data Type Definitions *********************/ @@ -91,37 +91,36 @@ typedef int16 CFE_TBL_Handle_t; typedef enum CFE_TBL_SrcEnum { CFE_TBL_SRC_FILE = 0, /**< \brief File source - When this option is selected, the \c SrcDataPtr - will be interpreted as a pointer to a null - terminated character string. The string should - specify the full path and filename of the file + When this option is selected, the \c SrcDataPtr + will be interpreted as a pointer to a null + terminated character string. The string should + specify the full path and filename of the file containing the initial data contents of the table. */ CFE_TBL_SRC_ADDRESS /**< \brief Address source When this option is selected, the \c SrcDataPtr will - be interpreted as a pointer to a memory location - that is the beginning of the initialization data + be interpreted as a pointer to a memory location + that is the beginning of the initialization data for loading the table OR, in the case of a "user defined" dump only table, the address of the active table itself. - The block of memory is assumed to be of the same size + The block of memory is assumed to be of the same size specified in the #CFE_TBL_Register function Size parameter. */ } CFE_TBL_SrcEnum_t; /** \brief Table Info */ typedef struct CFE_TBL_Info { - size_t Size; /**< \brief Size, in bytes, of Table */ - uint32 NumUsers; /**< \brief Number of Apps with access to the table */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ - uint32 Crc; /**< \brief Most recently calculated CRC by TBL services on table contents */ - CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ - bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ - bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ - bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ - bool UserDefAddr; /**< \brief Flag indicating Table address was defined by Owner Application */ - bool Critical; /**< \brief Flag indicating Table contents are maintained in a CDS */ - char LastFileLoaded[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ + size_t Size; /**< \brief Size, in bytes, of Table */ + uint32 NumUsers; /**< \brief Number of Apps with access to the table */ + uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ + uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ + uint32 Crc; /**< \brief Most recently calculated CRC by TBL services on table contents */ + CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ + bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ + bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ + bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ + bool UserDefAddr; /**< \brief Flag indicating Table address was defined by Owner Application */ + bool Critical; /**< \brief Flag indicating Table contents are maintained in a CDS */ + char LastFileLoaded[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ } CFE_TBL_Info_t; - -#endif /* CFE_TBL_ABSTRACT_TYPES_H */ +#endif /* CFE_TBL_ABSTRACT_TYPES_H */ diff --git a/modules/core_api/fsw/inc/cfe_tbl_core_internal.h b/modules/core_api/fsw/inc/cfe_tbl_core_internal.h index 6e3c6f8ed..2566c9376 100644 --- a/modules/core_api/fsw/inc/cfe_tbl_core_internal.h +++ b/modules/core_api/fsw/inc/cfe_tbl_core_internal.h @@ -41,9 +41,8 @@ #include "common_types.h" #include "cfe_es_extern_typedefs.h" - /* - * The internal APIs prototyped within this block are only intended to be invoked from + * The internal APIs prototyped within this block are only intended to be invoked from * other CFE core apps. They still need to be prototyped in the shared header such that * they can be called from other core modules, but applications should not call these. */ @@ -64,7 +63,7 @@ ** \par Assumptions, External Events, and Notes: ** None ** -** +** ******************************************************************************/ extern void CFE_TBL_TaskMain(void); @@ -97,8 +96,6 @@ extern int32 CFE_TBL_EarlyInit(void); ******************************************************************************/ extern int32 CFE_TBL_CleanUpApp(CFE_ES_AppId_t AppId); - /**@}*/ - -#endif /* CFE_TBL_CORE_INTERNAL_H */ +#endif /* CFE_TBL_CORE_INTERNAL_H */ diff --git a/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h index 0a8300426..93be4eeda 100644 --- a/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h @@ -21,7 +21,7 @@ #ifndef _CFE_TBL_EXTERN_TYPEDEFS_H_ #define _CFE_TBL_EXTERN_TYPEDEFS_H_ -/* This header may be generated from an EDS file, +/* This header may be generated from an EDS file, * tools are available and the feature is enabled */ #ifdef CFE_EDS_ENABLED_BUILD @@ -33,7 +33,7 @@ #include "common_types.h" #include "cfe_es_extern_typedefs.h" -#include "cfe_mission_cfg.h" /* for CFE_MISSION_TBL_MAX_FULL_NAME_LEN */ +#include "cfe_mission_cfg.h" /* for CFE_MISSION_TBL_MAX_FULL_NAME_LEN */ /** * @brief Label definitions associated with CFE_TBL_BufferSelect_Enum_t @@ -41,15 +41,15 @@ enum CFE_TBL_BufferSelect { - /** - * @brief Select the Inactive buffer for validate or dump - */ - CFE_TBL_BufferSelect_INACTIVE = 0, + /** + * @brief Select the Inactive buffer for validate or dump + */ + CFE_TBL_BufferSelect_INACTIVE = 0, - /** - * @brief Select the Active buffer for validate or dump - */ - CFE_TBL_BufferSelect_ACTIVE = 1 + /** + * @brief Select the Active buffer for validate or dump + */ + CFE_TBL_BufferSelect_ACTIVE = 1 }; /** @@ -58,9 +58,7 @@ enum CFE_TBL_BufferSelect * * @sa enum CFE_TBL_BufferSelect */ -typedef uint16 CFE_TBL_BufferSelect_Enum_t; - - +typedef uint16 CFE_TBL_BufferSelect_Enum_t; /** * @brief The definition of the header fields that are included in CFE Table Data files. @@ -69,16 +67,12 @@ typedef uint16 CFE_TBL_BufferSelect_En */ typedef struct CFE_TBL_File_Hdr { - uint32 Reserved; /**< Future Use: NumTblSegments in File? */ - CFE_ES_MemOffset_t Offset; /**< Byte Offset at which load should commence */ - CFE_ES_MemOffset_t NumBytes; /**< Number of bytes to load into table */ - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< Fully qualified name of table to load */ + uint32 Reserved; /**< Future Use: NumTblSegments in File? */ + CFE_ES_MemOffset_t Offset; /**< Byte Offset at which load should commence */ + CFE_ES_MemOffset_t NumBytes; /**< Number of bytes to load into table */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< Fully qualified name of table to load */ } CFE_TBL_File_Hdr_t; - - - #endif /* CFE_EDS_ENABLED_BUILD */ #endif /* _CFE_TBL_EXTERN_TYPEDEFS_H_ */ - diff --git a/modules/core_api/fsw/inc/cfe_tbl_filedef.h b/modules/core_api/fsw/inc/cfe_tbl_filedef.h index 6a8035055..4dd4d16a2 100644 --- a/modules/core_api/fsw/inc/cfe_tbl_filedef.h +++ b/modules/core_api/fsw/inc/cfe_tbl_filedef.h @@ -51,8 +51,8 @@ #include #include -#include "cfe_tbl_extern_typedefs.h" /* for "CFE_TBL_FileHdr_t" definition */ -#include "cfe_fs_extern_typedefs.h" /* for "CFE_FS_HDR_DESC_MAX_LEN" definition */ +#include "cfe_tbl_extern_typedefs.h" /* for "CFE_TBL_FileHdr_t" definition */ +#include "cfe_fs_extern_typedefs.h" /* for "CFE_FS_HDR_DESC_MAX_LEN" definition */ /* * The definition of the file definition metadata that can be used by @@ -60,22 +60,26 @@ */ typedef struct CFE_TBL_FileDef { - char ObjectName[64]; /**< \brief Name of instantiated variable that contains desired table image */ - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Name of Table as defined onboard */ - char Description[CFE_FS_HDR_DESC_MAX_LEN]; /**< \brief Description of table image that is included in cFE File Header */ - char TgtFilename[CFE_MISSION_MAX_FILE_LEN]; /**< \brief Default filename to be used for output of elf2cfetbl utility */ - uint32 ObjectSize; /**< \brief Size, in bytes, of instantiated object */ + char ObjectName[64]; /**< \brief Name of instantiated variable that contains desired table image */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Name of Table as defined onboard */ + char Description[CFE_FS_HDR_DESC_MAX_LEN]; /**< \brief Description of table image that is included in cFE File + Header */ + char TgtFilename[CFE_MISSION_MAX_FILE_LEN]; /**< \brief Default filename to be used for output of elf2cfetbl utility + */ + uint32 ObjectSize; /**< \brief Size, in bytes, of instantiated object */ } CFE_TBL_FileDef_t; -/** The CFE_TBL_FILEDEF macro can be used to simplify the declaration of a table image when using the elf2cfetbl utility. +/** The CFE_TBL_FILEDEF macro can be used to simplify the declaration of a table image when using the elf2cfetbl +utility. ** ** Note that the macro adds a NULL at the end to ensure that it is null-terminated. (C allows ** a struct to be statically initialized with a string exactly the length of the array, which ** loses the null terminator.) This means the actual length limit of the fields are the above ** LEN - 1. ** -** An example of the source code and how this macro would be used is as follows: \code - +** An example of the source code and how this macro would be used is as follows: +\code + #include "cfe_tbl_filedef.h" typedef struct MyTblStruct @@ -89,11 +93,13 @@ typedef struct CFE_TBL_FileDef MyTblStruct_t MyTblStruct = { 0x01020304, 0x05060708, 0x090A0B0C, 0x0D }; CFE_TBL_FILEDEF(MyTblStruct, MyApp.TableName, Table Utility Test Table, MyTblDefault.bin ) - + \endcode */ - -#define CFE_TBL_FILEDEF(ObjName, TblName, Desc, Filename) static OS_USED CFE_TBL_FileDef_t CFE_TBL_FileDef={#ObjName "\0", #TblName "\0", #Desc "\0", #Filename "\0", sizeof(ObjName)}; + +#define CFE_TBL_FILEDEF(ObjName, TblName, Desc, Filename) \ + static OS_USED CFE_TBL_FileDef_t CFE_TBL_FileDef = {#ObjName "\0", #TblName "\0", #Desc "\0", #Filename "\0", \ + sizeof(ObjName)}; /*************************************************************************/ diff --git a/modules/core_api/fsw/inc/cfe_time.h b/modules/core_api/fsw/inc/cfe_time.h index a447a15da..1e885eca5 100644 --- a/modules/core_api/fsw/inc/cfe_time.h +++ b/modules/core_api/fsw/inc/cfe_time.h @@ -35,7 +35,6 @@ #ifndef _cfe_time_ #define _cfe_time_ - /* ** Includes */ @@ -44,7 +43,6 @@ #include "cfe_time_api_typedefs.h" #include "cfe_es_api_typedefs.h" - /** ** \brief Time Copy ** @@ -52,8 +50,11 @@ ** Preferred to use this macro as it does not require the two arguments to be exactly the same type, ** it will work with any two structures that define "Seconds" and "Subseconds" members. */ -#define CFE_TIME_Copy(m,t) { (m)->Seconds = (t)->Seconds; (m)->Subseconds = (t)->Subseconds; } - +#define CFE_TIME_Copy(m, t) \ + { \ + (m)->Seconds = (t)->Seconds; \ + (m)->Subseconds = (t)->Subseconds; \ + } /*****************************************************************************/ /* @@ -69,11 +70,11 @@ ** \brief Get the current spacecraft time ** ** \par Description -** This routine returns the current spacecraft time. The time returned +** This routine returns the current spacecraft time. The time returned ** is either TAI (no leap seconds) or UTC (including leap seconds). This choice ** is made in the mission configuration file by defining either #CFE_MISSION_TIME_CFG_DEFAULT_TAI -** or #CFE_MISSION_TIME_CFG_DEFAULT_UTC as true at compile time. To maintain re-usability -** across missions, most applications should be using this function +** or #CFE_MISSION_TIME_CFG_DEFAULT_UTC as true at compile time. To maintain re-usability +** across missions, most applications should be using this function ** (or #CFE_TIME_GetTime) rather than the specific routines for getting UTC/TAI directly. ** ** \par Assumptions, External Events, and Notes: @@ -81,68 +82,68 @@ ** ** \return The current spacecraft time in default format ** -** \sa #CFE_TIME_GetTAI, #CFE_TIME_GetUTC, #CFE_TIME_GetMET, +** \sa #CFE_TIME_GetTAI, #CFE_TIME_GetUTC, #CFE_TIME_GetMET, ** #CFE_TIME_GetMETseconds, #CFE_TIME_GetMETsubsecs ** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_GetTime(void); +CFE_TIME_SysTime_t CFE_TIME_GetTime(void); /*****************************************************************************/ /** ** \brief Get the current TAI (MET + SCTF) time ** ** \par Description -** This routine returns the current TAI time to the caller. TAI is an -** international time standard that does not include leap seconds. -** This routine should only be used in situations where TAI is absolutely -** required. Applications that call #CFE_TIME_GetTAI may not be portable -** to all missions. Maintenance of correct TAI in flight is not guaranteed -** under all mission operations scenarios. To maintain re-usability across -** missions, most applications should be using #CFE_TIME_GetTime, rather +** This routine returns the current TAI time to the caller. TAI is an +** international time standard that does not include leap seconds. +** This routine should only be used in situations where TAI is absolutely +** required. Applications that call #CFE_TIME_GetTAI may not be portable +** to all missions. Maintenance of correct TAI in flight is not guaranteed +** under all mission operations scenarios. To maintain re-usability across +** missions, most applications should be using #CFE_TIME_GetTime, rather ** than the specific routines for getting UTC/TAI directly. ** ** \par Assumptions, External Events, and Notes: -** -# The "TAI" time returned is referenced to the mission-defined time epoch, +** -# The "TAI" time returned is referenced to the mission-defined time epoch, ** which may or may not be the same as the standard TAI epoch. -** -# Even though TAI does not include leap seconds, the time returned by this -** function can still jump forward or backward without warning when the -** spacecraft clock is set or adjusted by operators. Applications using +** -# Even though TAI does not include leap seconds, the time returned by this +** function can still jump forward or backward without warning when the +** spacecraft clock is set or adjusted by operators. Applications using ** this function must be able to handle these time discontinuities gracefully. ** ** \return The current spacecraft time in TAI ** -** \sa #CFE_TIME_GetTime, #CFE_TIME_GetUTC, #CFE_TIME_GetMET, +** \sa #CFE_TIME_GetTime, #CFE_TIME_GetUTC, #CFE_TIME_GetMET, ** #CFE_TIME_GetMETseconds, #CFE_TIME_GetMETsubsecs ** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_GetTAI(void); +CFE_TIME_SysTime_t CFE_TIME_GetTAI(void); /*****************************************************************************/ /** ** \brief Get the current UTC (MET + SCTF - Leap Seconds) time ** ** \par Description -** This routine returns the current UTC time to the caller. This routine -** should only be used in situations where UTC is absolutely required. -** Applications that call #CFE_TIME_GetUTC may not be portable to all -** missions. Maintenance of correct UTC in flight is not guaranteed under -** all mission operations scenarios. If UTC is maintained in flight, it will -** jump backwards occasionally due to leap second adjustments. To maintain -** re-usability across missions, most applications should be using -** #CFE_TIME_GetTime, rather than the specific routines for getting +** This routine returns the current UTC time to the caller. This routine +** should only be used in situations where UTC is absolutely required. +** Applications that call #CFE_TIME_GetUTC may not be portable to all +** missions. Maintenance of correct UTC in flight is not guaranteed under +** all mission operations scenarios. If UTC is maintained in flight, it will +** jump backwards occasionally due to leap second adjustments. To maintain +** re-usability across missions, most applications should be using +** #CFE_TIME_GetTime, rather than the specific routines for getting ** UTC/TAI directly. ** ** \par Assumptions, External Events, and Notes: -** Note: The "UTC" time returned is referenced to the mission-defined time epoch, +** Note: The "UTC" time returned is referenced to the mission-defined time epoch, ** which may or may not be the same as the standard UTC epoch. ** ** \return The current spacecraft time in UTC ** -** \sa #CFE_TIME_GetTime, #CFE_TIME_GetTAI, #CFE_TIME_GetMET, +** \sa #CFE_TIME_GetTime, #CFE_TIME_GetTAI, #CFE_TIME_GetMET, ** #CFE_TIME_GetMETseconds, #CFE_TIME_GetMETsubsecs ** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_GetUTC(void); +CFE_TIME_SysTime_t CFE_TIME_GetUTC(void); /*****************************************************************************/ /** @@ -164,7 +165,7 @@ CFE_TIME_SysTime_t CFE_TIME_GetUTC(void); ** #CFE_TIME_GetMETseconds, #CFE_TIME_GetMETsubsecs, #CFE_TIME_MET2SCTime ** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_GetMET(void); +CFE_TIME_SysTime_t CFE_TIME_GetMET(void); /*****************************************************************************/ /** @@ -183,7 +184,7 @@ CFE_TIME_SysTime_t CFE_TIME_GetMET(void); ** #CFE_TIME_GetMETsubsecs, #CFE_TIME_MET2SCTime ** ******************************************************************************/ -uint32 CFE_TIME_GetMETseconds(void); +uint32 CFE_TIME_GetMETseconds(void); /*****************************************************************************/ /** @@ -203,7 +204,7 @@ uint32 CFE_TIME_GetMETseconds(void); ** #CFE_TIME_GetMETseconds, #CFE_TIME_MET2SCTime ** ******************************************************************************/ -uint32 CFE_TIME_GetMETsubsecs(void); +uint32 CFE_TIME_GetMETsubsecs(void); /**@}*/ /** @defgroup CFEAPITIMEGetInfo cFE Get Time Information APIs @@ -215,12 +216,12 @@ uint32 CFE_TIME_GetMETsubsecs(void); ** \brief Get the current value of the spacecraft time correction factor (STCF). ** ** \par Description -** This routine returns the current value of the spacecraft time correction -** factor. This is the delta time between the MET and the TAI time. -** Applications cannot set or adjust the STCF; that can only be done -** through ground commands. However, science applications may want to -** include the STCF in their data products to aid in time correlation -** during downstream science data processing. +** This routine returns the current value of the spacecraft time correction +** factor. This is the delta time between the MET and the TAI time. +** Applications cannot set or adjust the STCF; that can only be done +** through ground commands. However, science applications may want to +** include the STCF in their data products to aid in time correlation +** during downstream science data processing. ** ** \par Assumptions, External Events, and Notes: ** Does not include leap seconds @@ -228,25 +229,25 @@ uint32 CFE_TIME_GetMETsubsecs(void); ** \return The current SCTF ** ** \sa #CFE_TIME_GetLeapSeconds, #CFE_TIME_GetClockState, #CFE_TIME_GetClockInfo -** +** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void); +CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void); /*****************************************************************************/ /** ** \brief Get the current value of the leap seconds counter. ** ** \par Description -** This routine returns the current value of the leap seconds counter. -** This is the delta seconds between international atomic time (TAI) -** and universal coordinated time (UTC). Applications cannot set or -** adjust the leap seconds; that can only be done through ground commands. -** However, science applications may want to include the leap seconds -** counter in their data products to aid in time correlation during -** downstream science data processing. Note that some mission operations -** teams do not maintain the leap seconds count, preferring to adjust the -** STCF instead. Users of this function should check with their mission -** ops team to see how they are planning to handle leap seconds. +** This routine returns the current value of the leap seconds counter. +** This is the delta seconds between international atomic time (TAI) +** and universal coordinated time (UTC). Applications cannot set or +** adjust the leap seconds; that can only be done through ground commands. +** However, science applications may want to include the leap seconds +** counter in their data products to aid in time correlation during +** downstream science data processing. Note that some mission operations +** teams do not maintain the leap seconds count, preferring to adjust the +** STCF instead. Users of this function should check with their mission +** ops team to see how they are planning to handle leap seconds. ** ** \par Assumptions, External Events, and Notes: ** None @@ -254,19 +255,19 @@ CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void); ** \returns The current spacecraft leap seconds. ** ** \sa #CFE_TIME_GetSTCF, #CFE_TIME_GetClockState, #CFE_TIME_GetClockInfo -** +** ******************************************************************************/ -int16 CFE_TIME_GetLeapSeconds(void); +int16 CFE_TIME_GetLeapSeconds(void); /*****************************************************************************/ /** ** \brief Get the current state of the spacecraft clock. ** ** \par Description -** This routine returns the spacecraft clock state. Applications that -** are highly dependent on valid time may want to call this routine -** before taking actions based on the times returned by the various -** clock routines +** This routine returns the spacecraft clock state. Applications that +** are highly dependent on valid time may want to call this routine +** before taking actions based on the times returned by the various +** clock routines ** ** \par Assumptions, External Events, and Notes: ** None @@ -274,16 +275,16 @@ int16 CFE_TIME_GetLeapSeconds(void); ** \return The current spacecraft clock state ** ** \sa #CFE_TIME_GetSTCF, #CFE_TIME_GetLeapSeconds, #CFE_TIME_GetClockInfo -** +** ******************************************************************************/ -CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void); +CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void); /*****************************************************************************/ /** ** \brief Provides information about the spacecraft clock. ** ** \par Description -** This routine returns information on the spacecraft clock in a bit mask. +** This routine returns information on the spacecraft clock in a bit mask. ** ** \par Assumptions, External Events, and Notes: ** None @@ -295,7 +296,7 @@ CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void); ** the following definition of the \c CFE_TIME_FLAG_xxxxxx is true.
** ** \sa #CFE_TIME_GetSTCF, #CFE_TIME_GetLeapSeconds, #CFE_TIME_GetClockState -** +** ******************************************************************************/ uint16 CFE_TIME_GetClockInfo(void); /**@}*/ @@ -309,10 +310,10 @@ uint16 CFE_TIME_GetClockInfo(void); ** \brief Adds two time values ** ** \par Description -** This routine adds the two specified times and returns the result. -** Normally, at least one of the input times should be a value representing -** a delta time. Adding two absolute times together will not cause an error, -** but the result will probably be meaningless. +** This routine adds the two specified times and returns the result. +** Normally, at least one of the input times should be a value representing +** a delta time. Adding two absolute times together will not cause an error, +** but the result will probably be meaningless. ** ** \par Assumptions, External Events, and Notes: ** None @@ -326,17 +327,17 @@ uint16 CFE_TIME_GetClockInfo(void); ** #CFE_TIME_SysTime_t, the result will roll over (this is not considered an error). ** ** \sa #CFE_TIME_Subtract, #CFE_TIME_Compare -** +** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2); +CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2); /*****************************************************************************/ /** ** \brief Subtracts two time values ** ** \par Description -** This routine subtracts time2 from time1 and returns the result. The -** time values can represent either absolute or delta times, but not all +** This routine subtracts time2 from time1 and returns the result. The +** time values can represent either absolute or delta times, but not all ** combinations make sense. ** - AbsTime - AbsTime = DeltaTime ** - AbsTime - DeltaTime = AbsTime @@ -351,32 +352,32 @@ CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Ti ** \param[in] Time2 The time to be subtracted from the base time. ** ** \return The result of subtracting the two times. -** If the subtraction results in an underflow, the result will +** If the subtraction results in an underflow, the result will ** roll over (this is not considered an error). ** ** \sa #CFE_TIME_Add, #CFE_TIME_Compare -** +** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2); +CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2); /*****************************************************************************/ /** ** \brief Compares two time values ** ** \par Description -** This routine compares two time values to see which is "greater". It -** is important that applications use this function rather than trying -** to directly compare the component pieces of times. This function will +** This routine compares two time values to see which is "greater". It +** is important that applications use this function rather than trying +** to directly compare the component pieces of times. This function will ** handle roll-over cases seamlessly, which may not be intuitively obvious. -** The cFE's internal representation of time "rolls over" when the 32 bit -** seconds count reaches 0xFFFFFFFF. Also, subtracting a delta time from -** an absolute time close to the epoch could result in "roll under". The -** strange cases that result from these situations can be handled by defining +** The cFE's internal representation of time "rolls over" when the 32 bit +** seconds count reaches 0xFFFFFFFF. Also, subtracting a delta time from +** an absolute time close to the epoch could result in "roll under". The +** strange cases that result from these situations can be handled by defining ** the comparison function for times as follows: -** Plot the two times on the circumference of a circle where 0 is at the -** top and 0x80000000 is at the bottom. If the shortest arc from time A -** to time B runs clockwise around the circle, then time A is less than -** time B. If the shortest arc from A to B runs counter-clockwise, then +** Plot the two times on the circumference of a circle where 0 is at the +** top and 0x80000000 is at the bottom. If the shortest arc from time A +** to time B runs clockwise around the circle, then time A is less than +** time B. If the shortest arc from A to B runs counter-clockwise, then ** time A is greater than time B. ** ** \par Assumptions, External Events, and Notes: @@ -392,9 +393,9 @@ CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime ** \retval #CFE_TIME_A_LT_B \copybrief CFE_TIME_A_LT_B ** ** \sa #CFE_TIME_Add, #CFE_TIME_Subtract -** +** ******************************************************************************/ -CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_t TimeB); +CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_t TimeB); /**@}*/ /** @defgroup CFEAPITIMEConvert cFE Time Conversion APIs @@ -422,14 +423,14 @@ CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_ ** #CFE_TIME_Sub2MicroSecs, #CFE_TIME_Micro2SubSecs ** ******************************************************************************/ -CFE_TIME_SysTime_t CFE_TIME_MET2SCTime (CFE_TIME_SysTime_t METTime); +CFE_TIME_SysTime_t CFE_TIME_MET2SCTime(CFE_TIME_SysTime_t METTime); /*****************************************************************************/ /** ** \brief Converts a sub-seconds count to an equivalent number of microseconds ** ** \par Description -** This routine converts from a sub-seconds count +** This routine converts from a sub-seconds count ** (each tick is 1 / 2^32 seconds) to microseconds (each tick is 1e-06 seconds). ** ** \par Assumptions, External Events, and Notes: @@ -439,17 +440,17 @@ CFE_TIME_SysTime_t CFE_TIME_MET2SCTime (CFE_TIME_SysTime_t METTime); ** ** \return The equivalent number of microseconds. ** -** \sa #CFE_TIME_MET2SCTime, #CFE_TIME_Micro2SubSecs, +** \sa #CFE_TIME_MET2SCTime, #CFE_TIME_Micro2SubSecs, ** ******************************************************************************/ -uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds); +uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds); /*****************************************************************************/ /** ** \brief Converts a number of microseconds to an equivalent sub-seconds count. ** ** \par Description -** This routine converts from microseconds (each tick is 1e-06 seconds) +** This routine converts from microseconds (each tick is 1e-06 seconds) ** to a subseconds count (each tick is 1 / 2^32 seconds). ** ** \par Assumptions, External Events, and Notes: @@ -461,10 +462,10 @@ uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds); ** passed in is greater than one second, (i.e. > 999,999), the return ** value is equal to \c 0xffffffff. ** -** \sa #CFE_TIME_MET2SCTime, #CFE_TIME_Sub2MicroSecs, +** \sa #CFE_TIME_MET2SCTime, #CFE_TIME_Sub2MicroSecs, ** ******************************************************************************/ -uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds); +uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds); /**@}*/ @@ -477,11 +478,11 @@ uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds); ** \brief Provides the 1 Hz signal from an external source ** ** \par Description -** This routine provides a method for cFE TIME software to be notified -** of the occurance of the 1Hz tone signal without knowledge of the -** specific hardware design. Regardless of the source of the tone, -** this routine should be called as soon as possible after detection -** to allow cFE TIME software the opportunity to latch the local clock +** This routine provides a method for cFE TIME software to be notified +** of the occurance of the 1Hz tone signal without knowledge of the +** specific hardware design. Regardless of the source of the tone, +** this routine should be called as soon as possible after detection +** to allow cFE TIME software the opportunity to latch the local clock ** as close as possible to the instant of the tone. ** ** \par Assumptions, External Events, and Notes: @@ -489,9 +490,9 @@ uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds); ** interrupt handler. ** ** \sa #CFE_TIME_ExternalMET, #CFE_TIME_ExternalGPS, #CFE_TIME_ExternalTime -** +** ******************************************************************************/ -void CFE_TIME_ExternalTone(void); +void CFE_TIME_ExternalTone(void); /* ** Function prototypes (external time source)... @@ -509,70 +510,68 @@ void CFE_TIME_ExternalTone(void); ** create and distribute the "time at the tone" command packet. */ - /*****************************************************************************/ /** ** \brief Provides the Mission Elapsed Time from an external source ** ** \par Description -** This routine provides a method to provide cFE TIME with MET acquired -** from an external source. There is a presumption that this function -** will be called at the appropriate time (relative to the tone) such -** that this call may be used by cFE TIME as the signal to generate the -** "time at the tone" data command. The "time at the tone" data command -** must arrive within the configuration parameter specified window for +** This routine provides a method to provide cFE TIME with MET acquired +** from an external source. There is a presumption that this function +** will be called at the appropriate time (relative to the tone) such +** that this call may be used by cFE TIME as the signal to generate the +** "time at the tone" data command. The "time at the tone" data command +** must arrive within the configuration parameter specified window for ** tone signal and data packet verification.

-** The MET value at the tone "should" have zero subseconds. Although the -** interface accepts non-zero values for sub-seconds, it may be harmful -** to other applications that expect zero subseconds at the moment of the +** The MET value at the tone "should" have zero subseconds. Although the +** interface accepts non-zero values for sub-seconds, it may be harmful +** to other applications that expect zero subseconds at the moment of the ** tone. Any decision to use non-zero subseconds should be carefully considered. ** ** \par Assumptions, External Events, and Notes: -** - This routine is included in the API only when 3 specific configuration -** parameters are set to true. The first is #CFE_PLATFORM_TIME_CFG_SERVER which defines -** this instantiation of cFE TIME as a time server (not a client). The -** second required configuration parameter is #CFE_PLATFORM_TIME_CFG_SOURCE which -** enables time source selection commands to the cFE TIME task, and further -** enables configuration definitions for the selected type of external time -** data. The third configuration parameter required for this routine is -** #CFE_PLATFORM_TIME_CFG_SRC_MET, which indicates that the external time data consists +** - This routine is included in the API only when 3 specific configuration +** parameters are set to true. The first is #CFE_PLATFORM_TIME_CFG_SERVER which defines +** this instantiation of cFE TIME as a time server (not a client). The +** second required configuration parameter is #CFE_PLATFORM_TIME_CFG_SOURCE which +** enables time source selection commands to the cFE TIME task, and further +** enables configuration definitions for the selected type of external time +** data. The third configuration parameter required for this routine is +** #CFE_PLATFORM_TIME_CFG_SRC_MET, which indicates that the external time data consists ** of MET. ** ** \param[in] NewMET The MET value at the next (or previous) 1 Hz tone signal. ** ** \sa #CFE_TIME_ExternalTone, #CFE_TIME_ExternalGPS, #CFE_TIME_ExternalTime -** +** ******************************************************************************/ void CFE_TIME_ExternalMET(CFE_TIME_SysTime_t NewMET); - /*****************************************************************************/ /** ** \brief Provide the time from an external source that has data common to GPS receivers. ** ** \par Description -** This routine provides a method to provide cFE TIME with current time -** data acquired from an external source. There is a presumption that -** this function will be called at the appropriate time (relative to the -** tone) such that this call may be used by cFE TIME as the signal to -** generate the "time at the tone" data command. The "time at the tone" -** data command must arrive within the configuration parameter specified +** This routine provides a method to provide cFE TIME with current time +** data acquired from an external source. There is a presumption that +** this function will be called at the appropriate time (relative to the +** tone) such that this call may be used by cFE TIME as the signal to +** generate the "time at the tone" data command. The "time at the tone" +** data command must arrive within the configuration parameter specified ** window for tone signal and data packet verification.

-** Internally, cFE TIME will calculate a new STCF as the difference between -** this new time value and the spacecraft MET value at the tone. This allows -** cFE TIME to always calculate time as the sum of MET and STCF. The value -** of STCF will change only as much as the drift factor between spacecraft +** Internally, cFE TIME will calculate a new STCF as the difference between +** this new time value and the spacecraft MET value at the tone. This allows +** cFE TIME to always calculate time as the sum of MET and STCF. The value +** of STCF will change only as much as the drift factor between spacecraft ** MET and the external time source. ** ** \par Assumptions, External Events, and Notes: -** - This routine is included in the API only when 3 specific configuration -** parameters are set to true. The first is #CFE_PLATFORM_TIME_CFG_SERVER which defines this -** instantiation of cFE TIME as a time server (not a client). The second -** required configuration parameter is #CFE_PLATFORM_TIME_CFG_SOURCE which enables -** time source selection commands to the cFE TIME task, and further enables -** configuration definitions for the selected type of external time data. -** The third configuration parameter required for this routine is -** #CFE_PLATFORM_TIME_CFG_SRC_GPS, which indicates that the external time data consists +** - This routine is included in the API only when 3 specific configuration +** parameters are set to true. The first is #CFE_PLATFORM_TIME_CFG_SERVER which defines this +** instantiation of cFE TIME as a time server (not a client). The second +** required configuration parameter is #CFE_PLATFORM_TIME_CFG_SOURCE which enables +** time source selection commands to the cFE TIME task, and further enables +** configuration definitions for the selected type of external time data. +** The third configuration parameter required for this routine is +** #CFE_PLATFORM_TIME_CFG_SRC_GPS, which indicates that the external time data consists ** of a time value relative to a known epoch, plus a leap seconds value. ** ** \param[in] NewTime The MET value at the next (or previous) 1 Hz tone signal. @@ -580,7 +579,7 @@ void CFE_TIME_ExternalMET(CFE_TIME_SysTime_t NewMET); ** \param[in] NewLeaps The Leap Seconds value used to calculate time as UTC. ** ** \sa #CFE_TIME_ExternalTone, #CFE_TIME_ExternalMET, #CFE_TIME_ExternalTime -** +** ******************************************************************************/ void CFE_TIME_ExternalGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps); @@ -589,34 +588,34 @@ void CFE_TIME_ExternalGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps); ** \brief Provide the time from an external source that measures time relative to a known epoch. ** ** \par Description -** This routine provides a method to provide cFE TIME with current time -** data acquired from an external source. There is a presumption that -** this function will be called at the appropriate time (relative to the -** tone) such that this call may be used by cFE TIME as the signal to -** generate the "time at the tone" data command. The "time at the tone" -** data command must arrive within the configuration specified window for +** This routine provides a method to provide cFE TIME with current time +** data acquired from an external source. There is a presumption that +** this function will be called at the appropriate time (relative to the +** tone) such that this call may be used by cFE TIME as the signal to +** generate the "time at the tone" data command. The "time at the tone" +** data command must arrive within the configuration specified window for ** tone signal and data packet verification.

-** Internally, cFE TIME will calculate a new STCF as the difference between -** this new time value and the spacecraft MET value at the tone. This allows -** cFE TIME to always calculate time as the sum of MET and STCF. The value -** of STCF will change only as much as the drift factor between spacecraft +** Internally, cFE TIME will calculate a new STCF as the difference between +** this new time value and the spacecraft MET value at the tone. This allows +** cFE TIME to always calculate time as the sum of MET and STCF. The value +** of STCF will change only as much as the drift factor between spacecraft ** MET and the external time source. ** ** \par Assumptions, External Events, and Notes: -** - This routine is included in the API only when 3 specific configuration -** parameters are set to true. The first is #CFE_PLATFORM_TIME_CFG_SERVER which defines this -** instanciation of cFE TIME as a time server (not a client). The second -** required configuration parameter is #CFE_PLATFORM_TIME_CFG_SOURCE which enables -** time source selection commands to the cFE TIME task, and further enables -** configuration definitions for the selected type of external time data. -** The third configuration parameter required for this routine is -** #CFE_PLATFORM_TIME_CFG_SRC_TIME, which indicates that the external time data consists +** - This routine is included in the API only when 3 specific configuration +** parameters are set to true. The first is #CFE_PLATFORM_TIME_CFG_SERVER which defines this +** instanciation of cFE TIME as a time server (not a client). The second +** required configuration parameter is #CFE_PLATFORM_TIME_CFG_SOURCE which enables +** time source selection commands to the cFE TIME task, and further enables +** configuration definitions for the selected type of external time data. +** The third configuration parameter required for this routine is +** #CFE_PLATFORM_TIME_CFG_SRC_TIME, which indicates that the external time data consists ** of a time value relative to a known epoch. ** ** \param[in] NewTime The MET value at the next (or previous) 1 Hz tone signal. ** ** \sa #CFE_TIME_ExternalTone, #CFE_TIME_ExternalMET, #CFE_TIME_ExternalGPS -** +** ******************************************************************************/ void CFE_TIME_ExternalTime(CFE_TIME_SysTime_t NewTime); @@ -642,8 +641,7 @@ void CFE_TIME_ExternalTime(CFE_TIME_SysTime_t NewTime); ** \sa #CFE_TIME_UnregisterSynchCallback ** ******************************************************************************/ -CFE_Status_t CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr); - +CFE_Status_t CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr); /*****************************************************************************/ /** @@ -665,7 +663,7 @@ CFE_Status_t CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t Callbac ** \sa #CFE_TIME_RegisterSynchCallback ** ******************************************************************************/ -CFE_Status_t CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr); +CFE_Status_t CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr); /**@}*/ /** @defgroup CFEAPITIMEMisc cFE Miscellaneous Time APIs @@ -700,7 +698,8 @@ CFE_Status_t CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t Callb ** structure is approximately 136 years. ** ** \param[in, out] PrintBuffer Pointer to a character array of at least -** #CFE_TIME_PRINTED_STRING_SIZE characters in length. *PrintBuffer is the time as a character string as described above. +** #CFE_TIME_PRINTED_STRING_SIZE characters in length. *PrintBuffer is the time as a +** character string as described above. ** ** \param[in] TimeToPrint The time to print into the character array. ** @@ -724,7 +723,6 @@ void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint); void CFE_TIME_Local1HzISR(void); /**@}*/ - #endif /* _cfe_time_ */ /************************/ diff --git a/modules/core_api/fsw/inc/cfe_time_api_typedefs.h b/modules/core_api/fsw/inc/cfe_time_api_typedefs.h index dafe8f511..b9cac22d5 100644 --- a/modules/core_api/fsw/inc/cfe_time_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_time_api_typedefs.h @@ -35,7 +35,6 @@ #ifndef CFE_TIME_API_TYPES_H #define CFE_TIME_API_TYPES_H - /* ** Includes */ @@ -47,15 +46,15 @@ ** Macro Definitions */ -#define CFE_TIME_PRINTED_STRING_SIZE 24 /**< \brief Required size of buffer to be passed into #CFE_TIME_Print (includes null terminator) */ - +#define CFE_TIME_PRINTED_STRING_SIZE \ + 24 /**< \brief Required size of buffer to be passed into #CFE_TIME_Print (includes null terminator) */ /*****************************************************************************/ /* ** Type Definitions */ -/** +/** ** \brief Enumerated types identifying the relative relationships of two times ** ** \par Description @@ -65,9 +64,9 @@ */ typedef enum CFE_TIME_Compare { - CFE_TIME_A_LT_B = -1, /**< \brief The first specified time is considered to be before the second specified time */ - CFE_TIME_EQUAL = 0, /**< \brief The two specified times are considered to be equal */ - CFE_TIME_A_GT_B = 1 /**< \brief The first specified time is considered to be after the second specified time */ + CFE_TIME_A_LT_B = -1, /**< \brief The first specified time is considered to be before the second specified time */ + CFE_TIME_EQUAL = 0, /**< \brief The two specified times are considered to be equal */ + CFE_TIME_A_GT_B = 1 /**< \brief The first specified time is considered to be after the second specified time */ } CFE_TIME_Compare_t; /** @@ -80,7 +79,6 @@ typedef enum CFE_TIME_Compare */ typedef int32 (*CFE_TIME_SynchCallbackPtr_t)(void); - #endif /* CFE_TIME_API_TYPES_H */ /************************/ diff --git a/modules/core_api/fsw/inc/cfe_time_core_internal.h b/modules/core_api/fsw/inc/cfe_time_core_internal.h index 96e3dc7e1..73ede06e0 100644 --- a/modules/core_api/fsw/inc/cfe_time_core_internal.h +++ b/modules/core_api/fsw/inc/cfe_time_core_internal.h @@ -39,7 +39,7 @@ #include "cfe_es_extern_typedefs.h" /* - * The internal APIs prototyped within this block are only intended to be invoked from + * The internal APIs prototyped within this block are only intended to be invoked from * other CFE core apps. They still need to be prototyped in the shared header such that * they can be called from other core modules, but applications should not call these. */ @@ -58,7 +58,7 @@ ** \par Assumptions, External Events, and Notes: ** None ** -** +** ******************************************************************************/ extern void CFE_TIME_TaskMain(void); @@ -87,10 +87,8 @@ extern int32 CFE_TIME_EarlyInit(void); ******************************************************************************/ extern int32 CFE_TIME_CleanUpApp(CFE_ES_AppId_t AppId); - /**@}*/ - #endif /* CFE_TIME_CORE_INTERNAL_H */ /************************/ diff --git a/modules/core_api/fsw/inc/cfe_time_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_time_extern_typedefs.h index 2fc4e943d..53e0a1276 100644 --- a/modules/core_api/fsw/inc/cfe_time_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_time_extern_typedefs.h @@ -21,7 +21,7 @@ #ifndef _CFE_TIME_EXTERN_TYPEDEFS_H_ #define _CFE_TIME_EXTERN_TYPEDEFS_H_ -/* This header may be generated from an EDS file, +/* This header may be generated from an EDS file, * tools are available and the feature is enabled */ #ifdef CFE_EDS_ENABLED_BUILD @@ -33,7 +33,7 @@ #include "common_types.h" -/** +/** ** \brief Data structure used to hold system time values ** ** \par Description @@ -46,8 +46,8 @@ */ typedef struct CFE_TIME_SysTime { - uint32 Seconds; /**< \brief Number of seconds since epoch */ - uint32 Subseconds; /**< \brief Number of subseconds since epoch (LSB = 2^(-32) seconds) */ + uint32 Seconds; /**< \brief Number of seconds since epoch */ + uint32 Subseconds; /**< \brief Number of subseconds since epoch (LSB = 2^(-32) seconds) */ } CFE_TIME_SysTime_t; /** @@ -56,60 +56,60 @@ typedef struct CFE_TIME_SysTime enum CFE_TIME_FlagBit { - /** - * @brief The spacecraft time has been set - */ - CFE_TIME_FlagBit_CLKSET = 0, - - /** - * @brief This instance of Time Services is flywheeling - */ - CFE_TIME_FlagBit_FLYING = 1, - - /** - * @brief The clock source is set to internal - */ - CFE_TIME_FlagBit_SRCINT = 2, - - /** - * @brief The clock signal is set to primary - */ - CFE_TIME_FlagBit_SIGPRI = 3, - - /** - * @brief The Time Server is in flywheel mode - */ - CFE_TIME_FlagBit_SRVFLY = 4, - - /** - * @brief This instance of Time Services was commanded into flywheel mode - */ - CFE_TIME_FlagBit_CMDFLY = 5, - - /** - * @brief One time STCF Adjustment is to be done in positive direction - */ - CFE_TIME_FlagBit_ADDADJ = 6, - - /** - * @brief 1 Hz STCF Adjustment is to be done in a positive direction - */ - CFE_TIME_FlagBit_ADD1HZ = 7, - - /** - * @brief Time Client Latency is applied in a positive direction - */ - CFE_TIME_FlagBit_ADDTCL = 8, - - /** - * @brief This instance of Time Services is a Time Server - */ - CFE_TIME_FlagBit_SERVER = 9, - - /** - * @brief The tone received is good compared to the last tone received - */ - CFE_TIME_FlagBit_GDTONE = 10 + /** + * @brief The spacecraft time has been set + */ + CFE_TIME_FlagBit_CLKSET = 0, + + /** + * @brief This instance of Time Services is flywheeling + */ + CFE_TIME_FlagBit_FLYING = 1, + + /** + * @brief The clock source is set to internal + */ + CFE_TIME_FlagBit_SRCINT = 2, + + /** + * @brief The clock signal is set to primary + */ + CFE_TIME_FlagBit_SIGPRI = 3, + + /** + * @brief The Time Server is in flywheel mode + */ + CFE_TIME_FlagBit_SRVFLY = 4, + + /** + * @brief This instance of Time Services was commanded into flywheel mode + */ + CFE_TIME_FlagBit_CMDFLY = 5, + + /** + * @brief One time STCF Adjustment is to be done in positive direction + */ + CFE_TIME_FlagBit_ADDADJ = 6, + + /** + * @brief 1 Hz STCF Adjustment is to be done in a positive direction + */ + CFE_TIME_FlagBit_ADD1HZ = 7, + + /** + * @brief Time Client Latency is applied in a positive direction + */ + CFE_TIME_FlagBit_ADDTCL = 8, + + /** + * @brief This instance of Time Services is a Time Server + */ + CFE_TIME_FlagBit_SERVER = 9, + + /** + * @brief The tone received is good compared to the last tone received + */ + CFE_TIME_FlagBit_GDTONE = 10 }; /** @@ -118,8 +118,7 @@ enum CFE_TIME_FlagBit * * @sa enum CFE_TIME_FlagBit */ -typedef uint8 CFE_TIME_FlagBit_Enum_t; - +typedef uint8 CFE_TIME_FlagBit_Enum_t; /** * @brief Label definitions associated with CFE_TIME_ClockState_Enum_t @@ -127,33 +126,33 @@ typedef uint8 CFE_TIME_FlagBit_Enum_t enum CFE_TIME_ClockState { - /** - * - * The spacecraft time has not been set since the last clock - * reset. Times returned by clock routines have no relationship - * to any ground-based time reference. - * - */ - CFE_TIME_ClockState_INVALID = -1, - - /** - * - * The spacecraft time has been set at least once since the last - * clock reset, and it is synchronized with the primary on-board - * time base. Times returned by clock routines can be trusted. - * - */ - CFE_TIME_ClockState_VALID = 0, - - /** - * - * The spacecraft time has been set at least once since the last - * clock reset, but it is not currently synchronized with the - * primary on-board time base. Times returned by clock routines - * are a "best guess" based on a non-optimal oscillator. - * - */ - CFE_TIME_ClockState_FLYWHEEL = 1 + /** + * + * The spacecraft time has not been set since the last clock + * reset. Times returned by clock routines have no relationship + * to any ground-based time reference. + * + */ + CFE_TIME_ClockState_INVALID = -1, + + /** + * + * The spacecraft time has been set at least once since the last + * clock reset, and it is synchronized with the primary on-board + * time base. Times returned by clock routines can be trusted. + * + */ + CFE_TIME_ClockState_VALID = 0, + + /** + * + * The spacecraft time has been set at least once since the last + * clock reset, but it is not currently synchronized with the + * primary on-board time base. Times returned by clock routines + * are a "best guess" based on a non-optimal oscillator. + * + */ + CFE_TIME_ClockState_FLYWHEEL = 1 }; /** @@ -173,8 +172,7 @@ enum CFE_TIME_ClockState * * @sa enum CFE_TIME_ClockState */ -typedef int16 CFE_TIME_ClockState_Enum_t; - +typedef int16 CFE_TIME_ClockState_Enum_t; /** * @brief Label definitions associated with CFE_TIME_SourceSelect_Enum_t @@ -182,15 +180,15 @@ typedef int16 CFE_TIME_ClockState_Enu enum CFE_TIME_SourceSelect { - /** - * @brief Use Internal Source - */ - CFE_TIME_SourceSelect_INTERNAL = 1, + /** + * @brief Use Internal Source + */ + CFE_TIME_SourceSelect_INTERNAL = 1, - /** - * @brief Use External Source - */ - CFE_TIME_SourceSelect_EXTERNAL = 2 + /** + * @brief Use External Source + */ + CFE_TIME_SourceSelect_EXTERNAL = 2 }; /** @@ -199,8 +197,7 @@ enum CFE_TIME_SourceSelect * * @sa enum CFE_TIME_SourceSelect */ -typedef uint8 CFE_TIME_SourceSelect_Enum_t; - +typedef uint8 CFE_TIME_SourceSelect_Enum_t; /** * @brief Label definitions associated with CFE_TIME_ToneSignalSelect_Enum_t @@ -208,15 +205,15 @@ typedef uint8 CFE_TIME_SourceSelect_E enum CFE_TIME_ToneSignalSelect { - /** - * @brief Primary Source - */ - CFE_TIME_ToneSignalSelect_PRIMARY = 1, + /** + * @brief Primary Source + */ + CFE_TIME_ToneSignalSelect_PRIMARY = 1, - /** - * @brief Redundant Source - */ - CFE_TIME_ToneSignalSelect_REDUNDANT = 2 + /** + * @brief Redundant Source + */ + CFE_TIME_ToneSignalSelect_REDUNDANT = 2 }; /** @@ -225,8 +222,7 @@ enum CFE_TIME_ToneSignalSelect * * @sa enum CFE_TIME_ToneSignalSelect */ -typedef uint8 CFE_TIME_ToneSignalSelect_Enum_t; - +typedef uint8 CFE_TIME_ToneSignalSelect_Enum_t; /** * @brief Label definitions associated with CFE_TIME_AdjustDirection_Enum_t @@ -234,15 +230,15 @@ typedef uint8 CFE_TIME_ToneSignalSele enum CFE_TIME_AdjustDirection { - /** - * @brief Add time adjustment - */ - CFE_TIME_AdjustDirection_ADD = 1, + /** + * @brief Add time adjustment + */ + CFE_TIME_AdjustDirection_ADD = 1, - /** - * @brief Subtract time adjustment - */ - CFE_TIME_AdjustDirection_SUBTRACT = 2 + /** + * @brief Subtract time adjustment + */ + CFE_TIME_AdjustDirection_SUBTRACT = 2 }; /** @@ -251,8 +247,7 @@ enum CFE_TIME_AdjustDirection * * @sa enum CFE_TIME_AdjustDirection */ -typedef uint8 CFE_TIME_AdjustDirection_Enum_t; - +typedef uint8 CFE_TIME_AdjustDirection_Enum_t; /** * @brief Label definitions associated with CFE_TIME_FlywheelState_Enum_t @@ -260,15 +255,15 @@ typedef uint8 CFE_TIME_AdjustDirectio enum CFE_TIME_FlywheelState { - /** - * @brief Not in flywheel state - */ - CFE_TIME_FlywheelState_NO_FLY = 0, + /** + * @brief Not in flywheel state + */ + CFE_TIME_FlywheelState_NO_FLY = 0, - /** - * @brief In flywheel state - */ - CFE_TIME_FlywheelState_IS_FLY = 1 + /** + * @brief In flywheel state + */ + CFE_TIME_FlywheelState_IS_FLY = 1 }; /** @@ -277,8 +272,7 @@ enum CFE_TIME_FlywheelState * * @sa enum CFE_TIME_FlywheelState */ -typedef uint8 CFE_TIME_FlywheelState_Enum_t; - +typedef uint8 CFE_TIME_FlywheelState_Enum_t; /** * @brief Label definitions associated with CFE_TIME_SetState_Enum_t @@ -286,15 +280,15 @@ typedef uint8 CFE_TIME_FlywheelState_ enum CFE_TIME_SetState { - /** - * @brief Spacecraft time has not been set - */ - CFE_TIME_SetState_NOT_SET = 0, + /** + * @brief Spacecraft time has not been set + */ + CFE_TIME_SetState_NOT_SET = 0, - /** - * @brief Spacecraft time has been set - */ - CFE_TIME_SetState_WAS_SET = 1 + /** + * @brief Spacecraft time has been set + */ + CFE_TIME_SetState_WAS_SET = 1 }; /** @@ -303,11 +297,8 @@ enum CFE_TIME_SetState * * @sa enum CFE_TIME_SetState */ -typedef uint8 CFE_TIME_SetState_Enum_t; - - +typedef uint8 CFE_TIME_SetState_Enum_t; #endif /* CFE_EDS_ENABLED_BUILD */ #endif /* _CFE_TIME_EXTERN_TYPEDEFS_H_ */ - diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index c5e794196..29de9ac86 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -31,18 +31,21 @@ * */ - /* Development Build Macro Definitions */ #define CFE_BUILD_NUMBER 402 /*!< 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 */ +#define CFE_BUILD_BASELINE \ + "v6.8.0-rc1" /*!< Development Build: git tag that is the base for the current development \ + */ /* Version Macro Definitions */ #define CFE_MAJOR_VERSION 6 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ #define CFE_MINOR_VERSION 7 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ -#define CFE_REVISION 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates a development version. */ -#define CFE_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ +#define CFE_REVISION \ + 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates a development \ + version. */ +#define CFE_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ -#define CFE_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */ +#define CFE_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */ #define CFE_STR(x) CFE_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer macros */ /*! @brief Development Build Version Number. @@ -52,13 +55,11 @@ #define CFE_SRC_VERSION CFE_BUILD_BASELINE "+dev" CFE_STR(CFE_BUILD_NUMBER) /*! @brief Development Build Version String. - * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest official version. @n - * See @ref cfsversions for format differences between development and release versions. -*/ -#define CFE_VERSION_STRING \ - " cFE DEVELOPMENT BUILD " \ - CFE_SRC_VERSION " (Codename: Bootes)" /* Codename for current development */ \ - ", Last Official Release: cfe v6.7.0" /* For full support please use this version */ - + * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest + * official version. @n See @ref cfsversions for format differences between development and release versions. + */ +#define CFE_VERSION_STRING \ + " cFE DEVELOPMENT BUILD " CFE_SRC_VERSION " (Codename: Bootes)" /* Codename for current development */ \ + ", Last Official Release: cfe v6.7.0" /* For full support please use this version */ #endif /* _cfe_version_ */ diff --git a/modules/core_api/ut-stubs/src/ut_es_stubs.c b/modules/core_api/ut-stubs/src/ut_es_stubs.c index 122a366d6..fcc138573 100644 --- a/modules/core_api/ut-stubs/src/ut_es_stubs.c +++ b/modules/core_api/ut-stubs/src/ut_es_stubs.c @@ -40,7 +40,7 @@ #include "utstubs.h" #include "utassert.h" -/* +/* * Assign ID base values for UT */ enum @@ -53,7 +53,6 @@ enum UT_CFE_ES_CDSBLOCKID_BASE = CFE_RESOURCEID_MAKE_BASE(0x26) }; - /* * Unit-test stub definitions/limits * @@ -74,32 +73,32 @@ enum * register its own simulated pool using UT_SetDataBuffer, * rather than changing this value. */ -#define CFE_UT_ES_POOL_STATIC_BLOCK_SIZE 4096 +#define CFE_UT_ES_POOL_STATIC_BLOCK_SIZE 4096 /* * Default value to return from calls that output an App ID, if the * test case does not provide a value */ -#define CFE_UT_ES_DEFAULT_APPID CFE_ES_APPID_C(CFE_ResourceId_FromInteger(UT_CFE_ES_APPID_BASE + 1)) +#define CFE_UT_ES_DEFAULT_APPID CFE_ES_APPID_C(CFE_ResourceId_FromInteger(UT_CFE_ES_APPID_BASE + 1)) /* * Default value to return from calls that output a Task ID, if the * test case does not provide a value */ -#define CFE_UT_ES_DEFAULT_TASKID CFE_ES_TASKID_C(CFE_ResourceId_FromInteger(UT_CFE_ES_TASKID_BASE + 1)) +#define CFE_UT_ES_DEFAULT_TASKID CFE_ES_TASKID_C(CFE_ResourceId_FromInteger(UT_CFE_ES_TASKID_BASE + 1)) /* * Default value to return from calls that output a CDS ID, if the * test case does not provide a value */ -#define CFE_UT_ES_DEFAULT_CDSID CFE_ES_CDSHANDLE_C(CFE_ResourceId_FromInteger(UT_CFE_ES_CDSBLOCKID_BASE + 1)) +#define CFE_UT_ES_DEFAULT_CDSID CFE_ES_CDSHANDLE_C(CFE_ResourceId_FromInteger(UT_CFE_ES_CDSBLOCKID_BASE + 1)) /* * Invalid value to output from calls as resource ID for the * calls that return failure. If subsequently used by application code, * it will likely induce a segfault or other noticeably bad behavior. */ -#define CFE_UT_ES_ID_INVALID CFE_ResourceId_FromInteger(0xDEADBEEF) +#define CFE_UT_ES_ID_INVALID CFE_ResourceId_FromInteger(0xDEADBEEF) /* ** Functions @@ -124,13 +123,9 @@ enum ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, - const char *TaskName, - CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, - CFE_ES_StackPointer_t StackPtr, - size_t StackSize, - CFE_ES_TaskPriority_Atom_t Priority, - uint32 Flags) +CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, + CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, CFE_ES_StackPointer_t StackPtr, + size_t StackSize, CFE_ES_TaskPriority_Atom_t Priority, uint32 Flags) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_CreateChildTask), TaskIdPtr); UT_Stub_RegisterContext(UT_KEY(CFE_ES_CreateChildTask), TaskName); @@ -171,10 +166,10 @@ int32 CFE_ES_GetAppID(CFE_ES_AppId_t *AppIdPtr) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppID), AppIdPtr); - int32 status; + int32 status; CFE_ES_AppId_t *IdBuff; - size_t BuffSize; - size_t Position; + size_t BuffSize; + size_t Position; status = UT_DEFAULT_IMPL(CFE_ES_GetAppID); @@ -203,10 +198,10 @@ int32 CFE_ES_GetTaskID(CFE_ES_TaskId_t *TaskIdPtr) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetTaskID), TaskIdPtr); - int32 status; + int32 status; CFE_ES_TaskId_t *IdBuff; - size_t BuffSize; - size_t Position; + size_t BuffSize; + size_t Position; status = UT_DEFAULT_IMPL(CFE_ES_GetTaskID); @@ -257,24 +252,24 @@ int32 CFE_ES_GetAppIDByName(CFE_ES_AppId_t *AppIdPtr, const char *AppName) UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), AppIdPtr); UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), AppName); - size_t UserBuffSize; - size_t BuffPosition; - const char *NameBuff; + size_t UserBuffSize; + size_t BuffPosition; + const char * NameBuff; CFE_ES_AppId_t *IdBuff; - int32 status; + int32 status; status = UT_DEFAULT_IMPL(CFE_ES_GetAppIDByName); if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetAppIDByName), (uint8*)AppIdPtr, sizeof(*AppIdPtr)) < sizeof(*AppIdPtr)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetAppIDByName), (uint8 *)AppIdPtr, sizeof(*AppIdPtr)) < + sizeof(*AppIdPtr)) { IdBuff = NULL; - UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), (void**)&NameBuff, &UserBuffSize, &BuffPosition); - if (NameBuff != NULL && UserBuffSize > 0 && - strncmp(NameBuff, AppName, UserBuffSize) == 0) + UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), (void **)&NameBuff, &UserBuffSize, &BuffPosition); + if (NameBuff != NULL && UserBuffSize > 0 && strncmp(NameBuff, AppName, UserBuffSize) == 0) { - UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), (void**)&IdBuff, &UserBuffSize, &BuffPosition); + UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), (void **)&IdBuff, &UserBuffSize, &BuffPosition); } if (IdBuff != NULL && UserBuffSize == sizeof(*AppIdPtr)) @@ -319,19 +314,19 @@ CFE_Status_t CFE_ES_GetAppName(char *AppName, CFE_ES_AppId_t AppId, size_t Buffe UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetAppName), AppId); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetAppName), BufferLength); - size_t UserBuffSize; - size_t BuffPosition; + size_t UserBuffSize; + size_t BuffPosition; const char *NameBuff; - int32 status; + int32 status; status = UT_DEFAULT_IMPL(CFE_ES_GetAppName); if (status >= 0 && BufferLength > 0) { - UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), (void**)&NameBuff, &UserBuffSize, &BuffPosition); + UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), (void **)&NameBuff, &UserBuffSize, &BuffPosition); if (NameBuff == NULL || UserBuffSize == 0) { - NameBuff = "UT"; + NameBuff = "UT"; UserBuffSize = 2; } @@ -373,7 +368,7 @@ CFE_Status_t CFE_ES_GetAppName(char *AppName, CFE_ES_AppId_t AppId, size_t Buffe ******************************************************************************/ int32 CFE_ES_RegisterApp(void) { - int32 status; + int32 status; status = UT_DEFAULT_IMPL(CFE_ES_RegisterApp); @@ -433,9 +428,9 @@ int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) int32 status; va_list va; char str[128]; - char *newline; + char * newline; - va_start(va,SpecStringPtr); + va_start(va, SpecStringPtr); vsnprintf(str, sizeof(str), SpecStringPtr, va); /* Replace newline since UtDebug already adds one */ @@ -448,13 +443,13 @@ int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) UtDebug("CFE_ES_WriteToSysLog: %s", str); va_end(va); - va_start(va,SpecStringPtr); + va_start(va, SpecStringPtr); status = UT_DEFAULT_IMPL_VARARGS(CFE_ES_WriteToSysLog, va); va_end(va); if (status >= 0) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_WriteToSysLog), (const uint8*)SpecStringPtr, strlen(SpecStringPtr)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_WriteToSysLog), (const uint8 *)SpecStringPtr, strlen(SpecStringPtr)); } return status; @@ -490,25 +485,29 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, static union { - uint32 Start; + uint32 Start; CFE_ES_PoolAlign_t Align; - uint8 Bytes[CFE_UT_ES_POOL_STATIC_BLOCK_SIZE]; + uint8 Bytes[CFE_UT_ES_POOL_STATIC_BLOCK_SIZE]; } Buffer; - size_t PoolSize; - size_t PositionStart; - size_t PositionEnd; - void *PoolPtr; + size_t PoolSize; + size_t PositionStart; + size_t PositionEnd; + void * PoolPtr; cpuaddr BufAddrStart; cpuaddr BufAddrEnd; - int32 status; + int32 status; /* * Determine the actual alignment of the CFE_ES_PoolAlign_t structure. * This is done by checking the offset of a struct member of that type following a single byte. */ - const cpuaddr AlignMask = ((cpuaddr)&((struct { char Byte; CFE_ES_PoolAlign_t Align; } *)0)->Align) - 1; - + const cpuaddr AlignMask = ((cpuaddr) & ((struct { + char Byte; + CFE_ES_PoolAlign_t Align; + } *)0) + ->Align) - + 1; status = UT_DEFAULT_IMPL_RC(CFE_ES_GetPoolBuf, Size); @@ -523,20 +522,20 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, * This means the test case did not register a buffer. * Use the static buffer to fulfill the request. */ - PoolPtr = Buffer.Bytes; - PoolSize = sizeof(Buffer); + PoolPtr = Buffer.Bytes; + PoolSize = sizeof(Buffer); PositionStart = 0; } BufAddrStart = (cpuaddr)PoolPtr + PositionStart; BufAddrStart = (BufAddrStart + AlignMask) & ~AlignMask; - BufAddrEnd = (BufAddrStart + Size + AlignMask) & ~AlignMask; - PositionEnd = BufAddrEnd - (cpuaddr)PoolPtr; + BufAddrEnd = (BufAddrStart + Size + AlignMask) & ~AlignMask; + PositionEnd = BufAddrEnd - (cpuaddr)PoolPtr; if (PositionEnd <= PoolSize) { *BufPtr = CFE_ES_MEMPOOLBUF_C(BufAddrStart); - memset((void*)BufAddrStart, 0x55, Size); + memset((void *)BufAddrStart, 0x55, Size); /* * Unfortunately the UT assert stub library is missing @@ -546,8 +545,7 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, Size = PositionEnd - PositionStart; while (Size > sizeof(Buffer)) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_GetPoolBuf), &Buffer, - sizeof(Buffer)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_GetPoolBuf), &Buffer, sizeof(Buffer)); Size -= sizeof(Buffer); } UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_GetPoolBuf), &Buffer, Size); @@ -561,8 +559,8 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, * use UT_SetDataBuffer() to register a pool buffer that is * sufficient for the code under test. */ - UtAssert_Failed("Pool buffer empty in %s: need at least %lu bytes, given %lu", - __func__, (unsigned long)PositionEnd, (unsigned long)PoolSize); + UtAssert_Failed("Pool buffer empty in %s: need at least %lu bytes, given %lu", __func__, + (unsigned long)PositionEnd, (unsigned long)PoolSize); status = -1; } } @@ -602,7 +600,7 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t if (status >= 0) { - UT_Stub_CopyToLocal(UT_KEY(CFE_ES_PoolCreate), (uint8*)PoolID, sizeof(*PoolID)); + UT_Stub_CopyToLocal(UT_KEY(CFE_ES_PoolCreate), (uint8 *)PoolID, sizeof(*PoolID)); } return status; @@ -635,7 +633,7 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s if (status >= 0) { - UT_Stub_CopyToLocal(UT_KEY(CFE_ES_PoolCreateNoSem), (uint8*)PoolID, sizeof(*PoolID)); + UT_Stub_CopyToLocal(UT_KEY(CFE_ES_PoolCreateNoSem), (uint8 *)PoolID, sizeof(*PoolID)); } return status; @@ -661,12 +659,8 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, - uint8 *MemPtr, - size_t Size, - uint16 NumBlockSizes, - const size_t *BlockSizes, - bool UseMutex ) +CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes, + const size_t *BlockSizes, bool UseMutex) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), PoolID); UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), MemPtr); @@ -697,7 +691,6 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) return status; } - /*****************************************************************************/ /** ** \brief CFE_ES_PutPoolBuf stub function @@ -726,7 +719,7 @@ 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_RegisterContextGenericArg(UT_KEY(CFE_ES_PutPoolBuf), BufPtr); - int32 status; + int32 status; status = UT_DEFAULT_IMPL_RC(CFE_ES_PutPoolBuf, 16); @@ -758,7 +751,7 @@ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPt UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBufInfo), PoolID); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBufInfo), BufPtr); - int32 status; + int32 status; status = UT_DEFAULT_IMPL_RC(CFE_ES_GetPoolBufInfo, 16); @@ -845,18 +838,18 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId) UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetTaskInfo), TaskInfo); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetTaskInfo), TaskId); - int32 status = CFE_SUCCESS; + int32 status = CFE_SUCCESS; status = UT_DEFAULT_IMPL(CFE_ES_GetTaskInfo); if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetTaskInfo), (uint8*)TaskInfo, sizeof(*TaskInfo)) < sizeof(*TaskInfo)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetTaskInfo), (uint8 *)TaskInfo, sizeof(*TaskInfo)) < sizeof(*TaskInfo)) { memset(TaskInfo, 0, sizeof(*TaskInfo)); TaskInfo->AppId = CFE_UT_ES_DEFAULT_APPID; - strncpy((char *) &TaskInfo->AppName, "UT", sizeof(TaskInfo->AppName)); - strncpy((char *) &TaskInfo->TaskName, "UT", sizeof(TaskInfo->TaskName)); + strncpy((char *)&TaskInfo->AppName, "UT", sizeof(TaskInfo->AppName)); + strncpy((char *)&TaskInfo->TaskName, "UT", sizeof(TaskInfo->TaskName)); } } @@ -887,7 +880,7 @@ void CFE_ES_ExitApp(uint32 ExitStatus) UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_ExitApp), ExitStatus); UT_DEFAULT_IMPL(CFE_ES_ExitApp); - UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_ExitApp), (uint8*)&ExitStatus, sizeof(ExitStatus)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_ES_ExitApp), (uint8 *)&ExitStatus, sizeof(ExitStatus)); } /*****************************************************************************/ @@ -912,8 +905,8 @@ void CFE_ES_ExitApp(uint32 ExitStatus) ******************************************************************************/ int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy) { - int32 status; - size_t CdsBufferSize; + int32 status; + size_t CdsBufferSize; UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CopyToCDS), Handle); UT_Stub_RegisterContext(UT_KEY(CFE_ES_CopyToCDS), DataToCopy); @@ -954,8 +947,8 @@ int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy) ******************************************************************************/ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) { - int32 status; - size_t CdsBufferSize; + int32 status; + size_t CdsBufferSize; UT_Stub_RegisterContext(UT_KEY(CFE_ES_RestoreFromCDS), RestoreToMemory); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_RestoreFromCDS), Handle); @@ -994,10 +987,7 @@ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, - size_t UserBlockSize, - const char *Name, - bool CriticalTbl) +int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, const char *Name, bool CriticalTbl) { int32 status = CFE_SUCCESS; @@ -1005,7 +995,8 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_RegisterCDSEx), (uint8*)HandlePtr, sizeof(*HandlePtr)) < sizeof(*HandlePtr)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_RegisterCDSEx), (uint8 *)HandlePtr, sizeof(*HandlePtr)) < + sizeof(*HandlePtr)) { *HandlePtr = CFE_UT_ES_DEFAULT_CDSID; } @@ -1069,7 +1060,7 @@ int32 CFE_ES_GetResetType(uint32 *ResetSubtypePtr) if (status >= 0) { - UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetResetType), (uint8*)ResetSubtypePtr, sizeof(*ResetSubtypePtr)); + UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetResetType), (uint8 *)ResetSubtypePtr, sizeof(*ResetSubtypePtr)); } return status; @@ -1311,7 +1302,7 @@ int32 CFE_ES_AppID_ToIndex(CFE_ES_AppId_t AppID, uint32 *Idx) int32 return_code; - *Idx = CFE_RESOURCEID_TO_ULONG(AppID) & 0xFFFF; + *Idx = CFE_RESOURCEID_TO_ULONG(AppID) & 0xFFFF; return_code = UT_DEFAULT_IMPL_RC(CFE_ES_AppID_ToIndex, 1); if (return_code == 1) @@ -1335,7 +1326,7 @@ int32 CFE_ES_TaskID_ToIndex(CFE_ES_TaskId_t TaskID, uint32 *Idx) int32 return_code; - *Idx = CFE_RESOURCEID_TO_ULONG(TaskID) & 0xFFFF; + *Idx = CFE_RESOURCEID_TO_ULONG(TaskID) & 0xFFFF; return_code = UT_DEFAULT_IMPL_RC(CFE_ES_TaskID_ToIndex, 1); if (return_code == 1) diff --git a/modules/core_api/ut-stubs/src/ut_evs_stubs.c b/modules/core_api/ut-stubs/src/ut_evs_stubs.c index 5e8b2233e..1d0ff921a 100644 --- a/modules/core_api/ut-stubs/src/ut_evs_stubs.c +++ b/modules/core_api/ut-stubs/src/ut_evs_stubs.c @@ -23,7 +23,7 @@ ** ** Purpose: ** Unit test stubs for Event Service routines -** +** ** Notes: ** Minimal work is done, only what is required for unit testing ** @@ -105,10 +105,7 @@ void CFE_EVS_TaskMain(void) ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_EVS_SendEvent(uint16 EventID, - uint16 EventType, - const char *Spec, - ...) +int32 CFE_EVS_SendEvent(uint16 EventID, uint16 EventType, const char *Spec, ...) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEvent), EventID); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEvent), EventType); @@ -116,7 +113,7 @@ int32 CFE_EVS_SendEvent(uint16 EventID, UtDebug("CFE_EVS_SendEvent: %u - %s", EventID, Spec); - int32 status; + int32 status; va_list va; va_start(va, Spec); @@ -125,7 +122,7 @@ int32 CFE_EVS_SendEvent(uint16 EventID, if (status >= 0) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_EVS_SendEvent), (uint8*)&EventID, sizeof(EventID)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_EVS_SendEvent), (uint8 *)&EventID, sizeof(EventID)); } return status; @@ -146,17 +143,13 @@ int32 CFE_EVS_SendEvent(uint16 EventID, ** Returns CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, - uint16 EventID, - uint16 EventType, - const char *Spec, - ...) +int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, uint16 EventID, uint16 EventType, const char *Spec, ...) { - /* + /* * NOTE: These args are out of order so that Arg[0] and Arg[1] will * be the same as they are for other EVS calls. This keeps it * compatible with old/existing UT hook routines. - * Newly-implemented hooks should use the name-based argument + * Newly-implemented hooks should use the name-based argument * retrieval so it is independent of the order. */ UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendTimedEvent), EventID); @@ -164,7 +157,7 @@ int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendTimedEvent), Time); UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendTimedEvent), Spec); - int32 status; + int32 status; va_list va; UtDebug("CFE_EVS_SendTimedEvent: %u - %s", EventID, Spec); @@ -175,7 +168,7 @@ int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, if (status >= 0) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_EVS_SendTimedEvent), (uint8*)&EventID, sizeof(EventID)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_EVS_SendTimedEvent), (uint8 *)&EventID, sizeof(EventID)); } return CFE_SUCCESS; @@ -201,9 +194,7 @@ int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_EVS_Register(const void *Filters, - uint16 NumFilteredEvents, - uint16 FilterScheme) +int32 CFE_EVS_Register(const void *Filters, uint16 NumFilteredEvents, uint16 FilterScheme) { UT_Stub_RegisterContext(UT_KEY(CFE_EVS_Register), Filters); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_Register), NumFilteredEvents); @@ -239,18 +230,14 @@ int32 CFE_EVS_Register(const void *Filters, ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_EVS_SendEventWithAppID(uint16 EventID, - uint16 EventType, - CFE_ES_AppId_t AppID, - const char *Spec, - ...) +int32 CFE_EVS_SendEventWithAppID(uint16 EventID, uint16 EventType, CFE_ES_AppId_t AppID, const char *Spec, ...) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEventWithAppID), EventID); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEventWithAppID), EventType); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_EVS_SendEventWithAppID), AppID); UT_Stub_RegisterContext(UT_KEY(CFE_EVS_SendEventWithAppID), Spec); - int32 status; + int32 status; va_list va; UtDebug("CFE_EVS_SendEventWithAppID: %u - %s", EventID, Spec); @@ -261,10 +248,9 @@ int32 CFE_EVS_SendEventWithAppID(uint16 EventID, if (status >= 0) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_EVS_SendEventWithAppID), (uint8*)&EventID, sizeof(EventID)); + UT_Stub_CopyFromLocal(UT_KEY(CFE_EVS_SendEventWithAppID), (uint8 *)&EventID, sizeof(EventID)); } - return status; } @@ -325,4 +311,3 @@ int32 CFE_EVS_Unregister(void) return status; } - diff --git a/modules/core_api/ut-stubs/src/ut_fs_stubs.c b/modules/core_api/ut-stubs/src/ut_fs_stubs.c index f7238c0dd..1f9a1eafe 100644 --- a/modules/core_api/ut-stubs/src/ut_fs_stubs.c +++ b/modules/core_api/ut-stubs/src/ut_fs_stubs.c @@ -23,7 +23,7 @@ ** ** Purpose: ** Unit test stubs for File Service routines -** +** ** Notes: ** Minimal work is done, only what is required for unit testing ** @@ -36,7 +36,6 @@ #include "cfe.h" #include "utstubs.h" - /* ** Functions */ @@ -47,10 +46,10 @@ const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_GetDefaultMountPoint), FileCategory); - - int32 Status; + + int32 Status; static const char DEFAULT_MOUNTPOINT[] = "/ut"; - const char *Result; + const char * Result; Status = UT_DEFAULT_IMPL(CFE_FS_GetDefaultMountPoint); Result = NULL; @@ -58,7 +57,7 @@ const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory) if (Status == CFE_SUCCESS) { /* If the test case supplied a buffer, return it, otherwise return fixed value */ - UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultMountPoint), (void**)&Result, NULL, NULL); + UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultMountPoint), (void **)&Result, NULL, NULL); if (Result == NULL) { Result = DEFAULT_MOUNTPOINT; @@ -74,10 +73,10 @@ const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory) const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_GetDefaultExtension), FileCategory); - - int32 Status; + + int32 Status; static const char DEFAULT_EXTENSION[] = ".ut"; - const char *Result; + const char * Result; Status = UT_DEFAULT_IMPL(CFE_FS_GetDefaultExtension); Result = NULL; @@ -85,7 +84,7 @@ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory) if (Status == CFE_SUCCESS) { /* If the test case supplied a buffer, return it, otherwise return fixed value */ - UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultExtension), (void**)&Result, NULL, NULL); + UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultExtension), (void **)&Result, NULL, NULL); if (Result == NULL) { Result = DEFAULT_EXTENSION; @@ -95,7 +94,6 @@ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory) return Result; } - /*****************************************************************************/ /** ** \brief CFE_FS_InitHeader stub function @@ -117,7 +115,7 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 Sub UT_Stub_RegisterContext(UT_KEY(CFE_FS_InitHeader), Description); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_InitHeader), SubType); - memset(Hdr,0,sizeof(CFE_FS_Header_t)); + memset(Hdr, 0, sizeof(CFE_FS_Header_t)); UT_DEFAULT_IMPL(CFE_FS_InitHeader); } @@ -154,7 +152,7 @@ int32 CFE_FS_WriteHeader(osal_id_t FileDes, CFE_FS_Header_t *Hdr) if (status > 0) { - UT_Stub_CopyFromLocal(UT_KEY(CFE_FS_WriteHeader), (const uint8*)Hdr, status); + UT_Stub_CopyFromLocal(UT_KEY(CFE_FS_WriteHeader), (const uint8 *)Hdr, status); } return status; @@ -193,7 +191,7 @@ int32 CFE_FS_ReadHeader(CFE_FS_Header_t *Hdr, osal_id_t FileDes) if (status > 0) { - UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ReadHeader), (uint8*)Hdr, status); + UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ReadHeader), (uint8 *)Hdr, status); } return status; @@ -259,8 +257,9 @@ int32 CFE_FS_EarlyInit(void) /* * Stub for CFE_FS_ParseInputFileNameEx - see prototype for description */ -int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize, size_t InputBufSize, - const char *DefaultInput, const char *DefaultPath, const char *DefaultExtension) +int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize, + size_t InputBufSize, const char *DefaultInput, const char *DefaultPath, + const char *DefaultExtension) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_ParseInputFileNameEx), OutputBuffer); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_ParseInputFileNameEx), InputBuffer); @@ -271,13 +270,12 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_ParseInputFileNameEx), DefaultExtension); int32 status; - + status = UT_DEFAULT_IMPL(CFE_FS_ParseInputFileNameEx); /* Copy any specific output supplied by test case */ - if (status >= 0 && - UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ParseInputFileNameEx), OutputBuffer, OutputBufSize) == 0 && - OutputBufSize > 0 && DefaultInput != NULL) + if (status >= 0 && UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ParseInputFileNameEx), OutputBuffer, OutputBufSize) == 0 && + OutputBufSize > 0 && DefaultInput != NULL) { /* Otherwise fall back to simple copy */ strncpy(OutputBuffer, DefaultInput, OutputBufSize); @@ -291,7 +289,7 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s * Stub for CFE_FS_ParseInputFileName - see prototype for description */ int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_t OutputBufSize, - CFE_FS_FileCategory_t FileCategory) + CFE_FS_FileCategory_t FileCategory) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_ParseInputFileName), OutputBuffer); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_ParseInputFileName), InputName); @@ -299,13 +297,12 @@ int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_ UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_ParseInputFileName), FileCategory); int32 status; - + status = UT_DEFAULT_IMPL(CFE_FS_ParseInputFileName); /* Copy any specific output supplied by test case */ - if (status >= 0 && - UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ParseInputFileName), OutputBuffer, OutputBufSize) == 0 && - OutputBufSize > 0) + if (status >= 0 && UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ParseInputFileName), OutputBuffer, OutputBufSize) == 0 && + OutputBufSize > 0) { /* Otherwise fall back to simple copy */ strncpy(OutputBuffer, InputName, OutputBufSize); @@ -314,7 +311,6 @@ int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_ return status; } - /*****************************************************************************/ /** ** \brief CFE_FS_ExtractFilenameFromPath stub function @@ -342,10 +338,10 @@ int32 CFE_FS_ExtractFilenameFromPath(const char *OriginalPath, char *FileNameOnl UT_Stub_RegisterContext(UT_KEY(CFE_FS_ExtractFilenameFromPath), OriginalPath); UT_Stub_RegisterContext(UT_KEY(CFE_FS_ExtractFilenameFromPath), FileNameOnly); - int i,j; - int StringLength; - int DirMarkIdx; - int32 status; + int i, j; + int StringLength; + int DirMarkIdx; + int32 status; uint32 UserBuffLen; status = UT_DEFAULT_IMPL(CFE_FS_ExtractFilenameFromPath); @@ -358,7 +354,8 @@ int32 CFE_FS_ExtractFilenameFromPath(const char *OriginalPath, char *FileNameOnl } else { - UserBuffLen = UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ExtractFilenameFromPath), (uint8*)FileNameOnly, OS_MAX_FILE_NAME); + UserBuffLen = + UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ExtractFilenameFromPath), (uint8 *)FileNameOnly, OS_MAX_FILE_NAME); if (UserBuffLen >= OS_MAX_FILE_NAME) { @@ -410,16 +407,15 @@ int32 CFE_FS_ExtractFilenameFromPath(const char *OriginalPath, char *FileNameOnl } else { - status = CFE_FS_FNAME_TOO_LONG; + status = CFE_FS_FNAME_TOO_LONG; } } } } - + return status; } - bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_RunBackgroundFileDump), ElapsedTime); @@ -454,5 +450,4 @@ bool CFE_FS_BackgroundFileDumpIsPending(const CFE_FS_FileWriteMetaData_t *Meta) UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), Meta); return UT_DEFAULT_IMPL(CFE_FS_BackgroundFileDumpIsPending); - } diff --git a/modules/core_api/ut-stubs/src/ut_resourceid_stubs.c b/modules/core_api/ut-stubs/src/ut_resourceid_stubs.c index 403c89735..8c3831d45 100644 --- a/modules/core_api/ut-stubs/src/ut_resourceid_stubs.c +++ b/modules/core_api/ut-stubs/src/ut_resourceid_stubs.c @@ -27,7 +27,6 @@ #include "cfe_resourceid.h" #include "cfe_resourceid_basevalue.h" - uint32 CFE_ResourceId_GetBase(CFE_ResourceId_t ResourceId) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ResourceId_GetBase), ResourceId); @@ -64,7 +63,8 @@ uint32 CFE_ResourceId_GetSerial(CFE_ResourceId_t ResourceId) return (CFE_ResourceId_ToInteger(ResourceId) & ((uint32)CFE_RESOURCEID_MAX)); } -CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableSize, bool (*CheckFunc)(CFE_ResourceId_t)) +CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableSize, + bool (*CheckFunc)(CFE_ResourceId_t)) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ResourceId_FindNext), StartId); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ResourceId_FindNext), TableSize); @@ -118,4 +118,3 @@ int32 CFE_ResourceId_ToIndex(CFE_ResourceId_t Id, uint32 BaseValue, uint32 Table return return_code; } - diff --git a/modules/core_api/ut-stubs/src/ut_sb_stubs.c b/modules/core_api/ut-stubs/src/ut_sb_stubs.c index 7c351f71e..296c18ed6 100644 --- a/modules/core_api/ut-stubs/src/ut_sb_stubs.c +++ b/modules/core_api/ut-stubs/src/ut_sb_stubs.c @@ -23,7 +23,7 @@ ** ** Purpose: ** Unit test stubs for Software Bus routines -** +** ** Notes: ** Minimal work is done, only what is required for unit testing ** @@ -40,22 +40,22 @@ typedef struct { - CFE_SB_MsgId_t MsgId; - uint32 UserLength; - uint32 TotalLength; - uint16 CommandCode; + CFE_SB_MsgId_t MsgId; + uint32 UserLength; + uint32 TotalLength; + uint16 CommandCode; CFE_TIME_SysTime_t TimeStamp; } CFE_SB_StubMsg_MetaData_t; -static CFE_SB_StubMsg_MetaData_t* CFE_SB_StubMsg_GetMetaData(const CFE_MSG_Message_t *MsgPtr) +static CFE_SB_StubMsg_MetaData_t *CFE_SB_StubMsg_GetMetaData(const CFE_MSG_Message_t *MsgPtr) { - CFE_SB_StubMsg_MetaData_t* MetaPtr; - CFE_SB_StubMsg_MetaData_t DefaultMeta; - size_t MetaSize; - UT_EntryKey_t MsgKey = (UT_EntryKey_t)MsgPtr; + CFE_SB_StubMsg_MetaData_t *MetaPtr; + CFE_SB_StubMsg_MetaData_t DefaultMeta; + size_t MetaSize; + UT_EntryKey_t MsgKey = (UT_EntryKey_t)MsgPtr; - UT_GetDataBuffer(MsgKey, (void**)&MetaPtr, &MetaSize, NULL); + UT_GetDataBuffer(MsgKey, (void **)&MetaPtr, &MetaSize, NULL); if (MetaPtr == NULL || MetaSize != sizeof(DefaultMeta)) { memset(&DefaultMeta, 0, sizeof(DefaultMeta)); @@ -64,7 +64,7 @@ static CFE_SB_StubMsg_MetaData_t* CFE_SB_StubMsg_GetMetaData(const CFE_MSG_Messa UT_SetDataBuffer(MsgKey, &DefaultMeta, sizeof(DefaultMeta), true); /* Because "allocate copy" is true above, this gets a pointer to the copy */ - UT_GetDataBuffer(MsgKey, (void**)&MetaPtr, &MetaSize, NULL); + UT_GetDataBuffer(MsgKey, (void **)&MetaPtr, &MetaSize, NULL); } return MetaPtr; @@ -95,7 +95,7 @@ int32 CFE_SB_EarlyInit(void) return status; } - + /*****************************************************************************/ /** ** \brief CFE_SB_TaskMain stub function @@ -136,8 +136,7 @@ void CFE_SB_TaskMain(void) ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, - const char *PipeName) +int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *PipeName) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_CreatePipe), PipeIdPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_CreatePipe), Depth); @@ -149,7 +148,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, if (status >= 0) { - UT_Stub_CopyToLocal(UT_KEY(CFE_SB_CreatePipe), (uint8*)PipeIdPtr, sizeof(*PipeIdPtr)); + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_CreatePipe), (uint8 *)PipeIdPtr, sizeof(*PipeIdPtr)); } return status; @@ -174,16 +173,16 @@ int32 CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_DeletePipe), PipeId); - int32 status; + int32 status; - status = UT_DEFAULT_IMPL(CFE_SB_DeletePipe); + status = UT_DEFAULT_IMPL(CFE_SB_DeletePipe); - if (status >= 0) - { + if (status >= 0) + { UT_Stub_CopyFromLocal(UT_KEY(CFE_SB_DeletePipe), &PipeId, sizeof(PipeId)); - } + } - return status; + return status; } /*****************************************************************************/ @@ -209,19 +208,19 @@ int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetPipeName), PipeNameSize); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetPipeName), PipeId); - size_t UserBuffSize; - size_t BuffPosition; + size_t UserBuffSize; + size_t BuffPosition; const char *NameBuff; - int32 status; + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_GetPipeName); if (status >= 0 && PipeNameSize > 0) { - UT_GetDataBuffer(UT_KEY(CFE_SB_GetPipeName), (void**)&NameBuff, &UserBuffSize, &BuffPosition); + UT_GetDataBuffer(UT_KEY(CFE_SB_GetPipeName), (void **)&NameBuff, &UserBuffSize, &BuffPosition); if (NameBuff == NULL || UserBuffSize == 0) { - NameBuff = "UT"; + NameBuff = "UT"; UserBuffSize = 2; } @@ -273,13 +272,14 @@ int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName) if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetPipeIdByName), (uint8*)PipeIdPtr, sizeof(*PipeIdPtr)) == sizeof(*PipeIdPtr)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetPipeIdByName), (uint8 *)PipeIdPtr, sizeof(*PipeIdPtr)) == + sizeof(*PipeIdPtr)) { status = CFE_SUCCESS; } else { - status = CFE_SB_BAD_ARGUMENT; + status = CFE_SB_BAD_ARGUMENT; *PipeIdPtr = CFE_SB_INVALID_PIPE; } } @@ -307,8 +307,8 @@ uint16 CFE_SB_GetCmdCode(CFE_MSG_Message_t *MsgPtr) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetCmdCode), MsgPtr); - int32 status; - uint16 cmdcode = 0; + int32 status; + uint16 cmdcode = 0; status = UT_DEFAULT_IMPL(CFE_SB_GetCmdCode); @@ -371,10 +371,7 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_MSG_Message_t *MsgPtr) ** This function does not return a value. ** ******************************************************************************/ -void CFE_SB_InitMsg(void *MsgPtr, - CFE_SB_MsgId_t MsgId, - size_t Length, - bool Clear ) +void CFE_SB_InitMsg(void *MsgPtr, CFE_SB_MsgId_t MsgId, size_t Length, bool Clear) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_InitMsg), MsgPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_InitMsg), MsgId); @@ -387,10 +384,10 @@ void CFE_SB_InitMsg(void *MsgPtr, if (status >= 0) { - CFE_SB_StubMsg_GetMetaData(MsgPtr)->MsgId = MsgId; + CFE_SB_StubMsg_GetMetaData(MsgPtr)->MsgId = MsgId; CFE_SB_StubMsg_GetMetaData(MsgPtr)->TotalLength = Length; - UT_Stub_CopyToLocal(UT_KEY(CFE_SB_InitMsg), (uint8*)MsgPtr, Length); + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_InitMsg), (uint8 *)MsgPtr, Length); } } @@ -410,9 +407,7 @@ void CFE_SB_InitMsg(void *MsgPtr, ** Returns CFE_SUCCESS or overridden unit test value ** ******************************************************************************/ -int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, - CFE_SB_PipeId_t PipeId, - int32 TimeOut) +int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_RcvMsg), BufPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_RcvMsg), PipeId); @@ -424,7 +419,7 @@ int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, if (status >= 0) { - UT_Stub_CopyToLocal(UT_KEY(CFE_SB_RcvMsg), (uint8*)BufPtr, sizeof(*BufPtr)); + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_RcvMsg), (uint8 *)BufPtr, sizeof(*BufPtr)); } return status; @@ -448,9 +443,7 @@ int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, ** Returns CFE_SUCCESS or overridden unit test value ** ******************************************************************************/ -int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_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) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_ReceiveBuffer), BufPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ReceiveBuffer), PipeId); @@ -462,7 +455,7 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, if (status >= 0) { - UT_Stub_CopyToLocal(UT_KEY(CFE_SB_ReceiveBuffer), (uint8*)BufPtr, sizeof(*BufPtr)); + UT_Stub_CopyToLocal(UT_KEY(CFE_SB_ReceiveBuffer), (uint8 *)BufPtr, sizeof(*BufPtr)); } return status; @@ -489,7 +482,7 @@ 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; + int32 status = CFE_SUCCESS; status = UT_DEFAULT_IMPL(CFE_SB_TransmitMsg); @@ -524,7 +517,7 @@ int32 CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t Zer UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_TransmitBuffer), ZeroCopyHandle); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_TransmitBuffer), IncrementSequenceCount); - int32 status = CFE_SUCCESS; + int32 status = CFE_SUCCESS; status = UT_DEFAULT_IMPL(CFE_SB_TransmitBuffer); @@ -566,7 +559,7 @@ int32 CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_SendMsg), MsgPtr); - int32 status = CFE_SUCCESS; + int32 status = CFE_SUCCESS; /* * Create a context entry so a hook function @@ -603,7 +596,7 @@ int32 CFE_SB_SetCmdCode(CFE_MSG_Message_t *MsgPtr, uint16 CmdCode) UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetCmdCode), MsgPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetCmdCode), CmdCode); - int32 status; + int32 status; status = UT_DEFAULT_IMPL(CFE_SB_SetCmdCode); @@ -699,8 +692,7 @@ int32 CFE_SB_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t Time) ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, - CFE_SB_Qos_t Quality, uint16 MsgLim) +int32 CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality, uint16 MsgLim) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeEx), MsgId); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeEx), PipeId); @@ -766,9 +758,7 @@ int32 CFE_SB_Subscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId, - CFE_SB_PipeId_t PipeId, - uint16 MsgLim) +int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint16 MsgLim) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeLocal), MsgId); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SubscribeLocal), PipeId); @@ -825,10 +815,10 @@ size_t CFE_SB_GetTotalMsgLength(const CFE_MSG_Message_t *MsgPtr) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetTotalMsgLength), MsgPtr); - int32 status; + int32 status; uint16 result; - status = UT_DEFAULT_IMPL_RC(CFE_SB_GetTotalMsgLength,-1); + status = UT_DEFAULT_IMPL_RC(CFE_SB_GetTotalMsgLength, -1); if (status >= 0) { @@ -872,7 +862,8 @@ int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId) ** See function prototype for full description ** */ -int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, size_t DestMaxSize, size_t SourceMaxSize) +int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, + size_t DestMaxSize, size_t SourceMaxSize) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), DestStringPtr); UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), SourceStringPtr); @@ -899,7 +890,7 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, if (DefaultString != NULL && (SourceMaxSize == 0 || *SourceStringPtr == 0)) { SourceStringPtr = DefaultString; - SourceMaxSize = DestMaxSize; + SourceMaxSize = DestMaxSize; } /* For the UT implementation, just call strncpy() */ @@ -919,7 +910,8 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, ** See function prototype for full description ** */ -int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, size_t SourceMaxSize) +int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, + size_t SourceMaxSize) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringSet), DestStringPtr); UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringSet), SourceStringPtr); @@ -988,14 +980,15 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_MSG_Message_t *MsgPtr) UT_DEFAULT_IMPL(CFE_SB_GetMsgTime); - if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetMsgTime), &TimeFromMsg, sizeof(CFE_TIME_SysTime_t)) != sizeof(CFE_TIME_SysTime_t)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetMsgTime), &TimeFromMsg, sizeof(CFE_TIME_SysTime_t)) != + sizeof(CFE_TIME_SysTime_t)) { TimeFromMsg = CFE_SB_StubMsg_GetMetaData(MsgPtr)->TimeStamp; } return TimeFromMsg; -}/* end CFE_SB_GetMsgTime */ +} /* end CFE_SB_GetMsgTime */ bool CFE_SB_ValidateChecksum(CFE_MSG_Message_t *MsgPtr) { @@ -1004,8 +997,8 @@ bool CFE_SB_ValidateChecksum(CFE_MSG_Message_t *MsgPtr) int32 status; status = UT_DEFAULT_IMPL(CFE_SB_ValidateChecksum); - - return (bool) status; + + return (bool)status; } #endif /* CFE_OMIT_DEPRECATED_6_8 */ @@ -1013,9 +1006,9 @@ void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_GetUserData), MsgPtr); - uint8 *BytePtr; - void *Result; - uint16 HdrSize; + uint8 *BytePtr; + void * Result; + uint16 HdrSize; UT_DEFAULT_IMPL(CFE_SB_GetUserData); @@ -1038,7 +1031,7 @@ void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) } #ifndef CFE_OMIT_DEPRECATED_6_8 -void CFE_SB_SetTotalMsgLength (CFE_MSG_Message_t *MsgPtr,size_t TotalLength) +void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr, size_t TotalLength) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetTotalMsgLength), MsgPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetTotalMsgLength), TotalLength); @@ -1171,7 +1164,7 @@ CFE_SB_Buffer_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, CFE_SB_ZeroCopyHandle_t * UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyGetPtr), MsgSize); UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyGetPtr), BufferHandle); - int32 status; + int32 status; CFE_SB_Buffer_t *SBBufPtr = NULL; status = UT_DEFAULT_IMPL(CFE_SB_ZeroCopyGetPtr); diff --git a/modules/core_api/ut-stubs/src/ut_tbl_stubs.c b/modules/core_api/ut-stubs/src/ut_tbl_stubs.c index 31d4156ab..e843e8d72 100644 --- a/modules/core_api/ut-stubs/src/ut_tbl_stubs.c +++ b/modules/core_api/ut-stubs/src/ut_tbl_stubs.c @@ -100,11 +100,11 @@ int32 CFE_TBL_CleanUpApp(CFE_ES_AppId_t AppId) return status; } -int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* Returned Handle */ - const char *Name, /* Application specific name */ - size_t Size, /* Size, in bytes, of table */ - uint16 TblOptionFlags, /* Tbl Options Settings */ - CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr ) /* Ptr to func that validates tbl */ +int32 CFE_TBL_Register(CFE_TBL_Handle_t * TblHandlePtr, /* Returned Handle */ + const char * Name, /* Application specific name */ + size_t Size, /* Size, in bytes, of table */ + uint16 TblOptionFlags, /* Tbl Options Settings */ + CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr) /* Ptr to func that validates tbl */ { UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Register), TblHandlePtr); UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Register), Name); @@ -113,34 +113,34 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* Ret UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Register), TblValidationFuncPtr); int32 status; - + status = UT_DEFAULT_IMPL(CFE_TBL_Register); if (status >= 0) { UT_Stub_CopyToLocal(UT_KEY(CFE_TBL_Register), (uint8 *)TblHandlePtr, sizeof(CFE_TBL_Handle_t)); } - + return status; } -int32 CFE_TBL_GetAddress (void **TblPtr, CFE_TBL_Handle_t TblHandle) +int32 CFE_TBL_GetAddress(void **TblPtr, CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetAddress), TblPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_GetAddress), TblHandle); int32 status; int32 ForceValue; - + status = UT_DEFAULT_IMPL(CFE_TBL_GetAddress); if (status >= 0 && !UT_Stub_CheckDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), &ForceValue)) { - UT_Stub_CopyToLocal(UT_KEY(CFE_TBL_GetAddress), (uint8 *)TblPtr, sizeof(void*)); + UT_Stub_CopyToLocal(UT_KEY(CFE_TBL_GetAddress), (uint8 *)TblPtr, sizeof(void *)); } - + return status; } -int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, const void *SrcDataPtr ) +int32 CFE_TBL_Load(CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, const void *SrcDataPtr) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Load), TblHandle); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Load), SrcType); @@ -152,8 +152,8 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, const return status; } - -int32 CFE_TBL_Unregister( CFE_TBL_Handle_t TblHandle ) + +int32 CFE_TBL_Unregister(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Unregister), TblHandle); @@ -164,7 +164,7 @@ int32 CFE_TBL_Unregister( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_Manage( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Manage(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Manage), TblHandle); @@ -175,7 +175,7 @@ int32 CFE_TBL_Manage( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_ReleaseAddress( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_ReleaseAddress(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_ReleaseAddress), TblHandle); @@ -186,7 +186,7 @@ int32 CFE_TBL_ReleaseAddress( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_ReleaseAddresses( uint16 NumTables, const CFE_TBL_Handle_t TblHandles[] ) +int32 CFE_TBL_ReleaseAddresses(uint16 NumTables, const CFE_TBL_Handle_t TblHandles[]) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_ReleaseAddresses), NumTables); UT_Stub_RegisterContext(UT_KEY(CFE_TBL_ReleaseAddresses), TblHandles); @@ -212,7 +212,7 @@ int32 CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, return status; } -int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Modified(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Modified), TblHandle); @@ -223,7 +223,7 @@ int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_GetStatus( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_GetStatus(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_GetStatus), TblHandle); @@ -234,7 +234,7 @@ int32 CFE_TBL_GetStatus( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_DumpToBuffer( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_DumpToBuffer(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_DumpToBuffer), TblHandle); @@ -245,7 +245,7 @@ int32 CFE_TBL_DumpToBuffer( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Validate(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Validate), TblHandle); @@ -256,7 +256,7 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Update(CFE_TBL_Handle_t TblHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_Update), TblHandle); @@ -267,7 +267,7 @@ int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) return status; } -int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) +int32 CFE_TBL_GetInfo(CFE_TBL_Info_t *TblInfoPtr, const char *TblName) { UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetInfo), TblInfoPtr); UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetInfo), TblName); @@ -276,7 +276,7 @@ int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) status = UT_DEFAULT_IMPL(CFE_TBL_GetInfo); if (status >= 0 && - UT_Stub_CopyToLocal(UT_KEY(CFE_TBL_GetInfo), TblInfoPtr, sizeof(*TblInfoPtr)) < sizeof(*TblInfoPtr)) + UT_Stub_CopyToLocal(UT_KEY(CFE_TBL_GetInfo), TblInfoPtr, sizeof(*TblInfoPtr)) < sizeof(*TblInfoPtr)) { /* just clear the output struct */ memset(TblInfoPtr, 0, sizeof(*TblInfoPtr)); @@ -285,7 +285,7 @@ int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) return status; } -int32 CFE_TBL_GetAddresses( void **TblPtrs[], uint16 NumTables, const CFE_TBL_Handle_t TblHandles[] ) +int32 CFE_TBL_GetAddresses(void **TblPtrs[], uint16 NumTables, const CFE_TBL_Handle_t TblHandles[]) { UT_Stub_RegisterContext(UT_KEY(CFE_TBL_GetAddresses), TblPtrs); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TBL_GetAddresses), NumTables); @@ -298,7 +298,7 @@ int32 CFE_TBL_GetAddresses( void **TblPtrs[], uint16 NumTables, const CFE_TBL_Ha return status; } -int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, const char *TblName ) +int32 CFE_TBL_Share(CFE_TBL_Handle_t *TblHandlePtr, const char *TblName) { UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Share), TblHandlePtr); UT_Stub_RegisterContext(UT_KEY(CFE_TBL_Share), TblName); @@ -309,4 +309,3 @@ int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, const char *TblName ) return status; } - diff --git a/modules/core_api/ut-stubs/src/ut_time_stubs.c b/modules/core_api/ut-stubs/src/ut_time_stubs.c index e3a1414dd..172621b2e 100644 --- a/modules/core_api/ut-stubs/src/ut_time_stubs.c +++ b/modules/core_api/ut-stubs/src/ut_time_stubs.c @@ -23,7 +23,7 @@ ** ** Purpose: ** Unit test stubs for Time routines -** +** ** Notes: ** Minimal work is done, only what is required for unit testing ** @@ -105,10 +105,7 @@ void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint) UT_Stub_RegisterContext(UT_KEY(CFE_TIME_Print), PrintBuffer); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Print), TimeToPrint); - snprintf(PrintBuffer, - CFE_TIME_PRINTED_STRING_SIZE, - "UT %u.%u -", - (unsigned int)TimeToPrint.Seconds, + snprintf(PrintBuffer, CFE_TIME_PRINTED_STRING_SIZE, "UT %u.%u -", (unsigned int)TimeToPrint.Seconds, (unsigned int)TimeToPrint.Subseconds); UT_DEFAULT_IMPL(CFE_TIME_Print); @@ -132,15 +129,15 @@ void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint) ******************************************************************************/ CFE_TIME_SysTime_t CFE_TIME_GetTime(void) { - static CFE_TIME_SysTime_t SimTime = { 0 }; - CFE_TIME_SysTime_t Result = { 0 }; - int32 status; + static CFE_TIME_SysTime_t SimTime = {0}; + CFE_TIME_SysTime_t Result = {0}; + int32 status; status = UT_DEFAULT_IMPL(CFE_TIME_GetTime); if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_GetTime), (uint8*)&Result, sizeof(Result)) < sizeof(Result)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_GetTime), (uint8 *)&Result, sizeof(Result)) < sizeof(Result)) { SimTime.Seconds++; SimTime.Subseconds++; @@ -180,8 +177,7 @@ int32 CFE_TIME_CleanUpApp(CFE_ES_AppId_t AppId) return status; } - -CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_t TimeB) +CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_t TimeB) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Compare), TimeA); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Compare), TimeB); @@ -189,24 +185,24 @@ CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_ int32 status; status = UT_DEFAULT_IMPL(CFE_TIME_Compare); - - return (CFE_TIME_Compare_t) status; + + return (CFE_TIME_Compare_t)status; } -CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) +CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Add), Time1); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Add), Time2); - static CFE_TIME_SysTime_t SimTime = { 0 }; - CFE_TIME_SysTime_t Result = { 0 }; - int32 status; + static CFE_TIME_SysTime_t SimTime = {0}; + CFE_TIME_SysTime_t Result = {0}; + int32 status; status = UT_DEFAULT_IMPL(CFE_TIME_Add); if (status >= 0) { - if (UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_Add), (uint8*)&Result, sizeof(Result)) < sizeof(Result)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_TIME_Add), (uint8 *)&Result, sizeof(Result)) < sizeof(Result)) { SimTime.Seconds++; SimTime.Subseconds++; @@ -217,7 +213,7 @@ CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Ti return Result; } -uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) +uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Sub2MicroSecs), SubSeconds); @@ -225,7 +221,7 @@ uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) status = UT_DEFAULT_IMPL(CFE_TIME_Sub2MicroSecs); - return (uint32) status; + return (uint32)status; } int32 CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) @@ -295,8 +291,8 @@ int16 CFE_TIME_GetLeapSeconds(void) CFE_TIME_SysTime_t CFE_TIME_GetMET(void) { - int32 status; - CFE_TIME_SysTime_t Result = { 0 }; + int32 status; + CFE_TIME_SysTime_t Result = {0}; status = UT_DEFAULT_IMPL(CFE_TIME_GetMET); if (status == 0) @@ -327,8 +323,8 @@ uint32 CFE_TIME_GetMETsubsecs(void) CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void) { - int32 status; - CFE_TIME_SysTime_t Result = { 0 }; + int32 status; + CFE_TIME_SysTime_t Result = {0}; status = UT_DEFAULT_IMPL(CFE_TIME_GetSTCF); if (status == 0) @@ -341,8 +337,8 @@ CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void) CFE_TIME_SysTime_t CFE_TIME_GetTAI(void) { - int32 status; - CFE_TIME_SysTime_t Result = { 0 }; + int32 status; + CFE_TIME_SysTime_t Result = {0}; status = UT_DEFAULT_IMPL(CFE_TIME_GetTAI); if (status == 0) @@ -355,8 +351,8 @@ CFE_TIME_SysTime_t CFE_TIME_GetTAI(void) CFE_TIME_SysTime_t CFE_TIME_GetUTC(void) { - int32 status; - CFE_TIME_SysTime_t Result = { 0 }; + int32 status; + CFE_TIME_SysTime_t Result = {0}; status = UT_DEFAULT_IMPL(CFE_TIME_GetUTC); if (status == 0) @@ -371,8 +367,8 @@ CFE_TIME_SysTime_t CFE_TIME_MET2SCTime(CFE_TIME_SysTime_t METTime) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_MET2SCTime), METTime); - int32 status; - CFE_TIME_SysTime_t Result = { 0 }; + int32 status; + CFE_TIME_SysTime_t Result = {0}; status = UT_DEFAULT_IMPL(CFE_TIME_MET2SCTime); if (status == 0) @@ -410,8 +406,8 @@ CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_ UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Subtract), Time1); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_TIME_Subtract), Time2); - int32 status; - CFE_TIME_SysTime_t Result = { 0 }; + int32 status; + CFE_TIME_SysTime_t Result = {0}; status = UT_DEFAULT_IMPL(CFE_TIME_Subtract); if (status == 0) @@ -421,4 +417,3 @@ CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_ return Result; } - diff --git a/modules/core_private/fsw/inc/cfe_core_resourceid_basevalues.h b/modules/core_private/fsw/inc/cfe_core_resourceid_basevalues.h index 5a5e6527f..e159e958b 100644 --- a/modules/core_private/fsw/inc/cfe_core_resourceid_basevalues.h +++ b/modules/core_private/fsw/inc/cfe_core_resourceid_basevalues.h @@ -40,10 +40,9 @@ * @{ */ - /* * Assign unique offsets per resource types used in CFE core apps. - * + * * Applications should not use these values directly, but rather * in conjuction with the CFE_RESOURCEID_MAKE_BASE macro provided * by the Resource ID module. (see below) @@ -51,15 +50,15 @@ enum { /* - * Note for Task ID base value -- - * This currently shares the same offset as OSAL tasks, such that - * when "simple" (non-enforcing/backward-compatible) IDs are selected, - * the CFE task IDs and the OSAL task IDs end up as the same value. - * - * The "CFE_RESOURCEID_MARK" bit still differentiates the value when - * in strict mode, so there is no overlap in that case. - */ - CFE_RESOURCEID_ES_TASKID_BASE_OFFSET = OS_OBJECT_TYPE_OS_TASK, + * Note for Task ID base value -- + * This currently shares the same offset as OSAL tasks, such that + * when "simple" (non-enforcing/backward-compatible) IDs are selected, + * the CFE task IDs and the OSAL task IDs end up as the same value. + * + * The "CFE_RESOURCEID_MARK" bit still differentiates the value when + * in strict mode, so there is no overlap in that case. + */ + CFE_RESOURCEID_ES_TASKID_BASE_OFFSET = OS_OBJECT_TYPE_OS_TASK, /* Other ES managed resources */ CFE_RESOURCEID_ES_APPID_BASE_OFFSET = OS_OBJECT_TYPE_USER + 1, @@ -72,9 +71,9 @@ enum CFE_RESOURCEID_SB_PIPEID_RESOURCE_BASE_OFFSET = OS_OBJECT_TYPE_USER + 6 }; -/* +/* * Assign actual base values from the offsets above - * + * * Using "enum" ensures these are resolved as integers now, as opposed at to the point of use like macros. */ enum @@ -88,10 +87,9 @@ enum CFE_ES_CDSBLOCKID_BASE = CFE_RESOURCEID_MAKE_BASE(CFE_RESOURCEID_ES_CDSBLOCKID_BASE_OFFSET), /* SB managed resources */ - CFE_SB_PIPEID_BASE = CFE_RESOURCEID_MAKE_BASE(CFE_RESOURCEID_SB_PIPEID_RESOURCE_BASE_OFFSET) + CFE_SB_PIPEID_BASE = CFE_RESOURCEID_MAKE_BASE(CFE_RESOURCEID_SB_PIPEID_RESOURCE_BASE_OFFSET) }; /** @} */ - -#endif /* CFE_CORE_RESOURCEID_BASEVALUES_H */ +#endif /* CFE_CORE_RESOURCEID_BASEVALUES_H */ diff --git a/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h b/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h index 76b30a8eb..dbc240898 100644 --- a/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h +++ b/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h @@ -34,20 +34,20 @@ #include #include -#include /* Needed for CFE_TIME_SysTime_t */ -#include /* Needed for CFE_ES_AppId_t */ +#include /* Needed for CFE_TIME_SysTime_t */ +#include /* Needed for CFE_ES_AppId_t */ -#define CFE_ES_ERLOG_DESCRIPTION_MAX_LENGTH 80 +#define CFE_ES_ERLOG_DESCRIPTION_MAX_LENGTH 80 /* ** Debug variables type */ typedef struct { - uint32 DebugFlag; - uint32 WatchdogWriteFlag; - uint32 PrintfEnabledFlag; - uint32 LastAppId; + uint32 DebugFlag; + uint32 WatchdogWriteFlag; + uint32 PrintfEnabledFlag; + uint32 LastAppId; } CFE_ES_DebugVariables_t; @@ -58,18 +58,17 @@ typedef struct */ typedef struct { - uint32 LogEntryType; /* What type of log entry */ - uint32 ResetType; /* Main cause for the reset */ - uint32 ResetSubtype; /* The sub-type for the reset */ - uint32 BootSource; /* The boot source */ - uint32 ProcessorResetCount; /* The number of processor resets */ - uint32 MaxProcessorResetCount; /* The maximum number before a Power On */ - CFE_ES_DebugVariables_t DebugVars; /* ES Debug variables */ - CFE_TIME_SysTime_t TimeCode; /* Time code */ - char Description[CFE_ES_ERLOG_DESCRIPTION_MAX_LENGTH]; /* The ascii data for the event */ + uint32 LogEntryType; /* What type of log entry */ + uint32 ResetType; /* Main cause for the reset */ + uint32 ResetSubtype; /* The sub-type for the reset */ + uint32 BootSource; /* The boot source */ + uint32 ProcessorResetCount; /* The number of processor resets */ + uint32 MaxProcessorResetCount; /* The maximum number before a Power On */ + CFE_ES_DebugVariables_t DebugVars; /* ES Debug variables */ + CFE_TIME_SysTime_t TimeCode; /* Time code */ + char Description[CFE_ES_ERLOG_DESCRIPTION_MAX_LENGTH]; /* The ascii data for the event */ } CFE_ES_ERLog_BaseInfo_t; - /* ** Exception and Reset Log File Structure ** @@ -82,27 +81,21 @@ typedef struct */ typedef struct { - CFE_ES_ERLog_BaseInfo_t BaseInfo; /* basic info about the event */ - uint32 ContextSize; /* Indicates the context data is valid */ - uint32 AppID; /* The application ID */ - uint8 Context[CFE_PLATFORM_ES_ER_LOG_MAX_CONTEXT_SIZE]; /* cpu context */ + CFE_ES_ERLog_BaseInfo_t BaseInfo; /* basic info about the event */ + uint32 ContextSize; /* Indicates the context data is valid */ + uint32 AppID; /* The application ID */ + uint8 Context[CFE_PLATFORM_ES_ER_LOG_MAX_CONTEXT_SIZE]; /* cpu context */ } CFE_ES_ERLog_FileEntry_t; - /* ** Exception and Reset Log Metadata Structure ** This is stored in ES RAM, not _directly_ written to ER log files. */ typedef struct { - CFE_ES_ERLog_BaseInfo_t BaseInfo; /**< Core Log Data */ - CFE_ES_AppId_t AppID; /* The application ID */ - uint32 PspContextId; /**< Reference to context information stored in PSP */ + CFE_ES_ERLog_BaseInfo_t BaseInfo; /**< Core Log Data */ + CFE_ES_AppId_t AppID; /* The application ID */ + uint32 PspContextId; /**< Reference to context information stored in PSP */ } CFE_ES_ERLog_MetaData_t; - - - - - #endif /* CFE_ES_ERLOG_TYPEDEF_H_ */ diff --git a/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h b/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h index 87dff302e..795a7053c 100644 --- a/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h +++ b/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h @@ -32,23 +32,24 @@ #include #include "cfe_mission_cfg.h" /* Required for CFE_MISSION_ES_PERF_MAX_IDS */ -#include "cfe_platform_cfg.h" /* Required for CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE */ +#include "cfe_platform_cfg.h" /* Required for CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE */ #define CFE_ES_PERF_32BIT_WORDS_IN_MASK ((CFE_MISSION_ES_PERF_MAX_IDS) / 32) - -typedef struct { - uint32 Data; - uint32 TimerUpper32; /* TBU - timebase register */ - uint32 TimerLower32; /* TBL - timebase register */ +typedef struct +{ + uint32 Data; + uint32 TimerUpper32; /* TBU - timebase register */ + uint32 TimerLower32; /* TBL - timebase register */ } CFE_ES_PerfDataEntry_t; -typedef struct { - uint8 Version; - uint8 Endian; - uint8 Spare[2]; - uint32 TimerTicksPerSecond; - uint32 TimerLow32Rollover; +typedef struct +{ + uint8 Version; + uint8 Endian; + uint8 Spare[2]; + uint32 TimerTicksPerSecond; + uint32 TimerLow32Rollover; /* * The "State" member is marked volatile to help * ensure that an optimizing compiler does not rearrange @@ -56,23 +57,22 @@ typedef struct { * outside of any locking to determine whether or not * the performance log function is enabled. */ - volatile uint32 State; - uint32 Mode; - uint32 TriggerCount; - uint32 DataStart; - uint32 DataEnd; - uint32 DataCount; - uint32 InvalidMarkerReported; - uint32 FilterTriggerMaskSize; - uint32 FilterMask[CFE_ES_PERF_32BIT_WORDS_IN_MASK]; - uint32 TriggerMask[CFE_ES_PERF_32BIT_WORDS_IN_MASK]; + volatile uint32 State; + uint32 Mode; + uint32 TriggerCount; + uint32 DataStart; + uint32 DataEnd; + uint32 DataCount; + uint32 InvalidMarkerReported; + uint32 FilterTriggerMaskSize; + uint32 FilterMask[CFE_ES_PERF_32BIT_WORDS_IN_MASK]; + uint32 TriggerMask[CFE_ES_PERF_32BIT_WORDS_IN_MASK]; } CFE_ES_PerfMetaData_t; -typedef struct { - CFE_ES_PerfMetaData_t MetaData; - CFE_ES_PerfDataEntry_t DataBuffer[CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE]; +typedef struct +{ + CFE_ES_PerfMetaData_t MetaData; + CFE_ES_PerfDataEntry_t DataBuffer[CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE]; } CFE_ES_PerfData_t; - - #endif /* CFE_ES_PERFDATA_TYPEDEF_H_ */ diff --git a/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h b/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h index 75f17b8bf..6bfc87041 100644 --- a/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h +++ b/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h @@ -33,26 +33,25 @@ #include -#include "cfe_time_resetvars_typedef.h" /* Required for CFE_TIME_ResetVars_t definition */ -#include "cfe_es_erlog_typedef.h" /* Required for CFE_ES_ERLog_t definition */ -#include "cfe_es_perfdata_typedef.h" /* Required for CFE_ES_PerfData_t definition */ -#include "cfe_evs_log_typedef.h" /* Required for CFE_EVS_Log_t definition */ -#include "cfe_platform_cfg.h" /* CFE_PLATFORM_ES_ER_LOG_ENTRIES, CFE_PLATFORM_ES_SYSTEM_LOG_SIZE */ +#include "cfe_time_resetvars_typedef.h" /* Required for CFE_TIME_ResetVars_t definition */ +#include "cfe_es_erlog_typedef.h" /* Required for CFE_ES_ERLog_t definition */ +#include "cfe_es_perfdata_typedef.h" /* Required for CFE_ES_PerfData_t definition */ +#include "cfe_evs_log_typedef.h" /* Required for CFE_EVS_Log_t definition */ +#include "cfe_platform_cfg.h" /* CFE_PLATFORM_ES_ER_LOG_ENTRIES, CFE_PLATFORM_ES_SYSTEM_LOG_SIZE */ /* ** Reset Variables type */ typedef struct { - uint32 ResetType; - uint32 ResetSubtype; - uint32 BootSource; - uint32 ES_CausedReset; - uint32 ProcessorResetCount; - uint32 MaxProcessorResetCount; + uint32 ResetType; + uint32 ResetSubtype; + uint32 BootSource; + uint32 ES_CausedReset; + uint32 ProcessorResetCount; + uint32 MaxProcessorResetCount; } CFE_ES_ResetVariables_t; - /* ** Executive Services Global Reset Data type ** This is the special memory area for ES that is preserved @@ -60,46 +59,44 @@ typedef struct */ typedef struct { - /* - ** Exception and Reset log declaration - */ - CFE_ES_ERLog_MetaData_t ERLog[CFE_PLATFORM_ES_ER_LOG_ENTRIES]; - uint32 ERLogIndex; - uint32 ERLogEntries; - uint32 LastAppId; - - /* - ** System Log declaration - */ - char SystemLog[CFE_PLATFORM_ES_SYSTEM_LOG_SIZE]; - size_t SystemLogWriteIdx; - size_t SystemLogEndIdx; - uint32 SystemLogMode; - uint32 SystemLogEntryNum; - - /* - ** Performance Data - */ - CFE_ES_PerfData_t Perf; - - /* - ** Reset Variables - */ - CFE_ES_ResetVariables_t ResetVars; - - /* - ** Time variables that are - ** preserved on a processor reset - */ - CFE_TIME_ResetVars_t TimeResetVars; - - /* - ** EVS Log and associated variables. This needs to be preserved on a processor reset. - */ - CFE_EVS_Log_t EVS_Log; + /* + ** Exception and Reset log declaration + */ + CFE_ES_ERLog_MetaData_t ERLog[CFE_PLATFORM_ES_ER_LOG_ENTRIES]; + uint32 ERLogIndex; + uint32 ERLogEntries; + uint32 LastAppId; + + /* + ** System Log declaration + */ + char SystemLog[CFE_PLATFORM_ES_SYSTEM_LOG_SIZE]; + size_t SystemLogWriteIdx; + size_t SystemLogEndIdx; + uint32 SystemLogMode; + uint32 SystemLogEntryNum; + + /* + ** Performance Data + */ + CFE_ES_PerfData_t Perf; + + /* + ** Reset Variables + */ + CFE_ES_ResetVariables_t ResetVars; + + /* + ** Time variables that are + ** preserved on a processor reset + */ + CFE_TIME_ResetVars_t TimeResetVars; + + /* + ** EVS Log and associated variables. This needs to be preserved on a processor reset. + */ + CFE_EVS_Log_t EVS_Log; } CFE_ES_ResetData_t; - - #endif /* CFE_ES_RESETDATA_TYPEDEF_H_ */ diff --git a/modules/core_private/fsw/inc/cfe_evs_log_typedef.h b/modules/core_private/fsw/inc/cfe_evs_log_typedef.h index a312b6adc..0cb4fa3d7 100644 --- a/modules/core_private/fsw/inc/cfe_evs_log_typedef.h +++ b/modules/core_private/fsw/inc/cfe_evs_log_typedef.h @@ -34,22 +34,21 @@ #include #include -#include "cfe_evs_msg.h" /* Required for CFE_EVS_LongEventTlm_t definition */ +#include "cfe_evs_msg.h" /* Required for CFE_EVS_LongEventTlm_t definition */ /* ** \brief EVS Log type definition. This is declared here so ES can include it ** in the reset area structure */ -typedef struct { - uint16 Next; /**< \brief Index of the next entry in the local event log */ - uint16 LogCount; /**< \brief Local Event Kog counter */ - uint8 LogFullFlag; /**< \brief Local Event Log full flag */ - uint8 LogMode; /**< \brief Local Event Logging mode (overwrite/discard) */ - uint16 LogOverflowCounter; /**< \brief Local Event Log overflow counter */ - CFE_EVS_LongEventTlm_t LogEntry[CFE_PLATFORM_EVS_LOG_MAX];/**< \brief The actual Local Event Log entry */ +typedef struct +{ + uint16 Next; /**< \brief Index of the next entry in the local event log */ + uint16 LogCount; /**< \brief Local Event Kog counter */ + uint8 LogFullFlag; /**< \brief Local Event Log full flag */ + uint8 LogMode; /**< \brief Local Event Logging mode (overwrite/discard) */ + uint16 LogOverflowCounter; /**< \brief Local Event Log overflow counter */ + CFE_EVS_LongEventTlm_t LogEntry[CFE_PLATFORM_EVS_LOG_MAX]; /**< \brief The actual Local Event Log entry */ } CFE_EVS_Log_t; - - #endif /* CFE_EVS_LOG_TYPEDEF_H_ */ diff --git a/modules/core_private/fsw/inc/cfe_sb_destination_typedef.h b/modules/core_private/fsw/inc/cfe_sb_destination_typedef.h index 5faf02a32..2c5b0ab41 100644 --- a/modules/core_private/fsw/inc/cfe_sb_destination_typedef.h +++ b/modules/core_private/fsw/inc/cfe_sb_destination_typedef.h @@ -27,7 +27,7 @@ #define CFE_SB_DESTINATION_TYPEDEF_H_ #include "common_types.h" -#include "cfe_sb_extern_typedefs.h" /* Required for CFE_SB_PipeId_t definition */ +#include "cfe_sb_extern_typedefs.h" /* Required for CFE_SB_PipeId_t definition */ /****************************************************************************** * This structure defines a DESTINATION DESCRIPTOR used to specify @@ -38,15 +38,15 @@ */ typedef struct { - CFE_SB_PipeId_t PipeId; - uint8 Active; - uint16 MsgId2PipeLim; - uint16 BuffCount; - uint16 DestCnt; - uint8 Scope; - uint8 Spare[3]; - void *Prev; - void *Next; + CFE_SB_PipeId_t PipeId; + uint8 Active; + uint16 MsgId2PipeLim; + uint16 BuffCount; + uint16 DestCnt; + uint8 Scope; + uint8 Spare[3]; + void * Prev; + void * Next; } CFE_SB_DestinationD_t; #endif /* CFE_SB_DESTINATION_TYPEDEF_H_ */ diff --git a/modules/core_private/fsw/inc/cfe_sbr_api_typedefs.h b/modules/core_private/fsw/inc/cfe_sbr_api_typedefs.h index 25ff71742..b326f79c5 100644 --- a/modules/core_private/fsw/inc/cfe_sbr_api_typedefs.h +++ b/modules/core_private/fsw/inc/cfe_sbr_api_typedefs.h @@ -42,7 +42,6 @@ /** \brief Invalid route id */ #define CFE_SBR_INVALID_ROUTE_ID ((CFE_SBR_RouteId_t) {.RouteId = 0}) - /****************************************************************************** * Type Definitions */ @@ -74,5 +73,4 @@ typedef struct /** \brief For each id callback function prototype */ typedef void (*CFE_SBR_CallbackPtr_t)(CFE_SBR_RouteId_t RouteId, void *ArgPtr); - #endif /* CFE_SBR_API_TYPEDEFS_H */ diff --git a/modules/core_private/fsw/inc/cfe_time_resetvars_typedef.h b/modules/core_private/fsw/inc/cfe_time_resetvars_typedef.h index 6b231e2b9..5414a8d82 100644 --- a/modules/core_private/fsw/inc/cfe_time_resetvars_typedef.h +++ b/modules/core_private/fsw/inc/cfe_time_resetvars_typedef.h @@ -35,14 +35,12 @@ #ifndef CFE_TIME_RESETVARS_TYPEDEF_H #define CFE_TIME_RESETVARS_TYPEDEF_H - /* ** Includes */ #include "common_types.h" #include "cfe_time_extern_typedefs.h" - /** ** \brief Time related variables that are maintained through a Processor Reset ** @@ -53,16 +51,15 @@ */ typedef struct CFE_TIME_ResetVars { - uint32 Signature; /**< \brief Data validation signature used to verify data structure contents*/ - int16 LeapSeconds; /**< \brief Leap seconds value */ - uint16 ClockSignal; /**< \brief Current clock signal selection */ - CFE_TIME_SysTime_t CurrentMET; /**< \brief Current Mission Elapsed Time (MET) */ - CFE_TIME_SysTime_t CurrentSTCF; /**< \brief Current Spacecraft Time Correlation Factor (STCF) */ - CFE_TIME_SysTime_t CurrentDelay; /**< \brief Current time client delay value */ + uint32 Signature; /**< \brief Data validation signature used to verify data structure contents*/ + int16 LeapSeconds; /**< \brief Leap seconds value */ + uint16 ClockSignal; /**< \brief Current clock signal selection */ + CFE_TIME_SysTime_t CurrentMET; /**< \brief Current Mission Elapsed Time (MET) */ + CFE_TIME_SysTime_t CurrentSTCF; /**< \brief Current Spacecraft Time Correlation Factor (STCF) */ + CFE_TIME_SysTime_t CurrentDelay; /**< \brief Current time client delay value */ } CFE_TIME_ResetVars_t; - #endif /* CFE_TIME_RESETVARS_TYPEDEF_H */ /************************/ diff --git a/modules/core_private/ut-stubs/inc/ut_osprintf_stubs.h b/modules/core_private/ut-stubs/inc/ut_osprintf_stubs.h index 377f20c14..a58c3c299 100644 --- a/modules/core_private/ut-stubs/inc/ut_osprintf_stubs.h +++ b/modules/core_private/ut-stubs/inc/ut_osprintf_stubs.h @@ -100,4 +100,3 @@ #define UT_OSP_BACKGROUND_TAKE 71 #endif - diff --git a/modules/core_private/ut-stubs/inc/ut_support.h b/modules/core_private/ut-stubs/inc/ut_support.h index 6ff966828..f0f728d5c 100644 --- a/modules/core_private/ut-stubs/inc/ut_support.h +++ b/modules/core_private/ut-stubs/inc/ut_support.h @@ -58,17 +58,16 @@ extern const char *UT_OSP_MESSAGES[]; #define CFE_ES_CDS_NUM_BLOCK_SIZES 17 /* MIN_BLOCK_SIZE must be < 16 bytes */ -#define CFE_ES_CDS_MIN_BLOCK_SIZE 8 -#define UT_EVENT_HISTORY_SIZE 64 -#define UT_MAX_MESSAGE_LENGTH 300 +#define CFE_ES_CDS_MIN_BLOCK_SIZE 8 +#define UT_EVENT_HISTORY_SIZE 64 +#define UT_MAX_MESSAGE_LENGTH 300 /* Macro to add a test to the UT assert list */ -#define UT_ADD_TEST(Func) UtTest_Add(Func, NULL, NULL, #Func) - +#define UT_ADD_TEST(Func) UtTest_Add(Func, NULL, NULL, #Func) /* Required to be defined for GetMsgId and SetMsgId stubs * Actual macro defitiions are in cfe_sb_msg_id_utils.h - * #ifndef so that the actual macros are used for unit + * #ifndef so that the actual macros are used for unit * testing of SB * */ #ifndef CFE_SB_CMD_MESSAGE_TYPE @@ -76,15 +75,15 @@ extern const char *UT_OSP_MESSAGES[]; #endif #ifndef CFE_SB_RD_APID_FROM_MSGID -#define CFE_SB_RD_APID_FROM_MSGID(MsgId) (MsgId & 0x0000007F) +#define CFE_SB_RD_APID_FROM_MSGID(MsgId) (MsgId & 0x0000007F) #endif #ifndef CFE_SB_RD_SUBSYS_ID_FROM_MSGID -#define CFE_SB_RD_SUBSYS_ID_FROM_MSGID(MsgId) ( (MsgId & 0x0000FF00) >> 8) +#define CFE_SB_RD_SUBSYS_ID_FROM_MSGID(MsgId) ((MsgId & 0x0000FF00) >> 8) #endif #ifndef CFE_SB_RD_TYPE_FROM_MSGID -#define CFE_SB_RD_TYPE_FROM_MSGID(MsgId) ( (MsgId & CFE_SB_CMD_MESSAGE_TYPE) >> 7) +#define CFE_SB_RD_TYPE_FROM_MSGID(MsgId) ((MsgId & CFE_SB_CMD_MESSAGE_TYPE) >> 7) #endif /* @@ -98,16 +97,15 @@ extern const char *UT_OSP_MESSAGES[]; */ #define UT_LITTLE_ENDIAN 1 #define UT_BIG_ENDIAN 2 -extern uint8 UT_Endianess; - +extern uint8 UT_Endianess; typedef struct { CFE_SB_MsgId_t MsgId; - uint16 SnapshotOffset; - uint16 SnapshotSize; - uint16 Count; - void *SnapshotBuffer; + uint16 SnapshotOffset; + uint16 SnapshotSize; + uint16 Count; + void * SnapshotBuffer; } UT_SoftwareBusSnapshot_Entry_t; /* @@ -237,8 +235,7 @@ void UT_ResetPoolBufferIndex(void); ** This function does not return a value. ** ******************************************************************************/ -void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, - const char *info); +void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, const char *info); /*****************************************************************************/ /** @@ -273,8 +270,8 @@ void UT_ReportFailures(void); ** \returns ** This function does not return a value. ******************************************************************************/ -void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t*), CFE_MSG_Message_t *MsgPtr, size_t MsgSize, - UT_TaskPipeDispatchId_t DispatchId); +void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t *MsgPtr, size_t MsgSize, + UT_TaskPipeDispatchId_t DispatchId); /*****************************************************************************/ /** @@ -290,8 +287,7 @@ void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t*), CFE_MSG_Message_t * ** Passes through the return code from the handler ** ******************************************************************************/ -int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCount, - const UT_StubContext_t *Context); +int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context); /*****************************************************************************/ /** @@ -335,8 +331,7 @@ void UT_SetAppID(CFE_ES_AppId_t AppID_in); ** This function does not return a value. ** ******************************************************************************/ -void UT_SetStatusBSPResetArea(int32 status, uint32 Signature, - uint32 ClockSignal); +void UT_SetStatusBSPResetArea(int32 status, uint32 Signature, uint32 ClockSignal); /*****************************************************************************/ /** @@ -434,7 +429,7 @@ void UT_SetSizeofESResetArea(int32 Size); ** This function does not return a value. ** ******************************************************************************/ -uint8* UT_SetCDSSize(int32 Size); +uint8 *UT_SetCDSSize(int32 Size); /*****************************************************************************/ /** @@ -581,7 +576,6 @@ void UT_DisplayPkt(CFE_MSG_Message_t *MsgPtr, size_t size); ******************************************************************************/ CFE_ES_ResetData_t *UT_GetResetDataPtr(void); - /*****************************************************************************/ /** ** \brief Add a test as a member of a subgroup. @@ -598,8 +592,8 @@ CFE_ES_ResetData_t *UT_GetResetDataPtr(void); ** None ** ******************************************************************************/ -void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(void), - const char *GroupName, const char *TestName); +void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(void), const char *GroupName, + const char *TestName); /** \brief Function to be called by the SETUP() macro */ void UT_SETUP_impl(const char *FileName, int LineNum, const char *TestName, const char *FnName, int32 FnRet); @@ -642,8 +636,8 @@ void UT_ASSERT_impl(const char *FileName, int LineNum, const char *TestName, con #define ASSERT(FN) (UT_ASSERT_impl(__FILE__, __LINE__, __func__, (#FN), (FN))) /** \brief Function to be called by the ASSERT_EQ() macro */ -void UT_ASSERT_EQ_impl(const char *FileName, int LineNum, - const char *FnName, int32 FnRet, const char *ExpName, int32 Exp); +void UT_ASSERT_EQ_impl(const char *FileName, int LineNum, const char *FnName, int32 FnRet, const char *ExpName, + int32 Exp); /*****************************************************************************/ /** @@ -661,12 +655,10 @@ void UT_ASSERT_EQ_impl(const char *FileName, int LineNum, ** \sa #START, #SETUP, #ASSERT, #ASSERT_TRUE, #EVTCNT, #EVTSENT, #REPORT, #TEARDOWN ** ******************************************************************************/ -#define ASSERT_EQ(FN,EXP) (UT_ASSERT_EQ_impl(__FILE__, __LINE__, (#FN), (FN), (#EXP), (EXP))) - +#define ASSERT_EQ(FN, EXP) (UT_ASSERT_EQ_impl(__FILE__, __LINE__, (#FN), (FN), (#EXP), (EXP))) /** \brief Function to be called by the ASSERT_EQ() macro */ -void UT_ASSERT_TRUE_impl(const char *FileName, int LineNum, const char *TestName, - const char *ExpName, bool Exp); +void UT_ASSERT_TRUE_impl(const char *FileName, int LineNum, const char *TestName, const char *ExpName, bool Exp); /*****************************************************************************/ /** diff --git a/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c b/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c index ffbf45f48..452cbb498 100644 --- a/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c +++ b/modules/core_private/ut-stubs/src/ut_osprintf_stubs.c @@ -36,133 +36,131 @@ #include "ut_support.h" #include "ut_osprintf_stubs.h" - /* ** Global variables */ -const char *UT_OSP_MESSAGES[] = -{ - [0] = NULL, /* Message 0 is reserved */ - /* ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_MOUNT_VOLATILE] = "ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n", - /* CFE_ES_ExitApp: CORE Application CFE_ES Had a Runtime Error. */ - [UT_OSP_CORE_RUNTIME] = "CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n", - /* ES:Call to CFE_ES_RegisterApp Failed, RC = 0x~ */ - [UT_OSP_REGISTER_APP] = "ES:Call to CFE_ES_RegisterApp Failed, RC = 0x%08X\n", - /* ES Startup: OS_TaskCreate error creating core App: CFE_TBL: EC = 0x~ */ - [UT_OSP_CORE_APP_CREATE] = "ES Startup: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", - /* ES Startup: Error returned when calling function: CFE_TBL_EarlyInit: EC = 0x~ */ - [UT_OSP_EARLYINIT] = "ES Startup: Error returned when calling function: %s: EC = 0x%08X\n", - /* ES Startup: Could not find Library Init symbol:TST_LIB_Init. EC = 0x~ */ - [UT_OSP_FIND_LIBRARY] = "ES Startup: Could not find Library Init symbol:%s. EC = %d\n", - /* POWER ON RESET due to max proc resets (HW Spec Cmd). */ - [UT_OSP_POR_MAX_HW_SPECIAL] = "POWER ON RESET due to max proc resets (HW Spec Cmd).\n", - /* CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = ~ */ - [UT_OSP_CANNOT_CALL_APP_MAIN] = "CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = %d\n", - /* ES Startup: bad function pointer ( table entry = 1). */ - [UT_OSP_FUNCTION_POINTER] = "ES Startup: bad function pointer ( table entry = %d).\n", - /* ES Startup: Error Reading Startup file. EC = 0x~ */ - [UT_OSP_STARTUP_READ] = "ES Startup: Error Reading Startup file. EC = 0x%08X\n", - /* PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded). */ - [UT_OSP_PROC_RESET_COMMANDED] = "PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n", - /* ES SharedData Mutex Take Err Stat=0x~,App=1,Func=TestAPI,Line=12345 */ - [UT_OSP_MUTEX_TAKE] = "ES SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", - /* ES Startup: Startup Sync failed - Applications may not have all started */ - [UT_OSP_STARTUP_SYNC_FAIL_1] = "ES Startup: Startup Sync failed - Applications may not have all started\n", - /* Warning: System Log full, log entry discarded. */ - [UT_OSP_SYSTEM_LOG_FULL] = "Warning: System Log full, log entry discarded.\n", - /* ES Startup: ES Startup File Line is too long: 137 bytes. */ - [UT_OSP_FILE_LINE_TOO_LONG] = "ES Startup: ES Startup File Line is too long: %u bytes.\n", - /* ES Startup: Load Shared Library Init Error. */ - [UT_OSP_SHARED_LIBRARY_INIT] = "ES Startup: Load Shared Library Init Error = 0x%08x\n", - /* ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_REMOVE_VOLATILE] = "ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n", - /* POWER ON RESET due to other cause (See Subtype). */ - [UT_OSP_POR_OTHER] = "POWER ON RESET due to other cause (See Subtype).\n", - /* ES Startup: Error Determining Blocks Free on Volume. EC = 0x~ */ - [UT_OSP_DETERMINE_BLOCKS] = "ES Startup: Error Determining Blocks Free on Volume. EC = 0x%08X\n", - /* ES Startup: Startup Sync failed - Applications may not have all initialized */ - [UT_OSP_STARTUP_SYNC_FAIL_2] = "ES Startup: Startup Sync failed - Applications may not have all initialized\n", - /* ES Startup: No free library slots available */ - [UT_OSP_LIBRARY_SLOTS] = "ES Startup: No free library slots available\n", - /* ES Startup: Unable to extract filename from path: ut/filename.gz. */ - [UT_OSP_EXTRACT_FILENAME_UT] = "ES Startup: Unable to extract filename from path: %s.\n", - /* ES Startup: Application path plus file name length (~) exceeds max allowed (~) */ - [UT_OSP_APP_PATH_FILE_TOO_LONG] = "ES Startup: Application path plus file name length (%d) exceeds max allowed (%d)\n", - /* ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_REFORMAT_VOLATILE] = "ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES Startup: Could not load cFE application file:ut/filename.x. EC = 0x~ */ - [UT_OSP_EXTRACT_FILENAME_UT55] = "ES Startup: Could not load file:%s. EC = 0x%08X\n", - /* ES Startup: Unable to extract filename from path: ut46/ */ - [UT_OSP_EXTRACT_FILENAME_UT46] = "ES Startup: Unable to extract filename from path: %s.\n", - /* ES Startup: No free application slots available */ - [UT_OSP_NO_FREE_APP_SLOTS] = "ES Startup: No free application slots available\n", - /* ES Startup: Unable to extract filename from path: ut57/ */ - [UT_OSP_EXTRACT_FILENAME_UT57] = "ES Startup: Unable to extract filename from path: %s.\n", - /* ES SharedData Mutex Give Err Stat=0x~,App=1,Func=TestAPI,Line=98765 */ - [UT_OSP_MUTEX_GIVE] = "ES SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", - /* ES Startup: Could not find symbol:EntryPoint. EC = 0x~ */ - [UT_OSP_CANNOT_FIND_SYMBOL] = "ES Startup: Could not find symbol:%s. EC = 0x%08X\n", - /* ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_INIT_VOLATILE] = "ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES:Application Init Failed,RC=0x~ */ - [UT_OSP_APP_INIT] = "ES:Application Init Failed,RC=0x%08X\n", - /* POWER ON RESET due to max proc resets (Commanded). */ - [UT_OSP_POR_MAX_PROC_RESETS] = "POWER ON RESET due to max proc resets (Commanded).\n", - /* CFE_ES_RestartApp: Cannot Restart Application appName, It is not running. */ - [UT_OSP_CANNOT_RESTART_APP] = "CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n", - /* ES Startup: Insufficent Free Space on Volatile Disk, Reformatting. */ - [UT_OSP_INSUFF_FREE_SPACE] = "ES Startup: Insufficent Free Space on Volatile Disk, Reformatting.\n", - /* ES Startup: Could not load cFE Shared Library */ - [UT_OSP_LOAD_SHARED_LIBRARY] = "ES Startup: Could not load cFE Shared Library\n", - /* POWER ON RESET due to HW Special Cmd (Hw Spec Cmd). */ - [UT_OSP_POR_HW_SPECIAL] = "POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n", - /* ES Startup: AppCreate Error: TaskCreate AppName Failed. EC = 0x~! */ - [UT_OSP_APP_CREATE] = "ES Startup: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", - /* ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_CREATE_VOLATILE] = "ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES Startup: Failed to unload APP: AppName. EC = 0x~ */ - [UT_OSP_MODULE_UNLOAD_FAILED] = "ES Startup: Failed to unload: %s. EC = 0x%08X\n", - /* POWERON RESET called from CFE_ES_ResetCFE (Commanded). */ - [UT_OSP_POR_COMMANDED] = "POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n", - /* ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_REMOUNT_VOLATILE] = "ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", - /* CFE_ES_ExitApp, Cannot Exit CORE Application CFE_ES */ - [UT_OSP_CORE_APP_EXIT] = "CFE_ES_ExitApp, Cannot Exit CORE Application %s\n", - /* ES Startup: Opened ES App Startup file: */ - [UT_OSP_ES_APP_STARTUP_OPEN] = "ES Startup: Opened ES App Startup file: %s\n", - /* CFE_ES_ExitApp: CORE Application CFE_ES Had an Init Error. */ - [UT_OSP_CORE_INIT] = "CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n", - /* PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd). */ - [UT_OSP_PROC_RESET_MAX_HW_SPECIAL] = "PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n", - /* ES:Error reading cmd pipe,RC=0x~ */ - [UT_OSP_COMMAND_PIPE] = "ES:Error reading cmd pipe,RC=0x%08X\n", - /* ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x~ */ - [UT_OSP_UNMOUNT_VOLATILE] = "ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", - /* ES Startup: Error: ES_TaskTable slot in use at task creation! */ - [UT_OSP_TABLE_SLOT_IN_USE] = "ES Startup: Error: ES_TaskTable slot in use at task creation!\n", - /* ES Startup: Error, Can't Open ES App Startup file: */ - [UT_OSP_CANNOT_OPEN_ES_APP_STARTUP] = "ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", - /* ES Startup: Unable to extract filename from path: /cf/apps/tst_lib.bundle.gz. */ - [UT_OSP_EXTRACT_FILENAME_CF] = "ES Startup: Unable to extract filename from path: %s.\n", - /* Warning: Invalid System Log mode, log entry discarded. */ - [UT_OSP_INVALID_LOG_MODE] = "Warning: Invalid System Log mode, log entry discarded.\n", - /* ES Startup: Library path plus file name length (~) exceeds max allowed (~) */ - [UT_OSP_LIB_PATH_FILE_TOO_LONG] = "ES Startup: Library path plus file name length (%d) exceeds max allowed (%d)\n", - /* ES Startup: Unable to decompress Application File: ut/filename.gz */ - [UT_OSP_DECOMPRESS_APP] = "ES Startup: Unable to decompress Application File: %s\n", - /* ES Startup: Unable to decompress library file: /cf/apps/tst_lib.bundle.gz */ - [UT_OSP_DECOMPRESS_LIBRARY] = "ES Startup: Unable to decompress library file: %s\n", - /* CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = ~, RC = 0x~ */ - [UT_OSP_GET_APP_ID] = "CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = %d, RC = 0x%08X\n", - /* ES Startup: Error, No free application slots available for CORE App! */ - [UT_OSP_NO_FREE_CORE_APP_SLOTS] = "ES Startup: Error, No free application slots available for CORE App!\n", - /* ES Startup: CFE_ES_Global.TaskTable record used error for App: CFE_EVS, continuing. */ - [UT_OSP_RECORD_USED] = "ES Startup: Error: ES_TaskTable slot for ID %lx in use at task creation!\n", - /* CFE_ES_ExitChildTask called from invalid task context */ - [UT_OSP_TASKEXIT_BAD_CONTEXT] = "CFE_ES_ExitChildTask called from invalid task context\n", - [UT_OSP_BACKGROUND_REGISTER] = "CFE_ES: Background Task Failed to register: %08lx\n", - [UT_OSP_BACKGROUND_TAKE] = "CFE_ES: Failed to take background sem: %08lx\n", +const char *UT_OSP_MESSAGES[] = { + [0] = NULL, /* Message 0 is reserved */ + /* ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x~ */ + [UT_OSP_MOUNT_VOLATILE] = "ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + /* CFE_ES_ExitApp: CORE Application CFE_ES Had a Runtime Error. */ + [UT_OSP_CORE_RUNTIME] = "CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n", + /* ES:Call to CFE_ES_RegisterApp Failed, RC = 0x~ */ + [UT_OSP_REGISTER_APP] = "ES:Call to CFE_ES_RegisterApp Failed, RC = 0x%08X\n", + /* ES Startup: OS_TaskCreate error creating core App: CFE_TBL: EC = 0x~ */ + [UT_OSP_CORE_APP_CREATE] = "ES Startup: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", + /* ES Startup: Error returned when calling function: CFE_TBL_EarlyInit: EC = 0x~ */ + [UT_OSP_EARLYINIT] = "ES Startup: Error returned when calling function: %s: EC = 0x%08X\n", + /* ES Startup: Could not find Library Init symbol:TST_LIB_Init. EC = 0x~ */ + [UT_OSP_FIND_LIBRARY] = "ES Startup: Could not find Library Init symbol:%s. EC = %d\n", + /* POWER ON RESET due to max proc resets (HW Spec Cmd). */ + [UT_OSP_POR_MAX_HW_SPECIAL] = "POWER ON RESET due to max proc resets (HW Spec Cmd).\n", + /* CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = ~ */ + [UT_OSP_CANNOT_CALL_APP_MAIN] = "CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = %d\n", + /* ES Startup: bad function pointer ( table entry = 1). */ + [UT_OSP_FUNCTION_POINTER] = "ES Startup: bad function pointer ( table entry = %d).\n", + /* ES Startup: Error Reading Startup file. EC = 0x~ */ + [UT_OSP_STARTUP_READ] = "ES Startup: Error Reading Startup file. EC = 0x%08X\n", + /* PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded). */ + [UT_OSP_PROC_RESET_COMMANDED] = "PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n", + /* ES SharedData Mutex Take Err Stat=0x~,App=1,Func=TestAPI,Line=12345 */ + [UT_OSP_MUTEX_TAKE] = "ES SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", + /* ES Startup: Startup Sync failed - Applications may not have all started */ + [UT_OSP_STARTUP_SYNC_FAIL_1] = "ES Startup: Startup Sync failed - Applications may not have all started\n", + /* Warning: System Log full, log entry discarded. */ + [UT_OSP_SYSTEM_LOG_FULL] = "Warning: System Log full, log entry discarded.\n", + /* ES Startup: ES Startup File Line is too long: 137 bytes. */ + [UT_OSP_FILE_LINE_TOO_LONG] = "ES Startup: ES Startup File Line is too long: %u bytes.\n", + /* ES Startup: Load Shared Library Init Error. */ + [UT_OSP_SHARED_LIBRARY_INIT] = "ES Startup: Load Shared Library Init Error = 0x%08x\n", + /* ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x~ */ + [UT_OSP_REMOVE_VOLATILE] = "ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n", + /* POWER ON RESET due to other cause (See Subtype). */ + [UT_OSP_POR_OTHER] = "POWER ON RESET due to other cause (See Subtype).\n", + /* ES Startup: Error Determining Blocks Free on Volume. EC = 0x~ */ + [UT_OSP_DETERMINE_BLOCKS] = "ES Startup: Error Determining Blocks Free on Volume. EC = 0x%08X\n", + /* ES Startup: Startup Sync failed - Applications may not have all initialized */ + [UT_OSP_STARTUP_SYNC_FAIL_2] = "ES Startup: Startup Sync failed - Applications may not have all initialized\n", + /* ES Startup: No free library slots available */ + [UT_OSP_LIBRARY_SLOTS] = "ES Startup: No free library slots available\n", + /* ES Startup: Unable to extract filename from path: ut/filename.gz. */ + [UT_OSP_EXTRACT_FILENAME_UT] = "ES Startup: Unable to extract filename from path: %s.\n", + /* ES Startup: Application path plus file name length (~) exceeds max allowed (~) */ + [UT_OSP_APP_PATH_FILE_TOO_LONG] = + "ES Startup: Application path plus file name length (%d) exceeds max allowed (%d)\n", + /* ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x~ */ + [UT_OSP_REFORMAT_VOLATILE] = "ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n", + /* ES Startup: Could not load cFE application file:ut/filename.x. EC = 0x~ */ + [UT_OSP_EXTRACT_FILENAME_UT55] = "ES Startup: Could not load file:%s. EC = 0x%08X\n", + /* ES Startup: Unable to extract filename from path: ut46/ */ + [UT_OSP_EXTRACT_FILENAME_UT46] = "ES Startup: Unable to extract filename from path: %s.\n", + /* ES Startup: No free application slots available */ + [UT_OSP_NO_FREE_APP_SLOTS] = "ES Startup: No free application slots available\n", + /* ES Startup: Unable to extract filename from path: ut57/ */ + [UT_OSP_EXTRACT_FILENAME_UT57] = "ES Startup: Unable to extract filename from path: %s.\n", + /* ES SharedData Mutex Give Err Stat=0x~,App=1,Func=TestAPI,Line=98765 */ + [UT_OSP_MUTEX_GIVE] = "ES SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", + /* ES Startup: Could not find symbol:EntryPoint. EC = 0x~ */ + [UT_OSP_CANNOT_FIND_SYMBOL] = "ES Startup: Could not find symbol:%s. EC = 0x%08X\n", + /* ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x~ */ + [UT_OSP_INIT_VOLATILE] = "ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n", + /* ES:Application Init Failed,RC=0x~ */ + [UT_OSP_APP_INIT] = "ES:Application Init Failed,RC=0x%08X\n", + /* POWER ON RESET due to max proc resets (Commanded). */ + [UT_OSP_POR_MAX_PROC_RESETS] = "POWER ON RESET due to max proc resets (Commanded).\n", + /* CFE_ES_RestartApp: Cannot Restart Application appName, It is not running. */ + [UT_OSP_CANNOT_RESTART_APP] = "CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n", + /* ES Startup: Insufficent Free Space on Volatile Disk, Reformatting. */ + [UT_OSP_INSUFF_FREE_SPACE] = "ES Startup: Insufficent Free Space on Volatile Disk, Reformatting.\n", + /* ES Startup: Could not load cFE Shared Library */ + [UT_OSP_LOAD_SHARED_LIBRARY] = "ES Startup: Could not load cFE Shared Library\n", + /* POWER ON RESET due to HW Special Cmd (Hw Spec Cmd). */ + [UT_OSP_POR_HW_SPECIAL] = "POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n", + /* ES Startup: AppCreate Error: TaskCreate AppName Failed. EC = 0x~! */ + [UT_OSP_APP_CREATE] = "ES Startup: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", + /* ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x~ */ + [UT_OSP_CREATE_VOLATILE] = "ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", + /* ES Startup: Failed to unload APP: AppName. EC = 0x~ */ + [UT_OSP_MODULE_UNLOAD_FAILED] = "ES Startup: Failed to unload: %s. EC = 0x%08X\n", + /* POWERON RESET called from CFE_ES_ResetCFE (Commanded). */ + [UT_OSP_POR_COMMANDED] = "POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n", + /* ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x~ */ + [UT_OSP_REMOUNT_VOLATILE] = "ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + /* CFE_ES_ExitApp, Cannot Exit CORE Application CFE_ES */ + [UT_OSP_CORE_APP_EXIT] = "CFE_ES_ExitApp, Cannot Exit CORE Application %s\n", + /* ES Startup: Opened ES App Startup file: */ + [UT_OSP_ES_APP_STARTUP_OPEN] = "ES Startup: Opened ES App Startup file: %s\n", + /* CFE_ES_ExitApp: CORE Application CFE_ES Had an Init Error. */ + [UT_OSP_CORE_INIT] = "CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n", + /* PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd). */ + [UT_OSP_PROC_RESET_MAX_HW_SPECIAL] = "PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n", + /* ES:Error reading cmd pipe,RC=0x~ */ + [UT_OSP_COMMAND_PIPE] = "ES:Error reading cmd pipe,RC=0x%08X\n", + /* ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x~ */ + [UT_OSP_UNMOUNT_VOLATILE] = "ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + /* ES Startup: Error: ES_TaskTable slot in use at task creation! */ + [UT_OSP_TABLE_SLOT_IN_USE] = "ES Startup: Error: ES_TaskTable slot in use at task creation!\n", + /* ES Startup: Error, Can't Open ES App Startup file: */ + [UT_OSP_CANNOT_OPEN_ES_APP_STARTUP] = "ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", + /* ES Startup: Unable to extract filename from path: /cf/apps/tst_lib.bundle.gz. */ + [UT_OSP_EXTRACT_FILENAME_CF] = "ES Startup: Unable to extract filename from path: %s.\n", + /* Warning: Invalid System Log mode, log entry discarded. */ + [UT_OSP_INVALID_LOG_MODE] = "Warning: Invalid System Log mode, log entry discarded.\n", + /* ES Startup: Library path plus file name length (~) exceeds max allowed (~) */ + [UT_OSP_LIB_PATH_FILE_TOO_LONG] = "ES Startup: Library path plus file name length (%d) exceeds max allowed (%d)\n", + /* ES Startup: Unable to decompress Application File: ut/filename.gz */ + [UT_OSP_DECOMPRESS_APP] = "ES Startup: Unable to decompress Application File: %s\n", + /* ES Startup: Unable to decompress library file: /cf/apps/tst_lib.bundle.gz */ + [UT_OSP_DECOMPRESS_LIBRARY] = "ES Startup: Unable to decompress library file: %s\n", + /* CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = ~, RC = 0x~ */ + [UT_OSP_GET_APP_ID] = "CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = %d, RC = 0x%08X\n", + /* ES Startup: Error, No free application slots available for CORE App! */ + [UT_OSP_NO_FREE_CORE_APP_SLOTS] = "ES Startup: Error, No free application slots available for CORE App!\n", + /* ES Startup: CFE_ES_Global.TaskTable record used error for App: CFE_EVS, continuing. */ + [UT_OSP_RECORD_USED] = "ES Startup: Error: ES_TaskTable slot for ID %lx in use at task creation!\n", + /* CFE_ES_ExitChildTask called from invalid task context */ + [UT_OSP_TASKEXIT_BAD_CONTEXT] = "CFE_ES_ExitChildTask called from invalid task context\n", + [UT_OSP_BACKGROUND_REGISTER] = "CFE_ES: Background Task Failed to register: %08lx\n", + [UT_OSP_BACKGROUND_TAKE] = "CFE_ES: Failed to take background sem: %08lx\n", }; - diff --git a/modules/core_private/ut-stubs/src/ut_support.c b/modules/core_private/ut-stubs/src/ut_support.c index 79d123557..9a9cb062a 100644 --- a/modules/core_private/ut-stubs/src/ut_support.c +++ b/modules/core_private/ut-stubs/src/ut_support.c @@ -39,19 +39,19 @@ /* ** Global variables */ -uint8 UT_Endianess; +uint8 UT_Endianess; -static char UT_appname[80]; -static char UT_subsys[5]; -static CFE_ES_AppId_t UT_AppID; -static uint32 UT_LastCDSSize = 0; +static char UT_appname[80]; +static char UT_subsys[5]; +static CFE_ES_AppId_t UT_AppID; +static uint32 UT_LastCDSSize = 0; typedef union { long long int AlignLong; - long double AlignDbl; - void *AlignPtr; - char Content[128 * 1024]; + long double AlignDbl; + void * AlignPtr; + char Content[128 * 1024]; } UT_Buffer_t; static UT_Buffer_t UT_CFE_ES_MemoryPool; @@ -60,14 +60,13 @@ static UT_Buffer_t UT_SyslogBuffer; static UT_Buffer_t UT_PrintfBuffer; static union { - UT_Buffer_t Buff; + UT_Buffer_t Buff; CFE_ES_ResetData_t ResetData; } UT_CFE_ES_ResetData; -static uint16 UT_SendEventHistory[UT_EVENT_HISTORY_SIZE]; -static uint16 UT_SendTimedEventHistory[UT_EVENT_HISTORY_SIZE]; -static uint16 UT_SendEventAppIDHistory[UT_EVENT_HISTORY_SIZE * 10]; - +static uint16 UT_SendEventHistory[UT_EVENT_HISTORY_SIZE]; +static uint16 UT_SendTimedEventHistory[UT_EVENT_HISTORY_SIZE]; +static uint16 UT_SendEventAppIDHistory[UT_EVENT_HISTORY_SIZE * 10]; extern int32 dummy_function(void); @@ -82,8 +81,8 @@ void UT_Init(const char *subsys) int8 i; /* Copy the application name for later use */ - strncpy(UT_subsys, subsys, sizeof(UT_subsys)-1); - UT_subsys[sizeof(UT_subsys)-1] = 0; + strncpy(UT_subsys, subsys, sizeof(UT_subsys) - 1); + UT_subsys[sizeof(UT_subsys) - 1] = 0; snprintf(UT_appname, 80, "ut_cfe_%s", subsys); /* Convert to upper case */ @@ -108,7 +107,7 @@ void UT_Init(const char *subsys) */ int32 EndianCheck = 0x01020304; - if ((*(char *) &EndianCheck) == 0x04) + if ((*(char *)&EndianCheck) == 0x04) { UT_Endianess = UT_LITTLE_ENDIAN; } @@ -116,7 +115,6 @@ void UT_Init(const char *subsys) { UT_Endianess = UT_BIG_ENDIAN; } - } /* @@ -139,7 +137,6 @@ void UT_InitData(void) UT_PrintfBuffer.AlignLong = 0; UT_SetDataBuffer(UT_KEY(OS_printf), &UT_PrintfBuffer, sizeof(UT_PrintfBuffer), false); - /* * Set up the CFE_ES reset area */ @@ -165,7 +162,7 @@ void UT_InitData(void) * Set up CFE_ES_GetAppName() and friends * This should return the UT_appname */ - UT_SetDataBuffer(UT_KEY(CFE_ES_GetAppName), (uint8*)UT_appname, sizeof(UT_appname), false); + UT_SetDataBuffer(UT_KEY(CFE_ES_GetAppName), (uint8 *)UT_appname, sizeof(UT_appname), false); /* * Reset the OSAL stubs to the default state @@ -174,7 +171,6 @@ void UT_InitData(void) UT_ClearEventHistory(); UT_ResetPoolBufferIndex(); - } void UT_ResetCDS(void) @@ -198,11 +194,9 @@ void UT_ResetPoolBufferIndex(void) /* ** Output single test's pass/fail status */ -void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, - const char *info) +void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, const char *info) { - UtAssertEx(test, UtAssert_GetContext(), file, line, "%s - %s", fun_name, - info); + UtAssertEx(test, UtAssert_GetContext(), file, line, "%s - %s", fun_name, info); } /* @@ -212,7 +206,7 @@ void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, ** then invokes the pipe function. */ void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t *MsgPtr, size_t MsgSize, - UT_TaskPipeDispatchId_t DispatchId) + UT_TaskPipeDispatchId_t DispatchId) { union { @@ -244,7 +238,7 @@ void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { UT_SoftwareBusSnapshot_Entry_t *Snapshot = UserObj; - const CFE_MSG_Message_t *MsgPtr; + const CFE_MSG_Message_t * MsgPtr; if (Context->ArgCount > 0) { @@ -260,8 +254,7 @@ int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCo ++Snapshot->Count; if (Snapshot->SnapshotSize > 0 && Snapshot->SnapshotBuffer != NULL) { - memcpy(Snapshot->SnapshotBuffer, &MsgPtr->Byte[Snapshot->SnapshotOffset], - Snapshot->SnapshotSize); + memcpy(Snapshot->SnapshotBuffer, &MsgPtr->Byte[Snapshot->SnapshotOffset], Snapshot->SnapshotSize); } } @@ -274,7 +267,7 @@ int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCo void UT_SetAppID(CFE_ES_AppId_t AppID_in) { UT_AppID = AppID_in; - UT_SetDataBuffer(UT_KEY(CFE_ES_GetAppID), (uint8*)&UT_AppID, sizeof(UT_AppID), false); + UT_SetDataBuffer(UT_KEY(CFE_ES_GetAppID), (uint8 *)&UT_AppID, sizeof(UT_AppID), false); } /* @@ -283,7 +276,7 @@ void UT_SetAppID(CFE_ES_AppId_t AppID_in) */ void UT_SetStatusBSPResetArea(int32 status, uint32 Signature, uint32 ClockSignal) { - UT_CFE_ES_ResetData.ResetData.TimeResetVars.Signature = Signature; + UT_CFE_ES_ResetData.ResetData.TimeResetVars.Signature = Signature; UT_CFE_ES_ResetData.ResetData.TimeResetVars.ClockSignal = ClockSignal; if (status != 0) { @@ -339,7 +332,7 @@ void UT_SetSizeofESResetArea(int32 Size) /* ** Set the CDS size returned by the BSP */ -uint8* UT_SetCDSSize(int32 Size) +uint8 *UT_SetCDSSize(int32 Size) { UT_ResetState(UT_KEY(CFE_PSP_GetCDSSize)); UT_ResetState(UT_KEY(CFE_PSP_ReadFromCDS)); @@ -359,7 +352,7 @@ uint8* UT_SetCDSSize(int32 Size) UT_SetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), &UT_CDS_Data, Size, false); UT_SetDataBuffer(UT_KEY(CFE_PSP_WriteToCDS), &UT_CDS_Data, Size, false); UT_LastCDSSize = Size; - return (uint8*)UT_CDS_Data.Content; + return (uint8 *)UT_CDS_Data.Content; } /* @@ -381,17 +374,18 @@ void UT_ClearEventHistory(void) UT_ResetState(UT_KEY(CFE_EVS_SendTimedEvent)); UT_SetDataBuffer(UT_KEY(CFE_EVS_SendEvent), UT_SendEventHistory, sizeof(UT_SendEventHistory), false); UT_SetDataBuffer(UT_KEY(CFE_EVS_SendTimedEvent), UT_SendTimedEventHistory, sizeof(UT_SendTimedEventHistory), false); - UT_SetDataBuffer(UT_KEY(CFE_EVS_SendEventWithAppID), UT_SendEventAppIDHistory, sizeof(UT_SendEventAppIDHistory), false); + UT_SetDataBuffer(UT_KEY(CFE_EVS_SendEventWithAppID), UT_SendEventAppIDHistory, sizeof(UT_SendEventAppIDHistory), + false); } static bool UT_CheckEventHistoryFromFunc(UT_EntryKey_t Func, uint16 EventIDToSearchFor) { - bool Result = false; - size_t Position; - size_t MaxSize; + bool Result = false; + size_t Position; + size_t MaxSize; uint16 *EvBuf; - UT_GetDataBuffer(Func, (void**)&EvBuf, &MaxSize, &Position); + UT_GetDataBuffer(Func, (void **)&EvBuf, &MaxSize, &Position); if (EvBuf != NULL && MaxSize > 0) { Position /= sizeof(*EvBuf); @@ -410,15 +404,14 @@ static bool UT_CheckEventHistoryFromFunc(UT_EntryKey_t Func, uint16 EventIDToSea return Result; } - /* ** Search the event history for a specified event ID */ bool UT_EventIsInHistory(uint16 EventIDToSearchFor) { - return (UT_CheckEventHistoryFromFunc(UT_KEY(CFE_EVS_SendEvent),EventIDToSearchFor) || - UT_CheckEventHistoryFromFunc(UT_KEY(CFE_EVS_SendEventWithAppID),EventIDToSearchFor) || - UT_CheckEventHistoryFromFunc(UT_KEY(CFE_EVS_SendTimedEvent),EventIDToSearchFor)); + return (UT_CheckEventHistoryFromFunc(UT_KEY(CFE_EVS_SendEvent), EventIDToSearchFor) || + UT_CheckEventHistoryFromFunc(UT_KEY(CFE_EVS_SendEventWithAppID), EventIDToSearchFor) || + UT_CheckEventHistoryFromFunc(UT_KEY(CFE_EVS_SendTimedEvent), EventIDToSearchFor)); } /* @@ -429,7 +422,7 @@ uint16 UT_GetNumEventsSent(void) uint16 Total = 0; size_t Position; size_t MaxSize; - void *EvBuf; + void * EvBuf; UT_GetDataBuffer(UT_KEY(CFE_EVS_SendEvent), &EvBuf, &MaxSize, &Position); Total += Position / sizeof(uint16); @@ -449,8 +442,8 @@ void UT_DisplayPkt(CFE_MSG_Message_t *MsgPtr, size_t size) uint8 *BytePtr = MsgPtr->Byte; size_t i; size_t BufSize = UT_MAX_MESSAGE_LENGTH; - char DisplayMsg[UT_MAX_MESSAGE_LENGTH]; - char *msgPtr = DisplayMsg; + char DisplayMsg[UT_MAX_MESSAGE_LENGTH]; + char * msgPtr = DisplayMsg; DisplayMsg[0] = '\0'; @@ -465,7 +458,6 @@ void UT_DisplayPkt(CFE_MSG_Message_t *MsgPtr, size_t size) UtPrintf("%s", DisplayMsg); } - CFE_ES_ResetData_t *UT_GetResetDataPtr(void) { return &UT_CFE_ES_ResetData.ResetData; @@ -499,15 +491,15 @@ static int UT_StrCmpFormatStr(const char *FormatStr, const char *TestStr, uint32 const char *ChunkStart; const char *ChunkEnd; const char *TestStart; - int WildCard; - int MatchGood; - size_t ChunkLen; + int WildCard; + int MatchGood; + size_t ChunkLen; /* Step through each character in both strings */ ChunkStart = FormatStr; - TestStart = TestStr; - WildCard = 1; - MatchGood = 1; + TestStart = TestStr; + WildCard = 1; + MatchGood = 1; while (FormatLength > 0) { if (*ChunkStart == '%') @@ -517,8 +509,7 @@ static int UT_StrCmpFormatStr(const char *FormatStr, const char *TestStr, uint32 { --FormatLength; ++ChunkStart; - } - while (FormatLength > 0 && strchr("%cdfFgGiuspxX ",*ChunkStart) == NULL); + } while (FormatLength > 0 && strchr("%cdfFgGiuspxX ", *ChunkStart) == NULL); if (FormatLength == 0) { @@ -550,7 +541,7 @@ static int UT_StrCmpFormatStr(const char *FormatStr, const char *TestStr, uint32 { /* Matchable content - Find the NEXT conversion specifier in the format string */ MatchGood = 0; - ChunkEnd = memchr(ChunkStart, '%', FormatLength); + ChunkEnd = memchr(ChunkStart, '%', FormatLength); if (ChunkEnd != NULL) { ChunkLen = ChunkEnd - ChunkStart; @@ -601,19 +592,19 @@ static int UT_StrCmpExact(const char *RefStr, const char *TestStr, uint32 RefLen } static uint32 UT_GetMessageCount(const char *Msg, UT_Buffer_t *Buf, - int (*Comparator)(const char *, const char *, uint32, uint32)) + int (*Comparator)(const char *, const char *, uint32, uint32)) { - uint32 Count = 0; + uint32 Count = 0; uint32 MsgLen = strlen(Msg); - char *Start = Buf->Content; - char *End; + char * Start = Buf->Content; + char * End; - while (MsgLen > 0 && Msg[MsgLen-1] == '\n') + while (MsgLen > 0 && Msg[MsgLen - 1] == '\n') { --MsgLen; } - while(1) + while (1) { End = strchr(Start, '\n'); if (End == NULL) @@ -652,9 +643,10 @@ uint32 UT_PrintfIsInHistory(const char *MsgToSearchFor) return UT_GetMessageCount(MsgToSearchFor, &UT_PrintfBuffer, UT_StrCmpFormatStr); } -void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(void), const char *GroupName, const char *TestName) +void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(void), const char *GroupName, + const char *TestName) { - char CompleteTestName[128]; + char CompleteTestName[128]; const char *GroupPtr; const char *TestPtr; @@ -663,7 +655,7 @@ void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(voi * and this repetitive information just becomes clutter. */ GroupPtr = GroupName; - TestPtr = TestName; + TestPtr = TestName; while (*GroupPtr != 0 && *GroupPtr == *TestPtr) { ++GroupPtr; @@ -673,7 +665,7 @@ void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(voi /* * Only break at an underscore(_) to avoid weird effects */ - while(TestPtr > TestName && *TestPtr != '_') + while (TestPtr > TestName && *TestPtr != '_') { --TestPtr; } @@ -708,27 +700,25 @@ void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(voi void UT_SETUP_impl(const char *FileName, int LineNum, const char *TestName, const char *FnName, int32 FnRet) { UtAssertEx(FnRet == CFE_SUCCESS, UTASSERT_CASETYPE_TSF, FileName, LineNum, "%s - Setup - %s returned 0x%lx", - TestName, FnName, (long int)FnRet); + TestName, FnName, (long int)FnRet); } void UT_ASSERT_impl(const char *FileName, int LineNum, const char *TestName, const char *FnName, int32 FnRet) { - UtAssertEx(FnRet == CFE_SUCCESS, UtAssert_GetContext(), FileName, LineNum, "%s - %s returned 0x%lx, expected CFE_SUCCESS", - TestName, FnName, (long int)FnRet); + UtAssertEx(FnRet == CFE_SUCCESS, UtAssert_GetContext(), FileName, LineNum, + "%s - %s returned 0x%lx, expected CFE_SUCCESS", TestName, FnName, (long int)FnRet); } -void UT_ASSERT_EQ_impl(const char *FileName, int LineNum, - const char *FnName, int32 FnRet, const char *ExpName, int32 Exp) +void UT_ASSERT_EQ_impl(const char *FileName, int LineNum, const char *FnName, int32 FnRet, const char *ExpName, + int32 Exp) { UtAssertEx(FnRet == Exp, UtAssert_GetContext(), FileName, LineNum, "%s - value %ld 0x%lx, expected %s[%ld 0x%lx]", - FnName, (long)FnRet, (long)FnRet, ExpName, (long)Exp, (long)Exp); + FnName, (long)FnRet, (long)FnRet, ExpName, (long)Exp, (long)Exp); } -void UT_ASSERT_TRUE_impl(const char *FileName, int LineNum, const char *TestName, - const char *ExpName, bool Exp) +void UT_ASSERT_TRUE_impl(const char *FileName, int LineNum, const char *TestName, const char *ExpName, bool Exp) { - UtAssertEx(Exp, UtAssert_GetContext(), FileName, LineNum, "%s - %s", - TestName, ExpName); + UtAssertEx(Exp, UtAssert_GetContext(), FileName, LineNum, "%s - %s", TestName, ExpName); } void UT_EVTCNT_impl(const char *FileName, int LineNum, const char *TestName, int32 CntExp) @@ -736,18 +726,17 @@ void UT_EVTCNT_impl(const char *FileName, int LineNum, const char *TestName, int int32 CntSent = UT_GetNumEventsSent(); UtAssertEx(CntSent == CntExp, UtAssert_GetContext(), FileName, LineNum, "%s - event count (sent %ld, expected %ld)", - TestName, (long int)CntSent, (long int)CntExp); + TestName, (long int)CntSent, (long int)CntExp); } void UT_EVTSENT_impl(const char *FileName, int LineNum, const char *TestName, const char *EvtName, int32 EvtId) { UtAssertEx(UT_EventIsInHistory(EvtId), UtAssert_GetContext(), FileName, LineNum, "%s - sent event %s [%ld]", - TestName, EvtName, (long int)EvtId); + TestName, EvtName, (long int)EvtId); } void UT_TEARDOWN_impl(const char *FileName, int LineNum, const char *TestName, const char *FnName, int32 FnRet) { - UtAssertEx(FnRet == CFE_SUCCESS, UTASSERT_CASETYPE_TTF, FileName, LineNum, "%s - Teardown failed (%s returned 0x%lx)", - TestName, FnName, (long int)FnRet); + UtAssertEx(FnRet == CFE_SUCCESS, UTASSERT_CASETYPE_TTF, FileName, LineNum, + "%s - Teardown failed (%s returned 0x%lx)", TestName, FnName, (long int)FnRet); } - diff --git a/modules/es/fsw/inc/cfe_es_events.h b/modules/es/fsw/inc/cfe_es_events.h index 1d2d3d93a..0266235a9 100644 --- a/modules/es/fsw/inc/cfe_es_events.h +++ b/modules/es/fsw/inc/cfe_es_events.h @@ -43,14 +43,14 @@ ** and when you're done adding, set this to the highest EID you used. It may ** be worthwhile to, on occasion, re-number the EID's to put them back in order. */ -#define CFE_ES_MAX_EID 92 +#define CFE_ES_MAX_EID 92 /* ** ES task event message ID's. */ /** \brief 'cFE ES Initialized' -** \event 'cFE ES Initialized' +** \event 'cFE ES Initialized' ** ** \par Type: INFORMATION ** @@ -59,10 +59,10 @@ ** This event message is always automatically issued when the Executive Services ** Task completes its Initialization. **/ -#define CFE_ES_INIT_INF_EID 1 /* start up message "informational" */ +#define CFE_ES_INIT_INF_EID 1 /* start up message "informational" */ /** \brief 'cFE Version \%d.\%d.\%d chksm \%d, OSAL Version \%d.\%d' -** \event 'cFE Version \%d.\%d.\%d chksm \%d, OSAL Version \%d.\%d' +** \event 'cFE Version \%d.\%d.\%d chksm \%d, OSAL Version \%d.\%d' ** ** \par Type: INFORMATION ** @@ -72,37 +72,37 @@ ** Task completes its Initialization. ** ** The \c Version field identifies the tagged version for the cFE Build, the \c chksm field -** provides the 16-bit checksum of the cFE Build and the \c OSAL \c Version field identifies +** provides the 16-bit checksum of the cFE Build and the \c OSAL \c Version field identifies ** the version of the OS Abstraction Layer on which this particular version of the cFE was built. **/ -#define CFE_ES_INITSTATS_INF_EID 2 +#define CFE_ES_INITSTATS_INF_EID 2 /** \brief 'No-op command' -** \event 'No-op command' +** \event 'No-op command' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Executive Services \link #CFE_ES_NOOP_CC NO-OP command \endlink **/ -#define CFE_ES_NOOP_INF_EID 3 /* processed command "informational" */ +#define CFE_ES_NOOP_INF_EID 3 /* processed command "informational" */ /** \brief 'Reset Counters command' -** \event 'Reset Counters command' +** \event 'Reset Counters command' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Executive Services \link #CFE_ES_RESET_COUNTERS_CC Reset Counters command \endlink **/ -#define CFE_ES_RESET_INF_EID 4 +#define CFE_ES_RESET_INF_EID 4 /** \brief 'Started \%s from \%s, AppID = \%d' -** \event 'Started \%s from \%s, AppID = \%d' +** \event 'Started \%s from \%s, AppID = \%d' ** ** \par Type: INFORMATION ** @@ -116,24 +116,24 @@ ** loaded and the \c AppId field specifies the Application ID assigned to the ** newly started Application by the cFE Executive Services. **/ -#define CFE_ES_START_INF_EID 6 +#define CFE_ES_START_INF_EID 6 /** \brief 'Stop Application \%s Initiated.' -** \event 'Stop Application \%s Initiated.' +** \event 'Stop Application \%s Initiated.' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is issued upon successful processing of the +** This event message is issued upon successful processing of the ** cFE Executive Services \link #CFE_ES_STOP_APP_CC Stop Application command \endlink -** Note that when this event is displayed, the Application is not deleted. ES has +** Note that when this event is displayed, the Application is not deleted. ES has ** accepted the request to delete the application, and it will be deleted after the app exits -** it's main loop, or times out. +** it's main loop, or times out. ** ** The \c 's' field identifies the name of the Application that will be stopped. **/ -#define CFE_ES_STOP_DBG_EID 7 +#define CFE_ES_STOP_DBG_EID 7 /** \brief 'Stop Application \%s Completed.' ** \event 'Stop Application \%s Completed.' @@ -148,24 +148,24 @@ ** ** The \c 's' field identifies the name of the Application that was stopped. */ -#define CFE_ES_STOP_INF_EID 8 +#define CFE_ES_STOP_INF_EID 8 /** \brief 'Restart Application \%s Initiated.' -** \event 'Restart Application \%s Initiated.' +** \event 'Restart Application \%s Initiated.' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is issued upon successful processing of the +** This event message is issued upon successful processing of the ** cFE Executive Services \link #CFE_ES_RESTART_APP_CC Restart Application command \endlink -** Note that when this event is displayed, the Application is not restarted. ES has +** Note that when this event is displayed, the Application is not restarted. ES has ** accepted the request to restart the application, and it will be restarted after the app exits -** it's main loop, or times out. +** it's main loop, or times out. ** ** The \c 's' field identifies the name of the Application that will be restarted. **/ -#define CFE_ES_RESTART_APP_DBG_EID 9 +#define CFE_ES_RESTART_APP_DBG_EID 9 /** \brief 'Restart Application \%s Completed, AppID=%lu' ** \event 'Restart Application \%s Completed, AppID=%lu' @@ -181,11 +181,10 @@ ** The \c 's' field identifies the name of the Application that was restarted, and ** the %lu field identifies the new Application ID */ -#define CFE_ES_RESTART_APP_INF_EID 10 - +#define CFE_ES_RESTART_APP_INF_EID 10 /** \brief 'Reload Application \%s Initiated.' -** \event 'Reload Application \%s Initiated.' +** \event 'Reload Application \%s Initiated.' ** ** \par Type: DEBUG ** @@ -193,16 +192,15 @@ ** ** This event message is issued upon successful processing of the ** cFE Executive Services \link #CFE_ES_RELOAD_APP_CC Reload Application command \endlink -** Note that when this event is displayed, the Application is not reloaded. ES has +** Note that when this event is displayed, the Application is not reloaded. ES has ** accepted the request to reload the application, and it will be reloaded after the app exits -** it's main loop, or times out. +** it's main loop, or times out. ** ** ** The \c 's' field identifies the name of the Application that will be reloaded. **/ #define CFE_ES_RELOAD_APP_DBG_EID 11 - /** \brief 'Reload Application \%s Completed, AppID=%lu' ** \event 'Reload Application \%s Completed, AppID=%lu' ** @@ -217,7 +215,7 @@ ** The \c 's' field identifies the name of the Application that was reloaded, and ** the %lu field identifies the new Application ID */ -#define CFE_ES_RELOAD_APP_INF_EID 12 +#define CFE_ES_RELOAD_APP_INF_EID 12 /** \brief 'Exit Application \%s Completed.' ** \event 'Exit Application \%s Completed.' @@ -226,7 +224,7 @@ ** ** \par Cause: ** -** This event message is issued when the cFE finishes exiting/cleaning up an +** This event message is issued when the cFE finishes exiting/cleaning up an ** application that called the CFE_ES_ExitApp API with the CFE_ES_RunStatus_APP_EXIT parameter. ** When an App calls this API, the request is recorded and the Executive Services App will ** actually delete cFE Application before issuing this event message. @@ -242,10 +240,10 @@ ** ** \par Cause: ** -** This event message is issued when the cFE finishes exiting/cleaning up an -** application that called the CFE_ES_ExitApp API with an ERROR condition. +** This event message is issued when the cFE finishes exiting/cleaning up an +** application that called the CFE_ES_ExitApp API with an ERROR condition. ** When an App calls this API, with the CFE_ES_RunStatus_APP_ERROR parameter, it indicates -** that the Application exited due to an error condition. The details of the +** that the Application exited due to an error condition. The details of the ** error that occurred should be given by the Application through an event message, ** System Log entry, or both. ** The request is recorded and the Executive Services App will actually delete @@ -255,24 +253,23 @@ */ #define CFE_ES_ERREXIT_APP_INF_EID 14 - /** \brief 'Sent \%s application data' -** \event 'Sent \%s application data' +** \event 'Sent \%s application data' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is issued upon successful completion of the +** This event message is issued upon successful completion of the ** cFE Executive Services \link #CFE_ES_QUERY_ONE_CC Query One Application command \endlink ** ** The \c 's' field identifies the name of the Application whose Executive Services ** Application information has been telemetered. **/ -#define CFE_ES_ONE_APP_EID 15 +#define CFE_ES_ONE_APP_EID 15 /** \brief 'App Info file written to \%s, Entries=\%d, FileSize=\%d' -** \event 'App Info file written to \%s, Entries=\%d, FileSize=\%d' +** \event 'App Info file written to \%s, Entries=\%d, FileSize=\%d' ** ** \par Type: DEBUG ** @@ -286,10 +283,10 @@ ** whose data was written and the \c FileSize field gives the total number of bytes written to the ** file. **/ -#define CFE_ES_ALL_APPS_EID 16 +#define CFE_ES_ALL_APPS_EID 16 /** \brief 'Cleared Executive Services log data' -** \event 'Cleared Executive Services log data' +** \event 'Cleared Executive Services log data' ** ** \par Type: INFORMATION ** @@ -298,10 +295,10 @@ ** This event message is generated upon successful completion of the cFE Executive ** Services \link #CFE_ES_CLEAR_SYSLOG_CC Clear System Log command \endlink **/ -#define CFE_ES_SYSLOG1_INF_EID 17 +#define CFE_ES_SYSLOG1_INF_EID 17 /** \brief '\%s written:Size=\%d,Entries=\%d' -** \event '\%s written:Size=\%d,Entries=\%d' +** \event '\%s written:Size=\%d,Entries=\%d' ** ** \par Type: DEBUG ** @@ -315,10 +312,10 @@ ** the number of bytes written to the file and the \c Entries field identifies the number of System Log ** messages that were written. **/ -#define CFE_ES_SYSLOG2_EID 18 +#define CFE_ES_SYSLOG2_EID 18 /** \brief 'Cleared mode log data' -** \event 'Cleared mode log data' +** \event 'Cleared mode log data' ** ** \par Type: INFORMATION ** @@ -327,10 +324,10 @@ ** This event message is generated upon successful completion of the cFE Executive ** Services \link #CFE_ES_CLEAR_ER_LOG_CC Clear Exception Reset Log command \endlink **/ -#define CFE_ES_ERLOG1_INF_EID 19 +#define CFE_ES_ERLOG1_INF_EID 19 /** \brief '\%s written:Size=\%d' -** \event '\%s written:Size=\%d' +** \event '\%s written:Size=\%d' ** ** \par Type: DEBUG ** @@ -343,10 +340,10 @@ ** The \c 's' field identifies the name of the file written to and the \c Size field specifies, in decimal, ** the number of bytes written to the file. **/ -#define CFE_ES_ERLOG2_EID 20 +#define CFE_ES_ERLOG2_EID 20 /** \brief 'Invalid command pipe message ID: 0x\%X' -** \event 'Invalid command pipe message ID: 0x\%X' +** \event 'Invalid command pipe message ID: 0x\%X' ** ** \par Type: ERROR ** @@ -357,15 +354,15 @@ ** Message ID that is neither #CFE_ES_SEND_HK_MID or #CFE_ES_CMD_MID. ** Most likely, the cFE Software Bus routing table has become corrupt ** and is sending messages targeted for other Applications to the cFE -** Executive Services Application. +** Executive Services Application. ** ** The \c ID field in the event message identifies ** the message ID (in hex) that was found in the message. **/ -#define CFE_ES_MID_ERR_EID 21 /* invalid command packet "error" */ +#define CFE_ES_MID_ERR_EID 21 /* invalid command packet "error" */ /** \brief 'Invalid ground command code: ID = 0x\%X, CC = \%d' -** \event 'Invalid ground command code: ID = 0x\%X, CC = \%d' +** \event 'Invalid ground command code: ID = 0x\%X, CC = \%d' ** ** \par Type: ERROR ** @@ -380,13 +377,13 @@ ** -# The Command Code field in the Message became corrupted. ** -# The command database at the ground station has been corrupted. ** -** The \c ID field in the event message specifies the Message ID (in hex) and the -** \c CC field specifies the Command Code (in decimal) found in the message. +** The \c ID field in the event message specifies the Message ID (in hex) and the +** \c CC field specifies the Command Code (in decimal) found in the message. **/ -#define CFE_ES_CC1_ERR_EID 22 +#define CFE_ES_CC1_ERR_EID 22 /** \brief 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' -** \event 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' +** \event 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' ** ** \par Type: ERROR ** @@ -399,12 +396,12 @@ ** The \c ID field in the event message specifies the Message ID (in hex), the \c CC field ** specifies the Command Code (in decimal), the \c Exp Len field specified the Expected ** Length (in decimal ), and \c Len specifies the message Length (in decimal) -** found in the message. +** found in the message. **/ -#define CFE_ES_LEN_ERR_EID 23 +#define CFE_ES_LEN_ERR_EID 23 /** \brief 'Invalid cFE restart type \%d' -** \event 'Invalid cFE restart type \%d' +** \event 'Invalid cFE restart type \%d' ** ** \par Type: ERROR ** @@ -418,7 +415,7 @@ ** The 'd' field identifies the numeric, in decimal, of the restart type found ** in the received cFE Restart Command Packet. **/ -#define CFE_ES_BOOT_ERR_EID 24 /* command specific "error" */ +#define CFE_ES_BOOT_ERR_EID 24 /* command specific "error" */ /** \brief 'Failed to start \%s from \%s, RC = \%08X' ** \event 'Failed to start \%s from \%s, RC = \%08X' @@ -433,14 +430,14 @@ ** This message is a general failure when the command passes the parameter validation, but ** fails when a call to CFE_ES_AppCreate is called. ** -** The \c 's' term identifies the name of the Application that was attempted to start. +** The \c 's' term identifies the name of the Application that was attempted to start. ** The second \c 's' field specifies the file from which the Application was loaded. ** The \c 'X' field is the return code returned by the CFE_ES_AppCreate. **/ -#define CFE_ES_START_ERR_EID 26 +#define CFE_ES_START_ERR_EID 26 /** \brief 'CFE_ES_StartAppCmd: invalid filename: \%s' -** \event 'CFE_ES_StartAppCmd: invalid filename: \%s' +** \event 'CFE_ES_StartAppCmd: invalid filename: \%s' ** ** \par Type: ERROR ** @@ -454,10 +451,10 @@ ** ** The \c 's' term identifies the invalid filename that was sent with the command. **/ -#define CFE_ES_START_INVALID_FILENAME_ERR_EID 27 +#define CFE_ES_START_INVALID_FILENAME_ERR_EID 27 /** \brief 'CFE_ES_StartAppCmd: App Entry Point is NULL.' -** \event 'CFE_ES_StartAppCmd: App Entry Point is NULL.' +** \event 'CFE_ES_StartAppCmd: App Entry Point is NULL.' ** ** \par Type: ERROR ** @@ -467,11 +464,11 @@ ** to an Executive Services \link #CFE_ES_START_APP_CC Start Application Command \endlink. ** ** This message reports a command failure when the Start Appplication Command is given -** a NULL Application Entry Point parameter. The command must contain an application entry +** a NULL Application Entry Point parameter. The command must contain an application entry ** point string. ( Example: "SC_AppMain" ). ** **/ -#define CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID 28 +#define CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID 28 /** \brief 'CFE_ES_StartAppCmd: App Name is NULL.' ** \event 'CFE_ES_StartAppCmd: App Name is NULL.' @@ -486,7 +483,7 @@ ** This message reports a command failure when the Start Appplication Command is given ** a NULL Application Name parameter. The command must contain an application name string. **/ -#define CFE_ES_START_NULL_APP_NAME_ERR_EID 29 +#define CFE_ES_START_NULL_APP_NAME_ERR_EID 29 /** \brief 'CFE_ES_StartAppCmd: Priority is too large: \%d.' ** \event 'CFE_ES_StartAppCmd: Priority is too large: \%d.' @@ -498,12 +495,12 @@ ** This event message is generated for an error encountered in response ** to an Executive Services \link #CFE_ES_START_APP_CC Start Application Command \endlink. ** -** This message reports a command failure when the Application priority greater than the -** maximum priority for a Task defined by the OS Abstraction Layer ( 256 ). +** This message reports a command failure when the Application priority greater than the +** maximum priority for a Task defined by the OS Abstraction Layer ( 256 ). ** -** The \c 'd' term identifies the priority that was given in the command. +** The \c 'd' term identifies the priority that was given in the command. **/ -#define CFE_ES_START_PRIORITY_ERR_EID 31 +#define CFE_ES_START_PRIORITY_ERR_EID 31 /** \brief 'CFE_ES_StartAppCmd: Invalid Exception Action: \%d.' ** \event 'CFE_ES_StartAppCmd: Invalid Exception Action: \%d.' @@ -518,21 +515,21 @@ ** This message reports a command failure when the Application Exception Action parameter is ** invalid. The valid options for this parameter are: 0 = Application will restart on an exception ** 1 = Application cause a processor restart on -** exception. +** exception. ** -** The \c 'd' term identifies the Exception Action parameter that was given in the command. +** The \c 'd' term identifies the Exception Action parameter that was given in the command. **/ -#define CFE_ES_START_EXC_ACTION_ERR_EID 32 +#define CFE_ES_START_EXC_ACTION_ERR_EID 32 /** \brief 'Exit Application \%s on Error Failed: CleanUpApp Error 0x\%08X.' -** \event 'Exit Application \%s on Error Failed: CleanUpApp Error 0x\%08X.' +** \event 'Exit Application \%s on Error Failed: CleanUpApp Error 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when ES is completing the processing of the -** CFE_ES_ExitApp API call with the CFE_ES_RunStatus_APP_ERROR parameter and the call to CFE_ES_CleanUpApp fails. +** This event message is generated when ES is completing the processing of the +** CFE_ES_ExitApp API call with the CFE_ES_RunStatus_APP_ERROR parameter and the call to CFE_ES_CleanUpApp fails. ** At this point the Application will likely be stopped or deleted, but it may be in an unknown state. ** ** The \c 's' field identifies the name of the Application which was attempted to be @@ -542,64 +539,63 @@ #define CFE_ES_ERREXIT_APP_ERR_EID 33 /** \brief 'Stop Application \%s Failed, RC = 0x\%08X' -** \event 'Stop Application \%s Failed, RC = 0x\%08X' +** \event 'Stop Application \%s Failed, RC = 0x\%08X' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_STOP_APP_CC Stop Application Command \endlink which fails. ** ** The \c 's' field identifies the name of the Application which was attempted to be ** stopped and the \c rc field identifies the error code, in hex, that may identify ** the precise reason for the failure. **/ -#define CFE_ES_STOP_ERR1_EID 35 +#define CFE_ES_STOP_ERR1_EID 35 /** \brief 'Stop Application \%s, GetAppIDByName failed. RC = 0x\%08X.' -** \event 'Stop Application \%s, GetAppIDByName failed. RC = 0x\%08X.' +** \event 'Stop Application \%s, GetAppIDByName failed. RC = 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_STOP_APP_CC Stop Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_GetAppIDByName fails. The application -** will not be deleted at this point. +** will not be deleted at this point. ** ** The \c 's' field identifies the name of the Application which was attempted to be ** stopped and the \c RC field identifies the error code, in hex, that will identify ** the precise reason for the failure. **/ -#define CFE_ES_STOP_ERR2_EID 36 +#define CFE_ES_STOP_ERR2_EID 36 /* ** "Stop Application \%s Failed: CleanUpApp Error 0x\%08X." */ /** \brief 'Stop Application \%s Failed: CleanUpApp Error 0x\%08X.' -** \event 'Stop Application \%s Failed: CleanUpApp Error 0x\%08X.' +** \event 'Stop Application \%s Failed: CleanUpApp Error 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_STOP_APP_CC Stop Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_GetAppIDByName fails. The application -** will not be deleted at this point. +** will not be deleted at this point. ** ** The \c 's' field identifies the name of the Application which was attempted to be ** stopped and the \c RC field identifies the error code, in hex, that will identify ** the precise reason for the failure. **/ -#define CFE_ES_STOP_ERR3_EID 37 - +#define CFE_ES_STOP_ERR3_EID 37 /** \brief 'Restart Application \%s Failed, RC = 0x\%08X' -** \event 'Restart Application \%s Failed, RC = 0x\%08X' +** \event 'Restart Application \%s Failed, RC = 0x\%08X' ** ** \par Type: ERROR ** @@ -615,54 +611,53 @@ #define CFE_ES_RESTART_APP_ERR1_EID 38 /** \brief 'Restart Application \%s, GetAppIDByName failed. RC = 0x\%08X.' -** \event 'Restart Application \%s, GetAppIDByName failed. RC = 0x\%08X.' +** \event 'Restart Application \%s, GetAppIDByName failed. RC = 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_RESTART_APP_CC Restart Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_GetAppIDByName fails. The application -** will not be restarted at this point. +** will not be restarted at this point. ** ** The \c 's' field identifies the name of the Application which was attempted to be ** restarted and the \c RC field identifies the error code, in hex, that will identify ** the precise reason for the failure. **/ -#define CFE_ES_RESTART_APP_ERR2_EID 39 +#define CFE_ES_RESTART_APP_ERR2_EID 39 /* ** "Restart Application \%s Failed: AppCreate Error 0x\%08X." */ /** \brief 'Restart Application \%s Failed: AppCreate Error 0x\%08X.' -** \event 'Restart Application \%s Failed: AppCreate Error 0x\%08X.' +** \event 'Restart Application \%s Failed: AppCreate Error 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_RESTART_APP_CC Restart Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_AppCreate fails. The application -** will not be restarted at this point. +** will not be restarted at this point. ** ** The \c 's' field identifies the name of the Application which was attempted to be ** restarted and the \c RC field identifies the error code, in hex, that will identify ** the precise reason for the failure. **/ -#define CFE_ES_RESTART_APP_ERR3_EID 40 - +#define CFE_ES_RESTART_APP_ERR3_EID 40 /** \brief 'Restart Application \%s Failed: CleanUpApp Error 0x\%08X.' -** \event 'Restart Application \%s Failed: CleanUpApp Error 0x\%08X.' +** \event 'Restart Application \%s Failed: CleanUpApp Error 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_RESTART_APP_CC Restart Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_CleanUpApp fails. The application ** will not be restarted at this point, but will likely be deleted or in an unknown state. @@ -671,11 +666,10 @@ ** restarted and the \c RC field identifies the error code, in hex, that will identify ** the precise reason for the failure. **/ -#define CFE_ES_RESTART_APP_ERR4_EID 41 - +#define CFE_ES_RESTART_APP_ERR4_EID 41 /** \brief 'Failed to reload Application \%s, rc = \%08X' -** \event 'Failed to reload Application \%s, rc = \%08X' +** \event 'Failed to reload Application \%s, rc = \%08X' ** ** \par Type: ERROR ** @@ -691,51 +685,49 @@ #define CFE_ES_RELOAD_APP_ERR1_EID 42 /** \brief 'Reload Application \%s, GetAppIDByName failed. RC = 0x\%08X.' -** \event 'Reload Application \%s, GetAppIDByName failed. RC = 0x\%08X.' +** \event 'Reload Application \%s, GetAppIDByName failed. RC = 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_RELOAD_APP_CC Reload Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_GetAppIDByName fails. The application -** will not be reloaded at this point. +** will not be reloaded at this point. ** ** The \c 's' field identifies the name of the Application which was attempted to be ** reloaded and the \c RC field identifies the error code, in hex, that will identify ** the precise reason for the failure. **/ -#define CFE_ES_RELOAD_APP_ERR2_EID 43 - +#define CFE_ES_RELOAD_APP_ERR2_EID 43 /** \brief 'Reload Application \%s Failed: AppCreate Error 0x\%08X.' -** \event 'Reload Application \%s Failed: AppCreate Error 0x\%08X.' +** \event 'Reload Application \%s Failed: AppCreate Error 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_RELOAD_APP_CC Reload Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_AppCreate fails. The application -** will not be reloaded at this point. +** will not be reloaded at this point. ** ** The \c 's' field identifies the name of the Application which was attempted to be ** reloaded and the \c RC field identifies the error code, in hex, that will identify ** the precise reason for the failure. **/ -#define CFE_ES_RELOAD_APP_ERR3_EID 44 - +#define CFE_ES_RELOAD_APP_ERR3_EID 44 /** \brief 'Reload Application \%s Failed: CleanUpApp Error 0x\%08X.' -** \event 'Reload Application \%s Failed: CleanUpApp Error 0x\%08X.' +** \event 'Reload Application \%s Failed: CleanUpApp Error 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon receipt of an Executive Services +** This event message is generated upon receipt of an Executive Services ** \link #CFE_ES_RELOAD_APP_CC Reload Application Command \endlink which fails. This message ** is for a specific failure when the call to CFE_ES_CleanUpApp fails. The application ** will not be reloaded at this point, and will likely be deleted or in an unknown state. @@ -746,15 +738,14 @@ **/ #define CFE_ES_RELOAD_APP_ERR4_EID 45 - /** \brief 'Exit Application \%s Failed: CleanUpApp Error 0x\%08X.' -** \event 'Exit Application \%s Failed: CleanUpApp Error 0x\%08X.' +** \event 'Exit Application \%s Failed: CleanUpApp Error 0x\%08X.' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when ES is completing the processing of the +** This event message is generated when ES is completing the processing of the ** CFE_ES_ExitApp API call and the call to CFE_ES_CleanUpApp fails. At this point the Application will ** likely be stopped or deleted, but it may be in an unknown state. ** @@ -764,26 +755,24 @@ **/ #define CFE_ES_EXIT_APP_ERR_EID 46 - /** \brief 'ES_ProcControlReq: Invalid State (EXCEPTION) Application \%s.' -** \event 'ES_ProcControlReq: Invalid State (EXCEPTION) Application \%s.' +** \event 'ES_ProcControlReq: Invalid State (EXCEPTION) Application \%s.' ** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is generated when ES is processing it's internal Application table and encounters -** an App with the EXCEPTION state. Because exceptions are supposed to be processed immediately, this is +** an App with the EXCEPTION state. Because exceptions are supposed to be processed immediately, this is ** an invalid state and should not happen. It may indicate some sort of memory corruption or other problem. **/ #define CFE_ES_PCR_ERR1_EID 47 - /* ** "CFE_ES_CleanUpApp: Unknown State ( \%d ) Application \%s." */ /** \brief 'ES_ProcControlReq: Unknown State ( \%d ) Application \%s.' -** \event 'ES_ProcControlReq: Unknown State ( \%d ) Application \%s.' +** \event 'ES_ProcControlReq: Unknown State ( \%d ) Application \%s.' ** ** \par Type: ERROR ** @@ -796,7 +785,7 @@ #define CFE_ES_PCR_ERR2_EID 48 /** \brief 'Failed to send \%s application data, RC = \%08X' -** \event 'Failed to send \%s application data, RC = \%08X' +** \event 'Failed to send \%s application data, RC = \%08X' ** ** \par Type: ERROR ** @@ -805,14 +794,14 @@ ** This event message is generated when an Executive Services \link #CFE_ES_QUERY_ONE_CC Request Application ** Data Command \endlink failed. ** -** The \c 's' field identifies the name of the Application whose data was attempted +** The \c 's' field identifies the name of the Application whose data was attempted ** to be telemetered and the \c rc field identifies the error code, in hex, that may identify ** the precise reason for the failure. **/ -#define CFE_ES_ONE_ERR_EID 49 +#define CFE_ES_ONE_ERR_EID 49 /** \brief 'Failed to send \%s application data: GetAppIDByName Failed, RC = 0x\%08X' -** \event 'Failed to send \%s application data: GetAppIDByName Failed, RC = 0x\%08X' +** \event 'Failed to send \%s application data: GetAppIDByName Failed, RC = 0x\%08X' ** ** \par Type: ERROR ** @@ -821,15 +810,14 @@ ** This event message is generated when an Executive Services \link #CFE_ES_QUERY_ONE_CC Request Application ** Data Command \endlink failed. ** -** The \c 's' field identifies the name of the Application whose data was attempted +** The \c 's' field identifies the name of the Application whose data was attempted ** to be telemetered and the \c rc field identifies the error code, in hex, that may identify ** the precise reason for the failure. **/ -#define CFE_ES_ONE_APPID_ERR_EID 50 - +#define CFE_ES_ONE_APPID_ERR_EID 50 /** \brief 'Failed to write App Info file, OS_OpenCreate returned \%d' -** \event 'Failed to write App Info file, OS_OpenCreate returned \%d' +** \event 'Failed to write App Info file, OS_OpenCreate returned \%d' ** ** \par Type: ERROR ** @@ -841,10 +829,10 @@ ** The \c 'd' parameter identifies, in decimal, the error code returned by #OS_OpenCreate when the attempt was made ** to create the file. **/ -#define CFE_ES_OSCREATE_ERR_EID 51 +#define CFE_ES_OSCREATE_ERR_EID 51 /** \brief 'Failed to write App Info file, WriteHdr rtnd \%08X, exp \%d' -** \event 'Failed to write App Info file, WriteHdr rtnd \%08X, exp \%d' +** \event 'Failed to write App Info file, WriteHdr rtnd \%08X, exp \%d' ** ** \par Type: ERROR ** @@ -856,11 +844,10 @@ ** The \c rtnd field contains the error code returned by the #CFE_FS_WriteHeader API. Nominally, the ** returned result should have been equal to the \c exp field (i.e. - sizeof(#CFE_FS_Header_t)). **/ -#define CFE_ES_WRHDR_ERR_EID 52 - +#define CFE_ES_WRHDR_ERR_EID 52 /** \brief 'Failed to write App Info file, Task write RC = 0x\%08X, exp \%d' -** \event 'Failed to write App Info file, Task write RC = 0x\%08X, exp \%d' +** \event 'Failed to write App Info file, Task write RC = 0x\%08X, exp \%d' ** ** \par Type: ERROR ** @@ -872,10 +859,10 @@ ** The \c rtnd field contains, in hex, the error code returned from the #OS_write API. The expected return ** value is identified, in decimal, in the \c exp field. **/ -#define CFE_ES_TASKWR_ERR_EID 53 +#define CFE_ES_TASKWR_ERR_EID 53 /** \brief 'Error creating file \%s, stat=0x\%x' -** \event 'Error creating file \%s, stat=0x\%x' +** \event 'Error creating file \%s, stat=0x\%x' ** ** \par Type: ERROR ** @@ -887,10 +874,10 @@ ** The \c 's' field identifies the name of the file that was attempted to be created and the \c stat field ** specifies, in hex, the error code returned by the #OS_OpenCreate API. **/ -#define CFE_ES_SYSLOG2_ERR_EID 55 +#define CFE_ES_SYSLOG2_ERR_EID 55 /** \brief 'Error creating file \%s, stat=0x\%x' -** \event 'Error creating file \%s, stat=0x\%x' +** \event 'Error creating file \%s, stat=0x\%x' ** ** \par Type: ERROR ** @@ -902,10 +889,10 @@ ** The \c 's' field identifies the name of the file that was attempted to be created and the \c stat field ** specifies, in hex, the error code returned by the #OS_OpenCreate API. **/ -#define CFE_ES_ERLOG2_ERR_EID 56 +#define CFE_ES_ERLOG2_ERR_EID 56 /** \brief 'Start collecting performance data command, trigger mode = %d' -** \event 'Start collecting performance data command, trigger mode = %d' +** \event 'Start collecting performance data command, trigger mode = %d' ** ** \par Type: DEBUG ** @@ -916,10 +903,10 @@ ** ** The \c 'd' field identifies the requested trigger mode as defined by CFE_ES_PerfMode_t. **/ -#define CFE_ES_PERF_STARTCMD_EID 57 +#define CFE_ES_PERF_STARTCMD_EID 57 /** \brief 'Cannot start collecting performance data,perf data write in progress' -** \event 'Cannot start collecting performance data,perf data write in progress' +** \event 'Cannot start collecting performance data,perf data write in progress' ** ** \par Type: ERROR ** @@ -928,60 +915,56 @@ ** This event message is generated in response to receiving an Executive Services ** \link #CFE_ES_START_PERF_DATA_CC Start Performance Analyzer Data Collection Command \endlink **/ -#define CFE_ES_PERF_STARTCMD_ERR_EID 58 - +#define CFE_ES_PERF_STARTCMD_ERR_EID 58 /** \brief 'Cannot start collecting performance data, trigger mode (%d) out of range (%d to %d)' -** \event 'Cannot start collecting performance data, trigger mode (%d) out of range (%d to %d)' +** \event 'Cannot start collecting performance data, trigger mode (%d) out of range (%d to %d)' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services \link #CFE_ES_START_PERF_DATA_CC +** This event message is generated when an Executive Services \link #CFE_ES_START_PERF_DATA_CC ** Start Performance Analyzer Data Collection Command \endlink command is received with a bad ** value for the requested trigger mode. ** ** The first \c 'd' field identifies the received trigger mode value as defined by CFE_ES_PerfMode_t. ** The second and third \c 'd' fields specify the valid range of values for the trigger mode. **/ -#define CFE_ES_PERF_STARTCMD_TRIG_ERR_EID 59 - +#define CFE_ES_PERF_STARTCMD_TRIG_ERR_EID 59 /** \brief 'Perf Stop Cmd Rcvd,\%s will write \%d entries.\%dmS dly every \%d entries' -** \event 'Perf Stop Cmd Rcvd,\%s will write \%d entries.\%dmS dly every \%d entries' +** \event 'Perf Stop Cmd Rcvd,\%s will write \%d entries.\%dmS dly every \%d entries' ** ** \par Type: DEBUG ** ** \par Cause: ** ** This event message is generated upon receipt of a successful Performance Data Stop -** Command after receiving the cFE Executive Services \link #CFE_ES_STOP_PERF_DATA_CC Stop +** Command after receiving the cFE Executive Services \link #CFE_ES_STOP_PERF_DATA_CC Stop ** Performance Analyzer Data Collection Command \endlink ** ** The \c 's' field identifies the name of the file write task that has begun execution. ** The first \c 'd' identifies the total number of performance entries(in decimal) that will be written to the file. ** A performance data entry is defined by an unsigned 32 bit data point and an unsigned 64 bit time stamp. -** The second \c 'd' identifies the millisecond delay between writes and the -** third \c 'd' identifies the number of entries written (in decimal) between delays. +** The second \c 'd' identifies the millisecond delay between writes and the +** third \c 'd' identifies the number of entries written (in decimal) between delays. **/ -#define CFE_ES_PERF_STOPCMD_EID 60 - +#define CFE_ES_PERF_STOPCMD_EID 60 /** \brief 'Stop performance data cmd ignored,perf data write in progress' -** \event 'Stop performance data cmd ignored,perf data write in progress' +** \event 'Stop performance data cmd ignored,perf data write in progress' ** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is generated upon receipt of an unsuccessful Performance Data Stop -** Command after receiving the cFE Executive Services \link #CFE_ES_STOP_PERF_DATA_CC Stop +** Command after receiving the cFE Executive Services \link #CFE_ES_STOP_PERF_DATA_CC Stop ** Performance Analyzer Data Collection Command \endlink ** **/ -#define CFE_ES_PERF_STOPCMD_ERR2_EID 62 - +#define CFE_ES_PERF_STOPCMD_ERR2_EID 62 /** \brief 'Set Performance Filter Mask command' ** \event 'Set Performance Filter Mask command' @@ -994,7 +977,7 @@ ** \link #CFE_ES_SET_PERF_FILTER_MASK_CC Set Performance Analyzer Filter Mask Command \endlink. ** **/ -#define CFE_ES_PERF_FILTMSKCMD_EID 63 +#define CFE_ES_PERF_FILTMSKCMD_EID 63 /** \brief 'Performance Filter Mask Cmd Error,Index(%u)out of range(%u)' ** \event 'Performance Filter Mask Cmd Error,Index(%u)out of range(%u)' @@ -1007,8 +990,7 @@ ** \link #CFE_ES_SET_PERF_FILTER_MASK_CC Set Performance Analyzer Filter Mask Command \endlink. ** **/ -#define CFE_ES_PERF_FILTMSKERR_EID 64 - +#define CFE_ES_PERF_FILTMSKERR_EID 64 /** \brief 'Set Performance Trigger Mask command' ** \event 'Set Performance Trigger Mask command' @@ -1036,43 +1018,41 @@ **/ #define CFE_ES_PERF_TRIGMSKERR_EID 66 - /** \brief 'Error creating file \%s, stat=\%d' -** \event 'Error creating file \%s, stat=\%d' +** \event 'Error creating file \%s, stat=\%d' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_STOP_PERF_DATA_CC Stop Performance Analyzer Data Collection Command \endlink ** fails to create the associated logic analyzer dump file. ** ** The \c 's' field identifies the name of the file that was attempted to be created and the \c stat field ** specifies, in decimal, the error code returned by the #OS_OpenCreate API. **/ -#define CFE_ES_PERF_LOG_ERR_EID 67 - +#define CFE_ES_PERF_LOG_ERR_EID 67 /** \brief '\%s written:Size=\%d,EntryCount=\%d' -** \event '\%s written:Size=\%d,EntryCount=\%d' +** \event '\%s written:Size=\%d,EntryCount=\%d' ** ** \par Type: DEBUG ** ** \par Cause: ** ** This event message is generated when the Performance Log has been successfully written -** to a file after receiving the cFE Executive Services \link #CFE_ES_STOP_PERF_DATA_CC Stop +** to a file after receiving the cFE Executive Services \link #CFE_ES_STOP_PERF_DATA_CC Stop ** Performance Analyzer Data Collection Command \endlink ** ** The \c 's' field identifies the name of the file written to, the \c Size field specifies, in decimal, ** the number of bytes written to the file and the \c EntryCount field identifies the number of data ** entries that were written. **/ -#define CFE_ES_PERF_DATAWRITTEN_EID 68 +#define CFE_ES_PERF_DATAWRITTEN_EID 68 /** \brief '\%s Failed to Register CDS '\%s', Status=0x\%08X' -** \event '\%s Failed to Register CDS '\%s', Status=0x\%08X' +** \event '\%s Failed to Register CDS '\%s', Status=0x\%08X' ** ** \par Type: ERROR ** @@ -1086,40 +1066,42 @@ ** provides the error code which identifies in more detail the nature of the failure (See return codes ** for the #CFE_ES_RegisterCDS API). **/ -#define CFE_ES_CDS_REGISTER_ERR_EID 69 +#define CFE_ES_CDS_REGISTER_ERR_EID 69 /** \brief 'Set OverWriteSysLog Command Received with Mode setting = \%d' -** \event 'Set OverWriteSysLog Command Received with Mode setting = \%d' +** \event 'Set OverWriteSysLog Command Received with Mode setting = \%d' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is generated upon successful completion of an Executive Services \link #CFE_ES_OVER_WRITE_SYSLOG_CC +** This event message is generated upon successful completion of an Executive Services \link +*#CFE_ES_OVER_WRITE_SYSLOG_CC ** Set System Log Overwrite Mode Command \endlink. ** ** The \c setting field identifies the newly chosen Overwrite Mode and should be equal to either ** #CFE_ES_LogMode_OVERWRITE or #CFE_ES_LogMode_DISCARD. **/ -#define CFE_ES_SYSLOGMODE_EID 70 +#define CFE_ES_SYSLOGMODE_EID 70 /** \brief 'Set OverWriteSysLog Command: Invalid Mode setting = \%d' -** \event 'Set OverWriteSysLog Command: Invalid Mode setting = \%d' +** \event 'Set OverWriteSysLog Command: Invalid Mode setting = \%d' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated upon unsuccessful completion of an Executive Services \link #CFE_ES_OVER_WRITE_SYSLOG_CC +** This event message is generated upon unsuccessful completion of an Executive Services \link +*#CFE_ES_OVER_WRITE_SYSLOG_CC ** Set System Log Overwrite Mode Command \endlink. ** ** The \c setting field identifies the illegal Overwrite Mode found in the command message. The mode ** must be either #CFE_ES_LogMode_OVERWRITE (0) or #CFE_ES_LogMode_DISCARD (1). **/ -#define CFE_ES_ERR_SYSLOGMODE_EID 71 +#define CFE_ES_ERR_SYSLOGMODE_EID 71 /** \brief 'Reset Processor Reset Count to Zero' -** \event 'Reset Processor Reset Count to Zero' +** \event 'Reset Processor Reset Count to Zero' ** ** \par Type: INFORMATION ** @@ -1128,10 +1110,10 @@ ** This event message is always generated in response to the Executive Services ** \link #CFE_ES_RESET_PR_COUNT_CC Set Processor Reset Counter to Zero Command \endlink. **/ -#define CFE_ES_RESET_PR_COUNT_EID 72 +#define CFE_ES_RESET_PR_COUNT_EID 72 /** \brief 'Maximum Processor Reset Count set to: \%d' -** \event 'Maximum Processor Reset Count set to: \%d' +** \event 'Maximum Processor Reset Count set to: \%d' ** ** \par Type: INFORMATION ** @@ -1143,10 +1125,10 @@ ** The \c 'd' field identifies, in decimal, the number of Processor Resets that will need ** to occur before a Power-On Reset is automatically performed. **/ -#define CFE_ES_SET_MAX_PR_COUNT_EID 73 +#define CFE_ES_SET_MAX_PR_COUNT_EID 73 /** \brief 'File write,byte cnt err,file \%s,request=\%d,actual=\%d' -** \event 'File write,byte cnt err,file \%s,request=\%d,actual=\%d' +** \event 'File write,byte cnt err,file \%s,request=\%d,actual=\%d' ** ** \par Type: ERROR ** @@ -1159,62 +1141,62 @@ ** the \c request field specifies, in decimal, the number of bytes that were attempted to be written and ** the \c actual field indicates, in decimal, the actual number of bytes written to the file. **/ -#define CFE_ES_FILEWRITE_ERR_EID 74 +#define CFE_ES_FILEWRITE_ERR_EID 74 /** \brief 'Error while deleting '\%s' from CDS, See SysLog.(Err=0x\%08X)' -** \event 'Error while deleting '\%s' from CDS, See SysLog.(Err=0x\%08X)' +** \event 'Error while deleting '\%s' from CDS, See SysLog.(Err=0x\%08X)' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DELETE_CDS_CC Delete CDS Command \endlink ** fails to cleanly remove the specified CDS. ** ** The \c 's' field identifies the name of the CDS that was attempted to be deleted the \c Err field ** specifies, in hex, the error code. **/ -#define CFE_ES_CDS_DELETE_ERR_EID 76 +#define CFE_ES_CDS_DELETE_ERR_EID 76 /** \brief 'Unable to locate '\%s' in CDS Registry' -** \event 'Unable to locate '\%s' in CDS Registry' +** \event 'Unable to locate '\%s' in CDS Registry' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DELETE_CDS_CC Delete CDS Command \endlink ** specifies a name for a CDS that cannot be found in the CDS Registry. ** ** The \c 's' field identifies the name of the CDS that was attempted to be deleted. **/ -#define CFE_ES_CDS_NAME_ERR_EID 77 +#define CFE_ES_CDS_NAME_ERR_EID 77 /** \brief 'Successfully removed '\%s' from CDS' -** \event 'Successfully removed '\%s' from CDS' +** \event 'Successfully removed '\%s' from CDS' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DELETE_CDS_CC Delete CDS Command \endlink ** is successfully completed. ** ** The \c 's' field identifies the name of the CDS that was deleted. **/ -#define CFE_ES_CDS_DELETED_INFO_EID 78 +#define CFE_ES_CDS_DELETED_INFO_EID 78 /** \brief 'CDS '\%s' is a Critical Table CDS. Must be deleted via TBL Command' -** \event 'CDS '\%s' is a Critical Table CDS. Must be deleted via TBL Command' +** \event 'CDS '\%s' is a Critical Table CDS. Must be deleted via TBL Command' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DELETE_CDS_CC Delete CDS Command \endlink ** specifies a name for a CDS that is a Critical Table image. ** Critical Table images can only be deleted via a Table Services @@ -1222,16 +1204,16 @@ ** ** The \c 's' field identifies the name of the CDS that was attempted to be deleted. **/ -#define CFE_ES_CDS_DELETE_TBL_ERR_EID 79 +#define CFE_ES_CDS_DELETE_TBL_ERR_EID 79 /** \brief 'CDS '\%s' not deleted because owning app is active' -** \event 'CDS '\%s' not deleted because owning app is active' +** \event 'CDS '\%s' not deleted because owning app is active' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DELETE_CDS_CC Delete CDS Command \endlink ** specifies a name for a CDS whose prefix name identifies ** an application that is still registered in the system. @@ -1240,28 +1222,28 @@ ** ** The \c 's' field identifies the name of the CDS that was attempted to be deleted. **/ -#define CFE_ES_CDS_OWNER_ACTIVE_EID 80 +#define CFE_ES_CDS_OWNER_ACTIVE_EID 80 /** \brief 'Successfully telemetered memory pool stats for 0x\%08X' -** \event 'Successfully telemetered memory pool stats for 0x\%08X' +** \event 'Successfully telemetered memory pool stats for 0x\%08X' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is generated following successful execution of the +** This event message is generated following successful execution of the ** \link #CFE_ES_SEND_MEM_POOL_STATS_CC Telemeter Memory Statistics Command \endlink. **/ -#define CFE_ES_TLM_POOL_STATS_INFO_EID 81 +#define CFE_ES_TLM_POOL_STATS_INFO_EID 81 /** \brief 'Cannot telemeter memory pool stats. Illegal Handle (0x\%08X)' -** \event 'Cannot telemeter memory pool stats. Illegal Handle (0x\%08X)' +** \event 'Cannot telemeter memory pool stats. Illegal Handle (0x\%08X)' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_SEND_MEM_POOL_STATS_CC Telemeter Memory Statistics Command \endlink ** specifies a memory pool handle that is invalid. A handle is determined to ** be invalid when any of the following are true: @@ -1273,79 +1255,78 @@ ** ** The \c '08X' field identifies the handle that was found in the command. **/ -#define CFE_ES_INVALID_POOL_HANDLE_ERR_EID 82 +#define CFE_ES_INVALID_POOL_HANDLE_ERR_EID 82 /** \brief 'Successfully dumped CDS Registry to '\%s':Size=\%d,Entries=\%d' -** \event 'Successfully dumped CDS Registry to '\%s':Size=\%d,Entries=\%d' +** \event 'Successfully dumped CDS Registry to '\%s':Size=\%d,Entries=\%d' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DUMP_CDS_REGISTRY_CC Dump Critical Data Store Registry Command \endlink ** is successfully executed. The specified file should have been created -** and contains the CDS Registry Entries. +** and contains the CDS Registry Entries. ** ** The \c 's' field identifies the CDS Registry Dump Filename. ** The first \c 'd' field specifies the size of the file (in bytes) ** The second \c 'd' field specifies the number of CDS Registry Records that were written **/ -#define CFE_ES_CDS_REG_DUMP_INF_EID 83 +#define CFE_ES_CDS_REG_DUMP_INF_EID 83 /** \brief 'Error writing CDS Registry to '\%s', Status=0x\%08X' -** \event 'Error writing CDS Registry to '\%s', Status=0x\%08X' +** \event 'Error writing CDS Registry to '\%s', Status=0x\%08X' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DUMP_CDS_REGISTRY_CC Dump Critical Data Store Registry Command \endlink ** was being performed and it encountered a filesystem write error while writing -** a CDS Registry record. +** a CDS Registry record. ** ** The \c 's' field identifies the CDS Registry Dump Filename. ** The \c '08X' field identifies the error code returned from #OS_write that caused the command to abort. **/ -#define CFE_ES_CDS_DUMP_ERR_EID 84 +#define CFE_ES_CDS_DUMP_ERR_EID 84 /** \brief 'Error writing cFE File Header to '\%s', Status=0x\%08X' -** \event 'Error writing cFE File Header to '\%s', Status=0x\%08X' +** \event 'Error writing cFE File Header to '\%s', Status=0x\%08X' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DUMP_CDS_REGISTRY_CC Dump Critical Data Store Registry Command \endlink ** command successfully created the CDS Dump File onboard but encountered an error -** while writing the standard cFE File Header to the file. +** while writing the standard cFE File Header to the file. ** ** The \c 's' field identifies the CDS Registry Dump Filename. ** The \c '08X' field identifies error code returned by the API #CFE_FS_WriteHeader. **/ -#define CFE_ES_WRITE_CFE_HDR_ERR_EID 85 +#define CFE_ES_WRITE_CFE_HDR_ERR_EID 85 /** \brief 'Error creating CDS dump file '\%s', Status=0x\%08X' -** \event 'Error creating CDS dump file '\%s', Status=0x\%08X' +** \event 'Error creating CDS dump file '\%s', Status=0x\%08X' ** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is generated when an Executive Services +** This event message is generated when an Executive Services ** \link #CFE_ES_DUMP_CDS_REGISTRY_CC Dump Critical Data Store Registry Command \endlink -** is unable to create the specified file on the onboard filesystem. +** is unable to create the specified file on the onboard filesystem. ** ** The \c 's' field identifies the CDS Registry Dump Filename. ** The \c '08X' field identifies error code returned by the API #OS_OpenCreate. **/ -#define CFE_ES_CREATING_CDS_DUMP_ERR_EID 86 - +#define CFE_ES_CREATING_CDS_DUMP_ERR_EID 86 /** \brief 'Task Info file written to \%s, Entries=\%d, FileSize=\%d' -** \event 'Task Info file written to \%s, Entries=\%d, FileSize=\%d' +** \event 'Task Info file written to \%s, Entries=\%d, FileSize=\%d' ** ** \par Type: DEBUG ** @@ -1359,11 +1340,10 @@ ** whose data was written and the \c FileSize field gives the total number of bytes written to the ** file. **/ -#define CFE_ES_TASKINFO_EID 87 - +#define CFE_ES_TASKINFO_EID 87 /** \brief 'Failed to write Task Info file, OS_OpenCreate returned \%d' -** \event 'Failed to write Task Info file, OS_OpenCreate returned \%d' +** \event 'Failed to write Task Info file, OS_OpenCreate returned \%d' ** ** \par Type: ERROR ** @@ -1375,10 +1355,10 @@ ** The \c 'd' parameter identifies, in decimal, the error code returned by #OS_OpenCreate when the attempt was made ** to create the file. **/ -#define CFE_ES_TASKINFO_OSCREATE_ERR_EID 88 +#define CFE_ES_TASKINFO_OSCREATE_ERR_EID 88 /** \brief 'Failed to write Task Info file, WriteHdr rtnd \%08X, exp \%d' -** \event 'Failed to write Task Info file, WriteHdr rtnd \%08X, exp \%d' +** \event 'Failed to write Task Info file, WriteHdr rtnd \%08X, exp \%d' ** ** \par Type: ERROR ** @@ -1390,11 +1370,10 @@ ** The \c rtnd field contains the error code returned by the #CFE_FS_WriteHeader API. Nominally, the ** returned result should have been equal to the \c exp field (i.e. - sizeof(#CFE_FS_Header_t)). **/ -#define CFE_ES_TASKINFO_WRHDR_ERR_EID 89 - +#define CFE_ES_TASKINFO_WRHDR_ERR_EID 89 /** \brief 'Failed to write Task Info file, Task write RC = 0x\%08X, exp \%d' -** \event 'Failed to write Task Info file, Task write RC = 0x\%08X, exp \%d' +** \event 'Failed to write Task Info file, Task write RC = 0x\%08X, exp \%d' ** ** \par Type: ERROR ** @@ -1406,8 +1385,7 @@ ** The \c rtnd field contains, in hex, the error code returned from the #OS_write API. The expected return ** value is identified, in decimal, in the \c exp field. **/ -#define CFE_ES_TASKINFO_WR_ERR_EID 90 - +#define CFE_ES_TASKINFO_WR_ERR_EID 90 /** \brief 'Version Info: %s, %s' ** \event 'Version Info: %s, %s' @@ -1429,7 +1407,7 @@ ** ** The \c Mission version information also identifies the build configuration name, if available. **/ -#define CFE_ES_VERSION_INF_EID 91 +#define CFE_ES_VERSION_INF_EID 91 /** \brief 'Build %s by %s@%s, config %s' ** \event 'Build %s by %s@%s, config %s' @@ -1456,8 +1434,7 @@ ** The values can be overridden by setting an environment variable with the names above ** to the value desired for the field when running "make". **/ -#define CFE_ES_BUILD_INF_EID 92 - +#define CFE_ES_BUILD_INF_EID 92 /** \brief 'Error log write to file \%s already in progress' ** \event 'Error log write to file \%s already in progress' @@ -1470,8 +1447,7 @@ ** Command \endlink is received before a previously-issued command has finished executing ** **/ -#define CFE_ES_ERLOG_PENDING_ERR_EID 93 - +#define CFE_ES_ERLOG_PENDING_ERR_EID 93 #endif /* _cfe_es_events_ */ diff --git a/modules/es/fsw/inc/cfe_es_msg.h b/modules/es/fsw/inc/cfe_es_msg.h index 33a538da9..623651255 100644 --- a/modules/es/fsw/inc/cfe_es_msg.h +++ b/modules/es/fsw/inc/cfe_es_msg.h @@ -38,11 +38,10 @@ /* ** Includes */ -#include "common_types.h" /* Basic data types */ -#include "cfe_msg_hdr.h" /* for header definitions */ +#include "common_types.h" /* Basic data types */ +#include "cfe_msg_hdr.h" /* for header definitions */ #include "cfe_es_extern_typedefs.h" - /* ** ES task command packet command codes */ @@ -51,8 +50,8 @@ /** \cfeescmd Executive Services No-Op ** ** \par Description -** This command performs no other function than to increment the -** command execution counter. The command may be used to verify +** This command performs no other function than to increment the +** command execution counter. The command may be used to verify ** general aliveness of the Executive Services task. ** ** \cfecmdmnemonic \ES_NOOP @@ -61,17 +60,17 @@ ** #CFE_ES_NoopCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_NOOP_INF_EID informational event message will +** - The #CFE_ES_NOOP_INF_EID informational event message will ** be generated ** ** \par Error Conditions ** This command may fail for the following reason(s): ** - The command packet length is incorrect -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment ** - the #CFE_ES_LEN_ERR_EID error event message will be generated @@ -79,14 +78,14 @@ ** \par Criticality ** None ** -** \sa +** \sa */ -#define CFE_ES_NOOP_CC 0 +#define CFE_ES_NOOP_CC 0 /** \cfeescmd Executive Services Reset Counters ** ** \par Description -** This command resets the following counters within the Executive +** This command resets the following counters within the Executive ** Services housekeeping telemetry: ** - Command Execution Counter ** - Command Error Counter @@ -97,30 +96,30 @@ ** #CFE_ES_ResetCountersCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_RESET_INF_EID informational event message will be +** - The #CFE_ES_RESET_INF_EID informational event message will be ** generated ** ** \par Error Conditions ** This command may fail for the following reason(s): ** - The command packet length is incorrect -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment ** - the #CFE_ES_LEN_ERR_EID error event message will be generated ** ** \par Criticality -** This command is not inherently dangerous. However, it is -** possible for ground systems and on-board safing procedures -** to be designed such that they react to changes in the counter +** This command is not inherently dangerous. However, it is +** possible for ground systems and on-board safing procedures +** to be designed such that they react to changes in the counter ** values that are reset by this command. ** ** \sa #CFE_ES_RESET_PR_COUNT_CC */ -#define CFE_ES_RESET_COUNTERS_CC 1 +#define CFE_ES_RESET_COUNTERS_CC 1 /** \cfeescmd Executive Services Processor / Power-On Reset ** @@ -129,10 +128,10 @@ ** will cause the cFE to restart as though the power were first applied ** to the processor. The Processor Reset will attempt to retain the contents ** of the volatile disk and the contents of the Critical Data Store. -** NOTE: If a requested Processor Reset should cause the +** NOTE: If a requested Processor Reset should cause the ** Processor Reset Counter (\b \c \ES_PROCRESETCNT) ** to exceed OR EQUAL the limit #CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS (which is reported in -** housekeeping telemetry as \b \c \ES_MAXPROCRESETS), +** housekeeping telemetry as \b \c \ES_MAXPROCRESETS), ** the command is \b AUTOMATICALLY upgraded to a Power-On Reset. ** ** \cfecmdmnemonic \ES_RESET @@ -141,7 +140,7 @@ ** #CFE_ES_RestartCmd_t ** ** \par Command Verification -** Successful execution of this command (as a Processor Reset) +** Successful execution of this command (as a Processor Reset) ** may be verified with the following telemetry: ** - \b \c \ES_PROCRESETCNT - processor reset counter will increment ** - New entries in the Exception Reset Log and System Log can be found
@@ -155,8 +154,8 @@ ** This command may fail for the following reason(s): ** - The command packet length is incorrect ** - The \link #CFE_ES_RestartCmd_Payload_t Restart Type \endlink was -** not a recognized value. -** +** not a recognized value. +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment ** - the #CFE_ES_BOOT_ERR_EID error event message will be generated @@ -170,13 +169,12 @@ ** ** \sa #CFE_ES_RESET_PR_COUNT_CC, #CFE_ES_SET_MAX_PR_COUNT_CC */ -#define CFE_ES_RESTART_CC 2 - +#define CFE_ES_RESTART_CC 2 /** \cfeescmd Load and Start an Application ** ** \par Description -** This command starts the specified application with the +** This command starts the specified application with the ** specified start address, stack size, etc options. ** ** \cfecmdmnemonic \ES_STARTAPP @@ -185,11 +183,11 @@ ** #CFE_ES_StartAppCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_START_INF_EID informational event message will be +** - The #CFE_ES_START_INF_EID informational event message will be ** generated ** ** \par Error Conditions @@ -207,7 +205,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -217,7 +215,7 @@ ** ** \sa #CFE_ES_STOP_APP_CC, #CFE_ES_RESTART_APP_CC, #CFE_ES_RELOAD_APP_CC */ -#define CFE_ES_START_APP_CC 4 +#define CFE_ES_START_APP_CC 4 /** \cfeescmd Stop and Unload Application ** @@ -226,7 +224,7 @@ ** from the system. \b NOTE: This command should never be used ** on the Command Ingest application. This would prevent further ** commands from entering the system. If Command Ingest needs to -** be stopped and restarted, use #CFE_ES_RESTART_APP_CC or +** be stopped and restarted, use #CFE_ES_RESTART_APP_CC or ** #CFE_ES_RELOAD_APP_CC. ** ** \cfecmdmnemonic \ES_STOPAPP @@ -235,16 +233,16 @@ ** #CFE_ES_StopAppCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_STOP_DBG_EID debug event message will be +** - The #CFE_ES_STOP_DBG_EID debug event message will be ** generated. NOTE: This event message only identifies that the ** stop has been started, not that is has completed. ** - Once the stop has successfully completed, the list of Applications -** and Tasks created in response to the \b \c \ES_WRITEAPPINFO2FILE, -** \b \c \ES_WRITETASKINFO2FILE should no longer contain the +** and Tasks created in response to the \b \c \ES_WRITEAPPINFO2FILE, +** \b \c \ES_WRITETASKINFO2FILE should no longer contain the ** specified application. ** ** \par Error Conditions @@ -255,7 +253,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** - Additional information on the reason for command failure may be found ** in the System Log @@ -267,7 +265,7 @@ ** ** \sa #CFE_ES_START_APP_CC, #CFE_ES_RESTART_APP_CC, #CFE_ES_RELOAD_APP_CC */ -#define CFE_ES_STOP_APP_CC 5 +#define CFE_ES_STOP_APP_CC 5 /** \cfeescmd Stops, Unloads, Loads using the previous File name, and Restarts an Application ** @@ -285,11 +283,11 @@ ** #CFE_ES_RestartAppCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_RESTART_APP_DBG_EID debug event message will be +** - The #CFE_ES_RESTART_APP_DBG_EID debug event message will be ** generated. NOTE: This event message only identifies that the ** act of stopping the application has begun, not that is has completed. ** @@ -302,7 +300,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** - Additional information on the reason for command failure may be found ** in the System Log @@ -314,17 +312,17 @@ ** ** \sa #CFE_ES_START_APP_CC, #CFE_ES_STOP_APP_CC, #CFE_ES_RELOAD_APP_CC */ -#define CFE_ES_RESTART_APP_CC 6 +#define CFE_ES_RESTART_APP_CC 6 /** \cfeescmd Stops, Unloads, Loads from the command specfied File and Restarts an Application ** ** \par Description ** This command halts and removes the specified Application ** from the system. Then it immediately loads the Application from -** the command specified file and restarts it. This command is +** the command specified file and restarts it. This command is ** especially useful for restarting a Command Ingest Application ** since once it has been stopped, no further commands can come in -** to restart it. +** to restart it. ** ** \cfecmdmnemonic \ES_RELOADAPP ** @@ -332,11 +330,11 @@ ** #CFE_ES_ReloadAppCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_RELOAD_APP_DBG_EID debug event message will be +** - The #CFE_ES_RELOAD_APP_DBG_EID debug event message will be ** generated. NOTE: This event message only identifies that the ** act of stopping the application has begun, not that is has completed. ** @@ -349,7 +347,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** - Additional information on the reason for command failure may be found ** in the System Log @@ -361,7 +359,7 @@ ** ** \sa #CFE_ES_START_APP_CC, #CFE_ES_STOP_APP_CC, #CFE_ES_RESTART_APP_CC */ -#define CFE_ES_RELOAD_APP_CC 7 +#define CFE_ES_RELOAD_APP_CC 7 /** \cfeescmd Request Executive Services Information on a Specified Application ** @@ -375,11 +373,11 @@ ** #CFE_ES_QueryOneCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_ONE_APP_EID debug event message will be +** - The #CFE_ES_ONE_APP_EID debug event message will be ** generated. NOTE: This event message only identifies that the ** act of stopping the application has begun, not that is has completed. ** - Receipt of the #CFE_ES_OneAppTlm_t telemetry packet @@ -391,7 +389,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -399,7 +397,7 @@ ** ** \sa #CFE_ES_QUERY_ALL_CC, #CFE_ES_QUERY_ALL_TASKS_CC */ -#define CFE_ES_QUERY_ONE_CC 8 +#define CFE_ES_QUERY_ONE_CC 8 /** \cfeescmd Writes all Executive Services Information on All Applications to a File ** @@ -413,14 +411,14 @@ ** #CFE_ES_QueryAllCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_ALL_APPS_EID debug event message will be +** - The #CFE_ES_ALL_APPS_EID debug event message will be ** generated. ** - The file specified in the command (or the default specified -** by the #CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE configuration parameter) will be +** by the #CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE configuration parameter) will be ** updated with the lastest information. ** ** \par Error Conditions @@ -430,18 +428,18 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality -** This command is not inherently dangerous. It will create a new -** file in the file system (or overwrite an existing one) and could, -** if performed repeatedly without sufficient file management by the +** This command is not inherently dangerous. It will create a new +** file in the file system (or overwrite an existing one) and could, +** if performed repeatedly without sufficient file management by the ** operator, fill the file system. ** ** \sa #CFE_ES_QUERY_ONE_CC, #CFE_ES_QUERY_ALL_TASKS_CC */ -#define CFE_ES_QUERY_ALL_CC 9 +#define CFE_ES_QUERY_ALL_CC 9 /** \cfeescmd Clear Executive Services System Log ** @@ -454,11 +452,11 @@ ** #CFE_ES_ClearSysLogCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_SYSLOG1_INF_EID informational event message will be +** - The #CFE_ES_SYSLOG1_INF_EID informational event message will be ** generated. ** - \b \c \ES_SYSLOGBYTEUSED - System Log Bytes Used will go to zero ** - \b \c \ES_SYSLOGENTRIES - Number of System Log Entries will go to zero @@ -469,7 +467,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -479,7 +477,7 @@ ** \sa #CFE_ES_WRITE_SYSLOG_CC, #CFE_ES_CLEAR_ER_LOG_CC, #CFE_ES_WRITE_ER_LOG_CC, ** #CFE_ES_OVER_WRITE_SYSLOG_CC */ -#define CFE_ES_CLEAR_SYSLOG_CC 10 +#define CFE_ES_CLEAR_SYSLOG_CC 10 /** \cfeescmd Writes contents of Executive Services System Log to a File ** @@ -493,14 +491,14 @@ ** #CFE_ES_WriteSysLogCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_SYSLOG2_EID debug event message will be +** - The #CFE_ES_SYSLOG2_EID debug event message will be ** generated. ** - The file specified in the command (or the default specified -** by the #CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE configuration parameter) will be +** by the #CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE configuration parameter) will be ** updated with the lastest information. ** ** \par Error Conditions @@ -510,19 +508,19 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality -** This command is not inherently dangerous. It will create a new -** file in the file system (or overwrite an existing one) and could, -** if performed repeatedly without sufficient file management by the +** This command is not inherently dangerous. It will create a new +** file in the file system (or overwrite an existing one) and could, +** if performed repeatedly without sufficient file management by the ** operator, fill the file system. ** ** \sa #CFE_ES_CLEAR_SYSLOG_CC, #CFE_ES_CLEAR_ER_LOG_CC, #CFE_ES_WRITE_ER_LOG_CC, ** #CFE_ES_OVER_WRITE_SYSLOG_CC */ -#define CFE_ES_WRITE_SYSLOG_CC 11 +#define CFE_ES_WRITE_SYSLOG_CC 11 /** \cfeescmd Clears the contents of the Exeception and Reset Log ** @@ -536,11 +534,11 @@ ** #CFE_ES_ClearERLogCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_ERLOG1_INF_EID informational event message will be +** - The #CFE_ES_ERLOG1_INF_EID informational event message will be ** generated. ** - \b \c \ES_ERLOGINDEX - Index into Exception Reset Log goes to zero ** @@ -550,7 +548,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -559,7 +557,7 @@ ** ** \sa #CFE_ES_CLEAR_SYSLOG_CC, #CFE_ES_WRITE_SYSLOG_CC, #CFE_ES_WRITE_ER_LOG_CC */ -#define CFE_ES_CLEAR_ER_LOG_CC 12 +#define CFE_ES_CLEAR_ER_LOG_CC 12 /** \cfeescmd Writes Exeception and Reset Log to a File ** @@ -573,14 +571,14 @@ ** #CFE_ES_WriteERLogCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_ERLOG2_EID debug event message will be +** - The #CFE_ES_ERLOG2_EID debug event message will be ** generated. ** - The file specified in the command (or the default specified -** by the #CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE configuration parameter) will be +** by the #CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE configuration parameter) will be ** updated with the lastest information. ** ** \par Error Conditions @@ -590,18 +588,18 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality -** This command is not inherently dangerous. It will create a new -** file in the file system (or overwrite an existing one) and could, -** if performed repeatedly without sufficient file management by the +** This command is not inherently dangerous. It will create a new +** file in the file system (or overwrite an existing one) and could, +** if performed repeatedly without sufficient file management by the ** operator, fill the file system. ** ** \sa #CFE_ES_CLEAR_SYSLOG_CC, #CFE_ES_WRITE_SYSLOG_CC, #CFE_ES_CLEAR_ER_LOG_CC */ -#define CFE_ES_WRITE_ER_LOG_CC 13 +#define CFE_ES_WRITE_ER_LOG_CC 13 /** \cfeescmd Start Performance Analyzer ** @@ -614,20 +612,20 @@ ** #CFE_ES_StartPerfDataCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment ** - \b \c \ES_PERFSTATE - Current performance analyzer state will change to ** either WAITING FOR TRIGGER or, if conditions are appropriate fast enough, ** TRIGGERED. -** - \b \c \ES_PERFMODE - Performance Analyzer Mode will change to the commanded trigger mode (TRIGGER START, +** - \b \c \ES_PERFMODE - Performance Analyzer Mode will change to the commanded trigger mode (TRIGGER START, ** TRIGGER CENTER, or TRIGGER END). ** - \b \c \ES_PERFTRIGCNT - Performance Trigger Count will go to zero ** - \b \c \ES_PERFDATASTART - Data Start Index will go to zero ** - \b \c \ES_PERFDATAEND - Data End Index will go to zero ** - \b \c \ES_PERFDATACNT - Performance Data Counter will go to zero -** - The #CFE_ES_PERF_STARTCMD_EID debug event message will be +** - The #CFE_ES_PERF_STARTCMD_EID debug event message will be ** generated. ** ** \par Error Conditions @@ -638,7 +636,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -647,7 +645,7 @@ ** ** \sa #CFE_ES_STOP_PERF_DATA_CC, #CFE_ES_SET_PERF_FILTER_MASK_CC, #CFE_ES_SET_PERF_TRIGGER_MASK_CC */ -#define CFE_ES_START_PERF_DATA_CC 14 +#define CFE_ES_START_PERF_DATA_CC 14 /** \cfeescmd Stop Performance Analyzer ** @@ -660,16 +658,16 @@ ** #CFE_ES_StopPerfDataCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment ** - \b \c \ES_PERFSTATE - Current performance analyzer state will change to -** IDLE. -** - The #CFE_ES_PERF_STOPCMD_EID debug event message will be +** IDLE. +** - The #CFE_ES_PERF_STOPCMD_EID debug event message will be ** generated. ** - The file specified in the command (or the default specified -** by the #CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME configuration parameter) will be +** by the #CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME configuration parameter) will be ** updated with the lastest information. ** ** \par Error Conditions @@ -681,7 +679,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -690,7 +688,7 @@ ** ** \sa #CFE_ES_START_PERF_DATA_CC, #CFE_ES_SET_PERF_FILTER_MASK_CC, #CFE_ES_SET_PERF_TRIGGER_MASK_CC */ -#define CFE_ES_STOP_PERF_DATA_CC 15 +#define CFE_ES_STOP_PERF_DATA_CC 15 /** \cfeescmd Set Performance Analyzer's Filter Masks ** @@ -703,13 +701,13 @@ ** #CFE_ES_SetPerfFilterMaskCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment ** - \b \c \ES_PERFFLTRMASK - the current performance filter mask ** value(s) should reflect the commanded value -** - The #CFE_ES_PERF_FILTMSKCMD_EID debug event message will be +** - The #CFE_ES_PERF_FILTMSKCMD_EID debug event message will be ** generated. ** ** \par Error Conditions @@ -719,7 +717,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -728,7 +726,7 @@ ** ** \sa #CFE_ES_START_PERF_DATA_CC, #CFE_ES_STOP_PERF_DATA_CC, #CFE_ES_SET_PERF_TRIGGER_MASK_CC */ -#define CFE_ES_SET_PERF_FILTER_MASK_CC 16 +#define CFE_ES_SET_PERF_FILTER_MASK_CC 16 /** \cfeescmd Set Performance Analyzer's Trigger Masks ** @@ -741,13 +739,13 @@ ** #CFE_ES_SetPerfTriggerMaskCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment ** - \b \c \ES_PERFTRIGMASK - the current performance trigger mask ** value(s) should reflect the commanded value -** - The #CFE_ES_PERF_TRIGMSKCMD_EID debug event message will be +** - The #CFE_ES_PERF_TRIGMSKCMD_EID debug event message will be ** generated. ** ** \par Error Conditions @@ -757,7 +755,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -766,7 +764,7 @@ ** ** \sa #CFE_ES_START_PERF_DATA_CC, #CFE_ES_STOP_PERF_DATA_CC, #CFE_ES_SET_PERF_FILTER_MASK_CC */ -#define CFE_ES_SET_PERF_TRIGGER_MASK_CC 17 +#define CFE_ES_SET_PERF_TRIGGER_MASK_CC 17 /** \cfeescmd Set Executive Services System Log Mode to Discard/Overwrite ** @@ -781,13 +779,13 @@ ** #CFE_ES_OverWriteSysLogCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment ** - \b \c \ES_SYSLOGMODE - Current System Log Mode should reflect ** the commanded value -** - The #CFE_ES_SYSLOGMODE_EID debug event message will be +** - The #CFE_ES_SYSLOGMODE_EID debug event message will be ** generated. ** ** \par Error Conditions @@ -797,7 +795,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -807,13 +805,13 @@ ** ** \sa #CFE_ES_CLEAR_SYSLOG_CC, #CFE_ES_WRITE_SYSLOG_CC */ -#define CFE_ES_OVER_WRITE_SYSLOG_CC 18 +#define CFE_ES_OVER_WRITE_SYSLOG_CC 18 /** \cfeescmd Resets the Processor Reset Counter to Zero ** ** \par Description ** This command allows the user to reset the Processor Reset Counter to zero. -** The Processor Reset Counter counts the number of Processor Resets that +** The Processor Reset Counter counts the number of Processor Resets that ** have occurred so as to identify when a Processor Reset should automatically ** be upgraded to a full Power-On Reset. ** @@ -823,12 +821,12 @@ ** #CFE_ES_ResetPRCountCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment ** - \b \c \ES_PROCRESETCNT - Current number of processor resets will go to zero -** - The #CFE_ES_RESET_PR_COUNT_EID informational event message will be +** - The #CFE_ES_RESET_PR_COUNT_EID informational event message will be ** generated. ** ** \par Error Conditions @@ -837,7 +835,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -847,7 +845,7 @@ ** ** \sa #CFE_ES_SET_MAX_PR_COUNT_CC, #CFE_ES_RESET_COUNTERS_CC */ -#define CFE_ES_RESET_PR_COUNT_CC 19 +#define CFE_ES_RESET_PR_COUNT_CC 19 /** \cfeescmd Configure the Maximum Number of Processor Resets before a Power-On Reset ** @@ -861,13 +859,13 @@ ** #CFE_ES_SetMaxPRCountCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - \b \c \ES_MAXPROCRESETS - Current maximum number of processor resets +** - \b \c \ES_MAXPROCRESETS - Current maximum number of processor resets ** before an automatic power-on reset will go to the command specified value. -** - The #CFE_ES_SET_MAX_PR_COUNT_EID informational event message will be +** - The #CFE_ES_SET_MAX_PR_COUNT_EID informational event message will be ** generated. ** ** \par Error Conditions @@ -876,7 +874,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -888,7 +886,7 @@ ** ** \sa #CFE_ES_RESET_PR_COUNT_CC */ -#define CFE_ES_SET_MAX_PR_COUNT_CC 20 +#define CFE_ES_SET_MAX_PR_COUNT_CC 20 /** \cfeescmd Delete Critical Data Store ** @@ -902,11 +900,11 @@ ** #CFE_ES_DeleteCDSCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_CDS_DELETED_INFO_EID informational event message will be +** - The #CFE_ES_CDS_DELETED_INFO_EID informational event message will be ** generated. ** - The specified CDS should no longer appear in a CDS Registry dump generated ** upon receipt of the #CFE_ES_DUMP_CDS_REGISTRY_CC command @@ -921,7 +919,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -931,7 +929,7 @@ ** ** \sa #CFE_ES_DUMP_CDS_REGISTRY_CC, #CFE_TBL_DELETE_CDS_CC */ -#define CFE_ES_DELETE_CDS_CC 21 +#define CFE_ES_DELETE_CDS_CC 21 /** \cfeescmd Telemeter Memory Pool Statistics ** @@ -945,11 +943,11 @@ ** #CFE_ES_SendMemPoolStatsCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_TLM_POOL_STATS_INFO_EID debug event message will be +** - The #CFE_ES_TLM_POOL_STATS_INFO_EID debug event message will be ** generated. ** - The \link #CFE_ES_MemStatsTlm_t Memory Pool Statistics Telemetry Packet \endlink ** is produced @@ -963,7 +961,7 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality @@ -971,9 +969,9 @@ ** Extreme care should be taken to ensure the memory handle value ** used in the command is correct. ** -** \sa +** \sa */ -#define CFE_ES_SEND_MEM_POOL_STATS_CC 22 +#define CFE_ES_SEND_MEM_POOL_STATS_CC 22 /** \cfeescmd Dump Critical Data Store Registry to a File ** @@ -987,14 +985,14 @@ ** #CFE_ES_DumpCDSRegistryCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_CDS_REG_DUMP_INF_EID debug event message will be +** - The #CFE_ES_CDS_REG_DUMP_INF_EID debug event message will be ** generated. ** - The file specified in the command (or the default specified -** by the #CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE configuration parameter) will be +** by the #CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE configuration parameter) will be ** updated with the lastest information. ** ** \par Error Conditions @@ -1003,18 +1001,18 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality -** This command is not inherently dangerous. It will create a new -** file in the file system (or overwrite an existing one) and could, -** if performed repeatedly without sufficient file management by the +** This command is not inherently dangerous. It will create a new +** file in the file system (or overwrite an existing one) and could, +** if performed repeatedly without sufficient file management by the ** operator, fill the file system. ** ** \sa #CFE_ES_DELETE_CDS_CC, #CFE_TBL_DELETE_CDS_CC */ -#define CFE_ES_DUMP_CDS_REGISTRY_CC 23 +#define CFE_ES_DUMP_CDS_REGISTRY_CC 23 /** \cfeescmd Writes a list of All Executive Services Tasks to a File ** @@ -1028,14 +1026,14 @@ ** #CFE_ES_QueryAllTasksCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \ES_CMDPC - command execution counter will +** - \b \c \ES_CMDPC - command execution counter will ** increment -** - The #CFE_ES_TASKINFO_EID debug event message will be +** - The #CFE_ES_TASKINFO_EID debug event message will be ** generated. ** - The file specified in the command (or the default specified -** by the #CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE configuration parameter) will be +** by the #CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE configuration parameter) will be ** updated with the lastest information. ** ** \par Error Conditions @@ -1045,23 +1043,21 @@ ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \ES_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality -** This command is not inherently dangerous. It will create a new -** file in the file system (or overwrite an existing one) and could, -** if performed repeatedly without sufficient file management by the +** This command is not inherently dangerous. It will create a new +** file in the file system (or overwrite an existing one) and could, +** if performed repeatedly without sufficient file management by the ** operator, fill the file system. ** ** \sa #CFE_ES_QUERY_ALL_CC, CFE_ES_QUERY_ONE_CC */ -#define CFE_ES_QUERY_ALL_TASKS_CC 24 - +#define CFE_ES_QUERY_ALL_TASKS_CC 24 /** \} */ - /*************************************************************************/ /********************************/ /* Command Message Data Formats */ @@ -1101,8 +1097,8 @@ typedef CFE_ES_NoArgsCmd_t CFE_ES_ResetPRCountCmd_t; **/ typedef struct CFE_ES_RestartCmd_Payload { - uint16 RestartType; /**< \brief #CFE_PSP_RST_TYPE_PROCESSOR=Processor Reset - or #CFE_PSP_RST_TYPE_POWERON=Power-On Reset */ + uint16 RestartType; /**< \brief #CFE_PSP_RST_TYPE_PROCESSOR=Processor Reset + or #CFE_PSP_RST_TYPE_POWERON=Power-On Reset */ } CFE_ES_RestartCmd_Payload_t; /** @@ -1124,8 +1120,8 @@ typedef struct CFE_ES_RestartCmd **/ typedef struct CFE_ES_FileNameCmd_Payload { - char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief ASCII text string containing full path and - filename of file in which Application data is to be dumped */ + char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief ASCII text string containing full path and + filename of file in which Application data is to be dumped */ } CFE_ES_FileNameCmd_Payload_t; /** @@ -1138,7 +1134,7 @@ typedef struct CFE_ES_FileNameCmd } CFE_ES_FileNameCmd_t; /* - * Unique typedefs for each of the commands that utilize the FileNameCmd + * Unique typedefs for each of the commands that utilize the FileNameCmd * packet format */ typedef CFE_ES_FileNameCmd_t CFE_ES_QueryAllCmd_t; @@ -1154,8 +1150,8 @@ typedef CFE_ES_FileNameCmd_t CFE_ES_WriteERLogCmd_t; **/ typedef struct CFE_ES_OverWriteSysLogCmd_Payload { - uint32 Mode; /**< \brief #CFE_ES_LogMode_DISCARD=Throw away most recent messages, - #CFE_ES_LogMode_OVERWRITE=Overwrite oldest with most recent */ + uint32 Mode; /**< \brief #CFE_ES_LogMode_DISCARD=Throw away most recent messages, + #CFE_ES_LogMode_OVERWRITE=Overwrite oldest with most recent */ } CFE_ES_OverWriteSysLogCmd_Payload_t; @@ -1176,18 +1172,18 @@ typedef struct CFE_ES_OverWriteSysLogCmd **/ typedef struct CFE_ES_StartAppCmd_Payload { - char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief Name of Application to be started */ - char AppEntryPoint[CFE_MISSION_MAX_API_LEN]; /**< \brief Symbolic name of Application's entry point */ - char AppFileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full path and filename of Application's - executable image */ + char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief Name of Application to be started */ + char AppEntryPoint[CFE_MISSION_MAX_API_LEN]; /**< \brief Symbolic name of Application's entry point */ + char AppFileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full path and filename of Application's + executable image */ - CFE_ES_MemOffset_t StackSize; /**< \brief Desired stack size for the new application */ + CFE_ES_MemOffset_t StackSize; /**< \brief Desired stack size for the new application */ - CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \brief #CFE_ES_ExceptionAction_RESTART_APP=On exception, - restart Application, - #CFE_ES_ExceptionAction_PROC_RESTART=On exception, - perform a Processor Reset */ - CFE_ES_TaskPriority_Atom_t Priority; /**< \brief The new Applications runtime priority. */ + CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \brief #CFE_ES_ExceptionAction_RESTART_APP=On exception, + restart Application, + #CFE_ES_ExceptionAction_PROC_RESTART=On exception, + perform a Processor Reset */ + CFE_ES_TaskPriority_Atom_t Priority; /**< \brief The new Applications runtime priority. */ } CFE_ES_StartAppCmd_Payload_t; @@ -1208,7 +1204,7 @@ typedef struct CFE_ES_StartApp **/ typedef struct CFE_ES_AppNameCmd_Payload { - char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief ASCII text string containing Application Name */ + char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief ASCII text string containing Application Name */ } CFE_ES_AppNameCmd_Payload_t; /** @@ -1237,9 +1233,9 @@ typedef CFE_ES_AppNameCmd_t CFE_ES_QueryOneCmd_t; **/ typedef struct CFE_ES_AppReloadCmd_Payload { - char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief ASCII text string containing Application Name */ - char AppFileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full path and filename of Application's - executable image */ + char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief ASCII text string containing Application Name */ + char AppFileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full path and filename of Application's + executable image */ } CFE_ES_AppReloadCmd_Payload_t; /** @@ -1259,8 +1255,8 @@ typedef struct CFE_ES_ReloadAppCmd **/ typedef struct CFE_ES_SetMaxPRCountCmd_Payload { - uint16 MaxPRCount; /**< \brief New maximum number of Processor Resets before - an automatic Power-On Reset is performed */ + uint16 MaxPRCount; /**< \brief New maximum number of Processor Resets before + an automatic Power-On Reset is performed */ } CFE_ES_SetMaxPRCountCmd_Payload_t; /** @@ -1280,7 +1276,8 @@ typedef struct CFE_ES_SetMaxPRCountCmd **/ typedef struct CFE_ES_DeleteCDSCmd_Payload { - char CdsName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; /**< \brief ASCII text string containing name of CDS to delete */ + char + CdsName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; /**< \brief ASCII text string containing name of CDS to delete */ } CFE_ES_DeleteCDSCmd_Payload_t; @@ -1301,7 +1298,7 @@ typedef struct CFE_ES_DeleteCDSCmd **/ typedef struct CFE_ES_StartPerfCmd_Payload { - uint32 TriggerMode; /**< \brief Desired trigger position (Start, Center, End) */ + uint32 TriggerMode; /**< \brief Desired trigger position (Start, Center, End) */ } CFE_ES_StartPerfCmd_Payload_t; /** @@ -1321,8 +1318,8 @@ typedef struct CFE_ES_StartPerfDataCmd **/ typedef struct CFE_ES_StopPerfCmd_Payload { - char DataFileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief ASCII text string of full path and filename - of file Performance Analyzer data is to be written */ + char DataFileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief ASCII text string of full path and filename + of file Performance Analyzer data is to be written */ } CFE_ES_StopPerfCmd_Payload_t; /** @@ -1334,7 +1331,6 @@ typedef struct CFE_ES_StopPerfDataCmd CFE_ES_StopPerfCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_StopPerfDataCmd_t; - /** ** \brief Set Performance Analyzer Filter Mask Command Payload ** @@ -1343,8 +1339,8 @@ typedef struct CFE_ES_StopPerfDataCmd **/ typedef struct CFE_ES_SetPerfFilterMaskCmd_Payload { - uint32 FilterMaskNum; /**< \brief Index into array of Filter Masks */ - uint32 FilterMask; /**< \brief New Mask for specified entry in array of Filter Masks */ + uint32 FilterMaskNum; /**< \brief Index into array of Filter Masks */ + uint32 FilterMask; /**< \brief New Mask for specified entry in array of Filter Masks */ } CFE_ES_SetPerfFilterMaskCmd_Payload_t; @@ -1365,8 +1361,8 @@ typedef struct CFE_ES_SetPerfFilterMaskCmd **/ typedef struct CFE_ES_SetPerfTrigMaskCmd_Payload { - uint32 TriggerMaskNum; /**< \brief Index into array of Trigger Masks */ - uint32 TriggerMask; /**< \brief New Mask for specified entry in array of Trigger Masks */ + uint32 TriggerMaskNum; /**< \brief Index into array of Trigger Masks */ + uint32 TriggerMask; /**< \brief New Mask for specified entry in array of Trigger Masks */ } CFE_ES_SetPerfTrigMaskCmd_Payload_t; @@ -1387,8 +1383,8 @@ typedef struct CFE_ES_SetPerfTriggerMaskCmd **/ typedef struct CFE_ES_SendMemPoolStatsCmd_Payload { - char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief - RESERVED - should be all zeroes */ - CFE_ES_MemHandle_t PoolHandle; /**< \brief Handle of Pool whose statistics are to be telemetered */ + char Application[CFE_MISSION_MAX_API_LEN]; /**< \brief - RESERVED - should be all zeroes */ + CFE_ES_MemHandle_t PoolHandle; /**< \brief Handle of Pool whose statistics are to be telemetered */ } CFE_ES_SendMemPoolStatsCmd_Payload_t; @@ -1409,8 +1405,8 @@ typedef struct CFE_ES_SendMemPoolStatsCmd **/ typedef struct CFE_ES_DumpCDSRegistryCmd_Payload { - char DumpFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief ASCII text string of full path and filename - of file CDS Registry is to be written */ + char DumpFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief ASCII text string of full path and filename + of file CDS Registry is to be written */ } CFE_ES_DumpCDSRegistryCmd_Payload_t; /** @@ -1428,17 +1424,16 @@ typedef struct CFE_ES_DumpCDSRegistryCmd /* Telemetry Interface Data Formats */ /************************************/ - /**********************************/ /* Telemetry Message Data Formats */ /**********************************/ -/** +/** ** \cfeestlm Single Application Information Packet **/ typedef struct CFE_ES_OneAppTlm_Payload { - CFE_ES_AppInfo_t AppInfo; /**< \brief For more information, see #CFE_ES_AppInfo_t */ - + CFE_ES_AppInfo_t AppInfo; /**< \brief For more information, see #CFE_ES_AppInfo_t */ + } CFE_ES_OneAppTlm_Payload_t; typedef struct CFE_ES_OneAppTlm @@ -1447,14 +1442,14 @@ typedef struct CFE_ES_OneAppTlm CFE_ES_OneAppTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_ES_OneAppTlm_t; -/** +/** ** \cfeestlm Memory Pool Statistics Packet **/ typedef struct CFE_ES_PoolStatsTlm_Payload { - CFE_ES_MemHandle_t PoolHandle; /**< \cfetlmmnemonic \ES_POOLHANDLE - \brief Handle of memory pool whose stats are being telemetered */ - CFE_ES_MemPoolStats_t PoolStats; /**< \brief For more info, see #CFE_ES_MemPoolStats_t */ + CFE_ES_MemHandle_t PoolHandle; /**< \cfetlmmnemonic \ES_POOLHANDLE + \brief Handle of memory pool whose stats are being telemetered */ + CFE_ES_MemPoolStats_t PoolStats; /**< \brief For more info, see #CFE_ES_MemPoolStats_t */ } CFE_ES_PoolStatsTlm_Payload_t; typedef struct CFE_ES_MemStatsTlm @@ -1465,106 +1460,106 @@ typedef struct CFE_ES_MemStatsTlm /*************************************************************************/ -/** +/** ** \cfeestlm Executive Services Housekeeping Packet **/ typedef struct CFE_ES_HousekeepingTlm_Payload { - uint8 CommandCounter; /**< \cfetlmmnemonic \ES_CMDPC - \brief The ES Application Command Counter */ - uint8 CommandErrorCounter; /**< \cfetlmmnemonic \ES_CMDEC - \brief The ES Application Command Error Counter */ - - uint16 CFECoreChecksum; /**< \cfetlmmnemonic \ES_CKSUM - \brief Checksum of cFE Core Code */ - uint8 CFEMajorVersion; /**< \cfetlmmnemonic \ES_CFEMAJORVER - \brief Major Version Number of cFE */ - uint8 CFEMinorVersion; /**< \cfetlmmnemonic \ES_CFEMINORVER - \brief Minor Version Number of cFE */ - uint8 CFERevision; /**< \cfetlmmnemonic \ES_CFEREVISION - \brief Sub-Minor Version Number of cFE */ - uint8 CFEMissionRevision; /**< \cfetlmmnemonic \ES_CFEMISSIONREV - \brief Mission Version Number of cFE */ - uint8 OSALMajorVersion; /**< \cfetlmmnemonic \ES_OSMAJORVER - \brief OS Abstraction Layer Major Version Number */ - uint8 OSALMinorVersion; /**< \cfetlmmnemonic \ES_OSMINORVER - \brief OS Abstraction Layer Minor Version Number */ - uint8 OSALRevision; /**< \cfetlmmnemonic \ES_OSREVISION - \brief OS Abstraction Layer Revision Number */ - uint8 OSALMissionRevision;/**< \cfetlmmnemonic \ES_OSMISSIONREV - \brief OS Abstraction Layer MissionRevision Number */ - - CFE_ES_MemOffset_t SysLogBytesUsed; /**< \cfetlmmnemonic \ES_SYSLOGBYTEUSED - \brief Total number of bytes used in system log */ - CFE_ES_MemOffset_t SysLogSize; /**< \cfetlmmnemonic \ES_SYSLOGSIZE - \brief Total size of the system log */ - uint32 SysLogEntries; /**< \cfetlmmnemonic \ES_SYSLOGENTRIES - \brief Number of entries in the system log */ - uint32 SysLogMode; /**< \cfetlmmnemonic \ES_SYSLOGMODE - \brief Write/Overwrite Mode */ - - uint32 ERLogIndex; /**< \cfetlmmnemonic \ES_ERLOGINDEX - \brief Current index of the ER Log (wraps around) */ - uint32 ERLogEntries; /**< \cfetlmmnemonic \ES_ERLOGENTRIES - \brief Number of entries made in the ER Log since the power on */ - - uint32 RegisteredCoreApps; /**< \cfetlmmnemonic \ES_REGCOREAPPS - \brief Number of Applications registered with ES */ - uint32 RegisteredExternalApps; /**< \cfetlmmnemonic \ES_REGEXTAPPS - \brief Number of Applications registered with ES */ - uint32 RegisteredTasks; /**< \cfetlmmnemonic \ES_REGTASKS - \brief Number of Tasks ( main AND child tasks ) registered with ES */ - uint32 RegisteredLibs; /**< \cfetlmmnemonic \ES_REGLIBS - \brief Number of Libraries registered with ES */ - - uint32 ResetType; /**< \cfetlmmnemonic \ES_RESETTYPE - \brief Reset type ( PROCESSOR or POWERON ) */ - uint32 ResetSubtype; /**< \cfetlmmnemonic \ES_RESETSUBTYPE - \brief Reset Sub Type */ - uint32 ProcessorResets; /**< \cfetlmmnemonic \ES_PROCRESETCNT - \brief Number of processor resets since last power on */ - uint32 MaxProcessorResets; /**< \cfetlmmnemonic \ES_MAXPROCRESETS - \brief Max processor resets before a power on is done */ - uint32 BootSource; /**< \cfetlmmnemonic \ES_BOOTSOURCE - \brief Boot source ( as provided from BSP ) */ - - uint32 PerfState; /**< \cfetlmmnemonic \ES_PERFSTATE - \brief Current state of Performance Analyzer */ - uint32 PerfMode; /**< \cfetlmmnemonic \ES_PERFMODE - \brief Current mode of Performance Analyzer */ - uint32 PerfTriggerCount; /**< \cfetlmmnemonic \ES_PERFTRIGCNT - \brief Number of Times Perfomance Analyzer has Triggered */ - uint32 PerfFilterMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFFLTRMASK - \brief Current Setting of Performance Analyzer Filter Masks */ - uint32 PerfTriggerMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFTRIGMASK - \brief Current Setting of Performance Analyzer Trigger Masks */ - uint32 PerfDataStart; /**< \cfetlmmnemonic \ES_PERFDATASTART - \brief Identifies First Stored Entry in Performance Analyzer Log */ - uint32 PerfDataEnd; /**< \cfetlmmnemonic \ES_PERFDATAEND - \brief Identifies Last Stored Entry in Performance Analyzer Log */ - uint32 PerfDataCount; /**< \cfetlmmnemonic \ES_PERFDATACNT - \brief Number of Entries Put Into the Performance Analyzer Log */ - uint32 PerfDataToWrite; /**< \cfetlmmnemonic \ES_PERFDATA2WRITE + uint8 CommandCounter; /**< \cfetlmmnemonic \ES_CMDPC + \brief The ES Application Command Counter */ + uint8 CommandErrorCounter; /**< \cfetlmmnemonic \ES_CMDEC + \brief The ES Application Command Error Counter */ + + uint16 CFECoreChecksum; /**< \cfetlmmnemonic \ES_CKSUM + \brief Checksum of cFE Core Code */ + uint8 CFEMajorVersion; /**< \cfetlmmnemonic \ES_CFEMAJORVER + \brief Major Version Number of cFE */ + uint8 CFEMinorVersion; /**< \cfetlmmnemonic \ES_CFEMINORVER + \brief Minor Version Number of cFE */ + uint8 CFERevision; /**< \cfetlmmnemonic \ES_CFEREVISION + \brief Sub-Minor Version Number of cFE */ + uint8 CFEMissionRevision; /**< \cfetlmmnemonic \ES_CFEMISSIONREV + \brief Mission Version Number of cFE */ + uint8 OSALMajorVersion; /**< \cfetlmmnemonic \ES_OSMAJORVER + \brief OS Abstraction Layer Major Version Number */ + uint8 OSALMinorVersion; /**< \cfetlmmnemonic \ES_OSMINORVER + \brief OS Abstraction Layer Minor Version Number */ + uint8 OSALRevision; /**< \cfetlmmnemonic \ES_OSREVISION + \brief OS Abstraction Layer Revision Number */ + uint8 OSALMissionRevision; /**< \cfetlmmnemonic \ES_OSMISSIONREV + \brief OS Abstraction Layer MissionRevision Number */ + + CFE_ES_MemOffset_t SysLogBytesUsed; /**< \cfetlmmnemonic \ES_SYSLOGBYTEUSED + \brief Total number of bytes used in system log */ + CFE_ES_MemOffset_t SysLogSize; /**< \cfetlmmnemonic \ES_SYSLOGSIZE + \brief Total size of the system log */ + uint32 SysLogEntries; /**< \cfetlmmnemonic \ES_SYSLOGENTRIES + \brief Number of entries in the system log */ + uint32 SysLogMode; /**< \cfetlmmnemonic \ES_SYSLOGMODE + \brief Write/Overwrite Mode */ + + uint32 ERLogIndex; /**< \cfetlmmnemonic \ES_ERLOGINDEX + \brief Current index of the ER Log (wraps around) */ + uint32 ERLogEntries; /**< \cfetlmmnemonic \ES_ERLOGENTRIES + \brief Number of entries made in the ER Log since the power on */ + + uint32 RegisteredCoreApps; /**< \cfetlmmnemonic \ES_REGCOREAPPS + \brief Number of Applications registered with ES */ + uint32 RegisteredExternalApps; /**< \cfetlmmnemonic \ES_REGEXTAPPS + \brief Number of Applications registered with ES */ + uint32 RegisteredTasks; /**< \cfetlmmnemonic \ES_REGTASKS + \brief Number of Tasks ( main AND child tasks ) registered with ES */ + uint32 RegisteredLibs; /**< \cfetlmmnemonic \ES_REGLIBS + \brief Number of Libraries registered with ES */ + + uint32 ResetType; /**< \cfetlmmnemonic \ES_RESETTYPE + \brief Reset type ( PROCESSOR or POWERON ) */ + uint32 ResetSubtype; /**< \cfetlmmnemonic \ES_RESETSUBTYPE + \brief Reset Sub Type */ + uint32 ProcessorResets; /**< \cfetlmmnemonic \ES_PROCRESETCNT + \brief Number of processor resets since last power on */ + uint32 MaxProcessorResets; /**< \cfetlmmnemonic \ES_MAXPROCRESETS + \brief Max processor resets before a power on is done */ + uint32 BootSource; /**< \cfetlmmnemonic \ES_BOOTSOURCE + \brief Boot source ( as provided from BSP ) */ + + uint32 PerfState; /**< \cfetlmmnemonic \ES_PERFSTATE + \brief Current state of Performance Analyzer */ + uint32 PerfMode; /**< \cfetlmmnemonic \ES_PERFMODE + \brief Current mode of Performance Analyzer */ + uint32 PerfTriggerCount; /**< \cfetlmmnemonic \ES_PERFTRIGCNT + \brief Number of Times Perfomance Analyzer has Triggered */ + uint32 PerfFilterMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFFLTRMASK + \brief Current Setting of Performance Analyzer Filter Masks */ + uint32 + PerfTriggerMask[CFE_MISSION_ES_PERF_MAX_IDS / 32]; /**< \cfetlmmnemonic \ES_PERFTRIGMASK + \brief Current Setting of Performance Analyzer Trigger Masks */ + uint32 PerfDataStart; /**< \cfetlmmnemonic \ES_PERFDATASTART + \brief Identifies First Stored Entry in Performance Analyzer Log */ + uint32 PerfDataEnd; /**< \cfetlmmnemonic \ES_PERFDATAEND + \brief Identifies Last Stored Entry in Performance Analyzer Log */ + uint32 PerfDataCount; /**< \cfetlmmnemonic \ES_PERFDATACNT + \brief Number of Entries Put Into the Performance Analyzer Log */ + uint32 + PerfDataToWrite; /**< \cfetlmmnemonic \ES_PERFDATA2WRITE \brief Number of Performance Analyzer Log Entries Left to be Written to Log Dump File */ - CFE_ES_MemOffset_t HeapBytesFree; /**< \cfetlmmnemonic \ES_HEAPBYTESFREE - \brief Number of free bytes remaining in the OS heap */ - CFE_ES_MemOffset_t HeapBlocksFree; /**< \cfetlmmnemonic \ES_HEAPBLKSFREE - \brief Number of free blocks remaining in the OS heap */ - CFE_ES_MemOffset_t HeapMaxBlockSize; /**< \cfetlmmnemonic \ES_HEAPMAXBLK - \brief Number of bytes in the largest free block */ + CFE_ES_MemOffset_t HeapBytesFree; /**< \cfetlmmnemonic \ES_HEAPBYTESFREE + \brief Number of free bytes remaining in the OS heap */ + CFE_ES_MemOffset_t HeapBlocksFree; /**< \cfetlmmnemonic \ES_HEAPBLKSFREE + \brief Number of free blocks remaining in the OS heap */ + CFE_ES_MemOffset_t HeapMaxBlockSize; /**< \cfetlmmnemonic \ES_HEAPMAXBLK + \brief Number of bytes in the largest free block */ } CFE_ES_HousekeepingTlm_Payload_t; typedef struct CFE_ES_HousekeepingTlm { CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ CFE_ES_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ - -} CFE_ES_HousekeepingTlm_t; +} CFE_ES_HousekeepingTlm_t; #endif /* _cfe_es_msg_ */ /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/es/fsw/src/cfe_es_api.c b/modules/es/fsw/src/cfe_es_api.c index a67a751ba..78f9a6491 100644 --- a/modules/es/fsw/src/cfe_es_api.c +++ b/modules/es/fsw/src/cfe_es_api.c @@ -38,27 +38,24 @@ */ #include "cfe_es_module_all.h" - #include #include #include - /* ** Function: CFE_ES_GetResetType - See API and header file for details */ int32 CFE_ES_GetResetType(uint32 *ResetSubtypePtr) { - if ( ResetSubtypePtr != NULL ) + if (ResetSubtypePtr != NULL) { - *ResetSubtypePtr = CFE_ES_ResetDataPtr->ResetVars.ResetSubtype; + *ResetSubtypePtr = CFE_ES_ResetDataPtr->ResetVars.ResetSubtype; } - return(CFE_ES_ResetDataPtr->ResetVars.ResetType); + return (CFE_ES_ResetDataPtr->ResetVars.ResetType); } /* End of CFE_ES_GetResetType() */ - /* ** Function: CFE_ES_ResetCFE - See API and header file for details */ @@ -66,92 +63,88 @@ int32 CFE_ES_ResetCFE(uint32 ResetType) { int32 ReturnCode; - if ( ResetType == CFE_PSP_RST_TYPE_PROCESSOR ) - { - /* - ** Increment the processor reset count - */ - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount++; - - /* - ** Before doing a Processor reset, check to see - ** if the maximum number has been exceeded - */ - if ( CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount > - CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount ) - { - CFE_ES_WriteToSysLog("POWER ON RESET due to max proc resets (Commanded).\n"); - - /* - ** Log the reset in the ER Log. The log will be wiped out, but it's good to have - ** the entry just in case something fails. - */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, - CFE_PSP_RST_SUBTYPE_RESET_COMMAND, - "POWER ON RESET due to max proc resets (Commanded)."); - /* - ** Call the BSP reset routine - */ - CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); - } - else - { - CFE_ES_WriteToSysLog("PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n"); - - /* - ** Update the reset variables - */ - CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = true; - - /* - ** Log the reset in the ER Log - */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_RESET_COMMAND, - "PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded)."); - /* - ** Call the BSP reset routine - */ - CFE_PSP_Restart(CFE_PSP_RST_TYPE_PROCESSOR); - - } /* end if */ - - /* - ** If the BSP routine is not implemented, - ** it will return. - */ - ReturnCode = CFE_ES_NOT_IMPLEMENTED; - } - else if ( ResetType == CFE_PSP_RST_TYPE_POWERON ) - { - CFE_ES_WriteToSysLog("POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n"); - - /* - ** Log the reset in the ER Log. The log will be wiped out, but it's good to have - ** the entry just in case something fails. - */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, - CFE_PSP_RST_SUBTYPE_RESET_COMMAND, - "POWERON RESET called from CFE_ES_ResetCFE (Commanded)."); - - /* - ** Call the BSP reset routine - */ - CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); - - /* - ** If the BSP routine is not implemented, - ** it will return. - */ - ReturnCode = CFE_ES_NOT_IMPLEMENTED; + if (ResetType == CFE_PSP_RST_TYPE_PROCESSOR) + { + /* + ** Increment the processor reset count + */ + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount++; + + /* + ** Before doing a Processor reset, check to see + ** if the maximum number has been exceeded + */ + if (CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount > CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount) + { + CFE_ES_WriteToSysLog("POWER ON RESET due to max proc resets (Commanded).\n"); + + /* + ** Log the reset in the ER Log. The log will be wiped out, but it's good to have + ** the entry just in case something fails. + */ + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_RESET_COMMAND, + "POWER ON RESET due to max proc resets (Commanded)."); + /* + ** Call the BSP reset routine + */ + CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); + } + else + { + CFE_ES_WriteToSysLog("PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded).\n"); + + /* + ** Update the reset variables + */ + CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = true; + + /* + ** Log the reset in the ER Log + */ + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_RESET_COMMAND, + "PROCESSOR RESET called from CFE_ES_ResetCFE (Commanded)."); + /* + ** Call the BSP reset routine + */ + CFE_PSP_Restart(CFE_PSP_RST_TYPE_PROCESSOR); + + } /* end if */ + + /* + ** If the BSP routine is not implemented, + ** it will return. + */ + ReturnCode = CFE_ES_NOT_IMPLEMENTED; + } + else if (ResetType == CFE_PSP_RST_TYPE_POWERON) + { + CFE_ES_WriteToSysLog("POWERON RESET called from CFE_ES_ResetCFE (Commanded).\n"); + + /* + ** Log the reset in the ER Log. The log will be wiped out, but it's good to have + ** the entry just in case something fails. + */ + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_RESET_COMMAND, + "POWERON RESET called from CFE_ES_ResetCFE (Commanded)."); + + /* + ** Call the BSP reset routine + */ + CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); + + /* + ** If the BSP routine is not implemented, + ** it will return. + */ + ReturnCode = CFE_ES_NOT_IMPLEMENTED; } else { - CFE_ES_WriteToSysLog("ES ResetCFE: Invalid Reset Type: %d.\n",(int)ResetType); - ReturnCode = CFE_ES_BAD_ARGUMENT; + CFE_ES_WriteToSysLog("ES ResetCFE: Invalid Reset Type: %d.\n", (int)ResetType); + ReturnCode = CFE_ES_BAD_ARGUMENT; } - return(ReturnCode); + return (ReturnCode); } /* End of CFE_ES_ResetCFE() */ @@ -160,63 +153,63 @@ int32 CFE_ES_ResetCFE(uint32 ResetType) */ int32 CFE_ES_RestartApp(CFE_ES_AppId_t AppID) { - int32 ReturnCode = CFE_SUCCESS; - os_fstat_t FileStatus; + int32 ReturnCode = CFE_SUCCESS; + os_fstat_t FileStatus; CFE_ES_AppRecord_t *AppRecPtr; AppRecPtr = CFE_ES_LocateAppRecordByID(AppID); - if ( AppRecPtr != NULL ) - { - - CFE_ES_LockSharedData(__func__,__LINE__); - - /* - ** Check to see if the App is an external cFE App. - */ - if ( AppRecPtr->Type == CFE_ES_AppType_CORE ) - { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_RestartApp: Cannot Restart a CORE Application: %s.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; - } - else if ( AppRecPtr->AppState != CFE_ES_AppState_RUNNING ) - { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; - } - else - { - /* - ** Check to see if the file exists - */ - if (OS_stat(AppRecPtr->StartParams.BasicInfo.FileName, &FileStatus) == OS_SUCCESS) - { - CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Restart Application %s Initiated\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; - } - else - { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_RestartApp: Cannot Restart Application %s, File %s does not exist.\n", - CFE_ES_AppRecordGetName(AppRecPtr), AppRecPtr->StartParams.BasicInfo.FileName); - ReturnCode = CFE_ES_FILE_IO_ERR; - } - - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); + if (AppRecPtr != NULL) + { + + CFE_ES_LockSharedData(__func__, __LINE__); + + /* + ** Check to see if the App is an external cFE App. + */ + if (AppRecPtr->Type == CFE_ES_AppType_CORE) + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Cannot Restart a CORE Application: %s.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; + } + else if (AppRecPtr->AppState != CFE_ES_AppState_RUNNING) + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; + } + else + { + /* + ** Check to see if the file exists + */ + if (OS_stat(AppRecPtr->StartParams.BasicInfo.FileName, &FileStatus) == OS_SUCCESS) + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Restart Application %s Initiated\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; + } + else + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Cannot Restart Application %s, File %s does not exist.\n", + CFE_ES_AppRecordGetName(AppRecPtr), + AppRecPtr->StartParams.BasicInfo.FileName); + ReturnCode = CFE_ES_FILE_IO_ERR; + } + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); } else /* App ID is not valid */ { - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; - CFE_ES_WriteToSysLog("CFE_ES_RestartApp: Invalid Application ID received, AppID = %lu\n", - CFE_RESOURCEID_TO_ULONG(AppID)); + CFE_ES_WriteToSysLog("CFE_ES_RestartApp: Invalid Application ID received, AppID = %lu\n", + CFE_RESOURCEID_TO_ULONG(AppID)); } /* end if */ - return(ReturnCode); + return (ReturnCode); } /* End of CFE_ES_RestartApp() */ @@ -225,57 +218,57 @@ int32 CFE_ES_RestartApp(CFE_ES_AppId_t AppID) */ int32 CFE_ES_ReloadApp(CFE_ES_AppId_t AppID, const char *AppFileName) { - int32 ReturnCode = CFE_SUCCESS; - os_fstat_t FileStatus; + int32 ReturnCode = CFE_SUCCESS; + os_fstat_t FileStatus; CFE_ES_AppRecord_t *AppRecPtr = CFE_ES_LocateAppRecordByID(AppID); - if ( AppRecPtr == NULL ) + if (AppRecPtr == NULL) { return CFE_ES_ERR_RESOURCEID_NOT_VALID; } - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* ** Check to see if the App is an external cFE App. */ - if ( AppRecPtr->Type == CFE_ES_AppType_CORE ) + if (AppRecPtr->Type == CFE_ES_AppType_CORE) { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Reload a CORE Application: %s.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; + CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Cannot Reload a CORE Application: %s.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } - else if ( AppRecPtr->AppState != CFE_ES_AppState_RUNNING ) + else if (AppRecPtr->AppState != CFE_ES_AppState_RUNNING) { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_ReloadApp: Cannot Reload Application %s, It is not running.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; + CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Cannot Reload Application %s, It is not running.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else { - /* - ** Check to see if the file exists - */ - if (OS_stat(AppFileName, &FileStatus) == OS_SUCCESS) - { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Reload Application %s Initiated. New filename = %s\n", - CFE_ES_AppRecordGetName(AppRecPtr), AppFileName); - strncpy(AppRecPtr->StartParams.BasicInfo.FileName, AppFileName, - sizeof(AppRecPtr->StartParams.BasicInfo.FileName)-1); - AppRecPtr->StartParams.BasicInfo.FileName[sizeof(AppRecPtr->StartParams.BasicInfo.FileName)-1] = 0; - AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - } - else - { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_ReloadApp: Cannot Reload Application %s, File %s does not exist.\n", - CFE_ES_AppRecordGetName(AppRecPtr), AppFileName); - ReturnCode = CFE_ES_FILE_IO_ERR; - } - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - return(ReturnCode); + /* + ** Check to see if the file exists + */ + if (OS_stat(AppFileName, &FileStatus) == OS_SUCCESS) + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Reload Application %s Initiated. New filename = %s\n", + CFE_ES_AppRecordGetName(AppRecPtr), AppFileName); + strncpy(AppRecPtr->StartParams.BasicInfo.FileName, AppFileName, + sizeof(AppRecPtr->StartParams.BasicInfo.FileName) - 1); + AppRecPtr->StartParams.BasicInfo.FileName[sizeof(AppRecPtr->StartParams.BasicInfo.FileName) - 1] = 0; + AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; + } + else + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Cannot Reload Application %s, File %s does not exist.\n", + CFE_ES_AppRecordGetName(AppRecPtr), AppFileName); + ReturnCode = CFE_ES_FILE_IO_ERR; + } + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); + + return (ReturnCode); } /* End of CFE_ES_ReloadApp() */ @@ -284,41 +277,41 @@ int32 CFE_ES_ReloadApp(CFE_ES_AppId_t AppID, const char *AppFileName) */ int32 CFE_ES_DeleteApp(CFE_ES_AppId_t AppID) { - int32 ReturnCode = CFE_SUCCESS; - CFE_ES_AppRecord_t *AppRecPtr = CFE_ES_LocateAppRecordByID(AppID); + int32 ReturnCode = CFE_SUCCESS; + CFE_ES_AppRecord_t *AppRecPtr = CFE_ES_LocateAppRecordByID(AppID); - if ( AppRecPtr == NULL ) + if (AppRecPtr == NULL) { return CFE_ES_ERR_RESOURCEID_NOT_VALID; } - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* ** Check to see if the App is an external cFE App. */ - if ( AppRecPtr->Type == CFE_ES_AppType_CORE ) + if (AppRecPtr->Type == CFE_ES_AppType_CORE) { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Delete a CORE Application: %s.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; + CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Cannot Delete a CORE Application: %s.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } - else if ( AppRecPtr->AppState != CFE_ES_AppState_RUNNING ) + else if (AppRecPtr->AppState != CFE_ES_AppState_RUNNING) { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Delete Application %s, It is not running.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; + CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Cannot Delete Application %s, It is not running.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else { - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Delete Application %s Initiated\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; + CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Delete Application %s Initiated\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(ReturnCode); + return (ReturnCode); } /* End of CFE_ES_DeleteApp() */ @@ -327,133 +320,127 @@ int32 CFE_ES_DeleteApp(CFE_ES_AppId_t AppID) */ void CFE_ES_ExitApp(uint32 ExitStatus) { - int32 ReturnCode; + int32 ReturnCode; CFE_ES_AppRecord_t *AppRecPtr; - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* - * This should only be called with a valid ExitStatus, anything else is invalid + * This should only be called with a valid ExitStatus, anything else is invalid * and indicates a bug in the caller. */ - if (ExitStatus == CFE_ES_RunStatus_UNDEFINED || - ExitStatus >= CFE_ES_RunStatus_MAX) + if (ExitStatus == CFE_ES_RunStatus_UNDEFINED || ExitStatus >= CFE_ES_RunStatus_MAX) { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp: Called with invalid status (%u).\n", - (unsigned int)ExitStatus); + CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp: Called with invalid status (%u).\n", (unsigned int)ExitStatus); /* revert to the ERROR status */ ExitStatus = CFE_ES_RunStatus_APP_ERROR; } AppRecPtr = CFE_ES_GetAppRecordByContext(); - if ( AppRecPtr != NULL ) - { - /* - * Set the status in the global table. - * - * The passed-in status should only be stored if there was no already-pending - * request from a ground command or other source, such as an exception, etc. - * - * If a control request is already pending, it is assumed that this exit is - * part of an orderly shutdown caused by that request, and therefore it - * should not be overwritten here. + if (AppRecPtr != NULL) + { + /* + * Set the status in the global table. + * + * The passed-in status should only be stored if there was no already-pending + * request from a ground command or other source, such as an exception, etc. + * + * If a control request is already pending, it is assumed that this exit is + * part of an orderly shutdown caused by that request, and therefore it + * should not be overwritten here. + */ + if (AppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_RUN) + { + AppRecPtr->ControlReq.AppControlRequest = ExitStatus; + } + + /* + ** Check to see if the App is an external cFE App. */ - if (AppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_RUN) - { - AppRecPtr->ControlReq.AppControlRequest = ExitStatus; - } - - /* - ** Check to see if the App is an external cFE App. - */ - if ( AppRecPtr->Type == CFE_ES_AppType_CORE ) - { - /* - ** A core app should only call this function with one of two ExitStatus codes. - */ - if ( ExitStatus == CFE_ES_RunStatus_CORE_APP_INIT_ERROR ) - { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - - /* - ** Unlock the ES Shared data before calling ResetCFE - */ - CFE_ES_UnlockSharedData(__func__,__LINE__); - - - /* - ** Do a Processor Reset the cFE - */ - ReturnCode = CFE_ES_ResetCFE(CFE_PSP_RST_TYPE_PROCESSOR); - - /* - ** The CFE_ES_ResetCFE function does not normally return, - ** but it may return during unit testing. If it does, - ** log the return code (even if it claims CFE_SUCCESS). - */ - CFE_ES_WriteToSysLog("CFE_ES_ExitApp: CORE Application Init Error Processor Reset, RC = 0x%08X\n", - (unsigned int) ReturnCode); - - return; - - } - else if ( ExitStatus == CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR ) - { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - - /* - ** Unlock the ES Shared data before killing the main task - */ - CFE_ES_UnlockSharedData(__func__,__LINE__); - - /* - ** Exit this task - */ - OS_TaskExit(); - - /* - ** Code will not return, except under unit test - */ - return; - } - else - { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp, Cannot Exit CORE Application %s\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - } - - } - else /* It is an external App */ - { - - CFE_ES_SysLogWrite_Unsync ("Application %s called CFE_ES_ExitApp\n", - CFE_ES_AppRecordGetName(AppRecPtr)); - - AppRecPtr->AppState = CFE_ES_AppState_STOPPED; - - /* - ** Unlock the ES Shared data before suspending the app - */ - CFE_ES_UnlockSharedData(__func__,__LINE__); - - /* - ** Suspend the Application until ES kills it. - ** It might be better to have a way of suspending the app in the OS - */ - while(1) - { - OS_TaskDelay(500); - } - - } /* end if */ - - } /* end if ReturnCode == CFE_SUCCESS */ - - CFE_ES_UnlockSharedData(__func__,__LINE__); + if (AppRecPtr->Type == CFE_ES_AppType_CORE) + { + /* + ** A core app should only call this function with one of two ExitStatus codes. + */ + if (ExitStatus == CFE_ES_RunStatus_CORE_APP_INIT_ERROR) + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + + /* + ** Unlock the ES Shared data before calling ResetCFE + */ + CFE_ES_UnlockSharedData(__func__, __LINE__); + + /* + ** Do a Processor Reset the cFE + */ + ReturnCode = CFE_ES_ResetCFE(CFE_PSP_RST_TYPE_PROCESSOR); + + /* + ** The CFE_ES_ResetCFE function does not normally return, + ** but it may return during unit testing. If it does, + ** log the return code (even if it claims CFE_SUCCESS). + */ + CFE_ES_WriteToSysLog("CFE_ES_ExitApp: CORE Application Init Error Processor Reset, RC = 0x%08X\n", + (unsigned int)ReturnCode); + + return; + } + else if (ExitStatus == CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR) + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + + /* + ** Unlock the ES Shared data before killing the main task + */ + CFE_ES_UnlockSharedData(__func__, __LINE__); + + /* + ** Exit this task + */ + OS_TaskExit(); + + /* + ** Code will not return, except under unit test + */ + return; + } + else + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitApp, Cannot Exit CORE Application %s\n", + CFE_ES_AppRecordGetName(AppRecPtr)); + } + } + else /* It is an external App */ + { + + CFE_ES_SysLogWrite_Unsync("Application %s called CFE_ES_ExitApp\n", CFE_ES_AppRecordGetName(AppRecPtr)); + + AppRecPtr->AppState = CFE_ES_AppState_STOPPED; + + /* + ** Unlock the ES Shared data before suspending the app + */ + CFE_ES_UnlockSharedData(__func__, __LINE__); + + /* + ** Suspend the Application until ES kills it. + ** It might be better to have a way of suspending the app in the OS + */ + while (1) + { + OS_TaskDelay(500); + } + + } /* end if */ + + } /* end if ReturnCode == CFE_SUCCESS */ + + CFE_ES_UnlockSharedData(__func__, __LINE__); } /* End of CFE_ES_ExitApp() */ @@ -462,7 +449,7 @@ void CFE_ES_ExitApp(uint32 ExitStatus) */ bool CFE_ES_RunLoop(uint32 *RunStatus) { - bool ReturnCode; + bool ReturnCode; CFE_ES_AppRecord_t *AppRecPtr; /* @@ -487,18 +474,18 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) * this function to be called with NULL, with the possibility of phasing this out * entirely. */ - if ( RunStatus != NULL && *RunStatus != CFE_ES_RunStatus_APP_RUN ) + if (RunStatus != NULL && *RunStatus != CFE_ES_RunStatus_APP_RUN) { return false; } - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* ** Get App Record */ AppRecPtr = CFE_ES_GetAppRecordByContext(); - if ( AppRecPtr != NULL ) + if (AppRecPtr != NULL) { /* ** App state must be RUNNING (no-op if already set to running) @@ -512,7 +499,7 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) * Check if the control request is also set to "RUN" * Anything else should also return false, so the the loop will exit. */ - if ( AppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_RUN ) + if (AppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_RUN) { ReturnCode = true; } @@ -538,9 +525,9 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) } /* end if Status == CFE_SUCCESS */ - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(ReturnCode); + return (ReturnCode); } /* End of CFE_ES_RunLoop() */ @@ -549,11 +536,11 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) */ int32 CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMilliseconds) { - int32 Status = CFE_SUCCESS; + int32 Status = CFE_SUCCESS; CFE_ES_AppRecord_t *AppRecPtr; - uint32 RequiredAppState; - uint32 WaitTime; - uint32 WaitRemaining; + uint32 RequiredAppState; + uint32 WaitTime; + uint32 WaitRemaining; /* * Calling app is assumed to have completed its own initialization up to the point @@ -561,13 +548,13 @@ int32 CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMillisecond * * Determine the implicit app state based on the system state it is indicating */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* ** Get App Record */ AppRecPtr = CFE_ES_GetAppRecordByContext(); - if ( AppRecPtr != NULL ) + if (AppRecPtr != NULL) { RequiredAppState = CFE_ES_AppState_EARLY_INIT; /* @@ -608,9 +595,8 @@ int32 CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMillisecond { AppRecPtr->AppState = RequiredAppState; } - } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); /* * Do the actual delay loop. @@ -658,37 +644,36 @@ void CFE_ES_WaitForStartupSync(uint32 TimeOutMilliseconds) */ int32 CFE_ES_RegisterApp(void) { - int32 Result; - - CFE_ES_LockSharedData(__func__,__LINE__); + int32 Result; - /* - ** Register the task - */ - Result = OS_TaskRegister(); + CFE_ES_LockSharedData(__func__, __LINE__); - if (Result == OS_SUCCESS) - { - Result = CFE_SUCCESS; - } - else - { - /* - ** Cannot create a syslog entry here because it requires the task to - ** be registered - */ - Result = CFE_ES_ERR_APP_REGISTER; - } + /* + ** Register the task + */ + Result = OS_TaskRegister(); - /* - ** Set the default exception environment - */ - CFE_PSP_SetDefaultExceptionEnvironment(); + if (Result == OS_SUCCESS) + { + Result = CFE_SUCCESS; + } + else + { + /* + ** Cannot create a syslog entry here because it requires the task to + ** be registered + */ + Result = CFE_ES_ERR_APP_REGISTER; + } - CFE_ES_UnlockSharedData(__func__,__LINE__); + /* + ** Set the default exception environment + */ + CFE_PSP_SetDefaultExceptionEnvironment(); - return(Result); + CFE_ES_UnlockSharedData(__func__, __LINE__); + return (Result); } /* End of CFE_ES_RegisterApp() */ @@ -698,14 +683,14 @@ int32 CFE_ES_RegisterApp(void) int32 CFE_ES_GetAppIDByName(CFE_ES_AppId_t *AppIdPtr, const char *AppName) { CFE_ES_AppRecord_t *AppRecPtr; - int32 Result; + int32 Result; if (AppName == NULL || AppIdPtr == NULL) { return CFE_ES_BAD_ARGUMENT; } - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); AppRecPtr = CFE_ES_LocateAppRecordByName(AppName); if (AppRecPtr == NULL) @@ -714,18 +699,18 @@ int32 CFE_ES_GetAppIDByName(CFE_ES_AppId_t *AppIdPtr, const char *AppName) * ensure the output value is set to a safe value, * in case the does not check the return code. */ - Result = CFE_ES_ERR_NAME_NOT_FOUND; + Result = CFE_ES_ERR_NAME_NOT_FOUND; *AppIdPtr = CFE_ES_APPID_UNDEFINED; } else { - Result = CFE_SUCCESS; + Result = CFE_SUCCESS; *AppIdPtr = CFE_ES_AppRecordGetID(AppRecPtr); } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(Result); + return (Result); } /* End of CFE_ES_GetAppIDByName() */ @@ -735,14 +720,14 @@ int32 CFE_ES_GetAppIDByName(CFE_ES_AppId_t *AppIdPtr, const char *AppName) int32 CFE_ES_GetLibIDByName(CFE_ES_LibId_t *LibIdPtr, const char *LibName) { CFE_ES_LibRecord_t *LibRecPtr; - int32 Result; + int32 Result; if (LibName == NULL || LibIdPtr == NULL) { return CFE_ES_BAD_ARGUMENT; } - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); LibRecPtr = CFE_ES_LocateLibRecordByName(LibName); if (LibRecPtr == NULL) @@ -751,18 +736,18 @@ int32 CFE_ES_GetLibIDByName(CFE_ES_LibId_t *LibIdPtr, const char *LibName) * ensure the output value is set to a safe value, * in case the does not check the return code. */ - Result = CFE_ES_ERR_NAME_NOT_FOUND; + Result = CFE_ES_ERR_NAME_NOT_FOUND; *LibIdPtr = CFE_ES_LIBID_UNDEFINED; } else { - Result = CFE_SUCCESS; + Result = CFE_SUCCESS; *LibIdPtr = CFE_ES_LibRecordGetID(LibRecPtr); } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(Result); + return (Result); } /* End of CFE_ES_GetLibIDByName() */ /* @@ -770,8 +755,8 @@ int32 CFE_ES_GetLibIDByName(CFE_ES_LibId_t *LibIdPtr, const char *LibName) */ CFE_Status_t CFE_ES_GetTaskIDByName(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName) { - osal_id_t OsalId; - int32 Status; + osal_id_t OsalId; + int32 Status; CFE_Status_t Result; if (TaskName == NULL || TaskIdPtr == NULL) @@ -783,45 +768,44 @@ CFE_Status_t CFE_ES_GetTaskIDByName(CFE_ES_TaskId_t *TaskIdPtr, const char *Task Status = OS_TaskGetIdByName(&OsalId, TaskName); if (Status == OS_SUCCESS) { - Result = CFE_SUCCESS; + Result = CFE_SUCCESS; *TaskIdPtr = CFE_ES_TaskId_FromOSAL(OsalId); } else { - Result = CFE_ES_ERR_NAME_NOT_FOUND; + Result = CFE_ES_ERR_NAME_NOT_FOUND; *TaskIdPtr = CFE_ES_TASKID_UNDEFINED; } - return(Result); + return (Result); } /* End of CFE_ES_GetTaskIDByName() */ - /* ** Function: CFE_ES_GetAppID - See API and header file for details */ int32 CFE_ES_GetAppID(CFE_ES_AppId_t *AppIdPtr) { - CFE_ES_AppRecord_t *AppRecPtr; - int32 Result; + CFE_ES_AppRecord_t *AppRecPtr; + int32 Result; - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); - AppRecPtr = CFE_ES_GetAppRecordByContext(); + AppRecPtr = CFE_ES_GetAppRecordByContext(); - if (AppRecPtr != NULL) - { - *AppIdPtr = CFE_ES_AppRecordGetID(AppRecPtr); - Result = CFE_SUCCESS; - } - else - { - *AppIdPtr = CFE_ES_APPID_UNDEFINED; - Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; - } + if (AppRecPtr != NULL) + { + *AppIdPtr = CFE_ES_AppRecordGetID(AppRecPtr); + Result = CFE_SUCCESS; + } + else + { + *AppIdPtr = CFE_ES_APPID_UNDEFINED; + Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; + } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(Result); + return (Result); } /* End of CFE_ES_GetAppID() */ @@ -830,22 +814,22 @@ int32 CFE_ES_GetAppID(CFE_ES_AppId_t *AppIdPtr) */ int32 CFE_ES_GetTaskID(CFE_ES_TaskId_t *TaskIdPtr) { - int32 Result; + int32 Result; CFE_ES_TaskRecord_t *TaskRecPtr; - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); TaskRecPtr = CFE_ES_GetTaskRecordByContext(); if (TaskRecPtr == NULL) { *TaskIdPtr = CFE_ES_TASKID_UNDEFINED; - Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; + Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else { *TaskIdPtr = CFE_ES_TaskRecordGetID(TaskRecPtr); - Result = CFE_SUCCESS; + Result = CFE_SUCCESS; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); return Result; } @@ -854,40 +838,40 @@ int32 CFE_ES_GetTaskID(CFE_ES_TaskId_t *TaskIdPtr) */ int32 CFE_ES_GetAppName(char *AppName, CFE_ES_AppId_t AppId, size_t BufferLength) { - int32 Result; - CFE_ES_AppRecord_t *AppRecPtr; + int32 Result; + CFE_ES_AppRecord_t *AppRecPtr; - if (BufferLength == 0 || AppName == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } + if (BufferLength == 0 || AppName == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } - /* - ** Get App Record - */ - AppRecPtr = CFE_ES_LocateAppRecordByID(AppId); + /* + ** Get App Record + */ + AppRecPtr = CFE_ES_LocateAppRecordByID(AppId); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); - /* - * confirm that the app record is a match, - * which must be done while locked. - */ - if (CFE_ES_AppRecordIsMatch(AppRecPtr, AppId)) - { - strncpy(AppName, CFE_ES_AppRecordGetName(AppRecPtr), BufferLength - 1); - AppName[BufferLength - 1] = '\0'; - Result = CFE_SUCCESS; - } - else - { - AppName[0] = 0; - Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - return(Result); + /* + * confirm that the app record is a match, + * which must be done while locked. + */ + if (CFE_ES_AppRecordIsMatch(AppRecPtr, AppId)) + { + strncpy(AppName, CFE_ES_AppRecordGetName(AppRecPtr), BufferLength - 1); + AppName[BufferLength - 1] = '\0'; + Result = CFE_SUCCESS; + } + else + { + AppName[0] = 0; + Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); + + return (Result); } /* End of CFE_ES_GetAppName() */ @@ -896,40 +880,40 @@ int32 CFE_ES_GetAppName(char *AppName, CFE_ES_AppId_t AppId, size_t BufferLength */ int32 CFE_ES_GetLibName(char *LibName, CFE_ES_LibId_t LibId, size_t BufferLength) { - int32 Result; - CFE_ES_LibRecord_t *LibRecPtr; + int32 Result; + CFE_ES_LibRecord_t *LibRecPtr; - if (BufferLength == 0 || LibName == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } + if (BufferLength == 0 || LibName == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } - /* - ** Get Lib Record - */ - LibRecPtr = CFE_ES_LocateLibRecordByID(LibId); + /* + ** Get Lib Record + */ + LibRecPtr = CFE_ES_LocateLibRecordByID(LibId); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); - /* - * confirm that the Lib record is a match, - * which must be done while locked. - */ - if (CFE_ES_LibRecordIsMatch(LibRecPtr, LibId)) - { - strncpy(LibName, CFE_ES_LibRecordGetName(LibRecPtr), BufferLength - 1); - LibName[BufferLength - 1] = '\0'; - Result = CFE_SUCCESS; - } - else - { - LibName[0] = 0; - Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - return(Result); + /* + * confirm that the Lib record is a match, + * which must be done while locked. + */ + if (CFE_ES_LibRecordIsMatch(LibRecPtr, LibId)) + { + strncpy(LibName, CFE_ES_LibRecordGetName(LibRecPtr), BufferLength - 1); + LibName[BufferLength - 1] = '\0'; + Result = CFE_SUCCESS; + } + else + { + LibName[0] = 0; + Result = CFE_ES_ERR_RESOURCEID_NOT_VALID; + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); + + return (Result); } /* End of CFE_ES_GetLibName() */ @@ -938,31 +922,31 @@ int32 CFE_ES_GetLibName(char *LibName, CFE_ES_LibId_t LibId, size_t BufferLength */ int32 CFE_ES_GetTaskName(char *TaskName, CFE_ES_TaskId_t TaskId, size_t BufferLength) { - int32 Result; - osal_id_t OsalId; + int32 Result; + osal_id_t OsalId; - if (BufferLength == 0 || TaskName == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } + if (BufferLength == 0 || TaskName == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } - if (!CFE_RESOURCEID_TEST_DEFINED(TaskId)) - { - return CFE_ES_ERR_RESOURCEID_NOT_VALID; - } + if (!CFE_RESOURCEID_TEST_DEFINED(TaskId)) + { + return CFE_ES_ERR_RESOURCEID_NOT_VALID; + } - /* - * Query OSAL to get the task name - */ - OsalId = CFE_ES_TaskId_ToOSAL(TaskId); - Result = OS_GetResourceName(OsalId, TaskName, BufferLength); + /* + * Query OSAL to get the task name + */ + OsalId = CFE_ES_TaskId_ToOSAL(TaskId); + Result = OS_GetResourceName(OsalId, TaskName, BufferLength); - if (Result != OS_SUCCESS) - { - return CFE_ES_ERR_RESOURCEID_NOT_VALID; - } + if (Result != OS_SUCCESS) + { + return CFE_ES_ERR_RESOURCEID_NOT_VALID; + } - return CFE_SUCCESS; + return CFE_SUCCESS; } /* End of CFE_ES_GetTaskName() */ @@ -971,95 +955,91 @@ int32 CFE_ES_GetTaskName(char *TaskName, CFE_ES_TaskId_t TaskId, size_t BufferLe */ int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId) { - CFE_ES_AppRecord_t *AppRecPtr; - CFE_ES_TaskRecord_t *TaskRecPtr; - int32 Status; - osal_id_t ModuleId; - uint32 i; + CFE_ES_AppRecord_t * AppRecPtr; + CFE_ES_TaskRecord_t *TaskRecPtr; + int32 Status; + osal_id_t ModuleId; + uint32 i; - if ( AppInfo == NULL ) - { - CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: Invalid Parameter ( Null Pointer )\n"); - return CFE_ES_ERR_BUFFER; - } + if (AppInfo == NULL) + { + CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: Invalid Parameter ( Null Pointer )\n"); + return CFE_ES_ERR_BUFFER; + } + + memset(AppInfo, 0, sizeof(*AppInfo)); + ModuleId = OS_OBJECT_ID_UNDEFINED; + + AppRecPtr = CFE_ES_LocateAppRecordByID(AppId); + + CFE_ES_LockSharedData(__func__, __LINE__); - memset(AppInfo, 0, sizeof(*AppInfo)); - ModuleId = OS_OBJECT_ID_UNDEFINED; + if (!CFE_ES_AppRecordIsMatch(AppRecPtr, AppId)) + { + /* + * Log a message if called with an invalid ID. + */ + CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: App ID not active: %lu\n", CFE_RESOURCEID_TO_ULONG(AppId)); - AppRecPtr = CFE_ES_LocateAppRecordByID(AppId); + Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; + } + else + { + AppInfo->ResourceId = CFE_RESOURCEID_UNWRAP(AppId); /* make into a generic resource ID */ + AppInfo->Type = AppRecPtr->Type; - CFE_ES_LockSharedData(__func__,__LINE__); + strncpy(AppInfo->Name, CFE_ES_AppRecordGetName(AppRecPtr), sizeof(AppInfo->Name) - 1); - if ( !CFE_ES_AppRecordIsMatch(AppRecPtr, AppId) ) - { - /* - * Log a message if called with an invalid ID. + CFE_ES_CopyModuleBasicInfo(&AppRecPtr->StartParams.BasicInfo, AppInfo); + CFE_ES_CopyModuleStatusInfo(&AppRecPtr->LoadStatus, AppInfo); + + AppInfo->ExceptionAction = AppRecPtr->StartParams.ExceptionAction; + AppInfo->MainTaskId = AppRecPtr->MainTaskId; + + ModuleId = AppRecPtr->LoadStatus.ModuleId; + + /* + ** Calculate the number of child tasks */ - CFE_ES_WriteToSysLog("CFE_ES_GetAppInfo: App ID not active: %lu\n", - CFE_RESOURCEID_TO_ULONG(AppId)); - - Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; - } - else - { - AppInfo->ResourceId = CFE_RESOURCEID_UNWRAP(AppId); /* make into a generic resource ID */ - AppInfo->Type = AppRecPtr->Type; - - strncpy(AppInfo->Name, CFE_ES_AppRecordGetName(AppRecPtr), sizeof(AppInfo->Name)-1); - - CFE_ES_CopyModuleBasicInfo(&AppRecPtr->StartParams.BasicInfo, AppInfo); - CFE_ES_CopyModuleStatusInfo(&AppRecPtr->LoadStatus, AppInfo); - - AppInfo->ExceptionAction = AppRecPtr->StartParams.ExceptionAction; - AppInfo->MainTaskId = AppRecPtr->MainTaskId; - - ModuleId = AppRecPtr->LoadStatus.ModuleId; - - /* - ** Calculate the number of child tasks - */ - AppInfo->NumOfChildTasks = 0; - TaskRecPtr = CFE_ES_Global.TaskTable; - for (i=0; iAppId, AppId)) - { - if (CFE_RESOURCEID_TEST_EQUAL(CFE_ES_TaskRecordGetID(TaskRecPtr), AppInfo->MainTaskId)) - { - /* This is the main task - capture its name and execution count */ - AppInfo->ExecutionCounter = TaskRecPtr->ExecutionCounter; - strncpy(AppInfo->MainTaskName, TaskRecPtr->TaskName, - sizeof(AppInfo->MainTaskName) - 1); - AppInfo->MainTaskName[sizeof(AppInfo->MainTaskName) - 1] = '\0'; - - AppInfo->StackSize = TaskRecPtr->StartParams.StackSize; - AppInfo->Priority = TaskRecPtr->StartParams.Priority; - - } - else - { - /* This is a child task, no extra info, just increment count */ - ++AppInfo->NumOfChildTasks; - } - } - ++TaskRecPtr; - } - - Status = CFE_SUCCESS; - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - /* - ** Get the address information from the OSAL - */ - if (Status == CFE_SUCCESS) - { - CFE_ES_CopyModuleAddressInfo(ModuleId, AppInfo); - } - - return Status; + AppInfo->NumOfChildTasks = 0; + TaskRecPtr = CFE_ES_Global.TaskTable; + for (i = 0; i < OS_MAX_TASKS; i++) + { + if (CFE_ES_TaskRecordIsUsed(TaskRecPtr) && CFE_RESOURCEID_TEST_EQUAL(TaskRecPtr->AppId, AppId)) + { + if (CFE_RESOURCEID_TEST_EQUAL(CFE_ES_TaskRecordGetID(TaskRecPtr), AppInfo->MainTaskId)) + { + /* This is the main task - capture its name and execution count */ + AppInfo->ExecutionCounter = TaskRecPtr->ExecutionCounter; + strncpy(AppInfo->MainTaskName, TaskRecPtr->TaskName, sizeof(AppInfo->MainTaskName) - 1); + AppInfo->MainTaskName[sizeof(AppInfo->MainTaskName) - 1] = '\0'; + + AppInfo->StackSize = TaskRecPtr->StartParams.StackSize; + AppInfo->Priority = TaskRecPtr->StartParams.Priority; + } + else + { + /* This is a child task, no extra info, just increment count */ + ++AppInfo->NumOfChildTasks; + } + } + ++TaskRecPtr; + } + + Status = CFE_SUCCESS; + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); + + /* + ** Get the address information from the OSAL + */ + if (Status == CFE_SUCCESS) + { + CFE_ES_CopyModuleAddressInfo(ModuleId, AppInfo); + } + + return Status; } /* @@ -1067,14 +1047,14 @@ int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId) */ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId) { - int32 Status; + int32 Status; CFE_ES_LibRecord_t *LibRecPtr; - osal_id_t ModuleId; + osal_id_t ModuleId; - if ( LibInfo == NULL ) + if (LibInfo == NULL) { - CFE_ES_WriteToSysLog("CFE_ES_GetLibInfo: Invalid Parameter ( Null Pointer )\n"); - return CFE_ES_ERR_BUFFER; + CFE_ES_WriteToSysLog("CFE_ES_GetLibInfo: Invalid Parameter ( Null Pointer )\n"); + return CFE_ES_ERR_BUFFER; } memset(LibInfo, 0, sizeof(*LibInfo)); @@ -1082,24 +1062,23 @@ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId) LibRecPtr = CFE_ES_LocateLibRecordByID(LibId); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); - if ( !CFE_ES_LibRecordIsMatch(LibRecPtr, LibId) ) + if (!CFE_ES_LibRecordIsMatch(LibRecPtr, LibId)) { /* * Log a message if called with an invalid ID. */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_GetLibInfo: Lib ID not active: %lu\n", - CFE_RESOURCEID_TO_ULONG(LibId)); + CFE_ES_SysLogWrite_Unsync("CFE_ES_GetLibInfo: Lib ID not active: %lu\n", CFE_RESOURCEID_TO_ULONG(LibId)); Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; } else { LibInfo->ResourceId = CFE_RESOURCEID_UNWRAP(LibId); /* make into generic ID */ - LibInfo->Type = CFE_ES_AppType_LIBRARY; + LibInfo->Type = CFE_ES_AppType_LIBRARY; - strncpy(LibInfo->Name, CFE_ES_LibRecordGetName(LibRecPtr), sizeof(LibInfo->Name)-1); + strncpy(LibInfo->Name, CFE_ES_LibRecordGetName(LibRecPtr), sizeof(LibInfo->Name) - 1); CFE_ES_CopyModuleBasicInfo(&LibRecPtr->LoadParams, LibInfo); CFE_ES_CopyModuleStatusInfo(&LibRecPtr->LoadStatus, LibInfo); @@ -1109,7 +1088,7 @@ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId) Status = CFE_SUCCESS; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); /* ** Get the address information from the OSAL @@ -1129,26 +1108,25 @@ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t Resour { int32 Status; - switch(CFE_ResourceId_GetBase(ResourceId)) + switch (CFE_ResourceId_GetBase(ResourceId)) { - case CFE_ES_APPID_BASE: - Status = CFE_ES_GetAppInfo(ModuleInfo, CFE_ES_APPID_C(ResourceId)); - break; - case CFE_ES_LIBID_BASE: - Status = CFE_ES_GetLibInfo(ModuleInfo, CFE_ES_LIBID_C(ResourceId)); - break; - default: - /* - * Log a message if called with an invalid ID. - */ - CFE_ES_WriteToSysLog("CFE_ES_GetModuleInfo: Resource ID not valid: %lu\n", - CFE_ResourceId_ToInteger(ResourceId)); - Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; - break; - + case CFE_ES_APPID_BASE: + Status = CFE_ES_GetAppInfo(ModuleInfo, CFE_ES_APPID_C(ResourceId)); + break; + case CFE_ES_LIBID_BASE: + Status = CFE_ES_GetLibInfo(ModuleInfo, CFE_ES_LIBID_C(ResourceId)); + break; + default: + /* + * Log a message if called with an invalid ID. + */ + CFE_ES_WriteToSysLog("CFE_ES_GetModuleInfo: Resource ID not valid: %lu\n", + CFE_ResourceId_ToInteger(ResourceId)); + Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; + break; } - return(Status); + return (Status); } /* End of CFE_ES_GetModuleInfo() */ @@ -1158,10 +1136,10 @@ int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t Resour int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId) { CFE_ES_TaskRecord_t *TaskRecPtr; - CFE_ES_AppRecord_t *AppRecPtr; - int32 Status; + CFE_ES_AppRecord_t * AppRecPtr; + int32 Status; - if ( TaskInfo == NULL ) + if (TaskInfo == NULL) { CFE_ES_WriteToSysLog("CFE_ES_GetTaskInfo: Invalid Parameter ( Null Pointer )\n"); return CFE_ES_ERR_BUFFER; @@ -1171,14 +1149,13 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId) TaskRecPtr = CFE_ES_LocateTaskRecordByID(TaskId); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); - if ( !CFE_ES_TaskRecordIsMatch(TaskRecPtr, TaskId) ) + if (!CFE_ES_TaskRecordIsMatch(TaskRecPtr, TaskId)) { /* task ID is bad */ Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; - CFE_ES_SysLogWrite_Unsync("CFE_ES_GetTaskInfo: Task ID Not Active: %lu\n", - CFE_RESOURCEID_TO_ULONG(TaskId)); + CFE_ES_SysLogWrite_Unsync("CFE_ES_GetTaskInfo: Task ID Not Active: %lu\n", CFE_RESOURCEID_TO_ULONG(TaskId)); } else { @@ -1187,10 +1164,8 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId) ** Get the Application ID and Task Name */ TaskInfo->AppId = TaskRecPtr->AppId; - strncpy(TaskInfo->TaskName, - CFE_ES_TaskRecordGetName(TaskRecPtr), - sizeof(TaskInfo->TaskName)-1); - TaskInfo->TaskName[sizeof(TaskInfo->TaskName)-1] = '\0'; + strncpy(TaskInfo->TaskName, CFE_ES_TaskRecordGetName(TaskRecPtr), sizeof(TaskInfo->TaskName) - 1); + TaskInfo->TaskName[sizeof(TaskInfo->TaskName) - 1] = '\0'; /* ** Store away the Task ID ( for the QueryAllTasks Cmd ) @@ -1200,9 +1175,9 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId) /* ** Get the other stats for the task */ - TaskInfo->ExecutionCounter = TaskRecPtr->ExecutionCounter; - TaskInfo->StackSize = TaskRecPtr->StartParams.StackSize; - TaskInfo->Priority = TaskRecPtr->StartParams.Priority; + TaskInfo->ExecutionCounter = TaskRecPtr->ExecutionCounter; + TaskInfo->StackSize = TaskRecPtr->StartParams.StackSize; + TaskInfo->Priority = TaskRecPtr->StartParams.Priority; /* ** Get the Application Details @@ -1210,11 +1185,9 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId) AppRecPtr = CFE_ES_LocateAppRecordByID(TaskRecPtr->AppId); if (CFE_ES_AppRecordIsMatch(AppRecPtr, TaskRecPtr->AppId)) { - strncpy(TaskInfo->AppName, - CFE_ES_AppRecordGetName(AppRecPtr), - sizeof(TaskInfo->AppName)-1); - TaskInfo->AppName[sizeof(TaskInfo->AppName)-1] = '\0'; - Status = CFE_SUCCESS; + strncpy(TaskInfo->AppName, CFE_ES_AppRecordGetName(AppRecPtr), sizeof(TaskInfo->AppName) - 1); + TaskInfo->AppName[sizeof(TaskInfo->AppName) - 1] = '\0'; + Status = CFE_SUCCESS; } else { @@ -1223,23 +1196,18 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t TaskId) } } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(Status); + return (Status); } /* End of CFE_ES_GetTaskInfo() */ - /* ** Function: CFE_ES_CreateChildTask - See API and header file for details */ -int32 CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, - const char *TaskName, - CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, - CFE_ES_StackPointer_t StackPtr, - size_t StackSize, - CFE_ES_TaskPriority_Atom_t Priority, - uint32 Flags) +int32 CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, + CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, CFE_ES_StackPointer_t StackPtr, + size_t StackSize, CFE_ES_TaskPriority_Atom_t Priority, uint32 Flags) { int32 ReturnCode; CFE_ES_AppRecord_t * AppRecPtr; @@ -1328,43 +1296,42 @@ int32 CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, } /* End of CFE_ES_CreateChildTask() */ - /* ** Function: CFE_ES_RegisterChildTask - See API and header file for details */ int32 CFE_ES_RegisterChildTask(void) { - int32 Result; - int32 ReturnCode; - - CFE_ES_LockSharedData(__func__,__LINE__); - - /* - ** Register the task with the OS - */ - Result = OS_TaskRegister(); - - if (Result != OS_SUCCESS) - { - /* - ** Cannot create a syslog entry here because it requires the task to - ** be registered - */ - ReturnCode = CFE_ES_ERR_CHILD_TASK_REGISTER; - } - else - { - ReturnCode = CFE_SUCCESS; - } - - /* - ** Set the default exception environment - */ - CFE_PSP_SetDefaultExceptionEnvironment(); - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - return(ReturnCode); + int32 Result; + int32 ReturnCode; + + CFE_ES_LockSharedData(__func__, __LINE__); + + /* + ** Register the task with the OS + */ + Result = OS_TaskRegister(); + + if (Result != OS_SUCCESS) + { + /* + ** Cannot create a syslog entry here because it requires the task to + ** be registered + */ + ReturnCode = CFE_ES_ERR_CHILD_TASK_REGISTER; + } + else + { + ReturnCode = CFE_SUCCESS; + } + + /* + ** Set the default exception environment + */ + CFE_PSP_SetDefaultExceptionEnvironment(); + + CFE_ES_UnlockSharedData(__func__, __LINE__); + + return (ReturnCode); } /* End of CFE_ES_RegisterChildTask() */ @@ -1374,7 +1341,7 @@ int32 CFE_ES_RegisterChildTask(void) void CFE_ES_IncrementTaskCounter(void) { CFE_ES_TaskRecord_t *TaskRecPtr; - CFE_ES_TaskId_t TaskID; + CFE_ES_TaskId_t TaskID; /* * Note this locates a task record but intentionally does _not_ @@ -1387,7 +1354,7 @@ void CFE_ES_IncrementTaskCounter(void) * Because the global data is not locked, only minimal validation * is performed. */ - TaskID = CFE_ES_TaskId_FromOSAL(OS_TaskGetId()); + TaskID = CFE_ES_TaskId_FromOSAL(OS_TaskGetId()); TaskRecPtr = CFE_ES_LocateTaskRecordByID(TaskID); if (TaskRecPtr != NULL) { @@ -1396,20 +1363,18 @@ void CFE_ES_IncrementTaskCounter(void) } /* End of CFE_ES_IncrementTaskCounter() */ - - /* ** Function: CFE_ES_DeleteChildTask - See API and header file for details */ int32 CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId) { CFE_ES_TaskRecord_t *TaskRecPtr; - CFE_ES_AppRecord_t *AppRecPtr; - uint32 i; - bool TaskIsMain; - int32 ReturnCode = CFE_SUCCESS; - int32 OSReturnCode; - osal_id_t OsalId; + CFE_ES_AppRecord_t * AppRecPtr; + uint32 i; + bool TaskIsMain; + int32 ReturnCode = CFE_SUCCESS; + int32 OSReturnCode; + osal_id_t OsalId; /* ** Make sure the task ID is within range @@ -1417,99 +1382,97 @@ int32 CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId) TaskRecPtr = CFE_ES_LocateTaskRecordByID(TaskId); if (TaskRecPtr != NULL) { - CFE_ES_LockSharedData(__func__,__LINE__); - - /* - ** Make sure the task is active/valid - */ - if (CFE_ES_TaskRecordIsMatch(TaskRecPtr, TaskId)) - { - /* - ** Search for this task ID in the ES App Table to make sure - ** it is not a cFE App Main Task - */ - TaskIsMain = false; - AppRecPtr = CFE_ES_Global.AppTable; - for ( i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++ ) - { - if ( CFE_ES_AppRecordIsUsed(AppRecPtr) ) - { - if ( CFE_RESOURCEID_TEST_EQUAL(AppRecPtr->MainTaskId, TaskId) ) + CFE_ES_LockSharedData(__func__, __LINE__); + + /* + ** Make sure the task is active/valid + */ + if (CFE_ES_TaskRecordIsMatch(TaskRecPtr, TaskId)) + { + /* + ** Search for this task ID in the ES App Table to make sure + ** it is not a cFE App Main Task + */ + TaskIsMain = false; + AppRecPtr = CFE_ES_Global.AppTable; + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) + { + if (CFE_ES_AppRecordIsUsed(AppRecPtr)) { - /* - ** Error, the task Id is an App Main Task ID - */ - TaskIsMain = true; - break; - } /* end if */ - } /* end if */ - ++AppRecPtr; - } /* end for */ - - if ( TaskIsMain == false ) - { - /* - ** Can delete the Task - */ - OsalId = CFE_ES_TaskId_ToOSAL(TaskId); - OSReturnCode = OS_TaskDelete(OsalId); - if ( OSReturnCode == OS_SUCCESS ) - { + if (CFE_RESOURCEID_TEST_EQUAL(AppRecPtr->MainTaskId, TaskId)) + { + /* + ** Error, the task Id is an App Main Task ID + */ + TaskIsMain = true; + break; + } /* end if */ + } /* end if */ + ++AppRecPtr; + } /* end for */ + + if (TaskIsMain == false) + { /* - ** Invalidate the task table entry + ** Can delete the Task */ - CFE_ES_TaskRecordSetFree(TaskRecPtr); - CFE_ES_Global.RegisteredTasks--; - + OsalId = CFE_ES_TaskId_ToOSAL(TaskId); + OSReturnCode = OS_TaskDelete(OsalId); + if (OSReturnCode == OS_SUCCESS) + { + /* + ** Invalidate the task table entry + */ + CFE_ES_TaskRecordSetFree(TaskRecPtr); + CFE_ES_Global.RegisteredTasks--; + + /* + ** Report the task delete + */ + CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Task %lu Deleted\n", + CFE_RESOURCEID_TO_ULONG(TaskId)); + ReturnCode = CFE_SUCCESS; + } + else + { + CFE_ES_SysLogWrite_Unsync( + "CFE_ES_DeleteChildTask Error: Error Calling OS_TaskDelete: Task %lu, RC = 0x%08X\n", + CFE_RESOURCEID_TO_ULONG(TaskId), (unsigned int)OSReturnCode); + ReturnCode = CFE_ES_ERR_CHILD_TASK_DELETE; + } + } + else + { /* - ** Report the task delete + ** Error: The task is a cFE Application Main task */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Task %lu Deleted\n", - CFE_RESOURCEID_TO_ULONG(TaskId)); - ReturnCode = CFE_SUCCESS; - } - else - { - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Error Calling OS_TaskDelete: Task %lu, RC = 0x%08X\n", - CFE_RESOURCEID_TO_ULONG(TaskId), (unsigned int)OSReturnCode); - ReturnCode = CFE_ES_ERR_CHILD_TASK_DELETE; - } - } - else - { - /* - ** Error: The task is a cFE Application Main task - */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Task %lu is a cFE Main Task.\n", - CFE_RESOURCEID_TO_ULONG(TaskId)); - ReturnCode = CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK; - } /* end if TaskMain == false */ - } - else - { - /* - ** Task ID is not in use, so it is invalid - */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Task ID is not active: %lu\n", - CFE_RESOURCEID_TO_ULONG(TaskId)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; - - } /* end if */ + CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Task %lu is a cFE Main Task.\n", + CFE_RESOURCEID_TO_ULONG(TaskId)); + ReturnCode = CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK; + } /* end if TaskMain == false */ + } + else + { + /* + ** Task ID is not in use, so it is invalid + */ + CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Task ID is not active: %lu\n", + CFE_RESOURCEID_TO_ULONG(TaskId)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; - CFE_ES_UnlockSharedData(__func__,__LINE__); + } /* end if */ + CFE_ES_UnlockSharedData(__func__, __LINE__); } else { - /* - ** Task ID is invalid ( too large ) - */ - CFE_ES_WriteToSysLog("CFE_ES_DeleteChildTask Error: Invalid Task ID: %lu\n", - CFE_RESOURCEID_TO_ULONG(TaskId)); - ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; - + /* + ** Task ID is invalid ( too large ) + */ + CFE_ES_WriteToSysLog("CFE_ES_DeleteChildTask Error: Invalid Task ID: %lu\n", CFE_RESOURCEID_TO_ULONG(TaskId)); + ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID; } - return(ReturnCode); + return (ReturnCode); } /* End of CFE_ES_DeleteTask() */ @@ -1521,32 +1484,30 @@ int32 CFE_ES_DeleteChildTask(CFE_ES_TaskId_t TaskId) */ void CFE_ES_ExitChildTask(void) { - CFE_ES_AppRecord_t *AppRecPtr; - CFE_ES_TaskRecord_t *TaskRecPtr; - - CFE_ES_LockSharedData(__func__,__LINE__); - - /* - ** Check to see if this is being called from a cFE Application's - ** main task. - */ - TaskRecPtr = CFE_ES_GetTaskRecordByContext(); - if ( TaskRecPtr != NULL ) - { - AppRecPtr = CFE_ES_LocateAppRecordByID(TaskRecPtr->AppId); - - if ( CFE_ES_AppRecordIsMatch(AppRecPtr, TaskRecPtr->AppId) && - !CFE_ES_TaskRecordIsMatch(TaskRecPtr, AppRecPtr->MainTaskId)) - { + CFE_ES_AppRecord_t * AppRecPtr; + CFE_ES_TaskRecord_t *TaskRecPtr; + + CFE_ES_LockSharedData(__func__, __LINE__); + + /* + ** Check to see if this is being called from a cFE Application's + ** main task. + */ + TaskRecPtr = CFE_ES_GetTaskRecordByContext(); + if (TaskRecPtr != NULL) + { + AppRecPtr = CFE_ES_LocateAppRecordByID(TaskRecPtr->AppId); + + if (CFE_ES_AppRecordIsMatch(AppRecPtr, TaskRecPtr->AppId) && + !CFE_ES_TaskRecordIsMatch(TaskRecPtr, AppRecPtr->MainTaskId)) + { /* ** Invalidate the task table entry */ CFE_ES_TaskRecordSetFree(TaskRecPtr); CFE_ES_Global.RegisteredTasks--; - - CFE_ES_UnlockSharedData(__func__,__LINE__); - + CFE_ES_UnlockSharedData(__func__, __LINE__); /* ** Call the OS AL routine @@ -1556,31 +1517,30 @@ void CFE_ES_ExitChildTask(void) ** Does not return from OS_TaskExit, except under unit test */ return; - } - else - { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = %lu\n", - CFE_RESOURCEID_TO_ULONG(CFE_ES_TaskRecordGetID(TaskRecPtr))); - } - } - else - { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitChildTask called from invalid task context\n"); - } /* end if GetAppId */ - - CFE_ES_UnlockSharedData(__func__,__LINE__); + } + else + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitChildTask Error: Cannot Call from a cFE App Main Task. ID = %lu\n", + CFE_RESOURCEID_TO_ULONG(CFE_ES_TaskRecordGetID(TaskRecPtr))); + } + } + else + { + CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitChildTask called from invalid task context\n"); + } /* end if GetAppId */ -} /* End of CFE_ES_ExitChildTask() */ + CFE_ES_UnlockSharedData(__func__, __LINE__); +} /* End of CFE_ES_ExitChildTask() */ /* ** Function: CFE_ES_WriteToSysLog - See API and header file for details */ int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) { - char TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE]; - int32 ReturnCode; - va_list ArgPtr; + char TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE]; + int32 ReturnCode; + va_list ArgPtr; if (SpecStringPtr == NULL) { @@ -1600,59 +1560,44 @@ int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) CFE_ES_UnlockSharedData(__func__, __LINE__); /* Output the entry to the console */ - OS_printf("%s",TmpString); + OS_printf("%s", TmpString); - return(ReturnCode); + return (ReturnCode); } /* End of CFE_ES_WriteToSysLog() */ - /* ** Function: CFE_ES_CalculateCRC - See API and header file for details */ uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, uint32 TypeCRC) { - uint32 i; - int16 Index; - int16 Crc = 0; + uint32 i; + int16 Index; + int16 Crc = 0; const uint8 *BufPtr; - uint8 ByteValue; - - static const uint16 CrcTable[256]= - { - - 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, - 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, - 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, - 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, - 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, - 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, - 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, - 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, - 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, - 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, - 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, - 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, - 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, - 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, - 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, - 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, - 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, - 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, - 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, - 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, - 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, - 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, - 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, - 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, - 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, - 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, - 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, - 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, - 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, - 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, - 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, - 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 + uint8 ByteValue; + + static const uint16 CrcTable[256] = { + + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, + 0xC481, 0x0440, 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, 0x0A00, 0xCAC1, 0xCB81, 0x0B40, + 0xC901, 0x09C0, 0x0880, 0xC841, 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, 0x1E00, 0xDEC1, + 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, + 0xF281, 0x3240, 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, 0x3C00, 0xFCC1, 0xFD81, 0x3D40, + 0xFF01, 0x3FC0, 0x3E80, 0xFE41, 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, 0x2800, 0xE8C1, + 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, + 0x2080, 0xE041, 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, 0x6600, 0xA6C1, 0xA781, 0x6740, + 0xA501, 0x65C0, 0x6480, 0xA441, 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, 0xAA01, 0x6AC0, + 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, + 0xB681, 0x7640, 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, 0x5000, 0x90C1, 0x9181, 0x5140, + 0x9301, 0x53C0, 0x5280, 0x9241, 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, 0x9C01, 0x5CC0, + 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, + 0x4C80, 0x8C41, 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 0x8201, 0x42C0, 0x4380, 0x8341, + 0x4100, 0x81C1, 0x8081, 0x4040 }; @@ -1661,41 +1606,40 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputC return InputCRC; } - switch(TypeCRC) + switch (TypeCRC) { - case CFE_MISSION_ES_CRC_32: - CFE_ES_WriteToSysLog("CFE ES Calculate CRC32 not Implemented\n"); - break; + case CFE_MISSION_ES_CRC_32: + CFE_ES_WriteToSysLog("CFE ES Calculate CRC32 not Implemented\n"); + break; - case CFE_MISSION_ES_CRC_16: - Crc = (int16 )( 0xFFFF & InputCRC ); - BufPtr = (const uint8 *)DataPtr; + case CFE_MISSION_ES_CRC_16: + Crc = (int16)(0xFFFF & InputCRC); + BufPtr = (const uint8 *)DataPtr; - for ( i = 0 ; i < DataLength ; i++, BufPtr++) - { - /* - * It is assumed that the supplied buffer is in a - * directly-accessible memory space that does not - * require special logic to access - */ - ByteValue = *BufPtr; - Index = ( ( Crc ^ ByteValue) & 0x00FF); - Crc = ( (Crc >> 8 ) & 0x00FF) ^ CrcTable[Index]; - } - break; + for (i = 0; i < DataLength; i++, BufPtr++) + { + /* + * It is assumed that the supplied buffer is in a + * directly-accessible memory space that does not + * require special logic to access + */ + ByteValue = *BufPtr; + Index = ((Crc ^ ByteValue) & 0x00FF); + Crc = ((Crc >> 8) & 0x00FF) ^ CrcTable[Index]; + } + break; - case CFE_MISSION_ES_CRC_8: - CFE_ES_WriteToSysLog("CFE ES Calculate CRC8 not Implemented\n"); - break; + case CFE_MISSION_ES_CRC_8: + CFE_ES_WriteToSysLog("CFE ES Calculate CRC8 not Implemented\n"); + break; - default: - break; + default: + break; } - return(Crc); + return (Crc); } /* End of CFE_ES_CalculateCRC() */ - /* ** Function: CFE_ES_RegisterCDS ** @@ -1704,17 +1648,18 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputC */ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, const char *Name) { - int32 Status; - size_t NameLen; - CFE_ES_AppId_t ThisAppId; + int32 Status; + size_t NameLen; + CFE_ES_AppId_t ThisAppId; - char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; - char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN] = {""}; + char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; + char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN] = {""}; /* Check to make sure calling application is legit */ Status = CFE_ES_GetAppID(&ThisAppId); - if (CDSHandlePtr == NULL || Name == NULL){ + if (CDSHandlePtr == NULL || Name == NULL) + { CFE_ES_WriteToSysLog("CFE_ES_RegisterCDS:-Failed invalid arguments\n"); return CFE_ES_BAD_ARGUMENT; } @@ -1722,9 +1667,9 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, con /* Initialize output to safe value, in case this fails */ *CDSHandlePtr = CFE_ES_CDS_BAD_HANDLE; - if ( Status != CFE_SUCCESS ) /* Application ID was invalid */ + if (Status != CFE_SUCCESS) /* Application ID was invalid */ { - CFE_ES_WriteToSysLog("CFE_CDS:Register-Bad AppId context\n"); + CFE_ES_WriteToSysLog("CFE_CDS:Register-Bad AppId context\n"); } else if (!CFE_ES_Global.CDSIsAvailable) { @@ -1737,28 +1682,29 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, con NameLen = strlen(Name); if ((NameLen > CFE_MISSION_ES_CDS_MAX_NAME_LENGTH) || (NameLen == 0)) { - Status = CFE_ES_CDS_INVALID_NAME; + Status = CFE_ES_CDS_INVALID_NAME; - /* Perform a buffer overrun safe copy of name for debug log message */ + /* Perform a buffer overrun safe copy of name for debug log message */ - strncpy(CDSName, Name, sizeof(CDSName) - 1); - CDSName[sizeof(CDSName) - 1] = '\0'; - CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS Name (%s) is too long\n", CDSName); + strncpy(CDSName, Name, sizeof(CDSName) - 1); + CDSName[sizeof(CDSName) - 1] = '\0'; + CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS Name (%s) is too long\n", CDSName); } else { - /* Modify specified name to be processor specific name */ - /* of the form "AppName.Name" */ - CFE_ES_FormCDSName(CDSName, Name, ThisAppId); - - /* Create CDS and designate it as NOT being a Critical Table */ - Status = CFE_ES_RegisterCDSEx(CDSHandlePtr, BlockSize, CDSName, false); - - /* If size is unacceptable, log it */ - if (Status == CFE_ES_CDS_INVALID_SIZE) - { - CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS %s has invalid size (%lu)\n", Name, (unsigned long)BlockSize); - } + /* Modify specified name to be processor specific name */ + /* of the form "AppName.Name" */ + CFE_ES_FormCDSName(CDSName, Name, ThisAppId); + + /* Create CDS and designate it as NOT being a Critical Table */ + Status = CFE_ES_RegisterCDSEx(CDSHandlePtr, BlockSize, CDSName, false); + + /* If size is unacceptable, log it */ + if (Status == CFE_ES_CDS_INVALID_SIZE) + { + CFE_ES_WriteToSysLog("CFE_CDS:Register-CDS %s has invalid size (%lu)\n", Name, + (unsigned long)BlockSize); + } } } @@ -1768,11 +1714,9 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, con /* Translate AppID of caller into App Name */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_EVS_SendEventWithAppID(CFE_ES_CDS_REGISTER_ERR_EID, - CFE_EVS_EventType_ERROR, - ThisAppId, - "%s Failed to Register CDS '%s', Status=0x%08X", - AppName, Name, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_ES_CDS_REGISTER_ERR_EID, CFE_EVS_EventType_ERROR, ThisAppId, + "%s Failed to Register CDS '%s', Status=0x%08X", AppName, Name, + (unsigned int)Status); } return Status; @@ -1786,7 +1730,7 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, con */ CFE_Status_t CFE_ES_GetCDSBlockIDByName(CFE_ES_CDSHandle_t *BlockIdPtr, const char *BlockName) { - CFE_Status_t Status; + CFE_Status_t Status; CFE_ES_CDS_RegRec_t *RegRecPtr; if (BlockName == NULL || BlockIdPtr == NULL) @@ -1805,12 +1749,12 @@ CFE_Status_t CFE_ES_GetCDSBlockIDByName(CFE_ES_CDSHandle_t *BlockIdPtr, const ch if (RegRecPtr != NULL) { *BlockIdPtr = CFE_ES_CDSBlockRecordGetID(RegRecPtr); - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; } else { *BlockIdPtr = CFE_ES_CDS_BAD_HANDLE; - Status = CFE_ES_ERR_NAME_NOT_FOUND; + Status = CFE_ES_ERR_NAME_NOT_FOUND; } CFE_ES_UnlockCDS(); @@ -1826,7 +1770,7 @@ CFE_Status_t CFE_ES_GetCDSBlockIDByName(CFE_ES_CDSHandle_t *BlockIdPtr, const ch */ CFE_Status_t CFE_ES_GetCDSBlockName(char *BlockName, CFE_ES_CDSHandle_t BlockId, size_t BufferLength) { - CFE_Status_t Status; + CFE_Status_t Status; CFE_ES_CDS_RegRec_t *RegRecPtr; if (BufferLength == 0 || BlockName == NULL) @@ -1842,16 +1786,16 @@ CFE_Status_t CFE_ES_GetCDSBlockName(char *BlockName, CFE_ES_CDSHandle_t BlockId, CFE_ES_LockCDS(); - if ( CFE_ES_CDSBlockRecordIsMatch(RegRecPtr, BlockId) ) + if (CFE_ES_CDSBlockRecordIsMatch(RegRecPtr, BlockId)) { - strncpy(BlockName, RegRecPtr->Name, BufferLength-1); - BlockName[BufferLength-1] = 0; - Status = CFE_SUCCESS; + strncpy(BlockName, RegRecPtr->Name, BufferLength - 1); + BlockName[BufferLength - 1] = 0; + Status = CFE_SUCCESS; } else { BlockName[0] = 0; - Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; + Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; } CFE_ES_UnlockCDS(); @@ -1887,7 +1831,7 @@ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) { return CFE_ES_BAD_ARGUMENT; } - + return CFE_ES_CDSBlockRead(RestoreToMemory, Handle); } /* End of CFE_ES_RestoreFromCDS() */ @@ -1898,61 +1842,59 @@ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) */ int32 CFE_ES_RegisterGenCounter(CFE_ES_CounterId_t *CounterIdPtr, const char *CounterName) { - CFE_ES_GenCounterRecord_t *CountRecPtr; - CFE_ResourceId_t PendingResourceId; - int32 Status; + CFE_ES_GenCounterRecord_t *CountRecPtr; + CFE_ResourceId_t PendingResourceId; + int32 Status; - if (CounterName == NULL || CounterIdPtr == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } + if (CounterName == NULL || CounterIdPtr == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } - if (strlen(CounterName) >= sizeof(CountRecPtr->CounterName)) - { - return CFE_ES_BAD_ARGUMENT; - } + if (strlen(CounterName) >= sizeof(CountRecPtr->CounterName)) + { + return CFE_ES_BAD_ARGUMENT; + } + CFE_ES_LockSharedData(__func__, __LINE__); + + /* + * Check for an existing entry with the same name. + */ + CountRecPtr = CFE_ES_LocateCounterRecordByName(CounterName); + if (CountRecPtr != NULL) + { + CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate Counter name '%s'\n", CounterName); + Status = CFE_ES_ERR_DUPLICATE_NAME; + PendingResourceId = CFE_RESOURCEID_UNDEFINED; + } + else + { + /* scan for a free slot */ + PendingResourceId = CFE_ResourceId_FindNext(CFE_ES_Global.LastCounterId, CFE_PLATFORM_ES_MAX_GEN_COUNTERS, + CFE_ES_CheckCounterIdSlotUsed); + CountRecPtr = CFE_ES_LocateCounterRecordByID(CFE_ES_COUNTERID_C(PendingResourceId)); - CFE_ES_LockSharedData(__func__,__LINE__); + if (CountRecPtr == NULL) + { + CFE_ES_SysLogWrite_Unsync("ES Startup: No free Counter slots available\n"); + Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; + } + else + { + strncpy(CountRecPtr->CounterName, CounterName, sizeof(CountRecPtr->CounterName) - 1); + CountRecPtr->CounterName[sizeof(CountRecPtr->CounterName) - 1] = '\0'; + CountRecPtr->Counter = 0; + CFE_ES_CounterRecordSetUsed(CountRecPtr, PendingResourceId); + CFE_ES_Global.LastCounterId = PendingResourceId; + Status = CFE_SUCCESS; + } + } - /* - * Check for an existing entry with the same name. - */ - CountRecPtr = CFE_ES_LocateCounterRecordByName(CounterName); - if (CountRecPtr != NULL) - { - CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate Counter name '%s'\n", CounterName); - Status = CFE_ES_ERR_DUPLICATE_NAME; - PendingResourceId = CFE_RESOURCEID_UNDEFINED; - } - else - { - /* scan for a free slot */ - PendingResourceId = CFE_ResourceId_FindNext(CFE_ES_Global.LastCounterId, CFE_PLATFORM_ES_MAX_GEN_COUNTERS, CFE_ES_CheckCounterIdSlotUsed); - CountRecPtr = CFE_ES_LocateCounterRecordByID(CFE_ES_COUNTERID_C(PendingResourceId)); - - if (CountRecPtr == NULL) - { - CFE_ES_SysLogWrite_Unsync("ES Startup: No free Counter slots available\n"); - Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; - } - else - { - strncpy(CountRecPtr->CounterName,CounterName, - sizeof(CountRecPtr->CounterName) - 1); - CountRecPtr->CounterName[sizeof(CountRecPtr->CounterName) - 1] = '\0'; - CountRecPtr->Counter = 0; - CFE_ES_CounterRecordSetUsed(CountRecPtr, PendingResourceId); - CFE_ES_Global.LastCounterId = PendingResourceId; - Status = CFE_SUCCESS; - } - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - *CounterIdPtr = CFE_ES_COUNTERID_C(PendingResourceId); - return Status; + CFE_ES_UnlockSharedData(__func__, __LINE__); + *CounterIdPtr = CFE_ES_COUNTERID_C(PendingResourceId); + return Status; } /* @@ -1963,23 +1905,23 @@ int32 CFE_ES_RegisterGenCounter(CFE_ES_CounterId_t *CounterIdPtr, const char *Co */ int32 CFE_ES_DeleteGenCounter(CFE_ES_CounterId_t CounterId) { - CFE_ES_GenCounterRecord_t *CountRecPtr; - int32 Status = CFE_ES_BAD_ARGUMENT; - - CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); - if(CountRecPtr != NULL) - { - CFE_ES_LockSharedData(__func__,__LINE__); - if (CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId)) - { - CountRecPtr->Counter = 0; - CFE_ES_CounterRecordSetFree(CountRecPtr); - Status = CFE_SUCCESS; - } - CFE_ES_UnlockSharedData(__func__,__LINE__); - } - - return Status; + CFE_ES_GenCounterRecord_t *CountRecPtr; + int32 Status = CFE_ES_BAD_ARGUMENT; + + CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); + if (CountRecPtr != NULL) + { + CFE_ES_LockSharedData(__func__, __LINE__); + if (CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId)) + { + CountRecPtr->Counter = 0; + CFE_ES_CounterRecordSetFree(CountRecPtr); + Status = CFE_SUCCESS; + } + CFE_ES_UnlockSharedData(__func__, __LINE__); + } + + return Status; } /* End of CFE_ES_DeleteGenCounter() */ @@ -1991,16 +1933,16 @@ int32 CFE_ES_DeleteGenCounter(CFE_ES_CounterId_t CounterId) */ int32 CFE_ES_IncrementGenCounter(CFE_ES_CounterId_t CounterId) { - int32 Status = CFE_ES_BAD_ARGUMENT; - CFE_ES_GenCounterRecord_t *CountRecPtr; + int32 Status = CFE_ES_BAD_ARGUMENT; + CFE_ES_GenCounterRecord_t *CountRecPtr; - CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); - if(CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId)) - { - ++CountRecPtr->Counter; - Status = CFE_SUCCESS; - } - return Status; + CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); + if (CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId)) + { + ++CountRecPtr->Counter; + Status = CFE_SUCCESS; + } + return Status; } /* End of CFE_ES_IncrementGenCounter() */ @@ -2012,16 +1954,16 @@ int32 CFE_ES_IncrementGenCounter(CFE_ES_CounterId_t CounterId) */ int32 CFE_ES_SetGenCount(CFE_ES_CounterId_t CounterId, uint32 Count) { - int32 Status = CFE_ES_BAD_ARGUMENT; - CFE_ES_GenCounterRecord_t *CountRecPtr; - - CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); - if(CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId)) - { - CountRecPtr->Counter = Count; - Status = CFE_SUCCESS; - } - return Status; + int32 Status = CFE_ES_BAD_ARGUMENT; + CFE_ES_GenCounterRecord_t *CountRecPtr; + + CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); + if (CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId)) + { + CountRecPtr->Counter = Count; + Status = CFE_SUCCESS; + } + return Status; } /* End of CFE_ES_SetGenCount() */ /* @@ -2032,53 +1974,52 @@ int32 CFE_ES_SetGenCount(CFE_ES_CounterId_t CounterId, uint32 Count) */ int32 CFE_ES_GetGenCount(CFE_ES_CounterId_t CounterId, uint32 *Count) { - int32 Status = CFE_ES_BAD_ARGUMENT; - CFE_ES_GenCounterRecord_t *CountRecPtr; - - CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); - if(CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId) && - Count != NULL) - { - *Count = CountRecPtr->Counter; - Status = CFE_SUCCESS; - } - return Status; + int32 Status = CFE_ES_BAD_ARGUMENT; + CFE_ES_GenCounterRecord_t *CountRecPtr; + + CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); + if (CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId) && Count != NULL) + { + *Count = CountRecPtr->Counter; + Status = CFE_SUCCESS; + } + return Status; } /* End of CFE_ES_GetGenCount() */ int32 CFE_ES_GetGenCounterIDByName(CFE_ES_CounterId_t *CounterIdPtr, const char *CounterName) { - CFE_ES_GenCounterRecord_t *CounterRecPtr; - int32 Result; - - if (CounterName == NULL || CounterIdPtr == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } - - /* - ** Search the ES Generic Counter table for a counter with a matching name. - */ - CFE_ES_LockSharedData(__func__,__LINE__); - - CounterRecPtr = CFE_ES_LocateCounterRecordByName(CounterName); - if (CounterRecPtr == NULL) - { - /* - * ensure the output value is set to a safe value, - * in case the does not check the return code. - */ - Result = CFE_ES_ERR_NAME_NOT_FOUND; - *CounterIdPtr = CFE_ES_COUNTERID_UNDEFINED; - } - else - { - Result = CFE_SUCCESS; - *CounterIdPtr = CFE_ES_CounterRecordGetID(CounterRecPtr); - } + CFE_ES_GenCounterRecord_t *CounterRecPtr; + int32 Result; + + if (CounterName == NULL || CounterIdPtr == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } + + /* + ** Search the ES Generic Counter table for a counter with a matching name. + */ + CFE_ES_LockSharedData(__func__, __LINE__); + + CounterRecPtr = CFE_ES_LocateCounterRecordByName(CounterName); + if (CounterRecPtr == NULL) + { + /* + * ensure the output value is set to a safe value, + * in case the does not check the return code. + */ + Result = CFE_ES_ERR_NAME_NOT_FOUND; + *CounterIdPtr = CFE_ES_COUNTERID_UNDEFINED; + } + else + { + Result = CFE_SUCCESS; + *CounterIdPtr = CFE_ES_CounterRecordGetID(CounterRecPtr); + } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(Result); + return (Result); } /* End of CFE_ES_GetGenCounterIDByName() */ @@ -2091,7 +2032,7 @@ int32 CFE_ES_GetGenCounterIDByName(CFE_ES_CounterId_t *CounterIdPtr, const char CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_CounterId_t CounterId, size_t BufferLength) { CFE_ES_GenCounterRecord_t *CountRecPtr; - CFE_Status_t Status; + CFE_Status_t Status; if (BufferLength == 0 || CounterName == NULL) { @@ -2100,21 +2041,21 @@ CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_CounterId_t Coun CountRecPtr = CFE_ES_LocateCounterRecordByID(CounterId); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); if (CFE_ES_CounterRecordIsMatch(CountRecPtr, CounterId)) { - strncpy(CounterName, CFE_ES_CounterRecordGetName(CountRecPtr), BufferLength-1); - CounterName[BufferLength-1] = 0; - Status = CFE_SUCCESS; + strncpy(CounterName, CFE_ES_CounterRecordGetName(CountRecPtr), BufferLength - 1); + CounterName[BufferLength - 1] = 0; + Status = CFE_SUCCESS; } else { CounterName[0] = 0; - Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; + Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); return Status; } @@ -2125,10 +2066,8 @@ CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_CounterId_t Coun */ int32 CFE_ES_AppID_ToIndex(CFE_ES_AppId_t AppID, uint32 *Idx) { - return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(AppID), - CFE_ES_APPID_BASE, - CFE_PLATFORM_ES_MAX_APPLICATIONS, - Idx); + return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(AppID), CFE_ES_APPID_BASE, CFE_PLATFORM_ES_MAX_APPLICATIONS, + Idx); } /* @@ -2137,22 +2076,19 @@ int32 CFE_ES_AppID_ToIndex(CFE_ES_AppId_t AppID, uint32 *Idx) */ int32 CFE_ES_LibID_ToIndex(CFE_ES_LibId_t LibId, uint32 *Idx) { - return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(LibId), - CFE_ES_LIBID_BASE, - CFE_PLATFORM_ES_MAX_LIBRARIES, - Idx); + return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(LibId), CFE_ES_LIBID_BASE, CFE_PLATFORM_ES_MAX_LIBRARIES, Idx); } /* * A conversion function to obtain an index value correlating to an TaskID * This is a zero based value that can be used for indexing into a table. - * + * * Task IDs come from OSAL, so this is currently a wrapper around the OSAL converter. * This is an alias for consistency with the ES AppID paradigm. */ int32 CFE_ES_TaskID_ToIndex(CFE_ES_TaskId_t TaskID, uint32 *Idx) { - osal_id_t OsalID; + osal_id_t OsalID; osal_index_t OsalIndex; if (!CFE_RESOURCEID_TEST_DEFINED(TaskID)) @@ -2177,10 +2113,8 @@ int32 CFE_ES_TaskID_ToIndex(CFE_ES_TaskId_t TaskID, uint32 *Idx) */ int32 CFE_ES_CounterID_ToIndex(CFE_ES_CounterId_t CounterId, uint32 *Idx) { - return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(CounterId), - CFE_ES_COUNTID_BASE, - CFE_PLATFORM_ES_MAX_GEN_COUNTERS, - Idx); + return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(CounterId), CFE_ES_COUNTID_BASE, + CFE_PLATFORM_ES_MAX_GEN_COUNTERS, Idx); } /*************************************************************************************** @@ -2203,7 +2137,7 @@ int32 CFE_ES_CounterID_ToIndex(CFE_ES_CounterId_t CounterId, uint32 *Idx) */ void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber) { - int32 Status; + int32 Status; Status = OS_MutSemTake(CFE_ES_Global.SharedDataMutex); if (Status != OS_SUCCESS) @@ -2212,14 +2146,14 @@ void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber) * NOTE: this is going to write into a buffer that itself * is _supposed_ to be protected by this same mutex. */ - CFE_ES_SysLogWrite_Unsync("ES SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", - (unsigned int)Status,FunctionName,(int)LineNumber); + CFE_ES_SysLogWrite_Unsync("ES SharedData Mutex Take Err Stat=0x%x,Func=%s,Line=%d\n", (unsigned int)Status, + FunctionName, (int)LineNumber); - }/* end if */ + } /* end if */ return; -}/* end CFE_ES_LockSharedData */ +} /* end CFE_ES_LockSharedData */ /****************************************************************************** ** Function: CFE_ES_UnlockSharedData() @@ -2237,7 +2171,7 @@ void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber) */ void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber) { - int32 Status; + int32 Status; Status = OS_MutSemGive(CFE_ES_Global.SharedDataMutex); if (Status != OS_SUCCESS) @@ -2246,14 +2180,14 @@ void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber) * NOTE: this is going to write into a buffer that itself * is _supposed_ to be protected by this same mutex. */ - CFE_ES_SysLogWrite_Unsync("ES SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", - (unsigned int)Status,FunctionName,(int)LineNumber); + CFE_ES_SysLogWrite_Unsync("ES SharedData Mutex Give Err Stat=0x%x,Func=%s,Line=%d\n", (unsigned int)Status, + FunctionName, (int)LineNumber); - }/* end if */ + } /* end if */ return; -}/* end CFE_ES_UnlockSharedData */ +} /* end CFE_ES_UnlockSharedData */ /****************************************************************************** ** Function: CFE_ES_ProcessAsyncEvent() diff --git a/modules/es/fsw/src/cfe_es_apps.c b/modules/es/fsw/src/cfe_es_apps.c index ba4dbea70..1944e7153 100644 --- a/modules/es/fsw/src/cfe_es_apps.c +++ b/modules/es/fsw/src/cfe_es_apps.c @@ -72,196 +72,194 @@ ** This routine loads/starts cFE applications. ** */ -void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ) +void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath) { - char ES_AppLoadBuffer[ES_START_BUFF_SIZE]; /* A buffer of for a line in a file */ - char ScriptFileName[OS_MAX_PATH_LEN]; - const char *TokenList[CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE]; - uint32 NumTokens; - uint32 BuffLen; /* Length of the current buffer */ - osal_id_t AppFile; - int32 Status; - char c; - bool LineTooLong = false; - bool FileOpened = false; - - /* - ** Get the ES startup script filename. - ** If this is a Processor Reset, try to open the file in the volatile disk first. - */ - if ( ResetType == CFE_PSP_RST_TYPE_PROCESSOR ) - { - /* - ** First Attempt to parse as file in the volatile disk (temp area). - */ - Status = CFE_FS_ParseInputFileName(ScriptFileName, CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE, - sizeof(ScriptFileName), CFE_FS_FileCategory_TEMP); - - if (Status == CFE_SUCCESS) - { - Status = OS_OpenCreate(&AppFile, ScriptFileName, OS_FILE_FLAG_NONE, OS_READ_ONLY); - } - - if ( Status >= 0 ) - { - CFE_ES_WriteToSysLog ("ES Startup: Opened ES App Startup file: %s\n", - ScriptFileName); - FileOpened = true; - } - else - { - CFE_ES_WriteToSysLog ("ES Startup: Cannot Open Volatile Startup file, Trying Nonvolatile.\n"); - FileOpened = false; - } - - } /* end if */ - - /* - ** This if block covers two cases: A Power on reset, and a Processor reset when - ** the startup file on the volatile file system could not be opened. - */ - if ( FileOpened == false ) - { - /* - ** Try to Open the file passed in to the cFE start. - */ - Status = CFE_FS_ParseInputFileName(ScriptFileName, StartFilePath, - sizeof(ScriptFileName), CFE_FS_FileCategory_SCRIPT); - - if (Status == CFE_SUCCESS) - { - Status = OS_OpenCreate(&AppFile, ScriptFileName, OS_FILE_FLAG_NONE, OS_READ_ONLY); - } - - if ( Status >= 0 ) - { - CFE_ES_WriteToSysLog ("ES Startup: Opened ES App Startup file: %s\n",ScriptFileName); - FileOpened = true; - } - else - { - CFE_ES_WriteToSysLog ("ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", - StartFilePath, (unsigned int)Status ); - FileOpened = false; - } - - } - - /* - ** If the file is opened in either the Nonvolatile or the Volatile disk, process it. - */ - if ( FileOpened == true) - { - memset(ES_AppLoadBuffer,0x0,ES_START_BUFF_SIZE); - BuffLen = 0; - NumTokens = 0; - TokenList[0] = ES_AppLoadBuffer; - - /* - ** Parse the lines from the file. If it has an error - ** or reaches EOF, then abort the loop. - */ - while(1) - { - Status = OS_read(AppFile, &c, 1); - if ( Status < 0 ) - { - CFE_ES_WriteToSysLog ("ES Startup: Error Reading Startup file. EC = 0x%08X\n",(unsigned int)Status); - break; - } - else if ( Status == 0 ) - { - /* - ** EOF Reached - */ - break; - } - else if(c != '!') - { - if ( c <= ' ') - { - /* - ** Skip all white space in the file - */ - ; - } - else if ( c == ',' ) - { - /* - ** replace the field delimiter with a null - ** This is used to separate the tokens - */ - if ( BuffLen < ES_START_BUFF_SIZE ) - { - ES_AppLoadBuffer[BuffLen] = 0; - } - else - { - LineTooLong = true; - } - BuffLen++; + char ES_AppLoadBuffer[ES_START_BUFF_SIZE]; /* A buffer of for a line in a file */ + char ScriptFileName[OS_MAX_PATH_LEN]; + const char *TokenList[CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE]; + uint32 NumTokens; + uint32 BuffLen; /* Length of the current buffer */ + osal_id_t AppFile; + int32 Status; + char c; + bool LineTooLong = false; + bool FileOpened = false; - if ( NumTokens < (CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE-1)) - { - /* - * NOTE: pointer never deferenced unless "LineTooLong" is false. - */ - ++NumTokens; - TokenList[NumTokens] = &ES_AppLoadBuffer[BuffLen]; - } - } - else if ( c != ';' ) - { + /* + ** Get the ES startup script filename. + ** If this is a Processor Reset, try to open the file in the volatile disk first. + */ + if (ResetType == CFE_PSP_RST_TYPE_PROCESSOR) + { + /* + ** First Attempt to parse as file in the volatile disk (temp area). + */ + Status = CFE_FS_ParseInputFileName(ScriptFileName, CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE, + sizeof(ScriptFileName), CFE_FS_FileCategory_TEMP); + + if (Status == CFE_SUCCESS) + { + Status = OS_OpenCreate(&AppFile, ScriptFileName, OS_FILE_FLAG_NONE, OS_READ_ONLY); + } + + if (Status >= 0) + { + CFE_ES_WriteToSysLog("ES Startup: Opened ES App Startup file: %s\n", ScriptFileName); + FileOpened = true; + } + else + { + CFE_ES_WriteToSysLog("ES Startup: Cannot Open Volatile Startup file, Trying Nonvolatile.\n"); + FileOpened = false; + } + + } /* end if */ + + /* + ** This if block covers two cases: A Power on reset, and a Processor reset when + ** the startup file on the volatile file system could not be opened. + */ + if (FileOpened == false) + { + /* + ** Try to Open the file passed in to the cFE start. + */ + Status = CFE_FS_ParseInputFileName(ScriptFileName, StartFilePath, sizeof(ScriptFileName), + CFE_FS_FileCategory_SCRIPT); + + if (Status == CFE_SUCCESS) + { + Status = OS_OpenCreate(&AppFile, ScriptFileName, OS_FILE_FLAG_NONE, OS_READ_ONLY); + } + + if (Status >= 0) + { + CFE_ES_WriteToSysLog("ES Startup: Opened ES App Startup file: %s\n", ScriptFileName); + FileOpened = true; + } + else + { + CFE_ES_WriteToSysLog("ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", StartFilePath, + (unsigned int)Status); + FileOpened = false; + } + } + + /* + ** If the file is opened in either the Nonvolatile or the Volatile disk, process it. + */ + if (FileOpened == true) + { + memset(ES_AppLoadBuffer, 0x0, ES_START_BUFF_SIZE); + BuffLen = 0; + NumTokens = 0; + TokenList[0] = ES_AppLoadBuffer; + + /* + ** Parse the lines from the file. If it has an error + ** or reaches EOF, then abort the loop. + */ + while (1) + { + Status = OS_read(AppFile, &c, 1); + if (Status < 0) + { + CFE_ES_WriteToSysLog("ES Startup: Error Reading Startup file. EC = 0x%08X\n", (unsigned int)Status); + break; + } + else if (Status == 0) + { /* - ** Regular data gets copied in + ** EOF Reached */ - if ( BuffLen < ES_START_BUFF_SIZE ) + break; + } + else if (c != '!') + { + if (c <= ' ') { - ES_AppLoadBuffer[BuffLen] = c; + /* + ** Skip all white space in the file + */ + ; } - else + else if (c == ',') { - LineTooLong = true; + /* + ** replace the field delimiter with a null + ** This is used to separate the tokens + */ + if (BuffLen < ES_START_BUFF_SIZE) + { + ES_AppLoadBuffer[BuffLen] = 0; + } + else + { + LineTooLong = true; + } + BuffLen++; + + if (NumTokens < (CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE - 1)) + { + /* + * NOTE: pointer never deferenced unless "LineTooLong" is false. + */ + ++NumTokens; + TokenList[NumTokens] = &ES_AppLoadBuffer[BuffLen]; + } } - BuffLen++; - } - else - { - if ( LineTooLong == true ) + else if (c != ';') { - /* - ** The was too big for the buffer - */ - CFE_ES_WriteToSysLog ("ES Startup: ES Startup File Line is too long: %u bytes.\n",(unsigned int)BuffLen); - LineTooLong = false; + /* + ** Regular data gets copied in + */ + if (BuffLen < ES_START_BUFF_SIZE) + { + ES_AppLoadBuffer[BuffLen] = c; + } + else + { + LineTooLong = true; + } + BuffLen++; } else { - /* - ** Send the line to the file parser - ** Ensure termination of the last token and send it along - */ - ES_AppLoadBuffer[BuffLen] = 0; - CFE_ES_ParseFileEntry(TokenList, 1 + NumTokens); + if (LineTooLong == true) + { + /* + ** The was too big for the buffer + */ + CFE_ES_WriteToSysLog("ES Startup: ES Startup File Line is too long: %u bytes.\n", + (unsigned int)BuffLen); + LineTooLong = false; + } + else + { + /* + ** Send the line to the file parser + ** Ensure termination of the last token and send it along + */ + ES_AppLoadBuffer[BuffLen] = 0; + CFE_ES_ParseFileEntry(TokenList, 1 + NumTokens); + } + BuffLen = 0; + NumTokens = 0; } - BuffLen = 0; - NumTokens = 0; - } - } - else - { - /* - ** break when EOF character '!' is reached - */ - break; - } - } - /* - ** close the file - */ - OS_close(AppFile); - - } + } + else + { + /* + ** break when EOF character '!' is reached + */ + break; + } + } + /* + ** close the file + */ + OS_close(AppFile); + } } /* @@ -295,16 +293,16 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) } /* Get pointers to specific tokens that are simple strings used as-is */ - EntryType = TokenList[0]; + EntryType = TokenList[0]; ModuleName = TokenList[3]; - /* - * Other tokens will need to be scrubbed/converted. + /* + * Other tokens will need to be scrubbed/converted. * Both Libraries and Apps use File Name (1) and Symbol Name (2) fields so copy those now */ memset(&ParamBuf, 0, sizeof(ParamBuf)); - Status = CFE_FS_ParseInputFileName(ParamBuf.BasicInfo.FileName, TokenList[1], - sizeof(ParamBuf.BasicInfo.FileName), CFE_FS_FileCategory_DYNAMIC_MODULE); + Status = CFE_FS_ParseInputFileName(ParamBuf.BasicInfo.FileName, TokenList[1], sizeof(ParamBuf.BasicInfo.FileName), + CFE_FS_FileCategory_DYNAMIC_MODULE); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES Startup: Invalid ES Startup script file name: %s\n", TokenList[1]); @@ -335,7 +333,6 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) /* No specific upper/lower limit for stack size - will pass value through */ ParamBuf.MainTaskInfo.StackSize = strtoul(TokenList[5], NULL, 0); - /* ** Validate Some parameters ** Exception action should be 0 ( Restart App ) or @@ -386,59 +383,57 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) ** **------------------------------------------------------------------------------------- */ -int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleName, const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus) +int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleName, + const CFE_ES_ModuleLoadParams_t *LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus) { osal_id_t ModuleId; - cpuaddr InitSymbolAddress; - int32 ReturnCode; - int32 StatusCode; - uint32 LoadFlags; + cpuaddr InitSymbolAddress; + int32 ReturnCode; + int32 StatusCode; + uint32 LoadFlags; - LoadFlags = 0; + LoadFlags = 0; InitSymbolAddress = 0; - ReturnCode = CFE_SUCCESS; + ReturnCode = CFE_SUCCESS; if (LoadParams->FileName[0] != 0) { - switch(CFE_ResourceId_GetBase(ParentResourceId)) + switch (CFE_ResourceId_GetBase(ParentResourceId)) { - case CFE_ES_APPID_BASE: - /* - * Apps should not typically have symbols exposed to other apps. - * - * Keeping symbols local/private may help ensure this module is unloadable - * in the future, depending on underlying OS/loader implementation. - */ - LoadFlags |= OS_MODULE_FLAG_LOCAL_SYMBOLS; - break; - case CFE_ES_LIBID_BASE: - /* - * Libraries need to have their symbols exposed to other apps. - * - * Note on some OS/loader implementations this may make it so the module - * cannot be unloaded, if there is no way to ensure that symbols - * are not being referenced. CFE does not currently support unloading - * of libraries for this reason, among others. - */ - LoadFlags |= OS_MODULE_FLAG_GLOBAL_SYMBOLS; - break; - default: - break; + case CFE_ES_APPID_BASE: + /* + * Apps should not typically have symbols exposed to other apps. + * + * Keeping symbols local/private may help ensure this module is unloadable + * in the future, depending on underlying OS/loader implementation. + */ + LoadFlags |= OS_MODULE_FLAG_LOCAL_SYMBOLS; + break; + case CFE_ES_LIBID_BASE: + /* + * Libraries need to have their symbols exposed to other apps. + * + * Note on some OS/loader implementations this may make it so the module + * cannot be unloaded, if there is no way to ensure that symbols + * are not being referenced. CFE does not currently support unloading + * of libraries for this reason, among others. + */ + LoadFlags |= OS_MODULE_FLAG_GLOBAL_SYMBOLS; + break; + default: + break; } /* * Load the module via OSAL. */ - StatusCode = OS_ModuleLoad ( &ModuleId, - ModuleName, - LoadParams->FileName, - LoadFlags ); + StatusCode = OS_ModuleLoad(&ModuleId, ModuleName, LoadParams->FileName, LoadFlags); if (StatusCode != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Could not load file:%s. EC = 0x%08X\n", - LoadParams->FileName, (unsigned int)StatusCode); - ModuleId = OS_OBJECT_ID_UNDEFINED; + CFE_ES_WriteToSysLog("ES Startup: Could not load file:%s. EC = 0x%08X\n", LoadParams->FileName, + (unsigned int)StatusCode); + ModuleId = OS_OBJECT_ID_UNDEFINED; ReturnCode = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } } @@ -455,16 +450,16 @@ int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleNam StatusCode = OS_ModuleSymbolLookup(ModuleId, &InitSymbolAddress, LoadParams->InitSymbolName); if (StatusCode != OS_SUCCESS) { - CFE_ES_WriteToSysLog("ES Startup: Could not find symbol:%s. EC = 0x%08X\n", - LoadParams->InitSymbolName, (unsigned int)StatusCode); + CFE_ES_WriteToSysLog("ES Startup: Could not find symbol:%s. EC = 0x%08X\n", LoadParams->InitSymbolName, + (unsigned int)StatusCode); ReturnCode = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } } - if ( ReturnCode == CFE_SUCCESS ) + if (ReturnCode == CFE_SUCCESS) { /* store the data in the app record after successful load+lookup */ - LoadStatus->ModuleId = ModuleId; + LoadStatus->ModuleId = ModuleId; LoadStatus->InitSymbolAddress = InitSymbolAddress; } else if (OS_ObjectIdDefined(ModuleId)) @@ -472,10 +467,10 @@ int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleNam /* If the module had been successfully loaded, then unload it, * so that it does not consume resources */ StatusCode = OS_ModuleUnload(ModuleId); - if ( StatusCode != OS_SUCCESS ) /* There's not much we can do except notify */ + if (StatusCode != OS_SUCCESS) /* There's not much we can do except notify */ { - CFE_ES_WriteToSysLog("ES Startup: Failed to unload: %s. EC = 0x%08X\n", - ModuleName, (unsigned int)StatusCode); + CFE_ES_WriteToSysLog("ES Startup: Failed to unload: %s. EC = 0x%08X\n", ModuleName, + (unsigned int)StatusCode); } } @@ -495,23 +490,23 @@ int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleNam */ int32 CFE_ES_GetTaskFunction(CFE_ES_TaskEntryFuncPtr_t *FuncPtr) { - CFE_ES_TaskRecord_t *TaskRecPtr; + CFE_ES_TaskRecord_t * TaskRecPtr; CFE_ES_TaskEntryFuncPtr_t EntryFunc; - int32 ReturnCode; - int32 Timeout; + int32 ReturnCode; + int32 Timeout; /* * Use the same timeout as was used for the startup script itself. */ ReturnCode = CFE_ES_ERR_APP_REGISTER; - Timeout = CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC; - EntryFunc = NULL; + Timeout = CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC; + EntryFunc = NULL; - while(true) + while (true) { OS_TaskDelay(CFE_PLATFORM_ES_STARTUP_SYNC_POLL_MSEC); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); TaskRecPtr = CFE_ES_GetTaskRecordByContext(); if (TaskRecPtr != NULL) { @@ -521,7 +516,7 @@ int32 CFE_ES_GetTaskFunction(CFE_ES_TaskEntryFuncPtr_t *FuncPtr) ReturnCode = CFE_SUCCESS; } } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); if (ReturnCode == CFE_SUCCESS || Timeout <= 0) { @@ -556,8 +551,7 @@ void CFE_ES_TaskEntryPoint(void) { CFE_ES_TaskEntryFuncPtr_t RealEntryFunc; - if (CFE_ES_GetTaskFunction(&RealEntryFunc) == CFE_SUCCESS && - RealEntryFunc != NULL) + if (CFE_ES_GetTaskFunction(&RealEntryFunc) == CFE_SUCCESS && RealEntryFunc != NULL) { (*RealEntryFunc)(); } @@ -579,13 +573,14 @@ void CFE_ES_TaskEntryPoint(void) ** **------------------------------------------------------------------------------------- */ -int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ES_TaskEntryFuncPtr_t EntryFunc, const CFE_ES_TaskStartParams_t* Params, CFE_ES_AppId_t ParentAppId) +int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ES_TaskEntryFuncPtr_t EntryFunc, + const CFE_ES_TaskStartParams_t *Params, CFE_ES_AppId_t ParentAppId) { CFE_ES_TaskRecord_t *TaskRecPtr; - osal_id_t OsalTaskId; - CFE_ES_TaskId_t LocalTaskId; - int32 StatusCode; - int32 ReturnCode; + osal_id_t OsalTaskId; + CFE_ES_TaskId_t LocalTaskId; + int32 StatusCode; + int32 ReturnCode; /* * Create the primary task for the newly loaded task @@ -598,9 +593,9 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ Params->Priority, /* task priority */ OS_FP_ENABLED); /* task options */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); - if ( StatusCode == OS_SUCCESS ) + if (StatusCode == OS_SUCCESS) { /* * As this is a newly-created task, this shouldn't fail. @@ -608,11 +603,11 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ * initialized here. */ LocalTaskId = CFE_ES_TaskId_FromOSAL(OsalTaskId); - TaskRecPtr = CFE_ES_LocateTaskRecordByID(LocalTaskId); - if ( CFE_ES_TaskRecordIsUsed(TaskRecPtr) ) + TaskRecPtr = CFE_ES_LocateTaskRecordByID(LocalTaskId); + if (CFE_ES_TaskRecordIsUsed(TaskRecPtr)) { CFE_ES_SysLogWrite_Unsync("ES Startup: Error: ES_TaskTable slot for ID %lx in use at task creation!\n", - OS_ObjectIdToInteger(OsalTaskId)); + OS_ObjectIdToInteger(OsalTaskId)); } /* @@ -625,9 +620,9 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ TaskRecPtr->EntryFunc = EntryFunc; TaskRecPtr->StartParams = *Params; - strncpy(TaskRecPtr->TaskName, TaskName, sizeof(TaskRecPtr->TaskName)-1); - TaskRecPtr->TaskName[sizeof(TaskRecPtr->TaskName)-1] = 0; - + strncpy(TaskRecPtr->TaskName, TaskName, sizeof(TaskRecPtr->TaskName) - 1); + TaskRecPtr->TaskName[sizeof(TaskRecPtr->TaskName) - 1] = 0; + CFE_ES_TaskRecordSetUsed(TaskRecPtr, CFE_RESOURCEID_UNWRAP(LocalTaskId)); /* @@ -639,13 +634,13 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ } else { - CFE_ES_SysLogWrite_Unsync("ES Startup: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", - TaskName,(unsigned int)StatusCode); + CFE_ES_SysLogWrite_Unsync("ES Startup: AppCreate Error: TaskCreate %s Failed. EC = 0x%08X!\n", TaskName, + (unsigned int)StatusCode); ReturnCode = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; *TaskIdPtr = CFE_ES_TASKID_UNDEFINED; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); return ReturnCode; } @@ -663,157 +658,159 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ */ int32 CFE_ES_AppCreate(CFE_ES_AppId_t *ApplicationIdPtr, const char *AppName, const CFE_ES_AppStartParams_t *Params) { - CFE_Status_t Status; - CFE_ES_AppRecord_t *AppRecPtr; - CFE_ResourceId_t PendingResourceId; + CFE_Status_t Status; + CFE_ES_AppRecord_t *AppRecPtr; + CFE_ResourceId_t PendingResourceId; + + /* + * The AppName must not be NULL + */ + if (AppName == NULL || Params == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } - /* - * The AppName must not be NULL + /* Confirm name will fit inside the record */ + if (memchr(AppName, 0, sizeof(AppRecPtr->AppName)) == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } + + /* + ** Allocate an ES_AppTable entry */ - if (AppName == NULL || Params == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } - - /* Confirm name will fit inside the record */ - if (memchr(AppName,0,sizeof(AppRecPtr->AppName)) == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } - - /* - ** Allocate an ES_AppTable entry - */ - CFE_ES_LockSharedData(__func__,__LINE__); - - /* - ** Find an ES AppTable entry, and set to RESERVED - ** - ** In this state, the entry is no longer free, but also will not pass the - ** validation test. So this function effectively has exclusive access - ** without holding the global lock. - ** - ** IMPORTANT: it must set the ID to something else before leaving - ** this function or else the resource will be leaked. After this - ** point, execution must proceed to the end of the function to - ** guarantee that the entry is either completed or freed. - */ - - /* - * Check for an existing entry with the same name. - * Also check for a matching Library name. - * (Apps and libraries should be uniquely named) + CFE_ES_LockSharedData(__func__, __LINE__); + + /* + ** Find an ES AppTable entry, and set to RESERVED + ** + ** In this state, the entry is no longer free, but also will not pass the + ** validation test. So this function effectively has exclusive access + ** without holding the global lock. + ** + ** IMPORTANT: it must set the ID to something else before leaving + ** this function or else the resource will be leaked. After this + ** point, execution must proceed to the end of the function to + ** guarantee that the entry is either completed or freed. */ - AppRecPtr = CFE_ES_LocateAppRecordByName(AppName); - if (AppRecPtr != NULL) - { - CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate app name '%s'\n", AppName); - Status = CFE_ES_ERR_DUPLICATE_NAME; - } - else - { - /* scan for a free slot */ - PendingResourceId = CFE_ResourceId_FindNext(CFE_ES_Global.LastAppId, CFE_PLATFORM_ES_MAX_APPLICATIONS, CFE_ES_CheckAppIdSlotUsed); - AppRecPtr = CFE_ES_LocateAppRecordByID(CFE_ES_APPID_C(PendingResourceId)); - - if (AppRecPtr == NULL) - { + + /* + * Check for an existing entry with the same name. + * Also check for a matching Library name. + * (Apps and libraries should be uniquely named) + */ + AppRecPtr = CFE_ES_LocateAppRecordByName(AppName); + if (AppRecPtr != NULL) + { + CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate app name '%s'\n", AppName); + Status = CFE_ES_ERR_DUPLICATE_NAME; + } + else + { + /* scan for a free slot */ + PendingResourceId = CFE_ResourceId_FindNext(CFE_ES_Global.LastAppId, CFE_PLATFORM_ES_MAX_APPLICATIONS, + CFE_ES_CheckAppIdSlotUsed); + AppRecPtr = CFE_ES_LocateAppRecordByID(CFE_ES_APPID_C(PendingResourceId)); + + if (AppRecPtr == NULL) + { CFE_ES_SysLogWrite_Unsync("ES Startup: No free application slots available\n"); Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; - } - else - { - /* Fully clear the entry, just in case of stale data */ - memset(AppRecPtr, 0, sizeof(*AppRecPtr)); - - /* Store the app name from passed-in value */ - strncpy(AppRecPtr->AppName, AppName, sizeof(AppRecPtr->AppName)-1); - - AppRecPtr->Type = CFE_ES_AppType_EXTERNAL; - - /* - * Fill out the parameters in the StartParams sub-structure - * - * This contains all relevant info, including file name, entry point, - * main task info, etc. which is required to start the app now - * or in a future restart/reload request. - */ - AppRecPtr->StartParams = *Params; - - /* - * Fill out the Task State info - */ - AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - AppRecPtr->ControlReq.AppTimerMsec = 0; - - CFE_ES_AppRecordSetUsed(AppRecPtr, CFE_RESOURCEID_RESERVED); - CFE_ES_Global.LastAppId = PendingResourceId; - Status = CFE_SUCCESS; - } - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - /* - * If ID allocation was not successful, return now. - * A message regarding the issue should have already been logged - */ - if (Status != CFE_SUCCESS) - { - return Status; - } + } + else + { + /* Fully clear the entry, just in case of stale data */ + memset(AppRecPtr, 0, sizeof(*AppRecPtr)); - /* - * Load the module based on StartParams configured above. - */ - Status = CFE_ES_LoadModule(PendingResourceId, AppName, &AppRecPtr->StartParams.BasicInfo, &AppRecPtr->LoadStatus); + /* Store the app name from passed-in value */ + strncpy(AppRecPtr->AppName, AppName, sizeof(AppRecPtr->AppName) - 1); - /* - * If the Load was OK, then complete the initialization - */ - if (Status == CFE_SUCCESS) - { - Status = CFE_ES_StartAppTask(&AppRecPtr->MainTaskId, /* Task ID (output) stored in App Record as main task */ - AppName, /* Main Task name matches app name */ - (CFE_ES_TaskEntryFuncPtr_t)AppRecPtr->LoadStatus - .InitSymbolAddress, /* Init Symbol is main task entry point */ - &AppRecPtr->StartParams.MainTaskInfo, /* Main task parameters */ - CFE_ES_APPID_C(PendingResourceId)); /* Parent App ID */ - } - - /* - * Finalize data in the app table entry, which must be done under lock. - * This transitions the entry from being RESERVED to the real ID. - */ - CFE_ES_LockSharedData(__func__,__LINE__); + AppRecPtr->Type = CFE_ES_AppType_EXTERNAL; - if ( Status == CFE_SUCCESS ) - { - /* - * important - set the ID to its proper value - * which turns this into a real/valid table entry - */ - CFE_ES_AppRecordSetUsed(AppRecPtr, PendingResourceId); + /* + * Fill out the parameters in the StartParams sub-structure + * + * This contains all relevant info, including file name, entry point, + * main task info, etc. which is required to start the app now + * or in a future restart/reload request. + */ + AppRecPtr->StartParams = *Params; - /* - ** Increment the registered App counter. - */ - CFE_ES_Global.RegisteredExternalApps++; - } - else - { - /* - * Set the table entry back to free - */ - CFE_ES_AppRecordSetFree(AppRecPtr); - PendingResourceId = CFE_RESOURCEID_UNDEFINED; - } + /* + * Fill out the Task State info + */ + AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; + AppRecPtr->ControlReq.AppTimerMsec = 0; + + CFE_ES_AppRecordSetUsed(AppRecPtr, CFE_RESOURCEID_RESERVED); + CFE_ES_Global.LastAppId = PendingResourceId; + Status = CFE_SUCCESS; + } + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); + + /* + * If ID allocation was not successful, return now. + * A message regarding the issue should have already been logged + */ + if (Status != CFE_SUCCESS) + { + return Status; + } - CFE_ES_UnlockSharedData(__func__,__LINE__); + /* + * Load the module based on StartParams configured above. + */ + Status = CFE_ES_LoadModule(PendingResourceId, AppName, &AppRecPtr->StartParams.BasicInfo, &AppRecPtr->LoadStatus); + + /* + * If the Load was OK, then complete the initialization + */ + if (Status == CFE_SUCCESS) + { + Status = + CFE_ES_StartAppTask(&AppRecPtr->MainTaskId, /* Task ID (output) stored in App Record as main task */ + AppName, /* Main Task name matches app name */ + (CFE_ES_TaskEntryFuncPtr_t) + AppRecPtr->LoadStatus.InitSymbolAddress, /* Init Symbol is main task entry point */ + &AppRecPtr->StartParams.MainTaskInfo, /* Main task parameters */ + CFE_ES_APPID_C(PendingResourceId)); /* Parent App ID */ + } - *ApplicationIdPtr = CFE_ES_APPID_C(PendingResourceId); + /* + * Finalize data in the app table entry, which must be done under lock. + * This transitions the entry from being RESERVED to the real ID. + */ + CFE_ES_LockSharedData(__func__, __LINE__); - return Status; + if (Status == CFE_SUCCESS) + { + /* + * important - set the ID to its proper value + * which turns this into a real/valid table entry + */ + CFE_ES_AppRecordSetUsed(AppRecPtr, PendingResourceId); + + /* + ** Increment the registered App counter. + */ + CFE_ES_Global.RegisteredExternalApps++; + } + else + { + /* + * Set the table entry back to free + */ + CFE_ES_AppRecordSetFree(AppRecPtr); + PendingResourceId = CFE_RESOURCEID_UNDEFINED; + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); + + *ApplicationIdPtr = CFE_ES_APPID_C(PendingResourceId); + + return Status; } /* End Function */ @@ -827,30 +824,30 @@ int32 CFE_ES_AppCreate(CFE_ES_AppId_t *ApplicationIdPtr, const char *AppName, co */ int32 CFE_ES_LoadLibrary(CFE_ES_LibId_t *LibraryIdPtr, const char *LibName, const CFE_ES_ModuleLoadParams_t *Params) { - CFE_ES_LibraryEntryFuncPtr_t FunctionPointer; - CFE_ES_LibRecord_t * LibSlotPtr; - int32 Status; - CFE_ResourceId_t PendingResourceId; + CFE_ES_LibraryEntryFuncPtr_t FunctionPointer; + CFE_ES_LibRecord_t * LibSlotPtr; + int32 Status; + CFE_ResourceId_t PendingResourceId; - /* - * The LibName must not be NULL + /* + * The LibName must not be NULL + */ + if (LibName == NULL || Params == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } + + /* Confirm name will fit inside the record */ + if (memchr(LibName, 0, sizeof(LibSlotPtr->LibName)) == NULL) + { + return CFE_ES_BAD_ARGUMENT; + } + + /* + ** Allocate an ES_LibTable entry */ - if (LibName == NULL || Params == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } - - /* Confirm name will fit inside the record */ - if (memchr(LibName,0,sizeof(LibSlotPtr->LibName)) == NULL) - { - return CFE_ES_BAD_ARGUMENT; - } - - /* - ** Allocate an ES_LibTable entry - */ - FunctionPointer = NULL; - PendingResourceId = CFE_RESOURCEID_UNDEFINED; + FunctionPointer = NULL; + PendingResourceId = CFE_RESOURCEID_UNDEFINED; /* ** Find an ES AppTable entry, and set to RESERVED @@ -864,114 +861,113 @@ int32 CFE_ES_LoadLibrary(CFE_ES_LibId_t *LibraryIdPtr, const char *LibName, cons ** point, execution must proceed to the end of the function to ** guarantee that the entry is either completed or freed. */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); - /* - * Check for an existing entry with the same name. - * Also check for a matching Library name. - * (Libs and libraries should be uniquely named) - */ - LibSlotPtr = CFE_ES_LocateLibRecordByName(LibName); - if (LibSlotPtr != NULL || CFE_ES_LocateAppRecordByName(LibName) != NULL) - { - CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate Lib name '%s'\n", LibName); - if (LibSlotPtr != NULL) - { - PendingResourceId = CFE_RESOURCEID_UNWRAP(CFE_ES_LibRecordGetID(LibSlotPtr)); - } - Status = CFE_ES_ERR_DUPLICATE_NAME; - } - else - { - /* scan for a free slot */ - PendingResourceId = CFE_ResourceId_FindNext(CFE_ES_Global.LastLibId, CFE_PLATFORM_ES_MAX_LIBRARIES, CFE_ES_CheckLibIdSlotUsed); - LibSlotPtr = CFE_ES_LocateLibRecordByID(CFE_ES_LIBID_C(PendingResourceId)); - - if (LibSlotPtr == NULL) - { - CFE_ES_SysLogWrite_Unsync("ES Startup: No free library slots available\n"); - Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; - } - else - { - /* Fully clear the entry, just in case of stale data */ - memset(LibSlotPtr, 0, sizeof(*LibSlotPtr)); - - /* - * Fill out the parameters in the AppStartParams sub-structure - */ - strncpy(LibSlotPtr->LibName, LibName, - sizeof(LibSlotPtr->LibName)-1); - LibSlotPtr->LibName[sizeof(LibSlotPtr->LibName)-1] = '\0'; - LibSlotPtr->LoadParams = *Params; - - CFE_ES_LibRecordSetUsed(LibSlotPtr, CFE_RESOURCEID_RESERVED); - CFE_ES_Global.LastLibId = PendingResourceId; - Status = CFE_SUCCESS; - } - } - - CFE_ES_UnlockSharedData(__func__,__LINE__); - - /* - * If any off-nominal condition exists, skip the rest of this logic. - * (Log message already written) - */ - if (Status != CFE_SUCCESS) - { - *LibraryIdPtr = CFE_ES_LIBID_C(PendingResourceId); - return Status; - } - - /* - * Load the module based on StartParams configured above. - */ - Status = CFE_ES_LoadModule(PendingResourceId, LibName, &LibSlotPtr->LoadParams, &LibSlotPtr->LoadStatus); - if (Status == CFE_SUCCESS) - { - FunctionPointer = (CFE_ES_LibraryEntryFuncPtr_t)LibSlotPtr->LoadStatus.InitSymbolAddress; - if (FunctionPointer != NULL) - { - Status = (*FunctionPointer)(CFE_ES_LIBID_C(PendingResourceId)); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("ES Startup: Load Shared Library Init Error = 0x%08x\n", - (unsigned int)Status); - } - } - } - - /* - * Finalize data in the app table entry, which must be done under lock. - * This transitions the entry from being RESERVED to the real type, - * either MAIN_TASK (success) or returning to INVALID (failure). - */ - CFE_ES_LockSharedData(__func__,__LINE__); + /* + * Check for an existing entry with the same name. + * Also check for a matching Library name. + * (Libs and libraries should be uniquely named) + */ + LibSlotPtr = CFE_ES_LocateLibRecordByName(LibName); + if (LibSlotPtr != NULL || CFE_ES_LocateAppRecordByName(LibName) != NULL) + { + CFE_ES_SysLogWrite_Unsync("ES Startup: Duplicate Lib name '%s'\n", LibName); + if (LibSlotPtr != NULL) + { + PendingResourceId = CFE_RESOURCEID_UNWRAP(CFE_ES_LibRecordGetID(LibSlotPtr)); + } + Status = CFE_ES_ERR_DUPLICATE_NAME; + } + else + { + /* scan for a free slot */ + PendingResourceId = + CFE_ResourceId_FindNext(CFE_ES_Global.LastLibId, CFE_PLATFORM_ES_MAX_LIBRARIES, CFE_ES_CheckLibIdSlotUsed); + LibSlotPtr = CFE_ES_LocateLibRecordByID(CFE_ES_LIBID_C(PendingResourceId)); + + if (LibSlotPtr == NULL) + { + CFE_ES_SysLogWrite_Unsync("ES Startup: No free library slots available\n"); + Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; + } + else + { + /* Fully clear the entry, just in case of stale data */ + memset(LibSlotPtr, 0, sizeof(*LibSlotPtr)); + + /* + * Fill out the parameters in the AppStartParams sub-structure + */ + strncpy(LibSlotPtr->LibName, LibName, sizeof(LibSlotPtr->LibName) - 1); + LibSlotPtr->LibName[sizeof(LibSlotPtr->LibName) - 1] = '\0'; + LibSlotPtr->LoadParams = *Params; + + CFE_ES_LibRecordSetUsed(LibSlotPtr, CFE_RESOURCEID_RESERVED); + CFE_ES_Global.LastLibId = PendingResourceId; + Status = CFE_SUCCESS; + } + } - if ( Status == CFE_SUCCESS ) - { - /* - * important - set the ID to its proper value - * which turns this into a real/valid table entry - */ - CFE_ES_LibRecordSetUsed(LibSlotPtr, PendingResourceId); + CFE_ES_UnlockSharedData(__func__, __LINE__); - /* - * Increment the registered Lib counter. - */ - CFE_ES_Global.RegisteredLibs++; - } - else - { - CFE_ES_LibRecordSetFree(LibSlotPtr); - PendingResourceId = CFE_RESOURCEID_UNDEFINED; - } + /* + * If any off-nominal condition exists, skip the rest of this logic. + * (Log message already written) + */ + if (Status != CFE_SUCCESS) + { + *LibraryIdPtr = CFE_ES_LIBID_C(PendingResourceId); + return Status; + } + + /* + * Load the module based on StartParams configured above. + */ + Status = CFE_ES_LoadModule(PendingResourceId, LibName, &LibSlotPtr->LoadParams, &LibSlotPtr->LoadStatus); + if (Status == CFE_SUCCESS) + { + FunctionPointer = (CFE_ES_LibraryEntryFuncPtr_t)LibSlotPtr->LoadStatus.InitSymbolAddress; + if (FunctionPointer != NULL) + { + Status = (*FunctionPointer)(CFE_ES_LIBID_C(PendingResourceId)); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Load Shared Library Init Error = 0x%08x\n", (unsigned int)Status); + } + } + } + + /* + * Finalize data in the app table entry, which must be done under lock. + * This transitions the entry from being RESERVED to the real type, + * either MAIN_TASK (success) or returning to INVALID (failure). + */ + CFE_ES_LockSharedData(__func__, __LINE__); + + if (Status == CFE_SUCCESS) + { + /* + * important - set the ID to its proper value + * which turns this into a real/valid table entry + */ + CFE_ES_LibRecordSetUsed(LibSlotPtr, PendingResourceId); + + /* + * Increment the registered Lib counter. + */ + CFE_ES_Global.RegisteredLibs++; + } + else + { + CFE_ES_LibRecordSetFree(LibSlotPtr); + PendingResourceId = CFE_RESOURCEID_UNDEFINED; + } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - *LibraryIdPtr = CFE_ES_LIBID_C(PendingResourceId); + *LibraryIdPtr = CFE_ES_LIBID_C(PendingResourceId); - return(Status); + return (Status); } /* End Function */ @@ -986,123 +982,118 @@ int32 CFE_ES_LoadLibrary(CFE_ES_LibId_t *LibraryIdPtr, const char *LibName, cons */ bool CFE_ES_RunAppTableScan(uint32 ElapsedTime, void *Arg) { - CFE_ES_AppTableScanState_t *State = (CFE_ES_AppTableScanState_t *)Arg; - uint32 i; - CFE_ES_AppRecord_t *AppPtr; - CFE_ES_AppId_t AppTimeoutList[CFE_PLATFORM_ES_MAX_APPLICATIONS]; - uint32 NumAppTimeouts; - - if (State->PendingAppStateChanges == 0) - { - /* - * If the command count changes, then a scan becomes due immediately. - */ - if (State->LastScanCommandCount == CFE_ES_TaskData.CommandCounter && - State->BackgroundScanTimer > ElapsedTime) - { - /* no action at this time, background scan is not due yet */ - State->BackgroundScanTimer -= ElapsedTime; - return false; - } - } - - /* - * Every time a scan is initiated (for any reason) - * reset the background scan timer to the full value, - * and take a snapshot of the the command counter. - */ - NumAppTimeouts = 0; - State->BackgroundScanTimer = CFE_PLATFORM_ES_APP_SCAN_RATE; - State->LastScanCommandCount = CFE_ES_TaskData.CommandCounter; - State->PendingAppStateChanges = 0; - - /* - * Scan needs to be done with the table locked, - * as these state changes need to be done atomically - * with respect to other tasks that also access/update - * the state. - */ - CFE_ES_LockSharedData(__func__,__LINE__); - - /* - ** Scan the ES Application table. Skip entries that are: - ** - Not in use, or - ** - cFE Core apps, or - ** - Currently running - */ - AppPtr = CFE_ES_Global.AppTable; - for ( i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++ ) - { - if ( CFE_ES_AppRecordIsUsed(AppPtr) && AppPtr->Type == CFE_ES_AppType_EXTERNAL) - { - if (AppPtr->AppState > CFE_ES_AppState_RUNNING) - { - /* - * Increment the "pending" counter which reflects - * the number of apps that are in some phase of clean up. - */ - ++State->PendingAppStateChanges; + CFE_ES_AppTableScanState_t *State = (CFE_ES_AppTableScanState_t *)Arg; + uint32 i; + CFE_ES_AppRecord_t * AppPtr; + CFE_ES_AppId_t AppTimeoutList[CFE_PLATFORM_ES_MAX_APPLICATIONS]; + uint32 NumAppTimeouts; - /* - * Decrement the wait timer, if active. - * When the timeout value becomes zero, take the action to delete/restart/reload the app - */ - if ( AppPtr->ControlReq.AppTimerMsec > ElapsedTime ) - { - AppPtr->ControlReq.AppTimerMsec -= ElapsedTime; - } - else - { - AppPtr->ControlReq.AppTimerMsec = 0; + if (State->PendingAppStateChanges == 0) + { + /* + * If the command count changes, then a scan becomes due immediately. + */ + if (State->LastScanCommandCount == CFE_ES_TaskData.CommandCounter && State->BackgroundScanTimer > ElapsedTime) + { + /* no action at this time, background scan is not due yet */ + State->BackgroundScanTimer -= ElapsedTime; + return false; + } + } - /* Add it to the list to be processed later */ - AppTimeoutList[NumAppTimeouts] = CFE_ES_AppRecordGetID(AppPtr); - ++NumAppTimeouts; - } - } - else if (AppPtr->AppState == CFE_ES_AppState_RUNNING && - AppPtr->ControlReq.AppControlRequest > CFE_ES_RunStatus_APP_RUN) - { - /* this happens after a command arrives to restart/reload/delete an app */ - /* switch to WAITING state, and set the timer for transition */ - AppPtr->AppState = CFE_ES_AppState_WAITING; - AppPtr->ControlReq.AppTimerMsec = CFE_PLATFORM_ES_APP_KILL_TIMEOUT * CFE_PLATFORM_ES_APP_SCAN_RATE; - } + /* + * Every time a scan is initiated (for any reason) + * reset the background scan timer to the full value, + * and take a snapshot of the the command counter. + */ + NumAppTimeouts = 0; + State->BackgroundScanTimer = CFE_PLATFORM_ES_APP_SCAN_RATE; + State->LastScanCommandCount = CFE_ES_TaskData.CommandCounter; + State->PendingAppStateChanges = 0; + /* + * Scan needs to be done with the table locked, + * as these state changes need to be done atomically + * with respect to other tasks that also access/update + * the state. + */ + CFE_ES_LockSharedData(__func__, __LINE__); - } /* end if */ + /* + ** Scan the ES Application table. Skip entries that are: + ** - Not in use, or + ** - cFE Core apps, or + ** - Currently running + */ + AppPtr = CFE_ES_Global.AppTable; + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) + { + if (CFE_ES_AppRecordIsUsed(AppPtr) && AppPtr->Type == CFE_ES_AppType_EXTERNAL) + { + if (AppPtr->AppState > CFE_ES_AppState_RUNNING) + { + /* + * Increment the "pending" counter which reflects + * the number of apps that are in some phase of clean up. + */ + ++State->PendingAppStateChanges; - ++AppPtr; + /* + * Decrement the wait timer, if active. + * When the timeout value becomes zero, take the action to delete/restart/reload the app + */ + if (AppPtr->ControlReq.AppTimerMsec > ElapsedTime) + { + AppPtr->ControlReq.AppTimerMsec -= ElapsedTime; + } + else + { + AppPtr->ControlReq.AppTimerMsec = 0; - } /* end for loop */ + /* Add it to the list to be processed later */ + AppTimeoutList[NumAppTimeouts] = CFE_ES_AppRecordGetID(AppPtr); + ++NumAppTimeouts; + } + } + else if (AppPtr->AppState == CFE_ES_AppState_RUNNING && + AppPtr->ControlReq.AppControlRequest > CFE_ES_RunStatus_APP_RUN) + { + /* this happens after a command arrives to restart/reload/delete an app */ + /* switch to WAITING state, and set the timer for transition */ + AppPtr->AppState = CFE_ES_AppState_WAITING; + AppPtr->ControlReq.AppTimerMsec = CFE_PLATFORM_ES_APP_KILL_TIMEOUT * CFE_PLATFORM_ES_APP_SCAN_RATE; + } - CFE_ES_UnlockSharedData(__func__,__LINE__); + } /* end if */ + ++AppPtr; - /* - * Now invoke the CFE_ES_ProcessControlRequest() routine for any app - * which has reached that point. - */ - for ( i = 0; i < NumAppTimeouts; i++ ) - { - /* - * Call CFE_ES_ProcessControlRequest() with a reference to - * the _copies_ of the app record details. (This avoids - * needing to access the global records outside of the lock). - */ - CFE_ES_ProcessControlRequest(AppTimeoutList[i]); - } + } /* end for loop */ + CFE_ES_UnlockSharedData(__func__, __LINE__); - /* - * This state machine is considered active if there are any - * pending app state changes. Returning "true" will cause this job - * to be called from the background task at a faster interval. - */ - return (State->PendingAppStateChanges != 0); + /* + * Now invoke the CFE_ES_ProcessControlRequest() routine for any app + * which has reached that point. + */ + for (i = 0; i < NumAppTimeouts; i++) + { + /* + * Call CFE_ES_ProcessControlRequest() with a reference to + * the _copies_ of the app record details. (This avoids + * needing to access the global records outside of the lock). + */ + CFE_ES_ProcessControlRequest(AppTimeoutList[i]); + } -} /* End Function */ + /* + * This state machine is considered active if there are any + * pending app state changes. Returning "true" will cause this job + * to be called from the background task at a faster interval. + */ + return (State->PendingAppStateChanges != 0); +} /* End Function */ /* **--------------------------------------------------------------------------------------- @@ -1113,56 +1104,53 @@ bool CFE_ES_RunAppTableScan(uint32 ElapsedTime, void *Arg) */ void CFE_ES_ProcessControlRequest(CFE_ES_AppId_t AppId) { - CFE_ES_AppRecord_t *AppRecPtr; + CFE_ES_AppRecord_t * AppRecPtr; uint32 PendingControlReq; CFE_ES_AppStartParams_t RestartParams; char OrigAppName[OS_MAX_API_NAME]; CFE_Status_t CleanupStatus; CFE_Status_t StartupStatus; CFE_ES_AppId_t NewAppId; - const char *ReqName; + const char * ReqName; char MessageDetail[48]; uint16 EventID; CFE_EVS_EventType_Enum_t EventType; /* Init/clear all local state variables */ - ReqName = NULL; - MessageDetail[0] = 0; - EventID = 0; - EventType = 0; - StartupStatus = CFE_SUCCESS; + ReqName = NULL; + MessageDetail[0] = 0; + EventID = 0; + EventType = 0; + StartupStatus = CFE_SUCCESS; PendingControlReq = 0; - NewAppId = CFE_ES_APPID_UNDEFINED; - OrigAppName[0] = 0; + NewAppId = CFE_ES_APPID_UNDEFINED; + OrigAppName[0] = 0; memset(&RestartParams, 0, sizeof(RestartParams)); AppRecPtr = CFE_ES_LocateAppRecordByID(AppId); - - /* * Take a local snapshot of the important app record data * This way it becomes private and can be accessed without * concerns about other threads/tasks, even after the global * data records are eventually cleared. */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); if (CFE_ES_AppRecordIsMatch(AppRecPtr, AppId)) { PendingControlReq = AppRecPtr->ControlReq.AppControlRequest; - strncpy(OrigAppName, AppRecPtr->AppName, sizeof(OrigAppName)-1); - OrigAppName[sizeof(OrigAppName)-1] = 0; + strncpy(OrigAppName, AppRecPtr->AppName, sizeof(OrigAppName) - 1); + OrigAppName[sizeof(OrigAppName) - 1] = 0; /* If a restart was requested, copy the parameters to re-use in new app */ - if ( PendingControlReq == CFE_ES_RunStatus_SYS_RESTART || - PendingControlReq == CFE_ES_RunStatus_SYS_RELOAD ) + if (PendingControlReq == CFE_ES_RunStatus_SYS_RESTART || PendingControlReq == CFE_ES_RunStatus_SYS_RELOAD) { RestartParams = AppRecPtr->StartParams; } } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); /* * All control requests start by deleting the app/task and @@ -1186,8 +1174,7 @@ void CFE_ES_ProcessControlRequest(CFE_ES_AppId_t AppId) * Attempt to restart the app if the request indicated to do so, * regardless of the CleanupStatus. */ - if ( PendingControlReq == CFE_ES_RunStatus_SYS_RESTART || - PendingControlReq == CFE_ES_RunStatus_SYS_RELOAD ) + if (PendingControlReq == CFE_ES_RunStatus_SYS_RESTART || PendingControlReq == CFE_ES_RunStatus_SYS_RELOAD) { StartupStatus = CFE_ES_AppCreate(&NewAppId, OrigAppName, &RestartParams); } @@ -1200,134 +1187,132 @@ void CFE_ES_ProcessControlRequest(CFE_ES_AppId_t AppId) * Note that the specific event ID that gets generated is the only * other difference between all these control request types. */ - switch ( PendingControlReq ) + switch (PendingControlReq) { - case CFE_ES_RunStatus_APP_EXIT: - ReqName = "Exit"; - if (CleanupStatus != CFE_SUCCESS) - { - /* error event for this request */ - EventID = CFE_ES_EXIT_APP_ERR_EID; - } - else - { - /* success event for this request */ - EventID = CFE_ES_EXIT_APP_INF_EID; - } - break; + case CFE_ES_RunStatus_APP_EXIT: + ReqName = "Exit"; + if (CleanupStatus != CFE_SUCCESS) + { + /* error event for this request */ + EventID = CFE_ES_EXIT_APP_ERR_EID; + } + else + { + /* success event for this request */ + EventID = CFE_ES_EXIT_APP_INF_EID; + } + break; - case CFE_ES_RunStatus_APP_ERROR: - ReqName = "Exit"; - if ( CleanupStatus != CFE_SUCCESS ) - { - /* error event for this request */ - EventID = CFE_ES_ERREXIT_APP_ERR_EID; - } - else - { - /* success event for this request */ - EventID = CFE_ES_ERREXIT_APP_INF_EID; - } - break; + case CFE_ES_RunStatus_APP_ERROR: + ReqName = "Exit"; + if (CleanupStatus != CFE_SUCCESS) + { + /* error event for this request */ + EventID = CFE_ES_ERREXIT_APP_ERR_EID; + } + else + { + /* success event for this request */ + EventID = CFE_ES_ERREXIT_APP_INF_EID; + } + break; - case CFE_ES_RunStatus_SYS_DELETE: - ReqName = "Stop"; - if ( CleanupStatus != CFE_SUCCESS ) - { - /* error event for this request */ - EventID = CFE_ES_STOP_ERR3_EID; - } - else - { - /* success event for this request */ - EventID = CFE_ES_STOP_INF_EID; - } - break; + case CFE_ES_RunStatus_SYS_DELETE: + ReqName = "Stop"; + if (CleanupStatus != CFE_SUCCESS) + { + /* error event for this request */ + EventID = CFE_ES_STOP_ERR3_EID; + } + else + { + /* success event for this request */ + EventID = CFE_ES_STOP_INF_EID; + } + break; - case CFE_ES_RunStatus_SYS_RESTART: - ReqName = "Restart"; - if ( CleanupStatus != CFE_SUCCESS ) - { - /* error event for this request */ - EventID = CFE_ES_RESTART_APP_ERR4_EID; - } - else if ( StartupStatus != CFE_SUCCESS ) - { - /* error event for this request */ - EventID = CFE_ES_RESTART_APP_ERR3_EID; - } - else - { - /* success event for this request */ - EventID = CFE_ES_RESTART_APP_INF_EID; - } - break; + case CFE_ES_RunStatus_SYS_RESTART: + ReqName = "Restart"; + if (CleanupStatus != CFE_SUCCESS) + { + /* error event for this request */ + EventID = CFE_ES_RESTART_APP_ERR4_EID; + } + else if (StartupStatus != CFE_SUCCESS) + { + /* error event for this request */ + EventID = CFE_ES_RESTART_APP_ERR3_EID; + } + else + { + /* success event for this request */ + EventID = CFE_ES_RESTART_APP_INF_EID; + } + break; - case CFE_ES_RunStatus_SYS_RELOAD: - ReqName = "Reload"; - if ( CleanupStatus != CFE_SUCCESS ) - { - /* error event for this request */ - EventID = CFE_ES_RELOAD_APP_ERR4_EID; - } - else if ( StartupStatus != CFE_SUCCESS ) - { - /* error event for this request */ - EventID = CFE_ES_RELOAD_APP_ERR3_EID; - } - else - { - /* success event for this request */ - EventID = CFE_ES_RELOAD_APP_INF_EID; - } - break; + case CFE_ES_RunStatus_SYS_RELOAD: + ReqName = "Reload"; + if (CleanupStatus != CFE_SUCCESS) + { + /* error event for this request */ + EventID = CFE_ES_RELOAD_APP_ERR4_EID; + } + else if (StartupStatus != CFE_SUCCESS) + { + /* error event for this request */ + EventID = CFE_ES_RELOAD_APP_ERR3_EID; + } + else + { + /* success event for this request */ + EventID = CFE_ES_RELOAD_APP_INF_EID; + } + break; - /* - * These two cases below should never occur so they are always - * reported as errors, but the CFE_ES_CleanUpApp() should hopefully - * have fixed it either way. - */ - case CFE_ES_RunStatus_SYS_EXCEPTION: - ReqName = "ES_ProcControlReq: Invalid State"; - EventID = CFE_ES_PCR_ERR1_EID; - snprintf(MessageDetail, sizeof(MessageDetail), "EXCEPTION"); - break; - - default: - ReqName = "ES_ProcControlReq: Unknown State"; - EventID = CFE_ES_PCR_ERR2_EID; - snprintf(MessageDetail, sizeof(MessageDetail), "( %lu )", - (unsigned long)PendingControlReq); - break; + /* + * These two cases below should never occur so they are always + * reported as errors, but the CFE_ES_CleanUpApp() should hopefully + * have fixed it either way. + */ + case CFE_ES_RunStatus_SYS_EXCEPTION: + ReqName = "ES_ProcControlReq: Invalid State"; + EventID = CFE_ES_PCR_ERR1_EID; + snprintf(MessageDetail, sizeof(MessageDetail), "EXCEPTION"); + break; + + default: + ReqName = "ES_ProcControlReq: Unknown State"; + EventID = CFE_ES_PCR_ERR2_EID; + snprintf(MessageDetail, sizeof(MessageDetail), "( %lu )", (unsigned long)PendingControlReq); + break; } if (EventID != 0 && ReqName != NULL) { - if ( MessageDetail[0] != 0 ) + if (MessageDetail[0] != 0) { /* Detail message already set, assume it is an error event */ EventType = CFE_EVS_EventType_ERROR; } - else if ( StartupStatus != CFE_SUCCESS ) + else if (StartupStatus != CFE_SUCCESS) { /* Make detail message for event containing startup error code */ EventType = CFE_EVS_EventType_ERROR; - snprintf(MessageDetail, sizeof(MessageDetail), - "Failed: AppCreate Error 0x%08X.",(unsigned int)StartupStatus); + snprintf(MessageDetail, sizeof(MessageDetail), "Failed: AppCreate Error 0x%08X.", + (unsigned int)StartupStatus); } - else if ( CleanupStatus != CFE_SUCCESS ) + else if (CleanupStatus != CFE_SUCCESS) { /* Make detail message for event containing cleanup error code */ EventType = CFE_EVS_EventType_ERROR; - snprintf(MessageDetail, sizeof(MessageDetail), - "Failed: CleanUpApp Error 0x%08X.",(unsigned int)CleanupStatus); + snprintf(MessageDetail, sizeof(MessageDetail), "Failed: CleanUpApp Error 0x%08X.", + (unsigned int)CleanupStatus); } else if (CFE_RESOURCEID_TEST_DEFINED(NewAppId)) { /* Record success message for event where app is restarted */ EventType = CFE_EVS_EventType_INFORMATION; - snprintf(MessageDetail, sizeof(MessageDetail), "Completed, AppID=%lu", - CFE_RESOURCEID_TO_ULONG(NewAppId)); + snprintf(MessageDetail, sizeof(MessageDetail), "Completed, AppID=%lu", CFE_RESOURCEID_TO_ULONG(NewAppId)); } else { @@ -1336,8 +1321,7 @@ void CFE_ES_ProcessControlRequest(CFE_ES_AppId_t AppId) snprintf(MessageDetail, sizeof(MessageDetail), "Completed."); } - CFE_EVS_SendEvent(EventID, EventType, "%s Application %s %s", - ReqName, OrigAppName, MessageDetail); + CFE_EVS_SendEvent(EventID, EventType, "%s Application %s %s", ReqName, OrigAppName, MessageDetail); } } /* End Function */ @@ -1351,22 +1335,21 @@ void CFE_ES_ProcessControlRequest(CFE_ES_AppId_t AppId) */ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) { - uint32 i; - int32 Status; - int32 ReturnCode; - CFE_ES_TaskId_t TaskList[OS_MAX_TASKS]; - CFE_ES_MemHandle_t PoolList[CFE_PLATFORM_ES_MAX_MEMORY_POOLS]; - osal_id_t ModuleId; - uint32 NumTasks; - uint32 NumPools; - CFE_ES_AppRecord_t *AppRecPtr; - CFE_ES_TaskRecord_t *TaskRecPtr; - CFE_ES_MemPoolRecord_t *MemPoolRecPtr; - - - NumTasks = 0; - NumPools = 0; - ModuleId = OS_OBJECT_ID_UNDEFINED; + uint32 i; + int32 Status; + int32 ReturnCode; + CFE_ES_TaskId_t TaskList[OS_MAX_TASKS]; + CFE_ES_MemHandle_t PoolList[CFE_PLATFORM_ES_MAX_MEMORY_POOLS]; + osal_id_t ModuleId; + uint32 NumTasks; + uint32 NumPools; + CFE_ES_AppRecord_t * AppRecPtr; + CFE_ES_TaskRecord_t * TaskRecPtr; + CFE_ES_MemPoolRecord_t *MemPoolRecPtr; + + NumTasks = 0; + NumPools = 0; + ModuleId = OS_OBJECT_ID_UNDEFINED; ReturnCode = CFE_SUCCESS; AppRecPtr = CFE_ES_LocateAppRecordByID(AppId); @@ -1375,7 +1358,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) * Collect a list of resources previously owned by this app, which * must be done while the global data is locked. */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); if (CFE_ES_AppRecordIsMatch(AppRecPtr, AppId)) { @@ -1395,19 +1378,17 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) * Collect all tasks associated with this app */ TaskRecPtr = CFE_ES_Global.TaskTable; - for ( i = 0; i < OS_MAX_TASKS; i++ ) + for (i = 0; i < OS_MAX_TASKS; i++) { - if ( CFE_ES_TaskRecordIsUsed(TaskRecPtr) && - CFE_RESOURCEID_TEST_EQUAL(TaskRecPtr->AppId, AppId)) + if (CFE_ES_TaskRecordIsUsed(TaskRecPtr) && CFE_RESOURCEID_TEST_EQUAL(TaskRecPtr->AppId, AppId)) { TaskList[NumTasks] = CFE_ES_TaskRecordGetID(TaskRecPtr); /* Store the main task ID at index 0 (swap with whatever was there) */ - if (CFE_RESOURCEID_TEST_EQUAL(TaskList[NumTasks], AppRecPtr->MainTaskId) && - NumTasks != 0) + if (CFE_RESOURCEID_TEST_EQUAL(TaskList[NumTasks], AppRecPtr->MainTaskId) && NumTasks != 0) { TaskList[NumTasks] = TaskList[0]; - TaskList[0] = AppRecPtr->MainTaskId; + TaskList[0] = AppRecPtr->MainTaskId; } /* Mark record for removal */ @@ -1424,10 +1405,10 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) * Collect memory pools associated with this app */ MemPoolRecPtr = CFE_ES_Global.MemPoolTable; - for ( i = 0; i < CFE_PLATFORM_ES_MAX_MEMORY_POOLS; i++ ) + for (i = 0; i < CFE_PLATFORM_ES_MAX_MEMORY_POOLS; i++) { - if ( CFE_ES_MemPoolRecordIsUsed(MemPoolRecPtr) && - CFE_RESOURCEID_TEST_EQUAL(MemPoolRecPtr->OwnerAppID, AppId)) + if (CFE_ES_MemPoolRecordIsUsed(MemPoolRecPtr) && + CFE_RESOURCEID_TEST_EQUAL(MemPoolRecPtr->OwnerAppID, AppId)) { PoolList[NumPools] = CFE_ES_MemPoolRecordGetID(MemPoolRecPtr); ++NumPools; @@ -1447,7 +1428,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) else { CFE_ES_SysLogWrite_Unsync("CFE_ES_CleanUpApp: AppID %lu is not valid for deletion\n", - CFE_RESOURCEID_TO_ULONG(AppId)); + CFE_RESOURCEID_TO_ULONG(AppId)); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } @@ -1458,7 +1439,6 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) return ReturnCode; } - /* * Now actually delete all the resources associated with the task. * @@ -1486,9 +1466,10 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) ** Call the EVS Clean up function */ Status = CFE_EVS_CleanUpApp(AppId); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: Call to CFE_EVS_CleanUpApp returned Error: 0x%08X\n",(unsigned int)Status); + CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: Call to CFE_EVS_CleanUpApp returned Error: 0x%08X\n", + (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } @@ -1505,10 +1486,10 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) { --i; Status = CFE_ES_CleanupTaskResources(TaskList[i]); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: CleanUpTaskResources for Task ID:%lu returned Error: 0x%08X\n", - CFE_RESOURCEID_TO_ULONG(TaskList[i]), (unsigned int)Status); + CFE_RESOURCEID_TO_ULONG(TaskList[i]), (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } } @@ -1516,13 +1497,13 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) /* * Delete all mem pools. */ - for (i=0; i < NumPools; ++i) + for (i = 0; i < NumPools; ++i) { Status = CFE_ES_PoolDelete(PoolList[i]); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("CFE_ES_MemPoolCleanupApp: delete pool %lu returned Error: 0x%08X\n", - CFE_RESOURCEID_TO_ULONG(PoolList[i]), (unsigned int)Status); + CFE_RESOURCEID_TO_ULONG(PoolList[i]), (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } } @@ -1530,16 +1511,16 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) /* ** Unload the module, if applicable */ - if ( OS_ObjectIdDefined(ModuleId) ) + if (OS_ObjectIdDefined(ModuleId)) { /* ** Unload the module only if it is an external app */ Status = OS_ModuleUnload(ModuleId); - if ( Status != OS_SUCCESS ) + if (Status != OS_SUCCESS) { CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: Module (ID:0x%08lX) Unload failed. RC=0x%08X\n", - OS_ObjectIdToInteger(ModuleId), (unsigned int)Status); + OS_ObjectIdToInteger(ModuleId), (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } } @@ -1548,12 +1529,12 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) * Finally, re-acquire the ES lock and set all * table entries free for re-use. */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* * Free all task records. */ - for (i=0; i < NumTasks; ++i) + for (i = 0; i < NumTasks; ++i) { TaskRecPtr = CFE_ES_LocateTaskRecordByID(TaskList[i]); if (CFE_ES_TaskRecordIsMatch(TaskRecPtr, CFE_ES_TASKID_C(CFE_RESOURCEID_RESERVED))) @@ -1570,13 +1551,12 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId) CFE_ES_AppRecordSetFree(AppRecPtr); } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - return(ReturnCode); + return (ReturnCode); } /* end function */ - /* * Simple state structure used when cleaning up objects associated with tasks * @@ -1602,45 +1582,45 @@ typedef struct */ void CFE_ES_CleanupObjectCallback(osal_id_t ObjectId, void *arg) { - CFE_ES_CleanupState_t *CleanState; - int32 Status; - osal_objtype_t ObjType; - bool ObjIsValid; + CFE_ES_CleanupState_t *CleanState; + int32 Status; + osal_objtype_t ObjType; + bool ObjIsValid; CleanState = (CFE_ES_CleanupState_t *)arg; ObjIsValid = true; ObjType = OS_IdentifyObject(ObjectId); - switch(ObjType) + switch (ObjType) { - case OS_OBJECT_TYPE_OS_TASK: - Status = OS_TaskDelete(ObjectId); - break; - case OS_OBJECT_TYPE_OS_QUEUE: - Status = OS_QueueDelete(ObjectId); - break; - case OS_OBJECT_TYPE_OS_BINSEM: - Status = OS_BinSemDelete(ObjectId); - break; - case OS_OBJECT_TYPE_OS_COUNTSEM: - Status = OS_CountSemDelete(ObjectId); - break; - case OS_OBJECT_TYPE_OS_MUTEX: - Status = OS_MutSemDelete(ObjectId); - break; - case OS_OBJECT_TYPE_OS_TIMECB: - Status = OS_TimerDelete(ObjectId); - break; - case OS_OBJECT_TYPE_OS_STREAM: - Status = OS_close(ObjectId); - break; - case OS_OBJECT_TYPE_OS_MODULE: - Status = OS_ModuleUnload(ObjectId); - break; - default: - ObjIsValid = false; - Status = OS_ERROR; - break; + case OS_OBJECT_TYPE_OS_TASK: + Status = OS_TaskDelete(ObjectId); + break; + case OS_OBJECT_TYPE_OS_QUEUE: + Status = OS_QueueDelete(ObjectId); + break; + case OS_OBJECT_TYPE_OS_BINSEM: + Status = OS_BinSemDelete(ObjectId); + break; + case OS_OBJECT_TYPE_OS_COUNTSEM: + Status = OS_CountSemDelete(ObjectId); + break; + case OS_OBJECT_TYPE_OS_MUTEX: + Status = OS_MutSemDelete(ObjectId); + break; + case OS_OBJECT_TYPE_OS_TIMECB: + Status = OS_TimerDelete(ObjectId); + break; + case OS_OBJECT_TYPE_OS_STREAM: + Status = OS_close(ObjectId); + break; + case OS_OBJECT_TYPE_OS_MODULE: + Status = OS_ModuleUnload(ObjectId); + break; + default: + ObjIsValid = false; + Status = OS_ERROR; + break; } if (ObjIsValid) @@ -1653,7 +1633,7 @@ void CFE_ES_CleanupObjectCallback(osal_id_t ObjectId, void *arg) else { CFE_ES_SysLogWrite_Unsync("Call to OSAL Delete Object (ID:%lu) failed. RC=0x%08X\n", - OS_ObjectIdToInteger(ObjectId), (unsigned int)Status); + OS_ObjectIdToInteger(ObjectId), (unsigned int)Status); if (CleanState->OverallStatus == CFE_SUCCESS) { /* @@ -1661,30 +1641,30 @@ void CFE_ES_CleanupObjectCallback(osal_id_t ObjectId, void *arg) * (Some object types have special return codes, depending on what type * of object failed to delete) */ - switch(ObjType) + switch (ObjType) { - case OS_OBJECT_TYPE_OS_TASK: - CleanState->OverallStatus = CFE_ES_ERR_CHILD_TASK_DELETE; - break; - case OS_OBJECT_TYPE_OS_QUEUE: - CleanState->OverallStatus = CFE_ES_QUEUE_DELETE_ERR; - break; - case OS_OBJECT_TYPE_OS_BINSEM: - CleanState->OverallStatus = CFE_ES_BIN_SEM_DELETE_ERR; - break; - case OS_OBJECT_TYPE_OS_COUNTSEM: - CleanState->OverallStatus = CFE_ES_COUNT_SEM_DELETE_ERR; - break; - case OS_OBJECT_TYPE_OS_MUTEX: - CleanState->OverallStatus = CFE_ES_MUT_SEM_DELETE_ERR; - break; - case OS_OBJECT_TYPE_OS_TIMECB: - CleanState->OverallStatus = CFE_ES_TIMER_DELETE_ERR; - break; - default: - /* generic failure */ - CleanState->OverallStatus = CFE_ES_APP_CLEANUP_ERR; - break; + case OS_OBJECT_TYPE_OS_TASK: + CleanState->OverallStatus = CFE_ES_ERR_CHILD_TASK_DELETE; + break; + case OS_OBJECT_TYPE_OS_QUEUE: + CleanState->OverallStatus = CFE_ES_QUEUE_DELETE_ERR; + break; + case OS_OBJECT_TYPE_OS_BINSEM: + CleanState->OverallStatus = CFE_ES_BIN_SEM_DELETE_ERR; + break; + case OS_OBJECT_TYPE_OS_COUNTSEM: + CleanState->OverallStatus = CFE_ES_COUNT_SEM_DELETE_ERR; + break; + case OS_OBJECT_TYPE_OS_MUTEX: + CleanState->OverallStatus = CFE_ES_MUT_SEM_DELETE_ERR; + break; + case OS_OBJECT_TYPE_OS_TIMECB: + CleanState->OverallStatus = CFE_ES_TIMER_DELETE_ERR; + break; + default: + /* generic failure */ + CleanState->OverallStatus = CFE_ES_APP_CLEANUP_ERR; + break; } } } @@ -1702,9 +1682,9 @@ void CFE_ES_CleanupObjectCallback(osal_id_t ObjectId, void *arg) */ int32 CFE_ES_CleanupTaskResources(CFE_ES_TaskId_t TaskId) { - CFE_ES_CleanupState_t CleanState; - int32 Result; - osal_id_t OsalId; + CFE_ES_CleanupState_t CleanState; + int32 Result; + osal_id_t OsalId; /* Get the Task ID for calling OSAL APIs (convert type) */ OsalId = CFE_ES_TaskId_ToOSAL(TaskId); @@ -1716,7 +1696,7 @@ int32 CFE_ES_CleanupTaskResources(CFE_ES_TaskId_t TaskId) --CleanState.PrevFoundObjects; while (1) { - OS_ForEachObject (OsalId, CFE_ES_CleanupObjectCallback, &CleanState); + OS_ForEachObject(OsalId, CFE_ES_CleanupObjectCallback, &CleanState); if (CleanState.FoundObjects == 0 || CleanState.ErrorFlag != 0) { break; @@ -1727,11 +1707,11 @@ int32 CFE_ES_CleanupTaskResources(CFE_ES_TaskId_t TaskId) * happen when using the UT stub functions, or if an object * cannot be fully deleted successfully). */ - CleanState.ErrorFlag = (CleanState.DeletedObjects == 0 || - CleanState.FoundObjects >= CleanState.PrevFoundObjects); + CleanState.ErrorFlag = + (CleanState.DeletedObjects == 0 || CleanState.FoundObjects >= CleanState.PrevFoundObjects); CleanState.PrevFoundObjects = CleanState.FoundObjects; - CleanState.FoundObjects = 0; - CleanState.DeletedObjects = 0; + CleanState.FoundObjects = 0; + CleanState.DeletedObjects = 0; } /* @@ -1756,8 +1736,7 @@ int32 CFE_ES_CleanupTaskResources(CFE_ES_TaskId_t TaskId) Result = CFE_ES_TASK_DELETE_ERR; } - return(Result); - + return (Result); } /* @@ -1772,12 +1751,10 @@ int32 CFE_ES_CleanupTaskResources(CFE_ES_TaskId_t TaskId) */ void CFE_ES_CopyModuleBasicInfo(const CFE_ES_ModuleLoadParams_t *ParamsPtr, CFE_ES_AppInfo_t *AppInfoPtr) { - strncpy(AppInfoPtr->EntryPoint, ParamsPtr->InitSymbolName, - sizeof(AppInfoPtr->EntryPoint) - 1); + strncpy(AppInfoPtr->EntryPoint, ParamsPtr->InitSymbolName, sizeof(AppInfoPtr->EntryPoint) - 1); AppInfoPtr->EntryPoint[sizeof(AppInfoPtr->EntryPoint) - 1] = '\0'; - strncpy(AppInfoPtr->FileName, ParamsPtr->FileName, - sizeof(AppInfoPtr->FileName) - 1); + strncpy(AppInfoPtr->FileName, ParamsPtr->FileName, sizeof(AppInfoPtr->FileName) - 1); AppInfoPtr->FileName[sizeof(AppInfoPtr->FileName) - 1] = '\0'; } @@ -1808,15 +1785,14 @@ void CFE_ES_CopyModuleStatusInfo(const CFE_ES_ModuleLoadStatus_t *StatusPtr, CFE */ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoPtr) { - OS_module_prop_t ModuleInfo; - int32 ReturnCode; + OS_module_prop_t ModuleInfo; + int32 ReturnCode; - ReturnCode = OS_ModuleInfo ( ModuleId, &ModuleInfo ); - if ( ReturnCode == OS_SUCCESS ) + ReturnCode = OS_ModuleInfo(ModuleId, &ModuleInfo); + if (ReturnCode == OS_SUCCESS) { AppInfoPtr->AddressesAreValid = - (sizeof(ModuleInfo.addr.code_address) <= sizeof(AppInfoPtr->CodeAddress)) && - ModuleInfo.addr.valid; + (sizeof(ModuleInfo.addr.code_address) <= sizeof(AppInfoPtr->CodeAddress)) && ModuleInfo.addr.valid; } else { @@ -1829,11 +1805,9 @@ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoP * (The telemetry format may be a different bitwidth than the native processor) */ AppInfoPtr->CodeAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.code_address); - AppInfoPtr->CodeSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.code_size); + AppInfoPtr->CodeSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.code_size); AppInfoPtr->DataAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.data_address); - AppInfoPtr->DataSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.data_size); - AppInfoPtr->BSSAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.bss_address); - AppInfoPtr->BSSSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.bss_size); + AppInfoPtr->DataSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.data_size); + AppInfoPtr->BSSAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.bss_address); + AppInfoPtr->BSSSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.bss_size); } - - diff --git a/modules/es/fsw/src/cfe_es_apps.h b/modules/es/fsw/src/cfe_es_apps.h index d776f044d..b51288a39 100644 --- a/modules/es/fsw/src/cfe_es_apps.h +++ b/modules/es/fsw/src/cfe_es_apps.h @@ -32,7 +32,6 @@ ** */ - #ifndef _cfe_es_apps_ #define _cfe_es_apps_ @@ -47,7 +46,7 @@ /* ** Macro Definitions */ -#define CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE 8 +#define CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE 8 /* ** Type Definitions @@ -60,12 +59,11 @@ */ typedef struct { - uint32 AppControlRequest; /* What the App should be doing next */ - int32 AppTimerMsec; /* Countdown timer for killing an app, in milliseconds */ + uint32 AppControlRequest; /* What the App should be doing next */ + int32 AppTimerMsec; /* Countdown timer for killing an app, in milliseconds */ } CFE_ES_ControlReq_t; - /* ** CFE_ES_ModuleLoadParams_t contains the information used when a module ** (library or app) load request initially processed in the system. It captures @@ -79,8 +77,8 @@ typedef struct */ typedef struct { - char InitSymbolName[OS_MAX_API_NAME]; - char FileName[OS_MAX_PATH_LEN]; + char InitSymbolName[OS_MAX_API_NAME]; + char FileName[OS_MAX_PATH_LEN]; } CFE_ES_ModuleLoadParams_t; @@ -93,26 +91,24 @@ typedef struct */ typedef struct { - osal_id_t ModuleId; - cpuaddr InitSymbolAddress; + osal_id_t ModuleId; + cpuaddr InitSymbolAddress; } CFE_ES_ModuleLoadStatus_t; - /* ** CFE_ES_TaskStartParams_t contains basic details about a CFE task -** +** ** This information needs to be specified when starting a task and is ** stored as part of the task record for future reference. */ typedef struct { - size_t StackSize; - CFE_ES_TaskPriority_Atom_t Priority; + size_t StackSize; + CFE_ES_TaskPriority_Atom_t Priority; } CFE_ES_TaskStartParams_t; - /* ** CFE_ES_AppStartParams_t contains basic details about a CFE app. ** @@ -132,7 +128,6 @@ typedef struct } CFE_ES_AppStartParams_t; - /* ** CFE_ES_AppRecord_t is an internal structure used to keep track of ** CFE Applications that are active in the system. @@ -150,7 +145,6 @@ typedef struct } CFE_ES_AppRecord_t; - /* ** CFE_ES_TaskRecord_t is an internal structure used to keep track of ** CFE Tasks that are active in the system. @@ -190,8 +184,6 @@ typedef struct uint8 LastScanCommandCount; } CFE_ES_AppTableScanState_t; - - /*****************************************************************************/ /* ** Function prototypes @@ -200,7 +192,7 @@ typedef struct /* ** Internal function start applications based on the startup script */ -void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ); +void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath); /* ** Internal function to parse/execute a line of the cFE application startup 'script' @@ -212,7 +204,8 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens); ** This only loads the code and looks up relevent runtime information. ** It does not start any tasks. */ -int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleName, const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus); +int32 CFE_ES_LoadModule(CFE_ResourceId_t ParentResourceId, const char *ModuleName, + const CFE_ES_ModuleLoadParams_t *LoadParams, CFE_ES_ModuleLoadStatus_t *LoadStatus); /* ** Internal function to determine the entry point of an app. @@ -231,7 +224,8 @@ void CFE_ES_TaskEntryPoint(void); /* ** Internal function to start a task associated with an app. */ -int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ES_TaskEntryFuncPtr_t EntryFunc, const CFE_ES_TaskStartParams_t* Params, CFE_ES_AppId_t ParentAppId); +int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_ES_TaskEntryFuncPtr_t EntryFunc, + const CFE_ES_TaskStartParams_t *Params, CFE_ES_AppId_t ParentAppId); /* ** Internal function to create/start a new cFE app @@ -262,7 +256,8 @@ bool CFE_ES_BackgroundERLogFileDataGetter(void *Meta, uint32 RecordNum, void **B /* * Background file write event handler for ER log entry */ -void CFE_ES_BackgroundERLogFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position); +void CFE_ES_BackgroundERLogFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, + size_t BlockSize, size_t Position); /* ** Perform the requested control action for an application @@ -279,7 +274,6 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppId_t AppId); */ int32 CFE_ES_CleanupTaskResources(CFE_ES_TaskId_t TaskId); - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_CopyModuleBasicInfo @@ -307,5 +301,4 @@ void CFE_ES_CopyModuleStatusInfo(const CFE_ES_ModuleLoadStatus_t *StatusPtr, CFE */ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoPtr); - -#endif /* _cfe_es_apps_ */ +#endif /* _cfe_es_apps_ */ diff --git a/modules/es/fsw/src/cfe_es_backgroundtask.c b/modules/es/fsw/src/cfe_es_backgroundtask.c index d17bb0cb4..6410005db 100644 --- a/modules/es/fsw/src/cfe_es_backgroundtask.c +++ b/modules/es/fsw/src/cfe_es_backgroundtask.c @@ -37,21 +37,20 @@ #include "cfe_es_module_all.h" -#define CFE_ES_BACKGROUND_SEM_NAME "ES_BG_SEM" -#define CFE_ES_BACKGROUND_CHILD_NAME "ES_BG_TASK" -#define CFE_ES_BACKGROUND_CHILD_STACK_PTR CFE_ES_TASK_STACK_ALLOCATE -#define CFE_ES_BACKGROUND_CHILD_STACK_SIZE CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE -#define CFE_ES_BACKGROUND_CHILD_PRIORITY CFE_PLATFORM_ES_PERF_CHILD_PRIORITY -#define CFE_ES_BACKGROUND_CHILD_FLAGS 0 -#define CFE_ES_BACKGROUND_MAX_IDLE_DELAY 30000 /* 30 seconds */ - +#define CFE_ES_BACKGROUND_SEM_NAME "ES_BG_SEM" +#define CFE_ES_BACKGROUND_CHILD_NAME "ES_BG_TASK" +#define CFE_ES_BACKGROUND_CHILD_STACK_PTR CFE_ES_TASK_STACK_ALLOCATE +#define CFE_ES_BACKGROUND_CHILD_STACK_SIZE CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE +#define CFE_ES_BACKGROUND_CHILD_PRIORITY CFE_PLATFORM_ES_PERF_CHILD_PRIORITY +#define CFE_ES_BACKGROUND_CHILD_FLAGS 0 +#define CFE_ES_BACKGROUND_MAX_IDLE_DELAY 30000 /* 30 seconds */ typedef struct { bool (*RunFunc)(uint32 ElapsedTime, void *Arg); - void *JobArg; - uint32 ActivePeriod; /**< max wait/delay time between calls when job is active */ - uint32 IdlePeriod; /**< max wait/delay time between calls when job is idle */ + void * JobArg; + uint32 ActivePeriod; /**< max wait/delay time between calls when job is active */ + uint32 IdlePeriod; /**< max wait/delay time between calls when job is idle */ } CFE_ES_BackgroundJobEntry_t; /* @@ -65,35 +64,29 @@ typedef struct * This uses "cooperative multitasking" -- the function should do some limited work, then return to the * background task. It will be called again after a delay period to do more work. */ -const CFE_ES_BackgroundJobEntry_t CFE_ES_BACKGROUND_JOB_TABLE[] = -{ - { /* ES app table background scan */ - .RunFunc = CFE_ES_RunAppTableScan, - .JobArg = &CFE_ES_TaskData.BackgroundAppScanState, - .ActivePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE / 4, - .IdlePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE - }, - { /* Performance Log Data Dump to file */ - .RunFunc = CFE_ES_RunPerfLogDump, - .JobArg = &CFE_ES_TaskData.BackgroundPerfDumpState, - .ActivePeriod = CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY, - .IdlePeriod = CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY * 1000 - }, - { /* Check for exceptions stored in the PSP */ - .RunFunc = CFE_ES_RunExceptionScan, - .JobArg = NULL, - .ActivePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE, - .IdlePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE - }, - { /* Call FS to handle background file writes */ - .RunFunc = CFE_FS_RunBackgroundFileDump, - .JobArg = NULL, - .ActivePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE, - .IdlePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE - } -}; - -#define CFE_ES_BACKGROUND_NUM_JOBS (sizeof(CFE_ES_BACKGROUND_JOB_TABLE) / sizeof(CFE_ES_BACKGROUND_JOB_TABLE[0])) +const CFE_ES_BackgroundJobEntry_t CFE_ES_BACKGROUND_JOB_TABLE[] = { + {/* ES app table background scan */ + .RunFunc = CFE_ES_RunAppTableScan, + .JobArg = &CFE_ES_TaskData.BackgroundAppScanState, + .ActivePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE / 4, + .IdlePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE}, + {/* Performance Log Data Dump to file */ + .RunFunc = CFE_ES_RunPerfLogDump, + .JobArg = &CFE_ES_TaskData.BackgroundPerfDumpState, + .ActivePeriod = CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY, + .IdlePeriod = CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY * 1000}, + {/* Check for exceptions stored in the PSP */ + .RunFunc = CFE_ES_RunExceptionScan, + .JobArg = NULL, + .ActivePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE, + .IdlePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE}, + {/* Call FS to handle background file writes */ + .RunFunc = CFE_FS_RunBackgroundFileDump, + .JobArg = NULL, + .ActivePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE, + .IdlePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE}}; + +#define CFE_ES_BACKGROUND_NUM_JOBS (sizeof(CFE_ES_BACKGROUND_JOB_TABLE) / sizeof(CFE_ES_BACKGROUND_JOB_TABLE[0])) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Name: CFE_ES_BackgroundTask */ @@ -109,13 +102,13 @@ const CFE_ES_BackgroundJobEntry_t CFE_ES_BACKGROUND_JOB_TABLE[] = /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void CFE_ES_BackgroundTask(void) { - int32 status; - uint32 JobTotal; - uint32 NumJobsRunning; - uint32 NextDelay; - uint32 ElapsedTime; - OS_time_t CurrTime; - OS_time_t LastTime; + int32 status; + uint32 JobTotal; + uint32 NumJobsRunning; + uint32 NextDelay; + uint32 ElapsedTime; + OS_time_t CurrTime; + OS_time_t LastTime; const CFE_ES_BackgroundJobEntry_t *JobPtr; status = CFE_ES_RegisterChildTask(); @@ -136,11 +129,11 @@ void CFE_ES_BackgroundTask(void) */ CFE_PSP_GetTime(&CurrTime); ElapsedTime = OS_TimeGetTotalMilliseconds(OS_TimeSubtract(CurrTime, LastTime)); - LastTime = CurrTime; + LastTime = CurrTime; - NextDelay = CFE_ES_BACKGROUND_MAX_IDLE_DELAY; /* default; will be adjusted based on active jobs */ - JobPtr = CFE_ES_BACKGROUND_JOB_TABLE; - JobTotal = CFE_ES_BACKGROUND_NUM_JOBS; + NextDelay = CFE_ES_BACKGROUND_MAX_IDLE_DELAY; /* default; will be adjusted based on active jobs */ + JobPtr = CFE_ES_BACKGROUND_JOB_TABLE; + JobTotal = CFE_ES_BACKGROUND_NUM_JOBS; NumJobsRunning = 0; while (JobTotal > 0) @@ -178,7 +171,6 @@ void CFE_ES_BackgroundTask(void) CFE_ES_WriteToSysLog("CFE_ES: Failed to take background sem: %08lx\n", (unsigned long)status); break; } - } } @@ -200,13 +192,10 @@ int32 CFE_ES_BackgroundInit(void) } /* Spawn a task to write the performance data to a file */ - status = CFE_ES_CreateChildTask(&CFE_ES_Global.BackgroundTask.TaskID, - CFE_ES_BACKGROUND_CHILD_NAME, - CFE_ES_BackgroundTask, - CFE_ES_BACKGROUND_CHILD_STACK_PTR, - CFE_ES_BACKGROUND_CHILD_STACK_SIZE, - CFE_ES_BACKGROUND_CHILD_PRIORITY, - CFE_ES_BACKGROUND_CHILD_FLAGS); + status = CFE_ES_CreateChildTask(&CFE_ES_Global.BackgroundTask.TaskID, CFE_ES_BACKGROUND_CHILD_NAME, + CFE_ES_BackgroundTask, CFE_ES_BACKGROUND_CHILD_STACK_PTR, + CFE_ES_BACKGROUND_CHILD_STACK_SIZE, CFE_ES_BACKGROUND_CHILD_PRIORITY, + CFE_ES_BACKGROUND_CHILD_FLAGS); if (status != OS_SUCCESS) { @@ -228,7 +217,7 @@ void CFE_ES_BackgroundCleanup(void) CFE_ES_DeleteChildTask(CFE_ES_Global.BackgroundTask.TaskID); OS_BinSemDelete(CFE_ES_Global.BackgroundTask.WorkSem); - CFE_ES_Global.BackgroundTask.TaskID = CFE_ES_TASKID_UNDEFINED; + CFE_ES_Global.BackgroundTask.TaskID = CFE_ES_TASKID_UNDEFINED; CFE_ES_Global.BackgroundTask.WorkSem = OS_OBJECT_ID_UNDEFINED; } @@ -247,5 +236,3 @@ void CFE_ES_BackgroundWakeup(void) * work if it was idle. */ OS_BinSemGive(CFE_ES_Global.BackgroundTask.WorkSem); } - - diff --git a/modules/es/fsw/src/cfe_es_cds.c b/modules/es/fsw/src/cfe_es_cds.c index 0af312a6d..9999d86eb 100644 --- a/modules/es/fsw/src/cfe_es_cds.c +++ b/modules/es/fsw/src/cfe_es_cds.c @@ -19,10 +19,10 @@ */ /* -** File: +** File: ** cfe_es_cds.c ** -** Purpose: +** Purpose: ** This file implements the cFE Executive Services Critical Data Store functions. ** ** References: @@ -30,7 +30,7 @@ ** cFE Flight Software Application Developers Guide ** ** Notes: -** +** ** Modification History: ** */ @@ -54,22 +54,21 @@ int32 CFE_ES_CDS_EarlyInit(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - uint32 PlatformSize; - size_t MinRequiredSize; - int32 Status; - + uint32 PlatformSize; + size_t MinRequiredSize; + int32 Status; + CFE_ES_Global.CDSIsAvailable = false; /* Create CDS general access mutex */ - Status = OS_MutSemCreate(&CDS->GenMutex, - CFE_ES_CDS_MUT_REG_NAME, CFE_ES_CDS_MUT_REG_VALUE); + Status = OS_MutSemCreate(&CDS->GenMutex, CFE_ES_CDS_MUT_REG_NAME, CFE_ES_CDS_MUT_REG_VALUE); if (Status != OS_SUCCESS) { CFE_ES_SysLogWrite_Unsync("CFE_ES_CDS_EarlyInit: Failed to create mutex with error %d\n", (int)Status); return CFE_STATUS_EXTERNAL_RESOURCE_FAIL; } - CDS->LastCDSBlockId = CFE_ResourceId_FromInteger(CFE_ES_CDSBLOCKID_BASE); + CDS->LastCDSBlockId = CFE_ResourceId_FromInteger(CFE_ES_CDSBLOCKID_BASE); /* Get CDS size from PSP. Note that the PSP interface * uses "uint32" for size here. */ @@ -77,7 +76,8 @@ int32 CFE_ES_CDS_EarlyInit(void) if (Status != CFE_PSP_SUCCESS) { /* Error getting the size of the CDS from the BSP */ - CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-Unable to obtain CDS Size from BSP (Err=0x%08X)\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-Unable to obtain CDS Size from BSP (Err=0x%08X)\n", + (unsigned int)Status); return Status; } @@ -86,12 +86,12 @@ int32 CFE_ES_CDS_EarlyInit(void) /* Compute the minimum size required for the CDS with the current configuration of the cFE */ MinRequiredSize = CDS_RESERVED_MIN_SIZE; - MinRequiredSize += CFE_ES_CDSReqdMinSize(CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES); /* Max # of Min Sized Blocks */ - + MinRequiredSize += CFE_ES_CDSReqdMinSize(CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES); /* Max # of Min Sized Blocks */ + if (CDS->TotalSize < MinRequiredSize) { CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-CDS Size (%lu) less than required (%lu)\n", - (unsigned long)CDS->TotalSize, (unsigned long)MinRequiredSize); + (unsigned long)CDS->TotalSize, (unsigned long)MinRequiredSize); Status = CFE_SUCCESS; } else @@ -101,7 +101,7 @@ int32 CFE_ES_CDS_EarlyInit(void) /* If the size was obtained successfully and meets the minimum requirements, then check its contents */ Status = CFE_ES_ValidateCDS(); - + if (Status == CFE_SUCCESS) { /* If a valid CDS was found, rebuild the memory pool */ @@ -134,7 +134,8 @@ int32 CFE_ES_CDS_EarlyInit(void) if (Status != CFE_SUCCESS) { /* Unrecoverable error while reading the CDS */ - CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-error validating/initializing CDS (0x%08lX)\n", (unsigned long)Status); + CFE_ES_WriteToSysLog("CFE_CDS:EarlyInit-error validating/initializing CDS (0x%08lX)\n", + (unsigned long)Status); } else { @@ -144,8 +145,8 @@ int32 CFE_ES_CDS_EarlyInit(void) } return Status; - -} /* End of CFE_ES_CDS_EarlyInit() */ + +} /* End of CFE_ES_CDS_EarlyInit() */ /*******************************************************************/ /* @@ -156,16 +157,14 @@ int32 CFE_ES_CDS_EarlyInit(void) /*******************************************************************/ int32 CFE_ES_CDSHandle_ToIndex(CFE_ES_CDSHandle_t BlockID, uint32 *Idx) { - return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(BlockID), - CFE_ES_CDSBLOCKID_BASE, - CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES, - Idx); + return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(BlockID), CFE_ES_CDSBLOCKID_BASE, + CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES, Idx); } /*--------------------------------------------------------------------------------------- * Function: CFE_ES_CheckCDSHandleSlotUsed - * - * Purpose: Helper function, Aids in allocating a new ID by checking if + * + * Purpose: Helper function, Aids in allocating a new ID by checking if * a given ID is available. Must be called while locked. *--------------------------------------------------------------------------------------- */ @@ -181,11 +180,11 @@ bool CFE_ES_CheckCDSHandleSlotUsed(CFE_ResourceId_t CheckId) * NOTE: For complete prolog information, see 'cfe_es_cds.h' */ /*******************************************************************/ -CFE_ES_CDS_RegRec_t* CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHandle_t BlockID) +CFE_ES_CDS_RegRec_t *CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHandle_t BlockID) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - CFE_ES_CDS_RegRec_t *CDSRegRecPtr; - uint32 Idx; + CFE_ES_CDS_RegRec_t * CDSRegRecPtr; + uint32 Idx; if (CFE_ES_CDSHandle_ToIndex(BlockID, &Idx) == CFE_SUCCESS) { @@ -199,7 +198,6 @@ CFE_ES_CDS_RegRec_t* CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHandle_t BlockID) return CDSRegRecPtr; } - /*******************************************************************/ /* * CFE_ES_CacheRead() @@ -213,14 +211,13 @@ int32 CFE_ES_CDS_CacheFetch(CFE_ES_CDS_AccessCache_t *Cache, size_t Offset, size if (Size > 0 && Size <= sizeof(Cache->Data)) { - Cache->AccessStatus = CFE_PSP_ReadFromCDS(&Cache->Data, - Offset, Size); + Cache->AccessStatus = CFE_PSP_ReadFromCDS(&Cache->Data, Offset, Size); if (Cache->AccessStatus == CFE_PSP_SUCCESS) { Cache->Offset = Offset; - Cache->Size = Size; - Status = CFE_SUCCESS; + Cache->Size = Size; + Status = CFE_SUCCESS; } else { @@ -248,8 +245,7 @@ int32 CFE_ES_CDS_CacheFlush(CFE_ES_CDS_AccessCache_t *Cache) if (Cache->Size > 0 && Cache->Size <= sizeof(Cache->Data)) { - Cache->AccessStatus = CFE_PSP_WriteToCDS(&Cache->Data, - Cache->Offset, Cache->Size); + Cache->AccessStatus = CFE_PSP_WriteToCDS(&Cache->Data, Cache->Offset, Cache->Size); if (Cache->AccessStatus == CFE_PSP_SUCCESS) { @@ -291,9 +287,9 @@ int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Sourc /* copy from the user-supplied preload data */ memcpy(&Cache->Data, Source, Size); } - Cache->Size = Size; + Cache->Size = Size; Cache->Offset = Offset; - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; } else { @@ -303,7 +299,6 @@ int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Sourc return Status; } - /******************************************************************* ** ** CFE_ES_RegisterCDSEx @@ -314,21 +309,21 @@ int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Sourc int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, const char *Name, bool CriticalTbl) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; - int32 RegUpdateStatus; - CFE_ES_CDS_RegRec_t *RegRecPtr; - size_t BlockOffset; - size_t OldBlockSize; - size_t NewBlockSize; - CFE_ResourceId_t PendingBlockId; - bool IsNewEntry; - bool IsNewOffset; - - Status = CFE_SUCCESS; + int32 Status; + int32 RegUpdateStatus; + CFE_ES_CDS_RegRec_t * RegRecPtr; + size_t BlockOffset; + size_t OldBlockSize; + size_t NewBlockSize; + CFE_ResourceId_t PendingBlockId; + bool IsNewEntry; + bool IsNewOffset; + + Status = CFE_SUCCESS; RegUpdateStatus = CFE_SUCCESS; - IsNewEntry = false; - IsNewOffset = false; - + IsNewEntry = false; + IsNewOffset = false; + if (UserBlockSize == 0 || UserBlockSize > CDS_ABS_MAX_BLOCK_SIZE) { /* Block size is not supportable */ @@ -352,20 +347,21 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, else { /* scan for a free slot */ - PendingBlockId = CFE_ResourceId_FindNext(CDS->LastCDSBlockId, CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES, CFE_ES_CheckCDSHandleSlotUsed); - RegRecPtr = CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHANDLE_C(PendingBlockId)); + PendingBlockId = CFE_ResourceId_FindNext(CDS->LastCDSBlockId, CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES, + CFE_ES_CheckCDSHandleSlotUsed); + RegRecPtr = CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHANDLE_C(PendingBlockId)); if (RegRecPtr != NULL) { /* Fully clear the entry, just in case of stale data */ memset(RegRecPtr, 0, sizeof(*RegRecPtr)); CDS->LastCDSBlockId = PendingBlockId; - IsNewEntry = true; - Status = CFE_SUCCESS; + IsNewEntry = true; + Status = CFE_SUCCESS; } else { - Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; + Status = CFE_ES_NO_RESOURCE_IDS_AVAILABLE; PendingBlockId = CFE_RESOURCEID_UNDEFINED; } } @@ -376,11 +372,8 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, NewBlockSize = UserBlockSize; NewBlockSize += sizeof(CFE_ES_CDS_BlockHeader_t); - /* If a reallocation is needed, the old block may need to be freed first */ - if (Status == CFE_SUCCESS && - RegRecPtr->BlockOffset != 0 && - NewBlockSize != RegRecPtr->BlockSize) + if (Status == CFE_SUCCESS && RegRecPtr->BlockOffset != 0 && NewBlockSize != RegRecPtr->BlockSize) { /* If the new size is different, the old CDS must be deleted first */ Status = CFE_ES_GenPoolPutBlock(&CDS->Pool, &OldBlockSize, RegRecPtr->BlockOffset); @@ -392,7 +385,7 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, if (Status == CFE_SUCCESS) { RegRecPtr->BlockOffset = 0; - RegRecPtr->BlockSize = 0; + RegRecPtr->BlockSize = 0; } } @@ -405,8 +398,8 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, { /* Save the size of the CDS */ RegRecPtr->BlockOffset = BlockOffset; - RegRecPtr->BlockSize = NewBlockSize; - IsNewOffset = true; + RegRecPtr->BlockSize = NewBlockSize; + IsNewOffset = true; } } @@ -416,8 +409,8 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, RegRecPtr->Table = CriticalTbl; /* Save CDS Name in Registry */ - strncpy(RegRecPtr->Name, Name, sizeof(RegRecPtr->Name)-1); - RegRecPtr->Name[sizeof(RegRecPtr->Name)-1] = 0; + strncpy(RegRecPtr->Name, Name, sizeof(RegRecPtr->Name) - 1); + RegRecPtr->Name[sizeof(RegRecPtr->Name) - 1] = 0; CFE_ES_CDSBlockRecordSetUsed(RegRecPtr, PendingBlockId); } @@ -434,18 +427,19 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, /* Log any failures AFTER releasing the lock */ if (RegUpdateStatus != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:RegCDS-Failed to update CDS Registry (Stat=0x%08X)\n", (unsigned int)RegUpdateStatus); + CFE_ES_WriteToSysLog("CFE_CDS:RegCDS-Failed to update CDS Registry (Stat=0x%08X)\n", + (unsigned int)RegUpdateStatus); - /* - * Return failure only if this was the primary error, - * do not overwrite a preexisting error. - */ - if (Status == CFE_SUCCESS) - { - Status = RegUpdateStatus; - } + /* + * Return failure only if this was the primary error, + * do not overwrite a preexisting error. + */ + if (Status == CFE_SUCCESS) + { + Status = RegUpdateStatus; + } } - + if (Status == CFE_SUCCESS && !IsNewOffset) { /* @@ -463,7 +457,7 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, return (Status); -} /* End of CFE_ES_RegisterCDSEx() */ +} /* End of CFE_ES_RegisterCDSEx() */ /******************************************************************* ** @@ -475,10 +469,10 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, int32 CFE_ES_ValidateCDS(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - size_t TrailerOffset; - const size_t SIG_CDS_SIZE = { CFE_ES_CDS_SIGNATURE_LEN }; - int32 Status; - + size_t TrailerOffset; + const size_t SIG_CDS_SIZE = {CFE_ES_CDS_SIGNATURE_LEN}; + int32 Status; + /* Perform 2 checks to validate the CDS Memory Pool */ /* First, determine if the first validity check field is correct */ Status = CFE_ES_CDS_CacheFetch(&CDS->Cache, CDS_SIG_BEGIN_OFFSET, SIG_CDS_SIZE); @@ -510,10 +504,10 @@ int32 CFE_ES_ValidateCDS(void) /* Ending Validity Field failed */ return CFE_ES_CDS_INVALID; } - + /* All sanity checks passed */ return CFE_SUCCESS; -} /* End of CFE_ES_ValidateCDS() */ +} /* End of CFE_ES_ValidateCDS() */ /******************************************************************* ** @@ -525,13 +519,12 @@ int32 CFE_ES_ValidateCDS(void) int32 CFE_ES_ClearCDS(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - size_t RemainSize; - int32 Status; + size_t RemainSize; + int32 Status; /* Clear the CDS to ensure everything is gone */ /* Create a block of zeros to write to the CDS */ - Status = CFE_ES_CDS_CachePreload(&CDS->Cache, NULL, - 0, sizeof(CDS->Cache.Data.Zero)); + Status = CFE_ES_CDS_CachePreload(&CDS->Cache, NULL, 0, sizeof(CDS->Cache.Data.Zero)); /* While there is space to write another block of zeros, then do so */ while (CDS->Cache.Offset < CDS->TotalSize) @@ -554,7 +547,7 @@ int32 CFE_ES_ClearCDS(void) if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("CFE_CDS:Init-Clear CDS failed @ Offset=%lu Status=0x%08X\n", - (unsigned long)CDS->Cache.Offset, (unsigned int)CDS->Cache.AccessStatus); + (unsigned long)CDS->Cache.Offset, (unsigned int)CDS->Cache.AccessStatus); } return Status; @@ -570,37 +563,35 @@ int32 CFE_ES_ClearCDS(void) int32 CFE_ES_InitCDSSignatures(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - size_t SigOffset; - int32 Status; - + size_t SigOffset; + int32 Status; + /* Initialize the Validity Check strings */ SigOffset = 0; - CFE_ES_CDS_CachePreload(&CDS->Cache, CFE_ES_CDS_SIGNATURE_BEGIN, - SigOffset, CFE_ES_CDS_SIGNATURE_LEN); + CFE_ES_CDS_CachePreload(&CDS->Cache, CFE_ES_CDS_SIGNATURE_BEGIN, SigOffset, CFE_ES_CDS_SIGNATURE_LEN); Status = CFE_ES_CDS_CacheFlush(&CDS->Cache); if (Status != CFE_SUCCESS) { /* BSP reported an error writing to CDS */ CFE_ES_WriteToSysLog("CFE_CDS:Init-'_CDSBeg_' write failed. Status=0x%08X\n", - (unsigned int)CDS->Cache.AccessStatus); + (unsigned int)CDS->Cache.AccessStatus); return Status; } SigOffset = CDS->TotalSize; SigOffset -= sizeof(CFE_ES_CDS_PersistentTrailer_t); - CFE_ES_CDS_CachePreload(&CDS->Cache, CFE_ES_CDS_SIGNATURE_END, - SigOffset, CFE_ES_CDS_SIGNATURE_LEN); + CFE_ES_CDS_CachePreload(&CDS->Cache, CFE_ES_CDS_SIGNATURE_END, SigOffset, CFE_ES_CDS_SIGNATURE_LEN); Status = CFE_ES_CDS_CacheFlush(&CDS->Cache); if (Status != CFE_PSP_SUCCESS) { CFE_ES_WriteToSysLog("CFE_CDS:Init-'_CDSEnd_' write failed. Status=0x%08X\n", - (unsigned int)CDS->Cache.AccessStatus); + (unsigned int)CDS->Cache.AccessStatus); return Status; } return Status; -} /* End of CFE_ES_InitCDSSignatures() */ +} /* End of CFE_ES_InitCDSSignatures() */ /******************************************************************* ** @@ -612,13 +603,12 @@ int32 CFE_ES_InitCDSSignatures(void) int32 CFE_ES_InitCDSRegistry(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; - uint32 RegSize; - + int32 Status; + uint32 RegSize; + /* Initialize the local CDS Registry */ RegSize = CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES; - CFE_ES_CDS_CachePreload(&CDS->Cache, &RegSize, - CDS_REG_SIZE_OFFSET,sizeof(RegSize)); + CFE_ES_CDS_CachePreload(&CDS->Cache, &RegSize, CDS_REG_SIZE_OFFSET, sizeof(RegSize)); /* Copy the number of registry entries to the CDS */ Status = CFE_ES_CDS_CacheFlush(&CDS->Cache); if (Status == CFE_SUCCESS) @@ -630,11 +620,11 @@ int32 CFE_ES_InitCDSRegistry(void) else { CFE_ES_WriteToSysLog("CFE_CDS:InitReg-Failed to write Reg Size. Status=0x%08X\n", - (unsigned int)CDS->Cache.AccessStatus); + (unsigned int)CDS->Cache.AccessStatus); } - + return Status; -} /* End of CFE_ES_InitCDSRegistry() */ +} /* End of CFE_ES_InitCDSRegistry() */ /******************************************************************* ** @@ -646,23 +636,20 @@ int32 CFE_ES_InitCDSRegistry(void) int32 CFE_ES_UpdateCDSRegistry(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; - + int32 Status; + /* Copy the contents of the local registry to the CDS */ - Status = CFE_PSP_WriteToCDS(CDS->Registry, - CDS_REG_OFFSET, - sizeof(CDS->Registry)); - + Status = CFE_PSP_WriteToCDS(CDS->Registry, CDS_REG_OFFSET, sizeof(CDS->Registry)); + if (Status != CFE_PSP_SUCCESS) { CFE_ES_WriteToSysLog("CFE_CDS:UpdateReg-Failed to write CDS Registry. Status=0x%08X\n", (unsigned int)Status); Status = CFE_ES_CDS_ACCESS_ERROR; } - + return Status; } - /******************************************************************* ** ** CFE_ES_FormCDSName @@ -677,14 +664,13 @@ void CFE_ES_FormCDSName(char *FullCDSName, const char *CDSName, CFE_ES_AppId_t T CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); /* Ensure that AppName is null terminated */ - AppName[OS_MAX_API_NAME-1] = '\0'; + AppName[OS_MAX_API_NAME - 1] = '\0'; /* Complete formation of processor specific table name */ sprintf(FullCDSName, "%s.%s", AppName, CDSName); return; -} /* End of CFE_ES_FormCDSName() */ - +} /* End of CFE_ES_FormCDSName() */ /******************************************************************* ** @@ -696,7 +682,7 @@ void CFE_ES_FormCDSName(char *FullCDSName, const char *CDSName, CFE_ES_AppId_t T int32 CFE_ES_LockCDS(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; + int32 Status; Status = OS_MutSemTake(CDS->GenMutex); @@ -712,8 +698,7 @@ int32 CFE_ES_LockCDS(void) return Status; -} /* End of CFE_ES_LockCDSRegistry() */ - +} /* End of CFE_ES_LockCDSRegistry() */ /******************************************************************* ** @@ -725,7 +710,7 @@ int32 CFE_ES_LockCDS(void) int32 CFE_ES_UnlockCDS(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; + int32 Status; Status = OS_MutSemGive(CDS->GenMutex); @@ -741,8 +726,7 @@ int32 CFE_ES_UnlockCDS(void) return Status; -} /* End of CFE_ES_UnlockCDSRegistry() */ - +} /* End of CFE_ES_UnlockCDSRegistry() */ /******************************************************************* ** @@ -754,11 +738,11 @@ int32 CFE_ES_UnlockCDS(void) CFE_ES_CDS_RegRec_t *CFE_ES_LocateCDSBlockRecordByName(const char *CDSName) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - CFE_ES_CDS_RegRec_t *CDSRegRecPtr; - uint32 NumReg; + CFE_ES_CDS_RegRec_t * CDSRegRecPtr; + uint32 NumReg; CDSRegRecPtr = CDS->Registry; - NumReg = CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES; + NumReg = CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES; while (true) { if (NumReg == 0) @@ -782,8 +766,7 @@ CFE_ES_CDS_RegRec_t *CFE_ES_LocateCDSBlockRecordByName(const char *CDSName) } return CDSRegRecPtr; -} /* End of CFE_ES_LocateCDSBlockRecordByName() */ - +} /* End of CFE_ES_LocateCDSBlockRecordByName() */ /******************************************************************* ** @@ -795,28 +778,28 @@ CFE_ES_CDS_RegRec_t *CFE_ES_LocateCDSBlockRecordByName(const char *CDSName) int32 CFE_ES_RebuildCDS(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; - + int32 Status; + /* First, determine if the CDS registry stored in the CDS is smaller or equal */ /* in size to the CDS registry we are currently configured for */ /* Copy the number of registry entries to the CDS */ Status = CFE_ES_CDS_CacheFetch(&CDS->Cache, CDS_REG_SIZE_OFFSET, sizeof(CDS->Cache.Data.RegistrySize)); if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-PSP Error reading Registry size (%lx)\n", (unsigned long)CDS->Cache.AccessStatus); + CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-PSP Error reading Registry size (%lx)\n", + (unsigned long)CDS->Cache.AccessStatus); return CFE_ES_CDS_INVALID; } if (CDS->Cache.Data.RegistrySize != CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES) { /* Registry in CDS is incompatible size to recover */ - CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-Registry in CDS incorrect size (%lu)\n", (unsigned long)CDS->Cache.Data.RegistrySize); + CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-Registry in CDS incorrect size (%lu)\n", + (unsigned long)CDS->Cache.Data.RegistrySize); return CFE_ES_CDS_INVALID; } - Status = CFE_PSP_ReadFromCDS(&CDS->Registry, - CDS_REG_OFFSET, - sizeof(CDS->Registry)); + Status = CFE_PSP_ReadFromCDS(&CDS->Registry, CDS_REG_OFFSET, sizeof(CDS->Registry)); if (Status == CFE_PSP_SUCCESS) { @@ -829,10 +812,9 @@ int32 CFE_ES_RebuildCDS(void) CFE_ES_WriteToSysLog("CFE_CDS:Rebuild-Registry in CDS is unreadable, PSP error %lx\n", (unsigned long)Status); Status = CFE_ES_CDS_INVALID; } - - return Status; -} + return Status; +} /******************************************************************* ** @@ -844,14 +826,14 @@ int32 CFE_ES_RebuildCDS(void) int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; - CFE_ES_CDS_RegRec_t *RegRecPtr; - char OwnerName[OS_MAX_API_NAME]; - CFE_ES_AppId_t AppId; - uint32 i; - char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; - size_t OldBlockSize; - + int32 Status; + CFE_ES_CDS_RegRec_t * RegRecPtr; + char OwnerName[OS_MAX_API_NAME]; + CFE_ES_AppId_t AppId; + uint32 i; + char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; + size_t OldBlockSize; + LogMessage[0] = 0; /* Lock Registry for update. This prevents two applications from */ @@ -874,31 +856,32 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) { /* Check to see if the owning application is still active */ /* First, extract the owning application name */ - i=0; - while ((i < (OS_MAX_API_NAME-1) && (RegRecPtr->Name[i] != '.'))) + i = 0; + while ((i < (OS_MAX_API_NAME - 1) && (RegRecPtr->Name[i] != '.'))) { OwnerName[i] = RegRecPtr->Name[i]; i++; } - + /* Null terminate the application name */ OwnerName[i] = '\0'; - + /* Check to see if the Application Name is in the Registered Apps list */ Status = CFE_ES_GetAppIDByName(&AppId, OwnerName); - + /* If we can't find the name, then things are good */ if (Status != CFE_SUCCESS) { /* Free the registry entry and the CDS memory block associated with it */ Status = CFE_ES_GenPoolPutBlock(&CDS->Pool, &OldBlockSize, RegRecPtr->BlockOffset); - + /* Report any errors incurred while freeing the CDS Memory Block */ if (Status != CFE_SUCCESS) { - CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage), - "CFE_ES:DeleteCDS-Failed to free CDS Mem Block (Handle=0x%08lX)(Stat=0x%08X)\n", - (unsigned long)RegRecPtr->BlockOffset, (unsigned int)Status); + CFE_ES_SysLog_snprintf( + LogMessage, sizeof(LogMessage), + "CFE_ES:DeleteCDS-Failed to free CDS Mem Block (Handle=0x%08lX)(Stat=0x%08X)\n", + (unsigned long)RegRecPtr->BlockOffset, (unsigned int)Status); } else { @@ -906,11 +889,12 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) CFE_ES_CDSBlockRecordSetFree(RegRecPtr); Status = CFE_ES_UpdateCDSRegistry(); - + if (Status != CFE_SUCCESS) { CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage), - "CFE_ES:DeleteCDS-Failed to update CDS Registry (Stat=0x%08X)\n", (unsigned int)Status); + "CFE_ES:DeleteCDS-Failed to update CDS Registry (Stat=0x%08X)\n", + (unsigned int)Status); } } } @@ -920,7 +904,7 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) } } } - else /* Error - CDS not in registry */ + else /* Error - CDS not in registry */ { Status = CFE_ES_ERR_NAME_NOT_FOUND; } @@ -935,6 +919,6 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) } return Status; -} /* End of CFE_ES_DeleteCDS() */ +} /* End of CFE_ES_DeleteCDS() */ /* end of file */ diff --git a/modules/es/fsw/src/cfe_es_cds.h b/modules/es/fsw/src/cfe_es_cds.h index e57de070e..c5a45ceb1 100644 --- a/modules/es/fsw/src/cfe_es_cds.h +++ b/modules/es/fsw/src/cfe_es_cds.h @@ -19,7 +19,7 @@ */ /* -** File: +** File: ** cfe_es_cds.h ** ** Purpose: @@ -34,7 +34,6 @@ ** */ - #ifndef _cfe_es_cds_ #define _cfe_es_cds_ @@ -50,37 +49,36 @@ /** \name Registry Mutex Definitions */ /** \{ */ -#define CFE_ES_CDS_MUT_REG_NAME "CDS_MUTEX" /**< \brief Name of Mutex controlling CDS Access */ -#define CFE_ES_CDS_MUT_REG_VALUE 0 /**< \brief Initial Value of CDS Access Mutex */ +#define CFE_ES_CDS_MUT_REG_NAME "CDS_MUTEX" /**< \brief Name of Mutex controlling CDS Access */ +#define CFE_ES_CDS_MUT_REG_VALUE 0 /**< \brief Initial Value of CDS Access Mutex */ /** \} */ /** \name Registry Signature Definitions */ /** \{ */ -#define CFE_ES_CDS_SIGNATURE_LEN 8 /**< \brief Length of CDS signature field. */ -#define CFE_ES_CDS_SIGNATURE_BEGIN "_CDSBeg_" /**< \brief Fixed signature at beginning of CDS */ -#define CFE_ES_CDS_SIGNATURE_END "_CDSEnd_" /**< \brief Fixed signature at end of CDS */ +#define CFE_ES_CDS_SIGNATURE_LEN 8 /**< \brief Length of CDS signature field. */ +#define CFE_ES_CDS_SIGNATURE_BEGIN "_CDSBeg_" /**< \brief Fixed signature at beginning of CDS */ +#define CFE_ES_CDS_SIGNATURE_END "_CDSEnd_" /**< \brief Fixed signature at end of CDS */ /** \} */ - /* * Space in CDS should be aligned to a multiple of uint32 * These helper macros round up to a whole number of words */ -#define CDS_SIZE_TO_U32WORDS(x) (((x) + 3) / sizeof(uint32)) -#define CDS_RESERVE_SPACE(name,size) uint32 name[CDS_SIZE_TO_U32WORDS(size)] +#define CDS_SIZE_TO_U32WORDS(x) (((x) + 3) / sizeof(uint32)) +#define CDS_RESERVE_SPACE(name, size) uint32 name[CDS_SIZE_TO_U32WORDS(size)] /* Define offset addresses for CDS data segments */ -#define CDS_SIG_BEGIN_OFFSET offsetof(CFE_ES_CDS_PersistentHeader_t, SignatureBegin) -#define CDS_REG_SIZE_OFFSET offsetof(CFE_ES_CDS_PersistentHeader_t, RegistrySize) -#define CDS_REG_OFFSET offsetof(CFE_ES_CDS_PersistentHeader_t, RegistryContent) -#define CDS_POOL_OFFSET sizeof(CFE_ES_CDS_PersistentHeader_t) +#define CDS_SIG_BEGIN_OFFSET offsetof(CFE_ES_CDS_PersistentHeader_t, SignatureBegin) +#define CDS_REG_SIZE_OFFSET offsetof(CFE_ES_CDS_PersistentHeader_t, RegistrySize) +#define CDS_REG_OFFSET offsetof(CFE_ES_CDS_PersistentHeader_t, RegistryContent) +#define CDS_POOL_OFFSET sizeof(CFE_ES_CDS_PersistentHeader_t) /* * Absolute Minimum CDS size conceivably supportable by the implementation. * This is the space required for the basic signatures and registry information. * It is not possible to create a CDS with a storage area smaller than this. */ -#define CDS_RESERVED_MIN_SIZE sizeof(CFE_ES_CDS_PersistentHeader_t) + sizeof(CFE_ES_CDS_PersistentTrailer_t) +#define CDS_RESERVED_MIN_SIZE sizeof(CFE_ES_CDS_PersistentHeader_t) + sizeof(CFE_ES_CDS_PersistentTrailer_t) /* * Absolute Maximum Block size conceivably supportable by the implementation. @@ -90,15 +88,12 @@ * This ensures the size is safe for a PSP that uses 32 bit CDS offsets. * (It is not anticipated that a CDS would need to exceed this size) */ -#define CDS_ABS_MAX_BLOCK_SIZE ((size_t)(1 << 30) - sizeof(CFE_ES_CDS_BlockHeader_t)) - - +#define CDS_ABS_MAX_BLOCK_SIZE ((size_t)(1 << 30) - sizeof(CFE_ES_CDS_BlockHeader_t)) /* ** Type Definitions */ - /** * The structure cached in RAM for each block within the CDS non-volatile memory * This has the basic runtime info without having to go to CDS. @@ -111,16 +106,16 @@ typedef struct * which has a CRC, and therefore the actual user data size is * less than this. */ - CFE_ES_CDSHandle_t BlockID; /**< Abstract ID associated with this CDS block */ - size_t BlockOffset; /**< Start offset of the block in CDS memory */ - size_t BlockSize; /**< Size, in bytes, of the CDS memory block */ - char Name[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; - bool Table; /**< \brief Flag that indicates whether CDS contains a Critical Table */ + CFE_ES_CDSHandle_t BlockID; /**< Abstract ID associated with this CDS block */ + size_t BlockOffset; /**< Start offset of the block in CDS memory */ + size_t BlockSize; /**< Size, in bytes, of the CDS memory block */ + char Name[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; + bool Table; /**< \brief Flag that indicates whether CDS contains a Critical Table */ } CFE_ES_CDS_RegRec_t; typedef struct CFE_ES_CDSBlockHeader { - uint32 Crc; /**< CRC of content */ + uint32 Crc; /**< CRC of content */ } CFE_ES_CDS_BlockHeader_t; /* @@ -129,12 +124,12 @@ typedef struct CFE_ES_CDSBlockHeader */ typedef union CFE_ES_CDS_AccessCacheData { - char Sig[CFE_ES_CDS_SIGNATURE_LEN]; /**< A signature field (beginning or end) */ - uint32 RegistrySize; /**< Registry Size Field */ - uint32 Zero[4]; /**< Used when clearing CDS content */ - CFE_ES_GenPoolBD_t Desc; /**< A generic block descriptor */ - CFE_ES_CDS_BlockHeader_t BlockHeader; /**< A user block header */ - CFE_ES_CDS_RegRec_t RegEntry; /**< A registry entry */ + char Sig[CFE_ES_CDS_SIGNATURE_LEN]; /**< A signature field (beginning or end) */ + uint32 RegistrySize; /**< Registry Size Field */ + uint32 Zero[4]; /**< Used when clearing CDS content */ + CFE_ES_GenPoolBD_t Desc; /**< A generic block descriptor */ + CFE_ES_CDS_BlockHeader_t BlockHeader; /**< A user block header */ + CFE_ES_CDS_RegRec_t RegEntry; /**< A registry entry */ } CFE_ES_CDS_AccessCacheData_t; typedef struct CFE_ES_CDS_AccessCache @@ -166,14 +161,13 @@ typedef struct */ CFE_ES_CDS_AccessCache_t Cache; - osal_id_t GenMutex; /**< \brief Mutex that controls access to CDS and registry */ - size_t TotalSize; /**< \brief Total size of the CDS as reported by BSP */ - size_t DataSize; /**< \brief Size of actual user data pool */ - CFE_ResourceId_t LastCDSBlockId; /**< \brief Last issued CDS block ID */ - CFE_ES_CDS_RegRec_t Registry[CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES]; /**< \brief CDS Registry (Local Copy) */ + osal_id_t GenMutex; /**< \brief Mutex that controls access to CDS and registry */ + size_t TotalSize; /**< \brief Total size of the CDS as reported by BSP */ + size_t DataSize; /**< \brief Size of actual user data pool */ + CFE_ResourceId_t LastCDSBlockId; /**< \brief Last issued CDS block ID */ + CFE_ES_CDS_RegRec_t Registry[CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES]; /**< \brief CDS Registry (Local Copy) */ } CFE_ES_CDS_Instance_t; - /* * structs representing the intended layout of data * in the actual CDS/PSP-provided non-volatile memory @@ -196,9 +190,6 @@ typedef struct CFE_ES_CDS_PersistentTrailer CDS_RESERVE_SPACE(SignatureEnd, CFE_ES_CDS_SIGNATURE_LEN); } CFE_ES_CDS_PersistentTrailer_t; - - - /*****************************************************************************/ /* ** Function prototypes @@ -219,9 +210,7 @@ typedef struct CFE_ES_CDS_PersistentTrailer * @param[in] Size the CDS data size to fetch * @returns #CFE_SUCCESS on success, or appropriate error code. */ -int32 CFE_ES_CDS_CacheFetch(CFE_ES_CDS_AccessCache_t *Cache, - size_t Offset, size_t Size); - +int32 CFE_ES_CDS_CacheFetch(CFE_ES_CDS_AccessCache_t *Cache, size_t Offset, size_t Size); /** * @brief Write data from the RAM cache back to non-volatile storage @@ -262,8 +251,7 @@ int32 CFE_ES_CDS_CacheFlush(CFE_ES_CDS_AccessCache_t *Cache); * @param[in] Size the CDS data size to fetch * @returns #CFE_SUCCESS on success, or appropriate error code. */ -int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Source, - size_t Offset, size_t Size); +int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Source, size_t Offset, size_t Size); /** * @brief Get the registry array index correlating with a CDS block ID @@ -291,7 +279,7 @@ int32 CFE_ES_CDSHandle_ToIndex(CFE_ES_CDSHandle_t BlockID, uint32 *Idx); * @param[in] BlockID the ID/handle of the CDS block to retrieve * @returns Pointer to registry record, or NULL if ID/handle invalid. */ -CFE_ES_CDS_RegRec_t* CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHandle_t BlockID); +CFE_ES_CDS_RegRec_t *CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHandle_t BlockID); /** * @brief Check if a Memory Pool record is in use or free/empty @@ -391,9 +379,9 @@ static inline size_t CFE_ES_CDSBlockRecordGetUserSize(const CFE_ES_CDS_RegRec_t * @brief Check if a CDS Block ID table slot is used * * Checks if a table slot is available for a potential new ID - * This is a helper function intended to be used with + * This is a helper function intended to be used with * CFE_ResourceId_FindNext() for allocating new IDs - * + * * As this dereferences fields within the record, global data must be * locked prior to invoking this function. * @@ -421,7 +409,6 @@ bool CFE_ES_CheckCDSHandleSlotUsed(CFE_ResourceId_t CheckId); ******************************************************************************/ int32 CFE_ES_CDS_EarlyInit(void); - /*****************************************************************************/ /** ** \brief Determines whether a CDS currently exists @@ -457,7 +444,6 @@ int32 CFE_ES_ValidateCDS(void); ******************************************************************************/ int32 CFE_ES_InitCDSRegistry(void); - /*****************************************************************************/ /** ** \brief Rebuilds memory pool for CDS and recovers existing registry @@ -487,12 +473,10 @@ int32 CFE_ES_RebuildCDS(void); ** ** \return #CFE_SUCCESS \copydoc CFE_SUCCESS ** \return Any of the return values from #CFE_PSP_WriteToCDS -** +** ******************************************************************************/ int32 CFE_ES_UpdateCDSRegistry(void); - - /*****************************************************************************/ /** ** \brief Creates a Full CDS name from application name and CDS name @@ -506,12 +490,13 @@ int32 CFE_ES_UpdateCDSRegistry(void); ** Note: AppName portion will be truncated to OS_MAX_API_NAME. ** ** \param[in, out] FullCDSName pointer to character buffer of #CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN size -** that will be filled with the processor specific CDS Name. *FullCDSName is the processor specific CDS Name of the form "AppName.CDSName". -** +** that will be filled with the processor specific CDS Name. *FullCDSName is the processor +** specific CDS Name of the form "AppName.CDSName". +** ** \param[in] CDSName pointer to character string containing the Application's local name for ** the CDS. ** -** \param[in] ThisAppId the Application ID of the Application making the call. +** \param[in] ThisAppId the Application ID of the Application making the call. ** ** ******************************************************************************/ @@ -530,7 +515,7 @@ void CFE_ES_FormCDSName(char *FullCDSName, const char *CDSName, CFE_ES_AppId_t T ** ** \param[in] CDSName - Pointer to character string containing complete ** CDS Name (of the format "AppName.CDSName"). -** +** ** \retval NULL if not found, Non null entry pointer on success ** ******************************************************************************/ @@ -549,9 +534,9 @@ CFE_ES_CDS_RegRec_t *CFE_ES_LocateCDSBlockRecordByName(const char *CDSName); ** \par Assumptions, External Events, and Notes: ** None ** -** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ******************************************************************************/ -int32 CFE_ES_LockCDS(void); +int32 CFE_ES_LockCDS(void); /*****************************************************************************/ /** @@ -565,9 +550,9 @@ int32 CFE_ES_LockCDS(void); ** None ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS -** +** ******************************************************************************/ -int32 CFE_ES_UnlockCDS(void); +int32 CFE_ES_UnlockCDS(void); /*****************************************************************************/ /** @@ -657,6 +642,4 @@ int32 CFE_ES_ClearCDS(void); ******************************************************************************/ int32 CFE_ES_InitCDSSignatures(void); - - -#endif /* _cfe_es_cds_ */ +#endif /* _cfe_es_cds_ */ diff --git a/modules/es/fsw/src/cfe_es_cds_mempool.c b/modules/es/fsw/src/cfe_es_cds_mempool.c index ad634adac..4f02386fc 100644 --- a/modules/es/fsw/src/cfe_es_cds_mempool.c +++ b/modules/es/fsw/src/cfe_es_cds_mempool.c @@ -50,28 +50,13 @@ ** File Global Data */ - - -const size_t CFE_ES_CDSMemPoolDefSize[CFE_ES_CDS_NUM_BLOCK_SIZES] = -{ - CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02, - CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 -}; +const size_t CFE_ES_CDSMemPoolDefSize[CFE_ES_CDS_NUM_BLOCK_SIZES] = { + CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15, + CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12, + CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09, + CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06, + CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03, + CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01}; /*****************************************************************************/ /* @@ -83,9 +68,7 @@ const size_t CFE_ES_CDSMemPoolDefSize[CFE_ES_CDS_NUM_BLOCK_SIZES] = ** ** This is a bridge between the generic pool implementation and the CDS cache. */ -int32 CFE_ES_CDS_PoolRetrieve(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, - size_t Offset, - CFE_ES_GenPoolBD_t **BdPtr) +int32 CFE_ES_CDS_PoolRetrieve(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { CFE_ES_CDS_Instance_t *CDS = (CFE_ES_CDS_Instance_t *)GenPoolRecPtr; @@ -99,9 +82,7 @@ int32 CFE_ES_CDS_PoolRetrieve(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, ** ** This is a bridge between the generic pool implementation and the CDS cache. */ -int32 CFE_ES_CDS_PoolCommit(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, - size_t Offset, - const CFE_ES_GenPoolBD_t *BdPtr) +int32 CFE_ES_CDS_PoolCommit(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { CFE_ES_CDS_Instance_t *CDS = (CFE_ES_CDS_Instance_t *)GenPoolRecPtr; @@ -110,7 +91,6 @@ int32 CFE_ES_CDS_PoolCommit(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, return CFE_ES_CDS_CacheFlush(&CDS->Cache); } - /* ** CFE_ES_CreateCDSPool will initialize a pre-allocated memory pool. ** @@ -119,37 +99,33 @@ int32 CFE_ES_CDS_PoolCommit(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, ** where it is not possible to have contention writing into the syslog. ** Therefore the use of CFE_ES_SysLogWrite_Unsync() is acceptable */ -int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset) +int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; - size_t SizeCheck; - size_t ActualSize; + int32 Status; + size_t SizeCheck; + size_t ActualSize; - SizeCheck = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, 1); + SizeCheck = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, 1); ActualSize = CDSPoolSize; if (ActualSize < SizeCheck) { /* Must be able make Pool verification, block descriptor and at least one of the smallest blocks */ CFE_ES_SysLogWrite_Unsync("CFE_ES:CreateCDSPool-Pool size(%lu) too small for one CDS Block, need >=%lu\n", - (unsigned long)ActualSize, (unsigned long)SizeCheck); + (unsigned long)ActualSize, (unsigned long)SizeCheck); return CFE_ES_CDS_INVALID_SIZE; } - Status = CFE_ES_GenPoolInitialize(&CDS->Pool, - StartOffset, /* starting offset */ - ActualSize, /* total size */ - 4, /* alignment */ - CFE_ES_CDS_NUM_BLOCK_SIZES, - CFE_ES_CDSMemPoolDefSize, - CFE_ES_CDS_PoolRetrieve, - CFE_ES_CDS_PoolCommit); + Status = CFE_ES_GenPoolInitialize(&CDS->Pool, StartOffset, /* starting offset */ + ActualSize, /* total size */ + 4, /* alignment */ + CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, CFE_ES_CDS_PoolRetrieve, + CFE_ES_CDS_PoolCommit); return Status; } - /* ** Function: ** CFE_ES_RebuildCDSPool @@ -164,7 +140,7 @@ int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset) int32 CFE_ES_RebuildCDSPool(size_t CDSPoolSize, size_t StartOffset) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - int32 Status; + int32 Status; /* * Start by creating the pool in a clean state, as it would be in a non-rebuild. @@ -187,7 +163,6 @@ int32 CFE_ES_RebuildCDSPool(size_t CDSPoolSize, size_t StartOffset) return Status; } - /* ** Function: ** CFE_ES_CDSBlockWrite @@ -198,12 +173,12 @@ int32 CFE_ES_RebuildCDSPool(size_t CDSPoolSize, size_t StartOffset) int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; - int32 Status; - size_t BlockSize; - size_t UserDataSize; - size_t UserDataOffset; - CFE_ES_CDS_RegRec_t *CDSRegRecPtr; + char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; + int32 Status; + size_t BlockSize; + size_t UserDataSize; + size_t UserDataOffset; + CFE_ES_CDS_RegRec_t * CDSRegRecPtr; /* Ensure the the log message is an empty string in case it is never written to */ LogMessage[0] = 0; @@ -227,14 +202,13 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite) if (Status != CFE_SUCCESS) { CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage), - "CFE_ES:CDSBlkWrite-Invalid Handle or Block Descriptor.\n"); + "CFE_ES:CDSBlkWrite-Invalid Handle or Block Descriptor.\n"); } - else if (BlockSize <= sizeof(CFE_ES_CDS_BlockHeader_t) || - BlockSize != CDSRegRecPtr->BlockSize) + else if (BlockSize <= sizeof(CFE_ES_CDS_BlockHeader_t) || BlockSize != CDSRegRecPtr->BlockSize) { CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage), - "CFE_ES:CDSBlkWrite-Block size %lu invalid, expected %lu\n", - (unsigned long)BlockSize, (unsigned long)CDSRegRecPtr->BlockSize); + "CFE_ES:CDSBlkWrite-Block size %lu invalid, expected %lu\n", + (unsigned long)BlockSize, (unsigned long)CDSRegRecPtr->BlockSize); Status = CFE_ES_CDS_INVALID_SIZE; } else @@ -244,27 +218,29 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite) UserDataOffset = CDSRegRecPtr->BlockOffset; UserDataOffset += sizeof(CFE_ES_CDS_BlockHeader_t); - CDS->Cache.Data.BlockHeader.Crc = CFE_ES_CalculateCRC( - DataToWrite, UserDataSize, 0, CFE_MISSION_ES_DEFAULT_CRC); + CDS->Cache.Data.BlockHeader.Crc = + CFE_ES_CalculateCRC(DataToWrite, UserDataSize, 0, CFE_MISSION_ES_DEFAULT_CRC); CDS->Cache.Offset = CDSRegRecPtr->BlockOffset; - CDS->Cache.Size = sizeof(CFE_ES_CDS_BlockHeader_t); + CDS->Cache.Size = sizeof(CFE_ES_CDS_BlockHeader_t); /* Write the new block descriptor for the data coming from the Application */ Status = CFE_ES_CDS_CacheFlush(&CDS->Cache); if (Status != CFE_SUCCESS) { - CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage), - "CFE_ES:CDSBlkWrite-Err writing header data to CDS (Stat=0x%08x) @Offset=0x%08lx\n", - (unsigned int)CDS->Cache.AccessStatus, (unsigned long)CDSRegRecPtr->BlockOffset); + CFE_ES_SysLog_snprintf( + LogMessage, sizeof(LogMessage), + "CFE_ES:CDSBlkWrite-Err writing header data to CDS (Stat=0x%08x) @Offset=0x%08lx\n", + (unsigned int)CDS->Cache.AccessStatus, (unsigned long)CDSRegRecPtr->BlockOffset); } else { Status = CFE_PSP_WriteToCDS(DataToWrite, UserDataOffset, UserDataSize); if (Status != CFE_PSP_SUCCESS) { - CFE_ES_SysLog_snprintf(LogMessage, sizeof(LogMessage), - "CFE_ES:CDSBlkWrite-Err writing user data to CDS (Stat=0x%08x) @Offset=0x%08lx\n", - (unsigned int)Status, (unsigned long)UserDataOffset); + CFE_ES_SysLog_snprintf( + LogMessage, sizeof(LogMessage), + "CFE_ES:CDSBlkWrite-Err writing user data to CDS (Stat=0x%08x) @Offset=0x%08lx\n", + (unsigned int)Status, (unsigned long)UserDataOffset); } } } @@ -285,7 +261,6 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite) return Status; } - /* ** Function: ** CFE_ES_CDSBlockRead @@ -296,18 +271,17 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite) int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; - int32 Status; - uint32 CrcOfCDSData; - size_t BlockSize; - size_t UserDataSize; - size_t UserDataOffset; - CFE_ES_CDS_RegRec_t *CDSRegRecPtr; + char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; + int32 Status; + uint32 CrcOfCDSData; + size_t BlockSize; + size_t UserDataSize; + size_t UserDataOffset; + CFE_ES_CDS_RegRec_t * CDSRegRecPtr; /* Validate the handle before doing anything */ LogMessage[0] = 0; - CDSRegRecPtr = CFE_ES_LocateCDSBlockRecordByID(Handle); /* @@ -326,8 +300,7 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) Status = CFE_ES_GenPoolGetBlockSize(&CDS->Pool, &BlockSize, CDSRegRecPtr->BlockOffset); if (Status == CFE_SUCCESS) { - if (BlockSize <= sizeof(CFE_ES_CDS_BlockHeader_t) || - BlockSize != CDSRegRecPtr->BlockSize) + if (BlockSize <= sizeof(CFE_ES_CDS_BlockHeader_t) || BlockSize != CDSRegRecPtr->BlockSize) { Status = CFE_ES_CDS_INVALID_SIZE; } @@ -339,8 +312,8 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) UserDataOffset += sizeof(CFE_ES_CDS_BlockHeader_t); /* Read the header */ - Status = CFE_ES_CDS_CacheFetch(&CDS->Cache, CDSRegRecPtr->BlockOffset, - sizeof(CFE_ES_CDS_BlockHeader_t)); + Status = + CFE_ES_CDS_CacheFetch(&CDS->Cache, CDSRegRecPtr->BlockOffset, sizeof(CFE_ES_CDS_BlockHeader_t)); if (Status == CFE_SUCCESS) { @@ -377,7 +350,7 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) { CFE_ES_SYSLOG_APPEND(LogMessage); } - + return Status; } @@ -392,10 +365,7 @@ size_t CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport) { size_t ReqSize; - ReqSize = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, - CFE_ES_CDSMemPoolDefSize, - MaxNumBlocksToSupport); + ReqSize = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, MaxNumBlocksToSupport); return ReqSize; } - diff --git a/modules/es/fsw/src/cfe_es_cds_mempool.h b/modules/es/fsw/src/cfe_es_cds_mempool.h index 53e07ac3e..cbe075921 100644 --- a/modules/es/fsw/src/cfe_es_cds_mempool.h +++ b/modules/es/fsw/src/cfe_es_cds_mempool.h @@ -19,11 +19,11 @@ */ /* -** File: +** File: ** cfe_es_cds_mempool.h ** ** Purpose: -** This file contains the Internal interface for the cFE Critical Data Store +** This file contains the Internal interface for the cFE Critical Data Store ** memory pool functions. ** ** References: @@ -34,7 +34,6 @@ ** */ - #ifndef _cfe_es_cds_mempool_ #define _cfe_es_cds_mempool_ @@ -46,8 +45,7 @@ /* ** Macro Definitions */ -#define CFE_ES_CDS_NUM_BLOCK_SIZES 17 - +#define CFE_ES_CDS_NUM_BLOCK_SIZES 17 /*****************************************************************************/ /* @@ -66,7 +64,7 @@ ** None ** ** \return #CFE_SUCCESS \copydoc CFE_SUCCESS -** +** ******************************************************************************/ int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset); @@ -78,4 +76,4 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle); size_t CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport); -#endif /* _cfe_es_cds_mempool_ */ +#endif /* _cfe_es_cds_mempool_ */ diff --git a/modules/es/fsw/src/cfe_es_erlog.c b/modules/es/fsw/src/cfe_es_erlog.c index efb0b50bf..5df6e9a98 100644 --- a/modules/es/fsw/src/cfe_es_erlog.c +++ b/modules/es/fsw/src/cfe_es_erlog.c @@ -19,10 +19,10 @@ */ /* -** File: +** File: ** cfe_es_erlog.c ** -** Purpose: +** Purpose: ** This file implements the cFE Executive Services Exception and Reset Log functions. ** ** References: @@ -30,7 +30,7 @@ ** cFE Flight Software Application Developers Guide ** ** Notes: -** +** ** Modification History: ** */ @@ -48,110 +48,106 @@ /* ** Function: CFE_ES_WriteToERLogWithContext ** -** Purpose: Create an entry in the ES Exception and Reset Log. +** Purpose: Create an entry in the ES Exception and Reset Log. ** This log API accepts extra context information (AppID and ContextID) ** and is used when the app/task invoking this API is not the same app ** as where the event occurred. ** */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_WriteToERLogWithContext( CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, - const char *Description, CFE_ES_AppId_t AppId, uint32 PspContextId) +int32 CFE_ES_WriteToERLogWithContext(CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, + const char *Description, CFE_ES_AppId_t AppId, uint32 PspContextId) { - uint32 LogIdx; - CFE_ES_ERLog_MetaData_t *EntryPtr; - CFE_TIME_SysTime_t PendingTime; + uint32 LogIdx; + CFE_ES_ERLog_MetaData_t *EntryPtr; + CFE_TIME_SysTime_t PendingTime; + + /* + * Snapshot the time before locking (different subsystem) + */ + PendingTime = CFE_TIME_GetTime(); + + /* + * Ensure that description string is not NULL. + */ + if (Description == NULL) + { + Description = "No Description String Given."; + } - /* - * Snapshot the time before locking (different subsystem) + /* + * This routine needs to lock in case it is called + * from concurrent threads + */ + CFE_ES_LockSharedData(__func__, __LINE__); + + /* + ** Try to clean up an invalid ER log index variable. */ - PendingTime = CFE_TIME_GetTime(); + if (CFE_ES_ResetDataPtr->ERLogIndex >= CFE_PLATFORM_ES_ER_LOG_ENTRIES) + { + CFE_ES_ResetDataPtr->ERLogIndex = 0; + } + LogIdx = CFE_ES_ResetDataPtr->ERLogIndex; - /* - * Ensure that description string is not NULL. + /* + ** Now that the Local Index variable is set, increment the index for the next entry. */ - if ( Description == NULL) - { - Description = "No Description String Given."; - } - - /* - * This routine needs to lock in case it is called - * from concurrent threads + CFE_ES_ResetDataPtr->ERLogIndex++; + if (CFE_ES_ResetDataPtr->ERLogIndex >= CFE_PLATFORM_ES_ER_LOG_ENTRIES) + { + CFE_ES_ResetDataPtr->ERLogIndex = 0; + } + + /* + ** Clear out the log entry we are about to use. */ - CFE_ES_LockSharedData(__func__,__LINE__); - - /* - ** Try to clean up an invalid ER log index variable. - */ - if ( CFE_ES_ResetDataPtr->ERLogIndex >= CFE_PLATFORM_ES_ER_LOG_ENTRIES ) - { - CFE_ES_ResetDataPtr->ERLogIndex = 0; - } - LogIdx = CFE_ES_ResetDataPtr->ERLogIndex; - - /* - ** Now that the Local Index variable is set, increment the index for the next entry. - */ - CFE_ES_ResetDataPtr->ERLogIndex++; - if ( CFE_ES_ResetDataPtr->ERLogIndex >= CFE_PLATFORM_ES_ER_LOG_ENTRIES ) - { - CFE_ES_ResetDataPtr->ERLogIndex = 0; - } - - - /* - ** Clear out the log entry we are about to use. - */ - EntryPtr = &CFE_ES_ResetDataPtr->ERLog[LogIdx]; - memset(EntryPtr, 0, sizeof (*EntryPtr)); - - /* - ** Fill out the log fields - */ - EntryPtr->BaseInfo.LogEntryType = EntryType; - EntryPtr->BaseInfo.ResetType = ResetType; - EntryPtr->BaseInfo.ResetSubtype = ResetSubtype; - EntryPtr->BaseInfo.BootSource = CFE_ES_ResetDataPtr->ResetVars.BootSource; - EntryPtr->BaseInfo.ProcessorResetCount = - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount; - EntryPtr->BaseInfo.MaxProcessorResetCount = - CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount; - - /* - ** Copy the ES Reset variables to the log (before they are modified by the log entry). - */ - memcpy(&EntryPtr->BaseInfo.DebugVars, &CFE_ES_Global.DebugVars, - sizeof(EntryPtr->BaseInfo.DebugVars)); - - /* - ** Time Stamp the log entry with the system time - */ - EntryPtr->BaseInfo.TimeCode = PendingTime; - - /* - ** Copy the Description string to the log. - */ - strncpy(EntryPtr->BaseInfo.Description, Description, sizeof(EntryPtr->BaseInfo.Description) - 1); - EntryPtr->BaseInfo.Description[sizeof(EntryPtr->BaseInfo.Description) - 1] = '\0'; - - /* - * Store the context info (if any) + EntryPtr = &CFE_ES_ResetDataPtr->ERLog[LogIdx]; + memset(EntryPtr, 0, sizeof(*EntryPtr)); + + /* + ** Fill out the log fields */ - EntryPtr->AppID = AppId; - EntryPtr->PspContextId = PspContextId; + EntryPtr->BaseInfo.LogEntryType = EntryType; + EntryPtr->BaseInfo.ResetType = ResetType; + EntryPtr->BaseInfo.ResetSubtype = ResetSubtype; + EntryPtr->BaseInfo.BootSource = CFE_ES_ResetDataPtr->ResetVars.BootSource; + EntryPtr->BaseInfo.ProcessorResetCount = CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount; + EntryPtr->BaseInfo.MaxProcessorResetCount = CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount; - /* - ** Increment the number of ER log entries made - */ - CFE_ES_ResetDataPtr->ERLogEntries++; + /* + ** Copy the ES Reset variables to the log (before they are modified by the log entry). + */ + memcpy(&EntryPtr->BaseInfo.DebugVars, &CFE_ES_Global.DebugVars, sizeof(EntryPtr->BaseInfo.DebugVars)); - /* - * Shared data update is complete + /* + ** Time Stamp the log entry with the system time */ - CFE_ES_UnlockSharedData(__func__,__LINE__); + EntryPtr->BaseInfo.TimeCode = PendingTime; - return(CFE_SUCCESS); + /* + ** Copy the Description string to the log. + */ + strncpy(EntryPtr->BaseInfo.Description, Description, sizeof(EntryPtr->BaseInfo.Description) - 1); + EntryPtr->BaseInfo.Description[sizeof(EntryPtr->BaseInfo.Description) - 1] = '\0'; + + /* + * Store the context info (if any) + */ + EntryPtr->AppID = AppId; + EntryPtr->PspContextId = PspContextId; + + /* + ** Increment the number of ER log entries made + */ + CFE_ES_ResetDataPtr->ERLogEntries++; + + /* + * Shared data update is complete + */ + CFE_ES_UnlockSharedData(__func__, __LINE__); + + return (CFE_SUCCESS); } /* End of CFE_ES_WriteToERLogWithContext() */ @@ -159,18 +155,18 @@ int32 CFE_ES_WriteToERLogWithContext( CFE_ES_LogEntryType_Enum_t EntryType, ui /* ** Function: CFE_ES_WriteToERLog ** -** Purpose: Create an entry in the ES Exception and Reset Log. +** Purpose: Create an entry in the ES Exception and Reset Log. ** This log API is simplified for cases which do not have a separate context ** */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_WriteToERLog( CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, - const char *Description) +int32 CFE_ES_WriteToERLog(CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, + const char *Description) { /* passing 0xFFFFFFFF as the appid avoids confusion with actual appid 0 */ - return CFE_ES_WriteToERLogWithContext(EntryType, ResetType, ResetSubtype, - Description, CFE_ES_APPID_UNDEFINED, CFE_ES_ERLOG_NO_CONTEXT); - + return CFE_ES_WriteToERLogWithContext(EntryType, ResetType, ResetSubtype, Description, CFE_ES_APPID_UNDEFINED, + CFE_ES_ERLOG_NO_CONTEXT); + } /* End of CFE_ES_WriteToERLog() */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -183,11 +179,11 @@ int32 CFE_ES_WriteToERLog( CFE_ES_LogEntryType_Enum_t EntryType, uint32 Reset bool CFE_ES_BackgroundERLogFileDataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize) { CFE_ES_BackgroundLogDumpGlobal_t *BgFilePtr; - CFE_ES_ERLog_FileEntry_t *FileBufferPtr; - CFE_ES_ERLog_MetaData_t *EntryPtr; - int32 PspStatus; - - BgFilePtr = (CFE_ES_BackgroundLogDumpGlobal_t *)Meta; + CFE_ES_ERLog_FileEntry_t * FileBufferPtr; + CFE_ES_ERLog_MetaData_t * EntryPtr; + int32 PspStatus; + + BgFilePtr = (CFE_ES_BackgroundLogDumpGlobal_t *)Meta; FileBufferPtr = &BgFilePtr->EntryBuffer; if (RecordNum < CFE_PLATFORM_ES_ER_LOG_ENTRIES) @@ -197,7 +193,7 @@ bool CFE_ES_BackgroundERLogFileDataGetter(void *Meta, uint32 RecordNum, void **B /* First wipe the buffer before re-use */ memset(FileBufferPtr, 0, sizeof(*FileBufferPtr)); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* The basic info comes directly from the ES log */ FileBufferPtr->BaseInfo = EntryPtr->BaseInfo; @@ -221,25 +217,24 @@ bool CFE_ES_BackgroundERLogFileDataGetter(void *Meta, uint32 RecordNum, void **B FileBufferPtr->ContextSize = 0; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); /* * Export data to caller for actual write */ - *Buffer = FileBufferPtr; + *Buffer = FileBufferPtr; *BufSize = sizeof(*FileBufferPtr); } else { - *Buffer = NULL; + *Buffer = NULL; *BufSize = 0; } /* Check for EOF (last entry) */ - return (RecordNum >= (CFE_PLATFORM_ES_ER_LOG_ENTRIES-1)); + return (RecordNum >= (CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1)); } - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Function: CFE_ER_BackgroundERLogFileEventHandler() */ /* */ @@ -247,7 +242,8 @@ bool CFE_ES_BackgroundERLogFileDataGetter(void *Meta, uint32 RecordNum, void **B /* Report events during writing exception & reset log to a file. */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_ES_BackgroundERLogFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position) +void CFE_ES_BackgroundERLogFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, + size_t BlockSize, size_t Position) { CFE_ES_BackgroundLogDumpGlobal_t *BgFilePtr; @@ -256,35 +252,33 @@ void CFE_ES_BackgroundERLogFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t /* * Note that this runs in the context of ES background task (file writer background job) * It does NOT run in the context of the CFE_TBL app task. - * + * * Events should use CFE_EVS_SendEventWithAppID() rather than CFE_EVS_SendEvent() * to get proper association with TBL task. */ - switch(Event) + switch (Event) { case CFE_FS_FileWriteEvent_COMPLETE: - CFE_EVS_SendEvent(CFE_ES_ERLOG2_EID, CFE_EVS_EventType_DEBUG, - "%s written:Size=%lu", - BgFilePtr->FileWrite.FileName,(unsigned long)Position); - break; + CFE_EVS_SendEvent(CFE_ES_ERLOG2_EID, CFE_EVS_EventType_DEBUG, "%s written:Size=%lu", + BgFilePtr->FileWrite.FileName, (unsigned long)Position); + break; case CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR: case CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR: - CFE_EVS_SendEvent(CFE_ES_FILEWRITE_ERR_EID,CFE_EVS_EventType_ERROR, - "File write,byte cnt err,file %s,request=%u,actual=%u", - BgFilePtr->FileWrite.FileName, (int)BlockSize, (int)Status); + CFE_EVS_SendEvent(CFE_ES_FILEWRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "File write,byte cnt err,file %s,request=%u,actual=%u", BgFilePtr->FileWrite.FileName, + (int)BlockSize, (int)Status); break; case CFE_FS_FileWriteEvent_CREATE_ERROR: - CFE_EVS_SendEvent(CFE_ES_ERLOG2_ERR_EID,CFE_EVS_EventType_ERROR, - "Error creating file %s, RC = %d", - BgFilePtr->FileWrite.FileName, (int)Status); + CFE_EVS_SendEvent(CFE_ES_ERLOG2_ERR_EID, CFE_EVS_EventType_ERROR, "Error creating file %s, RC = %d", + BgFilePtr->FileWrite.FileName, (int)Status); break; - + default: /* unhandled event - ignore */ break; - } + } } /* @@ -298,14 +292,14 @@ void CFE_ES_BackgroundERLogFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t */ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) { - int32 Status; - uint32 PspContextId; - char ReasonString[CFE_ES_ERLOG_DESCRIPTION_MAX_LENGTH]; - CFE_ES_TaskInfo_t EsTaskInfo; - osal_id_t ExceptionTaskID; - uint32 ResetType; + int32 Status; + uint32 PspContextId; + char ReasonString[CFE_ES_ERLOG_DESCRIPTION_MAX_LENGTH]; + CFE_ES_TaskInfo_t EsTaskInfo; + osal_id_t ExceptionTaskID; + uint32 ResetType; CFE_ES_LogEntryType_Enum_t LogType; - CFE_ES_AppRecord_t *AppRecPtr; + CFE_ES_AppRecord_t * AppRecPtr; if (CFE_PSP_Exception_GetCount() == 0) { @@ -324,7 +318,7 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) { /* reason string is not available - populate with something for the log */ snprintf(ReasonString, sizeof(ReasonString), "Unknown - CFE_PSP_ExceptionGetSummary() error %ld", (long)Status); - PspContextId = 0; + PspContextId = 0; ExceptionTaskID = OS_OBJECT_ID_UNDEFINED; } /* end if */ @@ -332,8 +326,8 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) * Note that writes to the ES ER log actually do not get propagated to the debug console. * so by writing to SysLog here it becomes visible in both places. */ - CFE_ES_WriteToSysLog("ExceptionID 0x%lx in TaskID %lu: %s\n", - (unsigned long)PspContextId, OS_ObjectIdToInteger(ExceptionTaskID), ReasonString); + CFE_ES_WriteToSysLog("ExceptionID 0x%lx in TaskID %lu: %s\n", (unsigned long)PspContextId, + OS_ObjectIdToInteger(ExceptionTaskID), ReasonString); /* * If task ID is 0, this means it was a system level exception and @@ -344,7 +338,7 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) */ if (OS_ObjectIdDefined(ExceptionTaskID)) { - Status = CFE_ES_GetTaskInfo( &EsTaskInfo, CFE_ES_TaskId_FromOSAL(ExceptionTaskID) ); + Status = CFE_ES_GetTaskInfo(&EsTaskInfo, CFE_ES_TaskId_FromOSAL(ExceptionTaskID)); /* * The App ID was found, now see if the ExceptionAction is set for a reset @@ -352,7 +346,7 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) if (Status == CFE_SUCCESS) { AppRecPtr = CFE_ES_LocateAppRecordByID(EsTaskInfo.AppId); - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); if (CFE_ES_AppRecordIsMatch(AppRecPtr, EsTaskInfo.AppId) && AppRecPtr->StartParams.ExceptionAction == CFE_ES_ExceptionAction_RESTART_APP) { @@ -361,7 +355,7 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) */ ResetType = CFE_ES_APP_RESTART; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); } } @@ -373,20 +367,19 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) */ if (ResetType == 0) { - if ( CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount >= - CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount ) + if (CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount >= + CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount) { CFE_ES_WriteToSysLog("Maximum Processor Reset count reached (%u)", - (unsigned int)CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount); + (unsigned int)CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount); ResetType = CFE_PSP_RST_TYPE_POWERON; } else { CFE_ES_WriteToSysLog("Processor Reset count not reached (%u/%u)", - (unsigned int)CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount, - (unsigned int)CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount); - + (unsigned int)CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount, + (unsigned int)CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount); /* ** Update the reset variables @@ -407,11 +400,8 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) LogType = CFE_ES_LogEntryType_CORE; } - - CFE_ES_WriteToERLogWithContext(LogType, ResetType, - CFE_PSP_RST_SUBTYPE_EXCEPTION, ReasonString, - EsTaskInfo.AppId, - PspContextId); + CFE_ES_WriteToERLogWithContext(LogType, ResetType, CFE_PSP_RST_SUBTYPE_EXCEPTION, ReasonString, + EsTaskInfo.AppId, PspContextId); if (ResetType == CFE_ES_APP_RESTART) { @@ -432,13 +422,9 @@ bool CFE_ES_RunExceptionScan(uint32 ElapsedTime, void *Arg) /* normally this will not return */ CFE_PSP_Restart(ResetType); } - } - while(ResetType == 0); + } while (ResetType == 0); - - return true; /* returning true because there was an exception to deal with */ + return true; /* returning true because there was an exception to deal with */ } - - /* end of file */ diff --git a/modules/es/fsw/src/cfe_es_generic_pool.c b/modules/es/fsw/src/cfe_es_generic_pool.c index 18a9bf385..bba148318 100644 --- a/modules/es/fsw/src/cfe_es_generic_pool.c +++ b/modules/es/fsw/src/cfe_es_generic_pool.c @@ -40,14 +40,11 @@ #include #include - /*****************************************************************************/ /* ** Functions */ - - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_GenPoolFindBucket @@ -59,7 +56,7 @@ uint16 CFE_ES_GenPoolFindBucket(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t ReqSi { uint16 Index; - for (Index=0; Index < PoolRecPtr->NumBuckets; ++Index) + for (Index = 0; Index < PoolRecPtr->NumBuckets; ++Index) { if (ReqSize <= PoolRecPtr->Buckets[Index].BlockSize) { @@ -75,7 +72,6 @@ uint16 CFE_ES_GenPoolFindBucket(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t ReqSi return (PoolRecPtr->NumBuckets - Index); } - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_GenPoolGetBucketState @@ -96,7 +92,6 @@ CFE_ES_GenPoolBucket_t *CFE_ES_GenPoolGetBucketState(CFE_ES_GenPoolRecord_t *Poo return &PoolRecPtr->Buckets[Index]; } - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_GenPoolRecyclePoolBlock @@ -104,34 +99,31 @@ CFE_ES_GenPoolBucket_t *CFE_ES_GenPoolGetBucketState(CFE_ES_GenPoolRecord_t *Poo ** Local helper function to find and re-allocate a previously returned block **--------------------------------------------------------------------------------------- */ -int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, - size_t NewSize, size_t *BlockOffsetPtr) +int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, size_t NewSize, + size_t *BlockOffsetPtr) { CFE_ES_GenPoolBucket_t *BucketPtr; - size_t DescOffset; - size_t BlockOffset; - size_t NextOffset; - CFE_ES_GenPoolBD_t *BdPtr; - uint16 RecycleBucketId; - int32 Status; + size_t DescOffset; + size_t BlockOffset; + size_t NextOffset; + CFE_ES_GenPoolBD_t * BdPtr; + uint16 RecycleBucketId; + int32 Status; BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId); - if (BucketPtr == NULL || - BucketPtr->RecycleCount == BucketPtr->ReleaseCount || - BucketPtr->FirstOffset == 0) + if (BucketPtr == NULL || BucketPtr->RecycleCount == BucketPtr->ReleaseCount || BucketPtr->FirstOffset == 0) { /* no buffers in pool to recycle */ return CFE_ES_BUFFER_NOT_IN_POOL; } BlockOffset = BucketPtr->FirstOffset; - DescOffset = BlockOffset - CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE; - Status = PoolRecPtr->Retrieve(PoolRecPtr, DescOffset, &BdPtr); + DescOffset = BlockOffset - CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE; + Status = PoolRecPtr->Retrieve(PoolRecPtr, DescOffset, &BdPtr); if (Status == CFE_SUCCESS) { RecycleBucketId = BdPtr->Allocated - CFE_ES_MEMORY_DEALLOCATED; - if (BdPtr->CheckBits != CFE_ES_CHECK_PATTERN || - RecycleBucketId != BucketId) + if (BdPtr->CheckBits != CFE_ES_CHECK_PATTERN || RecycleBucketId != BucketId) { /* sanity check failed - possible pool corruption? */ Status = CFE_ES_BUFFER_NOT_IN_POOL; @@ -143,14 +135,14 @@ int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 */ NextOffset = BdPtr->NextOffset; - BdPtr->Allocated = CFE_ES_MEMORY_ALLOCATED + BucketId; /* Flag memory block as allocated */ - BdPtr->ActualSize = NewSize; - BdPtr->NextOffset = 0; + BdPtr->Allocated = CFE_ES_MEMORY_ALLOCATED + BucketId; /* Flag memory block as allocated */ + BdPtr->ActualSize = NewSize; + BdPtr->NextOffset = 0; Status = PoolRecPtr->Commit(PoolRecPtr, DescOffset, BdPtr); if (Status == CFE_SUCCESS) { - *BlockOffsetPtr = BlockOffset; + *BlockOffsetPtr = BlockOffset; BucketPtr->FirstOffset = NextOffset; ++BucketPtr->RecycleCount; } @@ -160,7 +152,6 @@ int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 return Status; } - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_GenPoolCreatePoolBlock @@ -168,15 +159,15 @@ int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 ** Local helper function to create a new block of the given size **--------------------------------------------------------------------------------------- */ -int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, - size_t NewSize, size_t *BlockOffsetPtr) +int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, size_t NewSize, + size_t *BlockOffsetPtr) { CFE_ES_GenPoolBucket_t *BucketPtr; - size_t DescOffset; - size_t BlockOffset; - size_t NextTailPosition; - CFE_ES_GenPoolBD_t *BdPtr; - int32 Status; + size_t DescOffset; + size_t BlockOffset; + size_t NextTailPosition; + CFE_ES_GenPoolBD_t * BdPtr; + int32 Status; BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId); if (BucketPtr == NULL) @@ -195,14 +186,14 @@ int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 B BlockOffset += PoolRecPtr->AlignMask; BlockOffset &= ~PoolRecPtr->AlignMask; - DescOffset = BlockOffset - CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE; + DescOffset = BlockOffset - CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE; NextTailPosition = BlockOffset + BucketPtr->BlockSize; /* * Check if there is enough space remaining in the pool -- the * proposed start address plus the block size must not exceed the pool end. */ - if ( NextTailPosition > PoolRecPtr->PoolMaxOffset ) + if (NextTailPosition > PoolRecPtr->PoolMaxOffset) { /* can't fit in remaining mem */ return CFE_ES_ERR_MEM_BLOCK_SIZE; @@ -214,10 +205,10 @@ int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 B Status = PoolRecPtr->Retrieve(PoolRecPtr, DescOffset, &BdPtr); if (Status == CFE_SUCCESS) { - BdPtr->CheckBits = CFE_ES_CHECK_PATTERN; - BdPtr->Allocated = CFE_ES_MEMORY_ALLOCATED + BucketId; /* Flag memory block as allocated */ - BdPtr->ActualSize = NewSize; - BdPtr->NextOffset = 0; + BdPtr->CheckBits = CFE_ES_CHECK_PATTERN; + BdPtr->Allocated = CFE_ES_MEMORY_ALLOCATED + BucketId; /* Flag memory block as allocated */ + BdPtr->ActualSize = NewSize; + BdPtr->NextOffset = 0; Status = PoolRecPtr->Commit(PoolRecPtr, DescOffset, BdPtr); if (Status == CFE_SUCCESS) @@ -231,14 +222,11 @@ int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 B *BlockOffsetPtr = BlockOffset; } - } return Status; } - - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_GenPoolInitialize @@ -246,19 +234,13 @@ int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 B ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -int32 CFE_ES_GenPoolInitialize( - CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t StartOffset, - size_t PoolSize, - size_t AlignSize, - uint16 NumBlockSizes, - const size_t *BlockSizeList, - CFE_ES_PoolRetrieve_Func_t RetrieveFunc, - CFE_ES_PoolCommit_Func_t CommitFunc) +int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t StartOffset, size_t PoolSize, + size_t AlignSize, uint16 NumBlockSizes, const size_t *BlockSizeList, + CFE_ES_PoolRetrieve_Func_t RetrieveFunc, CFE_ES_PoolCommit_Func_t CommitFunc) { - cpuaddr AlignMask; - uint32 i; - uint32 j; + cpuaddr AlignMask; + uint32 i; + uint32 j; CFE_ES_GenPoolBucket_t *BucketPtr; /* @@ -287,17 +269,17 @@ int32 CFE_ES_GenPoolInitialize( } /* complete initialization of pool record entry */ - PoolRecPtr->AlignMask = AlignMask; + PoolRecPtr->AlignMask = AlignMask; PoolRecPtr->PoolTotalSize = PoolSize; PoolRecPtr->PoolMaxOffset = PoolSize + StartOffset; - PoolRecPtr->NumBuckets = NumBlockSizes; - PoolRecPtr->Retrieve = RetrieveFunc; - PoolRecPtr->Commit = CommitFunc; - PoolRecPtr->TailPosition = StartOffset; + PoolRecPtr->NumBuckets = NumBlockSizes; + PoolRecPtr->Retrieve = RetrieveFunc; + PoolRecPtr->Commit = CommitFunc; + PoolRecPtr->TailPosition = StartOffset; /* initially copy all block sizes */ BucketPtr = PoolRecPtr->Buckets; - for (i=0; i < NumBlockSizes; ++i) + for (i = 0; i < NumBlockSizes; ++i) { BucketPtr->BlockSize = BlockSizeList[i]; ++BucketPtr; @@ -307,9 +289,9 @@ int32 CFE_ES_GenPoolInitialize( * this does not run often and the list is relatively small. */ do { - j = 0; + j = 0; BucketPtr = PoolRecPtr->Buckets; - for (i=1; i < NumBlockSizes; ++i) + for (i = 1; i < NumBlockSizes; ++i) { if (BucketPtr[0].BlockSize > BucketPtr[1].BlockSize) { @@ -321,8 +303,7 @@ int32 CFE_ES_GenPoolInitialize( } ++BucketPtr; } - } - while (j > 0); + } while (j > 0); /* * Additional sanity check - after sorting the list, @@ -334,7 +315,6 @@ int32 CFE_ES_GenPoolInitialize( return CFE_ES_ERR_MEM_BLOCK_SIZE; } - return CFE_SUCCESS; } @@ -345,9 +325,7 @@ int32 CFE_ES_GenPoolInitialize( ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, - const size_t *BlockSizeList, - uint32 NumBlocks) +size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, const size_t *BlockSizeList, uint32 NumBlocks) { uint16 BucketId; size_t MinBlockSize; @@ -371,8 +349,6 @@ size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, return (NumBlocks * MinBlockSize); } - - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_GenPoolGetBlock @@ -380,21 +356,18 @@ size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t *BlockOffsetPtr, - size_t ReqSize ) +int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockOffsetPtr, size_t ReqSize) { - int32 Status; + int32 Status; uint16 BucketId; /* Find the bucket which can accommodate the requested size. */ BucketId = CFE_ES_GenPoolFindBucket(PoolRecPtr, ReqSize); if (BucketId == 0) { - CFE_ES_WriteToSysLog("CFE_ES:getPoolBlock err:size(%lu) > max(%lu).\n", - (unsigned long)ReqSize, - (unsigned long)PoolRecPtr->Buckets[PoolRecPtr->NumBuckets-1].BlockSize); - return(CFE_ES_ERR_MEM_BLOCK_SIZE); + CFE_ES_WriteToSysLog("CFE_ES:getPoolBlock err:size(%lu) > max(%lu).\n", (unsigned long)ReqSize, + (unsigned long)PoolRecPtr->Buckets[PoolRecPtr->NumBuckets - 1].BlockSize); + return (CFE_ES_ERR_MEM_BLOCK_SIZE); } /* first attempt to recycle any buffers from the same bucket that were freed */ @@ -405,7 +378,7 @@ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, Status = CFE_ES_GenPoolCreatePoolBlock(PoolRecPtr, BucketId, ReqSize, BlockOffsetPtr); } - return(Status); + return (Status); } /* @@ -415,15 +388,13 @@ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t *BlockSizePtr, - size_t BlockOffset) +int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockSizePtr, size_t BlockOffset) { - size_t DescOffset; + size_t DescOffset; CFE_ES_GenPoolBucket_t *BucketPtr; - CFE_ES_GenPoolBD_t *BdPtr; - int32 Status; - uint16 BucketId; + CFE_ES_GenPoolBD_t * BdPtr; + int32 Status; + uint16 BucketId; if (BlockOffset >= PoolRecPtr->TailPosition || BlockOffset < CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE) { @@ -436,13 +407,11 @@ int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, Status = PoolRecPtr->Retrieve(PoolRecPtr, DescOffset, &BdPtr); if (Status == CFE_SUCCESS) { - BucketId = BdPtr->Allocated - CFE_ES_MEMORY_ALLOCATED; + BucketId = BdPtr->Allocated - CFE_ES_MEMORY_ALLOCATED; BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId); - if (BdPtr->CheckBits != CFE_ES_CHECK_PATTERN || - BucketPtr == NULL || - BdPtr->ActualSize == 0 || - BucketPtr->BlockSize < BdPtr->ActualSize) + if (BdPtr->CheckBits != CFE_ES_CHECK_PATTERN || BucketPtr == NULL || BdPtr->ActualSize == 0 || + BucketPtr->BlockSize < BdPtr->ActualSize) { /* This does not appear to be a valid data buffer */ Status = CFE_ES_POOL_BLOCK_INVALID; @@ -450,7 +419,7 @@ int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, else { *BlockSizePtr = BdPtr->ActualSize; - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; } } @@ -464,15 +433,13 @@ int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t *BlockSizePtr, - size_t BlockOffset) +int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockSizePtr, size_t BlockOffset) { - size_t DescOffset; + size_t DescOffset; CFE_ES_GenPoolBucket_t *BucketPtr; - CFE_ES_GenPoolBD_t *BdPtr; - int32 Status; - uint16 BucketId; + CFE_ES_GenPoolBD_t * BdPtr; + int32 Status; + uint16 BucketId; if (BlockOffset >= PoolRecPtr->TailPosition || BlockOffset < CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE) { @@ -485,13 +452,11 @@ int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, Status = PoolRecPtr->Retrieve(PoolRecPtr, DescOffset, &BdPtr); if (Status == CFE_SUCCESS) { - BucketId = BdPtr->Allocated - CFE_ES_MEMORY_ALLOCATED; + BucketId = BdPtr->Allocated - CFE_ES_MEMORY_ALLOCATED; BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId); - if (BdPtr->CheckBits != CFE_ES_CHECK_PATTERN || - BucketPtr == NULL || - BdPtr->ActualSize == 0 || - BucketPtr->BlockSize < BdPtr->ActualSize) + if (BdPtr->CheckBits != CFE_ES_CHECK_PATTERN || BucketPtr == NULL || BdPtr->ActualSize == 0 || + BucketPtr->BlockSize < BdPtr->ActualSize) { /* This does not appear to be a valid data buffer */ ++PoolRecPtr->ValidationErrorCount; @@ -499,9 +464,9 @@ int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, } else { - BdPtr->Allocated = CFE_ES_MEMORY_DEALLOCATED + BucketId; + BdPtr->Allocated = CFE_ES_MEMORY_DEALLOCATED + BucketId; BdPtr->NextOffset = BucketPtr->FirstOffset; - *BlockSizePtr = BdPtr->ActualSize; + *BlockSizePtr = BdPtr->ActualSize; Status = PoolRecPtr->Commit(PoolRecPtr, DescOffset, BdPtr); if (Status == CFE_SUCCESS) @@ -524,13 +489,13 @@ int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, */ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) { - int32 Status; - size_t DescOffset; - size_t BlockOffset; + int32 Status; + size_t DescOffset; + size_t BlockOffset; CFE_ES_GenPoolBucket_t *BucketPtr; - CFE_ES_GenPoolBD_t *BdPtr; - uint16 BucketId; - bool IsDeallocatedBlock; + CFE_ES_GenPoolBD_t * BdPtr; + uint16 BucketId; + bool IsDeallocatedBlock; Status = CFE_SUCCESS; @@ -538,8 +503,8 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) while (true) { IsDeallocatedBlock = false; - BucketId = 0; - BucketPtr = NULL; + BucketId = 0; + BucketPtr = NULL; /* * Determine the offsets of the next user block, @@ -556,7 +521,7 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) } DescOffset = BlockOffset - CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE; - Status = PoolRecPtr->Retrieve(PoolRecPtr, DescOffset, &BdPtr); + Status = PoolRecPtr->Retrieve(PoolRecPtr, DescOffset, &BdPtr); if (Status != CFE_SUCCESS) { /* Failed to read descriptor */ @@ -571,7 +536,7 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) if (BdPtr->CheckBits == CFE_ES_CHECK_PATTERN) { /* Test if block is deallocated */ - BucketId = BdPtr->Allocated - CFE_ES_MEMORY_DEALLOCATED; + BucketId = BdPtr->Allocated - CFE_ES_MEMORY_DEALLOCATED; BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId); if (BucketPtr != 0) { @@ -584,12 +549,11 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) * In this case there is nothing more to do, just * get the size and skip the block. */ - BucketId = BdPtr->Allocated - CFE_ES_MEMORY_ALLOCATED; + BucketId = BdPtr->Allocated - CFE_ES_MEMORY_ALLOCATED; BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId); } } - /* * Sanity check that the actual size is less than the bucket size - * it always should be, as long as the pool was created with the same @@ -614,9 +578,9 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) if (IsDeallocatedBlock) { ++BucketPtr->ReleaseCount; - BdPtr->NextOffset = BucketPtr->FirstOffset; + BdPtr->NextOffset = BucketPtr->FirstOffset; BucketPtr->FirstOffset = BlockOffset; - Status = PoolRecPtr->Commit(PoolRecPtr, DescOffset, BdPtr); + Status = PoolRecPtr->Commit(PoolRecPtr, DescOffset, BdPtr); if (Status != CFE_SUCCESS) { break; @@ -636,10 +600,8 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) */ bool CFE_ES_GenPoolValidateState(const CFE_ES_GenPoolRecord_t *PoolRecPtr) { - return (PoolRecPtr->PoolTotalSize > 0 && - PoolRecPtr->TailPosition <= PoolRecPtr->PoolMaxOffset && - PoolRecPtr->NumBuckets > 0 && - PoolRecPtr->NumBuckets < CFE_PLATFORM_ES_POOL_MAX_BUCKETS); + return (PoolRecPtr->PoolTotalSize > 0 && PoolRecPtr->TailPosition <= PoolRecPtr->PoolMaxOffset && + PoolRecPtr->NumBuckets > 0 && PoolRecPtr->NumBuckets < CFE_PLATFORM_ES_POOL_MAX_BUCKETS); } /* @@ -649,9 +611,8 @@ bool CFE_ES_GenPoolValidateState(const CFE_ES_GenPoolRecord_t *PoolRecPtr) ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *FreeSizeBuf, - CFE_ES_MemOffset_t *TotalSizeBuf) +void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t *FreeSizeBuf, + CFE_ES_MemOffset_t *TotalSizeBuf) { if (TotalSizeBuf != NULL) { @@ -670,10 +631,8 @@ void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, - uint16 *NumBucketsBuf, - uint32 *AllocCountBuf, - uint32 *ValidationErrorCountBuf) +void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 *NumBucketsBuf, uint32 *AllocCountBuf, + uint32 *ValidationErrorCountBuf) { if (NumBucketsBuf != NULL) { @@ -689,7 +648,6 @@ void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, } } - /* **--------------------------------------------------------------------------------------- ** Name: CFE_ES_GenPoolGetFreeSize @@ -698,10 +656,10 @@ void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, **--------------------------------------------------------------------------------------- */ void CFE_ES_GenPoolGetBucketUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, - CFE_ES_BlockStats_t *BlockStatsBuf) + CFE_ES_BlockStats_t *BlockStatsBuf) { - const CFE_ES_GenPoolBucket_t *BucketPtr; - static const CFE_ES_GenPoolBucket_t ZeroBucket = { 0 }; + const CFE_ES_GenPoolBucket_t * BucketPtr; + static const CFE_ES_GenPoolBucket_t ZeroBucket = {0}; BucketPtr = CFE_ES_GenPoolGetBucketState(PoolRecPtr, BucketId); if (BucketPtr == NULL) @@ -713,8 +671,7 @@ void CFE_ES_GenPoolGetBucketUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 Buc if (BlockStatsBuf != NULL) { BlockStatsBuf->NumCreated = BucketPtr->AllocationCount; - BlockStatsBuf->BlockSize = CFE_ES_MEMOFFSET_C(BucketPtr->BlockSize); - BlockStatsBuf->NumFree = BucketPtr->ReleaseCount - BucketPtr->RecycleCount; + BlockStatsBuf->BlockSize = CFE_ES_MEMOFFSET_C(BucketPtr->BlockSize); + BlockStatsBuf->NumFree = BucketPtr->ReleaseCount - BucketPtr->RecycleCount; } } - diff --git a/modules/es/fsw/src/cfe_es_generic_pool.h b/modules/es/fsw/src/cfe_es_generic_pool.h index fb1947e78..1361a81e1 100644 --- a/modules/es/fsw/src/cfe_es_generic_pool.h +++ b/modules/es/fsw/src/cfe_es_generic_pool.h @@ -19,11 +19,11 @@ */ /* -** File: +** File: ** cfe_es_generic_pool.h ** ** Purpose: -** This file contains the Internal interface for the cFE Critical Data Store +** This file contains the Internal interface for the cFE Critical Data Store ** memory pool functions. ** ** References: @@ -34,7 +34,6 @@ ** */ - #ifndef cfe_es_generic_pool_h #define cfe_es_generic_pool_h @@ -46,12 +45,12 @@ /* ** Macro Definitions */ -#define CFE_ES_CHECK_PATTERN ((uint16)0x5a5a) -#define CFE_ES_MEMORY_ALLOCATED ((uint16)0xaaaa) -#define CFE_ES_MEMORY_DEALLOCATED ((uint16)0xdddd) - +#define CFE_ES_CHECK_PATTERN ((uint16)0x5a5a) +#define CFE_ES_MEMORY_ALLOCATED ((uint16)0xaaaa) +#define CFE_ES_MEMORY_DEALLOCATED ((uint16)0xdddd) -#define CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE sizeof(CFE_ES_GenPoolBD_t) /* amount of space to reserve with every allocation */ +#define CFE_ES_GENERIC_POOL_DESCRIPTOR_SIZE \ + sizeof(CFE_ES_GenPoolBD_t) /* amount of space to reserve with every allocation */ /* ** Type Definitions @@ -59,20 +58,19 @@ typedef struct CFE_ES_GenPoolBD { - uint16 CheckBits; /**< Set to a fixed bit pattern after init */ - uint16 Allocated; /**< Set to a bit pattern depending on allocation state */ - size_t ActualSize; /**< The actual requested size of the block */ - size_t NextOffset; /**< The offset of the next descriptor in the free stack */ + uint16 CheckBits; /**< Set to a fixed bit pattern after init */ + uint16 Allocated; /**< Set to a bit pattern depending on allocation state */ + size_t ActualSize; /**< The actual requested size of the block */ + size_t NextOffset; /**< The offset of the next descriptor in the free stack */ } CFE_ES_GenPoolBD_t; - typedef struct CFE_ES_GenPoolBucket { - size_t BlockSize; - size_t FirstOffset; /**< Top of the "free stack" of buffers which have been returned */ - uint32 AllocationCount; /**< Total number of buffers of this block size that exist (initial get) */ - uint32 ReleaseCount; /**< Total number of buffers that have been released (put back) */ - uint32 RecycleCount; /**< Total number of buffers that have been recycled (get after put) */ + size_t BlockSize; + size_t FirstOffset; /**< Top of the "free stack" of buffers which have been returned */ + uint32 AllocationCount; /**< Total number of buffers of this block size that exist (initial get) */ + uint32 ReleaseCount; /**< Total number of buffers that have been released (put back) */ + uint32 RecycleCount; /**< Total number of buffers that have been recycled (get after put) */ } CFE_ES_GenPoolBucket_t; /* @@ -88,8 +86,8 @@ typedef struct CFE_ES_GenPoolRecord CFE_ES_GenPoolRecord_t; * the descriptor data. On memory mapped pools it may output a direct * pointer to the data instead of copying it. */ -typedef int32 (*CFE_ES_PoolRetrieve_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t Offset, CFE_ES_GenPoolBD_t **BdPtr); +typedef int32 (*CFE_ES_PoolRetrieve_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, + CFE_ES_GenPoolBD_t **BdPtr); /** * \brief Function to commit a buffer descriptor to the pool storage @@ -98,27 +96,26 @@ typedef int32 (*CFE_ES_PoolRetrieve_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, * directly accessed as memory. This routine writes data back to pool * storage. It may be a no-op for memory mapped pools. */ -typedef int32 (*CFE_ES_PoolCommit_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr); - +typedef int32 (*CFE_ES_PoolCommit_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, + const CFE_ES_GenPoolBD_t *BdPtr); /** * \brief Generic Memory Pool Type */ struct CFE_ES_GenPoolRecord { - size_t PoolTotalSize; /**< Total size of the pool area, in bytes */ - size_t PoolMaxOffset; /**< End offset (position) of the pool */ - size_t AlignMask; /**< Alignment mask applied to all new allocations */ - size_t TailPosition; /**< Current high watermark of the pool, end of last allocation */ + size_t PoolTotalSize; /**< Total size of the pool area, in bytes */ + size_t PoolMaxOffset; /**< End offset (position) of the pool */ + size_t AlignMask; /**< Alignment mask applied to all new allocations */ + size_t TailPosition; /**< Current high watermark of the pool, end of last allocation */ - CFE_ES_PoolRetrieve_Func_t Retrieve; /**< Function to access a buffer descriptor in the pool storage */ - CFE_ES_PoolCommit_Func_t Commit; /**< Function to commit a buffer descriptor to the pool storage */ + CFE_ES_PoolRetrieve_Func_t Retrieve; /**< Function to access a buffer descriptor in the pool storage */ + CFE_ES_PoolCommit_Func_t Commit; /**< Function to commit a buffer descriptor to the pool storage */ - uint32 AllocationCount; /**< Total number of block allocations of any size */ - uint32 ValidationErrorCount; /**< Count of validation errors */ + uint32 AllocationCount; /**< Total number of block allocations of any size */ + uint32 ValidationErrorCount; /**< Count of validation errors */ - uint16 NumBuckets; /**< Number of entries in the "Buckets" array that are valid */ + uint16 NumBuckets; /**< Number of entries in the "Buckets" array that are valid */ CFE_ES_GenPoolBucket_t Buckets[CFE_PLATFORM_ES_POOL_MAX_BUCKETS]; /**< Bucket States */ }; @@ -144,14 +141,9 @@ struct CFE_ES_GenPoolRecord * * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ -int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t StartOffset, - size_t PoolSize, - size_t AlignSize, - uint16 NumBlockSizes, - const size_t *BlockSizeList, - CFE_ES_PoolRetrieve_Func_t RetrieveFunc, - CFE_ES_PoolCommit_Func_t CommitFunc); +int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t StartOffset, size_t PoolSize, + size_t AlignSize, uint16 NumBlockSizes, const size_t *BlockSizeList, + CFE_ES_PoolRetrieve_Func_t RetrieveFunc, CFE_ES_PoolCommit_Func_t CommitFunc); /** * \brief Gets a block from the pool @@ -165,9 +157,7 @@ int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, * * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ -int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t *BlockOffsetPtr, - size_t ReqSize); +int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockOffsetPtr, size_t ReqSize); /** * \brief Returns a block to the pool @@ -181,9 +171,7 @@ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, * * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ -int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t *BlockSizePtr, - size_t BlockOffset); +int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockSizePtr, size_t BlockOffset); /** * \brief Rebuild list of free blocks in pool @@ -217,9 +205,7 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr); * * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ -int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, - size_t *BlockSizePtr, - size_t BlockOffset); +int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t *BlockSizePtr, size_t BlockOffset); /** * \brief Validate a pool structure @@ -241,18 +227,17 @@ bool CFE_ES_GenPoolValidateState(const CFE_ES_GenPoolRecord_t *PoolRecPtr); * \param[out] FreeSizeBuf Buffer to store free size * \param[out] TotalSizeBuf Buffer to store total size * - * \note This function is intended for telemetry purposes, so it - * uses the message size type (CFE_ES_MemOffset_t) rather - * than size_t, to be compatible with the type used in telemetry + * \note This function is intended for telemetry purposes, so it + * uses the message size type (CFE_ES_MemOffset_t) rather + * than size_t, to be compatible with the type used in telemetry * messages. */ -void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *FreeSizeBuf, - CFE_ES_MemOffset_t *TotalSizeBuf); +void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t *FreeSizeBuf, + CFE_ES_MemOffset_t *TotalSizeBuf); /** * \brief Query counters associated with the pool structure - * + * * Obtain pool counters for telemetry/statistics reporting. * * \param[in] PoolRecPtr Pointer to pool structure @@ -260,10 +245,8 @@ void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, * \param[out] AllocCountBuf Buffer to store allocation count * \param[out] ValidationErrorCountBuf Buffer to store validation error count */ -void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, - uint16 *NumBucketsBuf, - uint32 *AllocCountBuf, - uint32 *ValidationErrorCountBuf); +void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 *NumBucketsBuf, uint32 *AllocCountBuf, + uint32 *ValidationErrorCountBuf); /** * \brief Query bucket-specific usage of the pool structure @@ -277,7 +260,7 @@ void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, * \param[out] BlockStatsBuf Buffer to store block stats */ void CFE_ES_GenPoolGetBucketUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, - CFE_ES_BlockStats_t *BlockStatsBuf); + CFE_ES_BlockStats_t *BlockStatsBuf); /** * \brief Calculate the pool size required for the specified number of blocks @@ -296,9 +279,6 @@ void CFE_ES_GenPoolGetBucketUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 Buc * * \return Minimum size required for requested number of blocks. */ -size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, - const size_t *BlockSizeList, - uint32 NumBlocks); - -#endif /* _cfe_es_generic_pool_ */ +size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, const size_t *BlockSizeList, uint32 NumBlocks); +#endif /* _cfe_es_generic_pool_ */ diff --git a/modules/es/fsw/src/cfe_es_global.h b/modules/es/fsw/src/cfe_es_global.h index 369f0eec6..bbe4ffb51 100644 --- a/modules/es/fsw/src/cfe_es_global.h +++ b/modules/es/fsw/src/cfe_es_global.h @@ -44,8 +44,7 @@ #include "cfe_es_resetdata_typedef.h" #include "cfe_es_cds.h" -#include /* for sig_atomic_t */ - +#include /* for sig_atomic_t */ /* ** Typedefs @@ -57,9 +56,9 @@ */ typedef struct { - CFE_ES_CounterId_t CounterId; /**< The actual counter ID of this entry, or undefined */ - uint32 Counter; - char CounterName[OS_MAX_API_NAME]; /* Counter Name */ + CFE_ES_CounterId_t CounterId; /**< The actual counter ID of this entry, or undefined */ + uint32 Counter; + char CounterName[OS_MAX_API_NAME]; /* Counter Name */ } CFE_ES_GenCounterRecord_t; /* @@ -67,12 +66,11 @@ typedef struct */ typedef struct { - CFE_ES_TaskId_t TaskID; /**< ES ID of the background task */ - osal_id_t WorkSem; /**< Semaphore that is given whenever background work is pending */ - uint32 NumJobsRunning; /**< Current Number of active jobs (updated by background task) */ + CFE_ES_TaskId_t TaskID; /**< ES ID of the background task */ + osal_id_t WorkSem; /**< Semaphore that is given whenever background work is pending */ + uint32 NumJobsRunning; /**< Current Number of active jobs (updated by background task) */ } CFE_ES_BackgroundTaskState_t; - /* ** Executive Services Global Memory Data ** This is the regular global data that is not preserved on a @@ -80,70 +78,70 @@ typedef struct */ typedef struct { - /* - ** Debug Variables - */ - CFE_ES_DebugVariables_t DebugVars; - - /* - ** Shared Data Semaphore - */ - osal_id_t SharedDataMutex; - - /* - ** Performance Data Mutex - */ - osal_id_t PerfDataMutex; - - /* - ** Startup Sync - */ - volatile sig_atomic_t SystemState; - - /* - ** ES Task Table - */ - uint32 RegisteredTasks; - CFE_ES_TaskRecord_t TaskTable[OS_MAX_TASKS]; - - /* - ** ES App Table - */ - uint32 RegisteredCoreApps; - uint32 RegisteredExternalApps; - CFE_ResourceId_t LastAppId; - CFE_ES_AppRecord_t AppTable[CFE_PLATFORM_ES_MAX_APPLICATIONS]; - - /* - ** ES Shared Library Table - */ - uint32 RegisteredLibs; - CFE_ResourceId_t LastLibId; - CFE_ES_LibRecord_t LibTable[CFE_PLATFORM_ES_MAX_LIBRARIES]; - - /* - ** ES Generic Counters Table - */ - CFE_ResourceId_t LastCounterId; - CFE_ES_GenCounterRecord_t CounterTable[CFE_PLATFORM_ES_MAX_GEN_COUNTERS]; - - /* - ** Critical Data Store Management Variables - */ - CFE_ES_CDS_Instance_t CDSVars; - bool CDSIsAvailable; /**< \brief Whether or not the CDS service is active/valid */ - - /* - * Background task for handling long-running, non real time tasks - * such as maintenance, file writes, and other items. + /* + ** Debug Variables + */ + CFE_ES_DebugVariables_t DebugVars; + + /* + ** Shared Data Semaphore + */ + osal_id_t SharedDataMutex; + + /* + ** Performance Data Mutex */ - CFE_ES_BackgroundTaskState_t BackgroundTask; + osal_id_t PerfDataMutex; - /* - ** Memory Pools - */ - CFE_ResourceId_t LastMemPoolId; - CFE_ES_MemPoolRecord_t MemPoolTable[CFE_PLATFORM_ES_MAX_MEMORY_POOLS]; + /* + ** Startup Sync + */ + volatile sig_atomic_t SystemState; + + /* + ** ES Task Table + */ + uint32 RegisteredTasks; + CFE_ES_TaskRecord_t TaskTable[OS_MAX_TASKS]; + + /* + ** ES App Table + */ + uint32 RegisteredCoreApps; + uint32 RegisteredExternalApps; + CFE_ResourceId_t LastAppId; + CFE_ES_AppRecord_t AppTable[CFE_PLATFORM_ES_MAX_APPLICATIONS]; + + /* + ** ES Shared Library Table + */ + uint32 RegisteredLibs; + CFE_ResourceId_t LastLibId; + CFE_ES_LibRecord_t LibTable[CFE_PLATFORM_ES_MAX_LIBRARIES]; + + /* + ** ES Generic Counters Table + */ + CFE_ResourceId_t LastCounterId; + CFE_ES_GenCounterRecord_t CounterTable[CFE_PLATFORM_ES_MAX_GEN_COUNTERS]; + + /* + ** Critical Data Store Management Variables + */ + CFE_ES_CDS_Instance_t CDSVars; + bool CDSIsAvailable; /**< \brief Whether or not the CDS service is active/valid */ + + /* + * Background task for handling long-running, non real time tasks + * such as maintenance, file writes, and other items. + */ + CFE_ES_BackgroundTaskState_t BackgroundTask; + + /* + ** Memory Pools + */ + CFE_ResourceId_t LastMemPoolId; + CFE_ES_MemPoolRecord_t MemPoolTable[CFE_PLATFORM_ES_MAX_MEMORY_POOLS]; } CFE_ES_Global_t; @@ -160,8 +158,7 @@ extern CFE_ES_ResetData_t *CFE_ES_ResetDataPtr; /* ** Functions used to lock/unlock shared data */ -extern void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber); -extern void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber); - +extern void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber); +extern void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber); #endif diff --git a/modules/es/fsw/src/cfe_es_log.h b/modules/es/fsw/src/cfe_es_log.h index 4c168274e..6e4c51524 100644 --- a/modules/es/fsw/src/cfe_es_log.h +++ b/modules/es/fsw/src/cfe_es_log.h @@ -19,11 +19,11 @@ */ /* -** File: +** File: ** cfe_es_log.h ** -** Purpose: -** This file contains definitions needed for the cFE ES Logs. The +** Purpose: +** This file contains definitions needed for the cFE ES Logs. The ** logs include the Mode Transition log, the System Log, and the ** Performance log. ** @@ -45,7 +45,7 @@ #include "cfe_es_api_typedefs.h" #include "cfe_time_api_typedefs.h" -#include /* required for "va_list" */ +#include /* required for "va_list" */ /* ** Macro Definitions @@ -63,8 +63,7 @@ * * note that a null terminator byte is accounted for in "CFE_TIME_PRINTED_STRING_SIZE" */ -#define CFE_ES_MAX_SYSLOG_MSG_SIZE (CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + CFE_TIME_PRINTED_STRING_SIZE + 2) - +#define CFE_ES_MAX_SYSLOG_MSG_SIZE (CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + CFE_TIME_PRINTED_STRING_SIZE + 2) /** * Size of the syslog "dump buffer" @@ -85,8 +84,7 @@ * therefore NOT blocked. Design preference is given to applications over the absolute * integrity of the dump file. */ -#define CFE_ES_SYSLOG_READ_BUFFER_SIZE (3 * CFE_ES_MAX_SYSLOG_MSG_SIZE) - +#define CFE_ES_SYSLOG_READ_BUFFER_SIZE (3 * CFE_ES_MAX_SYSLOG_MSG_SIZE) /** * \brief Self-synchronized macro to call CFE_ES_SysLogAppend_Unsync @@ -100,14 +98,13 @@ * * \sa CFE_ES_SysLogAppend_Unsync() */ -#define CFE_ES_SYSLOG_APPEND(LogString) \ - { \ - CFE_ES_LockSharedData(__func__, __LINE__); \ - CFE_ES_SysLogAppend_Unsync(LogString); \ - CFE_ES_UnlockSharedData(__func__, __LINE__); \ - OS_printf("%s", LogString); \ - } - +#define CFE_ES_SYSLOG_APPEND(LogString) \ + { \ + CFE_ES_LockSharedData(__func__, __LINE__); \ + CFE_ES_SysLogAppend_Unsync(LogString); \ + CFE_ES_UnlockSharedData(__func__, __LINE__); \ + OS_printf("%s", LogString); \ + } /** * \brief Indicates no context information Error Logs @@ -115,7 +112,7 @@ * For use with the CFE_ES_WriteToERLog() function when no context * information is available. */ -#define CFE_ES_ERLOG_NO_CONTEXT (0) +#define CFE_ES_ERLOG_NO_CONTEXT (0) /* ** Type Definitions @@ -132,16 +129,14 @@ */ typedef struct { - size_t SizeLeft; /**< Total amount of unread syslog data */ - size_t BlockSize; /**< Size of content currently in the "Data" member */ - size_t EndIdx; /**< End of the syslog buffer at the time reading started */ - size_t LastOffset; /**< Current Read Position */ + size_t SizeLeft; /**< Total amount of unread syslog data */ + size_t BlockSize; /**< Size of content currently in the "Data" member */ + size_t EndIdx; /**< End of the syslog buffer at the time reading started */ + size_t LastOffset; /**< Current Read Position */ - char Data[CFE_ES_SYSLOG_READ_BUFFER_SIZE]; /**< Actual syslog content */ + char Data[CFE_ES_SYSLOG_READ_BUFFER_SIZE]; /**< Actual syslog content */ } CFE_ES_SysLogReadBuffer_t; - - /* ** Function prototypes */ @@ -152,7 +147,6 @@ typedef struct ** NOTE: CFE_ES_WriteToSysLog() is a public routine in cfe_es.h, it is not prototyped here */ - /** * \brief Clear system log * @@ -183,7 +177,6 @@ void CFE_ES_SysLogClear_Unsync(void); */ void CFE_ES_SysLogReadStart_Unsync(CFE_ES_SysLogReadBuffer_t *Buffer); - /** * \brief Write a printf-style formatted string to the system log * @@ -196,7 +189,6 @@ void CFE_ES_SysLogReadStart_Unsync(CFE_ES_SysLogReadBuffer_t *Buffer); */ int32 CFE_ES_SysLogWrite_Unsync(const char *SpecStringPtr, ...); - /** * \brief Append a complete pre-formatted string to the ES SysLog * @@ -299,7 +291,7 @@ void CFE_ES_SysLog_vsnprintf(char *Buffer, size_t BufferSize, const char *SpecSt * * \sa CFE_ES_SysLogAppend_Unsync() */ -void CFE_ES_SysLog_snprintf(char *Buffer, size_t BufferSize, const char *SpecStringPtr, ...) OS_PRINTF(3,4); +void CFE_ES_SysLog_snprintf(char *Buffer, size_t BufferSize, const char *SpecStringPtr, ...) OS_PRINTF(3, 4); /** * \brief Write the contents of the syslog to a disk file @@ -332,14 +324,14 @@ int32 CFE_ES_SysLogDump(const char *Filename); ** Processor Performance log management */ int32 CFE_ES_PerfLogClear(void); -void CFE_ES_PerfLogDump(void); +void CFE_ES_PerfLogDump(void); /* ** Exception and Reset Log API */ /** - * \brief Create an entry in the ES Exception and Reset Log. + * \brief Create an entry in the ES Exception and Reset Log. * * The exception and reset log is used to track significant system-level events and anomalies * for later analysis. @@ -351,9 +343,8 @@ void CFE_ES_PerfLogDump(void); * * \return CFE_SUCCESS if successful, or an appropriate error code from cfe_error.h */ -int32 CFE_ES_WriteToERLog( CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, - const char *Description); - +int32 CFE_ES_WriteToERLog(CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, + const char *Description); /** * \copydoc CFE_ES_WriteToERLog() @@ -365,7 +356,7 @@ int32 CFE_ES_WriteToERLog( CFE_ES_LogEntryType_Enum_t EntryType, uint32 Reset * \param AppId The Application ID associated with the task that caused the exception * \param PspContextId Identifier of extended context info stored in the PSP (if available) */ -int32 CFE_ES_WriteToERLogWithContext( CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, - const char *Description, CFE_ES_AppId_t AppId, uint32 PspContextId); +int32 CFE_ES_WriteToERLogWithContext(CFE_ES_LogEntryType_Enum_t EntryType, uint32 ResetType, uint32 ResetSubtype, + const char *Description, CFE_ES_AppId_t AppId, uint32 PspContextId); -#endif /* _cfe_es_log_ */ +#endif /* _cfe_es_log_ */ diff --git a/modules/es/fsw/src/cfe_es_mempool.c b/modules/es/fsw/src/cfe_es_mempool.c index ec9901ffc..7a084f695 100644 --- a/modules/es/fsw/src/cfe_es_mempool.c +++ b/modules/es/fsw/src/cfe_es_mempool.c @@ -48,71 +48,57 @@ * minimum alignment requirement. (C99 is lacking a standardized "alignof" operator, * and this is intended to substitute). */ -#define ALIGN_OF(type) ((cpuaddr)&((struct { char Byte; type Align; } *)0)->Align) - +#define ALIGN_OF(type) \ + ((cpuaddr) & ((struct { \ + char Byte; \ + type Align; \ + } *)0) \ + ->Align) /*****************************************************************************/ /* ** Type Definitions */ -const size_t CFE_ES_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = -{ - CFE_PLATFORM_ES_MAX_BLOCK_SIZE, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02, - CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 -}; +const size_t CFE_ES_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { + CFE_PLATFORM_ES_MAX_BLOCK_SIZE, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15, + CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12, + CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09, + CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06, + CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03, + CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01}; /*****************************************************************************/ /* ** Functions */ -int32 CFE_ES_MemPoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - CFE_ES_GenPoolBD_t **BdPtr) +int32 CFE_ES_MemPoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { - cpuaddr DataAddress; + cpuaddr DataAddress; CFE_ES_MemPoolRecord_t *MemPoolRecPtr = (CFE_ES_MemPoolRecord_t *)PoolRecPtr; DataAddress = MemPoolRecPtr->BaseAddr + Offset; - *BdPtr = (CFE_ES_GenPoolBD_t *)DataAddress; + *BdPtr = (CFE_ES_GenPoolBD_t *)DataAddress; return CFE_SUCCESS; } -int32 CFE_ES_MemPoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - const CFE_ES_GenPoolBD_t *BdPtr) +int32 CFE_ES_MemPoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { return CFE_SUCCESS; } - int32 CFE_ES_MemPoolID_ToIndex(CFE_ES_MemHandle_t PoolID, uint32 *Idx) { - return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(PoolID), - CFE_ES_POOLID_BASE, - CFE_PLATFORM_ES_MAX_MEMORY_POOLS, - Idx); + return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(PoolID), CFE_ES_POOLID_BASE, CFE_PLATFORM_ES_MAX_MEMORY_POOLS, + Idx); } /*--------------------------------------------------------------------------------------- * Function: CFE_ES_CheckMemPoolSlotUsed - * - * Purpose: Helper function, Aids in allocating a new ID by checking if + * + * Purpose: Helper function, Aids in allocating a new ID by checking if * a given table slot is available. Must be called while locked. *--------------------------------------------------------------------------------------- */ @@ -121,10 +107,10 @@ bool CFE_ES_CheckMemPoolSlotUsed(CFE_ResourceId_t CheckId) return CFE_ES_MemPoolRecordIsUsed(CFE_ES_LocateMemPoolRecordByID(CFE_ES_MEMHANDLE_C(CheckId))); } -CFE_ES_MemPoolRecord_t* CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID) +CFE_ES_MemPoolRecord_t *CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID) { CFE_ES_MemPoolRecord_t *MemPoolRecPtr; - uint32 Idx; + uint32 Idx; if (CFE_ES_MemPoolID_ToIndex(PoolID, &Idx) == CFE_SUCCESS) { @@ -141,39 +127,30 @@ CFE_ES_MemPoolRecord_t* CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID /* ** CFE_ES_PoolCreateNoSem will initialize a pre-allocated memory pool without using a mutex. */ -int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, - uint8 *MemPtr, - size_t Size ) +int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size) { - return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - &CFE_ES_MemPoolDefSize[0],CFE_ES_NO_MUTEX); + return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0], + CFE_ES_NO_MUTEX); } /* ** CFE_ES_PoolCreate will initialize a pre-allocated memory pool while using a mutex. */ -int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, - uint8 *MemPtr, - size_t Size ) +int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size) { - return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - &CFE_ES_MemPoolDefSize[0],CFE_ES_USE_MUTEX); + return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0], + CFE_ES_USE_MUTEX); } - -int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, - uint8 *MemPtr, - size_t Size, - uint16 NumBlockSizes, - const size_t *BlockSizes, - bool UseMutex ) +int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes, + const size_t *BlockSizes, bool UseMutex) { - int32 Status; - CFE_ResourceId_t PendingID; + int32 Status; + CFE_ResourceId_t PendingID; CFE_ES_MemPoolRecord_t *PoolRecPtr; - size_t Alignment; - size_t MinimumSize; - char MutexName[OS_MAX_API_NAME]; + size_t Alignment; + size_t MinimumSize; + char MutexName[OS_MAX_API_NAME]; /* Sanity Check inputs */ if (MemPtr == NULL || PoolID == NULL) @@ -184,9 +161,9 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, /* If too many sizes are specified, return an error */ if (NumBlockSizes > CFE_PLATFORM_ES_POOL_MAX_BUCKETS) { - CFE_ES_WriteToSysLog("CFE_ES:poolCreate Num Block Sizes (%d) greater than max (%d)\n", - (int)NumBlockSizes, CFE_PLATFORM_ES_POOL_MAX_BUCKETS); - return(CFE_ES_BAD_ARGUMENT); + CFE_ES_WriteToSysLog("CFE_ES:poolCreate Num Block Sizes (%d) greater than max (%d)\n", (int)NumBlockSizes, + CFE_PLATFORM_ES_POOL_MAX_BUCKETS); + return (CFE_ES_BAD_ARGUMENT); } /* @@ -204,21 +181,19 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, /* * Sanity check the pool size */ - MinimumSize = CFE_ES_GenPoolCalcMinSize(NumBlockSizes, BlockSizes, 1); - if ( Size < MinimumSize ) + MinimumSize = CFE_ES_GenPoolCalcMinSize(NumBlockSizes, BlockSizes, 1); + if (Size < MinimumSize) { - CFE_ES_WriteToSysLog("CFE_ES:poolCreate Pool size(%lu) too small, need >=%lu bytes\n", - (unsigned long)Size, - (unsigned long)MinimumSize); + CFE_ES_WriteToSysLog("CFE_ES:poolCreate Pool size(%lu) too small, need >=%lu bytes\n", (unsigned long)Size, + (unsigned long)MinimumSize); return CFE_ES_BAD_ARGUMENT; } - - - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); /* scan for a free slot */ - PendingID = CFE_ResourceId_FindNext(CFE_ES_Global.LastMemPoolId, CFE_PLATFORM_ES_MAX_MEMORY_POOLS, CFE_ES_CheckMemPoolSlotUsed); + PendingID = CFE_ResourceId_FindNext(CFE_ES_Global.LastMemPoolId, CFE_PLATFORM_ES_MAX_MEMORY_POOLS, + CFE_ES_CheckMemPoolSlotUsed); PoolRecPtr = CFE_ES_LocateMemPoolRecordByID(CFE_ES_MEMHANDLE_C(PendingID)); if (PoolRecPtr == NULL) @@ -232,10 +207,10 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, memset(PoolRecPtr, 0, sizeof(*PoolRecPtr)); CFE_ES_MemPoolRecordSetUsed(PoolRecPtr, CFE_RESOURCEID_RESERVED); CFE_ES_Global.LastMemPoolId = PendingID; - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); /* * If no open resource ID was found, return now. @@ -249,7 +224,7 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, return Status; } - Alignment = ALIGN_OF(CFE_ES_PoolAlign_t); /* memory mapped pools should be aligned */ + Alignment = ALIGN_OF(CFE_ES_PoolAlign_t); /* memory mapped pools should be aligned */ if (Alignment < CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN) { /* @@ -264,38 +239,30 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, * Most of the work is done by the generic pool implementation. * This subsystem works in offsets, not pointers. */ - Status = CFE_ES_GenPoolInitialize( - &PoolRecPtr->Pool, - 0, - Size, - Alignment, - NumBlockSizes, - BlockSizes, - CFE_ES_MemPoolDirectRetrieve, - CFE_ES_MemPoolDirectCommit); + Status = CFE_ES_GenPoolInitialize(&PoolRecPtr->Pool, 0, Size, Alignment, NumBlockSizes, BlockSizes, + CFE_ES_MemPoolDirectRetrieve, CFE_ES_MemPoolDirectCommit); /* * If successful, complete the process. */ if (Status == CFE_SUCCESS && UseMutex == CFE_ES_USE_MUTEX) { - /* - ** Construct a name for the Mutex from the address - ** This is needed only because OS_MutSemCreate requires - ** a unique name for each semaphore created. - */ - snprintf(MutexName, OS_MAX_API_NAME, "Pool%08lX", CFE_ResourceId_ToInteger(PendingID)); - - /* create a mutex to protect this memory pool */ - Status = OS_MutSemCreate(&PoolRecPtr->MutexId, MutexName, 0); - if (Status != OS_SUCCESS) - { - /* log error and rewrite to CFE status code */ - CFE_ES_WriteToSysLog("CFE_ES:poolCreate OSAL error %d while creating mutex\n", - (int)Status); + /* + ** Construct a name for the Mutex from the address + ** This is needed only because OS_MutSemCreate requires + ** a unique name for each semaphore created. + */ + snprintf(MutexName, OS_MAX_API_NAME, "Pool%08lX", CFE_ResourceId_ToInteger(PendingID)); + + /* create a mutex to protect this memory pool */ + Status = OS_MutSemCreate(&PoolRecPtr->MutexId, MutexName, 0); + if (Status != OS_SUCCESS) + { + /* log error and rewrite to CFE status code */ + CFE_ES_WriteToSysLog("CFE_ES:poolCreate OSAL error %d while creating mutex\n", (int)Status); - Status = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; - } + Status = CFE_STATUS_EXTERNAL_RESOURCE_FAIL; + } } if (Status == CFE_SUCCESS) @@ -329,8 +296,7 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, if (Status == CFE_ES_POOL_BOUNDS_ERROR) { - CFE_ES_WriteToSysLog("CFE_ES:poolCreate Pool size(%lu) too small\n", - (unsigned long)Size); + CFE_ES_WriteToSysLog("CFE_ES:poolCreate Pool size(%lu) too small\n", (unsigned long)Size); } } @@ -339,15 +305,15 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, */ *PoolID = CFE_ES_MEMHANDLE_C(PendingID); - return(Status); + return (Status); } int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) { CFE_ES_MemPoolRecord_t *PoolRecPtr; - osal_id_t MutexId; - int32 Status; - int32 MutDeleteStatus; + osal_id_t MutexId; + int32 Status; + int32 MutDeleteStatus; PoolRecPtr = CFE_ES_LocateMemPoolRecordByID(PoolID); @@ -363,7 +329,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) else { MutexId = OS_OBJECT_ID_UNDEFINED; - Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; + Status = CFE_ES_ERR_RESOURCEID_NOT_VALID; } CFE_ES_UnlockSharedData(__func__, __LINE__); @@ -382,8 +348,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) * The MemPool entry has already been deleted, so this * function should not return an error at this point. */ - CFE_ES_WriteToSysLog("CFE_ES:poolDelete error %d deleting mutex\n", - (int)MutDeleteStatus); + CFE_ES_WriteToSysLog("CFE_ES:poolDelete error %d deleting mutex\n", (int)MutDeleteStatus); } } @@ -397,14 +362,12 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) ** Purpose: ** CFE_ES_GetPoolBuf allocates a block from the memory pool. */ -int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, - CFE_ES_MemHandle_t Handle, - size_t Size ) +int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t Handle, size_t Size) { - int32 Status; - CFE_ES_AppId_t AppId; + int32 Status; + CFE_ES_AppId_t AppId; CFE_ES_MemPoolRecord_t *PoolRecPtr; - size_t DataOffset; + size_t DataOffset; if (BufPtr == NULL) { @@ -417,10 +380,9 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, if (!CFE_ES_MemPoolRecordIsMatch(PoolRecPtr, Handle)) { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("CFE_ES:getPoolBuf err:Bad handle(0x%08lX) AppId=%lu\n", - CFE_RESOURCEID_TO_ULONG(Handle), - CFE_RESOURCEID_TO_ULONG(AppId)); - return(CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_ES_WriteToSysLog("CFE_ES:getPoolBuf err:Bad handle(0x%08lX) AppId=%lu\n", CFE_RESOURCEID_TO_ULONG(Handle), + CFE_RESOURCEID_TO_ULONG(AppId)); + return (CFE_ES_ERR_RESOURCEID_NOT_VALID); } /* @@ -455,7 +417,6 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, return (Status); } - /* Compute the actual buffer address. */ *BufPtr = CFE_ES_MEMPOOLBUF_C(PoolRecPtr->BaseAddr + DataOffset); @@ -465,13 +426,12 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, /* ** CFE_ES_GetPoolBufInfo gets the size of the specified block (if it exists). */ -int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, - CFE_ES_MemPoolBuf_t BufPtr) +int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr) { - int32 Status; + int32 Status; CFE_ES_MemPoolRecord_t *PoolRecPtr; - size_t DataOffset; - size_t DataSize; + size_t DataOffset; + size_t DataSize; if (BufPtr == NULL) { @@ -483,7 +443,7 @@ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, /* basic sanity check */ if (!CFE_ES_MemPoolRecordIsMatch(PoolRecPtr, Handle)) { - return(CFE_ES_ERR_RESOURCEID_NOT_VALID); + return (CFE_ES_ERR_RESOURCEID_NOT_VALID); } /* @@ -508,7 +468,6 @@ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, OS_MutSemGive(PoolRecPtr->MutexId); } - if (Status == CFE_SUCCESS) { /* @@ -524,13 +483,12 @@ 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, - CFE_ES_MemPoolBuf_t BufPtr) +int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr) { CFE_ES_MemPoolRecord_t *PoolRecPtr; - size_t DataSize; - size_t DataOffset; - int32 Status; + size_t DataSize; + size_t DataOffset; + int32 Status; if (BufPtr == NULL) { @@ -543,9 +501,9 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, if (!CFE_ES_MemPoolRecordIsMatch(PoolRecPtr, Handle)) { CFE_ES_WriteToSysLog("CFE_ES:putPoolBuf err:Invalid Memory Handle (0x%08lX).\n", - CFE_RESOURCEID_TO_ULONG(Handle)); + CFE_RESOURCEID_TO_ULONG(Handle)); - return(CFE_ES_ERR_RESOURCEID_NOT_VALID); + return (CFE_ES_ERR_RESOURCEID_NOT_VALID); } /* @@ -589,12 +547,12 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, else if (Status == CFE_ES_POOL_BLOCK_INVALID) { CFE_ES_WriteToSysLog("CFE_ES:putPoolBuf err:Deallocating invalid or corrupt memory block @ 0x%08lX\n", - (unsigned long)BufPtr); + (unsigned long)BufPtr); } else if (Status == CFE_ES_BUFFER_NOT_IN_POOL) { CFE_ES_WriteToSysLog("CFE_ES_GenPoolPutBlock err:Bad offset(%lu) outside pool boundary\n", - (unsigned long)DataOffset); + (unsigned long)DataOffset); } return Status; @@ -607,13 +565,12 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, ** Purpose: ** */ -int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, - CFE_ES_MemHandle_t Handle) +int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHandle_t Handle) { - CFE_ES_AppId_t AppId; + CFE_ES_AppId_t AppId; CFE_ES_MemPoolRecord_t *PoolRecPtr; - uint16 NumBuckets; - uint16 Idx; + uint16 NumBuckets; + uint16 Idx; if (BufPtr == NULL) { @@ -627,8 +584,8 @@ int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, { CFE_ES_GetAppID(&AppId); CFE_ES_WriteToSysLog("CFE_ES:getMemPoolStats err:Bad handle(0x%08lX) AppId=%lu\n", - CFE_RESOURCEID_TO_ULONG(Handle), CFE_RESOURCEID_TO_ULONG(AppId)); - return(CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_RESOURCEID_TO_ULONG(Handle), CFE_RESOURCEID_TO_ULONG(AppId)); + return (CFE_ES_ERR_RESOURCEID_NOT_VALID); } /* @@ -643,22 +600,16 @@ int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, /* * Obtain the free and total byte count */ - CFE_ES_GenPoolGetUsage(&PoolRecPtr->Pool, - &BufPtr->NumFreeBytes, - &BufPtr->PoolSize); + CFE_ES_GenPoolGetUsage(&PoolRecPtr->Pool, &BufPtr->NumFreeBytes, &BufPtr->PoolSize); /* * Obtain the allocation and validation error counts */ - CFE_ES_GenPoolGetCounts(&PoolRecPtr->Pool, - &NumBuckets, - &BufPtr->NumBlocksRequested, - &BufPtr->CheckErrCtr); + CFE_ES_GenPoolGetCounts(&PoolRecPtr->Pool, &NumBuckets, &BufPtr->NumBlocksRequested, &BufPtr->CheckErrCtr); for (Idx = 0; Idx < CFE_MISSION_ES_POOL_MAX_BUCKETS; ++Idx) { - CFE_ES_GenPoolGetBucketUsage(&PoolRecPtr->Pool, NumBuckets, - &BufPtr->BlockStats[Idx]); + CFE_ES_GenPoolGetBucketUsage(&PoolRecPtr->Pool, NumBuckets, &BufPtr->BlockStats[Idx]); if (NumBuckets > 0) { @@ -674,11 +625,10 @@ int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, { OS_MutSemGive(PoolRecPtr->MutexId); } - + return CFE_SUCCESS; } - /* ** Function: ** CFE_ES_ValidateHandle @@ -686,10 +636,10 @@ int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, ** Purpose: ** Insures that the handle passed in meets all of the requirements of a valid handle. */ -bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle) +bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle) { - CFE_ES_MemPoolRecord_t *PoolRecPtr; - CFE_ES_MemOffset_t TotalSize; + CFE_ES_MemPoolRecord_t *PoolRecPtr; + CFE_ES_MemOffset_t TotalSize; /* Test #1) Handle must be valid */ PoolRecPtr = CFE_ES_LocateMemPoolRecordByID(Handle); @@ -706,9 +656,7 @@ bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle) /* Test #3) Check memory address in PSP (allows both RAM and EEPROM) */ CFE_ES_GenPoolGetUsage(&PoolRecPtr->Pool, NULL, &TotalSize); - if (CFE_PSP_MemValidateRange(PoolRecPtr->BaseAddr, - TotalSize, - CFE_PSP_MEM_ANY) != CFE_PSP_SUCCESS) + if (CFE_PSP_MemValidateRange(PoolRecPtr->BaseAddr, TotalSize, CFE_PSP_MEM_ANY) != CFE_PSP_SUCCESS) { return false; } diff --git a/modules/es/fsw/src/cfe_es_mempool.h b/modules/es/fsw/src/cfe_es_mempool.h index c8627925d..9780a46fb 100644 --- a/modules/es/fsw/src/cfe_es_mempool.h +++ b/modules/es/fsw/src/cfe_es_mempool.h @@ -70,10 +70,9 @@ typedef struct /** * Optional Mutex for serializing get/put operations */ - osal_id_t MutexId; + osal_id_t MutexId; } CFE_ES_MemPoolRecord_t; - /** * @brief Obtain an index value correlating to an ES Memory Pool ID * @@ -107,7 +106,7 @@ int32 CFE_ES_MemPoolID_ToIndex(CFE_ES_MemHandle_t PoolID, uint32 *Idx); * @param[in] PoolID the Pool ID to locate * @return pointer to Pool Table entry for the given Pool ID */ -CFE_ES_MemPoolRecord_t* CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID); +CFE_ES_MemPoolRecord_t *CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID); /** * @brief Check if a Memory Pool record is in use or free/empty @@ -187,9 +186,9 @@ static inline bool CFE_ES_MemPoolRecordIsMatch(const CFE_ES_MemPoolRecord_t *Poo * @brief Check if a Pool ID table slot is used * * Checks if a table slot is available for a potential new ID - * This is a helper function intended to be used with + * This is a helper function intended to be used with * CFE_ResourceId_FindNext() for allocating new IDs - * + * * As this dereferences fields within the record, global data must be * locked prior to invoking this function. * @@ -198,5 +197,4 @@ static inline bool CFE_ES_MemPoolRecordIsMatch(const CFE_ES_MemPoolRecord_t *Poo */ bool CFE_ES_CheckMemPoolSlotUsed(CFE_ResourceId_t CheckId); - -#endif /* _CFE_ES_MEMPOOL_H_ */ +#endif /* _CFE_ES_MEMPOOL_H_ */ diff --git a/modules/es/fsw/src/cfe_es_module_all.h b/modules/es/fsw/src/cfe_es_module_all.h index 2faf519bb..c395518f7 100644 --- a/modules/es/fsw/src/cfe_es_module_all.h +++ b/modules/es/fsw/src/cfe_es_module_all.h @@ -20,10 +20,10 @@ /** * @file cfe_es_module_all.h - * + * * Encapsulates all ES module internal header files, as well * as the public API from all other CFE core modules, OSAL, and PSP. - * + * * This simplifies the set of include files that need to be put at the * start of every source file. */ @@ -54,5 +54,4 @@ #include "cfe_es_resource.h" #include "cfe_es_log.h" - #endif diff --git a/modules/es/fsw/src/cfe_es_objtab.c b/modules/es/fsw/src/cfe_es_objtab.c index 0b13cc6fc..2d8782e75 100644 --- a/modules/es/fsw/src/cfe_es_objtab.c +++ b/modules/es/fsw/src/cfe_es_objtab.c @@ -51,148 +51,87 @@ ** Note: The name field in this table should be no more than OS_MAX_API_NAME -1 characters. ** */ -CFE_ES_ObjectTable_t CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE] = -{ - /* - ** Spare entries -- The spares should be distributed evenly through this table - */ - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - - /* - ** cFE core early initialization calls. These must be done before the tasks start - */ - { - .ObjectType = CFE_ES_FUNCTION_CALL, - .ObjectName = "CFE_ES_CDSEarlyInit", - .FuncPtrUnion.FunctionPtr = CFE_ES_CDS_EarlyInit - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_FUNCTION_CALL, - .ObjectName = "CFE_EVS_EarlyInit", - .FuncPtrUnion.FunctionPtr = CFE_EVS_EarlyInit - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_FUNCTION_CALL, - .ObjectName = "CFE_SB_EarlyInit", - .FuncPtrUnion.FunctionPtr = CFE_SB_EarlyInit - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_FUNCTION_CALL, - .ObjectName = "CFE_TIME_EarlyInit", - .FuncPtrUnion.FunctionPtr = CFE_TIME_EarlyInit - }, - { - .ObjectType = CFE_ES_NULL_ENTRY }, - { - .ObjectType = CFE_ES_FUNCTION_CALL, - .ObjectName = "CFE_TBL_EarlyInit", - .FuncPtrUnion.FunctionPtr = CFE_TBL_EarlyInit - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_FUNCTION_CALL, - .ObjectName = "CFE_FS_EarlyInit", - .FuncPtrUnion.FunctionPtr = CFE_FS_EarlyInit - }, +CFE_ES_ObjectTable_t CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE] = { + /* + ** Spare entries -- The spares should be distributed evenly through this table + */ + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + /* + ** cFE core early initialization calls. These must be done before the tasks start + */ + {.ObjectType = CFE_ES_FUNCTION_CALL, + .ObjectName = "CFE_ES_CDSEarlyInit", + .FuncPtrUnion.FunctionPtr = CFE_ES_CDS_EarlyInit}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_FUNCTION_CALL, + .ObjectName = "CFE_EVS_EarlyInit", + .FuncPtrUnion.FunctionPtr = CFE_EVS_EarlyInit}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_FUNCTION_CALL, + .ObjectName = "CFE_SB_EarlyInit", + .FuncPtrUnion.FunctionPtr = CFE_SB_EarlyInit}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_FUNCTION_CALL, + .ObjectName = "CFE_TIME_EarlyInit", + .FuncPtrUnion.FunctionPtr = CFE_TIME_EarlyInit}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_FUNCTION_CALL, + .ObjectName = "CFE_TBL_EarlyInit", + .FuncPtrUnion.FunctionPtr = CFE_TBL_EarlyInit}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_FUNCTION_CALL, + .ObjectName = "CFE_FS_EarlyInit", + .FuncPtrUnion.FunctionPtr = CFE_FS_EarlyInit}, - /* - ** Spare entries - */ - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, + /* + ** Spare entries + */ + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_NULL_ENTRY}, - /* - ** cFE core tasks - */ - { - .ObjectType = CFE_ES_CORE_TASK, - .ObjectName = "CFE_EVS", - .FuncPtrUnion.MainTaskPtr = CFE_EVS_TaskMain, - .ObjectPriority = CFE_PLATFORM_EVS_START_TASK_PRIORITY, - .ObjectSize = CFE_PLATFORM_EVS_START_TASK_STACK_SIZE - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_CORE_TASK, - .ObjectName = "CFE_SB", - .FuncPtrUnion.MainTaskPtr = CFE_SB_TaskMain, - .ObjectPriority = CFE_PLATFORM_SB_START_TASK_PRIORITY, - .ObjectSize = CFE_PLATFORM_SB_START_TASK_STACK_SIZE - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_CORE_TASK, - .ObjectName = "CFE_ES", - .FuncPtrUnion.MainTaskPtr = CFE_ES_TaskMain, - .ObjectPriority = CFE_PLATFORM_ES_START_TASK_PRIORITY, - .ObjectSize = CFE_PLATFORM_ES_START_TASK_STACK_SIZE - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_CORE_TASK, - .ObjectName = "CFE_TIME", - .FuncPtrUnion.MainTaskPtr = CFE_TIME_TaskMain, - .ObjectPriority = CFE_PLATFORM_TIME_START_TASK_PRIORITY, - .ObjectSize = CFE_PLATFORM_TIME_START_TASK_STACK_SIZE - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_CORE_TASK, - .ObjectName = "CFE_TBL", - .FuncPtrUnion.MainTaskPtr = CFE_TBL_TaskMain, - .ObjectPriority = CFE_PLATFORM_TBL_START_TASK_PRIORITY, - .ObjectSize = CFE_PLATFORM_TBL_START_TASK_STACK_SIZE - }, + /* + ** cFE core tasks + */ + {.ObjectType = CFE_ES_CORE_TASK, + .ObjectName = "CFE_EVS", + .FuncPtrUnion.MainTaskPtr = CFE_EVS_TaskMain, + .ObjectPriority = CFE_PLATFORM_EVS_START_TASK_PRIORITY, + .ObjectSize = CFE_PLATFORM_EVS_START_TASK_STACK_SIZE}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_CORE_TASK, + .ObjectName = "CFE_SB", + .FuncPtrUnion.MainTaskPtr = CFE_SB_TaskMain, + .ObjectPriority = CFE_PLATFORM_SB_START_TASK_PRIORITY, + .ObjectSize = CFE_PLATFORM_SB_START_TASK_STACK_SIZE}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_CORE_TASK, + .ObjectName = "CFE_ES", + .FuncPtrUnion.MainTaskPtr = CFE_ES_TaskMain, + .ObjectPriority = CFE_PLATFORM_ES_START_TASK_PRIORITY, + .ObjectSize = CFE_PLATFORM_ES_START_TASK_STACK_SIZE}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_CORE_TASK, + .ObjectName = "CFE_TIME", + .FuncPtrUnion.MainTaskPtr = CFE_TIME_TaskMain, + .ObjectPriority = CFE_PLATFORM_TIME_START_TASK_PRIORITY, + .ObjectSize = CFE_PLATFORM_TIME_START_TASK_STACK_SIZE}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_CORE_TASK, + .ObjectName = "CFE_TBL", + .FuncPtrUnion.MainTaskPtr = CFE_TBL_TaskMain, + .ObjectPriority = CFE_PLATFORM_TBL_START_TASK_PRIORITY, + .ObjectSize = CFE_PLATFORM_TBL_START_TASK_STACK_SIZE}, - /* - ** Spare entries - */ - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - }, - { - .ObjectType = CFE_ES_NULL_ENTRY - } + /* + ** Spare entries + */ + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_NULL_ENTRY}, + {.ObjectType = CFE_ES_NULL_ENTRY} }; diff --git a/modules/es/fsw/src/cfe_es_perf.c b/modules/es/fsw/src/cfe_es_perf.c index 0e0691630..76935fa56 100644 --- a/modules/es/fsw/src/cfe_es_perf.c +++ b/modules/es/fsw/src/cfe_es_perf.c @@ -33,12 +33,10 @@ #include - /* ** Pointer to performance log in the reset area */ -CFE_ES_PerfData_t *Perf; - +CFE_ES_PerfData_t *Perf; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Name: CFE_ES_SetupPerfVariables */ @@ -60,48 +58,46 @@ void CFE_ES_SetupPerfVariables(uint32 ResetType) { uint16 Word; uint8 Endian; - } EndianCheck = { .Word = 0x0100 }; - + } EndianCheck = {.Word = 0x0100}; - uint32 i; + uint32 i; /* ** Set the pointer to the data area */ Perf = (CFE_ES_PerfData_t *)&(CFE_ES_ResetDataPtr->Perf); - if ( ResetType == CFE_PSP_RST_TYPE_PROCESSOR ) + if (ResetType == CFE_PSP_RST_TYPE_PROCESSOR) { - /* - ** On a processor reset, just IDLE the data - ** collection so the ground can dump the data - */ - Perf->MetaData.State = CFE_ES_PERF_IDLE; + /* + ** On a processor reset, just IDLE the data + ** collection so the ground can dump the data + */ + Perf->MetaData.State = CFE_ES_PERF_IDLE; } else { - Perf->MetaData.Version = 1; - Perf->MetaData.Endian = EndianCheck.Endian; - Perf->MetaData.TimerTicksPerSecond = CFE_PSP_GetTimerTicksPerSecond(); - Perf->MetaData.TimerLow32Rollover = CFE_PSP_GetTimerLow32Rollover(); - - /* set data collection state to waiting for command state */ - Perf->MetaData.State = CFE_ES_PERF_IDLE; - Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; - Perf->MetaData.TriggerCount = 0; - Perf->MetaData.DataStart = 0; - Perf->MetaData.DataEnd = 0; - Perf->MetaData.DataCount = 0; - Perf->MetaData.InvalidMarkerReported = false; - Perf->MetaData.FilterTriggerMaskSize = CFE_ES_PERF_32BIT_WORDS_IN_MASK; - - for (i=0; i < CFE_ES_PERF_32BIT_WORDS_IN_MASK; i++) - { - Perf->MetaData.FilterMask[i] = CFE_PLATFORM_ES_PERF_FILTMASK_INIT; - Perf->MetaData.TriggerMask[i] = CFE_PLATFORM_ES_PERF_TRIGMASK_INIT; - } - + Perf->MetaData.Version = 1; + Perf->MetaData.Endian = EndianCheck.Endian; + Perf->MetaData.TimerTicksPerSecond = CFE_PSP_GetTimerTicksPerSecond(); + Perf->MetaData.TimerLow32Rollover = CFE_PSP_GetTimerLow32Rollover(); + + /* set data collection state to waiting for command state */ + Perf->MetaData.State = CFE_ES_PERF_IDLE; + Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; + Perf->MetaData.TriggerCount = 0; + Perf->MetaData.DataStart = 0; + Perf->MetaData.DataEnd = 0; + Perf->MetaData.DataCount = 0; + Perf->MetaData.InvalidMarkerReported = false; + Perf->MetaData.FilterTriggerMaskSize = CFE_ES_PERF_32BIT_WORDS_IN_MASK; + + for (i = 0; i < CFE_ES_PERF_32BIT_WORDS_IN_MASK; i++) + { + Perf->MetaData.FilterMask[i] = CFE_PLATFORM_ES_PERF_FILTMASK_INIT; + Perf->MetaData.TriggerMask[i] = CFE_PLATFORM_ES_PERF_TRIGMASK_INIT; + } } } @@ -115,15 +111,14 @@ void CFE_ES_SetupPerfVariables(uint32 ResetType) uint32 CFE_ES_GetPerfLogDumpRemaining(void) { CFE_ES_PerfDumpGlobal_t *PerfDumpState = &CFE_ES_TaskData.BackgroundPerfDumpState; - CFE_ES_PerfDumpState_t CurrentState = PerfDumpState->CurrentState; - uint32 Result; + CFE_ES_PerfDumpState_t CurrentState = PerfDumpState->CurrentState; + uint32 Result; - /* note this reads the data "live" without exclusion and as such it + /* note this reads the data "live" without exclusion and as such it * may change even between checking the state and checking the value. * This shouldn't be a big deal, as the result should still be meaningful * for a progress report, and the actual 32-bit counters should be atomic */ - if (CurrentState > CFE_ES_PerfDumpState_IDLE && - CurrentState < CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES) + if (CurrentState > CFE_ES_PerfDumpState_IDLE && CurrentState < CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES) { /* dump is requested but not yet to entry writing state, * report the entire data count from perf log */ @@ -151,12 +146,12 @@ uint32 CFE_ES_GetPerfLogDumpRemaining(void) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 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; + const CFE_ES_StartPerfCmd_Payload_t *CmdPtr = &data->Payload; + CFE_ES_PerfDumpGlobal_t * PerfDumpState = &CFE_ES_TaskData.BackgroundPerfDumpState; /* Ensure there is no file write in progress before proceeding */ - if(PerfDumpState->CurrentState == CFE_ES_PerfDumpState_IDLE && - PerfDumpState->PendingState == CFE_ES_PerfDumpState_IDLE) + if (PerfDumpState->CurrentState == CFE_ES_PerfDumpState_IDLE && + PerfDumpState->PendingState == CFE_ES_PerfDumpState_IDLE) { /* Make sure Trigger Mode is valid */ /* cppcheck-suppress unsignedPositive */ @@ -168,38 +163,37 @@ int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_t *data) /* Taking lock here as this might be changing states from one active mode to another. * In that case, need to make sure that the log is not written to while resetting the counters. */ OS_MutSemTake(CFE_ES_Global.PerfDataMutex); - Perf->MetaData.Mode = CmdPtr->TriggerMode; - Perf->MetaData.TriggerCount = 0; - Perf->MetaData.DataStart = 0; - Perf->MetaData.DataEnd = 0; - Perf->MetaData.DataCount = 0; + Perf->MetaData.Mode = CmdPtr->TriggerMode; + Perf->MetaData.TriggerCount = 0; + Perf->MetaData.DataStart = 0; + Perf->MetaData.DataEnd = 0; + Perf->MetaData.DataCount = 0; Perf->MetaData.InvalidMarkerReported = false; - Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; /* this must be done last */ + Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; /* this must be done last */ OS_MutSemGive(CFE_ES_Global.PerfDataMutex); CFE_EVS_SendEvent(CFE_ES_PERF_STARTCMD_EID, CFE_EVS_EventType_DEBUG, - "Start collecting performance data cmd received, trigger mode = %d", - (int)CmdPtr->TriggerMode); + "Start collecting performance data cmd received, trigger mode = %d", + (int)CmdPtr->TriggerMode); } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID, CFE_EVS_EventType_ERROR, - "Cannot start collecting performance data, trigger mode (%d) out of range (%d to %d)", - (int)CmdPtr->TriggerMode, (int)CFE_ES_PERF_TRIGGER_START, (int)CFE_ES_PERF_TRIGGER_END); - }/* end if */ + "Cannot start collecting performance data, trigger mode (%d) out of range (%d to %d)", + (int)CmdPtr->TriggerMode, (int)CFE_ES_PERF_TRIGGER_START, (int)CFE_ES_PERF_TRIGGER_END); + } /* end if */ } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_PERF_STARTCMD_ERR_EID, CFE_EVS_EventType_ERROR, - "Cannot start collecting performance data,perf data write in progress"); + "Cannot start collecting performance data,perf data write in progress"); } /* end if */ return CFE_SUCCESS; } /* End of CFE_ES_StartPerfDataCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_StopPerfDataCmd() -- */ @@ -207,46 +201,44 @@ int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_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; + const CFE_ES_StopPerfCmd_Payload_t *CmdPtr = &data->Payload; + CFE_ES_PerfDumpGlobal_t * PerfDumpState = &CFE_ES_TaskData.BackgroundPerfDumpState; /* Ensure there is no file write in progress before proceeding */ /* note - also need to check the PendingState here, in case this command * was sent twice in succession and the background task has not awakened yet */ - if(PerfDumpState->CurrentState == CFE_ES_PerfDumpState_IDLE && - PerfDumpState->PendingState == CFE_ES_PerfDumpState_IDLE) + if (PerfDumpState->CurrentState == CFE_ES_PerfDumpState_IDLE && + PerfDumpState->PendingState == CFE_ES_PerfDumpState_IDLE) { Perf->MetaData.State = CFE_ES_PERF_IDLE; /* Copy out the string, using default if unspecified */ CFE_SB_MessageStringGet(PerfDumpState->DataFileName, CmdPtr->DataFileName, - CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME, - sizeof(PerfDumpState->DataFileName), sizeof(CmdPtr->DataFileName)); + CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME, sizeof(PerfDumpState->DataFileName), + sizeof(CmdPtr->DataFileName)); PerfDumpState->PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_BackgroundWakeup(); CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_PERF_STOPCMD_EID,CFE_EVS_EventType_DEBUG, - "Perf Stop Cmd Rcvd, will write %d entries.%dmS dly every %d entries", - (int)Perf->MetaData.DataCount, - (int)CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY, - (int)CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS); + CFE_EVS_SendEvent(CFE_ES_PERF_STOPCMD_EID, CFE_EVS_EventType_DEBUG, + "Perf Stop Cmd Rcvd, will write %d entries.%dmS dly every %d entries", + (int)Perf->MetaData.DataCount, (int)CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY, + (int)CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS); - }/* if data to write == 0 */ + } /* if data to write == 0 */ else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_PERF_STOPCMD_ERR2_EID, CFE_EVS_EventType_ERROR, - "Stop performance data cmd ignored,perf data write in progress"); - }/* end if */ + "Stop performance data cmd ignored,perf data write in progress"); + } /* end if */ return CFE_SUCCESS; } /* End of CFE_ES_StopPerfDataCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Function: CFE_ES_RunPerfLogDump() */ /* */ @@ -263,9 +255,9 @@ int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfDataCmd_t *data) bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) { CFE_ES_PerfDumpGlobal_t *State = (CFE_ES_PerfDumpGlobal_t *)Arg; - int32 Status; - CFE_FS_Header_t FileHdr; - size_t BlockSize; + int32 Status; + CFE_FS_Header_t FileHdr; + size_t BlockSize; /* * each time this background job is re-entered after a time delay, @@ -274,8 +266,7 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) * This implements work-throttling as a form of cooperative * CPU sharing with other low priority background jobs. */ - State->WorkCredit += - (ElapsedTime * CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS) / CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY; + State->WorkCredit += (ElapsedTime * CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS) / CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY; /* * do not allow credit to accumulate indefinitely - @@ -290,8 +281,7 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) { --State->WorkCredit; - if (State->PendingState != - State->CurrentState) + if (State->PendingState != State->CurrentState) { /* * Handle state change/entry logic. @@ -299,69 +289,67 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) */ State->StateCounter = 0; - switch(State->PendingState) + switch (State->PendingState) { - case CFE_ES_PerfDumpState_OPEN_FILE: - /* Create the file to dump to */ - Status = OS_OpenCreate(&State->FileDesc, State->DataFileName, - OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); - if (Status < 0) - { - State->FileDesc = OS_OBJECT_ID_UNDEFINED; - CFE_EVS_SendEvent(CFE_ES_PERF_LOG_ERR_EID,CFE_EVS_EventType_ERROR, - "Error creating file %s, RC = %d", - State->DataFileName, (int)Status); - - } - State->FileSize = 0; - break; - - case CFE_ES_PerfDumpState_DELAY: - /* - * Add a state entry delay before locking the "Perf" structure to - * ensure that any foreground task that may have been writing to this - * structure has completed its access. - * - * Note that the state should already have been set to IDLE, so - * no new writes will start, this is just to yield the CPU such that - * any already-started writes may finish. - * - * This can be done by simply zeroing out the current credit, - * which will cause this loop to exit for now and resume after - * some time delay (does not really matter how much time). - */ - State->WorkCredit = 0; - break; - - case CFE_ES_PerfDumpState_LOCK_DATA: - OS_MutSemTake(CFE_ES_Global.PerfDataMutex); - break; - - case CFE_ES_PerfDumpState_WRITE_FS_HDR: - case CFE_ES_PerfDumpState_WRITE_PERF_METADATA: - State->StateCounter = 1; - break; - - case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES: - State->DataPos = Perf->MetaData.DataStart; - State->StateCounter = Perf->MetaData.DataCount; - break; - - case CFE_ES_PerfDumpState_UNLOCK_DATA: - OS_MutSemGive(CFE_ES_Global.PerfDataMutex); - break; - - case CFE_ES_PerfDumpState_CLOSE_FILE: - /* close the fd */ - if (OS_ObjectIdDefined(State->FileDesc)) - { - OS_close(State->FileDesc); - State->FileDesc = OS_OBJECT_ID_UNDEFINED; - } - break; + case CFE_ES_PerfDumpState_OPEN_FILE: + /* Create the file to dump to */ + Status = OS_OpenCreate(&State->FileDesc, State->DataFileName, + OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); + if (Status < 0) + { + State->FileDesc = OS_OBJECT_ID_UNDEFINED; + CFE_EVS_SendEvent(CFE_ES_PERF_LOG_ERR_EID, CFE_EVS_EventType_ERROR, + "Error creating file %s, RC = %d", State->DataFileName, (int)Status); + } + State->FileSize = 0; + break; + + case CFE_ES_PerfDumpState_DELAY: + /* + * Add a state entry delay before locking the "Perf" structure to + * ensure that any foreground task that may have been writing to this + * structure has completed its access. + * + * Note that the state should already have been set to IDLE, so + * no new writes will start, this is just to yield the CPU such that + * any already-started writes may finish. + * + * This can be done by simply zeroing out the current credit, + * which will cause this loop to exit for now and resume after + * some time delay (does not really matter how much time). + */ + State->WorkCredit = 0; + break; + + case CFE_ES_PerfDumpState_LOCK_DATA: + OS_MutSemTake(CFE_ES_Global.PerfDataMutex); + break; + + case CFE_ES_PerfDumpState_WRITE_FS_HDR: + case CFE_ES_PerfDumpState_WRITE_PERF_METADATA: + State->StateCounter = 1; + break; + + case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES: + State->DataPos = Perf->MetaData.DataStart; + State->StateCounter = Perf->MetaData.DataCount; + break; + + case CFE_ES_PerfDumpState_UNLOCK_DATA: + OS_MutSemGive(CFE_ES_Global.PerfDataMutex); + break; + + case CFE_ES_PerfDumpState_CLOSE_FILE: + /* close the fd */ + if (OS_ObjectIdDefined(State->FileDesc)) + { + OS_close(State->FileDesc); + State->FileDesc = OS_OBJECT_ID_UNDEFINED; + } + break; - default: - break; + default: + break; } State->CurrentState = State->PendingState; @@ -388,25 +376,23 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) { State->PendingState = CFE_ES_PerfDumpState_IDLE; } - switch(State->CurrentState) + switch (State->CurrentState) { - case CFE_ES_PerfDumpState_OPEN_FILE: - if (!OS_ObjectIdDefined(State->FileDesc)) - { - State->PendingState = CFE_ES_PerfDumpState_IDLE; - } /* end if */ - break; - - case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES: - CFE_EVS_SendEvent(CFE_ES_PERF_DATAWRITTEN_EID,CFE_EVS_EventType_DEBUG, - "%s written:Size=%lu,EntryCount=%lu", - State->DataFileName, - (unsigned long)State->FileSize, - (unsigned long)Perf->MetaData.DataCount); - break; - - default: - break; + case CFE_ES_PerfDumpState_OPEN_FILE: + if (!OS_ObjectIdDefined(State->FileDesc)) + { + State->PendingState = CFE_ES_PerfDumpState_IDLE; + } /* end if */ + break; + + case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES: + CFE_EVS_SendEvent(CFE_ES_PERF_DATAWRITTEN_EID, CFE_EVS_EventType_DEBUG, + "%s written:Size=%lu,EntryCount=%lu", State->DataFileName, + (unsigned long)State->FileSize, (unsigned long)Perf->MetaData.DataCount); + break; + + default: + break; } } else @@ -414,43 +400,40 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) /* * State is in progress, perform work item(s) as required */ - Status = 0; + Status = 0; BlockSize = 0; - switch(State->CurrentState) + switch (State->CurrentState) { - case CFE_ES_PerfDumpState_WRITE_FS_HDR: - /* Zero cFE header, then fill in fields */ - CFE_FS_InitHeader(&FileHdr, CFE_ES_PERF_LOG_DESC, CFE_FS_SubType_ES_PERFDATA); - /* predicted total length of final output */ - FileHdr.Length = sizeof(CFE_ES_PerfMetaData_t) + (Perf->MetaData.DataCount * sizeof(CFE_ES_PerfDataEntry_t)); - /* write the cFE header to the file */ - Status = CFE_FS_WriteHeader(State->FileDesc, - &FileHdr); - BlockSize = sizeof(CFE_FS_Header_t); - break; - - case CFE_ES_PerfDumpState_WRITE_PERF_METADATA: - /* write the performance metadata to the file */ - BlockSize = sizeof(CFE_ES_PerfMetaData_t); - Status = OS_write(State->FileDesc, - &Perf->MetaData, BlockSize); - break; - - case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES: - BlockSize = sizeof(CFE_ES_PerfDataEntry_t); - Status = OS_write (State->FileDesc, - &Perf->DataBuffer[State->DataPos], - BlockSize); - - ++State->DataPos; - if (State->DataPos >= CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE) - { - State->DataPos = 0; - } - break; + case CFE_ES_PerfDumpState_WRITE_FS_HDR: + /* Zero cFE header, then fill in fields */ + CFE_FS_InitHeader(&FileHdr, CFE_ES_PERF_LOG_DESC, CFE_FS_SubType_ES_PERFDATA); + /* predicted total length of final output */ + FileHdr.Length = + sizeof(CFE_ES_PerfMetaData_t) + (Perf->MetaData.DataCount * sizeof(CFE_ES_PerfDataEntry_t)); + /* write the cFE header to the file */ + Status = CFE_FS_WriteHeader(State->FileDesc, &FileHdr); + BlockSize = sizeof(CFE_FS_Header_t); + break; + + case CFE_ES_PerfDumpState_WRITE_PERF_METADATA: + /* write the performance metadata to the file */ + BlockSize = sizeof(CFE_ES_PerfMetaData_t); + Status = OS_write(State->FileDesc, &Perf->MetaData, BlockSize); + break; + + case CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES: + BlockSize = sizeof(CFE_ES_PerfDataEntry_t); + Status = OS_write(State->FileDesc, &Perf->DataBuffer[State->DataPos], BlockSize); + + ++State->DataPos; + if (State->DataPos >= CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE) + { + State->DataPos = 0; + } + break; - default: - break; + default: + break; } if (BlockSize != 0) @@ -473,14 +456,13 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) --State->StateCounter; } - } /* * Return "true" if activity is ongoing, or "false" if not active */ return (State->CurrentState != CFE_ES_PerfDumpState_IDLE); -}/* end CFE_ES_PerfLogDump */ +} /* end CFE_ES_PerfLogDump */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -491,22 +473,24 @@ int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMaskCmd_t *data) { const CFE_ES_SetPerfFilterMaskCmd_Payload_t *cmd = &data->Payload; - if(cmd->FilterMaskNum < CFE_ES_PERF_32BIT_WORDS_IN_MASK ){ + if (cmd->FilterMaskNum < CFE_ES_PERF_32BIT_WORDS_IN_MASK) + { Perf->MetaData.FilterMask[cmd->FilterMaskNum] = cmd->FilterMask; CFE_EVS_SendEvent(CFE_ES_PERF_FILTMSKCMD_EID, CFE_EVS_EventType_DEBUG, - "Set Performance Filter Mask Cmd rcvd, num %u, val 0x%08X", - (unsigned int)cmd->FilterMaskNum,(unsigned int)cmd->FilterMask); + "Set Performance Filter Mask Cmd rcvd, num %u, val 0x%08X", (unsigned int)cmd->FilterMaskNum, + (unsigned int)cmd->FilterMask); CFE_ES_TaskData.CommandCounter++; - }else{ + } + else + { CFE_EVS_SendEvent(CFE_ES_PERF_FILTMSKERR_EID, CFE_EVS_EventType_ERROR, - "Performance Filter Mask Cmd Error,Index(%u)out of range(%u)", - (unsigned int)cmd->FilterMaskNum,(unsigned int)CFE_ES_PERF_32BIT_WORDS_IN_MASK); + "Performance Filter Mask Cmd Error,Index(%u)out of range(%u)", + (unsigned int)cmd->FilterMaskNum, (unsigned int)CFE_ES_PERF_32BIT_WORDS_IN_MASK); CFE_ES_TaskData.CommandErrorCounter++; - } return CFE_SUCCESS; @@ -521,20 +505,22 @@ int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMaskCmd_t *data) { const CFE_ES_SetPerfTrigMaskCmd_Payload_t *cmd = &data->Payload; - if(cmd->TriggerMaskNum < CFE_ES_PERF_32BIT_WORDS_IN_MASK ){ + if (cmd->TriggerMaskNum < CFE_ES_PERF_32BIT_WORDS_IN_MASK) + { Perf->MetaData.TriggerMask[cmd->TriggerMaskNum] = cmd->TriggerMask; CFE_EVS_SendEvent(CFE_ES_PERF_TRIGMSKCMD_EID, CFE_EVS_EventType_DEBUG, - "Set Performance Trigger Mask Cmd rcvd,num %u, val 0x%08X", - (unsigned int)cmd->TriggerMaskNum,(unsigned int)cmd->TriggerMask); + "Set Performance Trigger Mask Cmd rcvd,num %u, val 0x%08X", (unsigned int)cmd->TriggerMaskNum, + (unsigned int)cmd->TriggerMask); CFE_ES_TaskData.CommandCounter++; - - }else{ + } + else + { CFE_EVS_SendEvent(CFE_ES_PERF_TRIGMSKERR_EID, CFE_EVS_EventType_ERROR, - "Performance Trigger Mask Cmd Error,Index(%u)out of range(%u)", - (unsigned int)cmd->TriggerMaskNum,(unsigned int)CFE_ES_PERF_32BIT_WORDS_IN_MASK); + "Performance Trigger Mask Cmd Error,Index(%u)out of range(%u)", + (unsigned int)cmd->TriggerMaskNum, (unsigned int)CFE_ES_PERF_32BIT_WORDS_IN_MASK); CFE_ES_TaskData.CommandErrorCounter++; } @@ -542,7 +528,6 @@ int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMaskCmd_t *data) return CFE_SUCCESS; } /* End of CFE_ES_SetPerfTriggerMaskCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Name: CFE_ES_PerfLogAdd */ /* */ @@ -569,7 +554,7 @@ int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMaskCmd_t *data) void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit) { CFE_ES_PerfDataEntry_t EntryData; - uint32 DataEnd; + uint32 DataEnd; /* * If the global state is idle, exit immediately without locking or doing anything @@ -598,7 +583,7 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit) * This is also done outside the lock - * normally masks should NOT be changed while perf log is active / non-idle, * so although this is reading a global it should be constant, and this avoids - * locking (and potential task switch) if the data is ultimately not going to + * locking (and potential task switch) if the data is ultimately not going to * be written to the log. */ if (!CFE_ES_TEST_LONG_MASK(Perf->MetaData.FilterMask, Marker)) @@ -628,7 +613,7 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit) if (Perf->MetaData.State != CFE_ES_PERF_IDLE) { /* copy data to next perflog slot */ - DataEnd = Perf->MetaData.DataEnd; + DataEnd = Perf->MetaData.DataEnd; Perf->DataBuffer[DataEnd] = EntryData; ++DataEnd; @@ -687,4 +672,3 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit) OS_MutSemGive(CFE_ES_Global.PerfDataMutex); } /* end CFE_ES_PerfLogAdd */ - diff --git a/modules/es/fsw/src/cfe_es_perf.h b/modules/es/fsw/src/cfe_es_perf.h index ce2b2ac76..4b37d2602 100644 --- a/modules/es/fsw/src/cfe_es_perf.h +++ b/modules/es/fsw/src/cfe_es_perf.h @@ -32,7 +32,6 @@ #ifndef _cfe_es_perf_ #define _cfe_es_perf_ - /* ** Include Files */ @@ -44,14 +43,16 @@ ** Defines */ -enum CFE_ES_PerfState_t { +enum CFE_ES_PerfState_t +{ CFE_ES_PERF_IDLE = 0, CFE_ES_PERF_WAITING_FOR_TRIGGER, CFE_ES_PERF_TRIGGERED, CFE_ES_PERF_MAX_STATES }; -enum CFE_ES_PerfMode_t { +enum CFE_ES_PerfMode_t +{ CFE_ES_PERF_TRIGGER_START = 0, CFE_ES_PERF_TRIGGER_CENTER, CFE_ES_PERF_TRIGGER_END, @@ -68,18 +69,18 @@ enum CFE_ES_PerfMode_t { */ typedef enum { - CFE_ES_PerfDumpState_IDLE, /* Placeholder for idle, no action */ - CFE_ES_PerfDumpState_INIT, /* Placeholder for entry/init, no action */ - CFE_ES_PerfDumpState_OPEN_FILE, /* Opening of the output file */ - CFE_ES_PerfDumpState_DELAY, /* Wait-state to ensure in-progress writes are finished */ - CFE_ES_PerfDumpState_LOCK_DATA, /* Locking of the global data structure */ - CFE_ES_PerfDumpState_WRITE_FS_HDR, /* Write the CFE FS file header */ - CFE_ES_PerfDumpState_WRITE_PERF_METADATA, /* Write the Perf global metadata */ - CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES, /* Write the Perf Log entries (throttled) */ - CFE_ES_PerfDumpState_CLEANUP, /* Placeholder for cleanup, no action */ - CFE_ES_PerfDumpState_UNLOCK_DATA, /* Unlocking of the global data structure */ - CFE_ES_PerfDumpState_CLOSE_FILE, /* Closing of the output file */ - CFE_ES_PerfDumpState_MAX /* Placeholder for last state, no action, always last */ + CFE_ES_PerfDumpState_IDLE, /* Placeholder for idle, no action */ + CFE_ES_PerfDumpState_INIT, /* Placeholder for entry/init, no action */ + CFE_ES_PerfDumpState_OPEN_FILE, /* Opening of the output file */ + CFE_ES_PerfDumpState_DELAY, /* Wait-state to ensure in-progress writes are finished */ + CFE_ES_PerfDumpState_LOCK_DATA, /* Locking of the global data structure */ + CFE_ES_PerfDumpState_WRITE_FS_HDR, /* Write the CFE FS file header */ + CFE_ES_PerfDumpState_WRITE_PERF_METADATA, /* Write the Perf global metadata */ + CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES, /* Write the Perf Log entries (throttled) */ + CFE_ES_PerfDumpState_CLEANUP, /* Placeholder for cleanup, no action */ + CFE_ES_PerfDumpState_UNLOCK_DATA, /* Unlocking of the global data structure */ + CFE_ES_PerfDumpState_CLOSE_FILE, /* Closing of the output file */ + CFE_ES_PerfDumpState_MAX /* Placeholder for last state, no action, always last */ } CFE_ES_PerfDumpState_t; /* @@ -95,20 +96,20 @@ typedef enum * where the command processor sets the PendingState. * * Once state is non-IDLE, the structure becomes owned by the background - * task. It will progress through the remainder of the state machine, + * task. It will progress through the remainder of the state machine, * eventually arriving back at IDLE when the request is completed. */ typedef struct { - CFE_ES_PerfDumpState_t CurrentState; /* the current state of the job */ - CFE_ES_PerfDumpState_t PendingState; /* the pending/next state, if transitioning */ + CFE_ES_PerfDumpState_t CurrentState; /* the current state of the job */ + CFE_ES_PerfDumpState_t PendingState; /* the pending/next state, if transitioning */ - char DataFileName[OS_MAX_PATH_LEN]; /* output file name from dump command */ - osal_id_t FileDesc; /* file descriptor for writing */ - uint32 WorkCredit; /* accumulator based on the passage of time */ - uint32 StateCounter; /* number of blocks/items left in current state */ - uint32 DataPos; /* last position within the Perf Log */ - size_t FileSize; /* Total file size, for progress reporing in telemetry */ + char DataFileName[OS_MAX_PATH_LEN]; /* output file name from dump command */ + osal_id_t FileDesc; /* file descriptor for writing */ + uint32 WorkCredit; /* accumulator based on the passage of time */ + uint32 StateCounter; /* number of blocks/items left in current state */ + uint32 DataPos; /* last position within the Perf Log */ + size_t FileSize; /* Total file size, for progress reporing in telemetry */ } CFE_ES_PerfDumpGlobal_t; /* @@ -132,4 +133,3 @@ uint32 CFE_ES_GetPerfLogDumpRemaining(void); bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg); #endif /* _cfe_es_perf_ */ - diff --git a/modules/es/fsw/src/cfe_es_resource.c b/modules/es/fsw/src/cfe_es_resource.c index e1f7a6b5f..aab570a9c 100644 --- a/modules/es/fsw/src/cfe_es_resource.c +++ b/modules/es/fsw/src/cfe_es_resource.c @@ -39,37 +39,35 @@ #include #include - /*********************************************************************/ /* * Function: CFE_ES_TaskId_ToOSAL - * + * * For complete API information, see prototype in header */ osal_id_t CFE_ES_TaskId_ToOSAL(CFE_ES_TaskId_t id) { - osal_id_t Result; + osal_id_t Result; unsigned long Val; - Val = CFE_ResourceId_ToInteger(CFE_RESOURCEID_UNWRAP(id)); + Val = CFE_ResourceId_ToInteger(CFE_RESOURCEID_UNWRAP(id)); Result = OS_ObjectIdFromInteger(Val ^ CFE_RESOURCEID_MARK); return Result; } - /*********************************************************************/ /* * Function: CFE_TaskId_FromOSAL - * + * * For complete API information, see prototype in header */ CFE_ES_TaskId_t CFE_ES_TaskId_FromOSAL(osal_id_t id) { CFE_ResourceId_t Result; - unsigned long Val; + unsigned long Val; - Val = OS_ObjectIdToInteger(id); + Val = OS_ObjectIdToInteger(id); Result = CFE_ResourceId_FromInteger(Val ^ CFE_RESOURCEID_MARK); return CFE_ES_TASKID_C(Result); @@ -83,32 +81,31 @@ CFE_ES_TaskId_t CFE_ES_TaskId_FromOSAL(osal_id_t id) */ CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByName(const char *Name) { - CFE_ES_AppRecord_t *AppRecPtr; - uint32 Count; - - /* - ** Search the Application table for an app with a matching name. - */ - AppRecPtr = CFE_ES_Global.AppTable; - Count = CFE_PLATFORM_ES_MAX_APPLICATIONS; - while ( true ) - { - if ( Count == 0 ) - { - AppRecPtr = NULL; - break; - } - if ( CFE_ES_AppRecordIsUsed(AppRecPtr) && - strcmp(Name, CFE_ES_AppRecordGetName(AppRecPtr)) == 0 ) - { - break; - } - - ++AppRecPtr; - --Count; - } - - return AppRecPtr; + CFE_ES_AppRecord_t *AppRecPtr; + uint32 Count; + + /* + ** Search the Application table for an app with a matching name. + */ + AppRecPtr = CFE_ES_Global.AppTable; + Count = CFE_PLATFORM_ES_MAX_APPLICATIONS; + while (true) + { + if (Count == 0) + { + AppRecPtr = NULL; + break; + } + if (CFE_ES_AppRecordIsUsed(AppRecPtr) && strcmp(Name, CFE_ES_AppRecordGetName(AppRecPtr)) == 0) + { + break; + } + + ++AppRecPtr; + --Count; + } + + return AppRecPtr; } /* End of CFE_ES_LocateAppRecordByName() */ @@ -120,35 +117,33 @@ CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByName(const char *Name) */ CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByName(const char *Name) { - CFE_ES_LibRecord_t *LibRecPtr; - uint32 Count; - - /* - ** Search the Library table for a library with a matching name. - */ - LibRecPtr = CFE_ES_Global.LibTable; - Count = CFE_PLATFORM_ES_MAX_LIBRARIES; - while ( true ) - { - if ( Count == 0 ) - { - LibRecPtr = NULL; - break; - } - if ( CFE_ES_LibRecordIsUsed(LibRecPtr) && - strcmp(Name, CFE_ES_LibRecordGetName(LibRecPtr)) == 0 ) - { - break; - } - - ++LibRecPtr; - --Count; - } - - return LibRecPtr; + CFE_ES_LibRecord_t *LibRecPtr; + uint32 Count; -} /* End of CFE_ES_LocateLibRecordByName() */ + /* + ** Search the Library table for a library with a matching name. + */ + LibRecPtr = CFE_ES_Global.LibTable; + Count = CFE_PLATFORM_ES_MAX_LIBRARIES; + while (true) + { + if (Count == 0) + { + LibRecPtr = NULL; + break; + } + if (CFE_ES_LibRecordIsUsed(LibRecPtr) && strcmp(Name, CFE_ES_LibRecordGetName(LibRecPtr)) == 0) + { + break; + } + + ++LibRecPtr; + --Count; + } + + return LibRecPtr; +} /* End of CFE_ES_LocateLibRecordByName() */ /*********************************************************************/ /* @@ -159,34 +154,32 @@ CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByName(const char *Name) CFE_ES_GenCounterRecord_t *CFE_ES_LocateCounterRecordByName(const char *Name) { CFE_ES_GenCounterRecord_t *CounterRecPtr; - uint32 Count; + uint32 Count; /* ** Search the Counter table for a matching name. */ CounterRecPtr = CFE_ES_Global.CounterTable; - Count = CFE_PLATFORM_ES_MAX_GEN_COUNTERS; - while ( true ) + Count = CFE_PLATFORM_ES_MAX_GEN_COUNTERS; + while (true) { - if ( Count == 0 ) + if (Count == 0) { CounterRecPtr = NULL; break; } - if ( CFE_ES_CounterRecordIsUsed(CounterRecPtr) && - strcmp(Name, CFE_ES_CounterRecordGetName(CounterRecPtr)) == 0 ) + if (CFE_ES_CounterRecordIsUsed(CounterRecPtr) && strcmp(Name, CFE_ES_CounterRecordGetName(CounterRecPtr)) == 0) { break; } - ++CounterRecPtr; - --Count; + ++CounterRecPtr; + --Count; } return CounterRecPtr; } - /*********************************************************************/ /* * CFE_ES_LocateAppRecordByID @@ -196,7 +189,7 @@ CFE_ES_GenCounterRecord_t *CFE_ES_LocateCounterRecordByName(const char *Name) CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID) { CFE_ES_AppRecord_t *AppRecPtr; - uint32 Idx; + uint32 Idx; if (CFE_ES_AppID_ToIndex(AppID, &Idx) == CFE_SUCCESS) { @@ -216,10 +209,10 @@ CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID) * * For complete API information, see prototype in header */ -CFE_ES_LibRecord_t* CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID) +CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID) { CFE_ES_LibRecord_t *LibRecPtr; - uint32 Idx; + uint32 Idx; if (CFE_ES_LibID_ToIndex(LibID, &Idx) == CFE_SUCCESS) { @@ -242,7 +235,7 @@ CFE_ES_LibRecord_t* CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID) CFE_ES_TaskRecord_t *CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID) { CFE_ES_TaskRecord_t *TaskRecPtr; - uint32 Idx; + uint32 Idx; if (CFE_ES_TaskID_ToIndex(TaskID, &Idx) == CFE_SUCCESS) { @@ -262,10 +255,10 @@ CFE_ES_TaskRecord_t *CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID) * * For complete API information, see prototype in header */ -CFE_ES_GenCounterRecord_t* CFE_ES_LocateCounterRecordByID(CFE_ES_CounterId_t CounterID) +CFE_ES_GenCounterRecord_t *CFE_ES_LocateCounterRecordByID(CFE_ES_CounterId_t CounterID) { CFE_ES_GenCounterRecord_t *CounterRecPtr; - uint32 Idx; + uint32 Idx; if (CFE_ES_CounterID_ToIndex(CounterID, &Idx) == CFE_SUCCESS) { @@ -291,12 +284,12 @@ CFE_ES_GenCounterRecord_t* CFE_ES_LocateCounterRecordByID(CFE_ES_CounterId_t Cou CFE_ES_TaskRecord_t *CFE_ES_GetTaskRecordByContext(void) { CFE_ES_TaskRecord_t *TaskRecPtr; - CFE_ES_TaskId_t TaskID; + CFE_ES_TaskId_t TaskID; /* ** Use the OS task ID to get the ES task record */ - TaskID = CFE_ES_TaskId_FromOSAL(OS_TaskGetId()); + TaskID = CFE_ES_TaskId_FromOSAL(OS_TaskGetId()); TaskRecPtr = CFE_ES_LocateTaskRecordByID(TaskID); /* @@ -321,7 +314,7 @@ CFE_ES_TaskRecord_t *CFE_ES_GetTaskRecordByContext(void) */ CFE_ES_AppRecord_t *CFE_ES_GetAppRecordByContext(void) { - CFE_ES_AppRecord_t *AppRecPtr; + CFE_ES_AppRecord_t * AppRecPtr; CFE_ES_TaskRecord_t *TaskRecPtr; /* @@ -357,8 +350,8 @@ CFE_ES_AppRecord_t *CFE_ES_GetAppRecordByContext(void) /* * --------------------------------------------------------------------------------------- * Function: CFE_ES_CheckCounterIdSlotUsed - * - * Purpose: Helper function, Aids in allocating a new ID by checking if + * + * Purpose: Helper function, Aids in allocating a new ID by checking if * a given ID is available. Must be called while locked. * --------------------------------------------------------------------------------------- */ @@ -370,8 +363,8 @@ bool CFE_ES_CheckCounterIdSlotUsed(CFE_ResourceId_t CheckId) /* *--------------------------------------------------------------------------------------- * Function: CFE_ES_CheckAppIdSlotUsed - * - * Purpose: Helper function, Aids in allocating a new ID by checking if + * + * Purpose: Helper function, Aids in allocating a new ID by checking if * a given ID is available. Must be called while locked. *--------------------------------------------------------------------------------------- */ @@ -383,8 +376,8 @@ bool CFE_ES_CheckAppIdSlotUsed(CFE_ResourceId_t CheckId) /* * --------------------------------------------------------------------------------------- * Function: CFE_ES_CheckLibIdSlotUsed - * - * Purpose: Helper function, Aids in allocating a new ID by checking if + * + * Purpose: Helper function, Aids in allocating a new ID by checking if * a given ID is available. Must be called while locked. * --------------------------------------------------------------------------------------- */ @@ -392,5 +385,3 @@ bool CFE_ES_CheckLibIdSlotUsed(CFE_ResourceId_t CheckId) { return CFE_ES_LibRecordIsUsed(CFE_ES_LocateLibRecordByID(CFE_ES_LIBID_C(CheckId))); } - - diff --git a/modules/es/fsw/src/cfe_es_resource.h b/modules/es/fsw/src/cfe_es_resource.h index ad30b13a9..67f9bf417 100644 --- a/modules/es/fsw/src/cfe_es_resource.h +++ b/modules/es/fsw/src/cfe_es_resource.h @@ -38,7 +38,6 @@ #include "cfe_core_resourceid_basevalues.h" #include "cfe_es_global.h" - /** * @brief Locate the app table entry correlating with a given app ID. * @@ -48,7 +47,7 @@ * @param[in] AppID the app ID to locate * @return pointer to App Table entry for the given app ID */ -extern CFE_ES_AppRecord_t* CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID); +extern CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID); /** * @brief Locate the Library table entry correlating with a given Lib ID. @@ -59,7 +58,7 @@ extern CFE_ES_AppRecord_t* CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID); * @param[in] LibID the Lib ID to locate * @return pointer to Library Table entry for the given Lib ID */ -extern CFE_ES_LibRecord_t* CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID); +extern CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID); /** * @brief Locate the task table entry correlating with a given task ID. @@ -70,7 +69,7 @@ extern CFE_ES_LibRecord_t* CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID); * @param[in] TaskID the task ID to locate * @return pointer to Task Table entry for the given task ID */ -extern CFE_ES_TaskRecord_t* CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID); +extern CFE_ES_TaskRecord_t *CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID); /** * @brief Locate the Counter table entry correlating with a given Counter ID. @@ -81,7 +80,7 @@ extern CFE_ES_TaskRecord_t* CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID); * @param[in] CounterID the Counter ID to locate * @return pointer to Counter Table entry for the given Counter ID */ -extern CFE_ES_GenCounterRecord_t* CFE_ES_LocateCounterRecordByID(CFE_ES_CounterId_t CounterID); +extern CFE_ES_GenCounterRecord_t *CFE_ES_LocateCounterRecordByID(CFE_ES_CounterId_t CounterID); /** * @brief Check if an app record is in use or free/empty @@ -171,13 +170,11 @@ static inline bool CFE_ES_AppRecordIsMatch(const CFE_ES_AppRecord_t *AppRecPtr, * @param[in] AppRecPtr pointer to App table entry * @returns Pointer to Application name */ -static inline const char* CFE_ES_AppRecordGetName(const CFE_ES_AppRecord_t *AppRecPtr) +static inline const char *CFE_ES_AppRecordGetName(const CFE_ES_AppRecord_t *AppRecPtr) { return AppRecPtr->AppName; } - - /** * @brief Check if a Library record is in use or free/empty * @@ -264,13 +261,11 @@ static inline bool CFE_ES_LibRecordIsMatch(const CFE_ES_LibRecord_t *LibRecPtr, * @param[in] LibRecPtr pointer to Lib table entry * @returns Pointer to Library name */ -static inline const char* CFE_ES_LibRecordGetName(const CFE_ES_LibRecord_t *LibRecPtr) +static inline const char *CFE_ES_LibRecordGetName(const CFE_ES_LibRecord_t *LibRecPtr) { return LibRecPtr->LibName; } - - /** * @brief Get the ID value from an Task table entry * @@ -362,13 +357,11 @@ static inline bool CFE_ES_TaskRecordIsMatch(const CFE_ES_TaskRecord_t *TaskRecPt * @param[in] TaskRecPtr pointer to Task table entry * @returns Pointer to Task name */ -static inline const char* CFE_ES_TaskRecordGetName(const CFE_ES_TaskRecord_t *TaskRecPtr) +static inline const char *CFE_ES_TaskRecordGetName(const CFE_ES_TaskRecord_t *TaskRecPtr) { return TaskRecPtr->TaskName; } - - /** * @brief Check if an Counter record is in use or free/empty * @@ -444,7 +437,8 @@ static inline void CFE_ES_CounterRecordSetFree(CFE_ES_GenCounterRecord_t *Counte * @param[in] CounterID expected Counter ID * @returns true if the entry matches the given Counter ID */ -static inline bool CFE_ES_CounterRecordIsMatch(const CFE_ES_GenCounterRecord_t *CounterRecPtr, CFE_ES_CounterId_t CounterID) +static inline bool CFE_ES_CounterRecordIsMatch(const CFE_ES_GenCounterRecord_t *CounterRecPtr, + CFE_ES_CounterId_t CounterID) { return (CounterRecPtr != NULL && CFE_RESOURCEID_TEST_EQUAL(CounterRecPtr->CounterId, CounterID)); } @@ -457,12 +451,11 @@ static inline bool CFE_ES_CounterRecordIsMatch(const CFE_ES_GenCounterRecord_t * * @param[in] CounterRecPtr pointer to Counter table entry * @returns Pointer to counter name */ -static inline const char* CFE_ES_CounterRecordGetName(const CFE_ES_GenCounterRecord_t *CounterRecPtr) +static inline const char *CFE_ES_CounterRecordGetName(const CFE_ES_GenCounterRecord_t *CounterRecPtr) { return CounterRecPtr->CounterName; } - /** * Locate and validate the app record for the calling context. * @@ -473,7 +466,7 @@ static inline const char* CFE_ES_CounterRecordGetName(const CFE_ES_GenCounterRec * * The global data lock should be obtained prior to invoking this function. */ -extern CFE_ES_AppRecord_t* CFE_ES_GetAppRecordByContext(void); +extern CFE_ES_AppRecord_t *CFE_ES_GetAppRecordByContext(void); /** * Locate and validate the task record for the calling context. @@ -485,17 +478,17 @@ extern CFE_ES_AppRecord_t* CFE_ES_GetAppRecordByContext(void); * * The global data lock should be obtained prior to invoking this function. */ -extern CFE_ES_TaskRecord_t* CFE_ES_GetTaskRecordByContext(void); +extern CFE_ES_TaskRecord_t *CFE_ES_GetTaskRecordByContext(void); /* * OSAL <-> CFE task ID conversion - * + * * CFE ES does not currently allocate its own task IDs; instead it piggybacks on top * of the allocation that is already done by OSAL. This is partly for backward * compatibility - historically the OSAL task IDs were used directly by CFE task APIs. - * + * * This is _only_ used for tasks - for all other resource types ES should allocate - * its own identifiers independently of any other subsystem. This conversion may also + * its own identifiers independently of any other subsystem. This conversion may also * be removed in a future version of CFE, if ES starts allocating task IDs independently * of OSAL task IDs. */ @@ -546,9 +539,9 @@ extern CFE_ES_TaskId_t CFE_ES_TaskId_FromOSAL(osal_id_t id); * These functions do not lock, they must only be used internally by ES when * the lock is already held. */ -CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByName(const char *Name); -CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByName(const char *Name); -CFE_ES_TaskRecord_t *CFE_ES_LocateTaskRecordByName(const char *Name); +CFE_ES_AppRecord_t * CFE_ES_LocateAppRecordByName(const char *Name); +CFE_ES_LibRecord_t * CFE_ES_LocateLibRecordByName(const char *Name); +CFE_ES_TaskRecord_t * CFE_ES_LocateTaskRecordByName(const char *Name); CFE_ES_GenCounterRecord_t *CFE_ES_LocateCounterRecordByName(const char *Name); /* Availability check functions used in conjunction with CFE_ResourceId_FindNext() */ @@ -556,5 +549,4 @@ bool CFE_ES_CheckAppIdSlotUsed(CFE_ResourceId_t CheckId); bool CFE_ES_CheckLibIdSlotUsed(CFE_ResourceId_t CheckId); bool CFE_ES_CheckCounterIdSlotUsed(CFE_ResourceId_t CheckId); - -#endif /* CFE_ES_RESOURCE_H */ +#endif /* CFE_ES_RESOURCE_H */ diff --git a/modules/es/fsw/src/cfe_es_start.c b/modules/es/fsw/src/cfe_es_start.c index 9a1ae2831..c88b808d8 100644 --- a/modules/es/fsw/src/cfe_es_start.c +++ b/modules/es/fsw/src/cfe_es_start.c @@ -19,7 +19,7 @@ */ /* -** File: +** File: ** cfe_es_start.c ** ** Purpose: @@ -50,22 +50,20 @@ static int32 CFE_ES_MainTaskSyncDelay(uint32 AppStateId, uint32 TimeOutMilliseco ** Defines for this module */ -/* -** Number of msecs to delay before exiting cFE. Allows LogMsg to get through +/* +** Number of msecs to delay before exiting cFE. Allows LogMsg to get through */ -#define CFE_ES_PANIC_DELAY 500 - +#define CFE_ES_PANIC_DELAY 500 /* ** Global data for the ES startup code and Runtime library */ -CFE_ES_Global_t CFE_ES_Global; +CFE_ES_Global_t CFE_ES_Global; /* ** Pointer to the Reset data that is preserved on a processor reset */ -CFE_ES_ResetData_t *CFE_ES_ResetDataPtr; - +CFE_ES_ResetData_t *CFE_ES_ResetDataPtr; /***************************************************************************/ /* @@ -75,169 +73,167 @@ CFE_ES_ResetData_t *CFE_ES_ResetDataPtr; /* ** Name: CFE_ES_Main - See API and header file for details */ -void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const char *StartFilePath ) +void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const char *StartFilePath) { - int32 ReturnCode; + int32 ReturnCode; + + /* + * Clear the entire global data structure. + * This also takes care of setting all resource IDs on all table entries + * to be "undefined" (not in use). + */ + memset(&CFE_ES_Global, 0, sizeof(CFE_ES_Global)); + + /* + ** Indicate that the CFE is the earliest initialization state + */ + CFE_ES_Global.SystemState = CFE_ES_SystemState_EARLY_INIT; + + /* + ** Create the ES Shared Data Mutex + ** This must be done before ANY calls to CFE_ES_WriteToSysLog(), since this uses the mutex + */ + ReturnCode = OS_MutSemCreate(&(CFE_ES_Global.SharedDataMutex), "ES_DATA_MUTEX", 0); + if (ReturnCode != OS_SUCCESS) + { + CFE_ES_SysLogWrite_Unsync("ES Startup: Error: ES Shared Data Mutex could not be created. RC=0x%08X\n", + (unsigned int)ReturnCode); + + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_STARTUP_SEM); + + /* + * Normally CFE_PSP_Panic() will not return but it will under UT + */ + return; + } /* end if */ + + /* + ** Initialize the Reset variables. This call is required + ** Before most of the ES functions can be used including the + ** ES System log. + */ + CFE_ES_SetupResetVariables(StartType, StartSubtype, ModeId); - /* - * Clear the entire global data structure. - * This also takes care of setting all resource IDs on all table entries - * to be "undefined" (not in use). + /* + ** Initialize the Logic Perf variables + ** Because this is in the ES Reset area, it must be called after + ** CFE_ES_SetupResetVariables. */ - memset(&CFE_ES_Global, 0, sizeof(CFE_ES_Global)); - - /* - ** Indicate that the CFE is the earliest initialization state - */ - CFE_ES_Global.SystemState = CFE_ES_SystemState_EARLY_INIT; - - /* - ** Create the ES Shared Data Mutex - ** This must be done before ANY calls to CFE_ES_WriteToSysLog(), since this uses the mutex - */ - ReturnCode = OS_MutSemCreate(&(CFE_ES_Global.SharedDataMutex), "ES_DATA_MUTEX", 0 ); - if(ReturnCode != OS_SUCCESS) - { - CFE_ES_SysLogWrite_Unsync("ES Startup: Error: ES Shared Data Mutex could not be created. RC=0x%08X\n", - (unsigned int)ReturnCode); - - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_STARTUP_SEM); - - /* - * Normally CFE_PSP_Panic() will not return but it will under UT - */ - return; - } /* end if */ - - /* - ** Initialize the Reset variables. This call is required - ** Before most of the ES functions can be used including the - ** ES System log. - */ - CFE_ES_SetupResetVariables(StartType, StartSubtype, ModeId); - - /* - ** Initialize the Logic Perf variables - ** Because this is in the ES Reset area, it must be called after - ** CFE_ES_SetupResetVariables. - */ - CFE_ES_SetupPerfVariables(StartType); - - /* - ** Also Create the ES Performance Data Mutex - ** This is to separately protect against concurrent writes to the global performance log data - */ - ReturnCode = OS_MutSemCreate(&CFE_ES_Global.PerfDataMutex, "ES_PERF_MUTEX", 0); - if (ReturnCode != OS_SUCCESS) - { - CFE_ES_SysLogWrite_Unsync("ES Startup: Error: ES Performance Data Mutex could not be created. RC=0x%08X\n", - (unsigned int)ReturnCode); - - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_STARTUP_SEM); - - /* - * Normally CFE_PSP_Panic() will not return but it will under UT + CFE_ES_SetupPerfVariables(StartType); + + /* + ** Also Create the ES Performance Data Mutex + ** This is to separately protect against concurrent writes to the global performance log data + */ + ReturnCode = OS_MutSemCreate(&CFE_ES_Global.PerfDataMutex, "ES_PERF_MUTEX", 0); + if (ReturnCode != OS_SUCCESS) + { + CFE_ES_SysLogWrite_Unsync("ES Startup: Error: ES Performance Data Mutex could not be created. RC=0x%08X\n", + (unsigned int)ReturnCode); + + /* + ** Delay to allow the message to be read */ - return; - } - - /* - ** Announce the startup - */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main in EARLY_INIT state\n"); - - /* - ** Create and Mount the filesystems needed - */ - CFE_ES_InitializeFileSystems(StartType); - - /* - ** Install exception Handlers ( Placeholder ) - */ - CFE_PSP_AttachExceptions(); - - /* - ** Initialize the Last Id - */ - CFE_ES_Global.LastAppId = CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE); - CFE_ES_Global.LastLibId = CFE_ResourceId_FromInteger(CFE_ES_LIBID_BASE); - CFE_ES_Global.LastCounterId = CFE_ResourceId_FromInteger(CFE_ES_COUNTID_BASE); - CFE_ES_Global.LastMemPoolId = CFE_ResourceId_FromInteger(CFE_ES_POOLID_BASE); - - /* - ** Indicate that the CFE core is now starting up / going multi-threaded - */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering CORE_STARTUP state\n"); - CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_STARTUP; - - /* - ** Create the tasks, OS objects, and initialize hardware - */ - CFE_ES_CreateObjects(); - - /* - ** Indicate that the CFE core is ready - */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering CORE_READY state\n"); - CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - - /* - ** Start the cFE Applications from the disk using the file - ** specified in the CFE_PLATFORM_ES_NONVOL_STARTUP_FILE or CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE - ** ( defined in the cfe_platform_cfg.h file ) - */ - CFE_ES_StartApplications(StartType, StartFilePath ); - - /* - * Wait for applications to be in at least "LATE_INIT" - * - * However, if not everything starts up, that is not a fatal error, we will - * continue anyway since the core apps are OK and control/telemetry should function. - * The problem app could be deleted/restarted/etc by the ground station. + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_STARTUP_SEM); + + /* + * Normally CFE_PSP_Panic() will not return but it will under UT + */ + return; + } + + /* + ** Announce the startup + */ + CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main in EARLY_INIT state\n"); + + /* + ** Create and Mount the filesystems needed */ - if (CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_LATE_INIT, - CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("ES Startup: Startup Sync failed - Applications may not have all initialized\n"); - } - - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering APPS_INIT state\n"); - CFE_ES_Global.SystemState = CFE_ES_SystemState_APPS_INIT; - - /* - * Wait for applications to be "RUNNING" before moving to operational system state. - * - * However, if not everything starts up, that is not a fatal error, we will - * continue anyway since the core apps are OK and control/telemetry should function. - * The problem app could be deleted/restarted/etc by the ground station. + CFE_ES_InitializeFileSystems(StartType); + + /* + ** Install exception Handlers ( Placeholder ) + */ + CFE_PSP_AttachExceptions(); + + /* + ** Initialize the Last Id + */ + CFE_ES_Global.LastAppId = CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE); + CFE_ES_Global.LastLibId = CFE_ResourceId_FromInteger(CFE_ES_LIBID_BASE); + CFE_ES_Global.LastCounterId = CFE_ResourceId_FromInteger(CFE_ES_COUNTID_BASE); + CFE_ES_Global.LastMemPoolId = CFE_ResourceId_FromInteger(CFE_ES_POOLID_BASE); + + /* + ** Indicate that the CFE core is now starting up / going multi-threaded */ - if (CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_RUNNING, - CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("ES Startup: Startup Sync failed - Applications may not have all started\n"); - } - - /* - ** Startup is fully complete - */ - CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering OPERATIONAL state\n"); - CFE_ES_Global.SystemState = CFE_ES_SystemState_OPERATIONAL; + CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering CORE_STARTUP state\n"); + CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_STARTUP; + + /* + ** Create the tasks, OS objects, and initialize hardware + */ + CFE_ES_CreateObjects(); + + /* + ** Indicate that the CFE core is ready + */ + CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering CORE_READY state\n"); + CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; + + /* + ** Start the cFE Applications from the disk using the file + ** specified in the CFE_PLATFORM_ES_NONVOL_STARTUP_FILE or CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE + ** ( defined in the cfe_platform_cfg.h file ) + */ + CFE_ES_StartApplications(StartType, StartFilePath); + + /* + * Wait for applications to be in at least "LATE_INIT" + * + * However, if not everything starts up, that is not a fatal error, we will + * continue anyway since the core apps are OK and control/telemetry should function. + * The problem app could be deleted/restarted/etc by the ground station. + */ + if (CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_LATE_INIT, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Startup Sync failed - Applications may not have all initialized\n"); + } + + CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering APPS_INIT state\n"); + CFE_ES_Global.SystemState = CFE_ES_SystemState_APPS_INIT; + + /* + * Wait for applications to be "RUNNING" before moving to operational system state. + * + * However, if not everything starts up, that is not a fatal error, we will + * continue anyway since the core apps are OK and control/telemetry should function. + * The problem app could be deleted/restarted/etc by the ground station. + */ + if (CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_RUNNING, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Startup Sync failed - Applications may not have all started\n"); + } + + /* + ** Startup is fully complete + */ + CFE_ES_WriteToSysLog("ES Startup: CFE_ES_Main entering OPERATIONAL state\n"); + CFE_ES_Global.SystemState = CFE_ES_SystemState_OPERATIONAL; } /* @@ -251,231 +247,223 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId, const cha ** primitives are not even initialized yet. There is no chance for log contention here. ** */ -void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 BootSource ) +void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 BootSource) { - int32 status; - uint32 resetAreaSize; - cpuaddr ResetDataAddr; - - /* - ** Get the pointer to the Reset area from the BSP - */ - status = CFE_PSP_GetResetArea (&ResetDataAddr, &resetAreaSize); - - /* - ** Make sure the status is OK or size is big enough - */ - if ( status != CFE_PSP_SUCCESS ) - { - /* - ** Cannot use the ES System log without the Reset Area - */ - OS_printf("ES Startup: CFE_PSP_GetResetArea call Failed (0x%08x)!\n", (unsigned int)status); - - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); - - /* - * Normally unreachable, except in UT where - * CFE_PSP_Panic is a stub that may return - */ - return; - - } - else if ( resetAreaSize < sizeof(CFE_ES_ResetData_t)) - { - /* - ** Cannot use the ES system log without the Reset Area - */ - OS_printf("ES Startup: Error: ES Reset area not big enough. Needed: %d, Given: %d.\n", - (int)sizeof(CFE_ES_ResetData_t), - (int)resetAreaSize); - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); - - /* - * Normally unreachable, except in UT where - * CFE_PSP_Panic is a stub that may return - */ - return; - } - - CFE_ES_ResetDataPtr = (CFE_ES_ResetData_t *)ResetDataAddr; - - /* - ** Record the BootSource (bank) so it will be valid in the ER log entries. - */ - CFE_ES_ResetDataPtr->ResetVars.BootSource = BootSource; - - /* - ** Determine how the system was started. The choices are: - ** CFE_ES_POWER_ON_RESET, or CFE_PSP_RST_TYPE_PROCESSOR - ** The subtypes include: - ** CFE_PSP_RST_SUBTYPE_POWER_CYCLE, CFE_PSP_RST_SUBTYPE_PUSH_BUTTON, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, - ** CFE_PSP_RST_SUBTYPE_HW_WATCHDOG, CFE_PSP_RST_TYPE_COMMAND, or CFE_PSP_RST_SUBTYPE_EXCEPTION. - ** Some of these reset types are logged before the system is restarted. - ** ( CFE_PSP_RST_TYPE_COMMAND, CFE_PSP_RST_SUBTYPE_EXCEPTION ) while others occur - ** without the knowledge of the software and must be logged here. - */ - if ( StartType == CFE_PSP_RST_TYPE_POWERON ) - { - /* - ** Record the reset type and subtype - */ - CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = StartSubtype; - CFE_ES_ResetDataPtr->ResetVars.ResetType = CFE_PSP_RST_TYPE_POWERON; - - /* - ** Log the power-on reset. - */ - if ( StartSubtype == CFE_PSP_RST_SUBTYPE_POWER_CYCLE ) - { - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to Power Cycle (Power Cycle).\n"); - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, - "POWER ON RESET due to Power Cycle (Power Cycle)"); - } - else if ( StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND ) - { - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n"); - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, - "POWER ON RESET due to HW Special Cmd (Hw Spec Cmd)"); - } - else - { - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to other cause (See Subtype).\n"); - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, - "POWER ON RESET due to other cause (See Subtype)"); - } - - /* - ** Initialize all reset counters. - */ - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = 0; - CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount = CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS; - CFE_ES_Global.DebugVars.DebugFlag = 0; - - } - else if ( StartType == CFE_PSP_RST_TYPE_PROCESSOR ) - { - /* - ** If a Processor reset was not commanded, it must be a watchdog or other non-commanded reset - ** Log the reset before updating any reset variables. - */ - if ( CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset != true ) - { - CFE_ES_ResetDataPtr->ResetVars.ResetType = CFE_PSP_RST_TYPE_PROCESSOR; - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount++; - - /* - ** When coming up from a Processor reset that was not caused by ES, check to see - ** if the maximum number has been exceeded + int32 status; + uint32 resetAreaSize; + cpuaddr ResetDataAddr; + + /* + ** Get the pointer to the Reset area from the BSP + */ + status = CFE_PSP_GetResetArea(&ResetDataAddr, &resetAreaSize); + + /* + ** Make sure the status is OK or size is big enough + */ + if (status != CFE_PSP_SUCCESS) + { + /* + ** Cannot use the ES System log without the Reset Area + */ + OS_printf("ES Startup: CFE_PSP_GetResetArea call Failed (0x%08x)!\n", (unsigned int)status); + + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); + + /* + * Normally unreachable, except in UT where + * CFE_PSP_Panic is a stub that may return + */ + return; + } + else if (resetAreaSize < sizeof(CFE_ES_ResetData_t)) + { + /* + ** Cannot use the ES system log without the Reset Area + */ + OS_printf("ES Startup: Error: ES Reset area not big enough. Needed: %d, Given: %d.\n", + (int)sizeof(CFE_ES_ResetData_t), (int)resetAreaSize); + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); + + /* + * Normally unreachable, except in UT where + * CFE_PSP_Panic is a stub that may return */ - if ( CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount > - CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount ) - { - if ( StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND ) - { - CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND; - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to max proc resets (HW Spec Cmd).\n"); - - /* - ** Log the reset in the ER Log. The log will be wiped out, but it's good to have - ** the entry just in case something fails. - */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, - "POWER ON RESET due to max proc resets (HW Spec Cmd)."); - } - else - { - CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; - CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to max proc resets (Watchdog).\n"); - - /* - ** Log the reset in the ER Log. The log will be wiped out, but it's good to have - ** the entry just in case something fails. - */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, - "POWER ON RESET due to max proc resets (Watchdog)."); - } - /* - ** Call the BSP reset routine - */ - CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); - - /* - ** Should not return here. - */ - CFE_ES_SysLogWrite_Unsync("ES Startup: Error: CFE_PSP_Restart returned.\n"); - - } - else /* Maximum processor reset not exceeded */ - { - if ( StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND ) - { - CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND; - CFE_ES_SysLogWrite_Unsync("PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n"); + return; + } + + CFE_ES_ResetDataPtr = (CFE_ES_ResetData_t *)ResetDataAddr; + + /* + ** Record the BootSource (bank) so it will be valid in the ER log entries. + */ + CFE_ES_ResetDataPtr->ResetVars.BootSource = BootSource; + + /* + ** Determine how the system was started. The choices are: + ** CFE_ES_POWER_ON_RESET, or CFE_PSP_RST_TYPE_PROCESSOR + ** The subtypes include: + ** CFE_PSP_RST_SUBTYPE_POWER_CYCLE, CFE_PSP_RST_SUBTYPE_PUSH_BUTTON, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, + ** CFE_PSP_RST_SUBTYPE_HW_WATCHDOG, CFE_PSP_RST_TYPE_COMMAND, or CFE_PSP_RST_SUBTYPE_EXCEPTION. + ** Some of these reset types are logged before the system is restarted. + ** ( CFE_PSP_RST_TYPE_COMMAND, CFE_PSP_RST_SUBTYPE_EXCEPTION ) while others occur + ** without the knowledge of the software and must be logged here. + */ + if (StartType == CFE_PSP_RST_TYPE_POWERON) + { + /* + ** Record the reset type and subtype + */ + CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = StartSubtype; + CFE_ES_ResetDataPtr->ResetVars.ResetType = CFE_PSP_RST_TYPE_POWERON; + + /* + ** Log the power-on reset. + */ + if (StartSubtype == CFE_PSP_RST_SUBTYPE_POWER_CYCLE) + { + CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to Power Cycle (Power Cycle).\n"); + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, + "POWER ON RESET due to Power Cycle (Power Cycle)"); + } + else if (StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND) + { + CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to HW Special Cmd (Hw Spec Cmd).\n"); + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, + "POWER ON RESET due to HW Special Cmd (Hw Spec Cmd)"); + } + else + { + CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to other cause (See Subtype).\n"); + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, + "POWER ON RESET due to other cause (See Subtype)"); + } + + /* + ** Initialize all reset counters. + */ + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = 0; + CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount = CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS; + CFE_ES_Global.DebugVars.DebugFlag = 0; + } + else if (StartType == CFE_PSP_RST_TYPE_PROCESSOR) + { + /* + ** If a Processor reset was not commanded, it must be a watchdog or other non-commanded reset + ** Log the reset before updating any reset variables. + */ + if (CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset != true) + { + CFE_ES_ResetDataPtr->ResetVars.ResetType = CFE_PSP_RST_TYPE_PROCESSOR; + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount++; + + /* + ** When coming up from a Processor reset that was not caused by ES, check to see + ** if the maximum number has been exceeded + */ + if (CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount > + CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount) + { + if (StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND) + { + CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND; + CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to max proc resets (HW Spec Cmd).\n"); + + /* + ** Log the reset in the ER Log. The log will be wiped out, but it's good to have + ** the entry just in case something fails. + */ + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, + "POWER ON RESET due to max proc resets (HW Spec Cmd)."); + } + else + { + CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; + CFE_ES_SysLogWrite_Unsync("POWER ON RESET due to max proc resets (Watchdog).\n"); + /* + ** Log the reset in the ER Log. The log will be wiped out, but it's good to have + ** the entry just in case something fails. + */ + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, StartSubtype, + "POWER ON RESET due to max proc resets (Watchdog)."); + } /* - ** Log the watchdog reset + ** Call the BSP reset routine */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, StartSubtype, - "PROCESSOR RESET due to Hardware Special Command (Hw Spec Cmd)."); - - } - else - { - CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; - CFE_ES_SysLogWrite_Unsync("PROCESSOR RESET due to Watchdog (Watchdog).\n"); + CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); /* - ** Log the watchdog reset + ** Should not return here. */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, StartSubtype, - "PROCESSOR RESET due to Watchdog (Watchdog)."); - - } - - } /* end if */ - - } - /* - ** If a processor reset is due to a command or exception, the reset has already been logged. - ** Update the reset variables only. - ** The logic for detecting maximum resets is done on the command/exception side - ** on the "way down" when the command or exception handler is executed. - */ - else - { - CFE_ES_ResetDataPtr->ResetVars.ResetType = CFE_PSP_RST_TYPE_PROCESSOR; - CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = StartSubtype; - } - - /* - ** Initialize processor reset counters. - */ - CFE_ES_Global.DebugVars.DebugFlag = 0; - } - - /* - ** Clear the commanded reset flag, in case a watchdog happens. - */ - CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = false; - + CFE_ES_SysLogWrite_Unsync("ES Startup: Error: CFE_PSP_Restart returned.\n"); + } + else /* Maximum processor reset not exceeded */ + { + if (StartSubtype == CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND) + { + CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND; + CFE_ES_SysLogWrite_Unsync("PROCESSOR RESET due to Hardware Special Command (HW Spec Cmd).\n"); + + /* + ** Log the watchdog reset + */ + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, StartSubtype, + "PROCESSOR RESET due to Hardware Special Command (Hw Spec Cmd)."); + } + else + { + CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = CFE_PSP_RST_SUBTYPE_HW_WATCHDOG; + CFE_ES_SysLogWrite_Unsync("PROCESSOR RESET due to Watchdog (Watchdog).\n"); + + /* + ** Log the watchdog reset + */ + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, StartSubtype, + "PROCESSOR RESET due to Watchdog (Watchdog)."); + } + + } /* end if */ + } + /* + ** If a processor reset is due to a command or exception, the reset has already been logged. + ** Update the reset variables only. + ** The logic for detecting maximum resets is done on the command/exception side + ** on the "way down" when the command or exception handler is executed. + */ + else + { + CFE_ES_ResetDataPtr->ResetVars.ResetType = CFE_PSP_RST_TYPE_PROCESSOR; + CFE_ES_ResetDataPtr->ResetVars.ResetSubtype = StartSubtype; + } + + /* + ** Initialize processor reset counters. + */ + CFE_ES_Global.DebugVars.DebugFlag = 0; + } + + /* + ** Clear the commanded reset flag, in case a watchdog happens. + */ + CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = false; } /* @@ -486,237 +474,242 @@ void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 Bo */ void CFE_ES_InitializeFileSystems(uint32 StartType) { - int32 RetStatus; - cpuaddr RamDiskMemoryAddress; - uint32 RamDiskMemorySize; - int32 PercentFree; - OS_statvfs_t StatBuf; - - /* - ** Get the memory area for the RAM disk - */ - RetStatus = CFE_PSP_GetVolatileDiskMem(&(RamDiskMemoryAddress), &(RamDiskMemorySize)); - - if ( RetStatus != CFE_PSP_SUCCESS ) - { - CFE_ES_WriteToSysLog("ES Startup: Cannot Get Memory for Volatile Disk. EC = 0x%08X\n",(unsigned int)RetStatus); - - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - - } - - /* - ** Next, either format, or just initialize the RAM disk depending on - ** the reset type - */ - if ( StartType == CFE_PSP_RST_TYPE_POWERON ) - { - RetStatus = OS_mkfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS ); - if ( RetStatus != OS_SUCCESS ) - { - CFE_ES_WriteToSysLog("ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); - - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - } - } - else - { - RetStatus = OS_initfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS ); - if ( RetStatus != OS_SUCCESS ) - { - CFE_ES_WriteToSysLog("ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); - CFE_ES_WriteToSysLog("ES Startup: Formatting Volatile(RAM) Volume.\n"); - - RetStatus = OS_mkfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS ); - if ( RetStatus != OS_SUCCESS ) - { - CFE_ES_WriteToSysLog("ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); + int32 RetStatus; + cpuaddr RamDiskMemoryAddress; + uint32 RamDiskMemorySize; + int32 PercentFree; + OS_statvfs_t StatBuf; + + /* + ** Get the memory area for the RAM disk + */ + RetStatus = CFE_PSP_GetVolatileDiskMem(&(RamDiskMemoryAddress), &(RamDiskMemorySize)); + + if (RetStatus != CFE_PSP_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Cannot Get Memory for Volatile Disk. EC = 0x%08X\n", (unsigned int)RetStatus); + + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); + } + + /* + ** Next, either format, or just initialize the RAM disk depending on + ** the reset type + */ + if (StartType == CFE_PSP_RST_TYPE_POWERON) + { + RetStatus = OS_mkfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, + CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS); + if (RetStatus != OS_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); /* ** Delay to allow the message to be read */ OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. + + /* + ** cFE Cannot continue to start up. */ CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - } - - } - } - - /* - ** Now, mount the RAM disk - */ - RetStatus = OS_mount("/ramdev0", CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); - if ( RetStatus != OS_SUCCESS ) - { - CFE_ES_WriteToSysLog("ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - } - - - /* - ** During a Processor reset, if the RAM disk has less than a defined - ** amount of free space, reformat and re-mount it. - ** The parameter being checked is CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED - ** Note: When CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED is set to 0, this feature is - ** disabled. - */ - if ((StartType == CFE_PSP_RST_TYPE_PROCESSOR) && (CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED > 0)) - { - /* - ** See how many blocks are free in the RAM disk - */ - RetStatus = OS_FileSysStatVolume(CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING, &StatBuf); - if ( RetStatus == OS_SUCCESS && StatBuf.total_blocks > 0 ) - { - /* - ** Determine if the disk is too full - */ - PercentFree = (StatBuf.blocks_free * 100) / StatBuf.total_blocks; - CFE_ES_WriteToSysLog("Volatile Disk has %d Percent free space.\n",(int)PercentFree); + } + } + else + { + RetStatus = OS_initfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, + CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS); + if (RetStatus != OS_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Error Initializing Volatile(RAM) Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); + CFE_ES_WriteToSysLog("ES Startup: Formatting Volatile(RAM) Volume.\n"); + + RetStatus = OS_mkfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, + CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS); + if (RetStatus != OS_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Error Creating Volatile(RAM) Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); + + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); + } + } + } + + /* + ** Now, mount the RAM disk + */ + RetStatus = OS_mount("/ramdev0", CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); + if (RetStatus != OS_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Error Mounting Volatile(RAM) Volume. EC = 0x%08X\n", (unsigned int)RetStatus); + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); - if ( PercentFree < CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED ) - { - CFE_ES_WriteToSysLog("ES Startup: Insufficent Free Space on Volatile Disk, Reformatting.\n"); - + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); + } + + /* + ** During a Processor reset, if the RAM disk has less than a defined + ** amount of free space, reformat and re-mount it. + ** The parameter being checked is CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED + ** Note: When CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED is set to 0, this feature is + ** disabled. + */ + if ((StartType == CFE_PSP_RST_TYPE_PROCESSOR) && (CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED > 0)) + { + /* + ** See how many blocks are free in the RAM disk + */ + RetStatus = OS_FileSysStatVolume(CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING, &StatBuf); + if (RetStatus == OS_SUCCESS && StatBuf.total_blocks > 0) + { /* - ** First, unmount the disk + ** Determine if the disk is too full */ - RetStatus = OS_unmount(CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); - if ( RetStatus == OS_SUCCESS ) + PercentFree = (StatBuf.blocks_free * 100) / StatBuf.total_blocks; + CFE_ES_WriteToSysLog("Volatile Disk has %d Percent free space.\n", (int)PercentFree); + + if (PercentFree < CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED) { + CFE_ES_WriteToSysLog("ES Startup: Insufficent Free Space on Volatile Disk, Reformatting.\n"); - /* - ** Remove the file system from the OSAL - */ - RetStatus = OS_rmfs("/ramdev0"); - if ( RetStatus == OS_SUCCESS ) - { - - /* - ** Next, make a new file system on the disk - */ - RetStatus = OS_mkfs((void *)RamDiskMemoryAddress, "/ramdev0", - "RAM", CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, - CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS ); - if ( RetStatus == OS_SUCCESS ) - { - /* - ** Last, remount the disk - */ - RetStatus = OS_mount("/ramdev0", CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); - if ( RetStatus != OS_SUCCESS ) - { - CFE_ES_WriteToSysLog("ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); + /* + ** First, unmount the disk + */ + RetStatus = OS_unmount(CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); + if (RetStatus == OS_SUCCESS) + { + + /* + ** Remove the file system from the OSAL + */ + RetStatus = OS_rmfs("/ramdev0"); + if (RetStatus == OS_SUCCESS) + { + + /* + ** Next, make a new file system on the disk + */ + RetStatus = OS_mkfs((void *)RamDiskMemoryAddress, "/ramdev0", "RAM", + CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE, CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS); + if (RetStatus == OS_SUCCESS) + { + /* + ** Last, remount the disk + */ + RetStatus = OS_mount("/ramdev0", CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING); + if (RetStatus != OS_SUCCESS) + { + CFE_ES_WriteToSysLog( + "ES Startup: Error Re-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); + + } /* end if mount */ + } + else + { + + CFE_ES_WriteToSysLog("ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); + + } /* end if mkfs */ + } + else /* could not Remove File system */ + { + + CFE_ES_WriteToSysLog("ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); /* ** Delay to allow the message to be read */ OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. + + /* + ** cFE Cannot continue to start up. */ CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - - } /* end if mount */ - } - else - { - - CFE_ES_WriteToSysLog("ES Startup: Error Re-Formating Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - - } /* end if mkfs */ - - } - else /* could not Remove File system */ - { - - CFE_ES_WriteToSysLog("ES Startup: Error Removing Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - - } /* end if OS_rmfs */ - } - else /* could not un-mount disk */ - { - CFE_ES_WriteToSysLog("ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n",(unsigned int)RetStatus); - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - } - - } /* end if enough free space */ - - } - else /* could not determine free blocks */ - { - /* Log error message -- note that BlocksFree returns the error code in this case */ - CFE_ES_WriteToSysLog("ES Startup: Error Determining Blocks Free on Volume. EC = 0x%08X\n",(unsigned int)RetStatus); - - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); + } /* end if OS_rmfs */ + } + else /* could not un-mount disk */ + { + CFE_ES_WriteToSysLog("ES Startup: Error Un-Mounting Volatile(RAM) Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); + } + + } /* end if enough free space */ + } + else /* could not determine free blocks */ + { + /* Log error message -- note that BlocksFree returns the error code in this case */ + CFE_ES_WriteToSysLog("ES Startup: Error Determining Blocks Free on Volume. EC = 0x%08X\n", + (unsigned int)RetStatus); + + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); + + } /* end if BlocksFree */ + + } /* end if processor reset */ - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_VOLATILE_DISK); - - } /* end if BlocksFree */ - - } /* end if processor reset */ - } /* end function */ /*------------------------------------------------------------------------- @@ -729,170 +722,168 @@ void CFE_ES_InitializeFileSystems(uint32 StartType) ** application layer initialization. **---------------------------------------------------------------------------- */ -void CFE_ES_CreateObjects(void) +void CFE_ES_CreateObjects(void) { - int32 ReturnCode; - uint16 i; + int32 ReturnCode; + uint16 i; CFE_ES_AppRecord_t *AppRecPtr; - CFE_ResourceId_t PendingAppId; + CFE_ResourceId_t PendingAppId; CFE_ES_WriteToSysLog("ES Startup: Starting Object Creation calls.\n"); - for ( i = 0; i < CFE_PLATFORM_ES_OBJECT_TABLE_SIZE; i++ ) + for (i = 0; i < CFE_PLATFORM_ES_OBJECT_TABLE_SIZE; i++) { - switch ( CFE_ES_ObjectTable[i].ObjectType ) + switch (CFE_ES_ObjectTable[i].ObjectType) { case CFE_ES_DRIVER_TASK: case CFE_ES_CORE_TASK: - /* - ** Allocate an ES AppTable entry - */ - CFE_ES_LockSharedData(__func__,__LINE__); - - PendingAppId = CFE_ResourceId_FindNext(CFE_ES_Global.LastAppId, CFE_PLATFORM_ES_MAX_APPLICATIONS, CFE_ES_CheckAppIdSlotUsed); - AppRecPtr = CFE_ES_LocateAppRecordByID(CFE_ES_APPID_C(PendingAppId)); - if (AppRecPtr != NULL) - { /* - ** Fill out the parameters in the AppStartParams sub-structure + ** Allocate an ES AppTable entry */ - AppRecPtr->Type = CFE_ES_AppType_CORE; - - strncpy(AppRecPtr->AppName, CFE_ES_ObjectTable[i].ObjectName, - sizeof(AppRecPtr->AppName)-1); - AppRecPtr->AppName[sizeof(AppRecPtr->AppName)-1] = '\0'; + CFE_ES_LockSharedData(__func__, __LINE__); - /* FileName and EntryPoint is not valid for core apps */ - AppRecPtr->StartParams.MainTaskInfo.StackSize = CFE_ES_ObjectTable[i].ObjectSize; - AppRecPtr->StartParams.MainTaskInfo.Priority = CFE_ES_ObjectTable[i].ObjectPriority; - AppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_PROC_RESTART; + PendingAppId = CFE_ResourceId_FindNext(CFE_ES_Global.LastAppId, CFE_PLATFORM_ES_MAX_APPLICATIONS, + CFE_ES_CheckAppIdSlotUsed); + AppRecPtr = CFE_ES_LocateAppRecordByID(CFE_ES_APPID_C(PendingAppId)); + if (AppRecPtr != NULL) + { + /* + ** Fill out the parameters in the AppStartParams sub-structure + */ + AppRecPtr->Type = CFE_ES_AppType_CORE; - /* - ** Fill out the Task State info - */ - AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - AppRecPtr->ControlReq.AppTimerMsec = 0; + strncpy(AppRecPtr->AppName, CFE_ES_ObjectTable[i].ObjectName, sizeof(AppRecPtr->AppName) - 1); + AppRecPtr->AppName[sizeof(AppRecPtr->AppName) - 1] = '\0'; - CFE_ES_AppRecordSetUsed(AppRecPtr, CFE_RESOURCEID_RESERVED); - CFE_ES_Global.LastAppId = PendingAppId; - } + /* FileName and EntryPoint is not valid for core apps */ + AppRecPtr->StartParams.MainTaskInfo.StackSize = CFE_ES_ObjectTable[i].ObjectSize; + AppRecPtr->StartParams.MainTaskInfo.Priority = CFE_ES_ObjectTable[i].ObjectPriority; + AppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_PROC_RESTART; - CFE_ES_UnlockSharedData(__func__,__LINE__); + /* + ** Fill out the Task State info + */ + AppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; + AppRecPtr->ControlReq.AppTimerMsec = 0; - /* - ** If a slot was found, create the application - */ - if (AppRecPtr != NULL) - { - /* - ** Start the core app main task - ** (core apps are already in memory - no loading needed) - */ - ReturnCode = CFE_ES_StartAppTask(&AppRecPtr->MainTaskId, - AppRecPtr->AppName, - CFE_ES_ObjectTable[i].FuncPtrUnion.MainTaskPtr, - &AppRecPtr->StartParams.MainTaskInfo, - CFE_ES_APPID_C(PendingAppId)); + CFE_ES_AppRecordSetUsed(AppRecPtr, CFE_RESOURCEID_RESERVED); + CFE_ES_Global.LastAppId = PendingAppId; + } - /* - * Finalize data in the app table entry, which must be done under lock. - * This transitions the entry from being RESERVED to the real type, - * either MAIN_TASK (success) or returning to INVALID (failure). - */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); - if ( ReturnCode == OS_SUCCESS ) + /* + ** If a slot was found, create the application + */ + if (AppRecPtr != NULL) { - CFE_ES_AppRecordSetUsed(AppRecPtr, PendingAppId); - /* - ** Increment the Core App counter. + ** Start the core app main task + ** (core apps are already in memory - no loading needed) */ - CFE_ES_Global.RegisteredCoreApps++; - ReturnCode = CFE_SUCCESS; + ReturnCode = CFE_ES_StartAppTask( + &AppRecPtr->MainTaskId, AppRecPtr->AppName, CFE_ES_ObjectTable[i].FuncPtrUnion.MainTaskPtr, + &AppRecPtr->StartParams.MainTaskInfo, CFE_ES_APPID_C(PendingAppId)); + + /* + * Finalize data in the app table entry, which must be done under lock. + * This transitions the entry from being RESERVED to the real type, + * either MAIN_TASK (success) or returning to INVALID (failure). + */ + CFE_ES_LockSharedData(__func__, __LINE__); + + if (ReturnCode == OS_SUCCESS) + { + CFE_ES_AppRecordSetUsed(AppRecPtr, PendingAppId); + + /* + ** Increment the Core App counter. + */ + CFE_ES_Global.RegisteredCoreApps++; + ReturnCode = CFE_SUCCESS; + } + else + { + /* failure mode - just clear the whole app table entry. + * This will set the AppType back to CFE_ES_ResourceType_INVALID (0), + * as well as clearing any other data that had been written */ + memset(AppRecPtr, 0, sizeof(*AppRecPtr)); + } + + CFE_ES_UnlockSharedData(__func__, __LINE__); } else { - /* failure mode - just clear the whole app table entry. - * This will set the AppType back to CFE_ES_ResourceType_INVALID (0), - * as well as clearing any other data that had been written */ - memset(AppRecPtr, 0, sizeof(*AppRecPtr)); + /* appSlot not found -- This should never happen!*/ + CFE_ES_WriteToSysLog("ES Startup: Error, No free application slots available for CORE App!\n"); + ReturnCode = CFE_ES_ERR_APP_CREATE; } - CFE_ES_UnlockSharedData(__func__,__LINE__); - } - else - { - /* appSlot not found -- This should never happen!*/ - CFE_ES_WriteToSysLog("ES Startup: Error, No free application slots available for CORE App!\n"); - ReturnCode = CFE_ES_ERR_APP_CREATE; - } - - if ( ReturnCode == CFE_SUCCESS ) - { - /* - * CFE_ES_MainTaskSyncDelay() will delay this thread until the - * newly-started thread calls CFE_ES_WaitForSystemState() - */ - ReturnCode = CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_RUNNING, CFE_PLATFORM_CORE_MAX_STARTUP_MSEC*1000); - } + if (ReturnCode == CFE_SUCCESS) + { + /* + * CFE_ES_MainTaskSyncDelay() will delay this thread until the + * newly-started thread calls CFE_ES_WaitForSystemState() + */ + ReturnCode = + CFE_ES_MainTaskSyncDelay(CFE_ES_AppState_RUNNING, CFE_PLATFORM_CORE_MAX_STARTUP_MSEC * 1000); + } - if ( ReturnCode != CFE_SUCCESS ) - { - CFE_ES_WriteToSysLog("ES Startup: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", - CFE_ES_ObjectTable[i].ObjectName, (unsigned int)ReturnCode); + if (ReturnCode != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: OS_TaskCreate error creating core App: %s: EC = 0x%08X\n", + CFE_ES_ObjectTable[i].ObjectName, (unsigned int)ReturnCode); - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_CORE_APP); - } - break; + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_CORE_APP); + } + break; case CFE_ES_FUNCTION_CALL: /*----------------------------------------------------------*/ - if ( CFE_ES_ObjectTable[i].FuncPtrUnion.FunctionPtr != NULL ) - { - CFE_ES_WriteToSysLog("ES Startup: Calling %s\n",CFE_ES_ObjectTable[i].ObjectName); - /* - ** Call the function - */ - ReturnCode = (*CFE_ES_ObjectTable[i].FuncPtrUnion.FunctionPtr)(); - if(ReturnCode != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("ES Startup: Error returned when calling function: %s: EC = 0x%08X\n", - CFE_ES_ObjectTable[i].ObjectName, (unsigned int)ReturnCode); - - /* - ** Delay to allow the message to be read - */ - OS_TaskDelay(CFE_ES_PANIC_DELAY); - - /* - ** cFE Cannot continue to start up. - */ - CFE_PSP_Panic(CFE_PSP_PANIC_CORE_APP); - - } /* end if */ - - } - else - { - CFE_ES_WriteToSysLog("ES Startup: bad function pointer ( table entry = %d).\n",i); - } - break; + if (CFE_ES_ObjectTable[i].FuncPtrUnion.FunctionPtr != NULL) + { + CFE_ES_WriteToSysLog("ES Startup: Calling %s\n", CFE_ES_ObjectTable[i].ObjectName); + /* + ** Call the function + */ + ReturnCode = (*CFE_ES_ObjectTable[i].FuncPtrUnion.FunctionPtr)(); + if (ReturnCode != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("ES Startup: Error returned when calling function: %s: EC = 0x%08X\n", + CFE_ES_ObjectTable[i].ObjectName, (unsigned int)ReturnCode); + + /* + ** Delay to allow the message to be read + */ + OS_TaskDelay(CFE_ES_PANIC_DELAY); + + /* + ** cFE Cannot continue to start up. + */ + CFE_PSP_Panic(CFE_PSP_PANIC_CORE_APP); + + } /* end if */ + } + else + { + CFE_ES_WriteToSysLog("ES Startup: bad function pointer ( table entry = %d).\n", i); + } + break; case CFE_ES_NULL_ENTRY: /*-------------------------------------------------------*/ - break; + break; default: - break; - } /* end switch */ + break; + } /* end switch */ } /* end for */ @@ -908,14 +899,14 @@ void CFE_ES_CreateObjects(void) */ int32 CFE_ES_MainTaskSyncDelay(uint32 AppStateId, uint32 TimeOutMilliseconds) { - int32 Status; - uint32 i; - uint32 WaitTime; - uint32 WaitRemaining; - uint32 AppNotReadyCounter; + int32 Status; + uint32 i; + uint32 WaitTime; + uint32 WaitRemaining; + uint32 AppNotReadyCounter; CFE_ES_AppRecord_t *AppRecPtr; - Status = CFE_ES_OPERATION_TIMED_OUT; + Status = CFE_ES_OPERATION_TIMED_OUT; WaitRemaining = TimeOutMilliseconds; while (true) { @@ -924,18 +915,17 @@ int32 CFE_ES_MainTaskSyncDelay(uint32 AppStateId, uint32 TimeOutMilliseconds) /* * Count the number of apps that are NOT in (at least) in the state requested */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); AppRecPtr = CFE_ES_Global.AppTable; - for ( i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++ ) + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) { - if ( CFE_ES_AppRecordIsUsed(AppRecPtr) && - (AppRecPtr->AppState < AppStateId)) - { - ++AppNotReadyCounter; - } - ++AppRecPtr; + if (CFE_ES_AppRecordIsUsed(AppRecPtr) && (AppRecPtr->AppState < AppStateId)) + { + ++AppNotReadyCounter; + } + ++AppRecPtr; } - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); if (AppNotReadyCounter == 0) { diff --git a/modules/es/fsw/src/cfe_es_start.h b/modules/es/fsw/src/cfe_es_start.h index 0fa233a78..6df8e3295 100644 --- a/modules/es/fsw/src/cfe_es_start.h +++ b/modules/es/fsw/src/cfe_es_start.h @@ -20,7 +20,7 @@ /* ** -** File: +** File: ** cfe_es_start.h ** ** Purpose: @@ -47,8 +47,8 @@ ** Macro Definitions */ -/* -** values of object_type in OS object table +/* +** values of object_type in OS object table */ #define CFE_ES_NULL_ENTRY 0x00 #define CFE_ES_CORE_TASK 0x01 @@ -65,34 +65,33 @@ typedef int32 (*CFE_ES_EarlyInitFuncPtr_t)(void); /**< \brief Req'd prototype of typedef union { - CFE_ES_EarlyInitFuncPtr_t FunctionPtr; - CFE_ES_TaskEntryFuncPtr_t MainTaskPtr; - void *VoidPtr; + CFE_ES_EarlyInitFuncPtr_t FunctionPtr; + CFE_ES_TaskEntryFuncPtr_t MainTaskPtr; + void * VoidPtr; } CFE_ES_FuncPtrUnion_t; -typedef struct +typedef struct { - uint32 ObjectType; /* The type of object being created */ - char ObjectName[OS_MAX_API_NAME]; /* task or OS object name */ - CFE_ES_FuncPtrUnion_t FuncPtrUnion; /* task or function reference */ - uint32 ObjectPriority; /* object priority */ - uint32 ObjectSize; /* size used for stack, queue size, etc. */ - uint32 ObjectFlags; /* extra flags to pass */ + uint32 ObjectType; /* The type of object being created */ + char ObjectName[OS_MAX_API_NAME]; /* task or OS object name */ + CFE_ES_FuncPtrUnion_t FuncPtrUnion; /* task or function reference */ + uint32 ObjectPriority; /* object priority */ + uint32 ObjectSize; /* size used for stack, queue size, etc. */ + uint32 ObjectFlags; /* extra flags to pass */ } CFE_ES_ObjectTable_t; /* ** Exported data */ -extern CFE_ES_ObjectTable_t CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE]; /* es object table */ +extern CFE_ES_ObjectTable_t CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE]; /* es object table */ /* ** Function prototypes */ -extern void CFE_ES_CreateObjects(void); -extern void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 BootSource); -extern void CFE_ES_InitializeFileSystems(uint32 StartType); +extern void CFE_ES_CreateObjects(void); +extern void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 BootSource); +extern void CFE_ES_InitializeFileSystems(uint32 StartType); extern void CFE_ES_SetupPerfVariables(uint32 ResetType); - -#endif /* _cfe_es_start_ */ +#endif /* _cfe_es_start_ */ diff --git a/modules/es/fsw/src/cfe_es_syslog.c b/modules/es/fsw/src/cfe_es_syslog.c index 8502e60e7..61db46384 100644 --- a/modules/es/fsw/src/cfe_es_syslog.c +++ b/modules/es/fsw/src/cfe_es_syslog.c @@ -19,10 +19,10 @@ */ /* -** File: +** File: ** cfe_es_syslog.c ** -** Purpose: +** Purpose: ** This file implements the cFE Executive Services System Log functions. ** ** References: @@ -58,9 +58,6 @@ #include #include - - - /******************************************************************* * * Non-synchronized helper functions @@ -74,7 +71,6 @@ * *******************************************************************/ - /* * ----------------------------------------------------------------- * CFE_ES_SysLogClear -- @@ -89,7 +85,7 @@ void CFE_ES_SysLogClear_Unsync(void) */ CFE_ES_ResetDataPtr->SystemLogWriteIdx = 0; - CFE_ES_ResetDataPtr->SystemLogEndIdx = 0; + CFE_ES_ResetDataPtr->SystemLogEndIdx = 0; CFE_ES_ResetDataPtr->SystemLogEntryNum = 0; } /* End of CFE_ES_SysLogClear_Unsync() */ @@ -106,8 +102,8 @@ void CFE_ES_SysLogReadStart_Unsync(CFE_ES_SysLogReadBuffer_t *Buffer) size_t EndIdx; size_t TotalSize; - ReadIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; - EndIdx = CFE_ES_ResetDataPtr->SystemLogEndIdx; + ReadIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; + EndIdx = CFE_ES_ResetDataPtr->SystemLogEndIdx; TotalSize = EndIdx; /* @@ -118,16 +114,16 @@ void CFE_ES_SysLogReadStart_Unsync(CFE_ES_SysLogReadBuffer_t *Buffer) { ++ReadIdx; --TotalSize; - if (CFE_ES_ResetDataPtr->SystemLog[ReadIdx-1] == '\n') + if (CFE_ES_ResetDataPtr->SystemLog[ReadIdx - 1] == '\n') { break; } } - Buffer->SizeLeft = TotalSize; + Buffer->SizeLeft = TotalSize; Buffer->LastOffset = ReadIdx; - Buffer->EndIdx = EndIdx; - Buffer->BlockSize = 0; + Buffer->EndIdx = EndIdx; + Buffer->BlockSize = 0; } /* End of CFE_ES_SysLogReadStart_Unsync() */ /* @@ -138,7 +134,7 @@ void CFE_ES_SysLogReadStart_Unsync(CFE_ES_SysLogReadBuffer_t *Buffer) */ int32 CFE_ES_SysLogAppend_Unsync(const char *LogString) { - int32 ReturnCode; + int32 ReturnCode; size_t MessageLen; size_t WriteIdx; size_t EndIdx; @@ -149,7 +145,7 @@ int32 CFE_ES_SysLogAppend_Unsync(const char *LogString) * (even this may be overly generous) */ MessageLen = strlen(LogString); - if ( MessageLen > (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) ) + if (MessageLen > (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2)) { MessageLen = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2; ReturnCode = CFE_ES_ERR_SYS_LOG_TRUNCATED; @@ -180,7 +176,7 @@ int32 CFE_ES_SysLogAppend_Unsync(const char *LogString) * since CFE_ES_ResetDataPtr may point directly into a slower NVRAM space. */ WriteIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; - EndIdx = CFE_ES_ResetDataPtr->SystemLogEndIdx; + EndIdx = CFE_ES_ResetDataPtr->SystemLogEndIdx; /* * Check if the log message plus will fit between @@ -191,12 +187,12 @@ int32 CFE_ES_SysLogAppend_Unsync(const char *LogString) * If not, then the action depends on the setting of "SystemLogMode" which will be * to either discard (default) or overwrite */ - if ( (WriteIdx + MessageLen) > CFE_PLATFORM_ES_SYSTEM_LOG_SIZE ) + if ((WriteIdx + MessageLen) > CFE_PLATFORM_ES_SYSTEM_LOG_SIZE) { - if ( CFE_ES_ResetDataPtr->SystemLogMode == CFE_ES_LogMode_OVERWRITE ) + if (CFE_ES_ResetDataPtr->SystemLogMode == CFE_ES_LogMode_OVERWRITE) { /* In "overwrite" mode, start back at the beginning of the buffer */ - EndIdx = WriteIdx; + EndIdx = WriteIdx; WriteIdx = 0; } else if (WriteIdx < (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - CFE_TIME_PRINTED_STRING_SIZE)) @@ -245,7 +241,7 @@ int32 CFE_ES_SysLogAppend_Unsync(const char *LogString) * Export updated index values to the reset area for next time. */ CFE_ES_ResetDataPtr->SystemLogWriteIdx = WriteIdx; - CFE_ES_ResetDataPtr->SystemLogEndIdx = EndIdx; + CFE_ES_ResetDataPtr->SystemLogEndIdx = EndIdx; ++CFE_ES_ResetDataPtr->SystemLogEntryNum; } @@ -262,15 +258,15 @@ int32 CFE_ES_SysLogAppend_Unsync(const char *LogString) */ int32 CFE_ES_SysLogWrite_Unsync(const char *SpecStringPtr, ...) { - char TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE]; - va_list ArgPtr; + char TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE]; + va_list ArgPtr; va_start(ArgPtr, SpecStringPtr); CFE_ES_SysLog_vsnprintf(TmpString, sizeof(TmpString), SpecStringPtr, ArgPtr); va_end(ArgPtr); /* Output the entry to the console */ - OS_printf("%s",TmpString); + OS_printf("%s", TmpString); /* * Append to the syslog buffer @@ -278,7 +274,6 @@ int32 CFE_ES_SysLogWrite_Unsync(const char *SpecStringPtr, ...) return CFE_ES_SysLogAppend_Unsync(TmpString); } /* End of CFE_ES_SysLogWrite_Unsync() */ - /******************************************************************* * * Additional helper functions @@ -288,7 +283,6 @@ int32 CFE_ES_SysLogWrite_Unsync(const char *SpecStringPtr, ...) * *******************************************************************/ - /* * ----------------------------------------------------------------- * CFE_ES_SysLogReadData -- @@ -329,9 +323,7 @@ void CFE_ES_SysLogReadData(CFE_ES_SysLogReadBuffer_t *Buffer) break; } - memcpy(&Buffer->Data[Buffer->BlockSize], - &CFE_ES_ResetDataPtr->SystemLog[Buffer->LastOffset], - BlockSize); + memcpy(&Buffer->Data[Buffer->BlockSize], &CFE_ES_ResetDataPtr->SystemLog[Buffer->LastOffset], BlockSize); Buffer->BlockSize += BlockSize; Buffer->LastOffset += BlockSize; @@ -349,10 +341,10 @@ int32 CFE_ES_SysLogSetMode(CFE_ES_LogMode_Enum_t Mode) { int32 Status; - if((Mode == CFE_ES_LogMode_OVERWRITE) || (Mode == CFE_ES_LogMode_DISCARD)) + if ((Mode == CFE_ES_LogMode_OVERWRITE) || (Mode == CFE_ES_LogMode_DISCARD)) { CFE_ES_ResetDataPtr->SystemLogMode = Mode; - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; } else { @@ -373,7 +365,7 @@ void CFE_ES_SysLog_vsnprintf(char *Buffer, size_t BufferSize, const char *SpecSt { size_t StringLen; size_t MaxLen; - int PrintLen; + int PrintLen; /* * write the current time into the TmpString buffer @@ -425,7 +417,7 @@ void CFE_ES_SysLog_vsnprintf(char *Buffer, size_t BufferSize, const char *SpecSt * * Strip off all trailing whitespace, and add back a single newline */ - while (StringLen > 0 && isspace((int)Buffer[StringLen-1])) + while (StringLen > 0 && isspace((int)Buffer[StringLen - 1])) { --StringLen; } @@ -449,7 +441,7 @@ void CFE_ES_SysLog_vsnprintf(char *Buffer, size_t BufferSize, const char *SpecSt */ void CFE_ES_SysLog_snprintf(char *Buffer, size_t BufferSize, const char *SpecStringPtr, ...) { - va_list ArgPtr; + va_list ArgPtr; va_start(ArgPtr, SpecStringPtr); CFE_ES_SysLog_vsnprintf(Buffer, BufferSize, SpecStringPtr, ArgPtr); @@ -464,32 +456,31 @@ void CFE_ES_SysLog_snprintf(char *Buffer, size_t BufferSize, const char *SpecStr */ int32 CFE_ES_SysLogDump(const char *Filename) { - osal_id_t fd; - int32 Status; - size_t WritePos; - size_t TotalSize; - size_t LastReqSize; + osal_id_t fd; + int32 Status; + size_t WritePos; + size_t TotalSize; + size_t LastReqSize; union { CFE_ES_SysLogReadBuffer_t LogData; - CFE_FS_Header_t FileHdr; + CFE_FS_Header_t FileHdr; } Buffer; Status = OS_OpenCreate(&fd, Filename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); - if(Status < 0) + if (Status < 0) { - CFE_EVS_SendEvent(CFE_ES_SYSLOG2_ERR_EID,CFE_EVS_EventType_ERROR, - "Error creating file %s, RC = 0x%08X", - Filename,(unsigned int)Status); + CFE_EVS_SendEvent(CFE_ES_SYSLOG2_ERR_EID, CFE_EVS_EventType_ERROR, "Error creating file %s, RC = 0x%08X", + Filename, (unsigned int)Status); return CFE_ES_FILE_IO_ERR; - }/* end if */ + } /* end if */ CFE_FS_InitHeader(&Buffer.FileHdr, CFE_ES_SYS_LOG_DESC, CFE_FS_SubType_ES_SYSLOG); - TotalSize = 0; + TotalSize = 0; LastReqSize = sizeof(CFE_FS_Header_t); - Status = CFE_FS_WriteHeader(fd, &Buffer.FileHdr); - if(Status >= 0) + Status = CFE_FS_WriteHeader(fd, &Buffer.FileHdr); + if (Status >= 0) { TotalSize += Status; @@ -501,7 +492,7 @@ int32 CFE_ES_SysLogDump(const char *Filename) CFE_ES_LockSharedData(__func__, __LINE__); CFE_ES_SysLogReadStart_Unsync(&Buffer.LogData); CFE_ES_SysLogReadData(&Buffer.LogData); - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); while (Buffer.LogData.BlockSize > 0) { @@ -509,11 +500,11 @@ int32 CFE_ES_SysLogDump(const char *Filename) while (WritePos < Buffer.LogData.BlockSize) { LastReqSize = Buffer.LogData.BlockSize - WritePos; - Status = OS_write(fd, &Buffer.LogData.Data[WritePos], LastReqSize); - if(Status <= 0) + Status = OS_write(fd, &Buffer.LogData.Data[WritePos], LastReqSize); + if (Status <= 0) { break; - }/* end if */ + } /* end if */ WritePos += Status; TotalSize += Status; @@ -552,10 +543,8 @@ int32 CFE_ES_SysLogDump(const char *Filename) } else { - CFE_EVS_SendEvent(CFE_ES_SYSLOG2_EID, CFE_EVS_EventType_DEBUG, - "%s written:Size=%lu,Entries=%u",Filename, - (unsigned long)TotalSize, - (unsigned int)CFE_ES_TaskData.HkPacket.Payload.SysLogEntries); + CFE_EVS_SendEvent(CFE_ES_SYSLOG2_EID, CFE_EVS_EventType_DEBUG, "%s written:Size=%lu,Entries=%u", Filename, + (unsigned long)TotalSize, (unsigned int)CFE_ES_TaskData.HkPacket.Payload.SysLogEntries); Status = CFE_SUCCESS; } @@ -563,5 +552,4 @@ int32 CFE_ES_SysLogDump(const char *Filename) } /* End of CFE_ES_SysLogDump() */ - /* end of file */ diff --git a/modules/es/fsw/src/cfe_es_task.c b/modules/es/fsw/src/cfe_es_task.c index e29d9a796..b9154e9a2 100644 --- a/modules/es/fsw/src/cfe_es_task.c +++ b/modules/es/fsw/src/cfe_es_task.c @@ -32,7 +32,6 @@ ** */ - /* ** Includes */ @@ -46,10 +45,10 @@ /* ** Defines */ -#define CFE_ES_PERF_TRIGGERMASK_INT_SIZE (sizeof(CFE_ES_ResetDataPtr->Perf.MetaData.TriggerMask) / sizeof(uint32)) -#define CFE_ES_PERF_TRIGGERMASK_EXT_SIZE (sizeof(CFE_ES_TaskData.HkPacket.Payload.PerfTriggerMask) / sizeof(uint32)) -#define CFE_ES_PERF_FILTERMASK_INT_SIZE (sizeof(CFE_ES_ResetDataPtr->Perf.MetaData.FilterMask) / sizeof(uint32)) -#define CFE_ES_PERF_FILTERMASK_EXT_SIZE (sizeof(CFE_ES_TaskData.HkPacket.Payload.PerfFilterMask) / sizeof(uint32)) +#define CFE_ES_PERF_TRIGGERMASK_INT_SIZE (sizeof(CFE_ES_ResetDataPtr->Perf.MetaData.TriggerMask) / sizeof(uint32)) +#define CFE_ES_PERF_TRIGGERMASK_EXT_SIZE (sizeof(CFE_ES_TaskData.HkPacket.Payload.PerfTriggerMask) / sizeof(uint32)) +#define CFE_ES_PERF_FILTERMASK_INT_SIZE (sizeof(CFE_ES_ResetDataPtr->Perf.MetaData.FilterMask) / sizeof(uint32)) +#define CFE_ES_PERF_FILTERMASK_EXT_SIZE (sizeof(CFE_ES_TaskData.HkPacket.Payload.PerfFilterMask) / sizeof(uint32)) /* ** This define should be put in the OS API headers -- Right now it matches what the OS API uses @@ -82,18 +81,17 @@ void CFE_ES_TaskMain(void) ** Perform task specific initialization. */ Status = CFE_ES_TaskInit(); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { - /* - ** Create a syslog entry - */ - CFE_ES_WriteToSysLog("ES:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); - + /* + ** Create a syslog entry + */ + CFE_ES_WriteToSysLog("ES:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); - /* - ** Allow Core App to Exit - */ - AppRunStatus = CFE_ES_RunStatus_CORE_APP_INIT_ERROR; + /* + ** Allow Core App to Exit + */ + AppRunStatus = CFE_ES_RunStatus_CORE_APP_INIT_ERROR; } /* end if */ @@ -135,30 +133,30 @@ void CFE_ES_TaskMain(void) if (Status == CFE_SUCCESS) { - /* - ** Process message. - */ - CFE_ES_TaskPipe(SBBufPtr); - - /* - * Wake up the background task, which includes the - * scanning of the ES app table for entries that may need cleanup + /* + ** Process message. */ - CFE_ES_BackgroundWakeup(); + CFE_ES_TaskPipe(SBBufPtr); + + /* + * Wake up the background task, which includes the + * scanning of the ES app table for entries that may need cleanup + */ + CFE_ES_BackgroundWakeup(); } else { /* ** SB Error: Write a SysLog Message */ - CFE_ES_WriteToSysLog("ES:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); + CFE_ES_WriteToSysLog("ES:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); /* ** Allow Core App to Exit */ AppRunStatus = CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR; - } /* end if */ + } /* end if */ } /* end while */ @@ -210,7 +208,7 @@ const char *CFE_ES_FindConfigKeyValue(const CFE_ConfigKeyValue_t *ConfigList, co int32 CFE_ES_GenerateSingleVersionEvent(const char *ModuleType, const char *ModuleName) { - int32 Status; + int32 Status; const char *VersionString; /* The mission version which should appear in the version list under the mission name */ @@ -225,9 +223,8 @@ int32 CFE_ES_GenerateSingleVersionEvent(const char *ModuleType, const char *Modu /* * Advertise the mission version information */ - Status = CFE_EVS_SendEvent(CFE_ES_VERSION_INF_EID, CFE_EVS_EventType_INFORMATION, - "Version Info: %s %s, version %s", - ModuleType, ModuleName, VersionString); + Status = CFE_EVS_SendEvent(CFE_ES_VERSION_INF_EID, CFE_EVS_EventType_INFORMATION, "Version Info: %s %s, version %s", + ModuleType, ModuleName, VersionString); return Status; } @@ -240,17 +237,17 @@ int32 CFE_ES_GenerateSingleVersionEvent(const char *ModuleType, const char *Modu void CFE_ES_GenerateVersionEvents(void) { - int32 Status; - CFE_ConfigName_t *ModuleNamePtr; + int32 Status; + CFE_ConfigName_t * ModuleNamePtr; CFE_StaticModuleLoadEntry_t *StaticModulePtr; /* * Advertise the mission version information */ Status = CFE_ES_GenerateSingleVersionEvent("Mission", GLOBAL_CONFIGDATA.MissionName); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error sending mission version event:RC=0x%08X\n", (unsigned int)Status); + CFE_ES_WriteToSysLog("ES:Error sending mission version event:RC=0x%08X\n", (unsigned int)Status); } /* @@ -263,7 +260,7 @@ void CFE_ES_GenerateVersionEvents(void) while (Status == CFE_SUCCESS && ModuleNamePtr->Name != NULL) { Status = CFE_ES_GenerateSingleVersionEvent("Core Module", ModuleNamePtr->Name); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Error sending core module version event:RC=0x%08X\n", (unsigned int)Status); } @@ -271,8 +268,8 @@ void CFE_ES_GenerateVersionEvents(void) } } - /* - * Advertise PSP module versions + /* + * Advertise PSP module versions */ StaticModulePtr = GLOBAL_CONFIGDATA.PspModuleList; if (StaticModulePtr != NULL) @@ -280,7 +277,7 @@ void CFE_ES_GenerateVersionEvents(void) while (Status == CFE_SUCCESS && StaticModulePtr->Name != NULL) { Status = CFE_ES_GenerateSingleVersionEvent("PSP Module", StaticModulePtr->Name); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Error sending PSP module version event:RC=0x%08X\n", (unsigned int)Status); } @@ -297,7 +294,7 @@ void CFE_ES_GenerateVersionEvents(void) void CFE_ES_GenerateBuildInfoEvents(void) { - int32 Status; + int32 Status; const char *BuildDate; const char *BuildUser; const char *BuildHost; @@ -322,9 +319,9 @@ void CFE_ES_GenerateBuildInfoEvents(void) BuildHost = "[unknown]"; } - Status = CFE_EVS_SendEvent(CFE_ES_BUILD_INF_EID, CFE_EVS_EventType_INFORMATION, - "Build %s by %s@%s, config %s", BuildDate, BuildUser, BuildHost, GLOBAL_CONFIGDATA.Config); - if ( Status != CFE_SUCCESS ) + Status = CFE_EVS_SendEvent(CFE_ES_BUILD_INF_EID, CFE_EVS_EventType_INFORMATION, "Build %s by %s@%s, config %s", + BuildDate, BuildUser, BuildHost, GLOBAL_CONFIGDATA.Config); + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Error sending build info event:RC=0x%08X\n", (unsigned int)Status); } @@ -346,22 +343,22 @@ int32 CFE_ES_TaskInit(void) ** Register the Application */ Status = CFE_ES_RegisterApp(); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Call to CFE_ES_RegisterApp Failed, RC = 0x%08X\n", (unsigned int)Status); - return(Status); + return (Status); } /* ** Initialize task command execution counters */ - CFE_ES_TaskData.CommandCounter = 0; + CFE_ES_TaskData.CommandCounter = 0; CFE_ES_TaskData.CommandErrorCounter = 0; /* ** Initialize systemlog to default Power On or Processor Reset mode */ - if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON) + if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON) { CFE_ES_ResetDataPtr->SystemLogMode = CFE_PLATFORM_ES_DEFAULT_POR_SYSLOG_MODE; } @@ -373,78 +370,75 @@ int32 CFE_ES_TaskInit(void) /* ** Register event filter table. */ - Status = CFE_EVS_Register(NULL,0,CFE_EVS_EventFilter_BINARY); - if ( Status != CFE_SUCCESS ) + Status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Call to CFE_EVS_Register Failed, RC = 0x%08X\n", (unsigned int)Status); - return(Status); + return (Status); } /* ** Initialize housekeeping packet (clear user data area) */ - CFE_MSG_Init(&CFE_ES_TaskData.HkPacket.TlmHeader.Msg, - CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID), + 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.Msg, - CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID), + 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.Msg, - CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), + CFE_MSG_Init(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), sizeof(CFE_ES_TaskData.MemStatsPacket)); /* ** Create Software Bus message pipe */ Status = CFE_SB_CreatePipe(&CFE_ES_TaskData.CmdPipe, CFE_ES_PIPE_DEPTH, CFE_ES_PIPE_NAME); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Cannot Create SB Pipe, RC = 0x%08X\n", (unsigned int)Status); - return(Status); + return (Status); } /* ** Subscribe to Housekeeping request commands */ Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_ES_SEND_HK_MID), CFE_ES_TaskData.CmdPipe); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Cannot Subscribe to HK packet, RC = 0x%08X\n", (unsigned int)Status); - return(Status); + return (Status); } /* ** Subscribe to ES task ground command packets */ Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_ES_CMD_MID), CFE_ES_TaskData.CmdPipe); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Cannot Subscribe to ES ground commands, RC = 0x%08X\n", (unsigned int)Status); - return(Status); + return (Status); } /* ** Compute the CRC for the cfe core code segment and place ** in ES Housekeeping pkt. */ - Status = CFE_PSP_GetCFETextSegmentInfo( &CfeSegmentAddr, &SizeofCfeSegment); + Status = CFE_PSP_GetCFETextSegmentInfo(&CfeSegmentAddr, &SizeofCfeSegment); - if ( Status == CFE_PSP_SUCCESS ) + if (Status == CFE_PSP_SUCCESS) { - CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum = CFE_ES_CalculateCRC( - (void *)(CfeSegmentAddr), SizeofCfeSegment, 0, CFE_MISSION_ES_DEFAULT_CRC); + CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum = + CFE_ES_CalculateCRC((void *)(CfeSegmentAddr), SizeofCfeSegment, 0, CFE_MISSION_ES_DEFAULT_CRC); } else { - CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum = 0xFFFF; + CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum = 0xFFFF; } /* @@ -462,23 +456,22 @@ int32 CFE_ES_TaskInit(void) /* ** Task startup event message. */ - Status = CFE_EVS_SendEvent(CFE_ES_INIT_INF_EID, - CFE_EVS_EventType_INFORMATION, - "cFE ES Initialized"); - if ( Status != CFE_SUCCESS ) + Status = CFE_EVS_SendEvent(CFE_ES_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE ES Initialized"); + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Error sending init event:RC=0x%08X\n", (unsigned int)Status); - return(Status); + return (Status); } Status = CFE_EVS_SendEvent(CFE_ES_INITSTATS_INF_EID, CFE_EVS_EventType_INFORMATION, - "cFS Versions: cfe %s, osal %s, psp %s. cFE chksm %d", - GLOBAL_CONFIGDATA.CfeVersion, GLOBAL_CONFIGDATA.OsalVersion, CFE_PSP_VERSION, (int)CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum); + "cFS Versions: cfe %s, osal %s, psp %s. cFE chksm %d", GLOBAL_CONFIGDATA.CfeVersion, + GLOBAL_CONFIGDATA.OsalVersion, CFE_PSP_VERSION, + (int)CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("ES:Error sending init stats event:RC=0x%08X\n", (unsigned int)Status); - return(Status); + return (Status); } /* @@ -489,21 +482,20 @@ int32 CFE_ES_TaskInit(void) /* * Initialize the "background task" which is a low priority child task - * devoted to maintence duties that do not need to execute on a + * devoted to maintence duties that do not need to execute on a * strict/precise schedule. */ Status = CFE_ES_BackgroundInit(); - if ( Status != CFE_SUCCESS ) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("ES:Error initializing background task:RC=0x%08X\n", (unsigned int)Status); - return(Status); + CFE_ES_WriteToSysLog("ES:Error initializing background task:RC=0x%08X\n", (unsigned int)Status); + return (Status); } - return(CFE_SUCCESS); + return (CFE_SUCCESS); } /* End of CFE_ES_TaskInit() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_TaskPipe() -- Process command pipe message */ @@ -536,175 +528,175 @@ void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) case CFE_ES_NOOP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_NoopCmd_t))) { - CFE_ES_NoopCmd((CFE_ES_NoopCmd_t*)SBBufPtr); + CFE_ES_NoopCmd((CFE_ES_NoopCmd_t *)SBBufPtr); } break; case CFE_ES_RESET_COUNTERS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetCountersCmd_t))) { - CFE_ES_ResetCountersCmd((CFE_ES_ResetCountersCmd_t*)SBBufPtr); + CFE_ES_ResetCountersCmd((CFE_ES_ResetCountersCmd_t *)SBBufPtr); } break; case CFE_ES_RESTART_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartCmd_t))) { - CFE_ES_RestartCmd((CFE_ES_RestartCmd_t*)SBBufPtr); + CFE_ES_RestartCmd((CFE_ES_RestartCmd_t *)SBBufPtr); } break; case CFE_ES_START_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartAppCmd_t))) { - CFE_ES_StartAppCmd((CFE_ES_StartAppCmd_t*)SBBufPtr); + CFE_ES_StartAppCmd((CFE_ES_StartAppCmd_t *)SBBufPtr); } break; case CFE_ES_STOP_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopAppCmd_t))) { - CFE_ES_StopAppCmd((CFE_ES_StopAppCmd_t*)SBBufPtr); + CFE_ES_StopAppCmd((CFE_ES_StopAppCmd_t *)SBBufPtr); } break; case CFE_ES_RESTART_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartAppCmd_t))) { - CFE_ES_RestartAppCmd((CFE_ES_RestartAppCmd_t*)SBBufPtr); + CFE_ES_RestartAppCmd((CFE_ES_RestartAppCmd_t *)SBBufPtr); } break; case CFE_ES_RELOAD_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ReloadAppCmd_t))) { - CFE_ES_ReloadAppCmd((CFE_ES_ReloadAppCmd_t*)SBBufPtr); + CFE_ES_ReloadAppCmd((CFE_ES_ReloadAppCmd_t *)SBBufPtr); } break; case CFE_ES_QUERY_ONE_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryOneCmd_t))) { - CFE_ES_QueryOneCmd((CFE_ES_QueryOneCmd_t*)SBBufPtr); + CFE_ES_QueryOneCmd((CFE_ES_QueryOneCmd_t *)SBBufPtr); } break; case CFE_ES_QUERY_ALL_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllCmd_t))) { - CFE_ES_QueryAllCmd((CFE_ES_QueryAllCmd_t*)SBBufPtr); + CFE_ES_QueryAllCmd((CFE_ES_QueryAllCmd_t *)SBBufPtr); } break; case CFE_ES_QUERY_ALL_TASKS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllTasksCmd_t))) { - CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasksCmd_t*)SBBufPtr); + CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasksCmd_t *)SBBufPtr); } break; case CFE_ES_CLEAR_SYSLOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearSysLogCmd_t))) { - CFE_ES_ClearSysLogCmd((CFE_ES_ClearSysLogCmd_t*)SBBufPtr); + CFE_ES_ClearSysLogCmd((CFE_ES_ClearSysLogCmd_t *)SBBufPtr); } break; case CFE_ES_WRITE_SYSLOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteSysLogCmd_t))) { - CFE_ES_WriteSysLogCmd((CFE_ES_WriteSysLogCmd_t*)SBBufPtr); + CFE_ES_WriteSysLogCmd((CFE_ES_WriteSysLogCmd_t *)SBBufPtr); } break; case CFE_ES_OVER_WRITE_SYSLOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_OverWriteSysLogCmd_t))) { - CFE_ES_OverWriteSysLogCmd((CFE_ES_OverWriteSysLogCmd_t*)SBBufPtr); + CFE_ES_OverWriteSysLogCmd((CFE_ES_OverWriteSysLogCmd_t *)SBBufPtr); } break; case CFE_ES_CLEAR_ER_LOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearERLogCmd_t))) { - CFE_ES_ClearERLogCmd((CFE_ES_ClearERLogCmd_t*)SBBufPtr); + CFE_ES_ClearERLogCmd((CFE_ES_ClearERLogCmd_t *)SBBufPtr); } break; case CFE_ES_WRITE_ER_LOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteERLogCmd_t))) { - CFE_ES_WriteERLogCmd((CFE_ES_WriteERLogCmd_t*)SBBufPtr); + CFE_ES_WriteERLogCmd((CFE_ES_WriteERLogCmd_t *)SBBufPtr); } break; case CFE_ES_START_PERF_DATA_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartPerfDataCmd_t))) { - CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfDataCmd_t*)SBBufPtr); + CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfDataCmd_t *)SBBufPtr); } break; case CFE_ES_STOP_PERF_DATA_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopPerfDataCmd_t))) { - CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfDataCmd_t*)SBBufPtr); + CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfDataCmd_t *)SBBufPtr); } break; case CFE_ES_SET_PERF_FILTER_MASK_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfFilterMaskCmd_t))) { - CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMaskCmd_t*)SBBufPtr); + CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMaskCmd_t *)SBBufPtr); } break; case CFE_ES_SET_PERF_TRIGGER_MASK_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfTriggerMaskCmd_t))) { - CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMaskCmd_t*)SBBufPtr); + CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMaskCmd_t *)SBBufPtr); } break; case CFE_ES_RESET_PR_COUNT_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetPRCountCmd_t))) { - CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCountCmd_t*)SBBufPtr); + CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCountCmd_t *)SBBufPtr); } break; case CFE_ES_SET_MAX_PR_COUNT_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetMaxPRCountCmd_t))) { - CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCountCmd_t*)SBBufPtr); + CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCountCmd_t *)SBBufPtr); } break; case CFE_ES_DELETE_CDS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DeleteCDSCmd_t))) { - CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDSCmd_t*)SBBufPtr); + CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDSCmd_t *)SBBufPtr); } break; case CFE_ES_SEND_MEM_POOL_STATS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SendMemPoolStatsCmd_t))) { - CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStatsCmd_t*)SBBufPtr); + CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStatsCmd_t *)SBBufPtr); } break; case CFE_ES_DUMP_CDS_REGISTRY_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DumpCDSRegistryCmd_t))) { - CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistryCmd_t*)SBBufPtr); + CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistryCmd_t *)SBBufPtr); } break; default: CFE_EVS_SendEvent(CFE_ES_CC1_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid ground command code: ID = 0x%X, CC = %d", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode); + "Invalid ground command code: ID = 0x%X, CC = %d", + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode); CFE_ES_TaskData.CommandErrorCounter++; break; } @@ -712,8 +704,7 @@ void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) default: - CFE_EVS_SendEvent(CFE_ES_MID_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid command pipe message ID: 0x%X", + CFE_EVS_SendEvent(CFE_ES_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%X", (unsigned int)CFE_SB_MsgIdToValue(MessageID)); CFE_ES_TaskData.CommandErrorCounter++; break; @@ -721,7 +712,6 @@ void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) } /* End of CFE_ES_TaskPipe() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_HousekeepingCmd() -- On-board command (HK request) */ @@ -737,35 +727,35 @@ int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) /* ** Get command execution counters, system log entry count & bytes used. */ - CFE_ES_TaskData.HkPacket.Payload.CommandCounter = CFE_ES_TaskData.CommandCounter; + CFE_ES_TaskData.HkPacket.Payload.CommandCounter = CFE_ES_TaskData.CommandCounter; CFE_ES_TaskData.HkPacket.Payload.CommandErrorCounter = CFE_ES_TaskData.CommandErrorCounter; CFE_ES_TaskData.HkPacket.Payload.SysLogBytesUsed = CFE_ES_MEMOFFSET_C(CFE_ES_ResetDataPtr->SystemLogEndIdx); - CFE_ES_TaskData.HkPacket.Payload.SysLogSize = CFE_ES_MEMOFFSET_C(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE); + CFE_ES_TaskData.HkPacket.Payload.SysLogSize = CFE_ES_MEMOFFSET_C(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE); CFE_ES_TaskData.HkPacket.Payload.SysLogEntries = CFE_ES_ResetDataPtr->SystemLogEntryNum; - CFE_ES_TaskData.HkPacket.Payload.SysLogMode = CFE_ES_ResetDataPtr->SystemLogMode; + CFE_ES_TaskData.HkPacket.Payload.SysLogMode = CFE_ES_ResetDataPtr->SystemLogMode; - CFE_ES_TaskData.HkPacket.Payload.ERLogIndex = CFE_ES_ResetDataPtr->ERLogIndex; - CFE_ES_TaskData.HkPacket.Payload.ERLogEntries = CFE_ES_ResetDataPtr->ERLogEntries; + CFE_ES_TaskData.HkPacket.Payload.ERLogIndex = CFE_ES_ResetDataPtr->ERLogIndex; + CFE_ES_TaskData.HkPacket.Payload.ERLogEntries = CFE_ES_ResetDataPtr->ERLogEntries; - CFE_ES_TaskData.HkPacket.Payload.RegisteredCoreApps = CFE_ES_Global.RegisteredCoreApps; - CFE_ES_TaskData.HkPacket.Payload.RegisteredExternalApps = CFE_ES_Global.RegisteredExternalApps; - CFE_ES_TaskData.HkPacket.Payload.RegisteredTasks = CFE_ES_Global.RegisteredTasks; - CFE_ES_TaskData.HkPacket.Payload.RegisteredLibs = CFE_ES_Global.RegisteredLibs; + CFE_ES_TaskData.HkPacket.Payload.RegisteredCoreApps = CFE_ES_Global.RegisteredCoreApps; + CFE_ES_TaskData.HkPacket.Payload.RegisteredExternalApps = CFE_ES_Global.RegisteredExternalApps; + CFE_ES_TaskData.HkPacket.Payload.RegisteredTasks = CFE_ES_Global.RegisteredTasks; + CFE_ES_TaskData.HkPacket.Payload.RegisteredLibs = CFE_ES_Global.RegisteredLibs; - CFE_ES_TaskData.HkPacket.Payload.ResetType = CFE_ES_ResetDataPtr->ResetVars.ResetType; - CFE_ES_TaskData.HkPacket.Payload.ResetSubtype = CFE_ES_ResetDataPtr->ResetVars.ResetSubtype; - CFE_ES_TaskData.HkPacket.Payload.ProcessorResets = CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount; + CFE_ES_TaskData.HkPacket.Payload.ResetType = CFE_ES_ResetDataPtr->ResetVars.ResetType; + CFE_ES_TaskData.HkPacket.Payload.ResetSubtype = CFE_ES_ResetDataPtr->ResetVars.ResetSubtype; + CFE_ES_TaskData.HkPacket.Payload.ProcessorResets = CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount; CFE_ES_TaskData.HkPacket.Payload.MaxProcessorResets = CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount; - CFE_ES_TaskData.HkPacket.Payload.BootSource = CFE_ES_ResetDataPtr->ResetVars.BootSource; + CFE_ES_TaskData.HkPacket.Payload.BootSource = CFE_ES_ResetDataPtr->ResetVars.BootSource; - CFE_ES_TaskData.HkPacket.Payload.PerfState = CFE_ES_ResetDataPtr->Perf.MetaData.State; - CFE_ES_TaskData.HkPacket.Payload.PerfMode = CFE_ES_ResetDataPtr->Perf.MetaData.Mode; + CFE_ES_TaskData.HkPacket.Payload.PerfState = CFE_ES_ResetDataPtr->Perf.MetaData.State; + CFE_ES_TaskData.HkPacket.Payload.PerfMode = CFE_ES_ResetDataPtr->Perf.MetaData.Mode; CFE_ES_TaskData.HkPacket.Payload.PerfTriggerCount = CFE_ES_ResetDataPtr->Perf.MetaData.TriggerCount; - CFE_ES_TaskData.HkPacket.Payload.PerfDataStart = CFE_ES_ResetDataPtr->Perf.MetaData.DataStart; - CFE_ES_TaskData.HkPacket.Payload.PerfDataEnd = CFE_ES_ResetDataPtr->Perf.MetaData.DataEnd; - CFE_ES_TaskData.HkPacket.Payload.PerfDataCount = CFE_ES_ResetDataPtr->Perf.MetaData.DataCount; - CFE_ES_TaskData.HkPacket.Payload.PerfDataToWrite = CFE_ES_GetPerfLogDumpRemaining(); + CFE_ES_TaskData.HkPacket.Payload.PerfDataStart = CFE_ES_ResetDataPtr->Perf.MetaData.DataStart; + CFE_ES_TaskData.HkPacket.Payload.PerfDataEnd = CFE_ES_ResetDataPtr->Perf.MetaData.DataEnd; + CFE_ES_TaskData.HkPacket.Payload.PerfDataCount = CFE_ES_ResetDataPtr->Perf.MetaData.DataCount; + CFE_ES_TaskData.HkPacket.Payload.PerfDataToWrite = CFE_ES_GetPerfLogDumpRemaining(); /* * Fill out the perf trigger/filter mask objects @@ -782,7 +772,7 @@ int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) if (PerfIdx < CFE_ES_PERF_TRIGGERMASK_INT_SIZE) { CFE_ES_TaskData.HkPacket.Payload.PerfTriggerMask[PerfIdx] = - CFE_ES_ResetDataPtr->Perf.MetaData.TriggerMask[PerfIdx]; + CFE_ES_ResetDataPtr->Perf.MetaData.TriggerMask[PerfIdx]; } else { @@ -795,7 +785,7 @@ int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) if (PerfIdx < CFE_ES_PERF_FILTERMASK_INT_SIZE) { CFE_ES_TaskData.HkPacket.Payload.PerfFilterMask[PerfIdx] = - CFE_ES_ResetDataPtr->Perf.MetaData.FilterMask[PerfIdx]; + CFE_ES_ResetDataPtr->Perf.MetaData.FilterMask[PerfIdx]; } else { @@ -805,18 +795,18 @@ int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) stat = OS_HeapGetInfo(&HeapProp); - /* - * If retrieving info from OSAL was not successful, + /* + * If retrieving info from OSAL was not successful, * zero out the property struct, so all sizes will * in turn be reported in telemetry as 0. */ - if(stat != OS_SUCCESS) + if (stat != OS_SUCCESS) { memset(&HeapProp, 0, sizeof(HeapProp)); } - CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = CFE_ES_MEMOFFSET_C(HeapProp.free_bytes); - CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = CFE_ES_MEMOFFSET_C(HeapProp.free_blocks); + CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = CFE_ES_MEMOFFSET_C(HeapProp.free_bytes); + CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = CFE_ES_MEMOFFSET_C(HeapProp.free_blocks); CFE_ES_TaskData.HkPacket.Payload.HeapMaxBlockSize = CFE_ES_MEMOFFSET_C(HeapProp.largest_free_block); /* @@ -845,7 +835,7 @@ int32 CFE_ES_NoopCmd(const CFE_ES_NoopCmd_t *Cmd) ** For unit testing purposes, it helps to put this first - the UT ** is checking for the last event sent to be NOOP_INF_EID. */ - CFE_ES_GenerateBuildInfoEvents(); + CFE_ES_GenerateBuildInfoEvents(); /* ** This command will always succeed. @@ -853,13 +843,12 @@ int32 CFE_ES_NoopCmd(const CFE_ES_NoopCmd_t *Cmd) CFE_ES_TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, - "No-op command:\n cFS Versions: cfe %s, osal %s, psp %s", - GLOBAL_CONFIGDATA.CfeVersion, GLOBAL_CONFIGDATA.OsalVersion, CFE_PSP_VERSION); + "No-op command:\n cFS Versions: cfe %s, osal %s, psp %s", GLOBAL_CONFIGDATA.CfeVersion, + GLOBAL_CONFIGDATA.OsalVersion, CFE_PSP_VERSION); return CFE_SUCCESS; } /* End of CFE_ES_NoopCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_ResetCountersCmd() -- ES task ground command (reset counters) */ @@ -868,19 +857,17 @@ int32 CFE_ES_NoopCmd(const CFE_ES_NoopCmd_t *Cmd) int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCountersCmd_t *data) { - CFE_ES_TaskData.CommandCounter = 0; + CFE_ES_TaskData.CommandCounter = 0; CFE_ES_TaskData.CommandErrorCounter = 0; /* ** This command will always succeed. */ - CFE_EVS_SendEvent(CFE_ES_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, - "Reset Counters command"); + CFE_EVS_SendEvent(CFE_ES_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "Reset Counters command"); return CFE_SUCCESS; } /* End of CFE_ES_ResetCountersCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_RestartCmd() -- Restart cFE (may reset processor) */ @@ -891,13 +878,11 @@ int32 CFE_ES_RestartCmd(const CFE_ES_RestartCmd_t *data) { const CFE_ES_RestartCmd_Payload_t *cmd = &data->Payload; - if ((cmd->RestartType != CFE_PSP_RST_TYPE_PROCESSOR) && - (cmd->RestartType != CFE_PSP_RST_TYPE_POWERON)) + if ((cmd->RestartType != CFE_PSP_RST_TYPE_PROCESSOR) && (cmd->RestartType != CFE_PSP_RST_TYPE_POWERON)) { CFE_ES_TaskData.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_ES_BOOT_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid cFE restart type: %d", - (int)cmd->RestartType); + CFE_EVS_SendEvent(CFE_ES_BOOT_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid cFE restart type: %d", + (int)cmd->RestartType); } else { @@ -919,24 +904,23 @@ int32 CFE_ES_RestartCmd(const CFE_ES_RestartCmd_t *data) int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) { const CFE_ES_StartAppCmd_Payload_t *cmd = &data->Payload; - CFE_ES_AppId_t AppID; - int32 Result; - int32 FilenameLen; - int32 AppEntryLen; - int32 AppNameLen; - char LocalAppName[OS_MAX_API_NAME]; - CFE_ES_AppStartParams_t StartParams; - + CFE_ES_AppId_t AppID; + int32 Result; + int32 FilenameLen; + int32 AppEntryLen; + int32 AppNameLen; + char LocalAppName[OS_MAX_API_NAME]; + CFE_ES_AppStartParams_t StartParams; /* Create local copies of all input strings and ensure null termination */ FilenameLen = CFE_SB_MessageStringGet(StartParams.BasicInfo.FileName, cmd->AppFileName, NULL, - sizeof(StartParams.BasicInfo.FileName), sizeof(cmd->AppFileName)); + sizeof(StartParams.BasicInfo.FileName), sizeof(cmd->AppFileName)); AppEntryLen = CFE_SB_MessageStringGet(StartParams.BasicInfo.InitSymbolName, cmd->AppEntryPoint, NULL, - sizeof(StartParams.BasicInfo.InitSymbolName), sizeof(cmd->AppEntryPoint)); + sizeof(StartParams.BasicInfo.InitSymbolName), sizeof(cmd->AppEntryPoint)); - AppNameLen = CFE_SB_MessageStringGet(LocalAppName, cmd->Application, NULL, - sizeof(LocalAppName), sizeof(cmd->Application)); + AppNameLen = + CFE_SB_MessageStringGet(LocalAppName, cmd->Application, NULL, sizeof(LocalAppName), sizeof(cmd->Application)); /* ** Verify command parameters @@ -945,55 +929,52 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_INVALID_FILENAME_ERR_EID, CFE_EVS_EventType_ERROR, - "CFE_ES_StartAppCmd: invalid filename: %s", - StartParams.BasicInfo.FileName); + "CFE_ES_StartAppCmd: invalid filename: %s", StartParams.BasicInfo.FileName); } else if (AppEntryLen <= 0) { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID, CFE_EVS_EventType_ERROR, - "CFE_ES_StartAppCmd: App Entry Point is empty."); + "CFE_ES_StartAppCmd: App Entry Point is empty."); } else if (AppNameLen <= 0) { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_NULL_APP_NAME_ERR_EID, CFE_EVS_EventType_ERROR, - "CFE_ES_StartAppCmd: App Name is empty."); + "CFE_ES_StartAppCmd: App Name is empty."); } else if (cmd->Priority > OS_MAX_PRIORITY) { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_PRIORITY_ERR_EID, CFE_EVS_EventType_ERROR, - "CFE_ES_StartAppCmd: Priority is too large: %d.", - (int)cmd->Priority); + "CFE_ES_StartAppCmd: Priority is too large: %d.", (int)cmd->Priority); } else if ((cmd->ExceptionAction != CFE_ES_ExceptionAction_RESTART_APP) && - (cmd->ExceptionAction != CFE_ES_ExceptionAction_PROC_RESTART )) + (cmd->ExceptionAction != CFE_ES_ExceptionAction_PROC_RESTART)) { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_EXC_ACTION_ERR_EID, CFE_EVS_EventType_ERROR, - "CFE_ES_StartAppCmd: Invalid Exception Action: %d.", - (int)cmd->ExceptionAction); + "CFE_ES_StartAppCmd: Invalid Exception Action: %d.", (int)cmd->ExceptionAction); } else { - /* If stack size was provided, use it, otherwise use default. */ - if (cmd->StackSize == 0) - { - StartParams.MainTaskInfo.StackSize = CFE_PLATFORM_ES_DEFAULT_STACK_SIZE; - } - else - { - StartParams.MainTaskInfo.StackSize = cmd->StackSize; - } + /* If stack size was provided, use it, otherwise use default. */ + if (cmd->StackSize == 0) + { + StartParams.MainTaskInfo.StackSize = CFE_PLATFORM_ES_DEFAULT_STACK_SIZE; + } + else + { + StartParams.MainTaskInfo.StackSize = cmd->StackSize; + } - StartParams.MainTaskInfo.Priority = cmd->Priority; - StartParams.ExceptionAction = cmd->ExceptionAction; + StartParams.MainTaskInfo.Priority = cmd->Priority; + StartParams.ExceptionAction = cmd->ExceptionAction; - /* - ** Invoke application loader/startup function. - */ - Result = CFE_ES_AppCreate(&AppID, LocalAppName, &StartParams); + /* + ** Invoke application loader/startup function. + */ + Result = CFE_ES_AppCreate(&AppID, LocalAppName, &StartParams); /* ** Send appropriate event message @@ -1001,16 +982,14 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) if (Result == CFE_SUCCESS) { CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_START_INF_EID, CFE_EVS_EventType_INFORMATION, - "Started %s from %s, AppID = %lu", - LocalAppName, StartParams.BasicInfo.FileName, CFE_RESOURCEID_TO_ULONG(AppID)); + CFE_EVS_SendEvent(CFE_ES_START_INF_EID, CFE_EVS_EventType_INFORMATION, "Started %s from %s, AppID = %lu", + LocalAppName, StartParams.BasicInfo.FileName, CFE_RESOURCEID_TO_ULONG(AppID)); } else { CFE_ES_TaskData.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_ES_START_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to start %s from %s, RC = 0x%08X", - LocalAppName, StartParams.BasicInfo.FileName, (unsigned int)Result); + CFE_EVS_SendEvent(CFE_ES_START_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to start %s from %s, RC = 0x%08X", + LocalAppName, StartParams.BasicInfo.FileName, (unsigned int)Result); } } /* End if -- command parameter validation */ @@ -1018,7 +997,6 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) return CFE_SUCCESS; } /* End of CFE_ES_StartAppCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_StopAppCmd() -- Stop single application */ @@ -1028,12 +1006,11 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_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]; - CFE_ES_AppId_t AppID; - int32 Result; + char LocalApp[OS_MAX_API_NAME]; + CFE_ES_AppId_t AppID; + int32 Result; - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, - sizeof(LocalApp), sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&AppID, LocalApp); @@ -1050,29 +1027,25 @@ int32 CFE_ES_StopAppCmd(const CFE_ES_StopAppCmd_t *data) if (Result == CFE_SUCCESS) { CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_STOP_DBG_EID, CFE_EVS_EventType_DEBUG, - "Stop Application %s Initiated.", LocalApp); + CFE_EVS_SendEvent(CFE_ES_STOP_DBG_EID, CFE_EVS_EventType_DEBUG, "Stop Application %s Initiated.", LocalApp); } else { CFE_ES_TaskData.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_ES_STOP_ERR1_EID, CFE_EVS_EventType_ERROR, - "Stop Application %s Failed, RC = 0x%08X", - LocalApp, (unsigned int)Result); + CFE_EVS_SendEvent(CFE_ES_STOP_ERR1_EID, CFE_EVS_EventType_ERROR, "Stop Application %s Failed, RC = 0x%08X", + LocalApp, (unsigned int)Result); } } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_STOP_ERR2_EID, CFE_EVS_EventType_ERROR, - "Stop Application %s, GetAppIDByName failed. RC = 0x%08X.", - LocalApp, (unsigned int)Result); + "Stop Application %s, GetAppIDByName failed. RC = 0x%08X.", LocalApp, (unsigned int)Result); } return CFE_SUCCESS; } /* End of CFE_ES_StopAppCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_RestartAppCmd() -- Restart a single application */ @@ -1082,12 +1055,11 @@ int32 CFE_ES_StopAppCmd(const CFE_ES_StopAppCmd_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]; - CFE_ES_AppId_t AppID; - int32 Result; + char LocalApp[OS_MAX_API_NAME]; + CFE_ES_AppId_t AppID; + int32 Result; - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, - sizeof(LocalApp), sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&AppID, LocalApp); @@ -1101,23 +1073,22 @@ int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartAppCmd_t *data) if (Result == CFE_SUCCESS) { CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_RESTART_APP_DBG_EID, CFE_EVS_EventType_DEBUG, - "Restart Application %s Initiated.", LocalApp); + CFE_EVS_SendEvent(CFE_ES_RESTART_APP_DBG_EID, CFE_EVS_EventType_DEBUG, "Restart Application %s Initiated.", + LocalApp); } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR1_EID, CFE_EVS_EventType_ERROR, - "Restart Application %s Failed, RC = 0x%08X", - LocalApp, (unsigned int)Result); + "Restart Application %s Failed, RC = 0x%08X", LocalApp, (unsigned int)Result); } } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR2_EID, CFE_EVS_EventType_ERROR, - "Restart Application %s, GetAppIDByName failed. RC = 0x%08X.", - LocalApp, (unsigned int)Result); + "Restart Application %s, GetAppIDByName failed. RC = 0x%08X.", LocalApp, + (unsigned int)Result); } return CFE_SUCCESS; @@ -1132,15 +1103,14 @@ int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartAppCmd_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]; - char LocalFileName[OS_MAX_PATH_LEN]; - CFE_ES_AppId_t AppID; - int32 Result; + char LocalApp[OS_MAX_API_NAME]; + char LocalFileName[OS_MAX_PATH_LEN]; + CFE_ES_AppId_t AppID; + int32 Result; - CFE_SB_MessageStringGet(LocalFileName, (char *)cmd->AppFileName, NULL, - sizeof(LocalFileName), sizeof(cmd->AppFileName)); - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, - sizeof(LocalApp), sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalFileName, (char *)cmd->AppFileName, NULL, sizeof(LocalFileName), + sizeof(cmd->AppFileName)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&AppID, LocalApp); @@ -1154,29 +1124,26 @@ int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadAppCmd_t *data) if (Result == CFE_SUCCESS) { CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_DBG_EID, CFE_EVS_EventType_DEBUG, - "Reload Application %s Initiated.", LocalApp); + CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_DBG_EID, CFE_EVS_EventType_DEBUG, "Reload Application %s Initiated.", + LocalApp); } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR1_EID, CFE_EVS_EventType_ERROR, - "Reload Application %s Failed, RC = 0x%08X", - LocalApp, (unsigned int)Result); + "Reload Application %s Failed, RC = 0x%08X", LocalApp, (unsigned int)Result); } } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR2_EID, CFE_EVS_EventType_ERROR, - "Reload Application %s, GetAppIDByName failed. RC = 0x%08X.", - LocalApp, (unsigned int)Result); + "Reload Application %s, GetAppIDByName failed. RC = 0x%08X.", LocalApp, (unsigned int)Result); } return CFE_SUCCESS; } /* End of CFE_ES_ReloadAppCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_QueryOneCmd() -- Request tlm packet with single app data */ @@ -1186,7 +1153,7 @@ int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadAppCmd_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]; + char LocalApp[OS_MAX_API_NAME]; union { CFE_ES_AppId_t AppId; @@ -1195,8 +1162,7 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data) } IdBuf; int32 Result; - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, - sizeof(LocalApp), sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&IdBuf.AppId, LocalApp); if (Result == CFE_ES_ERR_NAME_NOT_FOUND) @@ -1220,26 +1186,24 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data) */ CFE_SB_TimeStampMsg(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg); Result = CFE_SB_TransmitMsg(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg, true); - if ( Result == CFE_SUCCESS ) + if (Result == CFE_SUCCESS) { CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_ONE_APP_EID, CFE_EVS_EventType_DEBUG, - "Sent %s application data", LocalApp); + CFE_EVS_SendEvent(CFE_ES_ONE_APP_EID, CFE_EVS_EventType_DEBUG, "Sent %s application data", LocalApp); } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_ONE_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to send %s application data, RC = 0x%08X", - LocalApp, (unsigned int)Result); + "Failed to send %s application data, RC = 0x%08X", LocalApp, (unsigned int)Result); } } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_ONE_APPID_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to send %s application data: GetAppIDByName Failed, RC = 0x%08X", - LocalApp, (unsigned int)Result); + "Failed to send %s application data: GetAppIDByName Failed, RC = 0x%08X", LocalApp, + (unsigned int)Result); } return CFE_SUCCESS; @@ -1253,25 +1217,25 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data) int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) { - CFE_FS_Header_t FileHeader; - osal_id_t FileDescriptor; - uint32 i; - uint32 EntryCount = 0; - uint32 FileSize = 0; - int32 Result; - CFE_ES_AppInfo_t AppInfo; + CFE_FS_Header_t FileHeader; + osal_id_t FileDescriptor; + uint32 i; + uint32 EntryCount = 0; + uint32 FileSize = 0; + int32 Result; + CFE_ES_AppInfo_t AppInfo; const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; - char QueryAllFilename[OS_MAX_PATH_LEN]; - CFE_ResourceId_t ResourceList[CFE_ES_QUERY_ALL_MAX_ENTRIES]; - uint32 NumResources; - CFE_ES_AppRecord_t *AppRecPtr; - CFE_ES_LibRecord_t *LibRecPtr; + char QueryAllFilename[OS_MAX_PATH_LEN]; + CFE_ResourceId_t ResourceList[CFE_ES_QUERY_ALL_MAX_ENTRIES]; + uint32 NumResources; + CFE_ES_AppRecord_t * AppRecPtr; + CFE_ES_LibRecord_t * LibRecPtr; /* ** Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(QueryAllFilename, (char *)CmdPtr->FileName, CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE, - sizeof(QueryAllFilename), sizeof(CmdPtr->FileName)); + sizeof(QueryAllFilename), sizeof(CmdPtr->FileName)); /* * Collect list of active resource IDs. @@ -1281,9 +1245,8 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) */ CFE_ES_LockSharedData(__func__, __LINE__); NumResources = 0; - AppRecPtr = CFE_ES_Global.AppTable; - for(i=0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS && - NumResources < CFE_ES_QUERY_ALL_MAX_ENTRIES; ++i) + AppRecPtr = CFE_ES_Global.AppTable; + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS && NumResources < CFE_ES_QUERY_ALL_MAX_ENTRIES; ++i) { if (CFE_ES_AppRecordIsUsed(AppRecPtr)) { @@ -1293,8 +1256,7 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) ++AppRecPtr; } LibRecPtr = CFE_ES_Global.LibTable; - for(i=0; i < CFE_PLATFORM_ES_MAX_LIBRARIES && - NumResources < CFE_ES_QUERY_ALL_MAX_ENTRIES; ++i) + for (i = 0; i < CFE_PLATFORM_ES_MAX_LIBRARIES && NumResources < CFE_ES_QUERY_ALL_MAX_ENTRIES; ++i) { if (CFE_ES_LibRecordIsUsed(LibRecPtr)) { @@ -1308,8 +1270,7 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) /* ** Check to see if the file already exists */ - Result = OS_OpenCreate(&FileDescriptor, QueryAllFilename, - OS_FILE_FLAG_NONE, OS_READ_ONLY); + Result = OS_OpenCreate(&FileDescriptor, QueryAllFilename, OS_FILE_FLAG_NONE, OS_READ_ONLY); if (Result >= 0) { OS_close(FileDescriptor); @@ -1319,8 +1280,8 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) /* ** Create ES task log data file */ - Result = OS_OpenCreate(&FileDescriptor, QueryAllFilename, - OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); + Result = + OS_OpenCreate(&FileDescriptor, QueryAllFilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); if (Result >= 0) { /* @@ -1338,14 +1299,14 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) OS_close(FileDescriptor); CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_WRHDR_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to write App Info file, WriteHdr RC = 0x%08X, exp %d", - (unsigned int)Result,(int)sizeof(CFE_FS_Header_t)); + "Failed to write App Info file, WriteHdr RC = 0x%08X, exp %d", (unsigned int)Result, + (int)sizeof(CFE_FS_Header_t)); /* * returning "success" here as there is no other recourse; * the full extent of the error recovery has been done */ return CFE_SUCCESS; - }/* end if */ + } /* end if */ /* ** Maintain statistics of amount of data written to file @@ -1355,7 +1316,7 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) /* ** Loop through the ES AppTable for main applications */ - for(i=0; i < NumResources; ++i) + for (i = 0; i < NumResources; ++i) { /* ** Populate the AppInfo entry @@ -1367,37 +1328,37 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) ** Write the local entry to file */ Result = OS_write(FileDescriptor, &AppInfo, sizeof(CFE_ES_AppInfo_t)); - if (Result != sizeof(CFE_ES_AppInfo_t)) + if (Result != sizeof(CFE_ES_AppInfo_t)) { OS_close(FileDescriptor); CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_TASKWR_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to write App Info file, Task write RC = 0x%08X, exp %d", - (unsigned int)Result,(int)sizeof(CFE_ES_AppInfo_t)); + "Failed to write App Info file, Task write RC = 0x%08X, exp %d", + (unsigned int)Result, (int)sizeof(CFE_ES_AppInfo_t)); /* * returning "success" here as there is no other recourse; * the full extent of the error recovery has been done */ return CFE_SUCCESS; - }/* end if */ + } /* end if */ FileSize += Result; - EntryCount ++; + EntryCount++; } - + } /* end for */ OS_close(FileDescriptor); CFE_ES_TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_ALL_APPS_EID, CFE_EVS_EventType_DEBUG, - "App Info file written to %s, Entries=%d, FileSize=%d", - QueryAllFilename,(int)EntryCount,(int)FileSize); + "App Info file written to %s, Entries=%d, FileSize=%d", QueryAllFilename, (int)EntryCount, + (int)FileSize); } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_OSCREATE_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to write App Info file, OS_OpenCreate RC = 0x%08X",(unsigned int)Result); + "Failed to write App Info file, OS_OpenCreate RC = 0x%08X", (unsigned int)Result); } return CFE_SUCCESS; @@ -1411,24 +1372,24 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) { - CFE_FS_Header_t FileHeader; - osal_id_t FileDescriptor; - uint32 i; - uint32 EntryCount = 0; - uint32 FileSize = 0; - int32 Result; - CFE_ES_TaskInfo_t TaskInfo; + CFE_FS_Header_t FileHeader; + osal_id_t FileDescriptor; + uint32 i; + uint32 EntryCount = 0; + uint32 FileSize = 0; + int32 Result; + CFE_ES_TaskInfo_t TaskInfo; const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; - char QueryAllFilename[OS_MAX_PATH_LEN]; - CFE_ES_TaskId_t TaskList[OS_MAX_TASKS]; - uint32 NumTasks; - CFE_ES_TaskRecord_t *TaskRecPtr; + char QueryAllFilename[OS_MAX_PATH_LEN]; + CFE_ES_TaskId_t TaskList[OS_MAX_TASKS]; + uint32 NumTasks; + CFE_ES_TaskRecord_t * TaskRecPtr; /* ** Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(QueryAllFilename, (char *)CmdPtr->FileName, CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE, - sizeof(QueryAllFilename), sizeof(CmdPtr->FileName)); + sizeof(QueryAllFilename), sizeof(CmdPtr->FileName)); /* * Collect list of active task IDs. @@ -1437,9 +1398,9 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) * of the AppInfo data should be done while NOT locked. */ CFE_ES_LockSharedData(__func__, __LINE__); - NumTasks = 0; + NumTasks = 0; TaskRecPtr = CFE_ES_Global.TaskTable; - for(i=0; i < OS_MAX_TASKS; ++i) + for (i = 0; i < OS_MAX_TASKS; ++i) { if (CFE_ES_TaskRecordIsUsed(TaskRecPtr)) { @@ -1453,8 +1414,7 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) /* ** Check to see if the file already exists */ - Result = OS_OpenCreate(&FileDescriptor, QueryAllFilename, - OS_FILE_FLAG_NONE, OS_READ_ONLY); + Result = OS_OpenCreate(&FileDescriptor, QueryAllFilename, OS_FILE_FLAG_NONE, OS_READ_ONLY); if (Result >= 0) { OS_close(FileDescriptor); @@ -1464,8 +1424,8 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) /* ** Create ES task log data file */ - Result = OS_OpenCreate(&FileDescriptor, QueryAllFilename, - OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); + Result = + OS_OpenCreate(&FileDescriptor, QueryAllFilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); if (Result >= 0) { /* @@ -1483,14 +1443,14 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) OS_close(FileDescriptor); CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_TASKINFO_WRHDR_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to write Task Info file, WriteHdr RC = 0x%08X, exp %d", - (unsigned int)Result,(int)sizeof(CFE_FS_Header_t)); + "Failed to write Task Info file, WriteHdr RC = 0x%08X, exp %d", (unsigned int)Result, + (int)sizeof(CFE_FS_Header_t)); /* * returning "success" here as there is no other recourse; * the full extent of the error recovery has been done */ return CFE_SUCCESS; - }/* end if */ + } /* end if */ /* ** Maintain statistics of amount of data written to file @@ -1500,7 +1460,7 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) /* ** Loop through the ES AppTable for main applications */ - for(i=0; i < NumTasks; ++i) + for (i = 0; i < NumTasks; ++i) { /* ** Populate the AppInfo entry @@ -1512,22 +1472,22 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) ** Write the local entry to file */ Result = OS_write(FileDescriptor, &TaskInfo, sizeof(CFE_ES_TaskInfo_t)); - if (Result != sizeof(CFE_ES_TaskInfo_t)) + if (Result != sizeof(CFE_ES_TaskInfo_t)) { OS_close(FileDescriptor); CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_TASKINFO_WR_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to write Task Info file, Task write RC = 0x%08X, exp %d", - (unsigned int)Result,(int)sizeof(CFE_ES_TaskInfo_t)); + "Failed to write Task Info file, Task write RC = 0x%08X, exp %d", + (unsigned int)Result, (int)sizeof(CFE_ES_TaskInfo_t)); /* * returning "success" here as there is no other recourse; * the full extent of the error recovery has been done */ return CFE_SUCCESS; - }/* end if */ + } /* end if */ FileSize += Result; - EntryCount ++; + EntryCount++; } } /* end for */ @@ -1535,20 +1495,19 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) OS_close(FileDescriptor); CFE_ES_TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_TASKINFO_EID, CFE_EVS_EventType_DEBUG, - "Task Info file written to %s, Entries=%d, FileSize=%d", - QueryAllFilename,(int)EntryCount,(int)FileSize); + "Task Info file written to %s, Entries=%d, FileSize=%d", QueryAllFilename, (int)EntryCount, + (int)FileSize); } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_TASKINFO_OSCREATE_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed to write Task Info file, OS_OpenCreate RC = 0x%08X",(unsigned int)Result); + "Failed to write Task Info file, OS_OpenCreate RC = 0x%08X", (unsigned int)Result); } return CFE_SUCCESS; } /* End of CFE_ES_QueryAllTasksCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_ClearSysLogCmd() -- Clear executive services system log */ @@ -1561,16 +1520,15 @@ int32 CFE_ES_ClearSysLogCmd(const CFE_ES_ClearSysLogCmd_t *data) ** Clear syslog index and memory area */ - CFE_ES_LockSharedData(__func__,__LINE__); + CFE_ES_LockSharedData(__func__, __LINE__); CFE_ES_SysLogClear_Unsync(); - CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_UnlockSharedData(__func__, __LINE__); /* ** This command will always succeed... */ CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_SYSLOG1_INF_EID, CFE_EVS_EventType_INFORMATION, - "Cleared Executive Services log data"); + CFE_EVS_SendEvent(CFE_ES_SYSLOG1_INF_EID, CFE_EVS_EventType_INFORMATION, "Cleared Executive Services log data"); return CFE_SUCCESS; } /* End of CFE_ES_ClearSysLogCmd() */ @@ -1583,24 +1541,22 @@ int32 CFE_ES_ClearSysLogCmd(const CFE_ES_ClearSysLogCmd_t *data) int32 CFE_ES_OverWriteSysLogCmd(const CFE_ES_OverWriteSysLogCmd_t *data) { - int32 Status; + int32 Status; const CFE_ES_OverWriteSysLogCmd_Payload_t *CmdPtr = &data->Payload; Status = CFE_ES_SysLogSetMode(CmdPtr->Mode); if (Status != CFE_SUCCESS) { - CFE_EVS_SendEvent(CFE_ES_ERR_SYSLOGMODE_EID, - CFE_EVS_EventType_ERROR, - "Set OverWriteSysLog Command: Invalid Mode setting = %d", (int)CmdPtr->Mode); + CFE_EVS_SendEvent(CFE_ES_ERR_SYSLOGMODE_EID, CFE_EVS_EventType_ERROR, + "Set OverWriteSysLog Command: Invalid Mode setting = %d", (int)CmdPtr->Mode); CFE_ES_TaskData.CommandErrorCounter++; } else { - CFE_EVS_SendEvent(CFE_ES_SYSLOGMODE_EID, - CFE_EVS_EventType_DEBUG, - "Set OverWriteSysLog Command Received with Mode setting = %d", (int)CmdPtr->Mode); + CFE_EVS_SendEvent(CFE_ES_SYSLOGMODE_EID, CFE_EVS_EventType_DEBUG, + "Set OverWriteSysLog Command Received with Mode setting = %d", (int)CmdPtr->Mode); CFE_ES_TaskData.CommandCounter++; } @@ -1608,7 +1564,6 @@ int32 CFE_ES_OverWriteSysLogCmd(const CFE_ES_OverWriteSysLogCmd_t *data) return CFE_SUCCESS; } /* End CFE_ES_OverWriteSysLogCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_WriteSysLogCmd() -- Process Cmd to write ES System Log to file */ @@ -1618,26 +1573,25 @@ int32 CFE_ES_OverWriteSysLogCmd(const CFE_ES_OverWriteSysLogCmd_t *data) int32 CFE_ES_WriteSysLogCmd(const CFE_ES_WriteSysLogCmd_t *data) { const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; - int32 Stat; - char LogFilename[OS_MAX_PATH_LEN]; + int32 Stat; + char LogFilename[OS_MAX_PATH_LEN]; CFE_SB_MessageStringGet(LogFilename, (char *)CmdPtr->FileName, CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE, - sizeof(LogFilename), sizeof(CmdPtr->FileName)); + sizeof(LogFilename), sizeof(CmdPtr->FileName)); Stat = CFE_ES_SysLogDump(LogFilename); - if(Stat == CFE_SUCCESS) + if (Stat == CFE_SUCCESS) { CFE_ES_TaskData.CommandCounter++; } else { CFE_ES_TaskData.CommandErrorCounter++; - }/* end if */ + } /* end if */ return CFE_SUCCESS; -}/* end CFE_ES_WriteSysLogCmd */ - +} /* end CFE_ES_WriteSysLogCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -1668,8 +1622,7 @@ int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLogCmd_t *data) ** This command will always succeed */ CFE_ES_TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_ERLOG1_INF_EID, CFE_EVS_EventType_INFORMATION, - "Cleared ES Exception and Reset Log data"); + CFE_EVS_SendEvent(CFE_ES_ERLOG1_INF_EID, CFE_EVS_EventType_INFORMATION, "Cleared ES Exception and Reset Log data"); return CFE_SUCCESS; } /* End of CFE_ES_ClearERLogCmd() */ @@ -1683,8 +1636,8 @@ int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLogCmd_t *data) int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLogCmd_t *data) { const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; - CFE_ES_BackgroundLogDumpGlobal_t *StatePtr; - int32 Status; + CFE_ES_BackgroundLogDumpGlobal_t * StatePtr; + int32 Status; StatePtr = &CFE_ES_TaskData.BackgroundERLogDumpState; @@ -1698,8 +1651,8 @@ int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLogCmd_t *data) /* Reset the entire state object (just for good measure, ensure no stale data) */ memset(StatePtr, 0, sizeof(*StatePtr)); - /* - * Fill out the remainder of meta data. + /* + * Fill out the remainder of meta data. * This data is currently the same for every request */ StatePtr->FileWrite.FileSubType = CFE_FS_SubType_ES_ERLOG; @@ -1708,30 +1661,27 @@ int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLogCmd_t *data) StatePtr->FileWrite.GetData = CFE_ES_BackgroundERLogFileDataGetter; StatePtr->FileWrite.OnEvent = CFE_ES_BackgroundERLogFileEventHandler; - CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->FileName, - CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE, - sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->FileName)); + CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->FileName, CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE, + sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->FileName)); Status = CFE_FS_BackgroundFileDumpRequest(&StatePtr->FileWrite); } if (Status != CFE_SUCCESS) { - CFE_EVS_SendEvent(CFE_ES_ERLOG_PENDING_ERR_EID,CFE_EVS_EventType_ERROR, - "Error log write to file %s already in progress", - StatePtr->FileWrite.FileName); + CFE_EVS_SendEvent(CFE_ES_ERLOG_PENDING_ERR_EID, CFE_EVS_EventType_ERROR, + "Error log write to file %s already in progress", StatePtr->FileWrite.FileName); /* background dump already running, consider this an error */ CFE_ES_TaskData.CommandErrorCounter++; - } + } else { CFE_ES_TaskData.CommandCounter++; - } + } return CFE_SUCCESS; -}/* end CFE_ES_WriteERLogCmd */ - +} /* end CFE_ES_WriteERLogCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -1758,17 +1708,16 @@ bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) CFE_EVS_SendEvent(CFE_ES_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, - (unsigned int)ActualLength, (unsigned int)ExpectedLength); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength, + (unsigned int)ExpectedLength); result = false; CFE_ES_TaskData.CommandErrorCounter++; } - return(result); + return (result); } /* End of CFE_ES_VerifyCmdLength() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_ES_ResetPRCountCmd() -- ES task ground command */ @@ -1786,8 +1735,7 @@ int32 CFE_ES_ResetPRCountCmd(const CFE_ES_ResetPRCountCmd_t *data) /* ** This command will always succeed. */ - CFE_EVS_SendEvent(CFE_ES_RESET_PR_COUNT_EID, CFE_EVS_EventType_INFORMATION, - "Set Processor Reset Count to Zero"); + CFE_EVS_SendEvent(CFE_ES_RESET_PR_COUNT_EID, CFE_EVS_EventType_INFORMATION, "Set Processor Reset Count to Zero"); CFE_ES_TaskData.CommandCounter++; @@ -1813,7 +1761,7 @@ int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCountCmd_t *data) ** This command will always succeed. */ CFE_EVS_SendEvent(CFE_ES_SET_MAX_PR_COUNT_EID, CFE_EVS_EventType_INFORMATION, - "Maximum Processor Reset Count set to: %d", (int)cmd->MaxPRCount); + "Maximum Processor Reset Count set to: %d", (int)cmd->MaxPRCount); CFE_ES_TaskData.CommandCounter++; @@ -1828,49 +1776,47 @@ int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCountCmd_t *data) int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDSCmd_t *data) { - int32 Status; + int32 Status; const CFE_ES_DeleteCDSCmd_Payload_t *cmd = &data->Payload; - char LocalCdsName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; + char LocalCdsName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; - CFE_SB_MessageStringGet(LocalCdsName, (char *)cmd->CdsName, NULL, - sizeof(LocalCdsName), sizeof(cmd->CdsName)); + CFE_SB_MessageStringGet(LocalCdsName, (char *)cmd->CdsName, NULL, sizeof(LocalCdsName), sizeof(cmd->CdsName)); Status = CFE_ES_DeleteCDS(LocalCdsName, false); if (Status == CFE_ES_CDS_WRONG_TYPE_ERR) { CFE_EVS_SendEvent(CFE_ES_CDS_DELETE_TBL_ERR_EID, CFE_EVS_EventType_ERROR, - "CDS '%s' is a Critical Table CDS. Must be deleted via TBL Command", - LocalCdsName); + "CDS '%s' is a Critical Table CDS. Must be deleted via TBL Command", LocalCdsName); CFE_ES_TaskData.CommandErrorCounter++; } else if (Status == CFE_ES_CDS_OWNER_ACTIVE_ERR) { CFE_EVS_SendEvent(CFE_ES_CDS_OWNER_ACTIVE_EID, CFE_EVS_EventType_ERROR, - "CDS '%s' not deleted because owning app is active", LocalCdsName); + "CDS '%s' not deleted because owning app is active", LocalCdsName); CFE_ES_TaskData.CommandErrorCounter++; } else if (Status == CFE_ES_ERR_NAME_NOT_FOUND) { - CFE_EVS_SendEvent(CFE_ES_CDS_NAME_ERR_EID, CFE_EVS_EventType_ERROR, - "Unable to locate '%s' in CDS Registry", LocalCdsName); + CFE_EVS_SendEvent(CFE_ES_CDS_NAME_ERR_EID, CFE_EVS_EventType_ERROR, "Unable to locate '%s' in CDS Registry", + LocalCdsName); CFE_ES_TaskData.CommandErrorCounter++; } else if (Status != CFE_SUCCESS) { CFE_EVS_SendEvent(CFE_ES_CDS_DELETE_ERR_EID, CFE_EVS_EventType_ERROR, - "Error while deleting '%s' from CDS, See SysLog.(Err=0x%08X)", - LocalCdsName, (unsigned int)Status); + "Error while deleting '%s' from CDS, See SysLog.(Err=0x%08X)", LocalCdsName, + (unsigned int)Status); CFE_ES_TaskData.CommandErrorCounter++; } else { CFE_EVS_SendEvent(CFE_ES_CDS_DELETED_INFO_EID, CFE_EVS_EventType_INFORMATION, - "Successfully removed '%s' from CDS", LocalCdsName); + "Successfully removed '%s' from CDS", LocalCdsName); CFE_ES_TaskData.CommandCounter++; } @@ -1890,13 +1836,13 @@ int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDSCmd_t *data) int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data) { const CFE_ES_SendMemPoolStatsCmd_Payload_t *Cmd; - CFE_ES_MemHandle_t MemHandle; - bool ValidHandle; + CFE_ES_MemHandle_t MemHandle; + bool ValidHandle; Cmd = &data->Payload; /* Verify the handle to make sure it is legit */ - MemHandle = Cmd->PoolHandle; + MemHandle = Cmd->PoolHandle; ValidHandle = CFE_ES_ValidateHandle(MemHandle); if (ValidHandle) @@ -1915,15 +1861,15 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data) CFE_ES_TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_TLM_POOL_STATS_INFO_EID, CFE_EVS_EventType_DEBUG, - "Successfully telemetered memory pool stats for 0x%08lX", - CFE_RESOURCEID_TO_ULONG(Cmd->PoolHandle)); + "Successfully telemetered memory pool stats for 0x%08lX", + CFE_RESOURCEID_TO_ULONG(Cmd->PoolHandle)); } else { CFE_ES_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_INVALID_POOL_HANDLE_ERR_EID, CFE_EVS_EventType_ERROR, - "Cannot telemeter memory pool stats. Illegal Handle (0x%08lX)", - CFE_RESOURCEID_TO_ULONG(Cmd->PoolHandle)); + "Cannot telemeter memory pool stats. Illegal Handle (0x%08lX)", + CFE_RESOURCEID_TO_ULONG(Cmd->PoolHandle)); } return CFE_SUCCESS; @@ -1937,24 +1883,23 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data) int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) { - CFE_FS_Header_t StdFileHeader; - osal_id_t FileDescriptor; - int32 Status; - int16 RegIndex=0; - const CFE_ES_DumpCDSRegistryCmd_Payload_t *CmdPtr = &data->Payload; - char DumpFilename[OS_MAX_PATH_LEN]; - CFE_ES_CDS_RegRec_t *RegRecPtr; - CFE_ES_CDSRegDumpRec_t DumpRecord; - int32 FileSize=0; - int32 NumEntries=0; + CFE_FS_Header_t StdFileHeader; + osal_id_t FileDescriptor; + int32 Status; + int16 RegIndex = 0; + const CFE_ES_DumpCDSRegistryCmd_Payload_t *CmdPtr = &data->Payload; + char DumpFilename[OS_MAX_PATH_LEN]; + CFE_ES_CDS_RegRec_t * RegRecPtr; + CFE_ES_CDSRegDumpRec_t DumpRecord; + int32 FileSize = 0; + int32 NumEntries = 0; /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(DumpFilename, CmdPtr->DumpFilename, CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE, - sizeof(DumpFilename), sizeof(CmdPtr->DumpFilename)); + sizeof(DumpFilename), sizeof(CmdPtr->DumpFilename)); /* Create a new dump file, overwriting anything that may have existed previously */ - Status = OS_OpenCreate(&FileDescriptor, DumpFilename, - OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); + Status = OS_OpenCreate(&FileDescriptor, DumpFilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); if (Status >= OS_SUCCESS) { @@ -1969,24 +1914,22 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) if (Status == sizeof(CFE_FS_Header_t)) { - Status = sizeof(CFE_ES_CDSRegDumpRec_t); + Status = sizeof(CFE_ES_CDSRegDumpRec_t); RegRecPtr = CFE_ES_Global.CDSVars.Registry; while ((RegIndex < CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES) && (Status == sizeof(CFE_ES_CDSRegDumpRec_t))) { /* Check to see if the Registry entry is empty */ - if ( CFE_ES_CDSBlockRecordIsUsed(RegRecPtr) ) + if (CFE_ES_CDSBlockRecordIsUsed(RegRecPtr)) { /* Fill CDS Registry Dump Record with relevant information */ memset(&DumpRecord, 0, sizeof(DumpRecord)); - DumpRecord.Size = CFE_ES_MEMOFFSET_C(CFE_ES_CDSBlockRecordGetUserSize(RegRecPtr)); - DumpRecord.Handle = CFE_ES_CDSBlockRecordGetID(RegRecPtr); - DumpRecord.Table = RegRecPtr->Table; - strncpy(DumpRecord.Name, RegRecPtr->Name, sizeof(DumpRecord.Name)-1); + DumpRecord.Size = CFE_ES_MEMOFFSET_C(CFE_ES_CDSBlockRecordGetUserSize(RegRecPtr)); + DumpRecord.Handle = CFE_ES_CDSBlockRecordGetID(RegRecPtr); + DumpRecord.Table = RegRecPtr->Table; + strncpy(DumpRecord.Name, RegRecPtr->Name, sizeof(DumpRecord.Name) - 1); /* Output Registry Dump Record to Registry Dump File */ - Status = OS_write(FileDescriptor, - &DumpRecord, - sizeof(CFE_ES_CDSRegDumpRec_t)); + Status = OS_write(FileDescriptor, &DumpRecord, sizeof(CFE_ES_CDSRegDumpRec_t)); FileSize += Status; NumEntries++; @@ -1999,20 +1942,18 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) if (Status == sizeof(CFE_ES_CDSRegDumpRec_t)) { - CFE_EVS_SendEvent(CFE_ES_CDS_REG_DUMP_INF_EID, - CFE_EVS_EventType_DEBUG, - "Successfully dumped CDS Registry to '%s':Size=%d,Entries=%d", - DumpFilename, (int)FileSize, (int)NumEntries); + CFE_EVS_SendEvent(CFE_ES_CDS_REG_DUMP_INF_EID, CFE_EVS_EventType_DEBUG, + "Successfully dumped CDS Registry to '%s':Size=%d,Entries=%d", DumpFilename, + (int)FileSize, (int)NumEntries); /* Increment Successful Command Counter */ CFE_ES_TaskData.CommandCounter++; } else { - CFE_EVS_SendEvent(CFE_ES_CDS_DUMP_ERR_EID, - CFE_EVS_EventType_ERROR, - "Error writing CDS Registry to '%s', Status=0x%08X", - DumpFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_ES_CDS_DUMP_ERR_EID, CFE_EVS_EventType_ERROR, + "Error writing CDS Registry to '%s', Status=0x%08X", DumpFilename, + (unsigned int)Status); /* Increment Command Error Counter */ CFE_ES_TaskData.CommandErrorCounter++; @@ -2020,10 +1961,9 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) } else { - CFE_EVS_SendEvent(CFE_ES_WRITE_CFE_HDR_ERR_EID, - CFE_EVS_EventType_ERROR, - "Error writing cFE File Header to '%s', Status=0x%08X", - DumpFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_ES_WRITE_CFE_HDR_ERR_EID, CFE_EVS_EventType_ERROR, + "Error writing cFE File Header to '%s', Status=0x%08X", DumpFilename, + (unsigned int)Status); /* Increment Command Error Counter */ CFE_ES_TaskData.CommandErrorCounter++; @@ -2034,10 +1974,8 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) } else { - CFE_EVS_SendEvent(CFE_ES_CREATING_CDS_DUMP_ERR_EID, - CFE_EVS_EventType_ERROR, - "Error creating CDS dump file '%s', Status=0x%08X", - DumpFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_ES_CREATING_CDS_DUMP_ERR_EID, CFE_EVS_EventType_ERROR, + "Error creating CDS dump file '%s', Status=0x%08X", DumpFilename, (unsigned int)Status); /* Increment Command Error Counter */ CFE_ES_TaskData.CommandErrorCounter++; @@ -2052,18 +1990,15 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) /* a byte count discrepancy has been*/ /* detected during the file write */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_ES_FileWriteByteCntErr(const char *Filename,size_t Requested,size_t Actual) +void CFE_ES_FileWriteByteCntErr(const char *Filename, size_t Requested, size_t Actual) { - CFE_EVS_SendEvent(CFE_ES_FILEWRITE_ERR_EID,CFE_EVS_EventType_ERROR, - "File write,byte cnt err,file %s,request=%u,actual=%u", - Filename,(unsigned int)Requested,(unsigned int)Actual); + CFE_EVS_SendEvent(CFE_ES_FILEWRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "File write,byte cnt err,file %s,request=%u,actual=%u", Filename, (unsigned int)Requested, + (unsigned int)Actual); - -}/* End of CFE_ES_FileWriteByteCntErr() */ +} /* End of CFE_ES_FileWriteByteCntErr() */ /************************/ /* End of File Comment */ /************************/ - - diff --git a/modules/es/fsw/src/cfe_es_task.h b/modules/es/fsw/src/cfe_es_task.h index d52a7207b..2dd8f25e2 100644 --- a/modules/es/fsw/src/cfe_es_task.h +++ b/modules/es/fsw/src/cfe_es_task.h @@ -55,17 +55,17 @@ /* ** ES File descriptions */ -#define CFE_ES_SYS_LOG_DESC "ES system log data file" -#define CFE_ES_TASK_LOG_DESC "ES Task Info file" -#define CFE_ES_APP_LOG_DESC "ES Application Info file" -#define CFE_ES_ER_LOG_DESC "ES ERlog data file" -#define CFE_ES_PERF_LOG_DESC "ES Performance data file" +#define CFE_ES_SYS_LOG_DESC "ES system log data file" +#define CFE_ES_TASK_LOG_DESC "ES Task Info file" +#define CFE_ES_APP_LOG_DESC "ES Application Info file" +#define CFE_ES_ER_LOG_DESC "ES ERlog data file" +#define CFE_ES_PERF_LOG_DESC "ES Performance data file" /* * Limit for the total number of entries that may be * produced by a "query all" type command. */ -#define CFE_ES_QUERY_ALL_MAX_ENTRIES (CFE_PLATFORM_ES_MAX_APPLICATIONS + CFE_PLATFORM_ES_MAX_LIBRARIES) +#define CFE_ES_QUERY_ALL_MAX_ENTRIES (CFE_PLATFORM_ES_MAX_APPLICATIONS + CFE_PLATFORM_ES_MAX_LIBRARIES) /*************************************************************************/ /* @@ -90,8 +90,8 @@ */ typedef struct { - CFE_FS_FileWriteMetaData_t FileWrite; /**< FS state data - must be first */ - CFE_ES_ERLog_FileEntry_t EntryBuffer; /**< Temp holding area for record to write */ + CFE_FS_FileWriteMetaData_t FileWrite; /**< FS state data - must be first */ + CFE_ES_ERLog_FileEntry_t EntryBuffer; /**< Temp holding area for record to write */ } CFE_ES_BackgroundLogDumpGlobal_t; /* @@ -99,46 +99,46 @@ typedef struct */ typedef struct { - /* - ** ES Task command interface counters - */ - uint8 CommandCounter; - uint8 CommandErrorCounter; - - /* - ** ES Task housekeeping telemetry - */ - CFE_ES_HousekeepingTlm_t HkPacket; - - /* - ** Single application telemetry - */ - CFE_ES_OneAppTlm_t OneAppPacket; - - /* - ** Memory statistics telemetry - */ - CFE_ES_MemStatsTlm_t MemStatsPacket; - - /* - ** ES Task operational data (not reported in housekeeping) - */ - CFE_SB_PipeId_t CmdPipe; - - /* - ** ES Task initialization data (not reported in housekeeping) - */ - CFE_ES_BackgroundLogDumpGlobal_t BackgroundERLogDumpState; - - /* - * Persistent state data associated with performance log data file writes - */ - CFE_ES_PerfDumpGlobal_t BackgroundPerfDumpState; - - /* - * Persistent state data associated with background app table scans - */ - CFE_ES_AppTableScanState_t BackgroundAppScanState; + /* + ** ES Task command interface counters + */ + uint8 CommandCounter; + uint8 CommandErrorCounter; + + /* + ** ES Task housekeeping telemetry + */ + CFE_ES_HousekeepingTlm_t HkPacket; + + /* + ** Single application telemetry + */ + CFE_ES_OneAppTlm_t OneAppPacket; + + /* + ** Memory statistics telemetry + */ + CFE_ES_MemStatsTlm_t MemStatsPacket; + + /* + ** ES Task operational data (not reported in housekeeping) + */ + CFE_SB_PipeId_t CmdPipe; + + /* + ** ES Task initialization data (not reported in housekeeping) + */ + CFE_ES_BackgroundLogDumpGlobal_t BackgroundERLogDumpState; + + /* + * Persistent state data associated with performance log data file writes + */ + CFE_ES_PerfDumpGlobal_t BackgroundPerfDumpState; + + /* + * Persistent state data associated with background app table scans + */ + CFE_ES_AppTableScanState_t BackgroundAppScanState; } CFE_ES_TaskData_t; @@ -147,8 +147,6 @@ typedef struct */ extern CFE_ES_TaskData_t CFE_ES_TaskData; - - /*************************************************************************/ /* @@ -158,7 +156,6 @@ void CFE_ES_TaskMain(void); int32 CFE_ES_TaskInit(void); void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr); - /* * Functions related to the ES background helper task for low-priority tasks */ @@ -198,9 +195,9 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data); /* ** Message Handler Helper Functions */ -bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle); +bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle); bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); -void CFE_ES_FileWriteByteCntErr(const char *Filename,size_t Requested,size_t Actual); +void CFE_ES_FileWriteByteCntErr(const char *Filename, size_t Requested, size_t Actual); /*************************************************************************/ @@ -209,4 +206,3 @@ void CFE_ES_FileWriteByteCntErr(const char *Filename,size_t Requested,size_t Act /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/es/fsw/src/cfe_es_verify.h b/modules/es/fsw/src/cfe_es_verify.h index 63d48f4cc..f04976cbb 100644 --- a/modules/es/fsw/src/cfe_es_verify.h +++ b/modules/es/fsw/src/cfe_es_verify.h @@ -40,302 +40,300 @@ #include -#if CFE_PLATFORM_ES_MAX_APPLICATIONS < 6 - #error CFE_PLATFORM_ES_MAX_APPLICATIONS cannot be less than 6! +#if CFE_PLATFORM_ES_MAX_APPLICATIONS < 6 +#error CFE_PLATFORM_ES_MAX_APPLICATIONS cannot be less than 6! #endif -#if CFE_PLATFORM_ES_MAX_LIBRARIES < 1 - #error CFE_PLATFORM_ES_MAX_LIBRARIES cannot be less than 1! +#if CFE_PLATFORM_ES_MAX_LIBRARIES < 1 +#error CFE_PLATFORM_ES_MAX_LIBRARIES cannot be less than 1! #endif -#if CFE_PLATFORM_ES_ER_LOG_ENTRIES < 1 - #error CFE_PLATFORM_ES_ER_LOG_ENTRIES cannot be less than 10! +#if CFE_PLATFORM_ES_ER_LOG_ENTRIES < 1 +#error CFE_PLATFORM_ES_ER_LOG_ENTRIES cannot be less than 10! #endif -#if CFE_PLATFORM_ES_SYSTEM_LOG_SIZE < 512 - #error CFE_PLATFORM_ES_SYSTEM_LOG_SIZE cannot be less than 512 Bytes! +#if CFE_PLATFORM_ES_SYSTEM_LOG_SIZE < 512 +#error CFE_PLATFORM_ES_SYSTEM_LOG_SIZE cannot be less than 512 Bytes! #endif -#if CFE_PLATFORM_ES_DEFAULT_STACK_SIZE < 2048 - #error CFE_PLATFORM_ES_DEFAULT_STACK_SIZE cannot be less than 2048 Bytes! +#if CFE_PLATFORM_ES_DEFAULT_STACK_SIZE < 2048 +#error CFE_PLATFORM_ES_DEFAULT_STACK_SIZE cannot be less than 2048 Bytes! #endif /* ** Number of entries in the ES Object table ( The table that controls core cFE startup ) */ -#if CFE_PLATFORM_ES_OBJECT_TABLE_SIZE < 15 - #error CFE_PLATFORM_ES_OBJECT_TABLE_SIZE cannot be less than 15! +#if CFE_PLATFORM_ES_OBJECT_TABLE_SIZE < 15 +#error CFE_PLATFORM_ES_OBJECT_TABLE_SIZE cannot be less than 15! #endif /* -** ES Application Control Scan Rate. +** ES Application Control Scan Rate. */ -#if CFE_PLATFORM_ES_APP_SCAN_RATE < 100 - #error CFE_PLATFORM_ES_APP_SCAN_RATE cannot be less than 100 milliseconds! -#elif CFE_PLATFORM_ES_APP_SCAN_RATE > 20000 - #error CFE_PLATFORM_ES_APP_SCAN_RATE cannot be greater than 20 seconds! +#if CFE_PLATFORM_ES_APP_SCAN_RATE < 100 +#error CFE_PLATFORM_ES_APP_SCAN_RATE cannot be less than 100 milliseconds! +#elif CFE_PLATFORM_ES_APP_SCAN_RATE > 20000 +#error CFE_PLATFORM_ES_APP_SCAN_RATE cannot be greater than 20 seconds! #endif /* -** ES Application Kill Timeout +** ES Application Kill Timeout */ -#if CFE_PLATFORM_ES_APP_KILL_TIMEOUT < 1 - #error CFE_PLATFORM_ES_APP_KILL_TIMEOUT cannot be less than 1! -#elif CFE_PLATFORM_ES_APP_KILL_TIMEOUT > 100 - #error CFE_PLATFORM_ES_APP_KILL_TIMEOUT cannot be greater than 100! +#if CFE_PLATFORM_ES_APP_KILL_TIMEOUT < 1 +#error CFE_PLATFORM_ES_APP_KILL_TIMEOUT cannot be less than 1! +#elif CFE_PLATFORM_ES_APP_KILL_TIMEOUT > 100 +#error CFE_PLATFORM_ES_APP_KILL_TIMEOUT cannot be greater than 100! #endif /* -** ES / cFE RAM disk parameters +** ES / cFE RAM disk parameters */ -#if CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE < 128 - #error CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE cannot be less than 128! +#if CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE < 128 +#error CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE cannot be less than 128! #endif -#if CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS < 128 - #error CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS cannot be less than 128! +#if CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS < 128 +#error CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS cannot be less than 128! #endif -#if CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED < 0 - #error CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED cannot be less than 0! -#elif CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED > 75 - #error CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED cannot be greater than 75! +#if CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED < 0 +#error CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED cannot be less than 0! +#elif CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED > 75 +#error CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED cannot be greater than 75! #endif /* -** Critical data store size +** Critical data store size */ -#if CFE_PLATFORM_ES_CDS_SIZE < ( 8 * 1024 ) - #error CFE_PLATFORM_ES_CDS_SIZE cannot be less than 8Kbytes! -#elif CFE_PLATFORM_ES_CDS_SIZE > UINT32_MAX - #error CFE_PLATFORM_ES_CDS_SIZE cannot be greater than UINT32_MAX (4 Gigabytes)! +#if CFE_PLATFORM_ES_CDS_SIZE < (8 * 1024) +#error CFE_PLATFORM_ES_CDS_SIZE cannot be less than 8Kbytes! +#elif CFE_PLATFORM_ES_CDS_SIZE > UINT32_MAX +#error CFE_PLATFORM_ES_CDS_SIZE cannot be greater than UINT32_MAX (4 Gigabytes)! #endif /* -** User Reserved Memory Size. +** User Reserved Memory Size. */ -#if CFE_PLATFORM_ES_USER_RESERVED_SIZE < ( 1 * 1024 ) - #error CFE_PLATFORM_ES_USER_RESERVED_SIZE cannot be less than 1Kbytes! -#elif CFE_PLATFORM_ES_USER_RESERVED_SIZE > UINT32_MAX - #error CFE_PLATFORM_ES_USER_RESERVED_SIZE cannot be greater than UINT32_MAX (4 Gigabytes)! +#if CFE_PLATFORM_ES_USER_RESERVED_SIZE < (1 * 1024) +#error CFE_PLATFORM_ES_USER_RESERVED_SIZE cannot be less than 1Kbytes! +#elif CFE_PLATFORM_ES_USER_RESERVED_SIZE > UINT32_MAX +#error CFE_PLATFORM_ES_USER_RESERVED_SIZE cannot be greater than UINT32_MAX (4 Gigabytes)! #endif -/* +/* ** SysLog mode */ -#if CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE < 0 - #error CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE cannot be less than 0! -#elif CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE > 1 - #error CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE cannot be greater than 1! +#if CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE < 0 +#error CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE cannot be less than 0! +#elif CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE > 1 +#error CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE cannot be greater than 1! #endif -/* -** Maximum number of performance IDs +/* +** Maximum number of performance IDs */ -#if CFE_MISSION_ES_PERF_MAX_IDS < 32 - #error CFE_MISSION_ES_PERF_MAX_IDS cannot be less than 32! +#if CFE_MISSION_ES_PERF_MAX_IDS < 32 +#error CFE_MISSION_ES_PERF_MAX_IDS cannot be less than 32! #endif -/* +/* ** Performance data buffer size */ -#if CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE < 1025 - #error CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE cannot be less than 1025 entries! +#if CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE < 1025 +#error CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE cannot be less than 1025 entries! #endif -/* +/* ** Maximum number of Registered CDS blocks */ -#if CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES < 8 - #error CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES cannot be less than 8! +#if CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES < 8 +#error CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES cannot be less than 8! #endif -/* +/* ** Maximum number of processor resets before a power-on */ -#if CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS < 0 - #error CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS cannot be less than 0! +#if CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS < 0 +#error CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS cannot be less than 0! #endif /* ** Alignment of ES memory pool */ #if CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN <= 0 - #error CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN cannot be 0! +#error CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN cannot be 0! #elif (CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN & (CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN - 1)) != 0 - #error CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN must be a power of 2! +#error CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN must be a power of 2! #endif /* ** Intermediate ES Memory Pool Block Sizes */ #if CFE_PLATFORM_ES_MAX_BLOCK_SIZE < CFE_MISSION_SB_MAX_SB_MSG_SIZE - #error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be larger than CFE_MISSION_SB_MAX_SB_MSG_SIZE! +#error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be larger than CFE_MISSION_SB_MAX_SB_MSG_SIZE! #endif #if CFE_PLATFORM_ES_MAX_BLOCK_SIZE < CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE - #error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be larger than CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE! +#error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be larger than CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE! #endif #if CFE_PLATFORM_ES_MAX_BLOCK_SIZE < CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE - #error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be larger than CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE! +#error CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be larger than CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE! #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 > CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 #endif #if CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 > CFE_PLATFORM_ES_MAX_BLOCK_SIZE - #error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_ES_MAX_BLOCK_SIZE +#error CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_ES_MAX_BLOCK_SIZE #endif /* ** Intermediate ES Critical Data Store Memory Pool Block Sizes */ #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 > CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 #endif #if CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 > CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE - #error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE +#error CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE #endif /* ** Validate task stack size... */ #if CFE_PLATFORM_ES_START_TASK_STACK_SIZE < 2048 - #error CFE_PLATFORM_ES_START_TASK_STACK_SIZE must be greater than or equal to 2048 +#error CFE_PLATFORM_ES_START_TASK_STACK_SIZE must be greater than or equal to 2048 #endif - #if ((CFE_MISSION_MAX_API_LEN % 4) != 0) - #error CFE_MISSION_MAX_API_LEN must be a multiple of 4 +#error CFE_MISSION_MAX_API_LEN must be a multiple of 4 #endif #if ((CFE_MISSION_MAX_PATH_LEN % 4) != 0) - #error CFE_MISSION_MAX_PATH_LEN must be a multiple of 4 +#error CFE_MISSION_MAX_PATH_LEN must be a multiple of 4 #endif #if ((CFE_MISSION_MAX_FILE_LEN % 4) != 0) - #error CFE_MISSION_MAX_FILE_LEN must be a multiple of 4 +#error CFE_MISSION_MAX_FILE_LEN must be a multiple of 4 #endif #if ((CFE_MISSION_ES_CDS_MAX_NAME_LENGTH % 4) != 0) - #error CFE_MISSION_ES_CDS_MAX_NAME_LENGTH must be a multiple of 4 +#error CFE_MISSION_ES_CDS_MAX_NAME_LENGTH must be a multiple of 4 #endif #if ((CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN % 4) != 0) - #error CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN must be a multiple of 4 +#error CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN must be a multiple of 4 #endif - #endif /* _cfe_es_verify_ */ /*****************************************************************************/ diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index ad3587284..67e48dc4f 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -40,23 +40,23 @@ */ #include "es_UT.h" -#define ES_UT_CDS_BLOCK_SIZE 16 +#define ES_UT_CDS_BLOCK_SIZE 16 /* * A size which meets the minimum CDS size * requirements for the implementation, but * not much larger. */ -#define ES_UT_CDS_SMALL_TEST_SIZE (56 * 1024) +#define ES_UT_CDS_SMALL_TEST_SIZE (56 * 1024) /* * A size which has room for actual allocations */ -#define ES_UT_CDS_LARGE_TEST_SIZE (128 * 1024) +#define ES_UT_CDS_LARGE_TEST_SIZE (128 * 1024) -extern CFE_ES_PerfData_t *Perf; -extern CFE_ES_Global_t CFE_ES_Global; -extern CFE_ES_TaskData_t CFE_ES_TaskData; +extern CFE_ES_PerfData_t *Perf; +extern CFE_ES_Global_t CFE_ES_Global; +extern CFE_ES_TaskData_t CFE_ES_TaskData; extern int32 dummy_function(void); @@ -67,159 +67,80 @@ extern int32 dummy_function(void); /* Buffers to support memory pool testing */ typedef union { - CFE_ES_PoolAlign_t Align; /* make aligned */ - uint8 Data[300]; + CFE_ES_PoolAlign_t Align; /* make aligned */ + uint8 Data[300]; } CFE_ES_GMP_DirectBuffer_t; typedef struct { - CFE_ES_GenPoolBD_t BD; - CFE_ES_PoolAlign_t Align; /* make aligned */ - uint8 Spare; /* make unaligned */ - uint8 Data[(sizeof(CFE_ES_GenPoolBD_t) * 4) + 157]; /* oddball size */ + CFE_ES_GenPoolBD_t BD; + CFE_ES_PoolAlign_t Align; /* make aligned */ + uint8 Spare; /* make unaligned */ + uint8 Data[(sizeof(CFE_ES_GenPoolBD_t) * 4) + 157]; /* oddball size */ } CFE_ES_GMP_IndirectBuffer_t; - CFE_ES_GMP_DirectBuffer_t UT_MemPoolDirectBuffer; CFE_ES_GMP_IndirectBuffer_t UT_MemPoolIndirectBuffer; /* Create a startup script buffer for a maximum of 5 lines * 80 chars/line */ char StartupScript[MAX_STARTUP_SCRIPT]; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_NOOP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_NOOP_CC -}; - -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_RESET_COUNTERS_CC -}; - -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESTART_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_RESTART_CC -}; - -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_START_APP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_START_APP_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_STOP_APP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_STOP_APP_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESTART_APP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_RESTART_APP_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RELOAD_APP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_RELOAD_APP_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ONE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_QUERY_ONE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ALL_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_QUERY_ALL_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_QUERY_ALL_TASKS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_CLEAR_SYSLOG_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_WRITE_SYSLOG_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_OVER_WRITE_SYSLOG_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_CLEAR_ER_LOG_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_WRITE_ER_LOG_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_START_PERF_DATA_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_STOP_PERF_DATA_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_SET_PERF_FILTER_MASK_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_SET_PERF_TRIGGER_MASK_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_RESET_PR_COUNT_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_SET_MAX_PR_COUNT_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_DELETE_CDS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_DELETE_CDS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_SEND_MEM_POOL_STATS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_DUMP_CDS_REGISTRY_CC -}; - -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_INVALID_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), - .CommandCode = CFE_ES_DUMP_CDS_REGISTRY_CC + 2 -}; - -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_SEND_HK = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_SEND_HK_MID) -}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_NOOP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), + .CommandCode = CFE_ES_NOOP_CC}; + +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RESET_COUNTERS_CC}; + +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESTART_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), + .CommandCode = CFE_ES_RESTART_CC}; + +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_START_APP_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_START_APP_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_STOP_APP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), + .CommandCode = CFE_ES_STOP_APP_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESTART_APP_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RESTART_APP_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RELOAD_APP_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RELOAD_APP_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ONE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_QUERY_ONE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ALL_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_QUERY_ALL_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_QUERY_ALL_TASKS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_CLEAR_SYSLOG_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_WRITE_SYSLOG_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_OVER_WRITE_SYSLOG_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_CLEAR_ER_LOG_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_WRITE_ER_LOG_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_START_PERF_DATA_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_STOP_PERF_DATA_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SET_PERF_FILTER_MASK_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SET_PERF_TRIGGER_MASK_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RESET_PR_COUNT_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SET_MAX_PR_COUNT_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_DELETE_CDS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_DELETE_CDS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SEND_MEM_POOL_STATS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_DUMP_CDS_REGISTRY_CC}; + +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_INVALID_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), + .CommandCode = CFE_ES_DUMP_CDS_REGISTRY_CC + 2}; + +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_SEND_HK = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_SEND_HK_MID)}; /* ** Functions @@ -284,7 +205,7 @@ void ES_UT_TaskFunction(void) } /* - * Helper function to assemble basic bits of info into the "CFE_ES_ModuleLoadParams_t" struct + * Helper function to assemble basic bits of info into the "CFE_ES_ModuleLoadParams_t" struct */ void ES_UT_SetupModuleLoadParams(CFE_ES_ModuleLoadParams_t *Params, const char *FileName, const char *EntryName) { @@ -294,7 +215,7 @@ void ES_UT_SetupModuleLoadParams(CFE_ES_ModuleLoadParams_t *Params, const char * { FileName = &Empty; } - + if (EntryName == NULL) { EntryName = &Empty; @@ -305,7 +226,7 @@ void ES_UT_SetupModuleLoadParams(CFE_ES_ModuleLoadParams_t *Params, const char * } /* - * Helper function to assemble basic bits of info into the "CFE_ES_AppStartParams_t" struct + * Helper function to assemble basic bits of info into the "CFE_ES_AppStartParams_t" struct */ void ES_UT_SetupAppStartParams(CFE_ES_AppStartParams_t *Params, const char *FileName, const char *EntryName, size_t StackSize, CFE_ES_TaskPriority_Atom_t Priority, @@ -313,48 +234,44 @@ void ES_UT_SetupAppStartParams(CFE_ES_AppStartParams_t *Params, const char *File { ES_UT_SetupModuleLoadParams(&Params->BasicInfo, FileName, EntryName); Params->MainTaskInfo.StackSize = StackSize; - Params->MainTaskInfo.Priority = Priority; - Params->ExceptionAction = ExceptionAction; + Params->MainTaskInfo.Priority = Priority; + Params->ExceptionAction = ExceptionAction; } - - - /* * Helper function to setup a single app ID in the given state, along with * a main task ID. A pointer to the App and Task record is output so the * record can be modified */ -void ES_UT_SetupSingleAppId(CFE_ES_AppType_Enum_t AppType, CFE_ES_AppState_Enum_t AppState, - const char *AppName, CFE_ES_AppRecord_t **OutAppRec, CFE_ES_TaskRecord_t **OutTaskRec) +void ES_UT_SetupSingleAppId(CFE_ES_AppType_Enum_t AppType, CFE_ES_AppState_Enum_t AppState, const char *AppName, + CFE_ES_AppRecord_t **OutAppRec, CFE_ES_TaskRecord_t **OutTaskRec) { - osal_id_t UtOsalId; - CFE_ResourceId_t UtTaskId; - CFE_ResourceId_t UtAppId; - CFE_ES_AppRecord_t *LocalAppPtr; + osal_id_t UtOsalId; + CFE_ResourceId_t UtTaskId; + CFE_ResourceId_t UtAppId; + CFE_ES_AppRecord_t * LocalAppPtr; CFE_ES_TaskRecord_t *LocalTaskPtr; OS_TaskCreate(&UtOsalId, "UT", NULL, OSAL_TASK_STACK_ALLOCATE, 0, 0, 0); - UtTaskId = CFE_RESOURCEID_UNWRAP(CFE_ES_TaskId_FromOSAL(UtOsalId)); - UtAppId = CFE_ES_Global.LastAppId; - CFE_ES_Global.LastAppId = CFE_ResourceId_FromInteger( - CFE_ResourceId_ToInteger(UtAppId) + 1); + UtTaskId = CFE_RESOURCEID_UNWRAP(CFE_ES_TaskId_FromOSAL(UtOsalId)); + UtAppId = CFE_ES_Global.LastAppId; + CFE_ES_Global.LastAppId = CFE_ResourceId_FromInteger(CFE_ResourceId_ToInteger(UtAppId) + 1); LocalTaskPtr = CFE_ES_LocateTaskRecordByID(CFE_ES_TASKID_C(UtTaskId)); - LocalAppPtr = CFE_ES_LocateAppRecordByID(CFE_ES_APPID_C(UtAppId)); + LocalAppPtr = CFE_ES_LocateAppRecordByID(CFE_ES_APPID_C(UtAppId)); CFE_ES_TaskRecordSetUsed(LocalTaskPtr, UtTaskId); CFE_ES_AppRecordSetUsed(LocalAppPtr, UtAppId); - LocalTaskPtr->AppId = CFE_ES_AppRecordGetID(LocalAppPtr); + LocalTaskPtr->AppId = CFE_ES_AppRecordGetID(LocalAppPtr); LocalAppPtr->MainTaskId = CFE_ES_TaskRecordGetID(LocalTaskPtr); - LocalAppPtr->AppState = AppState; - LocalAppPtr->Type = AppType; + LocalAppPtr->AppState = AppState; + LocalAppPtr->Type = AppType; if (AppName) { - strncpy(LocalAppPtr->AppName, AppName, sizeof(LocalAppPtr->AppName)-1); - LocalAppPtr->AppName[sizeof(LocalAppPtr->AppName)-1] = 0; - strncpy(LocalTaskPtr->TaskName, AppName, sizeof(LocalTaskPtr->TaskName)-1); - LocalTaskPtr->TaskName[sizeof(LocalTaskPtr->TaskName)-1] = 0; + strncpy(LocalAppPtr->AppName, AppName, sizeof(LocalAppPtr->AppName) - 1); + LocalAppPtr->AppName[sizeof(LocalAppPtr->AppName) - 1] = 0; + strncpy(LocalTaskPtr->TaskName, AppName, sizeof(LocalTaskPtr->TaskName) - 1); + LocalTaskPtr->TaskName[sizeof(LocalTaskPtr->TaskName) - 1] = 0; } if (OutAppRec) @@ -387,9 +304,9 @@ void ES_UT_SetupSingleAppId(CFE_ES_AppType_Enum_t AppType, CFE_ES_AppState_Enum_ */ void ES_UT_SetupChildTaskId(const CFE_ES_AppRecord_t *ParentApp, const char *TaskName, CFE_ES_TaskRecord_t **OutTaskRec) { - osal_id_t UtOsalId; - CFE_ES_TaskId_t UtTaskId; - CFE_ES_AppId_t UtAppId; + osal_id_t UtOsalId; + CFE_ES_TaskId_t UtTaskId; + CFE_ES_AppId_t UtAppId; CFE_ES_TaskRecord_t *LocalTaskPtr; UtAppId = CFE_ES_AppRecordGetID(ParentApp); @@ -403,9 +320,8 @@ void ES_UT_SetupChildTaskId(const CFE_ES_AppRecord_t *ParentApp, const char *Tas if (TaskName) { - strncpy(LocalTaskPtr->TaskName, TaskName, - sizeof(LocalTaskPtr->TaskName)-1); - LocalTaskPtr->TaskName[sizeof(LocalTaskPtr->TaskName)-1] = 0; + strncpy(LocalTaskPtr->TaskName, TaskName, sizeof(LocalTaskPtr->TaskName) - 1); + LocalTaskPtr->TaskName[sizeof(LocalTaskPtr->TaskName) - 1] = 0; } if (OutTaskRec) @@ -422,21 +338,19 @@ void ES_UT_SetupChildTaskId(const CFE_ES_AppRecord_t *ParentApp, const char *Tas */ void ES_UT_SetupSingleLibId(const char *LibName, CFE_ES_LibRecord_t **OutLibRec) { - CFE_ResourceId_t UtLibId; + CFE_ResourceId_t UtLibId; CFE_ES_LibRecord_t *LocalLibPtr; - UtLibId = CFE_ES_Global.LastLibId; - CFE_ES_Global.LastLibId = CFE_ResourceId_FromInteger( - CFE_ResourceId_ToInteger(UtLibId) + 1); + UtLibId = CFE_ES_Global.LastLibId; + CFE_ES_Global.LastLibId = CFE_ResourceId_FromInteger(CFE_ResourceId_ToInteger(UtLibId) + 1); LocalLibPtr = CFE_ES_LocateLibRecordByID(CFE_ES_LIBID_C(UtLibId)); CFE_ES_LibRecordSetUsed(LocalLibPtr, UtLibId); if (LibName) { - strncpy(LocalLibPtr->LibName, LibName, - sizeof(LocalLibPtr->LibName)-1); - LocalLibPtr->LibName[sizeof(LocalLibPtr->LibName)-1] = 0; + strncpy(LocalLibPtr->LibName, LibName, sizeof(LocalLibPtr->LibName) - 1); + LocalLibPtr->LibName[sizeof(LocalLibPtr->LibName) - 1] = 0; } if (OutLibRec) @@ -447,36 +361,31 @@ void ES_UT_SetupSingleLibId(const char *LibName, CFE_ES_LibRecord_t **OutLibRec) ++CFE_ES_Global.RegisteredLibs; } -int32 ES_UT_PoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - CFE_ES_GenPoolBD_t **BdPtr) +int32 ES_UT_PoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { - *BdPtr = (CFE_ES_GenPoolBD_t*)((void*)&UT_MemPoolDirectBuffer.Data[Offset]); + *BdPtr = (CFE_ES_GenPoolBD_t *)((void *)&UT_MemPoolDirectBuffer.Data[Offset]); return CFE_SUCCESS; } -int32 ES_UT_PoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - const CFE_ES_GenPoolBD_t *BdPtr) +int32 ES_UT_PoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { return CFE_SUCCESS; } -int32 ES_UT_PoolIndirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - CFE_ES_GenPoolBD_t **BdPtr) +int32 ES_UT_PoolIndirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { memcpy(&UT_MemPoolIndirectBuffer.BD, &UT_MemPoolIndirectBuffer.Data[Offset], sizeof(CFE_ES_GenPoolBD_t)); *BdPtr = &UT_MemPoolIndirectBuffer.BD; return CFE_SUCCESS; } -int32 ES_UT_PoolIndirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - const CFE_ES_GenPoolBD_t *BdPtr) +int32 ES_UT_PoolIndirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { memcpy(&UT_MemPoolIndirectBuffer.Data[Offset], BdPtr, sizeof(CFE_ES_GenPoolBD_t)); return CFE_SUCCESS; } -int32 ES_UT_CDSPoolRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - CFE_ES_GenPoolBD_t **BdPtr) +int32 ES_UT_CDSPoolRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { static CFE_ES_GenPoolBD_t BdBuf; @@ -484,32 +393,29 @@ int32 ES_UT_CDSPoolRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, return CFE_PSP_ReadFromCDS(&BdBuf, Offset, sizeof(BdBuf)); } -int32 ES_UT_CDSPoolCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, - const CFE_ES_GenPoolBD_t *BdPtr) +int32 ES_UT_CDSPoolCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { return CFE_PSP_WriteToCDS(BdPtr, Offset, sizeof(*BdPtr)); } void ES_UT_SetupMemPoolId(CFE_ES_MemPoolRecord_t **OutPoolRecPtr) { - CFE_ResourceId_t UtPoolID; + CFE_ResourceId_t UtPoolID; CFE_ES_MemPoolRecord_t *LocalPoolRecPtr; - UtPoolID = CFE_ES_Global.LastMemPoolId; - CFE_ES_Global.LastMemPoolId = CFE_ResourceId_FromInteger( - CFE_ResourceId_ToInteger(UtPoolID) + 1); - + UtPoolID = CFE_ES_Global.LastMemPoolId; + CFE_ES_Global.LastMemPoolId = CFE_ResourceId_FromInteger(CFE_ResourceId_ToInteger(UtPoolID) + 1); LocalPoolRecPtr = CFE_ES_LocateMemPoolRecordByID(CFE_ES_MEMHANDLE_C(UtPoolID)); /* in order to validate the size must be nonzero */ - LocalPoolRecPtr->Pool.PoolTotalSize = sizeof(UT_MemPoolDirectBuffer.Data); - LocalPoolRecPtr->Pool.PoolMaxOffset = sizeof(UT_MemPoolDirectBuffer.Data); + LocalPoolRecPtr->Pool.PoolTotalSize = sizeof(UT_MemPoolDirectBuffer.Data); + LocalPoolRecPtr->Pool.PoolMaxOffset = sizeof(UT_MemPoolDirectBuffer.Data); LocalPoolRecPtr->Pool.Buckets[0].BlockSize = 16; - LocalPoolRecPtr->Pool.NumBuckets = 1; - LocalPoolRecPtr->Pool.Retrieve = ES_UT_PoolDirectRetrieve; - LocalPoolRecPtr->Pool.Commit = ES_UT_PoolDirectCommit; - LocalPoolRecPtr->BaseAddr = (cpuaddr)UT_MemPoolDirectBuffer.Data; + LocalPoolRecPtr->Pool.NumBuckets = 1; + LocalPoolRecPtr->Pool.Retrieve = ES_UT_PoolDirectRetrieve; + LocalPoolRecPtr->Pool.Commit = ES_UT_PoolDirectCommit; + LocalPoolRecPtr->BaseAddr = (cpuaddr)UT_MemPoolDirectBuffer.Data; OS_MutSemCreate(&LocalPoolRecPtr->MutexId, NULL, 0); CFE_ES_MemPoolRecordSetUsed(LocalPoolRecPtr, UtPoolID); @@ -530,7 +436,7 @@ void ES_UT_SetupCDSGlobal(uint32 CDS_Size) { OS_MutSemCreate(&CDS->GenMutex, "UT", 0); CDS->TotalSize = CDS_Size; - CDS->DataSize = CDS->TotalSize; + CDS->DataSize = CDS->TotalSize; CDS->DataSize -= CDS_RESERVED_MIN_SIZE; CFE_ES_InitCDSSignatures(); @@ -541,52 +447,47 @@ void ES_UT_SetupCDSGlobal(uint32 CDS_Size) } } - -void ES_UT_SetupSingleCDSRegistry(const char *CDSName, size_t BlockSize, bool IsTable, - CFE_ES_CDS_RegRec_t **OutRegRec) +void ES_UT_SetupSingleCDSRegistry(const char *CDSName, size_t BlockSize, bool IsTable, CFE_ES_CDS_RegRec_t **OutRegRec) { CFE_ES_CDS_RegRec_t *LocalRegRecPtr; - CFE_ResourceId_t UtCDSID; - CFE_ES_GenPoolBD_t LocalBD; - size_t UT_CDS_BufferSize; - + CFE_ResourceId_t UtCDSID; + CFE_ES_GenPoolBD_t LocalBD; + size_t UT_CDS_BufferSize; /* first time this is done, set up the global */ if (!CFE_ES_Global.CDSIsAvailable) { UT_GetDataBuffer(UT_KEY(CFE_PSP_GetCDSSize), NULL, &UT_CDS_BufferSize, NULL); - if (UT_CDS_BufferSize > (2*CFE_ES_CDS_SIGNATURE_LEN)) + if (UT_CDS_BufferSize > (2 * CFE_ES_CDS_SIGNATURE_LEN)) { /* Use the CDS buffer from ut_support.c if it was configured */ CFE_ES_Global.CDSVars.Pool.PoolMaxOffset = UT_CDS_BufferSize - CFE_ES_CDS_SIGNATURE_LEN; - CFE_ES_Global.CDSVars.Pool.Retrieve = ES_UT_CDSPoolRetrieve; - CFE_ES_Global.CDSVars.Pool.Commit = ES_UT_CDSPoolCommit; + CFE_ES_Global.CDSVars.Pool.Retrieve = ES_UT_CDSPoolRetrieve; + CFE_ES_Global.CDSVars.Pool.Commit = ES_UT_CDSPoolCommit; } else { CFE_ES_Global.CDSVars.Pool.PoolMaxOffset = sizeof(UT_MemPoolIndirectBuffer.Data); - CFE_ES_Global.CDSVars.Pool.Retrieve = ES_UT_PoolIndirectRetrieve; - CFE_ES_Global.CDSVars.Pool.Commit = ES_UT_PoolIndirectCommit; + CFE_ES_Global.CDSVars.Pool.Retrieve = ES_UT_PoolIndirectRetrieve; + CFE_ES_Global.CDSVars.Pool.Commit = ES_UT_PoolIndirectCommit; } CFE_ES_Global.CDSVars.Pool.Buckets[0].BlockSize = ES_UT_CDS_BLOCK_SIZE; - CFE_ES_Global.CDSVars.Pool.NumBuckets = 1; - CFE_ES_Global.CDSVars.Pool.TailPosition = CFE_ES_CDS_SIGNATURE_LEN; - CFE_ES_Global.CDSVars.Pool.PoolTotalSize = CFE_ES_Global.CDSVars.Pool.PoolMaxOffset - - CFE_ES_Global.CDSVars.Pool.TailPosition; + CFE_ES_Global.CDSVars.Pool.NumBuckets = 1; + CFE_ES_Global.CDSVars.Pool.TailPosition = CFE_ES_CDS_SIGNATURE_LEN; + CFE_ES_Global.CDSVars.Pool.PoolTotalSize = + CFE_ES_Global.CDSVars.Pool.PoolMaxOffset - CFE_ES_Global.CDSVars.Pool.TailPosition; CFE_ES_Global.CDSIsAvailable = true; } - UtCDSID = CFE_ES_Global.CDSVars.LastCDSBlockId; - CFE_ES_Global.CDSVars.LastCDSBlockId = CFE_ResourceId_FromInteger( - CFE_ResourceId_ToInteger(UtCDSID) + 1); + UtCDSID = CFE_ES_Global.CDSVars.LastCDSBlockId; + CFE_ES_Global.CDSVars.LastCDSBlockId = CFE_ResourceId_FromInteger(CFE_ResourceId_ToInteger(UtCDSID) + 1); LocalRegRecPtr = CFE_ES_LocateCDSBlockRecordByID(CFE_ES_CDSHANDLE_C(UtCDSID)); if (CDSName != NULL) { - strncpy(LocalRegRecPtr->Name, CDSName, - sizeof(LocalRegRecPtr->Name) - 1); + strncpy(LocalRegRecPtr->Name, CDSName, sizeof(LocalRegRecPtr->Name) - 1); LocalRegRecPtr->Name[sizeof(LocalRegRecPtr->Name) - 1] = 0; } else @@ -594,17 +495,15 @@ void ES_UT_SetupSingleCDSRegistry(const char *CDSName, size_t BlockSize, bool Is LocalRegRecPtr->Name[0] = 0; } - LocalRegRecPtr->Table = IsTable; + LocalRegRecPtr->Table = IsTable; LocalRegRecPtr->BlockOffset = CFE_ES_Global.CDSVars.Pool.TailPosition + sizeof(LocalBD); - LocalRegRecPtr->BlockSize = BlockSize; + LocalRegRecPtr->BlockSize = BlockSize; - LocalBD.CheckBits = CFE_ES_CHECK_PATTERN; - LocalBD.Allocated = CFE_ES_MEMORY_ALLOCATED + 1; + LocalBD.CheckBits = CFE_ES_CHECK_PATTERN; + LocalBD.Allocated = CFE_ES_MEMORY_ALLOCATED + 1; LocalBD.ActualSize = BlockSize; LocalBD.NextOffset = 0; - CFE_ES_Global.CDSVars.Pool.Commit(&CFE_ES_Global.CDSVars.Pool, - CFE_ES_Global.CDSVars.Pool.TailPosition, - &LocalBD); + CFE_ES_Global.CDSVars.Pool.Commit(&CFE_ES_Global.CDSVars.Pool, CFE_ES_Global.CDSVars.Pool.TailPosition, &LocalBD); CFE_ES_Global.CDSVars.Pool.TailPosition = LocalRegRecPtr->BlockOffset + LocalRegRecPtr->BlockSize; @@ -616,10 +515,7 @@ void ES_UT_SetupSingleCDSRegistry(const char *CDSName, size_t BlockSize, bool Is } } - -int32 ES_UT_SetupOSCleanupHook(void *UserObj, int32 StubRetcode, - uint32 CallCount, - const UT_StubContext_t *Context) +int32 ES_UT_SetupOSCleanupHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { osal_id_t ObjList[7]; @@ -636,8 +532,7 @@ int32 ES_UT_SetupOSCleanupHook(void *UserObj, int32 StubRetcode, OS_TimerCreate(&ObjList[5], NULL, NULL, NULL); OS_OpenCreate(&ObjList[6], NULL, 0, 0); - UT_SetDataBuffer((UT_EntryKey_t)&OS_ForEachObject, ObjList, - sizeof(ObjList), true); + UT_SetDataBuffer((UT_EntryKey_t)&OS_ForEachObject, ObjList, sizeof(ObjList), true); } return StubRetcode; @@ -645,8 +540,7 @@ int32 ES_UT_SetupOSCleanupHook(void *UserObj, int32 StubRetcode, static void ES_UT_SetupForOSCleanup(void) { - UT_SetHookFunction(UT_KEY(OS_ForEachObject), ES_UT_SetupOSCleanupHook, - NULL); + UT_SetHookFunction(UT_KEY(OS_ForEachObject), ES_UT_SetupOSCleanupHook, NULL); } typedef struct @@ -655,19 +549,16 @@ typedef struct uint32 AppState; } ES_UT_SetAppStateHook_t; -static int32 ES_UT_SetAppStateHook(void *UserObj, int32 StubRetcode, - uint32 CallCount, - const UT_StubContext_t *Context) +static int32 ES_UT_SetAppStateHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { ES_UT_SetAppStateHook_t *StateHook = UserObj; - uint32 i; - CFE_ES_AppRecord_t *AppRecPtr; - + uint32 i; + CFE_ES_AppRecord_t * AppRecPtr; AppRecPtr = CFE_ES_Global.AppTable; - for (i=0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; ++i) + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; ++i) { - if ( CFE_ES_AppRecordIsUsed(AppRecPtr) ) + if (CFE_ES_AppRecordIsUsed(AppRecPtr)) { /* If no filter object supplied, set all apps to RUNNING */ if (StateHook == NULL) @@ -691,7 +582,7 @@ void UtTest_Setup(void) UtPrintf("cFE ES Unit Test Output File\n\n"); /* Set up the performance logging variable */ - Perf = (CFE_ES_PerfData_t *) &CFE_ES_ResetDataPtr->Perf; + Perf = (CFE_ES_PerfData_t *)&CFE_ES_ResetDataPtr->Perf; UT_ADD_TEST(TestInit); UT_ADD_TEST(TestStartupErrorPaths); @@ -723,13 +614,12 @@ void ES_ResetUnitTest(void) /* ** Initialize the Last Id */ - CFE_ES_Global.LastAppId = CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE); - CFE_ES_Global.LastLibId = CFE_ResourceId_FromInteger(CFE_ES_LIBID_BASE); - CFE_ES_Global.LastCounterId = CFE_ResourceId_FromInteger(CFE_ES_COUNTID_BASE); - CFE_ES_Global.LastMemPoolId = CFE_ResourceId_FromInteger(CFE_ES_POOLID_BASE); + CFE_ES_Global.LastAppId = CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE); + CFE_ES_Global.LastLibId = CFE_ResourceId_FromInteger(CFE_ES_LIBID_BASE); + CFE_ES_Global.LastCounterId = CFE_ResourceId_FromInteger(CFE_ES_COUNTID_BASE); + CFE_ES_Global.LastMemPoolId = CFE_ResourceId_FromInteger(CFE_ES_POOLID_BASE); CFE_ES_Global.CDSVars.LastCDSBlockId = CFE_ResourceId_FromInteger(CFE_ES_CDSBLOCKID_BASE); - } /* end ES_ResetUnitTest() */ void TestInit(void) @@ -740,8 +630,7 @@ void TestInit(void) UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t)); /* Set up the reset area */ - UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, - CFE_TIME_ToneSignalSelect_PRIMARY); + UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); /* Set up the startup script for reading */ strncpy(StartupScript, @@ -756,23 +645,19 @@ void TestInit(void) /* Go through ES_Main and cover normal paths */ UT_SetDummyFuncRtn(OS_SUCCESS); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); - CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1, - "ut_startup"); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, - "CFE_ES_Main", - "Normal startup"); + CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1, "ut_startup"); + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_Main", "Normal startup"); } void TestStartupErrorPaths(void) { - int j; + int j; ES_UT_SetAppStateHook_t StateHook; - uint32 PanicStatus; - uint32 ResetType; - OS_statvfs_t StatBuf; - CFE_ES_TaskRecord_t *TaskRecPtr; - CFE_ES_AppRecord_t *AppRecPtr; + uint32 PanicStatus; + uint32 ResetType; + OS_statvfs_t StatBuf; + CFE_ES_TaskRecord_t * TaskRecPtr; + CFE_ES_AppRecord_t * AppRecPtr; UtPrintf("Begin Test Startup Error Paths"); @@ -792,9 +677,7 @@ void TestStartupErrorPaths(void) UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_STARTUP_SEM && - UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, - "CFE_ES_Main", + PanicStatus == CFE_PSP_PANIC_STARTUP_SEM && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, "CFE_ES_Main", "Mutex create failure"); /* Perform ES main startup with a file open failure */ @@ -803,116 +686,89 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), - "CFE_ES_Main", - "File open failure"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), + "CFE_ES_Main", "File open failure"); /* Perform ES main startup with a startup sync failure */ ES_ResetUnitTest(); StateHook.AppState = CFE_ES_AppState_RUNNING; - StateHook.AppType = CFE_ES_AppType_CORE; /* by only setting core apps, it will appear as if external apps did not start */ + StateHook.AppType = + CFE_ES_AppType_CORE; /* by only setting core apps, it will appear as if external apps did not start */ UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, &StateHook); UT_SetReadBuffer(StartupScript, strlen(StartupScript)); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_1]), - "CFE_ES_Main", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_1]), "CFE_ES_Main", "Startup sync failure 1"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_2]), - "CFE_ES_Main", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_2]), "CFE_ES_Main", "Startup sync failure 2"); /* Perform a power on reset with a hardware special sub-type */ ES_ResetUnitTest(); - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_POWERON, - CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", - "Power on reset - Hardware special command"); + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_HW_SPECIAL]), + "CFE_ES_SetupResetVariables", "Power on reset - Hardware special command"); /* Perform a processor reset with a hardware special sub-type */ ES_ResetUnitTest(); - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_MAX_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", - "Processor reset - hardware special command"); + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_MAX_HW_SPECIAL]), + "CFE_ES_SetupResetVariables", "Processor reset - hardware special command"); /* Perform a power on reset with an "other cause" sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_POWERON, -1, 1); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_OTHER]), - "CFE_ES_SetupResetVariables", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_OTHER]), "CFE_ES_SetupResetVariables", "Other cause reset"); /* Perform the maximum number of processor resets */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = 0; - CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = false; + CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = false; for (j = 0; j < CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS; j++) { - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); } UT_Report(__FILE__, __LINE__, - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount == - CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS, - "CFE_ES_SetupResetVariables", - "Maximum processor resets"); + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount == CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS, + "CFE_ES_SetupResetVariables", "Maximum processor resets"); /* Attempt another processor reset after the maximum have occurred */ ES_ResetUnitTest(); UT_SetDataBuffer(UT_KEY(CFE_PSP_Restart), &ResetType, sizeof(ResetType), false); - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); UT_Report(__FILE__, __LINE__, - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount == - CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS + 1 && - ResetType == CFE_PSP_RST_TYPE_POWERON && - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount == CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS + 1 && + ResetType == CFE_PSP_RST_TYPE_POWERON && UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_SetupResetVariables", "Processor reset - power cycle; exceeded maximum " - "processor resets"); + "processor resets"); /* Perform a power on reset with a hardware special sub-type */ ES_ResetUnitTest(); - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_HW_SPECIAL]), + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_HW_SPECIAL]), "CFE_ES_SetupResetVariables", "Processor reset - hardware special command; exceeded maximum " - "processor resets"); + "processor resets"); /* Perform a processor reset with an reset area failure */ ES_ResetUnitTest(); UT_SetStatusBSPResetArea(OS_ERROR, 0, CFE_TIME_ToneSignalSelect_PRIMARY); UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = true; - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && - UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, - "CFE_ES_SetupResetVariables", - "Get reset area error"); + PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, + "CFE_ES_SetupResetVariables", "Get reset area error"); /* Perform a processor reset triggered by ES */ /* Added for coverage, as the "panic" case will should not cover this one */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->ResetVars.ES_CausedReset = true; - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, - "CFE_ES_SetupResetVariables", + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_SetupResetVariables", "Processor Reset caused by ES"); /* Perform a processor reset with the size of the reset area too small */ @@ -920,13 +776,10 @@ void TestStartupErrorPaths(void) UT_SetSizeofESResetArea(0); UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); UT_SetStatusBSPResetArea(OS_SUCCESS, 0, CFE_TIME_ToneSignalSelect_PRIMARY); - CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, - CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); + CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && - UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, - "CFE_ES_SetupResetVariables", - "Reset area too small"); + PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, + "CFE_ES_SetupResetVariables", "Reset area too small"); /* Test initialization of the file systems specifying a power on reset * following a failure to create the RAM volume @@ -938,14 +791,13 @@ void TestStartupErrorPaths(void) CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_POWERON); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", - "Power on reset; error creating volatile (RAM) volume"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]), + "CFE_ES_InitializeFileSystems", "Power on reset; error creating volatile (RAM) volume"); /* prepare the StatBuf to reflect a RAM disk that is 99% full */ - StatBuf.block_size = 1024; + StatBuf.block_size = 1024; StatBuf.total_blocks = CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS; - StatBuf.blocks_free = CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS / 100; + StatBuf.blocks_free = CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS / 100; /* Test initialization of the file systems specifying a processor reset * following a failure to reformat the RAM volume @@ -958,12 +810,11 @@ void TestStartupErrorPaths(void) CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REFORMAT_VOLATILE]), - "CFE_ES_InitializeFileSystems", - "Processor reset; error reformatting volatile (RAM) volume"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REFORMAT_VOLATILE]), + "CFE_ES_InitializeFileSystems", "Processor reset; error reformatting volatile (RAM) volume"); /* Test initialization of the file systems specifying a processor reset * following failure to get the volatile disk memory @@ -972,10 +823,8 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetVolatileDiskMem), CFE_PSP_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]), - "CFE_ES_InitializeFileSystems", - "Processor reset; cannot get memory for volatile disk"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]), + "CFE_ES_InitializeFileSystems", "Processor reset; cannot get memory for volatile disk"); /* Test initialization of the file systems specifying a processor reset * following a failure to remove the RAM volume @@ -986,9 +835,8 @@ void TestStartupErrorPaths(void) CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOVE_VOLATILE]), - "CFE_ES_InitializeFileSystems", - "Processor reset; error removing volatile (RAM) volume"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOVE_VOLATILE]), + "CFE_ES_InitializeFileSystems", "Processor reset; error removing volatile (RAM) volume"); /* Test initialization of the file systems specifying a processor reset * following a failure to unmount the RAM volume @@ -999,16 +847,13 @@ void TestStartupErrorPaths(void) CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_UNMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", - "Processor reset; error unmounting volatile (RAM) volume"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_UNMOUNT_VOLATILE]), + "CFE_ES_InitializeFileSystems", "Processor reset; error unmounting volatile (RAM) volume"); /* Test successful initialization of the file systems */ ES_ResetUnitTest(); CFE_ES_InitializeFileSystems(4564564); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, - "CFE_ES_InitializeFileSystems", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_InitializeFileSystems", "Initialize file systems; successful"); /* Test initialization of the file systems specifying a processor reset @@ -1020,10 +865,9 @@ void TestStartupErrorPaths(void) CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", - "Processor reset; error remounting volatile (RAM) volume"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), + "CFE_ES_InitializeFileSystems", "Processor reset; error remounting volatile (RAM) volume"); /* Test initialization of the file systems with an error determining the * number of blocks that are free on the volume @@ -1031,10 +875,8 @@ void TestStartupErrorPaths(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_FileSysStatVolume), 1, -1); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_DETERMINE_BLOCKS]), - "CFE_ES_InitializeFileSystems", - "Processor reset; error determining blocks free on volume"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_DETERMINE_BLOCKS]), + "CFE_ES_InitializeFileSystems", "Processor reset; error determining blocks free on volume"); /* Test reading the object table where a record used error occurs */ ES_ResetUnitTest(); @@ -1050,9 +892,7 @@ void TestStartupErrorPaths(void) UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]), - "CFE_ES_CreateObjects", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]), "CFE_ES_CreateObjects", "Record used error"); /* Test reading the object table where an error occurs when @@ -1073,10 +913,9 @@ void TestStartupErrorPaths(void) UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_EARLYINIT]), - "CFE_ES_CreateObjects", - "Error returned when calling function"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]) && + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_EARLYINIT]), + "CFE_ES_CreateObjects", "Error returned when calling function"); /* Test reading the object table where an error occurs when * creating a core app @@ -1086,9 +925,7 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_BinSemCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_CREATE]), - "CFE_ES_CreateObjects", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_CREATE]), "CFE_ES_CreateObjects", "Error creating core application"); /* Test reading the object table where all app slots are taken */ @@ -1096,32 +933,24 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, - "CFE_ES_CreateObjects", - "No free application slots available, message"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, + "CFE_ES_CreateObjects", "No free application slots available, message"); /* Test reading the object table with a NULL function pointer */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); CFE_ES_ObjectTable[1].ObjectType = CFE_ES_FUNCTION_CALL; CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, - "CFE_ES_CreateObjects", - "Bad function pointer, app slots message"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]), - "CFE_ES_CreateObjects", - "Bad function pointer message"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, + "CFE_ES_CreateObjects", "Bad function pointer, app slots message"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]), + "CFE_ES_CreateObjects", "Bad function pointer message"); /* Test response to an invalid startup type */ ES_ResetUnitTest(); CFE_ES_Global.DebugVars.DebugFlag = 1; CFE_ES_SetupResetVariables(-1, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, - CFE_ES_Global.DebugVars.DebugFlag == 1, - "CFE_ES_SetupResetVariables", + UT_Report(__FILE__, __LINE__, CFE_ES_Global.DebugVars.DebugFlag == 1, "CFE_ES_SetupResetVariables", "Invalid startup type"); CFE_ES_Global.DebugVars.DebugFlag = 0; @@ -1135,12 +964,12 @@ void TestStartupErrorPaths(void) CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), "CFE_ES_InitializeFileSystems", "Processor reset; error initializing and mounting volatile " - "(RAM) volume"); + "(RAM) volume"); /* Test application sync delay where the operation times out */ ES_ResetUnitTest(); @@ -1148,13 +977,10 @@ void TestStartupErrorPaths(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, - CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT, - "CFE_ES_ApplicationSyncDelay", - "Operation timed out"); - - + CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == + CFE_ES_OPERATION_TIMED_OUT, + "CFE_ES_ApplicationSyncDelay", "Operation timed out"); + /* Test startup sync with alternate minimum system state * of CFE_ES_SystemState_SHUTDOWN */ @@ -1162,14 +988,11 @@ void TestStartupErrorPaths(void) /* This prep is necessary so GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - UT_Report(__FILE__, __LINE__, CFE_ES_WaitForSystemState(CFE_ES_SystemState_SHUTDOWN, - CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT && - AppRecPtr->AppState == - CFE_ES_AppState_STOPPED, - "CFE_ES_WaitForSystemState", - "Min System State is CFE_ES_SystemState_SHUTDOWN"); - + UT_Report(__FILE__, __LINE__, + CFE_ES_WaitForSystemState(CFE_ES_SystemState_SHUTDOWN, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == + CFE_ES_OPERATION_TIMED_OUT && + AppRecPtr->AppState == CFE_ES_AppState_STOPPED, + "CFE_ES_WaitForSystemState", "Min System State is CFE_ES_SystemState_SHUTDOWN"); /* Test startup sync with alternate minimum system state * of CFE_ES_SystemState_APPS_INIT @@ -1178,15 +1001,12 @@ void TestStartupErrorPaths(void) /* This prep is necessary so GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - + UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_APPS_INIT, - CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT && - AppRecPtr->AppState == - CFE_ES_AppState_LATE_INIT, - "CFE_ES_WaitForSystemState", - "Min System State is CFE_ES_SystemState_APPS_INIT"); + CFE_ES_WaitForSystemState(CFE_ES_SystemState_APPS_INIT, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == + CFE_ES_OPERATION_TIMED_OUT && + AppRecPtr->AppState == CFE_ES_AppState_LATE_INIT, + "CFE_ES_WaitForSystemState", "Min System State is CFE_ES_SystemState_APPS_INIT"); /* Test success */ ES_ResetUnitTest(); @@ -1194,20 +1014,19 @@ void TestStartupErrorPaths(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; ASSERT(CFE_ES_WaitForSystemState(CFE_ES_SystemState_CORE_READY, 0)); - } void TestApps(void) { - int NumBytes; - int Return; - CFE_ES_AppInfo_t AppInfo; - CFE_ES_AppId_t AppId; - CFE_ES_TaskId_t TaskId; - CFE_ES_TaskRecord_t *UtTaskRecPtr; - CFE_ES_AppRecord_t *UtAppRecPtr; + int NumBytes; + int Return; + CFE_ES_AppInfo_t AppInfo; + CFE_ES_AppId_t AppId; + CFE_ES_TaskId_t TaskId; + CFE_ES_TaskRecord_t * UtTaskRecPtr; + CFE_ES_AppRecord_t * UtAppRecPtr; CFE_ES_MemPoolRecord_t *UtPoolRecPtr; - char NameBuffer[OS_MAX_API_NAME+5]; + char NameBuffer[OS_MAX_API_NAME + 5]; CFE_ES_AppStartParams_t StartParams; UtPrintf("Begin Test Apps"); @@ -1223,7 +1042,7 @@ void TestApps(void) "TO_task_main, TO_APP, 74, 4096, 0x0, 1; !", sizeof(StartupScript) - 1); StartupScript[sizeof(StartupScript) - 1] = '\0'; - NumBytes = strlen(StartupScript); + NumBytes = strlen(StartupScript); UT_SetReadBuffer(StartupScript, NumBytes); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG])); @@ -1237,7 +1056,7 @@ void TestApps(void) "CFE_APP, /cf/apps/to.bundle, TO_task_main, TO_APP, 74, 4096, 0x0, 1; !", sizeof(StartupScript) - 1); StartupScript[sizeof(StartupScript) - 1] = '\0'; - NumBytes = strlen(StartupScript); + NumBytes = strlen(StartupScript); UT_SetReadBuffer(StartupScript, NumBytes); /* Test starting an application with an error reading the startup file */ @@ -1246,9 +1065,8 @@ void TestApps(void) CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_READ]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), - "CFE_ES_StartApplications", - "Error reading startup file"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), + "CFE_ES_StartApplications", "Error reading startup file"); /* Test starting an application with an end-of-file returned by the * OS read @@ -1256,19 +1074,15 @@ void TestApps(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, 0); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), - "CFE_ES_StartApplications", - "End of file reached"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), + "CFE_ES_StartApplications", "End of file reached"); /* Test starting an application with an open failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), - "CFE_ES_StartApplications", - "Can't open ES application startup file"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), + "CFE_ES_StartApplications", "Can't open ES application startup file"); /* Test successfully starting an application */ ES_ResetUnitTest(); @@ -1280,143 +1094,70 @@ void TestApps(void) /* Test parsing the startup script with an unknown entry type */ ES_ResetUnitTest(); { - const char *TokenList[] = - { - "UNKNOWN", - "/cf/apps/tst_lib.bundle", - "TST_LIB_Init", - "TST_LIB", - "0", - "0", - "0x0", - "1" - }; - UT_Report(__FILE__, __LINE__, - CFE_ES_ParseFileEntry(TokenList, 8) == CFE_ES_ERR_APP_CREATE, - "CFE_ES_ParseFileEntry", - "Unknown entry type"); + const char *TokenList[] = {"UNKNOWN", "/cf/apps/tst_lib.bundle", "TST_LIB_Init", "TST_LIB", "0", "0", "0x0", + "1"}; + UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_ES_ERR_APP_CREATE, + "CFE_ES_ParseFileEntry", "Unknown entry type"); /* Test parsing the startup script with an invalid file name */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_ParseInputFileName), CFE_FS_INVALID_PATH); - UT_Report(__FILE__, __LINE__, - CFE_ES_ParseFileEntry(TokenList, 8) == CFE_FS_INVALID_PATH, - "CFE_ES_ParseFileEntry", - "Invalid file name"); + UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_FS_INVALID_PATH, + "CFE_ES_ParseFileEntry", "Invalid file name"); } /* Test parsing the startup script with an invalid argument passed in */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_ParseFileEntry(NULL, 0) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_ParseFileEntry", + UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(NULL, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_ParseFileEntry", "Invalid argument"); /* Test application loading and creation with a task creation failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename", - "EntryPoint", - 170, - 4096, - 1); - Return = CFE_ES_AppCreate(&AppId, - "AppName", - &StartParams); + ES_UT_SetupAppStartParams(&StartParams, "ut/filename", "EntryPoint", 170, 4096, 1); + Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_APP_CREATE])); - + /* Test application creation with NULL parameters */ ES_ResetUnitTest(); - Return = CFE_ES_AppCreate(&AppId, - "AppName", - NULL); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_AppCreate", - "NULL file name"); - - /* Test application creation with name too long */ - memset(NameBuffer, 'x', sizeof(NameBuffer)-1); - NameBuffer[sizeof(NameBuffer)-1] = 0; - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename.x", - "EntryPoint", - 170, - 4096, - 1); - Return = CFE_ES_AppCreate(&AppId, - NameBuffer, - &StartParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_AppCreate", - "Name too long"); + Return = CFE_ES_AppCreate(&AppId, "AppName", NULL); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_AppCreate", "NULL file name"); + /* Test application creation with name too long */ + memset(NameBuffer, 'x', sizeof(NameBuffer) - 1); + NameBuffer[sizeof(NameBuffer) - 1] = 0; + ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 4096, 1); + Return = CFE_ES_AppCreate(&AppId, NameBuffer, &StartParams); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_AppCreate", "Name too long"); /* Test successful application loading and creation */ ES_ResetUnitTest(); - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename.x", - "EntryPoint", - 170, - 8192, - 1); - Return = CFE_ES_AppCreate(&AppId, - "AppName", - &StartParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_SUCCESS, - "CFE_ES_AppCreate", - "Application load/create; successful"); + ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); + Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); + UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_AppCreate", "Application load/create; successful"); /* Test application loading of the same name again */ - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename.x", - "EntryPoint", - 170, - 8192, - 1); - Return = CFE_ES_AppCreate(&AppId, - "AppName", - &StartParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_ERR_DUPLICATE_NAME, - "CFE_ES_AppCreate", - "Duplicate name"); + ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); + Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_DUPLICATE_NAME, "CFE_ES_AppCreate", "Duplicate name"); /* Test application loading and creation where the file cannot be loaded */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleLoad), 1, -1); - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename.x", - "EntryPoint", - 170, - 8192, - 1); - Return = CFE_ES_AppCreate(&AppId, - "AppName2", - &StartParams); + ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); + Return = CFE_ES_AppCreate(&AppId, "AppName2", &StartParams); UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_EXTRACT_FILENAME_UT55])); /* Test application loading and creation where all app slots are taken */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename.x", - "EntryPoint", - 170, - 8192, - 1); - Return = CFE_ES_AppCreate(&AppId, - "AppName", - &StartParams); + ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); + Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); UT_Report(__FILE__, __LINE__, Return == CFE_ES_NO_RESOURCE_IDS_AVAILABLE && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_APP_SLOTS]), - "CFE_ES_AppCreate", - "No free application slots available"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_APP_SLOTS]), + "CFE_ES_AppCreate", "No free application slots available"); /* Check operation of the CFE_ES_CheckAppIdSlotUsed() helper function */ CFE_ES_Global.AppTable[1].AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(1)); @@ -1429,34 +1170,19 @@ void TestApps(void) */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename.x", - "EntryPoint", - 170, - 8192, - 1); - Return = CFE_ES_AppCreate(&AppId, - "AppName", - &StartParams); + ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); + Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL])); - /* Test application loading and creation where the entry point symbol * cannot be found and module unload fails */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, -1); - ES_UT_SetupAppStartParams(&StartParams, - "ut/filename.x", - "EntryPoint", - 170, - 8192, - 1); - Return = CFE_ES_AppCreate(&AppId, - "AppName", - &StartParams); + ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); + Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL])); UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MODULE_UNLOAD_FAILED])); @@ -1476,14 +1202,11 @@ void TestApps(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_WAITING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->ControlReq.AppTimerMsec = 0; + UtAppRecPtr->ControlReq.AppTimerMsec = 0; memset(&CFE_ES_TaskData.BackgroundAppScanState, 0, sizeof(CFE_ES_TaskData.BackgroundAppScanState)); CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && - UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", - "Waiting; process control request"); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && UtAppRecPtr->ControlReq.AppTimerMsec == 0, + "CFE_ES_RunAppTableScan", "Waiting; process control request"); /* Test scanning and acting on the application table where the timer * has not expired for a waiting application @@ -1491,13 +1214,12 @@ void TestApps(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_WAITING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - UtAppRecPtr->ControlReq.AppTimerMsec = 5000; + UtAppRecPtr->ControlReq.AppTimerMsec = 5000; CFE_ES_RunAppTableScan(1000, &CFE_ES_TaskData.BackgroundAppScanState); UT_Report(__FILE__, __LINE__, UtAppRecPtr->ControlReq.AppTimerMsec == 4000 && - UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_EXIT, - "CFE_ES_RunAppTableScan", - "Decrement timer"); + UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_EXIT, + "CFE_ES_RunAppTableScan", "Decrement timer"); /* Test scanning and acting on the application table where the application * has stopped and is ready to be acted on @@ -1505,13 +1227,10 @@ void TestApps(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->ControlReq.AppTimerMsec = 0; + UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && - UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", - "Stopped; process control request"); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && UtAppRecPtr->ControlReq.AppTimerMsec == 0, + "CFE_ES_RunAppTableScan", "Stopped; process control request"); /* Test scanning and acting on the application table where the application * has stopped and is ready to be acted on @@ -1520,41 +1239,28 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_EARLY_INIT, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 5000; CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, - UT_GetNumEventsSent() == 0 && - UtAppRecPtr->ControlReq.AppTimerMsec == 5000, - "CFE_ES_RunAppTableScan", - "Initializing; process control request"); + UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 5000, + "CFE_ES_RunAppTableScan", "Initializing; process control request"); - /* Test a control action request on an application with an + /* Test a control action request on an application with an * undefined control request state */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = 0x12345; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID), "CFE_ES_ProcessControlRequest", "Unknown state (default)"); /* Test a successful control action request to exit an application */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, - "/ram/Filename", - "NotNULL", - 8192, - 255, - 0); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_EXIT; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/Filename", "NotNULL", 8192, 255, 0); + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_EXIT_APP_INF_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_EXIT_APP_INF_EID), "CFE_ES_ProcessControlRequest", "Exit application; successful"); /* Test a control action request to exit an application where the @@ -1566,9 +1272,7 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_EXIT_APP_ERR_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_EXIT_APP_ERR_EID), "CFE_ES_ProcessControlRequest", "Exit application failure"); /* Test a control action request to stop an application where the @@ -1576,14 +1280,11 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_DELETE; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_STOP_ERR3_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR3_EID), "CFE_ES_ProcessControlRequest", "Stop application failure"); /* Test a control action request to restart an application where the @@ -1591,14 +1292,11 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_RESTART; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR4_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR4_EID), "CFE_ES_ProcessControlRequest", "Restart application failure; CleanUpApp error"); /* Test a control action request to restart an application where the @@ -1606,15 +1304,12 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_RESTART; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR3_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR3_EID), "CFE_ES_ProcessControlRequest", "Restart application failure; AppCreate error"); /* Test a control action request to reload an application where the @@ -1622,14 +1317,11 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_RELOAD; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR4_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR4_EID), "CFE_ES_ProcessControlRequest", "Reload application failure; CleanUpApp error"); /* Test a control action request to reload an application where the @@ -1637,15 +1329,12 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_RELOAD; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR3_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR3_EID), "CFE_ES_ProcessControlRequest", "Reload application failure; AppCreate error"); /* Test a successful control action request to exit an application that @@ -1653,20 +1342,12 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, - "/ram/FileName", - "NULL", - 8192, - 255, - 0); - - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_ERROR; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); + + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_ERREXIT_APP_INF_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERREXIT_APP_INF_EID), "CFE_ES_ProcessControlRequest", "Exit application on error; successful"); /* Test a control action request to exit an application that @@ -1675,67 +1356,40 @@ void TestApps(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_ERROR; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_ERREXIT_APP_ERR_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERREXIT_APP_ERR_EID), "CFE_ES_ProcessControlRequest", "Exit application on error failure"); /* Test a successful control action request to stop an application */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, - "/ram/FileName", - "NULL", - 8192, - 255, - 0); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_DELETE; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_STOP_INF_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_INF_EID), "CFE_ES_ProcessControlRequest", "Stop application; successful"); /* Test a successful control action request to restart an application */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, - "/ram/FileName", - "NULL", - 8192, - 255, - 0); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_RESTART; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RESTART_APP_INF_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_INF_EID), "CFE_ES_ProcessControlRequest", "Restart application; successful"); /* Test a successful control action request to reload an application */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, - "/ram/FileName", - "NULL", - 8192, - 255, - 0); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_RELOAD; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RELOAD_APP_INF_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_INF_EID), "CFE_ES_ProcessControlRequest", "Reload application; successful"); /* Test a control action request for an application that has an invalid @@ -1743,28 +1397,18 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, - "/ram/FileName", - "NULL", - 8192, - 255, - 0); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_SYS_EXCEPTION; - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_EXCEPTION; + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PCR_ERR1_EID), - "CFE_ES_ProcessControlRequest", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR1_EID), "CFE_ES_ProcessControlRequest", "Invalid state"); /* Test populating the application information structure with data */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, - "CFE_ES_GetAppInfo", + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, "CFE_ES_GetAppInfo", "Get application information; successful"); /* Test populating the application information structure with data using @@ -1773,9 +1417,7 @@ void TestApps(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppInfo(NULL, AppId) == CFE_ES_ERR_BUFFER, - "CFE_ES_GetAppInfo", + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(NULL, AppId) == CFE_ES_ERR_BUFFER, "CFE_ES_GetAppInfo", "Null application information pointer"); /* Test populating the application information structure using an @@ -1785,20 +1427,16 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_AppRecordSetFree(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppInfo", - "Application ID not active"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetAppInfo", "Application ID not active"); /* Test populating the application information structure using an * application ID value greater than the maximum allowed */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppInfo", - "Application ID exceeds maximum"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetAppInfo", "Application ID exceeds maximum"); /* Test populating the application information structure using a valid * application ID, but with a failure to retrieve the module information @@ -1807,9 +1445,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_ModuleInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, - "CFE_ES_GetAppInfo", + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, "CFE_ES_GetAppInfo", "Module not found"); /* Test deleting an application and cleaning up its resources with OS @@ -1823,9 +1459,7 @@ void TestApps(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", "Task OS delete and close failure"); /* Test deleting an application and cleaning up its resources with a @@ -1837,9 +1471,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", "Task mutex delete failure"); /* Test deleting an application and cleaning up its resources with a @@ -1849,9 +1481,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", "Module unload failure"); /* Test deleting an application and cleaning up its resources where the @@ -1861,9 +1491,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", "EVS application cleanup failure"); /* Test cleaning up the OS resources for a task with a failure @@ -1874,11 +1502,8 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == - CFE_ES_MUT_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", - "Mutex delete failure"); + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_MUT_SEM_DELETE_ERR, + "CFE_ES_CleanupTaskResources", "Mutex delete failure"); /* Test cleaning up the OS resources for a task with a failure deleting * binary semaphores @@ -1888,11 +1513,8 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_BinSemDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == - CFE_ES_BIN_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", - "Binary semaphore delete failure"); + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_BIN_SEM_DELETE_ERR, + "CFE_ES_CleanupTaskResources", "Binary semaphore delete failure"); /* Test cleaning up the OS resources for a task with a failure deleting * counting semaphores @@ -1902,11 +1524,8 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_CountSemDelete), 1, OS_ERROR); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == - CFE_ES_COUNT_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", - "Counting semaphore failure"); + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_COUNT_SEM_DELETE_ERR, + "CFE_ES_CleanupTaskResources", "Counting semaphore failure"); /* Test cleaning up the OS resources for a task with a failure * deleting queues @@ -1916,11 +1535,8 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_QueueDelete), 1, OS_ERROR); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == - CFE_ES_QUEUE_DELETE_ERR, - "CFE_ES_CleanupTaskResources", - "Queue delete failure"); + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_QUEUE_DELETE_ERR, + "CFE_ES_CleanupTaskResources", "Queue delete failure"); /* Test cleaning up the OS resources for a task with a failure * deleting timers @@ -1933,11 +1549,8 @@ void TestApps(void) * that the code call OS_TimerGetInfo first. */ UT_SetDeferredRetcode(UT_KEY(OS_TimerDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == - CFE_ES_TIMER_DELETE_ERR, - "CFE_ES_CleanupTaskResources", - "Timer delete failure"); + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_TIMER_DELETE_ERR, + "CFE_ES_CleanupTaskResources", "Timer delete failure"); /* Test cleaning up the OS resources for a task with a failure * closing files @@ -1948,9 +1561,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) != CFE_SUCCESS, - "CFE_ES_CleanupTaskResources", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) != CFE_SUCCESS, "CFE_ES_CleanupTaskResources", "File close failure"); /* Test cleaning up the OS resources for a task with a failure @@ -1961,19 +1572,15 @@ void TestApps(void) TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_TASK_DELETE_ERR, - "CFE_ES_CleanupTaskResources", - "Task delete failure"); + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_TASK_DELETE_ERR, + "CFE_ES_CleanupTaskResources", "Task delete failure"); /* Test successfully cleaning up the OS resources for a task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, - "CFE_ES_CleanupTaskResources", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, "CFE_ES_CleanupTaskResources", "Clean up task OS resources; successful"); /* Test parsing the startup script for a cFE application and a restart @@ -1981,20 +1588,9 @@ void TestApps(void) */ ES_ResetUnitTest(); { - const char *TokenList[] = - { - "CFE_APP", - "/cf/apps/tst_lib.bundle", - "TST_LIB_Init", - "TST_LIB", - "0", - "0", - "0x0", - "0" - }; - UT_Report(__FILE__, __LINE__, - CFE_ES_ParseFileEntry(TokenList, 8) == CFE_SUCCESS, - "CFE_ES_ParseFileEntry", + const char *TokenList[] = {"CFE_APP", "/cf/apps/tst_lib.bundle", "TST_LIB_Init", "TST_LIB", "0", "0", "0x0", + "0"}; + UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_SUCCESS, "CFE_ES_ParseFileEntry", "CFE application; restart application on exception"); } @@ -2005,11 +1601,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, - UT_GetNumEventsSent() == 0 && - UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", - "Waiting; process control request"); + UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 0, + "CFE_ES_RunAppTableScan", "Waiting; process control request"); /* Test scanning and acting on the application table where the application * is already running @@ -2018,11 +1611,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, - UT_GetNumEventsSent() == 0 && - UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", - "Running; process control request"); + UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 0, + "CFE_ES_RunAppTableScan", "Running; process control request"); /* Test deleting an application and cleaning up its resources where the * application ID matches the main task ID @@ -2037,17 +1627,11 @@ void TestApps(void) /* Associate a child task with the app to be deleted */ ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, "CFE_ES_CleanUpApp", "Main task ID matches task ID, nominal"); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", "Main task ID matches task ID, other task unaffected"); - UT_Report(__FILE__, __LINE__, - !CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, !CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), "CFE_ES_CleanUpApp", "Main task ID matches task ID, memory pool deleted"); /* Test deleting an application and cleaning up its resources where the @@ -2058,16 +1642,11 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupMemPoolId(&UtPoolRecPtr); UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr); - UtPoolRecPtr->PoolID = CFE_ES_MEMHANDLE_C(CFE_ResourceId_FromInteger(99999)); /* Mismatch */ - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, - "CFE_ES_CleanUpApp", + UtPoolRecPtr->PoolID = CFE_ES_MEMHANDLE_C(CFE_ResourceId_FromInteger(99999)); /* Mismatch */ + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", "Mem Pool delete error"); - UT_Report(__FILE__, __LINE__, - CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), - "CFE_ES_CleanUpApp", - "Mem Pool not freed"); + UT_Report(__FILE__, __LINE__, CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), "CFE_ES_CleanUpApp", "Mem Pool not freed"); /* Test deleting an application and cleaning up its resources where the * application ID doesn't match the main task ID @@ -2086,13 +1665,9 @@ void TestApps(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", "Main task ID doesn't match task ID, CFE_ES_APP_CLEANUP_ERR"); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", "Main task ID doesn't match task ID, second task unchanged"); /* Test deleting an application and cleaning up its resources where the @@ -2108,21 +1683,15 @@ void TestApps(void) /* switch the main task association (makes it wrong) */ UtAppRecPtr->MainTaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, "CFE_ES_CleanUpApp", "Application ID mismatch; core application"); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", "Application ID mismatch; core application"); - UT_Report(__FILE__, __LINE__, - CFE_ES_Global.RegisteredExternalApps == 1, - "CFE_ES_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_ES_Global.RegisteredExternalApps == 1, "CFE_ES_CleanUpApp", "Application ID mismatch; core application"); /* Test successfully deleting an application and cleaning up its resources @@ -2134,11 +1703,9 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS && - !CFE_ES_TaskRecordIsUsed(UtTaskRecPtr) && - CFE_ES_Global.RegisteredExternalApps == 0, - "CFE_ES_CleanUpApp", - "Successful application cleanup; external application"); + CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS && !CFE_ES_TaskRecordIsUsed(UtTaskRecPtr) && + CFE_ES_Global.RegisteredExternalApps == 0, + "CFE_ES_CleanUpApp", "Successful application cleanup; external application"); /* Test cleaning up the OS resources for a task with failure to * obtain information on mutex, binary, and counter semaphores, and @@ -2153,11 +1720,8 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(OS_QueueGetInfo), 1, OS_ERROR); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDeferredRetcode(UT_KEY(OS_FDGetInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, - "CFE_ES_CleanupTaskResources", + UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, "CFE_ES_CleanupTaskResources", "Get OS information failures"); - } void TestResourceID(void) @@ -2165,16 +1729,16 @@ void TestResourceID(void) /* * Test cases for generic resource ID functions which are * not sufficiently covered by other app/lib tests. - * + * * Most of the Resource ID functions have been moved to a separate module and that module * has its own unit test which tests these APIs. - * + * * This is mainly to exercise the conversion of CFE ES task IDs to OSAL task IDs and vice versa. - * The conversion is only implemented for tasks, because this is the only resource type where - * there is overlap between OSAL and CFE (they both have task records). + * The conversion is only implemented for tasks, because this is the only resource type where + * there is overlap between OSAL and CFE (they both have task records). */ CFE_ES_TaskId_t cfe_id1, cfe_id2; - osal_id_t osal_id; + osal_id_t osal_id; /* * In this function the actual values may or may not change, @@ -2186,17 +1750,17 @@ void TestResourceID(void) cfe_id1 = CFE_ES_TASKID_C(ES_UT_MakeTaskIdForIndex(0)); osal_id = CFE_ES_TaskId_ToOSAL(cfe_id1); cfe_id2 = CFE_ES_TaskId_FromOSAL(osal_id); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(cfe_id1, cfe_id2), "CFE_ES_TaskId_ToOSAL()/FromOSAL(): before=%lx, after=%lx", - CFE_RESOURCEID_TO_ULONG(cfe_id1), CFE_RESOURCEID_TO_ULONG(cfe_id2)); - + UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(cfe_id1, cfe_id2), + "CFE_ES_TaskId_ToOSAL()/FromOSAL(): before=%lx, after=%lx", CFE_RESOURCEID_TO_ULONG(cfe_id1), + CFE_RESOURCEID_TO_ULONG(cfe_id2)); } void TestLibs(void) { - CFE_ES_LibRecord_t *UtLibRecPtr; - char LongLibraryName[sizeof(UtLibRecPtr->LibName)+1]; - CFE_ES_LibId_t Id; - int32 Return; + CFE_ES_LibRecord_t * UtLibRecPtr; + char LongLibraryName[sizeof(UtLibRecPtr->LibName) + 1]; + CFE_ES_LibId_t Id; + int32 Return; CFE_ES_ModuleLoadParams_t LoadParams; /* Test shared library loading and initialization where the initialization @@ -2211,34 +1775,25 @@ void TestLibs(void) /* Test Load library returning an error on a null pointer argument */ Return = CFE_ES_LoadLibrary(&Id, "LibName", NULL); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_LoadLibrary", + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", "Load shared library bad argument (NULL filename)"); Return = CFE_ES_LoadLibrary(&Id, NULL, &LoadParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_LoadLibrary", + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", "Load shared library bad argument (NULL library name)"); /* Test Load library returning an error on a too long library name */ - memset(LongLibraryName, 'a', sizeof(LongLibraryName)-1); - LongLibraryName[sizeof(LongLibraryName)-1] = '\0'; - Return = CFE_ES_LoadLibrary(&Id, LongLibraryName, &LoadParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_LoadLibrary", + memset(LongLibraryName, 'a', sizeof(LongLibraryName) - 1); + LongLibraryName[sizeof(LongLibraryName) - 1] = '\0'; + Return = CFE_ES_LoadLibrary(&Id, LongLibraryName, &LoadParams); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", "Load shared library bad argument (library name too long)"); /* Test successful shared library loading and initialization */ UT_InitData(); UT_SetDummyFuncRtn(OS_SUCCESS); Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_SUCCESS, - "CFE_ES_LoadLibrary", - "successful"); + UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_LoadLibrary", "successful"); UtLibRecPtr = CFE_ES_LocateLibRecordByID(Id); UtAssert_True(UtLibRecPtr != NULL, "CFE_ES_LoadLibrary() return valid ID"); @@ -2246,12 +1801,9 @@ void TestLibs(void) /* Try loading same library again, should return the DUPLICATE code */ Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_ERR_DUPLICATE_NAME, - "CFE_ES_LoadLibrary", - "Duplicate"); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_DUPLICATE_NAME, "CFE_ES_LoadLibrary", "Duplicate"); UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)), - "CFE_ES_LoadLibrary() returned previous ID"); + "CFE_ES_LoadLibrary() returned previous ID"); /* Test shared library loading and initialization where the library * fails to load @@ -2277,10 +1829,7 @@ void TestLibs(void) UT_SetDefaultReturnValue(UT_KEY(dummy_function), -555); ES_UT_SetupModuleLoadParams(&LoadParams, "filename", "dummy_function"); Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, - Return == -555, - "CFE_ES_LoadLibrary", - "Library initialization function failure"); + UT_Report(__FILE__, __LINE__, Return == -555, "CFE_ES_LoadLibrary", "Library initialization function failure"); /* Test shared library loading and initialization where there are no * library slots available @@ -2289,10 +1838,8 @@ void TestLibs(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); Return = CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams); UT_Report(__FILE__, __LINE__, - Return == CFE_ES_NO_RESOURCE_IDS_AVAILABLE && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_LIBRARY_SLOTS]), - "CFE_ES_LoadLibrary", - "No free library slots"); + Return == CFE_ES_NO_RESOURCE_IDS_AVAILABLE && UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_LIBRARY_SLOTS]), + "CFE_ES_LoadLibrary", "No free library slots"); /* check operation of the CFE_ES_CheckLibIdSlotUsed() function */ CFE_ES_Global.LibTable[1].LibId = CFE_ES_LIBID_C(ES_UT_MakeLibIdForIndex(1)); @@ -2309,16 +1856,17 @@ void TestLibs(void) UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&Id, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&Id, LongLibraryName), CFE_SUCCESS); UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)), "Library IDs Match"); - UtAssert_INT32_EQ(CFE_ES_GetLibName(LongLibraryName, CFE_ES_LIBID_UNDEFINED, sizeof(LongLibraryName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetLibName(LongLibraryName, CFE_ES_LIBID_UNDEFINED, sizeof(LongLibraryName)), + CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetLibName(NULL, Id, sizeof(LongLibraryName)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&Id, NULL), CFE_ES_BAD_ARGUMENT); } void TestERLog(void) { - int Return; - void *LocalBuffer; - size_t LocalBufSize; + int Return; + void * LocalBuffer; + size_t LocalBufSize; CFE_ES_BackgroundLogDumpGlobal_t State; UtPrintf("Begin Test Exception and Reset Log"); @@ -2329,18 +1877,12 @@ void TestERLog(void) */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->ERLogIndex = CFE_PLATFORM_ES_ER_LOG_ENTRIES + 1; - Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, - CFE_PSP_RST_TYPE_POWERON, - 1, - NULL); + Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL); UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS && - !strcmp(CFE_ES_ResetDataPtr->ERLog[0].BaseInfo.Description, - "No Description String Given.") && - CFE_ES_ResetDataPtr->ERLogIndex == 1, - "CFE_ES_WriteToERLog", - "Log entries exceeded; no description; valid context size"); - + !strcmp(CFE_ES_ResetDataPtr->ERLog[0].BaseInfo.Description, "No Description String Given.") && + CFE_ES_ResetDataPtr->ERLogIndex == 1, + "CFE_ES_WriteToERLog", "Log entries exceeded; no description; valid context size"); /* Test non-rolling over log entry, * null description, @@ -2348,63 +1890,59 @@ void TestERLog(void) */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->ERLogIndex = 0; - Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, - CFE_PSP_RST_TYPE_POWERON, - 1, - NULL); - UT_Report(__FILE__, __LINE__, - Return == CFE_SUCCESS && - CFE_ES_ResetDataPtr->ERLogIndex == 1, - "CFE_ES_WriteToERLog", + Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL); + UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS && CFE_ES_ResetDataPtr->ERLogIndex == 1, "CFE_ES_WriteToERLog", "No log entry rollover; no description; no context"); /* Test ER log background write functions */ memset(&State, 0, sizeof(State)); - LocalBuffer = NULL; + LocalBuffer = NULL; LocalBufSize = 0; UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, 128); UtAssert_True(!CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter at start, with context"); + "CFE_ES_BackgroundERLogFileDataGetter at start, with context"); UtAssert_UINT32_EQ(State.EntryBuffer.ContextSize, 128); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); memset(&State.EntryBuffer, 0xEE, sizeof(State.EntryBuffer)); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, -1); - UtAssert_True(CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES-1, &LocalBuffer, &LocalBufSize), + UtAssert_True( + CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1, &LocalBuffer, &LocalBufSize), "CFE_ES_BackgroundERLogFileDataGetter at EOF, no context"); UtAssert_ZERO(State.EntryBuffer.ContextSize); - UtAssert_True(CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize), + UtAssert_True( + CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize), "CFE_ES_BackgroundERLogFileDataGetter beyond EOF"); UtAssert_NULL(LocalBuffer); UtAssert_ZERO(LocalBufSize); - /* Test ER log background write event handling */ UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_EID), "COMPLETE: CFE_ES_ERLOG2_EID generated"); + UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_EID), "COMPLETE: CFE_ES_ERLOG2_EID generated"); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), "HEADER_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); + UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), + "HEADER_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), "RECORD_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); + UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), + "RECORD_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_CREATE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_ERR_EID), "CREATE_ERROR: CFE_ES_ERLOG2_ERR_EID generated"); + UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_ERR_EID), "CREATE_ERROR: CFE_ES_ERLOG2_ERR_EID generated"); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_UNDEFINED, CFE_SUCCESS, 10, 0, 100); - UtAssert_True(UT_GetNumEventsSent() == 0, "UNDEFINED: No event generated"); + UtAssert_True(UT_GetNumEventsSent() == 0, "UNDEFINED: No event generated"); } - void TestGenericPool(void) { CFE_ES_GenPoolRecord_t Pool1; @@ -2421,16 +1959,12 @@ void TestGenericPool(void) uint32 CountBuf; uint32 ErrBuf; CFE_ES_BlockStats_t BlockStats; - static const size_t UT_POOL_BLOCK_SIZES[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = - { - /* - * These are intentionally in a mixed order - * so that the implementation will sort them. - */ - 16, 56, 60, 40, 44, 48, - 64, 128, 20, 24, 28, 12, - 52, 32, 4, 8, 36 - }; + static const size_t UT_POOL_BLOCK_SIZES[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { + /* + * These are intentionally in a mixed order + * so that the implementation will sort them. + */ + 16, 56, 60, 40, 44, 48, 64, 128, 20, 24, 28, 12, 52, 32, 4, 8, 36}; uint16 i; uint32 ExpectedCount; @@ -2439,36 +1973,27 @@ void TestGenericPool(void) /* Test successfully creating direct access pool, with alignment, no mutex */ memset(&UT_MemPoolDirectBuffer, 0xee, sizeof(UT_MemPoolDirectBuffer)); OffsetEnd = sizeof(UT_MemPoolDirectBuffer.Data); - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, - 0, - OffsetEnd, - 32, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, - ES_UT_PoolDirectRetrieve, - ES_UT_PoolDirectCommit), - CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), + CFE_SUCCESS); /* Allocate buffers until no space left */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 44), CFE_SUCCESS); - UtAssert_True(Offset1 > 0 && Offset1 < OffsetEnd, "0 < Offset(%lu) < %lu", - (unsigned long)Offset1, (unsigned long)OffsetEnd); - UtAssert_True((Offset1 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", - (unsigned long)Offset1); + UtAssert_True(Offset1 > 0 && Offset1 < OffsetEnd, "0 < Offset(%lu) < %lu", (unsigned long)Offset1, + (unsigned long)OffsetEnd); + UtAssert_True((Offset1 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset1); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 72), CFE_SUCCESS); - UtAssert_True(Offset2 > Offset1 && Offset2 < OffsetEnd, "%lu < Offset(%lu) < %lu", - (unsigned long)Offset1, (unsigned long)Offset2, (unsigned long)OffsetEnd); - UtAssert_True((Offset2 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", - (unsigned long)Offset2); + UtAssert_True(Offset2 > Offset1 && Offset2 < OffsetEnd, "%lu < Offset(%lu) < %lu", (unsigned long)Offset1, + (unsigned long)Offset2, (unsigned long)OffsetEnd); + UtAssert_True((Offset2 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset2); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 72), CFE_ES_ERR_MEM_BLOCK_SIZE); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 6), CFE_SUCCESS); - UtAssert_True(Offset3 > Offset2 && Offset3 < OffsetEnd, "%lu < Offset(%lu) < %lu", - (unsigned long)Offset2, (unsigned long)Offset3, (unsigned long)OffsetEnd); - UtAssert_True((Offset3 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", - (unsigned long)Offset3); + UtAssert_True(Offset3 > Offset2 && Offset3 < OffsetEnd, "%lu < Offset(%lu) < %lu", (unsigned long)Offset2, + (unsigned long)Offset3, (unsigned long)OffsetEnd); + UtAssert_True((Offset3 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset3); /* Free a buffer and attempt to reallocate */ UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_SUCCESS); @@ -2481,8 +2006,8 @@ void TestGenericPool(void) UtAssert_NONZERO(Pool1.ValidationErrorCount); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset4, 100), CFE_SUCCESS); - UtAssert_True(Offset4 == Offset2, "New Offset(%lu) == Old Offset(%lu)", - (unsigned long)Offset4, (unsigned long)Offset2); + UtAssert_True(Offset4 == Offset2, "New Offset(%lu) == Old Offset(%lu)", (unsigned long)Offset4, + (unsigned long)Offset2); /* Attempt Bigger than the largest bucket */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 1000), CFE_ES_ERR_MEM_BLOCK_SIZE); @@ -2502,24 +2027,17 @@ void TestGenericPool(void) UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_SUCCESS); /* Now wipe the pool management structure, and attempt to rebuild it. */ - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, - 0, - OffsetEnd, - 32, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, - ES_UT_PoolDirectRetrieve, - ES_UT_PoolDirectCommit), - CFE_SUCCESS); - - UtAssert_INT32_EQ(CFE_ES_GenPoolRebuild(&Pool2), - CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), + CFE_SUCCESS); + + UtAssert_INT32_EQ(CFE_ES_GenPoolRebuild(&Pool2), CFE_SUCCESS); /* After rebuilding, Pool2 should have similar state data to Pool1. */ UtAssert_UINT32_EQ(Pool1.TailPosition, Pool2.TailPosition); UtAssert_UINT32_EQ(Pool1.AllocationCount, Pool2.AllocationCount); - for (i=0; i < Pool1.NumBuckets; ++i) + for (i = 0; i < Pool1.NumBuckets; ++i) { /* Allocation counts should match exactly */ UtAssert_UINT32_EQ(Pool1.Buckets[i].AllocationCount, Pool2.Buckets[i].AllocationCount); @@ -2540,43 +2058,32 @@ void TestGenericPool(void) UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 72), CFE_SUCCESS); UtAssert_UINT32_EQ(Offset4, Offset2); - - /* Test successfully creating indirect memory pool, no alignment, with mutex */ memset(&UT_MemPoolIndirectBuffer, 0xee, sizeof(UT_MemPoolIndirectBuffer)); OffsetEnd = sizeof(UT_MemPoolIndirectBuffer.Data); - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, - 2, - OffsetEnd - 2, - 0, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, - ES_UT_PoolIndirectRetrieve, - ES_UT_PoolIndirectCommit), - CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, 2, OffsetEnd - 2, 0, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolIndirectRetrieve, + ES_UT_PoolIndirectCommit), + CFE_SUCCESS); /* Do Series of allocations - confirm that the implementation is * properly adhering to the block sizes specified. */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 1), CFE_SUCCESS); /* With no alignment adjustments, the result offset should be exactly matching */ - UtAssert_True(Offset1 == 2 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", - (unsigned long)Offset1); + UtAssert_True(Offset1 == 2 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset1); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 55), CFE_SUCCESS); /* the previous block should be 4 in size (smallest block) */ - UtAssert_True(Offset2 == Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", - (unsigned long)Offset2); + UtAssert_True(Offset2 == Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset2); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 15), CFE_SUCCESS); /* the previous block should be 56 in size */ - UtAssert_True(Offset3 == Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", - (unsigned long)Offset3); + UtAssert_True(Offset3 == Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset3); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 54), CFE_SUCCESS); /* the previous block should be 16 in size */ - UtAssert_True(Offset4 == Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", - (unsigned long)Offset4); + UtAssert_True(Offset4 == Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset4); UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset1), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset2), CFE_SUCCESS); @@ -2585,14 +2092,12 @@ void TestGenericPool(void) UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 56), CFE_SUCCESS); /* should re-issue previous block */ - UtAssert_True(Offset4 == Offset1, "Offset(%lu) match", - (unsigned long)Offset1); + UtAssert_True(Offset4 == Offset1, "Offset(%lu) match", (unsigned long)Offset1); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56), CFE_SUCCESS); /* should re-issue previous block */ - UtAssert_True(Offset3 == Offset2, "Offset(%lu) match", - (unsigned long)Offset3); + UtAssert_True(Offset3 == Offset2, "Offset(%lu) match", (unsigned long)Offset3); /* Getting another will fail, despite being enough space, * because its now fragmented. */ @@ -2609,15 +2114,9 @@ void TestGenericPool(void) /* Calculate exact (predicted) pool consumption per block */ OffsetEnd = (sizeof(CFE_ES_GenPoolBD_t) + 31) & 0xFFF0; OffsetEnd *= 2; /* make enough for 2 */ - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, - 0, - OffsetEnd, - 16, - 1, - UT_POOL_BLOCK_SIZES, - ES_UT_PoolDirectRetrieve, - ES_UT_PoolDirectCommit), - CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 16, 1, UT_POOL_BLOCK_SIZES, + ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), + CFE_SUCCESS); /* * This should be exactly enough for 2 allocations. @@ -2644,14 +2143,12 @@ void TestGenericPool(void) Pool1.TailPosition = 0xFFFFFF; UtAssert_True(!CFE_ES_GenPoolValidateState(&Pool1), "Validate Corrupt handle"); - } - void TestTask(void) { - uint32 ResetType; - osal_id_t UT_ContextTask; + uint32 ResetType; + osal_id_t UT_ContextTask; union { CFE_MSG_Message_t Msg; @@ -2675,11 +2172,11 @@ void TestTask(void) CFE_ES_DumpCDSRegistryCmd_t DumpCDSRegistryCmd; CFE_ES_QueryAllTasksCmd_t QueryAllTasksCmd; } CmdBuf; - CFE_ES_AppRecord_t *UtAppRecPtr; - CFE_ES_TaskRecord_t *UtTaskRecPtr; - CFE_ES_CDS_RegRec_t *UtCDSRegRecPtr; - CFE_ES_MemPoolRecord_t *UtPoolRecPtr; - CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + CFE_ES_AppRecord_t * UtAppRecPtr; + CFE_ES_TaskRecord_t * UtTaskRecPtr; + CFE_ES_CDS_RegRec_t * UtCDSRegRecPtr; + CFE_ES_MemPoolRecord_t *UtPoolRecPtr; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; UtPrintf("Begin Test Task"); @@ -2689,7 +2186,7 @@ void TestTask(void) */ memset(&CmdBuf, 0, sizeof(CmdBuf)); CFE_ES_ResetDataPtr->SystemLogWriteIdx = 0; - CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; + CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; /* Test task main process loop with a command pipe error */ ES_ResetUnitTest(); @@ -2699,22 +2196,16 @@ void TestTask(void) /* Set up buffer for first cycle, pipe failure is on 2nd */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); CFE_ES_TaskMain(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]), - "CFE_ES_TaskMain", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]), "CFE_ES_TaskMain", "Command pipe error, UT_OSP_COMMAND_PIPE message"); /* Test task main process loop with an initialization failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskRegister), OS_ERROR); CFE_ES_TaskMain(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_APP_INIT]), - "CFE_ES_TaskMain", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_APP_INIT]), "CFE_ES_TaskMain", "Task initialization fail, UT_OSP_APP_INIT message"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REGISTER_APP]), - "CFE_ES_TaskMain", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REGISTER_APP]), "CFE_ES_TaskMain", "Task initialization fail, UT_OSP_REGISTER_APP message"); /* Test task main process loop with bad checksum information */ @@ -2722,13 +2213,9 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), 1, -1); /* this is needed so CFE_ES_GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_SUCCESS, - "CFE_ES_TaskInit", + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == CFE_SUCCESS, "CFE_ES_TaskInit", "Checksum fail, task init result"); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum == 0xFFFF, - "CFE_ES_TaskInit", + UT_Report(__FILE__, __LINE__, CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum == 0xFFFF, "CFE_ES_TaskInit", "Checksum fail, checksum value"); /* Test successful task main process loop - Power On Reset Path */ @@ -2737,10 +2224,8 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); CFE_ES_ResetDataPtr->ResetVars.ResetType = 2; UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_SUCCESS && - CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, - "CFE_ES_TaskInit", - "Checksum success, POR Path"); + CFE_ES_TaskInit() == CFE_SUCCESS && CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, + "CFE_ES_TaskInit", "Checksum success, POR Path"); /* Test successful task main process loop - Processor Reset Path */ ES_ResetUnitTest(); @@ -2748,74 +2233,49 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); CFE_ES_ResetDataPtr->ResetVars.ResetType = 1; UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_SUCCESS && - CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, - "CFE_ES_TaskInit", - "Checksum success, PR Path"); + CFE_ES_TaskInit() == CFE_SUCCESS && CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, + "CFE_ES_TaskInit", "Checksum success, PR Path"); /* Test task main process loop with a register app failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskRegister), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_ES_ERR_APP_REGISTER, - "CFE_ES_TaskInit", + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == CFE_ES_ERR_APP_REGISTER, "CFE_ES_TaskInit", "Register application fail"); /* Test task main process loop with a with an EVS register failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == -1, - "CFE_ES_TaskInit", - "EVS register fail"); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -1, "CFE_ES_TaskInit", "EVS register fail"); /* Test task main process loop with a SB pipe create failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -2); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == -2, - "CFE_ES_TaskInit", - "SB pipe create fail"); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -2, "CFE_ES_TaskInit", "SB pipe create fail"); /* Test task main process loop with a HK packet subscribe failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -3); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == -3, - "CFE_ES_TaskInit", - "HK packet subscribe fail"); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -3, "CFE_ES_TaskInit", "HK packet subscribe fail"); /* Test task main process loop with a ground command subscribe failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -4); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == -4, - "CFE_ES_TaskInit", - "Ground command subscribe fail"); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -4, "CFE_ES_TaskInit", "Ground command subscribe fail"); /* Test task main process loop with an init event send failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -5); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == -5, - "CFE_ES_TaskInit", - "Initialization event send fail"); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -5, "CFE_ES_TaskInit", "Initialization event send fail"); /* Test task main process loop with version event send failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 2, -6); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == -6, - "CFE_ES_TaskInit", - "Version event send fail"); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -6, "CFE_ES_TaskInit", "Version event send fail"); /* Test task init with background init fail */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 1, -7); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == -7, - "CFE_ES_TaskInit", - "Background init fail"); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -7, "CFE_ES_TaskInit", "Background init fail"); /* Set the log mode to OVERWRITE; CFE_ES_TaskInit() sets SystemLogMode to * DISCARD, which can result in a log overflow depending on the value that @@ -2825,272 +2285,201 @@ void TestTask(void) /* Test a successful HK request */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_ES_SEND_HK); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree > 0, - "CFE_ES_HousekeepingCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_SEND_HK); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree > 0, "CFE_ES_HousekeepingCmd", "HK packet - get heap successful"); /* Test the HK request with a get heap failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_HeapGetInfo), 1, -1); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_ES_SEND_HK); - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree == 0, - "CFE_ES_HousekeepingCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_SEND_HK); + UT_Report(__FILE__, __LINE__, CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree == 0, "CFE_ES_HousekeepingCmd", "HK packet - get heap fail"); /* Test successful no-op command */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_ES_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_NOOP_INF_EID), - "CFE_ES_NoopCmd", - "No-op"); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_NOOP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_NOOP_INF_EID), "CFE_ES_NoopCmd", "No-op"); /* Test successful reset counters command */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RESET_INF_EID), - "CFE_ES_ResetCountersCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESET_INF_EID), "CFE_ES_ResetCountersCmd", "Reset counters"); /* Test successful cFE restart */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = 0; - CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_PROCESSOR; + CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_PROCESSOR; UT_SetDataBuffer(UT_KEY(CFE_PSP_Restart), &ResetType, sizeof(ResetType), false); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), - UT_TPID_CFE_ES_CMD_RESTART_CC); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); UT_Report(__FILE__, __LINE__, - ResetType == CFE_PSP_RST_TYPE_PROCESSOR && - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_RestartCmd", - "Restart cFE"); + ResetType == CFE_PSP_RST_TYPE_PROCESSOR && UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, + "CFE_ES_RestartCmd", "Restart cFE"); /* Test cFE restart with bad restart type */ ES_ResetUnitTest(); CmdBuf.RestartCmd.Payload.RestartType = 4524; - 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), - "CFE_ES_RestartCmd", + 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), "CFE_ES_RestartCmd", "Invalid restart type"); /* Test successful app create */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; strncpy(CmdBuf.StartAppCmd.Payload.AppEntryPoint, "entrypoint", sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); CmdBuf.StartAppCmd.Payload.AppEntryPoint[sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1] = '\0'; - memset(CmdBuf.StartAppCmd.Payload.Application, 'x', - sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); + memset(CmdBuf.StartAppCmd.Payload.Application, 'x', sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); CmdBuf.StartAppCmd.Payload.Application[sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(8192); + 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_INF_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Start application from file name"); /* 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_ERR_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Start application from file name fail"); /* Test app create with the file name too short */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "123", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "123", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; strncpy(CmdBuf.StartAppCmd.Payload.AppEntryPoint, "entrypoint", sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); CmdBuf.StartAppCmd.Payload.AppEntryPoint[sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1] = '\0'; - strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", - sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); CmdBuf.StartAppCmd.Payload.Application[sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); + 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_INVALID_FILENAME_ERR_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Invalid file name"); /* Test app create with a null application entry point */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.AppEntryPoint[0] = '\0'; - strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", - sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); + CmdBuf.StartAppCmd.Payload.AppEntryPoint[0] = '\0'; + strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); CmdBuf.StartAppCmd.Payload.Application[sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); + 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Application entry point null"); /* Test app create with a null application name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; strncpy(CmdBuf.StartAppCmd.Payload.AppEntryPoint, "entrypoint", sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); CmdBuf.StartAppCmd.Payload.AppEntryPoint[sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.Application[0] = '\0'; - CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); + CmdBuf.StartAppCmd.Payload.Application[0] = '\0'; + 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_NULL_APP_NAME_ERR_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Application name null"); /* Test app create with with an invalid exception action */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; strncpy(CmdBuf.StartAppCmd.Payload.AppEntryPoint, "entrypoint", - sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); + sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); CmdBuf.StartAppCmd.Payload.AppEntryPoint[sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1] = '\0'; - strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", - sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); CmdBuf.StartAppCmd.Payload.Application[sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); + 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_EXC_ACTION_ERR_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Invalid exception action"); /* Test app create with a default stack size */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; strncpy(CmdBuf.StartAppCmd.Payload.AppEntryPoint, "entrypoint", - sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); + sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); CmdBuf.StartAppCmd.Payload.AppEntryPoint[sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1] = '\0'; - strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", - sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); CmdBuf.StartAppCmd.Payload.Application[sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(0); + 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_INF_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Default Stack Size"); /* Test app create with a bad priority */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; strncpy(CmdBuf.StartAppCmd.Payload.AppEntryPoint, "entrypoint", - sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); + sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); CmdBuf.StartAppCmd.Payload.AppEntryPoint[sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1] = '\0'; - strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", - sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); CmdBuf.StartAppCmd.Payload.Application[sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1] = '\0'; - CmdBuf.StartAppCmd.Payload.Priority = 1000; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); + 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_PRIORITY_ERR_EID), - "CFE_ES_StartAppCmd", + 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), "CFE_ES_StartAppCmd", "Priority is too large"); /* Test successful app stop */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.StopAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.StopAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); CmdBuf.StopAppCmd.Payload.Application[sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_StopAppCmd", + 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), "CFE_ES_StopAppCmd", "Stop application initiated"); /* 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(CmdBuf.StopAppCmd), - UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_STOP_ERR1_EID), - "CFE_ES_StopAppCmd", + 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), "CFE_ES_StopAppCmd", "Stop application failed"); /* Test app stop with a bad app name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StopAppCmd.Payload.Application, "BAD_APP_NAME", - sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.StopAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); CmdBuf.StopAppCmd.Payload.Application[sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_StopAppCmd", + 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), "CFE_ES_StopAppCmd", "Stop application bad name"); /* Test successful app restart */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_RestartAppCmd", + 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), "CFE_ES_RestartAppCmd", "Restart application initiated"); /* Test app restart with failed file check */ @@ -3098,14 +2487,10 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_stat), OS_ERROR); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.RestartAppCmd.Payload.Application)); + strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_RestartAppCmd", + 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), "CFE_ES_RestartAppCmd", "Restart application failed"); /* Test app restart with a bad app name */ @@ -3114,56 +2499,40 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_RestartAppCmd", + 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), "CFE_ES_RestartAppCmd", "Restart application bad name"); /* Test failed app restart, core app */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_RestartAppCmd", + 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), "CFE_ES_RestartAppCmd", "Restart application failed"); /* Test failed app restart, not running */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.RestartAppCmd.Payload.Application)); + strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_RestartAppCmd", + 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), "CFE_ES_RestartAppCmd", "Restart application failed"); /* Test successful app reload */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.ReloadAppCmd.Payload.AppFileName, "New_Name", - sizeof(CmdBuf.ReloadAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.ReloadAppCmd.Payload.AppFileName, "New_Name", sizeof(CmdBuf.ReloadAppCmd.Payload.AppFileName) - 1); CmdBuf.ReloadAppCmd.Payload.AppFileName[sizeof(CmdBuf.ReloadAppCmd.Payload.AppFileName) - 1] = '\0'; - strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_ReloadAppCmd", + 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), "CFE_ES_ReloadAppCmd", "Reload application initiated"); /* Test app reload with missing file */ @@ -3171,17 +2540,12 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_stat), OS_ERROR); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.ReloadAppCmd.Payload.AppFileName, "New_Name", - sizeof(CmdBuf.ReloadAppCmd.Payload.AppFileName)); + strncpy(CmdBuf.ReloadAppCmd.Payload.AppFileName, "New_Name", sizeof(CmdBuf.ReloadAppCmd.Payload.AppFileName)); CmdBuf.ReloadAppCmd.Payload.AppFileName[sizeof(CmdBuf.ReloadAppCmd.Payload.AppFileName) - 1] = '\0'; - strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); + strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_ReloadAppCmd", + 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), "CFE_ES_ReloadAppCmd", "Reload application failed"); /* Test app reload with a bad app name */ @@ -3190,117 +2554,84 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_ReloadAppCmd", + 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), "CFE_ES_ReloadAppCmd", "Reload application bad name"); /* Test failed app reload, core app */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); + strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_ReloadAppCmd", + 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), "CFE_ES_ReloadAppCmd", "Reload application failed"); /* Test failed app reload, not RUNNING */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); + strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_ReloadAppCmd", + 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), "CFE_ES_ReloadAppCmd", "Reload application failed"); /* Test successful telemetry packet request for single app data */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); + strncpy(CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; - 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", + 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 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(CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", - sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); + strncpy(CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; 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), - "CFE_ES_QueryOneCmd", + 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), "CFE_ES_QueryOneCmd", "Query application - SB send message fail"); /* Test telemetry packet request for single app data with a bad app name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.QueryOneCmd.Payload.Application, "BAD_APP_NAME", - sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); + strncpy(CmdBuf.QueryOneCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; - 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), - "CFE_ES_QueryOneCmd", + 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), "CFE_ES_QueryOneCmd", "Query application - bad application name"); /* Test successful write of all app data to file */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - strncpy(CmdBuf.QueryAllCmd.Payload.FileName, "AllFilename", - sizeof(CmdBuf.QueryAllCmd.Payload.FileName) - 1); + strncpy(CmdBuf.QueryAllCmd.Payload.FileName, "AllFilename", sizeof(CmdBuf.QueryAllCmd.Payload.FileName) - 1); CmdBuf.QueryAllCmd.Payload.FileName[sizeof(CmdBuf.QueryAllCmd.Payload.FileName) - 1] = '\0'; - 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), - "CFE_ES_QueryAllCmd", + 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), "CFE_ES_QueryAllCmd", "Query all applications - success"); /* 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(CmdBuf.QueryAllCmd), - UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), - "CFE_ES_QueryAllCmd", + 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), "CFE_ES_QueryAllCmd", "Query all applications - null file name"); /* Test write of all app data to file with a write header failure */ 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(CmdBuf.QueryAllCmd), - UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_WRHDR_ERR_EID), - "CFE_ES_QueryAllCmd", + 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), "CFE_ES_QueryAllCmd", "Write application information file fail; write header"); /* Test write of all app data to file with a file write failure */ @@ -3308,11 +2639,8 @@ 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(CmdBuf.QueryAllCmd), - UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_TASKWR_ERR_EID), - "CFE_ES_QueryAllCmd", + 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), "CFE_ES_QueryAllCmd", "Write application information file fail; task write"); /* Test write of all app data to file with a file create failure */ @@ -3320,11 +2648,8 @@ 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(CmdBuf.QueryAllCmd), - UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_OSCREATE_ERR_EID), - "CFE_ES_QueryAllCmd", + 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), "CFE_ES_QueryAllCmd", "Write application information file fail; OS create"); /* Test successful write of all task data to a file */ @@ -3332,24 +2657,19 @@ void TestTask(void) 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(CmdBuf.QueryAllTasksCmd), - UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_TASKINFO_EID), - "CFE_ES_QueryAllTasksCmd", + UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_EID), "CFE_ES_QueryAllTasksCmd", "Task information file written"); /* Test write of all task data to a file with write header failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.QueryAllTasksCmd.Payload.FileName, "filename", - sizeof(CmdBuf.QueryAllTasksCmd.Payload.FileName) - 1); + strncpy(CmdBuf.QueryAllTasksCmd.Payload.FileName, "filename", sizeof(CmdBuf.QueryAllTasksCmd.Payload.FileName) - 1); CmdBuf.QueryAllTasksCmd.Payload.FileName[sizeof(CmdBuf.QueryAllTasksCmd.Payload.FileName) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); 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), - "CFE_ES_QueryAllTasksCmd", + UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WRHDR_ERR_EID), "CFE_ES_QueryAllTasksCmd", "Task information file write fail; write header"); /* Test write of all task data to a file with a task write failure */ @@ -3358,10 +2678,8 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); 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), - "CFE_ES_QueryAllTasksCmd", + UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WR_ERR_EID), "CFE_ES_QueryAllTasksCmd", "Task information file write fail; task write"); /* Test write of all task data to a file with an OS create failure */ @@ -3369,20 +2687,15 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); 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), - "CFE_ES_QueryAllTasksCmd", + UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_OSCREATE_ERR_EID), "CFE_ES_QueryAllTasksCmd", "Task information file write fail; OS create"); /* Test successful clearing of the system log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - 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", + 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", "Clear ES log data"); /* Test successful overwriting of the system log using discard mode */ @@ -3390,10 +2703,8 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; 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", + UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", "Overwrite system log received (discard mode)"); /* Test overwriting the system log using an invalid mode */ @@ -3401,35 +2712,26 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.OverwriteSysLogCmd.Payload.Mode = 255; 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", + UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERR_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", "Overwrite system log using invalid mode"); /* Test successful writing of the system log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.WriteSysLogCmd.Payload.FileName, "filename", - sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName) - 1); + strncpy(CmdBuf.WriteSysLogCmd.Payload.FileName, "filename", sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName) - 1); CmdBuf.WriteSysLogCmd.Payload.FileName[sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName) - 1] = '\0'; - CFE_ES_TaskData.HkPacket.Payload.SysLogEntries = 123; - 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_TaskData.HkPacket.Payload.SysLogEntries = 123; + 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", "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(CmdBuf.WriteSysLogCmd), - UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_SYSLOG2_EID), - "CFE_ES_WriteSysLogCmd", + 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", "Write system log; null file name"); /* Test writing the system log with an OS create failure */ @@ -3437,113 +2739,82 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); 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_ERR_EID), - "CFE_ES_WriteSysLogCmd", + 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", "Write system log; OS create"); /* Test writing the system log with an OS write failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); - CFE_ES_ResetDataPtr->SystemLogWriteIdx = snprintf(CFE_ES_ResetDataPtr->SystemLog, - sizeof(CFE_ES_ResetDataPtr->SystemLog), - "0000-000-00:00:00.00000 Test Message\n"); - CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; + CFE_ES_ResetDataPtr->SystemLogWriteIdx = + snprintf(CFE_ES_ResetDataPtr->SystemLog, sizeof(CFE_ES_ResetDataPtr->SystemLog), + "0000-000-00:00:00.00000 Test Message\n"); + CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; 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_FILEWRITE_ERR_EID), - "CFE_ES_WriteSysLogCmd", + 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", "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(CmdBuf.WriteSysLogCmd), - UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "CFE_ES_WriteSysLogCmd", + 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", "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(CmdBuf.ClearERLogCmd), - UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_ERLOG1_INF_EID), - "CFE_ES_ClearERLogCmd", - "Clear E&R log"); + 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), "CFE_ES_ClearERLogCmd", "Clear E&R log"); /* Test successful writing of the E&R log */ /* In the current implementation, it does not directly write the file, * 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) - 1); + strncpy(CmdBuf.WriteERLogCmd.Payload.FileName, "filename", sizeof(CmdBuf.WriteERLogCmd.Payload.FileName) - 1); CmdBuf.WriteERLogCmd.Payload.FileName[sizeof(CmdBuf.WriteERLogCmd.Payload.FileName) - 1] = '\0'; UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), - UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_FS_BackgroundFileDumpRequest)) == 1, - "CFE_ES_WriteERLogCmd", - "Write E&R log command; pending"); - UT_Report(__FILE__, __LINE__, - !UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), - "CFE_ES_WriteERLogCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_FS_BackgroundFileDumpRequest)) == 1, + "CFE_ES_WriteERLogCmd", "Write E&R log command; pending"); + UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), "CFE_ES_WriteERLogCmd", "Write E&R log command; no events"); /* Failure from CFE_FS_BackgroundFileDumpRequest() should send the pending error event ID */ UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_BackgroundFileDumpRequest), 1, CFE_STATUS_REQUEST_ALREADY_PENDING); - 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), - "CFE_ES_WriteERLogCmd", + 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), "CFE_ES_WriteERLogCmd", "Write E&R log command; already pending event (from FS)"); /* Same event but pending locally */ UT_ClearEventHistory(); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); - 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), - "CFE_ES_WriteERLogCmd", + 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), "CFE_ES_WriteERLogCmd", "Write E&R log command; already pending event (local)"); /* Test scan for exceptions in the PSP, should invoke a Processor Reset */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_RunExceptionScan", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", "Scan for exceptions; processor restart"); ES_ResetUnitTest(); - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = 0; + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = 0; CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount = 1; UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); /* first time should do a processor restart (limit reached) */ - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_RunExceptionScan", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", "Scan for exceptions; processor restart"); /* next time should do a poweron restart (limit reached) */ CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, - "CFE_ES_RunExceptionScan", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, "CFE_ES_RunExceptionScan", "Scan for exceptions; poweron restart"); /* nominal for app restart - associate exception with a task ID */ @@ -3553,18 +2824,14 @@ void TestTask(void) UT_ContextTask = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDataBuffer(UT_KEY(CFE_PSP_Exception_GetSummary), &UT_ContextTask, sizeof(UT_ContextTask), false); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; + UtAppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; CFE_ES_RunExceptionScan(0, NULL); /* should have changed AppControlRequest from RUN to SYS_RESTART, * and the call to CFE_PSP_Restart should NOT increment */ - UT_Report(__FILE__, __LINE__, - UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_SYS_RESTART, - "CFE_ES_RunExceptionScan", - "Scan for exceptions; app restart request pending"); + UT_Report(__FILE__, __LINE__, UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_SYS_RESTART, + "CFE_ES_RunExceptionScan", "Scan for exceptions; app restart request pending"); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 0, - "CFE_ES_RunExceptionScan", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 0, "CFE_ES_RunExceptionScan", "Scan for exceptions; no psp restart"); /* repeat, but for a CORE app, which cannot be restarted */ @@ -3574,40 +2841,30 @@ void TestTask(void) UT_ContextTask = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDataBuffer(UT_KEY(CFE_PSP_Exception_GetSummary), &UT_ContextTask, sizeof(UT_ContextTask), false); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; + UtAppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_RunExceptionScan", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", "Scan for exceptions; core app, psp restart"); /* check failure of getting summary data */ UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetSummary), CFE_PSP_NO_EXCEPTION_DATA); CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, - "CFE_ES_RunExceptionScan", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, "CFE_ES_RunExceptionScan", "Scan for exceptions; fail to get context"); /* Test clearing the log with a bad size in the verify command * length call */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_ClearERLogCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ClearERLogCmd", "Packet length error"); /* 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(CmdBuf.ResetPRCountCmd), - UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_RESET_PR_COUNT_EID), - "CFE_ES_ResetPRCountCmd", + 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), "CFE_ES_ResetPRCountCmd", "Set processor reset count to zero"); /* Test setting the maximum processor reset count */ @@ -3615,37 +2872,27 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.SetMaxPRCountCmd.Payload.MaxPRCount = 3; 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), - "CFE_ES_SetMaxPRCountCmd", + UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SET_MAX_PR_COUNT_EID), "CFE_ES_SetMaxPRCountCmd", "Set maximum processor reset count"); /* Test failed deletion of specified CDS */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, &UtCDSRegRecPtr); - UtCDSRegRecPtr->BlockOffset = 0xFFFFFFFF; /* Fails validation in PutBuf */ + UtCDSRegRecPtr->BlockOffset = 0xFFFFFFFF; /* Fails validation in PutBuf */ memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.DeleteCDSCmd.Payload.CdsName, - "CFE_ES.CDS_NAME", - sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName) - 1); + strncpy(CmdBuf.DeleteCDSCmd.Payload.CdsName, "CFE_ES.CDS_NAME", sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName) - 1); CmdBuf.DeleteCDSCmd.Payload.CdsName[sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName) - 1] = '\0'; - 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), - "CFE_ES_DeleteCDSCmd", + 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), "CFE_ES_DeleteCDSCmd", "Delete from CDS; error"); /* Test failed deletion of specified critical table CDS */ /* 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(CmdBuf.DeleteCDSCmd), - UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_CDS_DELETE_TBL_ERR_EID), - "CFE_ES_DeleteCDSCmd", + 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), "CFE_ES_DeleteCDSCmd", "Delete from CDS; wrong type"); /* Test successful deletion of a specified CDS */ @@ -3654,22 +2901,16 @@ 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(CmdBuf.DeleteCDSCmd), - UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_CDS_DELETED_INFO_EID), - "CFE_ES_DeleteCDSCmd", + 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), "CFE_ES_DeleteCDSCmd", "Delete from CDS; success"); /* Test deletion of a specified CDS with the owning app being active */ 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(CmdBuf.DeleteCDSCmd), - UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_CDS_OWNER_ACTIVE_EID), - "CFE_ES_DeleteCDSCmd", + 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), "CFE_ES_DeleteCDSCmd", "Delete from CDS; owner active"); /* Test deletion of a specified CDS with the name not found */ @@ -3677,21 +2918,16 @@ 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(CmdBuf.DeleteCDSCmd), - UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_CDS_NAME_ERR_EID), - "CFE_ES_DeleteCDSCmd", + 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), "CFE_ES_DeleteCDSCmd", "Delete from CDS; not found"); /* 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(CmdBuf.DumpCDSRegistryCmd), - UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), - "CFE_ES_DumpCDSRegistryCmd", + UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), "CFE_ES_DumpCDSRegistryCmd", "Dump CDS; success (default dump file)"); /* Test dumping of the CDS to a file with a bad FS write header */ @@ -3699,10 +2935,8 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); 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), - "CFE_ES_DumpCDSRegistryCmd", + UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_WRITE_CFE_HDR_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", "Dump CDS; write header"); /* Test dumping of the CDS to a file with an OS create failure */ @@ -3710,10 +2944,8 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); 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), - "CFE_ES_DumpCDSRegistryCmd", + UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CREATING_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", "Dump CDS; OS create"); /* Test dumping of the CDS to a file with an OS write failure */ @@ -3722,20 +2954,16 @@ void TestTask(void) 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(CmdBuf.DumpCDSRegistryCmd), - UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_CDS_DUMP_ERR_EID), - "CFE_ES_DumpCDSRegistryCmd", + UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", "Dump CDS; OS write"); /* Test telemetry pool statistics retrieval with an invalid handle */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); 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), - "CFE_ES_SendMemPoolStatsCmd", + UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_INVALID_POOL_HANDLE_ERR_EID), "CFE_ES_SendMemPoolStatsCmd", "Telemetry pool; bad handle"); /* Test successful telemetry pool statistics retrieval */ @@ -3743,68 +2971,47 @@ void TestTask(void) ES_UT_SetupMemPoolId(&UtPoolRecPtr); 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), - "CFE_ES_SendMemPoolStatsCmd", + UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TLM_POOL_STATS_INFO_EID), "CFE_ES_SendMemPoolStatsCmd", "Telemetry pool; success"); /* Test the command pipe message process with an invalid command */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_ES_CMD_INVALID_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_CC1_ERR_EID), - "CFE_ES_TaskPipe", - "Invalid ground command"); + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_INVALID_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CC1_ERR_EID), "CFE_ES_TaskPipe", "Invalid ground command"); /* Test sending a no-op command with an invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_NoopCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_NOOP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_NoopCmd", "No-op; invalid command length"); /* Test sending a reset counters command with an invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_ResetCountersCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ResetCountersCmd", "Reset counters; invalid command length"); /* Test sending a cFE restart command with an invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_RestartCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_RestartCmd", "Restart cFE; invalid command length"); /* Test cFE restart with a power on reset */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_POWERON; - 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), - "CFE_ES_RestartCmd", + 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), "CFE_ES_RestartCmd", "Power on reset restart type"); /* Test sending a start application command with an invalid command * length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_StartAppCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_START_APP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_StartAppCmd", "Start application command; invalid command length"); /* Test start application command with a processor restart on application @@ -3812,100 +3019,74 @@ void TestTask(void) */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", - sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.AppFileName, "filename", sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1); CmdBuf.StartAppCmd.Payload.AppFileName[sizeof(CmdBuf.StartAppCmd.Payload.AppFileName) - 1] = '\0'; strncpy(CmdBuf.StartAppCmd.Payload.AppEntryPoint, "entrypoint", sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1); CmdBuf.StartAppCmd.Payload.AppEntryPoint[sizeof(CmdBuf.StartAppCmd.Payload.AppEntryPoint) - 1] = '\0'; - strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", - sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); + strncpy(CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1); CmdBuf.StartAppCmd.Payload.Application[sizeof(CmdBuf.StartAppCmd.Payload.Application) - 1] = '\0'; 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(CmdBuf.StartAppCmd), - UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_START_INF_EID), - "CFE_ES_StartAppCmd", + 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(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), "CFE_ES_StartAppCmd", "Processor restart on application exception"); /* Test sending a stop application command with an invalid command * length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_StopAppCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_STOP_APP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_StopAppCmd", "Stop application command; invalid command length"); /* Test sending a restart application command with an invalid command * length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_RestartAppCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_APP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_RestartAppCmd", "Restart application command; invalid command length"); /* Test sending a reload application command with an invalid command * length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_ReloadAppCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ReloadAppCmd", "Reload application command; invalid command length"); /* Test sending a write request for a single application with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_QueryOneAppCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryOneAppCmd", "Query one application command; invalid command length"); /* Test sending a write request for all applications with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_QueryAllAppCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryAllAppCmd", "Query all applications command; invalid command length"); /* Test write of all app data to file with a file open failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - 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), - "CFE_ES_QueryAllCmd", + 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), "CFE_ES_QueryAllCmd", "Write application information file fail; file open"); /* Test sending a write request for all tasks with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_QueryAllAppCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryAllAppCmd", "Query all tasks command; invalid command length"); /* Test write of all task data to file with a file open failure */ @@ -3913,43 +3094,32 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); 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), - "CFE_ES_QueryAllCmd", + UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_EID), "CFE_ES_QueryAllCmd", "Write task information file fail; file open"); /* Test sending a request to clear the system log with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_ClearSysLogCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ClearSysLogCmd", "Clear system log command; invalid command length"); /* Test sending a request to overwrite the system log with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_OverwriteSysLogCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_OverwriteSysLogCmd", "Overwrite system log command; invalid command length"); /* Test sending a request to write the system log with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_WriteSysLogCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_WriteSysLogCmd", "Write system log command; invalid command length"); /* Test successful overwriting of the system log using overwrite mode */ @@ -3957,66 +3127,49 @@ void TestTask(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; 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", + UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", "Overwrite system log received (overwrite mode)"); /* Test sending a request to write the error log with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_WriteErrlogCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_WriteErrlogCmd", "Write error log command; invalid command length"); /* Test sending a request to reset the processor reset count with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_ResetPRCountCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ResetPRCountCmd", "Reset processor reset count command; invalid command length"); /* Test sending a request to set the maximum processor reset count with * an invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_SetMaxPRCountCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_SetMaxPRCountCmd", "Set maximum processor reset count command; invalid " - "command length"); + "command length"); /* Test sending a request to delete the CDS with an invalid command * length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_DeleteCDSCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_DeleteCDSCmd", "Delete CDS command; invalid command length"); /* Test sending a telemetry pool statistics retrieval command with an * invalid command length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), - "CFE_ES_DeleteCDSCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_DeleteCDSCmd", "Telemetry pool command; invalid command length"); /* Test successful dump of CDS to file using a specified dump file name */ @@ -4028,10 +3181,8 @@ void TestTask(void) sizeof(CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename) - 1); CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename[sizeof(CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename) - 1] = '\0'; 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), - "CFE_ES_DumpCDSRegistryCmd", + UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), "CFE_ES_DumpCDSRegistryCmd", "Dump CDS; success (dump file specified)"); } /* end TestTask */ @@ -4053,9 +3204,7 @@ void TestPerf(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); Perf->MetaData.State = CFE_ES_PERF_MAX_STATES; CFE_ES_SetupPerfVariables(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_SetupPerfVariables", + UT_Report(__FILE__, __LINE__, Perf->MetaData.State == CFE_ES_PERF_IDLE, "CFE_ES_SetupPerfVariables", "Idle data collection"); /* Test successful performance data collection start in START @@ -4064,11 +3213,8 @@ void TestPerf(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), - "CFE_ES_StartPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", "Collect performance data; mode START"); /* Test successful performance data collection start in CENTER @@ -4077,11 +3223,8 @@ void TestPerf(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_CENTER; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), - "CFE_ES_StartPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", "Collect performance data; mode CENTER"); /* Test successful performance data collection start in END @@ -4090,11 +3233,8 @@ void TestPerf(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_END; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), - "CFE_ES_StartPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", "Collect performance data; mode END"); /* Test performance data collection start with an invalid trigger mode @@ -4103,11 +3243,8 @@ void TestPerf(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = (CFE_ES_PERF_TRIGGER_END + 1); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), - "CFE_ES_StartPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), "CFE_ES_StartPerfDataCmd", "Trigger mode out of range (high)"); /* Test performance data collection start with an invalid trigger mode @@ -4116,53 +3253,38 @@ void TestPerf(void) ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = 0xffffffff; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), - "CFE_ES_StartPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), "CFE_ES_StartPerfDataCmd", "Trigger mode out of range (low)"); /* Test performance data collection start with a file write in progress */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); /* clearing the BackgroundPerfDumpState will fully reset to initial state */ - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; - CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_ERR_EID), - "CFE_ES_StartPerfDataCmd", + CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_ERR_EID), "CFE_ES_StartPerfDataCmd", "Cannot collect performance data; write in progress"); /* Test performance data collection by sending another valid * start command */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), - "CFE_ES_StartPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", "Start collecting performance data"); /* Test successful performance data collection stop */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), - UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), - "CFE_ES_StopPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", "Stop collecting performance data"); /* Test successful performance data collection stop with a non-default @@ -4170,51 +3292,37 @@ void TestPerf(void) ES_ResetUnitTest(); /* clearing the BackgroundPerfDumpState will fully reset to initial state */ - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); - strncpy(CmdBuf.PerfStopCmd.Payload.DataFileName, "filename", - sizeof(CmdBuf.PerfStopCmd.Payload.DataFileName) - 1); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + strncpy(CmdBuf.PerfStopCmd.Payload.DataFileName, "filename", sizeof(CmdBuf.PerfStopCmd.Payload.DataFileName) - 1); CmdBuf.PerfStopCmd.Payload.DataFileName[sizeof(CmdBuf.PerfStopCmd.Payload.DataFileName) - 1] = '\0'; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), - UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), - "CFE_ES_StopPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", "Stop collecting performance data (non-default file name)"); /* Test performance data collection stop with a file write in progress */ ES_ResetUnitTest(); CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), - UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_ERR2_EID), - "CFE_ES_StopPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_ERR2_EID), "CFE_ES_StopPerfDataCmd", "Stop performance data command ignored"); /* Test performance filter mask command with out of range filter mask value */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = - CFE_ES_PERF_32BIT_WORDS_IN_MASK; + CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK; 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), - "CFE_ES_SetPerfFilterMaskCmd", + UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKERR_EID), "CFE_ES_SetPerfFilterMaskCmd", "Performance filter mask command error; index out of range"); /* Test successful performance filter mask command */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = - CFE_ES_PERF_32BIT_WORDS_IN_MASK / 2; + CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK / 2; 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), - "CFE_ES_SetPerfFilterMaskCmd", + UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), "CFE_ES_SetPerfFilterMaskCmd", "Set performance filter mask command received"); /* Test successful performance filter mask command with minimum filter @@ -4223,10 +3331,8 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = 0; 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), - "CFE_ES_SetPerfTriggerMaskCmd", + UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", "Set performance trigger mask command received; minimum index"); /* Test successful performance filter mask command with maximum filter @@ -4234,13 +3340,10 @@ void TestPerf(void) */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = - CFE_ES_PERF_32BIT_WORDS_IN_MASK - 1; + CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK - 1; 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), - "CFE_ES_SetPerfTriggerMaskCmd", + UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", "Set performance trigger mask command received; maximum index"); /* Test successful performance filter mask command with a greater than the @@ -4248,25 +3351,20 @@ void TestPerf(void) */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = - CFE_ES_PERF_32BIT_WORDS_IN_MASK + 1; + CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK + 1; 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), - "CFE_ES_SetPerfTriggerMaskCmd", + UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKERR_EID), "CFE_ES_SetPerfTriggerMaskCmd", "Performance trigger mask command error; index out of range"); /* Test successful addition of a new entry to the performance log */ ES_ResetUnitTest(); - Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; - Perf->MetaData.TriggerCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE +1; + Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; + Perf->MetaData.TriggerCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; Perf->MetaData.InvalidMarkerReported = false; - Perf->MetaData.DataEnd = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE +1 ; + Perf->MetaData.DataEnd = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.InvalidMarkerReported == true, - "CFE_ES_PerfLogAdd", + UT_Report(__FILE__, __LINE__, Perf->MetaData.InvalidMarkerReported == true, "CFE_ES_PerfLogAdd", "Invalid performance marker"); /* Test addition of a new entry to the performance log with START @@ -4274,105 +3372,87 @@ void TestPerf(void) */ ES_ResetUnitTest(); Perf->MetaData.InvalidMarkerReported = true; - Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; - Perf->MetaData.DataCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; - Perf->MetaData.TriggerMask[0] = 0xFFFF; + Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; + Perf->MetaData.DataCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; + Perf->MetaData.TriggerMask[0] = 0xFFFF; CFE_ES_PerfLogAdd(1, 0); UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_START && - Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", - "Triggered; START"); + Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_START && Perf->MetaData.State == CFE_ES_PERF_IDLE, + "CFE_ES_PerfLogAdd", "Triggered; START"); /* Test addition of a new entry to the performance log with CENTER * trigger mode */ ES_ResetUnitTest(); - Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; - Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; - Perf->MetaData.TriggerCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE / 2 + 1 ; + Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; + Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; + Perf->MetaData.TriggerCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE / 2 + 1; CFE_ES_PerfLogAdd(1, 0); UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_CENTER && - Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", - "Triggered; CENTER"); + Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_CENTER && Perf->MetaData.State == CFE_ES_PERF_IDLE, + "CFE_ES_PerfLogAdd", "Triggered; CENTER"); /* Test addition of a new entry to the performance log with END * trigger mode */ ES_ResetUnitTest(); Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; - Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_END; + Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_END; CFE_ES_PerfLogAdd(1, 0); UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_END && - Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", - "Triggered; END"); + Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_END && Perf->MetaData.State == CFE_ES_PERF_IDLE, + "CFE_ES_PerfLogAdd", "Triggered; END"); /* Test addition of a new entry to the performance log with an invalid * marker after an invalid marker has already been reported */ ES_ResetUnitTest(); - Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; + Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.InvalidMarkerReported = 2; CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS + 1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.InvalidMarkerReported == 2, - "CFE_ES_PerfLogAdd", + UT_Report(__FILE__, __LINE__, Perf->MetaData.InvalidMarkerReported == 2, "CFE_ES_PerfLogAdd", "Invalid marker after previous invalid marker"); /* Test addition of a new entry to the performance log with a marker that * is not in the filter mask */ ES_ResetUnitTest(); - Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; + Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.FilterMask[0] = 0x0; - Perf->MetaData.DataEnd = 0; + Perf->MetaData.DataEnd = 0; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.DataEnd == 0, - "CFE_ES_PerfLogAdd", - "Marker not in filter mask"); + UT_Report(__FILE__, __LINE__, Perf->MetaData.DataEnd == 0, "CFE_ES_PerfLogAdd", "Marker not in filter mask"); /* Test addition of a new entry to the performance log with the data count * below the maximum allowed */ ES_ResetUnitTest(); - Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; - Perf->MetaData.DataCount = 0; + Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; + Perf->MetaData.DataCount = 0; Perf->MetaData.FilterMask[0] = 0xffff; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.DataCount == 1, - "CFE_ES_PerfLogAdd", - "Data count below maximum"); + UT_Report(__FILE__, __LINE__, Perf->MetaData.DataCount == 1, "CFE_ES_PerfLogAdd", "Data count below maximum"); /* Test addition of a new entry to the performance log with a marker that * is not in the trigger mask */ ES_ResetUnitTest(); - Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; + Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; Perf->MetaData.TriggerMask[0] = 0x0; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.State != CFE_ES_PERF_TRIGGERED, - "CFE_ES_PerfLogAdd", + UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_TRIGGERED, "CFE_ES_PerfLogAdd", "Marker not in trigger mask"); /* Test addition of a new entry to the performance log with a start * trigger mode and the trigger count is less the buffer size */ ES_ResetUnitTest(); - Perf->MetaData.TriggerCount = 0; - Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; - Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; + Perf->MetaData.TriggerCount = 0; + Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; + Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; Perf->MetaData.TriggerMask[0] = 0xffff; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.TriggerCount == 1, - "CFE_ES_PerfLogAdd", + UT_Report(__FILE__, __LINE__, Perf->MetaData.TriggerCount == 1, "CFE_ES_PerfLogAdd", "Start trigger mode; trigger count less than the buffer size"); /* Test addition of a new entry to the performance log with a center @@ -4380,149 +3460,130 @@ void TestPerf(void) */ ES_ResetUnitTest(); Perf->MetaData.TriggerCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE / 2 - 2; - Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; - Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; + Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; + Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.State != CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", + UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_IDLE, "CFE_ES_PerfLogAdd", "Center trigger mode; trigger count less than half the " - "buffer size"); + "buffer size"); /* Test addition of a new entry to the performance log with an invalid * trigger mode */ ES_ResetUnitTest(); Perf->MetaData.TriggerCount = 0; - Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; - Perf->MetaData.Mode = -1; + Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; + Perf->MetaData.Mode = -1; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.State != CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", + UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_IDLE, "CFE_ES_PerfLogAdd", "Invalid trigger mode"); /* Test performance data collection start with an invalid message length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - !UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), - "CFE_ES_StartPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", "Invalid message length"); /* Test performance data collection stop with an invalid message length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, - !UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), - "CFE_ES_StopPerfDataCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); + UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", "Invalid message length"); /* Test performance data filer mask with an invalid message length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); - UT_Report(__FILE__, __LINE__, - !UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), - "CFE_ES_SetPerfFilterMaskCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); + UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), "CFE_ES_SetPerfFilterMaskCmd", "Invalid message length"); /* Test performance data trigger mask with an invalid message length */ ES_ResetUnitTest(); - UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, - UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, - !UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), - "CFE_ES_SetPerfTriggerMaskCmd", + UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); + UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", "Invalid message length"); /* Test perf log dump state machine */ /* Nominal call 1 - should go through up to the DELAY state */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); CFE_ES_TaskData.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_DELAY, - "CFE_ES_RunPerfLogDump - CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == DELAY (%d)", - (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); + "CFE_ES_RunPerfLogDump - CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == DELAY (%d)", + (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); UtAssert_True(UT_GetStubCount(UT_KEY(OS_OpenCreate)) == 1, "CFE_ES_RunPerfLogDump - OS_OpenCreate() called"); /* Nominal call 2 - should go through up to the remainder of states, back to IDLE */ CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", - (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); + "CFE_ES_RunPerfLogDump - CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", + (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); UtAssert_True(UT_GetStubCount(UT_KEY(OS_close)) == 1, "CFE_ES_RunPerfLogDump - OS_close() called"); /* Test a failure to open the output file */ /* This should go immediately back to idle, and generate CFE_ES_PERF_LOG_ERR_EID */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); CFE_ES_TaskData.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), -10); CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - OS create fail, CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", - (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); + "CFE_ES_RunPerfLogDump - OS create fail, CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) " + "== IDLE (%d)", + (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); UtAssert_True(UT_EventIsInHistory(CFE_ES_PERF_LOG_ERR_EID), - "CFE_ES_RunPerfLogDump - OS create fail, generated CFE_ES_PERF_LOG_ERR_EID"); + "CFE_ES_RunPerfLogDump - OS create fail, generated CFE_ES_PERF_LOG_ERR_EID"); /* Test a failure to write to the output file */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); UT_SetDefaultReturnValue(UT_KEY(OS_write), -10); CFE_ES_TaskData.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_DELAY, - "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == DELAY (%d)", - (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); + "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == " + "DELAY (%d)", + (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); /* This will trigger the OS_write() failure, which should go through up to the remainder of states, back to IDLE */ CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", - (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); + UtAssert_True( + CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, + "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", + (int)CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "CFE_ES_RunPerfLogDump - OS_write fail, generated CFE_ES_FILEWRITE_ERR_EID"); - + "CFE_ES_RunPerfLogDump - OS_write fail, generated CFE_ES_FILEWRITE_ERR_EID"); /* Test the ability of the file writer to handle the "wrap around" from the end of * the perflog buffer back to the beginning. Just need to set up the metadata * so that the writing position is toward the end of the buffer. */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); OS_OpenCreate(&CFE_ES_TaskData.BackgroundPerfDumpState.FileDesc, "UT", 0, OS_WRITE_ONLY); CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES; CFE_ES_TaskData.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES; - CFE_ES_TaskData.BackgroundPerfDumpState.DataPos = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE - 2; + CFE_ES_TaskData.BackgroundPerfDumpState.DataPos = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE - 2; CFE_ES_TaskData.BackgroundPerfDumpState.StateCounter = 4; CFE_ES_RunPerfLogDump(1000, &CFE_ES_TaskData.BackgroundPerfDumpState); /* check that the wraparound occurred */ UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.DataPos == 2, - "CFE_ES_RunPerfLogDump - wraparound, DataPos (%u) == 2", - (unsigned int)CFE_ES_TaskData.BackgroundPerfDumpState.DataPos); + "CFE_ES_RunPerfLogDump - wraparound, DataPos (%u) == 2", + (unsigned int)CFE_ES_TaskData.BackgroundPerfDumpState.DataPos); /* should have written 4 entries to the log */ UtAssert_True(CFE_ES_TaskData.BackgroundPerfDumpState.FileSize == sizeof(CFE_ES_PerfDataEntry_t) * 4, - "CFE_ES_RunPerfLogDump - wraparound, FileSize (%u) == sizeof(CFE_ES_PerfDataEntry_t) * 4", - (unsigned int)CFE_ES_TaskData.BackgroundPerfDumpState.FileSize); + "CFE_ES_RunPerfLogDump - wraparound, FileSize (%u) == sizeof(CFE_ES_PerfDataEntry_t) * 4", + (unsigned int)CFE_ES_TaskData.BackgroundPerfDumpState.FileSize); /* Confirm that the "CFE_ES_GetPerfLogDumpRemaining" function works. * This requires that the state is not idle, in order to get nonzero results. */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); OS_OpenCreate(&CFE_ES_TaskData.BackgroundPerfDumpState.FileDesc, "UT", 0, OS_WRITE_ONLY); CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_WRITE_PERF_METADATA; CFE_ES_TaskData.BackgroundPerfDumpState.StateCounter = 10; - Perf->MetaData.DataCount = 100; + Perf->MetaData.DataCount = 100; /* in states other than WRITE_PERF_ENTRIES, it should report the full size of the log */ UtAssert_True(CFE_ES_GetPerfLogDumpRemaining() == 100, " CFE_ES_GetPerfLogDumpRemaining - Setup Phase"); /* in WRITE_PERF_ENTRIES, it should report the StateCounter */ @@ -4532,47 +3593,41 @@ void TestPerf(void) void TestAPI(void) { - osal_id_t TestObjId; - char AppName[OS_MAX_API_NAME + 12]; - uint32 StackBuf[8]; - int32 Return; - uint8 Data[12]; - uint32 ResetType; - uint32 *ResetTypePtr; - CFE_ES_AppId_t AppId; - CFE_ES_TaskId_t TaskId; - uint32 RunStatus; - CFE_ES_TaskInfo_t TaskInfo; - CFE_ES_AppInfo_t AppInfo; - CFE_ES_AppRecord_t *UtAppRecPtr; + osal_id_t TestObjId; + char AppName[OS_MAX_API_NAME + 12]; + uint32 StackBuf[8]; + int32 Return; + uint8 Data[12]; + uint32 ResetType; + uint32 * ResetTypePtr; + CFE_ES_AppId_t AppId; + CFE_ES_TaskId_t TaskId; + uint32 RunStatus; + CFE_ES_TaskInfo_t TaskInfo; + CFE_ES_AppInfo_t AppInfo; + CFE_ES_AppRecord_t * UtAppRecPtr; CFE_ES_TaskRecord_t *UtTaskRecPtr; UtPrintf("Begin Test API"); /* Test resetting the cFE with a processor reset */ ES_ResetUnitTest(); - ResetType = CFE_PSP_RST_TYPE_PROCESSOR; - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = - CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount - 1; + ResetType = CFE_PSP_RST_TYPE_PROCESSOR; + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount - 1; CFE_ES_ResetCFE(ResetType); - CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = - CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount; + CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount = CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount; UT_Report(__FILE__, __LINE__, CFE_ES_ResetCFE(ResetType) == CFE_ES_NOT_IMPLEMENTED && UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]) && UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_COMMANDED]), - "CFE_ES_ResetCFE", - "Processor reset"); + "CFE_ES_ResetCFE", "Processor reset"); /* Test getting the reset type using a valid pointer and a null pointer */ ES_ResetUnitTest(); - Return = CFE_ES_GetResetType(&ResetType); + Return = CFE_ES_GetResetType(&ResetType); ResetTypePtr = NULL; CFE_ES_GetResetType(ResetTypePtr); - UT_Report(__FILE__, __LINE__, - Return == CFE_PSP_RST_TYPE_PROCESSOR && - ResetTypePtr == NULL, - "CFE_ES_GetResetType", + UT_Report(__FILE__, __LINE__, Return == CFE_PSP_RST_TYPE_PROCESSOR && ResetTypePtr == NULL, "CFE_ES_GetResetType", "Get reset type successful"); /* Test resetting the cFE with a power on reset */ @@ -4580,51 +3635,41 @@ void TestAPI(void) ResetType = CFE_PSP_RST_TYPE_POWERON; UT_Report(__FILE__, __LINE__, CFE_ES_ResetCFE(ResetType) == CFE_ES_NOT_IMPLEMENTED && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_COMMANDED]), - "CFE_ES_ResetCFE", - "Power on reset"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_COMMANDED]), + "CFE_ES_ResetCFE", "Power on reset"); /* Test resetting the cFE with an invalid argument */ ES_ResetUnitTest(); ResetType = CFE_PSP_RST_TYPE_POWERON + 3; - UT_Report(__FILE__, __LINE__, - CFE_ES_ResetCFE(ResetType) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_ResetCFE", + UT_Report(__FILE__, __LINE__, CFE_ES_ResetCFE(ResetType) == CFE_ES_BAD_ARGUMENT, "CFE_ES_ResetCFE", "Bad reset type"); /* Test restarting an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); - AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(CFE_PLATFORM_ES_MAX_APPLICATIONS-1)); /* Should be within range, but not used */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RestartApp", + AppId = CFE_ES_APPID_C( + ES_UT_MakeAppIdForIndex(CFE_PLATFORM_ES_MAX_APPLICATIONS - 1)); /* Should be within range, but not used */ + UT_Report(__FILE__, __LINE__, CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_RestartApp", "Bad application ID"); /* Test restarting an app with an ID out of range (high) */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, - CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RestartApp", + UT_Report(__FILE__, __LINE__, CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_RestartApp", "Application ID too large"); /* Test reloading an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_ReloadApp(AppId, "filename") == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_ReloadApp", - "Bad application ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_ReloadApp(AppId, "filename") == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_ReloadApp", "Bad application ID"); /* Test deleting an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_DeleteApp", + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_DeleteApp", "Bad application ID"); /* Test exiting an app with an init error */ @@ -4633,17 +3678,14 @@ void TestAPI(void) CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_INIT]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]), - "CFE_ES_ExitApp", - "Application initialization error"); + UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]), + "CFE_ES_ExitApp", "Application initialization error"); /* Test exiting an app with a runtime error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_RUNTIME]), - "CFE_ES_ExitApp", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_RUNTIME]), "CFE_ES_ExitApp", "Application runtime error"); /* Test exiting an app with an exit error */ @@ -4654,14 +3696,11 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, "UT", &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_ExitApp(1000); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_EXIT]), - "CFE_ES_ExitApp", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_EXIT]), "CFE_ES_ExitApp", "Application exit error"); UtAssert_True(UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_ERROR, - "CFE_ES_ExitApp - AppControlRequest (%u) == CFE_ES_RunStatus_APP_ERROR (%u)", - (unsigned int)UtAppRecPtr->ControlReq.AppControlRequest, - (unsigned int)CFE_ES_RunStatus_APP_ERROR); + "CFE_ES_ExitApp - AppControlRequest (%u) == CFE_ES_RunStatus_APP_ERROR (%u)", + (unsigned int)UtAppRecPtr->ControlReq.AppControlRequest, (unsigned int)CFE_ES_RunStatus_APP_ERROR); #if 0 /* Can't cover this path since it contains a while(1) (i.e., @@ -4679,153 +3718,106 @@ void TestAPI(void) /* Test successful run loop app run request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - RunStatus = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == true, - "CFE_ES_RunLoop", - "Request to run application"); + RunStatus = CFE_ES_RunStatus_APP_RUN; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; + UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == true, "CFE_ES_RunLoop", "Request to run application"); /* Test successful run loop app stop request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - RunStatus = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == false, - "CFE_ES_RunLoop", + RunStatus = CFE_ES_RunStatus_APP_RUN; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; + UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Request to stop running application"); /* Test successful run loop app exit request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - RunStatus = CFE_ES_RunStatus_APP_EXIT; - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == false, - "CFE_ES_RunLoop", - "Request to exit application"); + RunStatus = CFE_ES_RunStatus_APP_EXIT; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; + UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Request to exit application"); /* Test run loop with bad app ID */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); - RunStatus = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_RUN; + RunStatus = CFE_ES_RunStatus_APP_RUN; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_TaskRecordSetFree(UtTaskRecPtr); /* make it so task ID is bad */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == false, - "CFE_ES_RunLoop", - "Bad internal application ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Bad internal application ID"); /* Test run loop with an invalid run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - RunStatus = 1000; - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == false, - "CFE_ES_RunLoop", - "Invalid run status"); + RunStatus = 1000; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; + UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Invalid run status"); /* Test run loop with a NULL run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(NULL), - "CFE_ES_RunLoop", - "Nominal, NULL output pointer"); + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; + UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(NULL), "CFE_ES_RunLoop", "Nominal, NULL output pointer"); /* Test run loop with startup sync code */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_LATE_INIT, NULL, &UtAppRecPtr, NULL); - RunStatus = CFE_ES_RunStatus_APP_RUN; - UtAppRecPtr->ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_RUN; + RunStatus = CFE_ES_RunStatus_APP_RUN; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == true && - UtAppRecPtr->AppState == - CFE_ES_AppState_RUNNING, - "CFE_ES_RunLoop", + CFE_ES_RunLoop(&RunStatus) == true && UtAppRecPtr->AppState == CFE_ES_AppState_RUNNING, "CFE_ES_RunLoop", "Status change from initializing to run"); /* Test successful CFE application registration */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterApp() == CFE_SUCCESS, - "CFE_ES_RegisterApp", + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterApp() == CFE_SUCCESS, "CFE_ES_RegisterApp", "Application registration successful"); /* Test getting the cFE application and task ID by context */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppID(&AppId) == CFE_SUCCESS, - "CFE_ES_GetAppID", + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppID(&AppId) == CFE_SUCCESS, "CFE_ES_GetAppID", "Get application ID by context successful"); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetTaskID(&TaskId) == CFE_SUCCESS, - "CFE_ES_GetTaskID", + UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskID(&TaskId) == CFE_SUCCESS, "CFE_ES_GetTaskID", "Get task ID by context successful"); /* Test getting the app name with a bad app ID */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppName", - "Get application name by ID; bad application ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetAppName", "Get application name by ID; bad application ID"); /* Test getting the app name with that app ID out of range */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppName(AppName, - AppId, - sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppName", - "Get application name by ID; ID out of range"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetAppName", "Get application name by ID; ID out of range"); /* Test successfully getting the app name using the app ID */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_SUCCESS, - "CFE_ES_GetAppName", - "Get application name by ID successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_SUCCESS, + "CFE_ES_GetAppName", "Get application name by ID successful"); /* Test getting task information using the task ID - NULL buffer */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetTaskInfo(NULL, TaskId) == CFE_ES_ERR_BUFFER, - "CFE_ES_GetTaskInfo", + UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(NULL, TaskId) == CFE_ES_ERR_BUFFER, "CFE_ES_GetTaskInfo", "Get task info by ID; NULL buffer"); /* Test getting task information using the task ID - bad task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", - "Get task info by ID; bad task ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetTaskInfo", "Get task info by ID; bad task ID"); /* Test getting task information using the task ID */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); - TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); + TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UtAppRecPtr->AppState = CFE_ES_AppState_RUNNING; - UT_Report(__FILE__, __LINE__, - CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_SUCCESS, - "CFE_ES_GetTaskInfo", + UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_SUCCESS, "CFE_ES_GetTaskInfo", "Get task info by ID successful"); /* Test getting task information using the task ID with parent inactive */ @@ -4833,114 +3825,56 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); CFE_ES_AppRecordSetFree(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", - "Get task info by ID; parent application not active"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetTaskInfo", "Get task info by ID; parent application not active"); /* Test getting task information using the task ID with task inactive */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); CFE_ES_TaskRecordSetFree(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", - "Get task info by ID; task not active"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetTaskInfo", "Get task info by ID; task not active"); /* Test getting task information using the task ID with invalid task ID */ ES_ResetUnitTest(); TaskId = CFE_ES_TASKID_UNDEFINED; - UT_Report(__FILE__, __LINE__, - CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", - "Get task info by ID; invalid task ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetTaskInfo", "Get task info by ID; invalid task ID"); /* Test creating a child task with a bad app ID */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, - "TaskName", - TestAPI, - StackBuf, - sizeof(StackBuf), - 400, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_ChildTaskCreate", + Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_ChildTaskCreate", "Bad application ID"); /* Test creating a child task with an OS task create failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); - Return = CFE_ES_CreateChildTask(&TaskId, - "TaskName", - TestAPI, - StackBuf, - sizeof(StackBuf), - 400, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, - "CFE_ES_ChildTaskCreate", + Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_ChildTaskCreate", "OS task create failed"); /* Test creating a child task with a null task ID */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(NULL, - "TaskName", - TestAPI, - StackBuf, - sizeof(StackBuf), - 400, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_ChildTaskCreate", - "Task ID null"); + Return = CFE_ES_CreateChildTask(NULL, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task ID null"); /* Test creating a child task with a null task name */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, - NULL, - TestAPI, - StackBuf, - sizeof(StackBuf), - 400, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_ChildTaskCreate", - "Task name null"); + Return = CFE_ES_CreateChildTask(&TaskId, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task name null"); /* Test creating a child task with a null task ID and name */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(NULL, - NULL, - TestAPI, - StackBuf, - sizeof(StackBuf), - 400, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_ChildTaskCreate", - "Task name and ID null"); + Return = CFE_ES_CreateChildTask(NULL, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task name and ID null"); /* Test creating a child task with a null function pointer */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, - "TaskName", - NULL, - StackBuf, - sizeof(StackBuf), - 2, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_BAD_ARGUMENT, - "CFE_ES_ChildTaskCreate", - "Function pointer null"); + Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", NULL, StackBuf, sizeof(StackBuf), 2, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Function pointer null"); /* Test creating a child task within a child task */ ES_ResetUnitTest(); @@ -4948,36 +3882,20 @@ void TestAPI(void) ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); TestObjId = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ - Return = CFE_ES_CreateChildTask(&TaskId, - "TaskName", - TestAPI, - StackBuf, - sizeof(StackBuf), - 400, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_ERR_CHILD_TASK_CREATE, - "CFE_ES_CreateChildTask", + Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_CHILD_TASK_CREATE, "CFE_ES_CreateChildTask", "Cannot call from a child task"); /* Test successfully creating a child task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - Return = CFE_ES_CreateChildTask(&TaskId, - "TaskName", - TestAPI, - StackBuf, - sizeof(StackBuf), - 400, - 0); - UT_Report(__FILE__, __LINE__, - Return == CFE_SUCCESS, "CFE_ES_CreateChildTask", - "Create child task successful"); + Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); + UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_CreateChildTask", "Create child task successful"); /* Test common entry point */ ES_ResetUnitTest(); - /* + /* * Without no app/task set up the entry point will not be found. * There is no return value to check here, it just will not do anything. */ @@ -4998,58 +3916,46 @@ void TestAPI(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteChildTask(TaskId) == - CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK, - "CFE_ES_DeleteChildTask", - "Task ID belongs to a main task"); + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK, + "CFE_ES_DeleteChildTask", "Task ID belongs to a main task"); /* Test deleting a child task with an invalid task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_DeleteChildTask", - "Task ID invalid"); + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_DeleteChildTask", "Task ID invalid"); /* Test successfully deleting a child task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); /* the child task ID */ Return = CFE_ES_GetAppInfo(&AppInfo, AppId); - UtAssert_True(Return == CFE_SUCCESS, - "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); - UtAssert_True(AppInfo.NumOfChildTasks == 1, - "AppInfo.NumOfChildTaskss == %u", (unsigned int)AppInfo.NumOfChildTasks); + UtAssert_True(Return == CFE_SUCCESS, "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); + UtAssert_True(AppInfo.NumOfChildTasks == 1, "AppInfo.NumOfChildTaskss == %u", + (unsigned int)AppInfo.NumOfChildTasks); Return = CFE_ES_DeleteChildTask(TaskId); - UtAssert_True(Return == CFE_SUCCESS, - "DeleteChildResult() return=%x", (unsigned int)Return); - Return = CFE_ES_GetAppInfo(&AppInfo,AppId); - UtAssert_True(Return == CFE_SUCCESS, - "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); - UtAssert_True(AppInfo.NumOfChildTasks == 0, - "AppInfo.NumOfChildTaskss == %u", (unsigned int)AppInfo.NumOfChildTasks); + UtAssert_True(Return == CFE_SUCCESS, "DeleteChildResult() return=%x", (unsigned int)Return); + Return = CFE_ES_GetAppInfo(&AppInfo, AppId); + UtAssert_True(Return == CFE_SUCCESS, "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); + UtAssert_True(AppInfo.NumOfChildTasks == 0, "AppInfo.NumOfChildTaskss == %u", + (unsigned int)AppInfo.NumOfChildTasks); /* Test deleting a child task with an OS task delete failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); - AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ + AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); /* the child task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteChildTask(TaskId) <= 0, - "CFE_ES_DeleteChildTask", + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) <= 0, "CFE_ES_DeleteChildTask", "OS task delete failure"); /* Test deleting a child task with the task ID out of range */ ES_ResetUnitTest(); TaskId = CFE_ES_TASKID_UNDEFINED; - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_DeleteChildTask", - "Task ID too large"); + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_DeleteChildTask", "Task ID too large"); /* Test successfully exiting a child task */ ES_ResetUnitTest(); @@ -5058,9 +3964,7 @@ void TestAPI(void) TestObjId = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(OS_TaskExit)) == 1, - "CFE_ES_ExitChildTask", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(OS_TaskExit)) == 1, "CFE_ES_ExitChildTask", "Exit child task successful"); /* Test exiting a child task within an app main task */ @@ -5068,32 +3972,24 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_CALL_APP_MAIN]), - "CFE_ES_ExitChildTask", - "Cannot call from a cFE application main task"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_CALL_APP_MAIN]), + "CFE_ES_ExitChildTask", "Cannot call from a cFE application main task"); /* Test exiting a child task with an error retrieving the app ID */ ES_ResetUnitTest(); CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_TASKEXIT_BAD_CONTEXT]), - "CFE_ES_ExitChildTask", - "Invalid context"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_TASKEXIT_BAD_CONTEXT]), + "CFE_ES_ExitChildTask", "Invalid context"); /* Test registering a child task with an OS task register failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskRegister), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterChildTask() == CFE_ES_ERR_CHILD_TASK_REGISTER, - "CFE_ES_RegisterChildTask", - "OS task register failed"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterChildTask() == CFE_ES_ERR_CHILD_TASK_REGISTER, + "CFE_ES_RegisterChildTask", "OS task register failed"); /* Test successfully registering a child task */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterChildTask() == CFE_SUCCESS, - "CFE_ES_RegisterChildTask", + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterChildTask() == CFE_SUCCESS, "CFE_ES_RegisterChildTask", "Register child task successful"); /* Test successfully adding a time-stamped message to the system log that @@ -5101,36 +3997,31 @@ void TestAPI(void) */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - CFE_TIME_PRINTED_STRING_SIZE - 4; - CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; - CFE_ES_ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; + CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; + CFE_ES_ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; UT_Report(__FILE__, __LINE__, CFE_ES_SysLogWrite_Unsync("SysLogText This message should be truncated") == CFE_ES_ERR_SYS_LOG_TRUNCATED, - "CFE_ES_SysLogWrite_Internal", - "Add message to log that must be truncated"); + "CFE_ES_SysLogWrite_Internal", "Add message to log that must be truncated"); /* Reset the system log index to prevent an overflow in later tests */ CFE_ES_ResetDataPtr->SystemLogWriteIdx = 0; - CFE_ES_ResetDataPtr->SystemLogEndIdx = 0; + CFE_ES_ResetDataPtr->SystemLogEndIdx = 0; /* Test calculating a CRC on a range of memory using CRC type 8 * NOTE: This capability is not currently implemented in cFE */ memset(Data, 1, sizeof(Data)); ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_8) == 0, - "CFE_ES_CalculateCRC", - "*Not implemented* CRC-8 algorithm"); + UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_8) == 0, + "CFE_ES_CalculateCRC", "*Not implemented* CRC-8 algorithm"); /* Test calculating a CRC on a range of memory using CRC type 16 */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_16) == 2688, - "CFE_ES_CalculateCRC", - "CRC-16 algorithm - memory read successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_16) == 2688, + "CFE_ES_CalculateCRC", "CRC-16 algorithm - memory read successful"); /* - * CRC memory read failure test case removed in #322 - + * CRC memory read failure test case removed in #322 - * deprecated CFE_PSP_MemRead8, now the FSW code does a direct read * which has no failure path. */ @@ -5139,17 +4030,13 @@ void TestAPI(void) * NOTE: This capability is not currently implemented in cFE */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_32) == 0, - "CFE_ES_CalculateCRC", - "*Not implemented* CRC-32 algorithm"); + UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_32) == 0, + "CFE_ES_CalculateCRC", "*Not implemented* CRC-32 algorithm"); /* Test calculating a CRC on a range of memory using an invalid CRC type */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CalculateCRC(&Data, 12, 345353, -1) == 0, - "CFE_ES_CalculateCRC", + UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, -1) == 0, "CFE_ES_CalculateCRC", "Invalid CRC type"); /* Test shared mutex take with a take error */ @@ -5157,9 +4044,7 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, -1); CFE_ES_LockSharedData(__func__, 12345); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_TAKE]), - "CFE_ES_LockSharedData", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_TAKE]), "CFE_ES_LockSharedData", "Mutex take error"); /* Test shared mutex release with a release error */ @@ -5167,12 +4052,9 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, -1); CFE_ES_UnlockSharedData(__func__, 98765); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_GIVE]), - "CFE_ES_UnlockSharedData", + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_GIVE]), "CFE_ES_UnlockSharedData", "Mutex release error"); - /* Test waiting for apps to initialize before continuing; transition from * initializing to running */ @@ -5180,10 +4062,7 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_EARLY_INIT, "UT", &UtAppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_OPERATIONAL; CFE_ES_WaitForStartupSync(0); - UT_Report(__FILE__, __LINE__, - UtAppRecPtr->AppState == - CFE_ES_AppState_RUNNING, - "CFE_ES_WaitForStartupSync", + UT_Report(__FILE__, __LINE__, UtAppRecPtr->AppState == CFE_ES_AppState_RUNNING, "CFE_ES_WaitForStartupSync", "Transition from initializing to running"); /* Test waiting for apps to initialize before continuing with the semaphore @@ -5197,10 +4076,7 @@ void TestAPI(void) /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ - UT_Report(__FILE__, __LINE__, - 1, - "CFE_ES_WaitForStartupSync", - "System state core ready"); + UT_Report(__FILE__, __LINE__, 1, "CFE_ES_WaitForStartupSync", "System state core ready"); /* Test waiting for apps to initialize as an external app */ @@ -5212,94 +4088,81 @@ void TestAPI(void) /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ + UT_Report(__FILE__, __LINE__, 1, "CFE_ES_WaitForStartupSync", "System state operational"); + + /* Test adding a time-stamped message to the system log using an invalid + * log mode + * + * TEST CASE REMOVED as the invalid log mode follow the same path as Discard, + * this test case added nothing new + */ + + /* Test successfully adding a time-stamped message to the system log that + * causes the log index to be reset + */ + ES_ResetUnitTest(); + CFE_ES_ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; + CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; + CFE_ES_ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; + UT_Report(__FILE__, __LINE__, CFE_ES_WriteToSysLog("SysLogText") == CFE_ES_ERR_SYS_LOG_FULL, "CFE_ES_WriteToSysLog", + "Add message to log that resets the log index"); + + /* Test successfully adding a time-stamped message to the system log that + * causes the log index to be reset + */ + ES_ResetUnitTest(); + CFE_ES_ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; + CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; + CFE_ES_ResetDataPtr->SystemLogMode = CFE_ES_LogMode_OVERWRITE; UT_Report(__FILE__, __LINE__, - 1, - "CFE_ES_WaitForStartupSync", - "System state operational"); - - /* Test adding a time-stamped message to the system log using an invalid - * log mode - * - * TEST CASE REMOVED as the invalid log mode follow the same path as Discard, - * this test case added nothing new - */ - - - /* Test successfully adding a time-stamped message to the system log that - * causes the log index to be reset - */ - ES_ResetUnitTest(); - CFE_ES_ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; - CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; - CFE_ES_ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; - UT_Report(__FILE__, __LINE__, - CFE_ES_WriteToSysLog("SysLogText") == CFE_ES_ERR_SYS_LOG_FULL, - "CFE_ES_WriteToSysLog", - "Add message to log that resets the log index"); - - /* Test successfully adding a time-stamped message to the system log that - * causes the log index to be reset - */ - ES_ResetUnitTest(); - CFE_ES_ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; - CFE_ES_ResetDataPtr->SystemLogEndIdx = CFE_ES_ResetDataPtr->SystemLogWriteIdx; - CFE_ES_ResetDataPtr->SystemLogMode = CFE_ES_LogMode_OVERWRITE; - UT_Report(__FILE__, __LINE__, CFE_ES_WriteToSysLog("SysLogText") == CFE_SUCCESS && - CFE_ES_ResetDataPtr->SystemLogWriteIdx < CFE_PLATFORM_ES_SYSTEM_LOG_SIZE, - "CFE_ES_WriteToSysLog", - "Add message to log that resets the log index"); - - /* Test run loop with an application error status */ - ES_ResetUnitTest(); - ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); - RunStatus = CFE_ES_RunStatus_APP_ERROR; - UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == false, - "CFE_ES_RunLoop", - "Application error run status"); - - /* - * Test public Name+ID query/lookup API for tasks - * This just uses OSAL routines to implement, but need to cover error paths. - */ - ES_ResetUnitTest(); - ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, &UtTaskRecPtr); - TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, CFE_ES_TASKID_UNDEFINED, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_SUCCESS); - UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); - - UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, NULL), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, AppName), CFE_SUCCESS); - UT_SetDeferredRetcode(UT_KEY(OS_TaskGetIdByName), 1, OS_ERROR); - UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); + CFE_ES_ResetDataPtr->SystemLogWriteIdx < CFE_PLATFORM_ES_SYSTEM_LOG_SIZE, + "CFE_ES_WriteToSysLog", "Add message to log that resets the log index"); + + /* Test run loop with an application error status */ + ES_ResetUnitTest(); + ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); + RunStatus = CFE_ES_RunStatus_APP_ERROR; + UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; + UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", + "Application error run status"); + + /* + * Test public Name+ID query/lookup API for tasks + * This just uses OSAL routines to implement, but need to cover error paths. + */ + ES_ResetUnitTest(); + ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, &UtTaskRecPtr); + TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, CFE_ES_TASKID_UNDEFINED, sizeof(AppName)), + CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_SUCCESS); + UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); + + UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, AppName), CFE_SUCCESS); + UT_SetDeferredRetcode(UT_KEY(OS_TaskGetIdByName), 1, OS_ERROR); + UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); } void TestGenericCounterAPI(void) { - char CounterName[11]; + char CounterName[11]; CFE_ES_CounterId_t CounterId; CFE_ES_CounterId_t CounterId2; - uint32 CounterCount; - int i; + uint32 CounterCount; + int i; /* Test successfully registering a generic counter */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(&CounterId, "Counter1") == CFE_SUCCESS, - "CFE_ES_RegisterGenCounter", - "Register counter successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "Counter1") == CFE_SUCCESS, + "CFE_ES_RegisterGenCounter", "Register counter successful"); /* Test registering a generic counter that is already registered */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(&CounterId, - "Counter1") == CFE_ES_ERR_DUPLICATE_NAME, - "CFE_ES_RegisterGenCounter", - "Attempt to register an existing counter"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "Counter1") == CFE_ES_ERR_DUPLICATE_NAME, + "CFE_ES_RegisterGenCounter", "Attempt to register an existing counter"); /* Test registering the maximum number of generic counters */ for (i = 1; i < CFE_PLATFORM_ES_MAX_GEN_COUNTERS; i++) @@ -5312,18 +4175,14 @@ void TestGenericCounterAPI(void) } } - UT_Report(__FILE__, __LINE__, - i == CFE_PLATFORM_ES_MAX_GEN_COUNTERS, - "CFE_ES_RegisterGenCounter", + UT_Report(__FILE__, __LINE__, i == CFE_PLATFORM_ES_MAX_GEN_COUNTERS, "CFE_ES_RegisterGenCounter", "Register maximum number of counters"); /* Test registering a generic counter after the maximum are registered */ UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(&CounterId, - "Counter999") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_RegisterGenCounter", - "Maximum number of counters exceeded"); + CFE_ES_RegisterGenCounter(&CounterId, "Counter999") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, + "CFE_ES_RegisterGenCounter", "Maximum number of counters exceeded"); UT_ResetState(UT_KEY(CFE_ResourceId_FindNext)); /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ @@ -5332,141 +4191,93 @@ void TestGenericCounterAPI(void) UtAssert_True(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1)), "Counter Slot Used"); UtAssert_True(!CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2)), "Counter Slot Unused"); - /* Test getting a registered generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetGenCounterIDByName(&CounterId, - "Counter999") == CFE_ES_ERR_NAME_NOT_FOUND, - "CFE_ES_GetGenCounterIDByName", - "Cannot get counter that does not exist"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(&CounterId, "Counter999") == CFE_ES_ERR_NAME_NOT_FOUND, + "CFE_ES_GetGenCounterIDByName", "Cannot get counter that does not exist"); /* Test successfully getting a registered generic counter ID by name */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetGenCounterIDByName(&CounterId, - "Counter5") == CFE_SUCCESS, - "CFE_ES_GetGenCounterIDByName", - "Get generic counter ID successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(&CounterId, "Counter5") == CFE_SUCCESS, + "CFE_ES_GetGenCounterIDByName", "Get generic counter ID successful"); /* Test deleting a registered generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteGenCounter(CFE_ES_COUNTERID_UNDEFINED) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_DeleteGenCounter", - "Cannot delete counter that does not exist"); + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteGenCounter(CFE_ES_COUNTERID_UNDEFINED) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_DeleteGenCounter", "Cannot delete counter that does not exist"); /* Test successfully deleting a registered generic counter by ID */ - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteGenCounter(CounterId) == CFE_SUCCESS, - "CFE_ES_DeleteGenCounter", + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteGenCounter(CounterId) == CFE_SUCCESS, "CFE_ES_DeleteGenCounter", "Successful"); /* Test successfully registering a generic counter to verify a place for * it is now available and to provide an ID for subsequent tests */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(&CounterId, "CounterX") == CFE_SUCCESS, - "CFE_ES_RegisterGenCounter", - "Register counter; back to maximum number"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "CounterX") == CFE_SUCCESS, + "CFE_ES_RegisterGenCounter", "Register counter; back to maximum number"); /* Test incrementing a generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, - CFE_ES_IncrementGenCounter(CFE_ES_COUNTERID_UNDEFINED) - == CFE_ES_BAD_ARGUMENT, - "CFE_ES_IncrementGenCounter", - "Bad counter ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CFE_ES_COUNTERID_UNDEFINED) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_IncrementGenCounter", "Bad counter ID"); /* Test successfully incrementing a generic counter */ - UT_Report(__FILE__, __LINE__, - CFE_ES_IncrementGenCounter(CounterId) == CFE_SUCCESS, - "CFE_ES_IncrementGenCounter", + UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CounterId) == CFE_SUCCESS, "CFE_ES_IncrementGenCounter", "Increment counter successful"); /* Test getting a generic counter value for a counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetGenCount(CFE_ES_COUNTERID_UNDEFINED, &CounterCount) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCount", - "Bad counter ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CFE_ES_COUNTERID_UNDEFINED, &CounterCount) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_GetGenCount", "Bad counter ID"); /* Test successfully getting a generic counter value */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_SUCCESS && - CounterCount == 1, - "CFE_ES_GetGenCount", - "Get counter value successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_SUCCESS && CounterCount == 1, + "CFE_ES_GetGenCount", "Get counter value successful"); /* Test setting a generic counter value for a counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, - CFE_ES_SetGenCount(CFE_ES_COUNTERID_UNDEFINED, 5) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_SetGenCount", - "Bad counter ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CFE_ES_COUNTERID_UNDEFINED, 5) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_SetGenCount", "Bad counter ID"); /* Test successfully setting a generic counter value */ - UT_Report(__FILE__, __LINE__, - CFE_ES_SetGenCount(CounterId, 5) == CFE_SUCCESS, - "CFE_ES_SetGenCount", + UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CounterId, 5) == CFE_SUCCESS, "CFE_ES_SetGenCount", "Set counter value successful"); /* Test value retrieved from a generic counter value */ CFE_ES_GetGenCount(CounterId, &CounterCount); - UT_Report(__FILE__, __LINE__, - (CounterCount == 5), "CFE_ES_SetGenCount", - "Check value for counter set"); + UT_Report(__FILE__, __LINE__, (CounterCount == 5), "CFE_ES_SetGenCount", "Check value for counter set"); /* Test registering a generic counter with a null counter ID pointer */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(NULL, - "Counter1") == CFE_ES_BAD_ARGUMENT, - "CFE_ES_RegisterGenCounter", - "Attempt to register using a null counter ID pointer"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(NULL, "Counter1") == CFE_ES_BAD_ARGUMENT, + "CFE_ES_RegisterGenCounter", "Attempt to register using a null counter ID pointer"); /* Test registering a generic counter with a null counter name */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(&CounterId, - NULL) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_RegisterGenCounter", - "Attempt to register using a null counter name"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, NULL) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_RegisterGenCounter", "Attempt to register using a null counter name"); /* Test incrementing a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_IncrementGenCounter(CounterId) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_IncrementGenCounter", - "Record not in use"); + UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CounterId) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_IncrementGenCounter", "Record not in use"); /* Test setting a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_SetGenCount(CounterId, 0) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_SetGenCount", + UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CounterId, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_SetGenCount", "Record not in use"); /* Test getting a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetGenCount(CounterId, &CounterCount) - == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCount", - "Record not in use"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_GetGenCount", "Record not in use"); /* Test getting a generic counter where the count is null */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetGenCount(CounterId, NULL) - == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCount", + UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, NULL) == CFE_ES_BAD_ARGUMENT, "CFE_ES_GetGenCount", "Null count"); /* Test getting a registered generic counter ID using a null counter * pointer */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetGenCounterIDByName(NULL, - "CounterX") == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCounterIDByName", - "Null name"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(NULL, "CounterX") == CFE_ES_BAD_ARGUMENT, + "CFE_ES_GetGenCounterIDByName", "Null name"); /* * Test Name-ID query/conversion API @@ -5477,43 +4288,38 @@ void TestGenericCounterAPI(void) UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId2, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId2, CounterName), CFE_SUCCESS); UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(CounterId, CounterId2), "Counter IDs Match"); - UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CounterName, CFE_ES_COUNTERID_UNDEFINED, sizeof(CounterName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CounterName, CFE_ES_COUNTERID_UNDEFINED, sizeof(CounterName)), + CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(NULL, CounterId, sizeof(CounterName)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId, NULL), CFE_ES_BAD_ARGUMENT); } void TestCDS() { - size_t CdsSize; - uint8 *CdsPtr; - char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN + 4]; - CFE_ES_CDSHandle_t CDSHandle; + size_t CdsSize; + uint8 * CdsPtr; + char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN + 4]; + CFE_ES_CDSHandle_t CDSHandle; CFE_ES_CDS_RegRec_t *UtCDSRegRecPtr; - uint32 i; - uint32 TempSize; - uint8 BlockData[ES_UT_CDS_BLOCK_SIZE]; + uint32 i; + uint32 TempSize; + uint8 BlockData[ES_UT_CDS_BLOCK_SIZE]; UtPrintf("Begin Test CDS"); /* Test init with a mutex create failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, - "CFE_ES_CDS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_CDS_EarlyInit", "Mutex create failed"); /* Test locking the CDS registry with a mutex take failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_LockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, - "CFE_ES_LockCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_LockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_LockCDS", "Mutex take failed"); /* Test unlocking the CDS registry with a mutex give failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_UnlockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, - "CFE_ES_UnlockCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_UnlockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_UnlockCDS", "Mutex give failed"); /* Set up the PSP stubs for CDS testing */ @@ -5521,100 +4327,64 @@ void TestCDS() /* Test the CDS Cache Fetch/Flush/Load routine error cases */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, - 4, - 0) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CacheFetch", - "Invalid Size"); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CacheFlush", - "Invalid Size"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 0) == CFE_ES_CDS_INVALID_SIZE, + "CFE_ES_CDS_CacheFetch", "Invalid Size"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_INVALID_SIZE, + "CFE_ES_CDS_CacheFlush", "Invalid Size"); UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, NULL, - 4, - 0) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CachePreload", - "Invalid Size"); + CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, NULL, 4, 0) == CFE_ES_CDS_INVALID_SIZE, + "CFE_ES_CDS_CachePreload", "Invalid Size"); TempSize = 5; - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, &TempSize, - 4, - 4) == CFE_SUCCESS, - "CFE_ES_CDS_CachePreload", - "Nominal"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, &TempSize, 4, 4) == CFE_SUCCESS, + "CFE_ES_CDS_CachePreload", "Nominal"); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, - 4, - 4) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDS_CacheFetch", - "Access error"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 4) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_CDS_CacheFetch", "Access error"); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDS_CacheFlush", - "Access Error"); - + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_CDS_CacheFlush", "Access Error"); /* Test CDS registering with a write CDS failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, - 4, - "Name3") == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RegisterCDS", - "Writing to BSP CDS failure"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name3") == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_RegisterCDS", "Writing to BSP CDS failure"); /* Test successful CDS registering */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_SUCCESS, - "CFE_ES_RegisterCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_SUCCESS, "CFE_ES_RegisterCDS", "Register CDS successful"); /* Test CDS registering using an already registered name */ /* No reset here -- just attempt to register the same name again */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_CDS_ALREADY_EXISTS, - "CFE_ES_RegisterCDS", - "Retrieve existing CDS"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_CDS_ALREADY_EXISTS, + "CFE_ES_RegisterCDS", "Retrieve existing CDS"); /* Test CDS registering using the same name, but a different size */ /* No reset here -- just attempt to register the same name again */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 6, "Name") == CFE_SUCCESS, - "CFE_ES_RegisterCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 6, "Name") == CFE_SUCCESS, "CFE_ES_RegisterCDS", "Get CDS of same name, but new size"); /* Test CDS registering using a null name */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 4, "") == CFE_ES_CDS_INVALID_NAME, - "CFE_ES_RegisterCDS", - "Invalid name size"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "") == CFE_ES_CDS_INVALID_NAME, + "CFE_ES_RegisterCDS", "Invalid name size"); /* Test CDS registering with a block size of zero */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 0, "Name") == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_RegisterCDS", - "Block size zero"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 0, "Name") == CFE_ES_CDS_INVALID_SIZE, + "CFE_ES_RegisterCDS", "Block size zero"); /* Test CDS registering with no memory pool available */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_NOT_IMPLEMENTED, - "CFE_ES_RegisterCDS", - "No memory pool available"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_NOT_IMPLEMENTED, + "CFE_ES_RegisterCDS", "No memory pool available"); /* Test CDS registering with all the CDS registries taken */ ES_ResetUnitTest(); @@ -5623,10 +4393,8 @@ void TestCDS() /* Set all the CDS registries to 'taken' */ UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_RegisterCDS", - "No available entries"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, + "CFE_ES_RegisterCDS", "No available entries"); /* Check operation of the CFE_ES_CheckCDSHandleSlotUsed() helper function */ CFE_ES_Global.CDSVars.Registry[1].BlockID = CFE_ES_CDSHANDLE_C(ES_UT_MakeCDSIdForIndex(1)); @@ -5636,38 +4404,27 @@ void TestCDS() /* Test CDS registering using a bad app ID */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RegisterCDS", - "Bad application ID"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_RegisterCDS", "Bad application ID"); /* Test copying to CDS with bad handle */ CDSHandle = CFE_ES_CDS_BAD_HANDLE; - UT_Report(__FILE__, __LINE__, - CFE_ES_CopyToCDS(CDSHandle, &TempSize) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CopyToCDS", - "Copy to CDS bad handle"); + UT_Report(__FILE__, __LINE__, CFE_ES_CopyToCDS(CDSHandle, &TempSize) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_CopyToCDS", "Copy to CDS bad handle"); /* Test restoring from a CDS with bad handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RestoreFromCDS(&TempSize, CDSHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RestoreFromCDS", - "Restore from CDS bad handle"); - + UT_Report(__FILE__, __LINE__, CFE_ES_RestoreFromCDS(&TempSize, CDSHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_RestoreFromCDS", "Restore from CDS bad handle"); /* Test successfully copying to a CDS */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_SUCCESS); ES_UT_SetupSingleCDSRegistry("UT", ES_UT_CDS_BLOCK_SIZE, false, &UtCDSRegRecPtr); CDSHandle = CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CopyToCDS(CDSHandle, &BlockData) == CFE_SUCCESS, - "CFE_ES_CopyToCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_CopyToCDS(CDSHandle, &BlockData) == CFE_SUCCESS, "CFE_ES_CopyToCDS", "Copy to CDS successful"); /* Test successfully restoring from a CDS */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RestoreFromCDS(&BlockData, CDSHandle) == CFE_SUCCESS, - "CFE_ES_RestoreFromCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_RestoreFromCDS(&BlockData, CDSHandle) == CFE_SUCCESS, "CFE_ES_RestoreFromCDS", "Restore from CDS successful"); /* Test CDS registering using a name longer than the maximum allowed */ @@ -5682,161 +4439,116 @@ void TestCDS() CDSName[i] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, 4, CDSName) - == CFE_ES_CDS_INVALID_NAME, - "CFE_ES_RegisterCDS", - "Invalid name size"); + UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, CDSName) == CFE_ES_CDS_INVALID_NAME, + "CFE_ES_RegisterCDS", "Invalid name size"); /* Test unsuccessful CDS registering */ UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, - CDS_ABS_MAX_BLOCK_SIZE+1, - "Name") == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_RegisterCDS", - "Register CDS unsuccessful"); + CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE + 1, "Name") == CFE_ES_CDS_INVALID_SIZE, + "CFE_ES_RegisterCDS", "Register CDS unsuccessful"); UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, - CDS_ABS_MAX_BLOCK_SIZE-1, - "Name") == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_RegisterCDS", - "Register CDS unsuccessful"); + CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE - 1, "Name") == CFE_ES_ERR_MEM_BLOCK_SIZE, + "CFE_ES_RegisterCDS", "Register CDS unsuccessful"); /* Test memory pool rebuild and registry recovery with an * unreadable registry */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, - "CFE_ES_RebuildCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", "First read from CDS bad"); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, -1); - UT_Report(__FILE__, __LINE__, - CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, - "CFE_ES_RebuildCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", "Second read from CDS bad"); /* Test CDS registry initialization with a CDS write failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_InitCDSRegistry", + UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", "Failed to write registry size"); /* Test successful CDS initialization */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, - "CFE_ES_CDS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", "Initialization successful"); /* Test CDS initialization with a read error */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_CDS_EarlyInit", "Unrecoverable read error"); /* Test CDS initialization with size below the minimum */ ES_ResetUnitTest(); UT_SetCDSSize(1024); UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS && - UT_GetStubCount(UT_KEY(CFE_PSP_GetCDSSize)) == 1, - "CFE_ES_CDS_EarlyInit", - "CDS size less than minimum"); + CFE_ES_CDS_EarlyInit() == CFE_SUCCESS && UT_GetStubCount(UT_KEY(CFE_PSP_GetCDSSize)) == 1, + "CFE_ES_CDS_EarlyInit", "CDS size less than minimum"); /* Test CDS initialization with size not obtainable */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetCDSSize), -1); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == OS_ERROR, - "CFE_ES_CDS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == OS_ERROR, "CFE_ES_CDS_EarlyInit", "Unable to obtain CDS size"); /* Reset back to a sufficient CDS size */ - UT_SetCDSSize(128*1024); - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void**)&CdsPtr, &CdsSize, NULL); + UT_SetCDSSize(128 * 1024); + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); /* Test CDS initialization with rebuilding not possible */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, - "CFE_ES_CDS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", "Rebuilding not possible; create new CDS"); /* Test CDS validation with first CDS read call failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_ValidateCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ValidateCDS", "CDS read (first call) failed"); /* Test CDS validation with second CDS read call failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_ValidateCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ValidateCDS", "CDS read (second call) failed"); /* Test CDS validation with CDS read end check failure */ memset(CdsPtr + CdsSize - CFE_ES_CDS_SIGNATURE_LEN, 'x', CFE_ES_CDS_SIGNATURE_LEN); - UT_Report(__FILE__, __LINE__, - CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, - "CFE_ES_ValidateCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, "CFE_ES_ValidateCDS", "Reading from CDS failed end check"); /* Test CDS validation with CDS read begin check failure */ - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void**)&CdsPtr, &CdsSize, NULL); + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); memset(CdsPtr, 'x', CFE_ES_CDS_SIGNATURE_LEN); - UT_Report(__FILE__, __LINE__, - CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, - "CFE_ES_ValidateCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, "CFE_ES_ValidateCDS", "Reading from CDS failed begin check"); /* Test CDS initialization where first write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_InitCDSSignatures", + UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSSignatures", "CDS write (first call) failed"); /* Test CDS initialization where second write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_InitCDSSignatures", + UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSSignatures", "CDS write (second call) failed"); /* Test CDS clear where write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_ClearCDS() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_ClearCDS", - "CDS write failed"); + UT_Report(__FILE__, __LINE__, CFE_ES_ClearCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ClearCDS", "CDS write failed"); /* Test rebuilding the CDS where the registry is not the same size */ ES_ResetUnitTest(); - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void**)&CdsPtr, &CdsSize, NULL); + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); TempSize = CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES + 1; memcpy(CdsPtr + CDS_REG_SIZE_OFFSET, &TempSize, sizeof(TempSize)); - UT_Report(__FILE__, __LINE__, - CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, - "CFE_ES_RebuildCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", "Registry too large to recover"); /* Test clearing CDS where size is an odd number (requires partial write) */ ES_ResetUnitTest(); CFE_ES_Global.CDSVars.TotalSize = 53; - UT_Report(__FILE__, __LINE__, - CFE_ES_ClearCDS() == CFE_SUCCESS, - "CFE_ES_ClearCDS", - "CDS write failed"); + UT_Report(__FILE__, __LINE__, CFE_ES_ClearCDS() == CFE_SUCCESS, "CFE_ES_ClearCDS", "CDS write failed"); /* * To prepare for the rebuild tests, set up a clean area in PSP mem, @@ -5855,10 +4567,7 @@ void TestCDS() UtAssert_ZERO(UtCDSRegRecPtr->BlockOffset); UtAssert_ZERO(UtCDSRegRecPtr->BlockSize); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, - "CFE_ES_RebuildCDS", - "CDS rebuild successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_RebuildCDS", "CDS rebuild successful"); /* Check that the registry entry exists again (was recovered) */ UtAssert_NONZERO(UtCDSRegRecPtr->BlockOffset); @@ -5867,24 +4576,18 @@ void TestCDS() /* Test rebuilding the CDS with the registry unreadable */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, - "CFE_ES_RebuildCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", "CDS registry unreadable"); /* Test deleting the CDS from the registry with a registry write failure */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("NO_APP.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == -1, - "CFE_ES_DeleteCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == -1, "CFE_ES_DeleteCDS", "CDS block descriptor write failed"); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_DeleteCDS", - "CDS registry write failed"); + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_DeleteCDS", "CDS registry write failed"); /* Test deleting the CDS from the registry with the owner application * still active @@ -5892,11 +4595,8 @@ void TestCDS() ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteCDS("CFE_ES.CDS_NAME", true) == - CFE_ES_CDS_OWNER_ACTIVE_ERR, - "CFE_ES_DeleteCDS", - "Owner application still active"); + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("CFE_ES.CDS_NAME", true) == CFE_ES_CDS_OWNER_ACTIVE_ERR, + "CFE_ES_DeleteCDS", "Owner application still active"); /* * To prepare for the rebuild tests, set up a clean area in PSP mem @@ -5905,31 +4605,23 @@ void TestCDS() /* Test CDS initialization where rebuilding the CDS is successful */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, - "CFE_ES_CDS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", "Initialization with successful rebuild"); /* Test CDS initialization where rebuilding the CDS is unsuccessful */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, - "CFE_ES_CDS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", "Initialization with unsuccessful rebuild"); /* Test CDS initialization where initializing the CDS registry fails */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_InitCDSRegistry", + UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", "CDS registry write size failed"); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_InitCDSRegistry", + UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", "CDS registry write content failed"); /* Test deleting the CDS from the registry with a CDS name longer than the @@ -5939,9 +4631,7 @@ void TestCDS() memset(CDSName, 'a', sizeof(CDSName) - 1); CDSName[sizeof(CDSName) - 1] = '\0'; ES_UT_SetupSingleCDSRegistry(CDSName, ES_UT_CDS_BLOCK_SIZE, true, NULL); - UT_Report(__FILE__, __LINE__, - CFE_ES_DeleteCDS(CDSName, true) == CFE_ES_ERR_NAME_NOT_FOUND, - "CFE_ES_DeleteCDS", + UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS(CDSName, true) == CFE_ES_ERR_NAME_NOT_FOUND, "CFE_ES_DeleteCDS", "CDS name too long"); /* @@ -5953,8 +4643,10 @@ void TestCDS() UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSName, CDSHandle, sizeof(CDSName)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&CDSHandle, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&CDSHandle, CDSName), CFE_SUCCESS); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(CDSHandle, CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr)), "CDS Handle IDs Match"); - UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSName, CFE_ES_CDS_BAD_HANDLE, sizeof(CDSName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(CDSHandle, CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr)), + "CDS Handle IDs Match"); + UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSName, CFE_ES_CDS_BAD_HANDLE, sizeof(CDSName)), + CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(NULL, CDSHandle, sizeof(CDSName)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&CDSHandle, NULL), CFE_ES_BAD_ARGUMENT); @@ -5962,12 +4654,12 @@ void TestCDS() void TestCDSMempool(void) { - CFE_ES_CDS_RegRec_t *UtCdsRegRecPtr; - int Data; - CFE_ES_CDSHandle_t BlockHandle; - size_t SavedSize; - size_t SavedOffset; - uint8 *CdsPtr; + CFE_ES_CDS_RegRec_t *UtCdsRegRecPtr; + int Data; + CFE_ES_CDSHandle_t BlockHandle; + size_t SavedSize; + size_t SavedOffset; + uint8 * CdsPtr; UtPrintf("Begin Test CDS memory pool"); @@ -5975,15 +4667,11 @@ void TestCDSMempool(void) /* Test creating the CDS pool with the pool size too small */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_CreateCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CreateCDSPool", + UT_Report(__FILE__, __LINE__, CFE_ES_CreateCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, "CFE_ES_CreateCDSPool", "CDS pool size too small"); /* Test rebuilding the CDS pool with the pool size too small */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RebuildCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_RebuildCDSPool", + UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, "CFE_ES_RebuildCDSPool", "CDS pool size too small"); /* Test rebuilding CDS pool with CDS access errors */ @@ -5993,13 +4681,12 @@ void TestCDSMempool(void) */ ES_ResetUnitTest(); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); - SavedSize = CFE_ES_Global.CDSVars.TotalSize; + SavedSize = CFE_ES_Global.CDSVars.TotalSize; SavedOffset = CFE_ES_Global.CDSVars.Pool.TailPosition; - ES_UT_SetupSingleCDSRegistry("UT", sizeof(Data) + sizeof(CFE_ES_CDS_BlockHeader_t), - false, &UtCdsRegRecPtr); + ES_UT_SetupSingleCDSRegistry("UT", sizeof(Data) + sizeof(CFE_ES_CDS_BlockHeader_t), false, &UtCdsRegRecPtr); UtAssert_NONZERO(UtCdsRegRecPtr->BlockOffset); UtAssert_NONZERO(UtCdsRegRecPtr->BlockSize); - CFE_ES_DeleteCDS("UT",false); + CFE_ES_DeleteCDS("UT", false); UtAssert_INT32_EQ(CFE_ES_UpdateCDSRegistry(), CFE_SUCCESS); /* Clear/reset the global state */ @@ -6007,234 +4694,165 @@ void TestCDSMempool(void) /* Test rebuilding the CDS pool with a descriptor retrieve error */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RebuildCDSPool", - "CDS descriptor retrieve error"); + UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_RebuildCDSPool", "CDS descriptor retrieve error"); /* Test rebuilding the CDS pool with a descriptor commit error */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RebuildCDSPool", - "CDS descriptor commit error"); + UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_RebuildCDSPool", "CDS descriptor commit error"); /* Test CDS block write using an invalid memory handle */ ES_ResetUnitTest(); BlockHandle = CFE_ES_CDSHANDLE_C(CFE_ResourceId_FromInteger(7)); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CDSBlockWrite", - "Invalid memory handle"); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CDSBlockRead", - "Invalid memory handle"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_CDSBlockWrite", "Invalid memory handle"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_CDSBlockRead", "Invalid memory handle"); /* Test CDS block access */ ES_ResetUnitTest(); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); - ES_UT_SetupSingleCDSRegistry("UT", sizeof(Data) + sizeof(CFE_ES_CDS_BlockHeader_t), - false, &UtCdsRegRecPtr); + ES_UT_SetupSingleCDSRegistry("UT", sizeof(Data) + sizeof(CFE_ES_CDS_BlockHeader_t), false, &UtCdsRegRecPtr); BlockHandle = CFE_ES_CDSBlockRecordGetID(UtCdsRegRecPtr); - Data = 42; + Data = 42; /* Basic success path */ - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_SUCCESS, - "CFE_ES_CDSBlockWrite", + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_SUCCESS, "CFE_ES_CDSBlockWrite", "Nominal"); Data = 0; - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_SUCCESS, - "CFE_ES_CDSBlockRead", + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_SUCCESS, "CFE_ES_CDSBlockRead", "Nominal"); UtAssert_INT32_EQ(Data, 42); - /* Corrupt/change the block offset, should fail validation */ --UtCdsRegRecPtr->BlockOffset; - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_CDSBlockWrite", - "Block offset error"); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_CDSBlockRead", - "Block offset error"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_CDSBlockWrite", "Block offset error"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_CDSBlockRead", "Block offset error"); ++UtCdsRegRecPtr->BlockOffset; /* Corrupt/change the block size, should trigger invalid size error */ --UtCdsRegRecPtr->BlockSize; - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDSBlockWrite", - "Block size error"); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDSBlockRead", - "Block size error"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_INVALID_SIZE, + "CFE_ES_CDSBlockWrite", "Block size error"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_INVALID_SIZE, + "CFE_ES_CDSBlockRead", "Block size error"); ++UtCdsRegRecPtr->BlockSize; /* Test CDS block read/write with a CDS read error (block descriptor) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockWrite", - "Read error on descriptor"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_CDSBlockWrite", "Read error on descriptor"); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockRead", - "Read error on descriptor"); - + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_CDSBlockRead", "Read error on descriptor"); /* Test CDS block write with a CDS write error (block header) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockWrite", - "Write error on header"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_CDSBlockWrite", "Write error on header"); /* Test CDS block read with a CDS read error (block header) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockRead", - "Read error on header"); + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, + "CFE_ES_CDSBlockRead", "Read error on header"); /* Test CDS block write with a CDS write error (data content) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockWrite(BlockHandle, &Data) == OS_ERROR, - "CFE_ES_CDSBlockWrite", + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == OS_ERROR, "CFE_ES_CDSBlockWrite", "Write error on content"); /* Test CDS block read with a CDS read error (data content) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == OS_ERROR, - "CFE_ES_CDSBlockRead", + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == OS_ERROR, "CFE_ES_CDSBlockRead", "Read error on content"); /* Corrupt the data as to cause a CRC mismatch */ - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void**)&CdsPtr, NULL, NULL); - CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Bit flip */ - UT_Report(__FILE__, __LINE__, - CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_BLOCK_CRC_ERR, - "CFE_ES_CDSBlockRead", - "CRC error on content"); - CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Fix Bit */ + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, NULL, NULL); + CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Bit flip */ + UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_BLOCK_CRC_ERR, + "CFE_ES_CDSBlockRead", "CRC error on content"); + CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Fix Bit */ } void TestESMempool(void) { - CFE_ES_MemHandle_t PoolID1; /* Poo1 1 handle, no mutex */ - CFE_ES_MemHandle_t PoolID2; /* Poo1 2 handle, with mutex */ - uint8 Buffer1[1024]; - uint8 Buffer2[1024]; - 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]; - CFE_ES_GenPoolBD_t *BdPtr; - uint32 i; + CFE_ES_MemHandle_t PoolID1; /* Poo1 1 handle, no mutex */ + CFE_ES_MemHandle_t PoolID2; /* Poo1 2 handle, with mutex */ + uint8 Buffer1[1024]; + uint8 Buffer2[1024]; + 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]; + CFE_ES_GenPoolBD_t * BdPtr; + uint32 i; UtPrintf("Begin Test ES memory pool"); memset(BlockSizes, 0, sizeof(BlockSizes)); /* Test creating memory pool without using a mutex with the pool size - * too small - */ + * too small + */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateNoSem(&PoolID1, - Buffer1, - 0) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateNoSem", - "Pool size too small"); + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, 0) == CFE_ES_BAD_ARGUMENT, + "CFE_ES_PoolCreateNoSem", "Pool size too small"); /* Test successfully creating memory pool without using a mutex */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateNoSem(&PoolID1, - Buffer1, - sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreateNoSem", - "Memory pool create; successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, + "CFE_ES_PoolCreateNoSem", "Memory pool create; successful"); /* Test creating memory pool using a mutex with the pool size too small */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID2, Buffer2, 0) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreate", + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_PoolCreate", "Pool size too small"); /* Test successfully creating memory pool using a mutex */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID2, - Buffer2, - sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", - "Create memory pool (using mutex) [1]; successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, + "CFE_ES_PoolCreate", "Create memory pool (using mutex) [1]; successful"); /* Test successfully allocating a pool buffer */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, - "CFE_ES_GetPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [1]; successful"); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, - "CFE_ES_GetPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [2]; successful"); /* Test successfully getting the size of an existing pool buffer */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID2, addressp2) > 0, - "CFE_ES_GetPoolBufInfo", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) > 0, "CFE_ES_GetPoolBufInfo", "Get pool buffer size; successful"); /* Test successfully getting the size of an existing pool buffer. Use no * mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID1, addressp1) > 0, - "CFE_ES_GetPoolBufInfo", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) > 0, "CFE_ES_GetPoolBufInfo", "Get pool buffer size; successful (no mutex)"); /* Test successfully returning a pool buffer to the memory pool */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID1, addressp1) > 0, - "CFE_ES_PutPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) > 0, "CFE_ES_PutPoolBuf", "Return buffer to the memory pool; successful"); - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, - "CFE_ES_PutPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, "CFE_ES_PutPoolBuf", "Return buffer to the memory pool; successful"); /* Test successfully allocating an additional pool buffer */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, - "CFE_ES_GetPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [2]; successful"); /* Test successfully returning a pool buffer to the second memory pool. * Use no mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, - "CFE_ES_PutPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, "CFE_ES_PutPoolBuf", "Return buffer to the second memory pool; successful"); /* Test handle validation using a handle with an invalid memory address */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_MemValidateRange), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_ES_ValidateHandle(PoolID2) == false, - "CFE_ES_ValidateHandle", + UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(PoolID2) == false, "CFE_ES_ValidateHandle", "Invalid handle; bad memory address"); /* Test handle validation using a handle where the first pool structure @@ -6244,126 +4862,83 @@ void TestESMempool(void) /* * Intentionally corrupt the Pool ID value - whether strict or simple - * types are in use, underneath the wrapper(s) lies a uint32 eventually. + * types are in use, underneath the wrapper(s) lies a uint32 eventually. * This is intentionally a type-UNSAFE access to this value. */ - *((uint32*)&PoolPtr->PoolID) ^= 10; /* cause it to fail validation */ + *((uint32 *)&PoolPtr->PoolID) ^= 10; /* cause it to fail validation */ - UT_Report(__FILE__, __LINE__, - CFE_ES_ValidateHandle(PoolID2) == false, - "CFE_ES_ValidateHandle", + UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(PoolID2) == false, "CFE_ES_ValidateHandle", "Invalid handle; not pool start address"); /* Test allocating a pool buffer where the memory handle is not the pool * start address */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, - PoolID2, - 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBuf", - "Invalid handle; not pool start address"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetPoolBuf", "Invalid handle; not pool start address"); /* Test getting memory pool statistics where the memory handle is not * the pool start address */ UT_Report(__FILE__, __LINE__, - CFE_ES_GetMemPoolStats(&Stats, - CFE_ES_MEMHANDLE_UNDEFINED) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetMemPoolStats", - "Invalid handle; not pool start address"); + CFE_ES_GetMemPoolStats(&Stats, CFE_ES_MEMHANDLE_UNDEFINED) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetMemPoolStats", "Invalid handle; not pool start address"); /* Test allocating a pool buffer where the memory block doesn't fit within * the remaining memory */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp1, - PoolID1, - 75000) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", - "Requested pool size too large"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 75000) == CFE_ES_ERR_MEM_BLOCK_SIZE, + "CFE_ES_GetPoolBuf", "Requested pool size too large"); /* Test getting the size of an existing pool buffer using an * invalid handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == - CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBufInfo", - "Invalid memory pool handle"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle"); /* Undo the previous memory corruption */ - *((uint32*)&PoolPtr->PoolID) ^= 10; /* Repair Pool2 ID */ + *((uint32 *)&PoolPtr->PoolID) ^= 10; /* Repair Pool2 ID */ /* Test returning a pool buffer using an invalid memory block */ UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, - CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)) == CFE_ES_BUFFER_NOT_IN_POOL, - "CFE_ES_PutPoolBuf", - "Invalid memory block"); + CFE_ES_PutPoolBuf(PoolID2, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)) == CFE_ES_BUFFER_NOT_IN_POOL, + "CFE_ES_PutPoolBuf", "Invalid memory block"); /* Test initializing a pre-allocated pool specifying a number of block * sizes greater than the maximum */ ES_ResetUnitTest(); UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - sizeof(Buffer1), - CFE_PLATFORM_ES_POOL_MAX_BUCKETS + 2, - BlockSizes, + CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS + 2, BlockSizes, CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", - "Number of block sizes exceeds maximum"); + "CFE_ES_PoolCreateEx", "Number of block sizes exceeds maximum"); /* Test initializing a pre-allocated pool specifying a pool size that * is too small and using the default block size */ UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - sizeof(CFE_ES_GenPoolBD_t) / 2, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS - 2, - BlockSizes, + CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(CFE_ES_GenPoolBD_t) / 2, + CFE_PLATFORM_ES_POOL_MAX_BUCKETS - 2, BlockSizes, CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", - "Memory pool size too small (default block size)"); + "CFE_ES_PoolCreateEx", "Memory pool size too small (default block size)"); /* Test calling CFE_ES_PoolCreateEx() with NULL pointer arguments */ UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(NULL, - Buffer1, - sizeof(Buffer1), - CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - BlockSizes, + CFE_ES_PoolCreateEx(NULL, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", - "Memory pool bad arguments (NULL handle pointer)"); + "CFE_ES_PoolCreateEx", "Memory pool bad arguments (NULL handle pointer)"); UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - NULL, - sizeof(Buffer1), - CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - BlockSizes, + CFE_ES_PoolCreateEx(&PoolID1, NULL, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", - "Memory pool bad arguments (NULL mem pointer)"); + "CFE_ES_PoolCreateEx", "Memory pool bad arguments (NULL mem pointer)"); - - /* + /* * Test to use default block sizes if none are given */ UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - sizeof(Buffer1), - 0, - NULL, - CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", - "Use default block sizes when none are given"); + CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 0, NULL, CFE_ES_USE_MUTEX) == CFE_SUCCESS, + "CFE_ES_PoolCreateEx", "Use default block sizes when none are given"); /* * Test creating a memory pool after the limit reached (no slots) @@ -6371,14 +4946,9 @@ void TestESMempool(void) ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - sizeof(Buffer1), - CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - BlockSizes, + CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, CFE_ES_USE_MUTEX) == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_PoolCreateEx", - "Memory pool limit reached"); + "CFE_ES_PoolCreateEx", "Memory pool limit reached"); /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ CFE_ES_Global.MemPoolTable[1].PoolID = CFE_ES_MEMHANDLE_C(ES_UT_MakePoolIdForIndex(1)); @@ -6392,11 +4962,8 @@ void TestESMempool(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID1, - Buffer1, - sizeof(Buffer1)) == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, - "CFE_ES_PoolCreateEx", - "Memory pool mutex create error"); + CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, + "CFE_ES_PoolCreateEx", "Memory pool mutex create error"); /* * Test creating a memory pool with a semaphore error @@ -6407,13 +4974,9 @@ void TestESMempool(void) OS_MutSemCreate(&PoolPtr->MutexId, "UT", 0); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); PoolID1 = CFE_ES_MemPoolRecordGetID(PoolPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolDelete(PoolID1) == CFE_SUCCESS, - "CFE_ES_PoolDelete", + UT_Report(__FILE__, __LINE__, CFE_ES_PoolDelete(PoolID1) == CFE_SUCCESS, "CFE_ES_PoolDelete", "Memory pool delete with semaphore delete error"); - - /* Test initializing a pre-allocated pool specifying * the block size with one block size set to zero */ @@ -6423,55 +4986,32 @@ void TestESMempool(void) BlockSizes[2] = 100; BlockSizes[3] = 0; UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - sizeof(Buffer1), - 4, - BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_PoolCreateEx", - "Memory pool block size zero (block size specified)"); + CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 4, BlockSizes, CFE_ES_USE_MUTEX) == + CFE_ES_ERR_MEM_BLOCK_SIZE, + "CFE_ES_PoolCreateEx", "Memory pool block size zero (block size specified)"); BlockSizes[0] = 10; BlockSizes[1] = 50; UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - sizeof(Buffer1), - 2, - BlockSizes, - CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", - "Make space for new size"); - + CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 2, BlockSizes, CFE_ES_USE_MUTEX) == CFE_SUCCESS, + "CFE_ES_PoolCreateEx", "Make space for new size"); + /* Test successfully creating memory pool using a mutex for * subsequent tests */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID1, - Buffer1, - sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", - "Create memory pool (using mutex) [2]; successful"); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID2, - Buffer2, - sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", - "Create memory pool (no mutex) [2]; successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, + "CFE_ES_PoolCreate", "Create memory pool (using mutex) [2]; successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, + "CFE_ES_PoolCreate", "Create memory pool (no mutex) [2]; successful"); /* Test successfully allocating an additional pool buffer for * subsequent tests */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, - "CFE_ES_GetPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, - "CFE_ES_GetPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); /* Test getting the size of an existing pool buffer using an @@ -6479,201 +5019,141 @@ void TestESMempool(void) */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp1) - 1; BdPtr->Allocated ^= 717; - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == - CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", - "Invalid memory pool handle; unallocated block"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; unallocated block"); /* Test returning a pool buffer using an unallocated block */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", - "Deallocate an unallocated block"); + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_PutPoolBuf", "Deallocate an unallocated block"); - BdPtr->Allocated ^= 717; /* repair */ + BdPtr->Allocated ^= 717; /* repair */ /* Test getting the size of an existing pool buffer using an * invalid check bit pattern */ BdPtr->Allocated = 0xaaaa; BdPtr->CheckBits ^= 717; - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == - CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", - "Invalid memory pool handle; check bit pattern"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; check bit pattern"); - BdPtr->CheckBits ^= 717; /* repair */ + BdPtr->CheckBits ^= 717; /* repair */ /* Test returning a pool buffer using an invalid or corrupted * memory descriptor */ BdPtr->ActualSize = 0xFFFFFFFF; - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID1, addressp1) == - CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", - "Invalid/corrupted memory descriptor"); + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_PutPoolBuf", "Invalid/corrupted memory descriptor"); /* Test getting the size of an existing pool buffer using an * unallocated block. Use no mutex in order to get branch path coverage */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp2) - 1; BdPtr->Allocated ^= 717; - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == - CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", - "Invalid memory pool handle; unallocated block (no mutex)"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; unallocated block (no mutex)"); /* Test returning a pool buffer using an unallocated block. Use no mutex * in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", - "Deallocate an unallocated block (no mutex)"); + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_PutPoolBuf", "Deallocate an unallocated block (no mutex)"); - BdPtr->Allocated ^= 717; /* repair */ + BdPtr->Allocated ^= 717; /* repair */ /* Test getting the size of an existing pool buffer using an * invalid check bit pattern. Use no mutex in order to get branch path * coverage */ BdPtr->CheckBits ^= 717; - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == - CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", - "Invalid memory pool handle; check bit pattern (no mutex)"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; check bit pattern (no mutex)"); - BdPtr->CheckBits ^= 717; /* repair */ + BdPtr->CheckBits ^= 717; /* repair */ /* Test returning a pool buffer using an invalid or corrupted * memory descriptor. Use no mutex in order to get branch path coverage */ BdPtr->ActualSize = 0xFFFFFFFF; - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, addressp2) == - CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", - "Invalid/corrupted memory descriptor (no mutex)"); + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_PutPoolBuf", "Invalid/corrupted memory descriptor (no mutex)"); /* Test successfully creating memory pool using a mutex for * subsequent tests */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID1, - Buffer1, - sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", - "Create memory pool (using mutex) [3]; successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, + "CFE_ES_PoolCreate", "Create memory pool (using mutex) [3]; successful"); /* Test successfully allocating an additional pool buffer for * subsequent tests. Use no mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID2, - Buffer2, - sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", - "Create memory pool (using mutex) [3]; successful"); + UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, + "CFE_ES_PoolCreate", "Create memory pool (using mutex) [3]; successful"); /* Test successfully allocating an additional pool buffer for * subsequent tests */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, - "CFE_ES_GetPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, - "CFE_ES_GetPoolBuf", + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", "Allocate pool buffer [3]; successful"); /* Test returning a pool buffer using a buffer size larger than * the maximum */ - BdPtr = ((CFE_ES_GenPoolBD_t *)addressp1) - 1; - BdPtr->ActualSize = CFE_PLATFORM_ES_MAX_BLOCK_SIZE +1; - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", - "Pool buffer size exceeds maximum"); + BdPtr = ((CFE_ES_GenPoolBD_t *)addressp1) - 1; + BdPtr->ActualSize = CFE_PLATFORM_ES_MAX_BLOCK_SIZE + 1; + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_PutPoolBuf", "Pool buffer size exceeds maximum"); /* Test returning a pool buffer using a buffer size larger than * the maximum. Use no mutex in order to get branch path coverage */ - BdPtr = ((CFE_ES_GenPoolBD_t *)addressp2) - 1; - BdPtr->ActualSize =CFE_PLATFORM_ES_MAX_BLOCK_SIZE +1; - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", - "Pool buffer size exceeds maximum (no mutex)"); + BdPtr = ((CFE_ES_GenPoolBD_t *)addressp2) - 1; + BdPtr->ActualSize = CFE_PLATFORM_ES_MAX_BLOCK_SIZE + 1; + UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, + "CFE_ES_PutPoolBuf", "Pool buffer size exceeds maximum (no mutex)"); /* Test allocating an additional pool buffer using a buffer size larger * than the maximum */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, - PoolID1, - 99000) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", - "Pool buffer size exceeds maximum"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID1, 99000) == CFE_ES_ERR_MEM_BLOCK_SIZE, + "CFE_ES_GetPoolBuf", "Pool buffer size exceeds maximum"); /* Test handle validation using a null handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED) == false, - "CFE_ES_ValidateHandle", + UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED) == false, "CFE_ES_ValidateHandle", "NULL handle"); /* Test returning a pool buffer using a null handle */ UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp2) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_PutPoolBuf", - "NULL memory handle"); + "CFE_ES_PutPoolBuf", "NULL memory handle"); /* Test allocating a pool buffer using a null handle */ ES_ResetUnitTest(); UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, - CFE_ES_MEMHANDLE_UNDEFINED, - 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBuf", - "NULL memory handle"); + CFE_ES_GetPoolBuf(&addressp2, CFE_ES_MEMHANDLE_UNDEFINED, 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetPoolBuf", "NULL memory handle"); /* Test getting the size of an existing pool buffer using a null handle */ UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp1) == - CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBufInfo", - "NULL memory handle"); + CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp1) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_GetPoolBufInfo", "NULL memory handle"); /* Test initializing a pre-allocated pool specifying a small block size */ ES_ResetUnitTest(); BlockSizes[0] = 16; UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - 128, - 1, - BlockSizes, - CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", - "Allocate small memory pool"); + CFE_ES_PoolCreateEx(&PoolID1, Buffer1, 128, 1, BlockSizes, CFE_ES_USE_MUTEX) == CFE_SUCCESS, + "CFE_ES_PoolCreateEx", "Allocate small memory pool"); /* Test allocating an additional pool buffer using a buffer size larger * than the maximum. */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp1, - PoolID1, - 32) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", - "Pool buffer size exceeds maximum (no mutex)"); + UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 32) == CFE_ES_ERR_MEM_BLOCK_SIZE, + "CFE_ES_GetPoolBuf", "Pool buffer size exceeds maximum (no mutex)"); /* * Test allocating a pool buffer where the memory block doesn't fit within @@ -6689,35 +5169,26 @@ void TestESMempool(void) * successful ones is dependent on the CPU architecture and the setting of * CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN. Expect a failure within 20 allocations. */ - for (i=0; i < 25; ++i) + for (i = 0; i < 25; ++i) { - if (CFE_ES_GetPoolBuf(&addressp1, PoolID1, - 12) == CFE_ES_ERR_MEM_BLOCK_SIZE) + if (CFE_ES_GetPoolBuf(&addressp1, PoolID1, 12) == CFE_ES_ERR_MEM_BLOCK_SIZE) { break; } } - UT_Report(__FILE__, __LINE__, - i >= 1 && i <= 20, - "CFE_ES_GetPoolBuf", - "Pool fully allocated"); + UT_Report(__FILE__, __LINE__, i >= 1 && i <= 20, "CFE_ES_GetPoolBuf", "Pool fully allocated"); /* Test getting the size of a pool buffer that is not in the pool */ UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID1, - CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)) == - CFE_ES_BUFFER_NOT_IN_POOL, - "CFE_ES_GetPoolBufInfo", - "Invalid pool buffer"); + CFE_ES_GetPoolBufInfo(PoolID1, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)) == + CFE_ES_BUFFER_NOT_IN_POOL, + "CFE_ES_GetPoolBufInfo", "Invalid pool buffer"); /* Test getting the size of a pool buffer with an invalid memory handle */ UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, - addressp1) == - CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_PutPoolBuf", - "Invalid memory handle"); + CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp1) == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_PutPoolBuf", "Invalid memory handle"); } /* Tests to fill gaps in coverage in SysLog */ @@ -6726,7 +5197,7 @@ void TestSysLog(void) CFE_ES_SysLogReadBuffer_t SysLogBuffer; char LogString[(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 2]; - char TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE + 1]; + char TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE + 1]; UtPrintf("Begin Test Sys Log"); @@ -6734,81 +5205,65 @@ void TestSysLog(void) * reading at the start of a message */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->SystemLogWriteIdx = 0; - CFE_ES_ResetDataPtr->SystemLogEndIdx = sizeof(CFE_ES_ResetDataPtr->SystemLog) - 1; - + CFE_ES_ResetDataPtr->SystemLogEndIdx = sizeof(CFE_ES_ResetDataPtr->SystemLog) - 1; + memset(CFE_ES_ResetDataPtr->SystemLog, 'a', CFE_ES_ResetDataPtr->SystemLogEndIdx); - CFE_ES_ResetDataPtr->SystemLog[CFE_ES_ResetDataPtr->SystemLogEndIdx-1] = '\n'; + CFE_ES_ResetDataPtr->SystemLog[CFE_ES_ResetDataPtr->SystemLogEndIdx - 1] = '\n'; CFE_ES_SysLogReadStart_Unsync(&SysLogBuffer); UT_Report(__FILE__, __LINE__, SysLogBuffer.EndIdx == sizeof(CFE_ES_ResetDataPtr->SystemLog) - 1 && - SysLogBuffer.LastOffset == sizeof(CFE_ES_ResetDataPtr->SystemLog) - 1 && - SysLogBuffer.BlockSize == 0 && - SysLogBuffer.SizeLeft == 0, - "CFE_ES_SysLogReadStart_Unsync(SysLogBuffer)", - "ResetDataPtr pointing to an old fragment of a message"); - + SysLogBuffer.LastOffset == sizeof(CFE_ES_ResetDataPtr->SystemLog) - 1 && + SysLogBuffer.BlockSize == 0 && SysLogBuffer.SizeLeft == 0, + "CFE_ES_SysLogReadStart_Unsync(SysLogBuffer)", "ResetDataPtr pointing to an old fragment of a message"); + /* Test truncation of a sys log message that is over half * the size of the total log */ ES_ResetUnitTest(); memset(LogString, 'a', (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1); LogString[(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_ES_SysLogAppend_Unsync(LogString) == CFE_ES_ERR_SYS_LOG_TRUNCATED, - "CFE_ES_SysLogAppend_Unsync", - "Truncated sys log message"); - + UT_Report(__FILE__, __LINE__, CFE_ES_SysLogAppend_Unsync(LogString) == CFE_ES_ERR_SYS_LOG_TRUNCATED, + "CFE_ES_SysLogAppend_Unsync", "Truncated sys log message"); + /* Test code that skips writing an empty string to the sys log */ ES_ResetUnitTest(); memset(LogString, 'a', (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1); LogString[0] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_ES_SysLogAppend_Unsync(LogString) == CFE_SUCCESS, - "CFE_ES_SysLogAppend_Unsync", + UT_Report(__FILE__, __LINE__, CFE_ES_SysLogAppend_Unsync(LogString) == CFE_SUCCESS, "CFE_ES_SysLogAppend_Unsync", "Don't log an empty string"); - + /* Test Reading space between the current read offset and end of the log buffer */ ES_ResetUnitTest(); - SysLogBuffer.EndIdx = 3; + SysLogBuffer.EndIdx = 3; SysLogBuffer.LastOffset = 0; - SysLogBuffer.BlockSize = 3; - SysLogBuffer.SizeLeft = 1; - + SysLogBuffer.BlockSize = 3; + SysLogBuffer.SizeLeft = 1; + CFE_ES_SysLogReadData(&SysLogBuffer); - + UT_Report(__FILE__, __LINE__, - SysLogBuffer.EndIdx == 3 && - SysLogBuffer.LastOffset == 1 && - SysLogBuffer.BlockSize == 1 && - SysLogBuffer.SizeLeft == 0, - "CFE_ES_SysLogReadData", - "Read space between current offset and end of log buffer"); - + SysLogBuffer.EndIdx == 3 && SysLogBuffer.LastOffset == 1 && SysLogBuffer.BlockSize == 1 && + SysLogBuffer.SizeLeft == 0, + "CFE_ES_SysLogReadData", "Read space between current offset and end of log buffer"); + /* Test nominal flow through CFE_ES_SysLogDump * with multiple reads and writes */ ES_ResetUnitTest(); CFE_ES_ResetDataPtr->SystemLogWriteIdx = 0; - CFE_ES_ResetDataPtr->SystemLogEndIdx = sizeof(CFE_ES_ResetDataPtr->SystemLog) - 1; - + CFE_ES_ResetDataPtr->SystemLogEndIdx = sizeof(CFE_ES_ResetDataPtr->SystemLog) - 1; + CFE_ES_SysLogDump("fakefilename"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_ES_SysLogDump", - "Multiple reads and writes to sys log"); - + UT_Report(__FILE__, __LINE__, true, "CFE_ES_SysLogDump", "Multiple reads and writes to sys log"); + /* Test "message got truncated" */ ES_ResetUnitTest(); memset(TmpString, 'a', CFE_ES_MAX_SYSLOG_MSG_SIZE); TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE] = '\0'; - - CFE_ES_WriteToSysLog("%s",TmpString); - UT_Report(__FILE__, __LINE__, - true, - "CFE_ES_WriteToSysLog", - "Truncate message"); - + + CFE_ES_WriteToSysLog("%s", TmpString); + UT_Report(__FILE__, __LINE__, true, "CFE_ES_WriteToSysLog", "Truncate message"); } void TestBackground(void) @@ -6820,7 +5275,8 @@ void TestBackground(void) */ ES_ResetUnitTest(); status = CFE_ES_BackgroundInit(); - UtAssert_True(status == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_BackgroundInit - CFE_ES_CreateChildTask failure (%08x)", (unsigned int)status); + UtAssert_True(status == CFE_ES_ERR_RESOURCEID_NOT_VALID, + "CFE_ES_BackgroundInit - CFE_ES_CreateChildTask failure (%08x)", (unsigned int)status); /* The CFE_ES_BackgroundCleanup() function has no conditionals - * it just needs to be executed as part of this routine, @@ -6837,10 +5293,8 @@ void TestBackground(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_TaskRegister), 1, -1); CFE_ES_BackgroundTask(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_REGISTER]), - "CFE_ES_BackgroundTask", - "Failed to register error"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_REGISTER]), + "CFE_ES_BackgroundTask", "Failed to register error"); /* * When testing the background task loop, it is normally an infinite loop, @@ -6850,18 +5304,15 @@ void TestBackground(void) * execute the code which counts the number of active jobs. */ ES_ResetUnitTest(); - memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, - sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); + memset(&CFE_ES_TaskData.BackgroundPerfDumpState, 0, sizeof(CFE_ES_TaskData.BackgroundPerfDumpState)); UT_SetDefaultReturnValue(UT_KEY(OS_write), -10); CFE_ES_TaskData.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTimedWait), 3, -4); CFE_ES_BackgroundTask(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_TAKE]), - "CFE_ES_BackgroundTask", - "Failed to take background sem"); + UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_TAKE]), + "CFE_ES_BackgroundTask", "Failed to take background sem"); /* The number of jobs running should be 1 (perf log dump) */ UtAssert_True(CFE_ES_Global.BackgroundTask.NumJobsRunning == 1, - "CFE_ES_BackgroundTask - Nominal, CFE_ES_Global.BackgroundTask.NumJobsRunning (%u) == 1", - (unsigned int)CFE_ES_Global.BackgroundTask.NumJobsRunning); + "CFE_ES_BackgroundTask - Nominal, CFE_ES_Global.BackgroundTask.NumJobsRunning (%u) == 1", + (unsigned int)CFE_ES_Global.BackgroundTask.NumJobsRunning); } diff --git a/modules/es/ut-coverage/es_UT.h b/modules/es/ut-coverage/es_UT.h index 68fa658a6..4f15727d2 100644 --- a/modules/es/ut-coverage/es_UT.h +++ b/modules/es/ut-coverage/es_UT.h @@ -136,7 +136,7 @@ void TestApps(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void TestERLog(void); @@ -153,7 +153,7 @@ void TestERLog(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void TestTask(void); @@ -185,7 +185,7 @@ void TestBackground(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void TestPerf(void); @@ -200,7 +200,7 @@ void TestPerf(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void TestAPI(void); @@ -216,7 +216,7 @@ void TestAPI(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void TestCDS(void); @@ -233,7 +233,7 @@ void TestCDS(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void TestCDSMempool(void); @@ -250,7 +250,7 @@ void TestCDSMempool(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void TestESMempool(void); diff --git a/modules/evs/fsw/inc/cfe_evs_events.h b/modules/evs/fsw/inc/cfe_evs_events.h index 20d6b1fbf..e946a06cc 100644 --- a/modules/evs/fsw/inc/cfe_evs_events.h +++ b/modules/evs/fsw/inc/cfe_evs_events.h @@ -42,7 +42,7 @@ ** and when you're done adding, set this to the highest EID you used. It may ** be worthwhile to, on occasion, re-number the EID's to put them back in order. */ -#define CFE_EVS_MAX_EID 43 +#define CFE_EVS_MAX_EID 43 /* Event Service event ID's */ @@ -53,13 +53,13 @@ ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Event Services \link #CFE_EVS_NOOP_CC NO-OP command \endlink **/ -#define CFE_EVS_NOOP_EID 0 /* Noop event identifier */ +#define CFE_EVS_NOOP_EID 0 /* Noop event identifier */ /** \brief 'cFE EVS Initialized' -** \event 'cFE EVS Initialized' +** \event 'cFE EVS Initialized' ** ** \par Type: INFORMATION ** @@ -68,10 +68,10 @@ ** This event message is always automatically issued when the Event Services ** Task completes its Initialization. **/ -#define CFE_EVS_STARTUP_EID 1 +#define CFE_EVS_STARTUP_EID 1 /** \brief 'Write Log File Command Error: OS_write = 0x\%08X, filename = \%s' -** \event 'Write Log File Command Error: OS_write = 0x\%08X, filename = \%s' +** \event 'Write Log File Command Error: OS_write = 0x\%08X, filename = \%s' ** ** \par Type: ERROR ** @@ -85,7 +85,7 @@ ** which in this case should be equal to the size of a #CFE_EVS_LongEventTlm_t structure. Error ** codes are negative. **/ -#define CFE_EVS_ERR_WRLOGFILE_EID 2 +#define CFE_EVS_ERR_WRLOGFILE_EID 2 /** \brief 'Write Log File Command Error: OS_OpenCreate = 0x\%08X, filename = \%s' ** \event 'Write Log File Command Error: OS_OpenCreate = 0x\%08X, filename = \%s' @@ -101,10 +101,10 @@ ** from the system function call. The expected return value is a file handle, which in this case ** should be a relatively small positive number. Error codes are negative. **/ -#define CFE_EVS_ERR_CRLOGFILE_EID 3 +#define CFE_EVS_ERR_CRLOGFILE_EID 3 /** \brief 'Invalid command packet, Message ID = 0x\%08X' -** \event 'Invalid command packet, Message ID = 0x\%08X' +** \event 'Invalid command packet, Message ID = 0x\%08X' ** ** \par Type: ERROR ** @@ -115,15 +115,15 @@ ** Message ID that is neither #CFE_EVS_CMD_MID or #CFE_EVS_SEND_HK_MID. ** Most likely, the cFE Software Bus routing table has become corrupt ** and is sending messages targeted for other Applications to the cFE -** Event Services Application. +** Event Services Application. ** ** The \c ID field in the event message identifies ** the message ID (in hex) that was found in the message. **/ -#define CFE_EVS_ERR_MSGID_EID 5 +#define CFE_EVS_ERR_MSGID_EID 5 /** \brief '\%s Event ID \%d not registered for filtering: CC = \%lu' -** \event '\%s Event ID \%d not registered for filtering: CC = \%lu' +** \event '\%s Event ID \%d not registered for filtering: CC = \%lu' ** ** \par Type: ERROR ** @@ -137,10 +137,10 @@ ** The \c CC field specifies the Command Code whose processing generated the event message. It can ** be equal to either #CFE_EVS_SET_FILTER_CC, #CFE_EVS_RESET_FILTER_CC, or #CFE_EVS_DELETE_EVENT_FILTER_CC. **/ -#define CFE_EVS_ERR_EVTIDNOREGS_EID 6 +#define CFE_EVS_ERR_EVTIDNOREGS_EID 6 /** \brief '\%s not registered with EVS: CC = \%lu' -** \event '\%s not registered with EVS: CC = \%lu' +** \event '\%s not registered with EVS: CC = \%lu' ** ** \par Type: ERROR ** @@ -151,10 +151,11 @@ ** ** The \c CC field contains the Command Code whose processing resulted in the generation of the event message. ** Possible values are #CFE_EVS_SET_FILTER_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, -** #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC, #CFE_EVS_RESET_APP_COUNTER_CC, #CFE_EVS_RESET_FILTER_CC, +** #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC, #CFE_EVS_RESET_APP_COUNTER_CC, +*#CFE_EVS_RESET_FILTER_CC, ** #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, or #CFE_EVS_DELETE_EVENT_FILTER_CC. **/ -#define CFE_EVS_ERR_APPNOREGS_EID 7 +#define CFE_EVS_ERR_APPNOREGS_EID 7 /** \brief 'Illegal application ID \%d retrieved for \%s: CC = \%lu' ** \event 'Illegal application ID \%d retrieved for \%s: CC = \%lu' @@ -168,13 +169,14 @@ ** ** The \c CC field contains the Command Code whose processing resulted in the generation of the event message. ** Possible values are #CFE_EVS_SET_FILTER_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, -** #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC, #CFE_EVS_RESET_APP_COUNTER_CC, #CFE_EVS_RESET_FILTER_CC, +** #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC, #CFE_EVS_RESET_APP_COUNTER_CC, +*#CFE_EVS_RESET_FILTER_CC, ** #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, or #CFE_EVS_DELETE_EVENT_FILTER_CC. **/ -#define CFE_EVS_ERR_ILLAPPIDRANGE_EID 8 +#define CFE_EVS_ERR_ILLAPPIDRANGE_EID 8 /** \brief 'Unable to retrieve application ID for \%s: CC = \%lu' -** \event 'Unable to retrieve application ID for \%s: CC = \%lu' +** \event 'Unable to retrieve application ID for \%s: CC = \%lu' ** ** \par Type: ERROR ** @@ -185,13 +187,14 @@ ** ** The \c CC field contains the Command Code whose processing resulted in the generation of the event message. ** Possible values are #CFE_EVS_SET_FILTER_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, -** #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC, #CFE_EVS_RESET_APP_COUNTER_CC, #CFE_EVS_RESET_FILTER_CC, +** #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC, #CFE_EVS_RESET_APP_COUNTER_CC, +*#CFE_EVS_RESET_FILTER_CC, ** #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, or #CFE_EVS_DELETE_EVENT_FILTER_CC. **/ -#define CFE_EVS_ERR_NOAPPIDFOUND_EID 9 +#define CFE_EVS_ERR_NOAPPIDFOUND_EID 9 /** \brief 'Set Event Format Mode Command: Invalid Event Format Mode = 0x\%02x' -** \event 'Set Event Format Mode Command: Invalid Event Format Mode = 0x\%02x' +** \event 'Set Event Format Mode Command: Invalid Event Format Mode = 0x\%02x' ** ** \par Type: ERROR ** @@ -201,14 +204,14 @@ ** message has arrived and the #CFE_EVS_SetLogMode_Payload_t::LogMode field is equal to ** neither #CFE_EVS_MsgFormat_SHORT or #CFE_EVS_MsgFormat_LONG. These are ** the only allowed values for the mode field. -** +** ** The \c Mode field in the event message identifies ** the Mode value (in hex) that was found in the message. **/ -#define CFE_EVS_ERR_ILLEGALFMTMOD_EID 10 +#define CFE_EVS_ERR_ILLEGALFMTMOD_EID 10 /** \brief 'Add Filter Command: number of registered filters has reached max = \%d' -** \event 'Add Filter Command: number of registered filters has reached max = \%d' +** \event 'Add Filter Command: number of registered filters has reached max = \%d' ** ** \par Type: ERROR ** @@ -222,10 +225,10 @@ ** event filters allowed per Application. This value should be equal to ** the configuration parameter #CFE_PLATFORM_EVS_MAX_EVENT_FILTERS. **/ -#define CFE_EVS_ERR_MAXREGSFILTER_EID 11 +#define CFE_EVS_ERR_MAXREGSFILTER_EID 11 /** \brief 'Write App Data Command Error: OS_write = 0x\%08X, filename = \%s' -** \event 'Write App Data Command Error: OS_write = 0x\%08X, filename = \%s' +** \event 'Write App Data Command Error: OS_write = 0x\%08X, filename = \%s' ** ** \par Type: ERROR ** @@ -239,10 +242,10 @@ ** which in this case should be equal to the size of a CFE_EVS_AppDataFile_t structure. Error ** codes are negative. **/ -#define CFE_EVS_ERR_WRDATFILE_EID 12 +#define CFE_EVS_ERR_WRDATFILE_EID 12 /** \brief 'Write App Data Command Error: OS_OpenCreate = 0x\%08X, filename = \%s' -** \event 'Write App Data Command Error: OS_OpenCreate = 0x\%08X, filename = \%s' +** \event 'Write App Data Command Error: OS_OpenCreate = 0x\%08X, filename = \%s' ** ** \par Type: ERROR ** @@ -255,7 +258,7 @@ ** from the system function call. The expected return value is a file handle, which in this case ** should be a relatively small positive number. Error codes are negative. **/ -#define CFE_EVS_ERR_CRDATFILE_EID 13 +#define CFE_EVS_ERR_CRDATFILE_EID 13 /** \brief 'Invalid command code -- ID = 0x\%08x, CC = \%d' ** \event 'Invalid command code -- ID = 0x\%08x, CC = \%d' @@ -272,25 +275,25 @@ ** -# The Command Code field in the Message became corrupted. ** -# The command database at the ground station has been corrupted. ** -** The \c ID field in the event message specifies the Message ID (in hex) and the -** \c CC field specifies the Command Code (in decimal) found in the message. +** The \c ID field in the event message specifies the Message ID (in hex) and the +** \c CC field specifies the Command Code (in decimal) found in the message. **/ -#define CFE_EVS_ERR_CC_EID 15 +#define CFE_EVS_ERR_CC_EID 15 /** \brief 'Reset Counters Command Received' -** \event 'Reset Counters Command Received' +** \event 'Reset Counters Command Received' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Event Services Reset Counters command **/ -#define CFE_EVS_RSTCNT_EID 16 +#define CFE_EVS_RSTCNT_EID 16 /** \brief 'Set Filter Mask Command Received with AppName=\%s, EventID=0x\%08x, Mask=0x\%04x' -** \event 'Set Filter Mask Command Received with AppName=\%s, EventID=0x\%08x, Mask=0x\%04x' +** \event 'Set Filter Mask Command Received with AppName=\%s, EventID=0x\%08x, Mask=0x\%04x' ** ** \par Type: DEBUG ** @@ -302,10 +305,10 @@ ** The \c EventID field identifies the Event whose Filter Mask has been changed. ** The \c Mask field identifies the new Mask value associated with the specified event. **/ -#define CFE_EVS_SETFILTERMSK_EID 17 +#define CFE_EVS_SETFILTERMSK_EID 17 /** \brief 'Enable Ports Command Received with Port Bit Mask = 0x\%02x' -** \event 'Enable Ports Command Received with Port Bit Mask = 0x\%02x' +** \event 'Enable Ports Command Received with Port Bit Mask = 0x\%02x' ** ** \par Type: DEBUG ** @@ -316,10 +319,10 @@ ** The \c Mask field identifies the ports that are enabled. ** Mask bits are defined by #CFE_EVS_PORT1_BIT, #CFE_EVS_PORT2_BIT, #CFE_EVS_PORT3_BIT and #CFE_EVS_PORT4_BIT. **/ -#define CFE_EVS_ENAPORT_EID 18 +#define CFE_EVS_ENAPORT_EID 18 /** \brief 'Disable Ports Command Received with Port Bit Mask = 0x\%02x' -** \event 'Disable Ports Command Received with Port Bit Mask = 0x\%02x' +** \event 'Disable Ports Command Received with Port Bit Mask = 0x\%02x' ** ** \par Type: DEBUG ** @@ -330,10 +333,10 @@ ** The \c Mask field identifies (in hex) the ports are to be disabled. ** Mask bits are defined by #CFE_EVS_PORT1_BIT, #CFE_EVS_PORT2_BIT, #CFE_EVS_PORT3_BIT and #CFE_EVS_PORT4_BIT. **/ -#define CFE_EVS_DISPORT_EID 19 +#define CFE_EVS_DISPORT_EID 19 /** \brief 'Enable Event Type Command Received with Event Type Bit Mask = 0x\%02x' -** \event 'Enable Event Type Command Received with Event Type Bit Mask = 0x\%02x' +** \event 'Enable Event Type Command Received with Event Type Bit Mask = 0x\%02x' ** ** \par Type: DEBUG ** @@ -342,13 +345,13 @@ ** This event message is issued upon successful processing of the "Enable Event Type" command. ** ** The \c Mask field identifies the Event Types that are enabled. -** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, +** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, ** #CFE_EVS_ERROR_BIT and #CFE_EVS_CRITICAL_BIT. **/ -#define CFE_EVS_ENAEVTTYPE_EID 20 +#define CFE_EVS_ENAEVTTYPE_EID 20 /** \brief 'Disable Event Type Command Received with Event Type Bit Mask = 0x\%02x' -** \event 'Disable Event Type Command Received with Event Type Bit Mask = 0x\%02x' +** \event 'Disable Event Type Command Received with Event Type Bit Mask = 0x\%02x' ** ** \par Type: DEBUG ** @@ -357,13 +360,13 @@ ** This event message is issued upon successful processing of the "Disable Event Type" command. ** ** The \c Mask field identifies the Event Types that are disabled. -** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, +** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, ** #CFE_EVS_ERROR_BIT and #CFE_EVS_CRITICAL_BIT. **/ -#define CFE_EVS_DISEVTTYPE_EID 21 +#define CFE_EVS_DISEVTTYPE_EID 21 /** \brief 'Set Event Format Mode Command Received with Mode = 0x\%02x' -** \event 'Set Event Format Mode Command Received with Mode = 0x\%02x' +** \event 'Set Event Format Mode Command Received with Mode = 0x\%02x' ** ** \par Type: DEBUG ** @@ -374,10 +377,10 @@ ** The \c Mode field contains the newly chosen Event Format Mode (specified in hex). Acceptable values ** for this parameter are: #CFE_EVS_MsgFormat_SHORT or #CFE_EVS_MsgFormat_LONG **/ -#define CFE_EVS_SETEVTFMTMOD_EID 22 +#define CFE_EVS_SETEVTFMTMOD_EID 22 /** \brief 'Enable App Event Type Command Received with AppName = \%s, EventType Bit Mask = 0x\%02x' -** \event 'Enable App Event Type Command Received with AppName = \%s, EventType Bit Mask = 0x\%02x' +** \event 'Enable App Event Type Command Received with AppName = \%s, EventType Bit Mask = 0x\%02x' ** ** \par Type: DEBUG ** @@ -387,13 +390,13 @@ ** ** The \c AppName field identifies the Application whose Event Type Enable status has changed and the ** \c Mask field specifies (in hex) the Event Types that have been enabled. -** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, +** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, ** #CFE_EVS_ERROR_BIT and #CFE_EVS_CRITICAL_BIT. **/ -#define CFE_EVS_ENAAPPEVTTYPE_EID 23 +#define CFE_EVS_ENAAPPEVTTYPE_EID 23 /** \brief 'Disable App Event Type Command Received with AppName = \%s, EventType Bit Mask = 0x\%02x' -** \event 'Disable App Event Type Command Received with AppName = \%s, EventType Bit Mask = 0x\%02x' +** \event 'Disable App Event Type Command Received with AppName = \%s, EventType Bit Mask = 0x\%02x' ** ** \par Type: DEBUG ** @@ -403,12 +406,12 @@ ** ** The \c AppName field identifies the Application whose Event Type Disable status has changed and the ** \c Mask field specifies (in hex) the Event Types that have been disabled. -** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, +** Mask bits are defined by #CFE_EVS_DEBUG_BIT, #CFE_EVS_INFORMATION_BIT, ** #CFE_EVS_ERROR_BIT and #CFE_EVS_CRITICAL_BIT. **/ -#define CFE_EVS_DISAPPENTTYPE_EID 24 +#define CFE_EVS_DISAPPENTTYPE_EID 24 -/** \brief 'Enable App Events Command Received with AppName = \%s' +/** \brief 'Enable App Events Command Received with AppName = \%s' ** \event 'Enable App Events Command Received with AppName = \%s' ** ** \par Type: DEBUG @@ -419,10 +422,10 @@ ** ** The \c AppName field identifies the Application whose Events have been Enabled. **/ -#define CFE_EVS_ENAAPPEVT_EID 25 +#define CFE_EVS_ENAAPPEVT_EID 25 /** \brief 'Disable App Events Command Received with AppName = \%s' -** \event 'Disable App Events Command Received with AppName = \%s' +** \event 'Disable App Events Command Received with AppName = \%s' ** ** \par Type: DEBUG ** @@ -432,10 +435,10 @@ ** ** The \c AppName field identifies the Application whose Events have been Disabled. **/ -#define CFE_EVS_DISAPPEVT_EID 26 +#define CFE_EVS_DISAPPEVT_EID 26 /** \brief 'Reset Event Counter Command Received with AppName = \%s' -** \event 'Reset Event Counter Command Received with AppName = \%s' +** \event 'Reset Event Counter Command Received with AppName = \%s' ** ** \par Type: DEBUG ** @@ -445,10 +448,10 @@ ** ** The \c AppName field identifies the Application whose Event Counter has been reset. **/ -#define CFE_EVS_RSTEVTCNT_EID 27 +#define CFE_EVS_RSTEVTCNT_EID 27 /** \brief 'Reset Filter Command Received with AppName = \%s, EventID = 0x\%08x' -** \event 'Reset Filter Command Received with AppName = \%s, EventID = 0x\%08x' +** \event 'Reset Filter Command Received with AppName = \%s, EventID = 0x\%08x' ** ** \par Type: DEBUG ** @@ -459,10 +462,10 @@ ** The \c AppName field identifies the Application whose Event Message Filter has been reset and ** the \c EventID field identifies the specific event message whose filter has been reset. **/ -#define CFE_EVS_RSTFILTER_EID 28 +#define CFE_EVS_RSTFILTER_EID 28 /** \brief 'Reset All Filters Command Received with AppName = \%s' -** \event 'Reset All Filters Command Received with AppName = \%s' +** \event 'Reset All Filters Command Received with AppName = \%s' ** ** \par Type: DEBUG ** @@ -472,9 +475,9 @@ ** ** The \c AppName field identifies the Application whose entire set of Event Filters has been reset. **/ -#define CFE_EVS_RSTALLFILTER_EID 29 +#define CFE_EVS_RSTALLFILTER_EID 29 -/** \brief 'Add Filter Command Received with AppName = \%s, EventID = 0x\%08x, Mask = 0x\%04x' +/** \brief 'Add Filter Command Received with AppName = \%s, EventID = 0x\%08x, Mask = 0x\%04x' ** \event 'Add Filter Command Received with AppName = \%s, EventID = 0x\%08x, Mask = 0x\%04x' ** ** \par Type: DEBUG @@ -487,9 +490,9 @@ ** identifies the Event Identifier, in hex, that is getting the filter, and the \c Mask field specifies, in hex, ** what the binary filter mask has been set to. **/ -#define CFE_EVS_ADDFILTER_EID 30 +#define CFE_EVS_ADDFILTER_EID 30 -/** \brief 'Delete Filter Command Received with AppName = \%s, EventID = 0x\%08x' +/** \brief 'Delete Filter Command Received with AppName = \%s, EventID = 0x\%08x' ** \event 'Delete Filter Command Received with AppName = \%s, EventID = 0x\%08x' ** ** \par Type: DEBUG @@ -501,22 +504,22 @@ ** The \c AppName field identifies the Application who is getting the filter removed, the \c EventID field ** identifies the Event Identifier, in hex, whose filter is being deleted. **/ -#define CFE_EVS_DELFILTER_EID 31 +#define CFE_EVS_DELFILTER_EID 31 -/** \brief 'Write App Data Command: \%d application data entries written to \%s' -** \event 'Write App Data Command: \%d application data entries written to \%s' +/** \brief 'Write App Data Command: \%d application data entries written to \%s' +** \event 'Write App Data Command: \%d application data entries written to \%s' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is generated upon successful completion of the +** This event message is generated upon successful completion of the ** \link #CFE_EVS_WRITE_APP_DATA_FILE_CC "Write Event Services Application Information to File" \endlink command. ** ** The message text identifies the event log filename and specifies the number, in decimal, ** of events written to the file. **/ -#define CFE_EVS_WRDAT_EID 32 +#define CFE_EVS_WRDAT_EID 32 /** \brief 'Write Log File Command: \%d event log entries written to \%s' ** \event 'Write Log File Command: \%d event log entries written to \%s' @@ -525,16 +528,16 @@ ** ** \par Cause: ** -** This event message is generated upon successful completion of the +** This event message is generated upon successful completion of the ** \link #CFE_EVS_WRITE_LOG_DATA_FILE_CC "Write Event Log to File" \endlink command. ** ** The message text identifies the event log filename and specifies the number, in decimal, ** of events written to the file. **/ -#define CFE_EVS_WRLOG_EID 33 +#define CFE_EVS_WRLOG_EID 33 /** \brief 'Add Filter Command:AppName = \%s, EventID = 0x\%08x is already registered for filtering' -** \event 'Add Filter Command:AppName = \%s, EventID = 0x\%08x is already registered for filtering' +** \event 'Add Filter Command:AppName = \%s, EventID = 0x\%08x is already registered for filtering' ** ** \par Type: ERROR ** @@ -546,9 +549,9 @@ ** The \c AppName field identifies the Application whose filter was to be added and the \c EventID field identifies, ** in hex, the Event ID that the command was trying to add a filter for. **/ -#define CFE_EVS_EVT_FILTERED_EID 37 +#define CFE_EVS_EVT_FILTERED_EID 37 -/** \brief 'Set Log Mode Command Error: Log Mode = \%d' +/** \brief 'Set Log Mode Command Error: Log Mode = \%d' ** \event 'Set Log Mode Command Error: Log Mode = \%d' ** ** \par Type: DEBUG @@ -560,10 +563,10 @@ ** The event text identifies the Log Mode command argument. Valid Log Mode command ** arguments are: #CFE_EVS_LOG_OVERWRITE or #CFE_EVS_LOG_DISCARD. **/ -#define CFE_EVS_LOGMODE_EID 38 +#define CFE_EVS_LOGMODE_EID 38 /** \brief 'Set Log Mode Command Error: Log Mode = \%d' -** \event 'Set Log Mode Command Error: Log Mode = \%d +** \event 'Set Log Mode Command Error: Log Mode = \%d ** ** \par Type: ERROR ** @@ -571,11 +574,11 @@ ** ** This event message is generated when a "Set Log Mode" command is received that specifies ** an invalid Log Mode command argument. -** +** ** The event text identifies the invalid Log Mode command argument. Valid Log Mode command ** arguments are: #CFE_EVS_LOG_OVERWRITE or #CFE_EVS_LOG_DISCARD. **/ -#define CFE_EVS_ERR_LOGMODE_EID 39 +#define CFE_EVS_ERR_LOGMODE_EID 39 /** \brief 'Bit Mask = 0x\%X out of range: CC = \%lu' ** \event 'Bit Mask = 0x\%X out of range: CC = \%lu' @@ -584,10 +587,10 @@ ** ** \par Cause: ** -** This event message is generated when the bit mask passed in is equal to zero or greater than 0x0F, because a +** This event message is generated when the bit mask passed in is equal to zero or greater than 0x0F, because a ** bit mask of zero does nothing, and a bitmask of greater than 0x0F is invalid. **/ -#define CFE_EVS_ERR_INVALID_BITMASK_EID 40 +#define CFE_EVS_ERR_INVALID_BITMASK_EID 40 /** \brief 'App \%s not registered with Event Services. Unable to send event' ** \event 'App \%s not registered with Event Services. Unable to send event' @@ -597,29 +600,29 @@ ** \par Cause: ** ** This event message is generated when an event message has been requested to be sent by an Application that -** has not registered itself with cFE Event Services. +** has not registered itself with cFE Event Services. **/ -#define CFE_EVS_ERR_UNREGISTERED_EVS_APP 41 +#define CFE_EVS_ERR_UNREGISTERED_EVS_APP 41 /** \brief 'Max filter count reached, AppName = \%s, EventID = 0x\%08x: Filter locked until reset' -** \event 'Max filter count reached, AppName = \%s, EventID = 0x\%08x: Filter locked until reset' +** \event 'Max filter count reached, AppName = \%s, EventID = 0x\%08x: Filter locked until reset' ** ** \par Type: INFORMATIONAL ** ** \par Cause: ** -** This event message is generated when the filtering count for a specific App and Event ID reaches CFE_EVS_MAX_FILTER_COUNT -** The filtered event will no longer be received until the reset counter is reset via a +** This event message is generated when the filtering count for a specific App and Event ID reaches +** CFE_EVS_MAX_FILTER_COUNT. The filtered event will no longer be received until the reset counter is reset via a ** \link #CFE_EVS_RESET_FILTER_CC "Reset an Event Filter for an Application" \endlink or a ** \link #CFE_EVS_RESET_ALL_FILTERS_CC "Reset All Event Filters for an Application" \endlink -** +** ** The \c AppName field identifies the Application and the \c EventID field identifies, in hex, the Event ID ** for the filter whose maxium was reached. **/ -#define CFE_EVS_FILTER_MAX_EID 42 +#define CFE_EVS_FILTER_MAX_EID 42 /** \brief 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' -** \event 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' +** \event 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' ** ** \par Type: ERROR ** @@ -632,9 +635,8 @@ ** The \c ID field in the event message specifies the Message ID (in hex), the \c CC field ** specifies the Command Code (in decimal), the \c Exp Len field specified the Expected ** Length (in decimal ), and \c Len specifies the message Length (in decimal) -** found in the message. +** found in the message. **/ -#define CFE_EVS_LEN_ERR_EID 43 - -#endif /* _cfe_evs_events_ */ +#define CFE_EVS_LEN_ERR_EID 43 +#endif /* _cfe_evs_events_ */ diff --git a/modules/evs/fsw/inc/cfe_evs_msg.h b/modules/evs/fsw/inc/cfe_evs_msg.h index c5434ea70..5f56e2408 100644 --- a/modules/evs/fsw/inc/cfe_evs_msg.h +++ b/modules/evs/fsw/inc/cfe_evs_msg.h @@ -23,10 +23,10 @@ ** ** Title: Event Services Message definition header file Header File ** -** Purpose: +** Purpose: ** Unit specification for Event services command codes and data structures. ** -** Design Notes: +** Design Notes: ** ** References: ** Flight Software Branch C Coding Standard Version 1.0a @@ -36,20 +36,19 @@ #define _cfe_evs_msg_ /********************************** Include Files ************************************/ -#include "common_types.h" /* Basic data types */ -#include "cfe_msg_hdr.h" /* for header definitions */ +#include "common_types.h" /* Basic data types */ +#include "cfe_msg_hdr.h" /* for header definitions */ #include "cfe_evs_extern_typedefs.h" /* for EVS-specific types such as CFE_EVS_LogMode_Enum_t */ #include "cfe_es_extern_typedefs.h" /* for CFE_ES_AppId_t type */ - /** \name Event Services Command Codes */ /** \{ */ /** \cfeevscmd Event Services No-Op ** ** \par Description -** This command performs no other function than to increment the -** command execution counter. The command may be used to verify +** This command performs no other function than to increment the +** command execution counter. The command may be used to verify ** general aliveness of the Event Services task. ** ** \cfecmdmnemonic \EVS_NOOP @@ -58,30 +57,30 @@ ** #CFE_EVS_NoopCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The #CFE_EVS_NOOP_EID informational event message will +** - The #CFE_EVS_NOOP_EID informational event message will ** be generated ** ** \par Error Conditions -** There are no error conditions for this command. If the Event -** Services receives the command, the event is sent (although it -** may be filtered by EVS itself) and the counter is incremented +** There are no error conditions for this command. If the Event +** Services receives the command, the event is sent (although it +** may be filtered by EVS itself) and the counter is incremented ** unconditionally. ** ** \par Criticality ** None ** -** \sa +** \sa */ -#define CFE_EVS_NOOP_CC 0 +#define CFE_EVS_NOOP_CC 0 /** \cfeevscmd Event Services Reset Counters ** ** \par Description -** This command resets the following counters within the Event +** This command resets the following counters within the Event ** Services housekeeping telemetry: ** - Command Execution Counter (\EVS_CMDPC) ** - Command Error Counter (\EVS_CMDEC) @@ -92,37 +91,37 @@ ** #CFE_EVS_ResetCountersCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The #CFE_EVS_RSTCNT_EID debug event message will be +** - The #CFE_EVS_RSTCNT_EID debug event message will be ** generated ** ** \par Error Conditions -** There are no error conditions for this command. If the Event -** Services receives the command, the event is sent (although it -** may be filtered by EVS) and the counter is incremented +** There are no error conditions for this command. If the Event +** Services receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented ** unconditionally. ** ** \par Criticality -** This command is not inherently dangerous. However, it is -** possible for ground systems and on-board safing procedures -** to be designed such that they react to changes in the counter +** This command is not inherently dangerous. However, it is +** possible for ground systems and on-board safing procedures +** to be designed such that they react to changes in the counter ** values that are reset by this command. ** ** \sa #CFE_EVS_RESET_APP_COUNTER_CC */ -#define CFE_EVS_RESET_COUNTERS_CC 1 +#define CFE_EVS_RESET_COUNTERS_CC 1 /** \cfeevscmd Enable Event Type ** ** \par Description ** This command enables the command specified Event Type allowing event ** messages of this type to be sent through Event Service. An Event Type -** is defined to be a classification of an Event Message such as debug, -** informational, error and critical. This command is a global enable of a -** particular event type, it applies to all applications. +** is defined to be a classification of an Event Message such as debug, +** informational, error and critical. This command is a global enable of a +** particular event type, it applies to all applications. ** ** \cfecmdmnemonic \EVS_ENAEVENTTYPE ** @@ -133,16 +132,16 @@ ** Bit 1 - Informational ** Bit 2 - Error ** Bit 3 - Critical -** A one in a bit position means the event type will be enabled (or unfiltered). +** A one in a bit position means the event type will be enabled (or unfiltered). ** A zero in a bit position means the filtering state is unchanged. ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** -** - \b \c \EVS_CMDPC - command execution counter will +** +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_ENAEVTTYPE_EID debug message +** - The generation of #CFE_EVS_ENAEVTTYPE_EID debug message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -154,23 +153,23 @@ ** - An Error specific event message ** ** \par Criticality -** Enabling an event type is not particularly hazardous, as the result may -** be turning on necessary event messages and communication to the ground -** system. However, inappropriately enabling an event type could result +** Enabling an event type is not particularly hazardous, as the result may +** be turning on necessary event messages and communication to the ground +** system. However, inappropriately enabling an event type could result ** in flooding of the system. ** -** \sa #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, +** \sa #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, ** #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC */ -#define CFE_EVS_ENABLE_EVENT_TYPE_CC 2 +#define CFE_EVS_ENABLE_EVENT_TYPE_CC 2 /** \cfeevscmd Disable Event Type ** ** \par Description ** This command disables the command specified Event Type preventing event ** messages of this type to be sent through Event Service. An Event Type -** is defined to be a classification of an Event Message such as debug, -** informational, error and critical. This command is a global disable of a +** is defined to be a classification of an Event Message such as debug, +** informational, error and critical. This command is a global disable of a ** particular event type, it applies to all applications. ** ** \cfecmdmnemonic \EVS_DISEVENTTYPE @@ -182,52 +181,52 @@ ** Bit 1 - Informational ** Bit 2 - Error ** Bit 3 - Critical -** A one in a bit position means the event type will be disabled (or filtered). +** A one in a bit position means the event type will be disabled (or filtered). ** A zero in a bit position means the filtering state is unchanged. ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** -** - \b \c \EVS_CMDPC - command execution counter will +** +** - \b \c \EVS_CMDPC - command execution counter will ** increment - - The generation of #CFE_EVS_DISEVTTYPE_EID debug message + - The generation of #CFE_EVS_DISEVTTYPE_EID debug message ** ** \par Error Conditions ** This command may fail for the following reason(s): ** -** - Invalid Event Type selection +** - Invalid Event Type selection ** Evidence of failure may be found in the following telemetry: ** - \b \c \EVS_CMDEC - command error counter will increment ** - An Error specific event message ** ** \par Criticality -** Disabling an event type is not particularly hazardous, as the result -** may be shutting off unnecessary event messages and possible event -** flooding of the system. However, inappropriately disabling an event -** type could result in a loss of critical information and missed +** Disabling an event type is not particularly hazardous, as the result +** may be shutting off unnecessary event messages and possible event +** flooding of the system. However, inappropriately disabling an event +** type could result in a loss of critical information and missed ** behavior for the ground system. ** -** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, +** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, ** #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC */ -#define CFE_EVS_DISABLE_EVENT_TYPE_CC 3 +#define CFE_EVS_DISABLE_EVENT_TYPE_CC 3 /** \cfeevscmd Set Event Format Mode ** ** \par Description ** This command sets the event format mode to the command specified value. ** The event format mode may be either short or long. A short event format -** detaches the Event Data from the event message and only includes the +** detaches the Event Data from the event message and only includes the ** following information in the event packet: Processor ID, Application ID, -** Event ID, and Event Type. Refer to section 5.3.3.4 for a description of +** Event ID, and Event Type. Refer to section 5.3.3.4 for a description of ** the Event Service event packet contents. Event Data is defined to be data ** describing an Event that is supplied to the cFE Event Service. ASCII text -** strings are used as the primary format for Event Data because heritage +** strings are used as the primary format for Event Data because heritage ** ground systems use string compares as the basis for their automated alert -** systems. Two systems, ANSR and SERS were looked at for interface -** definitions. The short event format is used to accommodate experiences +** systems. Two systems, ANSR and SERS were looked at for interface +** definitions. The short event format is used to accommodate experiences ** with limited telemetry bandwidth. The long event format includes all event ** information included within the short format along with the Event Data. ** @@ -237,10 +236,10 @@ ** #CFE_EVS_SetEventFormatModeCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** -** - \b \c \EVS_CMDPC - command execution counter will +** +** - \b \c \EVS_CMDPC - command execution counter will ** increment ** - The generation of #CFE_EVS_SETEVTFMTMOD_EID debug message ** @@ -255,23 +254,23 @@ ** ** ** \par Criticality -** Setting the event format mode is not particularly hazardous, as the -** result may be saving necessary bandwidth. However, inappropriately +** Setting the event format mode is not particularly hazardous, as the +** result may be saving necessary bandwidth. However, inappropriately ** setting the event format mode could result in a loss of information ** and missed behavior for the ground system -** \sa +** \sa */ -#define CFE_EVS_SET_EVENT_FORMAT_MODE_CC 4 +#define CFE_EVS_SET_EVENT_FORMAT_MODE_CC 4 /** \cfeevscmd Enable Application Event Type ** ** \par Description ** This command enables the command specified event type for the command ** specified application, allowing the application to send event messages -** of the command specified event type through Event Service. An Event -** Type is defined to be a classification of an Event Message such as +** of the command specified event type through Event Service. An Event +** Type is defined to be a classification of an Event Message such as ** debug, informational, critical, and error. -** Note: In order for this command to take effect, applications must be +** Note: In order for this command to take effect, applications must be ** registered for Event Service. ** ** \cfecmdmnemonic \EVS_ENAAPPEVTTYPE @@ -283,18 +282,18 @@ ** Bit 1 - Informational ** Bit 2 - Error ** Bit 3 - Critical -** A one in a bit position means the event type will be enabled (or -** unfiltered) for the specified application. -** A zero in a bit position means the filtering state is unchanged for +** A one in a bit position means the event type will be enabled (or +** unfiltered) for the specified application. +** A zero in a bit position means the filtering state is unchanged for ** the specified application. ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment ** - The generation of #CFE_EVS_ENAAPPEVTTYPE_EID debug event message -** +** ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -306,25 +305,25 @@ ** ** ** \par Criticality -** Enabling an application event type is not particularly hazardous, as -** the result may be turning on necessary event messages and +** Enabling an application event type is not particularly hazardous, as +** the result may be turning on necessary event messages and ** communication to the ground system. However, inappropriately enabling ** an application's event type could result in flooding of the ground system. ** -** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, +** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, ** #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC */ -#define CFE_EVS_ENABLE_APP_EVENT_TYPE_CC 5 +#define CFE_EVS_ENABLE_APP_EVENT_TYPE_CC 5 /** \cfeevscmd Disable Application Event Type ** ** \par Description ** This command disables the command specified event type for the command ** specified application, preventing the application from sending event -** messages of the command specified event type through Event Service. +** messages of the command specified event type through Event Service. ** An Event Type is defined to be a classification of an Event Message such ** as debug, informational, critical, and error. Note: In order for this -** command to take effect, applications must be registered for Event Service. +** command to take effect, applications must be registered for Event Service. ** ** \cfecmdmnemonic \EVS_DISAPPEVTTYPE ** @@ -335,17 +334,17 @@ ** Bit 1 - Informational ** Bit 2 - Error ** Bit 3 - Critical -** A one in a bit position means the event type will be disabled (or -** filtered) for the specified application. -** A zero in a bit position means the filtering state is unchanged for +** A one in a bit position means the event type will be disabled (or +** filtered) for the specified application. +** A zero in a bit position means the filtering state is unchanged for ** the specified application. ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_DISAPPENTTYPE_EID debug event message +** - The generation of #CFE_EVS_DISAPPENTTYPE_EID debug event message ** - The clearing of the Event Type Active Flag in The Event Type Active Flag in EVS App Data File ** ** \par Error Conditions @@ -357,22 +356,22 @@ ** - An Error specific event message ** ** \par Criticality -** Disabling an application's event type is not particularly hazardous, +** Disabling an application's event type is not particularly hazardous, ** as the result may be shutting off unnecessary event messages and -** possible event flooding of the system. However, inappropriately +** possible event flooding of the system. However, inappropriately ** disabling an application's event type could result in a loss of critical ** information and missed behavior for the ground system. ** -** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, +** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, ** #CFE_EVS_ENABLE_APP_EVENTS_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC */ -#define CFE_EVS_DISABLE_APP_EVENT_TYPE_CC 6 +#define CFE_EVS_DISABLE_APP_EVENT_TYPE_CC 6 /** \cfeevscmd Enable Event Services for an Application ** ** \par Description -** This command enables the command specified application to send events -** through the Event Service. Note: In order for this command to take +** This command enables the command specified application to send events +** through the Event Service. Note: In order for this command to take ** effect, applications must be registered for Event Service. ** ** \cfecmdmnemonic \EVS_ENAAPPEVGEN @@ -381,11 +380,11 @@ ** #CFE_EVS_EnableAppEventsCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_ENAAPPEVT_EID debug event message +** - The generation of #CFE_EVS_ENAAPPEVT_EID debug event message ** - The setting of the Active Flag in The Active Flag in EVS App Data File ** ** \par Error Conditions @@ -399,20 +398,20 @@ ** - An Error specific event message ** ** \par Criticality -** Enabling an application events is not particularly hazardous, -** as the result may be turning on necessary event messages and -** communication to the ground system. However, inappropriately enabling +** Enabling an application events is not particularly hazardous, +** as the result may be turning on necessary event messages and +** communication to the ground system. However, inappropriately enabling ** an application's events could result in flooding of the ground system. ** -** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, +** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, ** #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, #CFE_EVS_DISABLE_APP_EVENTS_CC */ -#define CFE_EVS_ENABLE_APP_EVENTS_CC 7 +#define CFE_EVS_ENABLE_APP_EVENTS_CC 7 /** \cfeevscmd Disable Event Services for an Application ** ** \par Description -** This command disables the command specified application from sending +** This command disables the command specified application from sending ** events through Event Service. Note: In order for this command to take ** effect, applications must be registered for Event Service. ** @@ -422,11 +421,11 @@ ** #CFE_EVS_DisableAppEventsCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_DISAPPEVT_EID debug event message +** - The generation of #CFE_EVS_DISAPPEVT_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -439,16 +438,16 @@ ** - An Error specific event message ** ** \par Criticality -** Disabling an application's events is not particularly hazardous, as the +** Disabling an application's events is not particularly hazardous, as the ** result may be shutting off unnecessary event messages and possible event -** flooding of the system. However, inappropriately disabling an +** flooding of the system. However, inappropriately disabling an ** application's events could result in a loss of critical information and ** missed behavior for the ground system. ** -** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, +** \sa #CFE_EVS_ENABLE_EVENT_TYPE_CC, #CFE_EVS_DISABLE_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC, ** #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC, #CFE_EVS_ENABLE_APP_EVENTS_CC */ -#define CFE_EVS_DISABLE_APP_EVENTS_CC 8 +#define CFE_EVS_DISABLE_APP_EVENTS_CC 8 /** \cfeevscmd Reset Application Event Counters ** @@ -463,11 +462,11 @@ ** #CFE_EVS_ResetAppCounterCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_RSTEVTCNT_EID debug event message +** - The generation of #CFE_EVS_RSTEVTCNT_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -480,20 +479,20 @@ ** - An Error specific event message ** ** \par Criticality -** This command is not inherently dangerous. However, it is possible for +** This command is not inherently dangerous. However, it is possible for ** ground systems and on-board safing procedures to be designed such that ** they react to changes in the counter value that is reset by this command. ** ** \sa #CFE_EVS_RESET_COUNTERS_CC */ -#define CFE_EVS_RESET_APP_COUNTER_CC 9 +#define CFE_EVS_RESET_APP_COUNTER_CC 9 /** \cfeevscmd Set Application Event Filter ** ** \par Description ** This command sets the command specified application's event filter mask -** to the command specified value for the command specified event. Note: -** In order for this command to take effect, applications must be +** to the command specified value for the command specified event. Note: +** In order for this command to take effect, applications must be ** registered for Event Service. ** ** \cfecmdmnemonic \EVS_SETBINFLTRMASK @@ -502,11 +501,11 @@ ** #CFE_EVS_SetFilterCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_SETFILTERMSK_EID debug event message +** - The generation of #CFE_EVS_SETFILTERMSK_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -521,14 +520,15 @@ ** \par Criticality ** Setting an application event filter mask is not particularly hazardous, ** as the result may be shutting off unnecessary event messages and possible -** event flooding of the system. However, inappropriately setting an -** application's event filter mask could result in a loss of critical -** information and missed behavior for the ground system or flooding of the +** event flooding of the system. However, inappropriately setting an +** application's event filter mask could result in a loss of critical +** information and missed behavior for the ground system or flooding of the ** ground system. ** -** \sa #CFE_EVS_RESET_FILTER_CC, #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, #CFE_EVS_DELETE_EVENT_FILTER_CC +** \sa #CFE_EVS_RESET_FILTER_CC, #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, +*#CFE_EVS_DELETE_EVENT_FILTER_CC */ -#define CFE_EVS_SET_FILTER_CC 10 +#define CFE_EVS_SET_FILTER_CC 10 /** \cfeevscmd Enable Event Services Output Ports ** @@ -544,15 +544,15 @@ ** Bit 1 - Port 2 ** Bit 2 - Port 3 ** Bit 3 - Port 4 -** A one in a bit position means the port will be enabled. +** A one in a bit position means the port will be enabled. ** A zero in a bit position means the port state is unchanged. ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_ENAPORT_EID debug event message +** - The generation of #CFE_EVS_ENAPORT_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -568,7 +568,7 @@ ** ** \sa #CFE_EVS_DISABLE_PORTS_CC */ -#define CFE_EVS_ENABLE_PORTS_CC 11 +#define CFE_EVS_ENABLE_PORTS_CC 11 /** \cfeevscmd Disable Event Services Output Ports ** @@ -584,15 +584,15 @@ ** Bit 1 - Port 2 ** Bit 2 - Port 3 ** Bit 3 - Port 4 -** A one in a bit position means the port will be disabled. +** A one in a bit position means the port will be disabled. ** A zero in a bit position means the port state is unchanged. ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_DISPORT_EID debug event message +** - The generation of #CFE_EVS_DISPORT_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -608,13 +608,13 @@ ** ** \sa #CFE_EVS_ENABLE_PORTS_CC */ -#define CFE_EVS_DISABLE_PORTS_CC 12 +#define CFE_EVS_DISABLE_PORTS_CC 12 /** \cfeevscmd Reset an Event Filter for an Application ** ** \par Description ** This command resets the command specified application's event filter for -** the command specified event ID. Note: In order for this command to take +** the command specified event ID. Note: In order for this command to take ** effect, applications must be registered for Event Service. ** ** \cfecmdmnemonic \EVS_RSTBINFLTRCTR @@ -623,11 +623,11 @@ ** #CFE_EVS_ResetFilterCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_RSTFILTER_EID debug event message +** - The generation of #CFE_EVS_RSTFILTER_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -642,14 +642,15 @@ ** \par Criticality ** None. ** -** \sa #CFE_EVS_SET_FILTER_CC, #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, #CFE_EVS_DELETE_EVENT_FILTER_CC +** \sa #CFE_EVS_SET_FILTER_CC, #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, +*#CFE_EVS_DELETE_EVENT_FILTER_CC */ -#define CFE_EVS_RESET_FILTER_CC 13 +#define CFE_EVS_RESET_FILTER_CC 13 /** \cfeevscmd Reset All Event Filters for an Application ** ** \par Description -** This command resets all of the command specified applications event +** This command resets all of the command specified applications event ** filters. Note: In order for this command to take effect, applications ** must be registered for Event Service. ** @@ -659,11 +660,11 @@ ** #CFE_EVS_ResetAllFiltersCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_RSTALLFILTER_EID debug event message +** - The generation of #CFE_EVS_RSTALLFILTER_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -680,7 +681,7 @@ ** ** \sa #CFE_EVS_SET_FILTER_CC, #CFE_EVS_RESET_FILTER_CC, #CFE_EVS_ADD_EVENT_FILTER_CC, #CFE_EVS_DELETE_EVENT_FILTER_CC */ -#define CFE_EVS_RESET_ALL_FILTERS_CC 14 +#define CFE_EVS_RESET_ALL_FILTERS_CC 14 /** \cfeevscmd Add Application Event Filter ** @@ -695,11 +696,11 @@ ** #CFE_EVS_AddEventFilterCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_ADDFILTER_EID debug event message +** - The generation of #CFE_EVS_ADDFILTER_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -716,7 +717,7 @@ ** ** \sa #CFE_EVS_SET_FILTER_CC, #CFE_EVS_RESET_FILTER_CC, #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_DELETE_EVENT_FILTER_CC */ -#define CFE_EVS_ADD_EVENT_FILTER_CC 15 +#define CFE_EVS_ADD_EVENT_FILTER_CC 15 /** \cfeevscmd Delete Application Event Filter ** @@ -731,11 +732,11 @@ ** #CFE_EVS_DeleteEventFilterCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_DELFILTER_EID debug event message +** - The generation of #CFE_EVS_DELFILTER_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -752,7 +753,7 @@ ** ** \sa #CFE_EVS_SET_FILTER_CC, #CFE_EVS_RESET_FILTER_CC, #CFE_EVS_RESET_ALL_FILTERS_CC, #CFE_EVS_ADD_EVENT_FILTER_CC */ -#define CFE_EVS_DELETE_EVENT_FILTER_CC 16 +#define CFE_EVS_DELETE_EVENT_FILTER_CC 16 /** \cfeevscmd Write Event Services Application Information to File ** @@ -767,11 +768,11 @@ ** #CFE_EVS_WriteAppDataFileCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_WRDAT_EID debug event message +** - The generation of #CFE_EVS_WRDAT_EID debug event message ** - The generation of the file written to ** ** \par Error Conditions @@ -788,13 +789,13 @@ ** ** \sa #CFE_EVS_WRITE_LOG_DATA_FILE_CC, #CFE_EVS_SET_LOG_MODE_CC */ -#define CFE_EVS_WRITE_APP_DATA_FILE_CC 17 +#define CFE_EVS_WRITE_APP_DATA_FILE_CC 17 /** \cfeevscmd Write Event Log to File ** ** \par Description -** This command requests the Event Service to generate a file containing -** the contents of the local event log. +** This command requests the Event Service to generate a file containing +** the contents of the local event log. ** ** \cfecmdmnemonic \EVS_WRITELOG2FILE ** @@ -802,11 +803,11 @@ ** #CFE_EVS_WriteLogDataFileCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_WRLOG_EID debug event message +** - The generation of #CFE_EVS_WRLOG_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -822,7 +823,7 @@ ** ** \sa #CFE_EVS_WRITE_APP_DATA_FILE_CC, #CFE_EVS_SET_LOG_MODE_CC, #CFE_EVS_CLEAR_LOG_CC */ -#define CFE_EVS_WRITE_LOG_DATA_FILE_CC 18 +#define CFE_EVS_WRITE_LOG_DATA_FILE_CC 18 /** \cfeevscmd Set Logging Mode ** @@ -835,11 +836,11 @@ ** #CFE_EVS_SetLogModeCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment -** - The generation of #CFE_EVS_LOGMODE_EID debug event message +** - The generation of #CFE_EVS_LOGMODE_EID debug event message ** ** \par Error Conditions ** This command may fail for the following reason(s): @@ -853,12 +854,12 @@ ** \par Criticality ** Setting the event logging mode is not particularly hazardous, as the ** result may be saving valuable event data. However, inappropriately -** setting the log mode could result in a loss of critical information. +** setting the log mode could result in a loss of critical information. ** Note: the event log is a back-up log to the on-board recorder. ** ** \sa #CFE_EVS_WRITE_LOG_DATA_FILE_CC, #CFE_EVS_CLEAR_LOG_CC */ -#define CFE_EVS_SET_LOG_MODE_CC 19 +#define CFE_EVS_SET_LOG_MODE_CC 19 /** \cfeevscmd Clear Event Log ** @@ -871,9 +872,9 @@ ** #CFE_EVS_ClearLogCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \EVS_CMDPC - command execution counter will +** - \b \c \EVS_CMDPC - command execution counter will ** increment ** ** \par Error Conditions @@ -885,39 +886,40 @@ ** - An Error specific event message ** ** \par Criticality -** Clearing the local event log is not particularly hazardous, as the -** result may be making available space to record valuable event data. +** Clearing the local event log is not particularly hazardous, as the +** result may be making available space to record valuable event data. ** However, inappropriately clearing the local event log could result ** in a loss of critical information. Note: the event log is a back-up ** log to the on-board recorder. ** ** \sa #CFE_EVS_WRITE_LOG_DATA_FILE_CC, #CFE_EVS_SET_LOG_MODE_CC */ -#define CFE_EVS_CLEAR_LOG_CC 20 +#define CFE_EVS_CLEAR_LOG_CC 20 /** \} */ /* Event Type bit masks */ -#define CFE_EVS_DEBUG_BIT 0x0001 -#define CFE_EVS_INFORMATION_BIT 0x0002 -#define CFE_EVS_ERROR_BIT 0x0004 -#define CFE_EVS_CRITICAL_BIT 0x0008 +#define CFE_EVS_DEBUG_BIT 0x0001 +#define CFE_EVS_INFORMATION_BIT 0x0002 +#define CFE_EVS_ERROR_BIT 0x0004 +#define CFE_EVS_CRITICAL_BIT 0x0008 /* Output Port bit masks */ -#define CFE_EVS_PORT1_BIT 0x0001 -#define CFE_EVS_PORT2_BIT 0x0002 -#define CFE_EVS_PORT3_BIT 0x0004 -#define CFE_EVS_PORT4_BIT 0x0008 +#define CFE_EVS_PORT1_BIT 0x0001 +#define CFE_EVS_PORT2_BIT 0x0002 +#define CFE_EVS_PORT3_BIT 0x0004 +#define CFE_EVS_PORT4_BIT 0x0008 /* EVS Log Modes */ -#define CFE_EVS_LOG_OVERWRITE 0 -#define CFE_EVS_LOG_DISCARD 1 +#define CFE_EVS_LOG_OVERWRITE 0 +#define CFE_EVS_LOG_DISCARD 1 /****************** Structure Definitions *********************/ /** ** \brief Command with no additional arguments **/ -typedef struct CFE_EVS_NoArgsCmd { +typedef struct CFE_EVS_NoArgsCmd +{ CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } CFE_EVS_NoArgsCmd_t; @@ -936,33 +938,36 @@ typedef CFE_EVS_NoArgsCmd_t CFE_EVS_ClearLogCmd_t; ** For command details, see #CFE_EVS_WRITE_LOG_DATA_FILE_CC ** **/ -typedef struct CFE_EVS_LogFileCmd_Payload { +typedef struct CFE_EVS_LogFileCmd_Payload +{ char LogFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename where log data is to be written */ } CFE_EVS_LogFileCmd_Payload_t; /** * \brief Write Event Log to File Command */ -typedef struct CFE_EVS_WriteLogDataFileCmd { +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 Payload ** ** For command details, see #CFE_EVS_WRITE_APP_DATA_FILE_CC ** **/ -typedef struct CFE_EVS_AppDataCmd_Payload { - char AppDataFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename where applicaton data is to be written */ +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; /** * \brief Write Event Services Application Information to File Command */ -typedef struct CFE_EVS_WriteAppDataFileCmd { +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; @@ -973,15 +978,17 @@ typedef struct CFE_EVS_WriteAppDataFileCmd { ** 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*/ +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*/ } CFE_EVS_SetLogMode_Payload_t; /** * \brief Set Log Mode Command */ -typedef struct CFE_EVS_SetLogModeCmd { +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; @@ -992,15 +999,17 @@ typedef struct CFE_EVS_SetLogModeCmd { ** For command details, see #CFE_EVS_SET_EVENT_FORMAT_MODE_CC ** **/ -typedef struct CFE_EVS_SetEventFormatCode_Payload { - CFE_EVS_MsgFormat_Enum_t MsgFormat; /**< \brief Mode to use in the command*/ - uint8 Spare; /**< \brief Pad to even byte*/ +typedef struct CFE_EVS_SetEventFormatCode_Payload +{ + CFE_EVS_MsgFormat_Enum_t MsgFormat; /**< \brief Mode to use in the command*/ + uint8 Spare; /**< \brief Pad to even byte*/ } CFE_EVS_SetEventFormatMode_Payload_t; /** * \brief Set Event Format Mode Command */ -typedef struct CFE_EVS_SetEventFormatModeCmd { +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; @@ -1012,15 +1021,17 @@ typedef struct CFE_EVS_SetEventFormatModeCmd { ** #CFE_EVS_ENABLE_PORTS_CC and/or #CFE_EVS_DISABLE_PORTS_CC ** **/ -typedef struct CFE_EVS_BitMaskCmd_Payload { - uint8 BitMask; /**< \brief BitMask to use in the command */ - uint8 Spare; /**< \brief Pad to even byte*/ +typedef struct CFE_EVS_BitMaskCmd_Payload +{ + uint8 BitMask; /**< \brief BitMask to use in the command */ + uint8 Spare; /**< \brief Pad to even byte*/ } CFE_EVS_BitMaskCmd_Payload_t; /** * \brief Generic Bitmask Command */ -typedef struct CFE_EVS_BitMaskCmd { +typedef struct CFE_EVS_BitMaskCmd +{ CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ CFE_EVS_BitMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_BitMaskCmd_t; @@ -1042,14 +1053,16 @@ typedef CFE_EVS_BitMaskCmd_t CFE_EVS_DisableEventTypeCmd_t; ** #CFE_EVS_RESET_APP_COUNTER_CC and/or #CFE_EVS_RESET_ALL_FILTERS_CC ** **/ -typedef struct CFE_EVS_AppNameCmd_Payload { - char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ +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 { +typedef struct CFE_EVS_AppNameCmd +{ CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ CFE_EVS_AppNameCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameCmd_t; @@ -1070,17 +1083,19 @@ typedef CFE_EVS_AppNameCmd_t CFE_EVS_ResetAllFiltersCmd_t; ** For command details, see #CFE_EVS_RESET_FILTER_CC and #CFE_EVS_DELETE_EVENT_FILTER_CC ** **/ -typedef struct CFE_EVS_AppNameEventIDCmd_Payload { - char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ - uint16 EventID; /**< \brief Event ID to use in the command*/ +typedef struct CFE_EVS_AppNameEventIDCmd_Payload +{ + char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ + 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 { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_AppNameEventIDCmd_Payload_t Payload; /**< \brief Command payload */ +typedef struct CFE_EVS_AppNameEventIDCmd +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_EVS_AppNameEventIDCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameEventIDCmd_t; /* @@ -1097,16 +1112,18 @@ typedef CFE_EVS_AppNameEventIDCmd_t CFE_EVS_DeleteEventFilterCmd_t; ** For command details, see #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC and/or #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC ** **/ -typedef struct CFE_EVS_AppNameBitMaskCmd_Payload { - char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ - uint8 BitMask; /**< \brief BitMask to use in the command*/ - uint8 Spare; /**< \brief Pad to even byte*/ +typedef struct CFE_EVS_AppNameBitMaskCmd_Payload +{ + char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ + uint8 BitMask; /**< \brief BitMask to use in the command*/ + uint8 Spare; /**< \brief Pad to even byte*/ } CFE_EVS_AppNameBitMaskCmd_Payload_t; /** * \brief Generic App Name and Bitmask Command */ -typedef struct CFE_EVS_AppNameBitMaskCmd { +typedef struct CFE_EVS_AppNameBitMaskCmd +{ CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ CFE_EVS_AppNameBitMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameBitMaskCmd_t; @@ -1122,20 +1139,22 @@ typedef CFE_EVS_AppNameBitMaskCmd_t CFE_EVS_DisableAppEventTypeCmd_t; /** ** \brief Generic App Name, Event ID, Mask Command Payload ** -** For command details, see #CFE_EVS_SET_FILTER_CC, #CFE_EVS_ADD_EVENT_FILTER_CC +** For command details, see #CFE_EVS_SET_FILTER_CC, #CFE_EVS_ADD_EVENT_FILTER_CC ** and/or #CFE_EVS_DELETE_EVENT_FILTER_CC ** **/ -typedef struct CFE_EVS_AppNameEventIDMaskCmd_Payload { - char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ - uint16 EventID; /**< \brief Event ID to use in the command*/ - uint16 Mask; /**< \brief Mask to use in the command */ +typedef struct CFE_EVS_AppNameEventIDMaskCmd_Payload +{ + char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application name to use in the command*/ + uint16 EventID; /**< \brief Event ID to use in the command*/ + 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 { +typedef struct CFE_EVS_AppNameEventIDMaskCmd +{ CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ CFE_EVS_AppNameEventIDMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameEventIDMaskCmd_t; @@ -1152,117 +1171,119 @@ typedef CFE_EVS_AppNameEventIDMaskCmd_t CFE_EVS_SetFilterCmd_t; /**********************************/ /* Telemetry Message Data Formats */ /**********************************/ -typedef struct CFE_EVS_AppTlmData { - CFE_ES_AppId_t AppID; /**< \cfetlmmnemonic \EVS_APPID - \brief Numerical application identifier */ - uint16 AppMessageSentCounter; /**< \cfetlmmnemonic \EVS_APPMSGSENTC - \brief Application message sent counter */ - uint8 AppEnableStatus; /**< \cfetlmmnemonic \EVS_APPENASTAT - \brief Application event service enable status */ - uint8 Padding; /**< \cfetlmmnemonic \EVS_SPARE2ALIGN3 - \brief Padding for 32 bit boundary */ +typedef struct CFE_EVS_AppTlmData +{ + CFE_ES_AppId_t AppID; /**< \cfetlmmnemonic \EVS_APPID + \brief Numerical application identifier */ + uint16 AppMessageSentCounter; /**< \cfetlmmnemonic \EVS_APPMSGSENTC + \brief Application message sent counter */ + uint8 AppEnableStatus; /**< \cfetlmmnemonic \EVS_APPENASTAT + \brief Application event service enable status */ + uint8 Padding; /**< \cfetlmmnemonic \EVS_SPARE2ALIGN3 + \brief Padding for 32 bit boundary */ } CFE_EVS_AppTlmData_t; - -/** +/** ** \cfeevstlm Event Services Housekeeping Telemetry Packet **/ -typedef struct CFE_EVS_HousekeepingTlm_Payload { - uint8 CommandCounter; /**< \cfetlmmnemonic \EVS_CMDPC - \brief EVS Command Counter */ - uint8 CommandErrorCounter; /**< \cfetlmmnemonic \EVS_CMDEC - \brief EVS Command Error Counter */ - uint8 MessageFormatMode; /**< \cfetlmmnemonic \EVS_MSGFMTMODE - \brief Event message format mode (short/long) */ - uint8 MessageTruncCounter; /**< \cfetlmmnemonic \EVS_MSGTRUNC - \brief Event message truncation counter */ - - uint8 UnregisteredAppCounter; /**< \cfetlmmnemonic \EVS_UNREGAPPC - \brief Unregistered application message send counter */ - uint8 OutputPort; /**< \cfetlmmnemonic \EVS_OUTPUTPORT - \brief Output port mask */ - uint8 LogFullFlag; /**< \cfetlmmnemonic \EVS_LOGFULL - \brief Local event log full flag */ - uint8 LogMode; /**< \cfetlmmnemonic \EVS_LOGMODE - \brief Local event logging mode (overwrite/discard) */ - - uint16 MessageSendCounter; /**< \cfetlmmnemonic \EVS_MSGSENTC - \brief Event message send counter */ - uint16 LogOverflowCounter; /**< \cfetlmmnemonic \EVS_LOGOVERFLOWC - \brief Local event log overflow counter */ - - uint8 LogEnabled; /**< \cfetlmmnemonic \EVS_LOGENABLED - \brief Current event log enable/disable state */ - uint8 Spare1; /**< \cfetlmmnemonic \EVS_HK_SPARE1 - \brief Padding for 32 bit boundary */ - uint8 Spare2; /**< \cfetlmmnemonic \EVS_HK_SPARE2 - \brief Padding for 32 bit boundary */ - uint8 Spare3; /**< \cfetlmmnemonic \EVS_HK_SPARE3 - \brief Padding for 32 bit boundary */ - - CFE_EVS_AppTlmData_t AppData[CFE_MISSION_ES_MAX_APPLICATIONS]; /**< \cfetlmmnemonic \EVS_APP - \brief Array of registered application table data */ +typedef struct CFE_EVS_HousekeepingTlm_Payload +{ + uint8 CommandCounter; /**< \cfetlmmnemonic \EVS_CMDPC + \brief EVS Command Counter */ + uint8 CommandErrorCounter; /**< \cfetlmmnemonic \EVS_CMDEC + \brief EVS Command Error Counter */ + uint8 MessageFormatMode; /**< \cfetlmmnemonic \EVS_MSGFMTMODE + \brief Event message format mode (short/long) */ + uint8 MessageTruncCounter; /**< \cfetlmmnemonic \EVS_MSGTRUNC + \brief Event message truncation counter */ + + uint8 UnregisteredAppCounter; /**< \cfetlmmnemonic \EVS_UNREGAPPC + \brief Unregistered application message send counter */ + uint8 OutputPort; /**< \cfetlmmnemonic \EVS_OUTPUTPORT + \brief Output port mask */ + uint8 LogFullFlag; /**< \cfetlmmnemonic \EVS_LOGFULL + \brief Local event log full flag */ + uint8 LogMode; /**< \cfetlmmnemonic \EVS_LOGMODE + \brief Local event logging mode (overwrite/discard) */ + + uint16 MessageSendCounter; /**< \cfetlmmnemonic \EVS_MSGSENTC + \brief Event message send counter */ + uint16 LogOverflowCounter; /**< \cfetlmmnemonic \EVS_LOGOVERFLOWC + \brief Local event log overflow counter */ + + uint8 LogEnabled; /**< \cfetlmmnemonic \EVS_LOGENABLED + \brief Current event log enable/disable state */ + uint8 Spare1; /**< \cfetlmmnemonic \EVS_HK_SPARE1 + \brief Padding for 32 bit boundary */ + uint8 Spare2; /**< \cfetlmmnemonic \EVS_HK_SPARE2 + \brief Padding for 32 bit boundary */ + uint8 Spare3; /**< \cfetlmmnemonic \EVS_HK_SPARE3 + \brief Padding for 32 bit boundary */ + + CFE_EVS_AppTlmData_t AppData[CFE_MISSION_ES_MAX_APPLICATIONS]; /**< \cfetlmmnemonic \EVS_APP + \brief Array of registered application table data */ } CFE_EVS_HousekeepingTlm_Payload_t; -typedef struct CFE_EVS_HousekeepingTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_EVS_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ +typedef struct CFE_EVS_HousekeepingTlm +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_EVS_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_HousekeepingTlm_t; /** Telemetry packet structures */ -typedef struct CFE_EVS_PacketID { - char AppName[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \EVS_APPNAME - \brief Application name */ - uint16 EventID; /**< \cfetlmmnemonic \EVS_EVENTID - \brief Numerical event identifier */ - uint16 EventType; /**< \cfetlmmnemonic \EVS_EVENTTYPE - \brief Numerical event type identifier */ - uint32 SpacecraftID; /**< \cfetlmmnemonic \EVS_SCID - \brief Spacecraft identifier */ - uint32 ProcessorID; /**< \cfetlmmnemonic \EVS_PROCESSORID - \brief Numerical processor identifier */ +typedef struct CFE_EVS_PacketID +{ + char AppName[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \EVS_APPNAME + \brief Application name */ + uint16 EventID; /**< \cfetlmmnemonic \EVS_EVENTID + \brief Numerical event identifier */ + uint16 EventType; /**< \cfetlmmnemonic \EVS_EVENTTYPE + \brief Numerical event type identifier */ + uint32 SpacecraftID; /**< \cfetlmmnemonic \EVS_SCID + \brief Spacecraft identifier */ + uint32 ProcessorID; /**< \cfetlmmnemonic \EVS_PROCESSORID + \brief Numerical processor identifier */ } CFE_EVS_PacketID_t; - -/** +/** ** \cfeevstlm Event Message Telemetry Packet (Long format) **/ -typedef struct CFE_EVS_LongEventTlm_Payload { - CFE_EVS_PacketID_t PacketID; /**< \brief Event packet information */ - char Message[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; /**< \cfetlmmnemonic \EVS_EVENT - \brief Event message string */ - uint8 Spare1; /**< \cfetlmmnemonic \EVS_SPARE1 - \brief Structure padding */ - uint8 Spare2; /**< \cfetlmmnemonic \EVS_SPARE2 +typedef struct CFE_EVS_LongEventTlm_Payload +{ + CFE_EVS_PacketID_t PacketID; /**< \brief Event packet information */ + char Message[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; /**< \cfetlmmnemonic \EVS_EVENT + \brief Event message string */ + uint8 Spare1; /**< \cfetlmmnemonic \EVS_SPARE1 \brief Structure padding */ + uint8 Spare2; /**< \cfetlmmnemonic \EVS_SPARE2 + \brief Structure padding */ } CFE_EVS_LongEventTlm_Payload_t; /** ** \cfeevstlm Event Message Telemetry Packet (Short format) **/ -typedef struct CFE_EVS_ShortEventTlm_Payload { - CFE_EVS_PacketID_t PacketID; /**< \brief Event packet information */ +typedef struct CFE_EVS_ShortEventTlm_Payload +{ + CFE_EVS_PacketID_t PacketID; /**< \brief Event packet information */ } CFE_EVS_ShortEventTlm_Payload_t; -typedef struct CFE_EVS_LongEventTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_EVS_LongEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ +typedef struct CFE_EVS_LongEventTlm +{ + 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_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_EVS_ShortEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ +typedef struct CFE_EVS_ShortEventTlm +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_EVS_ShortEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_ShortEventTlm_t; - #endif - - - diff --git a/modules/evs/fsw/src/cfe_evs.c b/modules/evs/fsw/src/cfe_evs.c index 586ca4565..b04dfaf38 100644 --- a/modules/evs/fsw/src/cfe_evs.c +++ b/modules/evs/fsw/src/cfe_evs.c @@ -39,81 +39,79 @@ /* Local Function Prototypes */ - /* Function Definitions */ /* ** Function: CFE_EVS_Register - See API and header file for details */ -int32 CFE_EVS_Register (const void *Filters, uint16 NumEventFilters, uint16 FilterScheme) +int32 CFE_EVS_Register(const void *Filters, uint16 NumEventFilters, uint16 FilterScheme) { - uint16 FilterLimit; - uint16 i; - int32 Status; - CFE_ES_AppId_t AppID; - CFE_EVS_BinFilter_t *AppFilters; - EVS_AppData_t *AppDataPtr; - - /* Query and verify the caller's AppID */ - Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); - if (Status == CFE_SUCCESS) - { - /* Clear and configure entry */ - memset(AppDataPtr, 0, sizeof(EVS_AppData_t)); - - /* Verify filter arguments */ - if (FilterScheme != CFE_EVS_EventFilter_BINARY) - { - Status = CFE_EVS_UNKNOWN_FILTER; - } - else if ((NumEventFilters != 0) && (Filters == NULL)) - { - Status = CFE_ES_ERR_BUFFER; - } - else - { - /* Initialize application event data */ - AppDataPtr->ActiveFlag = true; - AppDataPtr->EventTypesActiveFlag = CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG; - - /* Set limit for number of provided filters */ - if (NumEventFilters < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS) - { - FilterLimit = NumEventFilters; - } - else - { - FilterLimit = CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; - CFE_ES_WriteToSysLog("CFE_EVS_Register: Filter limit truncated to %d\n", - (int)FilterLimit); - } - - if (Filters != NULL) - { - AppFilters = (CFE_EVS_BinFilter_t *) Filters; - - /* Copy provided filters */ - for (i = 0; i < FilterLimit; i++) + uint16 FilterLimit; + uint16 i; + int32 Status; + CFE_ES_AppId_t AppID; + CFE_EVS_BinFilter_t *AppFilters; + EVS_AppData_t * AppDataPtr; + + /* Query and verify the caller's AppID */ + Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); + if (Status == CFE_SUCCESS) + { + /* Clear and configure entry */ + memset(AppDataPtr, 0, sizeof(EVS_AppData_t)); + + /* Verify filter arguments */ + if (FilterScheme != CFE_EVS_EventFilter_BINARY) + { + Status = CFE_EVS_UNKNOWN_FILTER; + } + else if ((NumEventFilters != 0) && (Filters == NULL)) + { + Status = CFE_ES_ERR_BUFFER; + } + else + { + /* Initialize application event data */ + AppDataPtr->ActiveFlag = true; + AppDataPtr->EventTypesActiveFlag = CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG; + + /* Set limit for number of provided filters */ + if (NumEventFilters < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS) + { + FilterLimit = NumEventFilters; + } + else + { + FilterLimit = CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; + CFE_ES_WriteToSysLog("CFE_EVS_Register: Filter limit truncated to %d\n", (int)FilterLimit); + } + + if (Filters != NULL) { - AppDataPtr->BinFilters[i].EventID = AppFilters[i].EventID; - AppDataPtr->BinFilters[i].Mask = AppFilters[i].Mask; - AppDataPtr->BinFilters[i].Count = 0; + AppFilters = (CFE_EVS_BinFilter_t *)Filters; + + /* Copy provided filters */ + for (i = 0; i < FilterLimit; i++) + { + AppDataPtr->BinFilters[i].EventID = AppFilters[i].EventID; + AppDataPtr->BinFilters[i].Mask = AppFilters[i].Mask; + AppDataPtr->BinFilters[i].Count = 0; + } } - } - /* Initialize remainder of filters as unused */ - for (i = FilterLimit; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) - { - AppDataPtr->BinFilters[i].EventID = CFE_EVS_FREE_SLOT; - AppDataPtr->BinFilters[i].Mask = 0; - AppDataPtr->BinFilters[i].Count = 0; - } + /* Initialize remainder of filters as unused */ + for (i = FilterLimit; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) + { + AppDataPtr->BinFilters[i].EventID = CFE_EVS_FREE_SLOT; + AppDataPtr->BinFilters[i].Mask = 0; + AppDataPtr->BinFilters[i].Count = 0; + } - EVS_AppDataSetUsed(AppDataPtr, AppID); - } - } + EVS_AppDataSetUsed(AppDataPtr, AppID); + } + } - return(Status); + return (Status); } /* End CFE_EVS_Register */ @@ -122,206 +120,205 @@ int32 CFE_EVS_Register (const void *Filters, uint16 NumEventFilters, uint16 Filt */ int32 CFE_EVS_Unregister(void) { - int32 Status; - CFE_ES_AppId_t AppID; - EVS_AppData_t *AppDataPtr; + int32 Status; + CFE_ES_AppId_t AppID; + EVS_AppData_t *AppDataPtr; - /* Query and verify the caller's AppID */ - Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); - if (Status == CFE_SUCCESS && - EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - EVS_AppDataSetFree(AppDataPtr); - } + /* Query and verify the caller's AppID */ + Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); + if (Status == CFE_SUCCESS && EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + EVS_AppDataSetFree(AppDataPtr); + } - return(Status); + return (Status); } /* End CFE_EVS_Unregister */ /* ** Function: CFE_EVS_SendEvent - See API and header file for details */ -int32 CFE_EVS_SendEvent (uint16 EventID, uint16 EventType, const char *Spec, ... ) +int32 CFE_EVS_SendEvent(uint16 EventID, uint16 EventType, const char *Spec, ...) { - int32 Status; - CFE_ES_AppId_t AppID; - CFE_TIME_SysTime_t Time; - va_list Ptr; - EVS_AppData_t *AppDataPtr; - - if(Spec == NULL){ - return CFE_EVS_INVALID_PARAMETER; - } - - /* Query and verify the caller's AppID */ - Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); - if (Status == CFE_SUCCESS) - { - if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - /* Handler for events from apps not registered with EVS */ - Status = EVS_NotRegistered(AppDataPtr, AppID); - } - else if (EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) - { - /* Get current spacecraft time */ - Time = CFE_TIME_GetTime(); - - /* Send the event packets */ - va_start(Ptr, Spec); - EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); - va_end(Ptr); - } - } - - return(Status); + int32 Status; + CFE_ES_AppId_t AppID; + CFE_TIME_SysTime_t Time; + va_list Ptr; + EVS_AppData_t * AppDataPtr; + + if (Spec == NULL) + { + return CFE_EVS_INVALID_PARAMETER; + } + + /* Query and verify the caller's AppID */ + Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); + if (Status == CFE_SUCCESS) + { + if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + /* Handler for events from apps not registered with EVS */ + Status = EVS_NotRegistered(AppDataPtr, AppID); + } + else if (EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) + { + /* Get current spacecraft time */ + Time = CFE_TIME_GetTime(); + + /* Send the event packets */ + va_start(Ptr, Spec); + EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); + va_end(Ptr); + } + } + + return (Status); } /* End CFE_EVS_SendEvent */ - /* ** Function: CFE_EVS_SendEventWithAppID - See API and header file for details */ -int32 CFE_EVS_SendEventWithAppID (uint16 EventID, uint16 EventType, CFE_ES_AppId_t AppID, const char *Spec, ... ) +int32 CFE_EVS_SendEventWithAppID(uint16 EventID, uint16 EventType, CFE_ES_AppId_t AppID, const char *Spec, ...) { - int32 Status = CFE_SUCCESS; - CFE_TIME_SysTime_t Time; - va_list Ptr; - EVS_AppData_t *AppDataPtr; - - if(Spec == NULL){ - return CFE_EVS_INVALID_PARAMETER; - } - - AppDataPtr = EVS_GetAppDataByID (AppID); - if (AppDataPtr == NULL) - { - Status = CFE_EVS_APP_ILLEGAL_APP_ID; - } - else if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - /* Handler for events from apps not registered with EVS */ - Status = EVS_NotRegistered(AppDataPtr, AppID); - } - else if (EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) - { - /* Get current spacecraft time */ - Time = CFE_TIME_GetTime(); - - /* Send the event packets */ - va_start(Ptr, Spec); - EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); - va_end(Ptr); - } - - return Status; + int32 Status = CFE_SUCCESS; + CFE_TIME_SysTime_t Time; + va_list Ptr; + EVS_AppData_t * AppDataPtr; + + if (Spec == NULL) + { + return CFE_EVS_INVALID_PARAMETER; + } + + AppDataPtr = EVS_GetAppDataByID(AppID); + if (AppDataPtr == NULL) + { + Status = CFE_EVS_APP_ILLEGAL_APP_ID; + } + else if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + /* Handler for events from apps not registered with EVS */ + Status = EVS_NotRegistered(AppDataPtr, AppID); + } + else if (EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) + { + /* Get current spacecraft time */ + Time = CFE_TIME_GetTime(); + + /* Send the event packets */ + va_start(Ptr, Spec); + EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); + va_end(Ptr); + } + + return Status; } /* End CFE_EVS_SendEventWithAppID */ /* ** Function: CFE_EVS_SendTimedEvent - See API and header file for details */ -int32 CFE_EVS_SendTimedEvent (CFE_TIME_SysTime_t Time, uint16 EventID, uint16 EventType, const char *Spec, ... ) +int32 CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, uint16 EventID, uint16 EventType, const char *Spec, ...) { - int32 Status; - CFE_ES_AppId_t AppID; - va_list Ptr; - EVS_AppData_t *AppDataPtr; - - if(Spec == NULL){ - return CFE_EVS_INVALID_PARAMETER; - } - - /* Query and verify the caller's AppID */ - Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); - if (Status == CFE_SUCCESS) - { - if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - /* Handler for events from apps not registered with EVS */ - Status = EVS_NotRegistered(AppDataPtr, AppID); - } - else if (EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) - { - /* Send the event packets */ - va_start(Ptr, Spec); - EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); - va_end(Ptr); - } - } - - return(Status); + int32 Status; + CFE_ES_AppId_t AppID; + va_list Ptr; + EVS_AppData_t *AppDataPtr; + + if (Spec == NULL) + { + return CFE_EVS_INVALID_PARAMETER; + } + + /* Query and verify the caller's AppID */ + Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); + if (Status == CFE_SUCCESS) + { + if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + /* Handler for events from apps not registered with EVS */ + Status = EVS_NotRegistered(AppDataPtr, AppID); + } + else if (EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) + { + /* Send the event packets */ + va_start(Ptr, Spec); + EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); + va_end(Ptr); + } + } + + return (Status); } /* End CFE_EVS_SendTimedEvent */ /* ** Function: CFE_EVS_ResetFilter - See API and header file for details */ -int32 CFE_EVS_ResetFilter (int16 EventID) +int32 CFE_EVS_ResetFilter(int16 EventID) { - int32 Status; - EVS_BinFilter_t *FilterPtr = NULL; - CFE_ES_AppId_t AppID; - EVS_AppData_t *AppDataPtr; - - /* Query and verify the caller's AppID */ - Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); - if (Status == CFE_SUCCESS) - { - if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - Status = CFE_EVS_APP_NOT_REGISTERED; - } - else - { - FilterPtr = EVS_FindEventID(EventID, AppDataPtr->BinFilters); - - if (FilterPtr != NULL) - { - FilterPtr->Count = 0; - } - else - { - Status = CFE_EVS_EVT_NOT_REGISTERED; - } - } - } - - return(Status); + int32 Status; + EVS_BinFilter_t *FilterPtr = NULL; + CFE_ES_AppId_t AppID; + EVS_AppData_t * AppDataPtr; + + /* Query and verify the caller's AppID */ + Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); + if (Status == CFE_SUCCESS) + { + if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + Status = CFE_EVS_APP_NOT_REGISTERED; + } + else + { + FilterPtr = EVS_FindEventID(EventID, AppDataPtr->BinFilters); + + if (FilterPtr != NULL) + { + FilterPtr->Count = 0; + } + else + { + Status = CFE_EVS_EVT_NOT_REGISTERED; + } + } + } -} /* End CFE_EVS_ResetFilter */ + return (Status); +} /* End CFE_EVS_ResetFilter */ /* ** Function: CFE_EVS_ResetAllFilters - See API and header file for details */ -int32 CFE_EVS_ResetAllFilters ( void ) +int32 CFE_EVS_ResetAllFilters(void) { - int32 Status; - CFE_ES_AppId_t AppID; - uint32 i; - EVS_AppData_t *AppDataPtr; - - /* Query and verify the caller's AppID */ - Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); - if (Status == CFE_SUCCESS) - { - if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - Status = CFE_EVS_APP_NOT_REGISTERED; - } - else - { - for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) - { - AppDataPtr->BinFilters[i].Count = 0; - } - } - } - - return(Status); + int32 Status; + CFE_ES_AppId_t AppID; + uint32 i; + EVS_AppData_t *AppDataPtr; + + /* Query and verify the caller's AppID */ + Status = EVS_GetCurrentContext(&AppDataPtr, &AppID); + if (Status == CFE_SUCCESS) + { + if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + Status = CFE_EVS_APP_NOT_REGISTERED; + } + else + { + for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) + { + AppDataPtr->BinFilters[i].Count = 0; + } + } + } -} /* End CFE_EVS_ResetAllFilters */ + return (Status); +} /* End CFE_EVS_ResetAllFilters */ /* End CFE_EVS.C */ diff --git a/modules/evs/fsw/src/cfe_evs_log.c b/modules/evs/fsw/src/cfe_evs_log.c index 022d68a4e..bd665e005 100644 --- a/modules/evs/fsw/src/cfe_evs_log.c +++ b/modules/evs/fsw/src/cfe_evs_log.c @@ -33,7 +33,6 @@ #include - /* ** Function Prologue ** @@ -44,57 +43,55 @@ ** Assumptions and Notes: ** */ -void EVS_AddLog (CFE_EVS_LongEventTlm_t *EVS_PktPtr) +void EVS_AddLog(CFE_EVS_LongEventTlm_t *EVS_PktPtr) { - /* Serialize access to event log control variables */ - OS_MutSemTake(CFE_EVS_Global.EVS_SharedDataMutexID); - - if ((CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true) && - (CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_DISCARD)) - { - /* If log is full and in discard mode, just count the event */ - CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter++; - } - else - { - if (CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true) - { - /* If log is full and in wrap mode, count it and store it */ - CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter++; - } - - /* Copy the event data to the next available entry in the log */ - memcpy(&CFE_EVS_Global.EVS_LogPtr->LogEntry[CFE_EVS_Global.EVS_LogPtr->Next], - EVS_PktPtr, sizeof(*EVS_PktPtr)); - - CFE_EVS_Global.EVS_LogPtr->Next++; - - if (CFE_EVS_Global.EVS_LogPtr->Next >= CFE_PLATFORM_EVS_LOG_MAX) - { - /* This is important, even if we are in discard mode */ - CFE_EVS_Global.EVS_LogPtr->Next = 0; - } - - /* Log count cannot exceed the number of entries in the log */ - if (CFE_EVS_Global.EVS_LogPtr->LogCount < CFE_PLATFORM_EVS_LOG_MAX) - { - CFE_EVS_Global.EVS_LogPtr->LogCount++; - - if (CFE_EVS_Global.EVS_LogPtr->LogCount == CFE_PLATFORM_EVS_LOG_MAX) - { - /* The full flag and log count are somewhat redundant */ - CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true; - } - } - } - - OS_MutSemGive(CFE_EVS_Global.EVS_SharedDataMutexID); - - return; + /* Serialize access to event log control variables */ + OS_MutSemTake(CFE_EVS_Global.EVS_SharedDataMutexID); -} /* End EVS_AddLog */ + if ((CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true) && + (CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_DISCARD)) + { + /* If log is full and in discard mode, just count the event */ + CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter++; + } + else + { + if (CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true) + { + /* If log is full and in wrap mode, count it and store it */ + CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter++; + } + + /* Copy the event data to the next available entry in the log */ + memcpy(&CFE_EVS_Global.EVS_LogPtr->LogEntry[CFE_EVS_Global.EVS_LogPtr->Next], EVS_PktPtr, sizeof(*EVS_PktPtr)); + + CFE_EVS_Global.EVS_LogPtr->Next++; + + if (CFE_EVS_Global.EVS_LogPtr->Next >= CFE_PLATFORM_EVS_LOG_MAX) + { + /* This is important, even if we are in discard mode */ + CFE_EVS_Global.EVS_LogPtr->Next = 0; + } + /* Log count cannot exceed the number of entries in the log */ + if (CFE_EVS_Global.EVS_LogPtr->LogCount < CFE_PLATFORM_EVS_LOG_MAX) + { + CFE_EVS_Global.EVS_LogPtr->LogCount++; + + if (CFE_EVS_Global.EVS_LogPtr->LogCount == CFE_PLATFORM_EVS_LOG_MAX) + { + /* The full flag and log count are somewhat redundant */ + CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true; + } + } + } + + OS_MutSemGive(CFE_EVS_Global.EVS_SharedDataMutexID); + + return; + +} /* End EVS_AddLog */ /* ** Function Prologue @@ -106,28 +103,26 @@ void EVS_AddLog (CFE_EVS_LongEventTlm_t *EVS_PktPtr) ** Assumptions and Notes: ** */ -void EVS_ClearLog ( void ) +void EVS_ClearLog(void) { - /* Serialize access to event log control variables */ - OS_MutSemTake(CFE_EVS_Global.EVS_SharedDataMutexID); + /* Serialize access to event log control variables */ + OS_MutSemTake(CFE_EVS_Global.EVS_SharedDataMutexID); - /* Clears everything but LogMode (overwrite vs discard) */ - CFE_EVS_Global.EVS_LogPtr->Next = 0; - CFE_EVS_Global.EVS_LogPtr->LogCount = 0; - CFE_EVS_Global.EVS_LogPtr->LogFullFlag = false; - CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter = 0; + /* Clears everything but LogMode (overwrite vs discard) */ + CFE_EVS_Global.EVS_LogPtr->Next = 0; + CFE_EVS_Global.EVS_LogPtr->LogCount = 0; + CFE_EVS_Global.EVS_LogPtr->LogFullFlag = false; + CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter = 0; - memset(CFE_EVS_Global.EVS_LogPtr->LogEntry, 0, - sizeof(CFE_EVS_Global.EVS_LogPtr->LogEntry)); + memset(CFE_EVS_Global.EVS_LogPtr->LogEntry, 0, sizeof(CFE_EVS_Global.EVS_LogPtr->LogEntry)); - OS_MutSemGive(CFE_EVS_Global.EVS_SharedDataMutexID); + OS_MutSemGive(CFE_EVS_Global.EVS_SharedDataMutexID); - return; + return; } /* End EVS_ClearLog */ - /* ** Function Prologue ** @@ -141,17 +136,17 @@ void EVS_ClearLog ( void ) int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data) { const CFE_EVS_LogFileCmd_Payload_t *CmdPtr = &data->Payload; - int32 Result; - int32 LogIndex; - int32 BytesWritten; - osal_id_t LogFileHandle; - uint32 i; - CFE_FS_Header_t LogFileHdr; - char LogFilename[OS_MAX_PATH_LEN]; + int32 Result; + int32 LogIndex; + int32 BytesWritten; + osal_id_t LogFileHandle; + uint32 i; + CFE_FS_Header_t LogFileHdr; + char LogFilename[OS_MAX_PATH_LEN]; /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(LogFilename, (const char *)CmdPtr->LogFilename, CFE_PLATFORM_EVS_DEFAULT_LOG_FILE, - sizeof(LogFilename), sizeof(CmdPtr->LogFilename)); + sizeof(LogFilename), sizeof(CmdPtr->LogFilename)); /* Create the log file */ Result = OS_OpenCreate(&LogFileHandle, LogFilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); @@ -159,8 +154,8 @@ int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data) if (Result < OS_SUCCESS) { EVS_SendEvent(CFE_EVS_ERR_CRLOGFILE_EID, CFE_EVS_EventType_ERROR, - "Write Log File Command Error: OS_OpenCreate = 0x%08X, filename = %s", - (unsigned int)Result, LogFilename); + "Write Log File Command Error: OS_OpenCreate = 0x%08X, filename = %s", (unsigned int)Result, + LogFilename); } else { @@ -193,9 +188,8 @@ int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data) /* Write all the "in-use" event log entries to the file */ for (i = 0; i < CFE_EVS_Global.EVS_LogPtr->LogCount; i++) { - BytesWritten = OS_write(LogFileHandle, - &CFE_EVS_Global.EVS_LogPtr->LogEntry[LogIndex], - sizeof(CFE_EVS_Global.EVS_LogPtr->LogEntry[LogIndex])); + BytesWritten = OS_write(LogFileHandle, &CFE_EVS_Global.EVS_LogPtr->LogEntry[LogIndex], + sizeof(CFE_EVS_Global.EVS_LogPtr->LogEntry[LogIndex])); if (BytesWritten == sizeof(CFE_EVS_Global.EVS_LogPtr->LogEntry[LogIndex])) { @@ -218,26 +212,25 @@ int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data) if (i == CFE_EVS_Global.EVS_LogPtr->LogCount) { EVS_SendEvent(CFE_EVS_WRLOG_EID, CFE_EVS_EventType_DEBUG, - "Write Log File Command: %d event log entries written to %s", - (int)CFE_EVS_Global.EVS_LogPtr->LogCount, LogFilename); + "Write Log File Command: %d event log entries written to %s", + (int)CFE_EVS_Global.EVS_LogPtr->LogCount, LogFilename); Result = CFE_SUCCESS; } else { EVS_SendEvent(CFE_EVS_ERR_WRLOGFILE_EID, CFE_EVS_EventType_ERROR, - "Write Log File Command Error: OS_write = 0x%08X, filename = %s", - (unsigned int)BytesWritten, LogFilename); + "Write Log File Command Error: OS_write = 0x%08X, filename = %s", + (unsigned int)BytesWritten, LogFilename); } } OS_close(LogFileHandle); } - return(Result); + return (Result); } /* End CFE_EVS_WriteLogDataFileCmd */ - /* ** Function Prologue ** @@ -251,7 +244,7 @@ int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data) int32 CFE_EVS_SetLogModeCmd(const CFE_EVS_SetLogModeCmd_t *data) { const CFE_EVS_SetLogMode_Payload_t *CmdPtr = &data->Payload; - int32 Status; + int32 Status; if ((CmdPtr->LogMode == CFE_EVS_LogMode_OVERWRITE) || (CmdPtr->LogMode == CFE_EVS_LogMode_DISCARD)) { @@ -260,16 +253,16 @@ int32 CFE_EVS_SetLogModeCmd(const CFE_EVS_SetLogModeCmd_t *data) CFE_EVS_Global.EVS_LogPtr->LogMode = CmdPtr->LogMode; OS_MutSemGive(CFE_EVS_Global.EVS_SharedDataMutexID); - EVS_SendEvent(CFE_EVS_LOGMODE_EID, CFE_EVS_EventType_DEBUG, - "Set Log Mode Command: Log Mode = %d", (int)CmdPtr->LogMode); + EVS_SendEvent(CFE_EVS_LOGMODE_EID, CFE_EVS_EventType_DEBUG, "Set Log Mode Command: Log Mode = %d", + (int)CmdPtr->LogMode); Status = CFE_SUCCESS; } else { Status = CFE_EVS_INVALID_PARAMETER; - EVS_SendEvent(CFE_EVS_ERR_LOGMODE_EID, CFE_EVS_EventType_ERROR, - "Set Log Mode Command Error: Log Mode = %d", (int)CmdPtr->LogMode); + EVS_SendEvent(CFE_EVS_ERR_LOGMODE_EID, CFE_EVS_EventType_ERROR, "Set Log Mode Command Error: Log Mode = %d", + (int)CmdPtr->LogMode); } return Status; diff --git a/modules/evs/fsw/src/cfe_evs_log.h b/modules/evs/fsw/src/cfe_evs_log.h index 736d7c919..12f4a0c28 100644 --- a/modules/evs/fsw/src/cfe_evs_log.h +++ b/modules/evs/fsw/src/cfe_evs_log.h @@ -23,15 +23,15 @@ ** ** Title: Event Services API Log Control Interfaces. ** -** Purpose: +** Purpose: ** Unit specification for the event services log control interfaces. ** ** Contents: -** I. macro and constant type definitions +** I. macro and constant type definitions ** II. EVM internal structures ** III. function prototypes ** -** Design Notes: +** Design Notes: ** ** References: ** Flight Software Branch C Coding Standard Version 1.0a @@ -45,17 +45,17 @@ /********************* Include Files ************************/ -#include "cfe_evs_msg.h" /* EVS public definitions */ +#include "cfe_evs_msg.h" /* EVS public definitions */ /* ============== Section I: Macro and Constant Type Definitions =========== */ -/* ============== Section II: Internal Structures ============ */ +/* ============== Section II: Internal Structures ============ */ /* ============== Section III: Function Prototypes =========== */ -void EVS_AddLog ( CFE_EVS_LongEventTlm_t *EVS_PktPtr ); -void EVS_ClearLog ( void ); +void EVS_AddLog(CFE_EVS_LongEventTlm_t *EVS_PktPtr); +void EVS_ClearLog(void); int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data); int32 CFE_EVS_SetLogModeCmd(const CFE_EVS_SetLogModeCmd_t *data); -#endif /* _cfe_evs_log_ */ +#endif /* _cfe_evs_log_ */ diff --git a/modules/evs/fsw/src/cfe_evs_module_all.h b/modules/evs/fsw/src/cfe_evs_module_all.h index 4d9c9ec33..487d32aa9 100644 --- a/modules/evs/fsw/src/cfe_evs_module_all.h +++ b/modules/evs/fsw/src/cfe_evs_module_all.h @@ -20,10 +20,10 @@ /** * @file cfe_evs_module_all.h - * + * * Encapsulates all EVS module internal header files, as well * as the public API from all other CFE core modules, OSAL, and PSP. - * + * * This simplifies the set of include files that need to be put at the * start of every source file. */ @@ -33,7 +33,7 @@ /********************* Include Files ************************/ -#include "cfe.h" /* All CFE+OSAL public API definitions */ +#include "cfe.h" /* All CFE+OSAL public API definitions */ #include "cfe_platform_cfg.h" #include "cfe_msgids.h" @@ -41,10 +41,9 @@ #include "cfe_evs_core_internal.h" -#include "cfe_evs_events.h" /* EVS event IDs */ -#include "cfe_evs_task.h" /* EVS internal definitions */ -#include "cfe_evs_log.h" /* EVS log file definitions */ -#include "cfe_evs_utils.h" /* EVS utility function definitions */ +#include "cfe_evs_events.h" /* EVS event IDs */ +#include "cfe_evs_task.h" /* EVS internal definitions */ +#include "cfe_evs_log.h" /* EVS log file definitions */ +#include "cfe_evs_utils.h" /* EVS utility function definitions */ - -#endif /* CFE_EVS_MODULE_ALL_H */ +#endif /* CFE_EVS_MODULE_ALL_H */ diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index b480ed9c4..e225fc0e7 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -31,11 +31,11 @@ /* Include Files */ #include "cfe_evs_module_all.h" /* All EVS internal definitions and API */ -#include "cfe_version.h" /* cFE version definitions */ +#include "cfe_version.h" /* cFE version definitions */ #include -#include "cfe_es_resetdata_typedef.h" /* Definition of CFE_ES_ResetData_t */ +#include "cfe_es_resetdata_typedef.h" /* Definition of CFE_ES_ResetData_t */ /* Global Data */ CFE_EVS_Global_t CFE_EVS_Global; @@ -46,12 +46,11 @@ CFE_EVS_Global_t CFE_EVS_Global; /* ** Local function prototypes. */ -void CFE_EVS_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr, 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 */ - /* ** Function Prologue ** @@ -64,124 +63,119 @@ bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); ** necessary to support EVS API calls that might occur before ** the EVS application has completed its startup initialization. */ -int32 CFE_EVS_EarlyInit ( void ) +int32 CFE_EVS_EarlyInit(void) { - int32 Status; - uint32 resetAreaSize = 0; - cpuaddr resetAreaAddr; - CFE_ES_ResetData_t *CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *) NULL; - - memset(&CFE_EVS_Global, 0, sizeof(CFE_EVS_Global)); - - /* Initialize housekeeping packet */ - CFE_MSG_Init(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), - sizeof(CFE_EVS_Global.EVS_TlmPkt)); - - /* Elements stored in the hk packet that have non-zero default values */ - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE; - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort = CFE_PLATFORM_EVS_PORT_DEFAULT; - CFE_EVS_Global.EVS_TlmPkt.Payload.LogFullFlag = false; - CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; - - /* Get a pointer to the CFE reset area from the BSP */ - Status = CFE_PSP_GetResetArea(&resetAreaAddr, &resetAreaSize); - - /* Panic on error */ - if (Status != CFE_PSP_SUCCESS) - { - /* Can't log evs messages without the reset area */ - CFE_ES_WriteToSysLog("EVS call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", (unsigned int)Status); - - /* Delay to allow message to be read */ - OS_TaskDelay(CFE_EVS_PANIC_DELAY); - - CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); - } - else if (resetAreaSize < sizeof(CFE_ES_ResetData_t)) - { - /* Got the pointer but the size is wrong */ - Status = CFE_EVS_RESET_AREA_POINTER; - CFE_ES_WriteToSysLog("Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", - (unsigned long)sizeof(CFE_ES_ResetData_t), (unsigned long)resetAreaSize); - - /* Delay to allow message to be read */ - OS_TaskDelay(CFE_EVS_PANIC_DELAY); - - CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); - } - else - { - Status = CFE_SUCCESS; - } - - if (Status == CFE_SUCCESS) - { - CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)resetAreaAddr; - /* Save pointer to the EVS portion of the CFE reset area */ - CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; - - /* Create semaphore to serialize access to event log */ - Status = OS_MutSemCreate(&CFE_EVS_Global.EVS_SharedDataMutexID, "CFE_EVS_DataMutex", 0); - - if (Status != OS_SUCCESS) - { - CFE_ES_WriteToSysLog("EVS call to OS_MutSemCreate failed, RC=0x%08x\n", (unsigned int)Status); - - /* Delay to allow message to be read */ - OS_TaskDelay(CFE_EVS_PANIC_DELAY); - - CFE_PSP_Panic(CFE_PSP_PANIC_STARTUP_SEM); - } - else - { - Status = CFE_SUCCESS; - } - } - - if (Status == CFE_SUCCESS) - { - - /* Report log as enabled */ - CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; - - /* Clear event log if power-on reset or bad contents */ - if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON) - { - CFE_ES_WriteToSysLog("Event Log cleared following power-on reset\n"); - EVS_ClearLog(); - CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; - } - else if (((CFE_EVS_Global.EVS_LogPtr->LogMode != CFE_EVS_LogMode_OVERWRITE) && - (CFE_EVS_Global.EVS_LogPtr->LogMode != CFE_EVS_LogMode_DISCARD)) || - ((CFE_EVS_Global.EVS_LogPtr->LogFullFlag != false) && - (CFE_EVS_Global.EVS_LogPtr->LogFullFlag != true)) || - (CFE_EVS_Global.EVS_LogPtr->Next >= CFE_PLATFORM_EVS_LOG_MAX)) - { - CFE_ES_WriteToSysLog("Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", - (int)CFE_EVS_Global.EVS_LogPtr->Next, - (int)CFE_EVS_Global.EVS_LogPtr->LogCount, - (int)CFE_EVS_Global.EVS_LogPtr->LogFullFlag, - (int)CFE_EVS_Global.EVS_LogPtr->LogMode, - (int)CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter); - EVS_ClearLog(); - CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; - } - else - { - CFE_ES_WriteToSysLog("Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", - (int)CFE_EVS_Global.EVS_LogPtr->Next, - (int)CFE_EVS_Global.EVS_LogPtr->LogCount, - (int)CFE_EVS_Global.EVS_LogPtr->LogFullFlag, - (int)CFE_EVS_Global.EVS_LogPtr->LogMode, - (int)CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter); - } - } - - return(Status); + int32 Status; + uint32 resetAreaSize = 0; + cpuaddr resetAreaAddr; + CFE_ES_ResetData_t *CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)NULL; -} /* End CFE_EVS_EarlyInit */ + memset(&CFE_EVS_Global, 0, sizeof(CFE_EVS_Global)); + + /* Initialize housekeeping packet */ + CFE_MSG_Init(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), + sizeof(CFE_EVS_Global.EVS_TlmPkt)); + + /* Elements stored in the hk packet that have non-zero default values */ + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE; + CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort = CFE_PLATFORM_EVS_PORT_DEFAULT; + CFE_EVS_Global.EVS_TlmPkt.Payload.LogFullFlag = false; + CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; + /* Get a pointer to the CFE reset area from the BSP */ + Status = CFE_PSP_GetResetArea(&resetAreaAddr, &resetAreaSize); + + /* Panic on error */ + if (Status != CFE_PSP_SUCCESS) + { + /* Can't log evs messages without the reset area */ + CFE_ES_WriteToSysLog("EVS call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", (unsigned int)Status); + + /* Delay to allow message to be read */ + OS_TaskDelay(CFE_EVS_PANIC_DELAY); + + CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); + } + else if (resetAreaSize < sizeof(CFE_ES_ResetData_t)) + { + /* Got the pointer but the size is wrong */ + Status = CFE_EVS_RESET_AREA_POINTER; + CFE_ES_WriteToSysLog("Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", + (unsigned long)sizeof(CFE_ES_ResetData_t), (unsigned long)resetAreaSize); + + /* Delay to allow message to be read */ + OS_TaskDelay(CFE_EVS_PANIC_DELAY); + + CFE_PSP_Panic(CFE_PSP_PANIC_MEMORY_ALLOC); + } + else + { + Status = CFE_SUCCESS; + } + + if (Status == CFE_SUCCESS) + { + CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)resetAreaAddr; + /* Save pointer to the EVS portion of the CFE reset area */ + CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; + + /* Create semaphore to serialize access to event log */ + Status = OS_MutSemCreate(&CFE_EVS_Global.EVS_SharedDataMutexID, "CFE_EVS_DataMutex", 0); + + if (Status != OS_SUCCESS) + { + CFE_ES_WriteToSysLog("EVS call to OS_MutSemCreate failed, RC=0x%08x\n", (unsigned int)Status); + + /* Delay to allow message to be read */ + OS_TaskDelay(CFE_EVS_PANIC_DELAY); + + CFE_PSP_Panic(CFE_PSP_PANIC_STARTUP_SEM); + } + else + { + Status = CFE_SUCCESS; + } + } + + if (Status == CFE_SUCCESS) + { + + /* Report log as enabled */ + CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; + + /* Clear event log if power-on reset or bad contents */ + if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON) + { + CFE_ES_WriteToSysLog("Event Log cleared following power-on reset\n"); + EVS_ClearLog(); + CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; + } + else if (((CFE_EVS_Global.EVS_LogPtr->LogMode != CFE_EVS_LogMode_OVERWRITE) && + (CFE_EVS_Global.EVS_LogPtr->LogMode != CFE_EVS_LogMode_DISCARD)) || + ((CFE_EVS_Global.EVS_LogPtr->LogFullFlag != false) && + (CFE_EVS_Global.EVS_LogPtr->LogFullFlag != true)) || + (CFE_EVS_Global.EVS_LogPtr->Next >= CFE_PLATFORM_EVS_LOG_MAX)) + { + CFE_ES_WriteToSysLog("Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", + (int)CFE_EVS_Global.EVS_LogPtr->Next, (int)CFE_EVS_Global.EVS_LogPtr->LogCount, + (int)CFE_EVS_Global.EVS_LogPtr->LogFullFlag, (int)CFE_EVS_Global.EVS_LogPtr->LogMode, + (int)CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter); + EVS_ClearLog(); + CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; + } + else + { + CFE_ES_WriteToSysLog("Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", + (int)CFE_EVS_Global.EVS_LogPtr->Next, (int)CFE_EVS_Global.EVS_LogPtr->LogCount, + (int)CFE_EVS_Global.EVS_LogPtr->LogFullFlag, (int)CFE_EVS_Global.EVS_LogPtr->LogMode, + (int)CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter); + } + } + + return (Status); + +} /* End CFE_EVS_EarlyInit */ /* ** Function Prologue @@ -194,24 +188,23 @@ int32 CFE_EVS_EarlyInit ( void ) */ int32 CFE_EVS_CleanUpApp(CFE_ES_AppId_t AppID) { - int32 Status = CFE_SUCCESS; - EVS_AppData_t *AppDataPtr; - - /* Query and verify the caller's AppID */ - AppDataPtr = EVS_GetAppDataByID(AppID); - if (AppDataPtr == NULL) - { - Status = CFE_EVS_APP_ILLEGAL_APP_ID; - } - else if (EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - /* Same cleanup as CFE_EVS_Unregister() */ - EVS_AppDataSetFree(AppDataPtr); - } - - return(Status); -} + int32 Status = CFE_SUCCESS; + EVS_AppData_t *AppDataPtr; + /* Query and verify the caller's AppID */ + AppDataPtr = EVS_GetAppDataByID(AppID); + if (AppDataPtr == NULL) + { + Status = CFE_EVS_APP_ILLEGAL_APP_ID; + } + else if (EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + /* Same cleanup as CFE_EVS_Unregister() */ + EVS_AppDataSetFree(AppDataPtr); + } + + return (Status); +} /* ** Function Prologue @@ -225,20 +218,20 @@ int32 CFE_EVS_CleanUpApp(CFE_ES_AppId_t AppID) */ void CFE_EVS_TaskMain(void) { - int32 Status; - CFE_SB_Buffer_t *SBBufPtr; + int32 Status; + CFE_SB_Buffer_t *SBBufPtr; + + CFE_ES_PerfLogEntry(CFE_MISSION_EVS_MAIN_PERF_ID); - CFE_ES_PerfLogEntry(CFE_MISSION_EVS_MAIN_PERF_ID); - Status = CFE_EVS_TaskInit(); - - if(Status != CFE_SUCCESS) + + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("EVS:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); - CFE_ES_PerfLogExit(CFE_MISSION_EVS_MAIN_PERF_ID); - /* Note: CFE_ES_ExitApp will not return */ - CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); - }/* end if */ + CFE_ES_WriteToSysLog("EVS:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_PerfLogExit(CFE_MISSION_EVS_MAIN_PERF_ID); + /* Note: CFE_ES_ExitApp will not return */ + CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); + } /* end if */ /* * Wait for other apps to start. @@ -253,13 +246,11 @@ void CFE_EVS_TaskMain(void) { /* Increment the Main task Execution Counter */ CFE_ES_IncrementTaskCounter(); - + CFE_ES_PerfLogExit(CFE_MISSION_EVS_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_ReceiveBuffer(&SBBufPtr, - CFE_EVS_Global.EVS_CommandPipe, - CFE_SB_PEND_FOREVER); + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_EVS_Global.EVS_CommandPipe, CFE_SB_PEND_FOREVER); CFE_ES_PerfLogEntry(CFE_MISSION_EVS_MAIN_PERF_ID); @@ -267,19 +258,19 @@ void CFE_EVS_TaskMain(void) { /* Process cmd pipe msg */ CFE_EVS_ProcessCommandPacket(SBBufPtr); - }else{ - CFE_ES_WriteToSysLog("EVS:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); - }/* end if */ - - }/* end while */ + } + 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_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); } /* end CFE_EVS_TaskMain */ - - /* ** Function Prologue ** @@ -290,68 +281,65 @@ void CFE_EVS_TaskMain(void) ** Assumptions and Notes: ** */ -int32 CFE_EVS_TaskInit ( void ) +int32 CFE_EVS_TaskInit(void) { - int32 Status; - CFE_ES_AppId_t AppID; - - /* Register EVS application */ - Status = CFE_ES_RegisterApp(); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("EVS:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - } - - /* Query and verify the AppID */ - Status = CFE_ES_GetAppID(&AppID); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("EVS:Call to CFE_ES_GetAppID Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - } - - /* Register EVS task for event services */ - Status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("EVS:Call to CFE_EVS_Register Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - } - - /* Create software bus command pipe */ - Status = CFE_SB_CreatePipe(&CFE_EVS_Global.EVS_CommandPipe, - CFE_EVS_PIPE_DEPTH, CFE_EVS_PIPE_NAME); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("EVS:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - } - - /* Subscribe to command and telemetry requests coming in on the command pipe */ - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_EVS_CMD_MID), CFE_EVS_Global.EVS_CommandPipe); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("EVS:Subscribing to Cmds Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - } - - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_EVS_SEND_HK_MID), CFE_EVS_Global.EVS_CommandPipe); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("EVS:Subscribing to HK Request Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - } - - /* Write the AppID to the global location, now that the rest of initialization is done */ - CFE_EVS_Global.EVS_AppID = AppID; - EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized.%s", CFE_VERSION_STRING); - - return CFE_SUCCESS; + int32 Status; + CFE_ES_AppId_t AppID; -} /* End CFE_EVS_TaskInit */ + /* Register EVS application */ + Status = CFE_ES_RegisterApp(); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("EVS:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } + /* Query and verify the AppID */ + Status = CFE_ES_GetAppID(&AppID); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("EVS:Call to CFE_ES_GetAppID Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } + /* Register EVS task for event services */ + Status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("EVS:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } + + /* Create software bus command pipe */ + Status = CFE_SB_CreatePipe(&CFE_EVS_Global.EVS_CommandPipe, CFE_EVS_PIPE_DEPTH, CFE_EVS_PIPE_NAME); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("EVS:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } + + /* Subscribe to command and telemetry requests coming in on the command pipe */ + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_EVS_CMD_MID), CFE_EVS_Global.EVS_CommandPipe); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("EVS:Subscribing to Cmds Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } + + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_EVS_SEND_HK_MID), CFE_EVS_Global.EVS_CommandPipe); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("EVS:Subscribing to HK Request Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } + + /* Write the AppID to the global location, now that the rest of initialization is done */ + CFE_EVS_Global.EVS_AppID = AppID; + EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized.%s", CFE_VERSION_STRING); + + return CFE_SUCCESS; + +} /* End CFE_EVS_TaskInit */ /* ** Function Prologue @@ -365,7 +353,7 @@ int32 CFE_EVS_TaskInit ( void ) */ void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr) { - CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); @@ -385,8 +373,7 @@ void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr) default: /* Unknown command -- should never occur */ CFE_EVS_Global.EVS_TlmPkt.Payload.CommandErrorCounter++; - EVS_SendEvent(CFE_EVS_ERR_MSGID_EID, CFE_EVS_EventType_ERROR, - "Invalid command packet, Message ID = 0x%08X", + EVS_SendEvent(CFE_EVS_ERR_MSGID_EID, CFE_EVS_EventType_ERROR, "Invalid command packet, Message ID = 0x%08X", (unsigned int)CFE_SB_MsgIdToValue(MessageID)); break; } @@ -395,7 +382,6 @@ void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr) } /* End CFE_EVS_ProcessCommandPacket */ - /* ** Function Prologue ** @@ -409,208 +395,205 @@ void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr) */ 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(&SBBufPtr->Msg, &FcnCode); + /* status will get reset if it passes length check */ + int32 Status = CFE_STATUS_WRONG_MSG_LENGTH; + CFE_MSG_FcnCode_t FcnCode = 0; - /* Process "known" EVS task ground commands */ - switch (FcnCode) - { - case CFE_EVS_NOOP_CC: + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_NoopCmd_t))) - { - Status = CFE_EVS_NoopCmd((CFE_EVS_NoopCmd_t*)SBBufPtr); - } - break; + /* Process "known" EVS task ground commands */ + switch (FcnCode) + { + case CFE_EVS_NOOP_CC: - case CFE_EVS_RESET_COUNTERS_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_NoopCmd_t))) + { + Status = CFE_EVS_NoopCmd((CFE_EVS_NoopCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetCountersCmd_t))) - { - Status = CFE_EVS_ResetCountersCmd((CFE_EVS_ResetCountersCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_RESET_COUNTERS_CC: - case CFE_EVS_ENABLE_EVENT_TYPE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetCountersCmd_t))) + { + Status = CFE_EVS_ResetCountersCmd((CFE_EVS_ResetCountersCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableEventTypeCmd_t))) - { - Status = CFE_EVS_EnableEventTypeCmd((CFE_EVS_EnableEventTypeCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_ENABLE_EVENT_TYPE_CC: - case CFE_EVS_DISABLE_EVENT_TYPE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableEventTypeCmd_t))) + { + Status = CFE_EVS_EnableEventTypeCmd((CFE_EVS_EnableEventTypeCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableEventTypeCmd_t))) - { - Status = CFE_EVS_DisableEventTypeCmd((CFE_EVS_DisableEventTypeCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_DISABLE_EVENT_TYPE_CC: - case CFE_EVS_SET_EVENT_FORMAT_MODE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableEventTypeCmd_t))) + { + Status = CFE_EVS_DisableEventTypeCmd((CFE_EVS_DisableEventTypeCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetEventFormatModeCmd_t))) - { - Status = CFE_EVS_SetEventFormatModeCmd((CFE_EVS_SetEventFormatModeCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_SET_EVENT_FORMAT_MODE_CC: - case CFE_EVS_ENABLE_APP_EVENT_TYPE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetEventFormatModeCmd_t))) + { + Status = CFE_EVS_SetEventFormatModeCmd((CFE_EVS_SetEventFormatModeCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableAppEventTypeCmd_t))) - { - Status = CFE_EVS_EnableAppEventTypeCmd((CFE_EVS_EnableAppEventTypeCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_ENABLE_APP_EVENT_TYPE_CC: - case CFE_EVS_DISABLE_APP_EVENT_TYPE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableAppEventTypeCmd_t))) + { + Status = CFE_EVS_EnableAppEventTypeCmd((CFE_EVS_EnableAppEventTypeCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableAppEventTypeCmd_t))) - { - Status = CFE_EVS_DisableAppEventTypeCmd((CFE_EVS_DisableAppEventTypeCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_DISABLE_APP_EVENT_TYPE_CC: - case CFE_EVS_ENABLE_APP_EVENTS_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableAppEventTypeCmd_t))) + { + Status = CFE_EVS_DisableAppEventTypeCmd((CFE_EVS_DisableAppEventTypeCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableAppEventsCmd_t))) - { - Status = CFE_EVS_EnableAppEventsCmd((CFE_EVS_EnableAppEventsCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_ENABLE_APP_EVENTS_CC: - case CFE_EVS_DISABLE_APP_EVENTS_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnableAppEventsCmd_t))) + { + Status = CFE_EVS_EnableAppEventsCmd((CFE_EVS_EnableAppEventsCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableAppEventsCmd_t))) - { - Status = CFE_EVS_DisableAppEventsCmd((CFE_EVS_DisableAppEventsCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_DISABLE_APP_EVENTS_CC: - case CFE_EVS_RESET_APP_COUNTER_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisableAppEventsCmd_t))) + { + Status = CFE_EVS_DisableAppEventsCmd((CFE_EVS_DisableAppEventsCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetAppCounterCmd_t))) - { - Status = CFE_EVS_ResetAppCounterCmd((CFE_EVS_ResetAppCounterCmd_t*)SBBufPtr); - } - break; + case CFE_EVS_RESET_APP_COUNTER_CC: - case CFE_EVS_SET_FILTER_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetAppCounterCmd_t))) + { + Status = CFE_EVS_ResetAppCounterCmd((CFE_EVS_ResetAppCounterCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetFilterCmd_t))) - { - Status = CFE_EVS_SetFilterCmd((CFE_EVS_SetFilterCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_ENABLE_PORTS_CC: - - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnablePortsCmd_t))) - { - Status = CFE_EVS_EnablePortsCmd((CFE_EVS_EnablePortsCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_DISABLE_PORTS_CC: - - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisablePortsCmd_t))) - { - Status = CFE_EVS_DisablePortsCmd((CFE_EVS_DisablePortsCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_RESET_FILTER_CC: + case CFE_EVS_SET_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetFilterCmd_t))) - { - Status = CFE_EVS_ResetFilterCmd((CFE_EVS_ResetFilterCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_RESET_ALL_FILTERS_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetFilterCmd_t))) + { + Status = CFE_EVS_SetFilterCmd((CFE_EVS_SetFilterCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetAllFiltersCmd_t))) - { - Status = CFE_EVS_ResetAllFiltersCmd((CFE_EVS_ResetAllFiltersCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_ADD_EVENT_FILTER_CC: + case CFE_EVS_ENABLE_PORTS_CC: - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_AddEventFilterCmd_t))) - { - Status = CFE_EVS_AddEventFilterCmd((CFE_EVS_AddEventFilterCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_DELETE_EVENT_FILTER_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_EnablePortsCmd_t))) + { + Status = CFE_EVS_EnablePortsCmd((CFE_EVS_EnablePortsCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DeleteEventFilterCmd_t))) - { - Status = CFE_EVS_DeleteEventFilterCmd((CFE_EVS_DeleteEventFilterCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_WRITE_APP_DATA_FILE_CC: + case CFE_EVS_DISABLE_PORTS_CC: - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_WriteAppDataFileCmd_t))) - { - Status = CFE_EVS_WriteAppDataFileCmd((CFE_EVS_WriteAppDataFileCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_SET_LOG_MODE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DisablePortsCmd_t))) + { + Status = CFE_EVS_DisablePortsCmd((CFE_EVS_DisablePortsCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetLogModeCmd_t))) - { - Status = CFE_EVS_SetLogModeCmd((CFE_EVS_SetLogModeCmd_t*)SBBufPtr); - } - break; - - case CFE_EVS_CLEAR_LOG_CC: + case CFE_EVS_RESET_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ClearLogCmd_t))) - { - Status = CFE_EVS_ClearLogCmd((CFE_EVS_ClearLogCmd_t *)SBBufPtr); - } - break; - - case CFE_EVS_WRITE_LOG_DATA_FILE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetFilterCmd_t))) + { + Status = CFE_EVS_ResetFilterCmd((CFE_EVS_ResetFilterCmd_t *)SBBufPtr); + } + break; - if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_WriteLogDataFileCmd_t))) - { - Status = CFE_EVS_WriteLogDataFileCmd((CFE_EVS_WriteLogDataFileCmd_t*)SBBufPtr); - } - break; - - /* default is a bad command code as it was not found above */ - default: + case CFE_EVS_RESET_ALL_FILTERS_CC: - EVS_SendEvent(CFE_EVS_ERR_CC_EID, CFE_EVS_EventType_ERROR, - "Invalid command code -- ID = 0x%08x, CC = %u", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - (unsigned int)FcnCode); - Status = CFE_STATUS_BAD_COMMAND_CODE; + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ResetAllFiltersCmd_t))) + { + Status = CFE_EVS_ResetAllFiltersCmd((CFE_EVS_ResetAllFiltersCmd_t *)SBBufPtr); + } + break; - break; - } + case CFE_EVS_ADD_EVENT_FILTER_CC: - if (Status == CFE_SUCCESS) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.CommandCounter++; - } - else if (Status < 0) /* Negative values indicate errors */ - { - CFE_EVS_Global.EVS_TlmPkt.Payload.CommandErrorCounter++; - } + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_AddEventFilterCmd_t))) + { + Status = CFE_EVS_AddEventFilterCmd((CFE_EVS_AddEventFilterCmd_t *)SBBufPtr); + } + break; - return; + case CFE_EVS_DELETE_EVENT_FILTER_CC: -} /* End of EVS_ProcessGroundCommand() */ + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_DeleteEventFilterCmd_t))) + { + Status = CFE_EVS_DeleteEventFilterCmd((CFE_EVS_DeleteEventFilterCmd_t *)SBBufPtr); + } + break; + + case CFE_EVS_WRITE_APP_DATA_FILE_CC: + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_WriteAppDataFileCmd_t))) + { + Status = CFE_EVS_WriteAppDataFileCmd((CFE_EVS_WriteAppDataFileCmd_t *)SBBufPtr); + } + break; + + case CFE_EVS_SET_LOG_MODE_CC: + + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SetLogModeCmd_t))) + { + Status = CFE_EVS_SetLogModeCmd((CFE_EVS_SetLogModeCmd_t *)SBBufPtr); + } + break; + + case CFE_EVS_CLEAR_LOG_CC: + + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_ClearLogCmd_t))) + { + Status = CFE_EVS_ClearLogCmd((CFE_EVS_ClearLogCmd_t *)SBBufPtr); + } + break; + + case CFE_EVS_WRITE_LOG_DATA_FILE_CC: + + if (CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_WriteLogDataFileCmd_t))) + { + Status = CFE_EVS_WriteLogDataFileCmd((CFE_EVS_WriteLogDataFileCmd_t *)SBBufPtr); + } + break; + + /* default is a bad command code as it was not found above */ + default: + + EVS_SendEvent(CFE_EVS_ERR_CC_EID, CFE_EVS_EventType_ERROR, "Invalid command code -- ID = 0x%08x, CC = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode); + Status = CFE_STATUS_BAD_COMMAND_CODE; + + break; + } + + if (Status == CFE_SUCCESS) + { + CFE_EVS_Global.EVS_TlmPkt.Payload.CommandCounter++; + } + else if (Status < 0) /* Negative values indicate errors */ + { + CFE_EVS_Global.EVS_TlmPkt.Payload.CommandErrorCounter++; + } + + return; + +} /* End of EVS_ProcessGroundCommand() */ /* ** Function Prologue @@ -640,13 +623,13 @@ bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) CFE_MSG_GetFcnCode(MsgPtr, &FcnCode); EVS_SendEvent(CFE_EVS_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, - (unsigned int)ActualLength, (unsigned int)ExpectedLength); + "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength, + (unsigned int)ExpectedLength); result = false; } - return(result); + return (result); } /* End of CFE_EVS_VerifyCmdLength() */ @@ -662,9 +645,8 @@ bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) */ 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); - return CFE_SUCCESS; + EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op command. %s", CFE_VERSION_STRING); + return CFE_SUCCESS; } /* @@ -693,48 +675,47 @@ int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLogCmd_t *data) ** Assumptions and Notes: ** */ -int32 CFE_EVS_ReportHousekeepingCmd (const CFE_MSG_CommandHeader_t *data) +int32 CFE_EVS_ReportHousekeepingCmd(const CFE_MSG_CommandHeader_t *data) { - uint32 i, j; - EVS_AppData_t *AppDataPtr; - CFE_EVS_AppTlmData_t *AppTlmDataPtr; - - /* Copy hk variables that are maintained in the event log */ - CFE_EVS_Global.EVS_TlmPkt.Payload.LogFullFlag = CFE_EVS_Global.EVS_LogPtr->LogFullFlag; - CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_EVS_Global.EVS_LogPtr->LogMode; - CFE_EVS_Global.EVS_TlmPkt.Payload.LogOverflowCounter = CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter; - - /* Write event state data for registered apps to telemetry packet */ - AppDataPtr = CFE_EVS_Global.AppData; - AppTlmDataPtr = CFE_EVS_Global.EVS_TlmPkt.Payload.AppData; - for (i = 0, j = 0; j < CFE_MISSION_ES_MAX_APPLICATIONS && i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) - { - if ( EVS_AppDataIsUsed(AppDataPtr) ) - { - AppTlmDataPtr->AppID = EVS_AppDataGetID(AppDataPtr); - AppTlmDataPtr->AppEnableStatus = AppDataPtr->ActiveFlag; - AppTlmDataPtr->AppMessageSentCounter = AppDataPtr->EventCount; - ++j; - ++AppTlmDataPtr; - } - ++AppDataPtr; - } - - /* Clear unused portion of event state data in telemetry packet */ - for (i = j; i < CFE_MISSION_ES_MAX_APPLICATIONS; i++) - { - AppTlmDataPtr->AppID = CFE_ES_APPID_UNDEFINED; - AppTlmDataPtr->AppEnableStatus = false; - AppTlmDataPtr->AppMessageSentCounter = 0; - } - - CFE_SB_TimeStampMsg(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg); - - CFE_SB_TransmitMsg(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg, true); - - return CFE_STATUS_NO_COUNTER_INCREMENT; -} /* End of CFE_EVS_ReportHousekeepingCmd() */ + uint32 i, j; + EVS_AppData_t * AppDataPtr; + CFE_EVS_AppTlmData_t *AppTlmDataPtr; + + /* Copy hk variables that are maintained in the event log */ + CFE_EVS_Global.EVS_TlmPkt.Payload.LogFullFlag = CFE_EVS_Global.EVS_LogPtr->LogFullFlag; + CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_EVS_Global.EVS_LogPtr->LogMode; + CFE_EVS_Global.EVS_TlmPkt.Payload.LogOverflowCounter = CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter; + + /* Write event state data for registered apps to telemetry packet */ + AppDataPtr = CFE_EVS_Global.AppData; + AppTlmDataPtr = CFE_EVS_Global.EVS_TlmPkt.Payload.AppData; + for (i = 0, j = 0; j < CFE_MISSION_ES_MAX_APPLICATIONS && i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) + { + if (EVS_AppDataIsUsed(AppDataPtr)) + { + AppTlmDataPtr->AppID = EVS_AppDataGetID(AppDataPtr); + AppTlmDataPtr->AppEnableStatus = AppDataPtr->ActiveFlag; + AppTlmDataPtr->AppMessageSentCounter = AppDataPtr->EventCount; + ++j; + ++AppTlmDataPtr; + } + ++AppDataPtr; + } + + /* Clear unused portion of event state data in telemetry packet */ + for (i = j; i < CFE_MISSION_ES_MAX_APPLICATIONS; i++) + { + AppTlmDataPtr->AppID = CFE_ES_APPID_UNDEFINED; + AppTlmDataPtr->AppEnableStatus = false; + AppTlmDataPtr->AppMessageSentCounter = 0; + } + CFE_SB_TimeStampMsg(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg); + + CFE_SB_TransmitMsg(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg, true); + + return CFE_STATUS_NO_COUNTER_INCREMENT; +} /* End of CFE_EVS_ReportHousekeepingCmd() */ /* ** Function Prologue @@ -750,12 +731,12 @@ int32 CFE_EVS_ReportHousekeepingCmd (const CFE_MSG_CommandHeader_t *data) int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCountersCmd_t *data) { /* Status of commands processed by EVS task */ - CFE_EVS_Global.EVS_TlmPkt.Payload.CommandCounter = 0; - CFE_EVS_Global.EVS_TlmPkt.Payload.CommandErrorCounter = 0; + CFE_EVS_Global.EVS_TlmPkt.Payload.CommandCounter = 0; + CFE_EVS_Global.EVS_TlmPkt.Payload.CommandErrorCounter = 0; /* EVS telemetry counters */ - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = 0; - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter = 0; + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = 0; + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter = 0; CFE_EVS_Global.EVS_TlmPkt.Payload.UnregisteredAppCounter = 0; EVS_SendEvent(CFE_EVS_RSTCNT_EID, CFE_EVS_EventType_DEBUG, "Reset Counters Command Received"); @@ -765,7 +746,6 @@ int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCountersCmd_t *data) return CFE_STATUS_NO_COUNTER_INCREMENT; } /* End of CFE_EVS_ResetCountersCmd() */ - /* ** Function Prologue ** @@ -779,69 +759,64 @@ int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCountersCmd_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; - int32 Status; - EVS_AppData_t *AppDataPtr; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); - - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); - - if (Status == CFE_SUCCESS) - { - FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); - - if(FilterPtr != NULL) - { - /* Set application filter mask */ - FilterPtr->Mask = CmdPtr->Mask; - - EVS_SendEvent(CFE_EVS_SETFILTERMSK_EID, CFE_EVS_EventType_DEBUG, - "Set Filter Mask Command Received with AppName=%s, EventID=0x%08x, Mask=0x%04x", - LocalName, (unsigned int)CmdPtr->EventID, (unsigned int)CmdPtr->Mask); - - } - else - { - EVS_SendEvent(CFE_EVS_ERR_EVTIDNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s Event ID %d not registered for filtering: CC = %lu ", - LocalName, (int)CmdPtr->EventID, (long unsigned int)CFE_EVS_SET_FILTER_CC); - - Status = CFE_EVS_EVT_NOT_REGISTERED; - } - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_SET_FILTER_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_SET_FILTER_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_SET_FILTER_CC); - } - - return Status; + const CFE_EVS_AppNameEventIDMaskCmd_Payload_t *CmdPtr = &data->Payload; + EVS_BinFilter_t * FilterPtr; + int32 Status; + EVS_AppData_t * AppDataPtr; + char LocalName[OS_MAX_API_NAME]; -} /* End CFE_EVS_SetFilterMaskCmd */ + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); + + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { + FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); + + if (FilterPtr != NULL) + { + /* Set application filter mask */ + FilterPtr->Mask = CmdPtr->Mask; + + EVS_SendEvent(CFE_EVS_SETFILTERMSK_EID, CFE_EVS_EventType_DEBUG, + "Set Filter Mask Command Received with AppName=%s, EventID=0x%08x, Mask=0x%04x", LocalName, + (unsigned int)CmdPtr->EventID, (unsigned int)CmdPtr->Mask); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_EVTIDNOREGS_EID, CFE_EVS_EventType_ERROR, + "%s Event ID %d not registered for filtering: CC = %lu ", LocalName, (int)CmdPtr->EventID, + (long unsigned int)CFE_EVS_SET_FILTER_CC); + + Status = CFE_EVS_EVT_NOT_REGISTERED; + } + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_SET_FILTER_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_SET_FILTER_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_SET_FILTER_CC); + } + return Status; +} /* End CFE_EVS_SetFilterMaskCmd */ /* ** Function Prologue @@ -857,40 +832,39 @@ int32 CFE_EVS_SetFilterCmd(const CFE_EVS_SetFilterCmd_t *data) int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePortsCmd_t *data) { const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; - int32 ReturnCode; + int32 ReturnCode; /* Need to check for an out of range bitmask, since oue bit masks are only 4 bits */ if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) { EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, - "Bit Mask = 0x%08x out of range: CC = %lu", - (unsigned int)CmdPtr->BitMask, (long unsigned int)CFE_EVS_ENABLE_PORTS_CC); + "Bit Mask = 0x%08x out of range: CC = %lu", (unsigned int)CmdPtr->BitMask, + (long unsigned int)CFE_EVS_ENABLE_PORTS_CC); ReturnCode = CFE_EVS_INVALID_PARAMETER; } else { /* Process command data */ - if(((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >> 0) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >> 0) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT1_BIT; } - if(((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >>1) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >> 1) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT2_BIT; } - if(((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT3_BIT; } - if(((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >>3) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >> 3) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT4_BIT; } EVS_SendEvent(CFE_EVS_ENAPORT_EID, CFE_EVS_EventType_DEBUG, - "Enable Ports Command Received with Port Bit Mask = 0x%02x", - (unsigned int)CmdPtr->BitMask); + "Enable Ports Command Received with Port Bit Mask = 0x%02x", (unsigned int)CmdPtr->BitMask); ReturnCode = CFE_SUCCESS; } @@ -898,7 +872,6 @@ int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePortsCmd_t *data) } /* End CFE_EVS_EnablePortsCmd */ - /* ** Function Prologue ** @@ -913,50 +886,47 @@ int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePortsCmd_t *data) int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePortsCmd_t *data) { const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; - int32 ReturnCode; + int32 ReturnCode; /* Need to check for an out of range bitmask, since oue bit masks are only 4 bits */ if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) { EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, - "Bit Mask = 0x%08x out of range: CC = %lu", - (unsigned int)CmdPtr->BitMask, (long unsigned int)CFE_EVS_DISABLE_PORTS_CC); + "Bit Mask = 0x%08x out of range: CC = %lu", (unsigned int)CmdPtr->BitMask, + (long unsigned int)CFE_EVS_DISABLE_PORTS_CC); ReturnCode = CFE_EVS_INVALID_PARAMETER; } else { /* Process command data */ - if(((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >>0) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >> 0) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT1_BIT; } - if(((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >> 1) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >> 1) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT2_BIT; } - if(((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT3_BIT; } - if(((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >>3) == true) + if (((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >> 3) == true) { CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT4_BIT; } EVS_SendEvent(CFE_EVS_DISPORT_EID, CFE_EVS_EventType_DEBUG, - "Disable Ports Command Received with Port Bit Mask = 0x%02x", - (unsigned int)CmdPtr->BitMask); - + "Disable Ports Command Received with Port Bit Mask = 0x%02x", (unsigned int)CmdPtr->BitMask); + ReturnCode = CFE_SUCCESS; } - + return ReturnCode; } /* End CFE_EVS_DisablePortsCmd */ - - /* ** Function Prologue ** @@ -970,43 +940,42 @@ int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePortsCmd_t *data) */ int32 CFE_EVS_EnableEventTypeCmd(const CFE_EVS_EnableEventTypeCmd_t *data) { - uint32 i; - const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; - int32 ReturnCode; - EVS_AppData_t *AppDataPtr; - - /* Need to check for an out of range bitmask, since our bit masks are only 4 bits */ - if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) - { - EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, - "Bit Mask = 0x%08x out of range: CC = %lu", - (unsigned int)CmdPtr->BitMask, (long unsigned int)CFE_EVS_ENABLE_EVENT_TYPE_CC); - ReturnCode = CFE_EVS_INVALID_PARAMETER; - } - else - { - AppDataPtr = CFE_EVS_Global.AppData; - for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) - { - /* Make sure application is registered for event services */ - if ( EVS_AppDataIsUsed(AppDataPtr) ) - { - EVS_EnableTypes(AppDataPtr, CmdPtr->BitMask); - } - ++AppDataPtr; - } - - EVS_SendEvent(CFE_EVS_ENAEVTTYPE_EID, CFE_EVS_EventType_DEBUG, - "Enable Event Type Command Received with Event Type Bit Mask = 0x%02x", - (unsigned int)CmdPtr->BitMask); - - ReturnCode = CFE_SUCCESS; - } - - return ReturnCode; + uint32 i; + const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; + int32 ReturnCode; + EVS_AppData_t * AppDataPtr; -} /* End CFE_EVS_EnableEventTypesCmd */ + /* Need to check for an out of range bitmask, since our bit masks are only 4 bits */ + if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) + { + EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, + "Bit Mask = 0x%08x out of range: CC = %lu", (unsigned int)CmdPtr->BitMask, + (long unsigned int)CFE_EVS_ENABLE_EVENT_TYPE_CC); + ReturnCode = CFE_EVS_INVALID_PARAMETER; + } + else + { + AppDataPtr = CFE_EVS_Global.AppData; + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) + { + /* Make sure application is registered for event services */ + if (EVS_AppDataIsUsed(AppDataPtr)) + { + EVS_EnableTypes(AppDataPtr, CmdPtr->BitMask); + } + ++AppDataPtr; + } + EVS_SendEvent(CFE_EVS_ENAEVTTYPE_EID, CFE_EVS_EventType_DEBUG, + "Enable Event Type Command Received with Event Type Bit Mask = 0x%02x", + (unsigned int)CmdPtr->BitMask); + + ReturnCode = CFE_SUCCESS; + } + + return ReturnCode; + +} /* End CFE_EVS_EnableEventTypesCmd */ /* ** Function Prologue @@ -1021,45 +990,43 @@ int32 CFE_EVS_EnableEventTypeCmd(const CFE_EVS_EnableEventTypeCmd_t *data) */ int32 CFE_EVS_DisableEventTypeCmd(const CFE_EVS_DisableEventTypeCmd_t *data) { - uint32 i; - const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; - int32 ReturnCode; - EVS_AppData_t *AppDataPtr; - - /* Need to check for an out of range bitmask, since our bit masks are only 4 bits */ - if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) - { - EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, - "Bit Mask = 0x%08x out of range: CC = %lu", - (unsigned int)CmdPtr->BitMask, (long unsigned int)CFE_EVS_DISABLE_EVENT_TYPE_CC); - ReturnCode = CFE_EVS_INVALID_PARAMETER; - } - - else - { - AppDataPtr = CFE_EVS_Global.AppData; - for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) - { - /* Make sure application is registered for event services */ - if ( EVS_AppDataIsUsed(AppDataPtr) ) - { - EVS_DisableTypes(AppDataPtr, CmdPtr->BitMask); - } - ++AppDataPtr; - } - - EVS_SendEvent(CFE_EVS_DISEVTTYPE_EID, CFE_EVS_EventType_DEBUG, - "Disable Event Type Command Received with Event Type Bit Mask = 0x%02x", - (unsigned int)CmdPtr->BitMask); - - ReturnCode = CFE_SUCCESS; - } - - return ReturnCode; + uint32 i; + const CFE_EVS_BitMaskCmd_Payload_t *CmdPtr = &data->Payload; + int32 ReturnCode; + EVS_AppData_t * AppDataPtr; -} /* End CFE_EVS_DisableEventTypesCmd */ + /* Need to check for an out of range bitmask, since our bit masks are only 4 bits */ + if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) + { + EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, + "Bit Mask = 0x%08x out of range: CC = %lu", (unsigned int)CmdPtr->BitMask, + (long unsigned int)CFE_EVS_DISABLE_EVENT_TYPE_CC); + ReturnCode = CFE_EVS_INVALID_PARAMETER; + } + else + { + AppDataPtr = CFE_EVS_Global.AppData; + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) + { + /* Make sure application is registered for event services */ + if (EVS_AppDataIsUsed(AppDataPtr)) + { + EVS_DisableTypes(AppDataPtr, CmdPtr->BitMask); + } + ++AppDataPtr; + } + + EVS_SendEvent(CFE_EVS_DISEVTTYPE_EID, CFE_EVS_EventType_DEBUG, + "Disable Event Type Command Received with Event Type Bit Mask = 0x%02x", + (unsigned int)CmdPtr->BitMask); + + ReturnCode = CFE_SUCCESS; + } + return ReturnCode; + +} /* End CFE_EVS_DisableEventTypesCmd */ /* ** Function Prologue @@ -1073,30 +1040,28 @@ int32 CFE_EVS_DisableEventTypeCmd(const CFE_EVS_DisableEventTypeCmd_t *data) */ int32 CFE_EVS_SetEventFormatModeCmd(const CFE_EVS_SetEventFormatModeCmd_t *data) { - const CFE_EVS_SetEventFormatMode_Payload_t *CmdPtr = &data->Payload; - int32 Status; - - if((CmdPtr->MsgFormat == CFE_EVS_MsgFormat_SHORT) || (CmdPtr->MsgFormat == CFE_EVS_MsgFormat_LONG)) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CmdPtr->MsgFormat; - - EVS_SendEvent(CFE_EVS_SETEVTFMTMOD_EID, CFE_EVS_EventType_DEBUG, - "Set Event Format Mode Command Received with Mode = 0x%02x", - (unsigned int)CmdPtr->MsgFormat); - Status = CFE_SUCCESS; - } - else - { - EVS_SendEvent(CFE_EVS_ERR_ILLEGALFMTMOD_EID, CFE_EVS_EventType_ERROR, - "Set Event Format Mode Command: Invalid Event Format Mode = 0x%02x", - (unsigned int)CmdPtr->MsgFormat); - Status = CFE_EVS_INVALID_PARAMETER; - } - - return Status; + const CFE_EVS_SetEventFormatMode_Payload_t *CmdPtr = &data->Payload; + int32 Status; -} /* End CFE_EVS_SetEventFormatModeCmd */ + if ((CmdPtr->MsgFormat == CFE_EVS_MsgFormat_SHORT) || (CmdPtr->MsgFormat == CFE_EVS_MsgFormat_LONG)) + { + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CmdPtr->MsgFormat; + EVS_SendEvent(CFE_EVS_SETEVTFMTMOD_EID, CFE_EVS_EventType_DEBUG, + "Set Event Format Mode Command Received with Mode = 0x%02x", (unsigned int)CmdPtr->MsgFormat); + Status = CFE_SUCCESS; + } + else + { + EVS_SendEvent(CFE_EVS_ERR_ILLEGALFMTMOD_EID, CFE_EVS_EventType_ERROR, + "Set Event Format Mode Command: Invalid Event Format Mode = 0x%02x", + (unsigned int)CmdPtr->MsgFormat); + Status = CFE_EVS_INVALID_PARAMETER; + } + + return Status; + +} /* End CFE_EVS_SetEventFormatModeCmd */ /* ** Function Prologue @@ -1111,67 +1076,64 @@ int32 CFE_EVS_SetEventFormatModeCmd(const CFE_EVS_SetEventFormatModeCmd_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; - int32 Status; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); + const CFE_EVS_AppNameBitMaskCmd_Payload_t *CmdPtr = &data->Payload; + EVS_AppData_t * AppDataPtr; + int32 Status; + char LocalName[OS_MAX_API_NAME]; - /* Retrieve application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); - if(Status == CFE_SUCCESS) - { + /* Retrieve application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { /* Need to check for an out of range bitmask, since our bit masks are only 4 bits */ if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) { EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, - "Bit Mask = 0x%08x out of range: CC = %lu", - (unsigned int)CmdPtr->BitMask, (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); + "Bit Mask = 0x%08x out of range: CC = %lu", (unsigned int)CmdPtr->BitMask, + (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); Status = CFE_EVS_INVALID_PARAMETER; } else { EVS_EnableTypes(AppDataPtr, CmdPtr->BitMask); } - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); - } - - if(Status == CFE_SUCCESS) - { - EVS_SendEvent(CFE_EVS_ENAAPPEVTTYPE_EID, CFE_EVS_EventType_DEBUG, - "Enable App Event Type Command Received with AppName = %s, EventType Bit Mask = 0x%02x", - LocalName, CmdPtr->BitMask); - } - - return Status; + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_ENABLE_APP_EVENT_TYPE_CC); + } -} /* End CFE_EVS_EnableAppEventTypesCmd */ + if (Status == CFE_SUCCESS) + { + EVS_SendEvent(CFE_EVS_ENAAPPEVTTYPE_EID, CFE_EVS_EventType_DEBUG, + "Enable App Event Type Command Received with AppName = %s, EventType Bit Mask = 0x%02x", + LocalName, CmdPtr->BitMask); + } + return Status; + +} /* End CFE_EVS_EnableAppEventTypesCmd */ /* ** Function Prologue @@ -1186,67 +1148,64 @@ int32 CFE_EVS_EnableAppEventTypeCmd(const CFE_EVS_EnableAppEventTypeCmd_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; - int32 Status; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); + EVS_AppData_t * AppDataPtr; + const CFE_EVS_AppNameBitMaskCmd_Payload_t *CmdPtr = &data->Payload; + int32 Status; + char LocalName[OS_MAX_API_NAME]; - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); - if(Status == CFE_SUCCESS) - { + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { /* Need to check for an out of range bitmask, since our bit masks are only 4 bits */ if (CmdPtr->BitMask == 0x0 || CmdPtr->BitMask > 0x0F) { EVS_SendEvent(CFE_EVS_ERR_INVALID_BITMASK_EID, CFE_EVS_EventType_ERROR, - "Bit Mask = 0x%08x out of range: CC = %lu", - (unsigned int)CmdPtr->BitMask, (long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); + "Bit Mask = 0x%08x out of range: CC = %lu", (unsigned int)CmdPtr->BitMask, + (long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); Status = CFE_EVS_INVALID_PARAMETER; } else { EVS_DisableTypes(AppDataPtr, CmdPtr->BitMask); } - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS,: CC = %lu", - LocalName,(long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); - } - - if(Status == CFE_SUCCESS) - { - EVS_SendEvent(CFE_EVS_DISAPPENTTYPE_EID, CFE_EVS_EventType_DEBUG, - "Disable App Event Type Command Received with AppName = %s, EventType Bit Mask = 0x%02x", - LocalName, (unsigned int)CmdPtr->BitMask); - } - - return Status; + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS,: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_DISABLE_APP_EVENT_TYPE_CC); + } -} /* End CFE_EVS_DisableAppEventTypes */ + if (Status == CFE_SUCCESS) + { + EVS_SendEvent(CFE_EVS_DISAPPENTTYPE_EID, CFE_EVS_EventType_DEBUG, + "Disable App Event Type Command Received with AppName = %s, EventType Bit Mask = 0x%02x", + LocalName, (unsigned int)CmdPtr->BitMask); + } + + return Status; +} /* End CFE_EVS_DisableAppEventTypes */ /* ** Function Prologue @@ -1260,52 +1219,48 @@ int32 CFE_EVS_DisableAppEventTypeCmd(const CFE_EVS_DisableAppEventTypeCmd_t *dat */ int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEventsCmd_t *data) { - EVS_AppData_t *AppDataPtr; - const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; - int32 Status; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); + EVS_AppData_t * AppDataPtr; + const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; + int32 Status; + char LocalName[OS_MAX_API_NAME]; - /* Retrieve application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); - if(Status == CFE_SUCCESS) - { + /* Retrieve application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { AppDataPtr->ActiveFlag = true; EVS_SendEvent(CFE_EVS_ENAAPPEVT_EID, CFE_EVS_EventType_DEBUG, - "Enable App Events Command Received with AppName = %s", - LocalName); - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENTS_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENTS_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENTS_CC); - } - - return Status; + "Enable App Events Command Received with AppName = %s", LocalName); + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_ENABLE_APP_EVENTS_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_ENABLE_APP_EVENTS_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_ENABLE_APP_EVENTS_CC); + } -} /* End EVS_EnableAppEventsCmd */ + return Status; +} /* End EVS_EnableAppEventsCmd */ /* ** Function Prologue @@ -1319,52 +1274,48 @@ int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEventsCmd_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; - int32 Status; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); - - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); - - if(Status == CFE_SUCCESS) - { - AppDataPtr->ActiveFlag = false; - - EVS_SendEvent(CFE_EVS_DISAPPEVT_EID, CFE_EVS_EventType_DEBUG, - "Disable App Events Command Received with AppName = %s", - LocalName); - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName,(long unsigned int)CFE_EVS_DISABLE_APP_EVENTS_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName,(long unsigned int)CFE_EVS_DISABLE_APP_EVENTS_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Disable App Events Command: Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_DISABLE_APP_EVENTS_CC); - } - - return Status; + EVS_AppData_t * AppDataPtr; + const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; + int32 Status; + char LocalName[OS_MAX_API_NAME]; -} /* End CFE_EVS_DisableAppEventsCmd */ + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); + + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { + AppDataPtr->ActiveFlag = false; + + EVS_SendEvent(CFE_EVS_DISAPPEVT_EID, CFE_EVS_EventType_DEBUG, + "Disable App Events Command Received with AppName = %s", LocalName); + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_DISABLE_APP_EVENTS_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_DISABLE_APP_EVENTS_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Disable App Events Command: Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_DISABLE_APP_EVENTS_CC); + } + return Status; + +} /* End CFE_EVS_DisableAppEventsCmd */ /* ** Function Prologue @@ -1379,52 +1330,48 @@ int32 CFE_EVS_DisableAppEventsCmd(const CFE_EVS_DisableAppEventsCmd_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; - int32 Status; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); - - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); - - if(Status == CFE_SUCCESS) - { - AppDataPtr->EventCount = 0; - - EVS_SendEvent(CFE_EVS_RSTEVTCNT_EID, CFE_EVS_EventType_DEBUG, - "Reset Event Counter Command Received with AppName = %s", - LocalName); - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_APP_COUNTER_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName,(long unsigned int) CFE_EVS_RESET_APP_COUNTER_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Reset Event Counter Command: Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_APP_COUNTER_CC); - } - - return Status; + EVS_AppData_t * AppDataPtr; + const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; + int32 Status; + char LocalName[OS_MAX_API_NAME]; -} /* End CFE_EVS_ResetAppEventCounterCmd */ + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); + + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { + AppDataPtr->EventCount = 0; + + EVS_SendEvent(CFE_EVS_RSTEVTCNT_EID, CFE_EVS_EventType_DEBUG, + "Reset Event Counter Command Received with AppName = %s", LocalName); + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_RESET_APP_COUNTER_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_RESET_APP_COUNTER_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Reset Event Counter Command: Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_RESET_APP_COUNTER_CC); + } + return Status; + +} /* End CFE_EVS_ResetAppEventCounterCmd */ /* ** Function Prologue @@ -1439,66 +1386,63 @@ int32 CFE_EVS_ResetAppCounterCmd(const CFE_EVS_ResetAppCounterCmd_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; - int32 Status; - EVS_AppData_t *AppDataPtr; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); - - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); - - if(Status == CFE_SUCCESS) - { - FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); - - if(FilterPtr != NULL) - { - FilterPtr->Count = 0; - - EVS_SendEvent(CFE_EVS_RSTFILTER_EID, CFE_EVS_EventType_DEBUG, - "Reset Filter Command Received with AppName = %s, EventID = 0x%08x", - LocalName, (unsigned int)CmdPtr->EventID); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_EVTIDNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s Event ID %d not registered for filtering: CC = %lu", - LocalName, (int)CmdPtr->EventID, (long unsigned int)CFE_EVS_RESET_FILTER_CC); - - Status = CFE_EVS_EVT_NOT_REGISTERED; - } - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_FILTER_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_FILTER_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_FILTER_CC); - } - - return Status; + const CFE_EVS_AppNameEventIDCmd_Payload_t *CmdPtr = &data->Payload; + EVS_BinFilter_t * FilterPtr; + int32 Status; + EVS_AppData_t * AppDataPtr; + char LocalName[OS_MAX_API_NAME]; -} /* End CFE_EVS_ResetFilterCmd */ + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { + FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); + + if (FilterPtr != NULL) + { + FilterPtr->Count = 0; + + EVS_SendEvent(CFE_EVS_RSTFILTER_EID, CFE_EVS_EventType_DEBUG, + "Reset Filter Command Received with AppName = %s, EventID = 0x%08x", LocalName, + (unsigned int)CmdPtr->EventID); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_EVTIDNOREGS_EID, CFE_EVS_EventType_ERROR, + "%s Event ID %d not registered for filtering: CC = %lu", LocalName, (int)CmdPtr->EventID, + (long unsigned int)CFE_EVS_RESET_FILTER_CC); + + Status = CFE_EVS_EVT_NOT_REGISTERED; + } + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_RESET_FILTER_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_RESET_FILTER_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_RESET_FILTER_CC); + } + + return Status; + +} /* End CFE_EVS_ResetFilterCmd */ /* ** Function Prologue @@ -1513,53 +1457,50 @@ int32 CFE_EVS_ResetFilterCmd(const CFE_EVS_ResetFilterCmd_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; - int32 Status; - uint32 i; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); - - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); - - if(Status == CFE_SUCCESS) - { - for(i=0; iBinFilters[i].Count = 0; - } - - EVS_SendEvent(CFE_EVS_RSTALLFILTER_EID, CFE_EVS_EventType_DEBUG, - "Reset All Filters Command Received with AppName = %s", - LocalName); - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_ALL_FILTERS_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_ALL_FILTERS_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_RESET_ALL_FILTERS_CC); - } - - return Status; + EVS_AppData_t * AppDataPtr; + const CFE_EVS_AppNameCmd_Payload_t *CmdPtr = &data->Payload; + int32 Status; + uint32 i; + char LocalName[OS_MAX_API_NAME]; + + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); + + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { + for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) + { + AppDataPtr->BinFilters[i].Count = 0; + } + + EVS_SendEvent(CFE_EVS_RSTALLFILTER_EID, CFE_EVS_EventType_DEBUG, + "Reset All Filters Command Received with AppName = %s", LocalName); + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_RESET_ALL_FILTERS_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_RESET_ALL_FILTERS_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_RESET_ALL_FILTERS_CC); + } + + return Status; } /* End CFE_EVS_ResetAllFiltersCmd */ @@ -1576,83 +1517,81 @@ int32 CFE_EVS_ResetAllFiltersCmd(const CFE_EVS_ResetAllFiltersCmd_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; - int32 Status; - EVS_AppData_t *AppDataPtr; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); - - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); - - if(Status == CFE_SUCCESS) - { - /* Check to see if this event is already registered for filtering */ - FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); - - /* FilterPtr != NULL means that this Event ID was found as already being registered */ - if (FilterPtr != NULL) - { - EVS_SendEvent(CFE_EVS_EVT_FILTERED_EID, CFE_EVS_EventType_ERROR, - "Add Filter Command:AppName = %s, EventID = 0x%08x is already registered for filtering", - LocalName, (unsigned int)CmdPtr->EventID); - - Status = CFE_EVS_EVT_NOT_REGISTERED; - } - else - { - /* now check to see if there is a free slot */ - FilterPtr = EVS_FindEventID(CFE_EVS_FREE_SLOT, AppDataPtr->BinFilters); + const CFE_EVS_AppNameEventIDMaskCmd_Payload_t *CmdPtr = &data->Payload; + EVS_BinFilter_t * FilterPtr; + int32 Status; + EVS_AppData_t * AppDataPtr; + char LocalName[OS_MAX_API_NAME]; + + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); + + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { + /* Check to see if this event is already registered for filtering */ + FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); + + /* FilterPtr != NULL means that this Event ID was found as already being registered */ + if (FilterPtr != NULL) + { + EVS_SendEvent(CFE_EVS_EVT_FILTERED_EID, CFE_EVS_EventType_ERROR, + "Add Filter Command:AppName = %s, EventID = 0x%08x is already registered for filtering", + LocalName, (unsigned int)CmdPtr->EventID); + + Status = CFE_EVS_EVT_NOT_REGISTERED; + } + else + { + /* now check to see if there is a free slot */ + FilterPtr = EVS_FindEventID(CFE_EVS_FREE_SLOT, AppDataPtr->BinFilters); if (FilterPtr != NULL) { - /* Add Filter Contents */ - FilterPtr->EventID = CmdPtr->EventID; - FilterPtr->Mask = CmdPtr->Mask; - FilterPtr->Count = 0; - - EVS_SendEvent(CFE_EVS_ADDFILTER_EID, CFE_EVS_EventType_DEBUG, - "Add Filter Command Received with AppName = %s, EventID = 0x%08x, Mask = 0x%04x", - LocalName, (unsigned int)CmdPtr->EventID, (unsigned int)CmdPtr->Mask); + /* Add Filter Contents */ + FilterPtr->EventID = CmdPtr->EventID; + FilterPtr->Mask = CmdPtr->Mask; + FilterPtr->Count = 0; + + EVS_SendEvent(CFE_EVS_ADDFILTER_EID, CFE_EVS_EventType_DEBUG, + "Add Filter Command Received with AppName = %s, EventID = 0x%08x, Mask = 0x%04x", + LocalName, (unsigned int)CmdPtr->EventID, (unsigned int)CmdPtr->Mask); } else { - EVS_SendEvent(CFE_EVS_ERR_MAXREGSFILTER_EID, CFE_EVS_EventType_ERROR, - "Add Filter Command: number of registered filters has reached max = %d", - CFE_PLATFORM_EVS_MAX_EVENT_FILTERS); + EVS_SendEvent(CFE_EVS_ERR_MAXREGSFILTER_EID, CFE_EVS_EventType_ERROR, + "Add Filter Command: number of registered filters has reached max = %d", + CFE_PLATFORM_EVS_MAX_EVENT_FILTERS); - Status = CFE_EVS_APP_FILTER_OVERLOAD; + Status = CFE_EVS_APP_FILTER_OVERLOAD; } - }/* end else*/ - } /* end if (Status == CFE_SUCCESS) */ - - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ADD_EVENT_FILTER_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_ADD_EVENT_FILTER_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName,(long unsigned int)CFE_EVS_ADD_EVENT_FILTER_CC); - } - - return Status; + } /* end else*/ + } /* end if (Status == CFE_SUCCESS) */ + + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_ADD_EVENT_FILTER_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_ADD_EVENT_FILTER_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_ADD_EVENT_FILTER_CC); + } + + return Status; } /* CFE_End EVS_AddEventFilterCmd */ @@ -1669,69 +1608,65 @@ int32 CFE_EVS_AddEventFilterCmd(const CFE_EVS_AddEventFilterCmd_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; - int32 Status; - EVS_AppData_t *AppDataPtr; - char LocalName[OS_MAX_API_NAME]; - - /* - * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, - * the value is passed to EVS_SendEvent which does require termination (normal C string) - */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, - sizeof(LocalName), sizeof(CmdPtr->AppName)); - - /* Retreive application data */ - Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); - - if(Status == CFE_SUCCESS) - { - FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); - - if(FilterPtr != NULL) - { - /* Clear Filter Contents */ - FilterPtr->EventID = CFE_EVS_FREE_SLOT; - FilterPtr->Mask = CFE_EVS_NO_MASK; - FilterPtr->Count = 0; - - EVS_SendEvent(CFE_EVS_DELFILTER_EID, CFE_EVS_EventType_DEBUG, - "Delete Filter Command Received with AppName = %s, EventID = 0x%08x", - LocalName, (unsigned int)CmdPtr->EventID); - - } - else - { - EVS_SendEvent(CFE_EVS_ERR_EVTIDNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s Event ID %d not registered for filtering: CC = %lu", - LocalName, (int)CmdPtr->EventID, (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); - Status = CFE_EVS_EVT_NOT_REGISTERED; - } - } - else if(Status == CFE_EVS_APP_NOT_REGISTERED) - { - EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, - "%s not registered with EVS: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); - } - else if(Status == CFE_EVS_APP_ILLEGAL_APP_ID) - { - EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, - "Illegal application ID retrieved for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); - } - else - { - EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, - "Unable to retrieve application ID for %s: CC = %lu", - LocalName, (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); - } - - return Status; + const CFE_EVS_AppNameEventIDCmd_Payload_t *CmdPtr = &data->Payload; + EVS_BinFilter_t * FilterPtr; + int32 Status; + EVS_AppData_t * AppDataPtr; + char LocalName[OS_MAX_API_NAME]; -} /* End EVS_DeleteEventFilterCmd */ + /* + * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, + * the value is passed to EVS_SendEvent which does require termination (normal C string) + */ + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, sizeof(LocalName), sizeof(CmdPtr->AppName)); + + /* Retreive application data */ + Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); + + if (Status == CFE_SUCCESS) + { + FilterPtr = EVS_FindEventID(CmdPtr->EventID, AppDataPtr->BinFilters); + + if (FilterPtr != NULL) + { + /* Clear Filter Contents */ + FilterPtr->EventID = CFE_EVS_FREE_SLOT; + FilterPtr->Mask = CFE_EVS_NO_MASK; + FilterPtr->Count = 0; + + EVS_SendEvent(CFE_EVS_DELFILTER_EID, CFE_EVS_EventType_DEBUG, + "Delete Filter Command Received with AppName = %s, EventID = 0x%08x", LocalName, + (unsigned int)CmdPtr->EventID); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_EVTIDNOREGS_EID, CFE_EVS_EventType_ERROR, + "%s Event ID %d not registered for filtering: CC = %lu", LocalName, (int)CmdPtr->EventID, + (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); + Status = CFE_EVS_EVT_NOT_REGISTERED; + } + } + else if (Status == CFE_EVS_APP_NOT_REGISTERED) + { + EVS_SendEvent(CFE_EVS_ERR_APPNOREGS_EID, CFE_EVS_EventType_ERROR, "%s not registered with EVS: CC = %lu", + LocalName, (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); + } + else if (Status == CFE_EVS_APP_ILLEGAL_APP_ID) + { + EVS_SendEvent(CFE_EVS_ERR_ILLAPPIDRANGE_EID, CFE_EVS_EventType_ERROR, + "Illegal application ID retrieved for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); + } + else + { + EVS_SendEvent(CFE_EVS_ERR_NOAPPIDFOUND_EID, CFE_EVS_EventType_ERROR, + "Unable to retrieve application ID for %s: CC = %lu", LocalName, + (long unsigned int)CFE_EVS_DELETE_EVENT_FILTER_CC); + } + + return Status; +} /* End EVS_DeleteEventFilterCmd */ /* ** Function Prologue @@ -1747,97 +1682,95 @@ int32 CFE_EVS_DeleteEventFilterCmd(const CFE_EVS_DeleteEventFilterCmd_t *data) */ int32 CFE_EVS_WriteAppDataFileCmd(const CFE_EVS_WriteAppDataFileCmd_t *data) { - int32 Result; - osal_id_t FileHandle; - int32 BytesWritten; - uint32 EntryCount = 0; - uint32 i; - static CFE_EVS_AppDataFile_t AppDataFile; - CFE_FS_Header_t FileHdr; - EVS_AppData_t *AppDataPtr; - const CFE_EVS_AppDataCmd_Payload_t *CmdPtr = &data->Payload; - char LocalName[OS_MAX_PATH_LEN]; - - /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ - CFE_SB_MessageStringGet(LocalName, CmdPtr->AppDataFilename, CFE_PLATFORM_EVS_DEFAULT_APP_DATA_FILE, - sizeof(LocalName), sizeof(CmdPtr->AppDataFilename)); - - /* Create Application Data File */ - Result = OS_OpenCreate(&FileHandle, LocalName, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); - - if (Result < OS_SUCCESS) - { - EVS_SendEvent(CFE_EVS_ERR_CRDATFILE_EID, CFE_EVS_EventType_ERROR, - "Write App Data Command Error: OS_OpenCreate = 0x%08X, filename = %s", - (unsigned int)Result, LocalName); - } - else - { - /* Result will be overridden if everything works */ - Result = CFE_EVS_FILE_WRITE_ERROR; - - /* Initialize cFE file header */ - CFE_FS_InitHeader(&FileHdr, "EVS Application Data File", CFE_FS_SubType_EVS_APPDATA); - - /* Write cFE file header to the App File */ - BytesWritten = CFE_FS_WriteHeader(FileHandle, &FileHdr); - - if (BytesWritten == sizeof(CFE_FS_Header_t)) - { - AppDataPtr = CFE_EVS_Global.AppData; - for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) - { - /* Only have data for apps that are registered */ - if ( EVS_AppDataIsUsed(AppDataPtr) ) + int32 Result; + osal_id_t FileHandle; + int32 BytesWritten; + uint32 EntryCount = 0; + uint32 i; + static CFE_EVS_AppDataFile_t AppDataFile; + CFE_FS_Header_t FileHdr; + EVS_AppData_t * AppDataPtr; + const CFE_EVS_AppDataCmd_Payload_t *CmdPtr = &data->Payload; + char LocalName[OS_MAX_PATH_LEN]; + + /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ + CFE_SB_MessageStringGet(LocalName, CmdPtr->AppDataFilename, CFE_PLATFORM_EVS_DEFAULT_APP_DATA_FILE, + sizeof(LocalName), sizeof(CmdPtr->AppDataFilename)); + + /* Create Application Data File */ + Result = OS_OpenCreate(&FileHandle, LocalName, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); + + if (Result < OS_SUCCESS) + { + EVS_SendEvent(CFE_EVS_ERR_CRDATFILE_EID, CFE_EVS_EventType_ERROR, + "Write App Data Command Error: OS_OpenCreate = 0x%08X, filename = %s", (unsigned int)Result, + LocalName); + } + else + { + /* Result will be overridden if everything works */ + Result = CFE_EVS_FILE_WRITE_ERROR; + + /* Initialize cFE file header */ + CFE_FS_InitHeader(&FileHdr, "EVS Application Data File", CFE_FS_SubType_EVS_APPDATA); + + /* Write cFE file header to the App File */ + BytesWritten = CFE_FS_WriteHeader(FileHandle, &FileHdr); + + if (BytesWritten == sizeof(CFE_FS_Header_t)) + { + AppDataPtr = CFE_EVS_Global.AppData; + for (i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++) { - /* Clear application file data record */ - memset(&AppDataFile, 0, sizeof(CFE_EVS_AppDataFile_t)); - - /* Copy application data to application file data record */ - CFE_ES_GetAppName(AppDataFile.AppName, EVS_AppDataGetID(AppDataPtr), - sizeof(AppDataFile.AppName)); - AppDataFile.ActiveFlag = AppDataPtr->ActiveFlag; - AppDataFile.EventCount = AppDataPtr->EventCount; - AppDataFile.EventTypesActiveFlag = AppDataPtr->EventTypesActiveFlag; - - /* Copy application filter data to application file data record */ - memcpy(AppDataFile.Filters, AppDataPtr->BinFilters, - CFE_PLATFORM_EVS_MAX_EVENT_FILTERS * sizeof(EVS_BinFilter_t)); - - /* Write application data record to file */ - BytesWritten = OS_write(FileHandle, &AppDataFile, sizeof(CFE_EVS_AppDataFile_t)); - - if (BytesWritten == sizeof(CFE_EVS_AppDataFile_t)) - { - EntryCount++; - } - else - { - EVS_SendEvent(CFE_EVS_ERR_WRDATFILE_EID, CFE_EVS_EventType_ERROR, - "Write App Data Command Error: OS_write = 0x%08X, filename = %s", - (unsigned int)BytesWritten, LocalName); - break; - } + /* Only have data for apps that are registered */ + if (EVS_AppDataIsUsed(AppDataPtr)) + { + /* Clear application file data record */ + memset(&AppDataFile, 0, sizeof(CFE_EVS_AppDataFile_t)); + + /* Copy application data to application file data record */ + CFE_ES_GetAppName(AppDataFile.AppName, EVS_AppDataGetID(AppDataPtr), sizeof(AppDataFile.AppName)); + AppDataFile.ActiveFlag = AppDataPtr->ActiveFlag; + AppDataFile.EventCount = AppDataPtr->EventCount; + AppDataFile.EventTypesActiveFlag = AppDataPtr->EventTypesActiveFlag; + + /* Copy application filter data to application file data record */ + memcpy(AppDataFile.Filters, AppDataPtr->BinFilters, + CFE_PLATFORM_EVS_MAX_EVENT_FILTERS * sizeof(EVS_BinFilter_t)); + + /* Write application data record to file */ + BytesWritten = OS_write(FileHandle, &AppDataFile, sizeof(CFE_EVS_AppDataFile_t)); + + if (BytesWritten == sizeof(CFE_EVS_AppDataFile_t)) + { + EntryCount++; + } + else + { + EVS_SendEvent(CFE_EVS_ERR_WRDATFILE_EID, CFE_EVS_EventType_ERROR, + "Write App Data Command Error: OS_write = 0x%08X, filename = %s", + (unsigned int)BytesWritten, LocalName); + break; + } + } + ++AppDataPtr; } - ++AppDataPtr; - } - /* Process command handler success result */ - if (i == CFE_PLATFORM_ES_MAX_APPLICATIONS) - { - EVS_SendEvent(CFE_EVS_WRDAT_EID, CFE_EVS_EventType_DEBUG, - "Write App Data Command: %d application data entries written to %s", - (int)EntryCount, LocalName); - Result = CFE_SUCCESS; - } - } + /* Process command handler success result */ + if (i == CFE_PLATFORM_ES_MAX_APPLICATIONS) + { + EVS_SendEvent(CFE_EVS_WRDAT_EID, CFE_EVS_EventType_DEBUG, + "Write App Data Command: %d application data entries written to %s", (int)EntryCount, + LocalName); + Result = CFE_SUCCESS; + } + } - OS_close(FileHandle); - } + OS_close(FileHandle); + } - return(Result); + return (Result); } /* End CFE_EVS_WriteAppDataFileCmd */ - /* End cfe_evs_task */ diff --git a/modules/evs/fsw/src/cfe_evs_task.h b/modules/evs/fsw/src/cfe_evs_task.h index f9dbf7c87..df92fe472 100644 --- a/modules/evs/fsw/src/cfe_evs_task.h +++ b/modules/evs/fsw/src/cfe_evs_task.h @@ -53,90 +53,86 @@ /********************* Macro and Constant Type Definitions ***************************/ -#define CFE_EVS_MSG_TRUNCATED '$' -#define CFE_EVS_FREE_SLOT (-1) -#define CFE_EVS_NO_MASK 0 -#define CFE_EVS_PIPE_DEPTH 32 -#define CFE_EVS_MAX_EVENT_SEND_COUNT 65535 -#define CFE_EVS_MAX_FILTER_COUNT 65535 -#define CFE_EVS_PIPE_NAME "EVS_CMD_PIPE" -#define CFE_EVS_MAX_PORT_MSG_LENGTH (CFE_MISSION_EVS_MAX_MESSAGE_LENGTH+OS_MAX_API_NAME+30) - -/* Since CFE_EVS_MAX_PORT_MSG_LENGTH is the size of the buffer that is sent to - * print out (using OS_printf), we need to check to make sure that the buffer +#define CFE_EVS_MSG_TRUNCATED '$' +#define CFE_EVS_FREE_SLOT (-1) +#define CFE_EVS_NO_MASK 0 +#define CFE_EVS_PIPE_DEPTH 32 +#define CFE_EVS_MAX_EVENT_SEND_COUNT 65535 +#define CFE_EVS_MAX_FILTER_COUNT 65535 +#define CFE_EVS_PIPE_NAME "EVS_CMD_PIPE" +#define CFE_EVS_MAX_PORT_MSG_LENGTH (CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + OS_MAX_API_NAME + 30) + +/* Since CFE_EVS_MAX_PORT_MSG_LENGTH is the size of the buffer that is sent to + * print out (using OS_printf), we need to check to make sure that the buffer * size the OS uses is big enough. This check has to be made here because it is * the first spot after CFE_EVS_MAX_PORT_MSG_LENGTH is defined */ -#if OS_BUFFER_SIZE < CFE_EVS_MAX_PORT_MSG_LENGTH - #error CFE_EVS_MAX_PORT_MSG_LENGTH cannot be greater than OS_BUFFER_SIZE! +#if OS_BUFFER_SIZE < CFE_EVS_MAX_PORT_MSG_LENGTH +#error CFE_EVS_MAX_PORT_MSG_LENGTH cannot be greater than OS_BUFFER_SIZE! #endif - /************************ Internal Structure Definitions *****************************/ typedef struct { - int16 EventID; /* Numerical event identifier */ - uint16 Mask; /* Binary filter mask */ - uint16 Count; /* Binary filter counter */ - uint16 Padding; /* Structure padding */ + int16 EventID; /* Numerical event identifier */ + uint16 Mask; /* Binary filter mask */ + uint16 Count; /* Binary filter counter */ + uint16 Padding; /* Structure padding */ } EVS_BinFilter_t; - typedef struct { CFE_ES_AppId_t AppID; CFE_ES_AppId_t UnregAppID; - EVS_BinFilter_t BinFilters[CFE_PLATFORM_EVS_MAX_EVENT_FILTERS]; /* Array of binary filters */ + EVS_BinFilter_t BinFilters[CFE_PLATFORM_EVS_MAX_EVENT_FILTERS]; /* Array of binary filters */ - uint8 ActiveFlag; /* Application event service active flag */ - uint8 EventTypesActiveFlag; /* Application event types active flag */ - uint16 EventCount; /* Application event counter */ + uint8 ActiveFlag; /* Application event service active flag */ + uint8 EventTypesActiveFlag; /* Application event types active flag */ + uint16 EventCount; /* Application event counter */ } EVS_AppData_t; - -typedef struct { - char AppName[OS_MAX_API_NAME]; /* Application name */ - uint8 ActiveFlag; /* Application event service active flag */ - uint8 EventTypesActiveFlag; /* Application event types active flag */ - uint16 EventCount; /* Application event counter */ - EVS_BinFilter_t Filters[CFE_PLATFORM_EVS_MAX_EVENT_FILTERS]; /* Application event filters */ +typedef struct +{ + char AppName[OS_MAX_API_NAME]; /* Application name */ + uint8 ActiveFlag; /* Application event service active flag */ + uint8 EventTypesActiveFlag; /* Application event types active flag */ + uint16 EventCount; /* Application event counter */ + EVS_BinFilter_t Filters[CFE_PLATFORM_EVS_MAX_EVENT_FILTERS]; /* Application event filters */ } CFE_EVS_AppDataFile_t; - /* Global data structure */ typedef struct { - EVS_AppData_t AppData[CFE_PLATFORM_ES_MAX_APPLICATIONS]; /* Application state data and event filters */ - - CFE_EVS_Log_t *EVS_LogPtr; /* Pointer to the EVS log in the ES Reset area*/ - /* see cfe_es_global.h */ - - /* - ** EVS task data - */ - CFE_EVS_HousekeepingTlm_t EVS_TlmPkt; - CFE_SB_PipeId_t EVS_CommandPipe; - osal_id_t EVS_SharedDataMutexID; - CFE_ES_AppId_t EVS_AppID; + EVS_AppData_t AppData[CFE_PLATFORM_ES_MAX_APPLICATIONS]; /* Application state data and event filters */ + + CFE_EVS_Log_t *EVS_LogPtr; /* Pointer to the EVS log in the ES Reset area*/ + /* see cfe_es_global.h */ + + /* + ** EVS task data + */ + CFE_EVS_HousekeepingTlm_t EVS_TlmPkt; + CFE_SB_PipeId_t EVS_CommandPipe; + osal_id_t EVS_SharedDataMutexID; + CFE_ES_AppId_t EVS_AppID; } CFE_EVS_Global_t; /* * Global variable specific to EVS module */ -extern CFE_EVS_Global_t CFE_EVS_Global; - +extern CFE_EVS_Global_t CFE_EVS_Global; /***************************** Function Prototypes **********************************/ /* -* Functions used within this module and by the unit test -*/ -extern int32 CFE_EVS_TaskInit (void); + * Functions used within this module and by the unit test + */ +extern int32 CFE_EVS_TaskInit(void); extern void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr); /* @@ -163,5 +159,4 @@ 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_ */ +#endif /* _cfe_evs_task_ */ diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 2bfb59a53..de93e565f 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -35,15 +35,14 @@ #include /* Local Function Prototypes */ -void EVS_SendViaPorts (CFE_EVS_LongEventTlm_t *EVS_PktPtr); -void EVS_OutputPort1 (char *Message); -void EVS_OutputPort2 (char *Message); -void EVS_OutputPort3 (char *Message); -void EVS_OutputPort4 (char *Message); +void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr); +void EVS_OutputPort1(char *Message); +void EVS_OutputPort2(char *Message); +void EVS_OutputPort3(char *Message); +void EVS_OutputPort4(char *Message); /* Function Definitions */ - /* ** Function Prologue ** @@ -54,61 +53,59 @@ void EVS_OutputPort4 (char *Message); ** Assumptions and Notes: ** */ -EVS_AppData_t *EVS_GetAppDataByID (CFE_ES_AppId_t AppID) +EVS_AppData_t *EVS_GetAppDataByID(CFE_ES_AppId_t AppID) { - uint32 AppIndex; - EVS_AppData_t *AppDataPtr; + uint32 AppIndex; + EVS_AppData_t *AppDataPtr; - if (CFE_ES_AppID_ToIndex(AppID, &AppIndex) == CFE_SUCCESS && - AppIndex < CFE_PLATFORM_ES_MAX_APPLICATIONS) - { - AppDataPtr = &CFE_EVS_Global.AppData[AppIndex]; - } - else - { - AppDataPtr = NULL; - } + if (CFE_ES_AppID_ToIndex(AppID, &AppIndex) == CFE_SUCCESS && AppIndex < CFE_PLATFORM_ES_MAX_APPLICATIONS) + { + AppDataPtr = &CFE_EVS_Global.AppData[AppIndex]; + } + else + { + AppDataPtr = NULL; + } - return(AppDataPtr); + return (AppDataPtr); } /* End EVS_GetAppDataByID */ -int32 EVS_GetCurrentContext (EVS_AppData_t **AppDataOut, CFE_ES_AppId_t *AppIDOut) +int32 EVS_GetCurrentContext(EVS_AppData_t **AppDataOut, CFE_ES_AppId_t *AppIDOut) { - CFE_ES_AppId_t AppID; - EVS_AppData_t *AppDataPtr; - int32 Status; - - /* Get the caller's AppID */ - Status = CFE_ES_GetAppID(&AppID); - if (Status == CFE_SUCCESS) - { - AppDataPtr = EVS_GetAppDataByID (AppID); - } - else - { - AppDataPtr = NULL; - } - - if (AppDataPtr == NULL) - { - /* use EVS error/status code */ - Status = CFE_EVS_APP_ILLEGAL_APP_ID; - } - - if (AppIDOut) - { - *AppIDOut = AppID; - } - if (AppDataOut) - { - *AppDataOut = AppDataPtr; - } - - return Status; + CFE_ES_AppId_t AppID; + EVS_AppData_t *AppDataPtr; + int32 Status; -} /* End EVS_GetCurrentContext */ + /* Get the caller's AppID */ + Status = CFE_ES_GetAppID(&AppID); + if (Status == CFE_SUCCESS) + { + AppDataPtr = EVS_GetAppDataByID(AppID); + } + else + { + AppDataPtr = NULL; + } + + if (AppDataPtr == NULL) + { + /* use EVS error/status code */ + Status = CFE_EVS_APP_ILLEGAL_APP_ID; + } + + if (AppIDOut) + { + *AppIDOut = AppID; + } + if (AppDataOut) + { + *AppDataOut = AppDataPtr; + } + return Status; + +} /* End EVS_GetCurrentContext */ /* ** Function Prologue @@ -121,44 +118,41 @@ int32 EVS_GetCurrentContext (EVS_AppData_t **AppDataOut, CFE_ES_AppId_t *AppIDOu ** Assumptions and Notes: ** */ -int32 EVS_GetApplicationInfo (EVS_AppData_t **AppDataOut, const char *pAppName) +int32 EVS_GetApplicationInfo(EVS_AppData_t **AppDataOut, const char *pAppName) { - int32 Status; - CFE_ES_AppId_t AppID; - EVS_AppData_t *AppDataPtr; - - Status = CFE_ES_GetAppIDByName(&AppID, pAppName); - if (Status != CFE_SUCCESS) - { - AppDataPtr = NULL; - } - else - { - AppDataPtr = EVS_GetAppDataByID(AppID); - if (AppDataPtr == NULL) - { - /* - * should not happen - it means the CFE_ES_GetAppIDByName() - * returned a success code with an AppID which was in subsequently - * not accepted by CFE_ES_AppID_ToIndex() - */ - Status = CFE_EVS_APP_ILLEGAL_APP_ID; - } - else if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) - { - /* Avoid outputting a bad pointer */ - AppDataPtr = NULL; - Status = CFE_EVS_APP_NOT_REGISTERED; - } - } - - - - *AppDataOut = AppDataPtr; - return Status; + int32 Status; + CFE_ES_AppId_t AppID; + EVS_AppData_t *AppDataPtr; -} /* End EVS_GetApplicationInfo */ + Status = CFE_ES_GetAppIDByName(&AppID, pAppName); + if (Status != CFE_SUCCESS) + { + AppDataPtr = NULL; + } + else + { + AppDataPtr = EVS_GetAppDataByID(AppID); + if (AppDataPtr == NULL) + { + /* + * should not happen - it means the CFE_ES_GetAppIDByName() + * returned a success code with an AppID which was in subsequently + * not accepted by CFE_ES_AppID_ToIndex() + */ + Status = CFE_EVS_APP_ILLEGAL_APP_ID; + } + else if (!EVS_AppDataIsMatch(AppDataPtr, AppID)) + { + /* Avoid outputting a bad pointer */ + AppDataPtr = NULL; + Status = CFE_EVS_APP_NOT_REGISTERED; + } + } + *AppDataOut = AppDataPtr; + return Status; + +} /* End EVS_GetApplicationInfo */ /* ** Function Prologue @@ -170,35 +164,34 @@ int32 EVS_GetApplicationInfo (EVS_AppData_t **AppDataOut, const char *pAppName) ** Assumptions and Notes: ** */ -int32 EVS_NotRegistered (EVS_AppData_t *AppDataPtr, CFE_ES_AppId_t CallerID) +int32 EVS_NotRegistered(EVS_AppData_t *AppDataPtr, CFE_ES_AppId_t CallerID) { - char AppName[OS_MAX_API_NAME]; + char AppName[OS_MAX_API_NAME]; - /* Send only one "not registered" event per application */ - if ( !CFE_RESOURCEID_TEST_EQUAL(AppDataPtr->UnregAppID, CallerID) ) - { - /* Increment count of "not registered" applications */ - CFE_EVS_Global.EVS_TlmPkt.Payload.UnregisteredAppCounter++; + /* Send only one "not registered" event per application */ + if (!CFE_RESOURCEID_TEST_EQUAL(AppDataPtr->UnregAppID, CallerID)) + { + /* Increment count of "not registered" applications */ + CFE_EVS_Global.EVS_TlmPkt.Payload.UnregisteredAppCounter++; - /* Indicate that "not registered" event has been sent for this app */ - AppDataPtr->UnregAppID = CallerID; + /* Indicate that "not registered" event has been sent for this app */ + AppDataPtr->UnregAppID = CallerID; - /* Get the name of the "not registered" app */ - CFE_ES_GetAppName(AppName, CallerID, sizeof(AppName)); + /* Get the name of the "not registered" app */ + CFE_ES_GetAppName(AppName, CallerID, sizeof(AppName)); - /* Send the "not registered" event */ - EVS_SendEvent(CFE_EVS_ERR_UNREGISTERED_EVS_APP, CFE_EVS_EventType_ERROR, - "App %s not registered with Event Services. Unable to send event.", AppName); + /* Send the "not registered" event */ + EVS_SendEvent(CFE_EVS_ERR_UNREGISTERED_EVS_APP, CFE_EVS_EventType_ERROR, + "App %s not registered with Event Services. Unable to send event.", AppName); - /* Write the "not registered" info to the system log */ - CFE_ES_WriteToSysLog("App %s not registered with Event Services. Unable to send event.\n", AppName); - } + /* Write the "not registered" info to the system log */ + CFE_ES_WriteToSysLog("App %s not registered with Event Services. Unable to send event.\n", AppName); + } - return(CFE_EVS_APP_NOT_REGISTERED); + return (CFE_EVS_APP_NOT_REGISTERED); } /* End EVS_NotRegistered */ - /* ** Function Prologue ** @@ -211,100 +204,99 @@ int32 EVS_NotRegistered (EVS_AppData_t *AppDataPtr, CFE_ES_AppId_t CallerID) ** Assumptions and Notes: ** */ -bool EVS_IsFiltered (EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType) +bool EVS_IsFiltered(EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType) { - EVS_BinFilter_t *FilterPtr; - bool Filtered = false; - char AppName[OS_MAX_API_NAME]; - - - if (AppDataPtr->ActiveFlag == false) - { - /* All events are disabled for this application */ - Filtered = true; - } - else switch (EventType) - { - case CFE_EVS_EventType_DEBUG: - - if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_DEBUG_BIT) == 0) - { - /* Debug events are disabled for this application */ - Filtered = true; - } - break; - - case CFE_EVS_EventType_INFORMATION: - - if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_INFORMATION_BIT) == 0) - { - /* Informational events are disabled for this application */ - Filtered = true; - } - break; - - case CFE_EVS_EventType_ERROR: - - if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_ERROR_BIT) == 0) - { - /* Error events are disabled for this application */ - Filtered = true; - } - break; - - case CFE_EVS_EventType_CRITICAL: - - if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_CRITICAL_BIT) == 0) - { - /* Critical events are disabled for this application */ - Filtered = true; - } - break; - - default: - - /* Invalid Event Type */ - Filtered = true; - break; - } - - /* Is this type of event enabled for this application? */ - if (Filtered == false) - { - FilterPtr = EVS_FindEventID(EventID, AppDataPtr->BinFilters); - - /* Does this event ID have an event filter table entry? */ - if (FilterPtr != NULL) - { - if ((FilterPtr->Mask & FilterPtr->Count) != 0) - { - /* This iteration of the event ID is filtered */ - Filtered = true; - } - - if (FilterPtr->Count < CFE_EVS_MAX_FILTER_COUNT) - { - /* Maintain event iteration count */ - FilterPtr->Count++; - - /* Is it time to lock this filter? */ - if (FilterPtr->Count == CFE_EVS_MAX_FILTER_COUNT) + EVS_BinFilter_t *FilterPtr; + bool Filtered = false; + char AppName[OS_MAX_API_NAME]; + + if (AppDataPtr->ActiveFlag == false) + { + /* All events are disabled for this application */ + Filtered = true; + } + else + switch (EventType) + { + case CFE_EVS_EventType_DEBUG: + + if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_DEBUG_BIT) == 0) + { + /* Debug events are disabled for this application */ + Filtered = true; + } + break; + + case CFE_EVS_EventType_INFORMATION: + + if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_INFORMATION_BIT) == 0) + { + /* Informational events are disabled for this application */ + Filtered = true; + } + break; + + case CFE_EVS_EventType_ERROR: + + if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_ERROR_BIT) == 0) + { + /* Error events are disabled for this application */ + Filtered = true; + } + break; + + case CFE_EVS_EventType_CRITICAL: + + if ((AppDataPtr->EventTypesActiveFlag & CFE_EVS_CRITICAL_BIT) == 0) + { + /* Critical events are disabled for this application */ + Filtered = true; + } + break; + + default: + + /* Invalid Event Type */ + Filtered = true; + break; + } + + /* Is this type of event enabled for this application? */ + if (Filtered == false) + { + FilterPtr = EVS_FindEventID(EventID, AppDataPtr->BinFilters); + + /* Does this event ID have an event filter table entry? */ + if (FilterPtr != NULL) + { + if ((FilterPtr->Mask & FilterPtr->Count) != 0) { - CFE_ES_GetAppName(AppName, EVS_AppDataGetID(AppDataPtr), sizeof(AppName)); + /* This iteration of the event ID is filtered */ + Filtered = true; + } - EVS_SendEvent(CFE_EVS_FILTER_MAX_EID, CFE_EVS_EventType_INFORMATION, - "Max filter count reached, AppName = %s, EventID = 0x%08x: Filter locked until reset", - AppName, (unsigned int)EventID); + if (FilterPtr->Count < CFE_EVS_MAX_FILTER_COUNT) + { + /* Maintain event iteration count */ + FilterPtr->Count++; + + /* Is it time to lock this filter? */ + if (FilterPtr->Count == CFE_EVS_MAX_FILTER_COUNT) + { + CFE_ES_GetAppName(AppName, EVS_AppDataGetID(AppDataPtr), sizeof(AppName)); + + EVS_SendEvent(CFE_EVS_FILTER_MAX_EID, CFE_EVS_EventType_INFORMATION, + "Max filter count reached, AppName = %s, EventID = 0x%08x: Filter locked until reset", + AppName, (unsigned int)EventID); + } } - } - } - } + } + } - return(Filtered); + return (Filtered); } /* End EVS_IsFiltered */ - /* ** Function Prologue ** @@ -316,23 +308,22 @@ bool EVS_IsFiltered (EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType ** Assumptions and Notes: ** */ -EVS_BinFilter_t *EVS_FindEventID (int16 EventID, EVS_BinFilter_t *FilterArray) +EVS_BinFilter_t *EVS_FindEventID(int16 EventID, EVS_BinFilter_t *FilterArray) { - uint32 i; + uint32 i; - for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) - { - if (FilterArray[i].EventID == EventID) - { - return(&FilterArray[i]); - } - } + for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) + { + if (FilterArray[i].EventID == EventID) + { + return (&FilterArray[i]); + } + } - return((EVS_BinFilter_t *) NULL); + return ((EVS_BinFilter_t *)NULL); } /* End EVS_FindEventID */ - /* ** Function Prologue ** @@ -343,16 +334,15 @@ EVS_BinFilter_t *EVS_FindEventID (int16 EventID, EVS_BinFilter_t *FilterArray) ** Assumptions and Notes: ** */ -void EVS_EnableTypes (EVS_AppData_t *AppDataPtr, uint8 BitMask) +void EVS_EnableTypes(EVS_AppData_t *AppDataPtr, uint8 BitMask) { - uint8 EventTypeBits = (CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT); + uint8 EventTypeBits = (CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT); - /* Enable selected event type bits from bitmask */ - AppDataPtr->EventTypesActiveFlag |= (BitMask & EventTypeBits); + /* Enable selected event type bits from bitmask */ + AppDataPtr->EventTypesActiveFlag |= (BitMask & EventTypeBits); } /* End EVS_EnableTypes */ - /* ** Function Prologue ** @@ -363,16 +353,15 @@ void EVS_EnableTypes (EVS_AppData_t *AppDataPtr, uint8 BitMask) ** Assumptions and Notes: ** */ -void EVS_DisableTypes (EVS_AppData_t *AppDataPtr, uint8 BitMask) +void EVS_DisableTypes(EVS_AppData_t *AppDataPtr, uint8 BitMask) { - uint8 EventTypeBits = (CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT); + uint8 EventTypeBits = (CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT); - /* Disable selected event type bits from bitmask */ - AppDataPtr->EventTypesActiveFlag &= ~(BitMask & EventTypeBits); + /* Disable selected event type bits from bitmask */ + AppDataPtr->EventTypesActiveFlag &= ~(BitMask & EventTypeBits); } /* End EVS_DisableTypes */ - /* ** Function Prologue ** @@ -387,33 +376,34 @@ void EVS_DisableTypes (EVS_AppData_t *AppDataPtr, uint8 BitMask) ** If configured for short events, a separate short message is generated using a subset ** of the information from the long message. */ -void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType, const CFE_TIME_SysTime_t *TimeStamp, const char *MsgSpec, va_list ArgPtr) +void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType, + const CFE_TIME_SysTime_t *TimeStamp, const char *MsgSpec, va_list ArgPtr) { - CFE_EVS_LongEventTlm_t LongEventTlm; /* The "long" flavor is always generated, as this is what is logged */ - CFE_EVS_ShortEventTlm_t ShortEventTlm; /* The "short" flavor is only generated if selected */ - int ExpandedLength; + CFE_EVS_LongEventTlm_t LongEventTlm; /* The "long" flavor is always generated, as this is what is logged */ + CFE_EVS_ShortEventTlm_t ShortEventTlm; /* The "short" flavor is only generated if selected */ + int ExpandedLength; /* Initialize EVS event packets */ - CFE_MSG_Init(&LongEventTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), - sizeof(LongEventTlm)); + 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; /* vsnprintf() returns the total expanded length of the formatted string */ /* vsnprintf() copies and zero terminates portion that fits in the buffer */ - ExpandedLength = vsnprintf((char *)LongEventTlm.Payload.Message, sizeof(LongEventTlm.Payload.Message), MsgSpec, ArgPtr); + ExpandedLength = + vsnprintf((char *)LongEventTlm.Payload.Message, sizeof(LongEventTlm.Payload.Message), MsgSpec, ArgPtr); /* Were any characters truncated in the buffer? */ if (ExpandedLength >= sizeof(LongEventTlm.Payload.Message)) { - /* Mark character before zero terminator to indicate truncation */ - LongEventTlm.Payload.Message[sizeof(LongEventTlm.Payload.Message) - 2] = CFE_EVS_MSG_TRUNCATED; - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter++; + /* Mark character before zero terminator to indicate truncation */ + LongEventTlm.Payload.Message[sizeof(LongEventTlm.Payload.Message) - 2] = CFE_EVS_MSG_TRUNCATED; + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter++; } /* Obtain task and system information */ CFE_ES_GetAppName((char *)LongEventTlm.Payload.PacketID.AppName, EVS_AppDataGetID(AppDataPtr), - sizeof(LongEventTlm.Payload.PacketID.AppName)); + sizeof(LongEventTlm.Payload.PacketID.AppName)); LongEventTlm.Payload.PacketID.SpacecraftID = CFE_PSP_GetSpacecraftId(); LongEventTlm.Payload.PacketID.ProcessorID = CFE_PSP_GetProcessorId(); @@ -449,17 +439,16 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 /* Increment message send counters (prevent rollover) */ if (CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter < CFE_EVS_MAX_EVENT_SEND_COUNT) { - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter++; + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter++; } if (AppDataPtr->EventCount < CFE_EVS_MAX_EVENT_SEND_COUNT) { - AppDataPtr->EventCount++; + AppDataPtr->EventCount++; } } /* End EVS_GenerateEventTelemetry */ - /* ** Function Prologue ** @@ -470,60 +459,55 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 ** ** Assumptions and Notes: */ -void EVS_SendViaPorts (CFE_EVS_LongEventTlm_t *EVS_PktPtr) +void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr) { - char PortMessage[CFE_EVS_MAX_PORT_MSG_LENGTH]; - - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT) >> 0) == true) - { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port1 %u/%u/%s %u: %s", (unsigned int) EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int) EVS_PktPtr->Payload.PacketID.ProcessorID, - EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int) EVS_PktPtr->Payload.PacketID.EventID, - EVS_PktPtr->Payload.Message); - /* Send string event out port #1 */ - EVS_OutputPort1(PortMessage); - } - - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT2_BIT) >> 1) == true) - { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port2 %u/%u/%s %u: %s", (unsigned int) EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int) EVS_PktPtr->Payload.PacketID.ProcessorID, - EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int) EVS_PktPtr->Payload.PacketID.EventID, - EVS_PktPtr->Payload.Message); - /* Send string event out port #2 */ - EVS_OutputPort2(PortMessage); - } - - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT3_BIT) >> 2) == true) - { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port3 %u/%u/%s %u: %s", (unsigned int) EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int) EVS_PktPtr->Payload.PacketID.ProcessorID, - EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int) EVS_PktPtr->Payload.PacketID.EventID, - EVS_PktPtr->Payload.Message); - /* Send string event out port #3 */ - EVS_OutputPort3(PortMessage); - } - - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT4_BIT) >> 3) == true) - { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port4 %u/%u/%s %u: %s", (unsigned int) EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int) EVS_PktPtr->Payload.PacketID.ProcessorID, - EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int) EVS_PktPtr->Payload.PacketID.EventID, - EVS_PktPtr->Payload.Message); - /* Send string event out port #4 */ - EVS_OutputPort4(PortMessage); - } + char PortMessage[CFE_EVS_MAX_PORT_MSG_LENGTH]; -} /* End SendViaPorts */ + if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT) >> 0) == true) + { + /* Copy event message to string format */ + snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port1 %u/%u/%s %u: %s", + (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, + (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, + (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); + /* Send string event out port #1 */ + EVS_OutputPort1(PortMessage); + } + if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT2_BIT) >> 1) == true) + { + /* Copy event message to string format */ + snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port2 %u/%u/%s %u: %s", + (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, + (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, + (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); + /* Send string event out port #2 */ + EVS_OutputPort2(PortMessage); + } + + if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT3_BIT) >> 2) == true) + { + /* Copy event message to string format */ + snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port3 %u/%u/%s %u: %s", + (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, + (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, + (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); + /* Send string event out port #3 */ + EVS_OutputPort3(PortMessage); + } + + if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT4_BIT) >> 3) == true) + { + /* Copy event message to string format */ + snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port4 %u/%u/%s %u: %s", + (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, + (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, + (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); + /* Send string event out port #4 */ + EVS_OutputPort4(PortMessage); + } + +} /* End SendViaPorts */ /* ** Function Prologue @@ -536,13 +520,12 @@ void EVS_SendViaPorts (CFE_EVS_LongEventTlm_t *EVS_PktPtr) ** Assumptions and Notes: ** */ -void EVS_OutputPort1 (char *Message) +void EVS_OutputPort1(char *Message) { OS_printf("%s\n", Message); } /* End ES_OutputPort1 */ - /* ** Function Prologue ** @@ -554,13 +537,12 @@ void EVS_OutputPort1 (char *Message) ** Assumptions and Notes: ** */ -void EVS_OutputPort2 (char *Message) +void EVS_OutputPort2(char *Message) { - OS_printf("%s\n", Message); + OS_printf("%s\n", Message); } /* End ES_OutputPort2 */ - /* ** Function Prologue ** @@ -572,13 +554,12 @@ void EVS_OutputPort2 (char *Message) ** Assumptions and Notes: ** */ -void EVS_OutputPort3 (char *Message) +void EVS_OutputPort3(char *Message) { - OS_printf("%s\n", Message); + OS_printf("%s\n", Message); } /* End ES_OutputPort3 */ - /* ** Function Prologue ** @@ -590,13 +571,12 @@ void EVS_OutputPort3 (char *Message) ** Assumptions and Notes: ** */ -void EVS_OutputPort4 (char *Message) +void EVS_OutputPort4(char *Message) { - OS_printf("%s\n", Message); + OS_printf("%s\n", Message); } /* End ES_OutputPort4 */ - /* ** Function Prologue ** @@ -609,34 +589,33 @@ void EVS_OutputPort4 (char *Message) ** ** Assumptions and Notes: */ -int32 EVS_SendEvent (uint16 EventID, uint16 EventType, const char *Spec, ... ) +int32 EVS_SendEvent(uint16 EventID, uint16 EventType, const char *Spec, ...) { - CFE_TIME_SysTime_t Time; - va_list Ptr; - EVS_AppData_t *AppDataPtr; - - /* - * Must check that EVS_AppID is valid, which can happen if this is called - * by some other thread before CFE_EVS_TaskInit() runs - */ - AppDataPtr = EVS_GetAppDataByID(CFE_EVS_Global.EVS_AppID); - - /* Unlikely, but possible that an EVS event filter was added by command */ - if ( EVS_AppDataIsMatch(AppDataPtr, CFE_EVS_Global.EVS_AppID) && - EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) - { - /* Get current spacecraft time */ - Time = CFE_TIME_GetTime(); - - /* Send the event packets */ - va_start(Ptr, Spec); - EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); - va_end(Ptr); - } - - return(CFE_SUCCESS); + CFE_TIME_SysTime_t Time; + va_list Ptr; + EVS_AppData_t * AppDataPtr; + + /* + * Must check that EVS_AppID is valid, which can happen if this is called + * by some other thread before CFE_EVS_TaskInit() runs + */ + AppDataPtr = EVS_GetAppDataByID(CFE_EVS_Global.EVS_AppID); + + /* Unlikely, but possible that an EVS event filter was added by command */ + if (EVS_AppDataIsMatch(AppDataPtr, CFE_EVS_Global.EVS_AppID) && + EVS_IsFiltered(AppDataPtr, EventID, EventType) == false) + { + /* Get current spacecraft time */ + Time = CFE_TIME_GetTime(); -} /* End EVS_SendEvent */ + /* Send the event packets */ + va_start(Ptr, Spec); + EVS_GenerateEventTelemetry(AppDataPtr, EventID, EventType, &Time, Spec, Ptr); + va_end(Ptr); + } + return (CFE_SUCCESS); + +} /* End EVS_SendEvent */ /* End cfe_evs_utils */ diff --git a/modules/evs/fsw/src/cfe_evs_utils.h b/modules/evs/fsw/src/cfe_evs_utils.h index eb82998c1..db547bf05 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.h +++ b/modules/evs/fsw/src/cfe_evs_utils.h @@ -43,14 +43,14 @@ /********************* Include Files ************************/ -#include "cfe_evs_task.h" /* EVS internal definitions */ +#include "cfe_evs_task.h" /* EVS internal definitions */ #include "cfe_resourceid.h" #include "cfe_es_api_typedefs.h" #include "cfe_time_api_typedefs.h" /* ============== Section I: Macro and Constant Type Definitions =========== */ -/* ============== Section II: Internal Structures ============ */ +/* ============== Section II: Internal Structures ============ */ /* ============== Section III: Function Prototypes =========== */ @@ -66,7 +66,7 @@ * @param[in] AppID AppID to find * @returns Pointer to app table entry, or NULL if ID is invalid. */ -EVS_AppData_t *EVS_GetAppDataByID (CFE_ES_AppId_t AppID); +EVS_AppData_t *EVS_GetAppDataByID(CFE_ES_AppId_t AppID); /** * @brief Obtain the context information for the currently running app @@ -77,8 +77,7 @@ EVS_AppData_t *EVS_GetAppDataByID (CFE_ES_AppId_t AppID); * @param[out] AppIDOut Location to store AppID * @returns CFE_SUCCESS if successful, or relevant error code. */ -int32 EVS_GetCurrentContext (EVS_AppData_t **AppDataOut, CFE_ES_AppId_t *AppIDOut); - +int32 EVS_GetCurrentContext(EVS_AppData_t **AppDataOut, CFE_ES_AppId_t *AppIDOut); /** * @brief Check if an EVS app record is in use or free/empty @@ -158,22 +157,20 @@ static inline bool EVS_AppDataIsMatch(EVS_AppData_t *AppDataPtr, CFE_ES_AppId_t return (AppDataPtr != NULL && CFE_RESOURCEID_TEST_EQUAL(AppDataPtr->AppID, AppID)); } - - int32 EVS_GetApplicationInfo(EVS_AppData_t **AppDataOut, const char *pAppName); -int32 EVS_NotRegistered (EVS_AppData_t *AppDataPtr, CFE_ES_AppId_t CallerID); +int32 EVS_NotRegistered(EVS_AppData_t *AppDataPtr, CFE_ES_AppId_t CallerID); bool EVS_IsFiltered(EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType); EVS_BinFilter_t *EVS_FindEventID(int16 EventID, EVS_BinFilter_t *FilterArray); -void EVS_EnableTypes (EVS_AppData_t *AppDataPtr, uint8 BitMask); -void EVS_DisableTypes (EVS_AppData_t *AppDataPtr, uint8 BitMask); +void EVS_EnableTypes(EVS_AppData_t *AppDataPtr, uint8 BitMask); +void EVS_DisableTypes(EVS_AppData_t *AppDataPtr, uint8 BitMask); void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType, - const CFE_TIME_SysTime_t *Time, const char *MsgSpec, va_list ArgPtr); + const CFE_TIME_SysTime_t *Time, const char *MsgSpec, va_list ArgPtr); -int32 EVS_SendEvent (uint16 EventID, uint16 EventType, const char *Spec, ... ); +int32 EVS_SendEvent(uint16 EventID, uint16 EventType, const char *Spec, ...); -#endif /* _cfe_evs_utils_ */ +#endif /* _cfe_evs_utils_ */ diff --git a/modules/evs/fsw/src/cfe_evs_verify.h b/modules/evs/fsw/src/cfe_evs_verify.h index 2aa04781b..46ab29fad 100644 --- a/modules/evs/fsw/src/cfe_evs_verify.h +++ b/modules/evs/fsw/src/cfe_evs_verify.h @@ -36,31 +36,32 @@ #define _cfe_evs_verify_ /* NOTE: Besides the checks in this file, there is one more in cfe_evs_task.h. - * The check is not here because it is checking a local #define based on a + * The check is not here because it is checking a local #define based on a * configuration parameter */ -#if CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG > 0x0F - #error CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG cannot be more than 0x0F! +#if CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG > 0x0F +#error CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG cannot be more than 0x0F! #endif #if (CFE_PLATFORM_EVS_DEFAULT_LOG_MODE != 0) && (CFE_PLATFORM_EVS_DEFAULT_LOG_MODE != 1) - #error CFE_PLATFORM_EVS_DEFAULT_LOG_MODE can only be 0 (Overwrite) or 1 (Discard)! +#error CFE_PLATFORM_EVS_DEFAULT_LOG_MODE can only be 0 (Overwrite) or 1 (Discard)! #endif -#if( CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_LONG) && (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_SHORT) - #error CFE_EVS_DEFAULT_MSG_FORMAT can only be CFE_EVS_MsgFormat_LONG or CFE_EVS_MsgFormat_SHORT ! +#if (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_LONG) && \ + (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_SHORT) +#error CFE_EVS_DEFAULT_MSG_FORMAT can only be CFE_EVS_MsgFormat_LONG or CFE_EVS_MsgFormat_SHORT ! #endif #if CFE_PLATFORM_EVS_PORT_DEFAULT > 0x0F - #error CFE_PLATFORM_EVS_PORT_DEFAULT cannot be greater than 0x0F! +#error CFE_PLATFORM_EVS_PORT_DEFAULT cannot be greater than 0x0F! #endif /* ** Validate task stack size... */ #if CFE_PLATFORM_EVS_START_TASK_STACK_SIZE < 2048 - #error CFE_PLATFORM_EVS_START_TASK_STACK_SIZE must be greater than or equal to 2048 +#error CFE_PLATFORM_EVS_START_TASK_STACK_SIZE must be greater than or equal to 2048 #endif #endif /* _cfe_evs_verify_ */ diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 4e03b4857..d863302a4 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -40,159 +40,79 @@ */ #include "evs_UT.h" -static const char *EVS_SYSLOG_MSGS[] = -{ - NULL, - "EVS call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", - "Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", - "EVS call to OS_MutSemCreate failed, RC=0x%08x\n", - "Event Log cleared following power-on reset\n", - "Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", - "Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", - "EVS:Application Init Failed,RC=0x%08X\n", - "EVS:Error reading cmd pipe,RC=0x%08X\n", - "EVS:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n", - "EVS:Call to CFE_ES_GetAppID Failed:RC=0x%08X\n", - "EVS:Call to CFE_EVS_Register Failed:RC=0x%08X\n", - "EVS:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", - "EVS:Subscribing to Cmds Failed:RC=0x%08X\n", - "EVS:Subscribing to HK Request Failed:RC=0x%08X\n" -}; - -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_NOOP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_NOOP_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_RESET_COUNTERS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_ENABLE_EVENT_TYPE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_DISABLE_EVENT_TYPE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_SET_EVENT_FORMAT_MODE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_ENABLE_APP_EVENT_TYPE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_DISABLE_APP_EVENT_TYPE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_ENABLE_APP_EVENTS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_DISABLE_APP_EVENTS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_RESET_APP_COUNTER_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_FILTER_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_SET_FILTER_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_ENABLE_PORTS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_DISABLE_PORTS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_RESET_FILTER_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_RESET_ALL_FILTERS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_ADD_EVENT_FILTER_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_DELETE_EVENT_FILTER_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_WRITE_APP_DATA_FILE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_WRITE_LOG_DATA_FILE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_SET_LOG_MODE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = CFE_EVS_CLEAR_LOG_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_INVALID_MID = -{ - .MsgId = CFE_SB_MSGID_RESERVED, - .CommandCode = 0 -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_INVALID_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), - .CommandCode = 0x7F -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_SEND_HK = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SEND_HK_MID) -}; - - -static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_LONGFMT_SNAPSHOTDATA = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), - .SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID.EventID), - .SnapshotSize = sizeof(uint16) -}; - -static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_SHORTFMT_SNAPSHOTDATA = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID), - .SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID.EventID), - .SnapshotSize = sizeof(uint16) -}; +static const char *EVS_SYSLOG_MSGS[] = { + NULL, + "EVS call to CFE_PSP_GetResetArea failed, RC=0x%08x\n", + "Unexpected size from CFE_PSP_GetResetArea: expected = 0x%08lX, actual = 0x%08lX\n", + "EVS call to OS_MutSemCreate failed, RC=0x%08x\n", + "Event Log cleared following power-on reset\n", + "Event Log cleared, n=%d, c=%d, f=%d, m=%d, o=%d\n", + "Event Log restored, n=%d, c=%d, f=%d, m=%d, o=%d\n", + "EVS:Application Init Failed,RC=0x%08X\n", + "EVS:Error reading cmd pipe,RC=0x%08X\n", + "EVS:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n", + "EVS:Call to CFE_ES_GetAppID Failed:RC=0x%08X\n", + "EVS:Call to CFE_EVS_Register Failed:RC=0x%08X\n", + "EVS:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", + "EVS:Subscribing to Cmds Failed:RC=0x%08X\n", + "EVS:Subscribing to HK Request Failed:RC=0x%08X\n"}; + +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_NOOP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), + .CommandCode = CFE_EVS_NOOP_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_COUNTERS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_EVENT_TYPE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_EVENT_TYPE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_SET_EVENT_FORMAT_MODE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_APP_EVENT_TYPE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_APP_EVENT_TYPE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_APP_EVENTS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_APP_EVENTS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_APP_COUNTER_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_FILTER_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_SET_FILTER_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_PORTS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_PORTS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_FILTER_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_ALL_FILTERS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ADD_EVENT_FILTER_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DELETE_EVENT_FILTER_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_WRITE_APP_DATA_FILE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_WRITE_LOG_DATA_FILE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_SET_LOG_MODE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_CLEAR_LOG_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_INVALID_MID = {.MsgId = CFE_SB_MSGID_RESERVED, .CommandCode = 0}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_INVALID_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = 0x7F}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_SEND_HK = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SEND_HK_MID)}; + +static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_LONGFMT_SNAPSHOTDATA = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), + .SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID.EventID), + .SnapshotSize = sizeof(uint16)}; + +static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_SHORTFMT_SNAPSHOTDATA = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID), + .SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID.EventID), + .SnapshotSize = sizeof(uint16)}; typedef struct { @@ -216,19 +136,19 @@ static int32 UT_EVS_MSGInitHook(void *UserObj, int32 StubRetcode, uint32 CallCou UT_EVS_MSGInitData_t *msgdataptr = UserObj; msgdataptr->MsgPtr = UT_Hook_GetArgValueByName(Context, "MsgPtr", CFE_MSG_Message_t *); - msgdataptr->MsgId = UT_Hook_GetArgValueByName(Context, "MsgId", CFE_SB_MsgId_t); - msgdataptr->Size = UT_Hook_GetArgValueByName(Context, "Size", CFE_MSG_Size_t); + msgdataptr->MsgId = UT_Hook_GetArgValueByName(Context, "MsgId", CFE_SB_MsgId_t); + msgdataptr->Size = UT_Hook_GetArgValueByName(Context, "Size", CFE_MSG_Size_t); return StubRetcode; } -static void UT_EVS_DoDispatchCheckEvents_Impl(void *MsgPtr, uint32 MsgSize, - UT_TaskPipeDispatchId_t DispatchId, const UT_SoftwareBusSnapshot_Entry_t *SnapshotCfg, - UT_EVS_EventCapture_t *EventCapture) +static void UT_EVS_DoDispatchCheckEvents_Impl(void *MsgPtr, uint32 MsgSize, UT_TaskPipeDispatchId_t DispatchId, + const UT_SoftwareBusSnapshot_Entry_t *SnapshotCfg, + UT_EVS_EventCapture_t * EventCapture) { UT_SoftwareBusSnapshot_Entry_t SnapshotData = *SnapshotCfg; - EventCapture->EventID = 0xFFFF; + EventCapture->EventID = 0xFFFF; SnapshotData.SnapshotBuffer = &EventCapture->EventID; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &SnapshotData); @@ -239,14 +159,14 @@ static void UT_EVS_DoDispatchCheckEvents_Impl(void *MsgPtr, uint32 MsgSize, UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), NULL, NULL); } -static void UT_EVS_DoDispatchCheckEvents(void *MsgPtr, uint32 MsgSize, - UT_TaskPipeDispatchId_t DispatchId, UT_EVS_EventCapture_t *EventCapture) +static void UT_EVS_DoDispatchCheckEvents(void *MsgPtr, uint32 MsgSize, UT_TaskPipeDispatchId_t DispatchId, + UT_EVS_EventCapture_t *EventCapture) { UT_EVS_DoDispatchCheckEvents_Impl(MsgPtr, MsgSize, DispatchId, &UT_EVS_LONGFMT_SNAPSHOTDATA, EventCapture); } -static void UT_EVS_DoDispatchCheckEventsShort(void *MsgPtr, uint32 MsgSize, - UT_TaskPipeDispatchId_t DispatchId, UT_EVS_EventCapture_t *EventCapture) +static void UT_EVS_DoDispatchCheckEventsShort(void *MsgPtr, uint32 MsgSize, UT_TaskPipeDispatchId_t DispatchId, + UT_EVS_EventCapture_t *EventCapture) { UT_EVS_DoDispatchCheckEvents_Impl(MsgPtr, MsgSize, DispatchId, &UT_EVS_SHORTFMT_SNAPSHOTDATA, EventCapture); } @@ -255,7 +175,7 @@ static void UT_EVS_DoGenericCheckEvents(void (*Func)(void), UT_EVS_EventCapture_ { UT_SoftwareBusSnapshot_Entry_t SnapshotData = UT_EVS_LONGFMT_SNAPSHOTDATA; - EventCapture->EventID = -1; + EventCapture->EventID = -1; SnapshotData.SnapshotBuffer = &EventCapture->EventID; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &SnapshotData); @@ -303,8 +223,7 @@ void Test_Init(void) UtPrintf("Begin Test Init"); - strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", - sizeof(appbitcmd.Payload.AppName) - 1); + strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; /* Test successful early initialization of the cFE EVS */ @@ -313,9 +232,7 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[4]), - "CFE_EVS_EarlyInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[4]), "CFE_EVS_EarlyInit", "Early initialization successful"); /* Test TaskMain with a command pipe read failure due to an @@ -333,79 +250,61 @@ void Test_Init(void) /* Test TaskMain with a register application failure */ UT_InitData(); - UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterApp),1, -1 ); + UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterApp), 1, -1); CFE_EVS_TaskMain(); UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[7]) && - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 2, - "CFE_EVS_TaskMain", - "Application initialization failure"); + UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[7]) && UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 2, + "CFE_EVS_TaskMain", "Application initialization failure"); /* Test early initialization with a get reset area failure */ UT_InitData(); UT_SetStatusBSPResetArea(-1, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_EVS_EarlyInit(); - UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, - CFE_TIME_ToneSignalSelect_PRIMARY); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[1]), - "CFE_EVS_EarlyInit", + UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[1]), "CFE_EVS_EarlyInit", "CFE_PSP_GetResetArea call failure"); /* Test early initialization, restoring the event log */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[6]), - "CFE_EVS_EarlyInit", - "Event log restored"); - + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[6]), "CFE_EVS_EarlyInit", "Event log restored"); /* Test early initialization, clearing the event log (log mode path) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); - CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE + - CFE_EVS_LogMode_DISCARD + 1; + CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE + CFE_EVS_LogMode_DISCARD + 1; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = false; - CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX - 1; + CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX - 1; CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), - "CFE_EVS_EarlyInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), "CFE_EVS_EarlyInit", "Event log cleared (log mode path)"); /* Test early initialization, clearing the event log (log full path) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); - CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_DISCARD; + CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_DISCARD; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = 2; - CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX - 1; + CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX - 1; CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), - "CFE_EVS_EarlyInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), "CFE_EVS_EarlyInit", "Event log cleared (log full path)"); /* Test early initialization, clearing the event log (next log path) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); - CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE; + CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true; - CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX; + CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX; CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), - "CFE_EVS_EarlyInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), "CFE_EVS_EarlyInit", "Event log cleared (next log path)"); /* Test early initialization with a mutex creation failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, -1); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[3]), - "CFE_EVS_EarlyInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[3]), "CFE_EVS_EarlyInit", "Mutex create failure"); /* Test early initialization with an unexpected size returned @@ -414,9 +313,7 @@ void Test_Init(void) UT_InitData(); UT_SetSizeofESResetArea(0); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[2]), - "CFE_EVS_EarlyInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[2]), "CFE_EVS_EarlyInit", "Unexpected size returned by CFE_PSP_GetResetArea"); /* Repeat sucessful initialization to configure log for later references */ @@ -425,95 +322,71 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[4]), - "CFE_EVS_EarlyInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[4]), "CFE_EVS_EarlyInit", "Early initialization successful"); /* Test task initialization where the application registration fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterApp), 1, -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[9]), - "CFE_EVS_TaskInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[9]), "CFE_EVS_TaskInit", "Call to CFE_ES_RegisterApp failure"); /* Test task initialization where event services fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 2, -1); /* Set Failure in CFE_EVS_Register -> EVS_GetApp_ID */ CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[11]), - "CFE_EVS_TaskInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[11]), "CFE_EVS_TaskInit", "Call to CFE_EVS_Register failure"); /* Test task initialization where the pipe creation fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[12]), - "CFE_EVS_TaskInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[12]), "CFE_EVS_TaskInit", "Call to CFE_SB_CreatePipe failure"); /* Test task initialization where command subscription fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[13]), - "CFE_EVS_TaskInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[13]), "CFE_EVS_TaskInit", "Subscribing to commands failure"); /* Test task initialization where HK request subscription fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[14]), - "CFE_EVS_TaskInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[14]), "CFE_EVS_TaskInit", "Subscribing to HK request failure"); /* Test task initialization where getting the application ID fails */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppID), -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[10]), - "CFE_EVS_TaskInit", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[10]), "CFE_EVS_TaskInit", "Call to CFE_ES_GetAppID Failed"); /* Test successful task initialization */ UT_InitData(); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, - "CFE_EVS_TaskInit", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_EVS_TaskInit", "Normal init (WARM)"); /* Enable DEBUG message output */ UT_InitData(); - appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | - CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable debug message output"); + appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable debug message output"); /* Disable ports */ UT_InitData(); - bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | - CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, - "CFE_EVS_DisablePortsCmd", + bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", "Disable ports"); } @@ -531,82 +404,56 @@ void Test_IllegalAppID(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test registering an event using an illegal application ID */ - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, 0) == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_Register", + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, 0) == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_Register", "Illegal app ID"); /* Test unregistering an event using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Unregister() == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_Unregister", + UT_Report(__FILE__, __LINE__, CFE_EVS_Unregister() == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_Unregister", "Illegal app ID"); /* Test sending an event using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, 0, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_SendEvent", + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, 0, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_SendEvent", "Illegal app ID"); /* Test sending an event using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - EVS_SendEvent(0, 0, "NULL") == CFE_SUCCESS, - "EVS_SendEvent", - "Illegal app ID"); + UT_Report(__FILE__, __LINE__, EVS_SendEvent(0, 0, "NULL") == CFE_SUCCESS, "EVS_SendEvent", "Illegal app ID"); /* Test sending a timed event using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendTimedEvent(time, - 0, - 0, - "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_SendTimedEvent", - "Illegal app ID"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendTimedEvent(time, 0, 0, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, + "CFE_EVS_SendTimedEvent", "Illegal app ID"); /* Test sending an event with app ID using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, - 0, - CFE_ES_APPID_UNDEFINED, - "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_SendEventWithAppID", - "Illegal app ID"); + CFE_EVS_SendEventWithAppID(0, 0, CFE_ES_APPID_UNDEFINED, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, + "CFE_EVS_SendEventWithAppID", "Illegal app ID"); /* Test resetting a filter using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetFilter(0) == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_ResetFilter", + UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(0) == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_ResetFilter", "Illegal app ID"); /* Test resetting all filters using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetAllFilters() == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_ResetAllFilters", + UT_Report(__FILE__, __LINE__, CFE_EVS_ResetAllFilters() == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_ResetAllFilters", "Illegal app ID"); /* Test application cleanup using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED) == - CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_CleanUpApp", - "Illegal app ID"); - + UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED) == CFE_EVS_APP_ILLEGAL_APP_ID, + "CFE_EVS_CleanUpApp", "Illegal app ID"); } /* @@ -615,8 +462,8 @@ void Test_IllegalAppID(void) void Test_UnregisteredApp(void) { CFE_TIME_SysTime_t time = {0, 0}; - EVS_AppData_t *AppDataPtr; - CFE_ES_AppId_t AppID; + EVS_AppData_t * AppDataPtr; + CFE_ES_AppId_t AppID; /* Get a local ref to the "current" AppData table entry */ EVS_GetCurrentContext(&AppDataPtr, &AppID); @@ -629,64 +476,43 @@ void Test_UnregisteredApp(void) CFE_EVS_Unregister(); /* Test unregistering an already unregistered application */ - UT_Report(__FILE__, __LINE__, - CFE_EVS_Unregister() == CFE_SUCCESS, - "CFE_EVS_Unregister","App not registered"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Unregister() == CFE_SUCCESS, "CFE_EVS_Unregister", "App not registered"); /* Test sending an event to an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, 0, "NULL") == CFE_EVS_APP_NOT_REGISTERED, - "CFE_EVS_SendEvent", + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, 0, "NULL") == CFE_EVS_APP_NOT_REGISTERED, "CFE_EVS_SendEvent", "App not registered"); /* Test resetting a filter using an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetFilter(0) == CFE_EVS_APP_NOT_REGISTERED, - "CFE_EVS_ResetFilter", + UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(0) == CFE_EVS_APP_NOT_REGISTERED, "CFE_EVS_ResetFilter", "App not registered"); /* Test resetting all filters using an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetAllFilters() == CFE_EVS_APP_NOT_REGISTERED, - "CFE_EVS_ResetAllFilters", + UT_Report(__FILE__, __LINE__, CFE_EVS_ResetAllFilters() == CFE_EVS_APP_NOT_REGISTERED, "CFE_EVS_ResetAllFilters", "App not registered"); /* Test sending an event with app ID to an unregistered application */ UT_InitData(); UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, - CFE_EVS_EventType_INFORMATION, - AppID, - "NULL") == CFE_EVS_APP_NOT_REGISTERED, - "CFE_EVS_SendEventWithAppID", - "App not registered"); + CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL") == CFE_EVS_APP_NOT_REGISTERED, + "CFE_EVS_SendEventWithAppID", "App not registered"); /* Test sending a timed event to an unregistered application */ UT_InitData(); UT_Report(__FILE__, __LINE__, - CFE_EVS_SendTimedEvent(time, - CFE_EVS_EventType_INFORMATION, - 0, - "NULL") == CFE_EVS_APP_NOT_REGISTERED, - "CFE_EVS_SendTimedEvent", - "App not registered"); + CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL") == CFE_EVS_APP_NOT_REGISTERED, + "CFE_EVS_SendTimedEvent", "App not registered"); /* Test application cleanup using an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_CleanUpApp(AppID) == CFE_SUCCESS, - "CFE_EVS_CleanUpApp", - "App not registered"); + UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(AppID) == CFE_SUCCESS, "CFE_EVS_CleanUpApp", "App not registered"); /* Re-register the application for subsequent tests */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Register app - successful"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Register app - successful"); } /* @@ -697,8 +523,8 @@ void Test_FilterRegistration(void) int i; CFE_EVS_BinFilter_t filter[CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1]; - EVS_BinFilter_t *FilterPtr = NULL; - EVS_AppData_t *AppDataPtr; + EVS_BinFilter_t * FilterPtr = NULL; + EVS_AppData_t * AppDataPtr; CFE_ES_AppId_t AppID; CFE_TIME_SysTime_t time = {0, 0}; @@ -707,57 +533,41 @@ void Test_FilterRegistration(void) UtPrintf("Begin Test Filter Registration"); - CFE_EVS_Global.EVS_AppID = AppID; + CFE_EVS_Global.EVS_AppID = AppID; CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Test filter registration using an invalid filter option */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, - 0, - CFE_EVS_EventFilter_BINARY + 1) == - CFE_EVS_UNKNOWN_FILTER, - "CFE_EVS_Register","Illegal filter option"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY + 1) == CFE_EVS_UNKNOWN_FILTER, + "CFE_EVS_Register", "Illegal filter option"); /* Test successful filter registration with no filters */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Valid w/ no filters"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Valid w/ no filters"); /* Test filter unregistration with failed ES_putPool */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_PutPoolBuf), -1); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Unregister() < 0, "CFE_EVS_Unregister", + UT_Report(__FILE__, __LINE__, CFE_EVS_Unregister() < 0, "CFE_EVS_Unregister", "Unregistration with failed ES_putPool"); /* Re-register to test valid unregistration */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Valid with no filters (re-registration)"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Valid with no filters (re-registration)"); /* Test successful filter unregistration */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Unregister() == CFE_SUCCESS, - "CFE_EVS_Unregister", - "Valid unregistration"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Unregister() == CFE_SUCCESS, "CFE_EVS_Unregister", "Valid unregistration"); /* Test successful filter registration with a valid filter */ UT_InitData(); filter[0].EventID = 0; - filter[0].Mask = 0x0001; - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(filter, - 1, - CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Valid w/ filter"); + filter[0].Mask = 0x0001; + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(filter, 1, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Valid w/ filter"); /* Test successful multiple filter registration with valid filters */ UT_InitData(); @@ -765,93 +575,62 @@ void Test_FilterRegistration(void) for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1; i++) { filter[i].EventID = i; - filter[i].Mask = 1; + filter[i].Mask = 1; } UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(filter, CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1, - CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Valid over max filters"); + CFE_EVS_Register(filter, CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1, CFE_EVS_EventFilter_BINARY) == + CFE_SUCCESS, + "CFE_EVS_Register", "Valid over max filters"); /* Send 1st information message, should get through */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK") == CFE_SUCCESS, - "CFE_EVS_SendEvent", - "1st info message should go through"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK") == CFE_SUCCESS, + "CFE_EVS_SendEvent", "1st info message should go through"); /* Send 2nd information message, should be filtered */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, - CFE_EVS_EventType_INFORMATION, - "FAILED") == CFE_SUCCESS, - "CFE_EVS_SendEvent", - "2nd info message should be filtered"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED") == CFE_SUCCESS, + "CFE_EVS_SendEvent", "2nd info message should be filtered"); /* Send last information message, which should cause filtering to lock */ UT_InitData(); - FilterPtr = EVS_FindEventID(0, - (EVS_BinFilter_t *) AppDataPtr->BinFilters); + FilterPtr = EVS_FindEventID(0, (EVS_BinFilter_t *)AppDataPtr->BinFilters); FilterPtr->Count = CFE_EVS_MAX_FILTER_COUNT - 1; - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, - CFE_EVS_EventType_INFORMATION, - "OK") == CFE_SUCCESS, - "CFE_EVS_SendEvent", - "Last info message should go through"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK") == CFE_SUCCESS, + "CFE_EVS_SendEvent", "Last info message should go through"); /* Test that filter lock is applied */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, - CFE_EVS_EventType_INFORMATION, - "FAILED") == CFE_SUCCESS, - "CFE_EVS_SendEvent", - "Locked info message should be filtered"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED") == CFE_SUCCESS, + "CFE_EVS_SendEvent", "Locked info message should be filtered"); /* Test that filter lock is (still) applied */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, - CFE_EVS_EventType_INFORMATION, - "FAILED") == CFE_SUCCESS, - "CFE_EVS_SendEvent", - "Locked info message should still be filtered"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED") == CFE_SUCCESS, + "CFE_EVS_SendEvent", "Locked info message should still be filtered"); /* Return application to original state: re-register application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "FE_EVS_Register", - "Re-register application"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "FE_EVS_Register", "Re-register application"); /* Test sending an event with app ID to a registered, filtered * application */ UT_InitData(); - AppDataPtr->AppID = AppID; + AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, - CFE_EVS_EventType_INFORMATION, - AppID, - "NULL") == CFE_SUCCESS, - "CFE_EVS_SendEventWithAppID", - "Application registered and filtered"); + CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL") == CFE_SUCCESS, + "CFE_EVS_SendEventWithAppID", "Application registered and filtered"); /* Test sending a timed event to a registered, filtered application */ UT_InitData(); - AppDataPtr->AppID = AppID; + AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendTimedEvent(time, - CFE_EVS_EventType_INFORMATION, - 0, - "NULL") == CFE_SUCCESS, - "CFE_EVS_SendTimedEvent", - "Application registered and filtered"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL") == CFE_SUCCESS, + "CFE_EVS_SendTimedEvent", "Application registered and filtered"); } /* @@ -866,49 +645,34 @@ void Test_FilterReset(void) /* Test successful filter registration */ UT_InitData(); filter.EventID = 1; - filter.Mask = 0x0001; - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(&filter, - 1, - CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Register filter - successful"); + filter.Mask = 0x0001; + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(&filter, 1, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Register filter - successful"); /* Test filter reset using an invalid event ID */ UT_InitData(); UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetFilter(CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1) == - CFE_EVS_EVT_NOT_REGISTERED, - "CFE_EVS_ResetFilter", - "Invalid event ID"); + CFE_EVS_ResetFilter(CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1) == CFE_EVS_EVT_NOT_REGISTERED, + "CFE_EVS_ResetFilter", "Invalid event ID"); /* Test filter reset using an unregistered event ID */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetFilter(-1) == CFE_SUCCESS, - "CFE_EVS_ResetFilter", + UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(-1) == CFE_SUCCESS, "CFE_EVS_ResetFilter", "Unregistered event ID"); /* Test successful filter reset */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetFilter(1) == CFE_SUCCESS, - "CFE_EVS_ResetFilter", - "Valid reset filter"); + UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(1) == CFE_SUCCESS, "CFE_EVS_ResetFilter", "Valid reset filter"); /* Test successful reset of all filters */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetAllFilters() == CFE_SUCCESS, - "CFE_EVS_ResetAllFilters", + UT_Report(__FILE__, __LINE__, CFE_EVS_ResetAllFilters() == CFE_SUCCESS, "CFE_EVS_ResetAllFilters", "Valid reset all filters"); /* Return application to original state: re-register application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Re-register app"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Re-register app"); } /* @@ -917,32 +681,28 @@ void Test_FilterReset(void) */ void Test_Format(void) { - int i; - char long_msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + 2]; + int i; + char long_msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + 2]; int16 EventID[2]; - CFE_TIME_SysTime_t time = {0, 0}; - CFE_EVS_SetEventFormatModeCmd_t modecmd; + CFE_TIME_SysTime_t time = {0, 0}; + CFE_EVS_SetEventFormatModeCmd_t modecmd; CFE_EVS_AppNameBitMaskCmd_t appbitcmd; - CFE_EVS_PacketID_t CapturedMsg; - UT_SoftwareBusSnapshot_Entry_t LongFmtSnapshotData = - { - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), - .SnapshotBuffer = &CapturedMsg, - .SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID), - .SnapshotSize = sizeof(CapturedMsg) - }; - UT_SoftwareBusSnapshot_Entry_t ShortFmtSnapshotData = - { - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID), - .SnapshotBuffer = &CapturedMsg, - .SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID), - .SnapshotSize = sizeof(CapturedMsg) - }; - EVS_AppData_t *AppDataPtr; + CFE_EVS_PacketID_t CapturedMsg; + UT_SoftwareBusSnapshot_Entry_t LongFmtSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), + .SnapshotBuffer = &CapturedMsg, + .SnapshotOffset = + offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID), + .SnapshotSize = sizeof(CapturedMsg)}; + UT_SoftwareBusSnapshot_Entry_t ShortFmtSnapshotData = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID), + .SnapshotBuffer = &CapturedMsg, + .SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID), + .SnapshotSize = sizeof(CapturedMsg)}; + EVS_AppData_t * AppDataPtr; CFE_ES_AppId_t AppID; UT_EVS_MSGInitData_t MsgData; - CFE_MSG_Message_t *MsgSend; + CFE_MSG_Message_t * MsgSend; /* Get a local ref to the "current" AppData table entry */ EVS_GetCurrentContext(&AppDataPtr, &AppID); @@ -953,42 +713,31 @@ void Test_Format(void) /* Enable DEBUG message output */ UT_InitData(); - strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", - sizeof(appbitcmd.Payload.AppName) - 1); + strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; - modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; - appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | - CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable debug message output"); + modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; + appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable debug message output"); /* Test set event format mode command using an invalid mode */ UT_InitData(); modecmd.Payload.MsgFormat = 0xff; - UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), - UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLEGALFMTMOD_EID, - "CFE_EVS_SetEventFormatModeCmd", - "Set event format mode command: invalid event format mode = 0xff"); + UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLEGALFMTMOD_EID, + "CFE_EVS_SetEventFormatModeCmd", "Set event format mode command: invalid event format mode = 0xff"); /* Test set event format mode command using a valid command to set short * format, reports implicitly via event */ UT_InitData(); modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_SHORT; - UT_EVS_DoDispatchCheckEventsShort(&modecmd, sizeof(modecmd), - UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_SETEVTFMTMOD_EID, - "CFE_EVS_SetEventFormatModeCmd", + UT_EVS_DoDispatchCheckEventsShort(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_SETEVTFMTMOD_EID, "CFE_EVS_SetEventFormatModeCmd", "Set event format mode command: short format"); UtPrintf("Test for short event sent when configured to do so "); @@ -1011,12 +760,9 @@ void Test_Format(void) */ UT_InitData(); modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; - UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), - UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_SETEVTFMTMOD_EID, - "CFE_EVS_SetEventFormatModeCmd", + UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_SETEVTFMTMOD_EID, "CFE_EVS_SetEventFormatModeCmd", "Set event format mode command: long format"); /* Test event long format mode command was successful (the following @@ -1028,17 +774,12 @@ void Test_Format(void) CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Long format check (SendEvent)"); EventID[0] = CapturedMsg.EventID; memset(&CapturedMsg, 0xFF, sizeof(CapturedMsg)); - CFE_EVS_SendTimedEvent(time, 0, CFE_EVS_EventType_INFORMATION, - "Long format check (SendTimedEvent)"); + CFE_EVS_SendTimedEvent(time, 0, CFE_EVS_EventType_INFORMATION, "Long format check (SendTimedEvent)"); EventID[1] = CapturedMsg.EventID; memset(&CapturedMsg, 0xFF, sizeof(CapturedMsg)); - CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, - "Long format check (SendEventWithAppID)"); - UT_Report(__FILE__, __LINE__, - EventID[0] == 0 && EventID[1] == 0 && - CapturedMsg.EventID == 0, - "CFE_EVS_SetEventFormatModeCmd", - "Long event format mode verification"); + CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "Long format check (SendEventWithAppID)"); + UT_Report(__FILE__, __LINE__, EventID[0] == 0 && EventID[1] == 0 && CapturedMsg.EventID == 0, + "CFE_EVS_SetEventFormatModeCmd", "Long event format mode verification"); /* Test sending an event using a string length greater than * the maximum allowed @@ -1051,34 +792,22 @@ void Test_Format(void) } long_msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEvent(0, - CFE_EVS_EventType_INFORMATION, - "%s", long_msg) == CFE_SUCCESS, - "CFE_EVS_SendEvent", - "Sent info message with > maximum string length"); + UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "%s", long_msg) == CFE_SUCCESS, + "CFE_EVS_SendEvent", "Sent info message with > maximum string length"); /* Test sending an event with application ID using a string length * greater than the maximum allowed */ UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, - CFE_EVS_EventType_INFORMATION, - AppID, - "%s", long_msg) == CFE_SUCCESS, - "CFE_EVS_SendEventWithAppID", - "Sent info message with > maximum string length"); + CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "%s", long_msg) == CFE_SUCCESS, + "CFE_EVS_SendEventWithAppID", "Sent info message with > maximum string length"); /* Test sending a timed event using a string length greater than * the maximum allowed */ UT_Report(__FILE__, __LINE__, - CFE_EVS_SendTimedEvent(time, - 0, - CFE_EVS_EventType_INFORMATION, - "%s", long_msg) == CFE_SUCCESS, - "CFE_EVS_SendTimedEvent", - "Sent info message with > maximum string length"); + CFE_EVS_SendTimedEvent(time, 0, CFE_EVS_EventType_INFORMATION, "%s", long_msg) == CFE_SUCCESS, + "CFE_EVS_SendTimedEvent", "Sent info message with > maximum string length"); } /* @@ -1086,11 +815,8 @@ void Test_Format(void) */ void Test_Ports(void) { - CFE_EVS_BitMaskCmd_t bitmaskcmd; - UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = - { - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID) - }; + CFE_EVS_BitMaskCmd_t bitmaskcmd; + UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)}; UtPrintf("Begin Test Ports"); @@ -1098,122 +824,87 @@ void Test_Ports(void) /* Test enabling all ports; reports implicitly via port output */ UT_InitData(); - bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | - CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, - "CFE_EVS_EnablePortsCmd", + bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, "CFE_EVS_EnablePortsCmd", "Enable ports command received with port bit mask = 0x0f"); /* Test that ports are enabled by sending a message */ UT_InitData(); 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, - "CFE_EVS_EnablePortsCmd", - "Test ports output"); + UT_Report(__FILE__, __LINE__, LocalSnapshotData.Count == 1, "CFE_EVS_EnablePortsCmd", "Test ports output"); /* Disable all ports to cut down on unneeded output */ UT_InitData(); - bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | - CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, - "CFE_EVS_DisablePortsCmd", + bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", "Disable ports command received with port bit mask = 0x0f"); /* Test enabling a port using a bitmask that is out of range (high) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0xff; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_EnablePortsCmd", "Bit mask out of range (high)"); /* Test disabling a port using a bitmask that is out of range */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_DisablePortsCmd", "Bit mask = 0x000000ff out of range: CC = 12"); /* Test enabling a port using a bitmask that is out of range (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_EnablePortsCmd", "Bit mask out of range (low)"); /* Test enabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, - "CFE_EVS_EnablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, "CFE_EVS_EnablePortsCmd", "Enable ports 1 and 2; disable ports 3 and 4"); /* Test enabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, - "CFE_EVS_EnablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, "CFE_EVS_EnablePortsCmd", "Enable ports 3 and 4; disable ports 1 and 2"); /* Test disabling a port using a bitmask that is out of range (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_DisablePortsCmd", "Bit mask out of range (low)"); /* Test disabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, - "CFE_EVS_DisablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", "Enable ports 1 and 2; disable ports 3 and 4"); /* Test disabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, - "CFE_EVS_DisablePortsCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", "Enable ports 3 and 4; disable ports 1 and 2"); } @@ -1222,17 +913,17 @@ void Test_Ports(void) */ void Test_Logging(void) { - int i; - uint32 resetAreaSize = 0; - char tmpString[100]; + int i; + uint32 resetAreaSize = 0; + char tmpString[100]; union { 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; + cpuaddr TempAddr; + CFE_ES_ResetData_t *CFE_EVS_ResetDataPtr; UtPrintf("Begin Test Logging"); @@ -1248,29 +939,23 @@ void Test_Logging(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_PSP_GetResetArea(&TempAddr, &resetAreaSize); - CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)TempAddr; + CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)TempAddr; CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; /* Test setting the logging mode using an invalid mode */ UT_InitData(); CmdBuf.modecmd.Payload.LogMode = 0xff; - UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), - UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_LOGMODE_EID, - "CFE_EVS_SetLogModeCmd", + UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_LOGMODE_EID, "CFE_EVS_SetLogModeCmd", "Set log mode to an invalid mode"); /* Test setting the logging mode to discard */ UT_InitData(); CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_DISCARD; - UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), - UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LOGMODE_EID, - "CFE_EVS_SetLogModeCmd", + UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LOGMODE_EID, "CFE_EVS_SetLogModeCmd", "Set log mode to discard mode"); /* Test overfilling the log in discard mode */ @@ -1288,44 +973,32 @@ void Test_Logging(void) CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Log overfill event discard"); UT_Report(__FILE__, __LINE__, CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true && - CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_DISCARD, - "CFE_EVS_SendEvent", - "Log overfill event (discard mode)"); + CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_DISCARD, + "CFE_EVS_SendEvent", "Log overfill event (discard mode)"); /* Test setting the logging mode to overwrite */ UT_InitData(); CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_OVERWRITE; - UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), - UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, - &UT_EVS_EventBuf); + UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, + &UT_EVS_EventBuf); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Log overfill event overwrite"); UT_Report(__FILE__, __LINE__, CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true && - CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_OVERWRITE, - "CFE_EVS_SetLogModeCmd", - "Log overfill event (overwrite mode)"); + CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_OVERWRITE, + "CFE_EVS_SetLogModeCmd", "Log overfill event (overwrite mode)"); /* Test sending a no op command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), - UT_TPID_CFE_EVS_CMD_NOOP_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_NOOP_EID, - "CFE_EVS_ProcessGroundCommand", + UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_NOOP_EID, "CFE_EVS_ProcessGroundCommand", "No-op command"); /* Clear log for next test */ UT_InitData(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; - UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), - UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Global.EVS_LogPtr->LogFullFlag == false, - "EVS_ClearLog", - "Clear log"); + UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, CFE_EVS_Global.EVS_LogPtr->LogFullFlag == false, "EVS_ClearLog", "Clear log"); /* Test setting the logging mode to overwrite */ UT_InitData(); @@ -1334,12 +1007,10 @@ void Test_Logging(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_PSP_GetResetArea(&TempAddr, &resetAreaSize); - CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)TempAddr; - CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; + CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)TempAddr; + CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_OVERWRITE; - UT_Report(__FILE__, __LINE__, - CFE_EVS_SetLogModeCmd(&CmdBuf.modecmd) == CFE_SUCCESS, - "CFE_EVS_SetLogModeCmd", + UT_Report(__FILE__, __LINE__, CFE_EVS_SetLogModeCmd(&CmdBuf.modecmd) == CFE_SUCCESS, "CFE_EVS_SetLogModeCmd", "Set log mode to overwrite mode"); /* Test successfully writing a single event log entry using the default @@ -1349,51 +1020,40 @@ void Test_Logging(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", - "Write single event log entry - successful (default log name)"); + UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, + "CFE_EVS_WriteLogDataFileCmd", "Write single event log entry - successful (default log name)"); /* Test writing a log entry with a create failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", - "OS create fail"); + UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, + "CFE_EVS_WriteLogDataFileCmd", "OS create fail"); /* Test successfully writing all log entries */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; - UT_Report(__FILE__, __LINE__, - CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", - "Write all event log entries"); + UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, + "CFE_EVS_WriteLogDataFileCmd", "Write all event log entries"); /* Test writing a log entry with a write failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; - UT_Report(__FILE__, __LINE__, - CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", - "OS write fail"); + UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, + "CFE_EVS_WriteLogDataFileCmd", "OS write fail"); /* Test successfully writing a single event log entry using a specified * log name */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); - strncpy(CmdBuf.logfilecmd.Payload.LogFilename, "LogFile", - sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1); + strncpy(CmdBuf.logfilecmd.Payload.LogFilename, "LogFile", sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1); CmdBuf.logfilecmd.Payload.LogFilename[sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", - "Write single event log entry - successful (log name specified)"); + UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, + "CFE_EVS_WriteLogDataFileCmd", "Write single event log entry - successful (log name specified)"); /* Test successfully writing a single event log entry with a failure * writing the header @@ -1401,10 +1061,8 @@ void Test_Logging(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", - "Write single event log entry - write header failed"); + UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, + "CFE_EVS_WriteLogDataFileCmd", "Write single event log entry - write header failed"); } /* @@ -1414,9 +1072,9 @@ void Test_WriteApp(void) { union { - CFE_EVS_NoArgsCmd_t cmd; - CFE_EVS_WriteAppDataFileCmd_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"); @@ -1426,27 +1084,20 @@ void Test_WriteApp(void) /* Enable DEBUG message output */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - strncpy(CmdBuf.appbitcmd.Payload.AppName, "ut_cfe_evs", - sizeof(CmdBuf.appbitcmd.Payload.AppName) - 1); + strncpy(CmdBuf.appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(CmdBuf.appbitcmd.Payload.AppName) - 1); CmdBuf.appbitcmd.Payload.AppName[sizeof(CmdBuf.appbitcmd.Payload.AppName) - 1] = '\0'; - CmdBuf.appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | - CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; + CmdBuf.appbitcmd.Payload.BitMask = + CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&CmdBuf.appbitcmd, sizeof(CmdBuf.appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable debug message output"); + UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable debug message output"); /* Test resetting counters */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), - UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_RSTCNT_EID, - "CFE_EVS_ResetCountersCmd", + UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTCNT_EID, "CFE_EVS_ResetCountersCmd", "Reset counters - successful"); /* Test writing application data with a create failure using default @@ -1458,11 +1109,8 @@ void Test_WriteApp(void) CmdBuf.AppDataCmd.Payload.AppDataFilename[sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1] = '\0'; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), - UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CRDATFILE_EID, - "CFE_EVS_WriteAppDataFileCmd", + UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CRDATFILE_EID, "CFE_EVS_WriteAppDataFileCmd", "OS create fail (default file name)"); /* Test writing application data with a write/close failure */ @@ -1470,21 +1118,15 @@ void Test_WriteApp(void) UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), - UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_WRDATFILE_EID, - "CFE_EVS_WriteAppDataFileCmd", + UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_WRDATFILE_EID, "CFE_EVS_WriteAppDataFileCmd", "OS write fail"); /* Test successfully writing application data */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), - UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_WRDAT_EID, - "CFE_EVS_WriteAppDataFileCmd", + UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_WRDAT_EID, "CFE_EVS_WriteAppDataFileCmd", "Write application data - successful"); /* Test writing application data with a create failure using specified @@ -1496,21 +1138,16 @@ void Test_WriteApp(void) CmdBuf.AppDataCmd.Payload.AppDataFilename[sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1] = '\0'; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), - UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CRDATFILE_EID, - "CFE_EVS_WriteAppDataFileCmd", + UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CRDATFILE_EID, "CFE_EVS_WriteAppDataFileCmd", "OS create fail (specified file name)"); /* Test writing application data with a failure writing the header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[0] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_EVS_WriteAppDataFileCmd(&CmdBuf.AppDataCmd) != CFE_SUCCESS, - "CFE_EVS_WriteAppDataFileCmd", - "Write application data - write header failed"); + UT_Report(__FILE__, __LINE__, CFE_EVS_WriteAppDataFileCmd(&CmdBuf.AppDataCmd) != CFE_SUCCESS, + "CFE_EVS_WriteAppDataFileCmd", "Write application data - write header failed"); } /* @@ -1522,7 +1159,7 @@ void Test_BadAppCmd(void) CFE_EVS_AppNameCmd_t appnamecmd; CFE_EVS_AppNameEventIDMaskCmd_t appmaskcmd; CFE_EVS_AppNameEventIDCmd_t appcmdcmd; - uint32 TestAppIndex; + uint32 TestAppIndex; UtPrintf("Begin Test Bad App Command"); @@ -1531,65 +1168,49 @@ void Test_BadAppCmd(void) UT_InitData(); /* Set up event and mask */ - appbitcmd.Payload.BitMask = 0; - appmaskcmd.Payload.Mask = 0; + appbitcmd.Payload.BitMask = 0; + appmaskcmd.Payload.Mask = 0; appmaskcmd.Payload.EventID = 0; - appcmdcmd.Payload.EventID = 0; + appcmdcmd.Payload.EventID = 0; - strncpy(appbitcmd.Payload.AppName, "unknown_name", - sizeof(appbitcmd.Payload.AppName) - 1); + strncpy(appbitcmd.Payload.AppName, "unknown_name", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; - strncpy(appnamecmd.Payload.AppName, "unknown_name", - sizeof(appnamecmd.Payload.AppName) - 1); + strncpy(appnamecmd.Payload.AppName, "unknown_name", sizeof(appnamecmd.Payload.AppName) - 1); appnamecmd.Payload.AppName[sizeof(appnamecmd.Payload.AppName) - 1] = '\0'; - strncpy(appmaskcmd.Payload.AppName, "unknown_name", - sizeof(appmaskcmd.Payload.AppName) - 1); + strncpy(appmaskcmd.Payload.AppName, "unknown_name", sizeof(appmaskcmd.Payload.AppName) - 1); appmaskcmd.Payload.AppName[sizeof(appmaskcmd.Payload.AppName) - 1] = '\0'; - strncpy(appcmdcmd.Payload.AppName, "unknown_name", - sizeof(appcmdcmd.Payload.AppName) - 1); + strncpy(appcmdcmd.Payload.AppName, "unknown_name", sizeof(appcmdcmd.Payload.AppName) - 1); appcmdcmd.Payload.AppName[sizeof(appcmdcmd.Payload.AppName) - 1] = '\0'; /* Test disabling application event types with an unknown application ID */ UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_DisableAppEventTypesCmd", - "Unable to retrieve application ID while disabling event types"); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, + "CFE_EVS_DisableAppEventTypesCmd", "Unable to retrieve application ID while disabling event types"); /* Test enabling application event types with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Unable to retrieve application ID while enabling event types"); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Unable to retrieve application ID while enabling event types"); /* Test disabling application events with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_DisableAppEventsCmd", - "Unable to retrieve application ID while disabling events"); + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, + "CFE_EVS_DisableAppEventsCmd", "Unable to retrieve application ID while disabling events"); /* Test enabling application events with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_EnableAppEventsCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_EnableAppEventsCmd", "Unable to retrieve application ID while enabling events"); /* Test resetting the application event counter with an unknown @@ -1597,85 +1218,62 @@ void Test_BadAppCmd(void) */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_ResetAppEventCounterCmd", - "Unable to retrieve application ID while resetting events"); + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, + "CFE_EVS_ResetAppEventCounterCmd", "Unable to retrieve application ID while resetting events"); /* Test modifying event filters with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_AddEventFilterCmd", "Unable to retrieve application ID while modifying event " - "filters"); + "filters"); /* Test deleting event filters with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_DeleteEventFilterCmd", "Unable to retrieve application ID while deleting event " - "filters"); + "filters"); /* Test setting the event filter mask with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_SetFilterMaskCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_SetFilterMaskCmd", "Unable to retrieve application ID while setting the event " - "filter mask"); + "filter mask"); /* Test resetting the filter with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_ResetFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_ResetFilterCmd", "Unable to retrieve application ID while resetting the filter"); /* Test resetting all filters with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_ResetAllFiltersCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_ResetAllFiltersCmd", "Unable to retrieve application ID while resetting all filters"); /* Test disabling application event types with an illegal application ID */ UT_InitData(); - strncpy(appbitcmd.Payload.AppName, "illegal_id", - sizeof(appbitcmd.Payload.AppName) - 1); + strncpy(appbitcmd.Payload.AppName, "illegal_id", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; - strncpy(appnamecmd.Payload.AppName, "illegal_id", - sizeof(appnamecmd.Payload.AppName) - 1); + strncpy(appnamecmd.Payload.AppName, "illegal_id", sizeof(appnamecmd.Payload.AppName) - 1); appnamecmd.Payload.AppName[sizeof(appnamecmd.Payload.AppName) - 1] = '\0'; - strncpy(appmaskcmd.Payload.AppName, "illegal_id", - sizeof(appmaskcmd.Payload.AppName) - 1); + strncpy(appmaskcmd.Payload.AppName, "illegal_id", sizeof(appmaskcmd.Payload.AppName) - 1); appmaskcmd.Payload.AppName[sizeof(appmaskcmd.Payload.AppName) - 1] = '\0'; - strncpy(appcmdcmd.Payload.AppName, "illegal_id", - sizeof(appcmdcmd.Payload.AppName) - 1); + strncpy(appcmdcmd.Payload.AppName, "illegal_id", sizeof(appcmdcmd.Payload.AppName) - 1); appcmdcmd.Payload.AppName[sizeof(appcmdcmd.Payload.AppName) - 1] = '\0'; /* @@ -1683,116 +1281,86 @@ void Test_BadAppCmd(void) * but still allow the EVS AppID to send an event successfully (second call). */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_DisableAppEventTypesCmd", "Illegal application ID while disabling application event " - "types"); + "types"); /* Test enabling application event types with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Illegal application ID while enabling application event types"); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Illegal application ID while enabling application event types"); /* Test disabling application events with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_DisableAppEventsCmd", - "Illegal application ID while disabling application events"); + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, + "CFE_EVS_DisableAppEventsCmd", "Illegal application ID while disabling application events"); /* Test enabling application events with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_EnableAppEventsCmd", - "Illegal application ID while enabling application events"); + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, + "CFE_EVS_EnableAppEventsCmd", "Illegal application ID while enabling application events"); /* Test resetting the application event counter with an illegal * application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_ResetAppEventCounterCmd", "Illegal application ID while resetting the application event " - "counter"); + "counter"); /* Test adding the event filter with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_AddEventFilterCmd", "Illegal application ID while adding the event filter"); /* Test deleting the event filter with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_DeleteEventFilterCmd", - "Illegal application ID while deleting the event filter"); + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, + "CFE_EVS_DeleteEventFilterCmd", "Illegal application ID while deleting the event filter"); /* Test setting the filter mask with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_SetFilterMaskCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_SetFilterMaskCmd", "Illegal application ID while setting the filter mask"); /* Test resetting the filter with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_ResetFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_ResetFilterCmd", "Illegal application ID while resetting the filter"); /* Test resetting all filters with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_ResetAllFiltersCmd", - "Illegal application ID while resetting all filters"); + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, + "CFE_EVS_ResetAllFiltersCmd", "Illegal application ID while resetting all filters"); /* Test disabling application event types with an unregistered * application ID @@ -1800,61 +1368,47 @@ void Test_BadAppCmd(void) UT_InitData(); TestAppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - strncpy(appbitcmd.Payload.AppName, "unregistered_app", - sizeof(appbitcmd.Payload.AppName) - 1); + strncpy(appbitcmd.Payload.AppName, "unregistered_app", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; - strncpy(appnamecmd.Payload.AppName, "unregistered_app", - sizeof(appnamecmd.Payload.AppName) - 1); + strncpy(appnamecmd.Payload.AppName, "unregistered_app", sizeof(appnamecmd.Payload.AppName) - 1); appnamecmd.Payload.AppName[sizeof(appnamecmd.Payload.AppName) - 1] = '\0'; - strncpy(appmaskcmd.Payload.AppName, "unregistered_app", - sizeof(appmaskcmd.Payload.AppName) - 1); + strncpy(appmaskcmd.Payload.AppName, "unregistered_app", sizeof(appmaskcmd.Payload.AppName) - 1); appmaskcmd.Payload.AppName[sizeof(appmaskcmd.Payload.AppName) - 1] = '\0'; - strncpy(appcmdcmd.Payload.AppName, "unregistered_app", - sizeof(appcmdcmd.Payload.AppName) - 1); + strncpy(appcmdcmd.Payload.AppName, "unregistered_app", sizeof(appcmdcmd.Payload.AppName) - 1); appcmdcmd.Payload.AppName[sizeof(appcmdcmd.Payload.AppName) - 1] = '\0'; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_DisableAppEventTypesCmd", "Application not registered while disabling application event " - "types"); + "types"); /* Test enabling application event types with an unregistered * application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_EnableAppEventTypesCmd", "Application not registered while enabling application event " - "types"); + "types"); /* Test disabling application events with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_DisableAppEventsCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_DisableAppEventsCmd", "Application not registered while disabling application events"); /* Test enabling application events with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_EnableAppEventsCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_EnableAppEventsCmd", "Application not registered while enabling application events"); /* Test resetting the application event counter with an unregistered @@ -1862,68 +1416,49 @@ void Test_BadAppCmd(void) */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_ResetAppEventCounterCmd", "Application not registered while resetting the application " - "event counter"); + "event counter"); /* Test adding the event filter with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_AddEventFilterCmd", "Application not registered while adding the event filter"); /* Test deleting the event filter with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_DeleteEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_DeleteEventFilterCmd", "Application not registered while deleting the event filter"); /* Test setting the filter mask with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_SetFilterMaskCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_SetFilterMaskCmd", "Application not registered while setting the filter mask"); /* Test resetting the filter with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_ResetFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_ResetFilterCmd", "Application not registered while resetting the filter"); /* Test resetting all filters with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_ResetAllFiltersCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_ResetAllFiltersCmd", "Application not registered while resetting all filters"); } @@ -1932,14 +1467,11 @@ void Test_BadAppCmd(void) */ void Test_EventCmd(void) { - uint16 EventCount[4]; - CFE_EVS_BitMaskCmd_t bitmaskcmd; - CFE_EVS_AppNameBitMaskCmd_t appbitcmd; - CFE_EVS_AppNameCmd_t appnamecmd; - UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = - { - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID) - }; + uint16 EventCount[4]; + CFE_EVS_BitMaskCmd_t bitmaskcmd; + CFE_EVS_AppNameBitMaskCmd_t appbitcmd; + CFE_EVS_AppNameCmd_t appnamecmd; + UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)}; UtPrintf("Begin Test Event Command"); @@ -1948,19 +1480,15 @@ void Test_EventCmd(void) UT_InitData(); /* Run the next series of tests with valid, registered application name */ - strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", - sizeof(appbitcmd.Payload.AppName) - 1); + strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; - strncpy(appnamecmd.Payload.AppName, "ut_cfe_evs", - sizeof(appnamecmd.Payload.AppName) - 1); + strncpy(appnamecmd.Payload.AppName, "ut_cfe_evs", sizeof(appnamecmd.Payload.AppName) - 1); appnamecmd.Payload.AppName[sizeof(appnamecmd.Payload.AppName) - 1] = '\0'; /* Test disabling of all events */ - appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | - CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); + appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); LocalSnapshotData.Count = 0; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); @@ -1973,18 +1501,15 @@ void Test_EventCmd(void) CFE_EVS_SendEvent(0, CFE_EVS_EventType_CRITICAL, "FAIL : Critical message disabled"); EventCount[3] = LocalSnapshotData.Count; UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == 0xFFFF && - EventCount[0] == 0 && EventCount[1] == 0 && - EventCount[2] == 0 && EventCount[3] == 0, - "CFE_EVS_SendEvent", - "Disable all events"); + UT_EVS_EventBuf.EventID == 0xFFFF && EventCount[0] == 0 && EventCount[1] == 0 && EventCount[2] == 0 && + EventCount[3] == 0, + "CFE_EVS_SendEvent", "Disable all events"); /* Test enabling of all events */ UT_InitData(); LocalSnapshotData.Count = 0; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); + 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_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_DEBUG, "Debug message enabled"); EventCount[0] = LocalSnapshotData.Count; @@ -1995,182 +1520,135 @@ void Test_EventCmd(void) CFE_EVS_SendEvent(0, CFE_EVS_EventType_CRITICAL, "Critical message enabled"); EventCount[3] = LocalSnapshotData.Count; UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID && - EventCount[0] == 1 && EventCount[1] == 2 && - EventCount[2] == 3 && EventCount[3] == 4, - "CFE_EVS_SendEvent", - "Enable all event types"); + UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID && EventCount[0] == 1 && EventCount[1] == 2 && + EventCount[2] == 3 && EventCount[3] == 4, + "CFE_EVS_SendEvent", "Enable all event types"); /* Test disabling event type using an illegal type */ UT_InitData(); appbitcmd.Payload.BitMask = 0xff; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); CFE_EVS_SendEvent(0, 0xffff, "FAIL : Illegal type disabled"); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableAppEventTypesCmd", - "Disable events using an illegal event type"); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_DisableAppEventTypesCmd", "Disable events using an illegal event type"); /* Test enabling event type using an illegal type */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable events using an illegal event type"); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable events using an illegal event type"); /* Test successful disabling of application events */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == 0xFFFF, - "CFE_EVS_DisableAppEventsCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == 0xFFFF, "CFE_EVS_DisableAppEventsCmd", "Disable application events - successful"); /* Test successful enabling of application events */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVT_EID, - "CFE_EVS_EnableAppEventsCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVT_EID, "CFE_EVS_EnableAppEventsCmd", "Enable application events - successful"); /* Test disabling event types (leave debug enabled) */ UT_InitData(); - bitmaskcmd.Payload.BitMask = CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | - CFE_EVS_CRITICAL_BIT; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_DISEVTTYPE_EID, - "CFE_EVS_DisableEventTypesCmd", + bitmaskcmd.Payload.BitMask = CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISEVTTYPE_EID, "CFE_EVS_DisableEventTypesCmd", "Disable event types except debug"); /* Test enabling all event types (debug already enabled) */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAEVTTYPE_EID, - "CFE_EVS_EnableEventTypesCmd", + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAEVTTYPE_EID, "CFE_EVS_EnableEventTypesCmd", "Enable all event types"); /* Test successfully resetting the application event counter */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_RSTEVTCNT_EID, - "CFE_EVS_ResetAppEventCounterCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTEVTCNT_EID, "CFE_EVS_ResetAppEventCounterCmd", "Reset event application counter - successful"); /* Test disabling an event type using an out of range bit mask (high) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0xff; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableEventTypesCmd", - "Disable event types - bit mask out of range (high)"); + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_DisableEventTypesCmd", "Disable event types - bit mask out of range (high)"); /* Test enabling an event type using an out of range bit mask (high) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0xff; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableEventTypesCmd", - "Enable event types - bit mask out of range (high)"); + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_EnableEventTypesCmd", "Enable event types - bit mask out of range (high)"); /* Test disabling an application event type using an out of * range bit mask (high) */ UT_InitData(); appbitcmd.Payload.BitMask = 0xff; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_DisableAppEventTypesCmd", "Disable application event types - bit mask out of range " - "(high)"); + "(high)"); /* Test enabling an application event type using an out of * range bit mask (high) */ UT_InitData(); appbitcmd.Payload.BitMask = 0xff; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable application event types - bit mask out of range (high)"); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable application event types - bit mask out of range (high)"); /* Test disabling an event type using an out of range bit mask (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableEventTypesCmd", - "Disable event types - bit mask out of range (low)"); + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_DisableEventTypesCmd", "Disable event types - bit mask out of range (low)"); /* Test enabling an event type using an out of range bit mask (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; - UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableEventTypesCmd", - "Enable event types - bit mask out of range (low)"); + UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_EnableEventTypesCmd", "Enable event types - bit mask out of range (low)"); /* Test disabling an application event type using an out of * range bit mask (low) */ UT_InitData(); appbitcmd.Payload.BitMask = 0x0; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableAppEventTypesCmd", - "Disable application event types - bit mask out of range (low)"); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_DisableAppEventTypesCmd", "Disable application event types - bit mask out of range (low)"); /* Test enabling an application event type using an out of * range bit mask (low) */ UT_InitData(); appbitcmd.Payload.BitMask = 0x0; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable application event types - bit mask out of range (low)"); + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable application event types - bit mask out of range (low)"); } /* @@ -2191,140 +1669,97 @@ void Test_FilterCmd(void) UT_InitData(); /* Set up event and mask */ - appmaskcmd.Payload.Mask = 0; + appmaskcmd.Payload.Mask = 0; appmaskcmd.Payload.EventID = 0; - appcmdcmd.Payload.EventID = 0; + appcmdcmd.Payload.EventID = 0; /* Run the next series of tests with valid, registered application name */ - strncpy(appnamecmd.Payload.AppName, "ut_cfe_evs", - sizeof(appnamecmd.Payload.AppName) - 1); + strncpy(appnamecmd.Payload.AppName, "ut_cfe_evs", sizeof(appnamecmd.Payload.AppName) - 1); appnamecmd.Payload.AppName[sizeof(appnamecmd.Payload.AppName) - 1] = '\0'; - strncpy(appmaskcmd.Payload.AppName, "ut_cfe_evs", - sizeof(appmaskcmd.Payload.AppName) - 1); + strncpy(appmaskcmd.Payload.AppName, "ut_cfe_evs", sizeof(appmaskcmd.Payload.AppName) - 1); appmaskcmd.Payload.AppName[sizeof(appmaskcmd.Payload.AppName) - 1] = '\0'; - strncpy(appcmdcmd.Payload.AppName, "ut_cfe_evs", - sizeof(appcmdcmd.Payload.AppName) - 1); + strncpy(appcmdcmd.Payload.AppName, "ut_cfe_evs", sizeof(appcmdcmd.Payload.AppName) - 1); appcmdcmd.Payload.AppName[sizeof(appcmdcmd.Payload.AppName) - 1] = '\0'; - strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", - sizeof(appbitcmd.Payload.AppName) - 1); + strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; /* Enable all application event message output */ - appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | - CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable all application event types - successful"); + appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable all application event types - successful"); /* Ensure there is no filter for the next tests */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, - "CFE_EVS_DeleteEventFilterCmd", - "Delete event filter - successful"); + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, + "CFE_EVS_DeleteEventFilterCmd", "Delete event filter - successful"); /* Test setting a filter with an application that is not registered * for filtering */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, - "CFE_EVS_SetFilterMaskCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, "CFE_EVS_SetFilterMaskCmd", "Set filter - application is not registered for filtering"); /* Test resetting a filter with an application that is not registered * for filtering */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, - "CFE_EVS_ResetFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, "CFE_EVS_ResetFilterCmd", "Reset filter - application is not registered for filtering"); - /* Test resetting all filters */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_RSTALLFILTER_EID, - "CFE_EVS_ResetAllFiltersCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTALLFILTER_EID, "CFE_EVS_ResetAllFiltersCmd", "Reset all filters - successful"); /* Test successfully adding an event filter */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID, "CFE_EVS_AddEventFilterCmd", "Add event filter - successful"); /* Test adding an event filter to an event already registered * for filtering */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_EVT_FILTERED_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_EVT_FILTERED_EID, "CFE_EVS_AddEventFilterCmd", "Add event filter - event already registered for filtering"); /* Test successfully setting a filter mask */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_SETFILTERMSK_EID, - "CFE_EVS_SetFilterMaskCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_SETFILTERMSK_EID, "CFE_EVS_SetFilterMaskCmd", "Set filter mask - successful"); /* Test successfully resetting a filter mask */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_RSTFILTER_EID, - "CFE_EVS_ResetFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTFILTER_EID, "CFE_EVS_ResetFilterCmd", "Reset filter mask - successful"); /* Test successfully resetting all filters */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), - UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_RSTALLFILTER_EID, - "CFE_EVS_ResetAllFiltersCmd", + UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTALLFILTER_EID, "CFE_EVS_ResetAllFiltersCmd", "Reset all filters - successful"); /* Test successfully deleting an event filter */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_DELFILTER_EID, - "CFE_EVS_DeleteEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DELFILTER_EID, "CFE_EVS_DeleteEventFilterCmd", "Delete event filter - successful"); /* Test filling the event filters */ @@ -2333,84 +1768,62 @@ void Test_FilterCmd(void) for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) { - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); appmaskcmd.Payload.EventID++; } UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID && - UT_EVS_EventBuf.Count == CFE_PLATFORM_EVS_MAX_EVENT_FILTERS, - "CFE_EVS_AddEventFilterCmd", - "Maximum event filters added"); + UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID && + UT_EVS_EventBuf.Count == CFE_PLATFORM_EVS_MAX_EVENT_FILTERS, + "CFE_EVS_AddEventFilterCmd", "Maximum event filters added"); /* Test overfilling the event filters */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_MAXREGSFILTER_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_MAXREGSFILTER_EID, "CFE_EVS_AddEventFilterCmd", "Maximum event filters exceeded"); /* Return application to original state, re-register application */ UT_InitData(); appmaskcmd.Payload.EventID = 0; - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Register application - successful"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Register application - successful"); /* Enable all application event message output */ UT_InitData(); - appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | - CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; - UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Enable all application event message output"); + appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; + UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, + "CFE_EVS_EnableAppEventTypesCmd", "Enable all application event message output"); /* Set-up to test filtering the same event twice */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID, "CFE_EVS_AddEventFilterCmd", "Add event filter - successful"); /* Test filtering the same event again */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_EVT_FILTERED_EID, - "CFE_EVS_AddEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_EVT_FILTERED_EID, "CFE_EVS_AddEventFilterCmd", "Add event filter - event is already registered for filtering"); /* Test successful event filer deletion */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), - UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_DELFILTER_EID, - "CFE_EVS_DeleteEventFilterCmd", + UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, + &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DELFILTER_EID, "CFE_EVS_DeleteEventFilterCmd", "Delete filter - successful"); /* Return application to original state, re-register application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", - "Register application - successful"); + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, + "CFE_EVS_Register", "Register application - successful"); } /* @@ -2424,239 +1837,147 @@ void Test_InvalidCmd(void) /* Test invalid msg id event */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), - UT_TPID_CFE_EVS_INVALID_MID, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_MSGID_EID, - "CFE_EVS_ProcessGroundCommand", + UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_INVALID_MID, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_MSGID_EID, "CFE_EVS_ProcessGroundCommand", "Invalid command packet"); /* Test invalid command code event */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), - UT_TPID_CFE_EVS_CMD_INVALID_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CC_EID, - "CFE_EVS_ProcessGroundCommand", + UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_CMD_INVALID_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CC_EID, "CFE_EVS_ProcessGroundCommand", "Invalid command"); /* Test invalid command length event */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_NOOP_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with no op command"); /* Test invalid command length with reset counters command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with reset counters command"); /* Test invalid command length with enable event type command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with enable event type command"); /* Test invalid command length with disable event type command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with disable event type command"); /* Test invalid command length with set event format mode command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with set event format mode command"); /* Test invalid command length with enable application event * type command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with enable application event type " - "command"); + "command"); /* Test invalid command length with disable application event * type command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with disable application event type " - "command"); + "command"); /* Test invalid command length with enable application events command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with enable application events command"); /* Test invalid command length with disable application events command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with disable application events command"); /* Test invalid command length with reset application counter command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with reset application counter command"); /* Test invalid command length with set filter command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with set filter command"); /* Test invalid command length with enable ports command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with enable ports command"); /* Test invalid command length with disable ports command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with disable ports command"); /* Test invalid command length with reset filter command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with reset filter command"); /* Test invalid command length with reset all filters command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with reset all filters command"); /* Test invalid command length with add event filter command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with add event filter command"); /* Test invalid command length with delete event filter command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with delete event filter command"); /* Test invalid command length with write application data command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with write application data command"); /* Test invalid command length with write log data command */ UT_InitData(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with write log data command"); /* Test invalid command length with set log mode command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with set log mode command"); /* Test invalid command length with clear log command */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&cmd, 0, - UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, - "CFE_EVS_VerifyCmdLength", + UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", "Invalid command length with clear log command"); } @@ -2667,102 +1988,80 @@ void Test_Misc(void) { union { - CFE_MSG_Message_t msg; - CFE_EVS_NoArgsCmd_t cmd; - CFE_EVS_SetLogModeCmd_t modecmd; + CFE_MSG_Message_t msg; + CFE_EVS_NoArgsCmd_t cmd; + CFE_EVS_SetLogModeCmd_t modecmd; CFE_EVS_WriteLogDataFileCmd_t writelogdatacmd; } PktBuf; - CFE_ES_AppId_t AppID; - EVS_AppData_t *AppDataPtr; - int i; - char msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + 2]; - UT_SoftwareBusSnapshot_Entry_t HK_SnapshotData = - { - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_HK_TLM_MID) - }; + CFE_ES_AppId_t AppID; + EVS_AppData_t * AppDataPtr; + int i; + char msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + 2]; + UT_SoftwareBusSnapshot_Entry_t HK_SnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_HK_TLM_MID)}; EVS_GetCurrentContext(&AppDataPtr, &AppID); UtPrintf("Begin Test Miscellaneous"); memset(&PktBuf, 0, sizeof(PktBuf)); - CFE_EVS_Global.EVS_AppID = AppID; + CFE_EVS_Global.EVS_AppID = AppID; CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Test successful log data file write */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&PktBuf.writelogdatacmd, sizeof(PktBuf.writelogdatacmd), - UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, - &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - (UT_EVS_EventBuf.EventID == 0xFFFF) || (UT_EVS_EventBuf.EventID == CFE_EVS_WRLOG_EID), - "CFE_EVS_WriteLogDataFileCmd", - "Write log data - successful"); + UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); + UT_Report(__FILE__, __LINE__, (UT_EVS_EventBuf.EventID == 0xFFFF) || (UT_EVS_EventBuf.EventID == CFE_EVS_WRLOG_EID), + "CFE_EVS_WriteLogDataFileCmd", "Write log data - successful"); /* Test successfully setting the logging mode */ UT_InitData(); - UT_EVS_DoDispatchCheckEvents(&PktBuf.modecmd, sizeof(PktBuf.modecmd), - UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, - &UT_EVS_EventBuf); + UT_EVS_DoDispatchCheckEvents(&PktBuf.modecmd, sizeof(PktBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, + &UT_EVS_EventBuf); UT_Report(__FILE__, __LINE__, (UT_EVS_EventBuf.EventID == 0xFFFF) || (UT_EVS_EventBuf.EventID == CFE_EVS_LOGMODE_EID), - "CFE_EVS_SetLogModeCmd", - "Set logging mode - successful"); + "CFE_EVS_SetLogModeCmd", "Set logging mode - successful"); /* Test housekeeping report with log enabled */ UT_InitData(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; - HK_SnapshotData.Count = 0; + HK_SnapshotData.Count = 0; 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__, - HK_SnapshotData.Count == 1, - "CFE_EVS_ReportHousekeepingCmd", + UT_CallTaskPipe(CFE_EVS_ProcessCommandPacket, &PktBuf.msg, sizeof(PktBuf.cmd), UT_TPID_CFE_EVS_SEND_HK); + UT_Report(__FILE__, __LINE__, HK_SnapshotData.Count == 1, "CFE_EVS_ReportHousekeepingCmd", "Housekeeping report - successful (log enabled)"); /* Test successful application cleanup */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED) == CFE_SUCCESS, - "CFE_EVS_CleanUpApp", + UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED) == CFE_SUCCESS, "CFE_EVS_CleanUpApp", "Application cleanup - successful"); /* Test registering an application with invalid filter argument */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(NULL, 1, 0) == CFE_ES_ERR_BUFFER, - "CFE_EVS_Register", + UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 1, 0) == CFE_ES_ERR_BUFFER, "CFE_EVS_Register", "Register application with invalid arguments"); /* Test housekeeping report with log disabled */ UT_InitData(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = false; - HK_SnapshotData.Count = 0; + HK_SnapshotData.Count = 0; 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__, - HK_SnapshotData.Count == 1, - "CFE_EVS_ReportHousekeepingCmd", + UT_CallTaskPipe(CFE_EVS_ProcessCommandPacket, &PktBuf.msg, sizeof(PktBuf.cmd), UT_TPID_CFE_EVS_SEND_HK); + UT_Report(__FILE__, __LINE__, HK_SnapshotData.Count == 1, "CFE_EVS_ReportHousekeepingCmd", "Housekeeping report - successful (log disabled)"); /* Test sending a packet with the message counter and the event counter * at their maximum allowed values */ UT_InitData(); - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = - CFE_EVS_MAX_EVENT_SEND_COUNT; - AppDataPtr->EventCount = CFE_EVS_MAX_EVENT_SEND_COUNT; + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = CFE_EVS_MAX_EVENT_SEND_COUNT; + AppDataPtr->EventCount = CFE_EVS_MAX_EVENT_SEND_COUNT; EVS_SendEvent(0, 0, "Max Event Count"); UT_Report(__FILE__, __LINE__, - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter == - CFE_EVS_MAX_EVENT_SEND_COUNT && - AppDataPtr->EventCount == - CFE_EVS_MAX_EVENT_SEND_COUNT, - "EVS_SendEvent", - "Maximum message count and event count"); + CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter == CFE_EVS_MAX_EVENT_SEND_COUNT && + AppDataPtr->EventCount == CFE_EVS_MAX_EVENT_SEND_COUNT, + "EVS_SendEvent", "Maximum message count and event count"); /* Test sending a message with the message length greater than the * maximum allowed value @@ -2774,15 +2073,12 @@ void Test_Misc(void) msg[i] = 'a'; } - msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH] = '\0'; + msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH] = '\0'; CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter = 0; EVS_AppDataSetUsed(AppDataPtr, AppID); AppDataPtr->ActiveFlag = true; - AppDataPtr->EventTypesActiveFlag |= - CFE_EVS_INFORMATION_BIT; + AppDataPtr->EventTypesActiveFlag |= CFE_EVS_INFORMATION_BIT; EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, msg); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter == 1, - "EVS_SendEvent", + UT_Report(__FILE__, __LINE__, CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter == 1, "EVS_SendEvent", "Maximum message length exceeded"); } diff --git a/modules/evs/ut-coverage/evs_UT.h b/modules/evs/ut-coverage/evs_UT.h index 60279984f..26b7e60fd 100644 --- a/modules/evs/ut-coverage/evs_UT.h +++ b/modules/evs/ut-coverage/evs_UT.h @@ -69,7 +69,7 @@ ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_Init(void); @@ -84,7 +84,7 @@ void Test_Init(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_IllegalAppID(void); @@ -99,7 +99,7 @@ void Test_IllegalAppID(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_UnregisteredApp(void); @@ -114,7 +114,7 @@ void Test_UnregisteredApp(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_FilterRegistration(void); @@ -129,7 +129,7 @@ void Test_FilterRegistration(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_FilterReset(void); @@ -146,7 +146,7 @@ void Test_FilterReset(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_Format(void); @@ -161,7 +161,7 @@ void Test_Format(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_Ports(void); @@ -176,7 +176,7 @@ void Test_Ports(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_Logging(void); @@ -191,7 +191,7 @@ void Test_Logging(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_WriteApp(void); @@ -208,7 +208,7 @@ void Test_WriteApp(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_BadAppCmd(void); @@ -223,7 +223,7 @@ void Test_BadAppCmd(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_EventCmd(void); @@ -238,7 +238,7 @@ void Test_EventCmd(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_FilterCmd(void); @@ -255,7 +255,7 @@ void Test_FilterCmd(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_InvalidCmd(void); @@ -270,7 +270,7 @@ void Test_InvalidCmd(void); ** None ** ** \returns -** This function does not return a value. +** This function does not return a value. ******************************************************************************/ void Test_Misc(void); diff --git a/modules/fs/fsw/src/cfe_fs_api.c b/modules/fs/fsw/src/cfe_fs_api.c index b06d2c419..b3703eedf 100644 --- a/modules/fs/fsw/src/cfe_fs_api.c +++ b/modules/fs/fsw/src/cfe_fs_api.c @@ -29,7 +29,6 @@ ** */ - /* ** Required header files... */ @@ -43,17 +42,16 @@ /* * Fixed default file system extensions (not platform dependent) */ -const char CFE_FS_DEFAULT_SCRIPT_EXTENSION[] = ".scr"; -const char CFE_FS_DEFAULT_DUMP_FILE_EXTENSION[] = ".dat"; -const char CFE_FS_DEFAULT_TEMP_FILE_EXTENSION[] = ".tmp"; -const char CFE_FS_DEFAULT_LOG_FILE_EXTENSION[] = ".log"; - +const char CFE_FS_DEFAULT_SCRIPT_EXTENSION[] = ".scr"; +const char CFE_FS_DEFAULT_DUMP_FILE_EXTENSION[] = ".dat"; +const char CFE_FS_DEFAULT_TEMP_FILE_EXTENSION[] = ".tmp"; +const char CFE_FS_DEFAULT_LOG_FILE_EXTENSION[] = ".log"; const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory) { const char *Result; - switch(FileCategory) + switch (FileCategory) { case CFE_FS_FileCategory_SCRIPT: case CFE_FS_FileCategory_DYNAMIC_MODULE: @@ -67,7 +65,7 @@ const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory) Result = GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint; break; default: - Result = NULL; /* Should not be used */ + Result = NULL; /* Should not be used */ break; } @@ -78,7 +76,7 @@ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory) { const char *Result; - switch(FileCategory) + switch (FileCategory) { case CFE_FS_FileCategory_SCRIPT: Result = CFE_FS_DEFAULT_SCRIPT_EXTENSION; @@ -98,7 +96,7 @@ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory) Result = CFE_FS_DEFAULT_LOG_FILE_EXTENSION; break; default: - Result = NULL; /* Should not be used */ + Result = NULL; /* Should not be used */ break; } @@ -110,14 +108,14 @@ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory) */ int32 CFE_FS_ReadHeader(CFE_FS_Header_t *Hdr, osal_id_t FileDes) { - int32 Result; - int32 EndianCheck = 0x01020304; + int32 Result; + int32 EndianCheck = 0x01020304; if (Hdr == NULL) { return CFE_FS_BAD_ARGUMENT; } - + /* ** Ensure that we are at the start of the file... */ @@ -130,16 +128,16 @@ int32 CFE_FS_ReadHeader(CFE_FS_Header_t *Hdr, osal_id_t FileDes) */ Result = OS_read(FileDes, Hdr, sizeof(CFE_FS_Header_t)); - /* Determine if this processor is a little endian processor */ - if ((*(char *)(&EndianCheck)) == 0x04) - { - /* If this is a little endian processor, then convert the header data structure from */ - /* its standard big-endian format into a little endian format to ease user access */ - CFE_FS_ByteSwapCFEHeader(Hdr); - } + /* Determine if this processor is a little endian processor */ + if ((*(char *)(&EndianCheck)) == 0x04) + { + /* If this is a little endian processor, then convert the header data structure from */ + /* its standard big-endian format into a little endian format to ease user access */ + CFE_FS_ByteSwapCFEHeader(Hdr); + } } - - return(Result); + + return (Result); } /* End of CFE_FS_ReadHeader() */ @@ -148,16 +146,16 @@ int32 CFE_FS_ReadHeader(CFE_FS_Header_t *Hdr, osal_id_t FileDes) */ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 SubType) { - if(Hdr == NULL || Description == NULL) - { + if (Hdr == NULL || Description == NULL) + { CFE_ES_WriteToSysLog("CFE_FS:InitHeader-Failed invalid arguments\n"); - } - else - { + } + else + { memset(Hdr, 0, sizeof(CFE_FS_Header_t)); strncpy((char *)Hdr->Description, Description, sizeof(Hdr->Description) - 1); Hdr->SubType = SubType; - } + } } /* @@ -166,14 +164,14 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 Sub int32 CFE_FS_WriteHeader(osal_id_t FileDes, CFE_FS_Header_t *Hdr) { CFE_TIME_SysTime_t Time; - int32 Result; - int32 EndianCheck = 0x01020304; - CFE_ES_AppId_t AppID; + int32 Result; + int32 EndianCheck = 0x01020304; + CFE_ES_AppId_t AppID; if (Hdr == NULL) - { - return CFE_FS_BAD_ARGUMENT; - } + { + return CFE_FS_BAD_ARGUMENT; + } /* ** Ensure that we are at the start of the file... @@ -185,25 +183,24 @@ int32 CFE_FS_WriteHeader(osal_id_t FileDes, CFE_FS_Header_t *Hdr) /* ** Fill in the ID fields... */ - Hdr->SpacecraftID = CFE_PSP_GetSpacecraftId(); - Hdr->ProcessorID = CFE_PSP_GetProcessorId(); - CFE_ES_GetAppID(&AppID); - Hdr->ApplicationID = CFE_RESOURCEID_TO_ULONG(AppID); + Hdr->SpacecraftID = CFE_PSP_GetSpacecraftId(); + Hdr->ProcessorID = CFE_PSP_GetProcessorId(); + CFE_ES_GetAppID(&AppID); + Hdr->ApplicationID = CFE_RESOURCEID_TO_ULONG(AppID); - /* Fill in length field */ + /* Fill in length field */ - Hdr->Length = sizeof(CFE_FS_Header_t); + Hdr->Length = sizeof(CFE_FS_Header_t); - /* put the header, 'cfe1' in hex, in to the content type */ - Hdr->ContentType = 0x63464531; + /* put the header, 'cfe1' in hex, in to the content type */ + Hdr->ContentType = 0x63464531; - /* ** Fill in the timestamp fields... */ - Time = CFE_TIME_GetTime(); - Hdr->TimeSeconds = Time.Seconds; - Hdr->TimeSubSeconds = Time.Subseconds; + Time = CFE_TIME_GetTime(); + Hdr->TimeSeconds = Time.Seconds; + Hdr->TimeSubSeconds = Time.Subseconds; /* ** Determine if this is a little endian processor @@ -229,10 +226,9 @@ int32 CFE_FS_WriteHeader(osal_id_t FileDes, CFE_FS_Header_t *Hdr) /* from the required CFE standard big endian format to the little endian format */ CFE_FS_ByteSwapCFEHeader(Hdr); } - } - return(Result); + return (Result); } /* End of CFE_FS_WriteHeader() */ @@ -243,13 +239,13 @@ int32 CFE_FS_SetTimestamp(osal_id_t FileDes, CFE_TIME_SysTime_t NewTimestamp) { int32 Result; CFE_FS_Header_t TempHdr; - int32 EndianCheck = 0x01020304; + int32 EndianCheck = 0x01020304; CFE_TIME_SysTime_t OutTimestamp = NewTimestamp; - int32 FileOffset = 0; - + int32 FileOffset = 0; + FileOffset = ((char *)&TempHdr.TimeSeconds - (char *)&TempHdr.ContentType); - Result = OS_lseek(FileDes, FileOffset, OS_SEEK_SET); - + Result = OS_lseek(FileDes, FileOffset, OS_SEEK_SET); + if (Result == FileOffset) { /* @@ -262,14 +258,14 @@ int32 CFE_FS_SetTimestamp(osal_id_t FileDes, CFE_TIME_SysTime_t NewTimestamp) CFE_FS_ByteSwapUint32(&OutTimestamp.Seconds); CFE_FS_ByteSwapUint32(&OutTimestamp.Subseconds); } - + Result = OS_write(FileDes, &OutTimestamp.Seconds, sizeof(OutTimestamp.Seconds)); - + /* On a good write, the value returned will equal the number of bytes written */ if (Result == sizeof(OutTimestamp.Seconds)) { Result = OS_write(FileDes, &OutTimestamp.Subseconds, sizeof(OutTimestamp.Subseconds)); - + if (Result == sizeof(OutTimestamp.Subseconds)) { Result = OS_SUCCESS; @@ -288,10 +284,9 @@ int32 CFE_FS_SetTimestamp(osal_id_t FileDes, CFE_TIME_SysTime_t NewTimestamp) { CFE_ES_WriteToSysLog("CFE_FS:SetTime-Failed to lseek time fields (Status=0x%08X)\n", (unsigned int)Result); } - - return(Result); -} /* End of CFE_FS_SetTimestamp() */ + return (Result); +} /* End of CFE_FS_SetTimestamp() */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -312,7 +307,6 @@ void CFE_FS_ByteSwapCFEHeader(CFE_FS_Header_t *Hdr) } /* End of CFE_FS_ByteSwapCFEHeader() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_FS_ByteSwapUint32() -- byte swap an uint32 */ @@ -321,14 +315,14 @@ void CFE_FS_ByteSwapCFEHeader(CFE_FS_Header_t *Hdr) void CFE_FS_ByteSwapUint32(uint32 *Uint32ToSwapPtr) { - int32 Temp = *Uint32ToSwapPtr; - char *InPtr = (char *)&Temp; + int32 Temp = *Uint32ToSwapPtr; + char *InPtr = (char *)&Temp; char *OutPtr = (char *)Uint32ToSwapPtr; - + OutPtr[0] = InPtr[3]; OutPtr[1] = InPtr[2]; OutPtr[2] = InPtr[1]; - OutPtr[3] = InPtr[0]; + OutPtr[3] = InPtr[0]; } /* End of CFE_FS_ByteSwapUint32() */ /* @@ -340,17 +334,18 @@ void CFE_FS_ByteSwapUint32(uint32 *Uint32ToSwapPtr) ** - module extension is optional; append default for OS/platform if missing **--------------------------------------------------------------------------------------- */ -int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize, size_t InputBufSize, - const char *DefaultInput, const char *DefaultPath, const char *DefaultExtension) +int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize, + size_t InputBufSize, const char *DefaultInput, const char *DefaultPath, + const char *DefaultExtension) { - int32 Status; + int32 Status; const char *InputPtr; const char *ComponentPtr; - size_t ComponentLen; - char ComponentTerm; - size_t OutputLen; - size_t InputLen; - bool LastPathReached; + size_t ComponentLen; + char ComponentTerm; + size_t OutputLen; + size_t InputLen; + bool LastPathReached; /* The filename consists of a pathname, filename, and extension component. */ enum @@ -370,9 +365,9 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s return CFE_FS_BAD_ARGUMENT; } - Status = CFE_FS_INVALID_PATH; - OutputLen = 0; - ComponentTerm = 0; + Status = CFE_FS_INVALID_PATH; + OutputLen = 0; + ComponentTerm = 0; LastPathReached = false; /* If input buffer is not empty, then use it, otherwise use DefaultInput */ @@ -401,19 +396,19 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s if (Component == PATHNAME_SEPARATOR && !LastPathReached) { /* repeat until LastPathReached */ - Component = PATHNAME_COMPONENT; + Component = PATHNAME_COMPONENT; } else { ++Component; } - switch(Component) + switch (Component) { case PATHNAME_COMPONENT: /* path part ends with the last / char, which begins the filename */ ComponentTerm = '/'; - ComponentPtr = memchr(InputPtr, ComponentTerm, InputLen); + ComponentPtr = memchr(InputPtr, ComponentTerm, InputLen); if (ComponentPtr != NULL) { /* has path: use pathname from input, advance InputPtr to next part (filename) */ @@ -422,7 +417,7 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s InputPtr += ComponentLen; InputLen -= ComponentLen; } - else + else { LastPathReached = true; @@ -432,7 +427,7 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s ComponentLen = strlen(DefaultPath); ComponentPtr = DefaultPath; } - else + else { /* use no pathname at all */ ComponentLen = 0; @@ -444,7 +439,7 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s case FILENAME_COMPONENT: /* filename ends with a . char, which begins the extension */ ComponentTerm = '.'; - ComponentPtr = memchr(InputPtr, ComponentTerm, InputLen); + ComponentPtr = memchr(InputPtr, ComponentTerm, InputLen); if (ComponentPtr != NULL) { /* has ext: use pathname from input, advance InputPtr to next part (extension) */ @@ -473,7 +468,7 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s if (ComponentLen > 0 && *ComponentPtr != 0) { - /* + /* * If the filename part is non-empty, then consider the conversion successful * (note that extension is not really needed for an acceptable filename) */ @@ -485,7 +480,7 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s case PATHNAME_SEPARATOR: case EXTENSION_SEPARATOR: /* Remove duplicate terminators that may have been in the input */ - while (OutputLen > 0 && OutputBuffer[OutputLen-1] == ComponentTerm) + while (OutputLen > 0 && OutputBuffer[OutputLen - 1] == ComponentTerm) { --OutputLen; } @@ -501,23 +496,22 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s } break; - case EXTENSION_COMPONENT: /* Intentional fall through to default case */ default: - /* Just consume the rest of input - + /* Just consume the rest of input - * should already be pointing to correct data */ ComponentTerm = 0; - ComponentLen = InputLen; - ComponentPtr = InputPtr; - InputPtr = NULL; /* no more input */ - InputLen = 0; + ComponentLen = InputLen; + ComponentPtr = InputPtr; + InputPtr = NULL; /* no more input */ + InputLen = 0; break; } /* Append component */ - while(ComponentLen > 0 && *ComponentPtr != 0) + while (ComponentLen > 0 && *ComponentPtr != 0) { OutputBuffer[OutputLen] = *ComponentPtr; ++ComponentPtr; @@ -527,18 +521,18 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s if (OutputLen >= OutputBufSize) { /* name is too long to fit in output buffer */ - Status = CFE_FS_FNAME_TOO_LONG; + Status = CFE_FS_FNAME_TOO_LONG; InputPtr = NULL; /* no more input */ InputLen = 0; - --OutputLen; /* back up one char for term */ + --OutputLen; /* back up one char for term */ break; } } } - /* + /* * Always add a final terminating NUL char. - * + * * Note that the loop above should never entirely fill * buffer (length check includes extra char). */ @@ -555,86 +549,87 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s ** a non-empty, null terminated string and the fixed-length input buffer not needed. **--------------------------------------------------------------------------------------- */ -int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_t OutputBufSize, CFE_FS_FileCategory_t FileCategory) +int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_t OutputBufSize, + CFE_FS_FileCategory_t FileCategory) { - return CFE_FS_ParseInputFileNameEx(OutputBuffer, NULL, OutputBufSize, 0, InputName, - CFE_FS_GetDefaultMountPoint(FileCategory), CFE_FS_GetDefaultExtension(FileCategory)); + return CFE_FS_ParseInputFileNameEx(OutputBuffer, NULL, OutputBufSize, 0, InputName, + CFE_FS_GetDefaultMountPoint(FileCategory), + CFE_FS_GetDefaultExtension(FileCategory)); } - /* ** CFE_FS_ExtractFilenameFromPath - See API and header file for details */ int32 CFE_FS_ExtractFilenameFromPath(const char *OriginalPath, char *FileNameOnly) { - uint32 i,j; - int StringLength; - int DirMarkIdx; - int32 ReturnCode; - - if ( OriginalPath == NULL || FileNameOnly == NULL ) - { - ReturnCode = CFE_FS_BAD_ARGUMENT; - } - else - { - - /* - ** Get the string length of the original file path - */ - StringLength = strlen(OriginalPath); - - /* - ** Extract the filename from the Path - */ - - /* - ** Find the last '/' Character - */ - DirMarkIdx = -1; - for ( i = 0; i < StringLength; i++ ) - { - if ( OriginalPath[i] == '/' ) - { - DirMarkIdx = i; - } - } - - /* - ** Verify the filename isn't too long - */ - if ((StringLength - (DirMarkIdx + 1)) < OS_MAX_PATH_LEN) - { - /* - ** Extract the filename portion - */ - if ( DirMarkIdx > 0 ) - { - /* - ** Extract the filename portion - */ - j = 0; - for ( i = DirMarkIdx + 1; i < StringLength; i++ ) - { - FileNameOnly[j] = OriginalPath[i]; - j++; - } - FileNameOnly[j] = '\0'; - - ReturnCode = CFE_SUCCESS; - } - else - { - ReturnCode = CFE_FS_INVALID_PATH; - } - } - else - { - ReturnCode = CFE_FS_FNAME_TOO_LONG; - } + uint32 i, j; + int StringLength; + int DirMarkIdx; + int32 ReturnCode; + + if (OriginalPath == NULL || FileNameOnly == NULL) + { + ReturnCode = CFE_FS_BAD_ARGUMENT; } - - return(ReturnCode); + else + { + + /* + ** Get the string length of the original file path + */ + StringLength = strlen(OriginalPath); + + /* + ** Extract the filename from the Path + */ + + /* + ** Find the last '/' Character + */ + DirMarkIdx = -1; + for (i = 0; i < StringLength; i++) + { + if (OriginalPath[i] == '/') + { + DirMarkIdx = i; + } + } + + /* + ** Verify the filename isn't too long + */ + if ((StringLength - (DirMarkIdx + 1)) < OS_MAX_PATH_LEN) + { + /* + ** Extract the filename portion + */ + if (DirMarkIdx > 0) + { + /* + ** Extract the filename portion + */ + j = 0; + for (i = DirMarkIdx + 1; i < StringLength; i++) + { + FileNameOnly[j] = OriginalPath[i]; + j++; + } + FileNameOnly[j] = '\0'; + + ReturnCode = CFE_SUCCESS; + } + else + { + ReturnCode = CFE_FS_INVALID_PATH; + } + } + else + { + ReturnCode = CFE_FS_FNAME_TOO_LONG; + } + } + + return (ReturnCode); } /* @@ -642,19 +637,19 @@ int32 CFE_FS_ExtractFilenameFromPath(const char *OriginalPath, char *FileNameOnl */ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) { - CFE_FS_CurrentFileState_t *State; + CFE_FS_CurrentFileState_t * State; CFE_FS_BackgroundFileDumpEntry_t *Curr; - CFE_FS_FileWriteMetaData_t *Meta; - int32 Status; - CFE_FS_Header_t FileHdr; - void *RecordPtr; - size_t RecordSize; - bool IsEOF; - - State = &CFE_FS_Global.FileDump.Current; - Curr = NULL; - IsEOF = false; - RecordPtr = NULL; + CFE_FS_FileWriteMetaData_t * Meta; + int32 Status; + CFE_FS_Header_t FileHdr; + void * RecordPtr; + size_t RecordSize; + bool IsEOF; + + State = &CFE_FS_Global.FileDump.Current; + Curr = NULL; + IsEOF = false; + RecordPtr = NULL; RecordSize = 0; State->Credit += (ElapsedTime * CFE_FS_BACKGROUND_CREDIT_PER_SECOND) / 1000; @@ -672,7 +667,8 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) if (CFE_FS_Global.FileDump.CompleteCount != CFE_FS_Global.FileDump.RequestCount) { - Curr = &CFE_FS_Global.FileDump.Entries[CFE_FS_Global.FileDump.CompleteCount & (CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)]; + Curr = &CFE_FS_Global.FileDump + .Entries[CFE_FS_Global.FileDump.CompleteCount & (CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)]; } CFE_FS_UnlockSharedData(__func__); @@ -688,7 +684,7 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) { /* First time processing this entry - open the file */ Status = OS_OpenCreate(&State->Fd, Meta->FileName, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); - if(Status < 0) + if (Status < 0) { State->Fd = OS_OBJECT_ID_UNDEFINED; Meta->OnEvent(Meta, CFE_FS_FileWriteEvent_CREATE_ERROR, Status, 0, 0, 0); @@ -703,7 +699,8 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) { OS_close(State->Fd); State->Fd = OS_OBJECT_ID_UNDEFINED; - Meta->OnEvent(Meta, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, Status, State->RecordNum, sizeof(CFE_FS_Header_t), State->FileSize); + Meta->OnEvent(Meta, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, Status, State->RecordNum, + sizeof(CFE_FS_Header_t), State->FileSize); } else { @@ -721,7 +718,7 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) */ IsEOF = Meta->GetData(Meta, State->RecordNum, &RecordPtr, &RecordSize); - /* + /* * if the getter outputs a record size of 0, this means there is no data for * this entry, but the cycle keeps going (in case of "holes" or unused table entries * in the database). @@ -731,9 +728,9 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) State->Credit -= RecordSize; /* - * Now write to file - */ - Status = OS_write(State->Fd,RecordPtr,RecordSize); + * Now write to file + */ + Status = OS_write(State->Fd, RecordPtr, RecordSize); if (Status != RecordSize) { @@ -742,7 +739,8 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) State->Fd = OS_OBJECT_ID_UNDEFINED; /* generate write error event */ - Meta->OnEvent(Meta, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, Status, State->RecordNum, RecordSize, State->FileSize); + Meta->OnEvent(Meta, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, Status, State->RecordNum, RecordSize, + State->FileSize); break; } else @@ -765,7 +763,7 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) Meta->OnEvent(Meta, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, State->RecordNum, 0, State->FileSize); } - /* + /* * if the file is not open, consider this file complete, and advance the head position. * (done this way so it also catches the case where the file failed to create, not just EOF) */ @@ -793,8 +791,8 @@ bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) int32 CFE_FS_BackgroundFileDumpRequest(CFE_FS_FileWriteMetaData_t *Meta) { CFE_FS_BackgroundFileDumpEntry_t *Curr; - int32 Status; - uint32 PendingRequestCount; + int32 Status; + uint32 PendingRequestCount; /* Pre-validate inputs */ if (Meta == NULL) @@ -820,7 +818,6 @@ int32 CFE_FS_BackgroundFileDumpRequest(CFE_FS_FileWriteMetaData_t *Meta) return CFE_STATUS_REQUEST_ALREADY_PENDING; } - CFE_FS_LockSharedData(__func__); PendingRequestCount = CFE_FS_Global.FileDump.RequestCount + 1; @@ -832,18 +829,19 @@ int32 CFE_FS_BackgroundFileDumpRequest(CFE_FS_FileWriteMetaData_t *Meta) } else { - Curr = &CFE_FS_Global.FileDump.Entries[CFE_FS_Global.FileDump.RequestCount & (CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)]; + Curr = &CFE_FS_Global.FileDump + .Entries[CFE_FS_Global.FileDump.RequestCount & (CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)]; - /* - * store the meta object - note this retains the pointer that was submitted + /* + * store the meta object - note this retains the pointer that was submitted * (caller must not reuse/change this object until request is completed) */ Curr->Meta = Meta; - /* + /* * The "IsPending" Flag will be set true whenever while this is waiting in the request queue. * It will be set false when the file is done. - * + * * The requester can check this flag to determine if/when the request is complete */ Meta->IsPending = true; @@ -858,9 +856,9 @@ int32 CFE_FS_BackgroundFileDumpRequest(CFE_FS_FileWriteMetaData_t *Meta) if (Status == CFE_SUCCESS) { - /* + /* * If successfully added to write queue, then wake the ES background task to get started. - * + * * This may reduce the overall latency between request and completion (depending on other * background task work). If this is the only pending job, this should get it started faster. */ diff --git a/modules/fs/fsw/src/cfe_fs_module_all.h b/modules/fs/fsw/src/cfe_fs_module_all.h index 6730941c2..751b89f7f 100644 --- a/modules/fs/fsw/src/cfe_fs_module_all.h +++ b/modules/fs/fsw/src/cfe_fs_module_all.h @@ -20,10 +20,10 @@ /** * @file cfe_fs_module_all.h - * + * * Encapsulates all FS module internal header files, as well * as the public API from all other CFE core modules, OSAL, and PSP. - * + * * This simplifies the set of include files that need to be put at the * start of every source file. */ @@ -38,6 +38,5 @@ #include "cfe_fs_priv.h" #include "cfe_fs_core_internal.h" - #endif /* CFE_FS_MODULE_ALL_H */ /*****************************************************************************/ diff --git a/modules/fs/fsw/src/cfe_fs_priv.c b/modules/fs/fsw/src/cfe_fs_priv.c index d474dfe30..4344aaddc 100644 --- a/modules/fs/fsw/src/cfe_fs_priv.c +++ b/modules/fs/fsw/src/cfe_fs_priv.c @@ -21,15 +21,14 @@ /* ** File: cfe_fs_priv.c ** -** Purpose: cFE File Services (FS) library API Initialization +** Purpose: cFE File Services (FS) library API Initialization ** -** Author: Alan Cudmore/NASA GSFC +** Author: Alan Cudmore/NASA GSFC ** ** Notes: ** */ - /* ** Required header files */ @@ -37,10 +36,9 @@ #include - /* ** Global data -** +** */ CFE_FS_Global_t CFE_FS_Global; @@ -58,28 +56,28 @@ CFE_FS_Global_t CFE_FS_Global; ** Return: ** CFE_SUCCESS */ -int32 CFE_FS_EarlyInit (void) +int32 CFE_FS_EarlyInit(void) { int32 Stat; memset(&CFE_FS_Global, 0, sizeof(CFE_FS_Global)); Stat = OS_MutSemCreate(&CFE_FS_Global.SharedDataMutexId, "CFE_FS_SharedMutex", 0); - if( Stat != OS_SUCCESS ) + if (Stat != OS_SUCCESS) { - CFE_ES_WriteToSysLog("FS Shared Data Mutex creation failed! RC=0x%08x\n",(unsigned int)Stat); - return Stat; - }/* end if */ + CFE_ES_WriteToSysLog("FS Shared Data Mutex creation failed! RC=0x%08x\n", (unsigned int)Stat); + return Stat; + } /* end if */ return Stat; -}/* end CFE_FS_EarlyInit */ +} /* end CFE_FS_EarlyInit */ /****************************************************************************** ** Function: CFE_FS_LockSharedData() ** ** Purpose: -** FS internal function to handle a semaphore take failure for the FS +** FS internal function to handle a semaphore take failure for the FS ** Data Mutex ** ** Arguments: @@ -90,22 +88,22 @@ int32 CFE_FS_EarlyInit (void) */ void CFE_FS_LockSharedData(const char *FunctionName) { - int32 Status; - CFE_ES_AppId_t AppId; + int32 Status; + CFE_ES_AppId_t AppId; Status = OS_MutSemTake(CFE_FS_Global.SharedDataMutexId); - if (Status != OS_SUCCESS) + if (Status != OS_SUCCESS) { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("FS SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", - (unsigned int)Status,CFE_RESOURCEID_TO_ULONG(AppId),FunctionName); + CFE_ES_WriteToSysLog("FS SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", (unsigned int)Status, + CFE_RESOURCEID_TO_ULONG(AppId), FunctionName); - }/* end if */ + } /* end if */ return; -}/* end CFE_FS_LockSharedData */ +} /* end CFE_FS_LockSharedData */ /****************************************************************************** ** Function: CFE_FS_UnlockSharedData() @@ -122,20 +120,20 @@ void CFE_FS_LockSharedData(const char *FunctionName) */ void CFE_FS_UnlockSharedData(const char *FunctionName) { - int32 Status; - CFE_ES_AppId_t AppId; + int32 Status; + CFE_ES_AppId_t AppId; - Status = OS_MutSemGive(CFE_FS_Global.SharedDataMutexId); - if (Status != OS_SUCCESS) - { - CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("FS SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n", - (unsigned int)Status,CFE_RESOURCEID_TO_ULONG(AppId),FunctionName); + Status = OS_MutSemGive(CFE_FS_Global.SharedDataMutexId); + if (Status != OS_SUCCESS) + { + CFE_ES_GetAppID(&AppId); + CFE_ES_WriteToSysLog("FS SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n", (unsigned int)Status, + CFE_RESOURCEID_TO_ULONG(AppId), FunctionName); - }/* end if */ - return; + } /* end if */ + return; -}/* end CFE_FS_UnlockSharedData */ +} /* end CFE_FS_UnlockSharedData */ /************************/ /* End of File Comment */ diff --git a/modules/fs/fsw/src/cfe_fs_priv.h b/modules/fs/fsw/src/cfe_fs_priv.h index 0c26cafb7..7957a5757 100644 --- a/modules/fs/fsw/src/cfe_fs_priv.h +++ b/modules/fs/fsw/src/cfe_fs_priv.h @@ -25,7 +25,7 @@ ** This header file contains prototypes for private functions and type ** definitions for FS internal use. ** -** Author: A. Cudmore/NASA GSFC +** Author: A. Cudmore/NASA GSFC ** ** ******************************************************************************/ @@ -46,35 +46,34 @@ /* * Max Number of file write requests that can be queued - * + * * This needs to be a power of two to simplify the masking/wraparound (bitwise AND). */ -#define CFE_FS_MAX_BACKGROUND_FILE_WRITES 4 - +#define CFE_FS_MAX_BACKGROUND_FILE_WRITES 4 /* * Background file credit accumulation rate - * + * * The background file writer will limit the total bytes written over time. This * controls the amount of "credit" (bytes that can be written) per second * of elapsed time. - * + * * This permits a file writing rate of up to 10kbytes/sec. */ -#define CFE_FS_BACKGROUND_CREDIT_PER_SECOND 10000 +#define CFE_FS_BACKGROUND_CREDIT_PER_SECOND 10000 /* * Maximum credit that the background write task can accumulate - * + * * The background file writer will limit the total bytes written over time, and * will accumulate credit against this limit while no writes are in progress. * This is an upper cap on the amount of credit that can be accumulated. - * + * * Without this limit, after a long period of inactivity without any file * writes, a large credit would essentially bypass the rate limiting for * the next file write command(s) once they are issued. */ -#define CFE_FS_BACKGROUND_MAX_CREDIT 10000 +#define CFE_FS_BACKGROUND_MAX_CREDIT 10000 /* ** Type Definitions @@ -100,22 +99,21 @@ typedef struct size_t FileSize; } CFE_FS_CurrentFileState_t; - /** * \brief Background file dump queue structure * * This structure is stored in global memory and keeps the state * of the file dump from one iteration to the next. - * + * * Normally when idle the "RequestCount" and "CompleteCount" are the * same value. When an application requests a background file dump, * the "RequestCount" is incremented accordingly, and when the background - * job finishes, the "CompleteCount" is incremented accordingly. + * job finishes, the "CompleteCount" is incremented accordingly. */ typedef struct { - uint32 RequestCount; /**< Total Number of background file writes requested */ - uint32 CompleteCount; /**< Total Number of background file writes completed */ + uint32 RequestCount; /**< Total Number of background file writes requested */ + uint32 CompleteCount; /**< Total Number of background file writes completed */ /** * Data related to each background file write request @@ -130,33 +128,30 @@ typedef struct } CFE_FS_BackgroundFileDumpState_t; - /****************************************************************************** ** Typedef: CFE_FS_Global_t ** ** Purpose: ** This structure contains the FS global variables. */ -typedef struct +typedef struct { - osal_id_t SharedDataMutexId; + osal_id_t SharedDataMutexId; CFE_FS_BackgroundFileDumpState_t FileDump; } CFE_FS_Global_t; - extern CFE_FS_Global_t CFE_FS_Global; /* ** FS Function Prototypes */ -extern void CFE_FS_LockSharedData(const char *FunctionName ); -extern void CFE_FS_UnlockSharedData(const char *FunctionName ); +extern void CFE_FS_LockSharedData(const char *FunctionName); +extern void CFE_FS_UnlockSharedData(const char *FunctionName); extern void CFE_FS_ByteSwapCFEHeader(CFE_FS_Header_t *Hdr); extern void CFE_FS_ByteSwapUint32(uint32 *Uint32ToSwapPtr); - #endif /* _cfe_fs_priv_ */ /*****************************************************************************/ diff --git a/modules/fs/ut-coverage/fs_UT.c b/modules/fs/ut-coverage/fs_UT.c index d45013308..8eb7b53eb 100644 --- a/modules/fs/ut-coverage/fs_UT.c +++ b/modules/fs/ut-coverage/fs_UT.c @@ -42,17 +42,12 @@ #include "target_config.h" -const char *FS_SYSLOG_MSGS[] = -{ - NULL, - "FS SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", - "FS SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n" -}; +const char *FS_SYSLOG_MSGS[] = {NULL, "FS SharedData Mutex Take Err Stat=0x%x,App=%lu,Function=%s\n", + "FS SharedData Mutex Give Err Stat=0x%x,App=%lu,Function=%s\n"}; /* counts the number of times UT_FS_OnEvent() was invoked (below) */ uint32 UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_MAX]; - /* UT helper stub compatible with background file write DataGetter */ bool UT_FS_DataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize) { @@ -61,7 +56,8 @@ bool UT_FS_DataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSi } /* UT helper stub compatible with background file write OnEvent */ -void UT_FS_OnEvent(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position) +void UT_FS_OnEvent(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, + size_t Position) { ++UT_FS_FileWriteEventCount[Event]; UT_DEFAULT_IMPL(UT_FS_OnEvent); @@ -101,10 +97,7 @@ void Test_CFE_FS_InitHeader(void) /* Test initializing the header */ UT_InitData(); CFE_FS_InitHeader(&Hdr, "description", 123); - UT_Report(__FILE__, __LINE__, - Hdr.SubType == 123, - "CFE_FS_InitHeader", - "Initialize header - successful"); + UT_Report(__FILE__, __LINE__, Hdr.SubType == 123, "CFE_FS_InitHeader", "Initialize header - successful"); } /* @@ -112,7 +105,7 @@ void Test_CFE_FS_InitHeader(void) */ void Test_CFE_FS_ReadHeader(void) { - osal_id_t FileDes = OS_OBJECT_ID_UNDEFINED; + osal_id_t FileDes = OS_OBJECT_ID_UNDEFINED; CFE_FS_Header_t Hdr; UtPrintf("Begin Test Read Header"); @@ -120,18 +113,14 @@ void Test_CFE_FS_ReadHeader(void) /* Test reading the header with a lseek failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_FS_ReadHeader(&Hdr, FileDes) == OS_ERROR, - "CFE_FS_ReadHeader", + UT_Report(__FILE__, __LINE__, CFE_FS_ReadHeader(&Hdr, FileDes) == OS_ERROR, "CFE_FS_ReadHeader", "Header read lseek failed"); /* Test successfully reading the header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_lseek), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_read), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_FS_ReadHeader(&Hdr, FileDes) != sizeof(CFE_FS_Header_t), - "CFE_FS_ReadHeader", + UT_Report(__FILE__, __LINE__, CFE_FS_ReadHeader(&Hdr, FileDes) != sizeof(CFE_FS_Header_t), "CFE_FS_ReadHeader", "Header read - successful"); } @@ -140,7 +129,7 @@ void Test_CFE_FS_ReadHeader(void) */ void Test_CFE_FS_WriteHeader(void) { - osal_id_t FileDes = OS_OBJECT_ID_UNDEFINED; + osal_id_t FileDes = OS_OBJECT_ID_UNDEFINED; CFE_FS_Header_t Hdr; UtPrintf("Begin Test Write Header"); @@ -148,18 +137,14 @@ void Test_CFE_FS_WriteHeader(void) /* Test writing the header with a lseek failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_FS_WriteHeader(FileDes, &Hdr) == OS_ERROR, - "CFE_FS_WriteHeader", + UT_Report(__FILE__, __LINE__, CFE_FS_WriteHeader(FileDes, &Hdr) == OS_ERROR, "CFE_FS_WriteHeader", "Header write lseek failed"); /* Test successfully writing the header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_lseek), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, OS_SUCCESS); - UT_Report(__FILE__, __LINE__, - CFE_FS_WriteHeader(FileDes, &Hdr) == OS_SUCCESS, - "CFE_FS_WriteHeader", + UT_Report(__FILE__, __LINE__, CFE_FS_WriteHeader(FileDes, &Hdr) == OS_SUCCESS, "CFE_FS_WriteHeader", "Header write - successful"); } @@ -168,7 +153,7 @@ void Test_CFE_FS_WriteHeader(void) */ void Test_CFE_FS_SetTimestamp(void) { - osal_id_t FileDes = OS_OBJECT_ID_UNDEFINED; + osal_id_t FileDes = OS_OBJECT_ID_UNDEFINED; CFE_TIME_SysTime_t NewTimestamp = {0, 0}; UtPrintf("Begin Test Set Time Stamp"); @@ -176,32 +161,24 @@ void Test_CFE_FS_SetTimestamp(void) /* Test setting the time stamp with a lseek failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_ERROR, - "CFE_FS_SetTimestamp", + UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_ERROR, "CFE_FS_SetTimestamp", "Failed to lseek time fields"); /* Test setting the time stamp with a seconds write failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_FS_SetTimestamp(FileDes, NewTimestamp) != OS_SUCCESS, - "CFE_FS_SetTimestamp", + UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) != OS_SUCCESS, "CFE_FS_SetTimestamp", "Failed to write seconds"); /* Test setting the time stamp with a subeconds write failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_write), 2, 0); - UT_Report(__FILE__, __LINE__, - CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_SUCCESS, - "CFE_FS_SetTimestamp", + UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_SUCCESS, "CFE_FS_SetTimestamp", "Failed to write subseconds"); /* Test successfully setting the time stamp */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_SUCCESS, - "CFE_FS_SetTimestamp", + UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_SUCCESS, "CFE_FS_SetTimestamp", "Write time stamp - successful"); } @@ -215,26 +192,22 @@ void Test_CFE_FS_ByteSwapCFEHeader(void) UtPrintf("Begin Test Byte Swap cFE Header"); UT_InitData(); - Hdr.ContentType = 0x11223344; - Hdr.SubType = 0x22334455; - Hdr.Length = 0x33445566; - Hdr.SpacecraftID = 0x44556677; - Hdr.ProcessorID = 0x55667788; - Hdr.ApplicationID = 0x66778899; - Hdr.TimeSeconds = 0x778899aa; + Hdr.ContentType = 0x11223344; + Hdr.SubType = 0x22334455; + Hdr.Length = 0x33445566; + Hdr.SpacecraftID = 0x44556677; + Hdr.ProcessorID = 0x55667788; + Hdr.ApplicationID = 0x66778899; + Hdr.TimeSeconds = 0x778899aa; Hdr.TimeSubSeconds = 0x8899aabb; /* Test byte-swapping the header values */ CFE_FS_ByteSwapCFEHeader(&Hdr); UT_Report(__FILE__, __LINE__, - Hdr.ContentType == 0x44332211 && Hdr.SubType == 0x55443322 && - Hdr.Length == 0x66554433 && Hdr.SpacecraftID == 0x77665544 && - Hdr.ProcessorID == 0x88776655 && - Hdr.ApplicationID == 0x99887766 && - Hdr.TimeSeconds == 0xaa998877 && - Hdr.TimeSubSeconds == 0xbbaa9988, - "CFE_FS_ByteSwapUint32", - "Byte swap header - successful"); + Hdr.ContentType == 0x44332211 && Hdr.SubType == 0x55443322 && Hdr.Length == 0x66554433 && + Hdr.SpacecraftID == 0x77665544 && Hdr.ProcessorID == 0x88776655 && Hdr.ApplicationID == 0x99887766 && + Hdr.TimeSeconds == 0xaa998877 && Hdr.TimeSubSeconds == 0xbbaa9988, + "CFE_FS_ByteSwapUint32", "Byte swap header - successful"); } /* @@ -242,7 +215,7 @@ void Test_CFE_FS_ByteSwapCFEHeader(void) */ void Test_CFE_FS_ByteSwapUint32(void) { - uint32 test = 0x11223344; + uint32 test = 0x11223344; uint32 *testptr = &test; UtPrintf("Begin Test Byte Swap uint32"); @@ -250,9 +223,7 @@ void Test_CFE_FS_ByteSwapUint32(void) /* Test byte-swapping a uint32 value */ UT_InitData(); CFE_FS_ByteSwapUint32(testptr); - UT_Report(__FILE__, __LINE__, - test == 0x44332211, "CFE_FS_ByteSwapUint32", - "Byte swap - successful"); + UT_Report(__FILE__, __LINE__, test == 0x44332211, "CFE_FS_ByteSwapUint32", "Byte swap - successful"); } /* @@ -396,11 +367,11 @@ void Test_CFE_FS_ParseInputFileNameEx(void) CFE_SUCCESS); UtAssert_StrCmp(OutBuffer, "/dflpath/abcd.dflext", "Non terminated input -> %s", OutBuffer); - /* For coverage, also invoke the simplified CFE_FS_ParseInputFileName() */ /* no more error paths here, as all real logic is in CFE_FS_ParseInputFileNameEx() */ - UtAssert_INT32_EQ(CFE_FS_ParseInputFileName(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), CFE_FS_FileCategory_TEXT_LOG), - CFE_SUCCESS); + UtAssert_INT32_EQ( + CFE_FS_ParseInputFileName(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), CFE_FS_FileCategory_TEXT_LOG), + CFE_SUCCESS); UtAssert_StrCmp(OutBuffer, "/path/to/file.log", "Simplified API -> %s", OutBuffer); } @@ -413,8 +384,8 @@ void Test_CFE_FS_DefaultFileStrings(void) * Test case for: * const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory) * const char *CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_t FileCategory) - * - * Note that some of these depend on platform-specific and/or user-configurable + * + * Note that some of these depend on platform-specific and/or user-configurable * items, so the exact string outputs can vary. In general this just confirms * that the returned pointer address, not the actual string content. */ @@ -425,8 +396,8 @@ void Test_CFE_FS_DefaultFileStrings(void) UtAssert_NULL(Result); Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_DYNAMIC_MODULE); - UtAssert_True(Result == GLOBAL_CONFIGDATA.Default_ModuleExtension, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CONFIGDATA.Default_ModuleExtension); + UtAssert_True(Result == GLOBAL_CONFIGDATA.Default_ModuleExtension, "Result (%lx) matches config (%lx)", + (unsigned long)Result, (unsigned long)GLOBAL_CONFIGDATA.Default_ModuleExtension); Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_BINARY_DATA_DUMP); UtAssert_NOT_NULL(Result); @@ -447,29 +418,27 @@ void Test_CFE_FS_DefaultFileStrings(void) UtAssert_NULL(Result); Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_DYNAMIC_MODULE); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.NonvolMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); + UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.NonvolMountPoint, "Result (%lx) matches config (%lx)", + (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_BINARY_DATA_DUMP); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); + UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", + (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_TEXT_LOG); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); + UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", + (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_SCRIPT); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.NonvolMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); + UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.NonvolMountPoint, "Result (%lx) matches config (%lx)", + (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_TEMP); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); + UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", + (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_MAX); UtAssert_NULL(Result); - - } /* @@ -480,7 +449,7 @@ void Test_CFE_FS_ExtractFileNameFromPath(void) char Original[OS_MAX_PATH_LEN]; char FileName[OS_MAX_PATH_LEN]; char LongFileName[OS_MAX_PATH_LEN + 7]; - int j; + int j; UtPrintf("Begin Test Extract File Name from Path"); @@ -490,19 +459,13 @@ void Test_CFE_FS_ExtractFileNameFromPath(void) UT_InitData(); strncpy(Original, "/cf/appslibrary.gz", sizeof(Original) - 1); Original[sizeof(Original) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_FS_ExtractFilenameFromPath("name", FileName) == - CFE_FS_INVALID_PATH, - "CFE_FS_ExtractFilenameFromPath", - "Missing file path"); + UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath("name", FileName) == CFE_FS_INVALID_PATH, + "CFE_FS_ExtractFilenameFromPath", "Missing file path"); /* Test extracting the file name from a path that's null */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_FS_ExtractFilenameFromPath(NULL, FileName) == - CFE_FS_BAD_ARGUMENT, - "CFE_FS_ExtractFilenameFromPath", - "Null name"); + UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(NULL, FileName) == CFE_FS_BAD_ARGUMENT, + "CFE_FS_ExtractFilenameFromPath", "Null name"); /* Test extracting the file name from a path/file name that's too long */ UT_InitData(); @@ -515,27 +478,18 @@ void Test_CFE_FS_ExtractFileNameFromPath(void) strcat(LongFileName, ".gz"); - UT_Report(__FILE__, __LINE__, - CFE_FS_ExtractFilenameFromPath(LongFileName, FileName) == - CFE_FS_FNAME_TOO_LONG, - "CFE_FS_ExtractFilenameFromPath", - "Path/file name too long"); + UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(LongFileName, FileName) == CFE_FS_FNAME_TOO_LONG, + "CFE_FS_ExtractFilenameFromPath", "Path/file name too long"); /* Test successfully extracting the file name from a path/file name */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_FS_ExtractFilenameFromPath(Original, FileName) == - CFE_SUCCESS, - "CFE_FS_ExtractFilenameFromPath", - "Extract path name - successful"); + UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(Original, FileName) == CFE_SUCCESS, + "CFE_FS_ExtractFilenameFromPath", "Extract path name - successful"); /* Test extracting the file name from a file name that's null */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_FS_ExtractFilenameFromPath(Original, NULL) == - CFE_FS_BAD_ARGUMENT, - "CFE_FS_ExtractFilenameFromPath", - "Null file name"); + UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(Original, NULL) == CFE_FS_BAD_ARGUMENT, + "CFE_FS_ExtractFilenameFromPath", "Null file name"); } /* @@ -547,25 +501,18 @@ void Test_CFE_FS_Private(void) /* Test successful FS initialization */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_FS_EarlyInit() == CFE_SUCCESS, - "CFE_FS_EarlyInit", + UT_Report(__FILE__, __LINE__, CFE_FS_EarlyInit() == CFE_SUCCESS, "CFE_FS_EarlyInit", "FS initialization - successful"); /* Test FS initialization with a mutex creation failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_MutSemCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_FS_EarlyInit() == -1, - "CFE_FS_EarlyInit", - "Mutex creation failure"); + UT_Report(__FILE__, __LINE__, CFE_FS_EarlyInit() == -1, "CFE_FS_EarlyInit", "Mutex creation failure"); /* Test successful locking of shared data */ UT_InitData(); CFE_FS_LockSharedData("FunctionName"); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, - "CFE_FS_LockSharedData", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_FS_LockSharedData", "Lock shared data - successful"); /* Test locking of shared data with a mutex take error */ @@ -573,17 +520,13 @@ void Test_CFE_FS_Private(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, -1); CFE_FS_LockSharedData("FunctionName"); UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(FS_SYSLOG_MSGS[1]) && - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, - "CFE_FS_LockSharedData", - "Shared data mutex take error"); + UT_SyslogIsInHistory(FS_SYSLOG_MSGS[1]) && UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, + "CFE_FS_LockSharedData", "Shared data mutex take error"); /* Test successful unlocking of shared data */ UT_InitData(); CFE_FS_UnlockSharedData("FunctionName"); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, - "CFE_FS_UnlockSharedData", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_FS_UnlockSharedData", "Unlock shared data - successful"); /* Test unlocking of shared data with a mutex give error */ @@ -591,10 +534,8 @@ void Test_CFE_FS_Private(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, -1); CFE_FS_UnlockSharedData("FunctionName"); UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(FS_SYSLOG_MSGS[2]) && - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, - "CFE_FS_UnlockSharedData", - "SharedData mutex give error"); + UT_SyslogIsInHistory(FS_SYSLOG_MSGS[2]) && UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, + "CFE_FS_UnlockSharedData", "SharedData mutex give error"); UtPrintf("End Test Private\n"); } @@ -606,34 +547,42 @@ void Test_CFE_FS_BackgroundFileDump(void) * bool CFE_FS_RunBackgroundFileDump(uint32 ElapsedTime, void *Arg) */ CFE_FS_FileWriteMetaData_t State; - uint32 MyBuffer[2]; - int32 Status; + uint32 MyBuffer[2]; + int32 Status; memset(UT_FS_FileWriteEventCount, 0, sizeof(UT_FS_FileWriteEventCount)); memset(&State, 0, sizeof(State)); memset(&CFE_FS_Global.FileDump, 0, sizeof(CFE_FS_Global.FileDump)); /* Nominal with nothing pending - should accumulate credit */ - UtAssert_True(!CFE_FS_RunBackgroundFileDump(1, NULL), "CFE_FS_RunBackgroundFileDump() nothing pending, short delay"); - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit > 0, "Credit accumulating (%lu)", (unsigned long)CFE_FS_Global.FileDump.Current.Credit); - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit < CFE_FS_BACKGROUND_MAX_CREDIT, "Credit not max (%lu)", (unsigned long)CFE_FS_Global.FileDump.Current.Credit); - - UtAssert_True(!CFE_FS_RunBackgroundFileDump(100000, NULL), "CFE_FS_RunBackgroundFileDump() nothing pending, long delay"); - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit == CFE_FS_BACKGROUND_MAX_CREDIT, "Credit at max (%lu)", (unsigned long)CFE_FS_Global.FileDump.Current.Credit); + UtAssert_True(!CFE_FS_RunBackgroundFileDump(1, NULL), + "CFE_FS_RunBackgroundFileDump() nothing pending, short delay"); + UtAssert_True(CFE_FS_Global.FileDump.Current.Credit > 0, "Credit accumulating (%lu)", + (unsigned long)CFE_FS_Global.FileDump.Current.Credit); + UtAssert_True(CFE_FS_Global.FileDump.Current.Credit < CFE_FS_BACKGROUND_MAX_CREDIT, "Credit not max (%lu)", + (unsigned long)CFE_FS_Global.FileDump.Current.Credit); + + UtAssert_True(!CFE_FS_RunBackgroundFileDump(100000, NULL), + "CFE_FS_RunBackgroundFileDump() nothing pending, long delay"); + UtAssert_True(CFE_FS_Global.FileDump.Current.Credit == CFE_FS_BACKGROUND_MAX_CREDIT, "Credit at max (%lu)", + (unsigned long)CFE_FS_Global.FileDump.Current.Credit); Status = CFE_FS_BackgroundFileDumpRequest(NULL); - UtAssert_True(Status == CFE_FS_BAD_ARGUMENT, "CFE_FS_BackgroundFileDumpRequest(NULL) (%lu) == CFE_FS_BAD_ARGUMENT", (unsigned long)Status); + UtAssert_True(Status == CFE_FS_BAD_ARGUMENT, "CFE_FS_BackgroundFileDumpRequest(NULL) (%lu) == CFE_FS_BAD_ARGUMENT", + (unsigned long)Status); Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_FS_BAD_ARGUMENT, "CFE_FS_BackgroundFileDumpRequest(&State) (%lu) == CFE_FS_BAD_ARGUMENT", (unsigned long)Status); + UtAssert_True(Status == CFE_FS_BAD_ARGUMENT, + "CFE_FS_BackgroundFileDumpRequest(&State) (%lu) == CFE_FS_BAD_ARGUMENT", (unsigned long)Status); UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 0); /* confirm CFE_ES_BackgroundWakeup() was not invoked */ /* Set the data except file name and description */ State.FileSubType = 2; - State.GetData = UT_FS_DataGetter; - State.OnEvent = UT_FS_OnEvent; - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_FS_INVALID_PATH, "CFE_FS_BackgroundFileDumpRequest(&State) (%lu) == CFE_FS_INVALID_PATH", (unsigned long)Status); + State.GetData = UT_FS_DataGetter; + State.OnEvent = UT_FS_OnEvent; + Status = CFE_FS_BackgroundFileDumpRequest(&State); + UtAssert_True(Status == CFE_FS_INVALID_PATH, + "CFE_FS_BackgroundFileDumpRequest(&State) (%lu) == CFE_FS_INVALID_PATH", (unsigned long)Status); UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 0); /* confirm CFE_ES_BackgroundWakeup() was not invoked */ @@ -642,80 +591,99 @@ void Test_CFE_FS_BackgroundFileDump(void) strncpy(State.Description, "UT", sizeof(State.Description)); Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", (unsigned long)Status); + UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", + (unsigned long)Status); UtAssert_True(CFE_FS_BackgroundFileDumpIsPending(&State), "CFE_FS_BackgroundFileDumpIsPending(&State)"); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 1); /* confirm CFE_ES_BackgroundWakeup() was invoked */ - /* - * Set up a fixed data buffer which will be written, + /* + * Set up a fixed data buffer which will be written, * this will write sizeof(MyBuffer) until credit is gone */ MyBuffer[0] = 10; MyBuffer[1] = 20; - UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter),MyBuffer,sizeof(MyBuffer), false); + UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter), MyBuffer, sizeof(MyBuffer), false); UtAssert_True(CFE_FS_RunBackgroundFileDump(1, NULL), "CFE_FS_RunBackgroundFileDump() request pending nominal"); UtAssert_STUB_COUNT(OS_OpenCreate, 1); /* confirm OS_open() was invoked */ - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit <= 0, "Credit exhausted (%lu)", (unsigned long)CFE_FS_Global.FileDump.Current.Credit); + UtAssert_True(CFE_FS_Global.FileDump.Current.Credit <= 0, "Credit exhausted (%lu)", + (unsigned long)CFE_FS_Global.FileDump.Current.Credit); UtAssert_STUB_COUNT(OS_close, 0); /* confirm OS_close() was not invoked */ UT_SetDeferredRetcode(UT_KEY(UT_FS_DataGetter), 2, true); /* return EOF */ UtAssert_True(!CFE_FS_RunBackgroundFileDump(100, NULL), "CFE_FS_RunBackgroundFileDump() request pending EOF"); UtAssert_STUB_COUNT(OS_OpenCreate, 1); /* confirm OS_open() was not invoked again */ - UtAssert_STUB_COUNT(OS_close, 1); /* confirm OS_close() was invoked */ - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); /* request was completed */ + UtAssert_STUB_COUNT(OS_close, 1); /* confirm OS_close() was invoked */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, + CFE_FS_Global.FileDump.RequestCount); /* request was completed */ UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_COMPLETE], 1); /* complete event was sent */ UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); UT_ResetState(UT_KEY(UT_FS_DataGetter)); - /* Error opening file */ Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", (unsigned long)Status); + UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", + (unsigned long)Status); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), "CFE_FS_RunBackgroundFileDump() request pending, file open error"); - UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_CREATE_ERROR], 1); /* create error event was sent */ + UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), + "CFE_FS_RunBackgroundFileDump() request pending, file open error"); + UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_CREATE_ERROR], + 1); /* create error event was sent */ UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); /* request was completed */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, + CFE_FS_Global.FileDump.RequestCount); /* request was completed */ /* Error writing header */ Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", (unsigned long)Status); + UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", + (unsigned long)Status); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, OS_ERROR); - UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), "CFE_FS_RunBackgroundFileDump() request pending, file write header error"); - UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR], 1); /* header error event was sent */ + UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), + "CFE_FS_RunBackgroundFileDump() request pending, file write header error"); + UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR], + 1); /* header error event was sent */ UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); /* request was completed */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, + CFE_FS_Global.FileDump.RequestCount); /* request was completed */ /* Error writing data */ Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", (unsigned long)Status); + UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", + (unsigned long)Status); UT_SetDeferredRetcode(UT_KEY(OS_write), 2, OS_ERROR); - UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter),MyBuffer,sizeof(MyBuffer), false); - UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), "CFE_FS_RunBackgroundFileDump() request pending, file write data error"); - UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR], 1); /* record error event was sent */ + UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter), MyBuffer, sizeof(MyBuffer), false); + UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), + "CFE_FS_RunBackgroundFileDump() request pending, file write data error"); + UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR], + 1); /* record error event was sent */ UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); /* request was completed */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, + CFE_FS_Global.FileDump.RequestCount); /* request was completed */ UT_ResetState(UT_KEY(UT_FS_DataGetter)); /* Request multiple file dumps, check queing logic */ Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", (unsigned long)Status); + UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", + (unsigned long)Status); Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_STATUS_REQUEST_ALREADY_PENDING, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_STATUS_REQUEST_ALREADY_PENDING", (unsigned long)Status); + UtAssert_True(Status == CFE_STATUS_REQUEST_ALREADY_PENDING, + "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_STATUS_REQUEST_ALREADY_PENDING", + (unsigned long)Status); do { State.IsPending = false; /* UT hack to fill queue - Force not pending. Real code should not do this. */ - Status = CFE_FS_BackgroundFileDumpRequest(&State); - } - while (Status == CFE_SUCCESS); - - UtAssert_True(Status == CFE_STATUS_REQUEST_ALREADY_PENDING, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_STATUS_REQUEST_ALREADY_PENDING", (unsigned long)Status); - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.RequestCount, (CFE_FS_Global.FileDump.CompleteCount + CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)); + Status = CFE_FS_BackgroundFileDumpRequest(&State); + } while (Status == CFE_SUCCESS); + + UtAssert_True(Status == CFE_STATUS_REQUEST_ALREADY_PENDING, + "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_STATUS_REQUEST_ALREADY_PENDING", + (unsigned long)Status); + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.RequestCount, + (CFE_FS_Global.FileDump.CompleteCount + CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)); /* Confirm null arg handling in CFE_FS_BackgroundFileDumpIsPending() */ UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(NULL), "!CFE_FS_BackgroundFileDumpIsPending(NULL)"); diff --git a/modules/msg/fsw/inc/ccsds_hdr.h b/modules/msg/fsw/inc/ccsds_hdr.h index efcbc5eb8..1ac46bb2f 100644 --- a/modules/msg/fsw/inc/ccsds_hdr.h +++ b/modules/msg/fsw/inc/ccsds_hdr.h @@ -48,41 +48,43 @@ /** * \brief CCSDS packet primary header */ -typedef struct CCSDS_PrimaryHeader { +typedef struct CCSDS_PrimaryHeader +{ - uint8 StreamId[2]; /**< \brief packet identifier word (stream ID) */ - /* bits shift ------------ description ---------------- */ - /* 0x07FF 0 : application ID */ - /* 0x0800 11 : secondary header: 0 = absent, 1 = present */ - /* 0x1000 12 : packet type: 0 = TLM, 1 = CMD */ - /* 0xE000 13 : CCSDS version: 0 = ver 1, 1 = ver 2 */ + uint8 StreamId[2]; /**< \brief packet identifier word (stream ID) */ + /* bits shift ------------ description ---------------- */ + /* 0x07FF 0 : application ID */ + /* 0x0800 11 : secondary header: 0 = absent, 1 = present */ + /* 0x1000 12 : packet type: 0 = TLM, 1 = CMD */ + /* 0xE000 13 : CCSDS version: 0 = ver 1, 1 = ver 2 */ - uint8 Sequence[2]; /**< \brief packet sequence word */ - /* bits shift ------------ description ---------------- */ - /* 0x3FFF 0 : sequence count */ - /* 0xC000 14 : segmentation flags: 3 = complete packet */ + uint8 Sequence[2]; /**< \brief packet sequence word */ + /* bits shift ------------ description ---------------- */ + /* 0x3FFF 0 : sequence count */ + /* 0xC000 14 : segmentation flags: 3 = complete packet */ - uint8 Length[2]; /**< \brief packet length word */ - /* bits shift ------------ description ---------------- */ - /* 0xFFFF 0 : (total packet length) - 7 */ + uint8 Length[2]; /**< \brief packet length word */ + /* bits shift ------------ description ---------------- */ + /* 0xFFFF 0 : (total packet length) - 7 */ } CCSDS_PrimaryHeader_t; /** * \brief CCSDS packet extended header */ -typedef struct CCSDS_ExtendedHeader { - - uint8 Subsystem[2]; /**< \brief subsystem qualifier */ - /* bits shift ------------ description ---------------- */ - /* 0x01FF 0 : Subsystem Id mission defined */ - /* 0x0200 9 : Playback flag 0 = original, 1 = playback */ - /* 0x0400 10 : Endian: Big = 0, Little (Intel) = 1 */ - /* 0xF800 11 : EDS Version for packet definition used */ - - uint8 SystemId[2]; /**< \brief system qualifier */ - /* 0xFFFF 0 : System Id mission defined */ +typedef struct CCSDS_ExtendedHeader +{ + + uint8 Subsystem[2]; /**< \brief subsystem qualifier */ + /* bits shift ------------ description ---------------- */ + /* 0x01FF 0 : Subsystem Id mission defined */ + /* 0x0200 9 : Playback flag 0 = original, 1 = playback */ + /* 0x0400 10 : Endian: Big = 0, Little (Intel) = 1 */ + /* 0xF800 11 : EDS Version for packet definition used */ + + uint8 SystemId[2]; /**< \brief system qualifier */ + /* 0xFFFF 0 : System Id mission defined */ } CCSDS_ExtendedHeader_t; -#endif /* _ccsds_hdr_ */ +#endif /* _ccsds_hdr_ */ diff --git a/modules/msg/option_inc/default_cfe_msg_hdr_pri.h b/modules/msg/option_inc/default_cfe_msg_hdr_pri.h index f51260b4a..28958a283 100644 --- a/modules/msg/option_inc/default_cfe_msg_hdr_pri.h +++ b/modules/msg/option_inc/default_cfe_msg_hdr_pri.h @@ -57,7 +57,7 @@ typedef struct /** * \brief cFS generic base message - * + * * This provides the definition of CFE_MSG_Message_t */ union CFE_MSG_Message @@ -68,7 +68,7 @@ union CFE_MSG_Message /** * \brief cFS command header - * + * * This provides the definition of CFE_MSG_CommandHeader_t */ struct CFE_MSG_CommandHeader @@ -79,13 +79,13 @@ struct CFE_MSG_CommandHeader /** * \brief cFS telemetry header - * + * * This provides the definition of CFE_MSG_TelemetryHeader_t */ struct CFE_MSG_TelemetryHeader { - CFE_MSG_Message_t Msg; /**< \brief Base message */ - CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */ + CFE_MSG_Message_t Msg; /**< \brief Base message */ + CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */ uint8 Spare[4]; /**< \brief Padding to end on 64 bit boundary */ }; diff --git a/modules/msg/option_inc/default_cfe_msg_hdr_priext.h b/modules/msg/option_inc/default_cfe_msg_hdr_priext.h index 36d9dccbe..f756a8a03 100644 --- a/modules/msg/option_inc/default_cfe_msg_hdr_priext.h +++ b/modules/msg/option_inc/default_cfe_msg_hdr_priext.h @@ -70,8 +70,8 @@ typedef union typedef struct { - CFE_MSG_Message_t Msg; /**< \brief Base message */ - CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */ + CFE_MSG_Message_t Msg; /**< \brief Base message */ + CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */ uint8 Spare[4]; /**< /brief Padding to end on 64 bit boundary */ } CFE_MSG_CommandHeader_t; diff --git a/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c b/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c index f7eaed5b4..3d56ec17f 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c +++ b/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c @@ -131,7 +131,6 @@ void Test_MSG_Init_Ext(void) /* Confirm the rest of the fields not already explicitly checked */ ASSERT_EQ(Test_MSG_Ext_NotZero(&msg) & ~(MSG_EDSVER_FLAG | MSG_ENDIAN_FLAG | MSG_SUBSYS_FLAG | MSG_SYSTEM_FLAG), 0); - } void Test_MSG_EDSVersion(void) diff --git a/modules/msg/ut-coverage/test_cfe_msg_checksum.c b/modules/msg/ut-coverage/test_cfe_msg_checksum.c index c1b3b98eb..c092ecf41 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_checksum.c +++ b/modules/msg/ut-coverage/test_cfe_msg_checksum.c @@ -37,7 +37,7 @@ void Test_MSG_Checksum(void) { CFE_MSG_CommandHeader_t cmd; - CFE_MSG_Message_t *msgptr = &cmd.Msg; + CFE_MSG_Message_t * msgptr = &cmd.Msg; bool actual; UtPrintf("Bad parameter tests, Null pointers"); diff --git a/modules/msg/ut-coverage/test_cfe_msg_fc.c b/modules/msg/ut-coverage/test_cfe_msg_fc.c index 88a907a68..8826b175a 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_fc.c +++ b/modules/msg/ut-coverage/test_cfe_msg_fc.c @@ -42,7 +42,7 @@ void Test_MSG_FcnCode(void) { CFE_MSG_CommandHeader_t cmd; - CFE_MSG_Message_t *msgptr = &cmd.Msg; + 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; diff --git a/modules/msg/ut-coverage/test_cfe_msg_init.c b/modules/msg/ut-coverage/test_cfe_msg_init.c index ef2353017..239b78fd2 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_init.c +++ b/modules/msg/ut-coverage/test_cfe_msg_init.c @@ -123,6 +123,6 @@ void Test_MSG_Init(void) ASSERT_EQ(hdrver, 0); } - 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); + 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/ut-coverage/test_cfe_msg_time.c b/modules/msg/ut-coverage/test_cfe_msg_time.c index c72eab80c..680b1e02e 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_time.c +++ b/modules/msg/ut-coverage/test_cfe_msg_time.c @@ -37,7 +37,7 @@ void Test_MSG_Time(void) { CFE_MSG_TelemetryHeader_t tlm; - CFE_MSG_Message_t *msgptr = &tlm.Msg; + 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; diff --git a/modules/resourceid/fsw/src/cfe_resourceid_api.c b/modules/resourceid/fsw/src/cfe_resourceid_api.c index 531976151..e9f2ccae9 100644 --- a/modules/resourceid/fsw/src/cfe_resourceid_api.c +++ b/modules/resourceid/fsw/src/cfe_resourceid_api.c @@ -41,7 +41,6 @@ #include "cfe_resourceid.h" #include "cfe_resourceid_basevalue.h" - /*********************************************************************/ /* * CFE_ResourceId_GetBase @@ -64,7 +63,6 @@ uint32 CFE_ResourceId_GetSerial(CFE_ResourceId_t ResourceId) return (CFE_ResourceId_ToInteger(ResourceId) & ((uint32)CFE_RESOURCEID_MAX)); } - /*********************************************************************/ /* * CFE_ResourceId_ToIndex @@ -97,7 +95,8 @@ int32 CFE_ResourceId_ToIndex(CFE_ResourceId_t Id, uint32 BaseValue, uint32 Table * * For complete API information, see prototype in header */ -CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableSize, bool (*CheckFunc)(CFE_ResourceId_t)) +CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableSize, + bool (*CheckFunc)(CFE_ResourceId_t)) { uint32 Serial; uint32 Count; diff --git a/modules/resourceid/option_inc/cfe_resourceid_osal_compatible.h b/modules/resourceid/option_inc/cfe_resourceid_osal_compatible.h index 822dea588..77d7eefee 100644 --- a/modules/resourceid/option_inc/cfe_resourceid_osal_compatible.h +++ b/modules/resourceid/option_inc/cfe_resourceid_osal_compatible.h @@ -66,7 +66,6 @@ #define CFE_RESOURCEID_SHIFT OS_OBJECT_TYPE_SHIFT #define CFE_RESOURCEID_MAX OS_OBJECT_INDEX_MASK - /** * @brief A macro to generate a CFE resource ID base value from an offset * @@ -75,5 +74,4 @@ */ #define CFE_RESOURCEID_MAKE_BASE(offset) (CFE_RESOURCEID_MARK | ((offset) << CFE_RESOURCEID_SHIFT)) - #endif /* CFE_RESOURCEID_OSAL_COMPATIBLE_H */ diff --git a/modules/resourceid/option_inc/cfe_resourceid_simple.h b/modules/resourceid/option_inc/cfe_resourceid_simple.h index e92c31d9b..8a4e05607 100644 --- a/modules/resourceid/option_inc/cfe_resourceid_simple.h +++ b/modules/resourceid/option_inc/cfe_resourceid_simple.h @@ -23,7 +23,6 @@ #include "common_types.h" - /** * @brief A type that provides a common, abstract identifier for * all ES managed resources (e.g. apps, tasks, counters, etc). @@ -41,7 +40,6 @@ typedef uint32 CFE_ResourceId_t; */ #define CFE_RESOURCEID_BASE_TYPE CFE_ResourceId_t - /** * @brief A fixed bit that will be set in all CFE resource ID values * @@ -51,7 +49,6 @@ typedef uint32 CFE_ResourceId_t; */ #define CFE_RESOURCEID_MARK 0 - /* * Wrap/Unwrap macros. * diff --git a/modules/resourceid/option_inc/cfe_resourceid_strict.h b/modules/resourceid/option_inc/cfe_resourceid_strict.h index b47185f39..ca2d9bf2b 100644 --- a/modules/resourceid/option_inc/cfe_resourceid_strict.h +++ b/modules/resourceid/option_inc/cfe_resourceid_strict.h @@ -61,7 +61,6 @@ typedef struct CFE_ResourceId_t id; \ } - /** * @brief A fixed bit that should be set in all CFE resource ID values * @@ -71,7 +70,6 @@ typedef struct */ #define CFE_RESOURCEID_MARK 0x02000000 - /* * Wrap/Unwrap macros. * @@ -80,8 +78,10 @@ typedef struct * These are not type-safe - Whenever possible applications should use * the type-safe inline functions provided in cfe_resourceid.h instead. */ -#define CFE_RESOURCEID_WRAP(x) {x} +#define CFE_RESOURCEID_WRAP(x) \ + { \ + x \ + } #define CFE_RESOURCEID_UNWRAP(x) (x).id - #endif /* CFE_RESOURCEID_STRICT_H */ diff --git a/modules/resourceid/ut-coverage/test_cfe_resourceid.c b/modules/resourceid/ut-coverage/test_cfe_resourceid.c index 16b562dab..21f52ba58 100644 --- a/modules/resourceid/ut-coverage/test_cfe_resourceid.c +++ b/modules/resourceid/ut-coverage/test_cfe_resourceid.c @@ -36,7 +36,6 @@ static bool UT_ResourceId_CheckIdSlotUsed(CFE_ResourceId_t Id) return UT_DEFAULT_IMPL(UT_ResourceId_CheckIdSlotUsed) != 0; } - void TestResourceID(void) { /* @@ -130,7 +129,8 @@ void TestResourceID(void) /* Now verify that CFE_ResourceId_FindNext() recycles the first item again */ Id = CFE_ResourceId_FindNext(LastId, UT_RESOURCEID_TEST_SLOTS, UT_ResourceId_CheckIdSlotUsed); UtAssert_True(CFE_ResourceId_IsDefined(Id), "CFE_ResourceId_FindNext() after wrap"); - UtAssert_True(CFE_ResourceId_ToInteger(Id) < (RefBase + UT_RESOURCEID_TEST_SLOTS), "CFE_ResourceId_FindNext() wrap ID"); + UtAssert_True(CFE_ResourceId_ToInteger(Id) < (RefBase + UT_RESOURCEID_TEST_SLOTS), + "CFE_ResourceId_FindNext() wrap ID"); /* * Confirm outputs are as expected after wrapping around - @@ -143,9 +143,8 @@ void TestResourceID(void) CFE_ResourceId_ToInteger(Id), (unsigned long)RefSerial, (unsigned long)TestSerial); UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, RefBase, UT_RESOURCEID_TEST_SLOTS, &TestIndex), CFE_SUCCESS); - UtAssert_True(TestIndex == RefIndex, "ID index after wrap: id=%lx, expected=%lu, got=%lu", CFE_ResourceId_ToInteger(Id), - (unsigned long)RefIndex, (unsigned long)TestIndex); - + UtAssert_True(TestIndex == RefIndex, "ID index after wrap: id=%lx, expected=%lu, got=%lu", + CFE_ResourceId_ToInteger(Id), (unsigned long)RefIndex, (unsigned long)TestIndex); /* * Now check that CFE_ResourceId_FindNext() adheres to the CheckFunc. @@ -161,9 +160,8 @@ void TestResourceID(void) UtAssert_True(TestSerial == RefSerial, "ID serial after search: id=%lx, previous=%lx, got=%lx", CFE_ResourceId_ToInteger(Id), (unsigned long)RefSerial, (unsigned long)TestSerial); UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, RefBase, UT_RESOURCEID_TEST_SLOTS, &TestIndex), CFE_SUCCESS); - UtAssert_True(TestIndex == RefIndex, "ID index after search: id=%lx, expected=%lu, got=%lu", CFE_ResourceId_ToInteger(Id), - (unsigned long)RefIndex, (unsigned long)TestIndex); - + UtAssert_True(TestIndex == RefIndex, "ID index after search: id=%lx, expected=%lu, got=%lu", + CFE_ResourceId_ToInteger(Id), (unsigned long)RefIndex, (unsigned long)TestIndex); /* Validate off-nominal inputs */ Id = CFE_ResourceId_FindNext(CFE_RESOURCEID_UNDEFINED, 0, NULL); diff --git a/modules/sb/fsw/inc/cfe_sb_events.h b/modules/sb/fsw/inc/cfe_sb_events.h index a9669fb83..dfeaf466f 100644 --- a/modules/sb/fsw/inc/cfe_sb_events.h +++ b/modules/sb/fsw/inc/cfe_sb_events.h @@ -40,7 +40,7 @@ ** and when you're done adding, set this to the highest EID you used. It may ** be worthwhile to, on occasion, re-number the EID's to put them back in order. */ -#define CFE_SB_MAX_EID 67 +#define CFE_SB_MAX_EID 67 /* ** SB task event message ID's. @@ -59,7 +59,7 @@ ** This event message is issued when the Software Bus Task completes its ** initialization. **/ -#define CFE_SB_INIT_EID 1 +#define CFE_SB_INIT_EID 1 /** \brief 'CreatePipeErr:Bad Input Arg:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' ** \event 'CreatePipeErr:Bad Input Arg:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' @@ -72,7 +72,7 @@ ** argument. In this case, a bad argument is defined by the following: ** A NULL PipeIdPtr, PipeDepth = 0 and PipeDepth > maximum pipe depth **/ -#define CFE_SB_CR_PIPE_BAD_ARG_EID 2 +#define CFE_SB_CR_PIPE_BAD_ARG_EID 2 /** \brief 'CreatePipeErr:Max Pipes(\%d)In Use.app \%s' ** \event 'CreatePipeErr:Max Pipes(\%d)In Use.app \%s' @@ -84,8 +84,7 @@ ** This error event message is issued when the #CFE_SB_CreatePipe API is called and ** the maximum number of pipes (defined by cfg param #CFE_PLATFORM_SB_MAX_PIPES) are in use. **/ -#define CFE_SB_MAX_PIPES_MET_EID 3 - +#define CFE_SB_MAX_PIPES_MET_EID 3 /** \brief 'CreatePipeErr:OS_QueueCreate returned \%d,app \%s' ** \event 'CreatePipeErr:OS_QueueCreate returned \%d,app \%s' @@ -99,7 +98,7 @@ ** The error status returned by the OS is displayed in the event. Most commonly, ** this event is displayed as a result of trying to create pipes with the same name. **/ -#define CFE_SB_CR_PIPE_ERR_EID 4 +#define CFE_SB_CR_PIPE_ERR_EID 4 /** \brief 'Pipe Created:name \%s,id \%d,app \%s' ** \event 'Pipe Created:name \%s,id \%d,app \%s' @@ -111,7 +110,7 @@ ** This debug event message is issued when a pipe was successfully created in the ** #CFE_SB_CreatePipe API. **/ -#define CFE_SB_PIPE_ADDED_EID 5 +#define CFE_SB_PIPE_ADDED_EID 5 /** \brief 'SetPipeOptsErr:Invalid pipe id (\%d).app \%s' ** \event 'SetPipeOptsErr:Invalid pipe id (\%d).app \%s' @@ -123,7 +122,7 @@ ** This error event message is issued when the #CFE_SB_SetPipeOpts API is called and ** the PipeID is invalid. **/ -#define CFE_SB_SETPIPEOPTS_ID_ERR_EID 55 +#define CFE_SB_SETPIPEOPTS_ID_ERR_EID 55 /** \brief 'SetPipeOptsErr:Caller not owner (\%d).app \%s' ** \event 'SetPipeOptsErr:Caller not owner (\%d).app \%s' @@ -135,7 +134,7 @@ ** This error event message is issued when the #CFE_SB_SetPipeOpts API is called and ** the pipe is owned by another app ID. **/ -#define CFE_SB_SETPIPEOPTS_OWNER_ERR_EID 56 +#define CFE_SB_SETPIPEOPTS_OWNER_ERR_EID 56 /** \brief 'SetPipeOpts: Options set (\%d). app \%s' ** \event 'SetPipeOpts: Options set (\%d). app \%s' @@ -146,7 +145,7 @@ ** ** This debug event is generated when options are set. **/ -#define CFE_SB_SETPIPEOPTS_EID 57 +#define CFE_SB_SETPIPEOPTS_EID 57 /** \brief 'GetPipeOptsErr:Invalid pipe id (\%d).app \%s' ** \event 'GetPipeOptsErr:Invalid pipe id (\%d).app \%s' @@ -158,7 +157,7 @@ ** This error event message is issued when the #CFE_SB_GetPipeOpts API is called and ** the PipeID is invalid. **/ -#define CFE_SB_GETPIPEOPTS_ID_ERR_EID 58 +#define CFE_SB_GETPIPEOPTS_ID_ERR_EID 58 /** \brief 'GetPipeOptsErr:Invalid opts ptr.app \%s' ** \event 'GetPipeOptsErr:Invalid opts ptr.app \%s' @@ -170,7 +169,7 @@ ** This error event message is issued when the #CFE_SB_GetPipeOpts API is called and ** the pointer is invalid. **/ -#define CFE_SB_GETPIPEOPTS_PTR_ERR_EID 59 +#define CFE_SB_GETPIPEOPTS_PTR_ERR_EID 59 /** \brief 'GetPipeOpts: Options retrieved. app \%s' ** \event 'GetPipeOpts: Options retrieved. app \%s' @@ -181,7 +180,7 @@ ** ** This debug event is generated when options are retrieved. **/ -#define CFE_SB_GETPIPEOPTS_EID 60 +#define CFE_SB_GETPIPEOPTS_EID 60 /** \brief 'GetPipeName: Name retrieved. NameOut \%s,Id \%d, app \%s' ** \event 'GetPipeName: Name retrieved. NameOut \%s,Id \%d, app \%s' @@ -192,7 +191,7 @@ ** ** This debug event is generated when name is retrieved by id. **/ -#define CFE_SB_GETPIPENAME_EID 62 +#define CFE_SB_GETPIPENAME_EID 62 /** \brief 'GetPipeName: Null ptr error. Id \%d, app \%s' ** \event 'GetPipeName: Null ptr error. Id \%d, app \%s' @@ -203,7 +202,7 @@ ** ** This debug event is generated when the name buffer ptr is null. **/ -#define CFE_SB_GETPIPENAME_NULL_PTR_EID 63 +#define CFE_SB_GETPIPENAME_NULL_PTR_EID 63 /** \brief 'GetPipeName: Id error. NameOut \%s,Id \%d, app \%s' ** \event 'GetPipeName: Id error. NameOut \%s,Id \%d, app \%s' @@ -214,7 +213,7 @@ ** ** This debug event is generated when name is retrieved by id. **/ -#define CFE_SB_GETPIPENAME_ID_ERR_EID 64 +#define CFE_SB_GETPIPENAME_ID_ERR_EID 64 /** \brief 'GetPipeIdByName: ID retrieved. Name \%s,IdOut 0x\%x, app \%s' ** \event 'GetPipeIdByName: ID retrieved. Name \%s,IdOut 0x\%x, app \%s' @@ -225,7 +224,7 @@ ** ** This debug event is generated when id is retrieved by name. **/ -#define CFE_SB_GETPIPEIDBYNAME_EID 65 +#define CFE_SB_GETPIPEIDBYNAME_EID 65 /** \brief 'GetPipeIdByName Err:Bad input argument,Name 0x\%x,IdOut 0x%x,App \%s' ** \event 'GetPipeIdByName Err:Bad input argument,Name 0x\%x,IdOut 0x%x,App \%s' @@ -237,7 +236,7 @@ ** This error event message is issued when the #CFE_SB_GetPipeIdByName API receives a ** NULL ptr as an argument. **/ -#define CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID 66 +#define CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID 66 /** \brief 'GetPipeIdByName Err:Name not found,Name \%s,IdOut 0x%x,App \%s' ** \event 'GetPipeIdByName Err:Name not found,Name \%s,IdOut 0x%x,App \%s' @@ -249,7 +248,7 @@ ** This error event message is issued when the #CFE_SB_GetPipeIdByName API receives an ** invalid name. **/ -#define CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID 67 +#define CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID 67 /** \brief 'Subscribe Err:Bad Arg,MsgId 0x\%x,PipeId \%d,app \%s,scope \%d' ** \event 'Subscribe Err:Bad Arg,MsgId 0x\%x,PipeId \%d,app \%s,scope \%d' @@ -263,7 +262,7 @@ ** cfg param #CFE_PLATFORM_SB_HIGHEST_VALID_MSGID. ** **/ -#define CFE_SB_SUB_ARG_ERR_EID 6 +#define CFE_SB_SUB_ARG_ERR_EID 6 /** \brief 'Duplicate Subscription,MsgId 0x\%x on \%s pipe,app \%s' ** \event 'Duplicate Subscription,MsgId 0x\%x on \%s pipe,app \%s' @@ -281,7 +280,7 @@ ** event id will be filtered. A command must be sent to unfilter this event if ** the user desires to see it. **/ -#define CFE_SB_DUP_SUBSCRIP_EID 7 +#define CFE_SB_DUP_SUBSCRIP_EID 7 /** \brief 'Subscribe Err:Max Msgs(\%d)In Use,MsgId 0x\%x,pipe \%s,app \%s' ** \event 'Subscribe Err:Max Msgs(\%d)In Use,MsgId 0x\%x,pipe \%s,app \%s' @@ -298,7 +297,7 @@ ** table utilization figures (msgids currently in use, high water mark and max ** allowed) by sending the SB cmd to dump the SB statistics data. **/ -#define CFE_SB_MAX_MSGS_MET_EID 8 +#define CFE_SB_MAX_MSGS_MET_EID 8 /** \brief 'Subscribe Err:Max Dests(\%d)In Use For Msg 0x\%x,pipe \%s,app \%s' ** \event 'Subscribe Err:Max Dests(\%d)In Use For Msg 0x\%x,pipe \%s,app \%s' @@ -312,7 +311,7 @@ ** is a configuration parameter named #CFE_PLATFORM_SB_MAX_DEST_PER_PKT. A destination is ** defined as a pipe. **/ -#define CFE_SB_MAX_DESTS_MET_EID 9 +#define CFE_SB_MAX_DESTS_MET_EID 9 /** \brief 'Subscription Rcvd:MsgId 0x\%x on \%s(\%d),app \%s' ** \event 'Subscription Rcvd:MsgId 0x\%x on \%s(\%d),app \%s' @@ -324,7 +323,7 @@ ** This debug event message is issued when a subscription is successfully made ** through one of the SB Subscribe API's **/ -#define CFE_SB_SUBSCRIPTION_RCVD_EID 10 +#define CFE_SB_SUBSCRIPTION_RCVD_EID 10 /** \brief 'UnSubscribe Err:Bad Arg,MsgId 0x\%x,PipeId \%d,app \%s,scope \%d' ** \event 'UnSubscribe Err:Bad Arg,MsgId 0x\%x,PipeId \%d,app \%s,scope \%d' @@ -339,7 +338,7 @@ ** been created and have a value less than cfg param #CFE_PLATFORM_SB_MAX_PIPES. The SB pipe ** table may be viewed to verify its value or existence. **/ -#define CFE_SB_UNSUB_ARG_ERR_EID 11 +#define CFE_SB_UNSUB_ARG_ERR_EID 11 /** \brief 'Unsubscribe Err:No subs for Msg 0x\%x on \%s,app \%s' ** \event 'Unsubscribe Err:No subs for Msg 0x\%x on \%s,app \%s' @@ -352,7 +351,7 @@ ** a non existent msgid/pipeid combination in the SB routing table. The SB routing ** table may be viewed to see a list of valid msgid/pipeid combinations. **/ -#define CFE_SB_UNSUB_NO_SUBS_EID 12 +#define CFE_SB_UNSUB_NO_SUBS_EID 12 /** \brief 'Send Err:Bad input argument,Arg 0x\%x,App \%s' ** \event 'Send Err:Bad input argument,Arg 0x\%x,App \%s' @@ -364,7 +363,7 @@ ** 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 +#define CFE_SB_SEND_BAD_ARG_EID 13 /** \brief 'No subscribers for MsgId 0x\%x,sender \%s' ** \event 'No subscribers for MsgId 0x\%x,sender \%s' @@ -382,7 +381,7 @@ ** event id will be filtered. A command must be sent to unfilter this event if ** the user desires to see it. **/ -#define CFE_SB_SEND_NO_SUBS_EID 14 +#define CFE_SB_SEND_NO_SUBS_EID 14 /** \brief 'Send Err:Msg Too Big MsgId=0x\%x,app=\%s,size=\%d,MaxSz=\%d' ** \event 'Send Err:Msg Too Big MsgId=0x\%x,app=\%s,size=\%d,MaxSz=\%d' @@ -396,7 +395,7 @@ ** 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. **/ -#define CFE_SB_MSG_TOO_BIG_EID 15 +#define CFE_SB_MSG_TOO_BIG_EID 15 /** \brief 'Send Err:Request for Buffer Failed. MsgId 0x\%x,app \%s,size \%d' ** \event 'Send Err:Request for Buffer Failed. MsgId 0x\%x,app \%s,size \%d' @@ -410,7 +409,7 @@ ** 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. **/ -#define CFE_SB_GET_BUF_ERR_EID 16 +#define CFE_SB_GET_BUF_ERR_EID 16 /** \brief 'Send Err:Msg Limit Err MsgId 0x\%x,pipe \%s,sender \%s' ** \event 'Send Err:Msg Limit Err MsgId 0x\%x,pipe \%s,sender \%s' @@ -429,7 +428,7 @@ ** the #CFE_SB_SubscribeEx API or uses the default value of 4 if using the ** #CFE_SB_Subscribe API. **/ -#define CFE_SB_MSGID_LIM_ERR_EID 17 +#define CFE_SB_MSGID_LIM_ERR_EID 17 /** \brief 'Rcv Err:Bad Input Arg:BufPtr 0x\%x,pipe \%d,t/o \%d,app \%s' ** \event 'Rcv Err:Bad Input Arg:BufPtr 0x\%x,pipe \%d,t/o \%d,app \%s' @@ -442,7 +441,7 @@ ** #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 +#define CFE_SB_RCV_BAD_ARG_EID 18 /** \brief 'Rcv Err:PipeId \%d does not exist,app \%s' ** \event 'Rcv Err:PipeId \%d does not exist,app \%s' @@ -455,8 +454,7 @@ ** #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 - +#define CFE_SB_BAD_PIPEID_EID 19 /** \brief 'Subscribe Err:Request for Destination Blk failed for Msg 0x\%x,Pipe \%s' ** \event 'Subscribe Err:Request for Destination Blk failed for Msg 0x\%x,Pipe \%s' @@ -467,10 +465,9 @@ ** ** This error event message is issued when the SB receives an error from the memory ** pool in the attempt to obtain a new destination block. Then memory pool statistics -** may be viewed by sending the related ES command. +** may be viewed by sending the related ES command. **/ -#define CFE_SB_DEST_BLK_ERR_EID 20 - +#define CFE_SB_DEST_BLK_ERR_EID 20 /** \brief 'Send Err:Invalid msgid in msg,MsgId 0x\%x,App \%s' ** \event 'Send Err:Invalid msgid in msg,MsgId 0x\%x,App \%s' @@ -483,7 +480,7 @@ ** 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 **/ -#define CFE_SB_SEND_INV_MSGID_EID 21 +#define CFE_SB_SEND_INV_MSGID_EID 21 /** \brief 'Sending Subscription Report Msg=0x\%x,Pipe=\%d,Stat=0x\%x' ** \event 'Sending Subscription Report Msg=0x\%x,Pipe=\%d,Stat=0x\%x' @@ -495,7 +492,7 @@ ** This debug event message is issued when SB subscription reporting is enabled, ** (which is disabled by default) and a subscription is successfully received. **/ -#define CFE_SB_SUBSCRIPTION_RPT_EID 22 +#define CFE_SB_SUBSCRIPTION_RPT_EID 22 /** \brief 'Msg hash collision: MsgId = 0x\%x, collisions = \%u' ** \event 'Msg hash collision: MsgId = 0x\%x, collisions = \%u' @@ -510,7 +507,7 @@ ** Number of collisions will directly impact software bus performance. These can be resolved ** by adjusting MsgId values or increasing CFE_PLATFORM_SB_MAX_MSG_IDS. **/ -#define CFE_SB_HASHCOLLISION_EID 23 +#define CFE_SB_HASHCOLLISION_EID 23 /** \brief 'Pipe Overflow,MsgId 0x\%x,pipe \%s,stat 0x\%x,app \%s' ** \event 'Pipe Overflow,MsgId 0x\%x,pipe \%s,stat 0x\%x,app \%s' @@ -526,7 +523,7 @@ ** pipe depth is not deep enough. The pipe depth is an input parameter to the ** #CFE_SB_CreatePipe API. **/ -#define CFE_SB_Q_FULL_ERR_EID 25 +#define CFE_SB_Q_FULL_ERR_EID 25 /** \brief 'Pipe Write Err,MsgId 0x\%x,pipe \%s,stat 0x\%x,app \%s' ** \event 'Pipe Write Err,MsgId 0x\%x,pipe \%s,stat 0x\%x,app \%s' @@ -542,7 +539,7 @@ ** more information, the user may look up the return code in the OSAL documention or ** source code. **/ -#define CFE_SB_Q_WR_ERR_EID 26 +#define CFE_SB_Q_WR_ERR_EID 26 /** \brief 'Pipe Read Err,pipe \%s,app \%s,stat 0x\%x' ** \event 'Pipe Read Err,pipe \%s,app \%s,stat 0x\%x' @@ -558,7 +555,7 @@ ** more information, the user may look up the return code in the OSAL documention or ** source code. **/ -#define CFE_SB_Q_RD_ERR_EID 27 +#define CFE_SB_Q_RD_ERR_EID 27 /** \brief 'No-op Cmd Rcvd' ** \event 'No-op Cmd Rcvd' @@ -569,7 +566,7 @@ ** ** This info event message is issued in response an SB NO-OP command **/ -#define CFE_SB_CMD0_RCVD_EID 28 +#define CFE_SB_CMD0_RCVD_EID 28 /** \brief 'Reset Counters Cmd Rcvd' ** \event 'Reset Counters Cmd Rcvd' @@ -580,8 +577,7 @@ ** ** This debug event message is issued in response an SB Reset Counters command **/ -#define CFE_SB_CMD1_RCVD_EID 29 - +#define CFE_SB_CMD1_RCVD_EID 29 /** \brief 'Software Bus Statistics packet sent' ** \event 'Software Bus Statistics packet sent' @@ -593,7 +589,7 @@ ** This debug event message is issued when SB receives a cmd to send the SB ** statistics pkt. **/ -#define CFE_SB_SND_STATS_EID 32 +#define CFE_SB_SND_STATS_EID 32 /** \brief 'Enbl Route Cmd:Route does not exist.Msg 0x\%x,Pipe \%d' ** \event 'Enbl Route Cmd:Route does not exist.Msg 0x\%x,Pipe \%d' @@ -605,7 +601,7 @@ ** This error event message is issued when SB receives a cmd to enable a route that ** does not exist in the routing table. A route is defined by a MsgId, PipeId pair. **/ -#define CFE_SB_ENBL_RTE1_EID 33 +#define CFE_SB_ENBL_RTE1_EID 33 /** \brief 'Enabling Route,Msg 0x\%x,Pipe \%d' ** \event 'Enabling Route,Msg 0x\%x,Pipe \%d' @@ -617,7 +613,7 @@ ** This debug event message is issued when SB receives a cmd to enable a route and ** the request is successfully executed. **/ -#define CFE_SB_ENBL_RTE2_EID 34 +#define CFE_SB_ENBL_RTE2_EID 34 /** \brief 'Enbl Route Cmd:Invalid Param.Msg 0x\%x,Pipe \%d' ** \event 'Enbl Route Cmd:Invalid Param.Msg 0x\%x,Pipe \%d' @@ -632,7 +628,7 @@ ** cfg param #CFE_PLATFORM_SB_MAX_PIPES. The SB pipe table may be viewed to verify the PipeId ** existence. **/ -#define CFE_SB_ENBL_RTE3_EID 35 +#define CFE_SB_ENBL_RTE3_EID 35 /** \brief 'Disable Route Cmd:Route does not exist,Msg 0x\%x,Pipe \%d' ** \event 'Disable Route Cmd:Route does not exist,Msg 0x\%x,Pipe \%d' @@ -644,7 +640,7 @@ ** This error event message is issued when SB receives a cmd to disable a route that ** does not exist in the routing table. A route is defined by a MsgId, PipeId pair. **/ -#define CFE_SB_DSBL_RTE1_EID 36 +#define CFE_SB_DSBL_RTE1_EID 36 /** \brief 'Route Disabled,Msg 0x\%x,Pipe \%d' ** \event 'Route Disabled,Msg 0x\%x,Pipe \%d' @@ -656,7 +652,7 @@ ** This debug event message is issued when SB receives a cmd to disable a route and ** the request is successfully executed. **/ -#define CFE_SB_DSBL_RTE2_EID 37 +#define CFE_SB_DSBL_RTE2_EID 37 /** \brief 'Disable Route Cmd:Invalid Param.Msg 0x\%x,Pipe \%d' ** \event 'Disable Route Cmd:Invalid Param.Msg 0x\%x,Pipe \%d' @@ -671,7 +667,7 @@ ** cfg param #CFE_PLATFORM_SB_MAX_PIPES. The SB pipe table may be viewed to verify the PipeId ** existence. **/ -#define CFE_SB_DSBL_RTE3_EID 38 +#define CFE_SB_DSBL_RTE3_EID 38 /** \brief '\%s written:Size=\%d,Entries=\%d' ** \event '\%s written:Size=\%d,Entries=\%d' @@ -680,13 +676,12 @@ ** ** \par Cause: ** -** This debug event message is issued after the SB routing info file, pipe info -** file or the map info file is written and closed. This is done is response to -** the SB 'Send Routing Info' cmd, the SB 'Send pipe Info' cmd or the SB 'Send +** This debug event message is issued after the SB routing info file, pipe info +** file or the map info file is written and closed. This is done is response to +** the SB 'Send Routing Info' cmd, the SB 'Send pipe Info' cmd or the SB 'Send ** Map Info' cmd, respectively. **/ -#define CFE_SB_SND_RTG_EID 39 - +#define CFE_SB_SND_RTG_EID 39 /** \brief 'Error creating file \%s, stat=0x\%x' ** \event 'Error creating file \%s, stat=0x\%x' @@ -699,7 +694,7 @@ ** received and the file create fails. The event displays the status received from ** the OS. **/ -#define CFE_SB_SND_RTG_ERR1_EID 40 +#define CFE_SB_SND_RTG_ERR1_EID 40 /** \brief 'Invalid Cmd, Unexpected Command Code \%d' ** \event 'Invalid Cmd, Unexpected Command Code \%d' @@ -711,7 +706,7 @@ ** This error event message is issued when the SB receives a cmd that has an ** unexpected cmd code. **/ -#define CFE_SB_BAD_CMD_CODE_EID 42 +#define CFE_SB_BAD_CMD_CODE_EID 42 /** \brief 'Invalid Cmd, Unexpected Msg Id: 0x\%x' ** \event 'Invalid Cmd, Unexpected Msg Id: 0x\%x' @@ -723,8 +718,7 @@ ** This error event message is issued when the SB receives a msg that has an ** unexpected msg id. **/ -#define CFE_SB_BAD_MSGID_EID 43 - +#define CFE_SB_BAD_MSGID_EID 43 /** \brief 'Full Sub Pkt \%d Sent,Entries=\%d,Stat=0x\%x\n' ** \event 'Full Sub Pkt \%d Sent,Entries=\%d,Stat=0x\%x\n' @@ -736,7 +730,7 @@ ** This debug event message is issued in response to the ** 'Send Previous Subscriptions' command and a full pkt segment is sent. **/ -#define CFE_SB_FULL_SUB_PKT_EID 44 +#define CFE_SB_FULL_SUB_PKT_EID 44 /** \brief 'Partial Sub Pkt \%d Sent,Entries=\%d,Stat=0x\%x' ** \event 'Partial Sub Pkt \%d Sent,Entries=\%d,Stat=0x\%x' @@ -748,8 +742,7 @@ ** This debug event message is issued in response to the ** 'Send Previous Subscriptions' command and a partial pkt segment is sent. **/ -#define CFE_SB_PART_SUB_PKT_EID 45 - +#define CFE_SB_PART_SUB_PKT_EID 45 /** \brief 'Pipe Delete Error:Bad Argument,PipedId \%d,Requestor \%s,Idx \%d,Stat \%d' ** \event 'Pipe Delete Error:Bad Argument,PipedId \%d,Requestor \%s,Idx \%d,Stat \%d' @@ -761,7 +754,7 @@ ** This error event message is issued from CFE_SB_DeletePipeFull when an ** invalid pipe ID is passed in **/ -#define CFE_SB_DEL_PIPE_ERR1_EID 46 +#define CFE_SB_DEL_PIPE_ERR1_EID 46 /** \brief 'Pipe Deleted:id \%d,owner \%s' ** \event 'Pipe Deleted:id \%d,owner \%s' @@ -773,7 +766,7 @@ ** This debug event message is issued when the #CFE_SB_DeletePipe API is called and ** the request is successfully completed. **/ -#define CFE_SB_PIPE_DELETED_EID 47 +#define CFE_SB_PIPE_DELETED_EID 47 /** \brief 'Subscription Removed:Msg 0x\%x on pipe \%d,app \%s' ** \event 'Subscription Removed:Msg 0x\%x on pipe \%d,app \%s' @@ -799,7 +792,7 @@ ** returning something other than the number of bytes requested to be written. ** The requested value and the return value are displayed in the event. **/ -#define CFE_SB_FILEWRITE_ERR_EID 49 +#define CFE_SB_FILEWRITE_ERR_EID 49 /** \brief 'Subscribe Err:Invalid Pipe Id,Msg=0x\%x,PipeId=\%d,App \%s' ** \event 'Subscribe Err:Invalid Pipe Id,Msg=0x\%x,PipeId=\%d,App \%s' @@ -812,7 +805,7 @@ ** listed in the pipe table. This typically means that the pipe does not exist. ** The pipe table may be viewed for verification. **/ -#define CFE_SB_SUB_INV_PIPE_EID 50 +#define CFE_SB_SUB_INV_PIPE_EID 50 /** \brief 'Subscribe Err:Caller(\%s) is not the owner of pipe \%d, Msg=0x\%x' ** \event 'Subscribe Err:Caller(\%s) is not the owner of pipe \%d, Msg=0x\%x' @@ -825,7 +818,7 @@ ** and the requestor is not the owner of the pipe. Only the owner of the pipe may ** subscribe to messages on the pipe. **/ -#define CFE_SB_SUB_INV_CALLER_EID 51 +#define CFE_SB_SUB_INV_CALLER_EID 51 /** \brief 'Unsubscribe Err:Invalid Pipe Id Msg=0x\%x,Pipe=\%d,app=\%s' ** \event 'Unsubscribe Err:Invalid Pipe Id Msg=0x\%x,Pipe=\%d,app=\%s' @@ -839,7 +832,7 @@ ** This typically means that the pipe does not exist. The pipe table may be viewed ** for verification. **/ -#define CFE_SB_UNSUB_INV_PIPE_EID 52 +#define CFE_SB_UNSUB_INV_PIPE_EID 52 /** \brief 'Unsubscribe Err:Caller(\%s) is not the owner of pipe \%d,Msg=0x\%x' ** \event 'Unsubscribe Err:Caller(\%s) is not the owner of pipe \%d,Msg=0x\%x' @@ -852,7 +845,7 @@ ** called and the requestor is not the owner of the pipe (or ES). Only the owner of ** the pipe(or ES for cleanup purposes)may unsubscribe messages from a pipe. **/ -#define CFE_SB_UNSUB_INV_CALLER_EID 53 +#define CFE_SB_UNSUB_INV_CALLER_EID 53 /** \brief 'Pipe Delete Error:Caller(\%s) is not the owner of pipe \%d' ** \event 'Pipe Delete Error:Caller(\%s) is not the owner of pipe \%d' @@ -865,7 +858,7 @@ ** task that is not the owner of the pipe. Pipes may be deleted only by the task ** that created the pipe or ES(for cleanup purposes). **/ -#define CFE_SB_DEL_PIPE_ERR2_EID 54 +#define CFE_SB_DEL_PIPE_ERR2_EID 54 /** \brief 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' ** \event 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' @@ -883,7 +876,7 @@ ** Length (in decimal ), and \c Len specifies the message Length (in decimal) ** found in the message. **/ -#define CFE_SB_LEN_ERR_EID 61 +#define CFE_SB_LEN_ERR_EID 61 /** \brief 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' ** \event 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' @@ -895,7 +888,7 @@ ** This error event message is issued when the #CFE_SB_CreatePipe API tries to create ** a pipe with a name that is in use. **/ -#define CFE_SB_CR_PIPE_NAME_TAKEN_EID 62 +#define CFE_SB_CR_PIPE_NAME_TAKEN_EID 62 /** \brief 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' ** \event 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' @@ -907,12 +900,10 @@ ** This error event message is issued when the #CFE_SB_CreatePipe API is unable to ** create a queue because there are no queues free. **/ -#define CFE_SB_CR_PIPE_NO_FREE_EID 63 - +#define CFE_SB_CR_PIPE_NO_FREE_EID 63 #endif /* _cfe_sb_events_ */ /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/sb/fsw/inc/cfe_sb_msg.h b/modules/sb/fsw/inc/cfe_sb_msg.h index 4912ea7e4..ca9f5f85b 100644 --- a/modules/sb/fsw/inc/cfe_sb_msg.h +++ b/modules/sb/fsw/inc/cfe_sb_msg.h @@ -35,12 +35,11 @@ /* ** Includes */ -#include "common_types.h" /* Basic data types */ -#include "cfe_msg_hdr.h" /* for header definitions */ +#include "common_types.h" /* Basic data types */ +#include "cfe_msg_hdr.h" /* for header definitions */ #include "cfe_sb_extern_typedefs.h" #include "cfe_es_extern_typedefs.h" - /**************************************** ** SB task command packet command codes ****************************************/ @@ -76,7 +75,7 @@ ** ** \sa */ -#define CFE_SB_NOOP_CC 0 +#define CFE_SB_NOOP_CC 0 /** \cfesbcmd Software Bus Reset Counters ** @@ -113,7 +112,7 @@ ** ** \sa */ -#define CFE_SB_RESET_COUNTERS_CC 1 +#define CFE_SB_RESET_COUNTERS_CC 1 /** \cfesbcmd Send Software Bus Statistics ** @@ -148,7 +147,7 @@ ** ** \sa */ -#define CFE_SB_SEND_SB_STATS_CC 2 +#define CFE_SB_SEND_SB_STATS_CC 2 /** \cfesbcmd Write Software Bus Routing Info to a File ** @@ -190,7 +189,7 @@ ** file in the file system and could, if performed repeatedly without ** sufficient file management by the operator, fill the file system. */ -#define CFE_SB_WRITE_ROUTING_INFO_CC 3 +#define CFE_SB_WRITE_ROUTING_INFO_CC 3 /** \cfesbcmd Enable Software Bus Route ** @@ -228,7 +227,7 @@ ** \par Criticality ** This command is not inherently dangerous. */ -#define CFE_SB_ENABLE_ROUTE_CC 4 +#define CFE_SB_ENABLE_ROUTE_CC 4 /** \cfesbcmd Disable Software Bus Route ** @@ -269,7 +268,7 @@ ** commanding to the software bus until the processor was reset. There ** are similar problems that may occur when using this command. */ -#define CFE_SB_DISABLE_ROUTE_CC 5 +#define CFE_SB_DISABLE_ROUTE_CC 5 /** \cfesbcmd Write Pipe Info to a File ** @@ -311,7 +310,7 @@ ** file in the file system and could, if performed repeatedly without ** sufficient file management by the operator, fill the file system. */ -#define CFE_SB_WRITE_PIPE_INFO_CC 7 +#define CFE_SB_WRITE_PIPE_INFO_CC 7 /** \cfesbcmd Write Map Info to a File ** @@ -354,7 +353,7 @@ ** file in the file system and could, if performed repeatedly without ** sufficient file management by the operator, fill the file system. */ -#define CFE_SB_WRITE_MAP_INFO_CC 8 +#define CFE_SB_WRITE_MAP_INFO_CC 8 /** \cfesbcmd Enable Subscription Reporting Command ** @@ -387,7 +386,7 @@ ** \sa #CFE_SB_SingleSubscriptionTlm_t, #CFE_SB_DISABLE_SUB_REPORTING_CC, ** #CFE_SB_SEND_PREV_SUBS_CC */ -#define CFE_SB_ENABLE_SUB_REPORTING_CC 9 +#define CFE_SB_ENABLE_SUB_REPORTING_CC 9 /** \cfesbcmd Disable Subscription Reporting Command ** @@ -452,8 +451,7 @@ ** \sa #CFE_SB_AllSubscriptionsTlm_t, #CFE_SB_ENABLE_SUB_REPORTING_CC, ** #CFE_SB_DISABLE_SUB_REPORTING_CC */ -#define CFE_SB_SEND_PREV_SUBS_CC 11 - +#define CFE_SB_SEND_PREV_SUBS_CC 11 /**************************** ** SB Command Formats ** @@ -473,23 +471,24 @@ 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 Command Payload ** ** This structure contains a generic definition used by SB commands that write to a file */ -typedef struct CFE_SB_WriteFileInfoCmd_Payload { - char Filename[CFE_MISSION_MAX_PATH_LEN];/**< \brief Path and Filename of data to be loaded */ +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 { +typedef struct CFE_SB_WriteFileInfoCmd +{ CFE_MSG_CommandHeader_t Hdr; /**< \brief Command header */ CFE_SB_WriteFileInfoCmd_Payload_t Payload; /**< \brief Command payload */ -}CFE_SB_WriteFileInfoCmd_t; +} CFE_SB_WriteFileInfoCmd_t; /* * Create a unique typedef for each of the commands that share this format. @@ -506,17 +505,19 @@ typedef CFE_SB_WriteFileInfoCmd_t CFE_SB_WriteMapInfoCmd_t; ** A route is the destination pipe for a particular message and is therefore defined ** as a MsgId and PipeId combination. */ -typedef struct CFE_SB_RouteCmd_Payload { +typedef struct CFE_SB_RouteCmd_Payload +{ - CFE_SB_MsgId_t MsgId;/**< \brief Message ID of route to be enabled or disabled #CFE_SB_MsgId_t */ - CFE_SB_PipeId_t Pipe;/**< \brief Pipe ID of route to be enabled or disabled #CFE_SB_PipeId_t */ - uint8 Spare;/**<\brief Spare byte to make command even number of bytes */ + CFE_SB_MsgId_t MsgId; /**< \brief Message ID of route to be enabled or disabled #CFE_SB_MsgId_t */ + CFE_SB_PipeId_t Pipe; /**< \brief Pipe ID of route to be enabled or disabled #CFE_SB_PipeId_t */ + 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 { +typedef struct CFE_SB_RouteCmd +{ CFE_MSG_CommandHeader_t Hdr; /**< \brief Command header */ CFE_SB_RouteCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_SB_RouteCmd_t; @@ -534,84 +535,86 @@ typedef CFE_SB_RouteCmd_t CFE_SB_DisableRouteCmd_t; /** ** \cfesbtlm Software Bus task housekeeping Packet */ -typedef struct CFE_SB_HousekeepingTlm_Payload { - - uint8 CommandCounter;/**< \cfetlmmnemonic \SB_CMDPC - \brief Count of valid commands received */ - uint8 CommandErrorCounter;/**< \cfetlmmnemonic \SB_CMDEC - \brief Count of invalid commands received */ - uint8 NoSubscribersCounter;/**< \cfetlmmnemonic \SB_NOSUBEC - \brief Count pkts sent with no subscribers */ - uint8 MsgSendErrorCounter;/**< \cfetlmmnemonic \SB_MSGSNDEC - \brief Count of message send errors */ - - uint8 MsgReceiveErrorCounter;/**< \cfetlmmnemonic \SB_MSGRECEC - \brief Count of message receive errors */ - uint8 InternalErrorCounter;/**< \cfetlmmnemonic \SB_INTERNALEC +typedef struct CFE_SB_HousekeepingTlm_Payload +{ + + uint8 CommandCounter; /**< \cfetlmmnemonic \SB_CMDPC + \brief Count of valid commands received */ + uint8 CommandErrorCounter; /**< \cfetlmmnemonic \SB_CMDEC + \brief Count of invalid commands received */ + uint8 NoSubscribersCounter; /**< \cfetlmmnemonic \SB_NOSUBEC + \brief Count pkts sent with no subscribers */ + uint8 MsgSendErrorCounter; /**< \cfetlmmnemonic \SB_MSGSNDEC + \brief Count of message send errors */ + + uint8 MsgReceiveErrorCounter; /**< \cfetlmmnemonic \SB_MSGRECEC + \brief Count of message receive errors */ + uint8 InternalErrorCounter; /**< \cfetlmmnemonic \SB_INTERNALEC \brief Count of queue read or write errors */ - uint8 CreatePipeErrorCounter;/**< \cfetlmmnemonic \SB_NEWPIPEEC - \brief Count of errors in create pipe API */ - uint8 SubscribeErrorCounter;/**< \cfetlmmnemonic \SB_SUBSCREC - \brief Count of errors in subscribe API */ - uint8 PipeOptsErrorCounter; /**< \cfetlmmnemonic \SB_PIPEOPTSEC - \brief Count of errors in set/get pipe options API */ - uint8 DuplicateSubscriptionsCounter;/**< \cfetlmmnemonic \SB_DUPSUBCNT - \brief Count of duplicate subscriptions */ - uint8 GetPipeIdByNameErrorCounter; /**< \cfetlmmnemonic \SB_GETPIPEIDBYNAMEEC - \brief Count of errors in get pipe id by name API */ - uint8 Spare2Align[1];/**< \cfetlmmnemonic \SB_SPARE2ALIGN - \brief Spare bytes to ensure alignment */ - - uint16 PipeOverflowErrorCounter;/**< \cfetlmmnemonic \SB_PIPEOVREC - \brief Count of pipe overflow errors */ - uint16 MsgLimitErrorCounter;/**< \cfetlmmnemonic \SB_MSGLIMEC - \brief Count of msg id to pipe errors */ - - CFE_ES_MemHandle_t MemPoolHandle;/**< \cfetlmmnemonic \SB_MEMPOOLHANDLE - \brief Handle to SB's Memory Pool */ - - uint32 MemInUse;/**< \cfetlmmnemonic \SB_MEMINUSE - \brief Memory in use */ - - uint32 UnmarkedMem;/**< \cfetlmmnemonic \SB_UNMARKEDMEM - \brief cfg param CFE_PLATFORM_SB_BUF_MEMORY_BYTES minus Peak Memory in use */ + uint8 CreatePipeErrorCounter; /**< \cfetlmmnemonic \SB_NEWPIPEEC + \brief Count of errors in create pipe API */ + uint8 SubscribeErrorCounter; /**< \cfetlmmnemonic \SB_SUBSCREC + \brief Count of errors in subscribe API */ + uint8 PipeOptsErrorCounter; /**< \cfetlmmnemonic \SB_PIPEOPTSEC + \brief Count of errors in set/get pipe options API */ + uint8 DuplicateSubscriptionsCounter; /**< \cfetlmmnemonic \SB_DUPSUBCNT + \brief Count of duplicate subscriptions */ + uint8 GetPipeIdByNameErrorCounter; /**< \cfetlmmnemonic \SB_GETPIPEIDBYNAMEEC + \brief Count of errors in get pipe id by name API */ + uint8 Spare2Align[1]; /**< \cfetlmmnemonic \SB_SPARE2ALIGN + \brief Spare bytes to ensure alignment */ + + uint16 PipeOverflowErrorCounter; /**< \cfetlmmnemonic \SB_PIPEOVREC + \brief Count of pipe overflow errors */ + uint16 MsgLimitErrorCounter; /**< \cfetlmmnemonic \SB_MSGLIMEC + \brief Count of msg id to pipe errors */ + + CFE_ES_MemHandle_t MemPoolHandle; /**< \cfetlmmnemonic \SB_MEMPOOLHANDLE + \brief Handle to SB's Memory Pool */ + + uint32 MemInUse; /**< \cfetlmmnemonic \SB_MEMINUSE + \brief Memory in use */ + + uint32 UnmarkedMem; /**< \cfetlmmnemonic \SB_UNMARKEDMEM + \brief cfg param CFE_PLATFORM_SB_BUF_MEMORY_BYTES minus Peak Memory in use */ } CFE_SB_HousekeepingTlm_Payload_t; -typedef struct CFE_SB_HousekeepingTlm { +typedef struct CFE_SB_HousekeepingTlm +{ CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ CFE_SB_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_HousekeepingTlm_t; - /** ** \brief SB Pipe Depth Statistics ** ** Used in SB Statistics Telemetry Packet #CFE_SB_StatsTlm_t */ -typedef struct CFE_SB_PipeDepthStats { - - CFE_SB_PipeId_t PipeId;/**< \cfetlmmnemonic \SB_PDPIPEID - \brief Pipe Id associated with the stats below */ - uint16 MaxQueueDepth;/**< \cfetlmmnemonic \SB_PDDEPTH - \brief Number of messages the pipe can hold */ - uint16 CurrentQueueDepth;/**< \cfetlmmnemonic \SB_PDINUSE - \brief Number of messages currently on the pipe */ - uint16 PeakQueueDepth;/**< \cfetlmmnemonic \SB_PDPKINUSE - \brief Peak number of messages that have been on the pipe */ - uint16 Spare;/**< \cfetlmmnemonic \SB_PDSPARE +typedef struct CFE_SB_PipeDepthStats +{ + + CFE_SB_PipeId_t PipeId; /**< \cfetlmmnemonic \SB_PDPIPEID + \brief Pipe Id associated with the stats below */ + uint16 MaxQueueDepth; /**< \cfetlmmnemonic \SB_PDDEPTH + \brief Number of messages the pipe can hold */ + uint16 CurrentQueueDepth; /**< \cfetlmmnemonic \SB_PDINUSE + \brief Number of messages currently on the pipe */ + uint16 PeakQueueDepth; /**< \cfetlmmnemonic \SB_PDPKINUSE + \brief Peak number of messages that have been on the pipe */ + uint16 Spare; /**< \cfetlmmnemonic \SB_PDSPARE \brief Spare word to ensure alignment */ -}CFE_SB_PipeDepthStats_t; +} CFE_SB_PipeDepthStats_t; /** ** \brief SB Pipe Information File Entry ** ** This statistics structure is output as part of the CFE SB ** "Send Pipe Info" command (CFE_SB_SEND_PIPE_INFO_CC). -** +** ** Previous versions of CFE simply wrote the internal CFE_SB_PipeD_t object ** to the file, but this also contains information such as pointers which are -** not relevant outside the running CFE process. +** not relevant outside the running CFE process. ** ** By defining the pipe info structure separately, it also provides some ** independence, such that the internal CFE_SB_PipeD_t definition @@ -620,16 +623,16 @@ typedef struct CFE_SB_PipeDepthStats { */ typedef struct CFE_SB_PipeInfoEntry { - CFE_SB_PipeId_t PipeId; /**< The runtime ID of the pipe */ - CFE_ES_AppId_t AppId; /**< The runtime ID of the application that owns the pipe */ - char PipeName[CFE_MISSION_MAX_API_LEN]; /**< The Name of the pipe */ - char AppName[CFE_MISSION_MAX_API_LEN]; /**< The Name of the application that owns the pipe */ - uint16 MaxQueueDepth; /**< The allocated depth of the pipe (max capacity) */ - uint16 CurrentQueueDepth; /**< The current depth of the pipe */ - uint16 PeakQueueDepth; /**< The peak depth of the pipe (high watermark) */ - uint16 SendErrors; /**< Number of errors when writing to this pipe */ - uint8 Opts; /**< Pipe options set (bitmask) */ - uint8 Spare[3]; /**< Padding to make this structure a multiple of 4 bytes */ + CFE_SB_PipeId_t PipeId; /**< The runtime ID of the pipe */ + CFE_ES_AppId_t AppId; /**< The runtime ID of the application that owns the pipe */ + char PipeName[CFE_MISSION_MAX_API_LEN]; /**< The Name of the pipe */ + char AppName[CFE_MISSION_MAX_API_LEN]; /**< The Name of the application that owns the pipe */ + uint16 MaxQueueDepth; /**< The allocated depth of the pipe (max capacity) */ + uint16 CurrentQueueDepth; /**< The current depth of the pipe */ + uint16 PeakQueueDepth; /**< The peak depth of the pipe (high watermark) */ + uint16 SendErrors; /**< Number of errors when writing to this pipe */ + uint8 Opts; /**< Pipe options set (bitmask) */ + uint8 Spare[3]; /**< Padding to make this structure a multiple of 4 bytes */ } CFE_SB_PipeInfoEntry_t; @@ -638,79 +641,81 @@ typedef struct CFE_SB_PipeInfoEntry ** ** SB Statistics packet sent in response to #CFE_SB_SEND_SB_STATS_CC */ -typedef struct CFE_SB_StatsTlm_Payload { - - uint32 MsgIdsInUse;/**< \cfetlmmnemonic \SB_SMMIDIU - \brief Current number of MsgIds with a destination */ - uint32 PeakMsgIdsInUse;/**< \cfetlmmnemonic \SB_SMPMIDIU - \brief Peak number of MsgIds with a destination */ - uint32 MaxMsgIdsAllowed;/**< \cfetlmmnemonic \SB_SMMMIDALW - \brief cFE Cfg Param \link #CFE_PLATFORM_SB_MAX_MSG_IDS \endlink */ - - uint32 PipesInUse;/**< \cfetlmmnemonic \SB_SMPIU - \brief Number of pipes currently in use */ - uint32 PeakPipesInUse;/**< \cfetlmmnemonic \SB_SMPPIU - \brief Peak number of pipes since last reboot */ - uint32 MaxPipesAllowed;/**< \cfetlmmnemonic \SB_SMMPALW - \brief cFE Cfg Param \link #CFE_PLATFORM_SB_MAX_PIPES \endlink */ - - uint32 MemInUse;/**< \cfetlmmnemonic \SB_SMBMIU - \brief Memory bytes currently in use for SB msg transfers */ - uint32 PeakMemInUse;/**< \cfetlmmnemonic \SB_SMPBMIU - \brief Peak memory bytes in use for SB msg transfers */ - uint32 MaxMemAllowed;/**< \cfetlmmnemonic \SB_SMMBMALW - \brief cFE Cfg Param \link #CFE_PLATFORM_SB_BUF_MEMORY_BYTES \endlink */ - - uint32 SubscriptionsInUse;/**< \cfetlmmnemonic \SB_SMSIU - \brief Number of current subscriptions */ - uint32 PeakSubscriptionsInUse;/**< \cfetlmmnemonic \SB_SMPSIU - \brief Peak number of subscriptions */ - uint32 MaxSubscriptionsAllowed;/**< \cfetlmmnemonic \SB_SMMSALW - \brief product of \link #CFE_PLATFORM_SB_MAX_MSG_IDS \endlink - and \link #CFE_PLATFORM_SB_MAX_DEST_PER_PKT \endlink */ - - uint32 SBBuffersInUse;/**< \cfetlmmnemonic \SB_SMSBBIU - \brief Number of SB message buffers currently in use */ - uint32 PeakSBBuffersInUse;/**< \cfetlmmnemonic \SB_SMPSBBIU - \brief Max number of SB message buffers in use */ - - uint32 MaxPipeDepthAllowed;/**< \cfetlmmnemonic \SB_SMMPDALW - \brief Maximum allowed pipe depth */ - CFE_SB_PipeDepthStats_t PipeDepthStats[CFE_MISSION_SB_MAX_PIPES];/**< \cfetlmmnemonic \SB_SMPDS - \brief Pipe Depth Statistics #CFE_SB_PipeDepthStats_t*/ +typedef struct CFE_SB_StatsTlm_Payload +{ + + uint32 MsgIdsInUse; /**< \cfetlmmnemonic \SB_SMMIDIU + \brief Current number of MsgIds with a destination */ + uint32 PeakMsgIdsInUse; /**< \cfetlmmnemonic \SB_SMPMIDIU + \brief Peak number of MsgIds with a destination */ + uint32 MaxMsgIdsAllowed; /**< \cfetlmmnemonic \SB_SMMMIDALW + \brief cFE Cfg Param \link #CFE_PLATFORM_SB_MAX_MSG_IDS \endlink */ + + uint32 PipesInUse; /**< \cfetlmmnemonic \SB_SMPIU + \brief Number of pipes currently in use */ + uint32 PeakPipesInUse; /**< \cfetlmmnemonic \SB_SMPPIU + \brief Peak number of pipes since last reboot */ + uint32 MaxPipesAllowed; /**< \cfetlmmnemonic \SB_SMMPALW + \brief cFE Cfg Param \link #CFE_PLATFORM_SB_MAX_PIPES \endlink */ + + uint32 MemInUse; /**< \cfetlmmnemonic \SB_SMBMIU + \brief Memory bytes currently in use for SB msg transfers */ + uint32 PeakMemInUse; /**< \cfetlmmnemonic \SB_SMPBMIU + \brief Peak memory bytes in use for SB msg transfers */ + uint32 MaxMemAllowed; /**< \cfetlmmnemonic \SB_SMMBMALW + \brief cFE Cfg Param \link #CFE_PLATFORM_SB_BUF_MEMORY_BYTES \endlink */ + + uint32 SubscriptionsInUse; /**< \cfetlmmnemonic \SB_SMSIU + \brief Number of current subscriptions */ + uint32 PeakSubscriptionsInUse; /**< \cfetlmmnemonic \SB_SMPSIU + \brief Peak number of subscriptions */ + uint32 MaxSubscriptionsAllowed; /**< \cfetlmmnemonic \SB_SMMSALW + \brief product of \link #CFE_PLATFORM_SB_MAX_MSG_IDS \endlink + and \link #CFE_PLATFORM_SB_MAX_DEST_PER_PKT \endlink */ + + uint32 SBBuffersInUse; /**< \cfetlmmnemonic \SB_SMSBBIU + \brief Number of SB message buffers currently in use */ + uint32 PeakSBBuffersInUse; /**< \cfetlmmnemonic \SB_SMPSBBIU + \brief Max number of SB message buffers in use */ + + uint32 MaxPipeDepthAllowed; /**< \cfetlmmnemonic \SB_SMMPDALW + \brief Maximum allowed pipe depth */ + CFE_SB_PipeDepthStats_t + PipeDepthStats[CFE_MISSION_SB_MAX_PIPES]; /**< \cfetlmmnemonic \SB_SMPDS + \brief Pipe Depth Statistics #CFE_SB_PipeDepthStats_t*/ } CFE_SB_StatsTlm_Payload_t; -typedef struct CFE_SB_StatsTlm { +typedef struct CFE_SB_StatsTlm +{ CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ CFE_SB_StatsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_StatsTlm_t; - /** ** \brief SB Routing File Entry ** ** Structure of one element of the routing information in response to #CFE_SB_WRITE_ROUTING_INFO_CC */ -typedef struct CFE_SB_RoutingFileEntry { - CFE_SB_MsgId_t MsgId;/**< \brief Message Id portion of the route */ - CFE_SB_PipeId_t PipeId;/**< \brief Pipe Id portion of the route */ - uint8 State;/**< \brief Route Enabled or Disabled */ - uint16 MsgCnt;/**< \brief Number of msgs with this MsgId sent to this PipeId */ - char AppName[CFE_MISSION_MAX_API_LEN];/**< \brief Pipe Depth Statistics */ - char PipeName[CFE_MISSION_MAX_API_LEN];/**< \brief Pipe Depth Statistics */ - }CFE_SB_RoutingFileEntry_t; - +typedef struct CFE_SB_RoutingFileEntry +{ + CFE_SB_MsgId_t MsgId; /**< \brief Message Id portion of the route */ + CFE_SB_PipeId_t PipeId; /**< \brief Pipe Id portion of the route */ + uint8 State; /**< \brief Route Enabled or Disabled */ + uint16 MsgCnt; /**< \brief Number of msgs with this MsgId sent to this PipeId */ + char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Pipe Depth Statistics */ + char PipeName[CFE_MISSION_MAX_API_LEN]; /**< \brief Pipe Depth Statistics */ +} CFE_SB_RoutingFileEntry_t; /** ** \brief SB Map File Entry ** ** Structure of one element of the map information in response to #CFE_SB_WRITE_MAP_INFO_CC */ -typedef struct CFE_SB_MsgMapFileEntry { - CFE_SB_MsgId_t MsgId;/**< \brief Message Id which has been subscribed to */ - CFE_SB_RouteId_Atom_t Index;/**< \brief Routing raw index value (0 based, not Route ID) */ -}CFE_SB_MsgMapFileEntry_t; - +typedef struct CFE_SB_MsgMapFileEntry +{ + CFE_SB_MsgId_t MsgId; /**< \brief Message Id which has been subscribed to */ + CFE_SB_RouteId_Atom_t Index; /**< \brief Routing raw index value (0 based, not Route ID) */ +} CFE_SB_MsgMapFileEntry_t; /** ** \cfesbtlm SB Subscription Report Packet @@ -722,21 +727,22 @@ typedef struct CFE_SB_MsgMapFileEntry { ** ** \sa #CFE_SB_ENABLE_SUB_REPORTING_CC, #CFE_SB_DISABLE_SUB_REPORTING_CC */ -typedef struct CFE_SB_SingleSubscriptionTlm_Payload { +typedef struct CFE_SB_SingleSubscriptionTlm_Payload +{ - uint8 SubType;/**< \brief Subscription or Unsubscription */ - CFE_SB_MsgId_t MsgId;/**< \brief MsgId subscribed or unsubscribe to */ - CFE_SB_Qos_t Qos;/**< \brief Quality of Service, used only for interprocessor communication */ - CFE_SB_PipeId_t Pipe;/**< \brief Destination pipe id to send above msg id */ + uint8 SubType; /**< \brief Subscription or Unsubscription */ + CFE_SB_MsgId_t MsgId; /**< \brief MsgId subscribed or unsubscribe to */ + CFE_SB_Qos_t Qos; /**< \brief Quality of Service, used only for interprocessor communication */ + CFE_SB_PipeId_t Pipe; /**< \brief Destination pipe id to send above msg id */ } CFE_SB_SingleSubscriptionTlm_Payload_t; -typedef struct CFE_SB_SingleSubscriptionTlm { +typedef struct CFE_SB_SingleSubscriptionTlm +{ CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ CFE_SB_SingleSubscriptionTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_SingleSubscriptionTlm_t; - /** ** \brief SB Previous Subscriptions Entry ** @@ -745,14 +751,14 @@ typedef struct CFE_SB_SingleSubscriptionTlm { ** ** Used in structure definition #CFE_SB_AllSubscriptionsTlm_t */ -typedef struct CFE_SB_SubEntries { - - CFE_SB_MsgId_t MsgId;/**< \brief MsgId portion of the subscription */ - CFE_SB_Qos_t Qos;/**< \brief Qos portion of the subscription */ - CFE_SB_PipeId_t Pipe;/**< \brief PipeId portion of the subscription */ +typedef struct CFE_SB_SubEntries +{ -}CFE_SB_SubEntries_t; + CFE_SB_MsgId_t MsgId; /**< \brief MsgId portion of the subscription */ + CFE_SB_Qos_t Qos; /**< \brief Qos portion of the subscription */ + CFE_SB_PipeId_t Pipe; /**< \brief PipeId portion of the subscription */ +} CFE_SB_SubEntries_t; /** ** \cfesbtlm SB Previous Subscriptions Packet @@ -763,19 +769,20 @@ typedef struct CFE_SB_SubEntries { ** there are more subscriptions than can fit in one pkt. The complete list of ** subscriptions is sent via a series of segmented pkts. */ -typedef struct CFE_SB_AllSubscriptionsTlm_Payload { +typedef struct CFE_SB_AllSubscriptionsTlm_Payload +{ - uint32 PktSegment;/**< \brief Pkt number(starts at 1) in the series */ - uint32 TotalSegments;/**< \brief Total number of pkts needed to complete the request */ - uint32 Entries;/**< \brief Number of entries in the pkt */ - CFE_SB_SubEntries_t Entry[CFE_SB_SUB_ENTRIES_PER_PKT];/**< \brief Array of #CFE_SB_SubEntries_t entries */ + uint32 PktSegment; /**< \brief Pkt number(starts at 1) in the series */ + uint32 TotalSegments; /**< \brief Total number of pkts needed to complete the request */ + uint32 Entries; /**< \brief Number of entries in the pkt */ + CFE_SB_SubEntries_t Entry[CFE_SB_SUB_ENTRIES_PER_PKT]; /**< \brief Array of #CFE_SB_SubEntries_t entries */ } CFE_SB_AllSubscriptionsTlm_Payload_t; -typedef struct CFE_SB_AllSubscriptionsTlm { +typedef struct CFE_SB_AllSubscriptionsTlm +{ CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ CFE_SB_AllSubscriptionsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_AllSubscriptionsTlm_t; - #endif /* _cfe_sb_msg_ */ /*****************************************************************************/ diff --git a/modules/sb/fsw/src/cfe_sb_api.c b/modules/sb/fsw/src/cfe_sb_api.c index ea824a4f7..f96ba031d 100644 --- a/modules/sb/fsw/src/cfe_sb_api.c +++ b/modules/sb/fsw/src/cfe_sb_api.c @@ -23,10 +23,10 @@ ** ** Purpose: ** This file contains the source code for the SB API's. -** +** ** Notes: The following 4 terms have been, or are used in the cFS architecture and implementation -** -** StreamId - First 16 bits of CCSDS Space Packet Protocol (SPP) 133.0-B.1c2 Blue Book +** +** StreamId - First 16 bits of CCSDS Space Packet Protocol (SPP) 133.0-B.1c2 Blue Book ** packet primary header. It contains the 3 bit Version Number, 1 bit Packet Type ID, ** 1 bit Secondary Header flag, and 11 bit Application Process ID ** It was used in earlier cFS implementaions and is defined here for historical reference @@ -34,24 +34,24 @@ ** ** MsgId - Unique numeric message identifier within a mission namespace. It is used by cFS ** applications to the identify messages for publishing and subscribing -** It is used by the SB API and encoded in a mission defended way in the header of +** It is used by the SB API and encoded in a mission defended way in the header of ** all cFS messages. ** It is exposed to all cFS applications ** -** ApId - CCSDS Application Process Id field in the primary header. +** ApId - CCSDS Application Process Id field in the primary header. ** It has default bit mask of 0x07FF and is part of the cFS message Id ** It should not be confused with the cFE Executive Services (ES) term appId which ** identifies the software application/component ** It is NOT exposed to user applications. ** -** MsgIdkey - This is a unique numeric key within a mission namespace that is used with -** cFS software bus internal structures. +** MsgIdkey - This is a unique numeric key within a mission namespace that is used with +** cFS software bus internal structures. ** It is algorithmically created in a mission defined way from the MsgId to support -** efficient lookup and mapping implementations +** efficient lookup and mapping implementations ** It is NOT exposed to user applications. ** ** Author: R.McGraw/SSI -** J.Wilmot/NASA +** J.Wilmot/NASA ** ******************************************************************************/ @@ -62,55 +62,53 @@ #include -/* - * Macro to reflect size of PipeDepthStats Telemetry array - +/* + * Macro to reflect size of PipeDepthStats Telemetry array - * this may or may not be the same as CFE_SB_MSG_MAX_PIPES */ -#define CFE_SB_TLM_PIPEDEPTHSTATS_SIZE (sizeof(CFE_SB_Global.StatTlmMsg.Payload.PipeDepthStats) / sizeof(CFE_SB_Global.StatTlmMsg.Payload.PipeDepthStats[0])) +#define CFE_SB_TLM_PIPEDEPTHSTATS_SIZE \ + (sizeof(CFE_SB_Global.StatTlmMsg.Payload.PipeDepthStats) / \ + sizeof(CFE_SB_Global.StatTlmMsg.Payload.PipeDepthStats[0])) /* Local structure for remove pipe callbacks */ typedef struct { - const char *FullName; /* Full name (app.task) for error reporting */ - CFE_SB_PipeId_t PipeId; /* Pipe id to remove */ + const char * FullName; /* Full name (app.task) for error reporting */ + CFE_SB_PipeId_t PipeId; /* Pipe id to remove */ } CFE_SB_RemovePipeCallback_t; - /* * Function: CFE_SB_PipeId_ToIndex - See API and header file for details */ CFE_Status_t CFE_SB_PipeId_ToIndex(CFE_SB_PipeId_t PipeID, uint32 *Idx) { - return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(PipeID), - CFE_SB_PIPEID_BASE, - CFE_PLATFORM_SB_MAX_PIPES, - Idx); + return CFE_ResourceId_ToIndex(CFE_RESOURCEID_UNWRAP(PipeID), CFE_SB_PIPEID_BASE, CFE_PLATFORM_SB_MAX_PIPES, Idx); } /* * Function: CFE_SB_CreatePipe - See API and header file for details */ -int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *PipeName) +int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *PipeName) { - CFE_ES_AppId_t AppId; - CFE_ES_TaskId_t TskId; - osal_id_t SysQueueId; - int32 Status; - CFE_SB_PipeD_t *PipeDscPtr; + CFE_ES_AppId_t AppId; + CFE_ES_TaskId_t TskId; + osal_id_t SysQueueId; + int32 Status; + CFE_SB_PipeD_t * PipeDscPtr; CFE_ResourceId_t PendingPipeId; - uint16 PendingEventId; - char FullName[(OS_MAX_API_NAME * 2)]; + uint16 PendingEventId; + char FullName[(OS_MAX_API_NAME * 2)]; - Status = CFE_SUCCESS; - SysQueueId = OS_OBJECT_ID_UNDEFINED; + Status = CFE_SUCCESS; + SysQueueId = OS_OBJECT_ID_UNDEFINED; PendingEventId = 0; - PipeDscPtr = NULL; + PipeDscPtr = NULL; - /* + /* * Get caller AppId. - * + * * This is needed for both success and failure cases, - * as it is stored in the Pipe Descriptor on success, + * as it is stored in the Pipe Descriptor on success, * and used for events on failure, so get it now. */ CFE_ES_GetAppID(&AppId); @@ -119,25 +117,26 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * CFE_ES_GetTaskID(&TskId); /* check input parameters */ - if((PipeIdPtr == NULL) || (Depth > OS_QUEUE_MAX_DEPTH) || (Depth == 0)) + if ((PipeIdPtr == NULL) || (Depth > OS_QUEUE_MAX_DEPTH) || (Depth == 0)) { PendingEventId = CFE_SB_CR_PIPE_BAD_ARG_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { /* Get an available Pipe Descriptor which must be done while locked */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* get first available entry in pipe table */ - PendingPipeId = CFE_ResourceId_FindNext(CFE_SB_Global.LastPipeId, CFE_PLATFORM_SB_MAX_PIPES, CFE_SB_CheckPipeDescSlotUsed); + PendingPipeId = + CFE_ResourceId_FindNext(CFE_SB_Global.LastPipeId, CFE_PLATFORM_SB_MAX_PIPES, CFE_SB_CheckPipeDescSlotUsed); PipeDscPtr = CFE_SB_LocatePipeDescByID(CFE_SB_PIPEID_C(PendingPipeId)); /* if pipe table is full, send event and return error */ - if(PipeDscPtr == NULL) + if (PipeDscPtr == NULL) { PendingEventId = CFE_SB_MAX_PIPES_MET_EID; - Status = CFE_SB_MAX_PIPES_MET; + Status = CFE_SB_MAX_PIPES_MET; } else { @@ -148,14 +147,14 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * CFE_SB_Global.LastPipeId = PendingPipeId; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); } if (Status == CFE_SUCCESS) { /* create the queue */ - Status = OS_QueueCreate(&SysQueueId,PipeName,Depth,sizeof(CFE_SB_BufferD_t *),0); - if (Status == OS_SUCCESS) + Status = OS_QueueCreate(&SysQueueId, PipeName, Depth, sizeof(CFE_SB_BufferD_t *), 0); + if (Status == OS_SUCCESS) { /* just translate the RC to CFE */ Status = CFE_SUCCESS; @@ -181,7 +180,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * } } - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); if (Status == CFE_SUCCESS) { @@ -198,7 +197,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * if (CFE_SB_Global.StatTlmMsg.Payload.PipesInUse > CFE_SB_Global.StatTlmMsg.Payload.PeakPipesInUse) { CFE_SB_Global.StatTlmMsg.Payload.PeakPipesInUse = CFE_SB_Global.StatTlmMsg.Payload.PipesInUse; - }/* end if */ + } /* end if */ } else { @@ -216,7 +215,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * * If there is a relevant error counter, increment it now * while the global data is locked. */ - switch(PendingEventId) + switch (PendingEventId) { case CFE_SB_CR_PIPE_BAD_ARG_EID: ++CFE_SB_Global.HKTlmMsg.Payload.CreatePipeErrorCounter; @@ -227,57 +226,56 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * } } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* Send any pending events now, after final unlock */ if (Status == CFE_SUCCESS) { /* send debug event */ - CFE_EVS_SendEventWithAppID(CFE_SB_PIPE_ADDED_EID,CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "Pipe Created:name %s,id %d,app %s", - PipeName, (int)CFE_ResourceId_ToInteger(PendingPipeId), - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_PIPE_ADDED_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "Pipe Created:name %s,id %d,app %s", PipeName, + (int)CFE_ResourceId_ToInteger(PendingPipeId), CFE_SB_GetAppTskName(TskId, FullName)); /* give the pipe handle to the caller */ *PipeIdPtr = CFE_SB_PIPEID_C(PendingPipeId); } else { - switch(PendingEventId) + switch (PendingEventId) { case CFE_SB_CR_PIPE_BAD_ARG_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_BAD_ARG_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "CreatePipeErr:Bad Input Arg:app=%s,ptr=0x%lx,depth=%d,maxdepth=%d", - CFE_SB_GetAppTskName(TskId,FullName),(unsigned long)PipeIdPtr,(int)Depth,OS_QUEUE_MAX_DEPTH); + CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_BAD_ARG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "CreatePipeErr:Bad Input Arg:app=%s,ptr=0x%lx,depth=%d,maxdepth=%d", + CFE_SB_GetAppTskName(TskId, FullName), (unsigned long)PipeIdPtr, (int)Depth, + OS_QUEUE_MAX_DEPTH); break; case CFE_SB_MAX_PIPES_MET_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_MAX_PIPES_MET_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "CreatePipeErr:Max Pipes(%d)In Use.app %s", - CFE_PLATFORM_SB_MAX_PIPES,CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_MAX_PIPES_MET_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "CreatePipeErr:Max Pipes(%d)In Use.app %s", CFE_PLATFORM_SB_MAX_PIPES, + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_CR_PIPE_NAME_TAKEN_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NAME_TAKEN_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "CreatePipeErr:OS_QueueCreate failed, name taken (app=%s, name=%s)", - CFE_SB_GetAppTskName(TskId,FullName), PipeName); + CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NAME_TAKEN_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "CreatePipeErr:OS_QueueCreate failed, name taken (app=%s, name=%s)", + CFE_SB_GetAppTskName(TskId, FullName), PipeName); break; case CFE_SB_CR_PIPE_NO_FREE_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NO_FREE_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "CreatePipeErr:OS_QueueCreate failed, no free id's (app=%s)", - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NO_FREE_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "CreatePipeErr:OS_QueueCreate failed, no free id's (app=%s)", + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_CR_PIPE_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "CreatePipeErr:OS_QueueCreate returned %d,app %s", - (int)Status,CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "CreatePipeErr:OS_QueueCreate returned %d,app %s", (int)Status, + CFE_SB_GetAppTskName(TskId, FullName)); break; } } return Status; -}/* end CFE_SB_CreatePipe */ - +} /* end CFE_SB_CreatePipe */ /* * Function: CFE_SB_DeletePipe - See API and header file for details @@ -285,18 +283,16 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * int32 CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId) { CFE_ES_AppId_t CallerId; - int32 Status = 0; + int32 Status = 0; /* get the callers Application Id */ CFE_ES_GetAppID(&CallerId); - Status = CFE_SB_DeletePipeFull(PipeId,CallerId); + Status = CFE_SB_DeletePipeFull(PipeId, CallerId); return Status; -}/* end CFE_SB_DeletePipe */ - - +} /* end CFE_SB_DeletePipe */ /****************************************************************************** ** Function: CFE_SB_DeletePipeWithAppId() @@ -312,20 +308,20 @@ int32 CFE_SB_DeletePipe(CFE_SB_PipeId_t PipeId) */ int32 CFE_SB_DeletePipeWithAppId(CFE_SB_PipeId_t PipeId, CFE_ES_AppId_t AppId) { - int32 Status = 0; + int32 Status = 0; - Status = CFE_SB_DeletePipeFull(PipeId,AppId); + Status = CFE_SB_DeletePipeFull(PipeId, AppId); return Status; -}/* end CFE_SB_DeletePipeWithAppId */ +} /* end CFE_SB_DeletePipeWithAppId */ /****************************************************************************** * Local callback helper for deleting a pipe from a route */ void CFE_SB_RemovePipeFromRoute(CFE_SBR_RouteId_t RouteId, void *ArgPtr) { - CFE_SB_DestinationD_t *destptr; + CFE_SB_DestinationD_t * destptr; CFE_SB_RemovePipeCallback_t *args; args = (CFE_SB_RemovePipeCallback_t *)ArgPtr; @@ -353,59 +349,59 @@ void CFE_SB_RemovePipeFromRoute(CFE_SBR_RouteId_t RouteId, void *ArgPtr) ** Return: ** CFE_SUCCESS or cFE Error Code */ -int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId) +int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId, CFE_ES_AppId_t AppId) { - CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_PipeD_t * PipeDscPtr; int32 Status; CFE_ES_TaskId_t TskId; - CFE_SB_BufferD_t *BufDscPtr; + CFE_SB_BufferD_t * BufDscPtr; osal_id_t SysQueueId; char FullName[(OS_MAX_API_NAME * 2)]; size_t BufDscSize; CFE_SB_RemovePipeCallback_t Args; uint16 PendingEventID; - Status = CFE_SUCCESS; - PendingEventID = 0; - SysQueueId = OS_OBJECT_ID_UNDEFINED; - BufDscPtr = NULL; + Status = CFE_SUCCESS; + PendingEventID = 0; + SysQueueId = OS_OBJECT_ID_UNDEFINED; + BufDscPtr = NULL; /* take semaphore to prevent a task switch during this call */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); - /* check input parameter */ + /* check input parameter */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); if (!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) - { + { PendingEventID = CFE_SB_DEL_PIPE_ERR1_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } /* check that the given AppId is the owner of the pipe */ else if (!CFE_RESOURCEID_TEST_EQUAL(AppId, PipeDscPtr->AppId)) { PendingEventID = CFE_SB_DEL_PIPE_ERR2_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { /* Remove the pipe from all routes */ - Args.PipeId = PipeId; + Args.PipeId = PipeId; Args.FullName = FullName; CFE_SBR_ForEachRouteId(CFE_SB_RemovePipeFromRoute, &Args, NULL); - /* + /* * With the route removed there should be no new messages written to this pipe, - * + * * but the pipe ID itself also needs to be invalidated now (before releasing lock) to make * sure that no no subscriptions/routes can be added either. - * + * * However we must first save certain state data for later deletion. */ SysQueueId = PipeDscPtr->SysQueueId; BufDscPtr = PipeDscPtr->LastBuffer; - /* - * Mark entry as "reserved" so other resources can be deleted + /* + * Mark entry as "reserved" so other resources can be deleted * while the SB global is unlocked. This prevents other tasks * from trying to use this Pipe Desc slot, and also should prevents * any task from re-subscribing to this pipe. @@ -413,19 +409,19 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId) CFE_SB_PipeDescSetUsed(PipeDscPtr, CFE_RESOURCEID_RESERVED); } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* remove any messages that might be on the pipe */ if (Status == CFE_SUCCESS) { - while(true) + while (true) { /* decrement refcount of any previous buffer */ if (BufDscPtr != NULL) { - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); CFE_SB_DecrBufUseCnt(BufDscPtr); - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); BufDscPtr = NULL; } @@ -443,7 +439,7 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId) /* * Final cleanup with global data locked */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); if (Status == CFE_SUCCESS) { @@ -455,7 +451,7 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId) CFE_SB_Global.HKTlmMsg.Payload.CreatePipeErrorCounter++; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); if (Status == CFE_SUCCESS) { @@ -467,10 +463,10 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId) */ CFE_ES_GetAppName(FullName, AppId, sizeof(FullName)); - CFE_EVS_SendEventWithAppID(CFE_SB_PIPE_DELETED_EID,CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "Pipe Deleted:id %d,owner %s",(int)CFE_RESOURCEID_TO_ULONG(PipeId), FullName); + CFE_EVS_SendEventWithAppID(CFE_SB_PIPE_DELETED_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "Pipe Deleted:id %d,owner %s", (int)CFE_RESOURCEID_TO_ULONG(PipeId), FullName); } - else + else { /* get TaskId and name of caller for events */ CFE_ES_GetTaskID(&TskId); @@ -479,59 +475,58 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId) switch (PendingEventID) { case CFE_SB_DEL_PIPE_ERR1_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_DEL_PIPE_ERR1_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Pipe Delete Error:Bad Argument,PipedId %ld,Requestor %s", - CFE_RESOURCEID_TO_ULONG(PipeId),FullName); + CFE_EVS_SendEventWithAppID(CFE_SB_DEL_PIPE_ERR1_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Pipe Delete Error:Bad Argument,PipedId %ld,Requestor %s", + CFE_RESOURCEID_TO_ULONG(PipeId), FullName); break; case CFE_SB_DEL_PIPE_ERR2_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_DEL_PIPE_ERR2_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Pipe Delete Error:Caller(%s) is not the owner of pipe %ld", - FullName, CFE_RESOURCEID_TO_ULONG(PipeId)); + CFE_EVS_SendEventWithAppID(CFE_SB_DEL_PIPE_ERR2_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Pipe Delete Error:Caller(%s) is not the owner of pipe %ld", FullName, + CFE_RESOURCEID_TO_ULONG(PipeId)); break; } } return Status; -}/* end CFE_SB_DeletePipeFull */ - +} /* end CFE_SB_DeletePipeFull */ /* * Function: CFE_SB_SetPipeOpts - See API and header file for details */ int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts) { - CFE_SB_PipeD_t *PipeDscPtr; - CFE_ES_AppId_t AppID; - CFE_ES_TaskId_t TskId; - uint16 PendingEventID; - int32 Status; - char FullName[(OS_MAX_API_NAME * 2)]; + CFE_SB_PipeD_t *PipeDscPtr; + CFE_ES_AppId_t AppID; + CFE_ES_TaskId_t TskId; + uint16 PendingEventID; + int32 Status; + char FullName[(OS_MAX_API_NAME * 2)]; PendingEventID = 0; Status = CFE_ES_GetAppID(&AppID); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { /* shouldn't happen... */ return Status; } /* take semaphore to prevent a task switch during this call */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* check input parameter */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); - if(!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) + if (!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) { PendingEventID = CFE_SB_SETPIPEOPTS_ID_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } /* check that the caller AppId is the owner of the pipe */ - else if( !CFE_RESOURCEID_TEST_EQUAL(AppID, PipeDscPtr->AppId) ) + else if (!CFE_RESOURCEID_TEST_EQUAL(AppID, PipeDscPtr->AppId)) { PendingEventID = CFE_SB_SETPIPEOPTS_OWNER_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { @@ -544,7 +539,7 @@ int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts) CFE_SB_Global.HKTlmMsg.Payload.PipeOptsErrorCounter++; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* Send events after unlocking SB */ if (Status == CFE_SUCCESS) @@ -552,8 +547,9 @@ int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts) /* get AppID of caller for events */ CFE_ES_GetAppName(FullName, AppID, sizeof(FullName)); - CFE_EVS_SendEventWithAppID(CFE_SB_SETPIPEOPTS_EID,CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "Pipe opts set:id %lu,owner %s, opts=0x%02x",CFE_RESOURCEID_TO_ULONG(PipeId), FullName, (unsigned int)Opts); + CFE_EVS_SendEventWithAppID(CFE_SB_SETPIPEOPTS_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "Pipe opts set:id %lu,owner %s, opts=0x%02x", CFE_RESOURCEID_TO_ULONG(PipeId), + FullName, (unsigned int)Opts); } else { @@ -563,49 +559,50 @@ int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts) switch (PendingEventID) { case CFE_SB_SETPIPEOPTS_ID_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SETPIPEOPTS_ID_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Pipe Opts Error:Bad Argument,PipedId %lu,Requestor %s", - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_SETPIPEOPTS_ID_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Pipe Opts Error:Bad Argument,PipedId %lu,Requestor %s", + CFE_RESOURCEID_TO_ULONG(PipeId), CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_SETPIPEOPTS_OWNER_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SETPIPEOPTS_OWNER_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Pipe Opts Set Error: Caller(%s) is not the owner of pipe %lu", - CFE_SB_GetAppTskName(TskId,FullName),CFE_RESOURCEID_TO_ULONG(PipeId)); + CFE_EVS_SendEventWithAppID(CFE_SB_SETPIPEOPTS_OWNER_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_SB_Global.AppId, + "Pipe Opts Set Error: Caller(%s) is not the owner of pipe %lu", + CFE_SB_GetAppTskName(TskId, FullName), CFE_RESOURCEID_TO_ULONG(PipeId)); break; } } return Status; -}/* end CFE_SB_SetPipeOpts */ +} /* end CFE_SB_SetPipeOpts */ /* * Function: CFE_SB_GetPipeOpts - See API and header file for details */ int32 CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptsPtr) { - int32 Status; - CFE_ES_TaskId_t TskId; - char FullName[(OS_MAX_API_NAME * 2)]; - uint16 PendingEventID; - CFE_SB_PipeD_t *PipeDscPtr; + int32 Status; + CFE_ES_TaskId_t TskId; + char FullName[(OS_MAX_API_NAME * 2)]; + uint16 PendingEventID; + CFE_SB_PipeD_t *PipeDscPtr; PendingEventID = 0; - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; /* take semaphore to prevent a task switch during this call */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* check input parameter */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); if (!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) { PendingEventID = CFE_SB_GETPIPEOPTS_ID_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else if (OptsPtr == NULL) { PendingEventID = CFE_SB_GETPIPEOPTS_PTR_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { @@ -618,76 +615,77 @@ int32 CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptsPtr) CFE_SB_Global.HKTlmMsg.Payload.PipeOptsErrorCounter++; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* Send events after unlocking SB */ if (Status == CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEOPTS_EID,CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "Pipe opts get:id %lu, opts=0x%02x",CFE_RESOURCEID_TO_ULONG(PipeId), (unsigned int)*OptsPtr); + CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEOPTS_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "Pipe opts get:id %lu, opts=0x%02x", CFE_RESOURCEID_TO_ULONG(PipeId), + (unsigned int)*OptsPtr); } else { /* get TaskId of caller for events */ CFE_ES_GetTaskID(&TskId); - switch(PendingEventID) + switch (PendingEventID) { case CFE_SB_GETPIPEOPTS_PTR_ERR_EID: CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEOPTS_PTR_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, - "Pipe Opts Error:Bad Argument,Requestor %s", - CFE_SB_GetAppTskName(TskId,FullName)); + "Pipe Opts Error:Bad Argument,Requestor %s", + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_GETPIPEOPTS_ID_ERR_EID: CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEOPTS_ID_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, - "Pipe Opts Error:Bad Argument,PipedId %lu,Requestor %s", - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName)); + "Pipe Opts Error:Bad Argument,PipedId %lu,Requestor %s", + CFE_RESOURCEID_TO_ULONG(PipeId), CFE_SB_GetAppTskName(TskId, FullName)); break; } } return Status; -}/* end CFE_SB_GetPipeOpts */ +} /* end CFE_SB_GetPipeOpts */ /* * Function: CFE_SB_GetPipeName - See API and header file for details */ int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t PipeId) { - int32 Status; - CFE_ES_TaskId_t TskId; - char FullName[(OS_MAX_API_NAME * 2)]; - uint16 PendingEventID; - CFE_SB_PipeD_t *PipeDscPtr; - osal_id_t SysQueueId; + int32 Status; + CFE_ES_TaskId_t TskId; + char FullName[(OS_MAX_API_NAME * 2)]; + uint16 PendingEventID; + CFE_SB_PipeD_t *PipeDscPtr; + osal_id_t SysQueueId; PendingEventID = 0; - Status = CFE_SUCCESS; - SysQueueId = OS_OBJECT_ID_UNDEFINED; + Status = CFE_SUCCESS; + SysQueueId = OS_OBJECT_ID_UNDEFINED; /* take semaphore to prevent a task switch during this call */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* check input parameter */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); if (!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) { PendingEventID = CFE_SB_GETPIPENAME_ID_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { SysQueueId = PipeDscPtr->SysQueueId; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); if (Status == CFE_SUCCESS) { - if (PipeNameBuf == NULL || PipeNameSize == 0) + if (PipeNameBuf == NULL || PipeNameSize == 0) { PendingEventID = CFE_SB_GETPIPENAME_NULL_PTR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { @@ -700,7 +698,7 @@ int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t else { PendingEventID = CFE_SB_GETPIPENAME_ID_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } } } @@ -708,26 +706,24 @@ int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t /* Send Events */ if (Status == CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPENAME_EID, - CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "GetPipeName name=%s id=%lu", - PipeNameBuf, CFE_RESOURCEID_TO_ULONG(PipeId)); + CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPENAME_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "GetPipeName name=%s id=%lu", PipeNameBuf, CFE_RESOURCEID_TO_ULONG(PipeId)); } else { CFE_ES_GetTaskID(&TskId); - switch(PendingEventID) + switch (PendingEventID) { case CFE_SB_GETPIPENAME_NULL_PTR_EID: CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPENAME_NULL_PTR_EID, CFE_EVS_EventType_ERROR, - CFE_SB_Global.AppId, "Pipe Name Error:NullPtr,Requestor %s", - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_SB_Global.AppId, "Pipe Name Error:NullPtr,Requestor %s", + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_GETPIPENAME_ID_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPENAME_ID_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_SB_Global.AppId, "Pipe Id Error:Bad Argument,Id=%lu,Requestor %s", - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPENAME_ID_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Pipe Id Error:Bad Argument,Id=%lu,Requestor %s", + CFE_RESOURCEID_TO_ULONG(PipeId), CFE_SB_GetAppTskName(TskId, FullName)); break; } @@ -739,28 +735,28 @@ int32 CFE_SB_GetPipeName(char *PipeNameBuf, size_t PipeNameSize, CFE_SB_PipeId_t return Status; -}/* end CFE_SB_GetPipeName */ +} /* end CFE_SB_GetPipeName */ /* * Function: CFE_SB_GetPipeIdByName - See API and header file for details */ int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName) { - int32 Status; - CFE_ES_TaskId_t TskId; - uint32 Idx; - char FullName[(OS_MAX_API_NAME * 2)]; - uint16 PendingEventID; - CFE_SB_PipeD_t *PipeDscPtr; - osal_id_t SysQueueId; + int32 Status; + CFE_ES_TaskId_t TskId; + uint32 Idx; + char FullName[(OS_MAX_API_NAME * 2)]; + uint16 PendingEventID; + CFE_SB_PipeD_t *PipeDscPtr; + osal_id_t SysQueueId; PendingEventID = 0; - SysQueueId = OS_OBJECT_ID_UNDEFINED; + SysQueueId = OS_OBJECT_ID_UNDEFINED; - if(PipeName == NULL || PipeIdPtr == NULL) + if (PipeName == NULL || PipeIdPtr == NULL) { PendingEventID = CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { @@ -773,22 +769,22 @@ int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName) else { PendingEventID = CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } } - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); if (Status == CFE_SUCCESS) { - Idx = CFE_PLATFORM_SB_MAX_PIPES; + Idx = CFE_PLATFORM_SB_MAX_PIPES; PipeDscPtr = CFE_SB_Global.PipeTbl; - while(true) + while (true) { if (Idx == 0) { PendingEventID = CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; break; } @@ -797,96 +793,78 @@ int32 CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *PipeName) /* grab the ID before we release the lock */ *PipeIdPtr = CFE_SB_PipeDescGetID(PipeDscPtr); break; - }/* end if */ + } /* end if */ --Idx; ++PipeDscPtr; } } - + if (Status != CFE_SUCCESS) { ++CFE_SB_Global.HKTlmMsg.Payload.GetPipeIdByNameErrorCounter; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* Send Events */ if (Status == CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEIDBYNAME_EID, - CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "PipeIdByName name=%s id=%lu", - PipeName, CFE_RESOURCEID_TO_ULONG(*PipeIdPtr)); + CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEIDBYNAME_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "PipeIdByName name=%s id=%lu", PipeName, CFE_RESOURCEID_TO_ULONG(*PipeIdPtr)); } else { /* get TaskId of caller for events */ CFE_ES_GetTaskID(&TskId); - - switch(PendingEventID) + + switch (PendingEventID) { case CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID, - CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, - "Pipe ID By Name Error:Bad Argument,Requestor %s", - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_SB_Global.AppId, "Pipe ID By Name Error:Bad Argument,Requestor %s", + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID, - CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, - "Pipe ID By Name Error:Bad Argument,Requestor %s", - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_SB_Global.AppId, "Pipe ID By Name Error:Bad Argument,Requestor %s", + CFE_SB_GetAppTskName(TskId, FullName)); break; - } } return Status; -}/* end CFE_SB_GetPipeIdByName */ - +} /* end CFE_SB_GetPipeIdByName */ /* * Function: CFE_SB_SubscribeEx - See API and header file for details */ -int32 CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, - CFE_SB_PipeId_t PipeId, - CFE_SB_Qos_t Quality, - uint16 MsgLim) +int32 CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality, uint16 MsgLim) { - return CFE_SB_SubscribeFull(MsgId,PipeId,Quality,MsgLim,(uint8)CFE_SB_MSG_GLOBAL); - -}/* end CFE_SB_SubscribeEx */ - - + return CFE_SB_SubscribeFull(MsgId, PipeId, Quality, MsgLim, (uint8)CFE_SB_MSG_GLOBAL); +} /* end CFE_SB_SubscribeEx */ /* * Function: CFE_SB_SubscribeLocal - See API and header file for details */ -int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId, - CFE_SB_PipeId_t PipeId, - uint16 MsgLim) +int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint16 MsgLim) { - return CFE_SB_SubscribeFull(MsgId,PipeId,CFE_SB_DEFAULT_QOS,MsgLim, - (uint8)CFE_SB_MSG_LOCAL); + return CFE_SB_SubscribeFull(MsgId, PipeId, CFE_SB_DEFAULT_QOS, MsgLim, (uint8)CFE_SB_MSG_LOCAL); -}/* end CFE_SB_SubscribeLocal */ +} /* end CFE_SB_SubscribeLocal */ /* * Function: CFE_SB_Subscribe - See API and header file for details */ -int32 CFE_SB_Subscribe(CFE_SB_MsgId_t MsgId, - CFE_SB_PipeId_t PipeId) +int32 CFE_SB_Subscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) { - return CFE_SB_SubscribeFull(MsgId,PipeId,CFE_SB_DEFAULT_QOS, - (uint16)CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, - (uint8)CFE_SB_MSG_GLOBAL); - -}/* end CFE_SB_Subscribe */ + return CFE_SB_SubscribeFull(MsgId, PipeId, CFE_SB_DEFAULT_QOS, (uint16)CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, + (uint8)CFE_SB_MSG_GLOBAL); +} /* end CFE_SB_Subscribe */ /****************************************************************************** ** Name: CFE_SB_SubscribeFull @@ -917,28 +895,25 @@ int32 CFE_SB_Subscribe(CFE_SB_MsgId_t MsgId, ** Status ** ******************************************************************************/ -int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, - CFE_SB_PipeId_t PipeId, - CFE_SB_Qos_t Quality, - uint16 MsgLim, - uint8 Scope) +int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality, uint16 MsgLim, + uint8 Scope) { - CFE_SBR_RouteId_t RouteId; - CFE_SB_PipeD_t *PipeDscPtr; - int32 Status; - CFE_ES_TaskId_t TskId; - CFE_ES_AppId_t AppId; + CFE_SBR_RouteId_t RouteId; + CFE_SB_PipeD_t * PipeDscPtr; + int32 Status; + CFE_ES_TaskId_t TskId; + CFE_ES_AppId_t AppId; CFE_SB_DestinationD_t *DestPtr; - uint32 DestCount; - char FullName[(OS_MAX_API_NAME * 2)]; - char PipeName[OS_MAX_API_NAME]; - uint32 Collisions; - uint16 PendingEventID; + uint32 DestCount; + char FullName[(OS_MAX_API_NAME * 2)]; + char PipeName[OS_MAX_API_NAME]; + uint32 Collisions; + uint16 PendingEventID; PendingEventID = 0; - Status = CFE_SUCCESS; - DestPtr = NULL; - Collisions = 0; + Status = CFE_SUCCESS; + DestPtr = NULL; + Collisions = 0; /* get the callers Application Id */ CFE_ES_GetAppID(&AppId); @@ -947,25 +922,25 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_ES_GetTaskID(&TskId); /* take semaphore to prevent a task switch during this call */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* check that the pipe has been created */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); if (!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) { PendingEventID = CFE_SB_SUB_INV_PIPE_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else if (!CFE_RESOURCEID_TEST_EQUAL(PipeDscPtr->AppId, AppId)) { PendingEventID = CFE_SB_SUB_INV_CALLER_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } /* check message id key and scope */ else if (!CFE_SB_IsValidMsgId(MsgId) || (Scope > 1)) { PendingEventID = CFE_SB_SUB_ARG_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { @@ -981,17 +956,17 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, if (!CFE_SBR_IsValidRouteId(RouteId)) { PendingEventID = CFE_SB_MAX_MSGS_MET_EID; - Status = CFE_SB_MAX_MSGS_MET; + Status = CFE_SB_MAX_MSGS_MET; } else { /* Increment the MsgIds in use ctr and if it's > the high water mark,*/ /* adjust the high water mark */ CFE_SB_Global.StatTlmMsg.Payload.MsgIdsInUse++; - if(CFE_SB_Global.StatTlmMsg.Payload.MsgIdsInUse > CFE_SB_Global.StatTlmMsg.Payload.PeakMsgIdsInUse) + if (CFE_SB_Global.StatTlmMsg.Payload.MsgIdsInUse > CFE_SB_Global.StatTlmMsg.Payload.PeakMsgIdsInUse) { CFE_SB_Global.StatTlmMsg.Payload.PeakMsgIdsInUse = CFE_SB_Global.StatTlmMsg.Payload.MsgIdsInUse; - }/* end if */ + } /* end if */ } } } @@ -1000,9 +975,7 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, if (Status == CFE_SUCCESS) { DestCount = 0; - for (DestPtr = CFE_SBR_GetDestListHeadPtr(RouteId); - DestPtr != NULL; - DestPtr = DestPtr->Next) + for (DestPtr = CFE_SBR_GetDestListHeadPtr(RouteId); DestPtr != NULL; DestPtr = DestPtr->Next) { ++DestCount; @@ -1017,47 +990,48 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, if (DestCount >= CFE_PLATFORM_SB_MAX_DEST_PER_PKT) { PendingEventID = CFE_SB_MAX_DESTS_MET_EID; - Status = CFE_SB_MAX_DESTS_MET; + Status = CFE_SB_MAX_DESTS_MET; break; } - } /* If no existing dest found, add one now */ if (DestPtr == NULL) { DestPtr = CFE_SB_GetDestinationBlk(); - if(DestPtr == NULL) + if (DestPtr == NULL) { PendingEventID = CFE_SB_DEST_BLK_ERR_EID; - Status = CFE_SB_BUF_ALOC_ERR; + Status = CFE_SB_BUF_ALOC_ERR; } else { /* initialize destination block */ - DestPtr->PipeId = PipeId; + DestPtr->PipeId = PipeId; DestPtr->MsgId2PipeLim = MsgLim; - DestPtr->Active = CFE_SB_ACTIVE; - DestPtr->BuffCount = 0; - DestPtr->DestCnt = 0; - DestPtr->Scope = Scope; - DestPtr->Prev = NULL; - DestPtr->Next = NULL; + DestPtr->Active = CFE_SB_ACTIVE; + DestPtr->BuffCount = 0; + DestPtr->DestCnt = 0; + DestPtr->Scope = Scope; + DestPtr->Prev = NULL; + DestPtr->Next = NULL; /* add destination node */ CFE_SB_AddDestNode(RouteId, DestPtr); CFE_SB_Global.StatTlmMsg.Payload.SubscriptionsInUse++; - if(CFE_SB_Global.StatTlmMsg.Payload.SubscriptionsInUse > CFE_SB_Global.StatTlmMsg.Payload.PeakSubscriptionsInUse) + if (CFE_SB_Global.StatTlmMsg.Payload.SubscriptionsInUse > + CFE_SB_Global.StatTlmMsg.Payload.PeakSubscriptionsInUse) { - CFE_SB_Global.StatTlmMsg.Payload.PeakSubscriptionsInUse = CFE_SB_Global.StatTlmMsg.Payload.SubscriptionsInUse; + CFE_SB_Global.StatTlmMsg.Payload.PeakSubscriptionsInUse = + CFE_SB_Global.StatTlmMsg.Payload.SubscriptionsInUse; } } } } /* Increment counter before unlock */ - switch(PendingEventID) + switch (PendingEventID) { case CFE_SB_SUB_INV_PIPE_EID: case CFE_SB_SUB_INV_CALLER_EID: @@ -1072,71 +1046,71 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, break; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* Send events now */ if (PendingEventID != 0) { CFE_SB_GetPipeName(PipeName, sizeof(PipeName), PipeId); - switch(PendingEventID) + switch (PendingEventID) { - case CFE_SB_DUP_SUBSCRIP_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_DUP_SUBSCRIP_EID,CFE_EVS_EventType_INFORMATION,CFE_SB_Global.AppId, - "Duplicate Subscription,MsgId 0x%x on %s pipe,app %s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - PipeName,CFE_SB_GetAppTskName(TskId,FullName)); - break; + case CFE_SB_DUP_SUBSCRIP_EID: + CFE_EVS_SendEventWithAppID(CFE_SB_DUP_SUBSCRIP_EID, CFE_EVS_EventType_INFORMATION, CFE_SB_Global.AppId, + "Duplicate Subscription,MsgId 0x%x on %s pipe,app %s", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), PipeName, + CFE_SB_GetAppTskName(TskId, FullName)); + break; - case CFE_SB_SUB_INV_CALLER_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SUB_INV_CALLER_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Subscribe Err:Caller(%s) is not the owner of pipe %lu,Msg=0x%x", - CFE_SB_GetAppTskName(TskId,FullName),CFE_RESOURCEID_TO_ULONG(PipeId), - (unsigned int)CFE_SB_MsgIdToValue(MsgId)); - break; + case CFE_SB_SUB_INV_CALLER_EID: + CFE_EVS_SendEventWithAppID(CFE_SB_SUB_INV_CALLER_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Subscribe Err:Caller(%s) is not the owner of pipe %lu,Msg=0x%x", + CFE_SB_GetAppTskName(TskId, FullName), CFE_RESOURCEID_TO_ULONG(PipeId), + (unsigned int)CFE_SB_MsgIdToValue(MsgId)); + break; - case CFE_SB_SUB_INV_PIPE_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SUB_INV_PIPE_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Subscribe Err:Invalid Pipe Id,Msg=0x%x,PipeId=%lu,App %s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(PipeId), CFE_SB_GetAppTskName(TskId,FullName)); - break; + case CFE_SB_SUB_INV_PIPE_EID: + CFE_EVS_SendEventWithAppID(CFE_SB_SUB_INV_PIPE_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Subscribe Err:Invalid Pipe Id,Msg=0x%x,PipeId=%lu,App %s", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName)); + break; - case CFE_SB_DEST_BLK_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_DEST_BLK_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Subscribe Err:Request for Destination Blk failed for Msg 0x%x", - (unsigned int)CFE_SB_MsgIdToValue(MsgId)); - break; + case CFE_SB_DEST_BLK_ERR_EID: + CFE_EVS_SendEventWithAppID(CFE_SB_DEST_BLK_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Subscribe Err:Request for Destination Blk failed for Msg 0x%x", + (unsigned int)CFE_SB_MsgIdToValue(MsgId)); + break; - case CFE_SB_MAX_DESTS_MET_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_MAX_DESTS_MET_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Subscribe Err:Max Dests(%d)In Use For Msg 0x%x,pipe %s,app %s", - CFE_PLATFORM_SB_MAX_DEST_PER_PKT, (unsigned int)CFE_SB_MsgIdToValue(MsgId), - PipeName, CFE_SB_GetAppTskName(TskId,FullName)); - break; + case CFE_SB_MAX_DESTS_MET_EID: + CFE_EVS_SendEventWithAppID(CFE_SB_MAX_DESTS_MET_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Subscribe Err:Max Dests(%d)In Use For Msg 0x%x,pipe %s,app %s", + CFE_PLATFORM_SB_MAX_DEST_PER_PKT, (unsigned int)CFE_SB_MsgIdToValue(MsgId), + PipeName, CFE_SB_GetAppTskName(TskId, FullName)); + break; - case CFE_SB_MAX_MSGS_MET_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_MAX_MSGS_MET_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Subscribe Err:Max Msgs(%d)In Use,MsgId 0x%x,pipe %s,app %s", - CFE_PLATFORM_SB_MAX_MSG_IDS, (unsigned int)CFE_SB_MsgIdToValue(MsgId), - PipeName, CFE_SB_GetAppTskName(TskId,FullName)); - break; + case CFE_SB_MAX_MSGS_MET_EID: + CFE_EVS_SendEventWithAppID(CFE_SB_MAX_MSGS_MET_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Subscribe Err:Max Msgs(%d)In Use,MsgId 0x%x,pipe %s,app %s", + CFE_PLATFORM_SB_MAX_MSG_IDS, (unsigned int)CFE_SB_MsgIdToValue(MsgId), + PipeName, CFE_SB_GetAppTskName(TskId, FullName)); + break; - case CFE_SB_SUB_ARG_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SUB_ARG_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Subscribe Err:Bad Arg,MsgId 0x%x,PipeId %lu,app %s,scope %d", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName),Scope); - break; + case CFE_SB_SUB_ARG_ERR_EID: + CFE_EVS_SendEventWithAppID(CFE_SB_SUB_ARG_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Subscribe Err:Bad Arg,MsgId 0x%x,PipeId %lu,app %s,scope %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName), Scope); + break; } } else if (Status == CFE_SUCCESS) { /* If no other event pending, send a debug event indicating success */ - CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RCVD_EID,CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "Subscription Rcvd:MsgId 0x%x on PipeId %lu,app %s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RCVD_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "Subscription Rcvd:MsgId 0x%x on PipeId %lu,app %s", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName)); } if (Status == CFE_SUCCESS && Scope == CFE_SB_MSG_GLOBAL) @@ -1147,14 +1121,13 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, if (Collisions != 0) { CFE_EVS_SendEventWithAppID(CFE_SB_HASHCOLLISION_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, - "Msg hash collision: MsgId = 0x%x, collisions = %u", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)Collisions); + "Msg hash collision: MsgId = 0x%x, collisions = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)Collisions); } return Status; -}/* end CFE_SB_SubscribeFull */ - +} /* end CFE_SB_SubscribeFull */ /* * Function: CFE_SB_Unsubscribe - See API and header file for details @@ -1162,17 +1135,16 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, int32 CFE_SB_Unsubscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) { CFE_ES_AppId_t CallerId; - int32 Status = 0; + int32 Status = 0; /* get the callers Application Id */ CFE_ES_GetAppID(&CallerId); - Status = CFE_SB_UnsubscribeFull(MsgId, PipeId, (uint8)CFE_SB_MSG_GLOBAL,CallerId); + Status = CFE_SB_UnsubscribeFull(MsgId, PipeId, (uint8)CFE_SB_MSG_GLOBAL, CallerId); return Status; -}/* end CFE_SB_Unsubscribe */ - +} /* end CFE_SB_Unsubscribe */ /* * Function: CFE_SB_UnsubscribeLocal - See API and header file for details @@ -1180,17 +1152,16 @@ int32 CFE_SB_Unsubscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) int32 CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) { CFE_ES_AppId_t CallerId; - int32 Status = 0; + int32 Status = 0; /* get the callers Application Id */ CFE_ES_GetAppID(&CallerId); - Status = CFE_SB_UnsubscribeFull(MsgId, PipeId, (uint8)CFE_SB_MSG_LOCAL,CallerId); + Status = CFE_SB_UnsubscribeFull(MsgId, PipeId, (uint8)CFE_SB_MSG_LOCAL, CallerId); return Status; -}/* end CFE_SB_UnsubscribeLocal */ - +} /* end CFE_SB_UnsubscribeLocal */ /****************************************************************************** ** Name: CFE_SB_UnsubscribeAppId @@ -1214,18 +1185,15 @@ int32 CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) ** Status ** ******************************************************************************/ -int32 CFE_SB_UnsubscribeWithAppId(CFE_SB_MsgId_t MsgId, - CFE_SB_PipeId_t PipeId, - CFE_ES_AppId_t AppId) +int32 CFE_SB_UnsubscribeWithAppId(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_ES_AppId_t AppId) { - int32 Status = 0; + int32 Status = 0; Status = CFE_SB_UnsubscribeFull(MsgId, PipeId, (uint8)CFE_SB_MSG_LOCAL, AppId); return Status; -}/* end CFE_SB_UnsubscribeWithAppId */ - +} /* end CFE_SB_UnsubscribeWithAppId */ /****************************************************************************** ** Name: CFE_SB_UnsubscribeFull @@ -1255,46 +1223,45 @@ int32 CFE_SB_UnsubscribeWithAppId(CFE_SB_MsgId_t MsgId, ** Status ** ******************************************************************************/ -int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, - uint8 Scope,CFE_ES_AppId_t AppId) +int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint8 Scope, CFE_ES_AppId_t AppId) { - int32 Status; - CFE_SBR_RouteId_t RouteId; - CFE_ES_TaskId_t TskId; - CFE_SB_DestinationD_t *DestPtr; - char FullName[(OS_MAX_API_NAME * 2)]; - char PipeName[OS_MAX_API_NAME]; - CFE_SB_PipeD_t *PipeDscPtr; - uint16 PendingEventID; + int32 Status; + CFE_SBR_RouteId_t RouteId; + CFE_ES_TaskId_t TskId; + CFE_SB_DestinationD_t *DestPtr; + char FullName[(OS_MAX_API_NAME * 2)]; + char PipeName[OS_MAX_API_NAME]; + CFE_SB_PipeD_t * PipeDscPtr; + uint16 PendingEventID; PendingEventID = 0; - Status = CFE_SUCCESS; - DestPtr = NULL; + Status = CFE_SUCCESS; + DestPtr = NULL; /* get TaskId of caller for events */ CFE_ES_GetTaskID(&TskId); /* take semaphore to prevent a task switch during this call */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* check that the pipe has been created */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); if (!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) { PendingEventID = CFE_SB_UNSUB_INV_PIPE_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } /* if given 'AppId' is not the owner of the pipe, send error event and return */ else if (!CFE_RESOURCEID_TEST_EQUAL(PipeDscPtr->AppId, AppId)) { PendingEventID = CFE_SB_UNSUB_INV_CALLER_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } /* check input parameters */ else if (!CFE_SB_IsValidMsgId(MsgId) || (Scope > 1)) { PendingEventID = CFE_SB_UNSUB_ARG_ERR_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { @@ -1302,7 +1269,7 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, RouteId = CFE_SBR_GetRouteId(MsgId); /* if there have never been subscriptions for this message id... */ - if(!CFE_SBR_IsValidRouteId(RouteId)) + if (!CFE_SBR_IsValidRouteId(RouteId)) { PendingEventID = CFE_SB_UNSUB_NO_SUBS_EID; /* Status stays CFE_SUCCESS here */ @@ -1312,83 +1279,83 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, /* Get the destination pointer */ DestPtr = CFE_SB_GetDestPtr(RouteId, PipeId); - if(DestPtr != NULL) + if (DestPtr != NULL) { /* match found, remove destination */ - CFE_SB_RemoveDest(RouteId,DestPtr); + CFE_SB_RemoveDest(RouteId, DestPtr); } else { PendingEventID = CFE_SB_UNSUB_NO_SUBS_EID; } } - }/* end if */ + } /* end if */ - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); if (PendingEventID != 0) { - switch(PendingEventID) + switch (PendingEventID) { case CFE_SB_UNSUB_NO_SUBS_EID: CFE_SB_GetPipeName(PipeName, sizeof(PipeName), PipeId); - CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_NO_SUBS_EID,CFE_EVS_EventType_INFORMATION,CFE_SB_Global.AppId, - "Unsubscribe Err:No subs for Msg 0x%x on %s,app %s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - PipeName,CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_NO_SUBS_EID, CFE_EVS_EventType_INFORMATION, CFE_SB_Global.AppId, + "Unsubscribe Err:No subs for Msg 0x%x on %s,app %s", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), PipeName, + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_UNSUB_INV_PIPE_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_INV_PIPE_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Unsubscribe Err:Invalid Pipe Id Msg=0x%x,Pipe=%lu,app=%s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_INV_PIPE_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Unsubscribe Err:Invalid Pipe Id Msg=0x%x,Pipe=%lu,app=%s", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_UNSUB_INV_CALLER_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_INV_CALLER_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Unsubscribe Err:Caller(%s) is not the owner of pipe %lu,Msg=0x%x", - CFE_SB_GetAppTskName(TskId,FullName),CFE_RESOURCEID_TO_ULONG(PipeId), - (unsigned int)CFE_SB_MsgIdToValue(MsgId)); + CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_INV_CALLER_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Unsubscribe Err:Caller(%s) is not the owner of pipe %lu,Msg=0x%x", + CFE_SB_GetAppTskName(TskId, FullName), CFE_RESOURCEID_TO_ULONG(PipeId), + (unsigned int)CFE_SB_MsgIdToValue(MsgId)); break; case CFE_SB_UNSUB_ARG_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_ARG_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "UnSubscribe Err:Bad Arg,MsgId 0x%x,PipeId %lu,app %s,scope %d", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName),(int)Scope); + CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_ARG_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "UnSubscribe Err:Bad Arg,MsgId 0x%x,PipeId %lu,app %s,scope %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName), (int)Scope); break; } } else if (Status == CFE_SUCCESS) { /* if no other event pending, send a debug event for successful unsubscribe */ - CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_REMOVED_EID,CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "Subscription Removed:Msg 0x%x on pipe %lu,app %s", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_REMOVED_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "Subscription Removed:Msg 0x%x on pipe %lu,app %s", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName)); } return Status; -}/* end CFE_SB_UnsubscribeFull */ +} /* 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 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_TaskId_t TskId; - char FullName[(OS_MAX_API_NAME * 2)]; - CFE_SB_BufferD_t *BufDscPtr; - CFE_SBR_RouteId_t RouteId; - uint16 PendingEventID; + int32 Status; + CFE_MSG_Size_t Size = 0; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + CFE_ES_TaskId_t TskId; + char FullName[(OS_MAX_API_NAME * 2)]; + CFE_SB_BufferD_t *BufDscPtr; + CFE_SBR_RouteId_t RouteId; + uint16 PendingEventID; PendingEventID = 0; - BufDscPtr = NULL; - RouteId = CFE_SBR_INVALID_ROUTE_ID; + BufDscPtr = NULL; + RouteId = CFE_SBR_INVALID_ROUTE_ID; Status = CFE_SB_TransmitMsgValidate(MsgPtr, &MsgId, &Size, &RouteId); @@ -1396,13 +1363,13 @@ int32 CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount if (Status == CFE_SUCCESS && CFE_SBR_IsValidRouteId(RouteId)) { - /* Get buffer - note this pre-initializes the returned buffer with + /* Get buffer - note this pre-initializes the returned buffer with * a use count of 1, which refers to this task as it fills the buffer. */ BufDscPtr = CFE_SB_GetBufferFromPool(Size); if (BufDscPtr == NULL) { PendingEventID = CFE_SB_GET_BUF_ERR_EID; - Status = CFE_SB_BUF_ALOC_ERR; + Status = CFE_SB_BUF_ALOC_ERR; } } @@ -1422,36 +1389,36 @@ int32 CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount /* * If a buffer was obtained above, then copy the content into it * and broadcast it to all subscribers in the route. - * + * * Note - if there is no route / no subscribers, the "Status" will - * be CFE_SUCCESS because CFE_SB_TransmitMsgValidate() succeeded, - * but there will be no buffer because CFE_SBR_IsValidRouteId() returned - * false. - * - * But if the desciptor is non-null it means the message is valid and + * be CFE_SUCCESS because CFE_SB_TransmitMsgValidate() succeeded, + * but there will be no buffer because CFE_SBR_IsValidRouteId() returned + * false. + * + * But if the desciptor is non-null it means the message is valid and * there is a route to send it to. */ if (BufDscPtr != NULL) { /* Copy actual message content into buffer and set its metadata */ memcpy(&BufDscPtr->Content, MsgPtr, Size); - BufDscPtr->MsgId = MsgId; - BufDscPtr->ContentSize = Size; + BufDscPtr->MsgId = MsgId; + BufDscPtr->ContentSize = Size; BufDscPtr->AutoSequence = IncrementSequenceCount; CFE_MSG_GetType(MsgPtr, &BufDscPtr->ContentType); - /* + /* * This routine will use best-effort to send to all subscribers, * increment the buffer use count for every successful delivery, * and send an event/increment counter for any unsucessful delivery. */ CFE_SB_BroadcastBufferToRoute(BufDscPtr, RouteId); - /* - * The broadcast function consumes the buffer, so it should not be - * accessed in this function anymore + /* + * The broadcast function consumes the buffer, so it should not be + * accessed in this function anymore */ - BufDscPtr = NULL; + BufDscPtr = NULL; } if (PendingEventID == CFE_SB_GET_BUF_ERR_EID) @@ -1459,15 +1426,15 @@ int32 CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount /* Get task id for events and Sender Info*/ CFE_ES_GetTaskID(&TskId); - if (CFE_SB_RequestToSendEvent(TskId,CFE_SB_GET_BUF_ERR_EID_BIT) == CFE_SB_GRANTED) + 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_Global.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); + CFE_EVS_SendEventWithAppID(CFE_SB_GET_BUF_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.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); + CFE_SB_FinishSendEvent(TskId, CFE_SB_GET_BUF_ERR_EID_BIT); } } @@ -1478,28 +1445,28 @@ int32 CFE_SB_TransmitMsg(CFE_MSG_Message_t *MsgPtr, bool IncrementSequenceCount /* * Function: CFE_SB_SendMsg - See API and header file for details */ -int32 CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr) +int32 CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr) { - int32 Status = 0; + int32 Status = 0; Status = CFE_SB_TransmitMsg(MsgPtr, true); return Status; -}/* end CFE_SB_SendMsg */ +} /* end CFE_SB_SendMsg */ /* * Function: CFE_SB_PassMsg - See API and header file for details */ -int32 CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr) +int32 CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr) { - int32 Status = 0; + int32 Status = 0; Status = CFE_SB_TransmitMsg(MsgPtr, false); return Status; -}/* end CFE_SB_PassMsg */ +} /* end CFE_SB_PassMsg */ #endif /* CFE_OMIT_DEPRECATED_6_8 */ /*****************************************************************************/ @@ -1511,24 +1478,22 @@ int32 CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr) * \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, +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_ES_TaskId_t TskId; - char FullName[(OS_MAX_API_NAME * 2)]; - uint16 PendingEventID; - int32 Status; + CFE_ES_TaskId_t TskId; + char FullName[(OS_MAX_API_NAME * 2)]; + uint16 PendingEventID; + int32 Status; PendingEventID = 0; - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; /* check input parameter */ if (MsgPtr == NULL) { PendingEventID = CFE_SB_SEND_BAD_ARG_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } if (Status == CFE_SUCCESS) @@ -1536,10 +1501,10 @@ int32 CFE_SB_TransmitMsgValidate(CFE_MSG_Message_t *MsgPtr, CFE_MSG_GetMsgId(MsgPtr, MsgIdPtr); /* validate the msgid in the message */ - if(!CFE_SB_IsValidMsgId(*MsgIdPtr)) + if (!CFE_SB_IsValidMsgId(*MsgIdPtr)) { PendingEventID = CFE_SB_SEND_INV_MSGID_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } } @@ -1548,15 +1513,15 @@ int32 CFE_SB_TransmitMsgValidate(CFE_MSG_Message_t *MsgPtr, CFE_MSG_GetSize(MsgPtr, SizePtr); /* Verify the size of the pkt is < or = the mission defined max */ - if(*SizePtr > CFE_MISSION_SB_MAX_SB_MSG_SIZE) + if (*SizePtr > CFE_MISSION_SB_MAX_SB_MSG_SIZE) { PendingEventID = CFE_SB_MSG_TOO_BIG_EID; - Status = CFE_SB_MSG_TOO_BIG; - }/* end if */ + Status = CFE_SB_MSG_TOO_BIG; + } /* end if */ } if (Status == CFE_SUCCESS) - { + { /* check the route, which should be done while locked */ CFE_SB_LockSharedData(__func__, __LINE__); @@ -1565,7 +1530,7 @@ int32 CFE_SB_TransmitMsgValidate(CFE_MSG_Message_t *MsgPtr, /* if there have been no subscriptions for this pkt, */ /* increment the dropped pkt cnt, send event and return success */ - if(!CFE_SBR_IsValidRouteId(*RouteIdPtr)) + if (!CFE_SBR_IsValidRouteId(*RouteIdPtr)) { CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter++; PendingEventID = CFE_SB_SEND_NO_SUBS_EID; @@ -1582,41 +1547,42 @@ int32 CFE_SB_TransmitMsgValidate(CFE_MSG_Message_t *MsgPtr, switch (PendingEventID) { case CFE_SB_SEND_BAD_ARG_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SEND_BAD_ARG_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Send Err:Bad input argument,Arg 0x%lx,App %s", - (unsigned long)MsgPtr,CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_SEND_BAD_ARG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Send Err:Bad input argument,Arg 0x%lx,App %s", (unsigned long)MsgPtr, + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_SEND_INV_MSGID_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SEND_INV_MSGID_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Send Err:Invalid MsgId(0x%x)in msg,App %s", - (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_SEND_INV_MSGID_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Send Err:Invalid MsgId(0x%x)in msg,App %s", + (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_MSG_TOO_BIG_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_MSG_TOO_BIG_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Send Err:Msg Too Big MsgId=0x%x,app=%s,size=%d,MaxSz=%d", - (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), - CFE_SB_GetAppTskName(TskId,FullName),(int)*SizePtr,CFE_MISSION_SB_MAX_SB_MSG_SIZE); + CFE_EVS_SendEventWithAppID(CFE_SB_MSG_TOO_BIG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Send Err:Msg Too Big MsgId=0x%x,app=%s,size=%d,MaxSz=%d", + (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), + CFE_SB_GetAppTskName(TskId, FullName), (int)*SizePtr, + CFE_MISSION_SB_MAX_SB_MSG_SIZE); break; case CFE_SB_SEND_NO_SUBS_EID: /* 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) + 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_Global.AppId, - "No subscribers for MsgId 0x%x,sender %s", - (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_SEND_NO_SUBS_EID, CFE_EVS_EventType_INFORMATION, + CFE_SB_Global.AppId, "No subscribers for MsgId 0x%x,sender %s", + (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 */ + CFE_SB_FinishSendEvent(TskId, CFE_SB_SEND_NO_SUBS_EID_BIT); + } /* end if */ break; } - }/* end if */ + } /* end if */ return Status; } @@ -1631,15 +1597,15 @@ int32 CFE_SB_TransmitMsgValidate(CFE_MSG_Message_t *MsgPtr, */ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_t RouteId) { - CFE_ES_AppId_t AppId; - CFE_ES_TaskId_t TskId; - CFE_SB_DestinationD_t *DestPtr; - CFE_SB_PipeD_t *PipeDscPtr; - CFE_SB_EventBuf_t SBSndErr; - int32 Status; - uint32 i; - char FullName[(OS_MAX_API_NAME * 2)]; - char PipeName[OS_MAX_API_NAME]; + CFE_ES_AppId_t AppId; + CFE_ES_TaskId_t TskId; + CFE_SB_DestinationD_t *DestPtr; + CFE_SB_PipeD_t * PipeDscPtr; + CFE_SB_EventBuf_t SBSndErr; + int32 Status; + uint32 i; + char FullName[(OS_MAX_API_NAME * 2)]; + char PipeName[OS_MAX_API_NAME]; SBSndErr.EvtsToSnd = 0; @@ -1650,7 +1616,7 @@ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_ CFE_ES_GetTaskID(&TskId); /* take semaphore to prevent a task switch during processing */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* For an invalid route / no subsribers this whole logic can be skipped */ if (CFE_SBR_IsValidRouteId(RouteId)) @@ -1742,18 +1708,18 @@ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_ } /* end loop over destinations */ } - /* - * If any specific delivery issues occured, also increment the + /* + * If any specific delivery issues occured, also increment the * general error count before releasing the lock. */ - if (SBSndErr.EvtsToSnd > 0) + if (SBSndErr.EvtsToSnd > 0) { CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter++; } /* * Remove this from whatever list it was in - * + * * If it was a singleton/new buffer this has no effect. * If it was a zero-copy buffer this removes it from the ZeroCopyList. */ @@ -1776,75 +1742,78 @@ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_ CFE_SB_DecrBufUseCnt(BufDscPtr); /* release the semaphore */ - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* send an event for each pipe write error that may have occurred */ - for(i=0;i < SBSndErr.EvtsToSnd; i++) + for (i = 0; i < SBSndErr.EvtsToSnd; i++) { - if(SBSndErr.EvtBuf[i].EventId == CFE_SB_MSGID_LIM_ERR_EID) + if (SBSndErr.EvtBuf[i].EventId == CFE_SB_MSGID_LIM_ERR_EID) { /* Determine if event can be sent without causing recursive event problem */ - if(CFE_SB_RequestToSendEvent(TskId,CFE_SB_MSGID_LIM_ERR_EID_BIT) == CFE_SB_GRANTED){ - - CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId); + if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_MSGID_LIM_ERR_EID_BIT) == CFE_SB_GRANTED) + { - CFE_ES_PerfLogEntry(CFE_MISSION_SB_MSG_LIM_PERF_ID); - CFE_ES_PerfLogExit(CFE_MISSION_SB_MSG_LIM_PERF_ID); + CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId); - CFE_EVS_SendEventWithAppID(CFE_SB_MSGID_LIM_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Msg Limit Err,MsgId 0x%x,pipe %s,sender %s", - (unsigned int)CFE_SB_MsgIdToValue(BufDscPtr->MsgId), - PipeName, CFE_SB_GetAppTskName(TskId,FullName)); + CFE_ES_PerfLogEntry(CFE_MISSION_SB_MSG_LIM_PERF_ID); + CFE_ES_PerfLogExit(CFE_MISSION_SB_MSG_LIM_PERF_ID); - /* clear the bit so the task may send this event again */ - CFE_SB_FinishSendEvent(TskId,CFE_SB_MSGID_LIM_ERR_EID_BIT); - }/* end if */ + CFE_EVS_SendEventWithAppID(CFE_SB_MSGID_LIM_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Msg Limit Err,MsgId 0x%x,pipe %s,sender %s", + (unsigned int)CFE_SB_MsgIdToValue(BufDscPtr->MsgId), PipeName, + CFE_SB_GetAppTskName(TskId, FullName)); - }else if(SBSndErr.EvtBuf[i].EventId == CFE_SB_Q_FULL_ERR_EID){ + /* clear the bit so the task may send this event again */ + CFE_SB_FinishSendEvent(TskId, CFE_SB_MSGID_LIM_ERR_EID_BIT); + } /* end if */ + } + else if (SBSndErr.EvtBuf[i].EventId == CFE_SB_Q_FULL_ERR_EID) + { /* Determine if event can be sent without causing recursive event problem */ - if(CFE_SB_RequestToSendEvent(TskId,CFE_SB_Q_FULL_ERR_EID_BIT) == CFE_SB_GRANTED){ - - CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId); + if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_Q_FULL_ERR_EID_BIT) == CFE_SB_GRANTED) + { - CFE_ES_PerfLogEntry(CFE_MISSION_SB_PIPE_OFLOW_PERF_ID); - CFE_ES_PerfLogExit(CFE_MISSION_SB_PIPE_OFLOW_PERF_ID); + CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId); - CFE_EVS_SendEventWithAppID(CFE_SB_Q_FULL_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Pipe Overflow,MsgId 0x%x,pipe %s,sender %s", - (unsigned int)CFE_SB_MsgIdToValue(BufDscPtr->MsgId), - PipeName, CFE_SB_GetAppTskName(TskId,FullName)); + CFE_ES_PerfLogEntry(CFE_MISSION_SB_PIPE_OFLOW_PERF_ID); + CFE_ES_PerfLogExit(CFE_MISSION_SB_PIPE_OFLOW_PERF_ID); - /* clear the bit so the task may send this event again */ - CFE_SB_FinishSendEvent(TskId,CFE_SB_Q_FULL_ERR_EID_BIT); - }/* end if */ + CFE_EVS_SendEventWithAppID(CFE_SB_Q_FULL_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Pipe Overflow,MsgId 0x%x,pipe %s,sender %s", + (unsigned int)CFE_SB_MsgIdToValue(BufDscPtr->MsgId), PipeName, + CFE_SB_GetAppTskName(TskId, FullName)); - }else{ + /* clear the bit so the task may send this event again */ + CFE_SB_FinishSendEvent(TskId, CFE_SB_Q_FULL_ERR_EID_BIT); + } /* end if */ + } + else + { /* Determine if event can be sent without causing recursive event problem */ - if(CFE_SB_RequestToSendEvent(TskId,CFE_SB_Q_WR_ERR_EID_BIT) == CFE_SB_GRANTED){ + if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_Q_WR_ERR_EID_BIT) == CFE_SB_GRANTED) + { - CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId); + CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId); - CFE_EVS_SendEventWithAppID(CFE_SB_Q_WR_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Pipe Write Err,MsgId 0x%x,pipe %s,sender %s,stat 0x%x", - (unsigned int)CFE_SB_MsgIdToValue(BufDscPtr->MsgId), - PipeName, CFE_SB_GetAppTskName(TskId,FullName), - (unsigned int)SBSndErr.EvtBuf[i].ErrStat); + CFE_EVS_SendEventWithAppID(CFE_SB_Q_WR_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Pipe Write Err,MsgId 0x%x,pipe %s,sender %s,stat 0x%x", + (unsigned int)CFE_SB_MsgIdToValue(BufDscPtr->MsgId), PipeName, + CFE_SB_GetAppTskName(TskId, FullName), + (unsigned int)SBSndErr.EvtBuf[i].ErrStat); - /* clear the bit so the task may send this event again */ - CFE_SB_FinishSendEvent(TskId,CFE_SB_Q_WR_ERR_EID_BIT); - }/* end if */ + /* clear the bit so the task may send this event again */ + CFE_SB_FinishSendEvent(TskId, CFE_SB_Q_WR_ERR_EID_BIT); + } /* end if */ - }/* end if */ + } /* end if */ } } #ifndef CFE_OMIT_DEPRECATED_6_8 -int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, - CFE_SB_PipeId_t PipeId, - int32 TimeOut) +int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut) { return CFE_SB_ReceiveBuffer(BufPtr, PipeId, TimeOut); } @@ -1853,16 +1822,14 @@ int32 CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, /* * Function: CFE_SB_ReceiveBuffer - See API and header file for details */ -int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_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; int32 RcvStatus; - CFE_SB_BufferD_t *BufDscPtr; + CFE_SB_BufferD_t * BufDscPtr; size_t BufDscSize; - CFE_SB_PipeD_t *PipeDscPtr; - CFE_SB_DestinationD_t *DestPtr; + CFE_SB_PipeD_t * PipeDscPtr; + CFE_SB_DestinationD_t *DestPtr; CFE_SBR_RouteId_t RouteId; CFE_ES_TaskId_t TskId; uint16 PendingEventID; @@ -1871,20 +1838,20 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, char FullName[(OS_MAX_API_NAME * 2)]; PendingEventID = 0; - Status = CFE_SUCCESS; - SysTimeout = OS_PEND; - SysQueueId = OS_OBJECT_ID_UNDEFINED; - PipeDscPtr = NULL; - BufDscPtr = NULL; - DestPtr = NULL; - BufDscSize = 0; - RcvStatus = OS_SUCCESS; - + Status = CFE_SUCCESS; + SysTimeout = OS_PEND; + SysQueueId = OS_OBJECT_ID_UNDEFINED; + PipeDscPtr = NULL; + BufDscPtr = NULL; + DestPtr = NULL; + BufDscSize = 0; + RcvStatus = OS_SUCCESS; + /* * Check input args and see if any are bad, which require * a "BAD_ARG_EID" to be generated. - * - * Also translate the timeout here. Timeouts greater than 0 + * + * Also translate the timeout here. Timeouts greater than 0 * may be passed to OSAL directly, but the two fixed constants * CFE_SB_PEND_FOREVER and CFE_SB_POLL are checked explicitly, * to maintain API independence - even though the values are @@ -1894,7 +1861,7 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, if (BufPtr == NULL) { PendingEventID = CFE_SB_RCV_BAD_ARG_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else if (TimeOut > 0) { @@ -1909,43 +1876,43 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, { /* any other timeout value is invalid */ PendingEventID = CFE_SB_RCV_BAD_ARG_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } /* If OK, then lock and pull relevent info from Pipe Descriptor */ if (Status == CFE_SUCCESS) { - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); /* If the pipe does not exist or PipeId is out of range... */ - if(!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) + if (!CFE_SB_PipeDescIsMatch(PipeDscPtr, PipeId)) { PendingEventID = CFE_SB_BAD_PIPEID_EID; - Status = CFE_SB_BAD_ARGUMENT; + Status = CFE_SB_BAD_ARGUMENT; } else { /* Grab the queue ID */ SysQueueId = PipeDscPtr->SysQueueId; - /* - * Un-reference any previous buffer from the last call. - * - * NOTE: This is historical behavior where apps call CFE_SB_ReceiveBuffer() - * in the loop within the app's main task. There is currently no separate - * API to "free" or unreference a buffer that was returned from SB. - * - * Instead, each time this function is invoked, it is implicitly interpreted - * as an indication that the caller is done with the previous buffer. - * - * Unfortunately this prevents pipe IDs from being serviced/shared across - * multiple child tasks in a worker pattern design. This may be changed - * in a future version of CFE to decouple these actions, to allow for - * multiple workers to service the same pipe. - */ - if (PipeDscPtr->LastBuffer != NULL) + /* + * Un-reference any previous buffer from the last call. + * + * NOTE: This is historical behavior where apps call CFE_SB_ReceiveBuffer() + * in the loop within the app's main task. There is currently no separate + * API to "free" or unreference a buffer that was returned from SB. + * + * Instead, each time this function is invoked, it is implicitly interpreted + * as an indication that the caller is done with the previous buffer. + * + * Unfortunately this prevents pipe IDs from being serviced/shared across + * multiple child tasks in a worker pattern design. This may be changed + * in a future version of CFE to decouple these actions, to allow for + * multiple workers to service the same pipe. + */ + if (PipeDscPtr->LastBuffer != NULL) { /* Decrement the Buffer Use Count, which will Free buffer if it becomes 0 */ CFE_SB_DecrBufUseCnt(PipeDscPtr->LastBuffer); @@ -1953,29 +1920,25 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, } } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); } - /* + /* * If everything validated, then proceed to get a buffer from the queue. * This must be done OUTSIDE the SB lock, as this call likely blocks. */ if (Status == CFE_SUCCESS) { /* Read the buffer descriptor address from the queue. */ - RcvStatus = OS_QueueGet(SysQueueId, - &BufDscPtr, - sizeof(BufDscPtr), - &BufDscSize, - SysTimeout); + RcvStatus = OS_QueueGet(SysQueueId, &BufDscPtr, sizeof(BufDscPtr), &BufDscSize, SysTimeout); - /* + /* * translate the return value - - * - * CFE functions have their own set of RC values should not directly return OSAL codes + * + * CFE functions have their own set of RC values should not directly return OSAL codes * The size should always match. If it does not, then generate CFE_SB_Q_RD_ERR_EID. */ - if(RcvStatus == OS_SUCCESS && BufDscPtr != NULL && BufDscSize == sizeof(BufDscPtr)) + if (RcvStatus == OS_SUCCESS && BufDscPtr != NULL && BufDscSize == sizeof(BufDscPtr)) { /* Pass through */ } @@ -1993,16 +1956,16 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, { /* off-nominal condition, report an error event */ PendingEventID = CFE_SB_Q_RD_ERR_EID; - Status = CFE_SB_PIPE_RD_ERR; + Status = CFE_SB_PIPE_RD_ERR; } } /* Now re-lock to store the buffer in the pipe descriptor */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); if (Status == CFE_SUCCESS) { - /* + /* * NOTE: This uses the same PipeDscPtr that was found earlier. * Technically it is possible that the pipe was changed between now and then, * but the current PipeID definition doesn't really allow this to be detected. @@ -2019,8 +1982,8 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, CFE_SB_IncrBufUseCnt(BufDscPtr); PipeDscPtr->LastBuffer = BufDscPtr; - /* - * Also set the Receivers pointer to the address of the actual message + /* + * Also set the Receivers pointer to the address of the actual message * (currently this is "borrowing" the ref above, not its own ref) */ *BufPtr = &BufDscPtr->Content; @@ -2049,7 +2012,7 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, { /* should send the bad pipe ID event here too */ PendingEventID = CFE_SB_BAD_PIPEID_EID; - Status = CFE_SB_PIPE_RD_ERR; + Status = CFE_SB_PIPE_RD_ERR; } /* Always decrement the use count, for the ref that was in the queue */ @@ -2070,7 +2033,7 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, } } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* Now actually send the event, after unlocking (do not call EVS with SB locked) */ if (PendingEventID != 0) @@ -2078,22 +2041,23 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, /* get task id for events */ CFE_ES_GetTaskID(&TskId); - switch(PendingEventID) + switch (PendingEventID) { case CFE_SB_Q_RD_ERR_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_Q_RD_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Pipe Read Err,pipe %lu,app %s,stat 0x%x", - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName),(unsigned int)RcvStatus); + CFE_EVS_SendEventWithAppID(CFE_SB_Q_RD_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Pipe Read Err,pipe %lu,app %s,stat 0x%x", CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName), (unsigned int)RcvStatus); break; case CFE_SB_RCV_BAD_ARG_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_RCV_BAD_ARG_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Rcv Err:Bad Input Arg:BufPtr 0x%lx,pipe %lu,t/o %d,app %s", - (unsigned long)BufPtr,CFE_RESOURCEID_TO_ULONG(PipeId),(int)TimeOut,CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_RCV_BAD_ARG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Rcv Err:Bad Input Arg:BufPtr 0x%lx,pipe %lu,t/o %d,app %s", + (unsigned long)BufPtr, CFE_RESOURCEID_TO_ULONG(PipeId), (int)TimeOut, + CFE_SB_GetAppTskName(TskId, FullName)); break; case CFE_SB_BAD_PIPEID_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_BAD_PIPEID_EID,CFE_EVS_EventType_ERROR,CFE_SB_Global.AppId, - "Rcv Err:PipeId %lu does not exist,app %s", - CFE_RESOURCEID_TO_ULONG(PipeId),CFE_SB_GetAppTskName(TskId,FullName)); + CFE_EVS_SendEventWithAppID(CFE_SB_BAD_PIPEID_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Rcv Err:PipeId %lu does not exist,app %s", CFE_RESOURCEID_TO_ULONG(PipeId), + CFE_SB_GetAppTskName(TskId, FullName)); break; } } @@ -2107,21 +2071,19 @@ int32 CFE_SB_ReceiveBuffer(CFE_SB_Buffer_t **BufPtr, return Status; } - /* * Function: CFE_SB_ZeroCopyGetPtr - See API and header file for details */ -CFE_SB_Buffer_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) { - CFE_ES_AppId_t AppId; - CFE_SB_BufferD_t *BufDscPtr; - CFE_SB_Buffer_t *BufPtr; + CFE_ES_AppId_t AppId; + CFE_SB_BufferD_t *BufDscPtr; + CFE_SB_Buffer_t * BufPtr; - AppId = CFE_ES_APPID_UNDEFINED; + AppId = CFE_ES_APPID_UNDEFINED; BufDscPtr = NULL; - BufPtr = NULL; - if(MsgSize > CFE_MISSION_SB_MAX_SB_MSG_SIZE) + BufPtr = NULL; + if (MsgSize > CFE_MISSION_SB_MAX_SB_MSG_SIZE) { CFE_ES_WriteToSysLog(" CFE_SB:ZeroCopyGetPtr-Failed, MsgSize is too large\n"); return NULL; @@ -2136,31 +2098,31 @@ CFE_SB_Buffer_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, /* get callers AppId */ if (CFE_ES_GetAppID(&AppId) == CFE_SUCCESS) { - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* - * All this needs to do is get a descriptor from the pool, - * and associate that descriptor with this app ID, so it - * can be freed if this app is deleted before it uses it. - */ + * All this needs to do is get a descriptor from the pool, + * and associate that descriptor with this app ID, so it + * can be freed if this app is deleted before it uses it. + */ BufDscPtr = CFE_SB_GetBufferFromPool(MsgSize); if (BufDscPtr != NULL) { /* Track the buffer as a zero-copy assigned to this app ID */ BufDscPtr->AppId = AppId; - BufPtr = &BufDscPtr->Content; + BufPtr = &BufDscPtr->Content; CFE_SB_TrackingListAdd(&CFE_SB_Global.ZeroCopyList, &BufDscPtr->Link); } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); } if (BufPtr != NULL) { - /* + /* * If a buffer was obtained, wipe it now. - * (This ensures the buffer is fully cleared at least once, + * (This ensures the buffer is fully cleared at least once, * no stale data from a prior use of the same memory) */ memset(BufPtr, 0, MsgSize); @@ -2170,17 +2132,16 @@ CFE_SB_Buffer_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, BufferHandle->BufDscPtr = BufDscPtr; return BufPtr; -}/* CFE_SB_ZeroCopyGetPtr */ +} /* CFE_SB_ZeroCopyGetPtr */ /* * Helper functions to do sanity checks on the Zero Copy handle + Buffer combo. - * + * * Note in a future CFE version the API can be simplified - * only one of these pointers is strictly needed, since they * should refer to the same buffer descriptor object. */ -int32 CFE_SB_ZeroCopyHandleValidate(CFE_SB_Buffer_t *BufPtr, - CFE_SB_ZeroCopyHandle_t ZeroCopyHandle) +int32 CFE_SB_ZeroCopyHandleValidate(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t ZeroCopyHandle) { /* * Sanity Check that the pointers are not NULL @@ -2194,8 +2155,7 @@ int32 CFE_SB_ZeroCopyHandleValidate(CFE_SB_Buffer_t *BufPtr, * Check that the descriptor is actually a "zero copy" type, * and that it refers to same actual message buffer. */ - if (!CFE_RESOURCEID_TEST_DEFINED(ZeroCopyHandle.BufDscPtr->AppId) || - (&ZeroCopyHandle.BufDscPtr->Content != BufPtr)) + if (!CFE_RESOURCEID_TEST_DEFINED(ZeroCopyHandle.BufDscPtr->AppId) || (&ZeroCopyHandle.BufDscPtr->Content != BufPtr)) { return CFE_SB_BUFFER_INVALID; } @@ -2207,14 +2167,13 @@ int32 CFE_SB_ZeroCopyHandleValidate(CFE_SB_Buffer_t *BufPtr, /* * Function: CFE_SB_ZeroCopyReleasePtr - See API and header file for details */ -int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, - CFE_SB_ZeroCopyHandle_t ZeroCopyHandle) +int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t ZeroCopyHandle) { int32 Status; Status = CFE_SB_ZeroCopyHandleValidate(Ptr2Release, ZeroCopyHandle); - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); if (Status == CFE_SUCCESS) { @@ -2223,22 +2182,21 @@ int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_DecrBufUseCnt(ZeroCopyHandle.BufDscPtr); } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); return Status; -}/* end CFE_SB_ZeroCopyReleasePtr */ +} /* end CFE_SB_ZeroCopyReleasePtr */ /* * 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, +int32 CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t ZeroCopyHandle, bool IncrementSequenceCount) { - int32 Status; - CFE_SB_BufferD_t *BufDscPtr; - CFE_SBR_RouteId_t RouteId; + int32 Status; + CFE_SB_BufferD_t *BufDscPtr; + CFE_SBR_RouteId_t RouteId; Status = CFE_SB_ZeroCopyHandleValidate(BufPtr, ZeroCopyHandle); @@ -2250,13 +2208,13 @@ int32 CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, /* Validate the content and get the MsgId, store it in the descriptor */ Status = CFE_SB_TransmitMsgValidate(&BufPtr->Msg, &BufDscPtr->MsgId, &BufDscPtr->ContentSize, &RouteId); - /* + /* * Broadcast the message if validation succeeded. - * + * * Note that for the case of no subscribers, the validation returns CFE_SUCCESS * but the actual route ID may be invalid. This is OK and considered normal- * the validation will increment the NoSubscribers count, but we should NOT - * increment the MsgSendErrorCounter here - it is not really a sending error to + * increment the MsgSendErrorCounter here - it is not really a sending error to * have no subscribers. CFE_SB_BroadcastBufferToRoute() will not send to * anything if the route is not valid (benign). */ @@ -2291,29 +2249,26 @@ int32 CFE_SB_TransmitBuffer(CFE_SB_Buffer_t *BufPtr, /* * Function: CFE_SB_ZeroCopySend - See API and header file for details */ -int32 CFE_SB_ZeroCopySend(CFE_SB_Buffer_t *BufPtr, - CFE_SB_ZeroCopyHandle_t BufferHandle) +int32 CFE_SB_ZeroCopySend(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { - int32 Status = 0; + int32 Status = 0; Status = CFE_SB_TransmitBuffer(BufPtr, BufferHandle, true); return Status; -}/* end CFE_SB_ZeroCopySend */ - +} /* end CFE_SB_ZeroCopySend */ /* * Function: CFE_SB_ZeroCopyPass - See API and header file for details */ -int32 CFE_SB_ZeroCopyPass(CFE_SB_Buffer_t *BufPtr, - CFE_SB_ZeroCopyHandle_t BufferHandle) +int32 CFE_SB_ZeroCopyPass(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { - int32 Status = 0; + int32 Status = 0; Status = CFE_SB_TransmitBuffer(BufPtr, BufferHandle, false); return Status; -}/* end CFE_SB_ZeroCopyPass */ +} /* end CFE_SB_ZeroCopyPass */ #endif diff --git a/modules/sb/fsw/src/cfe_sb_buf.c b/modules/sb/fsw/src/cfe_sb_buf.c index 2b3385507..fc4d595ae 100644 --- a/modules/sb/fsw/src/cfe_sb_buf.c +++ b/modules/sb/fsw/src/cfe_sb_buf.c @@ -37,11 +37,10 @@ /* * The actual message content of a SB Buffer Descriptor is the - * offset of the content member. This will be auto-aligned by + * offset of the content member. This will be auto-aligned by * the compiler according to the requirements of the machine. */ -#define CFE_SB_BUFFERD_CONTENT_OFFSET (offsetof(CFE_SB_BufferD_t,Content)) - +#define CFE_SB_BUFFERD_CONTENT_OFFSET (offsetof(CFE_SB_BufferD_t, Content)) /****************************************************************************** * @@ -83,7 +82,6 @@ void CFE_SB_TrackingListAdd(CFE_SB_BufferLink_t *List, CFE_SB_BufferLink_t *Node Node->Next->Prev = Node; } - /****************************************************************************** ** Function: CFE_SB_GetBufferFromPool() ** @@ -138,9 +136,9 @@ CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(size_t MaxMsgSize) /* Initialize the buffer descriptor structure. */ memset(bd, 0, CFE_SB_BUFFERD_CONTENT_OFFSET); - bd->MsgId = CFE_SB_INVALID_MSG_ID; - bd->UseCount = 1; - bd->AllocatedSize = AllocSize; + bd->MsgId = CFE_SB_INVALID_MSG_ID; + bd->UseCount = 1; + bd->AllocatedSize = AllocSize; CFE_SB_TrackingListReset(&bd->Link); @@ -148,7 +146,6 @@ CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(size_t MaxMsgSize) } /* CFE_SB_GetBufferFromPool */ - /****************************************************************************** ** Function: CFE_SB_ReturnBufferToPool() ** @@ -177,8 +174,7 @@ void CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd) /* finally give the buf descriptor back to the buf descriptor pool */ CFE_ES_PutPoolBuf(CFE_SB_Global.Mem.PoolHdl, bd); -}/* end CFE_SB_ReturnBufferToPool */ - +} /* end CFE_SB_ReturnBufferToPool */ /****************************************************************************** ** Function: CFE_SB_IncrBufUseCnt() @@ -201,13 +197,12 @@ void CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd) void CFE_SB_IncrBufUseCnt(CFE_SB_BufferD_t *bd) { /* range check the UseCount variable */ - if(bd->UseCount < 0x7FFF) + if (bd->UseCount < 0x7FFF) { ++bd->UseCount; } -}/* end CFE_SB_DecrBufUseCnt */ - +} /* end CFE_SB_DecrBufUseCnt */ /****************************************************************************** ** Function: CFE_SB_DecrBufUseCnt() @@ -232,19 +227,17 @@ void CFE_SB_IncrBufUseCnt(CFE_SB_BufferD_t *bd) void CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd) { /* range check the UseCount variable */ - if(bd->UseCount > 0) + if (bd->UseCount > 0) { --bd->UseCount; - if (bd->UseCount == 0) + if (bd->UseCount == 0) { - CFE_SB_ReturnBufferToPool(bd); + CFE_SB_ReturnBufferToPool(bd); } } -}/* end CFE_SB_DecrBufUseCnt */ - - +} /* end CFE_SB_DecrBufUseCnt */ /****************************************************************************** ** Function: CFE_SB_GetDestinationBlk() @@ -263,26 +256,27 @@ void CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd) */ CFE_SB_DestinationD_t *CFE_SB_GetDestinationBlk(void) { - int32 Stat; + int32 Stat; CFE_SB_DestinationD_t *Dest = NULL; /* Allocate a new destination descriptor from the SB memory pool.*/ - Stat = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t*)&Dest, CFE_SB_Global.Mem.PoolHdl, sizeof(CFE_SB_DestinationD_t)); - if(Stat < 0){ + Stat = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t *)&Dest, CFE_SB_Global.Mem.PoolHdl, sizeof(CFE_SB_DestinationD_t)); + if (Stat < 0) + { return NULL; } /* Add the size of a destination descriptor to the memory-in-use ctr and */ /* adjust the high water mark if needed */ - CFE_SB_Global.StatTlmMsg.Payload.MemInUse+=Stat; - if(CFE_SB_Global.StatTlmMsg.Payload.MemInUse > CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse){ - CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = CFE_SB_Global.StatTlmMsg.Payload.MemInUse; - }/* end if */ + CFE_SB_Global.StatTlmMsg.Payload.MemInUse += Stat; + if (CFE_SB_Global.StatTlmMsg.Payload.MemInUse > CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse) + { + CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = CFE_SB_Global.StatTlmMsg.Payload.MemInUse; + } /* end if */ return Dest; -}/* end CFE_SB_GetDestinationBlk */ - +} /* end CFE_SB_GetDestinationBlk */ /****************************************************************************** ** Function: CFE_SB_PutDestinationBlk() @@ -303,20 +297,21 @@ int32 CFE_SB_PutDestinationBlk(CFE_SB_DestinationD_t *Dest) { int32 Stat; - if(Dest==NULL){ + if (Dest == NULL) + { return CFE_SB_BAD_ARGUMENT; - }/* end if */ + } /* end if */ /* give the destination block back to the SB memory pool */ Stat = CFE_ES_PutPoolBuf(CFE_SB_Global.Mem.PoolHdl, Dest); - if(Stat > 0){ + if (Stat > 0) + { /* Substract the size of the destination block from the Memory in use ctr */ - CFE_SB_Global.StatTlmMsg.Payload.MemInUse-=Stat; - }/* end if */ + CFE_SB_Global.StatTlmMsg.Payload.MemInUse -= Stat; + } /* end if */ return CFE_SUCCESS; -}/* end CFE_SB_PutDestinationBlk */ - +} /* end CFE_SB_PutDestinationBlk */ /*****************************************************************************/ diff --git a/modules/sb/fsw/src/cfe_sb_init.c b/modules/sb/fsw/src/cfe_sb_init.c index 0e3c40734..5312de7af 100644 --- a/modules/sb/fsw/src/cfe_sb_init.c +++ b/modules/sb/fsw/src/cfe_sb_init.c @@ -40,27 +40,13 @@ ** External Declarations */ -const size_t CFE_SB_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = -{ - CFE_PLATFORM_SB_MAX_BLOCK_SIZE, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02, - CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 -}; - +const size_t CFE_SB_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { + CFE_PLATFORM_SB_MAX_BLOCK_SIZE, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15, + CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12, + CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09, + CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06, + CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03, + CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01}; /****************************************************************************** ** Function: CFE_SB_EarlyInit() @@ -76,7 +62,8 @@ const size_t CFE_SB_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = ** Return: ** CFE_SUCCESS */ -int32 CFE_SB_EarlyInit (void) { +int32 CFE_SB_EarlyInit(void) +{ int32 Stat; @@ -84,20 +71,22 @@ int32 CFE_SB_EarlyInit (void) { memset(&CFE_SB_Global, 0, sizeof(CFE_SB_Global)); Stat = OS_MutSemCreate(&CFE_SB_Global.SharedDataMutexId, "CFE_SB_DataMutex", 0); - if(Stat != OS_SUCCESS){ - CFE_ES_WriteToSysLog("SB shared data mutex creation failed! RC=0x%08x\n",(unsigned int)Stat); - return Stat; - }/* end if */ - + if (Stat != OS_SUCCESS) + { + CFE_ES_WriteToSysLog("SB shared data mutex creation failed! RC=0x%08x\n", (unsigned int)Stat); + return Stat; + } /* end if */ + /* Initialize the state of susbcription reporting */ CFE_SB_Global.SubscriptionReporting = CFE_SB_DISABLE; - /* Initialize memory partition. */ + /* Initialize memory partition. */ Stat = CFE_SB_InitBuffers(); - if(Stat != CFE_SUCCESS){ - /* error reported in CFE_SB_InitBuffers */ - return Stat; - }/* end if */ + if (Stat != CFE_SUCCESS) + { + /* error reported in CFE_SB_InitBuffers */ + return Stat; + } /* end if */ /* Initialize the pipe table. */ CFE_SB_InitPipeTbl(); @@ -106,15 +95,12 @@ int32 CFE_SB_EarlyInit (void) { CFE_SBR_Init(); /* Initialize the SB Statistics Pkt */ - CFE_MSG_Init(&CFE_SB_Global.StatTlmMsg.Hdr.Msg, - CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), + CFE_MSG_Init(&CFE_SB_Global.StatTlmMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), sizeof(CFE_SB_Global.StatTlmMsg)); return Stat; -}/* end CFE_SB_EarlyInit */ - - +} /* end CFE_SB_EarlyInit */ /****************************************************************************** ** Function: CFE_SB_InitBuffers() @@ -130,33 +116,32 @@ int32 CFE_SB_EarlyInit (void) { ** Return: ** none */ -int32 CFE_SB_InitBuffers(void) { +int32 CFE_SB_InitBuffers(void) +{ int32 Stat = 0; - Stat = CFE_ES_PoolCreateEx(&CFE_SB_Global.Mem.PoolHdl, - CFE_SB_Global.Mem.Partition.Data, - CFE_PLATFORM_SB_BUF_MEMORY_BYTES, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - &CFE_SB_MemPoolDefSize[0], - CFE_ES_NO_MUTEX); - - if(Stat != CFE_SUCCESS){ + Stat = CFE_ES_PoolCreateEx(&CFE_SB_Global.Mem.PoolHdl, CFE_SB_Global.Mem.Partition.Data, + CFE_PLATFORM_SB_BUF_MEMORY_BYTES, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + &CFE_SB_MemPoolDefSize[0], CFE_ES_NO_MUTEX); + + if (Stat != CFE_SUCCESS) + { CFE_ES_WriteToSysLog("PoolCreate failed for SB Buffers, gave adr 0x%lx,size %d,stat=0x%x\n", - (unsigned long)CFE_SB_Global.Mem.Partition.Data,CFE_PLATFORM_SB_BUF_MEMORY_BYTES,(unsigned int)Stat); + (unsigned long)CFE_SB_Global.Mem.Partition.Data, CFE_PLATFORM_SB_BUF_MEMORY_BYTES, + (unsigned int)Stat); return Stat; } - /* + /* * Initialize the buffer tracking lists to be empty */ CFE_SB_TrackingListReset(&CFE_SB_Global.InTransitList); CFE_SB_TrackingListReset(&CFE_SB_Global.ZeroCopyList); - + return CFE_SUCCESS; - -}/* end CFE_SB_InitBuffers */ +} /* end CFE_SB_InitBuffers */ /****************************************************************************** ** Function: CFE_SB_InitPipeTbl() @@ -176,6 +161,6 @@ void CFE_SB_InitPipeTbl(void) { CFE_SB_Global.LastPipeId = CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE); -}/* end CFE_SB_InitPipeTbl */ +} /* end CFE_SB_InitPipeTbl */ /*****************************************************************************/ diff --git a/modules/sb/fsw/src/cfe_sb_module_all.h b/modules/sb/fsw/src/cfe_sb_module_all.h index aa2687387..b3fc6a453 100644 --- a/modules/sb/fsw/src/cfe_sb_module_all.h +++ b/modules/sb/fsw/src/cfe_sb_module_all.h @@ -20,10 +20,10 @@ /** * @file cfe_sb_module_all.h - * + * * Encapsulates all SB module internal header files, as well * as the public API from all other CFE core modules, OSAL, and PSP. - * + * * This simplifies the set of include files that need to be put at the * start of every source file. */ @@ -48,5 +48,4 @@ #include "cfe_sbr.h" #include "cfe_core_resourceid_basevalues.h" - #endif /* CFE_SB_MODULE_ALL_H */ diff --git a/modules/sb/fsw/src/cfe_sb_msg_id_util.c b/modules/sb/fsw/src/cfe_sb_msg_id_util.c index 6dceaf77f..74efc5d30 100644 --- a/modules/sb/fsw/src/cfe_sb_msg_id_util.c +++ b/modules/sb/fsw/src/cfe_sb_msg_id_util.c @@ -28,34 +28,31 @@ */ #include "cfe_sb_module_all.h" - #ifndef CFE_OMIT_DEPRECATED_6_8 /* * Function: CFE_SB_GetMsgId - See API and header file for details */ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_MSG_Message_t *MsgPtr) { - CFE_SB_MsgId_t MsgId; - - /* Ignore return since no alternative action */ - CFE_MSG_GetMsgId(MsgPtr, &MsgId); + CFE_SB_MsgId_t MsgId; - return MsgId; + /* Ignore return since no alternative action */ + CFE_MSG_GetMsgId(MsgPtr, &MsgId); -}/* end CFE_SB_GetMsgId */ + return MsgId; +} /* end CFE_SB_GetMsgId */ /* * Function: CFE_SB_SetMsgId - See API and header file for details */ -void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, - CFE_SB_MsgId_t MsgId) +void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) { - /* Ignore return, no alternate action */ - CFE_MSG_SetMsgId(MsgPtr, MsgId); + /* Ignore return, no alternate action */ + CFE_MSG_SetMsgId(MsgPtr, MsgId); -}/* end CFE_SB_SetMsgId */ +} /* end CFE_SB_SetMsgId */ /* * Function: CFE_SB_GetPktType - See API and header file for details @@ -63,14 +60,14 @@ void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId) { - CFE_MSG_Type_t type; + CFE_MSG_Type_t type; - /* Ignores return, no alternate action */ - CFE_MSG_GetTypeFromMsgId(MsgId, &type); + /* Ignores return, no alternate action */ + CFE_MSG_GetTypeFromMsgId(MsgId, &type); - return type; + return type; -}/* end CFE_SB_GetPktType */ +} /* end CFE_SB_GetPktType */ #endif /* CFE_OMIT_DEPRECATED_6_8 */ /* @@ -81,6 +78,3 @@ bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId) return (!CFE_SB_MsgId_Equal(MsgId, CFE_SB_INVALID_MSG_ID) && CFE_SB_MsgIdToValue(MsgId) <= CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); } /* end CFE_SB_IsValidMsgId */ - - - diff --git a/modules/sb/fsw/src/cfe_sb_priv.c b/modules/sb/fsw/src/cfe_sb_priv.c index 3f3ea3b99..5c4e9a766 100644 --- a/modules/sb/fsw/src/cfe_sb_priv.c +++ b/modules/sb/fsw/src/cfe_sb_priv.c @@ -27,11 +27,11 @@ ** ** Author: R.McGraw/SSI ** -** Notes: +** Notes: ** The following 4 terms have been or are used in the cFS architecture and implementation -** -** StreamId - First 16 bits of CCSDS Space Packet Protocol (SPP) 133.0-B.1c2 Blue Book +** +** StreamId - First 16 bits of CCSDS Space Packet Protocol (SPP) 133.0-B.1c2 Blue Book ** packet primary header. It contains the 3 bit Version Number, 1 bit Packet Type ID, ** 1 bit Secondary Header flag, and 11 bit Application Process ID ** It was used in earlier cFS implementaions and is defined here for historical reference @@ -39,20 +39,20 @@ ** ** MsgId - Unique numeric message identifier within a mission namespace. It is used by cFS ** applications to the identify messages for publishing and subscribing -** It is used by the SB API and encoded in a mission defended way in the header of +** It is used by the SB API and encoded in a mission defended way in the header of ** all cFS messages. ** It is exposed to all cFS applications ** -** ApId - CCSDS Application Process Id field in the primary header. +** ApId - CCSDS Application Process Id field in the primary header. ** It has default bit mask of 0x07FF and is part of the cFS message Id ** It should not be confused with the cFE Executive Services (ES) term appId which ** identifies the software application/component ** It is NOT exposed to user applications. ** -** MsgIdkey - This is a unique numeric key within a mission namespace that is used with -** cFS software bus internal structures. +** MsgIdkey - This is a unique numeric key within a mission namespace that is used with +** cFS software bus internal structures. ** It is algorithmically created in a mission defined way from the MsgId to support -** efficient lookup and mapping implementations +** efficient lookup and mapping implementations ** It is NOT exposed to user applications. ** ** Some functions have EXTERNAL SYNC REQUIREMENTS @@ -68,7 +68,7 @@ ** lock must wait until A_Unsync() finishes before calling B_Unsync(). ** ** The expectation is that the required level of synchronization can be achieved -** using the SB shared data lock. +** using the SB shared data lock. ** ******************************************************************************/ @@ -92,21 +92,20 @@ */ int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId) { - uint32 i; - uint32 DelCount; + uint32 i; + uint32 DelCount; CFE_SB_PipeD_t *PipeDscPtr; CFE_SB_PipeId_t DelList[CFE_PLATFORM_SB_MAX_PIPES]; PipeDscPtr = CFE_SB_Global.PipeTbl; - DelCount = 0; + DelCount = 0; - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* loop through the pipe table looking for pipes owned by AppId */ for (i = 0; i < CFE_PLATFORM_SB_MAX_PIPES; ++i) { - if (CFE_SB_PipeDescIsUsed(PipeDscPtr) && - CFE_RESOURCEID_TEST_EQUAL(PipeDscPtr->AppId, AppId)) + if (CFE_SB_PipeDescIsUsed(PipeDscPtr) && CFE_RESOURCEID_TEST_EQUAL(PipeDscPtr->AppId, AppId)) { DelList[DelCount] = CFE_SB_PipeDescGetID(PipeDscPtr); ++DelCount; @@ -114,11 +113,11 @@ int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId) ++PipeDscPtr; } - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); for (i = 0; i < DelCount; ++i) { - CFE_SB_DeletePipeWithAppId(DelList[i],AppId); + CFE_SB_DeletePipeWithAppId(DelList[i], AppId); } /* Release any zero copy buffers */ @@ -126,8 +125,7 @@ int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId) return CFE_SUCCESS; -}/* end CFE_SB_CleanUpApp */ - +} /* end CFE_SB_CleanUpApp */ /****************************************************************************** ** Function: CFE_SB_LockSharedData() @@ -143,26 +141,26 @@ int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId) ** Return: ** None */ -void CFE_SB_LockSharedData(const char *FuncName, int32 LineNumber){ +void CFE_SB_LockSharedData(const char *FuncName, int32 LineNumber) +{ - int32 Status; + int32 Status; CFE_ES_AppId_t AppId; Status = OS_MutSemTake(CFE_SB_Global.SharedDataMutexId); - if (Status != OS_SUCCESS) { + if (Status != OS_SUCCESS) + { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("SB SharedData Mutex Take Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", - (unsigned int)Status,CFE_RESOURCEID_TO_ULONG(AppId),FuncName,(int)LineNumber); + CFE_ES_WriteToSysLog("SB SharedData Mutex Take Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", (unsigned int)Status, + CFE_RESOURCEID_TO_ULONG(AppId), FuncName, (int)LineNumber); - }/* end if */ + } /* end if */ return; -}/* end CFE_SB_LockSharedData */ - - +} /* end CFE_SB_LockSharedData */ /****************************************************************************** ** Function: CFE_SB_UnlockSharedData() @@ -178,25 +176,26 @@ void CFE_SB_LockSharedData(const char *FuncName, int32 LineNumber){ ** Return: ** None */ -void CFE_SB_UnlockSharedData(const char *FuncName, int32 LineNumber){ +void CFE_SB_UnlockSharedData(const char *FuncName, int32 LineNumber) +{ - int32 Status; - CFE_ES_AppId_t AppId; + int32 Status; + CFE_ES_AppId_t AppId; Status = OS_MutSemGive(CFE_SB_Global.SharedDataMutexId); - if (Status != OS_SUCCESS) { + if (Status != OS_SUCCESS) + { CFE_ES_GetAppID(&AppId); - CFE_ES_WriteToSysLog("SB SharedData Mutex Give Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", - (unsigned int)Status,CFE_RESOURCEID_TO_ULONG(AppId),FuncName,(int)LineNumber); + CFE_ES_WriteToSysLog("SB SharedData Mutex Give Err Stat=0x%x,App=%lu,Func=%s,Line=%d\n", (unsigned int)Status, + CFE_RESOURCEID_TO_ULONG(AppId), FuncName, (int)LineNumber); - }/* end if */ + } /* end if */ return; -}/* end CFE_SB_UnlockSharedData */ - +} /* end CFE_SB_UnlockSharedData */ /****************************************************************************** * SB private function to get destination pointer - see description in header @@ -208,9 +207,9 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI destptr = CFE_SBR_GetDestListHeadPtr(RouteId); /* Check all destinations */ - while(destptr != NULL) + while (destptr != NULL) { - if( CFE_RESOURCEID_TEST_EQUAL(destptr->PipeId, PipeId) ) + if (CFE_RESOURCEID_TEST_EQUAL(destptr->PipeId, PipeId)) { break; } @@ -235,11 +234,12 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI ** Return: ** None */ -void CFE_SB_SetMsgSeqCnt(CFE_MSG_Message_t *MsgPtr,uint32 Count){ +void CFE_SB_SetMsgSeqCnt(CFE_MSG_Message_t *MsgPtr, uint32 Count) +{ CFE_MSG_SetSequenceCount(MsgPtr, Count); -}/* end CFE_SB_SetMsgSeqCnt */ +} /* end CFE_SB_SetMsgSeqCnt */ #endif /* CFE_OMIT_DEPRECATED_6_8 */ /****************************************************************************** @@ -253,7 +253,8 @@ void CFE_SB_SetMsgSeqCnt(CFE_MSG_Message_t *MsgPtr,uint32 Count){ ** Return: ** None */ -int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId){ +int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId) +{ if (!CFE_SB_IsValidMsgId(MsgId)) { @@ -262,9 +263,9 @@ int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId){ else { return CFE_SUCCESS; - }/* end if */ + } /* end if */ -}/* end CFE_SB_ValidateMsgId */ +} /* end CFE_SB_ValidateMsgId */ /*********************************************************************/ /* @@ -275,7 +276,7 @@ int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId){ CFE_SB_PipeD_t *CFE_SB_LocatePipeDescByID(CFE_SB_PipeId_t PipeId) { CFE_SB_PipeD_t *PipeDscPtr; - uint32 Idx; + uint32 Idx; if (CFE_SB_PipeId_ToIndex(PipeId, &Idx) == CFE_SUCCESS) { @@ -316,40 +317,44 @@ bool CFE_SB_CheckPipeDescSlotUsed(CFE_ResourceId_t CheckId) ** Note: With taskId, Parent App name and Child Task name can be queried from ES ** */ -char *CFE_SB_GetAppTskName(CFE_ES_TaskId_t TaskId,char *FullName){ +char *CFE_SB_GetAppTskName(CFE_ES_TaskId_t TaskId, char *FullName) +{ CFE_ES_TaskInfo_t TaskInfo; - CFE_ES_TaskInfo_t *ptr = &TaskInfo; + CFE_ES_TaskInfo_t *ptr = &TaskInfo; char AppName[OS_MAX_API_NAME]; char TskName[OS_MAX_API_NAME]; - if(CFE_ES_GetTaskInfo(ptr, TaskId) != CFE_SUCCESS){ - - /* unlikely, but possible if TaskId is bogus */ - strncpy(FullName,"Unknown",OS_MAX_API_NAME-1); - FullName[OS_MAX_API_NAME-1] = '\0'; - - }else if(strncmp((char *)ptr->AppName,(char *)ptr->TaskName,sizeof(ptr->AppName)) == 0){ + if (CFE_ES_GetTaskInfo(ptr, TaskId) != CFE_SUCCESS) + { - /* if app name and task name are the same */ - strncpy(FullName,(char *)ptr->AppName,OS_MAX_API_NAME-1); - FullName[OS_MAX_API_NAME-1] = '\0'; + /* unlikely, but possible if TaskId is bogus */ + strncpy(FullName, "Unknown", OS_MAX_API_NAME - 1); + FullName[OS_MAX_API_NAME - 1] = '\0'; + } + else if (strncmp((char *)ptr->AppName, (char *)ptr->TaskName, sizeof(ptr->AppName)) == 0) + { - }else{ + /* if app name and task name are the same */ + strncpy(FullName, (char *)ptr->AppName, OS_MAX_API_NAME - 1); + FullName[OS_MAX_API_NAME - 1] = '\0'; + } + else + { - /* AppName and TskName buffers and strncpy are needed to limit string sizes */ - strncpy(AppName,(char *)ptr->AppName,sizeof(AppName)-1); - AppName[sizeof(AppName)-1] = '\0'; - strncpy(TskName,(char *)ptr->TaskName,sizeof(TskName)-1); - TskName[sizeof(TskName)-1] = '\0'; + /* AppName and TskName buffers and strncpy are needed to limit string sizes */ + strncpy(AppName, (char *)ptr->AppName, sizeof(AppName) - 1); + AppName[sizeof(AppName) - 1] = '\0'; + strncpy(TskName, (char *)ptr->TaskName, sizeof(TskName) - 1); + TskName[sizeof(TskName) - 1] = '\0'; - sprintf(FullName,"%s.%s",AppName,TskName); + sprintf(FullName, "%s.%s", AppName, TskName); - }/* end if */ + } /* end if */ return FullName; -}/* end CFE_SB_GetAppTskName */ +} /* end CFE_SB_GetAppTskName */ /****************************************************************************** ** Function: CFE_SB_RequestToSendEvent() @@ -366,7 +371,8 @@ char *CFE_SB_GetAppTskName(CFE_ES_TaskId_t TaskId,char *FullName){ ** If the bit is set this function will return CFE_SB_DENIED. ** If bit is not set, this function set the bit and return CFE_SB_GRANTED. */ -uint32 CFE_SB_RequestToSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit){ +uint32 CFE_SB_RequestToSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit) +{ uint32 Indx; @@ -376,19 +382,20 @@ uint32 CFE_SB_RequestToSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit){ } /* if bit is set... */ - if(CFE_TST(CFE_SB_Global.StopRecurseFlags[Indx],Bit)) + if (CFE_TST(CFE_SB_Global.StopRecurseFlags[Indx], Bit)) { - return CFE_SB_DENIED; - - }else{ + return CFE_SB_DENIED; + } + else + { - CFE_SET(CFE_SB_Global.StopRecurseFlags[Indx],Bit); - return CFE_SB_GRANTED; + CFE_SET(CFE_SB_Global.StopRecurseFlags[Indx], Bit); + return CFE_SB_GRANTED; - }/* end if */ + } /* end if */ -}/* end CFE_SB_RequestToSendEvent */ +} /* end CFE_SB_RequestToSendEvent */ /****************************************************************************** ** Function: CFE_SB_FinishSendEvent() @@ -403,7 +410,8 @@ uint32 CFE_SB_RequestToSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit){ ** If the bit is set this function will return CFE_SB_DENIED. ** If bit is not set, this function set the bit and return CFE_SB_GRANTED. */ -void CFE_SB_FinishSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit){ +void CFE_SB_FinishSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit) +{ uint32 Indx; @@ -413,21 +421,22 @@ void CFE_SB_FinishSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit){ } /* clear the bit so the task may send this event again */ - CFE_CLR(CFE_SB_Global.StopRecurseFlags[Indx],Bit); -}/* end CFE_SB_RequestToSendEvent */ + CFE_CLR(CFE_SB_Global.StopRecurseFlags[Indx], Bit); +} /* end CFE_SB_RequestToSendEvent */ /****************************************************************************** * SB private function to add a destination node - see description in header */ -int32 CFE_SB_AddDestNode(CFE_SBR_RouteId_t RouteId, CFE_SB_DestinationD_t *NewNode){ +int32 CFE_SB_AddDestNode(CFE_SBR_RouteId_t RouteId, CFE_SB_DestinationD_t *NewNode) +{ - CFE_SB_DestinationD_t *WBS;/* Will Be Second (WBS) node */ + CFE_SB_DestinationD_t *WBS; /* Will Be Second (WBS) node */ CFE_SB_DestinationD_t *listheadptr; listheadptr = CFE_SBR_GetDestListHeadPtr(RouteId); /* if first node in list */ - if(listheadptr == NULL) + if (listheadptr == NULL) { /* initialize the new node */ NewNode->Next = NULL; @@ -442,7 +451,7 @@ int32 CFE_SB_AddDestNode(CFE_SBR_RouteId_t RouteId, CFE_SB_DestinationD_t *NewNo NewNode->Prev = NULL; /* insert the new node */ - WBS -> Prev = NewNode; + WBS->Prev = NewNode; } /* Update Head */ @@ -469,39 +478,39 @@ void CFE_SB_RemoveDestNode(CFE_SBR_RouteId_t RouteId, CFE_SB_DestinationD_t *Nod CFE_SB_DestinationD_t *PrevNode; CFE_SB_DestinationD_t *NextNode; - if((NodeToRemove->Prev == NULL) && (NodeToRemove->Next == NULL)) + if ((NodeToRemove->Prev == NULL) && (NodeToRemove->Next == NULL)) { /* Clear destinations if this is the only node in the list */ CFE_SBR_SetDestListHeadPtr(RouteId, NULL); } - else if(NodeToRemove->Prev == NULL) + else if (NodeToRemove->Prev == NULL) { /* First in the list, set the next node to list head */ - NextNode = NodeToRemove->Next; - NextNode -> Prev = NULL; + NextNode = NodeToRemove->Next; + NextNode->Prev = NULL; CFE_SBR_SetDestListHeadPtr(RouteId, NextNode); } - else if(NodeToRemove->Next == NULL){ + else if (NodeToRemove->Next == NULL) + { /* Last in the list, remove previous pointer */ - PrevNode = NodeToRemove->Prev; - PrevNode -> Next = NULL; + PrevNode = NodeToRemove->Prev; + PrevNode->Next = NULL; } else { /* Middle of list, remove */ - PrevNode = NodeToRemove->Prev; - NextNode = NodeToRemove->Next; - PrevNode -> Next = NextNode; - NextNode -> Prev = PrevNode; + PrevNode = NodeToRemove->Prev; + NextNode = NodeToRemove->Next; + PrevNode->Next = NextNode; + NextNode->Prev = PrevNode; } /* initialize the node before returning it to the heap */ - NodeToRemove -> Next = NULL; - NodeToRemove -> Prev = NULL; + NodeToRemove->Next = NULL; + NodeToRemove->Prev = NULL; } - /****************************************************************************** ** Name: CFE_SB_ZeroCopyReleaseAppId ** @@ -528,7 +537,7 @@ void CFE_SB_RemoveDestNode(CFE_SBR_RouteId_t RouteId, CFE_SB_DestinationD_t *Nod int32 CFE_SB_ZeroCopyReleaseAppId(CFE_ES_AppId_t AppId) { CFE_SB_BufferLink_t *NextLink; - CFE_SB_BufferD_t *DscPtr; + CFE_SB_BufferD_t * DscPtr; /* * First go through the "ZeroCopy" tracking list and find all nodes @@ -541,7 +550,7 @@ int32 CFE_SB_ZeroCopyReleaseAppId(CFE_ES_AppId_t AppId) /* Get start of list */ NextLink = CFE_SB_TrackingListGetNext(&CFE_SB_Global.ZeroCopyList); - while(!CFE_SB_TrackingListIsEnd(&CFE_SB_Global.ZeroCopyList, NextLink)) + while (!CFE_SB_TrackingListIsEnd(&CFE_SB_Global.ZeroCopyList, NextLink)) { /* Get buffer descriptor pointer */ /* NOTE: casting via void* here rather than CFE_SB_BufferD_t* avoids a false @@ -564,6 +573,6 @@ int32 CFE_SB_ZeroCopyReleaseAppId(CFE_ES_AppId_t AppId) return CFE_SUCCESS; -}/* end CFE_SB_ZeroCopyReleaseAppId */ +} /* end CFE_SB_ZeroCopyReleaseAppId */ /*****************************************************************************/ diff --git a/modules/sb/fsw/src/cfe_sb_priv.h b/modules/sb/fsw/src/cfe_sb_priv.h index 08d8cafaf..cb596fe25 100644 --- a/modules/sb/fsw/src/cfe_sb_priv.h +++ b/modules/sb/fsw/src/cfe_sb_priv.h @@ -50,57 +50,56 @@ ** Macro Definitions */ -#define CFE_SB_UNUSED_QUEUE OS_OBJECT_ID_UNDEFINED -#define CFE_SB_NO_DESTINATION 0xFF -#define CFE_SB_FAILED 1 -#define SB_DONT_CARE 0 +#define CFE_SB_UNUSED_QUEUE OS_OBJECT_ID_UNDEFINED +#define CFE_SB_NO_DESTINATION 0xFF +#define CFE_SB_FAILED 1 +#define SB_DONT_CARE 0 -#define CFE_SB_NO_DUPLICATE 0 -#define CFE_SB_DUPLICATE 1 +#define CFE_SB_NO_DUPLICATE 0 +#define CFE_SB_DUPLICATE 1 -#define CFE_SB_INACTIVE 0 -#define CFE_SB_ACTIVE 1 +#define CFE_SB_INACTIVE 0 +#define CFE_SB_ACTIVE 1 -#define CFE_SB_MSG_GLOBAL 0 -#define CFE_SB_MSG_LOCAL 1 +#define CFE_SB_MSG_GLOBAL 0 +#define CFE_SB_MSG_LOCAL 1 -#define CFE_SB_SEND_ZEROCOPY 0 -#define CFE_SB_SEND_ONECOPY 1 +#define CFE_SB_SEND_ZEROCOPY 0 +#define CFE_SB_SEND_ONECOPY 1 -#define CFE_SB_NOT_IN_USE 0 -#define CFE_SB_IN_USE 1 +#define CFE_SB_NOT_IN_USE 0 +#define CFE_SB_IN_USE 1 -#define CFE_SB_DISABLE 0 -#define CFE_SB_ENABLE 1 +#define CFE_SB_DISABLE 0 +#define CFE_SB_ENABLE 1 -#define CFE_SB_DENIED 0 -#define CFE_SB_GRANTED 1 +#define CFE_SB_DENIED 0 +#define CFE_SB_GRANTED 1 -#define CFE_SB_DO_NOT_INCREMENT 0 -#define CFE_SB_INCREMENT_TLM 1 +#define CFE_SB_DO_NOT_INCREMENT 0 +#define CFE_SB_INCREMENT_TLM 1 -#define CFE_SB_MAIN_LOOP_ERR_DLY 1000 -#define CFE_SB_CMD_PIPE_DEPTH 32 -#define CFE_SB_CMD_PIPE_NAME "SB_CMD_PIPE" -#define CFE_SB_MAX_CFG_FILE_EVENTS_TO_FILTER 8 +#define CFE_SB_MAIN_LOOP_ERR_DLY 1000 +#define CFE_SB_CMD_PIPE_DEPTH 32 +#define CFE_SB_CMD_PIPE_NAME "SB_CMD_PIPE" +#define CFE_SB_MAX_CFG_FILE_EVENTS_TO_FILTER 8 -#define CFE_SB_PIPE_OVERFLOW (-1) -#define CFE_SB_PIPE_WR_ERR (-2) -#define CFE_SB_USECNT_ERR (-3) -#define CFE_SB_FILE_IO_ERR (-5) +#define CFE_SB_PIPE_OVERFLOW (-1) +#define CFE_SB_PIPE_WR_ERR (-2) +#define CFE_SB_USECNT_ERR (-3) +#define CFE_SB_FILE_IO_ERR (-5) /* bit map for stopping recursive event problem */ -#define CFE_SB_SEND_NO_SUBS_EID_BIT 0 -#define CFE_SB_GET_BUF_ERR_EID_BIT 1 -#define CFE_SB_MSGID_LIM_ERR_EID_BIT 2 -#define CFE_SB_Q_FULL_ERR_EID_BIT 3 -#define CFE_SB_Q_WR_ERR_EID_BIT 4 +#define CFE_SB_SEND_NO_SUBS_EID_BIT 0 +#define CFE_SB_GET_BUF_ERR_EID_BIT 1 +#define CFE_SB_MSGID_LIM_ERR_EID_BIT 2 +#define CFE_SB_Q_FULL_ERR_EID_BIT 3 +#define CFE_SB_Q_WR_ERR_EID_BIT 4 /* ** Type Definitions */ - /** * \brief Basic linked list structure allowing all buffer descriptors to be tracked. */ @@ -126,31 +125,31 @@ typedef struct CFE_SB_BufferD CFE_SB_BufferLink_t Link; /**< Links for inclusion in the tracking lists */ /** - * Actual MsgId of the content, cached here to avoid repeat + * Actual MsgId of the content, cached here to avoid repeat * calls into CFE_MSG API during traversal/delivery of the message. - * + * * MsgId is set for buffers which contain actual data in transit. AppId is unset * while in transit, as it may be sent to multiple apps. - * + * * During zero copy buffer initial allocation, the MsgId is not known at this time * and should be set to the invalid msg ID. */ - CFE_SB_MsgId_t MsgId; + CFE_SB_MsgId_t MsgId; /** * Current owner of the buffer, if owned by a single app. - * - * This is used to track "zero copy" buffer allocations - this will be set to + * + * This is used to track "zero copy" buffer allocations - this will be set to * the AppID that initally allocated it, before it is used to transmit a message. - * + * * When the message is in transit, it may be queued to multiple applictions, * so this is unset. */ CFE_ES_AppId_t AppId; - size_t AllocatedSize; /**< Total size of this descriptor (including descriptor itself) */ - size_t ContentSize; /**< Actual size of message content currently stored in the buffer */ - CFE_MSG_Type_t ContentType; /**< Type of message content currently stored in the buffer */ + size_t AllocatedSize; /**< Total size of this descriptor (including descriptor itself) */ + size_t ContentSize; /**< Actual size of message content currently stored in the buffer */ + CFE_MSG_Type_t ContentType; /**< Type of message content currently stored in the buffer */ bool AutoSequence; /**< If message should get its sequence number assigned from the route */ @@ -160,7 +159,6 @@ typedef struct CFE_SB_BufferD } CFE_SB_BufferD_t; - /****************************************************************************** ** Typedef: CFE_SB_PipeD_t ** @@ -169,17 +167,18 @@ typedef struct CFE_SB_BufferD ** characteristics and status of a pipe. */ -typedef struct { - CFE_SB_PipeId_t PipeId; - uint8 Opts; - uint8 Spare; - CFE_ES_AppId_t AppId; - osal_id_t SysQueueId; - uint16 SendErrors; - uint16 MaxQueueDepth; - uint16 CurrentQueueDepth; - uint16 PeakQueueDepth; - CFE_SB_BufferD_t *LastBuffer; +typedef struct +{ + CFE_SB_PipeId_t PipeId; + uint8 Opts; + uint8 Spare; + CFE_ES_AppId_t AppId; + osal_id_t SysQueueId; + uint16 SendErrors; + uint16 MaxQueueDepth; + uint16 CurrentQueueDepth; + uint16 PeakQueueDepth; + CFE_SB_BufferD_t *LastBuffer; } CFE_SB_PipeD_t; /****************************************************************************** @@ -188,21 +187,22 @@ typedef struct { ** Purpose: ** This structure defines the variables related to the SB routing buffers. */ -typedef struct { +typedef struct +{ - CFE_ES_MemHandle_t PoolHdl; - CFE_ES_STATIC_POOL_TYPE(CFE_PLATFORM_SB_BUF_MEMORY_BYTES) Partition; + CFE_ES_MemHandle_t PoolHdl; + CFE_ES_STATIC_POOL_TYPE(CFE_PLATFORM_SB_BUF_MEMORY_BYTES) Partition; } CFE_SB_MemParams_t; /*******************************************************************************/ -/** +/** ** \brief SB route info temporary structure ** ** This tracks the number of desinations along with destination data for 1 route. ** Each route may contain zero or more desinations (variable length). */ -typedef struct +typedef struct { uint32 NumDestinations; CFE_SB_RoutingFileEntry_t DestEntries[CFE_PLATFORM_SB_MAX_DEST_PER_PKT]; /**< Actual data written to file */ @@ -220,19 +220,17 @@ typedef union CFE_SB_MsgMapFileEntry_t MsgMapInfo; } CFE_SB_BackgroundFileBuffer_t; -/** +/** * \brief SB Background file write state information * * Must be stored in persistent memory (e.g. global). */ -typedef struct +typedef struct { CFE_FS_FileWriteMetaData_t FileWrite; /**< FS state data - must be first */ CFE_SB_BackgroundFileBuffer_t Buffer; /**< Temporary holding area for file record */ } CFE_SB_BackgroundFileStateInfo_t; - - /****************************************************************************** ** Typedef: CFE_SB_Global_t ** @@ -241,43 +239,42 @@ typedef struct */ typedef struct { - osal_id_t SharedDataMutexId; - uint32 SubscriptionReporting; - CFE_ES_AppId_t AppId; - uint32 StopRecurseFlags[OS_MAX_TASKS]; - CFE_SB_PipeD_t PipeTbl[CFE_PLATFORM_SB_MAX_PIPES]; - CFE_SB_HousekeepingTlm_t HKTlmMsg; - CFE_SB_StatsTlm_t StatTlmMsg; - CFE_SB_PipeId_t CmdPipe; - CFE_SB_MemParams_t Mem; - CFE_SB_AllSubscriptionsTlm_t PrevSubMsg; - CFE_EVS_BinFilter_t EventFilters[CFE_SB_MAX_CFG_FILE_EVENTS_TO_FILTER]; - CFE_SB_Qos_t Default_Qos; - CFE_ResourceId_t LastPipeId; + osal_id_t SharedDataMutexId; + uint32 SubscriptionReporting; + CFE_ES_AppId_t AppId; + uint32 StopRecurseFlags[OS_MAX_TASKS]; + CFE_SB_PipeD_t PipeTbl[CFE_PLATFORM_SB_MAX_PIPES]; + CFE_SB_HousekeepingTlm_t HKTlmMsg; + CFE_SB_StatsTlm_t StatTlmMsg; + CFE_SB_PipeId_t CmdPipe; + CFE_SB_MemParams_t Mem; + CFE_SB_AllSubscriptionsTlm_t PrevSubMsg; + CFE_EVS_BinFilter_t EventFilters[CFE_SB_MAX_CFG_FILE_EVENTS_TO_FILTER]; + CFE_SB_Qos_t Default_Qos; + CFE_ResourceId_t LastPipeId; CFE_SB_BackgroundFileStateInfo_t BackgroundFile; /* A list of buffers currently in-transit, owned by SB */ - CFE_SB_BufferLink_t InTransitList; + CFE_SB_BufferLink_t InTransitList; /* A list of buffers currently issued to apps for zero-copy */ - CFE_SB_BufferLink_t ZeroCopyList; + CFE_SB_BufferLink_t ZeroCopyList; } CFE_SB_Global_t; - /****************************************************************************** ** Typedef: CFE_SB_SendErrEventBuf_t ** ** Purpose: ** This structure is used to store event information during a send. */ -typedef struct{ - uint32 EventId; - int32 ErrStat; - CFE_SB_PipeId_t PipeId; -}CFE_SB_SendErrEventBuf_t; - +typedef struct +{ + uint32 EventId; + int32 ErrStat; + CFE_SB_PipeId_t PipeId; +} CFE_SB_SendErrEventBuf_t; /****************************************************************************** ** Typedef: CFE_SB_EventBuf_t @@ -285,59 +282,51 @@ typedef struct{ ** Purpose: ** This structure is used to store event information during a send. */ -typedef struct{ - uint32 EvtsToSnd; - CFE_SB_SendErrEventBuf_t EvtBuf[CFE_PLATFORM_SB_MAX_DEST_PER_PKT]; -}CFE_SB_EventBuf_t; - +typedef struct +{ + uint32 EvtsToSnd; + CFE_SB_SendErrEventBuf_t EvtBuf[CFE_PLATFORM_SB_MAX_DEST_PER_PKT]; +} CFE_SB_EventBuf_t; /* ** Software Bus Function Prototypes */ -int32 CFE_SB_AppInit(void); -int32 CFE_SB_InitBuffers(void); -void CFE_SB_InitPipeTbl(void); -void CFE_SB_InitIdxStack(void); -void CFE_SB_ResetCounts(void); -void CFE_SB_LockSharedData(const char *FuncName, int32 LineNumber); -void CFE_SB_UnlockSharedData(const char *FuncName, int32 LineNumber); -void CFE_SB_ReleaseBuffer (CFE_SB_BufferD_t *bd, CFE_SB_DestinationD_t *dest); -int32 CFE_SB_WriteQueue(CFE_SB_PipeD_t *pd,uint32 TskId, - const CFE_SB_BufferD_t *bd,CFE_SB_MsgId_t MsgId ); -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_TaskId_t TaskId, char* FullName); -int32 CFE_SB_DeletePipeWithAppId(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId); -int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_AppId_t AppId); -int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, - CFE_SB_PipeId_t PipeId, - CFE_SB_Qos_t Quality, - uint16 MsgLim, - uint8 Scope); - -int32 CFE_SB_UnsubscribeWithAppId(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, - CFE_ES_AppId_t AppId); - -int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, - uint8 Scope, CFE_ES_AppId_t AppId); -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_ZeroCopyReleaseAppId(CFE_ES_AppId_t AppId); -void CFE_SB_IncrBufUseCnt(CFE_SB_BufferD_t *bd); -void CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd); -int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId); -int32 CFE_SB_ValidatePipeId(CFE_SB_PipeId_t PipeId); -void CFE_SB_IncrCmdCtr(int32 status); -void CFE_SB_SetSubscriptionReporting(uint32 state); -int32 CFE_SB_SendSubscriptionReport(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality); +int32 CFE_SB_AppInit(void); +int32 CFE_SB_InitBuffers(void); +void CFE_SB_InitPipeTbl(void); +void CFE_SB_InitIdxStack(void); +void CFE_SB_ResetCounts(void); +void CFE_SB_LockSharedData(const char *FuncName, int32 LineNumber); +void CFE_SB_UnlockSharedData(const char *FuncName, int32 LineNumber); +void CFE_SB_ReleaseBuffer(CFE_SB_BufferD_t *bd, CFE_SB_DestinationD_t *dest); +int32 CFE_SB_WriteQueue(CFE_SB_PipeD_t *pd, uint32 TskId, const CFE_SB_BufferD_t *bd, CFE_SB_MsgId_t MsgId); +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_TaskId_t TaskId, char *FullName); +int32 CFE_SB_DeletePipeWithAppId(CFE_SB_PipeId_t PipeId, CFE_ES_AppId_t AppId); +int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId, CFE_ES_AppId_t AppId); +int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality, uint16 MsgLim, + uint8 Scope); + +int32 CFE_SB_UnsubscribeWithAppId(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_ES_AppId_t AppId); + +int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint8 Scope, CFE_ES_AppId_t AppId); +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_ZeroCopyReleaseAppId(CFE_ES_AppId_t AppId); +void CFE_SB_IncrBufUseCnt(CFE_SB_BufferD_t *bd); +void CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd); +int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId); +int32 CFE_SB_ValidatePipeId(CFE_SB_PipeId_t PipeId); +void CFE_SB_IncrCmdCtr(int32 status); +void CFE_SB_SetSubscriptionReporting(uint32 state); +int32 CFE_SB_SendSubscriptionReport(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality); uint32 CFE_SB_RequestToSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit); -void CFE_SB_FinishSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit); +void CFE_SB_FinishSendEvent(CFE_ES_TaskId_t TaskId, uint32 Bit); CFE_SB_DestinationD_t *CFE_SB_GetDestinationBlk(void); -int32 CFE_SB_PutDestinationBlk(CFE_SB_DestinationD_t *Dest); +int32 CFE_SB_PutDestinationBlk(CFE_SB_DestinationD_t *Dest); /** * \brief For SB buffer tracking, get first/next position in a list @@ -358,7 +347,7 @@ static inline bool CFE_SB_TrackingListIsEnd(CFE_SB_BufferLink_t *List, CFE_SB_Bu /** * \brief For SB buffer tracking, reset link state to default - * + * * This turns the node into a singleton/lone object (not in a list) * or resets the head link to be empty. */ @@ -366,7 +355,7 @@ void CFE_SB_TrackingListReset(CFE_SB_BufferLink_t *Link); /** * \brief For SB buffer tracking, removes a node from a tracking list - * + * * Extracts a single node from whatever list it is in. After this the * node becomes a singleton owned by the caller. It may be put into * another list or freed. @@ -375,17 +364,16 @@ void CFE_SB_TrackingListRemove(CFE_SB_BufferLink_t *Node); /** * \brief For SB buffer tracking, adds a node to a tracking list - * + * * Extracts a single node from the list its in. After this the * node becomes a singleton owned by the caller. It must put it * in another list or free it. */ void CFE_SB_TrackingListAdd(CFE_SB_BufferLink_t *List, CFE_SB_BufferLink_t *Node); - /** * \brief Allocates a new buffer descriptor from the SB memory pool. - * + * * \param[in] MaxMsgSize Maximum message content size that the buffer must be capable of holding * \returns Pointer to buffer descriptor, or NULL on failure. */ @@ -396,37 +384,37 @@ CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(size_t MaxMsgSize); * * \param[in] Pointer to descriptor to return */ -void CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd); +void CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd); /** * \brief Broadcast a SB buffer descriptor to all destinations in route - * + * * Internal routine that implements the logic of transmitting a message buffer * to all destinations subscribed in the SB route. - * - * As this function will broadcast the message to any number of destinations (0-many), - * and some may be successful and some may fail, the status cannot be expressed + * + * As this function will broadcast the message to any number of destinations (0-many), + * and some may be successful and some may fail, the status cannot be expressed * in any single error code, so this does not return any status. - * + * * Instead, this routine handles all potential outcomes on its own, and does * not expect the caller to handle any delivery issues. Also note that the general * design pattern of the software bus is a "send and forget" model where the sender does * not know (or care) what entities are subscribed to the data being generated. - * + * * - For any undeliverable destination (limit, OSAL error, etc), a proper event is generated. * - For any successful queueing, the buffer use count is incremented - * + * * The caller is expected to hold a reference (use count) of the buffer prior to invoking * this routine, representing itself, which is then consumed by this routine. - * - * \note _This call will "consume" the buffer by decrementing the buffer use count_ after + * + * \note _This call will "consume" the buffer by decrementing the buffer use count_ after * broadcasting the message to all subscribed pipes. - * + * * The caller should not access the buffer again after calling this function, as it may * be deallocated at any time. If the caller wishes to continue accessing the buffer, * it should explicitly increment the use count before calling this, which will prevent * deallocation. - * + * * \param[in] BufDscPtr Pointer to the buffer descriptor to broadcast * \param[in] RouteId Route to send to */ @@ -440,8 +428,7 @@ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_ * * \returns CFE_SUCCESS if validation passed, or error code. */ -int32 CFE_SB_ZeroCopyHandleValidate(CFE_SB_Buffer_t *BufPtr, - CFE_SB_ZeroCopyHandle_t ZeroCopyHandle); +int32 CFE_SB_ZeroCopyHandleValidate(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t ZeroCopyHandle); /** * \brief Add a destination node @@ -518,7 +505,6 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI **/ size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr); - /* * Software Bus Message Handler Function prototypes */ @@ -535,8 +521,6 @@ int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data); int32 CFE_SB_WriteMapInfoCmd(const CFE_SB_WriteMapInfoCmd_t *data); int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data); - - /** * @brief Locate the Pipe table entry correlating with a given Pipe ID. * @@ -546,9 +530,7 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data); * @param[in] PipeId the Pipe ID to locate * @return pointer to Pipe Table entry for the given Pipe ID */ -extern CFE_SB_PipeD_t* CFE_SB_LocatePipeDescByID(CFE_SB_PipeId_t PipeId); - - +extern CFE_SB_PipeD_t *CFE_SB_LocatePipeDescByID(CFE_SB_PipeId_t PipeId); /** * @brief Check if an Pipe descriptor is in use or free/empty @@ -633,7 +615,6 @@ static inline bool CFE_SB_PipeDescIsMatch(const CFE_SB_PipeD_t *PipeDscPtr, CFE_ /* Availability check functions used in conjunction with CFE_ResourceId_FindNext() */ bool CFE_SB_CheckPipeDescSlotUsed(CFE_ResourceId_t CheckId); - /* * Helper functions for background file write requests (callbacks) */ @@ -642,7 +623,8 @@ bool CFE_SB_WriteMsgMapInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffe void CFE_SB_CollectRouteInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr); bool CFE_SB_WriteRouteInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize); bool CFE_SB_WritePipeInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize); -void CFE_SB_BackgroundFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position); +void CFE_SB_BackgroundFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, + size_t BlockSize, size_t Position); /* * External variables private to the software bus module diff --git a/modules/sb/fsw/src/cfe_sb_task.c b/modules/sb/fsw/src/cfe_sb_task.c index 3744d00db..28dbcd3fe 100644 --- a/modules/sb/fsw/src/cfe_sb_task.c +++ b/modules/sb/fsw/src/cfe_sb_task.c @@ -32,12 +32,12 @@ #include "cfe_sb_module_all.h" #include "cfe_version.h" -#include "cfe_es_msg.h" /* needed for local use of CFE_ES_RestartCmd_t */ +#include "cfe_es_msg.h" /* needed for local use of CFE_ES_RestartCmd_t */ #include /* Task Globals */ -CFE_SB_Global_t CFE_SB_Global; +CFE_SB_Global_t CFE_SB_Global; /* Local structure for file writing callbacks */ typedef struct @@ -69,14 +69,14 @@ void CFE_SB_TaskMain(void) CFE_ES_PerfLogEntry(CFE_MISSION_SB_MAIN_PERF_ID); Status = CFE_SB_AppInit(); - - if(Status != CFE_SUCCESS) + + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("SB:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); - CFE_ES_PerfLogExit(CFE_MISSION_SB_MAIN_PERF_ID); - /* Note: CFE_ES_ExitApp will not return */ - CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); - }/* end if */ + CFE_ES_WriteToSysLog("SB:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_PerfLogExit(CFE_MISSION_SB_MAIN_PERF_ID); + /* Note: CFE_ES_ExitApp will not return */ + CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); + } /* end if */ /* * Wait for other apps to start. @@ -88,35 +88,33 @@ void CFE_SB_TaskMain(void) /* Main loop */ while (Status == CFE_SUCCESS) - { + { /* Increment the Main task Execution Counter */ CFE_ES_IncrementTaskCounter(); CFE_ES_PerfLogExit(CFE_MISSION_SB_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_ReceiveBuffer(&SBBufPtr, - CFE_SB_Global.CmdPipe, - CFE_SB_PEND_FOREVER); + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_SB_Global.CmdPipe, CFE_SB_PEND_FOREVER); CFE_ES_PerfLogEntry(CFE_MISSION_SB_MAIN_PERF_ID); - if(Status == CFE_SUCCESS) + if (Status == CFE_SUCCESS) { /* Process cmd pipe msg */ CFE_SB_ProcessCmdPipePkt(SBBufPtr); - }else{ - CFE_ES_WriteToSysLog("SB:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); - }/* end if */ + } + else + { + CFE_ES_WriteToSysLog("SB:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); + } /* end if */ - }/* end while */ + } /* end while */ /* while loop exits only if CFE_SB_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); -}/* end CFE_SB_TaskMain */ - - +} /* end CFE_SB_TaskMain */ /****************************************************************************** ** Function: CFE_SB_AppInit() @@ -131,170 +129,178 @@ void CFE_SB_TaskMain(void) ** Return: ** CFE_SUCCESS if no errors, otherwise this function returns the error code ** that was received from the function that detected the error. -** +** */ -int32 CFE_SB_AppInit(void){ +int32 CFE_SB_AppInit(void) +{ - uint32 CfgFileEventsToFilter = 0; + uint32 CfgFileEventsToFilter = 0; CFE_ES_MemPoolBuf_t TmpPtr; - int32 Status; - + int32 Status; + Status = CFE_ES_RegisterApp(); - if(Status != CFE_SUCCESS){ - CFE_ES_WriteToSysLog("SB:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SB:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ /* Get the assigned Application ID for the SB Task */ CFE_ES_GetAppID(&CFE_SB_Global.AppId); /* Process the platform cfg file events to be filtered */ - if(CFE_PLATFORM_SB_FILTERED_EVENT1 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT1; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK1; - CfgFileEventsToFilter++; - }/* end if */ - - if(CFE_PLATFORM_SB_FILTERED_EVENT2 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT2; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK2; - CfgFileEventsToFilter++; - }/* end if */ - - if(CFE_PLATFORM_SB_FILTERED_EVENT3 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT3; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK3; - CfgFileEventsToFilter++; - }/* end if */ - - if(CFE_PLATFORM_SB_FILTERED_EVENT4 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT4; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK4; - CfgFileEventsToFilter++; - }/* end if */ - - if(CFE_PLATFORM_SB_FILTERED_EVENT5 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT5; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK5; - CfgFileEventsToFilter++; - }/* end if */ - - if(CFE_PLATFORM_SB_FILTERED_EVENT6 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT6; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK6; - CfgFileEventsToFilter++; - }/* end if */ - - if(CFE_PLATFORM_SB_FILTERED_EVENT7 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT7; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK7; - CfgFileEventsToFilter++; - }/* end if */ - - if(CFE_PLATFORM_SB_FILTERED_EVENT8 != 0){ - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT8; - CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK8; - CfgFileEventsToFilter++; - }/* end if */ - - /* Be sure the number of events to register for filtering - ** does not exceed CFE_PLATFORM_EVS_MAX_EVENT_FILTERS */ - if(CFE_PLATFORM_EVS_MAX_EVENT_FILTERS < CfgFileEventsToFilter){ - CfgFileEventsToFilter = CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; - }/* end if */ + if (CFE_PLATFORM_SB_FILTERED_EVENT1 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT1; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK1; + CfgFileEventsToFilter++; + } /* end if */ + + if (CFE_PLATFORM_SB_FILTERED_EVENT2 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT2; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK2; + CfgFileEventsToFilter++; + } /* end if */ + + if (CFE_PLATFORM_SB_FILTERED_EVENT3 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT3; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK3; + CfgFileEventsToFilter++; + } /* end if */ + + if (CFE_PLATFORM_SB_FILTERED_EVENT4 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT4; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK4; + CfgFileEventsToFilter++; + } /* end if */ + + if (CFE_PLATFORM_SB_FILTERED_EVENT5 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT5; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK5; + CfgFileEventsToFilter++; + } /* end if */ + + if (CFE_PLATFORM_SB_FILTERED_EVENT6 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT6; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK6; + CfgFileEventsToFilter++; + } /* end if */ + + if (CFE_PLATFORM_SB_FILTERED_EVENT7 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT7; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK7; + CfgFileEventsToFilter++; + } /* end if */ + + if (CFE_PLATFORM_SB_FILTERED_EVENT8 != 0) + { + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].EventID = CFE_PLATFORM_SB_FILTERED_EVENT8; + CFE_SB_Global.EventFilters[CfgFileEventsToFilter].Mask = CFE_PLATFORM_SB_FILTER_MASK8; + CfgFileEventsToFilter++; + } /* end if */ + /* Be sure the number of events to register for filtering + ** does not exceed CFE_PLATFORM_EVS_MAX_EVENT_FILTERS */ + if (CFE_PLATFORM_EVS_MAX_EVENT_FILTERS < CfgFileEventsToFilter) + { + CfgFileEventsToFilter = CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; + } /* end if */ /* Register event filter table... */ - Status = CFE_EVS_Register(CFE_SB_Global.EventFilters, - CfgFileEventsToFilter, - CFE_EVS_EventFilter_BINARY); - if(Status != CFE_SUCCESS){ - CFE_ES_WriteToSysLog("SB:Call to CFE_EVS_Register Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - CFE_ES_WriteToSysLog("SB:Registered %d events for filtering\n",(int)CfgFileEventsToFilter); - - CFE_MSG_Init(&CFE_SB_Global.HKTlmMsg.Hdr.Msg, - CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), + Status = CFE_EVS_Register(CFE_SB_Global.EventFilters, CfgFileEventsToFilter, CFE_EVS_EventFilter_BINARY); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SB:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + CFE_ES_WriteToSysLog("SB:Registered %d events for filtering\n", (int)CfgFileEventsToFilter); + + CFE_MSG_Init(&CFE_SB_Global.HKTlmMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), sizeof(CFE_SB_Global.HKTlmMsg)); - CFE_MSG_Init(&CFE_SB_Global.PrevSubMsg.Hdr.Msg, - CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), + CFE_MSG_Init(&CFE_SB_Global.PrevSubMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), sizeof(CFE_SB_Global.PrevSubMsg)); /* Populate the fixed fields in the HK Tlm Msg */ CFE_SB_Global.HKTlmMsg.Payload.MemPoolHandle = CFE_SB_Global.Mem.PoolHdl; - + /* Populate the fixed fields in the Stat Tlm Msg */ - CFE_SB_Global.StatTlmMsg.Payload.MaxMsgIdsAllowed = CFE_PLATFORM_SB_MAX_MSG_IDS; - CFE_SB_Global.StatTlmMsg.Payload.MaxPipesAllowed = CFE_PLATFORM_SB_MAX_PIPES; - CFE_SB_Global.StatTlmMsg.Payload.MaxMemAllowed = CFE_PLATFORM_SB_BUF_MEMORY_BYTES; + CFE_SB_Global.StatTlmMsg.Payload.MaxMsgIdsAllowed = CFE_PLATFORM_SB_MAX_MSG_IDS; + CFE_SB_Global.StatTlmMsg.Payload.MaxPipesAllowed = CFE_PLATFORM_SB_MAX_PIPES; + CFE_SB_Global.StatTlmMsg.Payload.MaxMemAllowed = CFE_PLATFORM_SB_BUF_MEMORY_BYTES; CFE_SB_Global.StatTlmMsg.Payload.MaxPipeDepthAllowed = OS_QUEUE_MAX_DEPTH; CFE_SB_Global.StatTlmMsg.Payload.MaxSubscriptionsAllowed = - ((CFE_PLATFORM_SB_MAX_MSG_IDS)*(CFE_PLATFORM_SB_MAX_DEST_PER_PKT)); - - Status = CFE_SB_CreatePipe(&CFE_SB_Global.CmdPipe, - CFE_SB_CMD_PIPE_DEPTH, - CFE_SB_CMD_PIPE_NAME); - if(Status != CFE_SUCCESS){ - CFE_ES_WriteToSysLog("SB:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_CMD_MID),CFE_SB_Global.CmdPipe); - - if(Status != CFE_SUCCESS){ - CFE_ES_WriteToSysLog("SB:Subscribe to Cmds Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID),CFE_SB_Global.CmdPipe); - - if(Status != CFE_SUCCESS){ - CFE_ES_WriteToSysLog("SB:Subscribe to HK Request Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID),CFE_SB_Global.CmdPipe); - - if(Status != CFE_SUCCESS){ - CFE_ES_WriteToSysLog("SB:Subscribe to Subscription Report Request Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + ((CFE_PLATFORM_SB_MAX_MSG_IDS) * (CFE_PLATFORM_SB_MAX_DEST_PER_PKT)); + + Status = CFE_SB_CreatePipe(&CFE_SB_Global.CmdPipe, CFE_SB_CMD_PIPE_DEPTH, CFE_SB_CMD_PIPE_NAME); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SB:Call to CFE_SB_CreatePipe Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), CFE_SB_Global.CmdPipe); + + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SB:Subscribe to Cmds Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID), CFE_SB_Global.CmdPipe); + + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SB:Subscribe to HK Request Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID), CFE_SB_Global.CmdPipe); + + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SB:Subscribe to Subscription Report Request Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + /* Ensure a ground commanded reset does not get blocked if SB mem pool */ /* becomes fully configured (DCR6772) */ - Status = CFE_ES_GetPoolBuf(&TmpPtr, CFE_SB_Global.Mem.PoolHdl, - sizeof(CFE_ES_RestartCmd_t)); + Status = CFE_ES_GetPoolBuf(&TmpPtr, CFE_SB_Global.Mem.PoolHdl, sizeof(CFE_ES_RestartCmd_t)); - if(Status < 0){ - CFE_ES_WriteToSysLog("SB:Init error, GetPool Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + if (Status < 0) + { + CFE_ES_WriteToSysLog("SB:Init error, GetPool Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ /* 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_Global.Mem.PoolHdl, TmpPtr); - if(Status < 0){ - CFE_ES_WriteToSysLog("SB:Init error, PutPool Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - Status = CFE_EVS_SendEvent(CFE_SB_INIT_EID, - CFE_EVS_EventType_INFORMATION, - "cFE SB Initialized"); - if(Status != CFE_SUCCESS){ - CFE_ES_WriteToSysLog("SB:Error sending init event:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - return CFE_SUCCESS; + if (Status < 0) + { + CFE_ES_WriteToSysLog("SB:Init error, PutPool Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized"); + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("SB:Error sending init event:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ -}/* end CFE_SB_AppInit */ + return CFE_SUCCESS; +} /* end CFE_SB_AppInit */ /****************************************************************************** ** Function: CFE_SB_VerifyCmdLength() @@ -327,18 +333,16 @@ bool CFE_SB_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) CFE_EVS_SendEvent(CFE_SB_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, - (unsigned int)ActualLength, (unsigned int)ExpectedLength); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength, + (unsigned int)ExpectedLength); result = false; ++CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter; } - return(result); + return (result); } /* End of CFE_SB_VerifyCmdLength() */ - - /****************************************************************************** ** Function: CFE_SB_ProcessCmdPipePkt() ** @@ -353,131 +357,131 @@ bool CFE_SB_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) */ 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(&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_MSG_CommandHeader_t *)SBBufPtr); - break; - - case CFE_SB_SUB_RPT_CTRL_MID: - /* Note: Command counter not incremented for this command */ - CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); - switch (FcnCode) { - case CFE_SB_SEND_PREV_SUBS_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendPrevSubsCmd_t))) - { - CFE_SB_SendPrevSubsCmd((CFE_SB_SendPrevSubsCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_ENABLE_SUB_REPORTING_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_EnableSubReportingCmd_t))) - { - CFE_SB_EnableSubReportingCmd((CFE_SB_EnableSubReportingCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_DISABLE_SUB_REPORTING_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_DisableSubReportingCmd_t))) - { - CFE_SB_DisableSubReportingCmd((CFE_SB_DisableSubReportingCmd_t *)SBBufPtr); - } - break; - - default: - CFE_EVS_SendEvent(CFE_SB_BAD_CMD_CODE_EID,CFE_EVS_EventType_ERROR, - "Invalid Cmd, Unexpected Command Code %u", (unsigned int)FcnCode); - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; - break; - } /* end switch on cmd code */ - break; - - case CFE_SB_CMD_MID: - CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); - switch (FcnCode) { - case CFE_SB_NOOP_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_NoopCmd_t))) - { - CFE_SB_NoopCmd((CFE_SB_NoopCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_RESET_COUNTERS_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_ResetCountersCmd_t))) - { - /* Note: Command counter not incremented for this command */ - CFE_SB_ResetCountersCmd((CFE_SB_ResetCountersCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_SEND_SB_STATS_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendSbStatsCmd_t))) - { - CFE_SB_SendStatsCmd((CFE_SB_SendSbStatsCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_WRITE_ROUTING_INFO_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WriteRoutingInfoCmd_t))) - { - CFE_SB_WriteRoutingInfoCmd((CFE_SB_WriteRoutingInfoCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_ENABLE_ROUTE_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_EnableRouteCmd_t))) - { - CFE_SB_EnableRouteCmd((CFE_SB_EnableRouteCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_DISABLE_ROUTE_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_DisableRouteCmd_t))) - { - CFE_SB_DisableRouteCmd((CFE_SB_DisableRouteCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_WRITE_PIPE_INFO_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WritePipeInfoCmd_t))) - { - CFE_SB_WritePipeInfoCmd((CFE_SB_WritePipeInfoCmd_t *)SBBufPtr); - } - break; - - case CFE_SB_WRITE_MAP_INFO_CC: - if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WriteMapInfoCmd_t))) - { - CFE_SB_WriteMapInfoCmd((CFE_SB_WriteMapInfoCmd_t *)SBBufPtr); - } - break; - - default: - CFE_EVS_SendEvent(CFE_SB_BAD_CMD_CODE_EID,CFE_EVS_EventType_ERROR, - "Invalid Cmd, Unexpected Command Code %u", FcnCode); - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; - break; - } /* end switch on cmd code */ - break; - - default: - CFE_EVS_SendEvent(CFE_SB_BAD_MSGID_EID,CFE_EVS_EventType_ERROR, - "Invalid Cmd, Unexpected Msg Id: 0x%x", - (unsigned int)CFE_SB_MsgIdToValue(MessageID)); - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t FcnCode = 0; + + 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_MSG_CommandHeader_t *)SBBufPtr); break; - } /* end switch on MsgId */ + case CFE_SB_SUB_RPT_CTRL_MID: + /* Note: Command counter not incremented for this command */ + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); + switch (FcnCode) + { + case CFE_SB_SEND_PREV_SUBS_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendPrevSubsCmd_t))) + { + CFE_SB_SendPrevSubsCmd((CFE_SB_SendPrevSubsCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_ENABLE_SUB_REPORTING_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_EnableSubReportingCmd_t))) + { + CFE_SB_EnableSubReportingCmd((CFE_SB_EnableSubReportingCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_DISABLE_SUB_REPORTING_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_DisableSubReportingCmd_t))) + { + CFE_SB_DisableSubReportingCmd((CFE_SB_DisableSubReportingCmd_t *)SBBufPtr); + } + break; + + default: + CFE_EVS_SendEvent(CFE_SB_BAD_CMD_CODE_EID, CFE_EVS_EventType_ERROR, + "Invalid Cmd, Unexpected Command Code %u", (unsigned int)FcnCode); + CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; + break; + } /* end switch on cmd code */ + break; -} /* end CFE_SB_ProcessCmdPipePkt */ + case CFE_SB_CMD_MID: + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &FcnCode); + switch (FcnCode) + { + case CFE_SB_NOOP_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_NoopCmd_t))) + { + CFE_SB_NoopCmd((CFE_SB_NoopCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_RESET_COUNTERS_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_ResetCountersCmd_t))) + { + /* Note: Command counter not incremented for this command */ + CFE_SB_ResetCountersCmd((CFE_SB_ResetCountersCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_SEND_SB_STATS_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendSbStatsCmd_t))) + { + CFE_SB_SendStatsCmd((CFE_SB_SendSbStatsCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_WRITE_ROUTING_INFO_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WriteRoutingInfoCmd_t))) + { + CFE_SB_WriteRoutingInfoCmd((CFE_SB_WriteRoutingInfoCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_ENABLE_ROUTE_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_EnableRouteCmd_t))) + { + CFE_SB_EnableRouteCmd((CFE_SB_EnableRouteCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_DISABLE_ROUTE_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_DisableRouteCmd_t))) + { + CFE_SB_DisableRouteCmd((CFE_SB_DisableRouteCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_WRITE_PIPE_INFO_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WritePipeInfoCmd_t))) + { + CFE_SB_WritePipeInfoCmd((CFE_SB_WritePipeInfoCmd_t *)SBBufPtr); + } + break; + + case CFE_SB_WRITE_MAP_INFO_CC: + if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WriteMapInfoCmd_t))) + { + CFE_SB_WriteMapInfoCmd((CFE_SB_WriteMapInfoCmd_t *)SBBufPtr); + } + break; + + default: + CFE_EVS_SendEvent(CFE_SB_BAD_CMD_CODE_EID, CFE_EVS_EventType_ERROR, + "Invalid Cmd, Unexpected Command Code %u", FcnCode); + CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; + break; + } /* end switch on cmd code */ + break; + default: + CFE_EVS_SendEvent(CFE_SB_BAD_MSGID_EID, CFE_EVS_EventType_ERROR, "Invalid Cmd, Unexpected Msg Id: 0x%x", + (unsigned int)CFE_SB_MsgIdToValue(MessageID)); + CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; + break; + + } /* end switch on MsgId */ +} /* end CFE_SB_ProcessCmdPipePkt */ /****************************************************************************** ** Function: CFE_SB_NoopCmd() @@ -488,8 +492,7 @@ void CFE_SB_ProcessCmdPipePkt(CFE_SB_Buffer_t *SBBufPtr) */ 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); + CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd. %s", CFE_VERSION_STRING); CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; return CFE_SUCCESS; @@ -504,8 +507,7 @@ int32 CFE_SB_NoopCmd(const CFE_SB_NoopCmd_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"); + CFE_EVS_SendEvent(CFE_SB_CMD1_RCVD_EID, CFE_EVS_EventType_DEBUG, "Reset Counters Cmd Rcvd"); CFE_SB_ResetCounters(); @@ -538,7 +540,6 @@ int32 CFE_SB_DisableSubReportingCmd(const CFE_SB_DisableSubReportingCmd_t *data) return CFE_SUCCESS; } - /****************************************************************************** ** Function: CFE_SB_SendHKTlmCmd() ** @@ -558,8 +559,9 @@ int32 CFE_SB_SendHKTlmCmd(const CFE_MSG_CommandHeader_t *data) { CFE_SB_LockSharedData(__FILE__, __LINE__); - CFE_SB_Global.HKTlmMsg.Payload.MemInUse = CFE_SB_Global.StatTlmMsg.Payload.MemInUse; - CFE_SB_Global.HKTlmMsg.Payload.UnmarkedMem = CFE_PLATFORM_SB_BUF_MEMORY_BYTES - CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse; + CFE_SB_Global.HKTlmMsg.Payload.MemInUse = CFE_SB_Global.StatTlmMsg.Payload.MemInUse; + CFE_SB_Global.HKTlmMsg.Payload.UnmarkedMem = + CFE_PLATFORM_SB_BUF_MEMORY_BYTES - CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse; CFE_SB_UnlockSharedData(__FILE__, __LINE__); @@ -567,8 +569,7 @@ int32 CFE_SB_SendHKTlmCmd(const CFE_MSG_CommandHeader_t *data) CFE_SB_TransmitMsg(&CFE_SB_Global.HKTlmMsg.Hdr.Msg, true); return CFE_SUCCESS; -}/* end CFE_SB_SendHKTlmCmd */ - +} /* end CFE_SB_SendHKTlmCmd */ /****************************************************************************** ** Function: CFE_SB_ResetCounters() @@ -585,22 +586,22 @@ int32 CFE_SB_SendHKTlmCmd(const CFE_MSG_CommandHeader_t *data) ** Return: ** none */ -void CFE_SB_ResetCounters(void){ - - CFE_SB_Global.HKTlmMsg.Payload.CommandCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.DuplicateSubscriptionsCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.MsgReceiveErrorCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.InternalErrorCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.CreatePipeErrorCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.SubscribeErrorCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.PipeOverflowErrorCounter = 0; - CFE_SB_Global.HKTlmMsg.Payload.MsgLimitErrorCounter = 0; +void CFE_SB_ResetCounters(void) +{ -}/* end CFE_SB_ResetCounters */ + CFE_SB_Global.HKTlmMsg.Payload.CommandCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.DuplicateSubscriptionsCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.MsgReceiveErrorCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.InternalErrorCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.CreatePipeErrorCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.SubscribeErrorCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.PipeOverflowErrorCounter = 0; + CFE_SB_Global.HKTlmMsg.Payload.MsgLimitErrorCounter = 0; +} /* end CFE_SB_ResetCounters */ /****************************************************************************** ** Function: CFE_SB_EnableRouteCmd() @@ -617,23 +618,22 @@ void CFE_SB_ResetCounters(void){ */ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) { - CFE_SB_MsgId_t MsgId; - CFE_SB_PipeD_t *PipeDscPtr; - CFE_SB_DestinationD_t *DestPtr; - const CFE_SB_RouteCmd_Payload_t *CmdPtr; - uint16 PendingEventID; + CFE_SB_MsgId_t MsgId; + CFE_SB_PipeD_t * PipeDscPtr; + CFE_SB_DestinationD_t * DestPtr; + const CFE_SB_RouteCmd_Payload_t *CmdPtr; + uint16 PendingEventID; PendingEventID = 0; - CmdPtr = &data->Payload; + CmdPtr = &data->Payload; - MsgId = CmdPtr->MsgId; + MsgId = CmdPtr->MsgId; - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* check cmd parameters */ PipeDscPtr = CFE_SB_LocatePipeDescByID(CmdPtr->Pipe); - if(!CFE_SB_IsValidMsgId(MsgId) || - !CFE_SB_PipeDescIsMatch(PipeDscPtr,CmdPtr->Pipe)) + if (!CFE_SB_IsValidMsgId(MsgId) || !CFE_SB_PipeDescIsMatch(PipeDscPtr, CmdPtr->Pipe)) { PendingEventID = CFE_SB_ENBL_RTE3_EID; CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; @@ -641,7 +641,7 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) else { DestPtr = CFE_SB_GetDestPtr(CFE_SBR_GetRouteId(MsgId), CmdPtr->Pipe); - if(DestPtr == NULL) + if (DestPtr == NULL) { PendingEventID = CFE_SB_ENBL_RTE1_EID; CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; @@ -649,40 +649,34 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) else { DestPtr->Active = CFE_SB_ACTIVE; - PendingEventID = CFE_SB_ENBL_RTE2_EID; + PendingEventID = CFE_SB_ENBL_RTE2_EID; CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; } - }/* end if */ + } /* end if */ - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); - switch(PendingEventID) + switch (PendingEventID) { case CFE_SB_ENBL_RTE1_EID: - CFE_EVS_SendEvent(CFE_SB_ENBL_RTE1_EID,CFE_EVS_EventType_ERROR, - "Enbl Route Cmd:Route does not exist.Msg 0x%x,Pipe %lu", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); + CFE_EVS_SendEvent(CFE_SB_ENBL_RTE1_EID, CFE_EVS_EventType_ERROR, + "Enbl Route Cmd:Route does not exist.Msg 0x%x,Pipe %lu", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); break; case CFE_SB_ENBL_RTE3_EID: - CFE_EVS_SendEvent(CFE_SB_ENBL_RTE3_EID,CFE_EVS_EventType_ERROR, - "Enbl Route Cmd:Invalid Param.Msg 0x%x,Pipe %lu", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); + CFE_EVS_SendEvent(CFE_SB_ENBL_RTE3_EID, CFE_EVS_EventType_ERROR, + "Enbl Route Cmd:Invalid Param.Msg 0x%x,Pipe %lu", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); break; case CFE_SB_ENBL_RTE2_EID: - CFE_EVS_SendEvent(CFE_SB_ENBL_RTE2_EID,CFE_EVS_EventType_DEBUG, - "Enabling Route,Msg 0x%x,Pipe %lu", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); + CFE_EVS_SendEvent(CFE_SB_ENBL_RTE2_EID, CFE_EVS_EventType_DEBUG, "Enabling Route,Msg 0x%x,Pipe %lu", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); break; } return CFE_SUCCESS; -}/* end CFE_SB_EnableRouteCmd */ - - +} /* end CFE_SB_EnableRouteCmd */ /****************************************************************************** ** Function: CFE_SB_DisableRouteCmd() @@ -699,23 +693,22 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) */ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) { - CFE_SB_MsgId_t MsgId; - CFE_SB_PipeD_t *PipeDscPtr; - CFE_SB_DestinationD_t *DestPtr; - const CFE_SB_RouteCmd_Payload_t *CmdPtr; - uint16 PendingEventID; + CFE_SB_MsgId_t MsgId; + CFE_SB_PipeD_t * PipeDscPtr; + CFE_SB_DestinationD_t * DestPtr; + const CFE_SB_RouteCmd_Payload_t *CmdPtr; + uint16 PendingEventID; PendingEventID = 0; - CmdPtr = &data->Payload; + CmdPtr = &data->Payload; - MsgId = CmdPtr->MsgId; + MsgId = CmdPtr->MsgId; - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* check cmd parameters */ PipeDscPtr = CFE_SB_LocatePipeDescByID(CmdPtr->Pipe); - if(!CFE_SB_IsValidMsgId(MsgId) || - !CFE_SB_PipeDescIsMatch(PipeDscPtr,CmdPtr->Pipe)) + if (!CFE_SB_IsValidMsgId(MsgId) || !CFE_SB_PipeDescIsMatch(PipeDscPtr, CmdPtr->Pipe)) { PendingEventID = CFE_SB_DSBL_RTE3_EID; CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; @@ -723,7 +716,7 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) else { DestPtr = CFE_SB_GetDestPtr(CFE_SBR_GetRouteId(MsgId), CmdPtr->Pipe); - if(DestPtr == NULL) + if (DestPtr == NULL) { PendingEventID = CFE_SB_DSBL_RTE1_EID; CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; @@ -731,40 +724,34 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) else { DestPtr->Active = CFE_SB_INACTIVE; - PendingEventID = CFE_SB_DSBL_RTE2_EID; + PendingEventID = CFE_SB_DSBL_RTE2_EID; CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; } - }/* end if */ + } /* end if */ - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); - - switch(PendingEventID) + switch (PendingEventID) { case CFE_SB_DSBL_RTE1_EID: - CFE_EVS_SendEvent(CFE_SB_DSBL_RTE1_EID,CFE_EVS_EventType_ERROR, - "Disable Route Cmd:Route does not exist,Msg 0x%x,Pipe %lu", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); + CFE_EVS_SendEvent(CFE_SB_DSBL_RTE1_EID, CFE_EVS_EventType_ERROR, + "Disable Route Cmd:Route does not exist,Msg 0x%x,Pipe %lu", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); break; case CFE_SB_DSBL_RTE3_EID: - CFE_EVS_SendEvent(CFE_SB_DSBL_RTE3_EID,CFE_EVS_EventType_ERROR, - "Disable Route Cmd:Invalid Param.Msg 0x%x,Pipe %lu", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); + CFE_EVS_SendEvent(CFE_SB_DSBL_RTE3_EID, CFE_EVS_EventType_ERROR, + "Disable Route Cmd:Invalid Param.Msg 0x%x,Pipe %lu", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); break; case CFE_SB_DSBL_RTE2_EID: - CFE_EVS_SendEvent(CFE_SB_DSBL_RTE2_EID,CFE_EVS_EventType_DEBUG, - "Route Disabled,Msg 0x%x,Pipe %lu", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); + CFE_EVS_SendEvent(CFE_SB_DSBL_RTE2_EID, CFE_EVS_EventType_DEBUG, "Route Disabled,Msg 0x%x,Pipe %lu", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(CmdPtr->Pipe)); break; } return CFE_SUCCESS; -}/* end CFE_SB_DisableRouteCmd */ - +} /* end CFE_SB_DisableRouteCmd */ /****************************************************************************** ** Function: CFE_SB_SendStatsCmd() @@ -780,18 +767,18 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) */ int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStatsCmd_t *data) { - uint32 PipeDscCount; - uint32 PipeStatCount; - CFE_SB_PipeD_t *PipeDscPtr; + uint32 PipeDscCount; + uint32 PipeStatCount; + CFE_SB_PipeD_t * PipeDscPtr; CFE_SB_PipeDepthStats_t *PipeStatPtr; CFE_SB_LockSharedData(__FILE__, __LINE__); /* Collect data on pipes */ - PipeDscCount = CFE_PLATFORM_SB_MAX_PIPES; + PipeDscCount = CFE_PLATFORM_SB_MAX_PIPES; PipeStatCount = CFE_MISSION_SB_MAX_PIPES; - PipeDscPtr = CFE_SB_Global.PipeTbl; - PipeStatPtr = CFE_SB_Global.StatTlmMsg.Payload.PipeDepthStats; + PipeDscPtr = CFE_SB_Global.PipeTbl; + PipeStatPtr = CFE_SB_Global.StatTlmMsg.Payload.PipeDepthStats; while (PipeDscCount > 0 && PipeStatCount > 0) { @@ -825,26 +812,25 @@ int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStatsCmd_t *data) CFE_SB_TimeStampMsg(&CFE_SB_Global.StatTlmMsg.Hdr.Msg); CFE_SB_TransmitMsg(&CFE_SB_Global.StatTlmMsg.Hdr.Msg, true); - CFE_EVS_SendEvent(CFE_SB_SND_STATS_EID,CFE_EVS_EventType_DEBUG, - "Software Bus Statistics packet sent"); + CFE_EVS_SendEvent(CFE_SB_SND_STATS_EID, CFE_EVS_EventType_DEBUG, "Software Bus Statistics packet sent"); CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; return CFE_SUCCESS; -}/* CFE_SB_SendStatsCmd */ +} /* CFE_SB_SendStatsCmd */ /****************************************************************************** * Local callback helper for writing routing info to a file */ void CFE_SB_CollectRouteInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) { - CFE_SB_DestinationD_t *DestPtr; - CFE_SB_PipeD_t *PipeDscPtr; - CFE_SB_MsgId_t RouteMsgId; + CFE_SB_DestinationD_t * DestPtr; + CFE_SB_PipeD_t * PipeDscPtr; + CFE_SB_MsgId_t RouteMsgId; CFE_SB_BackgroundRouteInfoBuffer_t *RouteBufferPtr; - CFE_SB_RoutingFileEntry_t *FileEntryPtr; - CFE_ES_AppId_t DestAppId[CFE_PLATFORM_SB_MAX_DEST_PER_PKT]; - uint32 i; + CFE_SB_RoutingFileEntry_t * FileEntryPtr; + CFE_ES_AppId_t DestAppId[CFE_PLATFORM_SB_MAX_DEST_PER_PKT]; + uint32 i; /* Cast arguments for local use */ RouteBufferPtr = (CFE_SB_BackgroundRouteInfoBuffer_t *)ArgPtr; @@ -853,7 +839,7 @@ void CFE_SB_CollectRouteInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) /* Data must be locked to snapshot the route info */ CFE_SB_LockSharedData(__FILE__, __LINE__); - RouteMsgId = CFE_SBR_GetMsgId(RouteId); + RouteMsgId = CFE_SBR_GetMsgId(RouteId); RouteBufferPtr->NumDestinations = 0; /* If this is a valid route, get the destinations */ @@ -862,12 +848,12 @@ void CFE_SB_CollectRouteInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) DestPtr = CFE_SBR_GetDestListHeadPtr(RouteId); /* copy relevant data from the destination list into the temp buffer */ - while(DestPtr != NULL && RouteBufferPtr->NumDestinations < CFE_PLATFORM_SB_MAX_DEST_PER_PKT) + while (DestPtr != NULL && RouteBufferPtr->NumDestinations < CFE_PLATFORM_SB_MAX_DEST_PER_PKT) { PipeDscPtr = CFE_SB_LocatePipeDescByID(DestPtr->PipeId); /* If invalid id, continue on to next entry */ - if (CFE_SB_PipeDescIsMatch(PipeDscPtr,DestPtr->PipeId)) + if (CFE_SB_PipeDescIsMatch(PipeDscPtr, DestPtr->PipeId)) { FileEntryPtr = &RouteBufferPtr->DestEntries[RouteBufferPtr->NumDestinations]; @@ -876,7 +862,7 @@ void CFE_SB_CollectRouteInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) FileEntryPtr->PipeId = DestPtr->PipeId; FileEntryPtr->State = DestPtr->Active; - FileEntryPtr->MsgCnt = DestPtr->DestCnt; + FileEntryPtr->MsgCnt = DestPtr->DestCnt; /* Stash the Pipe Owner AppId - App Name is looked up later (comes from ES) */ DestAppId[RouteBufferPtr->NumDestinations] = PipeDscPtr->AppId; @@ -892,7 +878,7 @@ void CFE_SB_CollectRouteInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) /* Go through the temp buffer and fill in the remaining info for each dest */ FileEntryPtr = RouteBufferPtr->DestEntries; - for(i = 0; i < RouteBufferPtr->NumDestinations; ++i) + for (i = 0; i < RouteBufferPtr->NumDestinations; ++i) { /* All dest entries refer to the same MsgId (based on the route) */ FileEntryPtr->MsgId = RouteMsgId; @@ -925,26 +911,24 @@ void CFE_SB_CollectRouteInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) int32 CFE_SB_SendSubscriptionReport(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, CFE_SB_Qos_t Quality) { CFE_SB_SingleSubscriptionTlm_t SubRptMsg; - int32 Status; + int32 Status; Status = CFE_SUCCESS; if (CFE_SB_Global.SubscriptionReporting == CFE_SB_ENABLE) { - CFE_MSG_Init(&SubRptMsg.Hdr.Msg, - CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), - sizeof(SubRptMsg)); + CFE_MSG_Init(&SubRptMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), sizeof(SubRptMsg)); - SubRptMsg.Payload.MsgId = MsgId; - SubRptMsg.Payload.Pipe = PipeId; - SubRptMsg.Payload.Qos = Quality; + SubRptMsg.Payload.MsgId = MsgId; + SubRptMsg.Payload.Pipe = PipeId; + SubRptMsg.Payload.Qos = Quality; SubRptMsg.Payload.SubType = CFE_SB_SUBSCRIPTION; Status = CFE_SB_TransmitMsg(&SubRptMsg.Hdr.Msg, true); - CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RPT_EID,CFE_EVS_EventType_DEBUG,CFE_SB_Global.AppId, - "Sending Subscription Report Msg=0x%x,Pipe=%lu,Stat=0x%x", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), - CFE_RESOURCEID_TO_ULONG(PipeId),(unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RPT_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "Sending Subscription Report Msg=0x%x,Pipe=%lu,Stat=0x%x", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), + (unsigned int)Status); } return Status; @@ -953,14 +937,14 @@ int32 CFE_SB_SendSubscriptionReport(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId bool CFE_SB_WriteRouteInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize) { CFE_SB_BackgroundFileStateInfo_t *BgFilePtr; - CFE_SBR_Throttle_t Throttle; + CFE_SBR_Throttle_t Throttle; /* Cast arguments for local use */ BgFilePtr = (CFE_SB_BackgroundFileStateInfo_t *)Meta; Throttle.StartIndex = RecordNum; - Throttle.MaxLoop = 1; - Throttle.NextIndex = 0; + Throttle.MaxLoop = 1; + Throttle.NextIndex = 0; /* Reset NumDestinations to 0, just in case the CFE_SBR_ForEachRouteId() is a no-op */ BgFilePtr->Buffer.RouteInfo.NumDestinations = 0; @@ -976,7 +960,8 @@ bool CFE_SB_WriteRouteInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer return (Throttle.NextIndex == 0); } -void CFE_SB_BackgroundFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position) +void CFE_SB_BackgroundFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, + size_t BlockSize, size_t Position) { CFE_SB_BackgroundFileStateInfo_t *BgFilePtr; @@ -985,38 +970,34 @@ void CFE_SB_BackgroundFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event /* * Note that this runs in the context of ES background task (file writer background job) * It does NOT run in the context of the CFE_TBL app task. - * + * * Events should use CFE_EVS_SendEventWithAppID() rather than CFE_EVS_SendEvent() * to get proper association with TBL task. */ - switch(Event) + switch (Event) { case CFE_FS_FileWriteEvent_COMPLETE: - CFE_EVS_SendEventWithAppID(CFE_SB_SND_RTG_EID,CFE_EVS_EventType_DEBUG, - CFE_SB_Global.AppId, - "%s written:Size=%d,Entries=%d", - BgFilePtr->FileWrite.FileName, (int)Position, (int)RecordNum); - break; + CFE_EVS_SendEventWithAppID(CFE_SB_SND_RTG_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, + "%s written:Size=%d,Entries=%d", BgFilePtr->FileWrite.FileName, (int)Position, + (int)RecordNum); + break; case CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR: case CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR: - CFE_EVS_SendEventWithAppID(CFE_SB_FILEWRITE_ERR_EID,CFE_EVS_EventType_ERROR, - CFE_SB_Global.AppId, - "File write,byte cnt err,file %s,request=%d,actual=%d", - BgFilePtr->FileWrite.FileName, (int)BlockSize, (int)Status); + CFE_EVS_SendEventWithAppID(CFE_SB_FILEWRITE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "File write,byte cnt err,file %s,request=%d,actual=%d", + BgFilePtr->FileWrite.FileName, (int)BlockSize, (int)Status); break; case CFE_FS_FileWriteEvent_CREATE_ERROR: - CFE_EVS_SendEventWithAppID(CFE_SB_SND_RTG_ERR1_EID, CFE_EVS_EventType_ERROR, - CFE_SB_Global.AppId, - "Error creating file %s, stat=0x%x", - BgFilePtr->FileWrite.FileName, (int)Status); + CFE_EVS_SendEventWithAppID(CFE_SB_SND_RTG_ERR1_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Error creating file %s, stat=0x%x", BgFilePtr->FileWrite.FileName, (int)Status); break; - + default: /* unhandled event - ignore */ break; - } + } } /****************************************************************************** @@ -1029,11 +1010,11 @@ void CFE_SB_BackgroundFileEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event int32 CFE_SB_WriteRoutingInfoCmd(const CFE_SB_WriteRoutingInfoCmd_t *data) { const CFE_SB_WriteFileInfoCmd_Payload_t *CmdPtr; - CFE_SB_BackgroundFileStateInfo_t *StatePtr; - int32 Status; + CFE_SB_BackgroundFileStateInfo_t * StatePtr; + int32 Status; StatePtr = &CFE_SB_Global.BackgroundFile; - CmdPtr = &data->Payload; + CmdPtr = &data->Payload; /* If a routing info dump was already pending, do not overwrite the current request */ if (!CFE_FS_BackgroundFileDumpIsPending(&StatePtr->FileWrite)) @@ -1042,11 +1023,12 @@ int32 CFE_SB_WriteRoutingInfoCmd(const CFE_SB_WriteRoutingInfoCmd_t *data) memset(StatePtr, 0, sizeof(*StatePtr)); /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ - CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->Filename, CFE_PLATFORM_SB_DEFAULT_ROUTING_FILENAME, - sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->Filename)); + CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->Filename, + CFE_PLATFORM_SB_DEFAULT_ROUTING_FILENAME, sizeof(StatePtr->FileWrite.FileName), + sizeof(CmdPtr->Filename)); - /* - * Fill out the remainder of meta data. + /* + * Fill out the remainder of meta data. * This data is currently the same for every request */ StatePtr->FileWrite.FileSubType = CFE_FS_SubType_SB_ROUTEDATA; @@ -1061,29 +1043,28 @@ int32 CFE_SB_WriteRoutingInfoCmd(const CFE_SB_WriteRoutingInfoCmd_t *data) { Status = CFE_STATUS_REQUEST_ALREADY_PENDING; } - + if (Status != CFE_SUCCESS) { /* generate the same event as is generated when unable to create the file (same thing, really) */ CFE_SB_BackgroundFileEventHandler(StatePtr, CFE_FS_FileWriteEvent_CREATE_ERROR, Status, 0, 0, 0); } - + CFE_SB_IncrCmdCtr(Status); - - return CFE_SUCCESS; -}/* end CFE_SB_WriteRoutingInfoCmd */ + return CFE_SUCCESS; +} /* end CFE_SB_WriteRoutingInfoCmd */ bool CFE_SB_WritePipeInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize) { CFE_SB_BackgroundFileStateInfo_t *BgFilePtr; - CFE_SB_PipeInfoEntry_t *PipeBufferPtr; - CFE_SB_PipeD_t *PipeDscPtr; - osal_id_t SysQueueId; - bool PipeIsValid; + CFE_SB_PipeInfoEntry_t * PipeBufferPtr; + CFE_SB_PipeD_t * PipeDscPtr; + osal_id_t SysQueueId; + bool PipeIsValid; - BgFilePtr = (CFE_SB_BackgroundFileStateInfo_t *)Meta; - PipeDscPtr = NULL; + BgFilePtr = (CFE_SB_BackgroundFileStateInfo_t *)Meta; + PipeDscPtr = NULL; PipeIsValid = false; PipeBufferPtr = &BgFilePtr->Buffer.PipeInfo; @@ -1092,7 +1073,7 @@ bool CFE_SB_WritePipeInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, { PipeDscPtr = &CFE_SB_Global.PipeTbl[RecordNum]; - CFE_SB_LockSharedData(__FILE__,__LINE__); + CFE_SB_LockSharedData(__FILE__, __LINE__); PipeIsValid = CFE_SB_PipeDescIsUsed(PipeDscPtr); @@ -1104,9 +1085,9 @@ bool CFE_SB_WritePipeInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, memset(PipeBufferPtr, 0, sizeof(*PipeBufferPtr)); /* - * Take a "snapshot" of the PipeDsc state while locked + * Take a "snapshot" of the PipeDsc state while locked */ - PipeBufferPtr->PipeId = CFE_SB_PipeDescGetID(PipeDscPtr); + PipeBufferPtr->PipeId = CFE_SB_PipeDescGetID(PipeDscPtr); PipeBufferPtr->AppId = PipeDscPtr->AppId; PipeBufferPtr->Opts = PipeDscPtr->Opts; @@ -1122,9 +1103,9 @@ bool CFE_SB_WritePipeInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, { SysQueueId = OS_OBJECT_ID_UNDEFINED; } - - CFE_SB_UnlockSharedData(__FILE__,__LINE__); - } + + CFE_SB_UnlockSharedData(__FILE__, __LINE__); + } if (PipeIsValid) { @@ -1137,20 +1118,19 @@ bool CFE_SB_WritePipeInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, OS_GetResourceName(SysQueueId, PipeBufferPtr->PipeName, sizeof(PipeBufferPtr->PipeName)); CFE_ES_GetAppName(PipeBufferPtr->AppName, PipeBufferPtr->AppId, sizeof(PipeBufferPtr->AppName)); - *Buffer = PipeBufferPtr; + *Buffer = PipeBufferPtr; *BufSize = sizeof(*PipeBufferPtr); } else { - *Buffer = NULL; + *Buffer = NULL; *BufSize = 0; } - + /* Check for EOF (last entry) */ - return (RecordNum >= (CFE_PLATFORM_SB_MAX_PIPES-1)); + return (RecordNum >= (CFE_PLATFORM_SB_MAX_PIPES - 1)); } - /****************************************************************************** * \brief SB internal function to handle processing of 'Write Pipe Info' Cmd * @@ -1161,11 +1141,11 @@ bool CFE_SB_WritePipeInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data) { const CFE_SB_WriteFileInfoCmd_Payload_t *CmdPtr; - CFE_SB_BackgroundFileStateInfo_t *StatePtr; - int32 Status; + CFE_SB_BackgroundFileStateInfo_t * StatePtr; + int32 Status; StatePtr = &CFE_SB_Global.BackgroundFile; - CmdPtr = &data->Payload; + CmdPtr = &data->Payload; /* If a pipe info dump was already pending, do not overwrite the current request */ if (!CFE_FS_BackgroundFileDumpIsPending(&StatePtr->FileWrite)) @@ -1175,10 +1155,10 @@ int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data) /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->Filename, CFE_PLATFORM_SB_DEFAULT_PIPE_FILENAME, - sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->Filename)); + sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->Filename)); - /* - * Fill out the remainder of meta data. + /* + * Fill out the remainder of meta data. * This data is currently the same for every request */ StatePtr->FileWrite.FileSubType = CFE_FS_SubType_SB_PIPEDATA; @@ -1193,7 +1173,7 @@ int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data) { Status = CFE_STATUS_REQUEST_ALREADY_PENDING; } - + if (Status != CFE_SUCCESS) { /* generate the same event as is generated when unable to create the file (same thing, really) */ @@ -1203,7 +1183,6 @@ int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data) CFE_SB_IncrCmdCtr(Status); return CFE_SUCCESS; - } /****************************************************************************** @@ -1211,7 +1190,7 @@ int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data) */ void CFE_SB_CollectMsgMapInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) { - CFE_SB_MsgMapFileEntry_t *BufferPtr; + CFE_SB_MsgMapFileEntry_t *BufferPtr; /* Cast arguments for local use */ BufferPtr = (CFE_SB_MsgMapFileEntry_t *)ArgPtr; @@ -1223,21 +1202,20 @@ void CFE_SB_CollectMsgMapInfo(CFE_SBR_RouteId_t RouteId, void *ArgPtr) BufferPtr->MsgId = CFE_SBR_GetMsgId(RouteId); BufferPtr->Index = CFE_SBR_RouteIdToValue(RouteId); - CFE_SB_UnlockSharedData(__FILE__,__LINE__); + CFE_SB_UnlockSharedData(__FILE__, __LINE__); } - bool CFE_SB_WriteMsgMapInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize) { CFE_SB_BackgroundFileStateInfo_t *BgFilePtr; - CFE_SBR_Throttle_t Throttle; + CFE_SBR_Throttle_t Throttle; /* Cast arguments for local use */ BgFilePtr = (CFE_SB_BackgroundFileStateInfo_t *)Meta; Throttle.StartIndex = RecordNum; - Throttle.MaxLoop = 1; - Throttle.NextIndex = 0; + Throttle.MaxLoop = 1; + Throttle.NextIndex = 0; /* Set the MsgId intially - will be overwritten with real info in CFE_SB_CollectMsgMapInfo */ BgFilePtr->Buffer.MsgMapInfo.MsgId = CFE_SB_INVALID_MSG_ID; @@ -1261,7 +1239,6 @@ bool CFE_SB_WriteMsgMapInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffe return (Throttle.NextIndex == 0); } - /****************************************************************************** * \brief SB internal function to handle processing of 'Write Map Info' Cmd * @@ -1272,11 +1249,11 @@ bool CFE_SB_WriteMsgMapInfoDataGetter(void *Meta, uint32 RecordNum, void **Buffe int32 CFE_SB_WriteMapInfoCmd(const CFE_SB_WriteMapInfoCmd_t *data) { const CFE_SB_WriteFileInfoCmd_Payload_t *CmdPtr; - CFE_SB_BackgroundFileStateInfo_t *StatePtr; - int32 Status; + CFE_SB_BackgroundFileStateInfo_t * StatePtr; + int32 Status; StatePtr = &CFE_SB_Global.BackgroundFile; - CmdPtr = &data->Payload; + CmdPtr = &data->Payload; /* If a pipe info dump was already pending, do not overwrite the current request */ if (!CFE_FS_BackgroundFileDumpIsPending(&StatePtr->FileWrite)) @@ -1286,10 +1263,10 @@ int32 CFE_SB_WriteMapInfoCmd(const CFE_SB_WriteMapInfoCmd_t *data) /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->Filename, CFE_PLATFORM_SB_DEFAULT_MAP_FILENAME, - sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->Filename)); + sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->Filename)); - /* - * Fill out the remainder of meta data. + /* + * Fill out the remainder of meta data. * This data is currently the same for every request */ StatePtr->FileWrite.FileSubType = CFE_FS_SubType_SB_MAPDATA; @@ -1304,7 +1281,7 @@ int32 CFE_SB_WriteMapInfoCmd(const CFE_SB_WriteMapInfoCmd_t *data) { Status = CFE_STATUS_REQUEST_ALREADY_PENDING; } - + if (Status != CFE_SUCCESS) { /* generate the same event as is generated when unable to create the file (same thing, really) */ @@ -1314,7 +1291,7 @@ int32 CFE_SB_WriteMapInfoCmd(const CFE_SB_WriteMapInfoCmd_t *data) CFE_SB_IncrCmdCtr(Status); return CFE_SUCCESS; -}/* end CFE_SB_WriteMapInfoCmd */ +} /* end CFE_SB_WriteMapInfoCmd */ /****************************************************************************** * Local callback helper for sending route subscriptions @@ -1327,28 +1304,29 @@ void CFE_SB_SendRouteSub(CFE_SBR_RouteId_t RouteId, void *ArgPtr) destptr = CFE_SBR_GetDestListHeadPtr(RouteId); /* Loop through destinations */ - while(destptr != NULL) + while (destptr != NULL) { - if(destptr->Scope == CFE_SB_MSG_GLOBAL) + if (destptr->Scope == CFE_SB_MSG_GLOBAL) { /* ...add entry into pkt */ - CFE_SB_Global.PrevSubMsg.Payload.Entry[CFE_SB_Global.PrevSubMsg.Payload.Entries].MsgId = CFE_SBR_GetMsgId(RouteId); - CFE_SB_Global.PrevSubMsg.Payload.Entry[CFE_SB_Global.PrevSubMsg.Payload.Entries].Qos.Priority = 0; + CFE_SB_Global.PrevSubMsg.Payload.Entry[CFE_SB_Global.PrevSubMsg.Payload.Entries].MsgId = + CFE_SBR_GetMsgId(RouteId); + CFE_SB_Global.PrevSubMsg.Payload.Entry[CFE_SB_Global.PrevSubMsg.Payload.Entries].Qos.Priority = 0; CFE_SB_Global.PrevSubMsg.Payload.Entry[CFE_SB_Global.PrevSubMsg.Payload.Entries].Qos.Reliability = 0; CFE_SB_Global.PrevSubMsg.Payload.Entries++; /* send pkt if full */ - if(CFE_SB_Global.PrevSubMsg.Payload.Entries >= CFE_SB_SUB_ENTRIES_PER_PKT) + if (CFE_SB_Global.PrevSubMsg.Payload.Entries >= CFE_SB_SUB_ENTRIES_PER_PKT) { - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); status = CFE_SB_TransmitMsg(&CFE_SB_Global.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_Global.PrevSubMsg.Payload.PktSegment, (int)CFE_SB_Global.PrevSubMsg.Payload.Entries, (unsigned int)status); - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); CFE_SB_Global.PrevSubMsg.Payload.Entries = 0; CFE_SB_Global.PrevSubMsg.Payload.PktSegment++; } @@ -1360,7 +1338,6 @@ void CFE_SB_SendRouteSub(CFE_SBR_RouteId_t RouteId, void *ArgPtr) * subscription if there are more than one */ break; - } /* Advance to next destination */ @@ -1387,31 +1364,29 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data) int32 status; /* Take semaphore to ensure data does not change during this function */ - CFE_SB_LockSharedData(__func__,__LINE__); + CFE_SB_LockSharedData(__func__, __LINE__); /* Initialize entry/segment tracking */ CFE_SB_Global.PrevSubMsg.Payload.PktSegment = 1; - CFE_SB_Global.PrevSubMsg.Payload.Entries = 0; + CFE_SB_Global.PrevSubMsg.Payload.Entries = 0; /* Send subcription for each route */ CFE_SBR_ForEachRouteId(CFE_SB_SendRouteSub, NULL, NULL); - CFE_SB_UnlockSharedData(__func__,__LINE__); + CFE_SB_UnlockSharedData(__func__, __LINE__); /* if pkt has any number of entries, send it as a partial pkt */ - if(CFE_SB_Global.PrevSubMsg.Payload.Entries > 0) + if (CFE_SB_Global.PrevSubMsg.Payload.Entries > 0) { status = CFE_SB_TransmitMsg(&CFE_SB_Global.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_Global.PrevSubMsg.Payload.PktSegment, (int)CFE_SB_Global.PrevSubMsg.Payload.Entries, - (unsigned int)status); + (int)CFE_SB_Global.PrevSubMsg.Payload.PktSegment, + (int)CFE_SB_Global.PrevSubMsg.Payload.Entries, (unsigned int)status); } return CFE_SUCCESS; -}/* end CFE_SB_SendPrevSubsCmd */ - - +} /* end CFE_SB_SendPrevSubsCmd */ /****************************************************************************** ** Function: CFE_SB_IncrCmdCtr() @@ -1426,15 +1401,19 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data) ** Return: ** None */ -void CFE_SB_IncrCmdCtr(int32 status){ +void CFE_SB_IncrCmdCtr(int32 status) +{ - if(status==CFE_SUCCESS){ - CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; - }else{ - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; - }/* end if */ + if (status == CFE_SUCCESS) + { + CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; + } + else + { + CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; + } /* end if */ -}/* end CFE_SB_IncrCmdCtr */ +} /* end CFE_SB_IncrCmdCtr */ /****************************************************************************** ** Function: CFE_SB_SetSubscriptionReporting() @@ -1448,8 +1427,9 @@ void CFE_SB_IncrCmdCtr(int32 status){ ** Return: ** None */ -void CFE_SB_SetSubscriptionReporting(uint32 state){ +void CFE_SB_SetSubscriptionReporting(uint32 state) +{ CFE_SB_Global.SubscriptionReporting = state; -}/* end CFE_SB_SetSubscriptionReporting */ +} /* end CFE_SB_SetSubscriptionReporting */ diff --git a/modules/sb/fsw/src/cfe_sb_util.c b/modules/sb/fsw/src/cfe_sb_util.c index 78f9b15d8..20de113b3 100644 --- a/modules/sb/fsw/src/cfe_sb_util.c +++ b/modules/sb/fsw/src/cfe_sb_util.c @@ -29,7 +29,6 @@ ** ******************************************************************************/ - /* ** Include Files */ @@ -42,13 +41,10 @@ /* * Function: CFE_SB_InitMsg - See API and header file for details */ -void CFE_SB_InitMsg(void *MsgPtr, - CFE_SB_MsgId_t MsgId, - size_t Length, - bool Clear ) +void CFE_SB_InitMsg(void *MsgPtr, CFE_SB_MsgId_t MsgId, size_t Length, bool Clear) { - CFE_MSG_Init((CFE_MSG_Message_t *)MsgPtr, MsgId, Length); + CFE_MSG_Init((CFE_MSG_Message_t *)MsgPtr, MsgId, Length); } /* end CFE_SB_InitMsg */ #endif @@ -60,16 +56,16 @@ void CFE_SB_InitMsg(void *MsgPtr, ** Get the size of a message header. ** ** Arguments: -** *MsgPtr - Pointer to a SB message +** *MsgPtr - Pointer to a SB message ** ** Return: ** Size of Message Header. */ size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr) { - size_t size = 0; + size_t size = 0; bool hassechdr = false; - CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; + CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; if (MsgPtr == NULL) { @@ -81,33 +77,33 @@ size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr) /* if secondary hdr is not present... */ /* Since all cFE messages must have a secondary hdr this check is not needed */ - if(!hassechdr) + if (!hassechdr) { size = sizeof(CCSDS_SpacePacket_t); } - else if(type == CFE_MSG_Type_Cmd) + else if (type == CFE_MSG_Type_Cmd) { size = sizeof(CFE_MSG_CommandHeader_t); } - else if(type == CFE_MSG_Type_Tlm) + else if (type == CFE_MSG_Type_Tlm) { size = sizeof(CFE_MSG_TelemetryHeader_t); } return size; -}/* end CFE_SB_MsgHdrSize */ - +} /* end CFE_SB_MsgHdrSize */ /* * Function: CFE_SB_GetUserData - See API and header file for details */ void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) { - uint8 *BytePtr; - size_t HdrSize; + uint8 *BytePtr; + size_t HdrSize; - if(MsgPtr == NULL){ + if (MsgPtr == NULL) + { CFE_ES_WriteToSysLog("CFE_SB:GetUserData-Failed invalid arguments\n"); return 0; } @@ -116,8 +112,7 @@ void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) HdrSize = CFE_SB_MsgHdrSize(MsgPtr); return (BytePtr + HdrSize); -}/* end CFE_SB_GetUserData */ - +} /* end CFE_SB_GetUserData */ /* * Function: CFE_SB_GetUserDataLength - See API and header file for details @@ -125,7 +120,7 @@ void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) size_t CFE_SB_GetUserDataLength(const CFE_MSG_Message_t *MsgPtr) { CFE_MSG_Size_t TotalMsgSize; - size_t HdrSize; + size_t HdrSize; if (MsgPtr == NULL) { @@ -136,8 +131,7 @@ size_t CFE_SB_GetUserDataLength(const CFE_MSG_Message_t *MsgPtr) HdrSize = CFE_SB_MsgHdrSize(MsgPtr); return TotalMsgSize - HdrSize; -}/* end CFE_SB_GetUserDataLength */ - +} /* end CFE_SB_GetUserDataLength */ /* * Function: CFE_SB_SetUserDataLength - See API and header file for details @@ -145,25 +139,27 @@ size_t CFE_SB_GetUserDataLength(const CFE_MSG_Message_t *MsgPtr) void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr, size_t DataLength) { CFE_MSG_Size_t TotalMsgSize; - size_t HdrSize; + size_t HdrSize; - if(MsgPtr == NULL){ + if (MsgPtr == NULL) + { CFE_ES_WriteToSysLog("CFE_SB:SetUserDataLength-Failed invalid arguments\n"); } else { - HdrSize = CFE_SB_MsgHdrSize(MsgPtr); + HdrSize = CFE_SB_MsgHdrSize(MsgPtr); TotalMsgSize = HdrSize + DataLength; - - if(TotalMsgSize <= CFE_MISSION_SB_MAX_SB_MSG_SIZE){ + + if (TotalMsgSize <= CFE_MISSION_SB_MAX_SB_MSG_SIZE) + { CFE_MSG_SetSize(MsgPtr, TotalMsgSize); } else { - CFE_ES_WriteToSysLog("CFE_SB:SetUserDataLength-Failed TotalMsgSize too large\n"); - } + CFE_ES_WriteToSysLog("CFE_SB:SetUserDataLength-Failed TotalMsgSize too large\n"); + } } -}/* end CFE_SB_SetUserDataLength */ +} /* end CFE_SB_SetUserDataLength */ #ifndef CFE_OMIT_DEPRECATED_6_8 /* @@ -178,17 +174,17 @@ size_t CFE_SB_GetTotalMsgLength(const CFE_MSG_Message_t *MsgPtr) return size; -}/* end CFE_SB_GetTotalMsgLength */ +} /* end CFE_SB_GetTotalMsgLength */ /* * Function: CFE_SB_SetTotalMsgLength - See API and header file for details */ -void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr,size_t TotalLength) +void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr, size_t TotalLength) { CFE_MSG_SetSize(MsgPtr, TotalLength); -}/* end CFE_SB_SetTotalMsgLength */ +} /* end CFE_SB_SetTotalMsgLength */ /* * Function: CFE_SB_GetMsgTime - See API and header file for details @@ -201,7 +197,7 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_MSG_Message_t *MsgPtr) return TimeFromMsg; -}/* end CFE_SB_GetMsgTime */ +} /* end CFE_SB_GetMsgTime */ /* * Function: CFE_SB_SetMsgTime - See API and header file for details @@ -211,7 +207,7 @@ int32 CFE_SB_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t NewTime) return CFE_MSG_SetMsgTime(MsgPtr, NewTime); -}/* end CFE_SB_SetMsgTime */ +} /* end CFE_SB_SetMsgTime */ #endif /* CFE_OMIT_DEPRECATED_6_8 */ /* @@ -219,9 +215,9 @@ int32 CFE_SB_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t NewTime) */ void CFE_SB_TimeStampMsg(CFE_MSG_Message_t *MsgPtr) { - CFE_MSG_SetMsgTime(MsgPtr,CFE_TIME_GetTime()); + CFE_MSG_SetMsgTime(MsgPtr, CFE_TIME_GetTime()); -}/* end CFE_SB_TimeStampMsg */ +} /* end CFE_SB_TimeStampMsg */ #ifndef CFE_OMIT_DEPRECATED_6_8 /* @@ -236,19 +232,17 @@ uint16 CFE_SB_GetCmdCode(CFE_MSG_Message_t *MsgPtr) return fc; -}/* end CFE_SB_GetCmdCode */ - +} /* end CFE_SB_GetCmdCode */ /* * Function: CFE_SB_SetCmdCode - See API and header file for details */ -int32 CFE_SB_SetCmdCode(CFE_MSG_Message_t *MsgPtr, - uint16 CmdCode) +int32 CFE_SB_SetCmdCode(CFE_MSG_Message_t *MsgPtr, uint16 CmdCode) { return CFE_MSG_SetFcnCode(MsgPtr, CmdCode); -}/* end CFE_SB_SetCmdCode */ +} /* end CFE_SB_SetCmdCode */ /* * Function: CFE_SB_GetChecksum - See API and header file for details @@ -256,22 +250,22 @@ int32 CFE_SB_SetCmdCode(CFE_MSG_Message_t *MsgPtr, uint16 CFE_SB_GetChecksum(CFE_MSG_Message_t *MsgPtr) { - CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; + CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; bool hassechdr = false; CFE_MSG_GetHasSecondaryHeader(MsgPtr, &hassechdr); CFE_MSG_GetType(MsgPtr, &type); /* if msg type is telemetry or there is no secondary hdr... */ - if((type == CFE_MSG_Type_Tlm)||(!hassechdr)) + if ((type == CFE_MSG_Type_Tlm) || (!hassechdr)) { return 0; - }/* end if */ + } /* end if */ /* Byte access for now to avoid error if secondary doesn't contain checksum */ return MsgPtr->Byte[sizeof(CCSDS_SpacePacket_t) + 1]; -}/* end CFE_SB_GetChecksum */ +} /* end CFE_SB_GetChecksum */ /* * Function: CFE_SB_GenerateChecksum - See API and header file for details @@ -281,8 +275,7 @@ void CFE_SB_GenerateChecksum(CFE_MSG_Message_t *MsgPtr) CFE_MSG_GenerateChecksum(MsgPtr); -}/* end CFE_SB_GenerateChecksum */ - +} /* end CFE_SB_GenerateChecksum */ /* * Function: CFE_SB_ValidateChecksum - See API and header file for details @@ -295,13 +288,14 @@ bool CFE_SB_ValidateChecksum(CFE_MSG_Message_t *MsgPtr) return isvalid; -}/* end CFE_SB_ValidateChecksum */ +} /* end CFE_SB_ValidateChecksum */ #endif /* CFE_OMIT_DEPRECATED_6_8 */ /* * Function: CFE_SB_MessageStringGet - See API and header file for details */ -int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, size_t DestMaxSize, size_t SourceMaxSize) +int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, + size_t DestMaxSize, size_t SourceMaxSize) { int32 Result; @@ -310,7 +304,7 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, * Cannot terminate the string, since there is no place for the NUL * In this case, do nothing */ - if (DestMaxSize == 0 || DestStringPtr == NULL ) + if (DestMaxSize == 0 || DestStringPtr == NULL) { Result = CFE_SB_BAD_ARGUMENT; } @@ -325,7 +319,7 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, if (DefaultString != NULL && (SourceMaxSize == 0 || *SourceStringPtr == 0)) { SourceStringPtr = DefaultString; - SourceMaxSize = DestMaxSize; + SourceMaxSize = DestMaxSize; } /* Reserve 1 character for the required NUL */ @@ -349,15 +343,15 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, return Result; } - /* * Function: CFE_SB_MessageStringSet - See API and header file for details */ -int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, size_t SourceMaxSize) +int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, + size_t SourceMaxSize) { int32 Result; - if (SourceStringPtr == NULL || DestStringPtr == NULL ) + if (SourceStringPtr == NULL || DestStringPtr == NULL) { Result = CFE_SB_BAD_ARGUMENT; } @@ -376,9 +370,9 @@ int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, } /* - * Pad the remaining space with NUL chars, - * but this should NOT be included in the final size - */ + * Pad the remaining space with NUL chars, + * but this should NOT be included in the final size + */ while (DestMaxSize > 0) { /* Put the NUL in the last character */ diff --git a/modules/sb/fsw/src/cfe_sb_verify.h b/modules/sb/fsw/src/cfe_sb_verify.h index f5fc750d4..395642196 100644 --- a/modules/sb/fsw/src/cfe_sb_verify.h +++ b/modules/sb/fsw/src/cfe_sb_verify.h @@ -35,35 +35,35 @@ #include #if CFE_PLATFORM_SB_MAX_MSG_IDS < 1 - #error CFE_PLATFORM_SB_MAX_MSG_IDS cannot be less than 1! +#error CFE_PLATFORM_SB_MAX_MSG_IDS cannot be less than 1! #endif #if CFE_PLATFORM_SB_MAX_PIPES < 1 - #error CFE_PLATFORM_SB_MAX_PIPES cannot be less than 1! +#error CFE_PLATFORM_SB_MAX_PIPES cannot be less than 1! #endif #if CFE_PLATFORM_SB_MAX_PIPES > OS_MAX_QUEUES - #error CFE_PLATFORM_SB_MAX_PIPES cannot be greater than OS_MAX_QUEUES! +#error CFE_PLATFORM_SB_MAX_PIPES cannot be greater than OS_MAX_QUEUES! #endif #if CFE_PLATFORM_SB_MAX_DEST_PER_PKT < 1 - #error CFE_PLATFORM_SB_MAX_DEST_PER_PKT cannot be less than 1! +#error CFE_PLATFORM_SB_MAX_DEST_PER_PKT cannot be less than 1! #endif #if CFE_PLATFORM_SB_HIGHEST_VALID_MSGID < 1 - #error CFE_PLATFORM_SB_HIGHEST_VALID_MSGID cannot be less than 1! +#error CFE_PLATFORM_SB_HIGHEST_VALID_MSGID cannot be less than 1! #endif #if CFE_PLATFORM_SB_HIGHEST_VALID_MSGID > 0xFFFFFFFE - #error CFE_PLATFORM_SB_HIGHEST_VALID_MSGID cannot be > 0xFFFFFFFE +#error CFE_PLATFORM_SB_HIGHEST_VALID_MSGID cannot be > 0xFFFFFFFE #endif #if CFE_PLATFORM_SB_BUF_MEMORY_BYTES < 512 - #error CFE_PLATFORM_SB_BUF_MEMORY_BYTES cannot be less than 512 bytes! +#error CFE_PLATFORM_SB_BUF_MEMORY_BYTES cannot be less than 512 bytes! #endif #if CFE_PLATFORM_SB_BUF_MEMORY_BYTES > UINT32_MAX - #error CFE_PLATFORM_SB_BUF_MEMORY_BYTES cannot be greater than UINT32_MAX (4 Gigabytes)! +#error CFE_PLATFORM_SB_BUF_MEMORY_BYTES cannot be greater than UINT32_MAX (4 Gigabytes)! #endif /* @@ -71,98 +71,97 @@ * if default is selected or if both defines are removed */ #if (CFE_MISSION_SB_PACKET_TIME_FORMAT != CFE_MISSION_SB_TIME_32_16_SUBS) - #error Legacy CFE_MISSION_SB_PACKET_TIME_FORMAT implementations no longer supported in core +#error Legacy CFE_MISSION_SB_PACKET_TIME_FORMAT implementations no longer supported in core #endif #if CFE_MISSION_SB_MAX_SB_MSG_SIZE < 6 - #error CFE_MISSION_SB_MAX_SB_MSG_SIZE cannot be less than 6 (CCSDS Primary Hdr Size)! +#error CFE_MISSION_SB_MAX_SB_MSG_SIZE cannot be less than 6 (CCSDS Primary Hdr Size)! #endif - /* ** SB Memory Pool Block Sizes */ #if CFE_PLATFORM_SB_MAX_BLOCK_SIZE < CFE_MISSION_SB_MAX_SB_MSG_SIZE - #error CFE_PLATFORM_SB_MAX_BLOCK_SIZE must be > or = to CFE_MISSION_SB_MAX_SB_MSG_SIZE! +#error CFE_PLATFORM_SB_MAX_BLOCK_SIZE must be > or = to CFE_MISSION_SB_MAX_SB_MSG_SIZE! #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 > CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 must be less than CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 #endif #if CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 >= CFE_PLATFORM_SB_MAX_BLOCK_SIZE - #error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_SB_MAX_BLOCK_SIZE +#error CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 must be less than CFE_PLATFORM_SB_MAX_BLOCK_SIZE #endif #if CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT < 4 - #error CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT cannot be less than 4! +#error CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT cannot be less than 4! #endif #if CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT > 65535 - #error CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT cannot be greater than 65535! +#error CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT cannot be greater than 65535! #endif /* ** Validate task stack size... */ #if CFE_PLATFORM_SB_START_TASK_STACK_SIZE < 2048 - #error CFE_PLATFORM_SB_START_TASK_STACK_SIZE must be greater than or equal to 2048 +#error CFE_PLATFORM_SB_START_TASK_STACK_SIZE must be greater than or equal to 2048 #endif #endif /* _cfe_sb_verify_ */ diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index b6899aee4..76d530570 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -51,7 +51,7 @@ * This also implicitly includes a call to SB_ResetUnitTest() as a setup function, * so the test routines do _not_ need to do this explictly on every test case. */ -#define SB_UT_ADD_SUBTEST(Func) UT_AddSubTest(Func, SB_ResetUnitTest, NULL, __func__, #Func) +#define SB_UT_ADD_SUBTEST(Func) UT_AddSubTest(Func, SB_ResetUnitTest, NULL, __func__, #Func) /* * MSG ID constants for unit testing: @@ -60,22 +60,22 @@ * The following constants are of the CFE_SB_MsgId_t type */ -const CFE_SB_MsgId_t SB_UT_CMD_MID = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE); -const CFE_SB_MsgId_t SB_UT_TLM_MID = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE); +const CFE_SB_MsgId_t SB_UT_CMD_MID = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE); +const CFE_SB_MsgId_t SB_UT_TLM_MID = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE); -const CFE_SB_MsgId_t SB_UT_CMD_MID1 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+1); -const CFE_SB_MsgId_t SB_UT_CMD_MID2 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+2); -const CFE_SB_MsgId_t SB_UT_CMD_MID3 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+3); -const CFE_SB_MsgId_t SB_UT_CMD_MID4 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+4); -const CFE_SB_MsgId_t SB_UT_CMD_MID5 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+5); -const CFE_SB_MsgId_t SB_UT_CMD_MID6 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+6); +const CFE_SB_MsgId_t SB_UT_CMD_MID1 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE + 1); +const CFE_SB_MsgId_t SB_UT_CMD_MID2 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE + 2); +const CFE_SB_MsgId_t SB_UT_CMD_MID3 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE + 3); +const CFE_SB_MsgId_t SB_UT_CMD_MID4 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE + 4); +const CFE_SB_MsgId_t SB_UT_CMD_MID5 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE + 5); +const CFE_SB_MsgId_t SB_UT_CMD_MID6 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE + 6); -const CFE_SB_MsgId_t SB_UT_TLM_MID1 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+1); -const CFE_SB_MsgId_t SB_UT_TLM_MID2 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+2); -const CFE_SB_MsgId_t SB_UT_TLM_MID3 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+3); -const CFE_SB_MsgId_t SB_UT_TLM_MID4 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+4); -const CFE_SB_MsgId_t SB_UT_TLM_MID5 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+5); -const CFE_SB_MsgId_t SB_UT_TLM_MID6 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+6); +const CFE_SB_MsgId_t SB_UT_TLM_MID1 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 1); +const CFE_SB_MsgId_t SB_UT_TLM_MID2 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 2); +const CFE_SB_MsgId_t SB_UT_TLM_MID3 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 3); +const CFE_SB_MsgId_t SB_UT_TLM_MID4 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 4); +const CFE_SB_MsgId_t SB_UT_TLM_MID5 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 5); +const CFE_SB_MsgId_t SB_UT_TLM_MID6 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 6); /* * A MsgId value which still qualifies as valid @@ -98,7 +98,8 @@ const CFE_SB_MsgId_t SB_UT_FIRST_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(0); * * The specific value depends on how MsgId is actually defined internally */ -const CFE_SB_MsgId_t SB_UT_INTERMEDIATE_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID / 2 + 1); +const CFE_SB_MsgId_t SB_UT_INTERMEDIATE_VALID_MID = + CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID / 2 + 1); /* * A MsgId value which is not valid but also not equal to CFE_SB_INVALID_MSG_ID @@ -106,18 +107,17 @@ const CFE_SB_MsgId_t SB_UT_INTERMEDIATE_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(CFE_ */ const CFE_SB_MsgId_t SB_UT_ALTERNATE_INVALID_MID = CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1); - /* * A MsgId value which is valid per CCSDS but does not have the secondary header bit set */ const CFE_SB_MsgId_t SB_UT_BARE_CMD_MID3 = CFE_SB_MSGID_WRAP_VALUE(0x1003); const CFE_SB_MsgId_t SB_UT_BARE_TLM_MID3 = CFE_SB_MSGID_WRAP_VALUE(0x0003); -#define SB_UT_PIPEID_0 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 0)) -#define SB_UT_PIPEID_1 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 1)) -#define SB_UT_PIPEID_2 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 2)) -#define SB_UT_PIPEID_3 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 3)) -#define SB_UT_ALTERNATE_INVALID_PIPEID CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(0xDEADBEEF)) +#define SB_UT_PIPEID_0 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 0)) +#define SB_UT_PIPEID_1 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 1)) +#define SB_UT_PIPEID_2 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 2)) +#define SB_UT_PIPEID_3 CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(CFE_SB_PIPEID_BASE + 3)) +#define SB_UT_ALTERNATE_INVALID_PIPEID CFE_SB_PIPEID_C(CFE_ResourceId_FromInteger(0xDEADBEEF)) /* * Helper function to manufacture a fake pipe ID value that will validate @@ -136,7 +136,7 @@ CFE_ES_AppId_t UT_SB_AppID_Modify(CFE_ES_AppId_t InitialID, int32 Modifier) CFE_ES_AppId_t TempValue = InitialID; /* Underneath the wrapper(s) the IDs are 32-bit integer values, so it can be cast */ - *((uint32*)&TempValue) += Modifier; + *((uint32 *)&TempValue) += Modifier; return TempValue; } @@ -202,7 +202,7 @@ void Test_SB_AppInit_ESRegFail(void) int32 ForcedRtnVal = -1; UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterApp), 1, ForcedRtnVal); - ASSERT_EQ(CFE_SB_AppInit(), ForcedRtnVal); + ASSERT_EQ(CFE_SB_AppInit(), ForcedRtnVal); EVTCNT(0); @@ -227,15 +227,15 @@ void Test_SB_AppInit_EVSRegFail(void) */ void Test_SB_AppInit_EVSSendEvtFail(void) { - int32 ForcedRtnVal = -1; + int32 ForcedRtnVal = -1; CFE_ES_TaskInfo_t TestTaskInfo; /* To get coverage on CFE_SB_GetAppTskName(), this ensures that the * path with different app/task names is followed on at least one event. */ memset(&TestTaskInfo, 0, sizeof(TestTaskInfo)); - strncpy(TestTaskInfo.TaskName, "test", sizeof(TestTaskInfo.TaskName)-1); - TestTaskInfo.TaskName[sizeof(TestTaskInfo.TaskName)-1] = '\0'; + strncpy(TestTaskInfo.TaskName, "test", sizeof(TestTaskInfo.TaskName) - 1); + TestTaskInfo.TaskName[sizeof(TestTaskInfo.TaskName) - 1] = '\0'; UT_SetDataBuffer(UT_KEY(CFE_ES_GetTaskInfo), &TestTaskInfo, sizeof(TestTaskInfo), false); /* There are three events prior to init, pipe created (1) and subscription @@ -305,7 +305,7 @@ void Test_SB_AppInit_Sub2Fail(void) */ void Test_SB_AppInit_GetPoolFail(void) { - int32 ForcedRtnVal = -1; + int32 ForcedRtnVal = -1; UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 4, ForcedRtnVal); @@ -322,7 +322,7 @@ void Test_SB_AppInit_GetPoolFail(void) */ void Test_SB_AppInit_PutPoolFail(void) { - int32 ForcedRtnVal = -1; + int32 ForcedRtnVal = -1; UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 1, ForcedRtnVal); @@ -423,8 +423,8 @@ void Test_SB_Cmds_Noop(void) 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(Noop.Cmd); + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + 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); @@ -448,8 +448,8 @@ void Test_SB_Cmds_RstCtrs(void) 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(ResetCounters.Cmd); + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + 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); @@ -478,13 +478,13 @@ void Test_SB_Cmds_Stats(void) /* For internal TransmitMsg call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID); - Size = sizeof(CFE_SB_Global.StatTlmMsg); + Size = sizeof(CFE_SB_Global.StatTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); /* For Generic command processing */ - MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - Size = sizeof(SendSbStats.Cmd); + MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + 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); @@ -510,8 +510,8 @@ void Test_SB_Cmds_RoutingInfoDef(void) CFE_SB_WriteRoutingInfoCmd_t Cmd; } WriteRoutingInfo; CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_ROUTING_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteRoutingInfo.Cmd); + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(WriteRoutingInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -544,16 +544,15 @@ void Test_SB_Cmds_RoutingInfoAlreadyPending(void) CFE_SB_WriteRoutingInfoCmd_t Cmd; } WriteRoutingInfo; CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_ROUTING_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteRoutingInfo.Cmd); + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(WriteRoutingInfo.Cmd); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), 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_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy(WriteRoutingInfo.Cmd.Payload.Filename, "RoutingTstFile", - sizeof(WriteRoutingInfo.Cmd.Payload.Filename) - 1); + strncpy(WriteRoutingInfo.Cmd.Payload.Filename, "RoutingTstFile", sizeof(WriteRoutingInfo.Cmd.Payload.Filename) - 1); WriteRoutingInfo.Cmd.Payload.Filename[sizeof(WriteRoutingInfo.Cmd.Payload.Filename) - 1] = '\0'; CFE_SB_ProcessCmdPipePkt(&WriteRoutingInfo.SBBuf); @@ -569,18 +568,18 @@ void Test_SB_Cmds_RoutingInfoAlreadyPending(void) */ void Test_SB_Cmds_RoutingInfoDataGetter(void) { - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; - 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; - CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; - CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; - CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; - uint16 PipeDepth = 10; - void *LocalBuffer; - size_t LocalBufSize; + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId3; + 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; + CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; + CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; + CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; + uint16 PipeDepth = 10; + void * LocalBuffer; + size_t LocalBufSize; CFE_SB_BackgroundFileStateInfo_t State; /* Create some map info */ @@ -596,7 +595,7 @@ void Test_SB_Cmds_RoutingInfoDataGetter(void) SETUP(CFE_SB_Subscribe(MsgId5, PipeId2)); memset(&State, 0, sizeof(State)); - LocalBuffer = NULL; + LocalBuffer = NULL; LocalBufSize = 0; ASSERT_TRUE(!CFE_SB_WriteRouteInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); @@ -621,13 +620,13 @@ void Test_SB_Cmds_PipeInfoDef(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WritePipeInfoCmd_t Cmd; } WritePipeInfo; - 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_WRITE_PIPE_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WritePipeInfo.Cmd); + 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_WRITE_PIPE_INFO_CC; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(WritePipeInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -661,17 +660,16 @@ void Test_SB_Cmds_PipeInfoAlreadyPending(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WritePipeInfoCmd_t Cmd; } WritePipeInfo; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_PIPE_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WritePipeInfo.Cmd); + CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_PIPE_INFO_CC; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(WritePipeInfo.Cmd); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), 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_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy(WritePipeInfo.Cmd.Payload.Filename, "PipeTstFile", - sizeof(WritePipeInfo.Cmd.Payload.Filename) - 1); + strncpy(WritePipeInfo.Cmd.Payload.Filename, "PipeTstFile", sizeof(WritePipeInfo.Cmd.Payload.Filename) - 1); WritePipeInfo.Cmd.Payload.Filename[sizeof(WritePipeInfo.Cmd.Payload.Filename) - 1] = '\0'; CFE_SB_ProcessCmdPipePkt(&WritePipeInfo.SBBuf); @@ -687,12 +685,12 @@ void Test_SB_Cmds_PipeInfoAlreadyPending(void) */ void Test_SB_Cmds_PipeInfoDataGetter(void) { - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; - uint16 PipeDepth = 10; - void *LocalBuffer; - size_t LocalBufSize; + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId3; + uint16 PipeDepth = 10; + void * LocalBuffer; + size_t LocalBufSize; CFE_SB_BackgroundFileStateInfo_t State; SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); @@ -700,7 +698,7 @@ void Test_SB_Cmds_PipeInfoDataGetter(void) SETUP(CFE_SB_CreatePipe(&PipeId3, PipeDepth, "TestPipe3")); memset(&State, 0, sizeof(State)); - LocalBuffer = NULL; + LocalBuffer = NULL; LocalBufSize = 0; /* Note that CFE_SB_CreatePipe() fills entry 1 first, so entry 0 is unused */ @@ -711,7 +709,7 @@ void Test_SB_Cmds_PipeInfoDataGetter(void) UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); - ASSERT_TRUE(CFE_SB_WritePipeInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_PIPES-1, &LocalBuffer, &LocalBufSize)); + ASSERT_TRUE(CFE_SB_WritePipeInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_PIPES - 1, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(LocalBufSize); ASSERT_TRUE(CFE_SB_WritePipeInfoDataGetter(&State, CFE_PLATFORM_SB_MAX_PIPES, &LocalBuffer, &LocalBufSize)); @@ -750,7 +748,6 @@ void Test_SB_Cmds_BackgroundFileWriteEvents(void) UT_ClearEventHistory(); CFE_SB_BackgroundFileEventHandler(&State, CFE_FS_FileWriteEvent_UNDEFINED, OS_ERROR, 0, 0, 0); EVTCNT(0); - } /* @@ -758,18 +755,18 @@ void Test_SB_Cmds_BackgroundFileWriteEvents(void) */ void Test_SB_Cmds_MapInfoDataGetter(void) { - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; - 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; - CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; - CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; - CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; - uint16 PipeDepth = 10; - void *LocalBuffer; - size_t LocalBufSize; + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId3; + 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; + CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; + CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; + CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; + uint16 PipeDepth = 10; + void * LocalBuffer; + size_t LocalBufSize; CFE_SB_BackgroundFileStateInfo_t State; /* Create some map info */ @@ -785,7 +782,7 @@ void Test_SB_Cmds_MapInfoDataGetter(void) SETUP(CFE_SB_Subscribe(MsgId5, PipeId2)); memset(&State, 0, sizeof(State)); - LocalBuffer = NULL; + LocalBuffer = NULL; LocalBufSize = 0; ASSERT_TRUE(!CFE_SB_WriteMsgMapInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); @@ -811,19 +808,19 @@ void Test_SB_Cmds_MapInfoDef(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WriteMapInfoCmd_t Cmd; } WriteMapInfo; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; - 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; - CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; - CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; - CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; - uint16 PipeDepth = 10; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_MAP_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteMapInfo.Cmd); + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId3; + 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; + CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; + CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; + CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; + uint16 PipeDepth = 10; + CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_MAP_INFO_CC; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(WriteMapInfo.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -866,17 +863,16 @@ void Test_SB_Cmds_MapInfoAlreadyPending(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WriteMapInfoCmd_t Cmd; } WriteMapInfo; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_MAP_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteMapInfo.Cmd); + CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_MAP_INFO_CC; + CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_MSG_Size_t Size = sizeof(WriteMapInfo.Cmd); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), 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_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - strncpy(WriteMapInfo.Cmd.Payload.Filename, "MapTstFile", - sizeof(WriteMapInfo.Cmd.Payload.Filename) - 1); + strncpy(WriteMapInfo.Cmd.Payload.Filename, "MapTstFile", sizeof(WriteMapInfo.Cmd.Payload.Filename) - 1); WriteMapInfo.Cmd.Payload.Filename[sizeof(WriteMapInfo.Cmd.Payload.Filename) - 1] = '\0'; CFE_SB_ProcessCmdPipePkt(&WriteMapInfo.SBBuf); @@ -898,12 +894,12 @@ void Test_SB_Cmds_EnRouteValParam(void) 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(EnableRoute.Cmd); + 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(EnableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -912,7 +908,7 @@ void Test_SB_Cmds_EnRouteValParam(void) SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "EnRouteTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); EnableRoute.Cmd.Payload.MsgId = MsgId; - EnableRoute.Cmd.Payload.Pipe = PipeId; + EnableRoute.Cmd.Payload.Pipe = PipeId; CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); @@ -938,13 +934,13 @@ void Test_SB_Cmds_EnRouteNonExist(void) 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(EnableRoute.Cmd); + 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(EnableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -954,7 +950,7 @@ void Test_SB_Cmds_EnRouteNonExist(void) SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "EnRouteTestPipe2")); SETUP(CFE_SB_Subscribe(MsgId, PipeId1)); EnableRoute.Cmd.Payload.MsgId = MsgId; - EnableRoute.Cmd.Payload.Pipe = PipeId2; + EnableRoute.Cmd.Payload.Pipe = PipeId2; CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); @@ -979,16 +975,16 @@ void Test_SB_Cmds_EnRouteInvParam(void) 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(EnableRoute.Cmd); + 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(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); EnableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; - EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; + EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); @@ -1008,16 +1004,16 @@ void Test_SB_Cmds_EnRouteInvParam2(void) 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(EnableRoute.Cmd); + 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(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); EnableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; - EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; + EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); @@ -1038,16 +1034,16 @@ void Test_SB_Cmds_EnRouteInvParam3(void) 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(EnableRoute.Cmd); + 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(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); EnableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; - EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; + EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); @@ -1064,15 +1060,15 @@ void Test_SB_Cmds_DisRouteValParam(void) { union { - CFE_SB_Buffer_t SBBuf; + 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(DisableRoute.Cmd); + 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(DisableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -1081,7 +1077,7 @@ void Test_SB_Cmds_DisRouteValParam(void) SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "DisRouteTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); DisableRoute.Cmd.Payload.MsgId = MsgId; - DisableRoute.Cmd.Payload.Pipe = PipeId; + DisableRoute.Cmd.Payload.Pipe = PipeId; CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); @@ -1104,15 +1100,15 @@ void Test_SB_Cmds_DisRouteNonExist(void) { union { - CFE_SB_Buffer_t SBBuf; + 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(DisableRoute.Cmd); + 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(DisableRoute.Cmd); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -1122,7 +1118,7 @@ void Test_SB_Cmds_DisRouteNonExist(void) SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "DisRouteTestPipe2")); SETUP(CFE_SB_Subscribe(MsgId, PipeId1)); DisableRoute.Cmd.Payload.MsgId = MsgId; - DisableRoute.Cmd.Payload.Pipe = PipeId2; + DisableRoute.Cmd.Payload.Pipe = PipeId2; CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); @@ -1144,19 +1140,19 @@ void Test_SB_Cmds_DisRouteInvParam(void) { union { - CFE_SB_Buffer_t SBBuf; + 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(DisableRoute.Cmd); + 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(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); DisableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; - DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; + DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); @@ -1173,19 +1169,19 @@ void Test_SB_Cmds_DisRouteInvParam2(void) { union { - CFE_SB_Buffer_t SBBuf; + 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(DisableRoute.Cmd); + 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(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); DisableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; - DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; + DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); @@ -1203,19 +1199,19 @@ void Test_SB_Cmds_DisRouteInvParam3(void) { union { - CFE_SB_Buffer_t SBBuf; + 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(DisableRoute.Cmd); + 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(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); DisableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; - DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; + DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); @@ -1232,7 +1228,7 @@ void Test_SB_Cmds_SendHK(void) { union { - CFE_SB_Buffer_t SBBuf; + CFE_SB_Buffer_t SBBuf; CFE_MSG_CommandHeader_t Cmd; } Housekeeping; CFE_SB_MsgId_t MsgIdCmd; @@ -1240,7 +1236,7 @@ void Test_SB_Cmds_SendHK(void) /* For internal TransmitMsg call */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); - Size = sizeof(CFE_SB_Global.HKTlmMsg); + Size = sizeof(CFE_SB_Global.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -1264,19 +1260,19 @@ void Test_SB_Cmds_SendPrevSubs(void) { union { - CFE_SB_Buffer_t SBBuf; + 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; + 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")); @@ -1287,7 +1283,7 @@ void Test_SB_Cmds_SendPrevSubs(void) { /* Skip subscribing to ALLSUBS mid. This is the one we are testing. * MsgID for this in CCSDS v.1 was 0x180d so this MID did not appear in the - * SB sub list. This results in multiple NO_SUBS_EID sent which we are not + * SB sub list. This results in multiple NO_SUBS_EID sent which we are not * testing here so it is irrelevent * For CCSDS v.2 CFE_SB_ALLSUBS_TLM_MID (0x0d) now appears in the * SB subscription list and thus we must skip adding 0x0D to the list @@ -1304,7 +1300,7 @@ void Test_SB_Cmds_SendPrevSubs(void) /* For 3 internal TransmitMsg calls */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); - Size = sizeof(CFE_SB_Global.PrevSubMsg); + Size = sizeof(CFE_SB_Global.PrevSubMsg); 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_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1314,14 +1310,14 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Set buffers for gets */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - Size = sizeof(SendPrevSubs.Cmd); + 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(&SendPrevSubs.SBBuf); - NumEvts += 7; /* +1 for the subscribe, +6 for the SEND_PREV_SUBS_CC */ + NumEvts += 7; /* +1 for the subscribe, +6 for the SEND_PREV_SUBS_CC */ /* Event count is only exact if there were no collisions */ if (UT_EventIsInHistory(CFE_SB_HASHCOLLISION_EID)) @@ -1346,7 +1342,7 @@ void Test_SB_Cmds_SendPrevSubs(void) /* For 3 internal TransmitMsg calls */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); - Size = sizeof(CFE_SB_Global.PrevSubMsg); + Size = sizeof(CFE_SB_Global.PrevSubMsg); 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_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1356,14 +1352,14 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Set buffers for gets */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - Size = sizeof(SendPrevSubs.Cmd); + 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(&SendPrevSubs.SBBuf); - NumEvts += 8; /* +2 for the subscribe, +6 for the SEND_PREV_SUBS_CC */ + NumEvts += 8; /* +2 for the subscribe, +6 for the SEND_PREV_SUBS_CC */ /* Event count is only exact if there were no collisions */ if (UT_EventIsInHistory(CFE_SB_HASHCOLLISION_EID)) @@ -1392,12 +1388,12 @@ void Test_SB_Cmds_SubRptOn(void) { union { - CFE_SB_Buffer_t SBBuf; + 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); + 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); @@ -1416,12 +1412,12 @@ void Test_SB_Cmds_SubRptOff(void) { union { - CFE_SB_Buffer_t SBBuf; + 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); + 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); @@ -1438,7 +1434,7 @@ void Test_SB_Cmds_SubRptOff(void) */ void Test_SB_Cmds_CmdUnexpCmdCode(void) { - CFE_MSG_FcnCode_t FcnCode = 99; + CFE_MSG_FcnCode_t FcnCode = 99; CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1460,9 +1456,9 @@ void Test_SB_Cmds_BadCmdLength(void) /* * Just choosing "EnableRoute" command here as it has a non-empty payload */ - 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; + 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); @@ -1484,7 +1480,7 @@ void Test_SB_Cmds_BadCmdLength(void) */ void Test_SB_Cmds_UnexpMsgId(void) { - CFE_SB_MsgId_t MsgIdCmd = SB_UT_TLM_MID; + CFE_SB_MsgId_t MsgIdCmd = SB_UT_TLM_MID; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); @@ -1512,9 +1508,8 @@ void Test_SB_EarlyInit(void) void Test_SB_EarlyInit_SemCreateError(void) { UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERR_NO_FREE_IDS); - UT_Report(__FILE__, __LINE__, - CFE_SB_EarlyInit() == OS_ERR_NO_FREE_IDS, - "CFE_SB_EarlyInit", "Sem Create error logic"); + UT_Report(__FILE__, __LINE__, CFE_SB_EarlyInit() == OS_ERR_NO_FREE_IDS, "CFE_SB_EarlyInit", + "Sem Create error logic"); } /* end Test_SB_EarlyInit_SemCreateError */ /* @@ -1523,9 +1518,8 @@ void Test_SB_EarlyInit_SemCreateError(void) void Test_SB_EarlyInit_PoolCreateError(void) { UT_SetDeferredRetcode(UT_KEY(CFE_ES_PoolCreateEx), 1, CFE_ES_BAD_ARGUMENT); - UT_Report(__FILE__, __LINE__, - CFE_SB_EarlyInit() == CFE_ES_BAD_ARGUMENT, - "CFE_SB_EarlyInit", "PoolCreateEx error logic"); + UT_Report(__FILE__, __LINE__, CFE_SB_EarlyInit() == CFE_ES_BAD_ARGUMENT, "CFE_SB_EarlyInit", + "PoolCreateEx error logic"); } /* end Test_SB_EarlyInit_PoolCreateError */ /* @@ -1534,9 +1528,7 @@ void Test_SB_EarlyInit_PoolCreateError(void) void Test_SB_EarlyInit_NoErrors(void) { CFE_SB_EarlyInit(); - UT_Report(__FILE__, __LINE__, - CFE_SB_EarlyInit() == CFE_SUCCESS, - "CFE_SB_EarlyInit", "No errors test"); + UT_Report(__FILE__, __LINE__, CFE_SB_EarlyInit() == CFE_SUCCESS, "CFE_SB_EarlyInit", "No errors test"); } /* end Test_SB_EarlyInit_NoErrors */ /* @@ -1599,8 +1591,8 @@ void Test_CreatePipe_InvalPipeDepth(void) UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS); /* Avoid creating socket */ ASSERT_EQ(CFE_SB_CreatePipe(&PipeIdReturned[0], 0, "TestPipe1"), CFE_SB_BAD_ARGUMENT); UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS); - ASSERT_EQ(CFE_SB_CreatePipe(&PipeIdReturned[1], - OS_QUEUE_MAX_DEPTH + 1, "TestPipeMaxDepPlus1"), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_CreatePipe(&PipeIdReturned[1], OS_QUEUE_MAX_DEPTH + 1, "TestPipeMaxDepPlus1"), + CFE_SB_BAD_ARGUMENT); UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS); ASSERT_EQ(CFE_SB_CreatePipe(&PipeIdReturned[2], 0xffff, "TestPipeffff"), CFE_SB_BAD_ARGUMENT); @@ -1623,10 +1615,10 @@ void Test_CreatePipe_MaxPipes(void) /* Create maximum number of pipes + 1. Only one 'create pipe' failure * expected */ - UT_SetDeferredRetcode(UT_KEY(CFE_ResourceId_ToIndex), 1+CFE_PLATFORM_SB_MAX_PIPES, -1); + UT_SetDeferredRetcode(UT_KEY(CFE_ResourceId_ToIndex), 1 + CFE_PLATFORM_SB_MAX_PIPES, -1); for (i = 0; i < (CFE_PLATFORM_SB_MAX_PIPES + 1); i++) { - snprintf(PipeName, sizeof(PipeName), "TestPipe%ld", (long) i); + snprintf(PipeName, sizeof(PipeName), "TestPipe%ld", (long)i); if (i < CFE_PLATFORM_SB_MAX_PIPES) { @@ -1646,7 +1638,7 @@ void Test_CreatePipe_MaxPipes(void) TEARDOWN(CFE_SB_DeletePipe(PipeIdReturned[i])); } - /* + /* * Also validate the CFE_SB_CheckPipeDescSlotUsed() helper function in this test, * as it is used to determine when max pipes has been hit. */ @@ -1663,9 +1655,9 @@ void Test_CreatePipe_MaxPipes(void) void Test_CreatePipe_SamePipeName(void) { CFE_SB_PipeId_t FirstPipeId = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; - uint16 PipeDepth = 1; - char PipeName[] = "Test_CFE_SB"; + CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE; + uint16 PipeDepth = 1; + char PipeName[] = "Test_CFE_SB"; /* Need to make sure OS_QueueCreate() stub fails on second call */ /* to mimick the failure expected when passing the same pipe name */ @@ -1687,7 +1679,6 @@ void Test_CreatePipe_SamePipeName(void) /* Call to CFE_SB_DeletePipe with the first pipe id created should work fine */ TEARDOWN(CFE_SB_DeletePipe(PipeId)); - } /* @@ -1726,10 +1717,10 @@ void Test_DeletePipe_NoSubs(void) void Test_DeletePipe_WithSubs(void) { CFE_SB_PipeId_t PipedId; - CFE_SB_MsgId_t MsgId0 = SB_UT_CMD_MID1; - CFE_SB_MsgId_t MsgId1 = SB_UT_CMD_MID2; - CFE_SB_MsgId_t MsgId2 = SB_UT_CMD_MID3; - CFE_SB_MsgId_t MsgId3 = SB_UT_CMD_MID4; + CFE_SB_MsgId_t MsgId0 = SB_UT_CMD_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_CMD_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_CMD_MID3; + CFE_SB_MsgId_t MsgId3 = SB_UT_CMD_MID4; uint16 PipeDepth = 10; SETUP(CFE_SB_CreatePipe(&PipedId, PipeDepth, "TestPipe")); @@ -1767,7 +1758,7 @@ void Test_DeletePipe_InvalidPipeId(void) void Test_DeletePipe_InvalidPipeOwner(void) { CFE_SB_PipeId_t PipedId; - CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_PipeD_t *PipeDscPtr; CFE_ES_AppId_t RealOwner; uint16 PipeDepth = 10; @@ -1775,7 +1766,7 @@ void Test_DeletePipe_InvalidPipeOwner(void) /* Change owner of pipe through memory corruption */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipedId); - RealOwner = PipeDscPtr->AppId; + RealOwner = PipeDscPtr->AppId; /* Choose a value that is sure not to be owner */ PipeDscPtr->AppId = UT_SB_AppID_Modify(RealOwner, 1); @@ -1857,7 +1848,7 @@ void Test_GetPipeName_NullPtr(void) */ void Test_GetPipeName_InvalidId(void) { - char PipeName[OS_MAX_API_NAME]; + char PipeName[OS_MAX_API_NAME]; CFE_SB_PipeId_t PipeId; SETUP(CFE_SB_CreatePipe(&PipeId, 4, "TestPipe")); @@ -1876,19 +1867,14 @@ void Test_GetPipeName_InvalidId(void) */ void Test_GetPipeName(void) { - char PipeName[OS_MAX_API_NAME]; + char PipeName[OS_MAX_API_NAME]; CFE_SB_PipeId_t PipeId = SB_UT_PIPEID_0; - OS_queue_prop_t queue_info = { - "TestPipe1" - }; + OS_queue_prop_t queue_info = {"TestPipe1"}; SETUP(CFE_SB_CreatePipe(&PipeId, 4, "TestPipe1")); - UT_SetDataBuffer( - UT_KEY(OS_QueueGetInfo), - &queue_info, sizeof(queue_info), - false); + UT_SetDataBuffer(UT_KEY(OS_QueueGetInfo), &queue_info, sizeof(queue_info), false); ASSERT(CFE_SB_GetPipeName(PipeName, sizeof(PipeName), PipeId)); @@ -1915,9 +1901,9 @@ void Test_GetPipeIdByName_NullPtrs(void) { CFE_SB_PipeId_t PipeIDOut; - ASSERT_EQ(CFE_SB_GetPipeIdByName(&PipeIDOut, NULL), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_GetPipeIdByName(&PipeIDOut, NULL), CFE_SB_BAD_ARGUMENT); - EVTSENT(CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID); + EVTSENT(CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID); ASSERT_EQ(CFE_SB_GetPipeIdByName(NULL, "invalid"), CFE_SB_BAD_ARGUMENT); @@ -1933,7 +1919,7 @@ void Test_GetPipeIdByName_InvalidName(void) CFE_SB_PipeId_t PipeIdOut; UT_SetDeferredRetcode(UT_KEY(OS_QueueGetIdByName), 1, OS_ERR_NAME_NOT_FOUND); - ASSERT_EQ(CFE_SB_GetPipeIdByName(&PipeIdOut, "invalid"), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_GetPipeIdByName(&PipeIdOut, "invalid"), CFE_SB_BAD_ARGUMENT); EVTSENT(CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID); @@ -1949,11 +1935,8 @@ void Test_GetPipeIdByName(void) SETUP(CFE_SB_CreatePipe(&PipeId, 4, "TestPipe1")); - UT_SetDataBuffer( - UT_KEY(OS_QueueGetIdByName), - &(CFE_SB_Global.PipeTbl[0].SysQueueId), - sizeof(CFE_SB_Global.PipeTbl[0].SysQueueId), - false); + UT_SetDataBuffer(UT_KEY(OS_QueueGetIdByName), &(CFE_SB_Global.PipeTbl[0].SysQueueId), + sizeof(CFE_SB_Global.PipeTbl[0].SysQueueId), false); ASSERT(CFE_SB_GetPipeIdByName(&PipeIdOut, "TestPipe1")); @@ -1968,7 +1951,7 @@ void Test_GetPipeIdByName(void) */ void Test_SetPipeOpts_BadID(void) { - ASSERT_EQ(CFE_SB_SetPipeOpts(SB_UT_ALTERNATE_INVALID_PIPEID, 0), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_SetPipeOpts(SB_UT_ALTERNATE_INVALID_PIPEID, 0), CFE_SB_BAD_ARGUMENT); EVTSENT(CFE_SB_SETPIPEOPTS_ID_ERR_EID); @@ -1980,14 +1963,14 @@ void Test_SetPipeOpts_BadID(void) void Test_SetPipeOpts_NotOwner(void) { CFE_SB_PipeId_t PipeID; - CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_PipeD_t *PipeDscPtr; CFE_ES_AppId_t OrigOwner; SETUP(CFE_SB_CreatePipe(&PipeID, 4, "TestPipe1")); PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeID); - OrigOwner = PipeDscPtr->AppId; + OrigOwner = PipeDscPtr->AppId; PipeDscPtr->AppId = UT_SB_AppID_Modify(OrigOwner, 1); ASSERT_EQ(CFE_SB_SetPipeOpts(PipeID, 0), CFE_SB_BAD_ARGUMENT); @@ -2053,7 +2036,7 @@ void Test_GetPipeOpts_BadPtr(void) void Test_GetPipeOpts(void) { CFE_SB_PipeId_t PipeID; - uint8 Opts = 0; + uint8 Opts = 0; SETUP(CFE_SB_CreatePipe(&PipeID, 4, "TestPipe1")); @@ -2090,10 +2073,10 @@ void Test_Subscribe_API(void) void Test_Subscribe_SubscribeEx(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; - CFE_SB_Qos_t Quality = {0, 0}; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_Qos_t Quality = {0, 0}; uint16 PipeDepth = 10; - uint16 MsgLim = 8; + uint16 MsgLim = 8; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); @@ -2114,7 +2097,7 @@ void Test_Subscribe_SubscribeEx(void) void Test_Subscribe_InvalidPipeId(void) { CFE_SB_PipeId_t PipeId = SB_UT_PIPEID_2; - CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; + CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; ASSERT_EQ(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); @@ -2130,7 +2113,7 @@ void Test_Subscribe_InvalidPipeId(void) void Test_Subscribe_InvalidMsgId(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; + CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; uint16 PipeDepth = 10; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); @@ -2151,8 +2134,8 @@ void Test_Subscribe_InvalidMsgId(void) void Test_Subscribe_MaxMsgLim(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; - CFE_SB_Qos_t Quality = {0, 0}; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_Qos_t Quality = {0, 0}; uint16 PipeDepth = 10; uint16 MsgLim; @@ -2175,7 +2158,7 @@ void Test_Subscribe_MaxMsgLim(void) void Test_Subscribe_DuplicateSubscription(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; uint16 PipeDepth = 10; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); @@ -2198,9 +2181,9 @@ void Test_Subscribe_DuplicateSubscription(void) void Test_Subscribe_LocalSubscription(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 10; - uint16 MsgLim = 4; + uint16 MsgLim = 4; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); @@ -2229,7 +2212,7 @@ void Test_Subscribe_MaxDestCount(void) /* Create pipes */ for (i = 0; i < CFE_PLATFORM_SB_MAX_DEST_PER_PKT + 1; i++) { - snprintf(PipeName, sizeof(PipeName), "TestPipe%ld", (long) i); + snprintf(PipeName, sizeof(PipeName), "TestPipe%ld", (long)i); SETUP(CFE_SB_CreatePipe(&PipeId[i], PipeDepth, PipeName)); } @@ -2302,9 +2285,9 @@ 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; + 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; @@ -2327,7 +2310,7 @@ void Test_Subscribe_SendPrevSubs(void) /* For internal TransmitMsg call */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); - Size = sizeof(CFE_SB_Global.PrevSubMsg); + Size = sizeof(CFE_SB_Global.PrevSubMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -2348,7 +2331,7 @@ void Test_Subscribe_SendPrevSubs(void) */ void Test_Subscribe_PipeNonexistent(void) { - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; CFE_SB_PipeId_t PipeId = SB_UT_ALTERNATE_INVALID_PIPEID; ASSERT_EQ(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); @@ -2378,7 +2361,7 @@ void Test_Subscribe_SubscriptionReporting(void) /* For internal TransmitMsg call that will report subscription */ MsgIdRpt = CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID); - Size = sizeof(CFE_SB_SingleSubscriptionTlm_t); + Size = sizeof(CFE_SB_SingleSubscriptionTlm_t); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdRpt, sizeof(MsgIdRpt), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -2408,8 +2391,8 @@ void Test_Subscribe_SubscriptionReporting(void) void Test_Subscribe_InvalidPipeOwner(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_PipeD_t *PipeDscPtr; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 10; CFE_ES_AppId_t RealOwner; @@ -2417,7 +2400,7 @@ void Test_Subscribe_InvalidPipeOwner(void) /* Change owner of pipe through memory corruption */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); - RealOwner = PipeDscPtr->AppId; + RealOwner = PipeDscPtr->AppId; /* Choose a value that is sure not to be owner */ PipeDscPtr->AppId = UT_SB_AppID_Modify(RealOwner, 1); @@ -2455,7 +2438,7 @@ void Test_Unsubscribe_API(void) void Test_Unsubscribe_Basic(void) { CFE_SB_PipeId_t TestPipe; - CFE_SB_MsgId_t MsgId = SB_UT_INTERMEDIATE_VALID_MID; + CFE_SB_MsgId_t MsgId = SB_UT_INTERMEDIATE_VALID_MID; uint16 PipeDepth = 50; SETUP(CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe")); @@ -2483,7 +2466,7 @@ void Test_Unsubscribe_Basic(void) void Test_Unsubscribe_Local(void) { CFE_SB_PipeId_t TestPipe; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 50; SETUP(CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe")); @@ -2506,7 +2489,7 @@ void Test_Unsubscribe_InvalParam(void) { CFE_SB_PipeId_t TestPipe; CFE_ES_AppId_t CallerId; - CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_PipeD_t *PipeDscPtr; uint16 PipeDepth = 50; CFE_SB_PipeId_t SavedPipeId; @@ -2519,15 +2502,16 @@ void Test_Unsubscribe_InvalParam(void) ASSERT(CFE_ES_GetAppID(&CallerId)); /* Perform test using a bad scope value */ - ASSERT_EQ(CFE_SB_UnsubscribeFull(SB_UT_FIRST_VALID_MID, TestPipe, CFE_SB_MSG_LOCAL + 1, CallerId), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ(CFE_SB_UnsubscribeFull(SB_UT_FIRST_VALID_MID, TestPipe, CFE_SB_MSG_LOCAL + 1, CallerId), + CFE_SB_BAD_ARGUMENT); /* Perform test using an invalid pipe ID for branch path coverage. * This situation cannot happen in normal circumstances since the * bad pipe ID is caught by CFE_SB_GetPipeIdx() before it gets to * CFE_SB_ValidatePipeId() */ - PipeDscPtr = CFE_SB_LocatePipeDescByID(TestPipe); - SavedPipeId = CFE_SB_PipeDescGetID(PipeDscPtr); + PipeDscPtr = CFE_SB_LocatePipeDescByID(TestPipe); + SavedPipeId = CFE_SB_PipeDescGetID(PipeDscPtr); PipeDscPtr->PipeId = SB_UT_ALTERNATE_INVALID_PIPEID; ASSERT_EQ(CFE_SB_Unsubscribe(SB_UT_FIRST_VALID_MID, TestPipe), CFE_SB_BAD_ARGUMENT); @@ -2549,7 +2533,7 @@ void Test_Unsubscribe_InvalParam(void) void Test_Unsubscribe_NoMatch(void) { CFE_SB_PipeId_t TestPipe; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 50; /* Create pipe, subscribe, unsubscribe */ @@ -2577,7 +2561,7 @@ void Test_Unsubscribe_NoMatch(void) void Test_Unsubscribe_InvalidPipe(void) { CFE_SB_PipeId_t TestPipe; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint16 PipeDepth = 50; SETUP(CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe")); @@ -2600,7 +2584,7 @@ void Test_Unsubscribe_InvalidPipeOwner(void) { CFE_SB_PipeId_t PipeId; CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_PipeD_t *PipeDscPtr; CFE_ES_AppId_t RealOwner; uint16 PipeDepth = 10; @@ -2610,7 +2594,7 @@ void Test_Unsubscribe_InvalidPipeOwner(void) /* Change owner of pipe through memory corruption */ PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); - RealOwner = PipeDscPtr->AppId; + RealOwner = PipeDscPtr->AppId; /* Choose a value that is sure not be owner */ PipeDscPtr->AppId = UT_SB_AppID_Modify(RealOwner, 1); @@ -2765,9 +2749,9 @@ void Test_TransmitMsg_NullPtr(void) */ void Test_TransmitMsg_NoSubscribers(void) { - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_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); @@ -2785,9 +2769,9 @@ void Test_TransmitMsg_NoSubscribers(void) */ void Test_TransmitMsg_MaxMsgSizePlusOne(void) { - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - SB_UT_Test_Tlm_t TlmPkt; - CFE_MSG_Size_t Size = CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_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); @@ -2805,13 +2789,12 @@ void Test_TransmitMsg_MaxMsgSizePlusOne(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; - int32 PipeDepth = 2; - CFE_MSG_Size_t Size = sizeof(TlmPkt); - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - + CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 2; + CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); @@ -2828,7 +2811,8 @@ void Test_TransmitMsg_BasicSend(void) } /* end Test_TransmitMsg_BasicSend */ /* Sequence count hook */ -static int32 UT_CheckSetSequenceCount(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) +static int32 UT_CheckSetSequenceCount(void *UserObj, int32 StubRetcode, uint32 CallCount, + const UT_StubContext_t *Context) { CFE_MSG_SequenceCount_t *SeqCntPtr = UserObj; @@ -2845,8 +2829,8 @@ 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_Size_t Size = sizeof(TlmPkt); - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; uint32 PipeDepth = 10; CFE_MSG_SequenceCount_t SeqCnt; @@ -2907,12 +2891,12 @@ void Test_TransmitMsg_SequenceCount(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; - int32 PipeDepth = 2; - CFE_MSG_Size_t Size = sizeof(TlmPkt); - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_SB_PipeId_t PipeId4Error; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 2; + CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; SETUP(CFE_SB_CreatePipe(&PipeId4Error, PipeDepth, "TestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId4Error)); @@ -2936,12 +2920,12 @@ void Test_TransmitMsg_QueuePutError(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; - int32 PipeDepth = 1; - CFE_MSG_Size_t Size = sizeof(TlmPkt); - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 1; + CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "PipeFullTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); @@ -2975,12 +2959,12 @@ void Test_TransmitMsg_PipeFull(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; - int32 PipeDepth = 5; - CFE_MSG_Size_t Size = sizeof(TlmPkt); - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 5; + CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "MsgLimTestPipe")); @@ -3016,11 +3000,11 @@ void Test_TransmitMsg_MsgLimitExceeded(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; - int32 PipeDepth; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth; + CFE_MSG_Size_t Size = sizeof(TlmPkt); PipeDepth = 1; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "GetPoolErrPipe")); @@ -3065,11 +3049,10 @@ void Test_TransmitMsg_ZeroCopyGetPtr(void) */ /* predict memory use for a given descriptor (this needs to match what impl does) */ - MemUse = MsgSize + offsetof(CFE_SB_BufferD_t, Content); - CFE_SB_Global.StatTlmMsg.Payload.MemInUse = 0; - CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = MemUse + 10; - CFE_SB_Global.StatTlmMsg.Payload.PeakSBBuffersInUse = - CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse + 2; + MemUse = MsgSize + offsetof(CFE_SB_BufferD_t, Content); + CFE_SB_Global.StatTlmMsg.Payload.MemInUse = 0; + CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = MemUse + 10; + CFE_SB_Global.StatTlmMsg.Payload.PeakSBBuffersInUse = CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse + 2; ASSERT_TRUE(CFE_SB_ZeroCopyGetPtr(MsgSize, &ZeroCpyBufHndl) != NULL); ASSERT_EQ(CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse, MemUse + 10); /* unchanged */ @@ -3083,11 +3066,11 @@ void Test_TransmitMsg_ZeroCopyGetPtr(void) void Test_TransmitMsg_ZeroCopyHandleValidate(void) { - CFE_SB_Buffer_t *SendPtr; + CFE_SB_Buffer_t * SendPtr; CFE_SB_ZeroCopyHandle_t GoodZeroCpyBufHndl; CFE_SB_ZeroCopyHandle_t BadZeroCpyBufHndl; CFE_SB_ZeroCopyHandle_t NullZeroCpyBufHndl; - CFE_SB_BufferD_t TestBufDsc; + CFE_SB_BufferD_t TestBufDsc; /* Create a real/valid Zero Copy handle via the API */ SendPtr = CFE_SB_ZeroCopyGetPtr(sizeof(SB_UT_Test_Tlm_t), &GoodZeroCpyBufHndl); @@ -3097,12 +3080,12 @@ void Test_TransmitMsg_ZeroCopyHandleValidate(void) } /* The NULL handle is just zero */ - NullZeroCpyBufHndl = (CFE_SB_ZeroCopyHandle_t) { 0 }; + NullZeroCpyBufHndl = (CFE_SB_ZeroCopyHandle_t) {0}; - /* Create an invalid Zero Copy handle that is not NULL but refers to a + /* Create an invalid Zero Copy handle that is not NULL but refers to a * descriptor which is NOT from CFE_SB_ZeroCopyGetPtr(). */ memset(&TestBufDsc, 0, sizeof(TestBufDsc)); - BadZeroCpyBufHndl = (CFE_SB_ZeroCopyHandle_t) { &TestBufDsc }; + BadZeroCpyBufHndl = (CFE_SB_ZeroCopyHandle_t) {&TestBufDsc}; /* Good buffer pointer + Null Handle => BAD_ARGUMENT */ ASSERT_EQ(CFE_SB_ZeroCopyHandleValidate(SendPtr, NullZeroCpyBufHndl), CFE_SB_BAD_ARGUMENT); @@ -3114,7 +3097,7 @@ void Test_TransmitMsg_ZeroCopyHandleValidate(void) ASSERT_EQ(CFE_SB_ZeroCopyHandleValidate(SendPtr, BadZeroCpyBufHndl), CFE_SB_BUFFER_INVALID); /* Mismatched buffer pointer + Good Handle => CFE_SB_BUFFER_INVALID */ - ASSERT_EQ(CFE_SB_ZeroCopyHandleValidate(SendPtr+1, GoodZeroCpyBufHndl), CFE_SB_BUFFER_INVALID); + ASSERT_EQ(CFE_SB_ZeroCopyHandleValidate(SendPtr + 1, GoodZeroCpyBufHndl), CFE_SB_BUFFER_INVALID); /* Good buffer pointer + Good Handle => SUCCESS */ ASSERT_EQ(CFE_SB_ZeroCopyHandleValidate(SendPtr, GoodZeroCpyBufHndl), CFE_SUCCESS); @@ -3129,10 +3112,10 @@ void Test_TransmitMsg_ZeroCopyHandleValidate(void) */ void Test_TransmitBuffer_IncrementSeqCnt(void) { - CFE_SB_Buffer_t *SendPtr = NULL; - CFE_SB_Buffer_t *ReceivePtr = NULL; + 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_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint32 PipeDepth = 10; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl; CFE_MSG_SequenceCount_t SeqCnt; @@ -3171,7 +3154,6 @@ void Test_TransmitBuffer_IncrementSeqCnt(void) EVTSENT(CFE_SB_SUBSCRIPTION_RCVD_EID); TEARDOWN(CFE_SB_DeletePipe(PipeId)); - } /* @@ -3180,15 +3162,15 @@ void Test_TransmitBuffer_IncrementSeqCnt(void) */ void Test_TransmitBuffer_NoIncrement(void) { - CFE_SB_Buffer_t *SendPtr = NULL; - CFE_SB_Buffer_t *ReceivePtr = NULL; + 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_SB_MsgId_t MsgId = SB_UT_TLM_MID; uint32 PipeDepth = 10; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl; CFE_MSG_SequenceCount_t SeqCnt = 22; - CFE_MSG_Size_t Size = sizeof(SB_UT_Test_Tlm_t); - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_MSG_Size_t Size = sizeof(SB_UT_Test_Tlm_t); + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; /* Set up hook for checking CFE_MSG_SetSequenceCount calls */ UT_SetHookFunction(UT_KEY(CFE_MSG_SetSequenceCount), UT_CheckSetSequenceCount, &SeqCnt); @@ -3219,7 +3201,6 @@ void Test_TransmitBuffer_NoIncrement(void) EVTSENT(CFE_SB_SUBSCRIPTION_RCVD_EID); TEARDOWN(CFE_SB_DeletePipe(PipeId)); - } /* @@ -3227,9 +3208,9 @@ void Test_TransmitBuffer_NoIncrement(void) */ void Test_TransmitMsg_ZeroCopyReleasePtr(void) { - CFE_SB_Buffer_t *ZeroCpyMsgPtr1 = NULL; - CFE_SB_Buffer_t *ZeroCpyMsgPtr2 = NULL; - CFE_SB_Buffer_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; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl2; CFE_SB_ZeroCopyHandle_t ZeroCpyBufHndl3; @@ -3247,8 +3228,7 @@ void Test_TransmitMsg_ZeroCopyReleasePtr(void) ASSERT_EQ(CFE_SB_ZeroCopyReleasePtr(NULL, ZeroCpyBufHndl3), CFE_SB_BAD_ARGUMENT); /* Test response to an invalid message pointer */ - ASSERT_EQ(CFE_SB_ZeroCopyReleasePtr(ZeroCpyMsgPtr1, - ZeroCpyBufHndl3), CFE_SB_BUFFER_INVALID); + ASSERT_EQ(CFE_SB_ZeroCopyReleasePtr(ZeroCpyMsgPtr1, ZeroCpyBufHndl3), CFE_SB_BUFFER_INVALID); /* Test successful release of the second buffer */ ASSERT(CFE_SB_ZeroCopyReleasePtr(ZeroCpyMsgPtr3, ZeroCpyBufHndl3)); @@ -3265,22 +3245,22 @@ void Test_TransmitMsg_ZeroCopyReleasePtr(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_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + SB_UT_Test_Tlm_t TlmPkt; CFE_SB_DestinationD_t *DestPtr; - int32 PipeDepth; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPkt); - CFE_SBR_RouteId_t RouteId; + int32 PipeDepth; + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_SBR_RouteId_t RouteId; PipeDepth = 2; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - RouteId = CFE_SBR_GetRouteId(MsgId); - DestPtr = CFE_SB_GetDestPtr(RouteId, PipeId); + RouteId = CFE_SBR_GetRouteId(MsgId); + DestPtr = CFE_SB_GetDestPtr(RouteId, PipeId); DestPtr->Active = CFE_SB_INACTIVE; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -3311,7 +3291,7 @@ void Test_BroadcastBufferToRoute(void) memset(&SBBufD, 0, sizeof(SBBufD)); SBBufD.MsgId = MsgId; CFE_SB_TrackingListReset(&SBBufD.Link); - + PipeDepth = 2; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); @@ -3332,12 +3312,12 @@ void Test_BroadcastBufferToRoute(void) */ void Test_TransmitMsgValidate_MaxMsgSizePlusOne(void) { - 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; + 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; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -3349,7 +3329,6 @@ void Test_TransmitMsgValidate_MaxMsgSizePlusOne(void) EVTCNT(1); EVTSENT(CFE_SB_MSG_TOO_BIG_EID); - } /* @@ -3357,12 +3336,12 @@ void Test_TransmitMsgValidate_MaxMsgSizePlusOne(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_Size_t Size = sizeof(TlmPkt); - CFE_MSG_Size_t SizeRtn; - CFE_SBR_RouteId_t RouteIdRtn; + 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 = sizeof(TlmPkt); + CFE_MSG_Size_t SizeRtn; + CFE_SBR_RouteId_t RouteIdRtn; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -3375,7 +3354,6 @@ void Test_TransmitMsgValidate_NoSubscribers(void) EVTCNT(1); EVTSENT(CFE_SB_SEND_NO_SUBS_EID); - } /* @@ -3397,12 +3375,11 @@ void Test_ReceiveBuffer_API(void) */ void Test_ReceiveBuffer_InvalidPipeId(void) { - CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t InvalidPipeId = SB_UT_ALTERNATE_INVALID_PIPEID; + CFE_SB_Buffer_t *SBBufPtr; + CFE_SB_PipeId_t InvalidPipeId = SB_UT_ALTERNATE_INVALID_PIPEID; ASSERT_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, InvalidPipeId, CFE_SB_POLL), CFE_SB_BAD_ARGUMENT); - EVTCNT(1); EVTSENT(CFE_SB_BAD_PIPEID_EID); @@ -3414,10 +3391,10 @@ void Test_ReceiveBuffer_InvalidPipeId(void) */ void Test_ReceiveBuffer_InvalidTimeout(void) { - CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; - uint32 PipeDepth = 10; - int32 TimeOut = -5; + CFE_SB_Buffer_t *SBBufPtr; + CFE_SB_PipeId_t PipeId; + uint32 PipeDepth = 10; + int32 TimeOut = -5; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); @@ -3436,9 +3413,9 @@ void Test_ReceiveBuffer_InvalidTimeout(void) */ void Test_ReceiveBuffer_Poll(void) { - CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; - uint32 PipeDepth = 10; + CFE_SB_Buffer_t *SBBufPtr; + CFE_SB_PipeId_t PipeId; + uint32 PipeDepth = 10; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); @@ -3457,10 +3434,10 @@ void Test_ReceiveBuffer_Poll(void) */ void Test_ReceiveBuffer_Timeout(void) { - CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; - uint32 PipeDepth = 10; - int32 TimeOut = 200; + CFE_SB_Buffer_t *SBBufPtr; + CFE_SB_PipeId_t PipeId; + uint32 PipeDepth = 10; + int32 TimeOut = 200; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); UT_SetDeferredRetcode(UT_KEY(OS_QueueGet), 1, OS_QUEUE_TIMEOUT); @@ -3480,9 +3457,9 @@ void Test_ReceiveBuffer_Timeout(void) */ void Test_ReceiveBuffer_PipeReadError(void) { - CFE_SB_Buffer_t *SBBufPtr; - CFE_SB_PipeId_t PipeId; - uint32 PipeDepth = 10; + CFE_SB_Buffer_t *SBBufPtr; + CFE_SB_PipeId_t PipeId; + uint32 PipeDepth = 10; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); UT_SetDeferredRetcode(UT_KEY(OS_QueueGet), 1, OS_ERROR); @@ -3501,13 +3478,13 @@ void Test_ReceiveBuffer_PipeReadError(void) */ void Test_ReceiveBuffer_PendForever(void) { - 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; - uint32 PipeDepth = 10; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + 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; + 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, "RcvTestPipe")); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); @@ -3517,7 +3494,7 @@ void Test_ReceiveBuffer_PendForever(void) SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); ASSERT(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER)); - + ASSERT_TRUE(SBBufPtr != NULL); EVTCNT(2); @@ -3560,7 +3537,7 @@ void Test_CleanupApp_API(void) /* Set second application ID to provide complete branch path coverage */ CFE_SB_Global.PipeTbl[1].PipeId = SB_UT_PIPEID_1; - CFE_SB_Global.PipeTbl[1].AppId = AppID; + CFE_SB_Global.PipeTbl[1].AppId = AppID; /* Attempt with a bad application ID first in order to get full branch path * coverage in CFE_SB_ZeroCopyReleaseAppId @@ -3633,14 +3610,14 @@ void Test_CFE_SB_MsgHdrSize(void) /* No secondary */ hassec = false; - type = CFE_MSG_Type_Invalid; + 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(CFE_MSG_Message_t)); /* Has secondary, tlm type */ hassec = true; - type = CFE_MSG_Type_Tlm; + 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_MSG_TelemetryHeader_t)); @@ -3665,7 +3642,7 @@ void Test_CFE_SB_MsgHdrSize(void) void Test_CFE_SB_GetUserData(void) { CFE_MSG_Message_t msg; - uint8 *expected; + uint8 * expected; bool hassec; CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; struct @@ -3691,22 +3668,22 @@ void Test_CFE_SB_GetUserData(void) struct { CFE_MSG_TelemetryHeader_t tlm; - uint8 payload; + uint8 payload; } tlm_uint8; struct { CFE_MSG_TelemetryHeader_t tlm; - uint16 payload; + uint16 payload; } tlm_uint16; struct { CFE_MSG_TelemetryHeader_t tlm; - uint32 payload; + uint32 payload; } tlm_uint32; struct { CFE_MSG_TelemetryHeader_t tlm; - uint64 payload; + uint64 payload; } tlm_uint64; /* No secondary */ @@ -3720,7 +3697,7 @@ void Test_CFE_SB_GetUserData(void) /* Commands */ hassec = true; - type = CFE_MSG_Type_Cmd; + 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); UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&cmd_uint8.cmd.Msg), &(cmd_uint8.payload)); @@ -3757,8 +3734,8 @@ void Test_CFE_SB_GetUserData(void) void Test_CFE_SB_SetGetUserDataLength(void) { CFE_MSG_Message_t msg; - CFE_MSG_Size_t size = 10; - CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; + CFE_MSG_Size_t size = 10; + CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; bool hassec = false; /* Pass through functions */ @@ -3778,7 +3755,7 @@ void Test_CFE_SB_SetGetUserDataLength(void) */ void Test_CFE_SB_ValidateMsgId(void) { - CFE_SB_MsgId_t MsgId; + CFE_SB_MsgId_t MsgId; /* Validate Msg Id */ MsgId = SB_UT_LAST_VALID_MID; @@ -3787,7 +3764,6 @@ void Test_CFE_SB_ValidateMsgId(void) /* Test for invalid msg id */ MsgId = SB_UT_ALTERNATE_INVALID_MID; ASSERT_EQ(CFE_SB_ValidateMsgId(MsgId), CFE_SB_FAILED); - } /* @@ -3815,7 +3791,7 @@ void Test_SB_SpecialCases(void) void Test_OS_MutSem_ErrLogic(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; + CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; uint16 PipeDepth = 50; UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_SEM_FAILURE); @@ -3839,7 +3815,7 @@ void Test_OS_MutSem_ErrLogic(void) void Test_ReqToSendEvent_ErrLogic(void) { CFE_ES_TaskId_t TaskId; - uint32 Bit = 5; + uint32 Bit = 5; /* Clear task bits, then call function, which should set the bit for * the specified task @@ -3878,15 +3854,15 @@ void Test_CFE_SB_Buffers(void) CFE_SB_BufferD_t *bd; - CFE_SB_Global.StatTlmMsg.Payload.MemInUse = 0; + CFE_SB_Global.StatTlmMsg.Payload.MemInUse = 0; CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = sizeof(CFE_SB_BufferD_t) * 4; - bd = CFE_SB_GetBufferFromPool(0); + bd = CFE_SB_GetBufferFromPool(0); ASSERT_EQ(CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse, sizeof(CFE_SB_BufferD_t) * 4); EVTCNT(0); - /* + /* * If returning to the pool fails SB still isn't going to use the buffer anymore, * so it shouldn't be tracked as "in use" - it is lost. */ @@ -3905,7 +3881,7 @@ void Test_CFE_SB_Buffers(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 1, -1); CFE_SB_Global.StatTlmMsg.Payload.MemInUse = 0; - CFE_SB_PutDestinationBlk((CFE_SB_DestinationD_t *) bd); + CFE_SB_PutDestinationBlk((CFE_SB_DestinationD_t *)bd); ASSERT_EQ(CFE_SB_Global.StatTlmMsg.Payload.MemInUse, 0); @@ -3919,14 +3895,14 @@ void Test_CFE_SB_Buffers(void) void Test_CFE_SB_BadPipeInfo(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_PipeD_t *PipeDscPtr; + CFE_SB_PipeD_t *PipeDscPtr; uint16 PipeDepth = 10; CFE_ES_AppId_t AppID; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe1")); /* Set the pipe ID to an erroneous value and attempt to delete the pipe */ - PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); + PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); PipeDscPtr->PipeId = SB_UT_PIPEID_1; CFE_ES_GetAppID(&AppID); ASSERT_EQ(CFE_SB_DeletePipeFull(SB_UT_PIPEID_0, AppID), CFE_SB_BAD_ARGUMENT); @@ -3936,14 +3912,14 @@ void Test_CFE_SB_BadPipeInfo(void) /* Reset the pipe ID and delete the pipe */ PipeDscPtr->PipeId = PipeId; - ASSERT_EQ(CFE_SB_SubscribeFull(SB_UT_FIRST_VALID_MID , PipeId, CFE_SB_DEFAULT_QOS, - CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, 2), CFE_SB_BAD_ARGUMENT); + ASSERT_EQ( + CFE_SB_SubscribeFull(SB_UT_FIRST_VALID_MID, PipeId, CFE_SB_DEFAULT_QOS, CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, 2), + CFE_SB_BAD_ARGUMENT); EVTCNT(4); TEARDOWN(CFE_SB_DeletePipe(PipeId)); - } /* end Test_CFE_SB_BadPipeInfo */ /* @@ -3953,19 +3929,19 @@ void Test_SB_TransmitMsgPaths_Nominal(void) { union { - CFE_SB_Buffer_t SBBuf; + 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; + 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 send message call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); - Size = sizeof(CFE_SB_Global.HKTlmMsg); + Size = sizeof(CFE_SB_Global.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -3988,7 +3964,7 @@ void Test_SB_TransmitMsgPaths_Nominal(void) /* For internal send message call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); - Size = sizeof(CFE_SB_Global.HKTlmMsg); + Size = sizeof(CFE_SB_Global.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -4008,8 +3984,8 @@ void Test_SB_TransmitMsgPaths_Nominal(void) /* Create a message ID with the command bit set and disable reporting */ MsgId = SB_UT_CMD_MID; - Size = sizeof(TlmPkt); - Type = CFE_MSG_Type_Cmd; + Size = sizeof(TlmPkt); + Type = CFE_MSG_Type_Cmd; SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); /* Will fail because of deferred CFE_ES_GetPoolBuf failure return */ @@ -4028,12 +4004,12 @@ void Test_SB_TransmitMsgPaths_Nominal(void) void Test_SB_TransmitMsgPaths_LimitErr(void) { - CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; - SB_UT_Test_Tlm_t TlmPkt; - int32 PipeDepth = 2; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_SB_MsgId_t MsgId; + CFE_SB_PipeId_t PipeId; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 2; + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_MSG_Size_t Size = sizeof(TlmPkt); /* Test inhibiting sending a "message ID limit error" message */ MsgId = SB_UT_TLM_MID; @@ -4063,15 +4039,14 @@ void Test_SB_TransmitMsgPaths_LimitErr(void) } /* end Test_SB_TransmitMsgPaths */ - void Test_SB_TransmitMsgPaths_FullErr(void) { - CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; - SB_UT_Test_Tlm_t TlmPkt; - int32 PipeDepth = 2; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_SB_MsgId_t MsgId; + CFE_SB_PipeId_t PipeId; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 2; + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_MSG_Size_t Size = sizeof(TlmPkt); /* Test inhibiting sending a "pipe full" message */ MsgId = SB_UT_TLM_MID; @@ -4104,12 +4079,12 @@ void Test_SB_TransmitMsgPaths_FullErr(void) void Test_SB_TransmitMsgPaths_WriteErr(void) { - CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; - SB_UT_Test_Tlm_t TlmPkt; - int32 PipeDepth = 2; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_SB_MsgId_t MsgId; + CFE_SB_PipeId_t PipeId; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 2; + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_MSG_Size_t Size = sizeof(TlmPkt); /* Test inhibiting sending a "pipe write error" message */ MsgId = SB_UT_TLM_MID; @@ -4141,12 +4116,12 @@ void Test_SB_TransmitMsgPaths_WriteErr(void) void Test_SB_TransmitMsgPaths_IgnoreOpt(void) { - CFE_SB_MsgId_t MsgId; - CFE_SB_PipeId_t PipeId; - SB_UT_Test_Tlm_t TlmPkt; - int32 PipeDepth = 2; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + CFE_SB_MsgId_t MsgId; + CFE_SB_PipeId_t PipeId; + SB_UT_Test_Tlm_t TlmPkt; + int32 PipeDepth = 2; + CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; + CFE_MSG_Size_t Size = sizeof(TlmPkt); /* Setup Test skipping sending to a pipe when the pipe option is set to ignore */ MsgId = SB_UT_TLM_MID; @@ -4166,20 +4141,19 @@ void Test_SB_TransmitMsgPaths_IgnoreOpt(void) } /* 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_ReceiveBuffer_UnsubResubPath(void) { - 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; - uint32 PipeDepth = 10; - CFE_MSG_Type_t Type = CFE_MSG_Type_Tlm; - CFE_MSG_Size_t Size = sizeof(TlmPkt); + 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; + 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, "RcvTestPipe")); SETUP(CFE_SB_Subscribe(MsgId, PipeId)); @@ -4208,68 +4182,49 @@ void Test_ReceiveBuffer_UnsubResubPath(void) */ void Test_MessageString(void) { - const char *SrcString = "abcdefg"; - char DestString[20]; - char *DestStringPtr = DestString; - const char *DefString = "default"; + const char *SrcString = "abcdefg"; + char DestString[20]; + char * DestStringPtr = DestString; + const char *DefString = "default"; /* Test setting string where the destination size > source string size */ - CFE_SB_MessageStringSet(DestStringPtr, SrcString, sizeof(DestString), - strlen(SrcString)); - UT_Report(__FILE__, __LINE__, - strcmp(DestString, SrcString) == 0, "CFE_SB_MessageStringSet", + CFE_SB_MessageStringSet(DestStringPtr, SrcString, sizeof(DestString), strlen(SrcString)); + UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) == 0, "CFE_SB_MessageStringSet", "Destination size > source string size"); - /* Test setting string where the source string is empty */ - CFE_SB_MessageStringSet(DestStringPtr, "", sizeof(DestString), - strlen(SrcString)); - UT_Report(__FILE__, __LINE__, - strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringSet", - "Empty source string"); - - /* Test setting string where the destination size < source string size */ - CFE_SB_MessageStringSet(DestStringPtr, SrcString, strlen(SrcString) - 1, - strlen(SrcString)); - UT_Report(__FILE__, __LINE__, - strncmp(DestString, SrcString, strlen(SrcString) - 1) == 0, - "CFE_SB_MessageStringSet", + /* Test setting string where the source string is empty */ + CFE_SB_MessageStringSet(DestStringPtr, "", sizeof(DestString), strlen(SrcString)); + UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringSet", "Empty source string"); + + /* Test setting string where the destination size < source string size */ + CFE_SB_MessageStringSet(DestStringPtr, SrcString, strlen(SrcString) - 1, strlen(SrcString)); + UT_Report(__FILE__, __LINE__, strncmp(DestString, SrcString, strlen(SrcString) - 1) == 0, "CFE_SB_MessageStringSet", "Destination size < source string size"); - /* Test getting string where the destination size > source string size */ - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, - sizeof(DestString), strlen(SrcString)); - UT_Report(__FILE__, __LINE__, - strcmp(DestString, SrcString) == 0, "CFE_SB_MessageStringGet", + /* Test getting string where the destination size > source string size */ + CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, sizeof(DestString), strlen(SrcString)); + UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) == 0, "CFE_SB_MessageStringGet", "Destination size > source string size"); - /* Test getting string where the destination size is zero */ + /* Test getting string where the destination size is zero */ DestString[0] = '\0'; - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, 0, - strlen(SrcString)); - UT_Report(__FILE__, __LINE__, - strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringGet", + CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, 0, strlen(SrcString)); + UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringGet", "Destination size = 0"); - /* Test getting string where the default string is NULL */ - CFE_SB_MessageStringGet(DestStringPtr, SrcString, NULL, - sizeof(DestString), 0); - UT_Report(__FILE__, __LINE__, - strcmp(DefString, SrcString) != 0, "CFE_SB_MessageStringGet", + /* Test getting string where the default string is NULL */ + CFE_SB_MessageStringGet(DestStringPtr, SrcString, NULL, sizeof(DestString), 0); + UT_Report(__FILE__, __LINE__, strcmp(DefString, SrcString) != 0, "CFE_SB_MessageStringGet", "Default string = NULL"); - /* Test getting string where the source string size is zero */ - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, - sizeof(DestString), 0); - UT_Report(__FILE__, __LINE__, - strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringGet", + /* Test getting string where the source string size is zero */ + CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, sizeof(DestString), 0); + UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringGet", "Source string size = 0"); - /* Test getting string where the destination size < source string size */ + /* Test getting string where the destination size < source string size */ DestString[0] = '\0'; - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, - strlen(SrcString) - 1, strlen(SrcString)); - UT_Report(__FILE__, __LINE__, - strncmp(DestString, SrcString, strlen(DestString)) == 0, - "CFE_SB_MessageStringGet", + CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, strlen(SrcString) - 1, strlen(SrcString)); + UT_Report(__FILE__, __LINE__, strncmp(DestString, SrcString, strlen(DestString)) == 0, "CFE_SB_MessageStringGet", "Destination size < source string size"); } /* end Test_MessageString */ diff --git a/modules/sb/ut-coverage/sb_UT.h b/modules/sb/ut-coverage/sb_UT.h index 99dc04cf2..0ed41de4c 100644 --- a/modules/sb/ut-coverage/sb_UT.h +++ b/modules/sb/ut-coverage/sb_UT.h @@ -51,39 +51,42 @@ /* ** Structures */ -typedef struct { - CFE_MSG_CommandHeader_t Hdr; - uint32 Cmd32Param1; - uint16 Cmd16Param1; - uint16 Cmd16Param2; - uint8 Cmd8Param1; - uint8 Cmd8Param2; - uint8 Cmd8Param3; - uint8 Cmd8Param4; +typedef struct +{ + 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_MSG_TelemetryHeader_t Hdr; - uint32 Tlm32Param1; - uint16 Tlm16Param1; - uint16 Tlm16Param2; - uint8 Tlm8Param1; - uint8 Tlm8Param2; - uint8 Tlm8Param3; - uint8 Tlm8Param4; +typedef struct +{ + 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; - uint8 Tlm8Param1; - uint8 Tlm8Param2; - uint32 Tlm32Param1; - uint16 Tlm16Param1; - uint16 Tlm16Param2; +typedef struct +{ + 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 -#define SB_UT_TLM_MID_VALUE_BASE CFE_PLATFORM_TLM_MID_BASE + 1 +#define SB_UT_CMD_MID_VALUE_BASE CFE_PLATFORM_CMD_MID_BASE + 1 +#define SB_UT_TLM_MID_VALUE_BASE CFE_PLATFORM_TLM_MID_BASE + 1 /* SB unit test functions */ /*****************************************************************************/ @@ -2416,7 +2419,6 @@ void Test_ReceiveBuffer_UnsubResubPath(void); ******************************************************************************/ void Test_MessageString(void); - void Test_SB_Macros(void); void Test_SB_CCSDSPriHdr_Macros(void); diff --git a/modules/sbr/fsw/src/cfe_sbr_priv.h b/modules/sbr/fsw/src/cfe_sbr_priv.h index 308185a05..429519d28 100644 --- a/modules/sbr/fsw/src/cfe_sbr_priv.h +++ b/modules/sbr/fsw/src/cfe_sbr_priv.h @@ -31,7 +31,6 @@ */ #include "cfe_sbr.h" - /****************************************************************************** * Function prototypes */ diff --git a/modules/tbl/fsw/inc/cfe_tbl_events.h b/modules/tbl/fsw/inc/cfe_tbl_events.h index e35245024..ab5cfba96 100644 --- a/modules/tbl/fsw/inc/cfe_tbl_events.h +++ b/modules/tbl/fsw/inc/cfe_tbl_events.h @@ -46,7 +46,7 @@ ** and when you're done adding, set this to the highest EID you used. It may ** be worthwhile to, on occasion, re-number the EID's to put them back in order. */ -#define CFE_TBL_MAX_EID 103 +#define CFE_TBL_MAX_EID 103 /******************* Macro Definitions ***********************/ /* @@ -56,7 +56,7 @@ /** \name Informational Event Message IDs */ /** \{ */ /** \brief 'Task Initialized' -** \event 'Task Initialized' +** \event 'Task Initialized' ** ** \par Type: INFORMATION ** @@ -65,37 +65,36 @@ ** This event message is always automatically issued when the Table Services ** Task completes its Initialization. **/ -#define CFE_TBL_INIT_INF_EID 1 +#define CFE_TBL_INIT_INF_EID 1 /** \} */ - /** \name Command Response Informational Event Message IDs */ /** \{ */ /** \brief 'No-op command' -** \event 'No-op command' +** \event 'No-op command' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Table Services \link #CFE_TBL_NOOP_CC NO-OP command \endlink **/ -#define CFE_TBL_NOOP_INF_EID 10 - +#define CFE_TBL_NOOP_INF_EID 10 + /** \brief 'Reset Counters command' -** \event 'Reset Counters command' +** \event 'Reset Counters command' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Table Services \link #CFE_TBL_RESET_COUNTERS_CC Reset Counters command \endlink **/ -#define CFE_TBL_RESET_INF_EID 11 - +#define CFE_TBL_RESET_INF_EID 11 + /** \brief 'Successful load of '\%s' into '\%s' working buffer' ** \event 'Successful load of '\%s' into '\%s' working buffer' ** @@ -103,11 +102,11 @@ ** ** \par Cause: ** -** This event message is always generated after a successful execution of +** This event message is always generated after a successful execution of ** a cFE Table Services \link #CFE_TBL_LOAD_CC Load Table command \endlink **/ -#define CFE_TBL_FILE_LOADED_INF_EID 12 - +#define CFE_TBL_FILE_LOADED_INF_EID 12 + /** \brief 'Successfully overwrote '\%s' with Table '\%s'' ** \event 'Successfully overwrote '\%s' with Table '\%s'' ** @@ -115,14 +114,14 @@ ** ** \par Cause: ** -** This event message is always generated after a successful execution of +** This event message is always generated after a successful execution of ** a cFE Table Services \link #CFE_TBL_DUMP_CC Dump Table command \endlink where ** the command specified target filename was the same as a file already present ** in the onboard filesystem. If the specified file did not exist, the event ** message would have been #CFE_TBL_WRITE_DUMP_INF_EID. **/ -#define CFE_TBL_OVERWRITE_DUMP_INF_EID 13 - +#define CFE_TBL_OVERWRITE_DUMP_INF_EID 13 + /** \brief 'Successfully dumped Table '\%s' to '\%s'' ** \event 'Successfully dumped Table '\%s' to '\%s'' ** @@ -130,14 +129,14 @@ ** ** \par Cause: ** -** This event message is always generated after a successful execution of +** This event message is always generated after a successful execution of ** a cFE Table Services \link #CFE_TBL_DUMP_CC Dump Table command \endlink where ** the command specified target filename was a currently non-existent file. If -** the file did already exist, the event message would have been +** the file did already exist, the event message would have been ** #CFE_TBL_OVERWRITE_DUMP_INF_EID. **/ -#define CFE_TBL_WRITE_DUMP_INF_EID 14 - +#define CFE_TBL_WRITE_DUMP_INF_EID 14 + /** \brief 'Successfully overwrote '\%s' with Table Registry' ** \event 'Successfully overwrote '\%s' with Table Registry' ** @@ -145,14 +144,14 @@ ** ** \par Cause: ** -** This event message is always generated after a successful execution of +** This event message is always generated after a successful execution of ** a cFE Table Services \link #CFE_TBL_DUMP_REGISTRY_CC Dump Table Registry command \endlink where ** the command specified target filename was the same as a file already present ** in the onboard filesystem. If the specified file did not exist, the event ** message would have been #CFE_TBL_WRITE_REG_DUMP_INF_EID. **/ -#define CFE_TBL_OVERWRITE_REG_DUMP_INF_EID 15 - +#define CFE_TBL_OVERWRITE_REG_DUMP_INF_EID 15 + /** \brief 'Tbl Services issued validation request for '\%s'' ** \event 'Tbl Services issued validation request for '\%s'' ** @@ -160,7 +159,7 @@ ** ** \par Cause: ** -** This event message is generated upon successful execution of +** This event message is generated upon successful execution of ** a cFE Table Services \link #CFE_TBL_VALIDATE_CC Validate Table command \endlink. ** It should be noted, however, that this Event Message does NOT indicate completion of ** the Table Validation. It is ONLY indicating that the appropriate flag has been @@ -168,8 +167,8 @@ ** Completion of the Validation is indicated by either the #CFE_TBL_VALIDATION_INF_EID or ** #CFE_TBL_VALIDATION_ERR_EID event messages. **/ -#define CFE_TBL_VAL_REQ_MADE_INF_EID 16 - +#define CFE_TBL_VAL_REQ_MADE_INF_EID 16 + /** \brief 'Tbl Services notifying App that '\%s' has a load pending' ** \event 'Tbl Services notifying App that '\%s' has a load pending' ** @@ -177,7 +176,7 @@ ** ** \par Cause: ** -** This event message is generated upon successful execution of +** This event message is generated upon successful execution of ** a cFE Table Services \link #CFE_TBL_ACTIVATE_CC Activate Table command \endlink. ** It should be noted, however, that this Event Message does NOT indicate completion of ** the Table Activation. It is ONLY indicating that the appropriate flag has been @@ -185,8 +184,8 @@ ** Completion of the Update is indicated by either the #CFE_TBL_UPDATE_SUCCESS_INF_EID or ** #CFE_TBL_UPDATE_ERR_EID event messages. **/ -#define CFE_TBL_LOAD_PEND_REQ_INF_EID 17 - +#define CFE_TBL_LOAD_PEND_REQ_INF_EID 17 + /** \brief 'Table Registry entry for '\%s' will be telemetered' ** \event 'Table Registry entry for '\%s' will be telemetered' ** @@ -194,12 +193,12 @@ ** ** \par Cause: ** -** This event message is generated upon successful execution of +** This event message is generated upon successful execution of ** a cFE Table Services \link #CFE_TBL_SEND_REGISTRY_CC Telemeter Table Registry Entry command \endlink. ** Subsequent Table Services Housekeeping Telemetry should contain the desired Table Registry Entry data. **/ -#define CFE_TBL_TLM_REG_CMD_INF_EID 18 - +#define CFE_TBL_TLM_REG_CMD_INF_EID 18 + /** \brief 'Table Load Aborted for '\%s'' ** \event 'Table Load Aborted for '\%s'' ** @@ -207,11 +206,11 @@ ** ** \par Cause: ** -** This event message is generated upon successful execution of +** This event message is generated upon successful execution of ** a cFE Table Services \link #CFE_TBL_ABORT_LOAD_CC Abort Table Load command \endlink. **/ -#define CFE_TBL_LOAD_ABORT_INF_EID 21 - +#define CFE_TBL_LOAD_ABORT_INF_EID 21 + /** \brief 'Successfully dumped Table Registry to '\%s':Size=\%d,Entries=\%d' ** \event 'Successfully dumped Table Registry to '\%s':Size=\%d,Entries=\%d' ** @@ -219,13 +218,13 @@ ** ** \par Cause: ** -** This event message is always generated after a successful execution of +** This event message is always generated after a successful execution of ** a cFE Table Services \link #CFE_TBL_DUMP_REGISTRY_CC Dump Table Registry command \endlink where ** the command specified target filename was a currently non-existent file. If -** the file did already exist, the event message would have been +** the file did already exist, the event message would have been ** #CFE_TBL_OVERWRITE_REG_DUMP_INF_EID. **/ -#define CFE_TBL_WRITE_REG_DUMP_INF_EID 22 +#define CFE_TBL_WRITE_REG_DUMP_INF_EID 22 /** \brief 'Tbl Services assumes '\%s' is valid. No Validation Function has been registered' ** \event 'Tbl Services assumes '\%s' is valid. No Validation Function has been registered' @@ -238,10 +237,9 @@ ** for a table that never specified a Validation Function when it was registered via the ** #CFE_TBL_Register API. **/ -#define CFE_TBL_ASSUMED_VALID_INF_EID 23 +#define CFE_TBL_ASSUMED_VALID_INF_EID 23 /** \} */ - /** \name Command Error Event Message IDs */ /** \{ */ /** \brief 'Invalid message ID -- ID = 0x\%X' @@ -256,13 +254,13 @@ ** Message ID that is neither #CFE_TBL_SEND_HK_MID or #CFE_TBL_CMD_MID. ** Most likely, the cFE Software Bus routing table has become corrupt ** and is sending messages targeted for other Applications to the cFE -** Table Services Application. +** Table Services Application. ** ** The \c ID field in the event message identifies ** the message ID (in hex) that was found in the message. **/ -#define CFE_TBL_MID_ERR_EID 50 - +#define CFE_TBL_MID_ERR_EID 50 + /** \brief 'Invalid command code -- ID = 0x\%X, CC = \%d' ** \event 'Invalid command code -- ID = 0x\%X, CC = \%d' ** @@ -279,11 +277,11 @@ ** -# The Command Code field in the Message became corrupted. ** -# The command database at the ground station has been corrupted. ** -** The \c ID field in the event message specifies the Message ID (in hex) and the -** \c CC field specifies the Command Code (in decimal) found in the message. +** The \c ID field in the event message specifies the Message ID (in hex) and the +** \c CC field specifies the Command Code (in decimal) found in the message. **/ -#define CFE_TBL_CC1_ERR_EID 51 - +#define CFE_TBL_CC1_ERR_EID 51 + /** \brief 'Invalid cmd pkt -- ID = 0x\%X, CC = \%d, Len = \%d' ** \event 'Invalid cmd pkt -- ID = 0x\%X, CC = \%d, Len = \%d' ** @@ -297,10 +295,10 @@ ** ** The \c ID field in the event message specifies the Message ID (in hex), the \c CC field ** specifies the Command Code (in decimal) and \c Len specifies the message Length (in decimal) -** found in the message. +** found in the message. **/ -#define CFE_TBL_LEN_ERR_EID 52 - +#define CFE_TBL_LEN_ERR_EID 52 + /** \brief 'Unable to open file '\%s' for table load, Status = 0x\%08X' ** \event 'Unable to open file '\%s' for table load, Status = 0x\%08X' ** @@ -308,21 +306,21 @@ ** ** \par Cause: ** -** This event message is generated upon receipt of a +** This event message is generated upon receipt of a ** \link #CFE_TBL_LOAD_CC Load Table command \endlink when ** the specified file containing the table image to be loaded ** cannot be opened. Possible causes for this are: ** ** -# The filename was misspelled ** -# The path to the file was incorrect -** -# The length (including terminator) of the filename and/or path exceeds the +** -# The length (including terminator) of the filename and/or path exceeds the ** allowable length (see #OS_MAX_PATH_LEN and #OS_MAX_FILE_NAME, respectively) ** ** The \c Status field in the event message indicates the error code returned by the #OS_OpenCreate -** API. +** API. **/ -#define CFE_TBL_FILE_ACCESS_ERR_EID 53 - +#define CFE_TBL_FILE_ACCESS_ERR_EID 53 + /** \brief 'Unable to read std header for '\%s', Status = 0x\%08X' ** \event 'Unable to read std header for '\%s', Status = 0x\%08X' ** @@ -331,14 +329,14 @@ ** \par Cause: ** ** This event message is generated when a read failure occurs during the reading of the -** \link #CFE_FS_Header_t cFE Standard File Header \endlink of a table image file specified -** either by an Application calling the #CFE_TBL_Load API or in response to a command to +** \link #CFE_FS_Header_t cFE Standard File Header \endlink of a table image file specified +** either by an Application calling the #CFE_TBL_Load API or in response to a command to ** Table Services requesting a table image file be loaded into an inactive buffer. ** -** The \c Status field of the event message contains the error code returned by #CFE_FS_ReadHeader. +** The \c Status field of the event message contains the error code returned by #CFE_FS_ReadHeader. **/ -#define CFE_TBL_FILE_STD_HDR_ERR_EID 54 - +#define CFE_TBL_FILE_STD_HDR_ERR_EID 54 + /** \brief 'Unable to read tbl header for '\%s', Status = 0x\%08X' ** \event 'Unable to read tbl header for '\%s', Status = 0x\%08X' ** @@ -347,14 +345,14 @@ ** \par Cause: ** ** This event message is generated when a read failure occurs during the reading of the -** \link #CFE_TBL_File_Hdr_t cFE Table File Secondary Header \endlink of a table image file specified -** either by an Application calling the #CFE_TBL_Load API or in response to a command to +** \link #CFE_TBL_File_Hdr_t cFE Table File Secondary Header \endlink of a table image file specified +** either by an Application calling the #CFE_TBL_Load API or in response to a command to ** Table Services requesting a table image file be loaded into an inactive buffer. ** -** The \c Status field of the event message contains the error code returned by #OS_read. +** The \c Status field of the event message contains the error code returned by #OS_read. **/ -#define CFE_TBL_FILE_TBL_HDR_ERR_EID 55 - +#define CFE_TBL_FILE_TBL_HDR_ERR_EID 55 + /** \brief 'Unable to send Hk Packet (Status=0x\%08X)' ** \event 'Unable to send Hk Packet (Status=0x\%08X)' ** @@ -367,7 +365,7 @@ ** ** The \c Status field of the event message contains the error code. **/ -#define CFE_TBL_FAIL_HK_SEND_ERR_EID 56 +#define CFE_TBL_FAIL_HK_SEND_ERR_EID 56 /** \brief 'Unable to locate '\%s' in Table Registry' ** \event 'Unable to locate '\%s' in Table Registry' @@ -384,7 +382,7 @@ ** has been terminated thus removing the Table from the Registry. ** -# The Table Registry has become corrupted. **/ -#define CFE_TBL_NO_SUCH_TABLE_ERR_EID 57 +#define CFE_TBL_NO_SUCH_TABLE_ERR_EID 57 /** \brief 'File '\%s' is not a cFE file type, ContentType = 0x\%08X' ** \event 'File '\%s' is not a cFE file type, ContentType = 0x\%08X' @@ -395,7 +393,7 @@ ** ** This event message is generated when either an Application calls the #CFE_TBL_Load API ** or a Table Load command has been received and the specified file has a \link #CFE_FS_Header_t -** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::ContentType Content Type \endlink +** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::ContentType Content Type \endlink ** is not equal to the expected #CFE_FS_FILE_CONTENT_ID. Most likely causes for this are: ** -# The specified file is not a cFE compatible file. ** -# The specified file has been created with bad "endianess" (headers should always conform to @@ -405,7 +403,7 @@ ** The \c ContentType field specified in the event message contains the content type that was found ** in the specified file. **/ -#define CFE_TBL_FILE_TYPE_ERR_EID 58 +#define CFE_TBL_FILE_TYPE_ERR_EID 58 /** \brief 'File subtype for '\%s' is wrong. Subtype = 0x\%08X' ** \event 'File subtype for '\%s' is wrong. Subtype = 0x\%08X' @@ -416,7 +414,7 @@ ** ** This event message is generated when either an Application calls the #CFE_TBL_Load API ** or a Table Load command has been received and the specified file has a \link #CFE_FS_Header_t -** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::SubType Sub Type \endlink +** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::SubType Sub Type \endlink ** is not equal to the expected #CFE_FS_SubType_TBL_IMG. Most likely causes for this are: ** -# The specified file is not a cFE table image file. ** -# The specified file has been created with bad "endianess" (headers should always conform to @@ -426,7 +424,7 @@ ** The \c SubType field specified in the event message contains the sub type that was found ** in the specified file. **/ -#define CFE_TBL_FILE_SUBTYPE_ERR_EID 59 +#define CFE_TBL_FILE_SUBTYPE_ERR_EID 59 /** \brief 'No working buffers available for table '\%s'' ** \event 'No working buffers available for table '\%s'' @@ -437,12 +435,12 @@ ** ** This event message is generated when either a Table Load Command for a Single Buffered Table ** or a Table Dump Command for a Dump Only Table has been sent AND there are no Shared Buffers -** available to hold either the load image or the dump image. To free a Shared Buffer, either +** available to hold either the load image or the dump image. To free a Shared Buffer, either ** a previously loaded table image must be activated or aborted OR the operator has to wait for ** previously dumped Dump Only tables have had a chance to be written to a file (which occurs ** whenever the cFE Table Services receives a Housekeeping Request). **/ -#define CFE_TBL_NO_WORK_BUFFERS_ERR_EID 60 +#define CFE_TBL_NO_WORK_BUFFERS_ERR_EID 60 /** \brief 'Internal Error (Status=0x\%08X)' ** \event 'Internal Error (Status=0x\%08X)' @@ -456,7 +454,7 @@ ** ** The \c Status field provides the return status from the function that was to provide a working buffer. **/ -#define CFE_TBL_INTERNAL_ERROR_ERR_EID 61 +#define CFE_TBL_INTERNAL_ERROR_ERR_EID 61 /** \brief 'Error creating dump file '\%s', Status=0x\%08X' ** \event 'Error creating dump file '\%s', Status=0x\%08X' @@ -465,12 +463,12 @@ ** ** \par Cause: ** -** This event message is generated when a Table Dump or Table Registry Dump command was +** This event message is generated when a Table Dump or Table Registry Dump command was ** received and the cFE Table Services is unable to create the specified file. ** ** The \c Status field provides the return status from the #OS_OpenCreate function call. **/ -#define CFE_TBL_CREATING_DUMP_FILE_ERR_EID 62 +#define CFE_TBL_CREATING_DUMP_FILE_ERR_EID 62 /** \brief 'Error writing cFE File Header to '\%s', Status=0x\%08X' ** \event 'Error writing cFE File Header to '\%s', Status=0x\%08X' @@ -479,13 +477,13 @@ ** ** \par Cause: ** -** This event message is generated when a Table Dump or Table Registry Dump command was +** This event message is generated when a Table Dump or Table Registry Dump command was ** received and the cFE Table Services is unable to write the standard cFE File Header ** to the specified file. ** ** The \c Status field provides the return status from the #CFE_FS_WriteHeader function call. **/ -#define CFE_TBL_WRITE_CFE_HDR_ERR_EID 63 +#define CFE_TBL_WRITE_CFE_HDR_ERR_EID 63 /** \brief 'Error writing Tbl image File Header to '\%s', Status=0x\%08X' ** \event 'Error writing Tbl image File Header to '\%s', Status=0x\%08X' @@ -494,12 +492,12 @@ ** ** \par Cause: ** -** This event message is generated when a Table Dump command was received and the +** This event message is generated when a Table Dump command was received and the ** cFE Table Services is unable to write the standard cFE Table Image Header to the specified file. ** ** The \c Status field provides the return status from the #OS_write function call. **/ -#define CFE_TBL_WRITE_TBL_HDR_ERR_EID 64 +#define CFE_TBL_WRITE_TBL_HDR_ERR_EID 64 /** \brief 'Error writing Tbl image to '\%s', Status=0x\%08X' ** \event 'Error writing Tbl image to '\%s', Status=0x\%08X' @@ -508,13 +506,13 @@ ** ** \par Cause: ** -** This event message is generated when a Table Dump command was received and the -** cFE Table Services is unable to write the contents of the specified Table image to +** This event message is generated when a Table Dump command was received and the +** cFE Table Services is unable to write the contents of the specified Table image to ** the specified file. ** ** The \c Status field provides the return status from the #OS_write function call. **/ -#define CFE_TBL_WRITE_TBL_IMG_ERR_EID 65 +#define CFE_TBL_WRITE_TBL_IMG_ERR_EID 65 /** \brief 'No Inactive Buffer for Table '\%s' present' ** \event 'No Inactive Buffer for Table '\%s' present' @@ -527,7 +525,7 @@ ** Inactive Table Buffer was received and there isn't an Inactive Table Buffer associated ** with the specified Table. **/ -#define CFE_TBL_NO_INACTIVE_BUFFER_ERR_EID 66 +#define CFE_TBL_NO_INACTIVE_BUFFER_ERR_EID 66 /** \brief 'Too many Table Validations have been requested' ** \event 'Too many Table Validations have been requested' @@ -545,7 +543,7 @@ ** command until the result of the Validation, performed by the table's owning Application, has ** been reported in a Table Services Housekeeping Request Message. **/ -#define CFE_TBL_TOO_MANY_VALIDATIONS_ERR_EID 67 +#define CFE_TBL_TOO_MANY_VALIDATIONS_ERR_EID 67 /** \brief 'Error writing Registry to '\%s', Status=0x\%08X' ** \event 'Error writing Registry to '\%s', Status=0x\%08X' @@ -554,13 +552,13 @@ ** ** \par Cause: ** -** This event message is generated when a Table Registry Dump command was received and the -** cFE Table Services is unable to write the entire contents of the Table Registry to +** This event message is generated when a Table Registry Dump command was received and the +** cFE Table Services is unable to write the entire contents of the Table Registry to ** the specified file. ** ** The \c Status field provides the return status from the #OS_write function call. **/ -#define CFE_TBL_WRITE_TBL_REG_ERR_EID 68 +#define CFE_TBL_WRITE_TBL_REG_ERR_EID 68 /** \brief 'Cannot abort load of '\%s'. No load started.' ** \event 'Cannot abort load of '\%s'. No load started.' @@ -572,7 +570,7 @@ ** This event message is generated when an Abort Load command is received and the command specified ** table is not currently in the process of being loaded. **/ -#define CFE_TBL_LOAD_ABORT_ERR_EID 69 +#define CFE_TBL_LOAD_ABORT_ERR_EID 69 /** \brief 'Cannot activate table '\%s'. No Inactive image available' ** \event 'Cannot activate table '\%s'. No Inactive image available' @@ -584,7 +582,7 @@ ** This event message is generated when an Activate Table command is received and the command specified ** table does not currently have an inactive buffer associated with it. **/ -#define CFE_TBL_ACTIVATE_ERR_EID 70 +#define CFE_TBL_ACTIVATE_ERR_EID 70 /** \brief 'Incomplete load of '\%s' into '\%s' working buffer' ** \event 'Incomplete load of '\%s' into '\%s' working buffer' @@ -597,7 +595,7 @@ ** is unable to load the number of bytes specified in the Table Image Header of the command ** specified file from the file into the Inactive Buffer. **/ -#define CFE_TBL_FILE_INCOMPLETE_ERR_EID 71 +#define CFE_TBL_FILE_INCOMPLETE_ERR_EID 71 /** \brief 'Cannot load '\%s' (\%d) at offset \%d in '\%s' (\%d)' ** \event 'Cannot load '\%s' (\%d) at offset \%d in '\%s' (\%d)' @@ -615,7 +613,7 @@ ** The numbers in parenthesis in the event message text indicate the data size (in bytes) for ** the specified load file and the registered size for the specified table. **/ -#define CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID 72 +#define CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID 72 /** \brief 'Table Hdr in '\%s' indicates no data in file' ** \event 'Table Hdr in '\%s' indicates no data in file' @@ -627,7 +625,7 @@ ** This event message is generated when a Load Table command is received and the Table Header in ** the specified Table Image file claims the file contains no data. **/ -#define CFE_TBL_ZERO_LENGTH_LOAD_ERR_EID 73 +#define CFE_TBL_ZERO_LENGTH_LOAD_ERR_EID 73 /** \brief ''\%s' has partial load for uninitialized table '\%s'' ** \event ''\%s' has partial load for uninitialized table '\%s'' @@ -641,7 +639,7 @@ ** table has never been previously, completely loaded. Partial Table loads are only allowed after ** the table has had a successful load. **/ -#define CFE_TBL_PARTIAL_LOAD_ERR_EID 74 +#define CFE_TBL_PARTIAL_LOAD_ERR_EID 74 /** \brief 'File '\%s' has more data than Tbl Hdr indicates (\%d)' ** \event 'File '\%s' has more data than Tbl Hdr indicates (\%d)' @@ -653,7 +651,7 @@ ** This event message is generated when a Load Table command is received and Table Services is ** able to locate more data in the specified Table Image file than the Table Header claims is present. **/ -#define CFE_TBL_FILE_TOO_BIG_ERR_EID 75 +#define CFE_TBL_FILE_TOO_BIG_ERR_EID 75 /** \brief 'Too many Dump Only Table Dumps have been requested' ** \event 'Too many Dump Only Table Dumps have been requested' @@ -664,10 +662,10 @@ ** ** This event message is generated when a Table Dump command for a Dump-Only Table was received and there are ** no more free Dump Only Control Blocks available. The number of simultaneous Dump Only Tables that -** can be pending is specified by the configuration parameter #CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS which +** can be pending is specified by the configuration parameter #CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS which ** is found in the cfe_platform_cfg.h file. **/ -#define CFE_TBL_TOO_MANY_DUMPS_ERR_EID 76 +#define CFE_TBL_TOO_MANY_DUMPS_ERR_EID 76 /** \brief 'A dump for '\%s' is already pending' ** \event 'A dump for '\%s' is already pending' @@ -676,10 +674,10 @@ ** ** \par Cause: ** -** This event message is generated when a Table Dump command for a Dump-Only Table was received and +** This event message is generated when a Table Dump command for a Dump-Only Table was received and ** Table Services hasn't finished processing the previous Table Dump command for the same Table. **/ -#define CFE_TBL_DUMP_PENDING_ERR_EID 77 +#define CFE_TBL_DUMP_PENDING_ERR_EID 77 /** \brief 'Illegal attempt to activate dump-only table '\%s'' ** \event 'Illegal attempt to activate dump-only table '\%s'' @@ -691,7 +689,7 @@ ** This event message is generated when a Table Activate command for a Dump-Only Table was received. ** By definition, Dump-Only tables are not allowed to be loaded with any new data. **/ -#define CFE_TBL_ACTIVATE_DUMP_ONLY_ERR_EID 78 +#define CFE_TBL_ACTIVATE_DUMP_ONLY_ERR_EID 78 /** \brief 'Attempted to load DUMP-ONLY table '\%s' from '\%s'' ** \event 'Attempted to load DUMP-ONLY table '\%s' from '\%s'' @@ -703,7 +701,7 @@ ** This event message is generated when a Table Load command for a Dump-Only Table was received. ** By definition, Dump-Only tables are not allowed to be loaded with any new data. **/ -#define CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID 79 +#define CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID 79 /** \brief 'Cmd for Table '\%s' had illegal buffer parameter (0x\%08X)' ** \event 'Cmd for Table '\%s' had illegal buffer parameter (0x\%08X)' @@ -713,12 +711,12 @@ ** \par Cause: ** ** This event message is generated when either a Table Validate command or a Table Dump Command -** contains a buffer identifier that does not equal either of the valid values +** contains a buffer identifier that does not equal either of the valid values ** (see #CFE_TBL_DumpCmd_Payload_t::ActiveTableFlag or #CFE_TBL_ValidateCmd_Payload_t::ActiveTableFlag) ** ** The parameter in the Event Message indicates (in hex) the value found for the ActiveTableFlag in the command. **/ -#define CFE_TBL_ILLEGAL_BUFF_PARAM_ERR_EID 80 +#define CFE_TBL_ILLEGAL_BUFF_PARAM_ERR_EID 80 /** \brief 'Cannot activate table '\%s'. Inactive image not Validated' ** \event 'Cannot activate table '\%s'. Inactive image not Validated' @@ -732,7 +730,7 @@ ** (as defined by the owning Application when the Table is first Registered), then the Inactive Image ** MUST be successfully Validated prior to Activation. **/ -#define CFE_TBL_UNVALIDATED_ERR_EID 81 +#define CFE_TBL_UNVALIDATED_ERR_EID 81 /** \brief ''\%s' found in Table Registry. CDS cannot be deleted until table is unregistered' ** \event ''\%s' found in Table Registry. CDS cannot be deleted until table is unregistered' @@ -745,7 +743,7 @@ ** a Table Image that is still registered. Critical Table Images cannot be removed from the CDS until the ** table is first removed from the Registry. Unload the owning application and try again. **/ -#define CFE_TBL_IN_REGISTRY_ERR_EID 82 +#define CFE_TBL_IN_REGISTRY_ERR_EID 82 /** \brief 'Table '\%s' is in Critical Table Registry but CDS is not tagged as a table' ** \event 'Table '\%s' is in Critical Table Registry but CDS is not tagged as a table' @@ -758,7 +756,7 @@ ** a CDS name for a Critical Data Store that is NOT a critical table image. To delete CDSs that are not ** Critical Table Images, the Executive Services command #CFE_ES_DELETE_CDS_CC must be used. **/ -#define CFE_TBL_NOT_CRITICAL_TBL_ERR_EID 83 +#define CFE_TBL_NOT_CRITICAL_TBL_ERR_EID 83 /** \brief 'Table '\%s' is not found in Critical Table Registry' ** \event 'Table '\%s' is not found in Critical Table Registry' @@ -770,9 +768,9 @@ ** This event message is generated when a Table Delete Critical Data Store command is received specifying ** a table name that cannot be found in the Critical Table Registry. If a Critical Data Store exists with ** the specified name, then the Critical Table Registry has somehow gotten out of sync with the CDS. -** Otherwise, the likely cause of this error is a misspelled table name in the command. +** Otherwise, the likely cause of this error is a misspelled table name in the command. **/ -#define CFE_TBL_NOT_IN_CRIT_REG_ERR_EID 84 +#define CFE_TBL_NOT_IN_CRIT_REG_ERR_EID 84 /** \brief 'Unable to locate '\%s' in CDS Registry' ** \event 'Unable to locate '\%s' in CDS Registry' @@ -783,9 +781,9 @@ ** ** This event message is generated when a Table Delete Critical Data Store command is received specifying ** a table name that WAS found in the Critical Table Registry but its associated entry in the Critical Data -** Store Registry was not found. Somehow the two entities have become out of synch. +** Store Registry was not found. Somehow the two entities have become out of synch. **/ -#define CFE_TBL_CDS_NOT_FOUND_ERR_EID 85 +#define CFE_TBL_CDS_NOT_FOUND_ERR_EID 85 /** \brief 'Error while deleting '\%s' from CDS, See SysLog.(Err=0x\%08X)' ** \event 'Error while deleting '\%s' from CDS, See SysLog.(Err=0x\%08X)' @@ -795,9 +793,9 @@ ** \par Cause: ** ** This event message is generated when an unexpected error was encountered during the deletion of the CDS. -** The System Log should have more precise information on the nature of the error. +** The System Log should have more precise information on the nature of the error. **/ -#define CFE_TBL_CDS_DELETE_ERR_EID 86 +#define CFE_TBL_CDS_DELETE_ERR_EID 86 /** \brief 'CDS '\%s' owning app is still active' ** \event 'CDS '\%s' owning app is still active' @@ -808,9 +806,9 @@ ** ** This event message is generated when an attempt is made to delete a CDS while an application with the ** same name as the CDS Prefix is still registered in the system. Owning applications must not be active -** before an associated CDS can be deleted. +** before an associated CDS can be deleted. **/ -#define CFE_TBL_CDS_OWNER_ACTIVE_ERR_EID 87 +#define CFE_TBL_CDS_OWNER_ACTIVE_ERR_EID 87 /** \brief 'Attempted to load table '\%s' while previous load is still pending' ** \event 'Attempted to load table '\%s' while previous load is still pending' @@ -822,9 +820,9 @@ ** This event message is generated when an attempt is made to load a table while a previous load is still ** pending. The most likely cause of this is the owning application is waiting for an appropriate time to ** load the table with the specified contents. In order to override this load, the user would be required -** to issue the \link #CFE_TBL_ABORT_LOAD_CC Abort Load Command \endlink. +** to issue the \link #CFE_TBL_ABORT_LOAD_CC Abort Load Command \endlink. **/ -#define CFE_TBL_LOADING_PENDING_ERR_EID 88 +#define CFE_TBL_LOADING_PENDING_ERR_EID 88 /** \brief 'Manage Notification Pkt Error(MsgId=0x\%08X, CC=0x\%04X, Param=0x\%08X, Status=0x\%08X)' ** \event 'Manage Notification Pkt Error(MsgId=0x\%08X, CC=0x\%04X, Param=0x\%08X, Status=0x\%08X)' @@ -840,10 +838,9 @@ ** 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. **/ -#define CFE_TBL_FAIL_NOTIFY_SEND_ERR_EID 89 +#define CFE_TBL_FAIL_NOTIFY_SEND_ERR_EID 89 /** \} */ - /** \name API Informational Event Message IDs */ /** \{ */ @@ -858,7 +855,7 @@ ** with the contents of the Application specified file or memory area. This Event Message only ** appears when an Application successfully calls the #CFE_TBL_Load API. **/ -#define CFE_TBL_LOAD_SUCCESS_INF_EID 35 +#define CFE_TBL_LOAD_SUCCESS_INF_EID 35 /** \brief '\%s validation successful for Inactive '\%s'' ** \event '\%s validation successful for Inactive '\%s'' @@ -871,7 +868,7 @@ ** Application via the Validation function specified by the owning Application when the table ** was first registered. **/ -#define CFE_TBL_VALIDATION_INF_EID 36 +#define CFE_TBL_VALIDATION_INF_EID 36 /** \brief '\%s Successfully Updated '\%s'' ** \event '\%s Successfully Updated '\%s'' @@ -883,7 +880,7 @@ ** This event message is generated when a Table's Active Buffer is successfully updated with the contents ** of its Inactive Buffer. **/ -#define CFE_TBL_UPDATE_SUCCESS_INF_EID 37 +#define CFE_TBL_UPDATE_SUCCESS_INF_EID 37 /** \brief 'Successfully removed '\%s' from CDS' ** \event 'Successfully removed '\%s' from CDS' @@ -894,10 +891,9 @@ ** ** This event message is generated when a Critical Table's CDS has been successfully deleted. **/ -#define CFE_TBL_CDS_DELETED_INFO_EID 38 +#define CFE_TBL_CDS_DELETED_INFO_EID 38 /** \} */ - /** \name API Error Event Message IDs */ /** \{ */ /** \brief '\%s Failed to Register '\%s', Status=0x\%08X' @@ -912,7 +908,7 @@ ** The \c Status field of the Event Message can be used to identify the reason for the failure ** by looking it up in the cfe_error.h file **/ -#define CFE_TBL_REGISTER_ERR_EID 90 +#define CFE_TBL_REGISTER_ERR_EID 90 /** \brief '\%s Failed to Share '\%s', Status=0x\%08X' ** \event '\%s Failed to Share '\%s', Status=0x\%08X' @@ -926,7 +922,7 @@ ** The \c Status field of the Event Message can be used to identify the reason for the failure ** by looking it up in the cfe_error.h file **/ -#define CFE_TBL_SHARE_ERR_EID 91 +#define CFE_TBL_SHARE_ERR_EID 91 /** \brief '\%s Failed to Unregister '\%s', Status=0x\%08X' ** \event '\%s Failed to Unregister '\%s', Status=0x\%08X' @@ -940,10 +936,10 @@ ** The \c Status field of the Event Message can be used to identify the reason for the failure ** by looking it up in the cfe_error.h file **/ -#define CFE_TBL_UNREGISTER_ERR_EID 92 +#define CFE_TBL_UNREGISTER_ERR_EID 92 /* TODO: document see https://github.com/nasa/cFE/issues/661 */ -#define CFE_TBL_LOAD_VAL_ERR_EID 93 +#define CFE_TBL_LOAD_VAL_ERR_EID 93 /** \brief '\%s Failed to Load '\%s' (Invalid Source Type)" ** \event '\%s Failed to Load '\%s' (Invalid Source Type)" @@ -955,7 +951,7 @@ ** This event message is generated when an Application calls #CFE_TBL_Load with a bad value for ** the \c SrcType parameter. The \c SrcType must be one of the values specified by #CFE_TBL_SrcEnum_t. **/ -#define CFE_TBL_LOAD_TYPE_ERR_EID 94 +#define CFE_TBL_LOAD_TYPE_ERR_EID 94 /** \brief '\%s Failed to Update '\%s', Status=0x\%08X" ** \event '\%s Failed to Update '\%s', Status=0x\%08X" @@ -970,7 +966,7 @@ ** The \c Status parameter in the Event Message can be used to identify the reason for the failure ** by looking it up in the cfe_error.h file. **/ -#define CFE_TBL_UPDATE_ERR_EID 95 +#define CFE_TBL_UPDATE_ERR_EID 95 /** \brief '\%s validation failed for Inactive '\%s', Status=0x\%08X' ** \event '\%s validation failed for Inactive '\%s', Status=0x\%08X' @@ -985,7 +981,7 @@ ** The \c Status parameter in the Event Message contains the status code returned by the Table's ** Validation function as defined by the owning Application when the Table was Registered. **/ -#define CFE_TBL_VALIDATION_ERR_EID 96 +#define CFE_TBL_VALIDATION_ERR_EID 96 /** \brief 'Unable to verify Spacecraft ID for '\%s', ID = 0x\%08X' ** \event 'Unable to verify Spacecraft ID for '\%s', ID = 0x\%08X' @@ -999,7 +995,7 @@ ** Verification of Spacecraft ID in table files is enabled/disabled via #CFE_PLATFORM_TBL_VALID_SCID_COUNT, ** defined in the platform configuration header file. This event message can only be generated if ** #CFE_PLATFORM_TBL_VALID_SCID_COUNT has a non-zero value and the table file has a \link #CFE_FS_Header_t -** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::SpacecraftID Spacecraft ID \endlink +** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::SpacecraftID Spacecraft ID \endlink ** does not match one of the values defined for Spacecraft ID verification in the platform config file. ** The most likely causes for this error are: ** -# The specified table file is not intended for this spacecraft. @@ -1013,7 +1009,7 @@ ** The \c ID field specified in the event message contains the Spacecraft ID that was found ** in the specified table file. **/ -#define CFE_TBL_SPACECRAFT_ID_ERR_EID 97 +#define CFE_TBL_SPACECRAFT_ID_ERR_EID 97 /** \brief 'Unable to verify Processor ID for '\%s', ID = 0x\%08X' ** \event 'Unable to verify Processor ID for '\%s', ID = 0x\%08X' @@ -1027,7 +1023,7 @@ ** Verification of Processor ID in table files is enabled/disabled via #CFE_PLATFORM_TBL_VALID_PRID_COUNT, ** defined in the platform configuration header file. This event message can only be generated if ** #CFE_PLATFORM_TBL_VALID_PRID_COUNT has a non-zero value and the table file has a \link #CFE_FS_Header_t -** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::ProcessorID Processor ID \endlink +** cFE Standard File Header \endlink whose \link #CFE_FS_Header_t::ProcessorID Processor ID \endlink ** does not match one of the values defined for Processor ID verification in the platform config file. ** The most likely causes for this error are: ** -# The specified table file is not intended for this processor. @@ -1041,7 +1037,7 @@ ** The \c ID field specified in the event message contains the Processor ID that was found ** in the specified table file. **/ -#define CFE_TBL_PROCESSOR_ID_ERR_EID 98 +#define CFE_TBL_PROCESSOR_ID_ERR_EID 98 /** \brief Attempted to load Dump Only Tbl '%s' ** \event Attempted to load Dump Only Tbl '%s' @@ -1052,7 +1048,7 @@ ** ** This event message is generated when an application attempts to load a dump-only table. **/ -#define CFE_TBL_LOAD_DUMPONLY_ERR_EID 99 +#define CFE_TBL_LOAD_DUMPONLY_ERR_EID 99 /** \brief Load already in progress for '%s' ** \event Load already in progress for '%s' @@ -1064,7 +1060,7 @@ ** This event message is generated when an application attempts to load a table already ** in progress. Likely due to a race condition. **/ -#define CFE_TBL_LOAD_IN_PROGRESS_ERR_EID 100 +#define CFE_TBL_LOAD_IN_PROGRESS_ERR_EID 100 /** \brief Filename is too long ('%s' (%lu) > %lu) ** \event Filename is too long ('%s' (%lu) > %lu) @@ -1075,7 +1071,7 @@ ** ** The filename provided for the table file is too long (exceeding OS_MAX_PATH_LEN - 1). **/ -#define CFE_TBL_LOAD_FILENAME_LONG_ERR_EID 101 +#define CFE_TBL_LOAD_FILENAME_LONG_ERR_EID 101 /** \brief table name mismatch (exp=%s, tblfilhdr=%s) ** \event table name mismatch (exp=%s, tblfilhdr=%s) @@ -1086,7 +1082,7 @@ ** ** The table name in the table file header does not match the specified table name. **/ -#define CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID 102 +#define CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID 102 /** \brief No access to Tbl handle=%d ** \event No access to Tbl handle=%d @@ -1097,11 +1093,10 @@ ** ** The application ID does not have access to the table handle. **/ -#define CFE_TBL_HANDLE_ACCESS_ERR_EID 103 +#define CFE_TBL_HANDLE_ACCESS_ERR_EID 103 /** \} */ - #endif /* _cfe_tbl_events_ */ /************************/ diff --git a/modules/tbl/fsw/inc/cfe_tbl_msg.h b/modules/tbl/fsw/inc/cfe_tbl_msg.h index 54a9ad1a5..5c05d7563 100644 --- a/modules/tbl/fsw/inc/cfe_tbl_msg.h +++ b/modules/tbl/fsw/inc/cfe_tbl_msg.h @@ -38,8 +38,8 @@ /* ** Required header files... */ -#include "common_types.h" /* Basic data types */ -#include "cfe_msg_hdr.h" /* for header definitions */ +#include "common_types.h" /* Basic data types */ +#include "cfe_msg_hdr.h" /* for header definitions */ #include "cfe_tbl_extern_typedefs.h" #include "cfe_time_extern_typedefs.h" @@ -54,8 +54,8 @@ /** \cfetblcmd Table No-Op ** ** \par Description -** This command performs no other function than to increment the -** command execution counter. The command may be used to verify +** This command performs no other function than to increment the +** command execution counter. The command may be used to verify ** general aliveness of the Table Services task. ** ** \cfecmdmnemonic \TBL_NOOP @@ -64,30 +64,30 @@ ** #CFE_TBL_NoopCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \TBL_CMDPC - command execution counter will +** - \b \c \TBL_CMDPC - command execution counter will ** increment -** - The #CFE_TBL_NOOP_INF_EID informational event message will +** - The #CFE_TBL_NOOP_INF_EID informational event message will ** be generated ** ** \par Error Conditions -** There are no error conditions for this command. If the Table -** Services receives the command, the event is sent (although it -** may be filtered by EVS) and the counter is incremented +** There are no error conditions for this command. If the Table +** Services receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented ** unconditionally. ** ** \par Criticality ** None ** -** \sa +** \sa */ -#define CFE_TBL_NOOP_CC 0 +#define CFE_TBL_NOOP_CC 0 /** \cfetblcmd Table Reset Counters ** ** \par Description -** This command resets the following counters within the Table +** This command resets the following counters within the Table ** Services housekeeping telemetry: ** - Command Execution Counter (\TBL_CMDPC) ** - Command Error Counter (\TBL_CMDEC) @@ -101,33 +101,33 @@ ** #CFE_TBL_ResetCountersCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \TBL_CMDPC - command execution counter will +** - \b \c \TBL_CMDPC - command execution counter will ** increment -** - The #CFE_TBL_RESET_INF_EID debug event message will be +** - The #CFE_TBL_RESET_INF_EID debug event message will be ** generated ** ** \par Error Conditions -** There are no error conditions for this command. If the Table -** Services receives the command, the event is sent (although it -** may be filtered by EVS) and the counter is incremented +** There are no error conditions for this command. If the Table +** Services receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented ** unconditionally. ** ** \par Criticality -** This command is not inherently dangerous. However, it is -** possible for ground systems and on-board safing procedures -** to be designed such that they react to changes in the counter +** This command is not inherently dangerous. However, it is +** possible for ground systems and on-board safing procedures +** to be designed such that they react to changes in the counter ** values that are reset by this command. ** -** \sa +** \sa */ -#define CFE_TBL_RESET_COUNTERS_CC 1 +#define CFE_TBL_RESET_COUNTERS_CC 1 /** \cfetblcmd Load Table ** ** \par Description -** This command loads the contents of the specified file into +** This command loads the contents of the specified file into ** an inactive buffer for the table specified within the file. ** ** \cfecmdmnemonic \TBL_LOAD @@ -136,32 +136,32 @@ ** #CFE_TBL_LoadCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with +** Successful execution of this command may be verified with ** the following telemetry: -** - \b \c \TBL_CMDPC - command execution counter will +** - \b \c \TBL_CMDPC - command execution counter will ** increment -** - The #CFE_TBL_FILE_LOADED_INF_EID informational event message +** - The #CFE_TBL_FILE_LOADED_INF_EID informational event message ** will be generated ** ** \par Error Conditions ** This command can fail for the following reasons: -** - Table name found in table image file's table header is not found -** in table registry (ie - The table associated with the table image +** - Table name found in table image file's table header is not found +** in table registry (ie - The table associated with the table image ** in the file has not been registered by an application). -** - The table image file's header indicates the file contains 'x' +** - The table image file's header indicates the file contains 'x' ** number of bytes of data but the file contains less. -** - No working buffers are available for the load. This would indicate -** that too many single-buffered table loads are in progress at the same +** - No working buffers are available for the load. This would indicate +** that too many single-buffered table loads are in progress at the same ** time. -** - The table image file's header indicates the data to be loaded is -** beyond the size of the table. Either the number of bytes in the +** - The table image file's header indicates the data to be loaded is +** beyond the size of the table. Either the number of bytes in the ** file are too many or the starting offset into the table is too high. -** - The table image file's header indicates there is no data in the +** - The table image file's header indicates there is no data in the ** file (ie - Number of bytes to load is zero). -** - An attempt is being made to load an uninitialized table with a file +** - An attempt is being made to load an uninitialized table with a file ** containing only a partial table image. -** - The table image file was unable to be opened. Either the file does -** not exist at the specified location, the filename is in error, or +** - The table image file was unable to be opened. Either the file does +** not exist at the specified location, the filename is in error, or ** the file system has been corrupted. ** ** Evidence of failure may be found in the following telemetry: @@ -169,20 +169,20 @@ ** - Command specific error event messages are issued for all error cases ** ** \par Criticality -** This command is not inherently dangerous. It is performing the first -** step of loading a table and can be aborted (using the Abort Table Load -** command described below) without affecting the contents of the active +** This command is not inherently dangerous. It is performing the first +** step of loading a table and can be aborted (using the Abort Table Load +** command described below) without affecting the contents of the active ** table image. ** ** \sa #CFE_TBL_DUMP_CC, #CFE_TBL_VALIDATE_CC, #CFE_TBL_ACTIVATE_CC, #CFE_TBL_ABORT_LOAD_CC */ -#define CFE_TBL_LOAD_CC 2 +#define CFE_TBL_LOAD_CC 2 /** \cfetblcmd Dump Table ** ** \par Description -** This command will cause the Table Services to put the contents -** of the specified table buffer into the command specified file. +** This command will cause the Table Services to put the contents +** of the specified table buffer into the command specified file. ** ** \cfecmdmnemonic \TBL_DUMP ** @@ -190,45 +190,45 @@ ** #CFE_TBL_DumpCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \TBL_CMDPC - command execution counter will +** - \b \c \TBL_CMDPC - command execution counter will ** increment ** - Either the #CFE_TBL_OVERWRITE_DUMP_INF_EID OR the -** #CFE_TBL_WRITE_DUMP_INF_EID informational event message will +** #CFE_TBL_WRITE_DUMP_INF_EID informational event message will ** be generated ** ** \par Error Conditions ** This command may fail for the following reason(s): -** - A single buffered table's inactive buffer was requested to be +** - A single buffered table's inactive buffer was requested to be ** dumped and no such buffer is currently allocated. -** - Error occurred during write operation to file. Possible causes -** might be insufficient space in the file system or the filename +** - Error occurred during write operation to file. Possible causes +** might be insufficient space in the file system or the filename ** or file path is improperly specified. ** - The specified table name was not found in the table registry. ** ** Evidence of failure may be found in the following telemetry: ** - \b \c \TBL_CMDEC - command error counter will increment -** - A command specific error event message is issued for all error +** - A command specific error event message is issued for all error ** cases ** ** \par Criticality -** This command is not inherently dangerous. It will create a new -** file in the file system and could, if performed repeatedly without +** This command is not inherently dangerous. It will create a new +** file in the file system and could, if performed repeatedly without ** sufficient file management by the operator, fill the file system. ** ** \sa #CFE_TBL_LOAD_CC, #CFE_TBL_VALIDATE_CC, #CFE_TBL_ACTIVATE_CC, #CFE_TBL_ABORT_LOAD_CC */ -#define CFE_TBL_DUMP_CC 3 +#define CFE_TBL_DUMP_CC 3 /** \cfetblcmd Validate Table ** ** \par Description -** This command will cause Table Services to calculate the Data Integrity -** Value for the specified table and to notify the owning application that -** the table's validation function should be executed. The results of both -** the Data Integrity Value computation and the validation function are -** reported in Table Services Housekeeping Telemetry. +** This command will cause Table Services to calculate the Data Integrity +** Value for the specified table and to notify the owning application that +** the table's validation function should be executed. The results of both +** the Data Integrity Value computation and the validation function are +** reported in Table Services Housekeeping Telemetry. ** ** \cfecmdmnemonic \TBL_VALIDATE ** @@ -236,55 +236,55 @@ ** #CFE_TBL_ValidateCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the following +** Successful execution of this command may be verified with the following ** telemetry: ** - \b \c \TBL_CMDPC - command execution counter will increment ** - \b \c \TBL_VALREQCTR - table validation request counter will increment ** - \b \c \TBL_LASTVALCRC - calculated data integrity value will be updated -** - The #CFE_TBL_VAL_REQ_MADE_INF_EID debug event message (indicating the +** - The #CFE_TBL_VAL_REQ_MADE_INF_EID debug event message (indicating the ** application is being notified of a validation request) -** -** If the specified table has an associated validation function, then the +** +** If the specified table has an associated validation function, then the ** following telemetry will also change: -** - Either \b \c \TBL_VALSUCCESSCTR OR \b \c \TBL_VALFAILEDCTR will +** - Either \b \c \TBL_VALSUCCESSCTR OR \b \c \TBL_VALFAILEDCTR will ** increment -** - \b \c \TBL_VALCOMPLTDCTR - table validations performed counter will +** - \b \c \TBL_VALCOMPLTDCTR - table validations performed counter will ** increment -** - \b \c \TBL_LASTVALS - table validation function return status will +** - \b \c \TBL_LASTVALS - table validation function return status will ** update -** - The #CFE_TBL_VALIDATION_INF_EID informational event message (indicating the +** - The #CFE_TBL_VALIDATION_INF_EID informational event message (indicating the ** validation function return status) will be generated ** ** \par Error Conditions ** This command may fail for the following reason(s): -** - A single buffered table's inactive buffer was requested to be dumped +** - A single buffered table's inactive buffer was requested to be dumped ** and no such buffer is currently allocated. -** - Too many validations have been requested simultaneously. The operator -** must wait for one or more applications to perform their table validation +** - Too many validations have been requested simultaneously. The operator +** must wait for one or more applications to perform their table validation ** functions before trying again. ** - The specified table name was not found in the table registry. -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \TBL_CMDEC - command error counter will increment ** - Command specific error event message are issued for all error cases ** ** \par Criticality -** The success or failure of a table validation does not have any immediate -** impact on table contents. The results are sent to the operator in telemetry -** and the operator must determine whether the results are acceptable and send a +** The success or failure of a table validation does not have any immediate +** impact on table contents. The results are sent to the operator in telemetry +** and the operator must determine whether the results are acceptable and send a ** command to activate the validated table image. ** ** \sa #CFE_TBL_LOAD_CC, #CFE_TBL_DUMP_CC, #CFE_TBL_ACTIVATE_CC, #CFE_TBL_ABORT_LOAD_CC */ -#define CFE_TBL_VALIDATE_CC 4 +#define CFE_TBL_VALIDATE_CC 4 /** \cfetblcmd Activate Table ** ** \par Description -** This command will cause Table Services to notify a table's owner -** that an update is pending. The owning application will then update -** the contents of the active table buffer with the contents of the -** associated inactive table buffer at a time of their convenience. +** This command will cause Table Services to notify a table's owner +** that an update is pending. The owning application will then update +** the contents of the active table buffer with the contents of the +** associated inactive table buffer at a time of their convenience. ** ** \cfecmdmnemonic \TBL_ACTIVATE ** @@ -292,39 +292,39 @@ ** #CFE_TBL_ActivateCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \TBL_CMDPC - command execution counter will +** - \b \c \TBL_CMDPC - command execution counter will ** increment -** - The #CFE_TBL_UPDATE_SUCCESS_INF_EID informational event message +** - The #CFE_TBL_UPDATE_SUCCESS_INF_EID informational event message ** will be generated ** ** \par Error Conditions ** This command may fail for the following reason(s): -** - A single buffered table's inactive buffer was requested to be +** - A single buffered table's inactive buffer was requested to be ** dumped and no such buffer is currently allocated. ** - The specified table name was not found in the table registry. -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \TBL_CMDEC - command error counter will increment -** - Command specific error event message are issued for all +** - Command specific error event message are issued for all ** error cases ** ** \par Criticality -** This command will cause the contents of the specified table to be +** This command will cause the contents of the specified table to be ** updated with the contents in the inactive table buffer. ** ** \sa #CFE_TBL_LOAD_CC, #CFE_TBL_DUMP_CC, #CFE_TBL_VALIDATE_CC, #CFE_TBL_ABORT_LOAD_CC */ -#define CFE_TBL_ACTIVATE_CC 5 +#define CFE_TBL_ACTIVATE_CC 5 /** \cfetblcmd Dump Table Registry ** ** \par Description -** This command will cause Table Services to write some of the -** contents of the Table Registry to the command specified file. -** This allows the operator to see the current state and configuration -** of all tables that have been registered with the cFE. +** This command will cause Table Services to write some of the +** contents of the Table Registry to the command specified file. +** This allows the operator to see the current state and configuration +** of all tables that have been registered with the cFE. ** ** \cfecmdmnemonic \TBL_WRITEREG2FILE ** @@ -332,39 +332,39 @@ ** #CFE_TBL_DumpRegistryCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \TBL_CMDPC - command execution counter will +** - \b \c \TBL_CMDPC - command execution counter will ** increment -** - The generation of either #CFE_TBL_OVERWRITE_REG_DUMP_INF_EID +** - The generation of either #CFE_TBL_OVERWRITE_REG_DUMP_INF_EID ** or #CFE_TBL_WRITE_REG_DUMP_INF_EID debug event messages -** - The specified file should appear (or be updated) at the +** - The specified file should appear (or be updated) at the ** specified location in the file system ** ** \par Error Conditions ** This command may fail for the following reason(s): -** - Error occurred during write operation to file. Possible -** causes might be insufficient space in the file system +** - Error occurred during write operation to file. Possible +** causes might be insufficient space in the file system ** or the filename or file path is improperly specified. -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \TBL_CMDEC - command error counter will increment ** - An Error specific event message ** ** \par Criticality -** This command is not inherently dangerous. It will create a new -** file in the file system and could, if performed repeatedly without +** This command is not inherently dangerous. It will create a new +** file in the file system and could, if performed repeatedly without ** sufficient file management by the operator, fill the file system. ** ** \sa #CFE_TBL_SEND_REGISTRY_CC */ -#define CFE_TBL_DUMP_REGISTRY_CC 6 +#define CFE_TBL_DUMP_REGISTRY_CC 6 /** \cfetblcmd Telemeter One Table Registry Entry ** ** \par Description -** This command will cause Table Services to telemeter the contents -** of the Table Registry for the command specified table. +** This command will cause Table Services to telemeter the contents +** of the Table Registry for the command specified table. ** ** \cfecmdmnemonic \TBL_TLMREG ** @@ -372,28 +372,28 @@ ** #CFE_TBL_SendRegistryCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TBL_CMDPC - command execution counter will increment ** - Receipt of a Table Registry Info Packet (see #CFE_TBL_TableRegistryTlm_t) -** - The #CFE_TBL_TLM_REG_CMD_INF_EID debug event message will +** - The #CFE_TBL_TLM_REG_CMD_INF_EID debug event message will ** be generated ** ** \par Error Conditions ** This command may fail for the following reason(s): ** - The specified table name was not found in the table registry. -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \TBL_CMDEC - command error counter will increment ** - Error specific event message ** ** \par Criticality -** This command is not inherently dangerous. It will generate +** This command is not inherently dangerous. It will generate ** additional telemetry. ** ** \sa #CFE_TBL_DUMP_REGISTRY_CC */ -#define CFE_TBL_SEND_REGISTRY_CC 7 +#define CFE_TBL_SEND_REGISTRY_CC 7 /** \cfetblcmd Delete Critical Table from Critical Data Store ** @@ -411,22 +411,22 @@ ** #CFE_TBL_DeleteCDSCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \TBL_CMDPC - command execution counter will +** - \b \c \TBL_CMDPC - command execution counter will ** increment -** - The #CFE_TBL_CDS_DELETED_INFO_EID informational event message +** - The #CFE_TBL_CDS_DELETED_INFO_EID informational event message ** will be generated ** ** \par Error Conditions ** This command may fail for the following reason(s): -** - The specified table name was not found in the critical data +** - The specified table name was not found in the critical data ** store registry ** - The specified table name WAS found in the table registry (all ** registrations/sharing of the table must be unregistered before ** the table's CDS can be deleted) ** - The table's owning application is still active -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \TBL_CMDEC - command error counter will increment ** - Error specific event message @@ -437,16 +437,16 @@ ** ** \sa #CFE_ES_DUMP_CDS_REGISTRY_CC, #CFE_ES_DELETE_CDS_CC */ -#define CFE_TBL_DELETE_CDS_CC 8 +#define CFE_TBL_DELETE_CDS_CC 8 /** \cfetblcmd Abort Table Load ** ** \par Description -** This command will cause Table Services to discard the contents of -** a table buffer that was previously loaded with the data in a file -** as specified by a Table Load command. For single buffered tables, -** the allocated shared working buffer is freed and becomes available -** for other Table Load commands. +** This command will cause Table Services to discard the contents of +** a table buffer that was previously loaded with the data in a file +** as specified by a Table Load command. For single buffered tables, +** the allocated shared working buffer is freed and becomes available +** for other Table Load commands. ** ** \cfecmdmnemonic \TBL_LOADABORT ** @@ -454,19 +454,19 @@ ** #CFE_TBL_AbortLoadCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TBL_CMDPC - command execution counter will increment ** - The #CFE_TBL_LOAD_ABORT_INF_EID informational event message ** is generated -** - If the load was aborted for a single buffered table, the +** - If the load was aborted for a single buffered table, the ** \b \c \TBL_NUMFREESHRBUF telemetry point should increment ** ** \par Error Conditions ** This command may fail for the following reason(s): ** - The specified table name was not found in the table registry. ** - The specified table did not have a load in progress to be aborted. -** +** ** Evidence of failure may be found in the following telemetry: ** - \b \c \TBL_CMDEC - command error counter will increment ** - Error specific event message @@ -476,7 +476,7 @@ ** ** \sa #CFE_TBL_LOAD_CC, #CFE_TBL_DUMP_CC, #CFE_TBL_VALIDATE_CC, #CFE_TBL_ACTIVATE_CC */ -#define CFE_TBL_ABORT_LOAD_CC 9 +#define CFE_TBL_ABORT_LOAD_CC 9 /** \} */ /*************************************************************************/ @@ -514,7 +514,7 @@ typedef CFE_TBL_NoArgsCmd_t CFE_TBL_ResetCountersCmd_t; **/ typedef struct CFE_TBL_LoadCmd_Payload { - char LoadFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename (and path) of data to be loaded */ + char LoadFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename (and path) of data to be loaded */ } CFE_TBL_LoadCmd_Payload_t; /** @@ -533,18 +533,18 @@ typedef struct CFE_TBL_LoadCmd */ typedef struct CFE_TBL_DumpCmd_Payload { - uint16 ActiveTableFlag; /**< \brief #CFE_TBL_BufferSelect_INACTIVE=Inactive Table, - #CFE_TBL_BufferSelect_ACTIVE=Active Table */ - /**< Selects either the "Inactive" - (#CFE_TBL_BufferSelect_INACTIVE) buffer or the - "Active" (#CFE_TBL_BufferSelect_ACTIVE) buffer - to be dumped */ - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full name of table to be dumped */ - /**< ASCII string containing full table name - identifier of table to be dumped */ - char DumpFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full Filename where data is to be written */ - /**< ASCII string containing full path of filename - where data is to be dumped */ + uint16 ActiveTableFlag; /**< \brief #CFE_TBL_BufferSelect_INACTIVE=Inactive Table, + #CFE_TBL_BufferSelect_ACTIVE=Active Table */ + /**< Selects either the "Inactive" + (#CFE_TBL_BufferSelect_INACTIVE) buffer or the + "Active" (#CFE_TBL_BufferSelect_ACTIVE) buffer + to be dumped */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full name of table to be dumped */ + /**< ASCII string containing full table name + identifier of table to be dumped */ + char DumpFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full Filename where data is to be written */ + /**< ASCII string containing full path of filename + where data is to be dumped */ } CFE_TBL_DumpCmd_Payload_t; /** @@ -563,15 +563,15 @@ typedef struct CFE_TBL_DumpCmd */ typedef struct CFE_TBL_ValidateCmd_Payload { - uint16 ActiveTableFlag; /**< \brief #CFE_TBL_BufferSelect_INACTIVE=Inactive Table, - #CFE_TBL_BufferSelect_ACTIVE=Active Table */ - /**< Selects either the "Inactive" - (#CFE_TBL_BufferSelect_INACTIVE) buffer or the - "Active" (#CFE_TBL_BufferSelect_ACTIVE) buffer - to be validated */ - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table to be validated */ - /**< ASCII string containing full table name - identifier of table to be validated */ + uint16 ActiveTableFlag; /**< \brief #CFE_TBL_BufferSelect_INACTIVE=Inactive Table, + #CFE_TBL_BufferSelect_ACTIVE=Active Table */ + /**< Selects either the "Inactive" + (#CFE_TBL_BufferSelect_INACTIVE) buffer or the + "Active" (#CFE_TBL_BufferSelect_ACTIVE) buffer + to be validated */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table to be validated */ + /**< ASCII string containing full table name + identifier of table to be validated */ } CFE_TBL_ValidateCmd_Payload_t; /** @@ -590,9 +590,9 @@ typedef struct CFE_TBL_ValidateCmd */ typedef struct CFE_TBL_ActivateCmd_Payload { - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table to be activated */ - /**< ASCII string containing full table name - identifier of table to be activated */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table to be activated */ + /**< ASCII string containing full table name + identifier of table to be activated */ } CFE_TBL_ActivateCmd_Payload_t; /** @@ -611,10 +611,10 @@ typedef struct CFE_TBL_ActivateCmd */ typedef struct CFE_TBL_DumpRegistryCmd_Payload { - char DumpFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full Filename where dumped data is to be - written */ - /**< ASCII string containing full path of filename - where registry is to be dumped */ + char DumpFilename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full Filename where dumped data is to be + written */ + /**< ASCII string containing full path of filename + where registry is to be dumped */ } CFE_TBL_DumpRegistryCmd_Payload_t; /** @@ -633,11 +633,11 @@ typedef struct CFE_TBL_DumpRegistryCmd */ typedef struct CFE_TBL_SendRegistryCmd_Payload { - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table whose registry entry - is to be telemetered */ - /**< ASCII string containing full table name - identifier of table whose registry entry is - to be telemetered via #CFE_TBL_TableRegistryTlm_t */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table whose registry entry + is to be telemetered */ + /**< ASCII string containing full table name + identifier of table whose registry entry is + to be telemetered via #CFE_TBL_TableRegistryTlm_t */ } CFE_TBL_SendRegistryCmd_Payload_t; /** @@ -656,11 +656,11 @@ typedef struct CFE_TBL_SendRegistryCmd */ typedef struct CFE_TBL_DelCDSCmd_Payload { - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table whose CDS is - to be deleted */ - /**< ASCII string containing full table name - identifier of a critical table whose - CDS is to be deleted */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table whose CDS is + to be deleted */ + /**< ASCII string containing full table name + identifier of a critical table whose + CDS is to be deleted */ } CFE_TBL_DelCDSCmd_Payload_t; /** @@ -679,9 +679,9 @@ typedef struct CFE_TBL_DeleteCDSCmd */ typedef struct CFE_TBL_AbortLoadCmd_Payload { - char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table whose load is to be aborted */ - /**< ASCII string containing full table name - identifier of a table whose load is to be aborted */ + char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \brief Full Name of Table whose load is to be aborted */ + /**< ASCII string containing full table name + identifier of a table whose load is to be aborted */ } CFE_TBL_AbortLoadCmd_Payload_t; /** @@ -693,7 +693,6 @@ typedef struct CFE_TBL_AbortLoadCmd CFE_TBL_AbortLoadCmd_Payload_t Payload; /**< \brief Command paylod */ } CFE_TBL_AbortLoadCmd_t; - /*************************************************************************/ /******************************************/ /* Generated Command Message Data Formats */ @@ -709,7 +708,7 @@ typedef struct CFE_TBL_AbortLoadCmd */ typedef struct CFE_TBL_NotifyCmd_Payload { - uint32 Parameter; /**< \brief Application specified command parameter */ + uint32 Parameter; /**< \brief Application specified command parameter */ } CFE_TBL_NotifyCmd_Payload_t; /** @@ -725,7 +724,7 @@ typedef struct CFE_TBL_NotifyCmd /**********************************/ /* Telemetry Message Data Formats */ /**********************************/ -/** +/** ** \cfetbltlm Table Services Housekeeping Packet **/ typedef struct CFE_TBL_HousekeepingTlm_Payload @@ -733,58 +732,58 @@ typedef struct CFE_TBL_HousekeepingTlm_Payload /* ** Task command interface counters... */ - uint8 CommandCounter; /**< \cfetlmmnemonic \TBL_CMDPC - \brief Count of valid commands received */ - uint8 CommandErrorCounter; /**< \cfetlmmnemonic \TBL_CMDEC - \brief Count of invalid commands received */ + uint8 CommandCounter; /**< \cfetlmmnemonic \TBL_CMDPC + \brief Count of valid commands received */ + uint8 CommandErrorCounter; /**< \cfetlmmnemonic \TBL_CMDEC + \brief Count of invalid commands received */ /* ** Table Registry Statistics */ - uint16 NumTables; /**< \cfetlmmnemonic \TBL_NUMTABLES - \brief Number of Tables Registered */ - uint16 NumLoadPending; /**< \cfetlmmnemonic \TBL_NUMUPDATESPEND - \brief Number of Tables pending on Applications for their update */ + uint16 NumTables; /**< \cfetlmmnemonic \TBL_NUMTABLES + \brief Number of Tables Registered */ + uint16 NumLoadPending; /**< \cfetlmmnemonic \TBL_NUMUPDATESPEND + \brief Number of Tables pending on Applications for their update */ /* ** Last Table Validation Results */ - uint16 ValidationCounter; /**< \cfetlmmnemonic \TBL_VALCOMPLTDCTR - \brief Number of completed table validations */ - uint32 LastValCrc; /**< \cfetlmmnemonic \TBL_LASTVALCRC - \brief Data Integrity Value computed for last table validated */ - int32 LastValStatus; /**< \cfetlmmnemonic \TBL_LASTVALS - \brief Returned status from validation function for last table validated */ - bool ActiveBuffer; /**< \cfetlmmnemonic \TBL_LASTVALBUF - \brief Indicator of whether table buffer validated was 0=Inactive, 1=Active */ - char LastValTableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \cfetlmmnemonic \TBL_LASTVALTBLNAME - \brief Name of last table validated */ - uint8 SuccessValCounter; /**< \cfetlmmnemonic \TBL_VALSUCCESSCTR - \brief Total number of successful table validations */ - uint8 FailedValCounter; /**< \cfetlmmnemonic \TBL_VALFAILEDCTR - \brief Total number of unsuccessful table validations */ - uint8 NumValRequests; /**< \cfetlmmnemonic \TBL_VALREQCTR - \brief Number of times Table Services has requested validations from Apps */ - + uint16 ValidationCounter; /**< \cfetlmmnemonic \TBL_VALCOMPLTDCTR + \brief Number of completed table validations */ + uint32 LastValCrc; /**< \cfetlmmnemonic \TBL_LASTVALCRC + \brief Data Integrity Value computed for last table validated */ + int32 LastValStatus; /**< \cfetlmmnemonic \TBL_LASTVALS + \brief Returned status from validation function for last table validated */ + bool ActiveBuffer; /**< \cfetlmmnemonic \TBL_LASTVALBUF + \brief Indicator of whether table buffer validated was 0=Inactive, 1=Active */ + char LastValTableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \cfetlmmnemonic \TBL_LASTVALTBLNAME + \brief Name of last table validated */ + uint8 SuccessValCounter; /**< \cfetlmmnemonic \TBL_VALSUCCESSCTR + \brief Total number of successful table validations */ + uint8 FailedValCounter; /**< \cfetlmmnemonic \TBL_VALFAILEDCTR + \brief Total number of unsuccessful table validations */ + uint8 NumValRequests; /**< \cfetlmmnemonic \TBL_VALREQCTR + \brief Number of times Table Services has requested validations from Apps */ + /* ** Ground system interface information */ - uint8 NumFreeSharedBufs; /**< \cfetlmmnemonic \TBL_NUMFREESHRBUF - \brief Number of free Shared Working Buffers */ - uint8 ByteAlignPad1; /**< \cfetlmmnemonic \TBL_BYTEALIGNPAD1 - \brief Spare byte to ensure longword alignment */ - CFE_ES_MemHandle_t MemPoolHandle; /**< \cfetlmmnemonic \TBL_MEMPOOLHANDLE - \brief Handle to TBL's memory pool */ - CFE_TIME_SysTime_t LastUpdateTime; /**< \cfetlmmnemonic \TBL_LASTUPDTIME - \brief Time of last table update */ - char LastUpdatedTable[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \cfetlmmnemonic \TBL_LASTUPDTBLNAME - \brief Name of the last table updated */ - char LastFileLoaded[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \TBL_LASTFILELOADED - \brief Path and Name of last table image file loaded */ - char LastFileDumped[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \TBL_LASTFILEDUMPED - \brief Path and Name of last file dumped to */ - char LastTableLoaded[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \cfetlmmnemonic \TBL_LASTTABLELOADED - \brief Name of the last table loaded */ + uint8 NumFreeSharedBufs; /**< \cfetlmmnemonic \TBL_NUMFREESHRBUF + \brief Number of free Shared Working Buffers */ + uint8 ByteAlignPad1; /**< \cfetlmmnemonic \TBL_BYTEALIGNPAD1 + \brief Spare byte to ensure longword alignment */ + CFE_ES_MemHandle_t MemPoolHandle; /**< \cfetlmmnemonic \TBL_MEMPOOLHANDLE + \brief Handle to TBL's memory pool */ + CFE_TIME_SysTime_t LastUpdateTime; /**< \cfetlmmnemonic \TBL_LASTUPDTIME + \brief Time of last table update */ + char LastUpdatedTable[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \cfetlmmnemonic \TBL_LASTUPDTBLNAME + \brief Name of the last table updated */ + char LastFileLoaded[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \TBL_LASTFILELOADED + \brief Path and Name of last table image file loaded */ + char LastFileDumped[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \TBL_LASTFILEDUMPED + \brief Path and Name of last file dumped to */ + char LastTableLoaded[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \cfetlmmnemonic \TBL_LASTTABLELOADED + \brief Name of the last table loaded */ } CFE_TBL_HousekeepingTlm_Payload_t; typedef struct CFE_TBL_HousekeepingTlm @@ -793,46 +792,45 @@ typedef struct CFE_TBL_HousekeepingTlm CFE_TBL_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TBL_HousekeepingTlm_t; - -/** +/** ** \cfetbltlm Table Registry Info Packet **/ typedef struct CFE_TBL_TblRegPacket_Payload { - CFE_ES_MemOffset_t Size; /**< \cfetlmmnemonic \TBL_SIZE - \brief Size, in bytes, of Table */ - uint32 Crc; /**< \cfetlmmnemonic \TBL_CRC - \brief Most recently calculated CRC of Table */ - CFE_ES_MemAddress_t ActiveBufferAddr; /**< \cfetlmmnemonic \TBL_ACTBUFADD - \brief Address of Active Buffer */ - CFE_ES_MemAddress_t InactiveBufferAddr; /**< \cfetlmmnemonic \TBL_IACTBUFADD - \brief Address of Inactive Buffer */ - CFE_ES_MemAddress_t ValidationFuncPtr; /**< \cfetlmmnemonic \TBL_VALFUNCPTR - \brief Ptr to Owner App's function that validates tbl contents */ - CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \cfetlmmnemonic \TBL_TIMELASTUPD - \brief Time when Table was last updated */ - uint32 FileCreateTimeSecs; /**< \cfetlmmnemonic \TBL_FILECSECONDS - \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \cfetlmmnemonic \TBL_FILECSUBSECONDS - \brief File creation time from last file loaded into table */ - bool TableLoadedOnce; /**< \cfetlmmnemonic \TBL_LOADEDONCE - \brief Flag indicating whether table has been loaded once or not */ - bool LoadPending; /**< \cfetlmmnemonic \TBL_UPDATEPNDNG - \brief Flag indicating an inactive buffer is ready to be copied */ - bool DumpOnly; /**< \cfetlmmnemonic \TBL_DUMPONLY - \brief Flag indicating Table is NOT to be loaded */ - bool DoubleBuffered; /**< \cfetlmmnemonic \TBL_DBLBUFFERED - \brief Flag indicating Table has a dedicated inactive buffer */ - char Name[CFE_MISSION_TBL_MAX_FULL_NAME_LEN];/**< \cfetlmmnemonic \TBL_NAME - \brief Processor specific table name */ - char LastFileLoaded[CFE_MISSION_MAX_PATH_LEN];/**< \cfetlmmnemonic \TBL_LASTFILEUPD - \brief Filename of last file loaded into table */ - char OwnerAppName[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \TBL_OWNERAPP - \brief Name of owning application */ - bool Critical; /**< \cfetlmmnemonic \TBL_CRITICAL - \brief Indicates whether table is Critical or not */ - uint8 ByteAlign4; /**< \cfetlmmnemonic \TBL_SPARE4 - \brief Spare byte to maintain byte alignment */ + CFE_ES_MemOffset_t Size; /**< \cfetlmmnemonic \TBL_SIZE + \brief Size, in bytes, of Table */ + uint32 Crc; /**< \cfetlmmnemonic \TBL_CRC + \brief Most recently calculated CRC of Table */ + CFE_ES_MemAddress_t ActiveBufferAddr; /**< \cfetlmmnemonic \TBL_ACTBUFADD + \brief Address of Active Buffer */ + CFE_ES_MemAddress_t InactiveBufferAddr; /**< \cfetlmmnemonic \TBL_IACTBUFADD + \brief Address of Inactive Buffer */ + CFE_ES_MemAddress_t ValidationFuncPtr; /**< \cfetlmmnemonic \TBL_VALFUNCPTR + \brief Ptr to Owner App's function that validates tbl contents */ + CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \cfetlmmnemonic \TBL_TIMELASTUPD + \brief Time when Table was last updated */ + uint32 FileCreateTimeSecs; /**< \cfetlmmnemonic \TBL_FILECSECONDS + \brief File creation time from last file loaded into table */ + uint32 FileCreateTimeSubSecs; /**< \cfetlmmnemonic \TBL_FILECSUBSECONDS + \brief File creation time from last file loaded into table */ + bool TableLoadedOnce; /**< \cfetlmmnemonic \TBL_LOADEDONCE + \brief Flag indicating whether table has been loaded once or not */ + bool LoadPending; /**< \cfetlmmnemonic \TBL_UPDATEPNDNG + \brief Flag indicating an inactive buffer is ready to be copied */ + bool DumpOnly; /**< \cfetlmmnemonic \TBL_DUMPONLY + \brief Flag indicating Table is NOT to be loaded */ + bool DoubleBuffered; /**< \cfetlmmnemonic \TBL_DBLBUFFERED + \brief Flag indicating Table has a dedicated inactive buffer */ + char Name[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< \cfetlmmnemonic \TBL_NAME + \brief Processor specific table name */ + char LastFileLoaded[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \TBL_LASTFILEUPD + \brief Filename of last file loaded into table */ + char OwnerAppName[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \TBL_OWNERAPP + \brief Name of owning application */ + bool Critical; /**< \cfetlmmnemonic \TBL_CRITICAL + \brief Indicates whether table is Critical or not */ + uint8 ByteAlign4; /**< \cfetlmmnemonic \TBL_SPARE4 + \brief Spare byte to maintain byte alignment */ } CFE_TBL_TblRegPacket_Payload_t; typedef struct CFE_TBL_TableRegistryTlm @@ -841,7 +839,6 @@ typedef struct CFE_TBL_TableRegistryTlm CFE_TBL_TblRegPacket_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TBL_TableRegistryTlm_t; - #endif /* _cfe_tbl_msg_ */ /************************/ diff --git a/modules/tbl/fsw/src/cfe_tbl_api.c b/modules/tbl/fsw/src/cfe_tbl_api.c index 5226bb35d..bab6fadb0 100644 --- a/modules/tbl/fsw/src/cfe_tbl_api.c +++ b/modules/tbl/fsw/src/cfe_tbl_api.c @@ -29,7 +29,6 @@ ** */ - /* ** Required header files... */ @@ -44,21 +43,18 @@ /* * Function: CFE_TBL_Register - See API and header file for details */ -int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, - const char *Name, - size_t Size, - uint16 TblOptionFlags, - CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr ) +int32 CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, const char *Name, size_t Size, uint16 TblOptionFlags, + CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr) { CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; - CFE_TBL_RegistryRec_t *RegRecPtr = NULL; - CFE_TBL_LoadBuff_t *WorkingBufferPtr; - CFE_TBL_CritRegRec_t *CritRegRecPtr = NULL; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; + CFE_TBL_LoadBuff_t * WorkingBufferPtr; + CFE_TBL_CritRegRec_t * CritRegRecPtr = NULL; int32 Status; size_t NameLen; int16 RegIndx; CFE_ES_AppId_t ThisAppId; - char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; + char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; char TblName[CFE_TBL_MAX_FULL_NAME_LEN] = {""}; CFE_TBL_Handle_t AccessIndex; @@ -84,7 +80,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* Perform a buffer overrun safe copy of name for debug log message */ strncpy(TblName, Name, sizeof(TblName) - 1); TblName[sizeof(TblName) - 1] = '\0'; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Table Name (%s) is bad length (%d)",TblName,(int)NameLen); + CFE_ES_WriteToSysLog("CFE_TBL:Register-Table Name (%s) is bad length (%d)", TblName, (int)NameLen); } else { @@ -92,7 +88,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* of the form "AppName.TableName" */ CFE_TBL_FormTableName(TblName, Name, ThisAppId); - /* Make sure the specified size is acceptable */ + /* Make sure the specified size is acceptable */ /* Single buffered tables are allowed to be up to CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE */ /* Double buffered tables are allowed to be up to CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE */ if (Size == 0) @@ -106,18 +102,18 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, { Status = CFE_TBL_ERR_INVALID_SIZE; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Single Buffered Table '%s' has size %d > %d\n", - Name, (int)Size, CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE); + CFE_ES_WriteToSysLog("CFE_TBL:Register-Single Buffered Table '%s' has size %d > %d\n", Name, (int)Size, + CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE); } else if ((Size > CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE) && ((TblOptionFlags & CFE_TBL_OPT_BUFFER_MSK) == CFE_TBL_OPT_DBL_BUFFER)) { Status = CFE_TBL_ERR_INVALID_SIZE; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Dbl Buffered Table '%s' has size %d > %d\n", - Name, (int)Size, CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE); + CFE_ES_WriteToSysLog("CFE_TBL:Register-Dbl Buffered Table '%s' has size %d > %d\n", Name, (int)Size, + CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE); } - + /* Verify Table Option settings are legal */ /* User defined table addresses are only legal for single buffered, dump-only, non-critical tables */ if ((TblOptionFlags & CFE_TBL_OPT_USR_DEF_MSK) == (CFE_TBL_OPT_USR_DEF_ADDR & CFE_TBL_OPT_USR_DEF_MSK)) @@ -127,9 +123,9 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, ((TblOptionFlags & CFE_TBL_OPT_CRITICAL_MSK) == CFE_TBL_OPT_CRITICAL)) { Status = CFE_TBL_ERR_INVALID_OPTIONS; - - CFE_ES_WriteToSysLog("CFE_TBL:Register-User Def tbl '%s' cannot be dbl buff, load/dump or critical\n", - Name); + + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-User Def tbl '%s' cannot be dbl buff, load/dump or critical\n", Name); } } else if ((TblOptionFlags & CFE_TBL_OPT_LD_DMP_MSK) == CFE_TBL_OPT_DUMP_ONLY) @@ -139,17 +135,16 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, ((TblOptionFlags & CFE_TBL_OPT_CRITICAL_MSK) == CFE_TBL_OPT_CRITICAL)) { Status = CFE_TBL_ERR_INVALID_OPTIONS; - + CFE_ES_WriteToSysLog("CFE_TBL:Register-Dump Only tbl '%s' cannot be double buffered or critical\n", Name); } } } } - else /* Application ID was invalid */ + else /* Application ID was invalid */ { - CFE_ES_WriteToSysLog("CFE_TBL:Register-Bad AppId(%lu)\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId)); + CFE_ES_WriteToSysLog("CFE_TBL:Register-Bad AppId(%lu)\n", CFE_RESOURCEID_TO_ULONG(ThisAppId)); } /* If input parameters appear acceptable, register the table */ @@ -169,7 +164,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, RegRecPtr = &CFE_TBL_Global.Registry[RegIndx]; /* If this app previously owned the table, then allow them to re-register */ - if ( CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, ThisAppId) ) + if (CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, ThisAppId)) { /* If the new table is the same size as the old, then no need to reallocate memory */ if (Size != RegRecPtr->Size) @@ -180,14 +175,15 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* to clean up this mess. */ Status = CFE_TBL_ERR_DUPLICATE_DIFF_SIZE; - CFE_ES_WriteToSysLog("CFE_TBL:Register-Attempt to register existing table ('%s') with different size(%d!=%d)\n", - TblName, (int)Size, (int)RegRecPtr->Size); + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-Attempt to register existing table ('%s') with different size(%d!=%d)\n", + TblName, (int)Size, (int)RegRecPtr->Size); } else { /* Warn calling application that this is a duplicate registration */ Status = CFE_TBL_WARN_DUPLICATE; - + /* Find the existing access descriptor for the table */ /* and return the same handle that was returned previously */ AccessIndex = RegRecPtr->HeadOfAccessList; @@ -215,7 +211,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, CFE_RESOURCEID_TO_ULONG(RegRecPtr->OwnerAppId)); } } - else /* Table not already in registry */ + else /* Table not already in registry */ { /* Locate empty slot in table registry */ RegIndx = CFE_TBL_FindFreeRegistryEntry(); @@ -247,22 +243,21 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, { /* Get pointer to Registry Record Entry to speed up processing */ RegRecPtr = &CFE_TBL_Global.Registry[RegIndx]; - + /* Initialize Registry Record to default settings */ CFE_TBL_InitRegistryRecord(RegRecPtr); if ((TblOptionFlags & CFE_TBL_OPT_USR_DEF_MSK) != (CFE_TBL_OPT_USR_DEF_ADDR & CFE_TBL_OPT_USR_DEF_MSK)) { RegRecPtr->UserDefAddr = false; - + /* Allocate the memory buffer(s) for the table and inactive table, if necessary */ - Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[0].BufferPtr, - CFE_TBL_Global.Buf.PoolHdl, - Size); - if(Status < 0) + Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[0].BufferPtr, CFE_TBL_Global.Buf.PoolHdl, Size); + if (Status < 0) { - CFE_ES_WriteToSysLog("CFE_TBL:Register-1st Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-1st Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); } else { @@ -275,20 +270,19 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, { /* Set buffer pointer to NULL for user defined address tables */ RegRecPtr->Buffers[0].BufferPtr = NULL; - RegRecPtr->UserDefAddr = true; + RegRecPtr->UserDefAddr = true; } if (((TblOptionFlags & CFE_TBL_OPT_DBL_BUFFER) == CFE_TBL_OPT_DBL_BUFFER) && ((Status & CFE_SEVERITY_BITMASK) != CFE_SEVERITY_ERROR)) { /* Allocate memory for the dedicated secondary buffer */ - Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[1].BufferPtr, - CFE_TBL_Global.Buf.PoolHdl, - Size); - if(Status < 0) + Status = CFE_ES_GetPoolBuf(&RegRecPtr->Buffers[1].BufferPtr, CFE_TBL_Global.Buf.PoolHdl, Size); + if (Status < 0) { - CFE_ES_WriteToSysLog("CFE_TBL:Register-2nd Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-2nd Buf Alloc GetPool fail Stat=0x%08X MemPoolHndl=0x%08lX\n", + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl)); } else { @@ -298,14 +292,14 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, } RegRecPtr->ActiveBufferIndex = 0; - RegRecPtr->DoubleBuffered = true; + RegRecPtr->DoubleBuffered = true; } - else /* Single Buffered Table */ + else /* Single Buffered Table */ { - RegRecPtr->DoubleBuffered = false; + RegRecPtr->DoubleBuffered = false; RegRecPtr->ActiveBufferIndex = 0; } - + if ((Status & CFE_SEVERITY_BITMASK) != CFE_SEVERITY_ERROR) { /* Save the size of the table */ @@ -331,9 +325,9 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* Initialize the Table Access Descriptor */ AccessDescPtr = &CFE_TBL_Global.Handles[*TblHandlePtr]; - AccessDescPtr->AppId = ThisAppId; + AccessDescPtr->AppId = ThisAppId; AccessDescPtr->LockFlag = false; - AccessDescPtr->Updated = false; + AccessDescPtr->Updated = false; if ((RegRecPtr->DumpOnly) && (!RegRecPtr->UserDefAddr)) { @@ -345,8 +339,8 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, AccessDescPtr->RegIndex = RegIndx; - AccessDescPtr->PrevLink = CFE_TBL_END_OF_LIST; /* We are the head of the list */ - AccessDescPtr->NextLink = CFE_TBL_END_OF_LIST; /* We are the end of the list */ + AccessDescPtr->PrevLink = CFE_TBL_END_OF_LIST; /* We are the head of the list */ + AccessDescPtr->NextLink = CFE_TBL_END_OF_LIST; /* We are the end of the list */ AccessDescPtr->UsedFlag = true; @@ -359,7 +353,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, { /* Register a CDS under the table name and determine if the table already exists there */ Status = CFE_ES_RegisterCDSEx(&RegRecPtr->CDSHandle, Size, TblName, true); - + if (Status == CFE_ES_CDS_ALREADY_EXISTS) { Status = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, true); @@ -371,19 +365,21 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* do need to handle the error case because if the function */ /* call did fail, WorkingBufferPtr would be a NULL pointer. */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to get work buffer for '%s.%s' (ErrCode=0x%08X)\n", - AppName, Name, (unsigned int)Status); + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-Failed to get work buffer for '%s.%s' (ErrCode=0x%08X)\n", + AppName, Name, (unsigned int)Status); } else { /* CDS exists for this table - try to restore the data */ Status = CFE_ES_RestoreFromCDS(WorkingBufferPtr->BufferPtr, RegRecPtr->CDSHandle); - + if (Status != CFE_SUCCESS) { CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to recover '%s.%s' from CDS (ErrCode=0x%08X)\n", - AppName, Name, (unsigned int)Status); + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-Failed to recover '%s.%s' from CDS (ErrCode=0x%08X)\n", + AppName, Name, (unsigned int)Status); } } @@ -391,36 +387,34 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, { /* Treat a restore from existing CDS error the same as */ /* after a power-on reset (CDS was created but is empty) */ - Status = CFE_SUCCESS; + Status = CFE_SUCCESS; } else { /* Try to locate the associated information in the Critical Table Registry */ CFE_TBL_FindCriticalTblInfo(&CritRegRecPtr, RegRecPtr->CDSHandle); - + if ((CritRegRecPtr != NULL) && (CritRegRecPtr->TableLoadedOnce)) { strncpy(WorkingBufferPtr->DataSource, CritRegRecPtr->LastFileLoaded, sizeof(WorkingBufferPtr->DataSource) - 1); WorkingBufferPtr->DataSource[sizeof(WorkingBufferPtr->DataSource) - 1] = '\0'; - WorkingBufferPtr->FileCreateTimeSecs = CritRegRecPtr->FileCreateTimeSecs; + WorkingBufferPtr->FileCreateTimeSecs = CritRegRecPtr->FileCreateTimeSecs; WorkingBufferPtr->FileCreateTimeSubSecs = CritRegRecPtr->FileCreateTimeSubSecs; strncpy(RegRecPtr->LastFileLoaded, CritRegRecPtr->LastFileLoaded, sizeof(RegRecPtr->LastFileLoaded) - 1); RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = '\0'; - RegRecPtr->TimeOfLastUpdate.Seconds = CritRegRecPtr->TimeOfLastUpdate.Seconds; + RegRecPtr->TimeOfLastUpdate.Seconds = CritRegRecPtr->TimeOfLastUpdate.Seconds; RegRecPtr->TimeOfLastUpdate.Subseconds = CritRegRecPtr->TimeOfLastUpdate.Subseconds; - RegRecPtr->TableLoadedOnce = CritRegRecPtr->TableLoadedOnce; - + RegRecPtr->TableLoadedOnce = CritRegRecPtr->TableLoadedOnce; + /* Compute the CRC on the specified table buffer */ - WorkingBufferPtr->Crc = CFE_ES_CalculateCRC(WorkingBufferPtr->BufferPtr, - RegRecPtr->Size, - 0, - CFE_MISSION_ES_DEFAULT_CRC); - + WorkingBufferPtr->Crc = CFE_ES_CalculateCRC( + WorkingBufferPtr->BufferPtr, RegRecPtr->Size, 0, CFE_MISSION_ES_DEFAULT_CRC); + /* Make sure everyone who sees the table knows that it has been updated */ CFE_TBL_NotifyTblUsersOfUpdate(RegRecPtr); - + /* Make sure the caller realizes the contents have been initialized */ Status = CFE_TBL_INFO_RECOVERED_TBL; } @@ -429,49 +423,52 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* If an error occurred while trying to get the previous contents registry info, */ /* Log the error in the System Log and pretend like we created a new CDS */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to recover '%s.%s' info from CDS TblReg\n", - AppName, Name); - Status = CFE_SUCCESS; + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-Failed to recover '%s.%s' info from CDS TblReg\n", AppName, + Name); + Status = CFE_SUCCESS; } } - + /* Mark the table as critical for future reference */ RegRecPtr->CriticalTable = true; } - + if (Status == CFE_SUCCESS) { /* Find and initialize a free entry in the Critical Table Registry */ CFE_TBL_FindCriticalTblInfo(&CritRegRecPtr, CFE_ES_CDS_BAD_HANDLE); - + if (CritRegRecPtr != NULL) { CritRegRecPtr->CDSHandle = RegRecPtr->CDSHandle; strncpy(CritRegRecPtr->Name, TblName, sizeof(CritRegRecPtr->Name) - 1); CritRegRecPtr->Name[sizeof(CritRegRecPtr->Name) - 1] = '\0'; - CritRegRecPtr->FileCreateTimeSecs = 0; - CritRegRecPtr->FileCreateTimeSubSecs = 0; - CritRegRecPtr->LastFileLoaded[0] = '\0'; - CritRegRecPtr->TimeOfLastUpdate.Seconds = 0; - CritRegRecPtr->TimeOfLastUpdate.Subseconds = 0; - CritRegRecPtr->TableLoadedOnce = false; - + CritRegRecPtr->FileCreateTimeSecs = 0; + CritRegRecPtr->FileCreateTimeSubSecs = 0; + CritRegRecPtr->LastFileLoaded[0] = '\0'; + CritRegRecPtr->TimeOfLastUpdate.Seconds = 0; + CritRegRecPtr->TimeOfLastUpdate.Subseconds = 0; + CritRegRecPtr->TableLoadedOnce = false; + CFE_ES_CopyToCDS(CFE_TBL_Global.CritRegHandle, CFE_TBL_Global.CritReg); } else { - CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to find a free Crit Tbl Reg Rec for '%s'\n", - RegRecPtr->Name); - } - + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-Failed to find a free Crit Tbl Reg Rec for '%s'\n", + RegRecPtr->Name); + } + /* Mark the table as critical for future reference */ RegRecPtr->CriticalTable = true; } else if (Status != CFE_TBL_INFO_RECOVERED_TBL) { - CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to register '%s.%s' as a CDS (ErrCode=0x%08X)\n", - AppName, Name, (unsigned int)Status); - + CFE_ES_WriteToSysLog( + "CFE_TBL:Register-Failed to register '%s.%s' as a CDS (ErrCode=0x%08X)\n", AppName, + Name, (unsigned int)Status); + /* Notify caller that although they asked for it to be critical, it isn't */ Status = CFE_TBL_WARN_NOT_CRITICAL; } @@ -495,39 +492,34 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, { /* Make sure the returned handle is invalid when an error occurs */ *TblHandlePtr = CFE_TBL_BAD_TABLE_HANDLE; - + /* Translate AppID of caller into App Name */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_EVS_SendEventWithAppID(CFE_TBL_REGISTER_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s Failed to Register '%s', Status=0x%08X", - AppName, TblName, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_REGISTER_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s Failed to Register '%s', Status=0x%08X", AppName, TblName, (unsigned int)Status); } return Status; -} /* End of CFE_TBL_Register() */ - +} /* End of CFE_TBL_Register() */ /* * Function: CFE_TBL_Share - See API and header file for details */ -int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, - const char *TblName ) +int32 CFE_TBL_Share(CFE_TBL_Handle_t *TblHandlePtr, const char *TblName) { - int32 Status; - CFE_ES_AppId_t ThisAppId; - int16 RegIndx; - CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; - CFE_TBL_RegistryRec_t *RegRecPtr = NULL; - char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; + int32 Status; + CFE_ES_AppId_t ThisAppId; + int16 RegIndx; + CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; + char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; if (TblHandlePtr == NULL || TblName == NULL) { return CFE_TBL_BAD_ARGUMENT; } - + /* Get a valid Application ID for calling App */ Status = CFE_ES_GetAppID(&ThisAppId); @@ -559,9 +551,9 @@ int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, /* Initialize the Table Access Descriptor */ AccessDescPtr = &CFE_TBL_Global.Handles[*TblHandlePtr]; - AccessDescPtr->AppId = ThisAppId; + AccessDescPtr->AppId = ThisAppId; AccessDescPtr->LockFlag = false; - AccessDescPtr->Updated = false; + AccessDescPtr->Updated = false; /* Check current state of table in order to set Notification flags properly */ if (RegRecPtr->TableLoadedOnce) @@ -572,7 +564,7 @@ int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, AccessDescPtr->RegIndex = RegIndx; AccessDescPtr->UsedFlag = true; - AccessDescPtr->PrevLink = CFE_TBL_END_OF_LIST; /* We are the new head of the list */ + AccessDescPtr->PrevLink = CFE_TBL_END_OF_LIST; /* We are the new head of the list */ AccessDescPtr->NextLink = RegRecPtr->HeadOfAccessList; /* Make sure the old head of the list now sees this as the head */ @@ -582,7 +574,7 @@ int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, RegRecPtr->HeadOfAccessList = *TblHandlePtr; } } - else /* Table could not be found in registry */ + else /* Table could not be found in registry */ { Status = CFE_TBL_ERR_INVALID_NAME; @@ -591,10 +583,9 @@ int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, CFE_TBL_UnlockRegistry(); } - else /* Application ID was invalid */ + else /* Application ID was invalid */ { - CFE_ES_WriteToSysLog("CFE_TBL:Share-Bad AppId(%lu)\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId)); + CFE_ES_WriteToSysLog("CFE_TBL:Share-Bad AppId(%lu)\n", CFE_RESOURCEID_TO_ULONG(ThisAppId)); } /* On Error conditions, notify ground of screw up */ @@ -603,27 +594,23 @@ int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, /* Translate AppID of caller into App Name */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_EVS_SendEventWithAppID(CFE_TBL_SHARE_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s Failed to Share '%s', Status=0x%08X", - AppName, TblName, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_SHARE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s Failed to Share '%s', Status=0x%08X", AppName, TblName, (unsigned int)Status); } return Status; -} /* End of CFE_TBL_Share() */ - +} /* End of CFE_TBL_Share() */ /* * Function: CFE_TBL_Unregister - See API and header file for details */ -int32 CFE_TBL_Unregister ( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Unregister(CFE_TBL_Handle_t TblHandle) { - int32 Status; - CFE_ES_AppId_t ThisAppId; - CFE_TBL_RegistryRec_t *RegRecPtr = NULL; - CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; - char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; + int32 Status; + CFE_ES_AppId_t ThisAppId; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; + CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; + char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; /* Verify that this application has the right to perform operation */ Status = CFE_TBL_ValidateAccess(TblHandle, &ThisAppId); @@ -658,7 +645,7 @@ int32 CFE_TBL_Unregister ( CFE_TBL_Handle_t TblHandle ) else { CFE_ES_WriteToSysLog("CFE_TBL:Unregister-App(%lu) does not have access to Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } /* On Error conditions, notify ground of screw up */ @@ -667,16 +654,12 @@ int32 CFE_TBL_Unregister ( CFE_TBL_Handle_t TblHandle ) /* Translate AppID of caller into App Name */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); - CFE_EVS_SendEventWithAppID(CFE_TBL_UNREGISTER_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s Failed to Unregister '?', Status=0x%08X", - AppName, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_UNREGISTER_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s Failed to Unregister '?', Status=0x%08X", AppName, (unsigned int)Status); } return Status; -} /* End of CFE_TBL_Unregister() */ - +} /* End of CFE_TBL_Unregister() */ /******************************************************************* ** @@ -686,17 +669,15 @@ int32 CFE_TBL_Unregister ( CFE_TBL_Handle_t TblHandle ) ** NOTE: For complete prolog information, see 'cfe_tbl.h' ********************************************************************/ -int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, - CFE_TBL_SrcEnum_t SrcType, - const void *SrcDataPtr ) +int32 CFE_TBL_Load(CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, const void *SrcDataPtr) { int32 Status; CFE_ES_AppId_t ThisAppId; - CFE_TBL_LoadBuff_t *WorkingBufferPtr; + CFE_TBL_LoadBuff_t * WorkingBufferPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; - CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_RegistryRec_t * RegRecPtr; char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; - bool FirstTime = false; + bool FirstTime = false; if (SrcDataPtr == NULL) { @@ -709,14 +690,14 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, if (Status != CFE_SUCCESS) { CFE_EVS_SendEventWithAppID(CFE_TBL_HANDLE_ACCESS_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: No access to Tbl Handle=%d", AppName, (int)TblHandle); + CFE_TBL_Global.TableTaskAppId, "%s: No access to Tbl Handle=%d", AppName, + (int)TblHandle); return Status; } AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; /* Translate AppID of caller into App Name */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); @@ -727,11 +708,11 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, /* Check to see if this is a dump only table */ if (RegRecPtr->DumpOnly) { - if ((!RegRecPtr->UserDefAddr) ||(RegRecPtr->TableLoadedOnce)) + if ((!RegRecPtr->UserDefAddr) || (RegRecPtr->TableLoadedOnce)) { - CFE_EVS_SendEventWithAppID(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID, - CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "%s: Attempted to load Dump Only Tbl '%s'", AppName, RegRecPtr->Name); + CFE_EVS_SendEventWithAppID(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_TBL_Global.TableTaskAppId, "%s: Attempted to load Dump Only Tbl '%s'", + AppName, RegRecPtr->Name); return CFE_TBL_ERR_DUMP_ONLY; } @@ -739,18 +720,15 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, /* The Application is allowed to call Load once when the address */ /* of the dump only table is being defined by the application. */ RegRecPtr->Buffers[0].BufferPtr = (void *)SrcDataPtr; - RegRecPtr->TableLoadedOnce = true; - - snprintf(RegRecPtr->Buffers[0].DataSource, sizeof(RegRecPtr->Buffers[0].DataSource), - "Addr 0x%08lX", (unsigned long)SrcDataPtr); - RegRecPtr->Buffers[0].FileCreateTimeSecs = 0; + RegRecPtr->TableLoadedOnce = true; + + snprintf(RegRecPtr->Buffers[0].DataSource, sizeof(RegRecPtr->Buffers[0].DataSource), "Addr 0x%08lX", + (unsigned long)SrcDataPtr); + RegRecPtr->Buffers[0].FileCreateTimeSecs = 0; RegRecPtr->Buffers[0].FileCreateTimeSubSecs = 0; - CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_SUCCESS_INF_EID, - CFE_EVS_EventType_DEBUG, - CFE_TBL_Global.TableTaskAppId, - "Successfully loaded '%s' from '%s'", - RegRecPtr->Name, + CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_SUCCESS_INF_EID, CFE_EVS_EventType_DEBUG, CFE_TBL_Global.TableTaskAppId, + "Successfully loaded '%s' from '%s'", RegRecPtr->Name, RegRecPtr->Buffers[0].DataSource); return CFE_SUCCESS; @@ -760,8 +738,8 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, if (RegRecPtr->LoadInProgress != CFE_TBL_NO_LOAD_IN_PROGRESS) { CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_IN_PROGRESS_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: Load already in progress for '%s'", AppName, RegRecPtr->Name); + CFE_TBL_Global.TableTaskAppId, "%s: Load already in progress for '%s'", AppName, + RegRecPtr->Name); return CFE_TBL_ERR_LOAD_IN_PROGRESS; } @@ -772,15 +750,15 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, if (Status != CFE_SUCCESS) { CFE_EVS_SendEventWithAppID(CFE_TBL_NO_WORK_BUFFERS_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: Failed to get Working Buffer (Stat=%u)", AppName, (unsigned int)Status); + CFE_TBL_Global.TableTaskAppId, "%s: Failed to get Working Buffer (Stat=%u)", AppName, + (unsigned int)Status); return Status; } /* Perform appropriate update to working buffer */ /* Determine whether the load is to occur from a file or from a block of memory */ - switch(SrcType) + switch (SrcType) { case CFE_TBL_SRC_FILE: /* Load the data from the file into the specified buffer */ @@ -791,9 +769,9 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, /* Uninitialized tables cannot be loaded with partial table loads */ /* Partial loads can only occur on previously loaded tables. */ CFE_EVS_SendEventWithAppID(CFE_TBL_PARTIAL_LOAD_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: Attempted to load from partial Tbl '%s' from '%s' (Stat=%u)", - AppName, RegRecPtr->Name, (const char *)SrcDataPtr, (unsigned int)Status); + CFE_TBL_Global.TableTaskAppId, + "%s: Attempted to load from partial Tbl '%s' from '%s' (Stat=%u)", AppName, + RegRecPtr->Name, (const char *)SrcDataPtr, (unsigned int)Status); Status = CFE_TBL_ERR_PARTIAL_LOAD; } @@ -801,26 +779,23 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, break; case CFE_TBL_SRC_ADDRESS: /* When the source is a block of memory, it is assumed to be a complete load */ - memcpy(WorkingBufferPtr->BufferPtr, - (uint8 *)SrcDataPtr, - RegRecPtr->Size); + memcpy(WorkingBufferPtr->BufferPtr, (uint8 *)SrcDataPtr, RegRecPtr->Size); - snprintf(WorkingBufferPtr->DataSource, sizeof(WorkingBufferPtr->DataSource), "Addr 0x%08lX", (unsigned long)SrcDataPtr); - WorkingBufferPtr->FileCreateTimeSecs = 0; + snprintf(WorkingBufferPtr->DataSource, sizeof(WorkingBufferPtr->DataSource), "Addr 0x%08lX", + (unsigned long)SrcDataPtr); + WorkingBufferPtr->FileCreateTimeSecs = 0; WorkingBufferPtr->FileCreateTimeSubSecs = 0; - + /* Compute the CRC on the specified table buffer */ - WorkingBufferPtr->Crc = CFE_ES_CalculateCRC(WorkingBufferPtr->BufferPtr, - RegRecPtr->Size, - 0, - CFE_MISSION_ES_DEFAULT_CRC); + WorkingBufferPtr->Crc = + CFE_ES_CalculateCRC(WorkingBufferPtr->BufferPtr, RegRecPtr->Size, 0, CFE_MISSION_ES_DEFAULT_CRC); break; default: CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_TYPE_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: Attempted to load from illegal source type=%d", AppName, (int)SrcType); - + CFE_TBL_Global.TableTaskAppId, + "%s: Attempted to load from illegal source type=%d", AppName, (int)SrcType); + Status = CFE_TBL_ERR_ILLEGAL_SRC_TYPE; } @@ -831,10 +806,9 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, if (Status > CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_VAL_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: Validation func return code invalid (Stat=%u) for '%s'", - AppName, (unsigned int)Status, RegRecPtr->Name); + CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_VAL_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s: Validation func return code invalid (Stat=%u) for '%s'", AppName, + (unsigned int)Status, RegRecPtr->Name); Status = -1; } @@ -842,9 +816,9 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, if (Status < 0) { CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: Validation func reports table invalid (Stat=%u) for '%s'", - AppName, (unsigned int)Status, RegRecPtr->Name); + CFE_TBL_Global.TableTaskAppId, + "%s: Validation func reports table invalid (Stat=%u) for '%s'", AppName, + (unsigned int)Status, RegRecPtr->Name); /* Zero out the buffer to remove any bad data */ memset(WorkingBufferPtr->BufferPtr, 0, RegRecPtr->Size); @@ -868,7 +842,7 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, } FirstTime = !RegRecPtr->TableLoadedOnce; - + /* If this is not the first load, then the data must be moved from the inactive buffer */ /* to the active buffer to complete the load. First loads are done directly to the active. */ if (!FirstTime) @@ -880,22 +854,19 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, if (Status != CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: Failed to update '%s' (Stat=%u)", - AppName, RegRecPtr->Name, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s: Failed to update '%s' (Stat=%u)", AppName, RegRecPtr->Name, + (unsigned int)Status); } } else { /* On initial loads, make sure registry is given file/address of data source */ - strncpy(RegRecPtr->LastFileLoaded, - WorkingBufferPtr->DataSource, - sizeof(RegRecPtr->LastFileLoaded) - 1); + strncpy(RegRecPtr->LastFileLoaded, WorkingBufferPtr->DataSource, sizeof(RegRecPtr->LastFileLoaded) - 1); RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = '\0'; CFE_TBL_NotifyTblUsersOfUpdate(RegRecPtr); - + /* If the table is a critical table, update the appropriate CDS with the new data */ if (RegRecPtr->CriticalTable == true) { @@ -910,28 +881,27 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, /* The first time a table is loaded, the event message is DEBUG */ /* to help eliminate a flood of events during a startup */ CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_SUCCESS_INF_EID, - FirstTime ? CFE_EVS_EventType_DEBUG : CFE_EVS_EventType_INFORMATION, - CFE_TBL_Global.TableTaskAppId, "Successfully loaded '%s' from '%s'", - RegRecPtr->Name, RegRecPtr->LastFileLoaded); - + FirstTime ? CFE_EVS_EventType_DEBUG : CFE_EVS_EventType_INFORMATION, + CFE_TBL_Global.TableTaskAppId, "Successfully loaded '%s' from '%s'", RegRecPtr->Name, + RegRecPtr->LastFileLoaded); + /* Save the index of the table for housekeeping telemetry */ CFE_TBL_Global.LastTblUpdated = AccessDescPtr->RegIndex; } return Status; -} /* End of CFE_TBL_Load() */ - +} /* End of CFE_TBL_Load() */ /* * Function: CFE_TBL_Update - See API and header file for details */ -int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Update(CFE_TBL_Handle_t TblHandle) { int32 Status; CFE_ES_AppId_t ThisAppId; - CFE_TBL_RegistryRec_t *RegRecPtr=NULL; - CFE_TBL_AccessDescriptor_t *AccessDescPtr=NULL; - char AppName[OS_MAX_API_NAME]={"UNKNOWN"}; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; + CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; + char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; /* Verify access rights and get a valid Application ID for calling App */ Status = CFE_TBL_ValidateAccess(TblHandle, &ThisAppId); @@ -940,20 +910,20 @@ int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) { /* Get pointers to pertinent records in registry and handles */ AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; Status = CFE_TBL_UpdateInternal(TblHandle, RegRecPtr, AccessDescPtr); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("CFE_TBL:Update-App(%lu) fail to update Tbl '%s' (Stat=0x%08X)\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), RegRecPtr->Name, (unsigned int)Status); + CFE_RESOURCEID_TO_ULONG(ThisAppId), RegRecPtr->Name, (unsigned int)Status); } } else { CFE_ES_WriteToSysLog("CFE_TBL:Update-App(%lu) does not have access to Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } if (Status != CFE_TBL_ERR_BAD_APP_ID) @@ -961,25 +931,20 @@ int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) /* Translate AppID of caller into App Name */ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); } - + /* On Error conditions, notify ground of screw up */ if (Status < 0) { if (RegRecPtr != NULL) { - CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s Failed to Update '%s', Status=0x%08X", - AppName, RegRecPtr->Name, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s Failed to Update '%s', Status=0x%08X", AppName, RegRecPtr->Name, + (unsigned int)Status); } else { - CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s Failed to Update '?', Status=0x%08X", - AppName, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s Failed to Update '?', Status=0x%08X", AppName, (unsigned int)Status); } } else @@ -987,29 +952,25 @@ int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) /* If there was a warning (ie - Table is currently locked), then do not issue a message */ if (Status == CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_SUCCESS_INF_EID, - CFE_EVS_EventType_INFORMATION, - CFE_TBL_Global.TableTaskAppId, - "%s Successfully Updated '%s'", - AppName, RegRecPtr->Name); - + CFE_EVS_SendEventWithAppID(CFE_TBL_UPDATE_SUCCESS_INF_EID, CFE_EVS_EventType_INFORMATION, + CFE_TBL_Global.TableTaskAppId, "%s Successfully Updated '%s'", AppName, + RegRecPtr->Name); + /* Save the index of the table for housekeeping telemetry */ CFE_TBL_Global.LastTblUpdated = AccessDescPtr->RegIndex; - } + } } return Status; -} /* End of CFE_TBL_Update() */ - +} /* End of CFE_TBL_Update() */ /* * Function: CFE_TBL_GetAddress - See API and header file for details */ -int32 CFE_TBL_GetAddress( void **TblPtr, - CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_GetAddress(void **TblPtr, CFE_TBL_Handle_t TblHandle) { - int32 Status; - CFE_ES_AppId_t ThisAppId; + int32 Status; + CFE_ES_AppId_t ThisAppId; if (TblPtr == NULL) { @@ -1032,20 +993,19 @@ int32 CFE_TBL_GetAddress( void **TblPtr, } else { - CFE_ES_WriteToSysLog("CFE_TBL:GetAddress-Bad AppId=%lu\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId)); + CFE_ES_WriteToSysLog("CFE_TBL:GetAddress-Bad AppId=%lu\n", CFE_RESOURCEID_TO_ULONG(ThisAppId)); } return Status; -} /* End of CFE_TBL_GetAddress() */ +} /* End of CFE_TBL_GetAddress() */ /* * Function: CFE_TBL_ReleaseAddress - See API and header file for details */ -int32 CFE_TBL_ReleaseAddress( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_ReleaseAddress(CFE_TBL_Handle_t TblHandle) { - int32 Status; - CFE_ES_AppId_t ThisAppId; + int32 Status; + CFE_ES_AppId_t ThisAppId; /* Verify that this application has the right to perform operation */ Status = CFE_TBL_ValidateAccess(TblHandle, &ThisAppId); @@ -1065,30 +1025,28 @@ int32 CFE_TBL_ReleaseAddress( CFE_TBL_Handle_t TblHandle ) else { CFE_ES_WriteToSysLog("CFE_TBL:ReleaseAddress-App(%lu) does not have access to Tbl Handle=%u\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (unsigned int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (unsigned int)TblHandle); } return Status; -} /* End of CFE_TBL_ReleaseAddress() */ +} /* End of CFE_TBL_ReleaseAddress() */ /* * Function: CFE_TBL_GetAddresses() - See API and header file for details */ -int32 CFE_TBL_GetAddresses( void **TblPtrs[], - uint16 NumTables, - const CFE_TBL_Handle_t TblHandles[] ) +int32 CFE_TBL_GetAddresses(void **TblPtrs[], uint16 NumTables, const CFE_TBL_Handle_t TblHandles[]) { - uint16 i; - int32 Status; - CFE_ES_AppId_t ThisAppId; + uint16 i; + int32 Status; + CFE_ES_AppId_t ThisAppId; - if (TblPtrs == NULL) + if (TblPtrs == NULL) { return CFE_TBL_BAD_ARGUMENT; } /* Assume failure at returning the table addresses */ - for (i=0; iRegIndex]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); @@ -1179,20 +1134,20 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) if (RegRecPtr->DoubleBuffered) { /* Call the Application's Validation function for the Inactive Buffer */ - Status = (RegRecPtr->ValidationFuncPtr)(RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].BufferPtr); - + Status = + (RegRecPtr->ValidationFuncPtr)(RegRecPtr->Buffers[(1U - RegRecPtr->ActiveBufferIndex)].BufferPtr); + /* Allow buffer to be activated after passing validation */ if (Status == CFE_SUCCESS) { - RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].Validated = true; + RegRecPtr->Buffers[(1U - RegRecPtr->ActiveBufferIndex)].Validated = true; } } else { /* Call the Application's Validation function for the appropriate shared buffer */ - Status = (RegRecPtr->ValidationFuncPtr) - (CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr); - + Status = (RegRecPtr->ValidationFuncPtr)(CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr); + /* Allow buffer to be activated after passing validation */ if (Status == CFE_SUCCESS) { @@ -1202,24 +1157,22 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) if (Status == CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_INF_EID, - CFE_EVS_EventType_INFORMATION, - CFE_TBL_Global.TableTaskAppId, - "%s validation successful for Inactive '%s'", + CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_INF_EID, CFE_EVS_EventType_INFORMATION, + CFE_TBL_Global.TableTaskAppId, "%s validation successful for Inactive '%s'", AppName, RegRecPtr->Name); } else { - CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "%s validation failed for Inactive '%s', Status=0x%08X", - AppName, RegRecPtr->Name, (unsigned int)Status); - + "%s validation failed for Inactive '%s', Status=0x%08X", AppName, + RegRecPtr->Name, (unsigned int)Status); + if (Status > CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:Validate-App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", - CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), (unsigned int)Status, RegRecPtr->Name); + CFE_ES_WriteToSysLog( + "CFE_TBL:Validate-App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", + CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), (unsigned int)Status, RegRecPtr->Name); } } @@ -1228,7 +1181,7 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) /* Once validation is complete, set flags to indicate response is ready */ CFE_TBL_Global.ValidationResults[RegRecPtr->ValidateInactiveIndex].State = CFE_TBL_VALIDATION_PERFORMED; - RegRecPtr->ValidateInactiveIndex = CFE_TBL_NO_VALIDATION_PENDING; + RegRecPtr->ValidateInactiveIndex = CFE_TBL_NO_VALIDATION_PENDING; /* Since the validation was successfully performed (although maybe not a successful result) */ /* return a success status */ @@ -1251,24 +1204,22 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) if (Status == CFE_SUCCESS) { - CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_INF_EID, - CFE_EVS_EventType_INFORMATION, - CFE_TBL_Global.TableTaskAppId, - "%s validation successful for Active '%s'", + CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_INF_EID, CFE_EVS_EventType_INFORMATION, + CFE_TBL_Global.TableTaskAppId, "%s validation successful for Active '%s'", AppName, RegRecPtr->Name); } else { - CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEventWithAppID(CFE_TBL_VALIDATION_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "%s validation failed for Active '%s', Status=0x%08X", - AppName, RegRecPtr->Name, (unsigned int)Status); - + "%s validation failed for Active '%s', Status=0x%08X", AppName, + RegRecPtr->Name, (unsigned int)Status); + if (Status > CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:Validate-App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", - CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), (unsigned int)Status, RegRecPtr->Name); + CFE_ES_WriteToSysLog( + "CFE_TBL:Validate-App(%lu) Validation func return code invalid (Stat=0x%08X) for '%s'\n", + CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.TableTaskAppId), (unsigned int)Status, RegRecPtr->Name); } } @@ -1277,7 +1228,7 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) /* Once validation is complete, reset the flags */ CFE_TBL_Global.ValidationResults[RegRecPtr->ValidateActiveIndex].State = CFE_TBL_VALIDATION_PERFORMED; - RegRecPtr->ValidateActiveIndex = CFE_TBL_NO_VALIDATION_PENDING; + RegRecPtr->ValidateActiveIndex = CFE_TBL_NO_VALIDATION_PENDING; /* Since the validation was successfully performed (although maybe not a successful result) */ /* return a success status */ @@ -1291,20 +1242,19 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) else { CFE_ES_WriteToSysLog("CFE_TBL:Validate-App(%lu) does not have access to Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } return Status; -} /* End of CFE_TBL_Validate() */ - +} /* End of CFE_TBL_Validate() */ /* * Function: CFE_TBL_Manage - See API and header file for details */ -int32 CFE_TBL_Manage( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Manage(CFE_TBL_Handle_t TblHandle) { - int32 Status = CFE_SUCCESS; - bool FinishedManaging = false; + int32 Status = CFE_SUCCESS; + bool FinishedManaging = false; while (!FinishedManaging) { @@ -1326,7 +1276,7 @@ int32 CFE_TBL_Manage( CFE_TBL_Handle_t TblHandle ) { /* Dump the specified Table */ Status = CFE_TBL_DumpToBuffer(TblHandle); - + /* After a Dump, always assume we are done (Dumps are on DumpOnly tables and cannot be "Updated") */ FinishedManaging = true; } @@ -1340,7 +1290,7 @@ int32 CFE_TBL_Manage( CFE_TBL_Handle_t TblHandle ) { Status = CFE_TBL_INFO_UPDATED; } - + /* After an Update, always assume we are done and return Update Status */ FinishedManaging = true; } @@ -1351,17 +1301,16 @@ int32 CFE_TBL_Manage( CFE_TBL_Handle_t TblHandle ) } return Status; -} /* End of CFE_TBL_Manage() */ - +} /* End of CFE_TBL_Manage() */ /* * Function: CFE_TBL_GetStatus - See API and header file for details */ -int32 CFE_TBL_GetStatus( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_GetStatus(CFE_TBL_Handle_t TblHandle) { - int32 Status ; + int32 Status; CFE_ES_AppId_t ThisAppId; - CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; /* Verify that this application has the right to perform operation */ @@ -1371,7 +1320,7 @@ int32 CFE_TBL_GetStatus( CFE_TBL_Handle_t TblHandle ) { /* Get pointers to pertinent records in registry and handles */ AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; /* Perform validations prior to performing any updates */ if (RegRecPtr->LoadPending) @@ -1391,25 +1340,25 @@ int32 CFE_TBL_GetStatus( CFE_TBL_Handle_t TblHandle ) else { CFE_ES_WriteToSysLog("CFE_TBL:GetStatus-App(%lu) does not have access to Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } return Status; -} /* End of CFE_TBL_GetStatus() */ - +} /* End of CFE_TBL_GetStatus() */ /* * Function: CFE_TBL_GetInfo - See API and header file for details */ -int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) +int32 CFE_TBL_GetInfo(CFE_TBL_Info_t *TblInfoPtr, const char *TblName) { - int32 Status = CFE_SUCCESS; - int16 RegIndx; - int32 NumAccessDescriptors = 0; - CFE_TBL_RegistryRec_t *RegRecPtr; - CFE_TBL_Handle_t HandleIterator; + int32 Status = CFE_SUCCESS; + int16 RegIndx; + int32 NumAccessDescriptors = 0; + CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_Handle_t HandleIterator; - if(TblInfoPtr == NULL || TblName == NULL){ + if (TblInfoPtr == NULL || TblName == NULL) + { return CFE_TBL_BAD_ARGUMENT; } @@ -1421,22 +1370,21 @@ int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) /* Get pointer to Registry Record Entry to speed up processing */ RegRecPtr = &CFE_TBL_Global.Registry[RegIndx]; - /* Return table characteristics */ - TblInfoPtr->Size = RegRecPtr->Size; - TblInfoPtr->DoubleBuffered = RegRecPtr->DoubleBuffered; - TblInfoPtr->DumpOnly = RegRecPtr->DumpOnly; - TblInfoPtr->UserDefAddr = RegRecPtr->UserDefAddr; + /* Return table characteristics */ + TblInfoPtr->Size = RegRecPtr->Size; + TblInfoPtr->DoubleBuffered = RegRecPtr->DoubleBuffered; + TblInfoPtr->DumpOnly = RegRecPtr->DumpOnly; + TblInfoPtr->UserDefAddr = RegRecPtr->UserDefAddr; TblInfoPtr->TableLoadedOnce = RegRecPtr->TableLoadedOnce; - + /* Return information on last load and update */ - TblInfoPtr->TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; - TblInfoPtr->FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; + TblInfoPtr->TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; + TblInfoPtr->FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; TblInfoPtr->FileCreateTimeSubSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; - TblInfoPtr->Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; - strncpy(TblInfoPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, - sizeof(TblInfoPtr->LastFileLoaded)-1); - TblInfoPtr->LastFileLoaded[sizeof(TblInfoPtr->LastFileLoaded)-1] = 0; - + TblInfoPtr->Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; + strncpy(TblInfoPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, sizeof(TblInfoPtr->LastFileLoaded) - 1); + TblInfoPtr->LastFileLoaded[sizeof(TblInfoPtr->LastFileLoaded) - 1] = 0; + /* Count the number of Access Descriptors to determine the number of users */ HandleIterator = RegRecPtr->HeadOfAccessList; while (HandleIterator != CFE_TBL_END_OF_LIST) @@ -1446,8 +1394,8 @@ int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) } TblInfoPtr->NumUsers = NumAccessDescriptors; - - TblInfoPtr->Critical = RegRecPtr->CriticalTable; + + TblInfoPtr->Critical = RegRecPtr->CriticalTable; } else { @@ -1455,56 +1403,55 @@ int32 CFE_TBL_GetInfo( CFE_TBL_Info_t *TblInfoPtr, const char *TblName ) } return Status; -} /* End of CFE_TBL_GetInfo() */ +} /* End of CFE_TBL_GetInfo() */ /* * Function: CFE_TBL_DumpToBuffer - See API and header file for details */ -int32 CFE_TBL_DumpToBuffer( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_DumpToBuffer(CFE_TBL_Handle_t TblHandle) { int32 Status; CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; - CFE_TBL_RegistryRec_t *RegRecPtr = NULL; - CFE_TBL_DumpControl_t *DumpCtrlPtr = NULL; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; + CFE_TBL_DumpControl_t * DumpCtrlPtr = NULL; CFE_TIME_SysTime_t DumpTime; - + /* Make sure the table has been requested to be dumped */ Status = CFE_TBL_GetStatus(TblHandle); if (Status == CFE_TBL_INFO_DUMP_PENDING) { AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - DumpCtrlPtr = &CFE_TBL_Global.DumpControlBlocks[RegRecPtr->DumpControlIndex]; - + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + DumpCtrlPtr = &CFE_TBL_Global.DumpControlBlocks[RegRecPtr->DumpControlIndex]; + /* Copy the contents of the active buffer to the assigned dump buffer */ memcpy(DumpCtrlPtr->DumpBufferPtr->BufferPtr, RegRecPtr->Buffers[0].BufferPtr, DumpCtrlPtr->Size); - + /* Save the current time so that the header in the dump file can have the correct time */ - DumpTime = CFE_TIME_GetTime(); - DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSecs = DumpTime.Seconds; + DumpTime = CFE_TIME_GetTime(); + DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSecs = DumpTime.Seconds; DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSubSecs = DumpTime.Subseconds; - + /* Disassociate the dump request from the table */ RegRecPtr->DumpControlIndex = CFE_TBL_NO_DUMP_PENDING; - + /* Notify the Table Services Application that the dump buffer is ready to be written to a file */ DumpCtrlPtr->State = CFE_TBL_DUMP_PERFORMED; - + Status = CFE_SUCCESS; } - - return Status; -} /* End of CFE_TBL_DumpToBuffer() */ + return Status; +} /* End of CFE_TBL_DumpToBuffer() */ /* * Function: CFE_TBL_Modified - See API and header file for details */ -int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle ) +int32 CFE_TBL_Modified(CFE_TBL_Handle_t TblHandle) { int32 Status; CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; - CFE_TBL_RegistryRec_t *RegRecPtr = NULL; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; CFE_TBL_Handle_t AccessIterator; CFE_ES_AppId_t ThisAppId; size_t FilenameLen; @@ -1516,33 +1463,30 @@ int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle ) { /* Get pointers to pertinent records in registry and handles */ AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + /* If the table is a critical table, update the appropriate CDS with the new data */ if (RegRecPtr->CriticalTable == true) { CFE_TBL_UpdateCriticalTblCDS(RegRecPtr); } - + /* Keep a record of change for the ground operators reference */ - RegRecPtr->TimeOfLastUpdate = CFE_TIME_GetTime(); - RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded)-1] = '\0'; - + RegRecPtr->TimeOfLastUpdate = CFE_TIME_GetTime(); + RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = '\0'; + /* Update CRC on contents of table */ - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc = - CFE_ES_CalculateCRC(RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr, - RegRecPtr->Size, - 0, - CFE_MISSION_ES_DEFAULT_CRC); + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc = CFE_ES_CalculateCRC( + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr, RegRecPtr->Size, 0, CFE_MISSION_ES_DEFAULT_CRC); FilenameLen = strlen(RegRecPtr->LastFileLoaded); - if (FilenameLen < (sizeof(RegRecPtr->LastFileLoaded)-4)) + if (FilenameLen < (sizeof(RegRecPtr->LastFileLoaded) - 4)) { strncpy(&RegRecPtr->LastFileLoaded[FilenameLen], "(*)", 4); } else { - strncpy(&RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded)-4], "(*)", 4); + strncpy(&RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 4], "(*)", 4); } AccessIterator = RegRecPtr->HeadOfAccessList; @@ -1560,22 +1504,21 @@ int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle ) else { CFE_ES_WriteToSysLog("CFE_TBL:Modified-App(%lu) does not have access to Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } - return Status; } /* End of CFE_TBL_Modified() */ - /* * Function: CFE_TBL_NotifyByMessage - See API and header file for details */ -int32 CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, CFE_MSG_FcnCode_t CommandCode, uint32 Parameter) +int32 CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, CFE_MSG_FcnCode_t CommandCode, + uint32 Parameter) { int32 Status; CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; - CFE_TBL_RegistryRec_t *RegRecPtr = NULL; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; CFE_ES_AppId_t ThisAppId; /* Verify that this application has the right to perform operation */ @@ -1585,28 +1528,27 @@ int32 CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, { /* Get pointers to pertinent records in registry and handles */ AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + /* Verify that the calling application is the table owner */ if (CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, ThisAppId)) { RegRecPtr->NotificationMsgId = MsgId; - RegRecPtr->NotificationCC = CommandCode; + RegRecPtr->NotificationCC = CommandCode; RegRecPtr->NotificationParam = Parameter; - RegRecPtr->NotifyByMsg = true; + RegRecPtr->NotifyByMsg = true; } else { Status = CFE_TBL_ERR_NO_ACCESS; CFE_ES_WriteToSysLog("CFE_TBL:NotifyByMsg-App(%lu) does not own Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } } - + return Status; -} /* End of CFE_TBL_NotifyByMessage() */ +} /* End of CFE_TBL_NotifyByMessage() */ /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.c b/modules/tbl/fsw/src/cfe_tbl_internal.c index 30c6740aa..df6045b8d 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.c +++ b/modules/tbl/fsw/src/cfe_tbl_internal.c @@ -29,7 +29,6 @@ ** */ - /* ** Required header files... */ @@ -58,87 +57,81 @@ ** Return: ** none */ -int32 CFE_TBL_EarlyInit (void) +int32 CFE_TBL_EarlyInit(void) { uint16 i; uint32 j; - int32 Status; + int32 Status; /* Clear task global */ memset(&CFE_TBL_Global, 0, sizeof(CFE_TBL_Global)); /* Initialize the Table Registry */ - for(i=0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) + for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) { CFE_TBL_InitRegistryRecord(&CFE_TBL_Global.Registry[i]); } /* Initialize the Table Access Descriptors nonzero values */ - for (i=0; i= CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE)); + } while ((j < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS) && (Status >= CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE)); } - + /* Try to obtain a previous image of the Critical Table Registry from the Critical Data Store */ Status = CFE_ES_RegisterCDSEx(&CFE_TBL_Global.CritRegHandle, - (sizeof(CFE_TBL_CritRegRec_t)*CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES), + (sizeof(CFE_TBL_CritRegRec_t) * CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES), "CFE_TBL.CritReg", true); - + /* Assume for the moment that nothing is already in the CDS and zero out the Critical Table Registry */ - for (i=0; iOwnerAppId = CFE_TBL_NOT_OWNED; - RegRecPtr->NotificationMsgId = CFE_SB_INVALID_MSG_ID; - RegRecPtr->HeadOfAccessList = CFE_TBL_END_OF_LIST; - RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - RegRecPtr->ValidateActiveIndex = CFE_TBL_NO_VALIDATION_PENDING; + RegRecPtr->OwnerAppId = CFE_TBL_NOT_OWNED; + RegRecPtr->NotificationMsgId = CFE_SB_INVALID_MSG_ID; + RegRecPtr->HeadOfAccessList = CFE_TBL_END_OF_LIST; + RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; + RegRecPtr->ValidateActiveIndex = CFE_TBL_NO_VALIDATION_PENDING; RegRecPtr->ValidateInactiveIndex = CFE_TBL_NO_VALIDATION_PENDING; - RegRecPtr->CDSHandle = CFE_ES_CDS_BAD_HANDLE; - RegRecPtr->DumpControlIndex = CFE_TBL_NO_DUMP_PENDING; + RegRecPtr->CDSHandle = CFE_ES_CDS_BAD_HANDLE; + RegRecPtr->DumpControlIndex = CFE_TBL_NO_DUMP_PENDING; } /* End CFE_TBL_InitRegistryRecord */ - /******************************************************************* ** ** CFE_TBL_ValidateHandle @@ -239,7 +232,6 @@ void CFE_TBL_InitRegistryRecord (CFE_TBL_RegistryRec_t *RegRecPtr) ** NOTE: For complete prolog information, see 'cfe_tbl_internal.h' ********************************************************************/ - int32 CFE_TBL_ValidateHandle(CFE_TBL_Handle_t TblHandle) { /* Is the handle out of range? */ @@ -256,7 +248,7 @@ int32 CFE_TBL_ValidateHandle(CFE_TBL_Handle_t TblHandle) } } return CFE_SUCCESS; -} /* End of CFE_TBL_ValidateHandle() */ +} /* End of CFE_TBL_ValidateHandle() */ /******************************************************************* ** @@ -288,8 +280,7 @@ int32 CFE_TBL_ValidateAccess(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t *AppIdPt Status = CFE_TBL_CheckAccessRights(TblHandle, *AppIdPtr); return Status; -} /* End of CFE_TBL_ValidateAccess() */ - +} /* End of CFE_TBL_ValidateAccess() */ /******************************************************************* ** @@ -324,9 +315,9 @@ int32 CFE_TBL_CheckAccessRights(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t ThisA int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) { - int32 Status = CFE_SUCCESS; + int32 Status = CFE_SUCCESS; CFE_TBL_AccessDescriptor_t *AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - CFE_TBL_RegistryRec_t *RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + CFE_TBL_RegistryRec_t * RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; /* Lock Access to the table while we modify the linked list */ CFE_TBL_LockRegistry(); @@ -371,8 +362,10 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) if (Status < 0) { - CFE_ES_WriteToSysLog("CFE_TBL:RemoveAccessLink-PutPoolBuf[0] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), (unsigned long)RegRecPtr->Buffers[0].BufferPtr); + CFE_ES_WriteToSysLog( + "CFE_TBL:RemoveAccessLink-PutPoolBuf[0] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), + (unsigned long)RegRecPtr->Buffers[0].BufferPtr); } /* If a double buffered table, then free the second buffer as well */ @@ -383,8 +376,10 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) if (Status < 0) { - CFE_ES_WriteToSysLog("CFE_TBL:RemoveAccessLink-PutPoolBuf[1] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", - (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), (unsigned long)RegRecPtr->Buffers[1].BufferPtr); + CFE_ES_WriteToSysLog( + "CFE_TBL:RemoveAccessLink-PutPoolBuf[1] Fail Stat=0x%08X, Hndl=0x%08lX, Buf=0x%08lX\n", + (unsigned int)Status, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Buf.PoolHdl), + (unsigned long)RegRecPtr->Buffers[1].BufferPtr); } } else @@ -394,7 +389,7 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) { /* Free the working buffer */ CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken = false; - RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; + RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; } } } @@ -404,8 +399,7 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) CFE_TBL_UnlockRegistry(); return Status; -} /* End of CFE_TBL_RemoveAccessLink() */ - +} /* End of CFE_TBL_RemoveAccessLink() */ /******************************************************************* ** @@ -414,12 +408,11 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle) ** NOTE: For complete prolog information, see 'cfe_tbl_internal.h' ********************************************************************/ - int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t ThisAppId) { - int32 Status; + int32 Status; CFE_TBL_AccessDescriptor_t *AccessDescPtr; - CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_RegistryRec_t * RegRecPtr; /* Check table handle validity */ Status = CFE_TBL_ValidateHandle(TblHandle); @@ -467,18 +460,17 @@ int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CFE_ else { CFE_ES_WriteToSysLog("CFE_TBL:GetAddressInternal-App(%lu) does not have access to Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } } else { CFE_ES_WriteToSysLog("CFE_TBL:GetAddressInternal-App(%lu) using invalid Tbl Handle=%d\n", - CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); + CFE_RESOURCEID_TO_ULONG(ThisAppId), (int)TblHandle); } return Status; -} /* End of CFE_TBL_GetAddressInternal() */ - +} /* End of CFE_TBL_GetAddressInternal() */ /******************************************************************* ** @@ -489,9 +481,9 @@ int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CFE_ int32 CFE_TBL_GetNextNotification(CFE_TBL_Handle_t TblHandle) { - int32 Status = CFE_SUCCESS; + int32 Status = CFE_SUCCESS; CFE_TBL_AccessDescriptor_t *AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle]; - CFE_TBL_RegistryRec_t *RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + CFE_TBL_RegistryRec_t * RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; if (!RegRecPtr->TableLoadedOnce) { @@ -505,8 +497,7 @@ int32 CFE_TBL_GetNextNotification(CFE_TBL_Handle_t TblHandle) } return Status; -} /* End of CFE_TBL_GetNextNotification() */ - +} /* End of CFE_TBL_GetNextNotification() */ /******************************************************************* ** @@ -518,7 +509,7 @@ int32 CFE_TBL_GetNextNotification(CFE_TBL_Handle_t TblHandle) int16 CFE_TBL_FindTableInRegistry(const char *TblName) { int16 RegIndx = CFE_TBL_NOT_FOUND; - int16 i = -1; + int16 i = -1; do { @@ -526,7 +517,7 @@ int16 CFE_TBL_FindTableInRegistry(const char *TblName) i++; /* Check to see if the record is currently being used */ - if ( !CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.Registry[i].OwnerAppId, CFE_TBL_NOT_OWNED) ) + if (!CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.Registry[i].OwnerAppId, CFE_TBL_NOT_OWNED)) { /* Perform a case sensitive name comparison */ if (strcmp(TblName, CFE_TBL_Global.Registry[i].Name) == 0) @@ -535,11 +526,10 @@ int16 CFE_TBL_FindTableInRegistry(const char *TblName) RegIndx = i; } } - } while ( (RegIndx == CFE_TBL_NOT_FOUND) && (i < (CFE_PLATFORM_TBL_MAX_NUM_TABLES-1)) ); + } while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < (CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1))); return RegIndx; -} /* End of CFE_TBL_FindTableInRegistry() */ - +} /* End of CFE_TBL_FindTableInRegistry() */ /******************************************************************* ** @@ -551,9 +541,9 @@ int16 CFE_TBL_FindTableInRegistry(const char *TblName) int16 CFE_TBL_FindFreeRegistryEntry(void) { int16 RegIndx = CFE_TBL_NOT_FOUND; - int16 i = 0; + int16 i = 0; - while ( (RegIndx == CFE_TBL_NOT_FOUND) && (i < CFE_PLATFORM_TBL_MAX_NUM_TABLES) ) + while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < CFE_PLATFORM_TBL_MAX_NUM_TABLES)) { /* A Table Registry is only "Free" when there isn't an owner AND */ /* all other applications are not sharing or locking the table */ @@ -569,8 +559,7 @@ int16 CFE_TBL_FindFreeRegistryEntry(void) } return RegIndx; -} /* End of CFE_TBL_FindFreeRegistryEntry() */ - +} /* End of CFE_TBL_FindFreeRegistryEntry() */ /******************************************************************* ** @@ -582,7 +571,7 @@ int16 CFE_TBL_FindFreeRegistryEntry(void) CFE_TBL_Handle_t CFE_TBL_FindFreeHandle(void) { CFE_TBL_Handle_t HandleIndx = CFE_TBL_END_OF_LIST; - int16 i = 0; + int16 i = 0; while ((HandleIndx == CFE_TBL_END_OF_LIST) && (i < CFE_PLATFORM_TBL_MAX_NUM_HANDLES)) { @@ -597,8 +586,7 @@ CFE_TBL_Handle_t CFE_TBL_FindFreeHandle(void) } return HandleIndx; -} /* End of CFE_TBL_FindFreeHandle() */ - +} /* End of CFE_TBL_FindFreeHandle() */ /******************************************************************* ** @@ -614,14 +602,13 @@ void CFE_TBL_FormTableName(char *FullTblName, const char *TblName, CFE_ES_AppId_ CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); /* Ensure that AppName is null terminated */ - AppName[OS_MAX_API_NAME-1] = '\0'; + AppName[OS_MAX_API_NAME - 1] = '\0'; /* Complete formation of processor specific table name */ sprintf(FullTblName, "%s.%s", AppName, TblName); return; -} /* End of CFE_TBL_FormTableName() */ - +} /* End of CFE_TBL_FormTableName() */ /******************************************************************* ** @@ -632,20 +619,18 @@ void CFE_TBL_FormTableName(char *FullTblName, const char *TblName, CFE_ES_AppId_ int32 CFE_TBL_LockRegistry(void) { - int32 Status; + int32 Status; Status = OS_MutSemTake(CFE_TBL_Global.RegistryMutex); if (Status == OS_SUCCESS) { Status = CFE_SUCCESS; - } return Status; -} /* End of CFE_TBL_LockRegistry() */ - +} /* End of CFE_TBL_LockRegistry() */ /******************************************************************* ** @@ -656,20 +641,18 @@ int32 CFE_TBL_LockRegistry(void) int32 CFE_TBL_UnlockRegistry(void) { - int32 Status; + int32 Status; Status = OS_MutSemGive(CFE_TBL_Global.RegistryMutex); if (Status == OS_SUCCESS) { Status = CFE_SUCCESS; - } return Status; -} /* End of CFE_TBL_UnlockRegistry() */ - +} /* End of CFE_TBL_UnlockRegistry() */ /******************************************************************* ** @@ -678,13 +661,12 @@ int32 CFE_TBL_UnlockRegistry(void) ** NOTE: For complete prolog information, see 'cfe_tbl_internal.h' ********************************************************************/ -int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, - CFE_TBL_RegistryRec_t *RegRecPtr, +int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, CFE_TBL_RegistryRec_t *RegRecPtr, bool CalledByApp) { - int32 Status = CFE_SUCCESS; - int32 i; - int32 InactiveBufferIndex; + int32 Status = CFE_SUCCESS; + int32 i; + int32 InactiveBufferIndex; CFE_TBL_Handle_t AccessIterator; /* Initialize return pointer to NULL */ @@ -695,7 +677,7 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, { if (RegRecPtr->DoubleBuffered) { - *WorkingBufferPtr = &RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)]; + *WorkingBufferPtr = &RegRecPtr->Buffers[(1U - RegRecPtr->ActiveBufferIndex)]; } else { @@ -733,12 +715,13 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, while ((AccessIterator != CFE_TBL_END_OF_LIST) && (Status == CFE_SUCCESS)) { if ((CFE_TBL_Global.Handles[AccessIterator].BufferIndex == InactiveBufferIndex) && - (CFE_TBL_Global.Handles[AccessIterator].LockFlag)) + (CFE_TBL_Global.Handles[AccessIterator].LockFlag)) { Status = CFE_TBL_ERR_NO_BUFFER_AVAIL; - CFE_ES_WriteToSysLog("CFE_TBL:GetWorkingBuffer-Inactive Dbl Buff Locked for '%s' by AppId=%lu\n", - RegRecPtr->Name, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Handles[AccessIterator].AppId)); + CFE_ES_WriteToSysLog( + "CFE_TBL:GetWorkingBuffer-Inactive Dbl Buff Locked for '%s' by AppId=%lu\n", + RegRecPtr->Name, CFE_RESOURCEID_TO_ULONG(CFE_TBL_Global.Handles[AccessIterator].AppId)); } /* Move to next access descriptor in linked list */ @@ -748,7 +731,7 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, /* If buffer is free, then return the pointer to it */ if (Status == CFE_SUCCESS) { - *WorkingBufferPtr = &RegRecPtr->Buffers[InactiveBufferIndex]; + *WorkingBufferPtr = &RegRecPtr->Buffers[InactiveBufferIndex]; RegRecPtr->LoadInProgress = InactiveBufferIndex; } } @@ -762,7 +745,7 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, if (Status != OS_SUCCESS) { CFE_ES_WriteToSysLog("CFE_TBL:GetWorkBuf-Internal error taking WorkBuf Mutex (Status=0x%08X)\n", - (unsigned int)Status); + (unsigned int)Status); } /* Determine if there are any common buffers available */ @@ -776,8 +759,8 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, if (i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS) { CFE_TBL_Global.LoadBuffs[i].Taken = true; - *WorkingBufferPtr = &CFE_TBL_Global.LoadBuffs[i]; - RegRecPtr->LoadInProgress = i; + *WorkingBufferPtr = &CFE_TBL_Global.LoadBuffs[i]; + RegRecPtr->LoadInProgress = i; /* Translate OS_SUCCESS into CFE_SUCCESS */ Status = CFE_SUCCESS; @@ -794,21 +777,18 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, } if ((*WorkingBufferPtr) != NULL && - (*WorkingBufferPtr)->BufferPtr != RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr) + (*WorkingBufferPtr)->BufferPtr != RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr) { /* In case the file contains a partial table load, get the active buffer contents first */ - memcpy((*WorkingBufferPtr)->BufferPtr, - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr, - RegRecPtr->Size); + memcpy((*WorkingBufferPtr)->BufferPtr, RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr, + RegRecPtr->Size); } } } - return Status; -} /* End of CFE_TBL_GetWorkingBuffer() */ - +} /* End of CFE_TBL_GetWorkingBuffer() */ /******************************************************************* ** @@ -817,25 +797,23 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, ** NOTE: For complete prolog information, see 'cfe_tbl_internal.h' ********************************************************************/ -int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBufferPtr, - CFE_TBL_RegistryRec_t *RegRecPtr, +int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBufferPtr, CFE_TBL_RegistryRec_t *RegRecPtr, const char *Filename) { - int32 Status = CFE_SUCCESS; - CFE_FS_Header_t StdFileHeader; - CFE_TBL_File_Hdr_t TblFileHeader; - osal_id_t FileDescriptor; - size_t FilenameLen = strlen(Filename); - uint32 NumBytes; - uint8 ExtraByte; - - if (FilenameLen > (OS_MAX_PATH_LEN-1)) + int32 Status = CFE_SUCCESS; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_File_Hdr_t TblFileHeader; + osal_id_t FileDescriptor; + size_t FilenameLen = strlen(Filename); + uint32 NumBytes; + uint8 ExtraByte; + + if (FilenameLen > (OS_MAX_PATH_LEN - 1)) { - CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_FILENAME_LONG_ERR_EID, - CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "%s: Filename is too long ('%s' (%lu) > %lu)", - AppName, Filename, (long unsigned int)FilenameLen, - (long unsigned int)OS_MAX_PATH_LEN-1); + CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_FILENAME_LONG_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_TBL_Global.TableTaskAppId, "%s: Filename is too long ('%s' (%lu) > %lu)", + AppName, Filename, (long unsigned int)FilenameLen, + (long unsigned int)OS_MAX_PATH_LEN - 1); return CFE_TBL_ERR_FILENAME_TOO_LONG; } @@ -845,12 +823,10 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe if (Status < 0) { - CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_ACCESS_ERR_EID, - CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "%s: Unable to open file (FileDescriptor=%d)", - AppName, (int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_ACCESS_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s: Unable to open file (FileDescriptor=%d)", AppName, (int)Status); - return CFE_TBL_ERR_ACCESS; + return CFE_TBL_ERR_ACCESS; } Status = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); @@ -859,17 +835,16 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe { /* CFE_TBL_ReadHeaders() generates its own events */ - OS_close (FileDescriptor); + OS_close(FileDescriptor); return Status; } /* Verify that the specified file has compatible data for specified table */ if (strcmp(RegRecPtr->Name, TblFileHeader.TableName) != 0) { - CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID, - CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "%s: Table name mismatch (exp=%s, tblfilhdr=%s)", - AppName, RegRecPtr->Name, TblFileHeader.TableName); + CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_TBL_Global.TableTaskAppId, "%s: Table name mismatch (exp=%s, tblfilhdr=%s)", + AppName, RegRecPtr->Name, TblFileHeader.TableName); OS_close(FileDescriptor); return CFE_TBL_ERR_FILE_FOR_WRONG_TABLE; @@ -877,12 +852,10 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe if ((TblFileHeader.Offset + TblFileHeader.NumBytes) > RegRecPtr->Size) { - CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID, - CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "%s: File reports size larger than expected (file=%lu, exp=%lu)", - AppName, - (long unsigned int)(TblFileHeader.Offset + TblFileHeader.NumBytes), - (long unsigned int)RegRecPtr->Size); + CFE_EVS_SendEventWithAppID( + CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s: File reports size larger than expected (file=%lu, exp=%lu)", AppName, + (long unsigned int)(TblFileHeader.Offset + TblFileHeader.NumBytes), (long unsigned int)RegRecPtr->Size); OS_close(FileDescriptor); return CFE_TBL_ERR_FILE_TOO_LARGE; @@ -900,32 +873,28 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe Status = CFE_TBL_WARN_SHORT_FILE; } - NumBytes = OS_read(FileDescriptor, - ((uint8*)WorkingBufferPtr->BufferPtr) + TblFileHeader.Offset, - TblFileHeader.NumBytes); + NumBytes = + OS_read(FileDescriptor, ((uint8 *)WorkingBufferPtr->BufferPtr) + TblFileHeader.Offset, TblFileHeader.NumBytes); if (NumBytes != TblFileHeader.NumBytes) { - CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_INCOMPLETE_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: File load incomplete (exp=%lu, read=%lu)", - AppName, (long unsigned int)TblFileHeader.NumBytes, - (long unsigned int)NumBytes); + CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_INCOMPLETE_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_TBL_Global.TableTaskAppId, "%s: File load incomplete (exp=%lu, read=%lu)", + AppName, (long unsigned int)TblFileHeader.NumBytes, (long unsigned int)NumBytes); OS_close(FileDescriptor); return CFE_TBL_ERR_LOAD_INCOMPLETE; } - + /* Check to see if the file is too large (ie - more data than header claims) */ NumBytes = OS_read(FileDescriptor, &ExtraByte, 1); - + /* If successfully read another byte, then file must have too much data */ if (NumBytes == 1) { - CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_TOO_BIG_ERR_EID, CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "%s: File load too long (file length > %lu)", - AppName, (long unsigned int)TblFileHeader.NumBytes); + CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_TOO_BIG_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "%s: File load too long (file length > %lu)", AppName, + (long unsigned int)TblFileHeader.NumBytes); OS_close(FileDescriptor); return CFE_TBL_ERR_FILE_TOO_LARGE; @@ -935,21 +904,18 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe strncpy(WorkingBufferPtr->DataSource, Filename, sizeof(WorkingBufferPtr->DataSource) - 1); /* Save file creation time for later storage into Registry */ - WorkingBufferPtr->FileCreateTimeSecs = StdFileHeader.TimeSeconds; + WorkingBufferPtr->FileCreateTimeSecs = StdFileHeader.TimeSeconds; WorkingBufferPtr->FileCreateTimeSubSecs = StdFileHeader.TimeSubSeconds; - + /* Compute the CRC on the specified table buffer */ - WorkingBufferPtr->Crc = CFE_ES_CalculateCRC(WorkingBufferPtr->BufferPtr, - RegRecPtr->Size, - 0, - CFE_MISSION_ES_DEFAULT_CRC); + WorkingBufferPtr->Crc = + CFE_ES_CalculateCRC(WorkingBufferPtr->BufferPtr, RegRecPtr->Size, 0, CFE_MISSION_ES_DEFAULT_CRC); OS_close(FileDescriptor); return Status; } /* End of CFE_TBL_LoadFromFile() */ - /******************************************************************* ** ** CFE_TBL_UpdateInternal @@ -957,14 +923,13 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe ** NOTE: For complete prolog information, see 'cfe_tbl_internal.h' ********************************************************************/ -int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, - CFE_TBL_RegistryRec_t *RegRecPtr, - CFE_TBL_AccessDescriptor_t *AccessDescPtr ) +int32 CFE_TBL_UpdateInternal(CFE_TBL_Handle_t TblHandle, CFE_TBL_RegistryRec_t *RegRecPtr, + CFE_TBL_AccessDescriptor_t *AccessDescPtr) { - int32 Status = CFE_SUCCESS; + int32 Status = CFE_SUCCESS; CFE_TBL_Handle_t AccessIterator; - bool LockStatus = false; - + bool LockStatus = false; + if ((!RegRecPtr->LoadPending) || (RegRecPtr->LoadInProgress == CFE_TBL_NO_LOAD_IN_PROGRESS)) { /* Question: Should calling CFE_TBL_Update on a table with no load pending */ @@ -981,13 +946,12 @@ int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, /* Source description in buffer should already have been updated by either */ /* the LoadFromFile function or the Load function (when a memory load). */ /* However, we need to copy it into active registry area */ - strncpy(RegRecPtr->LastFileLoaded, - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].DataSource, + strncpy(RegRecPtr->LastFileLoaded, RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].DataSource, sizeof(RegRecPtr->LastFileLoaded) - 1); RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = '\0'; CFE_TBL_NotifyTblUsersOfUpdate(RegRecPtr); - + /* If the table is a critical table, update the appropriate CDS with the new data */ if (RegRecPtr->CriticalTable == true) { @@ -1014,30 +978,27 @@ int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, else { /* To update a single buffered table requires a memcpy from working buffer */ - if (RegRecPtr->Buffers[0].BufferPtr != - CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr) + if (RegRecPtr->Buffers[0].BufferPtr != CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr) { memcpy(RegRecPtr->Buffers[0].BufferPtr, - CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr, - RegRecPtr->Size); + CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr, RegRecPtr->Size); } /* Save source description with active buffer */ strncpy(RegRecPtr->Buffers[0].DataSource, CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].DataSource, - sizeof(RegRecPtr->Buffers[0].DataSource)-1); - RegRecPtr->Buffers[0].DataSource[sizeof(RegRecPtr->Buffers[0].DataSource)-1] = 0; - strncpy(RegRecPtr->LastFileLoaded, - CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].DataSource, - sizeof(RegRecPtr->LastFileLoaded)-1); - RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded)-1] = 0; - + sizeof(RegRecPtr->Buffers[0].DataSource) - 1); + RegRecPtr->Buffers[0].DataSource[sizeof(RegRecPtr->Buffers[0].DataSource) - 1] = 0; + strncpy(RegRecPtr->LastFileLoaded, CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].DataSource, + sizeof(RegRecPtr->LastFileLoaded) - 1); + RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = 0; + /* Save the file creation time from the loaded file into the Table Registry */ - RegRecPtr->Buffers[0].FileCreateTimeSecs = + RegRecPtr->Buffers[0].FileCreateTimeSecs = CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].FileCreateTimeSecs; - RegRecPtr->Buffers[0].FileCreateTimeSubSecs = + RegRecPtr->Buffers[0].FileCreateTimeSubSecs = CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].FileCreateTimeSubSecs; - + /* Save the previously computed CRC into the new buffer */ RegRecPtr->Buffers[0].Crc = CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Crc; @@ -1045,7 +1006,7 @@ int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken = false; CFE_TBL_NotifyTblUsersOfUpdate(RegRecPtr); - + /* If the table is a critical table, update the appropriate CDS with the new data */ if (RegRecPtr->CriticalTable == true) { @@ -1056,8 +1017,7 @@ int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, } return Status; -} /* End of CFE_TBL_UpdateInternal() */ - +} /* End of CFE_TBL_UpdateInternal() */ /******************************************************************* ** @@ -1069,15 +1029,15 @@ int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, void CFE_TBL_NotifyTblUsersOfUpdate(CFE_TBL_RegistryRec_t *RegRecPtr) { CFE_TBL_Handle_t AccessIterator; - + /* Reset Load in Progress Values */ - RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; + RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; RegRecPtr->TimeOfLastUpdate = CFE_TIME_GetTime(); /* Clear notification of pending load (as well as NO LOAD) and notify everyone of update */ - RegRecPtr->LoadPending = false; + RegRecPtr->LoadPending = false; RegRecPtr->TableLoadedOnce = true; - AccessIterator = RegRecPtr->HeadOfAccessList; + AccessIterator = RegRecPtr->HeadOfAccessList; while (AccessIterator != CFE_TBL_END_OF_LIST) { CFE_TBL_Global.Handles[AccessIterator].Updated = true; @@ -1093,36 +1053,32 @@ void CFE_TBL_NotifyTblUsersOfUpdate(CFE_TBL_RegistryRec_t *RegRecPtr) ** NOTE: For complete prolog information, see 'cfe_tbl_internal.h' ********************************************************************/ -int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, - CFE_FS_Header_t *StdFileHeaderPtr, - CFE_TBL_File_Hdr_t *TblFileHeaderPtr, - const char *LoadFilename ) +int32 CFE_TBL_ReadHeaders(osal_id_t FileDescriptor, CFE_FS_Header_t *StdFileHeaderPtr, + CFE_TBL_File_Hdr_t *TblFileHeaderPtr, const char *LoadFilename) { int32 Status; int32 EndianCheck = 0x01020304; - #if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) - static uint32 ListSC[2] = { CFE_PLATFORM_TBL_VALID_SCID_1, CFE_PLATFORM_TBL_VALID_SCID_2}; - uint32 IndexSC; - #endif - - #if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) - static uint32 ListPR[4] = { CFE_PLATFORM_TBL_VALID_PRID_1, CFE_PLATFORM_TBL_VALID_PRID_2, - CFE_PLATFORM_TBL_VALID_PRID_3, CFE_PLATFORM_TBL_VALID_PRID_4}; - uint32 IndexPR; - #endif - +#if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) + static uint32 ListSC[2] = {CFE_PLATFORM_TBL_VALID_SCID_1, CFE_PLATFORM_TBL_VALID_SCID_2}; + uint32 IndexSC; +#endif + +#if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) + static uint32 ListPR[4] = {CFE_PLATFORM_TBL_VALID_PRID_1, CFE_PLATFORM_TBL_VALID_PRID_2, + CFE_PLATFORM_TBL_VALID_PRID_3, CFE_PLATFORM_TBL_VALID_PRID_4}; + uint32 IndexPR; +#endif + /* Once the file is open, read the headers to determine the target Table */ Status = CFE_FS_ReadHeader(StdFileHeaderPtr, FileDescriptor); /* Verify successful read of standard cFE File Header */ if (Status != sizeof(CFE_FS_Header_t)) { - CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_STD_HDR_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "Unable to read std header for '%s', Status = 0x%08X", - LoadFilename, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_STD_HDR_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "Unable to read std header for '%s', Status = 0x%08X", LoadFilename, + (unsigned int)Status); Status = CFE_TBL_ERR_NO_STD_HEADER; } @@ -1131,11 +1087,10 @@ int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, /* Verify the file type is a cFE compatible file */ if (StdFileHeaderPtr->ContentType != CFE_FS_FILE_CONTENT_ID) { - CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_TYPE_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_TYPE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "File '%s' is not a cFE file type, ContentType = 0x%08X", - LoadFilename, (unsigned int)StdFileHeaderPtr->ContentType); + "File '%s' is not a cFE file type, ContentType = 0x%08X", LoadFilename, + (unsigned int)StdFileHeaderPtr->ContentType); Status = CFE_TBL_ERR_BAD_CONTENT_ID; } @@ -1144,11 +1099,10 @@ int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, /* Verify the SubType to ensure that it is a Table Image File */ if (StdFileHeaderPtr->SubType != CFE_FS_SubType_TBL_IMG) { - CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_SUBTYPE_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_SUBTYPE_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, - "File subtype for '%s' is wrong. Subtype = 0x%08X", - LoadFilename, (unsigned int)StdFileHeaderPtr->SubType); + "File subtype for '%s' is wrong. Subtype = 0x%08X", LoadFilename, + (unsigned int)StdFileHeaderPtr->SubType); Status = CFE_TBL_ERR_BAD_SUBTYPE_ID; } @@ -1159,11 +1113,9 @@ int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, /* Verify successful read of cFE Table File Header */ if (Status != sizeof(CFE_TBL_File_Hdr_t)) { - CFE_EVS_SendEventWithAppID(CFE_TBL_FILE_TBL_HDR_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "Unable to read tbl header for '%s', Status = 0x%08X", - LoadFilename, (unsigned int)Status); + CFE_EVS_SendEventWithAppID( + CFE_TBL_FILE_TBL_HDR_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, + "Unable to read tbl header for '%s', Status = 0x%08X", LoadFilename, (unsigned int)Status); Status = CFE_TBL_ERR_NO_TBL_HEADER; } @@ -1188,8 +1140,8 @@ int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, */ TblFileHeaderPtr->TableName[sizeof(TblFileHeaderPtr->TableName) - 1] = '\0'; - /* Verify Spacecraft ID contained in table file header [optional] */ - #if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) +/* Verify Spacecraft ID contained in table file header [optional] */ +#if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) if (Status == CFE_SUCCESS) { Status = CFE_TBL_ERR_BAD_SPACECRAFT_ID; @@ -1203,17 +1155,16 @@ int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, if (Status == CFE_TBL_ERR_BAD_SPACECRAFT_ID) { - CFE_EVS_SendEventWithAppID(CFE_TBL_SPACECRAFT_ID_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEventWithAppID(CFE_TBL_SPACECRAFT_ID_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, "Unable to verify Spacecraft ID for '%s', ID = 0x%08X", LoadFilename, (unsigned int)StdFileHeaderPtr->SpacecraftID); } } - #endif +#endif - /* Verify Processor ID contained in table file header [optional] */ - #if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) +/* Verify Processor ID contained in table file header [optional] */ +#if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) if (Status == CFE_SUCCESS) { Status = CFE_TBL_ERR_BAD_PROCESSOR_ID; @@ -1227,22 +1178,20 @@ int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, if (Status == CFE_TBL_ERR_BAD_PROCESSOR_ID) { - CFE_EVS_SendEventWithAppID(CFE_TBL_PROCESSOR_ID_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEventWithAppID(CFE_TBL_PROCESSOR_ID_ERR_EID, CFE_EVS_EventType_ERROR, CFE_TBL_Global.TableTaskAppId, "Unable to verify Processor ID for '%s', ID = 0x%08X", LoadFilename, (unsigned int)StdFileHeaderPtr->ProcessorID); } } - #endif +#endif } } } } return Status; -} /* End of CFE_TBL_ReadHeaders() */ - +} /* End of CFE_TBL_ReadHeaders() */ /******************************************************************* ** @@ -1258,7 +1207,6 @@ void CFE_TBL_ByteSwapTblHeader(CFE_TBL_File_Hdr_t *HdrPtr) CFE_TBL_ByteSwapUint32(&HdrPtr->NumBytes); } /* End of CFE_TBL_ByteSwapTblHeader() */ - /******************************************************************* ** ** CFE_TBL_ByteSwapUint32 @@ -1268,14 +1216,14 @@ void CFE_TBL_ByteSwapTblHeader(CFE_TBL_File_Hdr_t *HdrPtr) void CFE_TBL_ByteSwapUint32(uint32 *Uint32ToSwapPtr) { - int32 Temp = *Uint32ToSwapPtr; - char *InPtr = (char *)&Temp; + int32 Temp = *Uint32ToSwapPtr; + char *InPtr = (char *)&Temp; char *OutPtr = (char *)Uint32ToSwapPtr; - + OutPtr[0] = InPtr[3]; OutPtr[1] = InPtr[2]; OutPtr[2] = InPtr[1]; - OutPtr[3] = InPtr[0]; + OutPtr[3] = InPtr[0]; } /* End of CFE_TBL_ByteSwapUint32() */ /******************************************************************* @@ -1287,29 +1235,29 @@ void CFE_TBL_ByteSwapUint32(uint32 *Uint32ToSwapPtr) int32 CFE_TBL_CleanUpApp(CFE_ES_AppId_t AppId) { - uint32 i; - CFE_TBL_RegistryRec_t *RegRecPtr = NULL; + uint32 i; + CFE_TBL_RegistryRec_t * RegRecPtr = NULL; CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; /* Scan Dump Requests to determine if any of the tables that */ /* were to be dumped will be deleted */ - for (i=0; iOwnerAppId, AppId)) + CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.DumpControlBlocks[i].RegRecPtr->OwnerAppId, AppId)) { /* If so, then remove the dump request */ CFE_TBL_Global.DumpControlBlocks[i].State = CFE_TBL_DUMP_FREE; } } - + /* Scan Access Descriptors to determine if the Application had access to any tables */ - for (i=0; iName[0] = '\0'; } - + /* Remove the Access Descriptor Link from linked list */ /* NOTE: If this removes the last access link, then */ /* memory buffers are set free as well. */ CFE_TBL_RemoveAccessLink(i); - - CFE_TBL_Global.Handles[i].AppId = CFE_TBL_NOT_OWNED; + CFE_TBL_Global.Handles[i].AppId = CFE_TBL_NOT_OWNED; } } @@ -1355,13 +1302,13 @@ int32 CFE_TBL_CleanUpApp(CFE_ES_AppId_t AppId) void CFE_TBL_FindCriticalTblInfo(CFE_TBL_CritRegRec_t **CritRegRecPtr, CFE_ES_CDSHandle_t CDSHandleToFind) { uint32 i; - + /* Assume the record is never found */ *CritRegRecPtr = NULL; - - for (i=0; iCDSHandle, RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr); - + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:UpdateCritTbl-Unable to update Critical Table '%s' in CDS (Err=0x%08X)\n", + CFE_ES_WriteToSysLog("CFE_TBL:UpdateCritTbl-Unable to update Critical Table '%s' in CDS (Err=0x%08X)\n", RegRecPtr->Name, (unsigned int)Status); } else { - /* Locate entry in Critical Table Registry */ + /* Locate entry in Critical Table Registry */ CFE_TBL_FindCriticalTblInfo(&CritRegRecPtr, RegRecPtr->CDSHandle); if (CritRegRecPtr != NULL) { /* Save information related to the source of the data stored in the table in Critical Table Registry */ CritRegRecPtr->FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; - CritRegRecPtr->FileCreateTimeSubSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; - strncpy(CritRegRecPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, sizeof(CritRegRecPtr->LastFileLoaded) - 1); + CritRegRecPtr->FileCreateTimeSubSecs = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; + strncpy(CritRegRecPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, + sizeof(CritRegRecPtr->LastFileLoaded) - 1); CritRegRecPtr->LastFileLoaded[sizeof(CritRegRecPtr->LastFileLoaded) - 1] = '\0'; - CritRegRecPtr->TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; - CritRegRecPtr->TableLoadedOnce = RegRecPtr->TableLoadedOnce; - + CritRegRecPtr->TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; + CritRegRecPtr->TableLoadedOnce = RegRecPtr->TableLoadedOnce; + /* Update copy of Critical Table Registry in the CDS */ Status = CFE_ES_CopyToCDS(CFE_TBL_Global.CritRegHandle, CFE_TBL_Global.CritReg); - + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:UpdateCritTbl-Unable to update Critical Table Registry in CDS (Err=0x%08X)\n", - (unsigned int)Status); + CFE_ES_WriteToSysLog( + "CFE_TBL:UpdateCritTbl-Unable to update Critical Table Registry in CDS (Err=0x%08X)\n", + (unsigned int)Status); } } else { - CFE_ES_WriteToSysLog("CFE_TBL:UpdateCritTbl-Error finding '%s' in Critical Table Registry\n", + CFE_ES_WriteToSysLog("CFE_TBL:UpdateCritTbl-Error finding '%s' in Critical Table Registry\n", RegRecPtr->Name); } } - - /* Don't bother notifying the caller of the problem since the active table is still legitimate */ -} /* End of CFE_TBL_UpdateCriticalTblCDS() */ + /* Don't bother notifying the caller of the problem since the active table is still legitimate */ +} /* End of CFE_TBL_UpdateCriticalTblCDS() */ /******************************************************************* ** @@ -1435,35 +1383,32 @@ void CFE_TBL_UpdateCriticalTblCDS(CFE_TBL_RegistryRec_t *RegRecPtr) int32 CFE_TBL_SendNotificationMsg(CFE_TBL_RegistryRec_t *RegRecPtr) { int32 Status = CFE_SUCCESS; - + /* First, determine if a message should be sent */ if (RegRecPtr->NotifyByMsg) { /* Set the message ID */ CFE_MSG_SetMsgId(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationMsgId); - + /* Set the command code */ CFE_MSG_SetFcnCode(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationCC); - + /* Set the command parameter */ CFE_TBL_Global.NotifyMsg.Payload.Parameter = RegRecPtr->NotificationParam; - + CFE_SB_TimeStampMsg(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg); Status = CFE_SB_TransmitMsg(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, false); - + if (Status != CFE_SUCCESS) { - CFE_EVS_SendEvent(CFE_TBL_FAIL_NOTIFY_SEND_ERR_EID, - CFE_EVS_EventType_ERROR, - "Manage Notification Pkt Error(Status=0x%08X)", - (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_FAIL_NOTIFY_SEND_ERR_EID, CFE_EVS_EventType_ERROR, + "Manage Notification Pkt Error(Status=0x%08X)", (unsigned int)Status); } } - + return Status; } /* End of CFE_TBL_SendNotificationMsg() */ /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.h b/modules/tbl/fsw/src/cfe_tbl_internal.h index a94205fa8..371509a96 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.h +++ b/modules/tbl/fsw/src/cfe_tbl_internal.h @@ -25,7 +25,7 @@ ** ** Author: D. Kobe/the Hammers Company, Inc. ** -** Notes: +** Notes: ** */ @@ -46,9 +46,9 @@ /********************* Macro and Constant Type Definitions ***************************/ -#define CFE_TBL_NOT_OWNED CFE_ES_APPID_UNDEFINED -#define CFE_TBL_NOT_FOUND (-1) -#define CFE_TBL_END_OF_LIST (CFE_TBL_Handle_t)0xFFFF +#define CFE_TBL_NOT_OWNED CFE_ES_APPID_UNDEFINED +#define CFE_TBL_NOT_FOUND (-1) +#define CFE_TBL_END_OF_LIST (CFE_TBL_Handle_t)0xFFFF /***************************** Function Prototypes **********************************/ @@ -65,12 +65,12 @@ ** None ** ** \param[in] TblHandle - Handle to be validated -** +** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ** \retval #CFE_TBL_ERR_INVALID_HANDLE \copydoc CFE_TBL_ERR_INVALID_HANDLE -** +** ******************************************************************************/ -int32 CFE_TBL_ValidateHandle(CFE_TBL_Handle_t TblHandle); +int32 CFE_TBL_ValidateHandle(CFE_TBL_Handle_t TblHandle); /*****************************************************************************/ /** @@ -89,16 +89,17 @@ int32 CFE_TBL_ValidateHandle(CFE_TBL_Handle_t TblHandle); ** ** \param[in] TblHandle Handle of table whose access is desired. ** -** \param[in, out] AppIdPtr Pointer to value that will hold AppID on return. *AppIdPtr is the AppID as obtained from #CFE_ES_GetAppID -** +** \param[in, out] AppIdPtr Pointer to value that will hold AppID on return. *AppIdPtr is the AppID as obtained from +*#CFE_ES_GetAppID +** ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ** \retval #CFE_TBL_ERR_BAD_APP_ID \copydoc CFE_TBL_ERR_BAD_APP_ID ** \retval #CFE_TBL_ERR_INVALID_HANDLE \copydoc CFE_TBL_ERR_INVALID_HANDLE ** \retval #CFE_TBL_ERR_NO_ACCESS \copydoc CFE_TBL_ERR_NO_ACCESS -** +** ******************************************************************************/ -int32 CFE_TBL_ValidateAccess(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t *AppIdPtr); +int32 CFE_TBL_ValidateAccess(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t *AppIdPtr); /*****************************************************************************/ /** @@ -114,15 +115,14 @@ int32 CFE_TBL_ValidateAccess(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t *AppId ** Note: The TblHandle and ThisAppId parameters are assumed to be valid. ** ** \param[in] TblHandle Handle of table whose access is desired. -** +** ** \param[in] ThisAppId Application ID of Application making the call ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ** \retval #CFE_TBL_ERR_NO_ACCESS \copydoc CFE_TBL_ERR_NO_ACCESS -** +** ******************************************************************************/ -int32 CFE_TBL_CheckAccessRights(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t ThisAppId); - +int32 CFE_TBL_CheckAccessRights(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t ThisAppId); /*****************************************************************************/ /** @@ -139,12 +139,11 @@ int32 CFE_TBL_CheckAccessRights(CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t Thi ** filled out and the TblHandle has been validated. ** ** \param[in] TblHandle Handle of Access Descriptor to be removed. -** -** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS +** +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ** ******************************************************************************/ -int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle); - +int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle); /*****************************************************************************/ /** @@ -161,19 +160,19 @@ int32 CFE_TBL_RemoveAccessLink(CFE_TBL_Handle_t TblHandle); ** this function would return #CFE_TBL_ERR_UNREGISTERED. ** -# ThisAppId parameter is assumed to be validated. ** -** \param[in, out] TblPtr Pointer to pointer that will hold address of data upon return. *TblPtr is the address of the Table Data. +** \param[in, out] TblPtr Pointer to pointer that will hold address of data upon return. *TblPtr is the address of +** the Table Data. ** \param[in] TblHandle Handle of Table whose address is needed. ** \param[in] ThisAppId AppID of application making the address request. -** +** ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS -** \retval #CFE_TBL_ERR_INVALID_HANDLE \copydoc CFE_TBL_ERR_INVALID_HANDLE -** \retval #CFE_TBL_ERR_NO_ACCESS \copydoc CFE_TBL_ERR_NO_ACCESS +** \retval #CFE_TBL_ERR_INVALID_HANDLE \copydoc CFE_TBL_ERR_INVALID_HANDLE +** \retval #CFE_TBL_ERR_NO_ACCESS \copydoc CFE_TBL_ERR_NO_ACCESS ** \retval #CFE_TBL_ERR_UNREGISTERED \copydoc CFE_TBL_ERR_UNREGISTERED -** +** ******************************************************************************/ -int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t ThisAppId); - +int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CFE_ES_AppId_t ThisAppId); /*****************************************************************************/ /** @@ -187,14 +186,13 @@ int32 CFE_TBL_GetAddressInternal(void **TblPtr, CFE_TBL_Handle_t TblHandle, CF ** ** \param[in] TblHandle Handle of Table whose pending notifications are ** to be returned. -** +** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ** \retval #CFE_TBL_INFO_UPDATE_PENDING \copydoc CFE_TBL_INFO_UPDATE_PENDING ** \retval #CFE_TBL_INFO_UPDATED \copydoc CFE_TBL_INFO_UPDATED ** ******************************************************************************/ -int32 CFE_TBL_GetNextNotification(CFE_TBL_Handle_t TblHandle); - +int32 CFE_TBL_GetNextNotification(CFE_TBL_Handle_t TblHandle); /*****************************************************************************/ /** @@ -209,11 +207,11 @@ int32 CFE_TBL_GetNextNotification(CFE_TBL_Handle_t TblHandle); ** ** \param[in] TblName - Pointer to character string containing complete ** Table Name (of the format "AppName.TblName"). -** +** ** \retval #CFE_TBL_NOT_FOUND or the Index into Registry for Table with specified name -** +** ******************************************************************************/ -int16 CFE_TBL_FindTableInRegistry(const char *TblName); +int16 CFE_TBL_FindTableInRegistry(const char *TblName); /*****************************************************************************/ /** @@ -225,9 +223,9 @@ int16 CFE_TBL_FindTableInRegistry(const char *TblName); ** \par Assumptions, External Events, and Notes: ** Note: This function assumes the registry has been locked. ** -** \retval #CFE_TBL_NOT_FOUND or Index into Table Registry of unused entry +** \retval #CFE_TBL_NOT_FOUND or Index into Table Registry of unused entry ******************************************************************************/ -int16 CFE_TBL_FindFreeRegistryEntry(void); +int16 CFE_TBL_FindFreeRegistryEntry(void); /*****************************************************************************/ /** @@ -239,11 +237,10 @@ int16 CFE_TBL_FindFreeRegistryEntry(void); ** \par Assumptions, External Events, and Notes: ** Note: This function assumes the registry has been locked. ** -** \retval #CFE_TBL_END_OF_LIST or Table Handle of unused Access Descriptor +** \retval #CFE_TBL_END_OF_LIST or Table Handle of unused Access Descriptor ******************************************************************************/ CFE_TBL_Handle_t CFE_TBL_FindFreeHandle(void); - /*****************************************************************************/ /** ** \brief Creates a Full Table name from application name and table name @@ -256,20 +253,20 @@ CFE_TBL_Handle_t CFE_TBL_FindFreeHandle(void); ** \par Assumptions, External Events, and Notes: ** Note: AppName portion will be truncated to OS_MAX_API_NAME. ** -** \param[in, out] FullTblName pointer to character buffer of #CFE_TBL_MAX_FULL_NAME_LEN size -** that will be filled with the processor specific Table Name. *FullTblName is the processor specific Table Name of the form "AppName.TblName". -** +** \param[in, out] FullTblName pointer to character buffer of #CFE_TBL_MAX_FULL_NAME_LEN size that will be filled with +** the processor specific Table Name. *FullTblName is the processor specific Table Name of the form +** "AppName.TblName". +** ** \param[in] TblName pointer to character string containing the Application's local name for ** the Table. ** -** \param[in] ThisAppId the Application ID of the Application making the call. +** \param[in] ThisAppId the Application ID of the Application making the call. +** ** ** -** ******************************************************************************/ void CFE_TBL_FormTableName(char *FullTblName, const char *TblName, CFE_ES_AppId_t ThisAppId); - /*****************************************************************************/ /** ** \brief Locks access to the Table Registry @@ -281,9 +278,9 @@ void CFE_TBL_FormTableName(char *FullTblName, const char *TblName, CFE_ES_AppId_ ** \par Assumptions, External Events, and Notes: ** None ** -** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ******************************************************************************/ -int32 CFE_TBL_LockRegistry(void); +int32 CFE_TBL_LockRegistry(void); /*****************************************************************************/ /** @@ -297,10 +294,9 @@ int32 CFE_TBL_LockRegistry(void); ** None ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS -** +** ******************************************************************************/ -int32 CFE_TBL_UnlockRegistry(void); - +int32 CFE_TBL_UnlockRegistry(void); /*****************************************************************************/ /** @@ -319,7 +315,8 @@ int32 CFE_TBL_UnlockRegistry(void); ** are legitimate. ** ** \param[in, out] WorkingBufferPtr Pointer to variable that will contain the -** address of the first byte of the working buffer. *WorkingBufferPtr is the address of the first byte of the working buffer +** address of the first byte of the working buffer. *WorkingBufferPtr is the address +** of the first byte of the working buffer ** ** \param[in] RegRecPtr Pointer to Table Registry Entry for Table for whom ** a working buffer is to be obtained @@ -327,16 +324,14 @@ int32 CFE_TBL_UnlockRegistry(void); ** \param[in] CalledByApp Boolean that identifies whether this internal API ** function is being called by a user Application (true) ** or by the Table Services Application (false) -** +** ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS -** \retval #CFE_TBL_ERR_NO_BUFFER_AVAIL \copydoc CFE_TBL_ERR_NO_BUFFER_AVAIL +** \retval #CFE_TBL_ERR_NO_BUFFER_AVAIL \copydoc CFE_TBL_ERR_NO_BUFFER_AVAIL ** ******************************************************************************/ -int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, - CFE_TBL_RegistryRec_t *RegRecPtr, - bool CalledByApp); - +int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, CFE_TBL_RegistryRec_t *RegRecPtr, + bool CalledByApp); /*****************************************************************************/ /** @@ -356,31 +351,30 @@ int32 CFE_TBL_GetWorkingBuffer(CFE_TBL_LoadBuff_t **WorkingBufferPtr, ** ** \param[in] RegRecPtr Pointer to Table Registry record for table whose ** buffer is to filled with data from the specified file -** +** ** \param[in] Filename Pointer to ASCII string containing full path and filename ** of table image file to be loaded ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS -** \retval #OS_INVALID_POINTER \copydoc OS_INVALID_POINTER -** \retval #OS_FS_ERR_PATH_TOO_LONG \copydoc OS_FS_ERR_PATH_TOO_LONG -** \retval #OS_FS_ERR_PATH_INVALID \copydoc OS_FS_ERR_PATH_INVALID -** \retval #OS_FS_ERR_NAME_TOO_LONG \copydoc OS_FS_ERR_NAME_TOO_LONG -** \retval #OS_ERR_NO_FREE_IDS \copydoc OS_ERR_NO_FREE_IDS -** \retval #OS_ERROR \copydoc OS_ERROR -** \retval #CFE_TBL_ERR_FILE_TOO_LARGE \copydoc CFE_TBL_ERR_FILE_TOO_LARGE -** \retval #CFE_TBL_WARN_SHORT_FILE \copydoc CFE_TBL_WARN_SHORT_FILE -** \retval #CFE_TBL_WARN_PARTIAL_LOAD \copydoc CFE_TBL_WARN_PARTIAL_LOAD -** \retval #CFE_TBL_ERR_FILENAME_TOO_LONG \copydoc CFE_TBL_ERR_FILENAME_TOO_LONG +** \retval #OS_INVALID_POINTER \copydoc OS_INVALID_POINTER +** \retval #OS_FS_ERR_PATH_TOO_LONG \copydoc OS_FS_ERR_PATH_TOO_LONG +** \retval #OS_FS_ERR_PATH_INVALID \copydoc OS_FS_ERR_PATH_INVALID +** \retval #OS_FS_ERR_NAME_TOO_LONG \copydoc OS_FS_ERR_NAME_TOO_LONG +** \retval #OS_ERR_NO_FREE_IDS \copydoc OS_ERR_NO_FREE_IDS +** \retval #OS_ERROR \copydoc OS_ERROR +** \retval #CFE_TBL_ERR_FILE_TOO_LARGE \copydoc CFE_TBL_ERR_FILE_TOO_LARGE +** \retval #CFE_TBL_WARN_SHORT_FILE \copydoc CFE_TBL_WARN_SHORT_FILE +** \retval #CFE_TBL_WARN_PARTIAL_LOAD \copydoc CFE_TBL_WARN_PARTIAL_LOAD +** \retval #CFE_TBL_ERR_FILENAME_TOO_LONG \copydoc CFE_TBL_ERR_FILENAME_TOO_LONG ** \retval #CFE_TBL_ERR_FILE_FOR_WRONG_TABLE \copydoc CFE_TBL_ERR_FILE_FOR_WRONG_TABLE -** \retval #CFE_TBL_ERR_NO_STD_HEADER \copydoc CFE_TBL_ERR_NO_STD_HEADER -** \retval #CFE_TBL_ERR_NO_TBL_HEADER \copydoc CFE_TBL_ERR_NO_TBL_HEADER -** \retval #CFE_TBL_ERR_BAD_CONTENT_ID \copydoc CFE_TBL_ERR_BAD_CONTENT_ID -** \retval #CFE_TBL_ERR_BAD_SUBTYPE_ID \copydoc CFE_TBL_ERR_BAD_SUBTYPE_ID -** +** \retval #CFE_TBL_ERR_NO_STD_HEADER \copydoc CFE_TBL_ERR_NO_STD_HEADER +** \retval #CFE_TBL_ERR_NO_TBL_HEADER \copydoc CFE_TBL_ERR_NO_TBL_HEADER +** \retval #CFE_TBL_ERR_BAD_CONTENT_ID \copydoc CFE_TBL_ERR_BAD_CONTENT_ID +** \retval #CFE_TBL_ERR_BAD_SUBTYPE_ID \copydoc CFE_TBL_ERR_BAD_SUBTYPE_ID +** ******************************************************************************/ -int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBufferPtr, - CFE_TBL_RegistryRec_t *RegRecPtr, const char *Filename); - +int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBufferPtr, CFE_TBL_RegistryRec_t *RegRecPtr, + const char *Filename); /*****************************************************************************/ /** @@ -397,17 +391,15 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuf ** is called. ** ** \param[in] TblHandle Handle of Table to be updated. -** +** ** \param[in] RegRecPtr Pointer to Table Registry Entry for table to be updated ** ** \param[in] AccessDescPtr Pointer to appropriate access descriptor for table-application interface ** -** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS ******************************************************************************/ -int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, - CFE_TBL_RegistryRec_t *RegRecPtr, - CFE_TBL_AccessDescriptor_t *AccessDescPtr ); - +int32 CFE_TBL_UpdateInternal(CFE_TBL_Handle_t TblHandle, CFE_TBL_RegistryRec_t *RegRecPtr, + CFE_TBL_AccessDescriptor_t *AccessDescPtr); /*****************************************************************************/ /** @@ -423,8 +415,7 @@ int32 CFE_TBL_UpdateInternal( CFE_TBL_Handle_t TblHandle, ** ** \param[in] RegRecPtr Pointer to Table Registry Entry for table to be updated ******************************************************************************/ -void CFE_TBL_NotifyTblUsersOfUpdate( CFE_TBL_RegistryRec_t *RegRecPtr ); - +void CFE_TBL_NotifyTblUsersOfUpdate(CFE_TBL_RegistryRec_t *RegRecPtr); /*****************************************************************************/ /** @@ -439,33 +430,31 @@ void CFE_TBL_NotifyTblUsersOfUpdate( CFE_TBL_RegistryRec_t *RegRecPtr ); ** -# FileDescriptor is assumed to be valid ** ** \param[in] FileDescriptor File Descriptor, as provided by OS_fopen -** +** ** \param[in, out] StdFileHeaderPtr Pointer to buffer to be filled with the contents -** of the file's standard cFE Header. *StdFileHeaderPtr is the contents of the standard cFE File Header +** of the file's standard cFE Header. *StdFileHeaderPtr is the contents of the +** standard cFE File Header ** ** \param[in, out] TblFileHeaderPtr Pointer to buffer to be filled with the contents -** of the file's standard cFE Table Header. *TblFileHeaderPtr is the contents of the standard cFE Table File Header +** of the file's standard cFE Table Header. *TblFileHeaderPtr is the contents of the +** standard cFE Table File Header ** ** \param[in] LoadFilename Pointer to character string containing full path ** and filename of table image to be loaded -** +** ** ** ** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS -** \retval #CFE_TBL_ERR_NO_STD_HEADER \copydoc CFE_TBL_ERR_NO_STD_HEADER -** \retval #CFE_TBL_ERR_NO_TBL_HEADER \copydoc CFE_TBL_ERR_NO_TBL_HEADER +** \retval #CFE_TBL_ERR_NO_STD_HEADER \copydoc CFE_TBL_ERR_NO_STD_HEADER +** \retval #CFE_TBL_ERR_NO_TBL_HEADER \copydoc CFE_TBL_ERR_NO_TBL_HEADER ** \retval #CFE_TBL_ERR_BAD_CONTENT_ID \copydoc CFE_TBL_ERR_BAD_CONTENT_ID ** \retval #CFE_TBL_ERR_BAD_SUBTYPE_ID \copydoc CFE_TBL_ERR_BAD_SUBTYPE_ID ** \retval #CFE_TBL_ERR_BAD_SPACECRAFT_ID \copydoc CFE_TBL_ERR_BAD_SPACECRAFT_ID ** \retval #CFE_TBL_ERR_BAD_PROCESSOR_ID \copydoc CFE_TBL_ERR_BAD_PROCESSOR_ID -** +** ******************************************************************************/ -int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, - CFE_FS_Header_t *StdFileHeaderPtr, - CFE_TBL_File_Hdr_t *TblFileHeaderPtr, - const char *LoadFilename ); - - +int32 CFE_TBL_ReadHeaders(osal_id_t FileDescriptor, CFE_FS_Header_t *StdFileHeaderPtr, + CFE_TBL_File_Hdr_t *TblFileHeaderPtr, const char *LoadFilename); /*****************************************************************************/ /** @@ -478,8 +467,7 @@ int32 CFE_TBL_ReadHeaders( osal_id_t FileDescriptor, ** -# This function is intended to be called before populating a table registry record ** ******************************************************************************/ -void CFE_TBL_InitRegistryRecord (CFE_TBL_RegistryRec_t *RegRecPtr); - +void CFE_TBL_InitRegistryRecord(CFE_TBL_RegistryRec_t *RegRecPtr); /*****************************************************************************/ /** @@ -493,12 +481,11 @@ void CFE_TBL_InitRegistryRecord (CFE_TBL_RegistryRec_t *RegRecPtr); ** None ** ** \param[in, out] HdrPtr Pointer to table header that needs to be swapped. *HdrPtr provides the swapped header -** -** +** +** ******************************************************************************/ void CFE_TBL_ByteSwapTblHeader(CFE_TBL_File_Hdr_t *HdrPtr); - /*****************************************************************************/ /** ** \brief Searches the Critical Table Registry for the given handle @@ -517,15 +504,14 @@ void CFE_TBL_ByteSwapTblHeader(CFE_TBL_File_Hdr_t *HdrPtr); ** the start address of the located Critical Table Registry ** Record. *CritRegRecPtr is the pointer to the start address of the located Critical ** Table Registry Record. \c NULL if the record is not -** found. +** found. ** ** \param[in] CDSHandleToFind CDS Handle to be located in Critical Table Registry. -** +** ** ******************************************************************************/ void CFE_TBL_FindCriticalTblInfo(CFE_TBL_CritRegRec_t **CritRegRecPtr, CFE_ES_CDSHandle_t CDSHandleToFind); - /*****************************************************************************/ /** ** \brief Updates a CDS associated with a Critical Table @@ -541,12 +527,11 @@ void CFE_TBL_FindCriticalTblInfo(CFE_TBL_CritRegRec_t **CritRegRecPtr, CFE_ES_CD ** ** \param[in] RegRecPtr Pointer to Registry Record of Critical Table whose CDS ** needs to be updated. -** -** +** +** ******************************************************************************/ void CFE_TBL_UpdateCriticalTblCDS(CFE_TBL_RegistryRec_t *RegRecPtr); - /*****************************************************************************/ /** ** \brief When enabled, will send a manage notification command message @@ -561,8 +546,8 @@ void CFE_TBL_UpdateCriticalTblCDS(CFE_TBL_RegistryRec_t *RegRecPtr); ** None ** ** \param[in] RegRecPtr Pointer to Registry Record of Table whose owner needs notifying. -** -** +** +** ******************************************************************************/ int32 CFE_TBL_SendNotificationMsg(CFE_TBL_RegistryRec_t *RegRecPtr); @@ -589,15 +574,13 @@ extern void CFE_TBL_ByteSwapUint32(uint32 *Uint32ToSwapPtr); * These callbacks are used with the FS background write request API * and are implemented per that specification. */ -void CFE_TBL_DumpRegistryEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position); +void CFE_TBL_DumpRegistryEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, + size_t BlockSize, size_t Position); bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize); - /* ** Globals specific to the TBL module */ extern CFE_TBL_Global_t CFE_TBL_Global; - - #endif /* CFE_TBL_INTERNAL_H */ diff --git a/modules/tbl/fsw/src/cfe_tbl_module_all.h b/modules/tbl/fsw/src/cfe_tbl_module_all.h index c7b2f9120..8bd7e7c86 100644 --- a/modules/tbl/fsw/src/cfe_tbl_module_all.h +++ b/modules/tbl/fsw/src/cfe_tbl_module_all.h @@ -20,10 +20,10 @@ /** * @file cfe_tbl_module_all.h - * + * * Encapsulates all TBL module internal header files, as well * as the public API from all other CFE core modules, OSAL, and PSP. - * + * * This simplifies the set of include files that need to be put at the * start of every source file. */ @@ -52,6 +52,4 @@ */ #include "cfe_es_core_internal.h" - - #endif /* CFE_TBL_MODULE_ALL_H */ diff --git a/modules/tbl/fsw/src/cfe_tbl_task.c b/modules/tbl/fsw/src/cfe_tbl_task.c index 3e7bed088..72a3dca1d 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task.c +++ b/modules/tbl/fsw/src/cfe_tbl_task.c @@ -29,7 +29,6 @@ ** */ - /* ** Required header files */ @@ -38,49 +37,51 @@ #include - /* ** Table task global data */ -CFE_TBL_Global_t CFE_TBL_Global; +CFE_TBL_Global_t CFE_TBL_Global; /* * Macros to assist in building the CFE_TBL_CmdHandlerTbl - * 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_MSG_CommandHeader_t), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_MSG_MSGTYPE } +#define CFE_TBL_MESSAGE_ENTRY(mid, handlerfunc) \ + { \ + 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 - * For command handler entries, which have a command code, payload type, and a handler function */ -#define CFE_TBL_COMMAND_ENTRY(ccode,paramtype,handlerfunc) \ - { CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), ccode, sizeof(paramtype), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_CMD_MSGTYPE } +#define CFE_TBL_COMMAND_ENTRY(ccode, paramtype, handlerfunc) \ + { \ + CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), ccode, sizeof(paramtype), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, \ + CFE_TBL_CMD_MSGTYPE \ + } /* Constant Data */ -const CFE_TBL_CmdHandlerTblRec_t CFE_TBL_CmdHandlerTbl[] = -{ - /* message entries (SEND_HK) */ - 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_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 } -}; - +const CFE_TBL_CmdHandlerTblRec_t CFE_TBL_CmdHandlerTbl[] = { + /* message entries (SEND_HK) */ + 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_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}}; /******************************************************************************/ @@ -92,14 +93,14 @@ void CFE_TBL_TaskMain(void) CFE_ES_PerfLogEntry(CFE_MISSION_TBL_MAIN_PERF_ID); Status = CFE_TBL_TaskInit(); - - if(Status != CFE_SUCCESS) + + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); - CFE_ES_PerfLogExit(CFE_MISSION_TBL_MAIN_PERF_ID); - /* Note: CFE_ES_ExitApp will not return */ - CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); - }/* end if */ + CFE_ES_WriteToSysLog("TBL:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_PerfLogExit(CFE_MISSION_TBL_MAIN_PERF_ID); + /* Note: CFE_ES_ExitApp will not return */ + CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); + } /* end if */ /* * Wait for other apps to start. @@ -118,9 +119,7 @@ void CFE_TBL_TaskMain(void) CFE_ES_PerfLogExit(CFE_MISSION_TBL_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_ReceiveBuffer( &SBBufPtr, - CFE_TBL_Global.CmdPipe, - CFE_SB_PEND_FOREVER); + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_TBL_Global.CmdPipe, CFE_SB_PEND_FOREVER); CFE_ES_PerfLogEntry(CFE_MISSION_TBL_MAIN_PERF_ID); @@ -128,18 +127,19 @@ void CFE_TBL_TaskMain(void) { /* Process cmd pipe msg */ CFE_TBL_TaskPipe(SBBufPtr); - }else{ - CFE_ES_WriteToSysLog("TBL:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); - }/* end if */ + } + else + { + CFE_ES_WriteToSysLog("TBL:Error reading cmd pipe,RC=0x%08X\n", (unsigned int)Status); + } /* end if */ - }/* end while */ + } /* end while */ /* while loop exits only if CFE_SB_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); } /* end CFE_TBL_TaskMain() */ - /******************************************************************************/ int32 CFE_TBL_TaskInit(void) @@ -151,12 +151,12 @@ int32 CFE_TBL_TaskInit(void) */ Status = CFE_ES_RegisterApp(); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + CFE_ES_WriteToSysLog("TBL:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + /* ** Initialize global Table Services data */ @@ -167,60 +167,60 @@ int32 CFE_TBL_TaskInit(void) */ Status = CFE_EVS_Register(NULL, 0, 0); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Call to CFE_EVS_Register Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + CFE_ES_WriteToSysLog("TBL:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + /* ** Create Software Bus message pipe */ Status = CFE_SB_CreatePipe(&CFE_TBL_Global.CmdPipe, CFE_TBL_TASK_PIPE_DEPTH, CFE_TBL_TASK_PIPE_NAME); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error creating cmd pipe:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + CFE_ES_WriteToSysLog("TBL:Error creating cmd pipe:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ /* ** Subscribe to Housekeeping request commands */ Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TBL_SEND_HK_MID), CFE_TBL_Global.CmdPipe); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error subscribing to HK Request:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + CFE_ES_WriteToSysLog("TBL:Error subscribing to HK Request:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ /* ** Subscribe to Table task ground command packets */ Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID), CFE_TBL_Global.CmdPipe); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error subscribing to gnd cmds:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + CFE_ES_WriteToSysLog("TBL:Error subscribing to gnd cmds:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + /* ** Task startup event message */ - Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized.%s", CFE_VERSION_STRING); + Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized.%s", + CFE_VERSION_STRING); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TBL:Error sending init event:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + CFE_ES_WriteToSysLog("TBL:Error sending init event:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ return CFE_SUCCESS; } /* End of CFE_TBL_TaskInit() */ - /******************************************************************************/ void CFE_TBL_InitData(void) @@ -230,31 +230,26 @@ void CFE_TBL_InitData(void) CFE_ES_GetAppID(&CFE_TBL_Global.TableTaskAppId); /* Initialize Packet Headers */ - CFE_MSG_Init(&CFE_TBL_Global.HkPacket.TlmHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), + CFE_MSG_Init(&CFE_TBL_Global.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), sizeof(CFE_TBL_Global.HkPacket)); - CFE_MSG_Init(&CFE_TBL_Global.TblRegPacket.TlmHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), + CFE_MSG_Init(&CFE_TBL_Global.TblRegPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), sizeof(CFE_TBL_Global.TblRegPacket)); /* Message ID is set when sent, so OK as 0 here */ - CFE_MSG_Init(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, - CFE_SB_ValueToMsgId(0), - sizeof(CFE_TBL_Global.NotifyMsg)); + CFE_MSG_Init(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, CFE_SB_ValueToMsgId(0), sizeof(CFE_TBL_Global.NotifyMsg)); } /* End of CFE_TBL_InitData() */ - /******************************************************************************/ void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) { - CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; int16 CmdIndx; CFE_MSG_Size_t ActualLength = 0; - CFE_TBL_CmdProcRet_t CmdStatus = CFE_TBL_INC_ERR_CTR; /* Assume a failed command */ + CFE_TBL_CmdProcRet_t CmdStatus = CFE_TBL_INC_ERR_CTR; /* Assume a failed command */ CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode); @@ -274,11 +269,10 @@ void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) } else /* Bad Message Length */ { - CFE_EVS_SendEvent( CFE_TBL_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid msg length -- ID = 0x%X, CC = %u, Len = %u, Expected = %u", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), - (unsigned int)CommandCode, (unsigned int)ActualLength, - (unsigned int)CFE_TBL_CmdHandlerTbl[CmdIndx].ExpectedLength ); + CFE_EVS_SendEvent(CFE_TBL_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid msg length -- ID = 0x%X, CC = %u, Len = %u, Expected = %u", + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (unsigned int)CommandCode, + (unsigned int)ActualLength, (unsigned int)CFE_TBL_CmdHandlerTbl[CmdIndx].ExpectedLength); } /* Only update command counters when message has a command code */ @@ -302,16 +296,14 @@ void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) { CFE_EVS_SendEvent(CFE_TBL_CC1_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command code -- ID = 0x%X, CC = %u", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), - (unsigned int)CommandCode); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (unsigned int)CommandCode); /* Update the command error counter */ CFE_TBL_Global.CommandErrorCounter++; } - else /* CmdIndx == CFE_TBL_BAD_MSG_ID */ + else /* CmdIndx == CFE_TBL_BAD_MSG_ID */ { - CFE_EVS_SendEvent(CFE_TBL_MID_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid message ID -- ID = 0x%X", + CFE_EVS_SendEvent(CFE_TBL_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid message ID -- ID = 0x%X", (unsigned int)CFE_SB_MsgIdToValue(MessageID)); /* ** Note: we only increment the command error counter when @@ -324,14 +316,13 @@ void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) } /* End of CFE_TBL_TaskPipe() */ - /******************************************************************************/ -int16 CFE_TBL_SearchCmdHndlrTbl( CFE_SB_MsgId_t MessageID, uint16 CommandCode ) +int16 CFE_TBL_SearchCmdHndlrTbl(CFE_SB_MsgId_t MessageID, uint16 CommandCode) { - int16 TblIndx = CFE_TBL_BAD_CMD_CODE; - bool FoundMsg = false; - bool FoundMatch = false; + int16 TblIndx = CFE_TBL_BAD_CMD_CODE; + bool FoundMsg = false; + bool FoundMatch = false; do { @@ -381,10 +372,8 @@ int16 CFE_TBL_SearchCmdHndlrTbl( CFE_SB_MsgId_t MessageID, uint16 CommandCode ) } return TblIndx; -} /* End of CFE_TBL_SearchCmdHndlrTbl() */ - +} /* End of CFE_TBL_SearchCmdHndlrTbl() */ /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/tbl/fsw/src/cfe_tbl_task.h b/modules/tbl/fsw/src/cfe_tbl_task.h index 2c88fb7a1..d86bb1dd0 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task.h +++ b/modules/tbl/fsw/src/cfe_tbl_task.h @@ -35,13 +35,11 @@ #ifndef _cfe_tbl_task_ #define _cfe_tbl_task_ - /* ** Required header files */ #include "cfe_tbl_msg.h" - /*************************************************************************/ /* @@ -49,91 +47,87 @@ */ /** \name Registry Mutex Definitions */ /** \{ */ -#define CFE_TBL_MUT_REG_NAME "TBL_REG_MUT" /**< \brief Name of Mutex controlling Registry Access */ -#define CFE_TBL_MUT_REG_VALUE 0 /**< \brief Initial Value of Registry Access Mutex */ -#define CFE_TBL_MUT_WORK_NAME "TBL_WRK_MUT" /**< \brief Name of Mutex controlling Working Buffer Assignment */ -#define CFE_TBL_MUT_WORK_VALUE 0 /**< \brief Initial Value of Working Buffer Assignment Mutex */ +#define CFE_TBL_MUT_REG_NAME "TBL_REG_MUT" /**< \brief Name of Mutex controlling Registry Access */ +#define CFE_TBL_MUT_REG_VALUE 0 /**< \brief Initial Value of Registry Access Mutex */ +#define CFE_TBL_MUT_WORK_NAME "TBL_WRK_MUT" /**< \brief Name of Mutex controlling Working Buffer Assignment */ +#define CFE_TBL_MUT_WORK_VALUE 0 /**< \brief Initial Value of Working Buffer Assignment Mutex */ /** \} */ /** \name Table Services Task Pipe Characteristics */ /** \{ */ -#define CFE_TBL_TASK_PIPE_NAME "TBL_CMD_PIPE" /**< \brief Name of TBL Task Command Pipe */ -#define CFE_TBL_TASK_PIPE_DEPTH 12 /**< \brief Number of Commands that can be queued */ +#define CFE_TBL_TASK_PIPE_NAME "TBL_CMD_PIPE" /**< \brief Name of TBL Task Command Pipe */ +#define CFE_TBL_TASK_PIPE_DEPTH 12 /**< \brief Number of Commands that can be queued */ /** \} */ /** \brief Value indicating when no load is in progress */ /** ** This macro is used to indicate no Load is in Progress by assigning it to -** #CFE_TBL_RegistryRec_t::LoadInProgress -*/ -#define CFE_TBL_NO_LOAD_IN_PROGRESS (-1) +** #CFE_TBL_RegistryRec_t::LoadInProgress +*/ +#define CFE_TBL_NO_LOAD_IN_PROGRESS (-1) /** \brief Value indicating when no Validation is Pending */ /** ** This macro is used to indicate no Validation is Pending by assigning it to -** #CFE_TBL_RegistryRec_t::ValidateActiveIndex or #CFE_TBL_RegistryRec_t::ValidateInactiveIndex -*/ -#define CFE_TBL_NO_VALIDATION_PENDING (-1) +** #CFE_TBL_RegistryRec_t::ValidateActiveIndex or #CFE_TBL_RegistryRec_t::ValidateInactiveIndex +*/ +#define CFE_TBL_NO_VALIDATION_PENDING (-1) /** \brief Value indicating when no Dump is Pending on a Dump-Only Table */ /** ** This macro is used to indicate no Dump is Pending by assigning it to -** #CFE_TBL_RegistryRec_t::DumpControlIndex -*/ -#define CFE_TBL_NO_DUMP_PENDING (-1) +** #CFE_TBL_RegistryRec_t::DumpControlIndex +*/ +#define CFE_TBL_NO_DUMP_PENDING (-1) /************************ Internal Structure Definitions *****************************/ /*******************************************************************************/ /** \brief Identifies the current state of a validation sequence. -*/ -typedef enum + */ +typedef enum { - CFE_TBL_VALIDATION_FREE=0, /**< \brief Validation Result Block is Free */ - CFE_TBL_VALIDATION_PENDING, /**< \brief Validation Result Block waiting for Application */ - CFE_TBL_VALIDATION_PERFORMED /**< \brief Validation Result Block contains Validation Results */ + CFE_TBL_VALIDATION_FREE = 0, /**< \brief Validation Result Block is Free */ + CFE_TBL_VALIDATION_PENDING, /**< \brief Validation Result Block waiting for Application */ + CFE_TBL_VALIDATION_PERFORMED /**< \brief Validation Result Block contains Validation Results */ } CFE_TBL_ValidationState_t; - /*******************************************************************************/ /** \brief Identifies the current state of a dump request. -*/ -typedef enum + */ +typedef enum { - CFE_TBL_DUMP_FREE=0, /**< \brief Dump Request Block is Free */ - CFE_TBL_DUMP_PENDING, /**< \brief Dump Request Block waiting for Application */ - CFE_TBL_DUMP_PERFORMED /**< \brief Dump Request Block processed by Application */ + CFE_TBL_DUMP_FREE = 0, /**< \brief Dump Request Block is Free */ + CFE_TBL_DUMP_PENDING, /**< \brief Dump Request Block waiting for Application */ + CFE_TBL_DUMP_PERFORMED /**< \brief Dump Request Block processed by Application */ } CFE_TBL_DumpState_t; - /*******************************************************************************/ /** \brief Validation Result Block ** ** This structure holds the data to be returned to the Operator via telemetry ** on the results of a Validation request. */ -typedef struct +typedef struct { - CFE_TBL_ValidationState_t State; /**< \brief Current state of this block of data */ - int32 Result; /**< \brief Result returned by Application's Validation function */ - uint32 CrcOfTable; /**< \brief Data Integrity Value computed on Table Buffer */ - bool ActiveBuffer; /**< \brief Flag indicating whether Validation is on Active/Inactive Buffer */ - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Name of Table being Validated */ + CFE_TBL_ValidationState_t State; /**< \brief Current state of this block of data */ + int32 Result; /**< \brief Result returned by Application's Validation function */ + uint32 CrcOfTable; /**< \brief Data Integrity Value computed on Table Buffer */ + bool ActiveBuffer; /**< \brief Flag indicating whether Validation is on Active/Inactive Buffer */ + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Name of Table being Validated */ } CFE_TBL_ValidationResult_t; - /*******************************************************************************/ /** \brief Memory Pool Data Structure ** ** This structure defines the variables related to the TBL buffers. */ -typedef struct +typedef struct { - CFE_ES_MemHandle_t PoolHdl; - CFE_ES_STATIC_POOL_TYPE(CFE_PLATFORM_TBL_BUF_MEMORY_BYTES) Partition; + CFE_ES_MemHandle_t PoolHdl; + CFE_ES_STATIC_POOL_TYPE(CFE_PLATFORM_TBL_BUF_MEMORY_BYTES) Partition; } CFE_TBL_BufParams_t; - /*******************************************************************************/ /** \brief Load Buffer Description Data ** @@ -141,132 +135,127 @@ typedef struct ** data such as the time from the file that was loaded into the buffer, whether ** the buffer has been allocated and a string describing the source of the data. */ -typedef struct +typedef struct { - void *BufferPtr; /**< \brief Pointer to Load Buffer */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ - uint32 Crc; /**< \brief Last calculated CRC for this buffer's contents */ - bool Taken; /**< \brief Flag indicating whether buffer is in use */ - bool Validated; /**< \brief Flag indicating whether the buffer has been successfully validated */ - char DataSource[OS_MAX_PATH_LEN]; /**< \brief Source of data put into buffer (filename or memory address) */ + void * BufferPtr; /**< \brief Pointer to Load Buffer */ + uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ + uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ + uint32 Crc; /**< \brief Last calculated CRC for this buffer's contents */ + bool Taken; /**< \brief Flag indicating whether buffer is in use */ + bool Validated; /**< \brief Flag indicating whether the buffer has been successfully validated */ + char DataSource[OS_MAX_PATH_LEN]; /**< \brief Source of data put into buffer (filename or memory address) */ } CFE_TBL_LoadBuff_t; - /*******************************************************************************/ /** \brief Application to Table Access Descriptor ** ** Table Access Descriptor data structure that contains information necessary ** to access the table without interfering with other threads. TblHandles are -** an index into an array of Access Descriptors, thus identifying a specific +** an index into an array of Access Descriptors, thus identifying a specific ** AccessDescriptor for a particular Application for a table. */ -typedef struct +typedef struct { - CFE_ES_AppId_t AppId; /**< \brief Application ID to verify access */ - int16 RegIndex; /**< \brief Index into Table Registry (a.k.a. - Global Table #) */ - CFE_TBL_Handle_t PrevLink; /**< \brief Index of previous access descriptor in linked list */ - CFE_TBL_Handle_t NextLink; /**< \brief Index of next access descriptor in linked list */ - bool UsedFlag; /**< \brief Indicates whether this descriptor is being used or not */ - bool LockFlag; /**< \brief Indicates whether thread is currently accessing table data */ - bool Updated; /**< \brief Indicates table has been updated since last GetAddress call */ - uint8 BufferIndex; /**< \brief Index of buffer currently being used */ + CFE_ES_AppId_t AppId; /**< \brief Application ID to verify access */ + int16 RegIndex; /**< \brief Index into Table Registry (a.k.a. - Global Table #) */ + CFE_TBL_Handle_t PrevLink; /**< \brief Index of previous access descriptor in linked list */ + CFE_TBL_Handle_t NextLink; /**< \brief Index of next access descriptor in linked list */ + bool UsedFlag; /**< \brief Indicates whether this descriptor is being used or not */ + bool LockFlag; /**< \brief Indicates whether thread is currently accessing table data */ + bool Updated; /**< \brief Indicates table has been updated since last GetAddress call */ + uint8 BufferIndex; /**< \brief Index of buffer currently being used */ } CFE_TBL_AccessDescriptor_t; - /*******************************************************************************/ /** \brief Table Registry Record ** ** Table Registry Record that contains all information associated ** with a particular table. */ -typedef struct +typedef struct { - CFE_ES_AppId_t OwnerAppId; /**< \brief Application ID of App that Registered Table */ - size_t Size; /**< \brief Size, in bytes, of Table */ - CFE_SB_MsgId_t NotificationMsgId; /**< \brief Message ID of an associated management notification message */ - uint32 NotificationParam; /**< \brief Parameter of an associated management notification message */ - CFE_TBL_LoadBuff_t Buffers[2]; /**< \brief Active and Inactive Buffer Pointers */ - CFE_TBL_CallbackFuncPtr_t ValidationFuncPtr; /**< \brief Ptr to Owner App's function that validates tbl contents */ - CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ - CFE_TBL_Handle_t HeadOfAccessList; /**< \brief Index into Handles Array that starts Access Linked List */ - int32 LoadInProgress; /**< \brief Flag identifies inactive buffer and whether load in progress */ - int32 ValidateActiveIndex; /**< \brief Index to Validation Request on Active Table Result data */ - int32 ValidateInactiveIndex; /**< \brief Index to Validation Request on Inactive Table Result data */ - int32 DumpControlIndex; /**< \brief Index to Dump Control Block */ - CFE_ES_CDSHandle_t CDSHandle; /**< \brief Handle to Critical Data Store for Critical Tables */ - CFE_MSG_FcnCode_t NotificationCC; /**< \brief Command Code of an associated management notification message */ - bool CriticalTable; /**< \brief Flag indicating whether table is a Critical Table */ - bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ - bool LoadPending; /**< \brief Flag indicating an inactive buffer is ready to be copied */ - bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ - bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ - bool UserDefAddr; /**< \brief Flag indicating Table address was defined by Owner Application */ - bool NotifyByMsg; /**< \brief Flag indicating Table Services should notify owning App via message - when table requires management */ - uint8 ActiveBufferIndex; /**< \brief Index identifying which buffer is the active buffer */ - char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ - char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ + CFE_ES_AppId_t OwnerAppId; /**< \brief Application ID of App that Registered Table */ + size_t Size; /**< \brief Size, in bytes, of Table */ + CFE_SB_MsgId_t NotificationMsgId; /**< \brief Message ID of an associated management notification message */ + uint32 NotificationParam; /**< \brief Parameter of an associated management notification message */ + CFE_TBL_LoadBuff_t Buffers[2]; /**< \brief Active and Inactive Buffer Pointers */ + CFE_TBL_CallbackFuncPtr_t ValidationFuncPtr; /**< \brief Ptr to Owner App's function that validates tbl contents */ + CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ + CFE_TBL_Handle_t HeadOfAccessList; /**< \brief Index into Handles Array that starts Access Linked List */ + int32 LoadInProgress; /**< \brief Flag identifies inactive buffer and whether load in progress */ + int32 ValidateActiveIndex; /**< \brief Index to Validation Request on Active Table Result data */ + int32 ValidateInactiveIndex; /**< \brief Index to Validation Request on Inactive Table Result data */ + int32 DumpControlIndex; /**< \brief Index to Dump Control Block */ + CFE_ES_CDSHandle_t CDSHandle; /**< \brief Handle to Critical Data Store for Critical Tables */ + CFE_MSG_FcnCode_t NotificationCC; /**< \brief Command Code of an associated management notification message */ + bool CriticalTable; /**< \brief Flag indicating whether table is a Critical Table */ + bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ + bool LoadPending; /**< \brief Flag indicating an inactive buffer is ready to be copied */ + bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ + bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ + bool UserDefAddr; /**< \brief Flag indicating Table address was defined by Owner Application */ + bool NotifyByMsg; /**< \brief Flag indicating Table Services should notify owning App via message + when table requires management */ + uint8 ActiveBufferIndex; /**< \brief Index identifying which buffer is the active buffer */ + char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ + char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ } CFE_TBL_RegistryRec_t; - /*******************************************************************************/ /** \brief Critical Table Registry Record ** ** Critical Table Registry Record that contains information about a Critical ** Table that must survive the reboot and repopulation of the Table Registry. */ -typedef struct +typedef struct { - CFE_ES_CDSHandle_t CDSHandle; /**< \brief Handle to Critical Data Store for Critical Tables */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ - CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ - char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ - char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ - bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ + CFE_ES_CDSHandle_t CDSHandle; /**< \brief Handle to Critical Data Store for Critical Tables */ + uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ + uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ + CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ + char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ + char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ + bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ } CFE_TBL_CritRegRec_t; - /*******************************************************************************/ /** \brief Dump Control Block ** ** This structure holds the data associated with a dump request. */ -typedef struct +typedef struct { - CFE_TBL_DumpState_t State; /**< \brief Current state of this block of data */ - size_t Size; /**< \brief Number of bytes to be dumped */ - CFE_TBL_LoadBuff_t *DumpBufferPtr; /**< \brief Address where dumped data is to be stored temporarily */ - CFE_TBL_RegistryRec_t *RegRecPtr; /**< \brief Ptr to dumped table's registry record */ - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Name of Table being Dumped */ + CFE_TBL_DumpState_t State; /**< \brief Current state of this block of data */ + size_t Size; /**< \brief Number of bytes to be dumped */ + CFE_TBL_LoadBuff_t * DumpBufferPtr; /**< \brief Address where dumped data is to be stored temporarily */ + CFE_TBL_RegistryRec_t *RegRecPtr; /**< \brief Ptr to dumped table's registry record */ + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Name of Table being Dumped */ } CFE_TBL_DumpControl_t; - /*******************************************************************************/ /** \brief Table Registry Dump Record ** ** Shortened Table Registry Record that is used when dumping a table ** registry entry to a file. */ -typedef struct +typedef struct { - CFE_ES_MemOffset_t Size; /**< \brief Size, in bytes, of Table */ - CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ - uint32 NumUsers; /**< \brief Number of applications that are sharing the table */ - int32 LoadInProgress; /**< \brief Flag identifies inactive buffer and whether load in progress */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ - uint32 Crc; /**< \brief Most recent CRC computed by TBL Services on table contents */ - bool ValidationFunc; /**< \brief Flag indicating whether table has an associated Validation func*/ - bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ - bool LoadPending; /**< \brief Flag indicating an inactive buffer is ready to be copied */ - bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ - bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ - char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ - char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ - char OwnerAppName[OS_MAX_API_NAME]; /**< \brief Application Name of App that Registered Table */ - bool CriticalTable; /**< \brief Identifies whether table is Critical or Not */ + CFE_ES_MemOffset_t Size; /**< \brief Size, in bytes, of Table */ + CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ + uint32 NumUsers; /**< \brief Number of applications that are sharing the table */ + int32 LoadInProgress; /**< \brief Flag identifies inactive buffer and whether load in progress */ + uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ + uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ + uint32 Crc; /**< \brief Most recent CRC computed by TBL Services on table contents */ + bool ValidationFunc; /**< \brief Flag indicating whether table has an associated Validation func*/ + bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ + bool LoadPending; /**< \brief Flag indicating an inactive buffer is ready to be copied */ + bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ + bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ + char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ + char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ + char OwnerAppName[OS_MAX_API_NAME]; /**< \brief Application Name of App that Registered Table */ + bool CriticalTable; /**< \brief Identifies whether table is Critical or Not */ } CFE_TBL_RegDumpRec_t; /*******************************************************************************/ @@ -274,9 +263,9 @@ typedef struct ** ** State info for background table registry dump process and one temporary data record. */ -typedef struct +typedef struct { - CFE_FS_FileWriteMetaData_t FileWrite; /**< FS state data - must be first */ + CFE_FS_FileWriteMetaData_t FileWrite; /**< FS state data - must be first */ bool FileExisted; /**< Set true if the file already existed at the time of request */ CFE_TBL_RegDumpRec_t DumpRecord; /**< Current record buffer (reused each entry) */ @@ -291,70 +280,73 @@ typedef struct */ typedef struct { - /* - ** Task command interface counters... - */ - uint8 CommandCounter; /**< \brief Counts number of valid commands received */ - uint8 CommandErrorCounter; /**< \brief Counts number of invalid commands received */ - - /* - ** Table Validation Result counters... - */ - uint8 SuccessValCounter; /**< \brief Counts number of successful table validations */ - uint8 FailedValCounter; /**< \brief Counts number of unsuccessful table validations */ - uint8 NumValRequests; /**< \brief Counts number of table validation requests made */ - - /* - ** Ground Interface Information - */ - int16 LastTblUpdated; /**< \brief Index into Registry of last table updated */ - - /* - ** Task housekeeping and diagnostics telemetry packets... - */ - CFE_TBL_HousekeepingTlm_t HkPacket; /**< \brief Housekeping Telemetry Packet */ - CFE_TBL_TableRegistryTlm_t TblRegPacket; /**< \brief Table Registry Entry Telemetry Packet */ - CFE_TBL_NotifyCmd_t NotifyMsg; /**< \brief Table management notification command message */ - - /* - ** Task operational data (not reported in housekeeping)... - */ - CFE_SB_PipeId_t CmdPipe; /**< \brief Table Task command pipe ID as obtained from Software Bus */ - - /* - ** Task initialization data (not reported in housekeeping)... - */ - CFE_ES_AppId_t TableTaskAppId; /**< \brief Contains Table Task Application ID as assigned by OS AL */ - - int16 HkTlmTblRegIndex; /**< \brief Index of table registry entry to be telemetered with Housekeeping */ - uint16 ValidationCounter; - - /* - ** Registry Access Mutex and Load Buffer Semaphores - */ - osal_id_t RegistryMutex; /**< \brief Mutex that controls access to Table Registry */ - osal_id_t WorkBufMutex; /**< \brief Mutex that controls assignment of Working Buffers */ - CFE_ES_CDSHandle_t CritRegHandle; /**< \brief Handle to Critical Table Registry in CDS */ - CFE_TBL_LoadBuff_t LoadBuffs[CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS]; /**< \brief Working table buffers shared by single buffered tables */ - - /* - ** Registry Data - */ - CFE_TBL_AccessDescriptor_t Handles[CFE_PLATFORM_TBL_MAX_NUM_HANDLES]; /**< \brief Array of Access Descriptors */ - CFE_TBL_RegistryRec_t Registry[CFE_PLATFORM_TBL_MAX_NUM_TABLES]; /**< \brief Array of Table Registry Records */ - CFE_TBL_CritRegRec_t CritReg[CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES]; /**< \brief Array of Critical Table Registry Records */ - CFE_TBL_BufParams_t Buf; /**< \brief Parameters associated with Table Task's Memory Pool */ - CFE_TBL_ValidationResult_t ValidationResults[CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS]; /**< \brief Array of Table Validation Requests */ - CFE_TBL_DumpControl_t DumpControlBlocks[CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS]; /**< \brief Array of Dump-Only Dump Control Blocks */ - - /* - * Registry dump state info (background job) - */ - CFE_TBL_RegDumpStateInfo_t RegDumpState; + /* + ** Task command interface counters... + */ + uint8 CommandCounter; /**< \brief Counts number of valid commands received */ + uint8 CommandErrorCounter; /**< \brief Counts number of invalid commands received */ + + /* + ** Table Validation Result counters... + */ + uint8 SuccessValCounter; /**< \brief Counts number of successful table validations */ + uint8 FailedValCounter; /**< \brief Counts number of unsuccessful table validations */ + uint8 NumValRequests; /**< \brief Counts number of table validation requests made */ + + /* + ** Ground Interface Information + */ + int16 LastTblUpdated; /**< \brief Index into Registry of last table updated */ + + /* + ** Task housekeeping and diagnostics telemetry packets... + */ + CFE_TBL_HousekeepingTlm_t HkPacket; /**< \brief Housekeping Telemetry Packet */ + CFE_TBL_TableRegistryTlm_t TblRegPacket; /**< \brief Table Registry Entry Telemetry Packet */ + CFE_TBL_NotifyCmd_t NotifyMsg; /**< \brief Table management notification command message */ + + /* + ** Task operational data (not reported in housekeeping)... + */ + CFE_SB_PipeId_t CmdPipe; /**< \brief Table Task command pipe ID as obtained from Software Bus */ + + /* + ** Task initialization data (not reported in housekeeping)... + */ + CFE_ES_AppId_t TableTaskAppId; /**< \brief Contains Table Task Application ID as assigned by OS AL */ + + int16 HkTlmTblRegIndex; /**< \brief Index of table registry entry to be telemetered with Housekeeping */ + uint16 ValidationCounter; + + /* + ** Registry Access Mutex and Load Buffer Semaphores + */ + osal_id_t RegistryMutex; /**< \brief Mutex that controls access to Table Registry */ + osal_id_t WorkBufMutex; /**< \brief Mutex that controls assignment of Working Buffers */ + CFE_ES_CDSHandle_t CritRegHandle; /**< \brief Handle to Critical Table Registry in CDS */ + CFE_TBL_LoadBuff_t LoadBuffs[CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS]; /**< \brief Working table buffers shared by + single buffered tables */ + + /* + ** Registry Data + */ + CFE_TBL_AccessDescriptor_t Handles[CFE_PLATFORM_TBL_MAX_NUM_HANDLES]; /**< \brief Array of Access Descriptors */ + CFE_TBL_RegistryRec_t Registry[CFE_PLATFORM_TBL_MAX_NUM_TABLES]; /**< \brief Array of Table Registry Records */ + CFE_TBL_CritRegRec_t + CritReg[CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES]; /**< \brief Array of Critical Table Registry Records */ + CFE_TBL_BufParams_t Buf; /**< \brief Parameters associated with Table Task's Memory Pool */ + CFE_TBL_ValidationResult_t + ValidationResults[CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS]; /**< \brief Array of Table Validation Requests */ + CFE_TBL_DumpControl_t DumpControlBlocks[CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS]; /**< \brief Array of Dump-Only + Dump Control Blocks */ + + /* + * Registry dump state info (background job) + */ + CFE_TBL_RegDumpStateInfo_t RegDumpState; } CFE_TBL_Global_t; - /*************************************************************************/ /* * Functions @@ -415,9 +407,9 @@ int32 CFE_TBL_TaskInit(void); ** ** \param[in] MessagePtr a pointer to the message received from the command pipe ** -** +** ******************************************************************************/ -void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr); +void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr); /*****************************************************************************/ /** @@ -429,10 +421,9 @@ void CFE_TBL_TaskPipe(CFE_SB_Buffer_t *SBBufPtr); ** \par Assumptions, External Events, and Notes: ** None ** -** +** ******************************************************************************/ -void CFE_TBL_InitData(void); - +void CFE_TBL_InitData(void); #endif /* _cfe_tbl_task_ */ diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index 94fb817d1..b3bccb2e8 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -29,7 +29,6 @@ ** */ - /* ** Required header files */ @@ -38,7 +37,6 @@ #include - /******************************************************************* ** ** CFE_TBL_HousekeepingCmd() -- Process Housekeeping Request Message @@ -48,12 +46,12 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) { - int32 Status; - uint32 i; - CFE_TBL_DumpControl_t *DumpCtrlPtr; - CFE_TIME_SysTime_t DumpTime; - osal_id_t FileDescriptor; - + int32 Status; + uint32 i; + CFE_TBL_DumpControl_t *DumpCtrlPtr; + CFE_TIME_SysTime_t DumpTime; + osal_id_t FileDescriptor; + /* ** Collect housekeeping data from Table Services */ @@ -67,10 +65,8 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) if (Status != CFE_SUCCESS) { - CFE_EVS_SendEvent(CFE_TBL_FAIL_HK_SEND_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to send Hk Packet (Status=0x%08X)", - (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_FAIL_HK_SEND_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to send Hk Packet (Status=0x%08X)", (unsigned int)Status); } /* If a table's registry entry has been requested for telemetry, then pack it and send it */ @@ -87,52 +83,51 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) /* Once the data has been sent, clear the index so that we don't send it again and again */ CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; } - + /* Check to see if there are any dump-only table dumps pending */ - for (i=0; i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; i++) + for (i = 0; i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; i++) { if (CFE_TBL_Global.DumpControlBlocks[i].State == CFE_TBL_DUMP_PERFORMED) { - DumpCtrlPtr = &CFE_TBL_Global.DumpControlBlocks[i]; - Status = CFE_TBL_DumpToFile(DumpCtrlPtr->DumpBufferPtr->DataSource, - DumpCtrlPtr->TableName, - DumpCtrlPtr->DumpBufferPtr->BufferPtr, - DumpCtrlPtr->Size); - + DumpCtrlPtr = &CFE_TBL_Global.DumpControlBlocks[i]; + Status = CFE_TBL_DumpToFile(DumpCtrlPtr->DumpBufferPtr->DataSource, DumpCtrlPtr->TableName, + DumpCtrlPtr->DumpBufferPtr->BufferPtr, DumpCtrlPtr->Size); + /* If dump file was successfully written, update the file header so that the timestamp */ - /* is the time of the actual capturing of the data, NOT the time when it was written to the file */ + /* is the time of the actual capturing of the data, NOT the time when it was written to the file */ if (Status == CFE_TBL_INC_CMD_CTR) { - DumpTime.Seconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSecs; + DumpTime.Seconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSecs; DumpTime.Subseconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSubSecs; - - Status = OS_OpenCreate(&FileDescriptor, DumpCtrlPtr->DumpBufferPtr->DataSource, OS_FILE_FLAG_NONE, OS_READ_WRITE); + + Status = OS_OpenCreate(&FileDescriptor, DumpCtrlPtr->DumpBufferPtr->DataSource, OS_FILE_FLAG_NONE, + OS_READ_WRITE); if (Status >= 0) { Status = CFE_FS_SetTimestamp(FileDescriptor, DumpTime); - + if (Status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("CFE_TBL:HkCmd-Unable to update timestamp in dump file '%s'\n", + CFE_ES_WriteToSysLog("CFE_TBL:HkCmd-Unable to update timestamp in dump file '%s'\n", DumpCtrlPtr->DumpBufferPtr->DataSource); } - + OS_close(FileDescriptor); } else { - CFE_ES_WriteToSysLog("CFE_TBL:HkCmd-Unable to open dump file '%s' to update timestamp\n", + CFE_ES_WriteToSysLog("CFE_TBL:HkCmd-Unable to open dump file '%s' to update timestamp\n", DumpCtrlPtr->DumpBufferPtr->DataSource); } - } - + } + /* Free the shared working buffer */ CFE_TBL_Global.LoadBuffs[DumpCtrlPtr->RegRecPtr->LoadInProgress].Taken = false; - DumpCtrlPtr->RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - + DumpCtrlPtr->RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; + /* Free the Dump Control Block for later use */ - DumpCtrlPtr->State = CFE_TBL_DUMP_FREE; + DumpCtrlPtr->State = CFE_TBL_DUMP_FREE; } } @@ -140,7 +135,6 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) } /* End of CFE_TBL_HousekeepingCmd() */ - /******************************************************************* ** ** CFE_TBL_GetHkData() -- Collect data and store it into the Housekeeping Message @@ -150,20 +144,20 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) void CFE_TBL_GetHkData(void) { - uint32 i; - uint16 Count; + uint32 i; + uint16 Count; CFE_TBL_ValidationResult_t *ValPtr = NULL; /* Copy command counter data */ - CFE_TBL_Global.HkPacket.Payload.CommandCounter = CFE_TBL_Global.CommandCounter; + CFE_TBL_Global.HkPacket.Payload.CommandCounter = CFE_TBL_Global.CommandCounter; CFE_TBL_Global.HkPacket.Payload.CommandErrorCounter = CFE_TBL_Global.CommandErrorCounter; - CFE_TBL_Global.HkPacket.Payload.FailedValCounter = CFE_TBL_Global.FailedValCounter; - CFE_TBL_Global.HkPacket.Payload.NumLoadPending = 0; - CFE_TBL_Global.HkPacket.Payload.MemPoolHandle = CFE_TBL_Global.Buf.PoolHdl; + CFE_TBL_Global.HkPacket.Payload.FailedValCounter = CFE_TBL_Global.FailedValCounter; + CFE_TBL_Global.HkPacket.Payload.NumLoadPending = 0; + CFE_TBL_Global.HkPacket.Payload.MemPoolHandle = CFE_TBL_Global.Buf.PoolHdl; /* Determine the number of tables currently registered and Number of Load Pending Tables */ Count = 0; - for (i=0; iCrcOfTable; + CFE_TBL_Global.HkPacket.Payload.LastValCrc = ValPtr->CrcOfTable; CFE_TBL_Global.HkPacket.Payload.LastValStatus = ValPtr->Result; - CFE_TBL_Global.HkPacket.Payload.ActiveBuffer = ValPtr->ActiveBuffer; + CFE_TBL_Global.HkPacket.Payload.ActiveBuffer = ValPtr->ActiveBuffer; /* Keep track of the number of failed and successful validations */ if (ValPtr->Result == CFE_SUCCESS) @@ -218,39 +212,39 @@ void CFE_TBL_GetHkData(void) } CFE_SB_MessageStringSet(CFE_TBL_Global.HkPacket.Payload.LastValTableName, ValPtr->TableName, - sizeof(CFE_TBL_Global.HkPacket.Payload.LastValTableName), sizeof(ValPtr->TableName)); + sizeof(CFE_TBL_Global.HkPacket.Payload.LastValTableName), sizeof(ValPtr->TableName)); CFE_TBL_Global.ValidationCounter++; /* Free the Validation Response Block for next time */ - ValPtr->Result = 0; - ValPtr->CrcOfTable = 0; + ValPtr->Result = 0; + ValPtr->CrcOfTable = 0; ValPtr->TableName[0] = '\0'; ValPtr->ActiveBuffer = false; - ValPtr->State = CFE_TBL_VALIDATION_FREE; + ValPtr->State = CFE_TBL_VALIDATION_FREE; } - CFE_TBL_Global.HkPacket.Payload.ValidationCounter = CFE_TBL_Global.ValidationCounter; - CFE_TBL_Global.HkPacket.Payload.SuccessValCounter = CFE_TBL_Global.SuccessValCounter; - CFE_TBL_Global.HkPacket.Payload.FailedValCounter = CFE_TBL_Global.FailedValCounter; - CFE_TBL_Global.HkPacket.Payload.NumValRequests = CFE_TBL_Global.NumValRequests; - + CFE_TBL_Global.HkPacket.Payload.ValidationCounter = CFE_TBL_Global.ValidationCounter; + CFE_TBL_Global.HkPacket.Payload.SuccessValCounter = CFE_TBL_Global.SuccessValCounter; + CFE_TBL_Global.HkPacket.Payload.FailedValCounter = CFE_TBL_Global.FailedValCounter; + CFE_TBL_Global.HkPacket.Payload.NumValRequests = CFE_TBL_Global.NumValRequests; + /* Validate the index of the last table updated before using it */ - if ((CFE_TBL_Global.LastTblUpdated >= 0) && - (CFE_TBL_Global.LastTblUpdated < CFE_PLATFORM_TBL_MAX_NUM_TABLES)) + if ((CFE_TBL_Global.LastTblUpdated >= 0) && (CFE_TBL_Global.LastTblUpdated < CFE_PLATFORM_TBL_MAX_NUM_TABLES)) { /* Check to make sure the Registry Entry is still valid */ - if (!CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].OwnerAppId, CFE_TBL_NOT_OWNED)) + if (!CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].OwnerAppId, + CFE_TBL_NOT_OWNED)) { /* Get the time at the last table update */ CFE_TBL_Global.HkPacket.Payload.LastUpdateTime = - CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].TimeOfLastUpdate; + CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].TimeOfLastUpdate; /* Get the table name used for the last table update */ CFE_SB_MessageStringSet(CFE_TBL_Global.HkPacket.Payload.LastUpdatedTable, - CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].Name, - sizeof(CFE_TBL_Global.HkPacket.Payload.LastUpdatedTable), - sizeof(CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].Name)); - } + CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].Name, + sizeof(CFE_TBL_Global.HkPacket.Payload.LastUpdatedTable), + sizeof(CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].Name)); + } } } /* End of CFE_TBL_GetHkData() */ @@ -263,19 +257,19 @@ void CFE_TBL_GetHkData(void) void CFE_TBL_GetTblRegData(void) { - CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_RegistryRec_t *RegRecPtr; RegRecPtr = &CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex]; CFE_TBL_Global.TblRegPacket.Payload.Size = CFE_ES_MEMOFFSET_C(RegRecPtr->Size); CFE_TBL_Global.TblRegPacket.Payload.ActiveBufferAddr = - CFE_ES_MEMADDRESS_C(RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr); + CFE_ES_MEMADDRESS_C(RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr); if (RegRecPtr->DoubleBuffered) { /* For a double buffered table, the inactive is the other allocated buffer */ CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = - CFE_ES_MEMADDRESS_C(RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].BufferPtr); + CFE_ES_MEMADDRESS_C(RegRecPtr->Buffers[(1U - RegRecPtr->ActiveBufferIndex)].BufferPtr); } else { @@ -283,34 +277,36 @@ void CFE_TBL_GetTblRegData(void) if (RegRecPtr->LoadInProgress != CFE_TBL_NO_LOAD_IN_PROGRESS) { CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = - CFE_ES_MEMADDRESS_C(CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr); + CFE_ES_MEMADDRESS_C(CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr); } else { - CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); + CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); } } CFE_TBL_Global.TblRegPacket.Payload.ValidationFuncPtr = CFE_ES_MEMADDRESS_C(RegRecPtr->ValidationFuncPtr); - CFE_TBL_Global.TblRegPacket.Payload.TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; - CFE_TBL_Global.TblRegPacket.Payload.TableLoadedOnce = RegRecPtr->TableLoadedOnce; - CFE_TBL_Global.TblRegPacket.Payload.LoadPending = RegRecPtr->LoadPending; - CFE_TBL_Global.TblRegPacket.Payload.DumpOnly = RegRecPtr->DumpOnly; - CFE_TBL_Global.TblRegPacket.Payload.DoubleBuffered = RegRecPtr->DoubleBuffered; - CFE_TBL_Global.TblRegPacket.Payload.FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; - CFE_TBL_Global.TblRegPacket.Payload.FileCreateTimeSubSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; - CFE_TBL_Global.TblRegPacket.Payload.Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; + CFE_TBL_Global.TblRegPacket.Payload.TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; + CFE_TBL_Global.TblRegPacket.Payload.TableLoadedOnce = RegRecPtr->TableLoadedOnce; + CFE_TBL_Global.TblRegPacket.Payload.LoadPending = RegRecPtr->LoadPending; + CFE_TBL_Global.TblRegPacket.Payload.DumpOnly = RegRecPtr->DumpOnly; + CFE_TBL_Global.TblRegPacket.Payload.DoubleBuffered = RegRecPtr->DoubleBuffered; + CFE_TBL_Global.TblRegPacket.Payload.FileCreateTimeSecs = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; + CFE_TBL_Global.TblRegPacket.Payload.FileCreateTimeSubSecs = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; + CFE_TBL_Global.TblRegPacket.Payload.Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; CFE_TBL_Global.TblRegPacket.Payload.Critical = RegRecPtr->CriticalTable; CFE_SB_MessageStringSet(CFE_TBL_Global.TblRegPacket.Payload.Name, RegRecPtr->Name, - sizeof(CFE_TBL_Global.TblRegPacket.Payload.Name), sizeof(RegRecPtr->Name)); + sizeof(CFE_TBL_Global.TblRegPacket.Payload.Name), sizeof(RegRecPtr->Name)); CFE_SB_MessageStringSet(CFE_TBL_Global.TblRegPacket.Payload.LastFileLoaded, RegRecPtr->LastFileLoaded, - sizeof(CFE_TBL_Global.TblRegPacket.Payload.LastFileLoaded), sizeof(RegRecPtr->LastFileLoaded)); + sizeof(CFE_TBL_Global.TblRegPacket.Payload.LastFileLoaded), + sizeof(RegRecPtr->LastFileLoaded)); CFE_ES_GetAppName(CFE_TBL_Global.TblRegPacket.Payload.OwnerAppName, RegRecPtr->OwnerAppId, - sizeof(CFE_TBL_Global.TblRegPacket.Payload.OwnerAppName)); + sizeof(CFE_TBL_Global.TblRegPacket.Payload.OwnerAppName)); } /* End of CFE_TBL_GetTblRegData() */ - /******************************************************************* ** ** CFE_TBL_NoopCmd() -- Process NO-Op Command Message @@ -327,7 +323,6 @@ int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data) } /* End of CFE_TBL_NoopCmd() */ - /******************************************************************* ** ** CFE_TBL_ResetCountersCmd() -- Process Reset Counters Command Message @@ -337,22 +332,19 @@ int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data) int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data) { - CFE_TBL_Global.CommandCounter = 0; + CFE_TBL_Global.CommandCounter = 0; CFE_TBL_Global.CommandErrorCounter = 0; - CFE_TBL_Global.SuccessValCounter = 0; - CFE_TBL_Global.FailedValCounter = 0; - CFE_TBL_Global.NumValRequests = 0; - CFE_TBL_Global.ValidationCounter = 0; + CFE_TBL_Global.SuccessValCounter = 0; + CFE_TBL_Global.FailedValCounter = 0; + CFE_TBL_Global.NumValRequests = 0; + CFE_TBL_Global.ValidationCounter = 0; - CFE_EVS_SendEvent(CFE_TBL_RESET_INF_EID, - CFE_EVS_EventType_DEBUG, - "Reset Counters command"); + CFE_EVS_SendEvent(CFE_TBL_RESET_INF_EID, CFE_EVS_EventType_DEBUG, "Reset Counters command"); return CFE_TBL_DONT_INC_CTR; } /* End of CFE_TBL_ResetCountersCmd() */ - /******************************************************************* ** ** CFE_TBL_LoadCmd() -- Process Load Table File to Buffer Command Message @@ -362,20 +354,20 @@ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_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; - CFE_FS_Header_t StdFileHeader; - CFE_TBL_File_Hdr_t TblFileHeader; - osal_id_t FileDescriptor; - int32 Status; - CFE_TBL_RegistryRec_t *RegRecPtr; - CFE_TBL_LoadBuff_t *WorkingBufferPtr; - char LoadFilename[OS_MAX_PATH_LEN]; - uint8 ExtraByte; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + const CFE_TBL_LoadCmd_Payload_t *CmdPtr = &data->Payload; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_File_Hdr_t TblFileHeader; + osal_id_t FileDescriptor; + int32 Status; + CFE_TBL_RegistryRec_t * RegRecPtr; + CFE_TBL_LoadBuff_t * WorkingBufferPtr; + char LoadFilename[OS_MAX_PATH_LEN]; + uint8 ExtraByte; /* Make sure all strings are null terminated before attempting to process them */ - CFE_SB_MessageStringGet(LoadFilename, (char *)CmdPtr->LoadFilename, NULL, - sizeof(LoadFilename), sizeof(CmdPtr->LoadFilename)); + CFE_SB_MessageStringGet(LoadFilename, (char *)CmdPtr->LoadFilename, NULL, sizeof(LoadFilename), + sizeof(CmdPtr->LoadFilename)); /* Try to open the specified table file */ Status = OS_OpenCreate(&FileDescriptor, LoadFilename, OS_FILE_FLAG_NONE, OS_READ_ONLY); @@ -391,10 +383,8 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) if (Status == CFE_TBL_NOT_FOUND) { - CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to locate '%s' in Table Registry", - TblFileHeader.TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to locate '%s' in Table Registry", TblFileHeader.TableName); } else { @@ -403,15 +393,13 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) if (RegRecPtr->DumpOnly) { - CFE_EVS_SendEvent(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID, - CFE_EVS_EventType_ERROR, - "Attempted to load DUMP-ONLY table '%s' from '%s'", - TblFileHeader.TableName, LoadFilename); + CFE_EVS_SendEvent(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID, CFE_EVS_EventType_ERROR, + "Attempted to load DUMP-ONLY table '%s' from '%s'", TblFileHeader.TableName, + LoadFilename); } else if (RegRecPtr->LoadPending) { - CFE_EVS_SendEvent(CFE_TBL_LOADING_PENDING_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_TBL_LOADING_PENDING_ERR_EID, CFE_EVS_EventType_ERROR, "Attempted to load table '%s' while previous load is still pending", TblFileHeader.TableName); } @@ -422,8 +410,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) /* load starts with the first byte */ /* 2) The number of bytes to load is greater than zero */ /* 3) The offset plus the number of bytes does not exceed the table size */ - if (((RegRecPtr->TableLoadedOnce) || (TblFileHeader.Offset == 0)) && - (TblFileHeader.NumBytes > 0) && + if (((RegRecPtr->TableLoadedOnce) || (TblFileHeader.Offset == 0)) && (TblFileHeader.NumBytes > 0) && ((TblFileHeader.NumBytes + TblFileHeader.Offset) <= RegRecPtr->Size)) { /* Get a working buffer, either a free one or one allocated with previous load command */ @@ -432,58 +419,56 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) if (Status == CFE_SUCCESS) { /* Copy data from file into working buffer */ - Status = OS_read(FileDescriptor, - ((uint8*)WorkingBufferPtr->BufferPtr) + TblFileHeader.Offset, - TblFileHeader.NumBytes); - + Status = + OS_read(FileDescriptor, ((uint8 *)WorkingBufferPtr->BufferPtr) + TblFileHeader.Offset, + TblFileHeader.NumBytes); + /* Make sure the appropriate number of bytes were read */ if (Status == (int32)TblFileHeader.NumBytes) { /* Check to ensure the file does not have any extra data at the end */ Status = OS_read(FileDescriptor, &ExtraByte, 1); - /* If another byte was successfully read, then file contains more data than header claims */ + /* If another byte was successfully read, then file contains more data than header + * claims */ if (Status == 1) { - CFE_EVS_SendEvent(CFE_TBL_FILE_TOO_BIG_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_TBL_FILE_TOO_BIG_ERR_EID, CFE_EVS_EventType_ERROR, "File '%s' has more data than Tbl Hdr indicates (%d)", - LoadFilename, - (int)TblFileHeader.NumBytes); + LoadFilename, (int)TblFileHeader.NumBytes); } else /* If error reading file or zero bytes read, assume it was the perfect size */ { - CFE_EVS_SendEvent(CFE_TBL_FILE_LOADED_INF_EID, - CFE_EVS_EventType_INFORMATION, - "Successful load of '%s' into '%s' working buffer", - LoadFilename, + CFE_EVS_SendEvent(CFE_TBL_FILE_LOADED_INF_EID, CFE_EVS_EventType_INFORMATION, + "Successful load of '%s' into '%s' working buffer", LoadFilename, TblFileHeader.TableName); /* Save file information statistics for later use in registry */ memcpy(WorkingBufferPtr->DataSource, LoadFilename, OS_MAX_PATH_LEN); /* Save file creation time for later storage into Registry */ - WorkingBufferPtr->FileCreateTimeSecs = StdFileHeader.TimeSeconds; + WorkingBufferPtr->FileCreateTimeSecs = StdFileHeader.TimeSeconds; WorkingBufferPtr->FileCreateTimeSubSecs = StdFileHeader.TimeSubSeconds; - + /* Compute the CRC on the specified table buffer */ - WorkingBufferPtr->Crc = CFE_ES_CalculateCRC(WorkingBufferPtr->BufferPtr, - RegRecPtr->Size, - 0, - CFE_MISSION_ES_DEFAULT_CRC); - - /* Initialize validation flag with true if no Validation Function is required to be called */ + WorkingBufferPtr->Crc = CFE_ES_CalculateCRC( + WorkingBufferPtr->BufferPtr, RegRecPtr->Size, 0, CFE_MISSION_ES_DEFAULT_CRC); + + /* Initialize validation flag with true if no Validation Function is required to be + * called */ WorkingBufferPtr->Validated = (RegRecPtr->ValidationFuncPtr == NULL); - + /* Save file information statistics for housekeeping telemetry */ strncpy(CFE_TBL_Global.HkPacket.Payload.LastFileLoaded, LoadFilename, sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileLoaded) - 1); - CFE_TBL_Global.HkPacket.Payload.LastFileLoaded[ - sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileLoaded) - 1] = '\0'; + CFE_TBL_Global.HkPacket.Payload + .LastFileLoaded[sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileLoaded) - 1] = + '\0'; strncpy(CFE_TBL_Global.HkPacket.Payload.LastTableLoaded, TblFileHeader.TableName, sizeof(CFE_TBL_Global.HkPacket.Payload.LastTableLoaded) - 1); - CFE_TBL_Global.HkPacket.Payload.LastTableLoaded[ - sizeof(CFE_TBL_Global.HkPacket.Payload.LastTableLoaded) - 1] = '\0'; + CFE_TBL_Global.HkPacket.Payload + .LastTableLoaded[sizeof(CFE_TBL_Global.HkPacket.Payload.LastTableLoaded) - 1] = + '\0'; /* Increment successful command completion counter */ ReturnCode = CFE_TBL_INC_CMD_CTR; @@ -493,57 +478,47 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) { /* A file whose header claims has 'x' amount of data but it only has 'y' */ /* is considered a fatal error during a load process */ - CFE_EVS_SendEvent(CFE_TBL_FILE_INCOMPLETE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Incomplete load of '%s' into '%s' working buffer", - LoadFilename, + CFE_EVS_SendEvent(CFE_TBL_FILE_INCOMPLETE_ERR_EID, CFE_EVS_EventType_ERROR, + "Incomplete load of '%s' into '%s' working buffer", LoadFilename, TblFileHeader.TableName); } } else if (Status == CFE_TBL_ERR_NO_BUFFER_AVAIL) { - CFE_EVS_SendEvent(CFE_TBL_NO_WORK_BUFFERS_ERR_EID, - CFE_EVS_EventType_ERROR, - "No working buffers available for table '%s'", - TblFileHeader.TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_WORK_BUFFERS_ERR_EID, CFE_EVS_EventType_ERROR, + "No working buffers available for table '%s'", TblFileHeader.TableName); } else { - CFE_EVS_SendEvent(CFE_TBL_INTERNAL_ERROR_ERR_EID, - CFE_EVS_EventType_ERROR, - "Internal Error (Status=0x%08X)", - (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_INTERNAL_ERROR_ERR_EID, CFE_EVS_EventType_ERROR, + "Internal Error (Status=0x%08X)", (unsigned int)Status); } } else { if ((TblFileHeader.NumBytes + TblFileHeader.Offset) > RegRecPtr->Size) { - CFE_EVS_SendEvent(CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Cannot load '%s' (%d) at offset %d in '%s' (%d)", - LoadFilename, (int)TblFileHeader.NumBytes, (int)TblFileHeader.Offset, + CFE_EVS_SendEvent(CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID, CFE_EVS_EventType_ERROR, + "Cannot load '%s' (%d) at offset %d in '%s' (%d)", LoadFilename, + (int)TblFileHeader.NumBytes, (int)TblFileHeader.Offset, TblFileHeader.TableName, (int)RegRecPtr->Size); } else if (TblFileHeader.NumBytes == 0) { - CFE_EVS_SendEvent(CFE_TBL_ZERO_LENGTH_LOAD_ERR_EID, - CFE_EVS_EventType_ERROR, - "Table Hdr in '%s' indicates no data in file", - LoadFilename); + CFE_EVS_SendEvent(CFE_TBL_ZERO_LENGTH_LOAD_ERR_EID, CFE_EVS_EventType_ERROR, + "Table Hdr in '%s' indicates no data in file", LoadFilename); } else { - CFE_EVS_SendEvent(CFE_TBL_PARTIAL_LOAD_ERR_EID, - CFE_EVS_EventType_ERROR, - "'%s' has partial load for uninitialized table '%s'", - LoadFilename, TblFileHeader.TableName); + CFE_EVS_SendEvent(CFE_TBL_PARTIAL_LOAD_ERR_EID, CFE_EVS_EventType_ERROR, + "'%s' has partial load for uninitialized table '%s'", LoadFilename, + TblFileHeader.TableName); } } } } - } /* No need to issue event messages in response to errors reading headers */ - /* because the function that read the headers will generate messages */ + } /* No need to issue event messages in response to errors reading headers */ + /* because the function that read the headers will generate messages */ /* Close the file now that the contents have been read */ OS_close(FileDescriptor); @@ -551,17 +526,15 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) else { /* Error opening specified file */ - CFE_EVS_SendEvent(CFE_TBL_FILE_ACCESS_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to open file '%s' for table load, Status = 0x%08X", - LoadFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_FILE_ACCESS_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to open file '%s' for table load, Status = 0x%08X", LoadFilename, + (unsigned int)Status); } return ReturnCode; } /* End of CFE_TBL_LoadCmd() */ - /******************************************************************* ** ** CFE_TBL_DumpCmd() -- Process Dump Table to File Command Message @@ -571,24 +544,23 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_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; - const CFE_TBL_DumpCmd_Payload_t *CmdPtr = &data->Payload; - char DumpFilename[OS_MAX_PATH_LEN]; - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; - CFE_TBL_RegistryRec_t *RegRecPtr; - void *DumpDataAddr = NULL; - CFE_TBL_LoadBuff_t *WorkingBufferPtr; - int32 DumpIndex; - int32 Status; - CFE_TBL_DumpControl_t *DumpCtrlPtr; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + int16 RegIndex; + const CFE_TBL_DumpCmd_Payload_t *CmdPtr = &data->Payload; + char DumpFilename[OS_MAX_PATH_LEN]; + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; + CFE_TBL_RegistryRec_t * RegRecPtr; + void * DumpDataAddr = NULL; + CFE_TBL_LoadBuff_t * WorkingBufferPtr; + int32 DumpIndex; + int32 Status; + CFE_TBL_DumpControl_t * DumpCtrlPtr; /* Make sure all strings are null terminated before attempting to process them */ - CFE_SB_MessageStringGet(DumpFilename, (char *)CmdPtr->DumpFilename, NULL, - sizeof(DumpFilename), sizeof(CmdPtr->DumpFilename)); + CFE_SB_MessageStringGet(DumpFilename, (char *)CmdPtr->DumpFilename, NULL, sizeof(DumpFilename), + sizeof(CmdPtr->DumpFilename)); - CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - sizeof(TableName), sizeof(CmdPtr->TableName)); + CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table that is to be dumped exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -603,12 +575,12 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) { DumpDataAddr = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr; } - else if (CmdPtr->ActiveTableFlag == CFE_TBL_BufferSelect_INACTIVE)/* Dumping Inactive Buffer */ + else if (CmdPtr->ActiveTableFlag == CFE_TBL_BufferSelect_INACTIVE) /* Dumping Inactive Buffer */ { /* If this is a double buffered table, locating the inactive buffer is trivial */ if (RegRecPtr->DoubleBuffered) { - DumpDataAddr = RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].BufferPtr; + DumpDataAddr = RegRecPtr->Buffers[(1U - RegRecPtr->ActiveBufferIndex)].BufferPtr; } else { @@ -620,19 +592,16 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) } else { - CFE_EVS_SendEvent(CFE_TBL_NO_INACTIVE_BUFFER_ERR_EID, - CFE_EVS_EventType_ERROR, - "No Inactive Buffer for Table '%s' present", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_INACTIVE_BUFFER_ERR_EID, CFE_EVS_EventType_ERROR, + "No Inactive Buffer for Table '%s' present", TableName); } } } else { - CFE_EVS_SendEvent(CFE_TBL_ILLEGAL_BUFF_PARAM_ERR_EID, - CFE_EVS_EventType_ERROR, - "Cmd for Table '%s' had illegal buffer parameter (0x%08X)", - TableName, (unsigned int)CmdPtr->ActiveTableFlag); + CFE_EVS_SendEvent(CFE_TBL_ILLEGAL_BUFF_PARAM_ERR_EID, CFE_EVS_EventType_ERROR, + "Cmd for Table '%s' had illegal buffer parameter (0x%08X)", TableName, + (unsigned int)CmdPtr->ActiveTableFlag); } /* If we have located the data to be dumped, then proceed with creating the file and dumping the data */ @@ -660,66 +629,58 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) { /* Allocate a shared memory buffer for storing the data to be dumped */ Status = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); - + if (Status == CFE_SUCCESS) { - DumpCtrlPtr = &CFE_TBL_Global.DumpControlBlocks[DumpIndex]; - DumpCtrlPtr->State = CFE_TBL_DUMP_PENDING; + DumpCtrlPtr = &CFE_TBL_Global.DumpControlBlocks[DumpIndex]; + DumpCtrlPtr->State = CFE_TBL_DUMP_PENDING; DumpCtrlPtr->RegRecPtr = RegRecPtr; - + /* Save the name of the desired dump filename, table name and size for later */ DumpCtrlPtr->DumpBufferPtr = WorkingBufferPtr; memcpy(DumpCtrlPtr->DumpBufferPtr->DataSource, DumpFilename, OS_MAX_PATH_LEN); memcpy(DumpCtrlPtr->TableName, TableName, CFE_TBL_MAX_FULL_NAME_LEN); DumpCtrlPtr->Size = RegRecPtr->Size; - + /* Notify the owning application that a dump is pending */ RegRecPtr->DumpControlIndex = DumpIndex; - + /* If application requested notification by message, then do so */ CFE_TBL_SendNotificationMsg(RegRecPtr); - + /* Consider the command completed successfully */ ReturnCode = CFE_TBL_INC_CMD_CTR; } else { - CFE_EVS_SendEvent(CFE_TBL_NO_WORK_BUFFERS_ERR_EID, - CFE_EVS_EventType_ERROR, - "No working buffers available for table '%s'", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_WORK_BUFFERS_ERR_EID, CFE_EVS_EventType_ERROR, + "No working buffers available for table '%s'", TableName); } } else { - CFE_EVS_SendEvent(CFE_TBL_TOO_MANY_DUMPS_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_TBL_TOO_MANY_DUMPS_ERR_EID, CFE_EVS_EventType_ERROR, "Too many Dump Only Table Dumps have been requested"); } } else { - CFE_EVS_SendEvent(CFE_TBL_DUMP_PENDING_ERR_EID, - CFE_EVS_EventType_ERROR, - "A dump for '%s' is already pending", - TableName); + CFE_EVS_SendEvent(CFE_TBL_DUMP_PENDING_ERR_EID, CFE_EVS_EventType_ERROR, + "A dump for '%s' is already pending", TableName); } } } } else /* Table could not be found in Registry */ { - CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to locate '%s' in Table Registry", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to locate '%s' in Table Registry", TableName); } return ReturnCode; } /* End of CFE_TBL_DumpCmd() */ - /******************************************************************* ** ** CFE_TBL_DumpToFile() -- Write table data to a file @@ -727,16 +688,17 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) ** NOTE: For complete prolog information, see prototype above ********************************************************************/ -CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *TableName, const void *DumpDataAddr, size_t TblSizeInBytes) +CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *TableName, const void *DumpDataAddr, + size_t TblSizeInBytes) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ - bool FileExistedPrev = false; - CFE_FS_Header_t StdFileHeader; - CFE_TBL_File_Hdr_t TblFileHeader; - osal_id_t FileDescriptor; - int32 Status; - int32 EndianCheck = 0x01020304; - + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + bool FileExistedPrev = false; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_File_Hdr_t TblFileHeader; + osal_id_t FileDescriptor; + int32 Status; + int32 EndianCheck = 0x01020304; + /* Clear Header of any garbage before copying content */ memset(&TblFileHeader, 0, sizeof(CFE_TBL_File_Hdr_t)); @@ -750,8 +712,7 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T } /* Create a new dump file, overwriting anything that may have existed previously */ - Status = OS_OpenCreate(&FileDescriptor, DumpFilename, - OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); + Status = OS_OpenCreate(&FileDescriptor, DumpFilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); if (Status >= OS_SUCCESS) { @@ -764,12 +725,12 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T if (Status == sizeof(CFE_FS_Header_t)) { /* Initialize the Table Image Header for the Dump File */ - strncpy(TblFileHeader.TableName, TableName, sizeof(TblFileHeader.TableName)-1); - TblFileHeader.TableName[sizeof(TblFileHeader.TableName)-1] = 0; - TblFileHeader.Offset = CFE_ES_MEMOFFSET_C(0); - TblFileHeader.NumBytes = CFE_ES_MEMOFFSET_C(TblSizeInBytes); - TblFileHeader.Reserved = 0; - + strncpy(TblFileHeader.TableName, TableName, sizeof(TblFileHeader.TableName) - 1); + TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = 0; + TblFileHeader.Offset = CFE_ES_MEMOFFSET_C(0); + TblFileHeader.NumBytes = CFE_ES_MEMOFFSET_C(TblSizeInBytes); + TblFileHeader.Reserved = 0; + /* Determine if this is a little endian processor */ if ((*(char *)&EndianCheck) == 0x04) { @@ -788,57 +749,49 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T { /* Output the requested data to the dump file */ /* Output the active table image data to the dump file */ - Status = OS_write(FileDescriptor, - DumpDataAddr, - TblSizeInBytes); + Status = OS_write(FileDescriptor, DumpDataAddr, TblSizeInBytes); if (Status == TblSizeInBytes) { if (FileExistedPrev) { - CFE_EVS_SendEvent(CFE_TBL_OVERWRITE_DUMP_INF_EID, - CFE_EVS_EventType_INFORMATION, - "Successfully overwrote '%s' with Table '%s'", - DumpFilename, TableName); + CFE_EVS_SendEvent(CFE_TBL_OVERWRITE_DUMP_INF_EID, CFE_EVS_EventType_INFORMATION, + "Successfully overwrote '%s' with Table '%s'", DumpFilename, TableName); } else { - CFE_EVS_SendEvent(CFE_TBL_WRITE_DUMP_INF_EID, - CFE_EVS_EventType_INFORMATION, - "Successfully dumped Table '%s' to '%s'", - TableName, DumpFilename); + CFE_EVS_SendEvent(CFE_TBL_WRITE_DUMP_INF_EID, CFE_EVS_EventType_INFORMATION, + "Successfully dumped Table '%s' to '%s'", TableName, DumpFilename); } /* Save file information statistics for housekeeping telemetry */ strncpy(CFE_TBL_Global.HkPacket.Payload.LastFileDumped, DumpFilename, - sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileDumped)-1); - CFE_TBL_Global.HkPacket.Payload.LastFileDumped[sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileDumped)-1] = 0; + sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileDumped) - 1); + CFE_TBL_Global.HkPacket.Payload + .LastFileDumped[sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileDumped) - 1] = 0; /* Increment Successful Command Counter */ ReturnCode = CFE_TBL_INC_CMD_CTR; } else { - CFE_EVS_SendEvent(CFE_TBL_WRITE_TBL_IMG_ERR_EID, - CFE_EVS_EventType_ERROR, - "Error writing Tbl image to '%s', Status=0x%08X", - DumpFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_WRITE_TBL_IMG_ERR_EID, CFE_EVS_EventType_ERROR, + "Error writing Tbl image to '%s', Status=0x%08X", DumpFilename, + (unsigned int)Status); } } else { - CFE_EVS_SendEvent(CFE_TBL_WRITE_TBL_HDR_ERR_EID, - CFE_EVS_EventType_ERROR, - "Error writing Tbl image File Header to '%s', Status=0x%08X", - DumpFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_WRITE_TBL_HDR_ERR_EID, CFE_EVS_EventType_ERROR, + "Error writing Tbl image File Header to '%s', Status=0x%08X", DumpFilename, + (unsigned int)Status); } } else { - CFE_EVS_SendEvent(CFE_TBL_WRITE_CFE_HDR_ERR_EID, - CFE_EVS_EventType_ERROR, - "Error writing cFE File Header to '%s', Status=0x%08X", - DumpFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_WRITE_CFE_HDR_ERR_EID, CFE_EVS_EventType_ERROR, + "Error writing cFE File Header to '%s', Status=0x%08X", DumpFilename, + (unsigned int)Status); } /* We are done outputting data to the dump file. Close it. */ @@ -846,12 +799,10 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T } else { - CFE_EVS_SendEvent(CFE_TBL_CREATING_DUMP_FILE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Error creating dump file '%s', Status=0x%08X", - DumpFilename, (unsigned int)Status); + CFE_EVS_SendEvent(CFE_TBL_CREATING_DUMP_FILE_ERR_EID, CFE_EVS_EventType_ERROR, + "Error creating dump file '%s', Status=0x%08X", DumpFilename, (unsigned int)Status); } - + return ReturnCode; } /* End of CFE_TBL_DumpToFile() */ @@ -864,18 +815,17 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ - int16 RegIndex; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + int16 RegIndex; const CFE_TBL_ValidateCmd_Payload_t *CmdPtr = &data->Payload; - CFE_TBL_RegistryRec_t *RegRecPtr; - void *ValidationDataPtr = NULL; - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; - uint32 CrcOfTable; - int32 ValIndex; + CFE_TBL_RegistryRec_t * RegRecPtr; + void * ValidationDataPtr = NULL; + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; + uint32 CrcOfTable; + int32 ValIndex; /* Make sure all strings are null terminated before attempting to process them */ - CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - sizeof(TableName), sizeof(CmdPtr->TableName)); + CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table that is to be dumped exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -895,7 +845,7 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) /* If this is a double buffered table, locating the inactive buffer is trivial */ if (RegRecPtr->DoubleBuffered) { - ValidationDataPtr = RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].BufferPtr; + ValidationDataPtr = RegRecPtr->Buffers[(1U - RegRecPtr->ActiveBufferIndex)].BufferPtr; } else { @@ -906,19 +856,16 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) } else { - CFE_EVS_SendEvent(CFE_TBL_NO_INACTIVE_BUFFER_ERR_EID, - CFE_EVS_EventType_ERROR, - "No Inactive Buffer for Table '%s' present", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_INACTIVE_BUFFER_ERR_EID, CFE_EVS_EventType_ERROR, + "No Inactive Buffer for Table '%s' present", TableName); } } } else { - CFE_EVS_SendEvent(CFE_TBL_ILLEGAL_BUFF_PARAM_ERR_EID, - CFE_EVS_EventType_ERROR, - "Cmd for Table '%s' had illegal buffer parameter (0x%08X)", - TableName, (unsigned int)CmdPtr->ActiveTableFlag); + CFE_EVS_SendEvent(CFE_TBL_ILLEGAL_BUFF_PARAM_ERR_EID, CFE_EVS_EventType_ERROR, + "Cmd for Table '%s' had illegal buffer parameter (0x%08X)", TableName, + (unsigned int)CmdPtr->ActiveTableFlag); } /* If we have located the data to be validated, then proceed with notifying the application, if */ @@ -936,18 +883,14 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) if (ValIndex < CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS) { /* Allocate this Validation Response Block */ - CFE_TBL_Global.ValidationResults[ValIndex].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[ValIndex].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[ValIndex].Result = 0; - memcpy(CFE_TBL_Global.ValidationResults[ValIndex].TableName, - TableName, CFE_TBL_MAX_FULL_NAME_LEN); + memcpy(CFE_TBL_Global.ValidationResults[ValIndex].TableName, TableName, CFE_TBL_MAX_FULL_NAME_LEN); /* Compute the CRC on the specified table buffer */ - CrcOfTable = CFE_ES_CalculateCRC(ValidationDataPtr, - RegRecPtr->Size, - 0, - CFE_MISSION_ES_DEFAULT_CRC); + CrcOfTable = CFE_ES_CalculateCRC(ValidationDataPtr, RegRecPtr->Size, 0, CFE_MISSION_ES_DEFAULT_CRC); - CFE_TBL_Global.ValidationResults[ValIndex].CrcOfTable = CrcOfTable; + CFE_TBL_Global.ValidationResults[ValIndex].CrcOfTable = CrcOfTable; CFE_TBL_Global.ValidationResults[ValIndex].ActiveBuffer = (CmdPtr->ActiveTableFlag != 0); /* If owner has a validation function, then notify the */ @@ -962,15 +905,13 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) { RegRecPtr->ValidateInactiveIndex = ValIndex; } - + /* If application requested notification by message, then do so */ if (CFE_TBL_SendNotificationMsg(RegRecPtr) == CFE_SUCCESS) { /* Notify ground that validation request has been made */ - CFE_EVS_SendEvent(CFE_TBL_VAL_REQ_MADE_INF_EID, - CFE_EVS_EventType_DEBUG, - "Tbl Services issued validation request for '%s'", - TableName); + CFE_EVS_SendEvent(CFE_TBL_VAL_REQ_MADE_INF_EID, CFE_EVS_EventType_DEBUG, + "Tbl Services issued validation request for '%s'", TableName); } /* Maintain statistic on number of validation requests given to applications */ @@ -982,9 +923,8 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) /* By setting this value, we are letting the Housekeeping process recognize it */ /* as data to be sent to the ground in telemetry. */ CFE_TBL_Global.ValidationResults[ValIndex].State = CFE_TBL_VALIDATION_PERFORMED; - - CFE_EVS_SendEvent(CFE_TBL_ASSUMED_VALID_INF_EID, - CFE_EVS_EventType_INFORMATION, + + CFE_EVS_SendEvent(CFE_TBL_ASSUMED_VALID_INF_EID, CFE_EVS_EventType_INFORMATION, "Tbl Services assumes '%s' is valid. No Validation Function has been registered", TableName); } @@ -994,25 +934,21 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) } else { - CFE_EVS_SendEvent(CFE_TBL_TOO_MANY_VALIDATIONS_ERR_EID, - CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_TBL_TOO_MANY_VALIDATIONS_ERR_EID, CFE_EVS_EventType_ERROR, "Too many Table Validations have been requested"); } } } else /* Table could not be found in Registry */ { - CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to locate '%s' in Table Registry", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to locate '%s' in Table Registry", TableName); } return ReturnCode; } /* End of CFE_TBL_ValidateCmd() */ - /******************************************************************* ** ** CFE_TBL_ActivateCmd() -- Process Activate Table Command Message @@ -1022,16 +958,15 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_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; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + int16 RegIndex; const CFE_TBL_ActivateCmd_Payload_t *CmdPtr = &data->Payload; - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; - CFE_TBL_RegistryRec_t *RegRecPtr; - bool ValidationStatus; + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; + CFE_TBL_RegistryRec_t * RegRecPtr; + bool ValidationStatus; /* Make sure all strings are null terminated before attempting to process them */ - CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - sizeof(TableName), sizeof(CmdPtr->TableName)); + CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table that is to be dumped exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -1040,37 +975,33 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data) { /* Obtain a pointer to registry information about specified table */ RegRecPtr = &CFE_TBL_Global.Registry[RegIndex]; - + if (RegRecPtr->DumpOnly) { - CFE_EVS_SendEvent(CFE_TBL_ACTIVATE_DUMP_ONLY_ERR_EID, - CFE_EVS_EventType_ERROR, - "Illegal attempt to activate dump-only table '%s'", - TableName); + CFE_EVS_SendEvent(CFE_TBL_ACTIVATE_DUMP_ONLY_ERR_EID, CFE_EVS_EventType_ERROR, + "Illegal attempt to activate dump-only table '%s'", TableName); } else if (RegRecPtr->LoadInProgress != CFE_TBL_NO_LOAD_IN_PROGRESS) { /* Determine if the inactive buffer has been successfully validated or not */ if (RegRecPtr->DoubleBuffered) { - ValidationStatus = RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].Validated; + ValidationStatus = RegRecPtr->Buffers[(1U - RegRecPtr->ActiveBufferIndex)].Validated; } else { ValidationStatus = CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Validated; } - + if (ValidationStatus == true) { CFE_TBL_Global.Registry[RegIndex].LoadPending = true; - + /* If application requested notification by message, then do so */ if (CFE_TBL_SendNotificationMsg(RegRecPtr) == CFE_SUCCESS) { - CFE_EVS_SendEvent(CFE_TBL_LOAD_PEND_REQ_INF_EID, - CFE_EVS_EventType_DEBUG, - "Tbl Services notifying App that '%s' has a load pending", - TableName); + CFE_EVS_SendEvent(CFE_TBL_LOAD_PEND_REQ_INF_EID, CFE_EVS_EventType_DEBUG, + "Tbl Services notifying App that '%s' has a load pending", TableName); } /* Increment Successful Command Counter */ @@ -1078,33 +1009,26 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data) } else { - CFE_EVS_SendEvent(CFE_TBL_UNVALIDATED_ERR_EID, - CFE_EVS_EventType_ERROR, - "Cannot activate table '%s'. Inactive image not Validated", - TableName); + CFE_EVS_SendEvent(CFE_TBL_UNVALIDATED_ERR_EID, CFE_EVS_EventType_ERROR, + "Cannot activate table '%s'. Inactive image not Validated", TableName); } } else { - CFE_EVS_SendEvent(CFE_TBL_ACTIVATE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Cannot activate table '%s'. No Inactive image available", - TableName); + CFE_EVS_SendEvent(CFE_TBL_ACTIVATE_ERR_EID, CFE_EVS_EventType_ERROR, + "Cannot activate table '%s'. No Inactive image available", TableName); } } else /* Table could not be found in Registry */ { - CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to locate '%s' in Table Registry", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to locate '%s' in Table Registry", TableName); } return ReturnCode; } /* End of CFE_TBL_ActivateCmd() */ - /******************************************************************* ** ** CFE_TBL_DumpRegistryGetter() -- Helper function for dumping table registry @@ -1114,13 +1038,13 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data) bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, size_t *BufSize) { CFE_TBL_RegDumpStateInfo_t *StatePtr = (CFE_TBL_RegDumpStateInfo_t *)Meta; - CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_Handle_t HandleIterator; CFE_ES_AppId_t OwnerAppId; bool IsValidEntry; IsValidEntry = false; - OwnerAppId = CFE_ES_APPID_UNDEFINED; + OwnerAppId = CFE_ES_APPID_UNDEFINED; if (RecordNum < CFE_PLATFORM_TBL_MAX_NUM_TABLES) { @@ -1135,7 +1059,7 @@ bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, siz (RegRecPtr->HeadOfAccessList != CFE_TBL_END_OF_LIST)) { IsValidEntry = true; - OwnerAppId = RegRecPtr->OwnerAppId; + OwnerAppId = RegRecPtr->OwnerAppId; /* Fill Registry Dump Record with relevant information */ StatePtr->DumpRecord.Size = CFE_ES_MEMOFFSET_C(RegRecPtr->Size); @@ -1145,11 +1069,13 @@ bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, siz StatePtr->DumpRecord.TableLoadedOnce = RegRecPtr->TableLoadedOnce; StatePtr->DumpRecord.LoadPending = RegRecPtr->LoadPending; StatePtr->DumpRecord.DumpOnly = RegRecPtr->DumpOnly; - StatePtr->DumpRecord.DoubleBuffered = RegRecPtr->DoubleBuffered; - StatePtr->DumpRecord.FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; - StatePtr->DumpRecord.FileCreateTimeSubSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; - StatePtr->DumpRecord.Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; - StatePtr->DumpRecord.CriticalTable = RegRecPtr->CriticalTable; + StatePtr->DumpRecord.DoubleBuffered = RegRecPtr->DoubleBuffered; + StatePtr->DumpRecord.FileCreateTimeSecs = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; + StatePtr->DumpRecord.FileCreateTimeSubSecs = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; + StatePtr->DumpRecord.Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; + StatePtr->DumpRecord.CriticalTable = RegRecPtr->CriticalTable; /* Convert LoadInProgress flag into more meaningful information */ /* When a load is in progress, identify which buffer is being used as the inactive buffer */ @@ -1167,16 +1093,17 @@ bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, siz /* buffers is a platform configuration parameter, then 0 on up merely identifies the buffer number. */ /* No translation is necessary for single buffered tables. */ } - - strncpy(StatePtr->DumpRecord.Name, RegRecPtr->Name, sizeof(StatePtr->DumpRecord.Name)-1); - StatePtr->DumpRecord.Name[sizeof(StatePtr->DumpRecord.Name)-1] = 0; - - strncpy(StatePtr->DumpRecord.LastFileLoaded, RegRecPtr->LastFileLoaded, sizeof(StatePtr->DumpRecord.LastFileLoaded)-1); - StatePtr->DumpRecord.LastFileLoaded[sizeof(StatePtr->DumpRecord.LastFileLoaded)-1] = 0; + + strncpy(StatePtr->DumpRecord.Name, RegRecPtr->Name, sizeof(StatePtr->DumpRecord.Name) - 1); + StatePtr->DumpRecord.Name[sizeof(StatePtr->DumpRecord.Name) - 1] = 0; + + strncpy(StatePtr->DumpRecord.LastFileLoaded, RegRecPtr->LastFileLoaded, + sizeof(StatePtr->DumpRecord.LastFileLoaded) - 1); + StatePtr->DumpRecord.LastFileLoaded[sizeof(StatePtr->DumpRecord.LastFileLoaded) - 1] = 0; /* Walk the access descriptor list to determine the number of users */ StatePtr->DumpRecord.NumUsers = 0; - HandleIterator = RegRecPtr->HeadOfAccessList; + HandleIterator = RegRecPtr->HeadOfAccessList; while (HandleIterator != CFE_TBL_END_OF_LIST) { StatePtr->DumpRecord.NumUsers++; @@ -1201,23 +1128,23 @@ bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, siz } else { - strncpy(StatePtr->DumpRecord.OwnerAppName, "--UNOWNED--", sizeof(StatePtr->DumpRecord.OwnerAppName)-1); - StatePtr->DumpRecord.OwnerAppName[sizeof(StatePtr->DumpRecord.OwnerAppName)-1] = 0; + strncpy(StatePtr->DumpRecord.OwnerAppName, "--UNOWNED--", sizeof(StatePtr->DumpRecord.OwnerAppName) - 1); + StatePtr->DumpRecord.OwnerAppName[sizeof(StatePtr->DumpRecord.OwnerAppName) - 1] = 0; } /* export data to caller */ - *Buffer = &StatePtr->DumpRecord; + *Buffer = &StatePtr->DumpRecord; *BufSize = sizeof(StatePtr->DumpRecord); } else { /* No data to write for this record */ *BufSize = 0; - *Buffer = NULL; + *Buffer = NULL; } /* Check for EOF (last entry) */ - return (RecordNum >= (CFE_PLATFORM_TBL_MAX_NUM_TABLES-1)); + return (RecordNum >= (CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1)); } /******************************************************************* @@ -1226,66 +1153,60 @@ bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, siz ** ********************************************************************/ -void CFE_TBL_DumpRegistryEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, size_t BlockSize, size_t Position) +void CFE_TBL_DumpRegistryEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 Status, uint32 RecordNum, + size_t BlockSize, size_t Position) { CFE_TBL_RegDumpStateInfo_t *StatePtr = (CFE_TBL_RegDumpStateInfo_t *)Meta; /* * Note that this runs in the context of ES background task (file writer background job) * It does NOT run in the context of the CFE_TBL app task. - * + * * Events should use CFE_EVS_SendEventWithAppID() rather than CFE_EVS_SendEvent() * to get proper association with TBL task. */ - switch(Event) + switch (Event) { case CFE_FS_FileWriteEvent_COMPLETE: if (StatePtr->FileExisted) { - CFE_EVS_SendEventWithAppID(CFE_TBL_OVERWRITE_REG_DUMP_INF_EID, - CFE_EVS_EventType_DEBUG, - CFE_TBL_Global.TableTaskAppId, - "Successfully overwrote '%s' with Table Registry:Size=%d,Entries=%d", - StatePtr->FileWrite.FileName, (int)Position, (int)RecordNum); + CFE_EVS_SendEventWithAppID(CFE_TBL_OVERWRITE_REG_DUMP_INF_EID, CFE_EVS_EventType_DEBUG, + CFE_TBL_Global.TableTaskAppId, + "Successfully overwrote '%s' with Table Registry:Size=%d,Entries=%d", + StatePtr->FileWrite.FileName, (int)Position, (int)RecordNum); } else { - CFE_EVS_SendEventWithAppID(CFE_TBL_WRITE_REG_DUMP_INF_EID, - CFE_EVS_EventType_DEBUG, - CFE_TBL_Global.TableTaskAppId, - "Successfully dumped Table Registry to '%s':Size=%d,Entries=%d", - StatePtr->FileWrite.FileName, (int)Position, (int)RecordNum); + CFE_EVS_SendEventWithAppID(CFE_TBL_WRITE_REG_DUMP_INF_EID, CFE_EVS_EventType_DEBUG, + CFE_TBL_Global.TableTaskAppId, + "Successfully dumped Table Registry to '%s':Size=%d,Entries=%d", + StatePtr->FileWrite.FileName, (int)Position, (int)RecordNum); } break; - + case CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR: - CFE_EVS_SendEventWithAppID(CFE_TBL_WRITE_TBL_REG_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "Error writing Registry to '%s', Status=0x%08X", - StatePtr->FileWrite.FileName, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_WRITE_TBL_REG_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_TBL_Global.TableTaskAppId, "Error writing Registry to '%s', Status=0x%08X", + StatePtr->FileWrite.FileName, (unsigned int)Status); break; case CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR: - CFE_EVS_SendEventWithAppID(CFE_TBL_WRITE_CFE_HDR_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "Error writing cFE File Header to '%s', Status=0x%08X", - StatePtr->FileWrite.FileName, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_WRITE_CFE_HDR_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_TBL_Global.TableTaskAppId, + "Error writing cFE File Header to '%s', Status=0x%08X", + StatePtr->FileWrite.FileName, (unsigned int)Status); break; case CFE_FS_FileWriteEvent_CREATE_ERROR: - CFE_EVS_SendEventWithAppID(CFE_TBL_CREATING_DUMP_FILE_ERR_EID, - CFE_EVS_EventType_ERROR, - CFE_TBL_Global.TableTaskAppId, - "Error creating dump file '%s', Status=0x%08X", - StatePtr->FileWrite.FileName, (unsigned int)Status); + CFE_EVS_SendEventWithAppID(CFE_TBL_CREATING_DUMP_FILE_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_TBL_Global.TableTaskAppId, "Error creating dump file '%s', Status=0x%08X", + StatePtr->FileWrite.FileName, (unsigned int)Status); break; - + default: /* unhandled event - ignore */ break; - } + } } /******************************************************************* @@ -1297,10 +1218,10 @@ void CFE_TBL_DumpRegistryEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ - int32 Status; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + int32 Status; const CFE_TBL_DumpRegistryCmd_Payload_t *CmdPtr = &data->Payload; - os_fstat_t FileStat; + os_fstat_t FileStat; CFE_TBL_RegDumpStateInfo_t *StatePtr; @@ -1310,11 +1231,12 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) if (!CFE_FS_BackgroundFileDumpIsPending(&StatePtr->FileWrite)) { /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ - CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->DumpFilename, CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE, - sizeof(StatePtr->FileWrite.FileName), sizeof(CmdPtr->DumpFilename)); + CFE_SB_MessageStringGet(StatePtr->FileWrite.FileName, CmdPtr->DumpFilename, + CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE, sizeof(StatePtr->FileWrite.FileName), + sizeof(CmdPtr->DumpFilename)); - /* - * Fill out the remainder of meta data. + /* + * Fill out the remainder of meta data. * This data is currently the same for every request */ StatePtr->FileWrite.FileSubType = CFE_FS_SubType_TBL_REG; @@ -1325,7 +1247,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) /* * Before submitting the background request, use OS_stat() to check if the file exists already. - * + * * This is because TBL services issued a different event ID in some cases if * it is overwriting a file vs. creating a new file. */ @@ -1344,7 +1266,6 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) } /* End of CFE_TBL_DumpRegistryCmd() */ - /******************************************************************* ** ** CFE_TBL_SendRegistryCmd() -- Process Telemeter Table Registry Entry Command Message @@ -1354,14 +1275,13 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_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; - const CFE_TBL_SendRegistryCmd_Payload_t *CmdPtr = &data->Payload; - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + int16 RegIndex; + const CFE_TBL_SendRegistryCmd_Payload_t *CmdPtr = &data->Payload; + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; /* Make sure all strings are null terminated before attempting to process them */ - CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - sizeof(TableName), sizeof(CmdPtr->TableName)); + CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table registry entry that is to be telemetered exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -1371,27 +1291,22 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data) /* Change the index used to identify what data is to be telemetered */ CFE_TBL_Global.HkTlmTblRegIndex = RegIndex; - CFE_EVS_SendEvent(CFE_TBL_TLM_REG_CMD_INF_EID, - CFE_EVS_EventType_DEBUG, - "Table Registry entry for '%s' will be telemetered", - TableName); + CFE_EVS_SendEvent(CFE_TBL_TLM_REG_CMD_INF_EID, CFE_EVS_EventType_DEBUG, + "Table Registry entry for '%s' will be telemetered", TableName); /* Increment Successful Command Counter */ ReturnCode = CFE_TBL_INC_CMD_CTR; } else /* Table could not be found in Registry */ { - CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to locate '%s' in Table Registry", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to locate '%s' in Table Registry", TableName); } return ReturnCode; } /* End of CFE_TBL_SendRegistryCmd() */ - /******************************************************************* ** ** CFE_TBL_DeleteCDSCmd() -- Process Delete Critical Table's CDS Command Message @@ -1401,17 +1316,16 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_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; - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; - CFE_TBL_CritRegRec_t *CritRegRecPtr = NULL; - uint32 i; - uint32 RegIndex; - int32 Status; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + const CFE_TBL_DelCDSCmd_Payload_t *CmdPtr = &data->Payload; + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; + CFE_TBL_CritRegRec_t * CritRegRecPtr = NULL; + uint32 i; + uint32 RegIndex; + int32 Status; /* Make sure all strings are null terminated before attempting to process them */ - CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - sizeof(TableName), sizeof(CmdPtr->TableName)); + CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table is no longer in the registry */ /* This would imply that the owning application has been terminated and that it */ @@ -1421,7 +1335,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data) if (RegIndex == CFE_TBL_NOT_FOUND) { /* Find table in the Critical Table Registry */ - for (i=0; iCDSHandle = CFE_ES_CDS_BAD_HANDLE; - + /* Increment Successful Command Counter */ ReturnCode = CFE_TBL_INC_CMD_CTR; } } else { - CFE_EVS_SendEvent(CFE_TBL_NOT_IN_CRIT_REG_ERR_EID, - CFE_EVS_EventType_ERROR, - "Table '%s' is not found in Critical Table Registry", - TableName); - } + CFE_EVS_SendEvent(CFE_TBL_NOT_IN_CRIT_REG_ERR_EID, CFE_EVS_EventType_ERROR, + "Table '%s' is not found in Critical Table Registry", TableName); + } } else /* Table was found in Registry */ { - CFE_EVS_SendEvent(CFE_TBL_IN_REGISTRY_ERR_EID, - CFE_EVS_EventType_ERROR, - "'%s' found in Table Registry. CDS cannot be deleted until table is unregistered", - TableName); + CFE_EVS_SendEvent(CFE_TBL_IN_REGISTRY_ERR_EID, CFE_EVS_EventType_ERROR, + "'%s' found in Table Registry. CDS cannot be deleted until table is unregistered", TableName); } return ReturnCode; } /* End of CFE_TBL_DeleteCDSCmd() */ - /******************************************************************* ** ** CFE_TBL_AbortLoadCmd() -- Process Abort Load Command Message @@ -1499,15 +1406,14 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_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; - const CFE_TBL_AbortLoadCmd_Payload_t *CmdPtr = &data->Payload; - CFE_TBL_RegistryRec_t *RegRecPtr; - char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; + CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + int16 RegIndex; + const CFE_TBL_AbortLoadCmd_Payload_t *CmdPtr = &data->Payload; + CFE_TBL_RegistryRec_t * RegRecPtr; + char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; /* Make sure all strings are null terminated before attempting to process them */ - CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - sizeof(TableName), sizeof(CmdPtr->TableName)); + CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table registry entry that is to be telemetered exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -1529,25 +1435,20 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data) } else { - CFE_EVS_SendEvent(CFE_TBL_LOAD_ABORT_ERR_EID, - CFE_EVS_EventType_ERROR, - "Cannot abort load of '%s'. No load started.", - TableName); + CFE_EVS_SendEvent(CFE_TBL_LOAD_ABORT_ERR_EID, CFE_EVS_EventType_ERROR, + "Cannot abort load of '%s'. No load started.", TableName); } } else /* Table could not be found in Registry */ { - CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, - CFE_EVS_EventType_ERROR, - "Unable to locate '%s' in Table Registry", - TableName); + CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, + "Unable to locate '%s' in Table Registry", TableName); } return ReturnCode; } /* End of CFE_TBL_AbortLoadCmd() */ - /******************************************************************* ** ** CFE_TBL_AbortLoad() -- Abort load, free buffers, issue event message @@ -1566,17 +1467,14 @@ void CFE_TBL_AbortLoad(CFE_TBL_RegistryRec_t *RegRecPtr) /* For double buffered tables, freeing buffer is simple */ RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - + /* Make sure the load was not already pending */ RegRecPtr->LoadPending = false; - CFE_EVS_SendEvent(CFE_TBL_LOAD_ABORT_INF_EID, - CFE_EVS_EventType_INFORMATION, - "Table Load Aborted for '%s'", + CFE_EVS_SendEvent(CFE_TBL_LOAD_ABORT_INF_EID, CFE_EVS_EventType_INFORMATION, "Table Load Aborted for '%s'", RegRecPtr->Name); } /* End of CFE_TBL_AbortLoad() */ /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.h b/modules/tbl/fsw/src/cfe_tbl_task_cmds.h index d77f435e3..df2e6a91e 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.h +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.h @@ -51,15 +51,17 @@ */ typedef enum { - CFE_TBL_INC_ERR_CTR = CFE_TBL_MESSAGE_ERROR, /**< Error detected in (or while processing) message, increment command error counter */ - CFE_TBL_DONT_INC_CTR = CFE_STATUS_NO_COUNTER_INCREMENT, /**< No errors detected but don't increment command counter */ - CFE_TBL_INC_CMD_CTR = CFE_SUCCESS /**< No errors detected and increment command counter */ + CFE_TBL_INC_ERR_CTR = + CFE_TBL_MESSAGE_ERROR, /**< Error detected in (or while processing) message, increment command error counter */ + CFE_TBL_DONT_INC_CTR = + CFE_STATUS_NO_COUNTER_INCREMENT, /**< No errors detected but don't increment command counter */ + CFE_TBL_INC_CMD_CTR = CFE_SUCCESS /**< No errors detected and increment command counter */ } CFE_TBL_CmdProcRet_t; typedef int32 (*CFE_TBL_MsgProcFuncPtr_t)(const void *MsgPtr); -#define CFE_TBL_BAD_CMD_CODE (-1) /**< Command Code found in Message does not match any in #CFE_TBL_CmdHandlerTbl */ -#define CFE_TBL_BAD_MSG_ID (-2) /**< Message ID found in Message does not match any in #CFE_TBL_CmdHandlerTbl */ +#define CFE_TBL_BAD_CMD_CODE (-1) /**< Command Code found in Message does not match any in #CFE_TBL_CmdHandlerTbl */ +#define CFE_TBL_BAD_MSG_ID (-2) /**< Message ID found in Message does not match any in #CFE_TBL_CmdHandlerTbl */ /* ** Table task const data @@ -67,7 +69,7 @@ typedef int32 (*CFE_TBL_MsgProcFuncPtr_t)(const void *MsgPtr); typedef enum { - CFE_TBL_TERM_MSGTYPE=0, /**< \brief Command Handler Table Terminator Type */ + CFE_TBL_TERM_MSGTYPE = 0, /**< \brief Command Handler Table Terminator Type */ CFE_TBL_MSG_MSGTYPE, /**< \brief Message Type (requires Message ID match) */ CFE_TBL_CMD_MSGTYPE /**< \brief Command Type (requires Message ID and Command Code match) */ } CFE_TBL_MsgType_t; @@ -75,15 +77,15 @@ typedef enum /** ** Data structure of a single record in #CFE_TBL_CmdHandlerTbl */ -typedef struct { - CFE_SB_MsgId_t MsgId; /**< \brief Acceptable Message ID */ - CFE_MSG_FcnCode_t CmdCode; /**< \brief Acceptable Command Code (if necessary) */ - size_t ExpectedLength; /**< \brief Expected Message Length (in bytes) including message header */ - CFE_TBL_MsgProcFuncPtr_t MsgProcFuncPtr; /**< \brief Pointer to function to handle message */ - CFE_TBL_MsgType_t MsgTypes; /**< \brief Message Type (i.e. - with/without Cmd Code) */ +typedef struct +{ + CFE_SB_MsgId_t MsgId; /**< \brief Acceptable Message ID */ + CFE_MSG_FcnCode_t CmdCode; /**< \brief Acceptable Command Code (if necessary) */ + size_t ExpectedLength; /**< \brief Expected Message Length (in bytes) including message header */ + CFE_TBL_MsgProcFuncPtr_t MsgProcFuncPtr; /**< \brief Pointer to function to handle message */ + CFE_TBL_MsgType_t MsgTypes; /**< \brief Message Type (i.e. - with/without Cmd Code) */ } CFE_TBL_CmdHandlerTblRec_t; - /* Command Message Processing Functions */ /*****************************************************************************/ /** @@ -96,9 +98,9 @@ typedef struct { ** \par Assumptions, External Events, and Notes: ** None ** -** +** ******************************************************************************/ -extern void CFE_TBL_GetHkData(void); +extern void CFE_TBL_GetHkData(void); /*****************************************************************************/ /** @@ -113,7 +115,7 @@ extern void CFE_TBL_GetHkData(void); ** #CFE_TBL_Global_t::HkTlmTblRegIndex is assumed to be a valid index into ** the Table Registry. ** -** +** ******************************************************************************/ extern void CFE_TBL_GetTblRegData(void); @@ -123,7 +125,7 @@ extern void CFE_TBL_GetTblRegData(void); ** ** \par Description ** Constructs a Housekeeping Packet (#CFE_TBL_HousekeepingTlm_t) from task data and sends it out -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Housekeeping Request Message ** @@ -139,7 +141,7 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data); ** ** \par Description ** Responds to the NOOP command by issuing an Event Message -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a NO OP Command Message ** @@ -156,7 +158,7 @@ int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data); ** ** \par Description ** Resets command counters and validation request counters -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Reset Counters Command Message ** @@ -173,7 +175,7 @@ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data); ** \par Description ** Locates the file specified in the command message and loads the contents of the file into ** a buffer that is associated with the table specified within the file header. -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Load Table Command Message ** @@ -191,7 +193,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data); ** \par Description ** Locates the memory associated with the table identified in the command message and copies ** the data contents to the command message specified file. -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Dump Table Command Message ** @@ -210,7 +212,7 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data); ** Computes a Data Integrity Check Value for the command message specified table and notifies ** the table's parent Application, if it has an associated validation function, that a validation ** of the buffer's contents is required. -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Validate Table Command Message ** @@ -228,7 +230,7 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data); ** \par Description ** Notifies the table's owner Application that a new version of the table is pending and should ** be used. -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as an Activate Table Command Message ** @@ -245,7 +247,7 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data); ** ** \par Description ** Copies the contents of the Table Registry to a command message specified file. -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Dump Table Registry Command Message ** @@ -263,7 +265,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data); ** \par Description ** Extracts the Table Registry information for a command message specified table and puts it into ** a message that is sent out. -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Telemeter Table Registry Entry Command Message ** @@ -280,7 +282,7 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data); ** ** \par Description ** Deletes a Critical Data Store used to hold a Critical Table's image -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as a Delete CDS Command Message ** @@ -297,7 +299,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data); ** ** \par Description ** Frees any resources associated with a previously loaded table. -** +** ** \par Assumptions, External Events, and Notes: ** The message pointed to by data has been identified as an Abort Load Command Message ** @@ -308,7 +310,6 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data); ******************************************************************************/ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data); - /*****************************************************************************/ /** ** \brief Output block of data to file with standard cFE Table Image Headers @@ -333,8 +334,8 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_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 ******************************************************************************/ -extern CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *TableName, - const void *DumpDataAddr, size_t TblSizeInBytes); +extern CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *TableName, + const void *DumpDataAddr, size_t TblSizeInBytes); /*****************************************************************************/ /** @@ -353,6 +354,4 @@ extern CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const ******************************************************************************/ void CFE_TBL_AbortLoad(CFE_TBL_RegistryRec_t *RegRecPtr); - - -#endif /* _cfe_tbl_task_cmds_ */ +#endif /* _cfe_tbl_task_cmds_ */ diff --git a/modules/tbl/fsw/src/cfe_tbl_verify.h b/modules/tbl/fsw/src/cfe_tbl_verify.h index b4599cb38..5cf91134d 100644 --- a/modules/tbl/fsw/src/cfe_tbl_verify.h +++ b/modules/tbl/fsw/src/cfe_tbl_verify.h @@ -33,20 +33,21 @@ #define _cfe_tbl_verify_ #include "cfe_platform_cfg.h" -#if (2*CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE) > CFE_PLATFORM_TBL_BUF_MEMORY_BYTES - #error Two buffers of size CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE cannot be greater than memory pool size of CFE_PLATFORM_TBL_BUF_MEMORY_BYTES! +#if (2 * CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE) > CFE_PLATFORM_TBL_BUF_MEMORY_BYTES +#error Two buffers of size CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE cannot be greater than memory pool size of CFE_PLATFORM_TBL_BUF_MEMORY_BYTES! #endif -#if ((CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS+1)*CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE) > CFE_PLATFORM_TBL_BUF_MEMORY_BYTES - #error Shared buffers and table of size CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE cannot be greater than memory pool size of CFE_PLATFORM_TBL_BUF_MEMORY_BYTES! +#if ((CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS + 1) * CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE) > \ + CFE_PLATFORM_TBL_BUF_MEMORY_BYTES +#error Shared buffers and table of size CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE cannot be greater than memory pool size of CFE_PLATFORM_TBL_BUF_MEMORY_BYTES! #endif #if CFE_PLATFORM_TBL_MAX_NUM_HANDLES < CFE_PLATFORM_TBL_MAX_NUM_TABLES - #error CFE_PLATFORM_TBL_MAX_NUM_HANDLES cannot be set less than CFE_PLATFORM_TBL_MAX_NUM_TABLES! +#error CFE_PLATFORM_TBL_MAX_NUM_HANDLES cannot be set less than CFE_PLATFORM_TBL_MAX_NUM_TABLES! #endif #if CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES > CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES - #error CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES cannot be greater than CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES! +#error CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES cannot be greater than CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES! #endif /* @@ -54,30 +55,30 @@ ** source code changes made to the function CFE_TBL_ReadHeaders() in ** the file "cfe_tbl_internal.c". */ -#if CFE_PLATFORM_TBL_VALID_SCID_COUNT < 0 - #error CFE_PLATFORM_TBL_VALID_SCID_COUNT must be greater than or equal to zero -#elif CFE_PLATFORM_TBL_VALID_SCID_COUNT > 2 - #error CFE_PLATFORM_TBL_VALID_SCID_COUNT must be less than or equal to 2 -#endif +#if CFE_PLATFORM_TBL_VALID_SCID_COUNT < 0 +#error CFE_PLATFORM_TBL_VALID_SCID_COUNT must be greater than or equal to zero +#elif CFE_PLATFORM_TBL_VALID_SCID_COUNT > 2 +#error CFE_PLATFORM_TBL_VALID_SCID_COUNT must be less than or equal to 2 +#endif -#if CFE_PLATFORM_TBL_VALID_PRID_COUNT < 0 - #error CFE_PLATFORM_TBL_VALID_PRID_COUNT must be greater than or equal to zero -#elif CFE_PLATFORM_TBL_VALID_PRID_COUNT > 4 - #error CFE_PLATFORM_TBL_VALID_PRID_COUNT must be less than or equal to 4 +#if CFE_PLATFORM_TBL_VALID_PRID_COUNT < 0 +#error CFE_PLATFORM_TBL_VALID_PRID_COUNT must be greater than or equal to zero +#elif CFE_PLATFORM_TBL_VALID_PRID_COUNT > 4 +#error CFE_PLATFORM_TBL_VALID_PRID_COUNT must be less than or equal to 4 #endif /* ** Validate task stack size... */ #if CFE_PLATFORM_TBL_START_TASK_STACK_SIZE < 2048 - #error CFE_PLATFORM_TBL_START_TASK_STACK_SIZE must be greater than or equal to 2048 +#error CFE_PLATFORM_TBL_START_TASK_STACK_SIZE must be greater than or equal to 2048 #endif /* the following check is removed because some compilers cannot handle the sizeof operator in a #if statement */ /* #if sizeof(CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE) > OS_MAX_PATH_LEN - #error The length (including NULL terminator) of CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE cannot be greater than OS_MAX_PATH_LEN -#endif + #error The length (including NULL terminator) of CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE cannot be greater than +OS_MAX_PATH_LEN #endif */ /* @@ -85,10 +86,10 @@ * as noted in the documentation, this confirms that they are. */ #if ((CFE_MISSION_TBL_MAX_NAME_LENGTH % 4) != 0) - #error CFE_MISSION_TBL_MAX_NAME_LENGTH must be a multiple of 4 +#error CFE_MISSION_TBL_MAX_NAME_LENGTH must be a multiple of 4 #endif #if ((CFE_MISSION_TBL_MAX_FULL_NAME_LEN % 4) != 0) - #error CFE_MISSION_TBL_MAX_FULL_NAME_LEN must be a multiple of 4 +#error CFE_MISSION_TBL_MAX_FULL_NAME_LEN must be a multiple of 4 #endif #endif /* _cfe_tbl_verify_ */ diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index 2344b08d5..3d788f8a0 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -56,37 +56,22 @@ CFE_TBL_Handle_t App2TblHandle1; CFE_TBL_Handle_t App2TblHandle2; CFE_TBL_Handle_t ArrayOfHandles[2]; -#define UT_TBL_APPID_1 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 1)) -#define UT_TBL_APPID_2 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 2)) -#define UT_TBL_APPID_3 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 3)) -#define UT_TBL_APPID_10 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 10)) +#define UT_TBL_APPID_1 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 1)) +#define UT_TBL_APPID_2 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 2)) +#define UT_TBL_APPID_3 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 3)) +#define UT_TBL_APPID_10 CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_ES_APPID_BASE + 10)) -void *Tbl1Ptr = NULL; -void *Tbl2Ptr = NULL; +void * Tbl1Ptr = NULL; +void * Tbl2Ptr = NULL; void **ArrayOfPtrsToTblPtrs[2]; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_NOOP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), - .CommandCode = CFE_TBL_NOOP_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_RESET_COUNTERS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), - .CommandCode = CFE_TBL_RESET_COUNTERS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_INVALID_MID = -{ - .MsgId = CFE_SB_MSGID_RESERVED, - .CommandCode = 0 -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_INVALID_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), - .CommandCode = 0x7F -}; - - +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_NOOP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), + .CommandCode = CFE_TBL_NOOP_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_RESET_COUNTERS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), .CommandCode = CFE_TBL_RESET_COUNTERS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_INVALID_MID = {.MsgId = CFE_SB_MSGID_RESERVED, .CommandCode = 0}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_INVALID_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), .CommandCode = 0x7F}; CFE_TBL_RegistryRec_t Original[CFE_PLATFORM_TBL_MAX_NUM_TABLES]; @@ -95,7 +80,7 @@ CFE_TBL_RegistryRec_t Original[CFE_PLATFORM_TBL_MAX_NUM_TABLES]; */ void UT_TBL_SetupHeader(CFE_TBL_File_Hdr_t *TblFileHeader, size_t Offset, size_t NumBytes) { - TblFileHeader->Offset = CFE_ES_MEMOFFSET_C(Offset); + TblFileHeader->Offset = CFE_ES_MEMOFFSET_C(Offset); TblFileHeader->NumBytes = CFE_ES_MEMOFFSET_C(NumBytes); if (UT_Endianess == UT_LITTLE_ENDIAN) @@ -168,8 +153,7 @@ void UT_InitializeTableRegistryNames() for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) { - snprintf(CFE_TBL_Global.Registry[i].Name, - CFE_TBL_MAX_FULL_NAME_LEN, "%d", i); + snprintf(CFE_TBL_Global.Registry[i].Name, CFE_TBL_MAX_FULL_NAME_LEN, "%d", i); CFE_TBL_Global.Registry[i].OwnerAppId = UT_TBL_APPID_2; } } @@ -189,22 +173,22 @@ void UT_ResetTableRegistry(void) /* Initialize the table access descriptors */ for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_HANDLES; i++) { - CFE_TBL_Global.Handles[i].AppId = CFE_TBL_NOT_OWNED; - CFE_TBL_Global.Handles[i].RegIndex = 0; - CFE_TBL_Global.Handles[i].PrevLink = CFE_TBL_END_OF_LIST; - CFE_TBL_Global.Handles[i].NextLink = CFE_TBL_END_OF_LIST; - CFE_TBL_Global.Handles[i].UsedFlag = false; - CFE_TBL_Global.Handles[i].LockFlag = false; - CFE_TBL_Global.Handles[i].Updated = false; + CFE_TBL_Global.Handles[i].AppId = CFE_TBL_NOT_OWNED; + CFE_TBL_Global.Handles[i].RegIndex = 0; + CFE_TBL_Global.Handles[i].PrevLink = CFE_TBL_END_OF_LIST; + CFE_TBL_Global.Handles[i].NextLink = CFE_TBL_END_OF_LIST; + CFE_TBL_Global.Handles[i].UsedFlag = false; + CFE_TBL_Global.Handles[i].LockFlag = false; + CFE_TBL_Global.Handles[i].Updated = false; CFE_TBL_Global.Handles[i].BufferIndex = 0; } /* Initialize the table validation results records */ for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS; i++) { - CFE_TBL_Global.ValidationResults[i].State = CFE_TBL_VALIDATION_FREE; - CFE_TBL_Global.ValidationResults[i].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[i].Result = 0; + CFE_TBL_Global.ValidationResults[i].State = CFE_TBL_VALIDATION_FREE; + CFE_TBL_Global.ValidationResults[i].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[i].Result = 0; CFE_TBL_Global.ValidationResults[i].ActiveBuffer = false; CFE_TBL_Global.ValidationResults[i].TableName[0] = '\0'; } @@ -212,18 +196,18 @@ void UT_ResetTableRegistry(void) /* Initialize the dump-only table dump control blocks */ for (i = 0; i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; i++) { - CFE_TBL_Global.DumpControlBlocks[i].State = CFE_TBL_DUMP_FREE; + CFE_TBL_Global.DumpControlBlocks[i].State = CFE_TBL_DUMP_FREE; CFE_TBL_Global.DumpControlBlocks[i].DumpBufferPtr = NULL; - CFE_TBL_Global.DumpControlBlocks[i].Size = 0; - CFE_TBL_Global.DumpControlBlocks[i].TableName[0] = '\0'; + CFE_TBL_Global.DumpControlBlocks[i].Size = 0; + CFE_TBL_Global.DumpControlBlocks[i].TableName[0] = '\0'; /* Free all shared buffers */ CFE_TBL_Global.LoadBuffs[i].Taken = false; } CFE_TBL_Global.ValidationCounter = 0; - CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; - CFE_TBL_Global.LastTblUpdated = CFE_TBL_NOT_FOUND; + CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; + CFE_TBL_Global.LastTblUpdated = CFE_TBL_NOT_FOUND; } /* @@ -237,7 +221,7 @@ void Test_CFE_TBL_TaskInit(void) CFE_TBL_NoArgsCmd_t NoArgsCmd; CFE_MSG_Message_t Msg; } CmdBuf; - CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t FcnCode = 0; UtPrintf("Begin Test Task Init"); @@ -252,10 +236,8 @@ void Test_CFE_TBL_TaskInit(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); CFE_TBL_TaskMain(); UT_Report(__FILE__, __LINE__, - ExitCode == CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR && - UT_GetStubCount(UT_KEY(CFE_ES_ExitApp)) == 1, - "CFE_TBL_TaskMain", - "Success"); + ExitCode == CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR && UT_GetStubCount(UT_KEY(CFE_ES_ExitApp)) == 1, + "CFE_TBL_TaskMain", "Success"); /* Test table services main entry point execution with a register * application failure @@ -266,123 +248,87 @@ void Test_CFE_TBL_TaskInit(void) UT_SetDataBuffer(UT_KEY(CFE_ES_ExitApp), &ExitCode, sizeof(ExitCode), false); CFE_TBL_TaskMain(); UT_Report(__FILE__, __LINE__, - ExitCode == CFE_ES_RunStatus_CORE_APP_INIT_ERROR && - UT_GetStubCount(UT_KEY(CFE_ES_ExitApp)) == 2, - "CFE_TBL_TaskMain", - "Application register fail"); + ExitCode == CFE_ES_RunStatus_CORE_APP_INIT_ERROR && UT_GetStubCount(UT_KEY(CFE_ES_ExitApp)) == 2, + "CFE_TBL_TaskMain", "Application register fail"); /* Test successful table services core application initialization */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_TaskInit() == CFE_SUCCESS, - "CFE_TBL_TaskInit", - "Success"); + UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == CFE_SUCCESS, "CFE_TBL_TaskInit", "Success"); /* Test table services core application initialization response to a pipe * creation failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -2); - UT_Report(__FILE__, __LINE__, - CFE_TBL_TaskInit() == -2, - "CFE_TBL_TaskInit", - "Create pipe fail"); + UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -2, "CFE_TBL_TaskInit", "Create pipe fail"); /* Test table services core application initialization response to a * housekeeping request subscription error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -3); - UT_Report(__FILE__, __LINE__, - CFE_TBL_TaskInit() == -3, - "CFE_TBL_TaskInit", - "Housekeeping request subscribe fail"); + UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -3, "CFE_TBL_TaskInit", "Housekeeping request subscribe fail"); /* Test table services core application initialization response to a * ground command subscription error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -4); - UT_Report(__FILE__, __LINE__, - CFE_TBL_TaskInit() == -4, - "CFE_TBL_TaskInit", - "Ground command subscribe fail"); + UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -4, "CFE_TBL_TaskInit", "Ground command subscribe fail"); /* Test table services core application initialization response to a * send initialization event error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -5); - UT_Report(__FILE__, __LINE__, - CFE_TBL_TaskInit() == -5, - "CFE_TBL_TaskInit", - "Send initialization event fail"); + UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -5, "CFE_TBL_TaskInit", "Send initialization event fail"); /* Test table services core application initialization response to an * EVS register failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -6); - UT_Report(__FILE__, __LINE__, - CFE_TBL_TaskInit() == -6, - "CFE_TBL_TaskInit", - "EVS register fail"); + UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -6, "CFE_TBL_TaskInit", "EVS register fail"); /* Test command pipe messages handler response to a valid command */ UT_InitData(); - UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_TBL_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_NOOP_INF_EID), - "CFE_TBL_TaskPipe", + UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_CMD_NOOP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_NOOP_INF_EID), "CFE_TBL_TaskPipe", "Valid command (no-op) - success"); /* Test command pipe messages handler response to an invalid * message length */ UT_InitData(); - UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd) - 1, - UT_TPID_CFE_TBL_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_LEN_ERR_EID), - "CFE_TBL_TaskPipe", + UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd) - 1, UT_TPID_CFE_TBL_CMD_NOOP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_LEN_ERR_EID), "CFE_TBL_TaskPipe", "Invalid message length"); /* Test command pipe messages handler response to an invalid * command code */ UT_InitData(); - UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_TBL_CMD_INVALID_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_CC1_ERR_EID), - "CFE_TBL_TaskPipe", - "Invalid command code"); + UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_CMD_INVALID_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_CC1_ERR_EID), "CFE_TBL_TaskPipe", "Invalid command code"); /* Test command pipe messages handler response to other errors */ /* Test command pipe messages handler response to "message type" message */ UT_InitData(); - CFE_TBL_Global.CommandCounter = 0; + CFE_TBL_Global.CommandCounter = 0; CFE_TBL_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_TBL_INVALID_MID); + UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_INVALID_MID); UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_MID_ERR_EID) && - CFE_TBL_Global.CommandCounter == 0 && + UT_EventIsInHistory(CFE_TBL_MID_ERR_EID) && CFE_TBL_Global.CommandCounter == 0 && CFE_TBL_Global.CommandErrorCounter == 0, - "CFE_TBL_TaskPipe", - "'Message' type message"); + "CFE_TBL_TaskPipe", "'Message' type message"); /* Test command pipe messages handler response to "command type" message */ UT_InitData(); - UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), - UT_TPID_CFE_TBL_CMD_RESET_COUNTERS_CC); + UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_CMD_RESET_COUNTERS_CC); UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_RESET_INF_EID) && - CFE_TBL_Global.CommandCounter == 0 && + UT_EventIsInHistory(CFE_TBL_RESET_INF_EID) && CFE_TBL_Global.CommandCounter == 0 && CFE_TBL_Global.CommandErrorCounter == 0, - "CFE_TBL_TaskPipe", - "'Command' type message"); + "CFE_TBL_TaskPipe", "'Command' type message"); } /* @@ -411,11 +357,9 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) /* Test successfully finding a matching message ID and command code */ UT_InitData(); - MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); CmdCode = CFE_TBL_NOOP_CC; - UT_Report(__FILE__, __LINE__, - CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, - "CFE_TBL_SearchCmdHndlrTbl", + UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", "Found matching message ID and command code"); /* Test using a message that is not a command message with specific @@ -423,10 +367,8 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) */ UT_InitData(); TblIndex = 0; - MsgID = CFE_SB_ValueToMsgId(CFE_TBL_SEND_HK_MID); - UT_Report(__FILE__, __LINE__, - CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, - "CFE_TBL_SearchCmdHndlrTbl", + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_SEND_HK_MID); + UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", "Message is not a command message with specific command code"); /* Test with a message ID that matches but the command code does @@ -434,20 +376,16 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) */ UT_InitData(); TblIndex = CFE_TBL_BAD_CMD_CODE; - MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); - CmdCode = 0xffff; - UT_Report(__FILE__, __LINE__, - CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, - "CFE_TBL_SearchCmdHndlrTbl", + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); + CmdCode = 0xffff; + UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", "Message ID matches, command code must does not match"); /* Test with a message ID that does not match */ UT_InitData(); TblIndex = CFE_TBL_BAD_MSG_ID; - MsgID = CFE_SB_INVALID_MSG_ID; - UT_Report(__FILE__, __LINE__, - CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, - "CFE_TBL_SearchCmdHndlrTbl", + MsgID = CFE_SB_INVALID_MSG_ID; + UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", "Message ID does not match"); } @@ -463,13 +401,9 @@ void Test_CFE_TBL_DeleteCDSCmd(void) /* Test successfully finding the table name in the table registry */ UT_InitData(); - strncpy(DelCDSCmd.Payload.TableName, "0", - sizeof(DelCDSCmd.Payload.TableName) - 1); + strncpy(DelCDSCmd.Payload.TableName, "0", sizeof(DelCDSCmd.Payload.TableName) - 1); DelCDSCmd.Payload.TableName[sizeof(DelCDSCmd.Payload.TableName) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DeleteCDSCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", "Table name found in table registry"); /* Test failure to find table in the critical table registry */ @@ -478,17 +412,12 @@ void Test_CFE_TBL_DeleteCDSCmd(void) for (j = CFE_PLATFORM_TBL_MAX_NUM_TABLES; j < k; j++) { - snprintf(CFE_TBL_Global.CritReg[j - CFE_PLATFORM_TBL_MAX_NUM_TABLES].Name, - CFE_TBL_MAX_FULL_NAME_LEN, "%d", j); + snprintf(CFE_TBL_Global.CritReg[j - CFE_PLATFORM_TBL_MAX_NUM_TABLES].Name, CFE_TBL_MAX_FULL_NAME_LEN, "%d", j); } - strncpy(DelCDSCmd.Payload.TableName, "-1", - sizeof(DelCDSCmd.Payload.TableName) - 1); + strncpy(DelCDSCmd.Payload.TableName, "-1", sizeof(DelCDSCmd.Payload.TableName) - 1); DelCDSCmd.Payload.TableName[sizeof(DelCDSCmd.Payload.TableName) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DeleteCDSCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", "Table not found in critical table registry"); /* Test finding the table in the critical table registry, but CDS is not @@ -498,47 +427,32 @@ void Test_CFE_TBL_DeleteCDSCmd(void) snprintf(DelCDSCmd.Payload.TableName, sizeof(DelCDSCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES + CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_CDS_WRONG_TYPE_ERR); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DeleteCDSCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", "Table is in critical table registry but CDS is not tagged " - "as a table"); + "as a table"); /* Test deletion when CDS owning application is still active */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_CDS_OWNER_ACTIVE_ERR); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DeleteCDSCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", "CDS owning application is still active"); /* Test deletion where the table cannot be located in the CDS registry */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_ERR_NAME_NOT_FOUND); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DeleteCDSCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", "Unable to locate table in CDS registry"); /* Test deletion error while deleting table from the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_SUCCESS - 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DeleteCDSCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", "Error while deleting table from CDS"); /* Test successful removal of the table from the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_SUCCESS); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DeleteCDSCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_DeleteCDSCmd", "Successfully removed table from CDS"); } @@ -557,24 +471,17 @@ void Test_CFE_TBL_TlmRegCmd(void) /* Registry[0].Name used because it is confirmed to be a registered * table name */ - strncpy(TlmRegCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TlmRegCmd.Payload.TableName) - 1); + strncpy(TlmRegCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TlmRegCmd.Payload.TableName) - 1); TlmRegCmd.Payload.TableName[sizeof(TlmRegCmd.Payload.TableName) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_TBL_SendRegistryCmd(&TlmRegCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_SendRegistryCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_SendRegistryCmd(&TlmRegCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_SendRegistryCmd", "Table registry entry for telemetry does exist"); /* Test when table name does not exist */ UT_InitData(); - snprintf(TlmRegCmd.Payload.TableName, sizeof(TlmRegCmd.Payload.TableName), - "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_SendRegistryCmd(&TlmRegCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_SendRegistryCmd", + snprintf(TlmRegCmd.Payload.TableName, sizeof(TlmRegCmd.Payload.TableName), "%d", + CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); + UT_Report(__FILE__, __LINE__, CFE_TBL_SendRegistryCmd(&TlmRegCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_SendRegistryCmd", "Table registry entry for telemetry doesn't exist"); } @@ -583,7 +490,7 @@ void Test_CFE_TBL_TlmRegCmd(void) */ void Test_CFE_TBL_AbortLoadCmd(void) { - int load = (int) CFE_TBL_Global.Registry[0].LoadInProgress; + int load = (int)CFE_TBL_Global.Registry[0].LoadInProgress; CFE_TBL_AbortLoadCmd_t AbortLdCmd; UtPrintf("Begin Test Abort Load Command"); @@ -594,23 +501,16 @@ void Test_CFE_TBL_AbortLoadCmd(void) /* Entering the if statement with a table name that has to be in * the registry */ - strncpy(AbortLdCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(AbortLdCmd.Payload.TableName) - 1); + strncpy(AbortLdCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(AbortLdCmd.Payload.TableName) - 1); AbortLdCmd.Payload.TableName[sizeof(AbortLdCmd.Payload.TableName) - 1] = '\0'; - CFE_TBL_Global.Registry[0].LoadInProgress = 1; - UT_Report(__FILE__, __LINE__, - CFE_TBL_AbortLoadCmd(&AbortLdCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_AbortLoadCmd", + CFE_TBL_Global.Registry[0].LoadInProgress = 1; + UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_AbortLoadCmd", "Table registry entry exists & load in progress"); /* Test when table name does exist but no table load is in progress */ UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, - CFE_TBL_AbortLoadCmd(&AbortLdCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_AbortLoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_AbortLoadCmd", "Table registry entry exists but no load in progress"); /* Test when table name does exist, a table load is in progress, and the @@ -618,36 +518,28 @@ void Test_CFE_TBL_AbortLoadCmd(void) */ UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - CFE_TBL_Global.Registry[0].DumpOnly = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_AbortLoadCmd(&AbortLdCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_AbortLoadCmd", + CFE_TBL_Global.Registry[0].DumpOnly = true; + UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_AbortLoadCmd", "Table registry entry exists, load in progress, dump only"); /* Test when table name not found in the registry */ UT_InitData(); - snprintf(AbortLdCmd.Payload.TableName, sizeof(AbortLdCmd.Payload.TableName), - "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_AbortLoadCmd(&AbortLdCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_AbortLoadCmd", + snprintf(AbortLdCmd.Payload.TableName, sizeof(AbortLdCmd.Payload.TableName), "%d", + CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); + UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_AbortLoadCmd", "Table registry entry doesn't exist"); /* Test when table is double buffered */ UT_InitData(); CFE_TBL_Global.Registry[0].DoubleBuffered = true; - CFE_TBL_Global.LoadBuffs[0].Taken = true; + CFE_TBL_Global.LoadBuffs[0].Taken = true; CFE_TBL_AbortLoad(&CFE_TBL_Global.Registry[0]); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.LoadBuffs[0].Taken == true, - "CFE_TBL_AbortLoad", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.LoadBuffs[0].Taken == true, "CFE_TBL_AbortLoad", "Table is double buffered"); /* Restore values for subsequent tests */ CFE_TBL_Global.Registry[0].LoadInProgress = load; - CFE_TBL_Global.LoadBuffs[0].Taken = false; + CFE_TBL_Global.LoadBuffs[0].Taken = false; } /* @@ -655,15 +547,14 @@ void Test_CFE_TBL_AbortLoadCmd(void) */ void Test_CFE_TBL_ActivateCmd(void) { - int load = (int) CFE_TBL_Global.Registry[0].LoadInProgress; + int load = (int)CFE_TBL_Global.Registry[0].LoadInProgress; uint8 dump = CFE_TBL_Global.Registry[0].DumpOnly; CFE_TBL_ActivateCmd_t ActivateCmd; UtPrintf("Begin Test Activate Command"); /* Enter the if statement with a table name that is in the registry */ - strncpy(ActivateCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(ActivateCmd.Payload.TableName) - 1); + strncpy(ActivateCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(ActivateCmd.Payload.TableName) - 1); ActivateCmd.Payload.TableName[sizeof(ActivateCmd.Payload.TableName) - 1] = '\0'; /* Test when table name exists, but attempts to activate a dump-only @@ -671,79 +562,61 @@ void Test_CFE_TBL_ActivateCmd(void) */ UT_InitData(); CFE_TBL_Global.Registry[0].DumpOnly = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ActivateCmd(&ActivateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ActivateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", "Table registry exists, but dump-only table attempted to load"); /* Test when table name exists, the table is not a dump-only, a load is in * progress, and the table is double-buffered */ UT_InitData(); - CFE_TBL_Global.Registry[0].DumpOnly = false; + CFE_TBL_Global.Registry[0].DumpOnly = false; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.Registry[0].DoubleBuffered = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ActivateCmd(&ActivateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ActivateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", "Table registry exists, not a dump-only tbl, and a load in " - "progress: Table is double-buffered"); + "progress: Table is double-buffered"); /* Test when table name exists, the table is not a dump-only, a load is in * progress, the table isn't double-buffered, and ValidationStatus = true */ UT_InitData(); - CFE_TBL_Global.Registry[0].DoubleBuffered = false; + CFE_TBL_Global.Registry[0].DoubleBuffered = false; CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].Validated = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ActivateCmd(&ActivateCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_ActivateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ActivateCmd", "Table registry exists, not a dump-only tbl, and a load in " - "progress: Table isn't double-buffered"); + "progress: Table isn't double-buffered"); /* Test when table name exists, the table is not a dump-only, no load is in * progress, and no notification message should be sent */ UT_InitData(); - CFE_TBL_Global.Registry[0].NotifyByMsg = false; + CFE_TBL_Global.Registry[0].NotifyByMsg = false; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ActivateCmd(&ActivateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ActivateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", "Table registry exists, not a dump-only tbl, no load in " - "progress, no notification message"); + "progress, no notification message"); /* Test when table name exists, the table is not a dump-only, no load in in * progress, and a notification message should be sent */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); - CFE_TBL_Global.Registry[0].NotifyByMsg = true; + CFE_TBL_Global.Registry[0].NotifyByMsg = true; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ActivateCmd(&ActivateCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_ActivateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ActivateCmd", "Table registry exists, not a dump-only tbl, no load in " - "progress, send notification message"); + "progress, send notification message"); /* Test when the table name doesn't exist */ UT_InitData(); - snprintf(ActivateCmd.Payload.TableName, sizeof(ActivateCmd.Payload.TableName), - "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_ActivateCmd(&ActivateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ActivateCmd", + snprintf(ActivateCmd.Payload.TableName, sizeof(ActivateCmd.Payload.TableName), "%d", + CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); + UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", "Table registry entry doesn't exist"); /* Restore original values */ CFE_TBL_Global.Registry[0].LoadInProgress = load; - CFE_TBL_Global.Registry[0].DumpOnly = dump; + CFE_TBL_Global.Registry[0].DumpOnly = dump; } /* @@ -759,19 +632,15 @@ void Test_CFE_TBL_DumpToFile(void) UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename" ,"tablename" ,"dumpaddress", - TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", - "Error creating dump file"); + CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, + "CFE_TBL_DumpToFile", "Error creating dump file"); /* Test with an error writing the cFE file header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) - 1); UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename" ,"tablename" ,"dumpaddress", - TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", - "Error writing cFE file header"); + CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, + "CFE_TBL_DumpToFile", "Error writing cFE file header"); /* Test with an error writing the table file header */ UT_InitData(); @@ -782,36 +651,28 @@ void Test_CFE_TBL_DumpToFile(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 6, sizeof(CFE_FS_Header_t)); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, sizeof(CFE_TBL_File_Hdr_t) - 1); UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename" ,"tablename" ,"dumpaddress", - TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", - "Error writing cFE file header"); + CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, + "CFE_TBL_DumpToFile", "Error writing cFE file header"); /* Test with an error writing the table to a file */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_write), 2, TblSizeInBytes - 1); UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename" ,"tablename" ,"dumpaddress", - TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", - "Error writing cFE file header"); + CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, + "CFE_TBL_DumpToFile", "Error writing cFE file header"); /* Test successful file creation and data dumped */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename" ,"tablename" ,"dumpaddress", - TblSizeInBytes) == CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DumpToFile", - "File created and data dumped"); + CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_CMD_CTR, + "CFE_TBL_DumpToFile", "File created and data dumped"); /* Test where file already exists so data isoverwritten */ UT_InitData(); UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename" ,"tablename" ,"dumpaddress", - TblSizeInBytes) == CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DumpToFile", - "File existed previously => data overwritten"); + CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_CMD_CTR, + "CFE_TBL_DumpToFile", "File existed previously => data overwritten"); } /* @@ -823,9 +684,7 @@ void Test_CFE_TBL_ResetCmd(void) /* Test run through function (there are no additional paths) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_ResetCountersCmd(NULL) == CFE_TBL_DONT_INC_CTR, - "CFE_TBL_ResetCountersCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ResetCountersCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_ResetCountersCmd", "Function run and completed"); } @@ -836,108 +695,83 @@ void Test_CFE_TBL_ValidateCmd(void) { int i; uint8 Buff; - uint8 *BuffPtr = &Buff; + uint8 * BuffPtr = &Buff; CFE_TBL_ValidateCmd_t ValidateCmd; - CFE_TBL_CallbackFuncPtr_t ValFuncPtr = (CFE_TBL_CallbackFuncPtr_t) - ((unsigned long ) - &UT_InitializeTableRegistryNames); + CFE_TBL_CallbackFuncPtr_t ValFuncPtr = (CFE_TBL_CallbackFuncPtr_t)((unsigned long)&UT_InitializeTableRegistryNames); UtPrintf("Begin Test Validate Command"); /* Test when table name is not found in the registry */ UT_InitData(); - snprintf(ValidateCmd.Payload.TableName, sizeof(ValidateCmd.Payload.TableName), - "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ValidateCmd", + snprintf(ValidateCmd.Payload.TableName, sizeof(ValidateCmd.Payload.TableName), "%d", + CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", "Table registry entry doesn't exist"); /* Test where the active buffer has data, but too many table validations * have been requested */ UT_InitData(); - strncpy(ValidateCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(ValidateCmd.Payload.TableName) - 1); + strncpy(ValidateCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(ValidateCmd.Payload.TableName) - 1); ValidateCmd.Payload.TableName[sizeof(ValidateCmd.Payload.TableName) - 1] = '\0'; - ValidateCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE; - CFE_TBL_Global.Registry[0]. - Buffers[CFE_TBL_Global.Registry[0].ActiveBufferIndex]. - BufferPtr = BuffPtr; + ValidateCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE; + CFE_TBL_Global.Registry[0].Buffers[CFE_TBL_Global.Registry[0].ActiveBufferIndex].BufferPtr = BuffPtr; for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS; i++) { - CFE_TBL_Global.ValidationResults[i].State = - CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[i].State = CFE_TBL_VALIDATION_PENDING; } - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ValidateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", "Active buffer with data: too many table validations have " - "been requested"); + "been requested"); /* Test where the active buffer has data, but there is no validation * function pointer */ UT_InitData(); - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = NULL; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_ValidateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", "Active buffer with data: No validation function pointer"); /* Test where the active buffer has data, the validation function pointer * exists, and the active table flag is set */ UT_InitData(); - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = ValFuncPtr; - ValidateCmd.Payload.ActiveTableFlag = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_ValidateCmd", + ValidateCmd.Payload.ActiveTableFlag = true; + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", "Active buffer with data: validation function pointer and " - "active table flag"); + "active table flag"); /* Test with the buffer inactive, the table is double-buffered, and the * validation function pointer exists */ UT_InitData(); - ValidateCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_INACTIVE; + ValidateCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_INACTIVE; CFE_TBL_Global.Registry[0].DoubleBuffered = true; CFE_TBL_Global.Registry[0].Buffers[1 - CFE_TBL_Global.Registry[0].ActiveBufferIndex].BufferPtr = BuffPtr; - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = ValFuncPtr; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_ValidateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", "Inactive buffer: double buffered table : validation " - "function pointer"); + "function pointer"); /* Test with the buffer inactive, the table is single-buffered with a * load in progress, the validation function pointer exists, and no * notification message should be sent */ UT_InitData(); - CFE_TBL_Global.Registry[0].NotifyByMsg = false; - CFE_TBL_Global.Registry[0].DoubleBuffered = false; + CFE_TBL_Global.Registry[0].NotifyByMsg = false; + CFE_TBL_Global.Registry[0].DoubleBuffered = false; CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = BuffPtr; - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; - CFE_TBL_Global.Registry[0].LoadInProgress = - CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_ValidateCmd", + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; + CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", "Inactive buffer: single buffered table with load in progress: " - "validation function pointer, no notification message"); + "validation function pointer, no notification message"); /* Test with the buffer inactive, the table is single-buffered with a * load in progress, the validation function pointer exists, and a @@ -945,37 +779,27 @@ void Test_CFE_TBL_ValidateCmd(void) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); - CFE_TBL_Global.Registry[0].NotifyByMsg = true; - CFE_TBL_Global.Registry[0].DoubleBuffered = false; + CFE_TBL_Global.Registry[0].NotifyByMsg = true; + CFE_TBL_Global.Registry[0].DoubleBuffered = false; CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = BuffPtr; - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; - CFE_TBL_Global.Registry[0].LoadInProgress = - CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_ValidateCmd", + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; + CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", "Inactive buffer: single buffered table with load in progress: " - "validation function pointer, send notification message"); + "validation function pointer, send notification message"); /* Test where no inactive buffer is present (single-buffered table without * load in progress) */ UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ValidateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", "Inactive buffer: single buffered table with load in progress"); /* Test with an illegal buffer */ UT_InitData(); ValidateCmd.Payload.ActiveTableFlag = 0xffff; - UT_Report(__FILE__, __LINE__, - CFE_TBL_ValidateCmd(&ValidateCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_ValidateCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", "Illegal buffer"); } @@ -989,9 +813,7 @@ void Test_CFE_TBL_NoopCmd(void) /* Test run through function (there are no additional paths) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_NoopCmd(NULL) == CFE_TBL_INC_CMD_CTR, - "CFE_TBL_NoopCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_NoopCmd(NULL) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_NoopCmd", "Function run and completed"); } @@ -1005,37 +827,27 @@ void Test_CFE_TBL_GetTblRegData(void) /* Test using a double buffered table */ UT_InitData(); - CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); + CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].DoubleBuffered = true; CFE_TBL_GetTblRegData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr != 0, - "CFE_TBL_GetTblRegData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr != 0, "CFE_TBL_GetTblRegData", "Double buffered table"); /* Test using a single buffered table and the buffer is inactive */ UT_InitData(); - CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); + CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].DoubleBuffered = false; - CFE_TBL_Global. - Registry[CFE_TBL_Global.HkTlmTblRegIndex]. - LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_GetTblRegData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr != 0, - "CFE_TBL_GetTblRegData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr != 0, "CFE_TBL_GetTblRegData", "Single buffered table - inactive buffer"); /* Test with no inactive buffer */ UT_InitData(); - CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); - CFE_TBL_Global. - Registry[CFE_TBL_Global.HkTlmTblRegIndex].LoadInProgress = - CFE_TBL_NO_LOAD_IN_PROGRESS; + CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); + CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; CFE_TBL_GetTblRegData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr == 0, - "CFE_TBL_GetTblRegData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr == 0, "CFE_TBL_GetTblRegData", "No inactive buffer"); } @@ -1045,10 +857,10 @@ void Test_CFE_TBL_GetTblRegData(void) */ void Test_CFE_TBL_GetHkData(void) { - int i; - int32 NumLoadPendingIndex = CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1; - int32 FreeSharedBuffIndex = CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS - 1; - int32 ValTableIndex = CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS - 1; + int i; + int32 NumLoadPendingIndex = CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1; + int32 FreeSharedBuffIndex = CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS - 1; + int32 ValTableIndex = CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS - 1; CFE_ES_AppId_t AppID; /* Get the AppID being used for UT */ @@ -1064,11 +876,9 @@ void Test_CFE_TBL_GetHkData(void) /* Test raising the count of load pending tables */ UT_InitData(); CFE_TBL_Global.Registry[NumLoadPendingIndex].LoadPending = true; - CFE_TBL_Global.Registry[NumLoadPendingIndex].OwnerAppId = AppID; + CFE_TBL_Global.Registry[NumLoadPendingIndex].OwnerAppId = AppID; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.HkPacket.Payload.NumLoadPending == 1, - "CFE_TBL_GetHkData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.NumLoadPending == 1, "CFE_TBL_GetHkData", "Raise load pending table count"); /* Test lowering the count of free shared buffers */ @@ -1076,63 +886,49 @@ void Test_CFE_TBL_GetHkData(void) CFE_TBL_Global.LoadBuffs[FreeSharedBuffIndex].Taken = true; CFE_TBL_GetHkData(); UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.HkPacket.Payload.NumFreeSharedBufs == - CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS - 1, - "CFE_TBL_GetHkData", - "Lower free shared buffer count"); + CFE_TBL_Global.HkPacket.Payload.NumFreeSharedBufs == CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS - 1, + "CFE_TBL_GetHkData", "Lower free shared buffer count"); /* Test making a ValPtr with result = CFE_SUCCESS */ UT_InitData(); - CFE_TBL_Global.SuccessValCounter = 0; - CFE_TBL_Global.ValidationResults[ValTableIndex].State = - CFE_TBL_VALIDATION_PERFORMED; + CFE_TBL_Global.SuccessValCounter = 0; + CFE_TBL_Global.ValidationResults[ValTableIndex].State = CFE_TBL_VALIDATION_PERFORMED; CFE_TBL_Global.ValidationResults[ValTableIndex].Result = CFE_SUCCESS; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.SuccessValCounter == 1, - "CFE_TBL_GetHkData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.SuccessValCounter == 1, "CFE_TBL_GetHkData", "ValPtr result CFE_SUCCESS"); /* Test making a ValPtr without result = CFE_SUCCESS */ UT_InitData(); - CFE_TBL_Global.FailedValCounter = 0; - CFE_TBL_Global.ValidationResults[ValTableIndex].State = - CFE_TBL_VALIDATION_PERFORMED; + CFE_TBL_Global.FailedValCounter = 0; + CFE_TBL_Global.ValidationResults[ValTableIndex].State = CFE_TBL_VALIDATION_PERFORMED; CFE_TBL_Global.ValidationResults[ValTableIndex].Result = CFE_SUCCESS - 1; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.FailedValCounter == 1, - "CFE_TBL_GetHkData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.FailedValCounter == 1, "CFE_TBL_GetHkData", "ValPtr result != CFE_SUCCESS"); /* Test with an invalid registry entry */ UT_InitData(); CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].OwnerAppId = CFE_TBL_NOT_OWNED; - CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds = 19283; + CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds = 19283; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 19283, - "CFE_TBL_GetHkData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 19283, "CFE_TBL_GetHkData", "Invalid registry entry"); /* Test with invalid last valid table updated out of range (low) */ UT_InitData(); - CFE_TBL_Global.LastTblUpdated = -1; + CFE_TBL_Global.LastTblUpdated = -1; CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds = 12345; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 12345, - "CFE_TBL_GetHkData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 12345, "CFE_TBL_GetHkData", "Last valid table updated out of range (low)"); /* Test with invalid last valid table updated out of range (high) */ UT_InitData(); - CFE_TBL_Global.LastTblUpdated = CFE_PLATFORM_TBL_MAX_NUM_TABLES; + CFE_TBL_Global.LastTblUpdated = CFE_PLATFORM_TBL_MAX_NUM_TABLES; CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds = 54321; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 54321, - "CFE_TBL_GetHkData", + UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 54321, "CFE_TBL_GetHkData", "Last valid table updated out of range (high)"); } @@ -1145,14 +941,13 @@ void Test_CFE_TBL_DumpRegCmd(void) int q; CFE_TBL_DumpRegistryCmd_t DumpRegCmd; CFE_ES_AppId_t AppID; - size_t LocalSize; - void *LocalBuf; - bool IsEOF; + size_t LocalSize; + void * LocalBuf; + bool IsEOF; /* Get the AppID being used for UT */ CFE_ES_GetAppID(&AppID); - UtPrintf("Begin Test Dump Register Command"); for (q = 0; q < CFE_PLATFORM_TBL_MAX_NUM_TABLES; q++) @@ -1165,117 +960,94 @@ void Test_CFE_TBL_DumpRegCmd(void) UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); strncpy(DumpRegCmd.Payload.DumpFilename, "X", sizeof(DumpRegCmd.Payload.DumpFilename) - 1); DumpRegCmd.Payload.DumpFilename[sizeof(DumpRegCmd.Payload.DumpFilename) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DumpRegistryCmd", - "Default dump file name"); + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_CMD_CTR, + "CFE_TBL_DumpRegistryCmd", "Default dump file name"); /* Test command with the dump file already pending (max requests pending) */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpRequest), CFE_STATUS_REQUEST_ALREADY_PENDING); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpRegistryCmd", - "Dump file already pending (FS max requests)"); + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_ERR_CTR, + "CFE_TBL_DumpRegistryCmd", "Dump file already pending (FS max requests)"); UT_ResetState(UT_KEY(CFE_FS_BackgroundFileDumpRequest)); /* Test command with the dump file already pending (local) */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpRequest), CFE_STATUS_REQUEST_ALREADY_PENDING); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpRegistryCmd", - "Dump file already pending (local)"); + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_ERR_CTR, + "CFE_TBL_DumpRegistryCmd", "Dump file already pending (local)"); /* Check event generators */ UT_ClearEventHistory(); CFE_TBL_Global.RegDumpState.FileExisted = true; - CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, 1000); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_OVERWRITE_REG_DUMP_INF_EID), - "CFE_TBL_DumpRegistryEventHandler", - "Dump file created event (overwrite)"); + CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, + 1000); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_OVERWRITE_REG_DUMP_INF_EID), + "CFE_TBL_DumpRegistryEventHandler", "Dump file created event (overwrite)"); UT_ClearEventHistory(); CFE_TBL_Global.RegDumpState.FileExisted = false; - CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, 1000); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_WRITE_REG_DUMP_INF_EID), - "CFE_TBL_DumpRegistryEventHandler", - "Dump file created event (new)"); + CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, + 1000); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_WRITE_REG_DUMP_INF_EID), + "CFE_TBL_DumpRegistryEventHandler", "Dump file created event (new)"); UT_ClearEventHistory(); - CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, CFE_SUCCESS, 10, 10, 1000); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_WRITE_TBL_REG_ERR_EID), - "CFE_TBL_DumpRegistryEventHandler", - "Dump file record write error event"); + CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, + CFE_SUCCESS, 10, 10, 1000); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_WRITE_TBL_REG_ERR_EID), + "CFE_TBL_DumpRegistryEventHandler", "Dump file record write error event"); UT_ClearEventHistory(); - CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, CFE_SUCCESS, 10, 10, 1000); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_WRITE_CFE_HDR_ERR_EID), - "CFE_TBL_DumpRegistryEventHandler", - "Dump file header write error event"); + CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, + CFE_SUCCESS, 10, 10, 1000); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_WRITE_CFE_HDR_ERR_EID), + "CFE_TBL_DumpRegistryEventHandler", "Dump file header write error event"); UT_ClearEventHistory(); - CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_CREATE_ERROR, OS_ERROR, 10, 0, 0); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_CREATING_DUMP_FILE_ERR_EID), - "CFE_TBL_DumpRegistryEventHandler", - "Dump file created error event"); + CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_CREATE_ERROR, OS_ERROR, 10, 0, + 0); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_CREATING_DUMP_FILE_ERR_EID), + "CFE_TBL_DumpRegistryEventHandler", "Dump file created error event"); UT_ClearEventHistory(); CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_UNDEFINED, OS_ERROR, 0, 0, 0); - UT_Report(__FILE__, __LINE__, - UT_GetNumEventsSent() == 0, - "CFE_TBL_DumpRegistryEventHandler", + UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0, "CFE_TBL_DumpRegistryEventHandler", "Undefined event is ignored"); /* Test where the table is owned, the file doesn't already exist, and the * table is successfully dumped */ UT_InitData(); - CFE_TBL_Global.Registry[0].OwnerAppId = AppID; + CFE_TBL_Global.Registry[0].OwnerAppId = AppID; CFE_TBL_Global.Registry[0].HeadOfAccessList = CFE_TBL_END_OF_LIST; - CFE_TBL_Global.Registry[1].OwnerAppId = CFE_TBL_NOT_OWNED; - CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - CFE_TBL_Global.Registry[0].DoubleBuffered = true; - LocalBuf = NULL; - LocalSize = 0; + CFE_TBL_Global.Registry[1].OwnerAppId = CFE_TBL_NOT_OWNED; + CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + CFE_TBL_Global.Registry[0].DoubleBuffered = true; + LocalBuf = NULL; + LocalSize = 0; IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, 0, &LocalBuf, &LocalSize); - UT_Report(__FILE__, __LINE__, - !IsEOF, - "CFE_TBL_DumpRegistryGetter", - "Nominal, first record, not end of file"); + UT_Report(__FILE__, __LINE__, !IsEOF, "CFE_TBL_DumpRegistryGetter", "Nominal, first record, not end of file"); UtAssert_NOT_NULL(LocalBuf); UtAssert_NONZERO(LocalSize); - CFE_TBL_Global.Registry[CFE_PLATFORM_TBL_MAX_NUM_TABLES-1].OwnerAppId = CFE_TBL_NOT_OWNED; - CFE_TBL_Global.Registry[CFE_PLATFORM_TBL_MAX_NUM_TABLES-1].HeadOfAccessList = 2; - CFE_TBL_Global.Handles[2].NextLink = CFE_TBL_END_OF_LIST; - LocalBuf = NULL; - LocalSize = 0; - IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES-1, &LocalBuf, &LocalSize); - UT_Report(__FILE__, __LINE__, - IsEOF, - "CFE_TBL_DumpRegistryGetter", + CFE_TBL_Global.Registry[CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1].OwnerAppId = CFE_TBL_NOT_OWNED; + CFE_TBL_Global.Registry[CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1].HeadOfAccessList = 2; + CFE_TBL_Global.Handles[2].NextLink = CFE_TBL_END_OF_LIST; + LocalBuf = NULL; + LocalSize = 0; + IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1, &LocalBuf, + &LocalSize); + UT_Report(__FILE__, __LINE__, IsEOF, "CFE_TBL_DumpRegistryGetter", "Nominal, last record, multiple accessors, end of file"); UtAssert_NOT_NULL(LocalBuf); UtAssert_NONZERO(LocalSize); /* Test with record numb beyond EOF (should be ignored, return null) */ - IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES+1, &LocalBuf, &LocalSize); - UT_Report(__FILE__, __LINE__, - IsEOF, - "CFE_TBL_DumpRegistryGetter", - "Past end of file"); + IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1, &LocalBuf, + &LocalSize); + UT_Report(__FILE__, __LINE__, IsEOF, "CFE_TBL_DumpRegistryGetter", "Past end of file"); UtAssert_NULL(LocalBuf); UtAssert_ZERO(LocalSize); - } /* @@ -1283,12 +1055,12 @@ void Test_CFE_TBL_DumpRegCmd(void) */ void Test_CFE_TBL_DumpCmd(void) { - int i, k, u; - uint8 Buff; - uint8 *BuffPtr = &Buff; - CFE_TBL_LoadBuff_t Load = {0}; - CFE_TBL_DumpCmd_t DumpCmd; - CFE_ES_AppId_t AppID; + int i, k, u; + uint8 Buff; + uint8 * BuffPtr = &Buff; + CFE_TBL_LoadBuff_t Load = {0}; + CFE_TBL_DumpCmd_t DumpCmd; + CFE_ES_AppId_t AppID; CFE_ES_GetAppID(&AppID); @@ -1298,12 +1070,8 @@ void Test_CFE_TBL_DumpCmd(void) /* Test where the table cannot be found in the registry */ UT_InitData(); - snprintf(DumpCmd.Payload.TableName, sizeof(DumpCmd.Payload.TableName), - "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpCmd", + snprintf(DumpCmd.Payload.TableName, sizeof(DumpCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", "Table registry entry doesn't exist"); /* Test with an active buffer, the pointer is created, validation passes, @@ -1311,14 +1079,12 @@ void Test_CFE_TBL_DumpCmd(void) * working buffer; load in progress, single-buffered */ UT_InitData(); - strncpy(CFE_TBL_Global.Registry[2].Name, "DumpCmdTest", - sizeof(CFE_TBL_Global.Registry[2].Name) - 1); + strncpy(CFE_TBL_Global.Registry[2].Name, "DumpCmdTest", sizeof(CFE_TBL_Global.Registry[2].Name) - 1); CFE_TBL_Global.Registry[2].Name[sizeof(CFE_TBL_Global.Registry[2].Name) - 1] = '\0'; - CFE_TBL_Global.Registry[2].OwnerAppId = AppID; - strncpy(DumpCmd.Payload.TableName, CFE_TBL_Global.Registry[2].Name, - sizeof(DumpCmd.Payload.TableName) - 1); + CFE_TBL_Global.Registry[2].OwnerAppId = AppID; + strncpy(DumpCmd.Payload.TableName, CFE_TBL_Global.Registry[2].Name, sizeof(DumpCmd.Payload.TableName) - 1); DumpCmd.Payload.TableName[sizeof(DumpCmd.Payload.TableName) - 1] = '\0'; - DumpCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE; + DumpCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE; CFE_TBL_Global.Registry[2].Buffers[CFE_TBL_Global.Registry[2].ActiveBufferIndex].BufferPtr = BuffPtr; for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) @@ -1326,20 +1092,17 @@ void Test_CFE_TBL_DumpCmd(void) CFE_TBL_Global.Registry[i].DumpOnly = true; } - CFE_TBL_Global.DumpControlBlocks[2].State = CFE_TBL_DUMP_PENDING; - CFE_TBL_Global.DumpControlBlocks[3].State = CFE_TBL_DUMP_FREE; - CFE_TBL_Global.Registry[2].DumpControlIndex = CFE_TBL_NO_DUMP_PENDING; - CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - CFE_TBL_Global.Registry[2].DoubleBuffered = false; + CFE_TBL_Global.DumpControlBlocks[2].State = CFE_TBL_DUMP_PENDING; + CFE_TBL_Global.DumpControlBlocks[3].State = CFE_TBL_DUMP_FREE; + CFE_TBL_Global.Registry[2].DumpControlIndex = CFE_TBL_NO_DUMP_PENDING; + CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + CFE_TBL_Global.Registry[2].DoubleBuffered = false; CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[2].LoadInProgress] = Load; - CFE_TBL_Global.Registry[2].NotifyByMsg = true; + CFE_TBL_Global.Registry[2].NotifyByMsg = true; 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, - "CFE_TBL_DumpCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_DumpCmd", "Active buffer, pointer created, validation passes, is a dump " - "only table, no dump already in progress, got working buffer"); + "only table, no dump already in progress, got working buffer"); /* Test with an active buffer, a pointer is created, the table is dump * only, no dump is already progress, and fails to get a working buffer; @@ -1347,11 +1110,11 @@ void Test_CFE_TBL_DumpCmd(void) * available */ UT_InitData(); - CFE_TBL_Global.DumpControlBlocks[2].State = CFE_TBL_DUMP_FREE; + CFE_TBL_Global.DumpControlBlocks[2].State = CFE_TBL_DUMP_FREE; CFE_TBL_Global.Registry[2].DumpControlIndex = CFE_TBL_NO_DUMP_PENDING; - CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - CFE_TBL_Global.Registry[2].TableLoadedOnce = true; - CFE_TBL_Global.Registry[2].DoubleBuffered = false; + CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; + CFE_TBL_Global.Registry[2].TableLoadedOnce = true; + CFE_TBL_Global.Registry[2].DoubleBuffered = false; for (u = 0; u < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; u++) { @@ -1359,13 +1122,10 @@ void Test_CFE_TBL_DumpCmd(void) } CFE_TBL_Global.Registry[2].NotifyByMsg = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", "Active buffer, pointer created, is a dump only table, no dump " - "already in progress, fails to get a working buffer: No " - "working buffers available"); + "already in progress, fails to get a working buffer: No " + "working buffers available"); /* Test with an active buffer, a pointer is created, the table is dump * only, and no dump fails to find a free dump control block; too many @@ -1380,80 +1140,61 @@ void Test_CFE_TBL_DumpCmd(void) } CFE_TBL_Global.Registry[2].NotifyByMsg = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", "Active buffer, pointer created, is dump only table, fails to " - "find a free dump control block: too many dump only table " - "dumps have been requested"); + "find a free dump control block: too many dump only table " + "dumps have been requested"); /* Test with an inactive buffer, double-buffered, dump already in progress; * dump is already pending */ UT_InitData(); - DumpCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_INACTIVE; + DumpCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_INACTIVE; CFE_TBL_Global.Registry[2].DoubleBuffered = true; CFE_TBL_Global.Registry[2].Buffers[(1 - CFE_TBL_Global.Registry[2].ActiveBufferIndex)].BufferPtr = BuffPtr; - CFE_TBL_Global.Registry[2].DumpControlIndex = CFE_TBL_NO_DUMP_PENDING + - 1; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpCmd", + CFE_TBL_Global.Registry[2].DumpControlIndex = CFE_TBL_NO_DUMP_PENDING + 1; + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", "Inactive buffer, double-buffered, dump already in progress: " - "dump is already pending"); + "dump is already pending"); /* Test with an inactive buffer, single-buffered, pointer created, is a * dump only table */ UT_InitData(); - CFE_TBL_Global.Registry[2].DoubleBuffered = false; - CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + CFE_TBL_Global.Registry[2].DoubleBuffered = false; + CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[2].LoadInProgress].BufferPtr = BuffPtr; - CFE_TBL_Global.Registry[2].DumpOnly = false; + CFE_TBL_Global.Registry[2].DumpOnly = false; strncpy(DumpCmd.Payload.DumpFilename, CFE_TBL_Global.Registry[2].LastFileLoaded, sizeof(DumpCmd.Payload.DumpFilename) - 1); DumpCmd.Payload.DumpFilename[sizeof(DumpCmd.Payload.DumpFilename) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DumpCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_DumpCmd", "Inactive buffer, single-buffered, pointer created, is a dump " - "only table"); + "only table"); /* Test with an inactive buffer, single-buffered: No inactive buffer for * table due to load in progress */ UT_InitData(); CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", "Inactive buffer, single-buffered: no inactive buffer for table " - "due to load in progress"); + "due to load in progress"); /* Test with an inactive buffer, single-buffered: No inactive buffer for * table due to user defined address */ UT_InitData(); CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - CFE_TBL_Global.Registry[2].UserDefAddr = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpCmd", + CFE_TBL_Global.Registry[2].UserDefAddr = true; + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", "Inactive buffer, single-buffered: no inactive buffer for table " - "due to user defined address"); + "due to user defined address"); /* Test with an illegal buffer parameter */ UT_InitData(); DumpCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE + 1; - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpCmd(&DumpCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", "Illegal buffer parameter"); } @@ -1463,30 +1204,26 @@ 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_Global.LoadBuffs[0]; - CFE_TBL_LoadCmd_t LoadCmd; - CFE_ES_AppId_t AppID; + int i, j; + CFE_TBL_File_Hdr_t TblFileHeader; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_LoadBuff_t BufferPtr = CFE_TBL_Global.LoadBuffs[0]; + CFE_TBL_LoadCmd_t LoadCmd; + CFE_ES_AppId_t AppID; CFE_ES_GetAppID(&AppID); UtPrintf("Begin Test Load Command"); StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; /* Test response to inability to open file */ UT_InitData(); - strncpy(LoadCmd.Payload.LoadFilename, "LoadFileName", - sizeof(LoadCmd.Payload.LoadFilename) - 1); + strncpy(LoadCmd.Payload.LoadFilename, "LoadFileName", sizeof(LoadCmd.Payload.LoadFilename) - 1); LoadCmd.Payload.LoadFilename[sizeof(LoadCmd.Payload.LoadFilename) - 1] = '\0'; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Unable to open file"); /* Test response to inability to find the table in the registry */ @@ -1494,24 +1231,19 @@ void Test_CFE_TBL_LoadCmd(void) for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) { - CFE_TBL_Global.Registry[i].OwnerAppId = CFE_TBL_NOT_OWNED; + CFE_TBL_Global.Registry[i].OwnerAppId = CFE_TBL_NOT_OWNED; CFE_TBL_Global.Registry[i].LoadPending = false; } - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - strncpy(StdFileHeader.Description, "FS header description", - sizeof(StdFileHeader.Description) - 1); + strncpy(StdFileHeader.Description, "FS header description", sizeof(StdFileHeader.Description) - 1); StdFileHeader.Description[sizeof(StdFileHeader.Description) - 1] = '\0'; - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Table registry entry doesn't exist"); /* Test attempt to load a dump only table */ @@ -1519,12 +1251,9 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].OwnerAppId = AppID; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t) + 1; + CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t) + 1; CFE_TBL_Global.Registry[0].DumpOnly = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Attempting to load a dump only table"); /* Test attempt to load a table with a load already pending */ @@ -1532,13 +1261,10 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].OwnerAppId = AppID; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t) + 1; - CFE_TBL_Global.Registry[0].DumpOnly = false; + CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t) + 1; + CFE_TBL_Global.Registry[0].DumpOnly = false; CFE_TBL_Global.Registry[0].LoadPending = true; - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Attempting to load a table with load already pending"); CFE_TBL_Global.Registry[0].LoadPending = false; @@ -1550,18 +1276,14 @@ void Test_CFE_TBL_LoadCmd(void) UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(CFE_TBL_File_Hdr_t)); CFE_TBL_Global.Registry[0].TableLoadedOnce = true; - CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t); - CFE_TBL_Global.Registry[0].LoadInProgress = - CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - CFE_TBL_Global.Registry[0].DoubleBuffered = false; - CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = (uint8 *) &BufferPtr; + CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t); + CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + CFE_TBL_Global.Registry[0].DoubleBuffered = false; + CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = (uint8 *)&BufferPtr; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); CFE_TBL_Global.Registry[0].DumpOnly = false; - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "There is more data than the file indicates"); /* Test with no extra byte => successful load */ @@ -1569,15 +1291,11 @@ void Test_CFE_TBL_LoadCmd(void) UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(CFE_TBL_File_Hdr_t)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_CMD_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_LoadCmd", "Successful load"); /* Test with differing amount of data from header's claim */ @@ -1589,23 +1307,19 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_ByteSwapUint32(&TblFileHeader.NumBytes); } - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(OS_read), 2, 0); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Incomplete load of file into the working buffer"); /* Test with no working buffers available */ UT_InitData(); - CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - CFE_TBL_Global.Registry[0].TableLoadedOnce = true; - CFE_TBL_Global.Registry[0].DoubleBuffered = false; + CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; + CFE_TBL_Global.Registry[0].TableLoadedOnce = true; + CFE_TBL_Global.Registry[0].DoubleBuffered = false; CFE_TBL_Global.Registry[0].Buffers[CFE_TBL_Global.Registry[0].ActiveBufferIndex] = BufferPtr; for (j = 0; j < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; j++) @@ -1613,15 +1327,11 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.LoadBuffs[j].Taken = true; } - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "No working buffers available"); /* Test with table header indicating data beyond size of the table */ @@ -1629,30 +1339,22 @@ void Test_CFE_TBL_LoadCmd(void) UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(CFE_TBL_File_Hdr_t)); CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t) - 1; - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Table header indicates data beyond size of the table"); /* Test with table header indicating no data in the file */ UT_InitData(); UT_TBL_SetupHeader(&TblFileHeader, 0, 0); - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Table header indicates no data in file"); /* Test where file has partial load for uninitialized table and offset @@ -1664,17 +1366,13 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].TableLoadedOnce = false; CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t); - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "File has partial load for uninitialized table and offset " - "is non-zero"); + "is non-zero"); /* Test where file has partial load for uninitialized table and offset * is zero @@ -1685,28 +1383,20 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].TableLoadedOnce = false; CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t); - strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, - sizeof(TblFileHeader.TableName) - 1); + strncpy(TblFileHeader.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "File has partial load for uninitialized table and offset " - "is zero"); + "is zero"); /* Test response to inability to read the file header */ UT_InitData(); - strncpy(LoadCmd.Payload.LoadFilename, "LoadFileName", - sizeof(LoadCmd.Payload.LoadFilename) - 1); + strncpy(LoadCmd.Payload.LoadFilename, "LoadFileName", sizeof(LoadCmd.Payload.LoadFilename) - 1); LoadCmd.Payload.LoadFilename[sizeof(LoadCmd.Payload.LoadFilename) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(CFE_FS_ReadHeader), 1, sizeof(CFE_FS_Header_t) - 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_LoadCmd(&LoadCmd) == - CFE_TBL_INC_ERR_CTR, - "CFE_TBL_LoadCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", "Unable to read file header"); } @@ -1717,12 +1407,12 @@ void Test_CFE_TBL_HousekeepingCmd(void) { int i; CFE_TBL_LoadBuff_t DumpBuff; - CFE_TBL_LoadBuff_t *DumpBuffPtr = &DumpBuff; + CFE_TBL_LoadBuff_t * DumpBuffPtr = &DumpBuff; CFE_TBL_RegistryRec_t RegRecPtr; uint8 Buff; - void *BuffPtr = &Buff; - uint32 Secs = 0; - uint32 SubSecs = 0; + void * BuffPtr = &Buff; + uint32 Secs = 0; + uint32 SubSecs = 0; int32 LoadInProg = 0; UtPrintf("Begin Test Housekeeping Command"); @@ -1731,22 +1421,22 @@ void Test_CFE_TBL_HousekeepingCmd(void) * to send Hk packet */ UT_InitData(); - strncpy(CFE_TBL_Global.DumpControlBlocks[0].TableName, - "housekeepingtest", sizeof(CFE_TBL_Global.DumpControlBlocks[0].TableName) - 1); + strncpy(CFE_TBL_Global.DumpControlBlocks[0].TableName, "housekeepingtest", + sizeof(CFE_TBL_Global.DumpControlBlocks[0].TableName) - 1); CFE_TBL_Global.DumpControlBlocks[0].TableName[sizeof(CFE_TBL_Global.DumpControlBlocks[0].TableName) - 1] = '\0'; - CFE_TBL_Global.DumpControlBlocks[0].Size = 10; - LoadInProg = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - RegRecPtr.LoadInProgress = LoadInProg; + CFE_TBL_Global.DumpControlBlocks[0].Size = 10; + LoadInProg = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; + RegRecPtr.LoadInProgress = LoadInProg; CFE_TBL_Global.DumpControlBlocks[0].RegRecPtr = &RegRecPtr; - DumpBuffPtr->Taken = true; - DumpBuffPtr->Validated = true; - DumpBuffPtr->BufferPtr = BuffPtr; - DumpBuffPtr->FileCreateTimeSecs = Secs; - DumpBuffPtr->FileCreateTimeSubSecs = SubSecs; + DumpBuffPtr->Taken = true; + DumpBuffPtr->Validated = true; + DumpBuffPtr->BufferPtr = BuffPtr; + DumpBuffPtr->FileCreateTimeSecs = Secs; + DumpBuffPtr->FileCreateTimeSubSecs = SubSecs; strncpy(DumpBuffPtr->DataSource, "hkSource", sizeof(DumpBuffPtr->DataSource) - 1); DumpBuffPtr->DataSource[sizeof(DumpBuffPtr->DataSource) - 1] = '\0'; - CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr = DumpBuffPtr; - CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; + CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr = DumpBuffPtr; + CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; for (i = 1; i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; i++) { @@ -1755,9 +1445,7 @@ void Test_CFE_TBL_HousekeepingCmd(void) UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SUCCESS - 1); CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; - UT_Report(__FILE__, __LINE__, - CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, - "CFE_TBL_HousekeepingCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", "Able to open dump file"); for (i = 1; i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; i++) @@ -1765,36 +1453,30 @@ void Test_CFE_TBL_HousekeepingCmd(void) CFE_TBL_Global.DumpControlBlocks[i].State = CFE_TBL_DUMP_PENDING; } - RegRecPtr.LoadInProgress = LoadInProg; + RegRecPtr.LoadInProgress = LoadInProg; CFE_TBL_Global.DumpControlBlocks[0].RegRecPtr = &RegRecPtr; /* Test response to inability to open dump file */ UT_InitData(); CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; - CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; + CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, - "CFE_TBL_HousekeepingCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", "Unable to open dump file"); /* Test response to an invalid table and a dump file create failure */ UT_InitData(); - CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; + CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, - "CFE_TBL_HousekeepingCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", "Invalid table and dump file create failure"); /* Test response to a file time stamp failure */ UT_InitData(); CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; UT_SetDeferredRetcode(UT_KEY(CFE_FS_SetTimestamp), 1, OS_SUCCESS - 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, - "CFE_TBL_HousekeepingCmd", + UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", "Time stamp file failure"); } @@ -1814,30 +1496,25 @@ void Test_CFE_TBL_ApiInit(void) */ void Test_CFE_TBL_Register(void) { - int32 RtnCode; - int32 RtnCode2; - CFE_TBL_Handle_t TblHandle1; - CFE_TBL_Handle_t TblHandle2; - CFE_TBL_Handle_t TblHandle3; - bool EventsCorrect; - char TblName[CFE_MISSION_TBL_MAX_NAME_LENGTH + 2]; - int16 i; + int32 RtnCode; + int32 RtnCode2; + CFE_TBL_Handle_t TblHandle1; + CFE_TBL_Handle_t TblHandle2; + CFE_TBL_Handle_t TblHandle3; + bool EventsCorrect; + char TblName[CFE_MISSION_TBL_MAX_NAME_LENGTH + 2]; + int16 i; CFE_TBL_AccessDescriptor_t *AccessDescPtr; - CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_RegistryRec_t * RegRecPtr; UtPrintf("Begin Test Register"); /* Test response to an invalid application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_Register", "Invalid application ID"); /* Test response to a table name longer than the maximum allowed */ @@ -1849,206 +1526,133 @@ void Test_CFE_TBL_Register(void) TblName[i] = 'A'; } - TblName[i] = '\0'; - RtnCode = CFE_TBL_Register(&TblHandle1, TblName, - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, - "CFE_TBL_Register", + TblName[i] = '\0'; + RtnCode = CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_Register", "Table name too long"); /* Test response to a table name shorter than the minimum allowed */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "", sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_Register", "Table name too short"); /* Test response to a table size of zero */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - 0, CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", 0, CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, "CFE_TBL_Register", "Size of table = 0"); /* Test response to a table size larger than the maximum allowed */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - (CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE + 1), + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", (CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE + 1), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, - "CFE_TBL_Register", + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, "CFE_TBL_Register", "Table size too large"); /* Test response to a double-buffered table size larger than the * maximum allowed */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - (CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE + 1), + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", (CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE + 1), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, - "CFE_TBL_Register", + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, "CFE_TBL_Register", "Double-buffered table size too large"); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_DBL_BUFFER) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - ((CFE_TBL_OPT_USR_DEF_ADDR & - ~CFE_TBL_OPT_LD_DMP_MSK) | - CFE_TBL_OPT_DBL_BUFFER), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + ((CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK) | CFE_TBL_OPT_DBL_BUFFER), NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR | " - "CFE_TBL_OPT_DBL_BUFFER)"); + "CFE_TBL_OPT_DBL_BUFFER)"); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_LOAD_DUMP) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - (CFE_TBL_OPT_USR_DEF_ADDR & - ~CFE_TBL_OPT_LD_DMP_MSK), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + (CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK), NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR | " - "CFE_TBL_OPT_LOAD_DUMP)"); + "CFE_TBL_OPT_LOAD_DUMP)"); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - ((CFE_TBL_OPT_USR_DEF_ADDR & - ~CFE_TBL_OPT_LD_DMP_MSK) | - CFE_TBL_OPT_CRITICAL), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + ((CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK) | CFE_TBL_OPT_CRITICAL), NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR | " - "CFE_TBL_OPT_CRITICAL)"); + "CFE_TBL_OPT_CRITICAL)"); /* Test response to an invalid table option combination * (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_DBL_BUFFER) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - (CFE_TBL_OPT_DUMP_ONLY | - CFE_TBL_OPT_DBL_BUFFER), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_DBL_BUFFER), NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", "Invalid table option combination (CFE_TBL_OPT_DUMP_ONLY | " - "CFE_TBL_OPT_DBL_BUFFER)"); + "CFE_TBL_OPT_DBL_BUFFER)"); /* Test response to a memory handle error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_Register", "Memory handle error"); /* Test response to a memory block size error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_MEM_BLOCK_SIZE && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_MEM_BLOCK_SIZE && EventsCorrect, "CFE_TBL_Register", "Memory block size error"); /* Test response to a memory block size error (for a second buffer) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 2, CFE_ES_ERR_MEM_BLOCK_SIZE); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_MEM_BLOCK_SIZE && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_MEM_BLOCK_SIZE && EventsCorrect, "CFE_TBL_Register", "Memory block size error (for second buffer)"); /* Test successfully getting a double buffered table */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Get a double buffered table - successful"); /* Test attempt to register table owned by another application */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Register(&TblHandle3, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_DUPLICATE_NOT_OWNED && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle3, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUPLICATE_NOT_OWNED && EventsCorrect, "CFE_TBL_Register", "Table owned by another application"); /* Test attempt to register existing table with a different size */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&TblHandle3, "UT_Table1", - sizeof(UT_Table2_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_DUPLICATE_DIFF_SIZE && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle3, "UT_Table1", sizeof(UT_Table2_t), CFE_TBL_OPT_DBL_BUFFER, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUPLICATE_DIFF_SIZE && EventsCorrect, "CFE_TBL_Register", "Table size mismatch"); /* Test attempt to register a table with the same size and name */ @@ -2056,126 +1660,88 @@ void Test_CFE_TBL_Register(void) UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_Share(&TblHandle3, "ut_cfe_tbl.UT_Table1"); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Share(&TblHandle3, "ut_cfe_tbl.UT_Table1"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Table with same size and name (setup)"); /* b. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); /* Restore AppID to proper value */ - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); + RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && - TblHandle1 == TblHandle2, - "CFE_TBL_Register", - "Table with same size and name"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, + "CFE_TBL_Register", "Table with same size and name"); /* c. Test cleanup: unregister tables */ UT_ClearEventHistory(); UT_SetAppID(UT_TBL_APPID_1); RtnCode = CFE_TBL_Unregister(TblHandle2); UT_SetAppID(UT_TBL_APPID_2); - RtnCode2 = CFE_TBL_Unregister(TblHandle3); + RtnCode2 = CFE_TBL_Unregister(TblHandle3); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && RtnCode2 == CFE_SUCCESS && - EventsCorrect, - "CFE_TBL_Unregister", - "Table with same size and name (cleanup)"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && RtnCode2 == CFE_SUCCESS && EventsCorrect, + "CFE_TBL_Unregister", "Table with same size and name (cleanup)"); /* Test registering a single buffered table */ /* a. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register single buffered table"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register single buffered table (cleanup)"); /* Test registering a single buffered dump-only table */ /* a. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - (CFE_TBL_OPT_SNGL_BUFFER | - CFE_TBL_OPT_DUMP_ONLY), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + (CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_DUMP_ONLY), NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register single buffered dump-only table"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register single buffered dump-only table (cleanup)"); /* Test registering a user defined address table */ /* a. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_USR_DEF_ADDR, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_USR_DEF_ADDR, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register user defined address table"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register user defined address table (cleanup)"); /* Test registering a critical table */ /* a. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register critical table"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register critical table (cleanup)"); /* Test registering a critical table that already has an allocated CDS */ @@ -2183,25 +1749,18 @@ void Test_CFE_TBL_Register(void) UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); CFE_TBL_Global.CritReg[0].TableLoadedOnce = true; - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_RECOVERED_TBL && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_RECOVERED_TBL && EventsCorrect, "CFE_TBL_Register", "Register critical table that already has an allocated CDS"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register critical table that already has an allocated " - "CDS (cleanup)"); + "CDS (cleanup)"); /* Test registering a critical table that already has an allocated CDS * and recovery fails @@ -2210,26 +1769,19 @@ void Test_CFE_TBL_Register(void) UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); CFE_TBL_Global.CritReg[0].TableLoadedOnce = false; - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register critical table that already has an allocated CDS where " "recovery fails"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register critical table that already has an allocated " - "CDS where recovery fails (cleanup)"); + "CDS where recovery fails (cleanup)"); /* Test registering a critical table that already has an allocated CDS but * fails recovery @@ -2238,26 +1790,19 @@ void Test_CFE_TBL_Register(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RestoreFromCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register critical table that already has an allocated CDS but " - "fails recovery"); + "fails recovery"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register critical table that already has an allocated CDS but " - "fails recovery (cleanup)"); + "fails recovery (cleanup)"); /* Test registering a critical table that already has an allocated CDS but * no critical table registry entry @@ -2272,26 +1817,19 @@ void Test_CFE_TBL_Register(void) CFE_TBL_Global.CritReg[i].CDSHandle = CFE_ES_CDS_BAD_HANDLE; } - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register Critical table that already has an allocated CDS " - "but no critical table registry entry"); + "but no critical table registry entry"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register Critical table that already has an allocated CDS " - "but no critical table registry entry (cleanup)"); + "but no critical table registry entry (cleanup)"); /* Test registering a critical table but no critical table registry entry * is free @@ -2306,85 +1844,59 @@ void Test_CFE_TBL_Register(void) CFE_TBL_Global.CritReg[i].CDSHandle = CFE_ES_CDS_BAD_HANDLE; } - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Register Critical table but no critical table registry entry " - "is free"); + "is free"); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); + RtnCode = CFE_TBL_Unregister(TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Register Critical table but no critical table registry entry " - "is free (cleanup)"); + "is free (cleanup)"); /* Test attempt to register a critical table when the CDS registry * is full */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_NO_RESOURCE_IDS_AVAILABLE); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_WARN_NOT_CRITICAL && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_NOT_CRITICAL && EventsCorrect, "CFE_TBL_Register", "Register critical table when CDS registry is full"); /* Test attempt to register a table when the registry is full */ /* a. Test setup */ UT_InitData(); UT_ResetTableRegistry(); - i = 0; + i = 0; RtnCode = CFE_SUCCESS; while (i < CFE_PLATFORM_TBL_MAX_NUM_TABLES && RtnCode == CFE_SUCCESS) { snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", i + 1); - RtnCode = CFE_TBL_Register(&TblHandle1, TblName, - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); + RtnCode = CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); i++; } - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS, - "CFE_TBL_Register", - "Registry full (setup)"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Register", "Registry full (setup)"); /* b. Perform test */ UT_ClearEventHistory(); snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", i + 1); - RtnCode = CFE_TBL_Register(&TblHandle2, TblName, - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_REGISTRY_FULL && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle2, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_REGISTRY_FULL && EventsCorrect, "CFE_TBL_Register", "Registry full"); /* c. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + RtnCode = CFE_TBL_Unregister(TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Registry full (cleanup)"); /* Test response to no available handles */ @@ -2394,44 +1906,26 @@ void Test_CFE_TBL_Register(void) do { RtnCode = CFE_TBL_Share(&TblHandle1, "ut_cfe_tbl.UT_Table2"); - } while ((TblHandle1 < CFE_PLATFORM_TBL_MAX_NUM_HANDLES - 1) && - RtnCode == CFE_SUCCESS); + } while ((TblHandle1 < CFE_PLATFORM_TBL_MAX_NUM_HANDLES - 1) && RtnCode == CFE_SUCCESS); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS, - "CFE_TBL_Share", - "No available handles (setup)"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Share", "No available handles (setup)"); /* b. Perform test */ UT_ClearEventHistory(); - snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", - CFE_PLATFORM_TBL_MAX_NUM_TABLES); - RtnCode = CFE_TBL_Register(&TblHandle1, - TblName, - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, - NULL); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_HANDLES_FULL && EventsCorrect, - "CFE_TBL_Register", + snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES); + RtnCode = CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_HANDLES_FULL && EventsCorrect, "CFE_TBL_Register", "No available handles"); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL, - NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR |" "CFE_TBL_OPT_CRITICAL)"); @@ -2439,83 +1933,57 @@ void Test_CFE_TBL_Register(void) * (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_CRITICAL) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_CRITICAL, - NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_CRITICAL, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", "Invalid table option combination (CFE_TBL_OPT_DUMP_ONLY |" "CFE_TBL_OPT_CRITICAL)"); /* Test attempt to register a table with UsedFlag = false */ UT_InitData(); CFE_TBL_Global.Handles[0].UsedFlag = false; - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); + RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && - TblHandle1 == TblHandle2, - "CFE_TBL_Register", - "UsedFlag is false"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, + "CFE_TBL_Register", "UsedFlag is false"); /* Test attempt to register a table with an invalid registry index */ UT_InitData(); CFE_TBL_Global.Handles[0].UsedFlag = true; CFE_TBL_Global.Handles[0].RegIndex = -1; - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); + RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && - TblHandle1 == TblHandle2, - "CFE_TBL_Register", - "Invalid registry index"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, + "CFE_TBL_Register", "Invalid registry index"); /* Test attempt to register a table with access index at end of list */ UT_InitData(); - for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) - { - CFE_TBL_Global.Registry[i].HeadOfAccessList = CFE_TBL_END_OF_LIST; - } - - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && - TblHandle1 == TblHandle2, - "CFE_TBL_Register", - "Access index at end of list"); - - /* Test attempt to register a double buffered table with a pool buffer - * error */ - UT_InitData(); - UT_SetAppID(UT_TBL_APPID_1); - UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_SEVERITY_ERROR); - snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", - CFE_PLATFORM_TBL_MAX_NUM_TABLES); - CFE_TBL_Global.Handles[0].UsedFlag = false; - RtnCode = CFE_TBL_Register(&TblHandle2, TblName, - sizeof(UT_Table1_t) + 1, - CFE_TBL_OPT_DBL_BUFFER, NULL); - AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - EventsCorrect = RegRecPtr->DoubleBuffered == false && - RegRecPtr->ActiveBufferIndex == 0; - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SEVERITY_ERROR && EventsCorrect, - "CFE_TBL_Register", - "Register a double buffered table with pool buffer error"); - CFE_TBL_Global.Handles[0].UsedFlag = true; + for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; i++) + { + CFE_TBL_Global.Registry[i].HeadOfAccessList = CFE_TBL_END_OF_LIST; + } + + RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, + "CFE_TBL_Register", "Access index at end of list"); + + /* Test attempt to register a double buffered table with a pool buffer + * error */ + UT_InitData(); + UT_SetAppID(UT_TBL_APPID_1); + UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_SEVERITY_ERROR); + snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES); + CFE_TBL_Global.Handles[0].UsedFlag = false; + RtnCode = CFE_TBL_Register(&TblHandle2, TblName, sizeof(UT_Table1_t) + 1, CFE_TBL_OPT_DBL_BUFFER, NULL); + AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle2]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + EventsCorrect = RegRecPtr->DoubleBuffered == false && RegRecPtr->ActiveBufferIndex == 0; + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SEVERITY_ERROR && EventsCorrect, "CFE_TBL_Register", + "Register a double buffered table with pool buffer error"); + CFE_TBL_Global.Handles[0].UsedFlag = true; } /* @@ -2525,75 +1993,58 @@ void Test_CFE_TBL_Register(void) void Test_CFE_TBL_Share(void) { int32 RtnCode; - bool EventsCorrect; + bool EventsCorrect; CFE_FS_Header_t StdFileHeader; CFE_TBL_File_Hdr_t TblFileHeader; UtPrintf("Begin Test Share"); StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; /* Test response to an invalid application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table2"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_Share", + RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table2"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_Share", "Invalid application ID"); /* Test response when table name is not in the registry */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.NOT_Table2"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, - "CFE_TBL_Share", + RtnCode = CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.NOT_Table2"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_Share", "Table name not in registry"); /* Test response when there are no available table handles */ UT_InitData(); - RtnCode = CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.UT_Table3"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_HANDLES_FULL && EventsCorrect, - "CFE_TBL_Share", + RtnCode = CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.UT_Table3"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_HANDLES_FULL && EventsCorrect, "CFE_TBL_Share", "No available table handles"); /* Test unregistering tables to free handles */ UT_InitData(); - RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2); + RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", - "Free handles"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Free handles"); /* Test unregister response to a PutPoolBuf error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2 + 1); + RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2 + 1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", - "PutPoolBuf error"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "PutPoolBuf error"); /* Test successful first load of a table */ UT_InitData(); - strncpy(StdFileHeader.Description, "FS header description", - sizeof(StdFileHeader.Description) - 1); + strncpy(StdFileHeader.Description, "FS header description", sizeof(StdFileHeader.Description) - 1); StdFileHeader.Description[sizeof(StdFileHeader.Description) - 1] = '\0'; - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table4", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table4", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); @@ -2601,32 +2052,24 @@ void Test_CFE_TBL_Share(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(3, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(3, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "First load of a table - successful"); /* Test successful share of a table that has not been loaded once */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table3"); + RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table3"); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Share", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", "Share of table that has not been loaded - successful"); /* Test successful share of a table that has been loaded once */ UT_InitData(); - RtnCode = CFE_TBL_Share(&App2TblHandle2, "ut_cfe_tbl.UT_Table4"); + RtnCode = CFE_TBL_Share(&App2TblHandle2, "ut_cfe_tbl.UT_Table4"); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Share", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", "Share of table that has been loaded - successful"); } @@ -2636,41 +2079,32 @@ void Test_CFE_TBL_Share(void) */ void Test_CFE_TBL_Unregister(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Unregister"); /* Test response to unregistering a table with an invalid handle */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UNREGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - (RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect), - "CFE_TBL_Unregister", + RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UNREGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, (RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect), "CFE_TBL_Unregister", "Invalid handle"); /* Unregister a shared table to make it unowned */ UT_InitData(); - RtnCode = CFE_TBL_Unregister(3); + RtnCode = CFE_TBL_Unregister(3); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Unregister shared table to make it unowned"); /* Test response to unregistering an unowned table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Unregister(App2TblHandle2); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_UNREGISTER_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_Unregister", + RtnCode = CFE_TBL_Unregister(App2TblHandle2); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UNREGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Unregister", "Unregister unowned table"); } @@ -2680,8 +2114,8 @@ void Test_CFE_TBL_Unregister(void) */ void Test_CFE_TBL_NotifyByMessage(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Notify by Message"); @@ -2691,22 +2125,16 @@ void Test_CFE_TBL_NotifyByMessage(void) UT_SetAppID(UT_TBL_APPID_1); UT_ResetPoolBufferIndex(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "NBMsg_Tbl", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); + RtnCode = CFE_TBL_Register(&App1TblHandle1, "NBMsg_Tbl", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Notify by message (setup)"); /* Test successful notification */ UT_InitData(); EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_NotifyByMessage", + RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_NotifyByMessage", "Notify - success"); /* Test response to notification request when the application doesn't @@ -2714,22 +2142,18 @@ void Test_CFE_TBL_NotifyByMessage(void) */ UT_InitData(); CFE_TBL_Global.Registry[0].OwnerAppId = CFE_TBL_NOT_OWNED; - EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_NotifyByMessage", + EventsCorrect = (UT_GetNumEventsSent() == 0); + RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_NotifyByMessage", "Notify - no access"); /* Test response to notification request when the application ID is bad */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_NotifyByMessage", - "Notify - bad application ID"); + RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, + "CFE_TBL_NotifyByMessage", "Notify - bad application ID"); } /* @@ -2738,60 +2162,48 @@ void Test_CFE_TBL_NotifyByMessage(void) */ void Test_CFE_TBL_Load(void) { - CFE_TBL_Handle_t DumpOnlyTblHandle; - CFE_TBL_Handle_t UserDefTblHandle; - UT_Table1_t TestTable1; - int32 RtnCode; - bool EventsCorrect; - CFE_FS_Header_t StdFileHeader; - CFE_TBL_File_Hdr_t TblFileHeader; - UT_Table1_t *App2TblPtr; - CFE_TBL_RegistryRec_t *RegRecPtr; + CFE_TBL_Handle_t DumpOnlyTblHandle; + CFE_TBL_Handle_t UserDefTblHandle; + UT_Table1_t TestTable1; + int32 RtnCode; + bool EventsCorrect; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_File_Hdr_t TblFileHeader; + UT_Table1_t * App2TblPtr; + CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; UtPrintf("Begin Test Load"); StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; /* Set up for table load test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); UT_ResetTableRegistry(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, + RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Load setup - single buffered table"); /* Test attempt to perform partial INITIAL load */ UT_InitData(); - strncpy(StdFileHeader.Description,"Test description", - sizeof(StdFileHeader.Description) - 1); + strncpy(StdFileHeader.Description, "Test description", sizeof(StdFileHeader.Description) - 1); StdFileHeader.Description[sizeof(StdFileHeader.Description) - 1] = '\0'; - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - UT_TBL_SetupHeader(&TblFileHeader, 1, sizeof(UT_Table1_t)-1); + UT_TBL_SetupHeader(&TblFileHeader, 1, sizeof(UT_Table1_t) - 1); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, - CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PARTIAL_LOAD_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_PARTIAL_LOAD && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PARTIAL_LOAD_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_PARTIAL_LOAD && EventsCorrect, "CFE_TBL_Load", "Attempt to perform partial INITIAL load"); /* Test attempt to perform partial INITIAL load with table already @@ -2801,118 +2213,83 @@ void Test_CFE_TBL_Load(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RegRecPtr->UserDefAddr = true; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr->UserDefAddr = true; RegRecPtr->TableLoadedOnce = true; - RtnCode = CFE_TBL_Load(App1TblHandle1, - CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PARTIAL_LOAD_ERR_EID) == false && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PARTIAL_LOAD_ERR_EID) == false && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Attempt to perform partial INITIAL load with table already loaded"); /* Test attempt to load a file that has incompatible data for the * specified table */ UT_InitData(); - strncpy(StdFileHeader.Description,"Test description", - sizeof(StdFileHeader.Description) - 1); + strncpy(StdFileHeader.Description, "Test description", sizeof(StdFileHeader.Description) - 1); StdFileHeader.Description[sizeof(StdFileHeader.Description) - 1] = '\0'; - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.NotUT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.NotUT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, - CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, "CFE_TBL_Load", "File data incompatible with table"); /* Set up for double buffer table load test */ /* Test setup - register a double buffered table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&App1TblHandle2, - "UT_Table2x", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, + RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table2x", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "CFE_TBL_Load setup - register a double buffered table"); /* Test attempt to load a file that has incompatible data for the * specified double buffered table that is already loaded */ UT_InitData(); - strncpy(StdFileHeader.Description,"Test description", - sizeof(StdFileHeader.Description) - 1); + strncpy(StdFileHeader.Description, "Test description", sizeof(StdFileHeader.Description) - 1); StdFileHeader.Description[sizeof(StdFileHeader.Description) - 1] = '\0'; - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.NotUT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.NotUT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RegRecPtr->DoubleBuffered = true; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr->DoubleBuffered = true; RegRecPtr->TableLoadedOnce = true; - RtnCode = CFE_TBL_Load(App1TblHandle2, - CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, "CFE_TBL_Load", "File data incompatible with table, double buffered, already " - "loaded"); + "loaded"); /* Test performing a Load from memory */ UT_InitData(); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", - "Perform load from memory"); + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Perform load from memory"); /* Test attempt to load from an illegal source type (not a file or * from memory) */ UT_InitData(); - RtnCode = CFE_TBL_Load(App1TblHandle1, - (CFE_TBL_SrcEnum_t) 99, - &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TYPE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_ILLEGAL_SRC_TYPE && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, (CFE_TBL_SrcEnum_t)99, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TYPE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_ILLEGAL_SRC_TYPE && EventsCorrect, "CFE_TBL_Load", "Attempt to load from illegal source type"); /* Test failure of validation function on table load using a negative @@ -2920,12 +2297,9 @@ void Test_CFE_TBL_Load(void) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == -1 && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == -1 && EventsCorrect, "CFE_TBL_Load", "Fail validation function on table load (negative return code)"); /* Test failure of validation function on table load using a positive @@ -2933,127 +2307,88 @@ void Test_CFE_TBL_Load(void) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, 1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_VAL_ERR_EID) == true && - UT_GetNumEventsSent() == 2); - UT_Report(__FILE__, __LINE__, - RtnCode == -1 && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_VAL_ERR_EID) == true && UT_GetNumEventsSent() == 2); + UT_Report(__FILE__, __LINE__, RtnCode == -1 && EventsCorrect, "CFE_TBL_Load", "Fail validation function on table load (positive return code)"); /* Test attempt to load a table with a bad handle */ UT_InitData(); - RtnCode = CFE_TBL_Load(CFE_PLATFORM_TBL_MAX_NUM_HANDLES, - CFE_TBL_SRC_ADDRESS, - &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_HANDLE_ACCESS_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(CFE_PLATFORM_TBL_MAX_NUM_HANDLES, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_HANDLE_ACCESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_Load", "Attempt to load table with bad handle"); /* Test attempt to load a dump-only table */ /* a. Test setup */ UT_InitData(); - RtnCode = CFE_TBL_Register(&DumpOnlyTblHandle, "UT_Table2", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DUMP_ONLY, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&DumpOnlyTblHandle, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DUMP_ONLY, NULL); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Attempt to load a dump-only table (setup)"); /* b. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Load(DumpOnlyTblHandle, - CFE_TBL_SRC_ADDRESS, - &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_DUMP_ONLY && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(DumpOnlyTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUMP_ONLY && EventsCorrect, "CFE_TBL_Load", "Attempt to load a dump-only table"); /* Test attempt to load a dump-only table with the table already loaded */ UT_InitData(); - AccessDescPtr = &CFE_TBL_Global.Handles[DumpOnlyTblHandle]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RegRecPtr->UserDefAddr = true; + AccessDescPtr = &CFE_TBL_Global.Handles[DumpOnlyTblHandle]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr->UserDefAddr = true; RegRecPtr->TableLoadedOnce = true; - RtnCode = CFE_TBL_Load(DumpOnlyTblHandle, - CFE_TBL_SRC_ADDRESS, - &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_DUMP_ONLY && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(DumpOnlyTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUMP_ONLY && EventsCorrect, "CFE_TBL_Load", "Attempt to load a dump-only table with table already loaded"); /* Test specifying a table address for a user defined table */ /* a. Test setup */ UT_InitData(); - RtnCode = CFE_TBL_Register(&UserDefTblHandle, - "UT_Table3", sizeof(UT_Table1_t), - CFE_TBL_OPT_USR_DEF_ADDR, NULL); + RtnCode = CFE_TBL_Register(&UserDefTblHandle, "UT_Table3", sizeof(UT_Table1_t), CFE_TBL_OPT_USR_DEF_ADDR, NULL); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Specify table address for a user defined table"); /* Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Load(UserDefTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(UserDefTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Specify table address for a user defined table"); /* Test attempt to load a locked shared table */ /* a. Test setup part 1 */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); + RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Share", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", "Attempt to load locked shared table (setup part 1)"); /* a. Test setup part 2 */ - RtnCode = CFE_TBL_GetAddress((void **) &App2TblPtr, App2TblHandle1); + RtnCode = CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", "Attempt to load locked shared table (setup part 2)"); /* c. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); EventsCorrect = (UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_TABLE_LOCKED && EventsCorrect, - "CFE_TBL_Load", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_TABLE_LOCKED && EventsCorrect, "CFE_TBL_Load", "Attempt to load locked shared table"); /* d. Test cleanup */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_ReleaseAddress(App2TblHandle1); + RtnCode = CFE_TBL_ReleaseAddress(App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_ReleaseAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", "Attempt to load locked shared table (cleanup)"); } @@ -3063,8 +2398,8 @@ void Test_CFE_TBL_Load(void) */ void Test_CFE_TBL_GetAddress(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UT_Table1_t *App3TblPtr; UT_Table1_t *App2TblPtr; @@ -3075,52 +2410,41 @@ void Test_CFE_TBL_GetAddress(void) */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_3); - RtnCode = CFE_TBL_GetAddress((void **) &App3TblPtr, App2TblHandle1); + RtnCode = CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_GetAddress", "Application does not have access to table"); /* Test attempt to get the address with an invalid application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_GetAddress((void **) &App3TblPtr, App2TblHandle1); + RtnCode = CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_GetAddress", "Invalid application ID"); /* Test attempt to get the address with an invalid handle */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress((void **) &App3TblPtr, - CFE_PLATFORM_TBL_MAX_NUM_HANDLES); + RtnCode = CFE_TBL_GetAddress((void **)&App3TblPtr, CFE_PLATFORM_TBL_MAX_NUM_HANDLES); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_GetAddress", "Invalid table handle"); /* Attempt to get the address of an unregistered (unowned) table */ /* a. Test setup */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Unregister(App1TblHandle1); + RtnCode = CFE_TBL_Unregister(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Attempt to get address of unregistered table (setup)"); /* b. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_GetAddress((void **) &App2TblPtr, App2TblHandle1); + RtnCode = CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_UNREGISTERED && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_UNREGISTERED && EventsCorrect, "CFE_TBL_GetAddress", "Attempt to get address of unregistered table"); } @@ -3130,8 +2454,8 @@ void Test_CFE_TBL_GetAddress(void) */ void Test_CFE_TBL_ReleaseAddress(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Release Address"); @@ -3140,25 +2464,18 @@ void Test_CFE_TBL_ReleaseAddress(void) UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); UT_ResetTableRegistry(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, + RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Attempt to release address with invalid application ID (setup)"); /* b. Perform test */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle1); + RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_GetAddress", "Attempt to release address with invalid application ID"); } @@ -3168,56 +2485,47 @@ void Test_CFE_TBL_ReleaseAddress(void) */ void Test_CFE_TBL_GetAddresses(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Get Addresses"); /* Test setup - register a double buffered table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&App1TblHandle2, - "UT_Table2", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, + RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "CFE_TBL_GetAddresses setup - register a double buffered table"); /* b. Perform test */ UT_InitData(); /* Test getting the addresses of two tables that have not been loaded */ - ArrayOfHandles[0] = App1TblHandle1; - ArrayOfHandles[1] = App1TblHandle2; + ArrayOfHandles[0] = App1TblHandle1; + ArrayOfHandles[1] = App1TblHandle2; ArrayOfPtrsToTblPtrs[0] = &Tbl1Ptr; ArrayOfPtrsToTblPtrs[1] = &Tbl2Ptr; - RtnCode = CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles); + RtnCode = CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles); EventsCorrect = (UT_GetNumEventsSent() == 0); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect && - Tbl1Ptr != NULL && Tbl2Ptr != NULL, + RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect && Tbl1Ptr != NULL && Tbl2Ptr != NULL, "CFE_TBL_GetAddresses", "Get addresses of two tables (neither of which have " - "been loaded)"); + "been loaded)"); /* Test attempt to get addresses of tables that the application is not * allowed to see */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles); + RtnCode = CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_Validate", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Validate", "Attempt to get addresses of tables that application is not " - "allowed to see"); + "allowed to see"); } /* @@ -3226,21 +2534,19 @@ void Test_CFE_TBL_GetAddresses(void) */ void Test_CFE_TBL_ReleaseAddresses(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Release Addresses"); /* Test response to releasing two tables that have not been loaded */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_ReleaseAddresses(2, ArrayOfHandles); + RtnCode = CFE_TBL_ReleaseAddresses(2, ArrayOfHandles); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, - "CFE_TBL_ReleaseAddresses", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, "CFE_TBL_ReleaseAddresses", "Release addresses of two tables (neither of which have " - "been loaded)"); + "been loaded)"); } /* @@ -3248,8 +2554,8 @@ void Test_CFE_TBL_ReleaseAddresses(void) */ void Test_CFE_TBL_Validate(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Validate"); @@ -3258,25 +2564,20 @@ void Test_CFE_TBL_Validate(void) */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_Validate(App1TblHandle1); + RtnCode = CFE_TBL_Validate(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_Validate", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Validate", "Attempt to validate table that application is not allowed " - "to see"); + "to see"); /* Test response to attempt to validate a table when no validation is * pending */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Validate(App1TblHandle1); + RtnCode = CFE_TBL_Validate(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_NO_VALIDATION_PENDING && - EventsCorrect, - "CFE_TBL_Validate", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_NO_VALIDATION_PENDING && EventsCorrect, "CFE_TBL_Validate", "Attempt to validate table when no validation is pending"); } @@ -3286,41 +2587,36 @@ void Test_CFE_TBL_Validate(void) */ void Test_CFE_TBL_Manage(void) { - int32 RtnCode; - bool EventsCorrect; - int32 RegIndex; - CFE_TBL_RegistryRec_t *RegRecPtr; - CFE_TBL_LoadBuff_t *WorkingBufferPtr; - UT_Table1_t TestTable1; - UT_Table1_t *App2TblPtr; + int32 RtnCode; + bool EventsCorrect; + int32 RegIndex; + CFE_TBL_RegistryRec_t * RegRecPtr; + CFE_TBL_LoadBuff_t * WorkingBufferPtr; + UT_Table1_t TestTable1; + UT_Table1_t * App2TblPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; - CFE_TBL_Handle_t AccessIterator; + CFE_TBL_Handle_t AccessIterator; UtPrintf("Begin Test Manage"); /* Test response to attempt to manage a table that doesn't need managing */ UT_InitData(); - RtnCode = CFE_TBL_Manage(App1TblHandle1); + RtnCode = CFE_TBL_Manage(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Manage", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Manage", "Manage table that doesn't need managing"); /* Test response to attempt to load while a load is in progress */ UT_InitData(); /* "Load" image into inactive buffer for table */ - RegIndex = CFE_TBL_FindTableInRegistry("ut_cfe_tbl.UT_Table1"); + RegIndex = CFE_TBL_FindTableInRegistry("ut_cfe_tbl.UT_Table1"); RegRecPtr = &CFE_TBL_Global.Registry[RegIndex]; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); + RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_IN_PROGRESS_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_LOAD_IN_PROGRESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_IN_PROGRESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_LOAD_IN_PROGRESS && EventsCorrect, "CFE_TBL_Load", "Attempt to load while a load is in progress"); /* Test response to processing an unsuccessful validation request on @@ -3329,26 +2625,24 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 0; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table1", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table1", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; - RegRecPtr->ValidateInactiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; + RegRecPtr->ValidateInactiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == -1, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, "CFE_TBL_Manage", "Manage table that has a failed validation pending on " - "inactive buffer (valid function return code)"); + "inactive buffer (valid function return code)"); /* Test response to processing an unsuccessful validation request on * inactive buffer ; validation function return code is invalid @@ -3356,26 +2650,24 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 0; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table1", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table1", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; - RegRecPtr->ValidateInactiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; + RegRecPtr->ValidateInactiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, 1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == 1, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 1, "CFE_TBL_Manage", "Manage table that has a failed validation pending on " - "inactive buffer (invalid function return code)"); + "inactive buffer (invalid function return code)"); /* Test response to processing a successful validation request on an * inactive buffer @@ -3383,26 +2675,24 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 1; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table1", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table1", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; - RegRecPtr->ValidateInactiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; + RegRecPtr->ValidateInactiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == 0, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, "CFE_TBL_Manage", "Manage table that has a successful validation pending on " - "an inactive buffer"); + "an inactive buffer"); /* Test response to processing an unsuccessful validation request on an * active buffer @@ -3410,26 +2700,24 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 0; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table1", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table1", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; - RegRecPtr->ValidateActiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; + RegRecPtr->ValidateActiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == -1, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, "CFE_TBL_Manage", "Manage table that has an unsuccessful validation pending on " - "an active buffer"); + "an active buffer"); /* Test response to processing an unsuccessful validation request on * an active buffer @@ -3437,26 +2725,24 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 0; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table1", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table1", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; - RegRecPtr->ValidateActiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; + RegRecPtr->ValidateActiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, 1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == 1, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 1, "CFE_TBL_Manage", "Manage table that has an unsuccessful validation pending " - "on an active buffer"); + "on an active buffer"); /* Test response to processing a successful validation request on an * active buffer @@ -3464,44 +2750,38 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 1; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table1", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table1", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; - RegRecPtr->ValidateActiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; + RegRecPtr->ValidateActiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == 0, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, "CFE_TBL_Manage", "Manage table that has a successful validation pending on " - "an active buffer"); + "an active buffer"); /* Test response to processing an update request on a locked table */ /* a. Test setup - part 1 */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); + RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Share", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", "Process an update request on a locked table (setup - part 1)"); /* a. Test setup - part 2 */ - RtnCode = CFE_TBL_GetAddress((void **) &App2TblPtr, App2TblHandle1); + RtnCode = CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, "CFE_TBL_GetAddress", "Process an update request on a locked table (setup - part 2)"); /* c. Perform test */ @@ -3510,26 +2790,22 @@ void Test_CFE_TBL_Manage(void) /* Configure table for update */ RegRecPtr->LoadPending = true; - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_TABLE_LOCKED && EventsCorrect, - "CFE_TBL_Manage", + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_TABLE_LOCKED && EventsCorrect, "CFE_TBL_Manage", "Process an update request on a locked table"); /* Save the previous table's information for a subsequent test */ - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; AccessIterator = RegRecPtr->HeadOfAccessList; /* Test unlocking a table by releasing the address */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_ReleaseAddress(App2TblHandle1); + RtnCode = CFE_TBL_ReleaseAddress(App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, - "CFE_TBL_ReleaseAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, "CFE_TBL_ReleaseAddress", "Release address to unlock shared table"); /* Test response to processing an update request on a single @@ -3540,13 +2816,9 @@ void Test_CFE_TBL_Manage(void) /* Configure table for Update */ RegRecPtr->LoadPending = true; - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_UPDATE_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, - "CFE_TBL_Manage", + RtnCode = CFE_TBL_Manage(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UPDATE_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_Manage", "Process an update request on a single buffered table"); /* Test response to processing an unsuccessful validation request on an @@ -3557,51 +2829,47 @@ void Test_CFE_TBL_Manage(void) /* Reset the current table entry pointer to a previous table in order to * exercise the path where no buffer is available */ - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - CFE_TBL_Global.Handles[AccessIterator].NextLink = RegRecPtr->HeadOfAccessList; - CFE_TBL_Global.Handles[AccessIterator].AppId = UT_TBL_APPID_2; - RegRecPtr->HeadOfAccessList = AccessIterator; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + CFE_TBL_Global.Handles[AccessIterator].NextLink = RegRecPtr->HeadOfAccessList; + CFE_TBL_Global.Handles[AccessIterator].AppId = UT_TBL_APPID_2; + RegRecPtr->HeadOfAccessList = AccessIterator; CFE_TBL_Global.Handles[AccessIterator].BufferIndex = 1; - CFE_TBL_Global.Handles[AccessIterator].LockFlag = true; + CFE_TBL_Global.Handles[AccessIterator].LockFlag = true; /* Attempt to "load" image into inactive buffer for table */ - RegIndex = CFE_TBL_FindTableInRegistry("ut_cfe_tbl.UT_Table2"); + RegIndex = CFE_TBL_FindTableInRegistry("ut_cfe_tbl.UT_Table2"); RegRecPtr = &CFE_TBL_Global.Registry[RegIndex]; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_BUFFER_AVAIL, - "CFE_TBL_GetWorkingBuffer", + RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_BUFFER_AVAIL, "CFE_TBL_GetWorkingBuffer", "No buffer available"); /* Reset the table information for subsequent tests */ CFE_TBL_Global.Handles[AccessIterator].BufferIndex = 1; - CFE_TBL_Global.Handles[AccessIterator].LockFlag = false; + CFE_TBL_Global.Handles[AccessIterator].LockFlag = false; /* Successfully "load" image into inactive buffer for table */ RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 0; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table2", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table2", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; - RegRecPtr->ValidateInactiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; + RegRecPtr->ValidateInactiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle2); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == -1, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, "CFE_TBL_Manage", "Manage table that has a failed validation pending on an " - "inactive buffer (double buffered)"); + "inactive buffer (double buffered)"); /* Test successfully processing a validation request on an inactive buffer * (double buffered) @@ -3609,26 +2877,24 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 1; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table2", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table2", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; - RegRecPtr->ValidateInactiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = false; + RegRecPtr->ValidateInactiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle2); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == 0, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, "CFE_TBL_Manage", "Manage table that has a successful validation pending on an " - "inactive buffer (double buffered)"); + "inactive buffer (double buffered)"); /* Test processing an unsuccessful validation request on an active buffer * (double buffered) @@ -3636,26 +2902,24 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 0; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table2", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table2", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; - RegRecPtr->ValidateActiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; + RegRecPtr->ValidateActiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle2); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == -1, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, "CFE_TBL_Manage", "Manage table that has an unsuccessful validation pending on an " - "active buffer (double buffered)"); + "active buffer (double buffered)"); /* Test successfully processing a validation request on active buffer * (double buffered) @@ -3663,51 +2927,47 @@ void Test_CFE_TBL_Manage(void) UT_InitData(); /* Configure table for validation */ - CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; + CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; CFE_TBL_Global.ValidationResults[0].Result = 1; - strncpy(CFE_TBL_Global.ValidationResults[0].TableName, - "ut_cfe_tbl.UT_Table2", sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); + strncpy(CFE_TBL_Global.ValidationResults[0].TableName, "ut_cfe_tbl.UT_Table2", + sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1); CFE_TBL_Global.ValidationResults[0].TableName[sizeof(CFE_TBL_Global.ValidationResults[0].TableName) - 1] = '\0'; - CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; - CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; - RegRecPtr->ValidateActiveIndex = 0; + CFE_TBL_Global.ValidationResults[0].CrcOfTable = 0; + CFE_TBL_Global.ValidationResults[0].ActiveBuffer = true; + RegRecPtr->ValidateActiveIndex = 0; /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && - UT_GetNumEventsSent() == 1); + RtnCode = CFE_TBL_Manage(App1TblHandle2); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - CFE_TBL_Global.ValidationResults[0].Result == 0, + RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, "CFE_TBL_Manage", "Manage table that has a successful validation pending on an " - "active buffer (double buffered)"); + "active buffer (double buffered)"); /* Test successfully processing a table dump request */ UT_InitData(); - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); - CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PENDING; + RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); + CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PENDING; CFE_TBL_Global.DumpControlBlocks[0].RegRecPtr = RegRecPtr; /* Save the name of the desired dump filename, table name, and size for * later */ CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr = WorkingBufferPtr; - strncpy(CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr->DataSource, - "MyDumpFilename", sizeof(CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr->DataSource) - 1); - CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr->DataSource[ - sizeof(CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr->DataSource) - 1] = 0; + strncpy(CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr->DataSource, "MyDumpFilename", + sizeof(CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr->DataSource) - 1); + CFE_TBL_Global.DumpControlBlocks[0] + .DumpBufferPtr->DataSource[sizeof(CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr->DataSource) - 1] = 0; strncpy(CFE_TBL_Global.DumpControlBlocks[0].TableName, "ut_cfe_tbl.UT_Table2", sizeof(CFE_TBL_Global.DumpControlBlocks[0].TableName) - 1); CFE_TBL_Global.DumpControlBlocks[0].TableName[sizeof(CFE_TBL_Global.DumpControlBlocks[0].TableName) - 1] = 0; CFE_TBL_Global.DumpControlBlocks[0].Size = RegRecPtr->Size; - RegRecPtr->DumpControlIndex = 0; - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Manage", + RegRecPtr->DumpControlIndex = 0; + RtnCode = CFE_TBL_Manage(App1TblHandle2); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Manage", "Manage table that has a dump request pending"); } @@ -3716,8 +2976,8 @@ void Test_CFE_TBL_Manage(void) */ void Test_CFE_TBL_Update(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Update"); @@ -3726,37 +2986,30 @@ void Test_CFE_TBL_Update(void) */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Update(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UPDATE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_Update", + RtnCode = CFE_TBL_Update(App1TblHandle1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UPDATE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Update", "Process an update on a single buffered table " - "without privileges"); + "without privileges"); /* Test processing an update on a single buffered table when no update * is pending */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Update(App1TblHandle1); + RtnCode = CFE_TBL_Update(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_NO_UPDATE_PENDING && EventsCorrect, - "CFE_TBL_Update", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_NO_UPDATE_PENDING && EventsCorrect, "CFE_TBL_Update", "Process an update on a single buffered table when no update " - "is pending"); + "is pending"); /* Test processing an update on an application with a bad ID */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_Update(App1TblHandle1); + RtnCode = CFE_TBL_Update(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_Update", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Update", "Bad application ID"); } @@ -3765,8 +3018,8 @@ void Test_CFE_TBL_Update(void) */ void Test_CFE_TBL_GetStatus(void) { - int32 RtnCode; - bool EventsCorrect; + int32 RtnCode; + bool EventsCorrect; UtPrintf("Begin Test Get Status"); @@ -3775,26 +3028,22 @@ void Test_CFE_TBL_GetStatus(void) */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_GetStatus(App1TblHandle1); + RtnCode = CFE_TBL_GetStatus(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_GetStatus", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_GetStatus", "Attempt to get status on a table that the application is not " - "allowed to see"); + "allowed to see"); /* Test response to an attempt to dump the buffer on a table that the * application is not allowed to see */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_DumpToBuffer(App1TblHandle1); + RtnCode = CFE_TBL_DumpToBuffer(App1TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, - "CFE_TBL_GetStatus", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_GetStatus", "Attempt to to dump the buffer on a table that the application " - "is not allowed to see"); + "is not allowed to see"); } /* @@ -3803,7 +3052,7 @@ void Test_CFE_TBL_GetStatus(void) void Test_CFE_TBL_GetInfo(void) { int32 RtnCode; - bool EventsCorrect; + bool EventsCorrect; CFE_TBL_Info_t TblInfo; UtPrintf("Begin Test Get Info"); @@ -3811,20 +3060,16 @@ void Test_CFE_TBL_GetInfo(void) /* Test successfully getting information on a table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table1"); + RtnCode = CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table1"); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_GetInfo", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_GetInfo", "Get information on UT_Table1"); /* Test response to attempt to get information on a non-existent table */ UT_InitData(); - RtnCode = CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table_Not"); + RtnCode = CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table_Not"); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, - "CFE_TBL_GetInfo", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_GetInfo", "Get information on non-existent table"); } @@ -3834,24 +3079,24 @@ void Test_CFE_TBL_GetInfo(void) */ void Test_CFE_TBL_TblMod(void) { - int32 RtnCode; - int32 RtnCode2; - bool EventsCorrect; - CFE_FS_Header_t FileHeader; - UT_TempFile_t File; - uint32 Index; - CFE_TBL_Info_t TblInfo1; - UT_Table1_t *TblDataPtr; - char MyFilename[OS_MAX_PATH_LEN]; + int32 RtnCode; + int32 RtnCode2; + bool EventsCorrect; + CFE_FS_Header_t FileHeader; + UT_TempFile_t File; + uint32 Index; + CFE_TBL_Info_t TblInfo1; + UT_Table1_t * TblDataPtr; + char MyFilename[OS_MAX_PATH_LEN]; CFE_TBL_AccessDescriptor_t *AccessDescPtr; - CFE_TBL_RegistryRec_t *RegRecPtr; - CFE_TBL_Handle_t AccessIterator; + CFE_TBL_RegistryRec_t * RegRecPtr; + CFE_TBL_Handle_t AccessIterator; uint8 CDS_Data[sizeof(UT_Table1_t)]; UtPrintf("Begin Test Table Modified"); FileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - FileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + FileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; /* Test adding a TBL API for notifying table services that the table has * been updated by the application @@ -3863,29 +3108,23 @@ void Test_CFE_TBL_TblMod(void) UT_ResetPoolBufferIndex(); /* Test setup for CFE_TBL_Modified; register a non critical table */ - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_CRITICAL, NULL); + RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Add TBL API for notifying table services that table has " - "been updated by application (setup)"); + "been updated by application (setup)"); /* b. Perform test */ UT_ClearEventHistory(); /* Configure for successful file read to initialize table */ - strncpy(FileHeader.Description, "FS header description", - sizeof(FileHeader.Description) - 1); + strncpy(FileHeader.Description, "FS header description", sizeof(FileHeader.Description) - 1); FileHeader.Description[sizeof(FileHeader.Description) - 1] = '\0'; - FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - FileHeader.SubType = CFE_FS_SubType_TBL_IMG; - FileHeader.TimeSeconds = 1704; - FileHeader.TimeSubSeconds = 104; - strncpy(File.TblHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(File.TblHeader.TableName) - 1); + FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + FileHeader.SubType = CFE_FS_SubType_TBL_IMG; + FileHeader.TimeSeconds = 1704; + FileHeader.TimeSubSeconds = 104; + strncpy(File.TblHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(File.TblHeader.TableName) - 1); File.TblHeader.TableName[sizeof(File.TblHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&File.TblHeader, 0, sizeof(UT_Table1_t)); @@ -3905,10 +3144,8 @@ void Test_CFE_TBL_TblMod(void) UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); /* Perform load */ - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "MyInputFile"); - EventsCorrect = - (UT_GetNumEventsSent() == 1 && - UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true); + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "MyInputFile"); + EventsCorrect = (UT_GetNumEventsSent() == 1 && UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true); /* Modify the contents of the table */ CFE_TBL_GetAddress((void **)&TblDataPtr, App1TblHandle1); @@ -3917,23 +3154,20 @@ void Test_CFE_TBL_TblMod(void) /* Notify Table Services that the table has been modified */ UT_SetDataBuffer(UT_KEY(CFE_ES_CopyToCDS), CDS_Data, sizeof(CDS_Data), false); - RtnCode = CFE_TBL_Modified(App1TblHandle1); + RtnCode = CFE_TBL_Modified(App1TblHandle1); RtnCode2 = CFE_TBL_GetInfo(&TblInfo1, "ut_cfe_tbl.UT_Table1"); UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && - RtnCode2 == CFE_SUCCESS && - EventsCorrect && - TblInfo1.TimeOfLastUpdate.Seconds == - TblInfo1.TimeOfLastUpdate.Subseconds && - strcmp(TblInfo1.LastFileLoaded, "MyInputFile(*)") == 0 && - memcmp(CDS_Data, &File.TblData, sizeof(CDS_Data)) == 0, + RtnCode == CFE_SUCCESS && RtnCode2 == CFE_SUCCESS && EventsCorrect && + TblInfo1.TimeOfLastUpdate.Seconds == TblInfo1.TimeOfLastUpdate.Subseconds && + strcmp(TblInfo1.LastFileLoaded, "MyInputFile(*)") == 0 && + memcmp(CDS_Data, &File.TblData, sizeof(CDS_Data)) == 0, "CFE_TBL_Modified", "Add TBL API for notifying table services that table has " - "been updated by application"); + "been updated by application"); /* Save the previous table's information for a subsequent test */ - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; AccessIterator = RegRecPtr->HeadOfAccessList; /* Test response to adding a TBL API for notifying table services that @@ -3943,35 +3177,29 @@ void Test_CFE_TBL_TblMod(void) UT_InitData(); /* Register a non critical table */ - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table2", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT, NULL); + RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "Add TBL API for notifying table services that table has " - "been updated by application (setup)"); + "been updated by application (setup)"); /* Reset the current table entry pointer to a previous table in order to * exercise the path where one of the application IDs don't match */ - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; CFE_TBL_Global.Handles[AccessIterator].NextLink = RegRecPtr->HeadOfAccessList; - CFE_TBL_Global.Handles[AccessIterator].AppId = UT_TBL_APPID_2; - RegRecPtr->HeadOfAccessList = AccessIterator; + CFE_TBL_Global.Handles[AccessIterator].AppId = UT_TBL_APPID_2; + RegRecPtr->HeadOfAccessList = AccessIterator; /* Configure for successful file read to initialize table */ - strncpy(FileHeader.Description, "FS header description", - sizeof(FileHeader.Description) - 1); + strncpy(FileHeader.Description, "FS header description", sizeof(FileHeader.Description) - 1); FileHeader.Description[sizeof(FileHeader.Description) - 1] = '\0'; - FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - FileHeader.SubType = CFE_FS_SubType_TBL_IMG; - FileHeader.TimeSeconds = 1704; - FileHeader.TimeSubSeconds = 104; - strncpy(File.TblHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(File.TblHeader.TableName) - 1); + FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + FileHeader.SubType = CFE_FS_SubType_TBL_IMG; + FileHeader.TimeSeconds = 1704; + FileHeader.TimeSubSeconds = 104; + strncpy(File.TblHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(File.TblHeader.TableName) - 1); File.TblHeader.TableName[sizeof(File.TblHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&File.TblHeader, 0, sizeof(UT_Table1_t)); @@ -4008,9 +3236,7 @@ void Test_CFE_TBL_TblMod(void) /* Test response to an invalid handle */ RtnCode = CFE_TBL_Modified(CFE_TBL_BAD_TABLE_HANDLE); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, - "CFE_TBL_Modified", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_Modified", "Invalid table handle"); } @@ -4019,57 +3245,48 @@ void Test_CFE_TBL_TblMod(void) */ void Test_CFE_TBL_Internal(void) { - int32 RtnCode; - bool EventsCorrect; - CFE_TBL_LoadBuff_t *WorkingBufferPtr; - CFE_TBL_RegistryRec_t *RegRecPtr; + int32 RtnCode; + bool EventsCorrect; + CFE_TBL_LoadBuff_t * WorkingBufferPtr; + CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; - char FilenameLong[OS_MAX_PATH_LEN + 10]; - char Filename[OS_MAX_PATH_LEN]; - int32 i; - CFE_FS_Header_t StdFileHeader; - CFE_TBL_File_Hdr_t TblFileHeader; - osal_id_t FileDescriptor; - void *TblPtr; + char FilenameLong[OS_MAX_PATH_LEN + 10]; + char Filename[OS_MAX_PATH_LEN]; + int32 i; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_File_Hdr_t TblFileHeader; + osal_id_t FileDescriptor; + void * TblPtr; UtPrintf("Begin Test Internal"); - FileDescriptor = OS_OBJECT_ID_UNDEFINED; + FileDescriptor = OS_OBJECT_ID_UNDEFINED; StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; /* Test setup - register a double buffered table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&App1TblHandle2, - "UT_Table3", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER, + RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table3", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && - UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Register", + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", "CFE_TBL_GetWorkingBuffer setup - register a double buffered table"); /* Test successful initial load of double buffered table */ UT_InitData(); AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - strncpy(RegRecPtr->Name, "ut_cfe_tbl.UT_Table3", - sizeof(RegRecPtr->Name) - 1); + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + strncpy(RegRecPtr->Name, "ut_cfe_tbl.UT_Table3", sizeof(RegRecPtr->Name) - 1); RegRecPtr->Name[sizeof(RegRecPtr->Name) - 1] = '\0'; - RegRecPtr->TableLoadedOnce = false; - RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, true); - EventsCorrect = (UT_GetNumEventsSent() == 0); + RegRecPtr->TableLoadedOnce = false; + RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; + RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, true); + EventsCorrect = (UT_GetNumEventsSent() == 0); UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect && - WorkingBufferPtr == - &RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex], - "CFE_TBL_GetWorkingBuffer", - "Initial load of double buffered table"); + WorkingBufferPtr == &RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex], + "CFE_TBL_GetWorkingBuffer", "Initial load of double buffered table"); /* Test response to a single buffered table with a mutex sem take * failure @@ -4077,12 +3294,10 @@ void Test_CFE_TBL_Internal(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_ERROR); AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_GetWorkingBuffer", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_GetWorkingBuffer", "Single buffered table has mutex sem take failure"); /* Test CFE_TBL_LoadFromFile response to a file name that is too long */ @@ -4094,12 +3309,9 @@ void Test_CFE_TBL_Internal(void) } FilenameLong[i] = '\0'; /* Null terminate file name string */ - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, FilenameLong); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_FILENAME_LONG_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_FILENAME_TOO_LONG && EventsCorrect, - "CFE_TBL_LoadFromFile", + RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, FilenameLong); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_FILENAME_LONG_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILENAME_TOO_LONG && EventsCorrect, "CFE_TBL_LoadFromFile", "Filename too long"); /* Test CFE_TBL_LoadFromFile response to a file that's content is too large @@ -4108,24 +3320,19 @@ void Test_CFE_TBL_Internal(void) UT_InitData(); strncpy(Filename, FilenameLong, sizeof(Filename) - 1); Filename[sizeof(Filename) - 1] = '\0'; - strncpy(StdFileHeader.Description, "FS header description", - sizeof(StdFileHeader.Description) - 1); + strncpy(StdFileHeader.Description, "FS header description", sizeof(StdFileHeader.Description) - 1); StdFileHeader.Description[sizeof(StdFileHeader.Description) - 1] = '\0'; - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 1, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_FILE_TOO_LARGE && EventsCorrect, - "CFE_TBL_LoadFromFile", + RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_TOO_LARGE && EventsCorrect, "CFE_TBL_LoadFromFile", "File content too large (according to header)"); /* Test CFE_TBL_LoadFromFile response that's file content is too large @@ -4133,21 +3340,17 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 2, sizeof(UT_Table1_t)); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TOO_BIG_ERR_EID) == true && - UT_GetNumEventsSent() == 1); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TOO_BIG_ERR_EID) == true && UT_GetNumEventsSent() == 1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_FILE_TOO_LARGE && EventsCorrect, - "CFE_TBL_LoadFromFile", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_TOO_LARGE && EventsCorrect, "CFE_TBL_LoadFromFile", "File content too large (too much content)"); /* Test CFE_TBL_LoadFromFile response to the file content being @@ -4155,9 +3358,8 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); @@ -4165,12 +3367,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 2, sizeof(UT_Table1_t) - 1); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, 0); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_INCOMPLETE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_LOAD_INCOMPLETE && EventsCorrect, - "CFE_TBL_LoadFromFile", + RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_INCOMPLETE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_LOAD_INCOMPLETE && EventsCorrect, "CFE_TBL_LoadFromFile", "File content incomplete"); /* Test CFE_TBL_LoadFromFile response to the file being for the @@ -4178,60 +3377,49 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.NotUT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.NotUT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, - "CFE_TBL_LoadFromFile", + RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, "CFE_TBL_LoadFromFile", "File for wrong table"); /* Test CFE_TBL_LoadFromFile response to an OS open error */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_ACCESS_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_ACCESS && EventsCorrect, - "CFE_TBL_LoadFromFile", + RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_ACCESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_ACCESS && EventsCorrect, "CFE_TBL_LoadFromFile", "OS open error"); /* Test CFE_TBL_LoadFromFile response to a file too short warning */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)-1); + UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t) - 1); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); + RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_WARN_SHORT_FILE && EventsCorrect, - "CFE_TBL_LoadFromFile", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_SHORT_FILE && EventsCorrect, "CFE_TBL_LoadFromFile", "File too short warning"); /* Test CFE_TBL_ReadHeaders response to a failure reading the standard cFE @@ -4239,25 +3427,19 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)-1); + UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t) - 1); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); strncpy(Filename, "MyTestInputFilename", sizeof(Filename) - 1); Filename[sizeof(Filename) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(CFE_FS_ReadHeader), 1, sizeof(CFE_FS_Header_t) - 1); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, - &TblFileHeader, Filename); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_FILE_STD_HDR_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_STD_HEADER && EventsCorrect, - "CFE_TBL_ReadHeaders", + RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_STD_HDR_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_STD_HEADER && EventsCorrect, "CFE_TBL_ReadHeaders", "Failure reading standard cFE file header"); /* Test CFE_TBL_ReadHeaders response to a bad magic number in cFE @@ -4265,12 +3447,11 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID - 1; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; - TblFileHeader.Offset = 0; + TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; + TblFileHeader.Offset = 0; if (UT_Endianess == UT_LITTLE_ENDIAN) { @@ -4280,34 +3461,24 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, - &TblFileHeader, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TYPE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_BAD_CONTENT_ID && EventsCorrect, - "CFE_TBL_ReadHeaders", + RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TYPE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_CONTENT_ID && EventsCorrect, "CFE_TBL_ReadHeaders", "Bad magic number in cFE standard header"); /* Test CFE_TBL_ReadHeaders response to a wrong cFE file subtype */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG - 1; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG - 1; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)-1); + UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t) - 1); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, - &TblFileHeader, Filename); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_FILE_SUBTYPE_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_BAD_SUBTYPE_ID && EventsCorrect, - "CFE_TBL_ReadHeaders", + RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_SUBTYPE_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_SUBTYPE_ID && EventsCorrect, "CFE_TBL_ReadHeaders", "Wrong cFE file subType"); /* Test CFE_TBL_ReadHeaders response to a failure reading the cFE @@ -4315,23 +3486,17 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)-1); + UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t) - 1); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, sizeof(CFE_TBL_File_Hdr_t) - 1); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, - &TblFileHeader, Filename); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_FILE_TBL_HDR_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_TBL_HEADER && EventsCorrect, - "CFE_TBL_ReadHeaders", + RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TBL_HDR_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_TBL_HEADER && EventsCorrect, "CFE_TBL_ReadHeaders", "Failure reading cFE table header"); /* Test CFE_TBL_RemoveAccessLink response to a failure to put back the @@ -4339,51 +3504,41 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 2, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_RemoveAccessLink(App1TblHandle2); + RtnCode = CFE_TBL_RemoveAccessLink(App1TblHandle2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_RemoveAccessLink", - "Fail to put back memory buffer for double buffered table"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, + "CFE_TBL_RemoveAccessLink", "Fail to put back memory buffer for double buffered table"); /* EarlyInit - Table Registry Mutex Create Failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == OS_ERROR && EventsCorrect, - "CFE_TBL_EarlyInit", + UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_EarlyInit", "Table registry mutex create failure"); /* Test CFE_TBL_EarlyInit response to a work buffer mutex create failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 2, OS_ERROR); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == OS_ERROR && EventsCorrect, - "CFE_TBL_EarlyInit", + UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_EarlyInit", "Work buffer mutex create failure"); /* Test CFE_TBL_EarlyInit response to a memory pool create failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_PoolCreate), 1, CFE_ES_BAD_ARGUMENT); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_BAD_ARGUMENT && EventsCorrect, - "CFE_TBL_EarlyInit", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_BAD_ARGUMENT && EventsCorrect, "CFE_TBL_EarlyInit", "Memory pool create failure"); /* Test CFE_TBL_EarlyInit reponse to a get pool buffer failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_EarlyInit", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_EarlyInit", "Get pool buffer failure"); /* Test CFE_TBL_EarlyInit response where the CDS already exists but @@ -4392,33 +3547,26 @@ void Test_CFE_TBL_Internal(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RestoreFromCDS), 1, CFE_ES_CDS_BLOCK_CRC_ERR); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_EarlyInit", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", "CDS already exists but restore fails"); /* Test CFE_TBL_EarlyInit response when no CDS is available */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_NOT_IMPLEMENTED); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_EarlyInit", - "No CDS available"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", "No CDS available"); /* Test CFE_TBL_EarlyInit response to a failure to save a critical table * registry to the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_EarlyInit", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", "Fail to save critical table registry to CDS"); /* Reset, then register tables for subsequent tests */ @@ -4426,105 +3574,75 @@ void Test_CFE_TBL_Internal(void) UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); RtnCode = CFE_TBL_EarlyInit(); - UT_Report(__FILE__, __LINE__, - (RtnCode == CFE_SUCCESS), - "CFE_TBL_EarlyInit", - "Reset (setup - part 1)"); + UT_Report(__FILE__, __LINE__, (RtnCode == CFE_SUCCESS), "CFE_TBL_EarlyInit", "Reset (setup - part 1)"); /* b. Register critical single buffered table */ UT_InitData(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT | CFE_TBL_OPT_CRITICAL, - Test_CFE_TBL_ValidationFunc); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + CFE_TBL_OPT_DEFAULT | CFE_TBL_OPT_CRITICAL, Test_CFE_TBL_ValidationFunc); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Register", "Critical single buffered table (setup - part 2)"); /* c. Register critical double buffered table */ UT_InitData(); - RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table2", - sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER | CFE_TBL_OPT_CRITICAL, - Test_CFE_TBL_ValidationFunc); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS, - "CFE_TBL_Register", + RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table2", sizeof(UT_Table1_t), + CFE_TBL_OPT_DBL_BUFFER | CFE_TBL_OPT_CRITICAL, Test_CFE_TBL_ValidationFunc); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Register", "Critical double buffered table (setup - part 3)"); /* d. Perform an initial load on the critical single buffered table */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Critical single buffered table (setup - part 4)"); /* e. Update CDS for single buffered table */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Update CDS for single buffered table (setup - part 5)"); /* f. Perform an initial load on the critical double buffered table */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Critical single buffered table (setup - part 6)"); /* g. Update CDS for double buffered table */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); @@ -4532,14 +3650,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Update CDS for single buffered table (setup - part 7)"); /* Test CFE_TBL_GetWorkingBuffer response when both double buffered table @@ -4547,50 +3660,39 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_NO_WORK_BUFFERS_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_BUFFER_AVAIL && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_NO_WORK_BUFFERS_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_BUFFER_AVAIL && EventsCorrect, "CFE_TBL_Load", "Both double buffered table buffers locked"); /* Release buffer for error writing to CDS test */ /* a. Get table address */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); + RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", "Error writing to CDS (setup - part 1)"); /* b. Release table address */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); + RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_ReleaseAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", "Error writing to CDS (setup - part 2)"); /* c. Perform test */ UT_ClearEventHistory(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); @@ -4598,41 +3700,30 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - ((RtnCode == CFE_SUCCESS) && EventsCorrect), - "CFE_TBL_Load", - "Error writing to CDS"); + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, ((RtnCode == CFE_SUCCESS) && EventsCorrect), "CFE_TBL_Load", "Error writing to CDS"); /* Release buffer for error writing to CDS (second time) test */ /* a. Get table address */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); + RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", "Error writing to CDS second time (setup - part 1)"); /* b. Release table address */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); + RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_ReleaseAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", "Error writing to CDS second time (setup - part 2)"); /* c. Perform test */ UT_ClearEventHistory(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); @@ -4640,14 +3731,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 2, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Error writing to CDS (second time)"); /* Release buffer for failure to find the CDS handle in the CDS @@ -4655,28 +3741,23 @@ void Test_CFE_TBL_Internal(void) */ /* a. Get table address */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); + RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, - "CFE_TBL_GetAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", "Failure to find CDS handle in CDS registry (setup - part 1)"); /* b. Release table address */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); + RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_ReleaseAddress", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", "Failure to find CDS handle in CDS registry (setup - part 2)"); /* c. Perform test */ UT_ClearEventHistory(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); @@ -4685,24 +3766,19 @@ void Test_CFE_TBL_Internal(void) UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 2, CFE_ES_ERR_RESOURCEID_NOT_VALID); AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; for (i = 0; i < CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES; i++) { - if ( CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.CritReg[i].CDSHandle, RegRecPtr->CDSHandle) ) + if (CFE_RESOURCEID_TEST_EQUAL(CFE_TBL_Global.CritReg[i].CDSHandle, RegRecPtr->CDSHandle)) { CFE_TBL_Global.CritReg[i].CDSHandle = CFE_ES_CDSHANDLE_C(CFE_RESOURCEID_RESERVED); } } - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Failure to find CDS handle in CDS registry"); /* Test unregistering a shared table */ @@ -4711,47 +3787,38 @@ void Test_CFE_TBL_Internal(void) CFE_TBL_Global.CritReg[0].CDSHandle = RegRecPtr->CDSHandle; UT_SetAppID(UT_TBL_APPID_2); RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS, - "CFE_TBL_Share", - "Unregister shared table (setup)"); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Share", "Unregister shared table (setup)"); /* b. Perform test */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(App2TblHandle1); + RtnCode = CFE_TBL_Unregister(App2TblHandle1); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Unregister shared table"); /* Test successful application cleanup */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_PutPoolBuf), -1); - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - CFE_TBL_Global.DumpControlBlocks[3].State = CFE_TBL_DUMP_PENDING; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + CFE_TBL_Global.DumpControlBlocks[3].State = CFE_TBL_DUMP_PENDING; CFE_TBL_Global.DumpControlBlocks[3].RegRecPtr = RegRecPtr; - RegRecPtr->LoadInProgress = 1; - CFE_TBL_Global.LoadBuffs[1].Taken = true; + RegRecPtr->LoadInProgress = 1; + CFE_TBL_Global.LoadBuffs[1].Taken = true; CFE_TBL_CleanUpApp(UT_TBL_APPID_1); UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.DumpControlBlocks[3].State == - CFE_TBL_DUMP_FREE && - CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED) && - CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken == - false && - RegRecPtr->LoadInProgress == CFE_TBL_NO_LOAD_IN_PROGRESS, - "CFE_TBL_CleanUpApp", - "Execute clean up - success"); + CFE_TBL_Global.DumpControlBlocks[3].State == CFE_TBL_DUMP_FREE && + CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED) && + CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken == false && + RegRecPtr->LoadInProgress == CFE_TBL_NO_LOAD_IN_PROGRESS, + "CFE_TBL_CleanUpApp", "Execute clean up - success"); /* Test response to an attempt to use an invalid table handle */ UT_InitData(); StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&TblFileHeader, 0, sizeof(UT_Table1_t)); @@ -4759,13 +3826,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 2, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, - "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_HANDLE_ACCESS_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, - "CFE_TBL_Load", + RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_HANDLE_ACCESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_Load", "Attempt to use an invalid handle"); /* Test CFE_TBL_EarlyInit response where the CDS already exists and @@ -4773,11 +3836,9 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); - RtnCode = CFE_TBL_EarlyInit(); + RtnCode = CFE_TBL_EarlyInit(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_EarlyInit", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", "CDS already exists and restore succeeds"); /* Test CFE_TBL_CheckAccessRights response when the application ID matches @@ -4785,142 +3846,122 @@ void Test_CFE_TBL_Internal(void) */ UT_InitData(); CFE_TBL_Global.TableTaskAppId = UT_TBL_APPID_1; - RtnCode = CFE_TBL_CheckAccessRights(App2TblHandle1, UT_TBL_APPID_1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_EarlyInit", + RtnCode = CFE_TBL_CheckAccessRights(App2TblHandle1, UT_TBL_APPID_1); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", "Application ID matches table task application ID"); /* Test CFE_TBL_FindFreeRegistryEntry response when the registry entry is * not owned but is not at the end of the list */ UT_InitData(); - CFE_TBL_Global.Registry[0].OwnerAppId = CFE_TBL_NOT_OWNED; + CFE_TBL_Global.Registry[0].OwnerAppId = CFE_TBL_NOT_OWNED; CFE_TBL_Global.Registry[0].HeadOfAccessList = CFE_TBL_END_OF_LIST + 1; - RtnCode = CFE_TBL_FindFreeRegistryEntry(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == 1 && EventsCorrect, - "CFE_TBL_FindFreeRegistryEntry", + RtnCode = CFE_TBL_FindFreeRegistryEntry(); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == 1 && EventsCorrect, "CFE_TBL_FindFreeRegistryEntry", "Registry entry not owned but not at end of list"); /* Test CFE_TBL_LockRegistry response when an error occurs taking the mutex */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_ERROR); - RtnCode = CFE_TBL_LockRegistry(); + RtnCode = CFE_TBL_LockRegistry(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == OS_ERROR && EventsCorrect, - "CFE_TBL_LockRegistry", - "Mutex take error"); + UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_LockRegistry", "Mutex take error"); /* Test CFE_TBL_UnlockRegistry response when an error occurs giving the * mutex */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, OS_ERROR); - RtnCode = CFE_TBL_UnlockRegistry(); + RtnCode = CFE_TBL_UnlockRegistry(); EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == OS_ERROR && EventsCorrect, - "CFE_TBL_UnlockRegistry", - "Mutex give error"); + UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_UnlockRegistry", "Mutex give error"); /* Test CFE_TBL_LoadFromFile response to an invalid header length */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ReadHeader), 1, sizeof(CFE_FS_Header_t) - 1); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); + RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); EventsCorrect = (UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NO_STD_HEADER && EventsCorrect, - "CFE_TBL_LoadFromFile", + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_STD_HEADER && EventsCorrect, "CFE_TBL_LoadFromFile", "No standard header"); /* Test CFE_TBL_UpdateInternal response when an inactive buffer is ready to * be copied but a load is in progress */ UT_InitData(); - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RegRecPtr->LoadPending = true; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr->LoadPending = true; RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_INFO_NO_UPDATE_PENDING && EventsCorrect, - "CFE_TBL_UpdateInternal", + RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_NO_UPDATE_PENDING && EventsCorrect, "CFE_TBL_UpdateInternal", "Inactive buffer ready while load in progress"); /* Test CFE_TBL_UpdateInternal response when an inactive buffer is ready to * be copied but a load is in progress */ UT_InitData(); - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RegRecPtr->LoadPending = true; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr->LoadPending = true; RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - RegRecPtr->CriticalTable = false; + RegRecPtr->CriticalTable = false; RegRecPtr->DoubleBuffered = true; UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_UpdateInternal", + RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_UpdateInternal", "Active buffer ready, no load in progress, double buffered " - "non-critical table"); + "non-critical table"); /* Test CFE_TBL_UpdateInternal single buffer memcpy when * source and dest are not equal */ UT_InitData(); - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RegRecPtr->LoadPending = true; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr->LoadPending = true; RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; RegRecPtr->DoubleBuffered = false; - RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_UpdateInternal", + RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); + EventsCorrect = (UT_GetNumEventsSent() == 0); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_UpdateInternal", "Update single buffer table memcpy test with src != dest"); - + /* Test application cleanup where there are no dumped tables to delete and * the application doesn't own the table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_PutPoolBuf), -1); - CFE_TBL_Global.Handles[0].AppId = UT_TBL_APPID_1; - AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; - RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RegRecPtr->OwnerAppId = CFE_TBL_NOT_OWNED; - CFE_TBL_Global.DumpControlBlocks[3].State = CFE_TBL_DUMP_PENDING; + CFE_TBL_Global.Handles[0].AppId = UT_TBL_APPID_1; + AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle2]; + RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; + RegRecPtr->OwnerAppId = CFE_TBL_NOT_OWNED; + CFE_TBL_Global.DumpControlBlocks[3].State = CFE_TBL_DUMP_PENDING; CFE_TBL_Global.DumpControlBlocks[3].RegRecPtr = RegRecPtr; CFE_TBL_CleanUpApp(UT_TBL_APPID_1); UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.DumpControlBlocks[3].State == - CFE_TBL_DUMP_PENDING && - CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED), + CFE_TBL_Global.DumpControlBlocks[3].State == CFE_TBL_DUMP_PENDING && + CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED), "CFE_TBL_CleanUpApp", "Execute clean up - no dumped tables to delete, application " - "doesn't own table"); + "doesn't own table"); #if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) /* Test CFE_TBL_ReadHeaders response to an invalid spacecraft ID */ UT_InitData(); - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; StdFileHeader.SpacecraftID = -1; - StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.ProcessorID = CFE_PLATFORM_TBL_VALID_PRID_1; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; - TblFileHeader.Offset = 0; + TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; + TblFileHeader.Offset = 0; if (UT_Endianess == UT_LITTLE_ENDIAN) { @@ -4932,34 +3973,25 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); strncpy(Filename, "MyTestInputFilename", sizeof(Filename) - 1); Filename[sizeof(Filename) - 1] = '\0'; - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, - &TblFileHeader, Filename); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_SPACECRAFT_ID_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_BAD_SPACECRAFT_ID && EventsCorrect, - "CFE_TBL_ReadHeaders", + RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SPACECRAFT_ID_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_SPACECRAFT_ID && EventsCorrect, "CFE_TBL_ReadHeaders", "Invalid spacecraft ID"); #else - UT_Report(__FILE__, __LINE__, - true, - "CFE_TBL_ReadHeaders", - "*Not tested* Invalid spacecraft ID "); + UT_Report(__FILE__, __LINE__, true, "CFE_TBL_ReadHeaders", "*Not tested* Invalid spacecraft ID "); #endif #if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) /* Test CFE_TBL_ReadHeaders response to an invalid processor ID */ UT_InitData(); - StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; - StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; + StdFileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; + StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; StdFileHeader.SpacecraftID = CFE_PLATFORM_TBL_VALID_SCID_1; - StdFileHeader.ProcessorID = -1; - strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", - sizeof(TblFileHeader.TableName) - 1); + StdFileHeader.ProcessorID = -1; + strncpy(TblFileHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(TblFileHeader.TableName) - 1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; - TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; - TblFileHeader.Offset = 0; + TblFileHeader.NumBytes = sizeof(UT_Table1_t) - 1; + TblFileHeader.Offset = 0; if (UT_Endianess == UT_LITTLE_ENDIAN) { @@ -4971,20 +4003,12 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); strncpy(Filename, "MyTestInputFilename", sizeof(Filename) - 1); Filename[sizeof(Filename) - 1] = '\0'; - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, - &TblFileHeader, Filename); - EventsCorrect = - (UT_EventIsInHistory(CFE_TBL_PROCESSOR_ID_ERR_EID) == true && - UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_BAD_PROCESSOR_ID && EventsCorrect, - "CFE_TBL_ReadHeaders", + RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); + EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PROCESSOR_ID_ERR_EID) == true && UT_GetNumEventsSent() == 1); + UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_PROCESSOR_ID && EventsCorrect, "CFE_TBL_ReadHeaders", "Invalid processor ID"); #else - UT_Report(__FILE__, __LINE__, - true, - "CFE_TBL_ReadHeaders", - "*Not tested* Invalid processor ID "); + UT_Report(__FILE__, __LINE__, true, "CFE_TBL_ReadHeaders", "*Not tested* Invalid processor ID "); #endif } diff --git a/modules/tbl/ut-coverage/tbl_UT.h b/modules/tbl/ut-coverage/tbl_UT.h index a5f6fde71..6d3d6dd82 100644 --- a/modules/tbl/ut-coverage/tbl_UT.h +++ b/modules/tbl/ut-coverage/tbl_UT.h @@ -69,7 +69,6 @@ typedef struct UT_Table1_t TblData; } UT_TempFile_t; - /* TBL unit test functions */ /*****************************************************************************/ diff --git a/modules/time/fsw/inc/cfe_time_events.h b/modules/time/fsw/inc/cfe_time_events.h index 389ac8673..20c3c5f20 100644 --- a/modules/time/fsw/inc/cfe_time_events.h +++ b/modules/time/fsw/inc/cfe_time_events.h @@ -42,13 +42,13 @@ ** and when you're done adding, set this to the highest EID you used. It may ** be worthwhile to, on occasion, re-number the EID's to put them back in order. */ -#define CFE_TIME_MAX_EID 49 +#define CFE_TIME_MAX_EID 49 /* ** Event message ID's... */ /** \brief 'cFE TIME Initialized' -** \event 'cFE TIME Initialized' +** \event 'cFE TIME Initialized' ** ** \par Type: INFORMATION ** @@ -57,99 +57,98 @@ ** This event message is always automatically issued when the Time Services ** Task completes its Initialization. **/ -#define CFE_TIME_INIT_EID 1 /* start up message "informational" */ +#define CFE_TIME_INIT_EID 1 /* start up message "informational" */ /** \brief 'No-op command' -** \event 'No-op command' +** \event 'No-op command' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Time Services \link #CFE_TIME_NOOP_CC NO-OP command \endlink **/ -#define CFE_TIME_NOOP_EID 4 /* processed command "informational" */ +#define CFE_TIME_NOOP_EID 4 /* processed command "informational" */ /** \brief 'Reset Counters command' -** \event 'Reset Counters command' +** \event 'Reset Counters command' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Time Services \link #CFE_TIME_RESET_COUNTERS_CC Reset Counters command \endlink **/ -#define CFE_TIME_RESET_EID 5 +#define CFE_TIME_RESET_EID 5 /** \brief 'Request diagnostics command' -** \event 'Request diagnostics command' +** \event 'Request diagnostics command' ** ** \par Type: DEBUG ** ** \par Cause: ** -** This event message is always automatically issued in response +** This event message is always automatically issued in response ** to a cFE Time Services \link #CFE_TIME_SEND_DIAGNOSTIC_TLM_CC Request Diagnostics command \endlink **/ -#define CFE_TIME_DIAG_EID 6 +#define CFE_TIME_DIAG_EID 6 /** \brief 'Set Clock State = \%s' -** \event 'Set Clock State = \%s' +** \event 'Set Clock State = \%s' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of a cFE Time Services \link #CFE_TIME_SET_STATE_CC Set Time State command \endlink ** ** The \c '\%s' field will identify whether the command specified ** \c VALID, \c INVALID, or \c FLYWHEEL. **/ -#define CFE_TIME_STATE_EID 7 +#define CFE_TIME_STATE_EID 7 /** \brief 'Set Time Source = \%s' -** \event 'Set Time Source = \%s' +** \event 'Set Time Source = \%s' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of a cFE Time Services \link #CFE_TIME_SET_SOURCE_CC Set Time Source command \endlink ** ** The \c '\%s' field will identify whether the command specified ** \c INTERNAL, or \c EXTERNAL. **/ -#define CFE_TIME_SOURCE_EID 8 +#define CFE_TIME_SOURCE_EID 8 /** \brief 'Set Tone Source = \%s' -** \event 'Set Tone Source = \%s' +** \event 'Set Tone Source = \%s' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of a cFE Time Services \link #CFE_TIME_SET_SIGNAL_CC Set Clock Signal command \endlink ** ** The \c '\%s' field will identify whether the command specified ** \c PRIMARY, or \c REDUNDANT. **/ -#define CFE_TIME_SIGNAL_EID 9 - +#define CFE_TIME_SIGNAL_EID 9 /** \brief 'Set Tone Delay -- secs = \%d, usecs = \%d, ssecs = 0x\%X, dir = \%d' -** \event 'Set Tone Delay -- secs = \%d, usecs = \%d, ssecs = 0x\%X, dir = \%d' +** \event 'Set Tone Delay -- secs = \%d, usecs = \%d, ssecs = 0x\%X, dir = \%d' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion -** of either a cFE Time Services +** This event message is generated upon successful completion +** of either a cFE Time Services ** \link #CFE_TIME_ADD_DELAY_CC Add Time Delay \endlink OR a ** \link #CFE_TIME_SUB_DELAY_CC Subtract Time Delay command \endlink ** @@ -159,65 +158,65 @@ ** the \c dir field identifies the direction of the delay. The direction ** can be either #CFE_TIME_AdjustDirection_ADD or #CFE_TIME_AdjustDirection_SUBTRACT. **/ -#define CFE_TIME_DELAY_EID 11 +#define CFE_TIME_DELAY_EID 11 /** \brief 'Set Time -- secs = \%d, usecs = \%d, ssecs = 0x\%X' -** \event 'Set Time -- secs = \%d, usecs = \%d, ssecs = 0x\%X' +** \event 'Set Time -- secs = \%d, usecs = \%d, ssecs = 0x\%X' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of a cFE Time Services \link #CFE_TIME_SET_TIME_CC Set Time command \endlink ** ** The \c secs field specifies the new spacecraft time (in seconds), the \c usecs ** field specifies the spacecraft time micro-seconds, the \c ssecs field is ** the micro-seconds field converted to Spacecraft Time sub-seconds **/ -#define CFE_TIME_TIME_EID 12 +#define CFE_TIME_TIME_EID 12 /** \brief 'Set MET -- secs = \%d, usecs = \%d, ssecs = 0x\%X' -** \event 'Set MET -- secs = \%d, usecs = \%d, ssecs = 0x\%X' +** \event 'Set MET -- secs = \%d, usecs = \%d, ssecs = 0x\%X' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of a cFE Time Services \link #CFE_TIME_SET_MET_CC Set Mission Elapsed Time command \endlink ** ** The \c secs field specifies the new MET (in seconds), the \c usecs ** field specifies the MET micro-seconds, the \c ssecs field is ** the micro-seconds field converted to Spacecraft Time sub-seconds **/ -#define CFE_TIME_MET_EID 13 +#define CFE_TIME_MET_EID 13 /** \brief 'Set STCF -- secs = \%d, usecs = \%d, ssecs = 0x\%X' -** \event 'Set STCF -- secs = \%d, usecs = \%d, ssecs = 0x\%X' +** \event 'Set STCF -- secs = \%d, usecs = \%d, ssecs = 0x\%X' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion -** of a cFE Time Services \link #CFE_TIME_SET_STCF_CC Set Spacecraft Time +** This event message is generated upon successful completion +** of a cFE Time Services \link #CFE_TIME_SET_STCF_CC Set Spacecraft Time ** Correlation Factor command \endlink ** ** The \c secs field specifies the new STCF (in seconds), the \c usecs ** field specifies the STCF micro-seconds, the \c ssecs field is ** the micro-seconds field converted to Spacecraft Time sub-seconds. **/ -#define CFE_TIME_STCF_EID 14 +#define CFE_TIME_STCF_EID 14 /** \brief 'STCF Adjust -- secs = \%d, usecs = \%d, ssecs = 0x\%X, dir[1=Positive, 2=Negative] = \%d' -** \event 'STCF Adjust -- secs = \%d, usecs = \%d, ssecs = 0x\%X, dir[1=Positive, 2=Negative] = \%d' +** \event 'STCF Adjust -- secs = \%d, usecs = \%d, ssecs = 0x\%X, dir[1=Positive, 2=Negative] = \%d' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of any of the following cFE Time Services STCF Adjustment Commands: ** - \link #CFE_TIME_ADD_ADJUST_CC Add Single STCF Adjustment command \endlink ** - \link #CFE_TIME_SUB_ADJUST_CC Subtract Single STCF Adjustment command \endlink @@ -228,16 +227,16 @@ ** field identifies whether the adjustment was added or subtracted. The direction ** can be either #CFE_TIME_AdjustDirection_ADD or #CFE_TIME_AdjustDirection_SUBTRACT. **/ -#define CFE_TIME_DELTA_EID 15 +#define CFE_TIME_DELTA_EID 15 /** \brief 'STCF 1Hz Adjust -- secs = \%d, ssecs = 0x\%X, dir = \%d' -** \event 'STCF 1Hz Adjust -- secs = \%d, ssecs = 0x\%X, dir = \%d' +** \event 'STCF 1Hz Adjust -- secs = \%d, ssecs = 0x\%X, dir = \%d' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of any of the following cFE Time Services STCF Adjustment Commands: ** - \link #CFE_TIME_ADD_1HZ_ADJUSTMENT_CC Add STCF Adjustment each second command \endlink ** - \link #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC Subtract STCF Adjustment each second command \endlink @@ -248,25 +247,25 @@ ** added or subtracted. The direction value can be either #CFE_TIME_AdjustDirection_ADD or ** #CFE_TIME_AdjustDirection_SUBTRACT. **/ -#define CFE_TIME_1HZ_EID 16 +#define CFE_TIME_1HZ_EID 16 /** \brief 'Set Leap Seconds = \%d' -** \event 'Set Leap Seconds = \%d' +** \event 'Set Leap Seconds = \%d' ** ** \par Type: INFORMATION ** ** \par Cause: ** -** This event message is generated upon successful completion +** This event message is generated upon successful completion ** of the \link #CFE_TIME_SET_LEAP_SECONDS_CC Set Leap Seconds command \endlink ** ** The \c \%d field contains the number of seconds the Spacecraft's Leap Seconds ** has been set to. **/ -#define CFE_TIME_LEAPS_EID 17 +#define CFE_TIME_LEAPS_EID 17 /** \brief 'Start FLYWHEEL' -** \event 'Start FLYWHEEL' +** \event 'Start FLYWHEEL' ** ** \par Type: INFORMATION ** @@ -274,10 +273,10 @@ ** ** This event message is generated whenever the Time Services enters FLYWHEEL mode. **/ -#define CFE_TIME_FLY_ON_EID 20 /* flywheel state "informational" */ +#define CFE_TIME_FLY_ON_EID 20 /* flywheel state "informational" */ /** \brief 'Stop FLYWHEEL' -** \event 'Stop FLYWHEEL' +** \event 'Stop FLYWHEEL' ** ** \par Type: INFORMATION ** @@ -285,12 +284,12 @@ ** ** This event message is generated whenever the Time Services exits FLYWHEEL mode. **/ -#define CFE_TIME_FLY_OFF_EID 21 +#define CFE_TIME_FLY_OFF_EID 21 -#define CFE_TIME_EXIT_ERR_EID 25 /* task termination "error" */ +#define CFE_TIME_EXIT_ERR_EID 25 /* task termination "error" */ /** \brief 'Invalid message ID -- ID = 0x\%X' -** \event 'Invalid message ID -- ID = 0x\%X' +** \event 'Invalid message ID -- ID = 0x\%X' ** ** \par Type: ERROR ** @@ -303,10 +302,10 @@ ** The \c ID field specifies, in hex, the message ID of the inappropriately ** received message. **/ -#define CFE_TIME_ID_ERR_EID 26 /* invalid command packet "error" */ +#define CFE_TIME_ID_ERR_EID 26 /* invalid command packet "error" */ /** \brief 'Invalid command code -- ID = 0x\%X, CC = \%d' -** \event 'Invalid command code -- ID = 0x\%X, CC = \%d' +** \event 'Invalid command code -- ID = 0x\%X, CC = \%d' ** ** \par Type: ERROR ** @@ -319,10 +318,10 @@ ** The \c ID field specifies, in hex, the message ID of the message containing ** the unrecognized command code, identified, in decimal, by the \c CC field. **/ -#define CFE_TIME_CC_ERR_EID 27 +#define CFE_TIME_CC_ERR_EID 27 /** \brief 'Invalid Clock State = 0x\%X' -** \event 'Invalid Clock State = 0x\%X' +** \event 'Invalid Clock State = 0x\%X' ** ** \par Type: ERROR ** @@ -335,13 +334,13 @@ ** - #CFE_TIME_ClockState_VALID ** - #CFE_TIME_ClockState_FLYWHEEL ** -** The \c State field specifies, in hex, the state value received +** The \c State field specifies, in hex, the state value received ** in the command message. **/ -#define CFE_TIME_STATE_ERR_EID 30 /* processed command "error" */ +#define CFE_TIME_STATE_ERR_EID 30 /* processed command "error" */ /** \brief 'Invalid Time Source = 0x\%X' -** \event 'Invalid Time Source = 0x\%X' +** \event 'Invalid Time Source = 0x\%X' ** ** \par Type: ERROR ** @@ -353,13 +352,13 @@ ** - #CFE_TIME_SourceSelect_INTERNAL ** - #CFE_TIME_SourceSelect_EXTERNAL ** -** The \c Source field specifies, in hex, the source value received +** The \c Source field specifies, in hex, the source value received ** in the command message. **/ -#define CFE_TIME_SOURCE_ERR_EID 31 +#define CFE_TIME_SOURCE_ERR_EID 31 /** \brief 'Invalid Tone Source = 0x\%X' -** \event 'Invalid Tone Source = 0x\%X' +** \event 'Invalid Tone Source = 0x\%X' ** ** \par Type: ERROR ** @@ -371,13 +370,13 @@ ** - #CFE_TIME_ToneSignalSelect_PRIMARY ** - #CFE_TIME_ToneSignalSelect_REDUNDANT ** -** The \c Source field specifies, in hex, the signal source value received +** The \c Source field specifies, in hex, the signal source value received ** in the command message. **/ -#define CFE_TIME_SIGNAL_ERR_EID 32 +#define CFE_TIME_SIGNAL_ERR_EID 32 /** \brief 'Invalid Tone Delay -- secs = \%d, usecs = \%d' -** \event 'Invalid Tone Delay -- secs = \%d, usecs = \%d' +** \event 'Invalid Tone Delay -- secs = \%d, usecs = \%d' ** ** \par Type: ERROR ** @@ -393,10 +392,10 @@ ** and the \c usecs field specifies, in decimal, the micro-second delay that ** was in error. **/ -#define CFE_TIME_DELAY_ERR_EID 33 +#define CFE_TIME_DELAY_ERR_EID 33 /** \brief 'Invalid Time -- secs = \%d, usecs = \%d' -** \event 'Invalid Time -- secs = \%d, usecs = \%d' +** \event 'Invalid Time -- secs = \%d, usecs = \%d' ** ** \par Type: ERROR ** @@ -411,10 +410,10 @@ ** and the \c usecs field specifies, in decimal, the micro-second field of ** the spacecraft time that was in error. **/ -#define CFE_TIME_TIME_ERR_EID 34 +#define CFE_TIME_TIME_ERR_EID 34 /** \brief 'Invalid MET -- secs = \%d, usecs = \%d' -** \event 'Invalid MET -- secs = \%d, usecs = \%d' +** \event 'Invalid MET -- secs = \%d, usecs = \%d' ** ** \par Type: ERROR ** @@ -429,10 +428,10 @@ ** and the \c usecs field specifies, in decimal, the micro-second field of ** the MET that was in error. **/ -#define CFE_TIME_MET_ERR_EID 35 +#define CFE_TIME_MET_ERR_EID 35 /** \brief 'Invalid STCF -- secs = \%d, usecs = \%d' -** \event 'Invalid STCF -- secs = \%d, usecs = \%d' +** \event 'Invalid STCF -- secs = \%d, usecs = \%d' ** ** \par Type: ERROR ** @@ -447,10 +446,10 @@ ** and the \c usecs field specifies, in decimal, the micro-second field of ** the STCF that was in error. **/ -#define CFE_TIME_STCF_ERR_EID 36 +#define CFE_TIME_STCF_ERR_EID 36 /** \brief 'Invalid STCF Adjust -- secs = \%d, usecs = \%d, dir[1=Positive, 2=Negative] = \%d' -** \event 'Invalid STCF Adjust -- secs = \%d, usecs = \%d, dir[1=Positive, 2=Negative] = \%d' +** \event 'Invalid STCF Adjust -- secs = \%d, usecs = \%d, dir[1=Positive, 2=Negative] = \%d' ** ** \par Type: ERROR ** @@ -467,14 +466,14 @@ ** field identifies whether the adjustment was to be added or subtracted. The direction ** can be either #CFE_TIME_AdjustDirection_ADD or #CFE_TIME_AdjustDirection_SUBTRACT. **/ -#define CFE_TIME_DELTA_ERR_EID 37 +#define CFE_TIME_DELTA_ERR_EID 37 /** (obsolete - unused) -**/ -#define CFE_TIME_1HZ_ERR_EID 38 + **/ +#define CFE_TIME_1HZ_ERR_EID 38 /** \brief 'Set Source commands invalid without CFE_PLATFORM_TIME_CFG_SOURCE set to true' -** \event 'Set Source commands invalid without CFE_PLATFORM_TIME_CFG_SOURCE set to true' +** \event 'Set Source commands invalid without CFE_PLATFORM_TIME_CFG_SOURCE set to true' ** ** \par Type: ERROR ** @@ -485,10 +484,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SOURCE has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_SOURCE_CFG_EID 40 /* cmd disabled per cfg "error" */ +#define CFE_TIME_SOURCE_CFG_EID 40 /* cmd disabled per cfg "error" */ /** \brief 'Set Signal commands invalid without CFE_PLATFORM_TIME_CFG_SIGNAL set to true' -** \event 'Set Signal commands invalid without CFE_PLATFORM_TIME_CFG_SIGNAL set to true' +** \event 'Set Signal commands invalid without CFE_PLATFORM_TIME_CFG_SIGNAL set to true' ** ** \par Type: ERROR ** @@ -499,10 +498,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SIGNAL has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_SIGNAL_CFG_EID 41 +#define CFE_TIME_SIGNAL_CFG_EID 41 /** \brief 'Set Delay commands invalid without CFE_PLATFORM_TIME_CFG_CLIENT set to true' -** \event 'Set Delay commands invalid without CFE_PLATFORM_TIME_CFG_CLIENT set to true' +** \event 'Set Delay commands invalid without CFE_PLATFORM_TIME_CFG_CLIENT set to true' ** ** \par Type: ERROR ** @@ -514,10 +513,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_CLIENT has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_DELAY_CFG_EID 42 +#define CFE_TIME_DELAY_CFG_EID 42 /** \brief 'Set Time commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' -** \event 'Set Time commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' +** \event 'Set Time commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' ** ** \par Type: ERROR ** @@ -528,10 +527,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SERVER has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_TIME_CFG_EID 43 +#define CFE_TIME_TIME_CFG_EID 43 /** \brief 'Set MET commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' -** \event 'Set MET commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' +** \event 'Set MET commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' ** ** \par Type: ERROR ** @@ -542,10 +541,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SERVER has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_MET_CFG_EID 44 +#define CFE_TIME_MET_CFG_EID 44 /** \brief 'Set STCF commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' -** \event 'Set STCF commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' +** \event 'Set STCF commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' ** ** \par Type: ERROR ** @@ -556,10 +555,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SERVER has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_STCF_CFG_EID 45 +#define CFE_TIME_STCF_CFG_EID 45 /** \brief 'Set Leaps commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' -** \event 'Set Leaps commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' +** \event 'Set Leaps commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' ** ** \par Type: ERROR ** @@ -570,10 +569,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SERVER has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_LEAPS_CFG_EID 46 +#define CFE_TIME_LEAPS_CFG_EID 46 /** \brief 'STCF Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' -** \event 'STCF Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' +** \event 'STCF Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' ** ** \par Type: ERROR ** @@ -585,10 +584,10 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SERVER has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_DELTA_CFG_EID 47 +#define CFE_TIME_DELTA_CFG_EID 47 /** \brief '1Hz Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' -** \event '1Hz Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' +** \event '1Hz Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to true' ** ** \par Type: ERROR ** @@ -600,7 +599,7 @@ ** and the Time Services configuration parameter #CFE_PLATFORM_TIME_CFG_SERVER has ** not been set to true in the cfe_platform_cfg.h file. **/ -#define CFE_TIME_1HZ_CFG_EID 48 +#define CFE_TIME_1HZ_CFG_EID 48 /** \brief 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' ** \event 'Invalid cmd length: ID = 0x\%X, CC = \%d, Exp Len = \%d, Len = \%d' @@ -618,6 +617,6 @@ ** Length (in decimal ), and \c Len specifies the message Length (in decimal) ** found in the message. **/ -#define CFE_TIME_LEN_ERR_EID 49 +#define CFE_TIME_LEN_ERR_EID 49 -#endif /* _cfe_time_events_ */ +#endif /* _cfe_time_events_ */ diff --git a/modules/time/fsw/inc/cfe_time_msg.h b/modules/time/fsw/inc/cfe_time_msg.h index 7d952188b..2890c5abe 100644 --- a/modules/time/fsw/inc/cfe_time_msg.h +++ b/modules/time/fsw/inc/cfe_time_msg.h @@ -38,8 +38,8 @@ /* ** Required header files... */ -#include "common_types.h" /* Basic data types */ -#include "cfe_msg_hdr.h" /* for header definitions */ +#include "common_types.h" /* Basic data types */ +#include "cfe_msg_hdr.h" /* for header definitions */ #include "cfe_time_extern_typedefs.h" /*************************************************************************/ @@ -53,8 +53,8 @@ /** \cfetimecmd Time No-Op ** ** \par Description -** This command performs no other function than to increment the -** command execution counter. The command may be used to verify +** This command performs no other function than to increment the +** command execution counter. The command may be used to verify ** general aliveness of the Time Services task. ** ** \cfecmdmnemonic \TIME_NOOP @@ -63,23 +63,23 @@ ** #CFE_TIME_NoopCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - The #CFE_TIME_NOOP_EID informational event message will be generated ** ** \par Error Conditions -** There are no error conditions for this command. If the Time -** Services receives the command, the event is sent (although it -** may be filtered by EVS) and the counter is incremented +** There are no error conditions for this command. If the Time +** Services receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented ** unconditionally. ** ** \par Criticality ** None ** -** \sa +** \sa */ -#define CFE_TIME_NOOP_CC 0 /* no-op command */ +#define CFE_TIME_NOOP_CC 0 /* no-op command */ /** \cfetimecmd Time Reset Counters ** @@ -107,32 +107,32 @@ ** #CFE_TIME_ResetCountersCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - The #CFE_TIME_RESET_EID informational event message will be generated ** ** \par Error Conditions -** There are no error conditions for this command. If the Time -** Services receives the command, the event is sent (although it -** may be filtered by EVS) and the counter is incremented +** There are no error conditions for this command. If the Time +** Services receives the command, the event is sent (although it +** may be filtered by EVS) and the counter is incremented ** unconditionally. ** ** \par Criticality ** None ** -** \sa +** \sa */ -#define CFE_TIME_RESET_COUNTERS_CC 1 /* reset counters */ +#define CFE_TIME_RESET_COUNTERS_CC 1 /* reset counters */ /** \cfetimecmd Request TIME Diagnostic Telemetry ** ** \par Description -** This command requests that the Time Service generate a message -** containing various data values not included in the normal Time -** Service housekeeping message. The command requests only a single -** copy of the diagnostic message. Refer to #CFE_TIME_DiagnosticTlm_t for -** a description of the Time Service diagnostic message contents. +** This command requests that the Time Service generate a message +** containing various data values not included in the normal Time +** Service housekeeping message. The command requests only a single +** copy of the diagnostic message. Refer to #CFE_TIME_DiagnosticTlm_t for +** a description of the Time Service diagnostic message contents. ** ** \cfecmdmnemonic \TIME_REQUESTDIAG ** @@ -140,43 +140,43 @@ ** #CFE_TIME_SendDiagnosticCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - Sequence Counter for #CFE_TIME_DiagnosticTlm_t will increment ** - The #CFE_TIME_DIAG_EID debug event message will be generated ** ** \par Error Conditions -** There are no error conditions for this command. If the Time -** Services receives the command, the event and telemetry is sent -** (although one or both may be filtered by EVS and TO) and the +** There are no error conditions for this command. If the Time +** Services receives the command, the event and telemetry is sent +** (although one or both may be filtered by EVS and TO) and the ** counter is incremented unconditionally. ** ** \par Criticality ** None ** -** \sa +** \sa */ -#define CFE_TIME_SEND_DIAGNOSTIC_TLM_CC 2 /* request diagnostic hk telemetry */ +#define CFE_TIME_SEND_DIAGNOSTIC_TLM_CC 2 /* request diagnostic hk telemetry */ /** \cfetimecmd Set Time Source ** ** \par Description -** This command selects the Time Service clock source. Although the -** list of potential clock sources is mission specific and defined -** via configuration parameters, this command provides a common method -** for switching between the local processor clock and an external +** This command selects the Time Service clock source. Although the +** list of potential clock sources is mission specific and defined +** via configuration parameters, this command provides a common method +** for switching between the local processor clock and an external ** source for time data.

-** When commanded to accept external time data (GPS, MET, spacecraft -** time, etc.), the Time Server will enable input via an API function -** specific to the configuration definitions for the particular source. -** When commanded to use internal time data, the Time Server will ignore -** the external data. However, the Time Server will continue to use the -** API function as the trigger to generate a "time at the tone" command +** When commanded to accept external time data (GPS, MET, spacecraft +** time, etc.), the Time Server will enable input via an API function +** specific to the configuration definitions for the particular source. +** When commanded to use internal time data, the Time Server will ignore +** the external data. However, the Time Server will continue to use the +** API function as the trigger to generate a "time at the tone" command ** packet regardless of the internal/external command selection.

** Notes: -** - Operating in FLYWHEEL mode is not considered a choice related -** to clock source, but rather an element of the clock state. See below +** - Operating in FLYWHEEL mode is not considered a choice related +** to clock source, but rather an element of the clock state. See below ** for a description of the #CFE_TIME_SET_STATE_CC command. ** - This command is only valid when the #CFE_PLATFORM_TIME_CFG_SOURCE configuration ** parameter in the cfe_platform_cfg.h file has been set to true. @@ -187,7 +187,7 @@ ** #CFE_TIME_SetSourceCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_SOURCE - Diagnostic Telemetry point will indicate the @@ -195,7 +195,7 @@ ** - The #CFE_TIME_SOURCE_EID informational event message will be generated ** ** \par Error Conditions -** - Invalid Source selection +** - Invalid Source selection ** (a value other than #CFE_TIME_SourceSelect_INTERNAL or #CFE_TIME_SourceSelect_EXTERNAL was specified) ** - Time source selection not allowed on this platform **

Evidence of failure may be found in the following telemetry: @@ -207,29 +207,29 @@ ** ** \sa #CFE_TIME_SET_STATE_CC, #CFE_TIME_SET_SIGNAL_CC */ -#define CFE_TIME_SET_SOURCE_CC 3 /* set clock source (int vs ext) */ +#define CFE_TIME_SET_SOURCE_CC 3 /* set clock source (int vs ext) */ /** \cfetimecmd Set Time State ** ** \par Description -** This command indirectly affects the Time Service on-board determination -** of clock state. Clock state is a combination of factors, most significantly -** whether the spacecraft time has been accurately set, and whether Time Service +** This command indirectly affects the Time Service on-board determination +** of clock state. Clock state is a combination of factors, most significantly +** whether the spacecraft time has been accurately set, and whether Time Service ** is operating in FLYWHEEL mode.

-** This command may be used to notify the Time Server that spacecraft time is -** now correct, or that time is no longer correct. This information will be -** distributed to Time Clients, and in turn, to any interested sub-systems.

-** Also, this command may be used to force a Time Server or Time Client into -** FLYWHEEL mode. Use of FLYWHEEL mode is mainly for debug purposes although -** in extreme circumstances, it may be of value to force Time Service not to rely -** on normal time updates. Note that when commanded into FLYWHEEL mode, the Time -** Service will remain so until receipt of another "set state" command setting the +** This command may be used to notify the Time Server that spacecraft time is +** now correct, or that time is no longer correct. This information will be +** distributed to Time Clients, and in turn, to any interested sub-systems.

+** Also, this command may be used to force a Time Server or Time Client into +** FLYWHEEL mode. Use of FLYWHEEL mode is mainly for debug purposes although +** in extreme circumstances, it may be of value to force Time Service not to rely +** on normal time updates. Note that when commanded into FLYWHEEL mode, the Time +** Service will remain so until receipt of another "set state" command setting the ** state into a mode other than FLYWHEEL.

-** Note also that setting the clock state to VALID or INVALID on a Time Client that -** is currently getting time updates from the Time Server will have very limited -** effect. As soon as the Time Client receives the next time update, the VALID/INVALID -** selection will be set to that of the Time Server. However, setting a Time Client -** to FLYWHEEL cannot be overridden by the Time Server since the Time Client will +** Note also that setting the clock state to VALID or INVALID on a Time Client that +** is currently getting time updates from the Time Server will have very limited +** effect. As soon as the Time Client receives the next time update, the VALID/INVALID +** selection will be set to that of the Time Server. However, setting a Time Client +** to FLYWHEEL cannot be overridden by the Time Server since the Time Client will ** ignore time updates from the Time Server while in FLYWHEEL mode. ** ** \cfecmdmnemonic \TIME_SETSTATE @@ -238,7 +238,7 @@ ** #CFE_TIME_SetStateCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_STATEFLG - Housekeeping Telemetry point "may"l indicate the @@ -246,34 +246,35 @@ ** - The #CFE_TIME_STATE_EID informational event message will be generated ** ** \par Error Conditions -** - Invalid State selection -** (a value other than #CFE_TIME_ClockState_INVALID, #CFE_TIME_ClockState_VALID or #CFE_TIME_ClockState_FLYWHEEL was specified) +** - Invalid State selection +** (a value other than #CFE_TIME_ClockState_INVALID, #CFE_TIME_ClockState_VALID or +** #CFE_TIME_ClockState_FLYWHEEL was specified) ** - Time source selection not allowed on this platform **

Evidence of failure may be found in the following telemetry: ** - \b \c \TIME_CMDEC - Command Error counter will increment ** - Error specific event message (#CFE_TIME_STATE_ERR_EID) ** ** \par Criticality -** Setting Time Service into FLYWHEEL mode is not particularly hazardous, as -** the result may be that the calculation of spacecraft time is done using a -** less than optimal timer. However, inappropriately setting the clock state -** to VALID (indicating that spacecraft time is accurate) may result in other -** sub-systems performing incorrect time based calculations. The specific risk +** Setting Time Service into FLYWHEEL mode is not particularly hazardous, as +** the result may be that the calculation of spacecraft time is done using a +** less than optimal timer. However, inappropriately setting the clock state +** to VALID (indicating that spacecraft time is accurate) may result in other +** sub-systems performing incorrect time based calculations. The specific risk ** is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_SET_SOURCE_CC, #CFE_TIME_SET_SIGNAL_CC */ -#define CFE_TIME_SET_STATE_CC 4 /* set clock state */ +#define CFE_TIME_SET_STATE_CC 4 /* set clock state */ /** \cfetimecmd Add Time to Tone Time Delay ** ** \par Description -** This command is used to factor out a known, predictable latency between the -** Time Server and a particular Time Client. The correction is applied (added) -** to the current time calculation for Time Clients, so this command has no -** meaning for Time Servers. Each Time Client can have a unique latency setting. -** The latency value is a positive number of seconds and microseconds that represent -** the deviation from the time maintained by the Time Server. +** This command is used to factor out a known, predictable latency between the +** Time Server and a particular Time Client. The correction is applied (added) +** to the current time calculation for Time Clients, so this command has no +** meaning for Time Servers. Each Time Client can have a unique latency setting. +** The latency value is a positive number of seconds and microseconds that represent +** the deviation from the time maintained by the Time Server. ** ** \cfecmdmnemonic \TIME_ADDCLOCKLAT ** @@ -281,7 +282,7 @@ ** #CFE_TIME_AddDelayCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_LATENTS - Housekeeping Telemetry point indicating command specified values @@ -296,22 +297,22 @@ ** - Error specific event messages will be issued (#CFE_TIME_DELAY_CFG_EID or #CFE_TIME_DELAY_ERR_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_SUB_DELAY_CC */ -#define CFE_TIME_ADD_DELAY_CC 5 /* add tone delay value */ +#define CFE_TIME_ADD_DELAY_CC 5 /* add tone delay value */ /** \cfetimecmd Subtract Time from Tone Time Delay ** ** \par Description -** This command is used to factor out a known, predictable latency between the Time Server -** and a particular Time Client. The correction is applied (subtracted) to the current time -** calculation for Time Clients, so this command has no meaning for Time Servers. Each Time -** Client can have a unique latency setting. The latency value is a positive number of seconds +** This command is used to factor out a known, predictable latency between the Time Server +** and a particular Time Client. The correction is applied (subtracted) to the current time +** calculation for Time Clients, so this command has no meaning for Time Servers. Each Time +** Client can have a unique latency setting. The latency value is a positive number of seconds ** and microseconds that represent the deviation from the time maintained by the Time Server.

-** Note that it is unimaginable that the seconds value will ever be anything but zero. +** Note that it is unimaginable that the seconds value will ever be anything but zero. ** ** \cfecmdmnemonic \TIME_SUBCLOCKLAT ** @@ -319,7 +320,7 @@ ** #CFE_TIME_SubDelayCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_LATENTS - Housekeeping Telemetry point indicating command specified values @@ -334,22 +335,22 @@ ** - Error specific event messages will be issued (#CFE_TIME_DELAY_CFG_EID or #CFE_TIME_DELAY_ERR_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_ADD_DELAY_CC */ -#define CFE_TIME_SUB_DELAY_CC 6 /* sub tone delay value */ +#define CFE_TIME_SUB_DELAY_CC 6 /* sub tone delay value */ /** \cfetimecmd Set Spacecraft Time ** ** \par Description -** This command sets the spacecraft clock to a new value, -** regardless of the current setting (time jam). The new time -** value represents the desired offset from the mission-defined -** time epoch and takes effect immediately upon execution of -** this command. Time Service will calculate a new STCF value -** based on the current MET and the desired new time using one +** This command sets the spacecraft clock to a new value, +** regardless of the current setting (time jam). The new time +** value represents the desired offset from the mission-defined +** time epoch and takes effect immediately upon execution of +** this command. Time Service will calculate a new STCF value +** based on the current MET and the desired new time using one ** of the following:

** If Time Service is configured to compute current time as TAI
** - STCF = (new time) - (current MET) @@ -364,7 +365,7 @@ ** #CFE_TIME_SetTimeCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating newly calculated STCF seconds value @@ -379,23 +380,23 @@ ** - Error specific event messages will be issued (#CFE_TIME_TIME_CFG_EID or #CFE_TIME_TIME_ERR_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_SET_MET_CC, #CFE_TIME_SET_STCF_CC, #CFE_TIME_SET_LEAP_SECONDS_CC */ -#define CFE_TIME_SET_TIME_CC 7 /* set time */ +#define CFE_TIME_SET_TIME_CC 7 /* set time */ /** \cfetimecmd Set Mission Elapsed Time ** ** \par Description ** This command sets the Mission Elapsed Timer (MET) to the specified value.

-** Note that the MET (as implemented for cFE Time Service) is a logical representation -** and not a physical timer. Thus, setting the MET is not dependent on whether the +** Note that the MET (as implemented for cFE Time Service) is a logical representation +** and not a physical timer. Thus, setting the MET is not dependent on whether the ** hardware supports a MET register that can be written to.

-** Note also that Time Service "assumes" that during normal operation, the MET is -** synchronized to the tone signal. Therefore, unless operating in FLYWHEEL mode, -** the sub-seconds portion of the MET will be set to zero at the next tone signal interrupt.

+** Note also that Time Service "assumes" that during normal operation, the MET is +** synchronized to the tone signal. Therefore, unless operating in FLYWHEEL mode, +** the sub-seconds portion of the MET will be set to zero at the next tone signal interrupt.

** The new MET takes effect immediately upon execution of this command. ** ** \cfecmdmnemonic \TIME_SETCLOCKMET @@ -404,7 +405,7 @@ ** #CFE_TIME_SetMETCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_METSECS - Housekeeping Telemetry point indicating new MET seconds value @@ -419,21 +420,21 @@ ** - Error specific event messages will be issued (#CFE_TIME_MET_CFG_EID or #CFE_TIME_MET_ERR_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_SET_TIME_CC, #CFE_TIME_SET_STCF_CC, #CFE_TIME_SET_LEAP_SECONDS_CC */ -#define CFE_TIME_SET_MET_CC 8 /* set MET */ +#define CFE_TIME_SET_MET_CC 8 /* set MET */ /** \cfetimecmd Set Spacecraft Time Correlation Factor ** ** \par Description -** This command sets the Spacecraft Time Correlation Factor (STCF) to the specified value. -** This command differs from the previously described SET CLOCK in the nature of the command -** argument. This command sets the STCF value directly, rather than extracting the STCF -** from a value representing the total of MET, STCF and optionally, Leap Seconds. The new -** STCF takes effect immediately upon execution of this command. +** This command sets the Spacecraft Time Correlation Factor (STCF) to the specified value. +** This command differs from the previously described SET CLOCK in the nature of the command +** argument. This command sets the STCF value directly, rather than extracting the STCF +** from a value representing the total of MET, STCF and optionally, Leap Seconds. The new +** STCF takes effect immediately upon execution of this command. ** ** \cfecmdmnemonic \TIME_SETCLOCKSTCF ** @@ -441,7 +442,7 @@ ** #CFE_TIME_SetSTCFCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value @@ -456,20 +457,20 @@ ** - Error specific event messages will be issued (#CFE_TIME_STCF_CFG_EID or #CFE_TIME_STCF_ERR_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_SET_TIME_CC, #CFE_TIME_SET_MET_CC, #CFE_TIME_SET_LEAP_SECONDS_CC */ -#define CFE_TIME_SET_STCF_CC 9 /* set STCF */ +#define CFE_TIME_SET_STCF_CC 9 /* set STCF */ /** \cfetimecmd Set Leap Seconds ** ** \par Description -** This command sets the spacecraft Leap Seconds to the specified value. -** Leap Seconds may be positive or negative, and there is no limit to the -** value except, of course, the limit imposed by the 16 bit signed integer -** data type. The new Leap Seconds value takes effect immediately upon +** This command sets the spacecraft Leap Seconds to the specified value. +** Leap Seconds may be positive or negative, and there is no limit to the +** value except, of course, the limit imposed by the 16 bit signed integer +** data type. The new Leap Seconds value takes effect immediately upon ** execution of this command. ** ** \cfecmdmnemonic \TIME_SETCLOCKLEAP @@ -478,7 +479,7 @@ ** #CFE_TIME_SetLeapSecondsCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_LEAPSECS - Housekeeping Telemetry point indicating new Leap seconds value @@ -491,19 +492,19 @@ ** - Error specific event messages will be issued (#CFE_TIME_LEAPS_CFG_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_SET_TIME_CC, #CFE_TIME_SET_MET_CC, #CFE_TIME_SET_STCF_CC */ -#define CFE_TIME_SET_LEAP_SECONDS_CC 10 /* set Leap Seconds */ +#define CFE_TIME_SET_LEAP_SECONDS_CC 10 /* set Leap Seconds */ -/** \cfetimecmd Add Delta to Spacecraft Time Correlation Factor +/** \cfetimecmd Add Delta to Spacecraft Time Correlation Factor ** ** \par Description -** This command adjusts the Spacecraft Time Correlation Factor (STCF) by -** adding the specified value. The new STCF takes effect immediately upon -** execution of this command. +** This command adjusts the Spacecraft Time Correlation Factor (STCF) by +** adding the specified value. The new STCF takes effect immediately upon +** execution of this command. ** ** \cfecmdmnemonic \TIME_ADDSTCFADJ ** @@ -511,7 +512,7 @@ ** #CFE_TIME_AddAdjustCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value @@ -526,18 +527,19 @@ ** - Error specific event messages will be issued (#CFE_TIME_DELTA_ERR_EID or #CFE_TIME_DELTA_CFG_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** -** \sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_SUB_ADJUST_CC, #CFE_TIME_ADD_1HZ_ADJUSTMENT_CC, #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC +** \sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_SUB_ADJUST_CC, #CFE_TIME_ADD_1HZ_ADJUSTMENT_CC, +*#CFE_TIME_SUB_1HZ_ADJUSTMENT_CC */ -#define CFE_TIME_ADD_ADJUST_CC 11 /* add one time STCF adjustment */ +#define CFE_TIME_ADD_ADJUST_CC 11 /* add one time STCF adjustment */ -/** \cfetimecmd Subtract Delta from Spacecraft Time Correlation Factor +/** \cfetimecmd Subtract Delta from Spacecraft Time Correlation Factor ** ** \par Description -** This command adjusts the Spacecraft Time Correlation Factor (STCF) by subtracting the specified -** value. The new STCF takes effect immediately upon execution of this command. +** This command adjusts the Spacecraft Time Correlation Factor (STCF) by subtracting the specified +** value. The new STCF takes effect immediately upon execution of this command. ** ** \cfecmdmnemonic \TIME_SUBSTCFADJ ** @@ -545,7 +547,7 @@ ** #CFE_TIME_SubAdjustCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value @@ -560,12 +562,12 @@ ** - Error specific event messages will be issued (#CFE_TIME_DELTA_ERR_EID or #CFE_TIME_DELTA_CFG_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_ADD_1HZ_ADJUSTMENT_CC, #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC */ -#define CFE_TIME_SUB_ADJUST_CC 12 /* subtract one time STCF adjustment */ +#define CFE_TIME_SUB_ADJUST_CC 12 /* subtract one time STCF adjustment */ /** \cfetimecmd Add Delta to Spacecraft Time Correlation Factor each 1Hz ** @@ -574,11 +576,11 @@ ** rather than micro-seconds as an input argument. This change occurred ** after the determination was made that one micro-second is too large an ** increment for a constant 1Hz adjustment.

-** This command continuously adjusts the Spacecraft Time Correlation Factor (STCF) -** every second, by adding the specified value. The adjustment to the STCF is -** applied in the Time Service local 1Hz interrupt handler. As the local 1Hz -** interrupt is not synchronized to the tone signal, one cannot say when the -** adjustment will occur, other than once a second, at about the same time +** This command continuously adjusts the Spacecraft Time Correlation Factor (STCF) +** every second, by adding the specified value. The adjustment to the STCF is +** applied in the Time Service local 1Hz interrupt handler. As the local 1Hz +** interrupt is not synchronized to the tone signal, one cannot say when the +** adjustment will occur, other than once a second, at about the same time ** relative to the tone.

** There was some debate about whether the maximum 1Hz clock drift correction ** factor would ever need to exceed some small fraction of a second. But, the @@ -592,7 +594,7 @@ ** #CFE_TIME_Add1HZAdjustmentCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value @@ -606,25 +608,25 @@ ** - Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_SUB_ADJUST_CC, #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC */ -#define CFE_TIME_ADD_1HZ_ADJUSTMENT_CC 13 /* add 1Hz STCF adjustment */ +#define CFE_TIME_ADD_1HZ_ADJUSTMENT_CC 13 /* add 1Hz STCF adjustment */ -/** \cfetimecmd Subtract Delta from Spacecraft Time Correlation Factor each 1Hz +/** \cfetimecmd Subtract Delta from Spacecraft Time Correlation Factor each 1Hz ** ** \par Description ** This command has been updated to take actual sub-seconds (1/2^32 seconds) ** rather than micro-seconds as an input argument. This change occurred ** after the determination was made that one micro-second is too large an ** increment for a constant 1Hz adjustment.

-** This command continuously adjusts the Spacecraft Time Correlation Factor (STCF) +** This command continuously adjusts the Spacecraft Time Correlation Factor (STCF) ** every second, by subtracting the specified value. The adjustment to the STCF -** is applied in the Time Service local 1Hz interrupt handler. As the local 1Hz -** interrupt is not synchronized to the tone signal, one cannot say when the -** adjustment will occur, other than once a second, at about the same time +** is applied in the Time Service local 1Hz interrupt handler. As the local 1Hz +** interrupt is not synchronized to the tone signal, one cannot say when the +** adjustment will occur, other than once a second, at about the same time ** relative to the tone.

** There was some debate about whether the maximum 1Hz clock drift correction ** factor would ever need to exceed some small fraction of a second. But, the @@ -638,9 +640,9 @@ ** #CFE_TIME_Sub1HZAdjustmentCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: ** - \b \c \TIME_CMDPC - command execution counter will increment ** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value @@ -654,23 +656,22 @@ ** - Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID) ** ** \par Criticality -** Inappropriately setting the clock may result in other sub-systems performing incorrect +** Inappropriately setting the clock may result in other sub-systems performing incorrect ** time based calculations. The specific risk is dependent upon the behavior of those sub-systems. ** ** \sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_SUB_ADJUST_CC, #CFE_TIME_ADD_1HZ_ADJUSTMENT_CC */ -#define CFE_TIME_SUB_1HZ_ADJUSTMENT_CC 14 /* subtract 1Hz STCF adjustment */ - +#define CFE_TIME_SUB_1HZ_ADJUSTMENT_CC 14 /* subtract 1Hz STCF adjustment */ /** \cfetimecmd Set Tone Signal Source ** ** \par Description -** This command selects the Time Service tone signal source. Although the -** list of potential tone signal sources is mission specific, a common -** choice is the selection of primary or redundant tone signal. The selection -** may be available to both the Time Server and Time Clients, depending on +** This command selects the Time Service tone signal source. Although the +** list of potential tone signal sources is mission specific, a common +** choice is the selection of primary or redundant tone signal. The selection +** may be available to both the Time Server and Time Clients, depending on ** hardware configuration.

-** Notes: +** Notes: ** - This command is only valid when the #CFE_PLATFORM_TIME_CFG_SIGNAL configuration ** parameter in the cfe_platform_cfg.h file has been set to true. ** @@ -680,17 +681,17 @@ ** #CFE_TIME_SetSignalCmd_t ** ** \par Command Verification -** Successful execution of this command may be verified with the +** Successful execution of this command may be verified with the ** following telemetry: -** - \b \c \TIME_CMDPC - command execution counter will +** - \b \c \TIME_CMDPC - command execution counter will ** increment ** - \b \c \TIME_SIGNAL - Diagnostic Telemetry point will indicate the ** command specified value -** - The #CFE_TIME_SIGNAL_EID informational event message will +** - The #CFE_TIME_SIGNAL_EID informational event message will ** be generated ** ** \par Error Conditions -** - Invalid Signal selection +** - Invalid Signal selection ** (a value other than #CFE_TIME_ToneSignalSelect_PRIMARY or #CFE_TIME_ToneSignalSelect_REDUNDANT was specified) ** - Multiple Tone Signal Sources not available on this platform **

Evidence of failure may be found in the following telemetry: @@ -702,27 +703,26 @@ ** ** \sa #CFE_TIME_SET_STATE_CC, #CFE_TIME_SET_SOURCE_CC */ -#define CFE_TIME_SET_SIGNAL_CC 15 /* set clock signal (pri vs red) */ +#define CFE_TIME_SET_SIGNAL_CC 15 /* set clock signal (pri vs red) */ /** \} */ /** \defgroup CFETIMEClkStates cFE Clock State Flag Defines * \{ */ -#define CFE_TIME_FLAG_CLKSET 0x8000 /**< \brief The spacecraft time has been set */ -#define CFE_TIME_FLAG_FLYING 0x4000 /**< \brief This instance of Time Services is flywheeling */ -#define CFE_TIME_FLAG_SRCINT 0x2000 /**< \brief The clock source is set to "internal" */ -#define CFE_TIME_FLAG_SIGPRI 0x1000 /**< \brief The clock signal is set to "primary" */ -#define CFE_TIME_FLAG_SRVFLY 0x0800 /**< \brief The Time Server is in flywheel mode */ -#define CFE_TIME_FLAG_CMDFLY 0x0400 /**< \brief This instance of Time Services was commanded into flywheel mode */ -#define CFE_TIME_FLAG_ADDADJ 0x0200 /**< \brief One time STCF Adjustment is to be done in positive direction */ -#define CFE_TIME_FLAG_ADD1HZ 0x0100 /**< \brief 1 Hz STCF Adjustment is to be done in a positive direction */ -#define CFE_TIME_FLAG_ADDTCL 0x0080 /**< \brief Time Client Latency is applied in a positive direction */ -#define CFE_TIME_FLAG_SERVER 0x0040 /**< \brief This instance of Time Services is a Time Server */ -#define CFE_TIME_FLAG_GDTONE 0x0020 /**< \brief The tone received is good compared to the last tone received */ -#define CFE_TIME_FLAG_UNUSED 0x001F /**< \brief Reserved flags - should be zero */ +#define CFE_TIME_FLAG_CLKSET 0x8000 /**< \brief The spacecraft time has been set */ +#define CFE_TIME_FLAG_FLYING 0x4000 /**< \brief This instance of Time Services is flywheeling */ +#define CFE_TIME_FLAG_SRCINT 0x2000 /**< \brief The clock source is set to "internal" */ +#define CFE_TIME_FLAG_SIGPRI 0x1000 /**< \brief The clock signal is set to "primary" */ +#define CFE_TIME_FLAG_SRVFLY 0x0800 /**< \brief The Time Server is in flywheel mode */ +#define CFE_TIME_FLAG_CMDFLY 0x0400 /**< \brief This instance of Time Services was commanded into flywheel mode */ +#define CFE_TIME_FLAG_ADDADJ 0x0200 /**< \brief One time STCF Adjustment is to be done in positive direction */ +#define CFE_TIME_FLAG_ADD1HZ 0x0100 /**< \brief 1 Hz STCF Adjustment is to be done in a positive direction */ +#define CFE_TIME_FLAG_ADDTCL 0x0080 /**< \brief Time Client Latency is applied in a positive direction */ +#define CFE_TIME_FLAG_SERVER 0x0040 /**< \brief This instance of Time Services is a Time Server */ +#define CFE_TIME_FLAG_GDTONE 0x0020 /**< \brief The tone received is good compared to the last tone received */ +#define CFE_TIME_FLAG_UNUSED 0x001F /**< \brief Reserved flags - should be zero */ /** \} */ - /*************************************************************************/ /** @@ -730,7 +730,7 @@ */ typedef struct CFE_TIME_NoArgsCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } CFE_TIME_NoArgsCmd_t; @@ -751,7 +751,7 @@ typedef CFE_TIME_NoArgsCmd_t CFE_TIME_FakeToneCmd_t; */ typedef struct CFE_TIME_LeapsCmd_Payload { - int16 LeapSeconds; + int16 LeapSeconds; } CFE_TIME_LeapsCmd_Payload_t; /** @@ -768,10 +768,10 @@ typedef struct CFE_TIME_SetLeapSecondsCmd */ typedef struct CFE_TIME_StateCmd_Payload { - int16 ClockState; /**< \brief #CFE_TIME_ClockState_INVALID=Spacecraft time has not been accurately set, - #CFE_TIME_ClockState_VALID=Spacecraft clock has been accurately set, - #CFE_TIME_ClockState_FLYWHEEL=Force into FLYWHEEL mode */ - /**< Selects the current clock state */ + int16 ClockState; /**< \brief #CFE_TIME_ClockState_INVALID=Spacecraft time has not been accurately set, + #CFE_TIME_ClockState_VALID=Spacecraft clock has been accurately set, + #CFE_TIME_ClockState_FLYWHEEL=Force into FLYWHEEL mode */ + /**< Selects the current clock state */ } CFE_TIME_StateCmd_Payload_t; /** @@ -779,19 +779,18 @@ typedef struct CFE_TIME_StateCmd_Payload */ typedef struct CFE_TIME_SetStateCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_StateCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_StateCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_SetStateCmd_t; - /** * \brief Set time data source command payload */ typedef struct CFE_TIME_SourceCmd_Payload { - int16 TimeSource; /**< \brief #CFE_TIME_SourceSelect_INTERNAL=Internal Source, - #CFE_TIME_SourceSelect_EXTERNAL=External Source */ - /**< Selects either the "Internal" and "External" clock source */ + int16 TimeSource; /**< \brief #CFE_TIME_SourceSelect_INTERNAL=Internal Source, + #CFE_TIME_SourceSelect_EXTERNAL=External Source */ + /**< Selects either the "Internal" and "External" clock source */ } CFE_TIME_SourceCmd_Payload_t; /** @@ -799,8 +798,8 @@ typedef struct CFE_TIME_SourceCmd_Payload */ typedef struct CFE_TIME_SetSourceCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_SourceCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_SourceCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_SetSourceCmd_t; /** @@ -808,9 +807,9 @@ typedef struct CFE_TIME_SetSourceCmd */ typedef struct CFE_TIME_SignalCmd_Payload { - int16 ToneSource; /**< \brief #CFE_TIME_ToneSignalSelect_PRIMARY=Primary Source, - #CFE_TIME_ToneSignalSelect_REDUNDANT=Redundant Source */ - /**< Selects either the "Primary" or "Redundant" tone signal source */ + int16 ToneSource; /**< \brief #CFE_TIME_ToneSignalSelect_PRIMARY=Primary Source, + #CFE_TIME_ToneSignalSelect_REDUNDANT=Redundant Source */ + /**< Selects either the "Primary" or "Redundant" tone signal source */ } CFE_TIME_SignalCmd_Payload_t; /** @@ -818,18 +817,17 @@ typedef struct CFE_TIME_SignalCmd_Payload */ typedef struct CFE_TIME_SetSignalCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_SignalCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_SignalCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_SetSignalCmd_t; - /** * \brief Generic seconds, microseconds command payload */ typedef struct CFE_TIME_TimeCmd_Payload { - uint32 Seconds; - uint32 MicroSeconds; + uint32 Seconds; + uint32 MicroSeconds; } CFE_TIME_TimeCmd_Payload_t; /** @@ -837,8 +835,8 @@ typedef struct CFE_TIME_TimeCmd_Payload */ typedef struct CFE_TIME_TimeCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_TimeCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_TimeCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_TimeCmd_t; /* @@ -854,14 +852,13 @@ 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; - /** * \brief Generic seconds, subseconds command payload */ typedef struct CFE_TIME_OneHzAdjustmentCmd_Payload { - uint32 Seconds; - uint32 Subseconds; + uint32 Seconds; + uint32 Subseconds; } CFE_TIME_OneHzAdjustmentCmd_Payload_t; @@ -870,8 +867,8 @@ typedef struct CFE_TIME_OneHzAdjustmentCmd_Payload */ typedef struct CFE_TIME_OneHzAdjustmentCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_OneHzAdjustmentCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_OneHzAdjustmentCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_OneHzAdjustmentCmd_t; /* @@ -887,10 +884,10 @@ typedef CFE_TIME_OneHzAdjustmentCmd_t CFE_TIME_Sub1HZAdjustmentCmd_t; */ typedef struct CFE_TIME_ToneDataCmd_Payload { - CFE_TIME_SysTime_t AtToneMET; /**< \brief MET at time of tone */ - CFE_TIME_SysTime_t AtToneSTCF; /**< \brief STCF at time of tone */ - int16 AtToneLeapSeconds; /**< \brief Leap Seconds at time of tone */ - int16 AtToneState; /**< \brief Clock state at time of tone */ + CFE_TIME_SysTime_t AtToneMET; /**< \brief MET at time of tone */ + CFE_TIME_SysTime_t AtToneSTCF; /**< \brief STCF at time of tone */ + int16 AtToneLeapSeconds; /**< \brief Leap Seconds at time of tone */ + int16 AtToneState; /**< \brief Clock state at time of tone */ } CFE_TIME_ToneDataCmd_Payload_t; /** @@ -898,14 +895,13 @@ typedef struct CFE_TIME_ToneDataCmd_Payload */ typedef struct CFE_TIME_ToneDataCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_ToneDataCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_TIME_ToneDataCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_ToneDataCmd_t; - /*************************************************************************/ -/** +/** ** \cfetimetlm Time Services Housekeeping Packet **/ typedef struct CFE_TIME_HousekeepingTlm_Payload @@ -913,70 +909,69 @@ typedef struct CFE_TIME_HousekeepingTlm_Payload /* ** Task command interface counters... */ - uint8 CommandCounter; /**< \cfetlmmnemonic \TIME_CMDPC - \brief Time Command Execution Counter */ - uint8 CommandErrorCounter; /**< \cfetlmmnemonic \TIME_CMDEC - \brief Time Command Error Counter */ + uint8 CommandCounter; /**< \cfetlmmnemonic \TIME_CMDPC + \brief Time Command Execution Counter */ + uint8 CommandErrorCounter; /**< \cfetlmmnemonic \TIME_CMDEC + \brief Time Command Error Counter */ /* ** Clock state flags and "as calculated" clock state... */ - uint16 ClockStateFlags; /**< \cfetlmmnemonic \TIME_STATEFLG - \brief State Flags */ - int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE - \brief API State */ + uint16 ClockStateFlags; /**< \cfetlmmnemonic \TIME_STATEFLG + \brief State Flags */ + int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE + \brief API State */ /* ** Leap Seconds... */ - int16 LeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPSECS - \brief Current Leaps Seconds */ + int16 LeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPSECS + \brief Current Leaps Seconds */ /* ** Current MET and STCF time values... */ - uint32 SecondsMET; /**< \cfetlmmnemonic \TIME_METSECS - \brief Current MET (seconds) */ - uint32 SubsecsMET; /**< \cfetlmmnemonic \TIME_METSUBSECS - \brief Current MET (sub-seconds) */ + uint32 SecondsMET; /**< \cfetlmmnemonic \TIME_METSECS + \brief Current MET (seconds) */ + uint32 SubsecsMET; /**< \cfetlmmnemonic \TIME_METSUBSECS + \brief Current MET (sub-seconds) */ - uint32 SecondsSTCF; /**< \cfetlmmnemonic \TIME_STCFSECS - \brief Current STCF (seconds) */ - uint32 SubsecsSTCF; /**< \cfetlmmnemonic \TIME_STCFSUBSECS - \brief Current STCF (sub-seconds) */ + uint32 SecondsSTCF; /**< \cfetlmmnemonic \TIME_STCFSECS + \brief Current STCF (seconds) */ + uint32 SubsecsSTCF; /**< \cfetlmmnemonic \TIME_STCFSUBSECS + \brief Current STCF (sub-seconds) */ - /* - ** 1Hz STCF adjustment values (server only)... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - uint32 Seconds1HzAdj; /**< \cfetlmmnemonic \TIME_1HZADJSECS - \brief Current 1 Hz SCTF adjustment (seconds) */ - uint32 Subsecs1HzAdj; /**< \cfetlmmnemonic \TIME_1HZADJSSECS - \brief Current 1 Hz SCTF adjustment (sub-seconds) */ - #endif +/* +** 1Hz STCF adjustment values (server only)... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) + uint32 Seconds1HzAdj; /**< \cfetlmmnemonic \TIME_1HZADJSECS + \brief Current 1 Hz SCTF adjustment (seconds) */ + uint32 Subsecs1HzAdj; /**< \cfetlmmnemonic \TIME_1HZADJSSECS + \brief Current 1 Hz SCTF adjustment (sub-seconds) */ +#endif - /* - ** Time at tone delay values (client only)... - */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - uint32 SecondsDelay; /**< \cfetlmmnemonic \TIME_1HZDLYSECS - \brief Current 1 Hz SCTF Delay (seconds) */ - uint32 SubsecsDelay; /**< \cfetlmmnemonic \TIME_1HZDLYSSECS - \brief Current 1 Hz SCTF Delay (sub-seconds) */ - #endif +/* +** Time at tone delay values (client only)... +*/ +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) + uint32 SecondsDelay; /**< \cfetlmmnemonic \TIME_1HZDLYSECS + \brief Current 1 Hz SCTF Delay (seconds) */ + uint32 SubsecsDelay; /**< \cfetlmmnemonic \TIME_1HZDLYSSECS + \brief Current 1 Hz SCTF Delay (sub-seconds) */ +#endif } CFE_TIME_HousekeepingTlm_Payload_t; typedef struct CFE_TIME_HousekeepingTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_TIME_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_TIME_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TIME_HousekeepingTlm_t; - /*************************************************************************/ -/** +/** ** \cfetimetlm Time Services Diagnostics Packet **/ typedef struct CFE_TIME_DiagnosticTlm_Payload @@ -984,111 +979,111 @@ typedef struct CFE_TIME_DiagnosticTlm_Payload /* ** Data values used to compute time (in reference to "tone")... */ - CFE_TIME_SysTime_t AtToneMET; /**< \cfetlmmnemonic \TIME_TMETS - \brief MET at time of tone */ - CFE_TIME_SysTime_t AtToneSTCF; /**< \cfetlmmnemonic \TIME_STCFS - \brief STCF at time of tone */ - CFE_TIME_SysTime_t AtToneDelay; /**< \cfetlmmnemonic \TIME_LATENTS - \brief Adjustment for slow tone detection */ - CFE_TIME_SysTime_t AtToneLatch; /**< \cfetlmmnemonic \TIME_TVALIDS - \brief Local clock latched at time of tone */ - - int16 AtToneLeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPS - \brief Leap Seconds at time of tone */ - int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE - \brief Clock state as per API */ + CFE_TIME_SysTime_t AtToneMET; /**< \cfetlmmnemonic \TIME_TMETS + \brief MET at time of tone */ + CFE_TIME_SysTime_t AtToneSTCF; /**< \cfetlmmnemonic \TIME_STCFS + \brief STCF at time of tone */ + CFE_TIME_SysTime_t AtToneDelay; /**< \cfetlmmnemonic \TIME_LATENTS + \brief Adjustment for slow tone detection */ + CFE_TIME_SysTime_t AtToneLatch; /**< \cfetlmmnemonic \TIME_TVALIDS + \brief Local clock latched at time of tone */ + + int16 AtToneLeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPS + \brief Leap Seconds at time of tone */ + int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE + \brief Clock state as per API */ /* ** Data values that reflect the time (right now)... */ - CFE_TIME_SysTime_t TimeSinceTone; /**< \cfetlmmnemonic \TIME_ELAPSEDS - \brief Time elapsed since the tone */ - CFE_TIME_SysTime_t CurrentLatch; /**< \cfetlmmnemonic \TIME_LOCALS - \brief Local clock latched just "now" */ - CFE_TIME_SysTime_t CurrentMET; /**< \cfetlmmnemonic \TIME_METS - \brief MET at this instant */ - CFE_TIME_SysTime_t CurrentTAI; /**< \cfetlmmnemonic \TIME_TAIS - \brief TAI at this instant */ - CFE_TIME_SysTime_t CurrentUTC; /**< \cfetlmmnemonic \TIME_UTCS - \brief UTC at this instant */ + CFE_TIME_SysTime_t TimeSinceTone; /**< \cfetlmmnemonic \TIME_ELAPSEDS + \brief Time elapsed since the tone */ + CFE_TIME_SysTime_t CurrentLatch; /**< \cfetlmmnemonic \TIME_LOCALS + \brief Local clock latched just "now" */ + CFE_TIME_SysTime_t CurrentMET; /**< \cfetlmmnemonic \TIME_METS + \brief MET at this instant */ + CFE_TIME_SysTime_t CurrentTAI; /**< \cfetlmmnemonic \TIME_TAIS + \brief TAI at this instant */ + CFE_TIME_SysTime_t CurrentUTC; /**< \cfetlmmnemonic \TIME_UTCS + \brief UTC at this instant */ /* ** Data values used to define the current clock state... */ - int16 ClockSetState; /**< \cfetlmmnemonic \TIME_VALID - \brief Time has been "set" */ - int16 ClockFlyState; /**< \cfetlmmnemonic \TIME_FLYWHEEL - \brief Current fly-wheel state */ - int16 ClockSource; /**< \cfetlmmnemonic \TIME_SOURCE - \brief Internal vs external, etc. */ - int16 ClockSignal; /**< \cfetlmmnemonic \TIME_SIGNAL - \brief Primary vs redundant, etc. */ - int16 ServerFlyState; /**< \cfetlmmnemonic \TIME_SRVFLY - \brief Used by clients only */ - int16 Forced2Fly; /**< \cfetlmmnemonic \TIME_CMD2FLY - \brief Commanded into fly-wheel */ + int16 ClockSetState; /**< \cfetlmmnemonic \TIME_VALID + \brief Time has been "set" */ + int16 ClockFlyState; /**< \cfetlmmnemonic \TIME_FLYWHEEL + \brief Current fly-wheel state */ + int16 ClockSource; /**< \cfetlmmnemonic \TIME_SOURCE + \brief Internal vs external, etc. */ + int16 ClockSignal; /**< \cfetlmmnemonic \TIME_SIGNAL + \brief Primary vs redundant, etc. */ + int16 ServerFlyState; /**< \cfetlmmnemonic \TIME_SRVFLY + \brief Used by clients only */ + int16 Forced2Fly; /**< \cfetlmmnemonic \TIME_CMD2FLY + \brief Commanded into fly-wheel */ /* ** Clock state flags... */ - uint16 ClockStateFlags;/**< \cfetlmmnemonic \TIME_STATEFLAGS - \brief Clock State Flags */ + uint16 ClockStateFlags; /**< \cfetlmmnemonic \TIME_STATEFLAGS + \brief Clock State Flags */ /* ** STCF adjustment direction values... */ - int16 OneTimeDirection; /**< \cfetlmmnemonic \TIME_ADJUSTDIR - \brief One time STCF adjustment direction (Add = 1, Sub = 2) */ - int16 OneHzDirection; /**< \cfetlmmnemonic \TIME_1HZADJDIR - \brief 1Hz STCF adjustment direction */ - int16 DelayDirection; /**< \cfetlmmnemonic \TIME_LATENTDIR - \brief Client latency adjustment direction */ + int16 OneTimeDirection; /**< \cfetlmmnemonic \TIME_ADJUSTDIR + \brief One time STCF adjustment direction (Add = 1, Sub = 2) */ + int16 OneHzDirection; /**< \cfetlmmnemonic \TIME_1HZADJDIR + \brief 1Hz STCF adjustment direction */ + int16 DelayDirection; /**< \cfetlmmnemonic \TIME_LATENTDIR + \brief Client latency adjustment direction */ /* ** STCF adjustment values... */ - CFE_TIME_SysTime_t OneTimeAdjust; /**< \cfetlmmnemonic \TIME_ADJUSTS - \brief Previous one-time STCF adjustment */ - CFE_TIME_SysTime_t OneHzAdjust; /**< \cfetlmmnemonic \TIME_1HZADJS - \brief Current 1Hz STCF adjustment */ + CFE_TIME_SysTime_t OneTimeAdjust; /**< \cfetlmmnemonic \TIME_ADJUSTS + \brief Previous one-time STCF adjustment */ + CFE_TIME_SysTime_t OneHzAdjust; /**< \cfetlmmnemonic \TIME_1HZADJS + \brief Current 1Hz STCF adjustment */ /* ** Most recent local clock latch values... */ - CFE_TIME_SysTime_t ToneSignalLatch; /**< \cfetlmmnemonic \TIME_TTS - \brief Local Clock latched at most recent tone signal */ - CFE_TIME_SysTime_t ToneDataLatch; /**< \cfetlmmnemonic \TIME_TDS - \brief Local Clock latched at arrival of tone data */ + CFE_TIME_SysTime_t ToneSignalLatch; /**< \cfetlmmnemonic \TIME_TTS + \brief Local Clock latched at most recent tone signal */ + CFE_TIME_SysTime_t ToneDataLatch; /**< \cfetlmmnemonic \TIME_TDS + \brief Local Clock latched at arrival of tone data */ /* ** Miscellaneous counters (subject to reset command)... */ - uint32 ToneMatchCounter; /**< \cfetlmmnemonic \TIME_VERIFYCNT - \brief Tone signal / data verification count */ - uint32 ToneMatchErrorCounter; /**< \cfetlmmnemonic \TIME_VERIFYER - \brief Tone signal / data verification error count */ - uint32 ToneSignalCounter; /**< \cfetlmmnemonic \TIME_TSDETCNT - \brief Tone signal detected SB message count */ - uint32 ToneDataCounter; /**< \cfetlmmnemonic \TIME_TATTCNT - \brief Time at the tone data SB message count */ - uint32 ToneIntCounter; /**< \cfetlmmnemonic \TIME_TSISRCNT - \brief Tone signal ISR execution count */ - uint32 ToneIntErrorCounter; /**< \cfetlmmnemonic \TIME_TSISRERR - \brief Tone signal ISR error count */ - uint32 ToneTaskCounter; /**< \cfetlmmnemonic \TIME_TSTASKCNT - \brief Tone task execution count */ - uint32 VersionCounter; /**< \cfetlmmnemonic \TIME_VERSIONCNT - \brief Count of mods to time at tone reference data (version) */ - uint32 LocalIntCounter; /**< \cfetlmmnemonic \TIME_1HZISRCNT - \brief Local 1Hz ISR execution count */ - uint32 LocalTaskCounter; /**< \cfetlmmnemonic \TIME_1HZTASKCNT - \brief Local 1Hz task execution count */ + uint32 ToneMatchCounter; /**< \cfetlmmnemonic \TIME_VERIFYCNT + \brief Tone signal / data verification count */ + uint32 ToneMatchErrorCounter; /**< \cfetlmmnemonic \TIME_VERIFYER + \brief Tone signal / data verification error count */ + uint32 ToneSignalCounter; /**< \cfetlmmnemonic \TIME_TSDETCNT + \brief Tone signal detected SB message count */ + uint32 ToneDataCounter; /**< \cfetlmmnemonic \TIME_TATTCNT + \brief Time at the tone data SB message count */ + uint32 ToneIntCounter; /**< \cfetlmmnemonic \TIME_TSISRCNT + \brief Tone signal ISR execution count */ + uint32 ToneIntErrorCounter; /**< \cfetlmmnemonic \TIME_TSISRERR + \brief Tone signal ISR error count */ + uint32 ToneTaskCounter; /**< \cfetlmmnemonic \TIME_TSTASKCNT + \brief Tone task execution count */ + uint32 VersionCounter; /**< \cfetlmmnemonic \TIME_VERSIONCNT + \brief Count of mods to time at tone reference data (version) */ + uint32 LocalIntCounter; /**< \cfetlmmnemonic \TIME_1HZISRCNT + \brief Local 1Hz ISR execution count */ + uint32 LocalTaskCounter; /**< \cfetlmmnemonic \TIME_1HZTASKCNT + \brief Local 1Hz task execution count */ /* ** Miscellaneous counters (not subject to reset command)... */ - uint32 VirtualMET; /**< \cfetlmmnemonic \TIME_LOGICALMET - \brief Software MET */ + uint32 VirtualMET; /**< \cfetlmmnemonic \TIME_LOGICALMET + \brief Software MET */ /* ** Time window verification values (converted from micro-secs)... @@ -1099,40 +1094,38 @@ typedef struct CFE_TIME_DiagnosticTlm_Payload ** be as little as zero, and the maximum must be something less ** than a second. */ - uint32 MinElapsed; /**< \cfetlmmnemonic \TIME_MINWINDOW - \brief Min tone signal / data pkt arrival window (Sub-seconds) */ - uint32 MaxElapsed; /**< \cfetlmmnemonic \TIME_MAXWINDOW - \brief Max tone signal / data pkt arrival window (Sub-seconds) */ + uint32 MinElapsed; /**< \cfetlmmnemonic \TIME_MINWINDOW + \brief Min tone signal / data pkt arrival window (Sub-seconds) */ + uint32 MaxElapsed; /**< \cfetlmmnemonic \TIME_MAXWINDOW + \brief Max tone signal / data pkt arrival window (Sub-seconds) */ /* ** Maximum local clock value (before roll-over)... */ - CFE_TIME_SysTime_t MaxLocalClock; /**< \cfetlmmnemonic \TIME_WRAPS - \brief Max local clock value before rollover */ + CFE_TIME_SysTime_t MaxLocalClock; /**< \cfetlmmnemonic \TIME_WRAPS + \brief Max local clock value before rollover */ /* ** Tone signal tolerance limits... */ - uint32 ToneOverLimit; /**< \cfetlmmnemonic \TIME_MAXSS - \brief Max between tone signal interrupts */ - uint32 ToneUnderLimit; /**< \cfetlmmnemonic \TIME_MINSS - \brief Min between tone signal interrupts */ + uint32 ToneOverLimit; /**< \cfetlmmnemonic \TIME_MAXSS + \brief Max between tone signal interrupts */ + uint32 ToneUnderLimit; /**< \cfetlmmnemonic \TIME_MINSS + \brief Min between tone signal interrupts */ /* ** Reset Area... */ - uint32 DataStoreStatus; /**< \cfetlmmnemonic \TIME_ATASTSTAT - \brief Data Store status (preserved across processor reset) */ + uint32 DataStoreStatus; /**< \cfetlmmnemonic \TIME_ATASTSTAT + \brief Data Store status (preserved across processor reset) */ } CFE_TIME_DiagnosticTlm_Payload_t; typedef struct CFE_TIME_DiagnosticTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_TIME_DiagnosticTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + CFE_TIME_DiagnosticTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TIME_DiagnosticTlm_t; - - #endif /* _cfe_time_msg_ */ /************************/ diff --git a/modules/time/fsw/src/cfe_time_api.c b/modules/time/fsw/src/cfe_time_api.c index 61b16e809..e1ad20845 100644 --- a/modules/time/fsw/src/cfe_time_api.c +++ b/modules/time/fsw/src/cfe_time_api.c @@ -29,7 +29,6 @@ ** */ - /* ** Required header files... */ @@ -40,7 +39,7 @@ /* * Function: CFE_TIME_GetTime - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_GetTime(void) +CFE_TIME_SysTime_t CFE_TIME_GetTime(void) { CFE_TIME_SysTime_t CurrentTime; @@ -54,24 +53,23 @@ CFE_TIME_SysTime_t CFE_TIME_GetTime(void) #endif - return(CurrentTime); + return (CurrentTime); } /* End of CFE_TIME_GetTime() */ - /* * Function: CFE_TIME_GetTAI - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_GetTAI(void) +CFE_TIME_SysTime_t CFE_TIME_GetTAI(void) { CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t tai; + CFE_TIME_SysTime_t tai; /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); - + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); + /* ** Get reference time values (local time, time at tone, etc.)... */ @@ -82,23 +80,22 @@ CFE_TIME_SysTime_t CFE_TIME_GetTAI(void) */ tai = CFE_TIME_CalculateTAI(&Reference); - return(tai); + return (tai); } /* End of CFE_TIME_GetTAI() */ - /* * Function: CFE_TIME_GetUTC - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_GetUTC(void) +CFE_TIME_SysTime_t CFE_TIME_GetUTC(void) { CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t utc; + CFE_TIME_SysTime_t utc; /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); /* ** Get reference time values (local time, time at tone, etc.)... */ @@ -109,14 +106,14 @@ CFE_TIME_SysTime_t CFE_TIME_GetUTC(void) */ utc = CFE_TIME_CalculateUTC(&Reference); - return(utc); + return (utc); } /* End of CFE_TIME_GetUTC() */ /* * Function: CFE_TIME_MET2SCTime - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_MET2SCTime (CFE_TIME_SysTime_t METTime) +CFE_TIME_SysTime_t CFE_TIME_MET2SCTime(CFE_TIME_SysTime_t METTime) { CFE_TIME_SysTime_t STCF; @@ -125,7 +122,7 @@ CFE_TIME_SysTime_t CFE_TIME_MET2SCTime (CFE_TIME_SysTime_t METTime) #if (CFE_MISSION_TIME_CFG_DEFAULT_TAI != true) CFE_TIME_SysTime_t LeapSecsAsSysTime; #endif - + STCF = CFE_TIME_GetSTCF(); /* TIA = MET + STCF */ @@ -138,29 +135,29 @@ CFE_TIME_SysTime_t CFE_TIME_MET2SCTime (CFE_TIME_SysTime_t METTime) #else /* Put leap seconds in correct format */ - LeapSecsAsSysTime.Seconds = CFE_TIME_GetLeapSeconds(); - LeapSecsAsSysTime.Subseconds = 0; - + LeapSecsAsSysTime.Seconds = CFE_TIME_GetLeapSeconds(); + LeapSecsAsSysTime.Subseconds = 0; + /* UTC Time = TIA Time - Leap Seconds */ ReturnTime = CFE_TIME_Subtract(TIATime, LeapSecsAsSysTime); #endif return (ReturnTime); -}/* end CFE_TIME_MET2SCTime() */ +} /* end CFE_TIME_MET2SCTime() */ /* * Function: CFE_TIME_GetClockState - See API and header file for details */ -CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void) +CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void) { - CFE_TIME_Reference_t Reference; + CFE_TIME_Reference_t Reference; CFE_TIME_ClockState_Enum_t state; - + /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); /* ** Get reference time values (local time, time at tone, etc.)... */ @@ -169,9 +166,9 @@ CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void) /* ** Determine the current clock state... */ - state = (CFE_TIME_ClockState_Enum_t) CFE_TIME_CalculateState(&Reference); + state = (CFE_TIME_ClockState_Enum_t)CFE_TIME_CalculateState(&Reference); - return(state); + return (state); } /* End of CFE_TIME_GetClockState() */ @@ -180,8 +177,8 @@ CFE_TIME_ClockState_Enum_t CFE_TIME_GetClockState(void) */ uint16 CFE_TIME_GetClockInfo(void) { - uint16 StateFlags = 0; - volatile CFE_TIME_ReferenceState_t *RefState = CFE_TIME_GetReferenceState(); + uint16 StateFlags = 0; + volatile CFE_TIME_ReferenceState_t *RefState = CFE_TIME_GetReferenceState(); /* ** Spacecraft time has been set... @@ -246,141 +243,134 @@ uint16 CFE_TIME_GetClockInfo(void) { StateFlags |= CFE_TIME_FLAG_ADDTCL; } - /* - ** This instance of Time Service is a "server"... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +/* +** This instance of Time Service is a "server"... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) StateFlags |= CFE_TIME_FLAG_SERVER; - #endif +#endif - /* - ** The tone is good + /* + ** The tone is good */ if (CFE_TIME_Global.IsToneGood == true) { StateFlags |= CFE_TIME_FLAG_GDTONE; - } + } - return(StateFlags); + return (StateFlags); } /* End of CFE_TIME_GetClockInfo() */ - /* * Function: CFE_TIME_GetLeapSeconds - See API and header file for details */ -int16 CFE_TIME_GetLeapSeconds(void) +int16 CFE_TIME_GetLeapSeconds(void) { CFE_TIME_Reference_t Reference; /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); /* ** Get reference time values (local time, time at tone, etc.)... */ CFE_TIME_GetReference(&Reference); - return(Reference.AtToneLeapSeconds); + return (Reference.AtToneLeapSeconds); } /* End of CFE_TIME_GetLeapSeconds() */ - /* * Function: CFE_TIME_GetSTCF - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void) +CFE_TIME_SysTime_t CFE_TIME_GetSTCF(void) { CFE_TIME_Reference_t Reference; - + /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); - + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); + /* ** Get reference time values (local time, time at tone, etc.)... */ CFE_TIME_GetReference(&Reference); - return(Reference.AtToneSTCF); + return (Reference.AtToneSTCF); } /* End of CFE_TIME_GetSTCF() */ - /* * Function: CFE_TIME_GetMET - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_GetMET(void) +CFE_TIME_SysTime_t CFE_TIME_GetMET(void) { CFE_TIME_Reference_t Reference; - - /* Zero out the Reference variable because we pass it into + + /* Zero out the Reference variable because we pass it into * a function before using it */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); - + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); /* ** Get reference time values (local time, time at tone, etc.)... */ CFE_TIME_GetReference(&Reference); - return(Reference.CurrentMET); + return (Reference.CurrentMET); } /* End of CFE_TIME_GetMET() */ - /* * Function: CFE_TIME_GetMETseconds - See API and header file for details */ -uint32 CFE_TIME_GetMETseconds(void) +uint32 CFE_TIME_GetMETseconds(void) { CFE_TIME_Reference_t Reference; /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); - /* ** Get reference time values (local time, time at tone, etc.)... */ CFE_TIME_GetReference(&Reference); - return(Reference.CurrentMET.Seconds); + return (Reference.CurrentMET.Seconds); } /* End of CFE_TIME_GetMETseconds() */ /* * Function: CFE_TIME_GetMETsubsecs - See API and header file for details */ -uint32 CFE_TIME_GetMETsubsecs(void) +uint32 CFE_TIME_GetMETsubsecs(void) { CFE_TIME_Reference_t Reference; /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); - + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); + /* ** Get reference time values (local time, time at tone, etc.)... */ CFE_TIME_GetReference(&Reference); - return(Reference.CurrentMET.Subseconds); + return (Reference.CurrentMET.Subseconds); } /* End of CFE_TIME_GetMETsubsecs() */ - /* * Function: CFE_TIME_Add - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) +CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) { CFE_TIME_SysTime_t Result; @@ -398,15 +388,14 @@ CFE_TIME_SysTime_t CFE_TIME_Add(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Ti Result.Seconds = Time1.Seconds + Time2.Seconds; } - return(Result); + return (Result); } /* End of CFE_TIME_Add() */ - /* * Function: CFE_TIME_Subtract - See API and header file for details */ -CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) +CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) { CFE_TIME_SysTime_t Result; @@ -421,14 +410,14 @@ CFE_TIME_SysTime_t CFE_TIME_Subtract(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime Result.Seconds = Time1.Seconds - Time2.Seconds; } - return(Result); + return (Result); } /* End of CFE_TIME_Subtract() */ /* * Function: CFE_TIME_Compare - See API and header file for details */ -CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_t TimeB) +CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_t TimeB) { CFE_TIME_Compare_t Result; @@ -479,19 +468,18 @@ CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_ } } - return(Result); + return (Result); } /* End of CFE_TIME_Compare() */ - /* * Function: CFE_TIME_Sub2MicroSecs - See API and header file for details */ -uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) +uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) { OS_time_t tm; - /* + /* ** Convert using the OSAL method. Note that there ** is no range check here because any uint32 value is valid, ** and OSAL will handle and properly convert any input. @@ -502,14 +490,13 @@ uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds) } /* End of CFE_TIME_Sub2MicroSecs() */ - /* * Function: CFE_TIME_Micro2SubSecs - See API and header file for details */ -uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds) +uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds) { OS_time_t tm; - uint32 SubSeconds; + uint32 SubSeconds; /* ** Conversion amount must be less than one second @@ -524,11 +511,11 @@ uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds) /* ** Convert micro-seconds count to sub-seconds (1/2^32) count using OSAL */ - tm = OS_TimeAssembleFromNanoseconds(0, MicroSeconds * 1000); + tm = OS_TimeAssembleFromNanoseconds(0, MicroSeconds * 1000); SubSeconds = OS_TimeGetSubsecondsPart(tm); } - return(SubSeconds); + return (SubSeconds); } /* End of CFE_TIME_Micro2SubSecs() */ @@ -606,7 +593,7 @@ void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint) } else { - /* Do Nothing. Non-leap year. */ + /* Do Nothing. Non-leap year. */ } } @@ -640,41 +627,46 @@ void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint) /* ** Build formatted output string (yyyy-ddd-hh:mm:ss.xxxxx)... */ - *PrintBuffer++ = '0' + (char) (NumberOfYears / 1000); NumberOfYears = NumberOfYears % 1000; - *PrintBuffer++ = '0' + (char) (NumberOfYears / 100); NumberOfYears = NumberOfYears % 100; - *PrintBuffer++ = '0' + (char) (NumberOfYears / 10); - *PrintBuffer++ = '0' + (char) (NumberOfYears % 10); + *PrintBuffer++ = '0' + (char)(NumberOfYears / 1000); + NumberOfYears = NumberOfYears % 1000; + *PrintBuffer++ = '0' + (char)(NumberOfYears / 100); + NumberOfYears = NumberOfYears % 100; + *PrintBuffer++ = '0' + (char)(NumberOfYears / 10); + *PrintBuffer++ = '0' + (char)(NumberOfYears % 10); *PrintBuffer++ = '-'; - *PrintBuffer++ = '0' + (char) (NumberOfDays / 100); NumberOfDays = NumberOfDays % 100; - *PrintBuffer++ = '0' + (char) (NumberOfDays / 10); - *PrintBuffer++ = '0' + (char) (NumberOfDays % 10); + *PrintBuffer++ = '0' + (char)(NumberOfDays / 100); + NumberOfDays = NumberOfDays % 100; + *PrintBuffer++ = '0' + (char)(NumberOfDays / 10); + *PrintBuffer++ = '0' + (char)(NumberOfDays % 10); *PrintBuffer++ = '-'; - *PrintBuffer++ = '0' + (char) (NumberOfHours / 10); - *PrintBuffer++ = '0' + (char) (NumberOfHours % 10); + *PrintBuffer++ = '0' + (char)(NumberOfHours / 10); + *PrintBuffer++ = '0' + (char)(NumberOfHours % 10); *PrintBuffer++ = ':'; - *PrintBuffer++ = '0' + (char) (NumberOfMinutes / 10); - *PrintBuffer++ = '0' + (char) (NumberOfMinutes % 10); + *PrintBuffer++ = '0' + (char)(NumberOfMinutes / 10); + *PrintBuffer++ = '0' + (char)(NumberOfMinutes % 10); *PrintBuffer++ = ':'; - *PrintBuffer++ = '0' + (char) (NumberOfSeconds / 10); - *PrintBuffer++ = '0' + (char) (NumberOfSeconds % 10); + *PrintBuffer++ = '0' + (char)(NumberOfSeconds / 10); + *PrintBuffer++ = '0' + (char)(NumberOfSeconds % 10); *PrintBuffer++ = '.'; - *PrintBuffer++ = '0' + (char) (NumberOfMicros / 10000); NumberOfMicros = NumberOfMicros % 10000; - *PrintBuffer++ = '0' + (char) (NumberOfMicros / 1000); NumberOfMicros = NumberOfMicros % 1000; - *PrintBuffer++ = '0' + (char) (NumberOfMicros / 100); NumberOfMicros = NumberOfMicros % 100; - *PrintBuffer++ = '0' + (char) (NumberOfMicros / 10); - *PrintBuffer++ = '0' + (char) (NumberOfMicros % 10); + *PrintBuffer++ = '0' + (char)(NumberOfMicros / 10000); + NumberOfMicros = NumberOfMicros % 10000; + *PrintBuffer++ = '0' + (char)(NumberOfMicros / 1000); + NumberOfMicros = NumberOfMicros % 1000; + *PrintBuffer++ = '0' + (char)(NumberOfMicros / 100); + NumberOfMicros = NumberOfMicros % 100; + *PrintBuffer++ = '0' + (char)(NumberOfMicros / 10); + *PrintBuffer++ = '0' + (char)(NumberOfMicros % 10); *PrintBuffer++ = '\0'; return; } /* End of CFE_TIME_Print() */ - /* * Function: CFE_TIME_ExternalTone - See API and header file for details */ @@ -689,15 +681,14 @@ void CFE_TIME_ExternalTone(void) } /* End of CFE_TIME_ExternalTone() */ - /* * Function: CFE_TIME_RegisterSynchCallback - See API and header file for details */ -int32 CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) +int32 CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) { - int32 Status; + int32 Status; CFE_ES_AppId_t AppId; - uint32 AppIndex; + uint32 AppIndex; if (CallbackFuncPtr == NULL) { @@ -723,19 +714,18 @@ int32 CFE_TIME_RegisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPt } } } - + return Status; } /* End of CFE_TIME_RegisterSynchCallback() */ - /* * Function: CFE_TIME_UnregisterSynchCallback - See API and header file for details */ -int32 CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) +int32 CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFuncPtr) { - int32 Status; + int32 Status; CFE_ES_AppId_t AppId; - uint32 AppIndex; + uint32 AppIndex; if (CallbackFuncPtr == NULL) { @@ -754,7 +744,7 @@ int32 CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFunc } if (AppIndex >= (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])) || - CFE_TIME_Global.SynchCallback[AppIndex].Ptr != CallbackFuncPtr) + CFE_TIME_Global.SynchCallback[AppIndex].Ptr != CallbackFuncPtr) { Status = CFE_TIME_CALLBACK_NOT_REGISTERED; } @@ -762,11 +752,10 @@ int32 CFE_TIME_UnregisterSynchCallback(CFE_TIME_SynchCallbackPtr_t CallbackFunc { CFE_TIME_Global.SynchCallback[AppIndex].Ptr = NULL; } - + return Status; } /* End of CFE_TIME_UnregisterSynchCallback() */ - /* * Function: CFE_TIME_ExternalMET - See API and header file for details */ @@ -783,7 +772,6 @@ void CFE_TIME_ExternalMET(CFE_TIME_SysTime_t NewMET) } /* End of CFE_TIME_ExternalMET() */ #endif /* CFE_PLATFORM_TIME_CFG_SRC_MET */ - /* * Function: CFE_TIME_ExternalGPS - See API and header file for details */ @@ -800,7 +788,6 @@ void CFE_TIME_ExternalGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) } /* End of CFE_TIME_ExternalGPS() */ #endif /* CFE_PLATFORM_TIME_CFG_SRC_GPS */ - /* * Function: CFE_TIME_ExternalTime - See API and header file for details */ @@ -817,7 +804,6 @@ void CFE_TIME_ExternalTime(CFE_TIME_SysTime_t NewTime) } /* End of CFE_TIME_ExternalTime() */ #endif /* CFE_PLATFORM_TIME_CFG_SRC_TIME */ - /************************/ /* End of File Comment */ /************************/ diff --git a/modules/time/fsw/src/cfe_time_module_all.h b/modules/time/fsw/src/cfe_time_module_all.h index e5a401f0f..c7aab6da7 100644 --- a/modules/time/fsw/src/cfe_time_module_all.h +++ b/modules/time/fsw/src/cfe_time_module_all.h @@ -20,10 +20,10 @@ /** * @file cfe_time_module_all.h - * + * * Encapsulates all TIME module internal header files, as well * as the public API from all other CFE core modules, OSAL, and PSP. - * + * * This simplifies the set of include files that need to be put at the * start of every source file. */ @@ -33,7 +33,7 @@ /********************* Include Files ************************/ -#include "cfe.h" /* All CFE+OSAL public API definitions */ +#include "cfe.h" /* All CFE+OSAL public API definitions */ #include "cfe_platform_cfg.h" #include "cfe_msgids.h" @@ -45,5 +45,4 @@ #include "cfe_time_events.h" #include "cfe_time_utils.h" - -#endif /* CFE_TIME_MODULE_ALL_H */ +#endif /* CFE_TIME_MODULE_ALL_H */ diff --git a/modules/time/fsw/src/cfe_time_task.c b/modules/time/fsw/src/cfe_time_task.c index 99f1b371c..e535be358 100644 --- a/modules/time/fsw/src/cfe_time_task.c +++ b/modules/time/fsw/src/cfe_time_task.c @@ -29,7 +29,6 @@ ** */ - /* ** Required header files... */ @@ -41,7 +40,6 @@ */ CFE_TIME_Global_t CFE_TIME_Global; - /* ** Command handler for "HK request"... */ @@ -73,7 +71,7 @@ int32 CFE_TIME_OneHzCmd(const CFE_TIME_1HzCmd_t *data); ** Time Server. ** ** In "fake tone" mode this command is locally generated -** however it is still sent via the software bus, thereby +** however it is still sent via the software bus, thereby ** utilizing (mostly) the same code path as the ** non-fake tone mode. */ @@ -85,7 +83,8 @@ int32 CFE_TIME_ToneSendCmd(const CFE_TIME_FakeToneCmd_t *data); * Ground command helper functions */ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction); -void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction); +void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction); void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction); /* @@ -121,11 +120,10 @@ int32 CFE_TIME_EarlyInit(void) */ CFE_TIME_InitData(); - return ( CFE_SUCCESS); + return (CFE_SUCCESS); } /* End of CFE_TIME_EarlyInit() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_TaskMain() -- Task entry point and main process loop */ @@ -136,19 +134,19 @@ void CFE_TIME_TaskMain(void) { int32 Status; CFE_SB_Buffer_t *SBBufPtr; - + CFE_ES_PerfLogEntry(CFE_MISSION_TIME_MAIN_PERF_ID); - + Status = CFE_TIME_TaskInit(); - - if(Status != CFE_SUCCESS) + + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); - CFE_ES_PerfLogExit(CFE_MISSION_TIME_MAIN_PERF_ID); - /* Note: CFE_ES_ExitApp will not return */ - CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); - }/* end if */ - + CFE_ES_WriteToSysLog("TIME:Application Init Failed,RC=0x%08X\n", (unsigned int)Status); + CFE_ES_PerfLogExit(CFE_MISSION_TIME_MAIN_PERF_ID); + /* Note: CFE_ES_ExitApp will not return */ + CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); + } /* end if */ + /* * Wait for other apps to start. * It is important that the core apps are present before this starts receiving @@ -160,35 +158,34 @@ void CFE_TIME_TaskMain(void) /* Main loop */ while (Status == CFE_SUCCESS) { - - /* Increment the Main task Execution Counter */ - CFE_ES_IncrementTaskCounter(); - - CFE_ES_PerfLogExit(CFE_MISSION_TIME_MAIN_PERF_ID); - - /* Pend on receipt of packet */ - Status = CFE_SB_ReceiveBuffer(&SBBufPtr, - CFE_TIME_Global.CmdPipe, - CFE_SB_PEND_FOREVER); - - CFE_ES_PerfLogEntry(CFE_MISSION_TIME_MAIN_PERF_ID); - - if (Status == CFE_SUCCESS) - { - /* Process cmd pipe msg */ - CFE_TIME_TaskPipe(SBBufPtr); - }else{ - CFE_ES_WriteToSysLog("TIME:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); - }/* end if */ - - }/* end while */ - + + /* Increment the Main task Execution Counter */ + CFE_ES_IncrementTaskCounter(); + + CFE_ES_PerfLogExit(CFE_MISSION_TIME_MAIN_PERF_ID); + + /* Pend on receipt of packet */ + Status = CFE_SB_ReceiveBuffer(&SBBufPtr, CFE_TIME_Global.CmdPipe, CFE_SB_PEND_FOREVER); + + CFE_ES_PerfLogEntry(CFE_MISSION_TIME_MAIN_PERF_ID); + + if (Status == CFE_SUCCESS) + { + /* Process cmd pipe msg */ + 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_ReceiveBuffer returns error */ CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); } /* end CFE_TIME_TaskMain */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_TaskInit() -- Time task initialization */ @@ -197,188 +194,157 @@ void CFE_TIME_TaskMain(void) int32 CFE_TIME_TaskInit(void) { - int32 Status; + int32 Status; osal_id_t TimeBaseId; osal_id_t TimerId; Status = CFE_ES_RegisterApp(); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + CFE_ES_WriteToSysLog("TIME:Call to CFE_ES_RegisterApp Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + Status = CFE_EVS_Register(NULL, 0, 0); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Call to CFE_EVS_Register Failed:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - Status = OS_BinSemCreate(&CFE_TIME_Global.ToneSemaphore, - CFE_TIME_SEM_TONE_NAME, - CFE_TIME_SEM_VALUE, - CFE_TIME_SEM_OPTIONS); - if(Status != CFE_SUCCESS) + CFE_ES_WriteToSysLog("TIME:Call to CFE_EVS_Register Failed:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = OS_BinSemCreate(&CFE_TIME_Global.ToneSemaphore, CFE_TIME_SEM_TONE_NAME, CFE_TIME_SEM_VALUE, + CFE_TIME_SEM_OPTIONS); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating tone semaphore:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - Status = OS_BinSemCreate(&CFE_TIME_Global.LocalSemaphore, - CFE_TIME_SEM_1HZ_NAME, - CFE_TIME_SEM_VALUE, - CFE_TIME_SEM_OPTIONS); - if(Status != CFE_SUCCESS) + CFE_ES_WriteToSysLog("TIME:Error creating tone semaphore:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = OS_BinSemCreate(&CFE_TIME_Global.LocalSemaphore, CFE_TIME_SEM_1HZ_NAME, CFE_TIME_SEM_VALUE, + CFE_TIME_SEM_OPTIONS); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating local semaphore:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - - Status = CFE_ES_CreateChildTask(&CFE_TIME_Global.ToneTaskID, - CFE_TIME_TASK_TONE_NAME, - CFE_TIME_Tone1HzTask, - CFE_TIME_TASK_STACK_PTR, - CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE, - CFE_PLATFORM_TIME_TONE_TASK_PRIORITY, - CFE_TIME_TASK_FLAGS); - if(Status != CFE_SUCCESS) + CFE_ES_WriteToSysLog("TIME:Error creating local semaphore:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = CFE_ES_CreateChildTask(&CFE_TIME_Global.ToneTaskID, CFE_TIME_TASK_TONE_NAME, CFE_TIME_Tone1HzTask, + CFE_TIME_TASK_STACK_PTR, CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE, + CFE_PLATFORM_TIME_TONE_TASK_PRIORITY, CFE_TIME_TASK_FLAGS); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating tone 1Hz child task:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - - Status = CFE_ES_CreateChildTask(&CFE_TIME_Global.LocalTaskID, - CFE_TIME_TASK_1HZ_NAME, - CFE_TIME_Local1HzTask, - CFE_TIME_TASK_STACK_PTR, - CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE, - CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY, - CFE_TIME_TASK_FLAGS); - if(Status != CFE_SUCCESS) + CFE_ES_WriteToSysLog("TIME:Error creating tone 1Hz child task:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + + Status = CFE_ES_CreateChildTask(&CFE_TIME_Global.LocalTaskID, CFE_TIME_TASK_1HZ_NAME, CFE_TIME_Local1HzTask, + CFE_TIME_TASK_STACK_PTR, CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE, + CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY, CFE_TIME_TASK_FLAGS); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating local 1Hz child task:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + CFE_ES_WriteToSysLog("TIME:Error creating local 1Hz child task:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ Status = CFE_SB_CreatePipe(&CFE_TIME_Global.CmdPipe, CFE_TIME_TASK_PIPE_DEPTH, CFE_TIME_TASK_PIPE_NAME); - if(Status != CFE_SUCCESS) + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error creating cmd pipe:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + CFE_ES_WriteToSysLog("TIME:Error creating cmd pipe:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_HK_MID), - CFE_TIME_Global.CmdPipe); - if(Status != CFE_SUCCESS) + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_HK_MID), CFE_TIME_Global.CmdPipe); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to HK Request:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + CFE_ES_WriteToSysLog("TIME:Error subscribing to HK Request:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ +/* +** Subscribe to time at the tone "signal" commands... +*/ +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), CFE_TIME_Global.CmdPipe); +#endif - /* - ** Subscribe to time at the tone "signal" commands... - */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), - CFE_TIME_Global.CmdPipe); - #endif - - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), - CFE_TIME_Global.CmdPipe,4); - #endif - if(Status != CFE_SUCCESS) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), CFE_TIME_Global.CmdPipe, 4); +#endif + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to tone cmd:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + CFE_ES_WriteToSysLog("TIME:Error subscribing to tone cmd:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ +/* +** Subscribe to time at the tone "data" commands... +*/ +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), CFE_TIME_Global.CmdPipe); +#endif - /* - ** Subscribe to time at the tone "data" commands... - */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), - CFE_TIME_Global.CmdPipe); - #endif - - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), - CFE_TIME_Global.CmdPipe,4); - #endif - if(Status != CFE_SUCCESS) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), CFE_TIME_Global.CmdPipe, 4); +#endif + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to time data cmd:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - - /* - ** Subscribe to 1Hz signal commands... - */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), - CFE_TIME_Global.CmdPipe); - #endif - - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), - CFE_TIME_Global.CmdPipe,4); - #endif - - if(Status != CFE_SUCCESS) + CFE_ES_WriteToSysLog("TIME:Error subscribing to time data cmd:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + +/* +** Subscribe to 1Hz signal commands... +*/ +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_Global.CmdPipe); +#endif + +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_Global.CmdPipe, 4); +#endif + + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to fake tone signal cmds:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - - - /* - ** Subscribe to time at the tone "request data" commands... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), - CFE_TIME_Global.CmdPipe); - if(Status != CFE_SUCCESS) + CFE_ES_WriteToSysLog("TIME:Error subscribing to fake tone signal cmds:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ + +/* +** Subscribe to time at the tone "request data" commands... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), CFE_TIME_Global.CmdPipe); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to time at the tone request data cmds:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - #endif + CFE_ES_WriteToSysLog("TIME:Error subscribing to time at the tone request data cmds:RC=0x%08X\n", + (unsigned int)Status); + return Status; + } /* end if */ +#endif /* ** Subscribe to Time task ground command packets... */ - Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_CMD_MID), - CFE_TIME_Global.CmdPipe); - if(Status != CFE_SUCCESS) + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_CMD_MID), CFE_TIME_Global.CmdPipe); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error subscribing to time task gnd cmds:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ - + CFE_ES_WriteToSysLog("TIME:Error subscribing to time task gnd cmds:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ - Status = CFE_EVS_SendEvent(CFE_TIME_INIT_EID, - CFE_EVS_EventType_INFORMATION, - "cFE TIME Initialized"); - if(Status != CFE_SUCCESS) + Status = CFE_EVS_SendEvent(CFE_TIME_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE TIME Initialized"); + if (Status != CFE_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:Error sending init event:RC=0x%08X\n",(unsigned int)Status); - return Status; - }/* end if */ + CFE_ES_WriteToSysLog("TIME:Error sending init event:RC=0x%08X\n", (unsigned int)Status); + return Status; + } /* end if */ - /* - ** Select primary vs redundant tone interrupt signal... - */ - #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) +/* +** Select primary vs redundant tone interrupt signal... +*/ +#if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) OS_SelectTone(CFE_TIME_Global.ClockSignal); - #endif +#endif /* * Check to see if the OSAL in use implements the TimeBase API @@ -399,16 +365,15 @@ int32 CFE_TIME_TaskInit(void) Status = OS_TimerSet(TimerId, 500000, 1000000); if (Status != OS_SUCCESS) { - CFE_ES_WriteToSysLog("TIME:1Hz OS_TimerSet failed:RC=0x%08X\n",(unsigned int)Status); + CFE_ES_WriteToSysLog("TIME:1Hz OS_TimerSet failed:RC=0x%08X\n", (unsigned int)Status); } } else { - CFE_ES_WriteToSysLog("TIME:1Hz OS_TimerAdd failed:RC=0x%08X\n",(unsigned int)Status); + CFE_ES_WriteToSysLog("TIME:1Hz OS_TimerAdd failed:RC=0x%08X\n", (unsigned int)Status); } } - return CFE_SUCCESS; } /* End of CFE_TIME_TaskInit() */ @@ -444,17 +409,16 @@ bool CFE_TIME_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) CFE_EVS_SendEvent(CFE_TIME_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, - (unsigned int)ActualLength, (unsigned int)ExpectedLength); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength, + (unsigned int)ExpectedLength); result = false; ++CFE_TIME_Global.CommandErrorCounter; } - return(result); + return (result); } /* End of CFE_TIME_VerifyCmdLength() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_TaskPipe() -- Process command pipe message */ @@ -463,7 +427,7 @@ bool CFE_TIME_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) void CFE_TIME_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) { - CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); @@ -498,14 +462,14 @@ void CFE_TIME_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) CFE_TIME_OneHzCmd((CFE_TIME_1HzCmd_t *)SBBufPtr); break; - /* - ** Request for time at the tone "data"... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +/* +** Request for time at the tone "data"... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) case CFE_TIME_SEND_CMD_MID: CFE_TIME_ToneSendCmd((CFE_TIME_FakeToneCmd_t *)SBBufPtr); break; - #endif +#endif /* ** Time task ground commands... @@ -637,9 +601,8 @@ void CFE_TIME_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_CC_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid command code -- ID = 0x%X, CC = %d", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), - (int)CommandCode); + "Invalid command code -- ID = 0x%X, CC = %d", + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode); break; } /* switch (CFE_TIME_CMD_MID -- command code)*/ break; @@ -650,8 +613,7 @@ void CFE_TIME_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) ** Note: we only increment the command error counter when ** processing CFE_TIME_CMD_MID commands... */ - CFE_EVS_SendEvent(CFE_TIME_ID_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid message ID -- ID = 0x%X", + CFE_EVS_SendEvent(CFE_TIME_ID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid message ID -- ID = 0x%X", (unsigned int)CFE_SB_MsgIdToValue(MessageID)); break; @@ -661,7 +623,6 @@ void CFE_TIME_TaskPipe(CFE_SB_Buffer_t *SBBufPtr) } /* End of CFE_TIME_TaskPipe() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_HousekeepingCmd() -- On-board command (HK request) */ @@ -701,7 +662,6 @@ int32 CFE_TIME_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) } /* End of CFE_TIME_HousekeepingCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneSignalCmd() -- Time at tone command (signal) */ @@ -723,7 +683,6 @@ int32 CFE_TIME_ToneSignalCmd(const CFE_TIME_ToneSignalCmd_t *data) } /* End of CFE_TIME_ToneSignalCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneDataCmd() -- Time at tone command (data) */ @@ -745,7 +704,6 @@ int32 CFE_TIME_ToneDataCmd(const CFE_TIME_ToneDataCmd_t *data) } /* End of CFE_TIME_ToneDataCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * CFE_TIME_OneHzCmd() -- Execute state machine tasks required at 1Hz @@ -782,7 +740,6 @@ int32 CFE_TIME_OneHzCmd(const CFE_TIME_1HzCmd_t *data) } /* End of CFE_TIME_OneHzCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneSendCmd() -- Time at tone command (send data) */ @@ -817,14 +774,12 @@ int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data) CFE_TIME_Global.CommandCounter++; - CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, - "No-op command.%s", CFE_VERSION_STRING); + CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op command.%s", CFE_VERSION_STRING); return CFE_SUCCESS; } /* End of CFE_TIME_NoopCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ResetCountersCmd() -- Time task ground command (reset counters)*/ @@ -834,40 +789,37 @@ int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data) int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCountersCmd_t *data) { - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - CFE_TIME_Global.ToneMatchCounter = 0; + CFE_TIME_Global.ToneMatchCounter = 0; CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_Global.ToneSignalCounter = 0; CFE_TIME_Global.ToneDataCounter = 0; - CFE_TIME_Global.ToneIntCounter = 0; - CFE_TIME_Global.ToneIntErrorCounter = 0; - CFE_TIME_Global.ToneTaskCounter = 0; + CFE_TIME_Global.ToneIntCounter = 0; + CFE_TIME_Global.ToneIntErrorCounter = 0; + CFE_TIME_Global.ToneTaskCounter = 0; /* * Note: Not resetting "LastVersion" counter here, that might * disturb access to the time reference data by other tasks */ - CFE_TIME_Global.ResetVersionCounter = - CFE_TIME_Global.LastVersionCounter; + CFE_TIME_Global.ResetVersionCounter = CFE_TIME_Global.LastVersionCounter; - CFE_TIME_Global.LocalIntCounter = 0; - CFE_TIME_Global.LocalTaskCounter = 0; + CFE_TIME_Global.LocalIntCounter = 0; + CFE_TIME_Global.LocalTaskCounter = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.ExternalCount = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.ExternalCount = 0; - CFE_EVS_SendEvent(CFE_TIME_RESET_EID, CFE_EVS_EventType_DEBUG, - "Reset Counters command"); + CFE_EVS_SendEvent(CFE_TIME_RESET_EID, CFE_EVS_EventType_DEBUG, "Reset Counters command"); return CFE_SUCCESS; } /* End of CFE_TIME_ResetCountersCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_DiagCmd() -- Time task ground command (diagnostics) */ @@ -889,14 +841,12 @@ int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticCmd_t *data) CFE_SB_TimeStampMsg(&CFE_TIME_Global.DiagPacket.TlmHeader.Msg); CFE_SB_TransmitMsg(&CFE_TIME_Global.DiagPacket.TlmHeader.Msg, true); - CFE_EVS_SendEvent(CFE_TIME_DIAG_EID, CFE_EVS_EventType_DEBUG, - "Request diagnostics command"); + CFE_EVS_SendEvent(CFE_TIME_DIAG_EID, CFE_EVS_EventType_DEBUG, "Request diagnostics command"); return CFE_SUCCESS; } /* End of CFE_TIME_DiagCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetStateCmd() -- Time task command (set clock state) */ @@ -906,13 +856,13 @@ int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticCmd_t *data) int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetStateCmd_t *data) { const CFE_TIME_StateCmd_Payload_t *CommandPtr = &data->Payload; - const char *ClockStateText; + const char * ClockStateText; /* ** Verify command argument value (clock state)... */ if ((CommandPtr->ClockState == CFE_TIME_ClockState_INVALID) || - (CommandPtr->ClockState == CFE_TIME_ClockState_VALID) || + (CommandPtr->ClockState == CFE_TIME_ClockState_VALID) || (CommandPtr->ClockState == CFE_TIME_ClockState_FLYWHEEL)) { CFE_TIME_SetState(CommandPtr->ClockState); @@ -934,21 +884,19 @@ int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetStateCmd_t *data) } CFE_TIME_Global.CommandCounter++; - CFE_EVS_SendEvent(CFE_TIME_STATE_EID, CFE_EVS_EventType_INFORMATION, - "Set Clock State = %s", ClockStateText); + CFE_EVS_SendEvent(CFE_TIME_STATE_EID, CFE_EVS_EventType_INFORMATION, "Set Clock State = %s", ClockStateText); } else { CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_STATE_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid Clock State = 0x%X", (unsigned int)CommandPtr->ClockState); + CFE_EVS_SendEvent(CFE_TIME_STATE_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Clock State = 0x%X", + (unsigned int)CommandPtr->ClockState); } return CFE_SUCCESS; } /* End of CFE_TIME_SetStateCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetSourceCmd() -- Time task command (set time source) */ @@ -959,9 +907,9 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) { const CFE_TIME_SourceCmd_Payload_t *CommandPtr = &data->Payload; - #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) +#if (CFE_PLATFORM_TIME_CFG_SOURCE == true) const char *TimeSourceText; - #endif +#endif /* ** Verify command argument value (time data source)... @@ -969,7 +917,7 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) if ((CommandPtr->TimeSource == CFE_TIME_SourceSelect_INTERNAL) || (CommandPtr->TimeSource == CFE_TIME_SourceSelect_EXTERNAL)) { - #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) +#if (CFE_PLATFORM_TIME_CFG_SOURCE == true) /* ** Only systems configured to select source of time data... */ @@ -989,20 +937,18 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) TimeSourceText = "EXTERNAL"; } - CFE_EVS_SendEvent(CFE_TIME_SOURCE_EID, - CFE_EVS_EventType_INFORMATION, - "Set Time Source = %s", TimeSourceText); + CFE_EVS_SendEvent(CFE_TIME_SOURCE_EID, CFE_EVS_EventType_INFORMATION, "Set Time Source = %s", TimeSourceText); - #else /* not CFE_PLATFORM_TIME_CFG_SOURCE */ +#else /* not CFE_PLATFORM_TIME_CFG_SOURCE */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_SOURCE_CFG_EID, CFE_EVS_EventType_ERROR, - "Set Source commands invalid without CFE_PLATFORM_TIME_CFG_SOURCE set to TRUE"); + "Set Source commands invalid without CFE_PLATFORM_TIME_CFG_SOURCE set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SOURCE */ +#endif /* CFE_PLATFORM_TIME_CFG_SOURCE */ } else { @@ -1011,15 +957,14 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) */ CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_SOURCE_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid Time Source = 0x%X", (unsigned int)CommandPtr->TimeSource); + CFE_EVS_SendEvent(CFE_TIME_SOURCE_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Time Source = 0x%X", + (unsigned int)CommandPtr->TimeSource); } return CFE_SUCCESS; } /* End of CFE_TIME_SetSourceCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetSignalCmd() -- Time task command (set tone source) */ @@ -1029,9 +974,9 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) { const CFE_TIME_SignalCmd_Payload_t *CommandPtr = &data->Payload; - #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) +#if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) const char *ToneSourceText; - #endif +#endif /* ** Verify command argument value (tone source)... @@ -1039,7 +984,7 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) if ((CommandPtr->ToneSource == CFE_TIME_ToneSignalSelect_PRIMARY) || (CommandPtr->ToneSource == CFE_TIME_ToneSignalSelect_REDUNDANT)) { - #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) +#if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) /* ** Only systems configured to select tone signal... */ @@ -1059,20 +1004,18 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) ToneSourceText = "REDUNDANT"; } - CFE_EVS_SendEvent(CFE_TIME_SIGNAL_EID, - CFE_EVS_EventType_INFORMATION, - "Set Tone Source = %s", ToneSourceText); + CFE_EVS_SendEvent(CFE_TIME_SIGNAL_EID, CFE_EVS_EventType_INFORMATION, "Set Tone Source = %s", ToneSourceText); - #else /* not CFE_PLATFORM_TIME_CFG_SIGNAL */ +#else /* not CFE_PLATFORM_TIME_CFG_SIGNAL */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_SIGNAL_CFG_EID, CFE_EVS_EventType_ERROR, - "Set Signal commands invalid without CFE_PLATFORM_TIME_CFG_SIGNAL set to TRUE"); + "Set Signal commands invalid without CFE_PLATFORM_TIME_CFG_SIGNAL set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SIGNAL */ +#endif /* CFE_PLATFORM_TIME_CFG_SIGNAL */ } else { @@ -1081,15 +1024,14 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) */ CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_SIGNAL_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid Tone Source = 0x%X", (unsigned int)CommandPtr->ToneSource); + CFE_EVS_SendEvent(CFE_TIME_SIGNAL_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Tone Source = 0x%X", + (unsigned int)CommandPtr->ToneSource); } return CFE_SUCCESS; } /* End of CFE_TIME_SetSignalCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetDelayImpl() -- Time task ground command (tone delay)*/ @@ -1103,44 +1045,42 @@ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIM */ if (CommandPtr->MicroSeconds < 1000000) { - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) CFE_TIME_SysTime_t Delay; - Delay.Seconds = CommandPtr->Seconds; + Delay.Seconds = CommandPtr->Seconds; Delay.Subseconds = CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds); CFE_TIME_SetDelay(Delay, Direction); CFE_TIME_Global.CommandCounter++; CFE_EVS_SendEvent(CFE_TIME_DELAY_EID, CFE_EVS_EventType_INFORMATION, - "Set Tone Delay -- secs = %u, usecs = %u, ssecs = 0x%X, dir = %d", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, - (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds), - (int)Direction); + "Set Tone Delay -- secs = %u, usecs = %u, ssecs = 0x%X, dir = %d", + (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, + (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds), (int)Direction); - #else /* not CFE_PLATFORM_TIME_CFG_CLIENT */ +#else /* not CFE_PLATFORM_TIME_CFG_CLIENT */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_DELAY_CFG_EID, CFE_EVS_EventType_ERROR, - "Set Delay commands invalid without CFE_PLATFORM_TIME_CFG_CLIENT set to TRUE"); + "Set Delay commands invalid without CFE_PLATFORM_TIME_CFG_CLIENT set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_CLIENT */ +#endif /* CFE_PLATFORM_TIME_CFG_CLIENT */ } else { CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_DELAY_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid Tone Delay -- secs = %u, usecs = %u", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); + "Invalid Tone Delay -- secs = %u, usecs = %u", (unsigned int)CommandPtr->Seconds, + (unsigned int)CommandPtr->MicroSeconds); } } /* End of CFE_TIME_SetDelayImpl() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_AddSubDelayCmd() -- Time task ground command (tone delay) */ @@ -1150,13 +1090,13 @@ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIM int32 CFE_TIME_AddDelayCmd(const CFE_TIME_AddDelayCmd_t *data) { - CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); - return CFE_SUCCESS; + CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); + return CFE_SUCCESS; } int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelayCmd_t *data) { - CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); - return CFE_SUCCESS; + CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -1174,45 +1114,43 @@ int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data) */ if (CommandPtr->MicroSeconds < 1000000) { - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_SysTime_t NewTime; - NewTime.Seconds = CommandPtr->Seconds; + NewTime.Seconds = CommandPtr->Seconds; NewTime.Subseconds = CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds); CFE_TIME_SetTime(NewTime); CFE_TIME_Global.CommandCounter++; CFE_EVS_SendEvent(CFE_TIME_TIME_EID, CFE_EVS_EventType_INFORMATION, - "Set Time -- secs = %u, usecs = %u, ssecs = 0x%X", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, + "Set Time -- secs = %u, usecs = %u, ssecs = 0x%X", (unsigned int)CommandPtr->Seconds, + (unsigned int)CommandPtr->MicroSeconds, (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds)); - #else /* not CFE_PLATFORM_TIME_CFG_SERVER */ +#else /* not CFE_PLATFORM_TIME_CFG_SERVER */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_TIME_CFG_EID, CFE_EVS_EventType_ERROR, - "Set Time commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); + "Set Time commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ } else { CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_TIME_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid Time -- secs = %u, usecs = %u", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); + CFE_EVS_SendEvent(CFE_TIME_TIME_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Time -- secs = %u, usecs = %u", + (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); } return CFE_SUCCESS; } /* End of CFE_TIME_SetTimeCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetMETCmd() -- Time task ground command (set MET) */ @@ -1233,45 +1171,43 @@ int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data) */ if (CommandPtr->MicroSeconds < 1000000) { - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_SysTime_t NewMET; - NewMET.Seconds = CommandPtr->Seconds; + NewMET.Seconds = CommandPtr->Seconds; NewMET.Subseconds = CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds); CFE_TIME_SetMET(NewMET); CFE_TIME_Global.CommandCounter++; CFE_EVS_SendEvent(CFE_TIME_MET_EID, CFE_EVS_EventType_INFORMATION, - "Set MET -- secs = %u, usecs = %u, ssecs = 0x%X", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, + "Set MET -- secs = %u, usecs = %u, ssecs = 0x%X", (unsigned int)CommandPtr->Seconds, + (unsigned int)CommandPtr->MicroSeconds, (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds)); - #else /* not CFE_PLATFORM_TIME_CFG_SERVER */ +#else /* not CFE_PLATFORM_TIME_CFG_SERVER */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_MET_CFG_EID, CFE_EVS_EventType_ERROR, - "Set MET commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); + "Set MET commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ } else { CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_MET_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid MET -- secs = %u, usecs = %u", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); + CFE_EVS_SendEvent(CFE_TIME_MET_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid MET -- secs = %u, usecs = %u", + (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); } return CFE_SUCCESS; } /* End of CFE_TIME_SetMETCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetSTCFCmd() -- Time task ground command (set STCF) */ @@ -1287,45 +1223,43 @@ int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) */ if (CommandPtr->MicroSeconds < 1000000) { - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_SysTime_t NewSTCF; - NewSTCF.Seconds = CommandPtr->Seconds; + NewSTCF.Seconds = CommandPtr->Seconds; NewSTCF.Subseconds = CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds); CFE_TIME_SetSTCF(NewSTCF); CFE_TIME_Global.CommandCounter++; CFE_EVS_SendEvent(CFE_TIME_STCF_EID, CFE_EVS_EventType_INFORMATION, - "Set STCF -- secs = %u, usecs = %u, ssecs = 0x%X", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, - (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds)); + "Set STCF -- secs = %u, usecs = %u, ssecs = 0x%X", (unsigned int)CommandPtr->Seconds, + (unsigned int)CommandPtr->MicroSeconds, + (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds)); - #else /* not CFE_PLATFORM_TIME_CFG_SERVER */ +#else /* not CFE_PLATFORM_TIME_CFG_SERVER */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_STCF_CFG_EID, CFE_EVS_EventType_ERROR, - "Set STCF commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); + "Set STCF commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ } else { CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_STCF_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid STCF -- secs = %u, usecs = %u", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); + CFE_EVS_SendEvent(CFE_TIME_STCF_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid STCF -- secs = %u, usecs = %u", + (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); } return CFE_SUCCESS; } /* End of CFE_TIME_SetSTCFCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetLeapSecondsCmd() -- Time task ground command (set leaps) */ @@ -1334,7 +1268,7 @@ int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data) { - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) const CFE_TIME_LeapsCmd_Payload_t *CommandPtr = &data->Payload; @@ -1345,25 +1279,24 @@ int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data) CFE_TIME_Global.CommandCounter++; - CFE_EVS_SendEvent(CFE_TIME_LEAPS_EID, CFE_EVS_EventType_INFORMATION, - "Set Leap Seconds = %d", (int)CommandPtr->LeapSeconds); + CFE_EVS_SendEvent(CFE_TIME_LEAPS_EID, CFE_EVS_EventType_INFORMATION, "Set Leap Seconds = %d", + (int)CommandPtr->LeapSeconds); - #else /* not CFE_PLATFORM_TIME_CFG_SERVER */ +#else /* not CFE_PLATFORM_TIME_CFG_SERVER */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_LEAPS_CFG_EID, CFE_EVS_EventType_ERROR, - "Set Leaps commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); + "Set Leaps commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ return CFE_SUCCESS; } /* End of CFE_TIME_SetLeapSecondsCmd() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_AdjustImpl() -- Time task ground command (adjust STCF) */ @@ -1377,39 +1310,38 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ */ if (CommandPtr->MicroSeconds < 1000000) { - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_SysTime_t Adjust; - Adjust.Seconds = CommandPtr->Seconds; + Adjust.Seconds = CommandPtr->Seconds; Adjust.Subseconds = CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds); CFE_TIME_SetAdjust(Adjust, Direction); CFE_TIME_Global.CommandCounter++; CFE_EVS_SendEvent(CFE_TIME_DELTA_EID, CFE_EVS_EventType_INFORMATION, - "STCF Adjust -- secs = %u, usecs = %u, ssecs = 0x%X, dir[1=Pos, 2=Neg] = %d", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, - (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds), - (int)Direction); + "STCF Adjust -- secs = %u, usecs = %u, ssecs = 0x%X, dir[1=Pos, 2=Neg] = %d", + (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, + (unsigned int)CFE_TIME_Micro2SubSecs(CommandPtr->MicroSeconds), (int)Direction); - #else /* not CFE_PLATFORM_TIME_CFG_SERVER */ +#else /* not CFE_PLATFORM_TIME_CFG_SERVER */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_DELTA_CFG_EID, CFE_EVS_EventType_ERROR, - "STCF Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); + "STCF Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ } else { CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_DELTA_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid STCF Adjust -- secs = %u, usecs = %u, dir[1=Pos, 2=Neg] = %d", - (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, (int)Direction); + "Invalid STCF Adjust -- secs = %u, usecs = %u, dir[1=Pos, 2=Neg] = %d", + (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, (int)Direction); } } /* End of CFE_TIME_AdjustImpl() */ @@ -1424,8 +1356,8 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjustCmd_t *data) { - CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); - return CFE_SUCCESS; + CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -1438,8 +1370,8 @@ int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjustCmd_t *data) int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjustCmd_t *data) { - CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); - return CFE_SUCCESS; + CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -1448,12 +1380,13 @@ int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjustCmd_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction) +void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction) { - /* - ** 1Hz adjustments are only valid for "Time Servers"... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +/* +** 1Hz adjustments are only valid for "Time Servers"... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_SysTime_t Adjust; @@ -1463,19 +1396,19 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr CFE_TIME_Global.CommandCounter++; CFE_EVS_SendEvent(CFE_TIME_1HZ_EID, CFE_EVS_EventType_INFORMATION, - "STCF 1Hz Adjust -- secs = %d, ssecs = 0x%X, dir[1=Pos, 2=Neg] = %d", - (int)CommandPtr->Seconds, (unsigned int)CommandPtr->Subseconds, (int)Direction); + "STCF 1Hz Adjust -- secs = %d, ssecs = 0x%X, dir[1=Pos, 2=Neg] = %d", (int)CommandPtr->Seconds, + (unsigned int)CommandPtr->Subseconds, (int)Direction); - #else /* not CFE_PLATFORM_TIME_CFG_SERVER */ +#else /* not CFE_PLATFORM_TIME_CFG_SERVER */ /* ** We want to know if disabled commands are being sent... */ CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_1HZ_CFG_EID, CFE_EVS_EventType_ERROR, - "1Hz Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); + "1Hz Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ } /* End of CFE_TIME_1HzAdjImpl() */ @@ -1489,8 +1422,8 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustmentCmd_t *data) { - CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); - return CFE_SUCCESS; + CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -1503,8 +1436,8 @@ int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustmentCmd_t *data) int32 CFE_TIME_Sub1HZAdjustmentCmd(const CFE_TIME_Sub1HZAdjustmentCmd_t *data) { - CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); - return CFE_SUCCESS; + CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); + return CFE_SUCCESS; } /************************/ diff --git a/modules/time/fsw/src/cfe_time_tone.c b/modules/time/fsw/src/cfe_time_tone.c index 48b765a94..671c8456f 100644 --- a/modules/time/fsw/src/cfe_time_tone.c +++ b/modules/time/fsw/src/cfe_time_tone.c @@ -36,7 +36,6 @@ ** */ - /* ** Required header files... */ @@ -59,14 +58,13 @@ void CFE_TIME_ToneSend(void) { CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t NewMET; + CFE_TIME_SysTime_t NewMET; /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); - /* ** Get reference time values (local time, time at tone, etc.)... */ @@ -91,27 +89,27 @@ void CFE_TIME_ToneSend(void) } else { - /* - ** MET seconds is the count of tone interrupts... - */ - #if (CFE_PLATFORM_TIME_CFG_VIRTUAL == true) +/* +** MET seconds is the count of tone interrupts... +*/ +#if (CFE_PLATFORM_TIME_CFG_VIRTUAL == true) NewMET.Seconds = CFE_TIME_Global.VirtualMET; - #endif +#endif - /* - ** Read MET seconds from a h/w register... - */ - #if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) +/* +** Read MET seconds from a h/w register... +*/ +#if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) OS_GetLocalMET(&NewMET.Seconds); - #endif +#endif } - /* - ** Add a second if the tone has not yet occurred... - */ - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +/* +** Add a second if the tone has not yet occurred... +*/ +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) NewMET.Seconds++; - #endif +#endif /* ** Need to fix this if the tone is not 1Hz... @@ -122,7 +120,7 @@ void CFE_TIME_ToneSend(void) ** Current clock state is a combination of factors... */ - #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN +#ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN /* ** Current clock state is a combination of factors... @@ -133,20 +131,14 @@ void CFE_TIME_ToneSend(void) ** Payload must be big-endian. */ - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = - CFE_MAKE_BIG32(NewMET.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = - CFE_MAKE_BIG32(NewMET.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = - CFE_MAKE_BIG32(Reference.AtToneSTCF.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = - CFE_MAKE_BIG32(Reference.AtToneSTCF.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = - CFE_MAKE_BIG16(Reference.AtToneLeapSeconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = - CFE_MAKE_BIG16(AtToneState); - - #else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = CFE_MAKE_BIG32(NewMET.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = CFE_MAKE_BIG32(NewMET.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = CFE_MAKE_BIG32(Reference.AtToneSTCF.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = CFE_MAKE_BIG32(Reference.AtToneSTCF.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = CFE_MAKE_BIG16(Reference.AtToneLeapSeconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = CFE_MAKE_BIG16(AtToneState); + +#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ /* ** Remainder of time values are unchanged... @@ -160,7 +152,7 @@ void CFE_TIME_ToneSend(void) */ CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = CFE_TIME_CalculateState(&Reference); - #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ +#endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ /* ** Send "time at the tone" command data packet... @@ -177,7 +169,6 @@ void CFE_TIME_ToneSend(void) } /* End of CFE_TIME_ToneSend() */ #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneSendMET() -- Send "time at tone" (external MET) */ @@ -193,23 +184,23 @@ void CFE_TIME_ToneSend(void) int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) { CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t Expected; - CFE_TIME_SysTime_t MinValid; - CFE_TIME_SysTime_t MaxValid; - CFE_TIME_Compare_t MinResult; - CFE_TIME_Compare_t MaxResult; + CFE_TIME_SysTime_t Expected; + CFE_TIME_SysTime_t MinValid; + CFE_TIME_SysTime_t MaxValid; + CFE_TIME_Compare_t MinResult; + CFE_TIME_Compare_t MaxResult; int16 ClockState; int32 Result = CFE_SUCCESS; /* Start Performance Monitoring */ - CFE_ES_PerfLogEntry(CFE_MISSION_TIME_SENDMET_PERF_ID ); + CFE_ES_PerfLogEntry(CFE_MISSION_TIME_SENDMET_PERF_ID); /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); - + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); + /* ** Ignore external time data if commanded to use local MET... */ @@ -232,15 +223,15 @@ int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) /* ** cFE defines MET as being synchronized to the tone signal... */ - Expected.Seconds = Reference.CurrentMET.Seconds; + Expected.Seconds = Reference.CurrentMET.Seconds; Expected.Subseconds = 0; - /* - ** Add a second if the tone has not yet occurred... - */ - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +/* +** Add a second if the tone has not yet occurred... +*/ +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) Expected.Seconds++; - #endif +#endif /* ** Compute minimum and maximum values for valid MET... @@ -258,7 +249,7 @@ int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) ** Ignore bad external time data only if clock state is valid... */ if ((Reference.ClockSetState == CFE_TIME_SetState_WAS_SET) && - ((MinResult == CFE_TIME_A_LT_B) || (MaxResult == CFE_TIME_A_GT_B))) + ((MinResult == CFE_TIME_A_LT_B) || (MaxResult == CFE_TIME_A_GT_B))) { Result = CFE_TIME_OUT_OF_RANGE; @@ -275,32 +266,26 @@ int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) ** Set "time at the tone" command data packet arguments... */ - #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN +#ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN /* ** Payload must be big-endian. */ - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = - CFE_MAKE_BIG32(NewMET.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = - CFE_MAKE_BIG32(NewMET.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = - CFE_MAKE_BIG32(Reference.AtToneSTCF.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = - CFE_MAKE_BIG32(Reference.AtToneSTCF.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = - CFE_MAKE_BIG16(Reference.AtToneLeapSeconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = - CFE_MAKE_BIG16(ClockState); - - #else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ - - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET = NewMET; - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF = Reference.AtToneSTCF; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = CFE_MAKE_BIG32(NewMET.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = CFE_MAKE_BIG32(NewMET.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = CFE_MAKE_BIG32(Reference.AtToneSTCF.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = CFE_MAKE_BIG32(Reference.AtToneSTCF.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = CFE_MAKE_BIG16(Reference.AtToneLeapSeconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = CFE_MAKE_BIG16(ClockState); + +#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ + + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET = NewMET; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF = Reference.AtToneSTCF; CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = Reference.AtToneLeapSeconds; - CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = ClockState; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = ClockState; - #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ +#endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ /* ** Send "time at the tone" command data packet... @@ -316,12 +301,11 @@ int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) /* Exit performance monitoring */ CFE_ES_PerfLogExit(CFE_MISSION_TIME_SENDMET_PERF_ID); - return(Result); + return (Result); } /* End of CFE_TIME_ToneSendMET() */ #endif /* CFE_PLATFORM_TIME_CFG_SRC_MET */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneSendGPS() -- Send "time at tone" (external GPS) */ @@ -337,12 +321,12 @@ int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) { CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t NewSTCF; - CFE_TIME_SysTime_t NewMET; - CFE_TIME_SysTime_t MinValid; - CFE_TIME_SysTime_t MaxValid; - CFE_TIME_Compare_t MinResult; - CFE_TIME_Compare_t MaxResult; + CFE_TIME_SysTime_t NewSTCF; + CFE_TIME_SysTime_t NewMET; + CFE_TIME_SysTime_t MinValid; + CFE_TIME_SysTime_t MaxValid; + CFE_TIME_Compare_t MinResult; + CFE_TIME_Compare_t MaxResult; int16 ClockState; int32 Result = CFE_SUCCESS; @@ -350,9 +334,8 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); - /* ** Ignore external time data if commanded to use local MET... */ @@ -375,27 +358,27 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) /* ** cFE defines MET as being synchronized to the tone signal... */ - NewMET.Seconds = Reference.CurrentMET.Seconds; + NewMET.Seconds = Reference.CurrentMET.Seconds; NewMET.Subseconds = 0; - /* - ** Add a second if the tone has not yet occurred... - */ - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +/* +** Add a second if the tone has not yet occurred... +*/ +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) NewMET.Seconds++; - #endif +#endif /* ** Remove MET from the new time value (leaves STCF)... */ NewSTCF = CFE_TIME_Subtract(NewTime, NewMET); - /* - ** Restore leap seconds if default time format is UTC... - */ - #if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) +/* +** Restore leap seconds if default time format is UTC... +*/ +#if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) NewSTCF.Seconds += NewLeaps; - #endif +#endif /* ** Compute minimum and maximum values for valid STCF... @@ -413,7 +396,7 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) ** If state is valid then ignore bad external time data... */ if ((Reference.ClockSetState == CFE_TIME_SetState_WAS_SET) && - ((MinResult == CFE_TIME_A_LT_B) || (MaxResult == CFE_TIME_A_GT_B))) + ((MinResult == CFE_TIME_A_LT_B) || (MaxResult == CFE_TIME_A_GT_B))) { Result = CFE_TIME_OUT_OF_RANGE; @@ -429,32 +412,26 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) ** Set "time at the tone" command data packet arguments... */ - #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN +#ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN /* ** Payload must be big-endian. */ - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = - CFE_MAKE_BIG32(NewMET.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = - CFE_MAKE_BIG32(NewMET.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = - CFE_MAKE_BIG32(NewSTCF.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = - CFE_MAKE_BIG32(NewSTCF.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = - CFE_MAKE_BIG16(NewLeaps); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = - CFE_MAKE_BIG16(ClockState); - - #else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ - - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET = NewMET; - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF = NewSTCF; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = CFE_MAKE_BIG32(NewMET.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = CFE_MAKE_BIG32(NewMET.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = CFE_MAKE_BIG32(NewSTCF.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = CFE_MAKE_BIG32(NewSTCF.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = CFE_MAKE_BIG16(NewLeaps); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = CFE_MAKE_BIG16(ClockState); + +#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ + + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET = NewMET; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF = NewSTCF; CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = NewLeaps; - CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = ClockState; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = ClockState; - #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ +#endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ /* ** Send "time at the tone" command data packet... @@ -468,12 +445,11 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) } } - return(Result); + return (Result); } /* End of CFE_TIME_ToneSendGPS() */ #endif /* CFE_PLATFORM_TIME_CFG_SRC_GPS */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneSendTime() -- Send "time at tone" (external time) */ @@ -489,12 +465,12 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) { CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t NewSTCF; - CFE_TIME_SysTime_t NewMET; - CFE_TIME_SysTime_t MinValid; - CFE_TIME_SysTime_t MaxValid; - CFE_TIME_Compare_t MinResult; - CFE_TIME_Compare_t MaxResult; + CFE_TIME_SysTime_t NewSTCF; + CFE_TIME_SysTime_t NewMET; + CFE_TIME_SysTime_t MinValid; + CFE_TIME_SysTime_t MaxValid; + CFE_TIME_Compare_t MinResult; + CFE_TIME_Compare_t MaxResult; int16 ClockState; int32 Result = CFE_SUCCESS; @@ -502,8 +478,8 @@ int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); - + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); + /* ** Ignore external time data if commanded to use local MET... */ @@ -526,27 +502,27 @@ int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) /* ** cFE defines MET as being synchronized to the tone signal... */ - NewMET.Seconds = Reference.CurrentMET.Seconds; + NewMET.Seconds = Reference.CurrentMET.Seconds; NewMET.Subseconds = 0; - /* - ** Add a second if the tone has not yet occurred... - */ - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +/* +** Add a second if the tone has not yet occurred... +*/ +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) NewMET.Seconds++; - #endif +#endif /* ** Remove MET from the new time value (leaves STCF)... */ NewSTCF = CFE_TIME_Subtract(NewTime, NewMET); - /* - ** Restore leap seconds if default time format is UTC... - */ - #if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) +/* +** Restore leap seconds if default time format is UTC... +*/ +#if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) NewSTCF.Seconds += Reference.AtToneLeapSeconds; - #endif +#endif /* ** Compute minimum and maximum values for valid STCF... @@ -564,7 +540,7 @@ int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) ** If state is valid then ignore bad external time data... */ if ((Reference.ClockSetState == CFE_TIME_SetState_WAS_SET) && - ((MinResult == CFE_TIME_A_LT_B) || (MaxResult == CFE_TIME_A_GT_B))) + ((MinResult == CFE_TIME_A_LT_B) || (MaxResult == CFE_TIME_A_GT_B))) { Result = CFE_TIME_OUT_OF_RANGE; @@ -581,33 +557,27 @@ int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) ** Set "time at the tone" command data packet arguments... */ - #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN +#ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN /* ** Payload must be big-endian. */ - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = - CFE_MAKE_BIG32(NewMET.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = - CFE_MAKE_BIG32(NewMET.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = - CFE_MAKE_BIG32(NewSTCF.Seconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = - CFE_MAKE_BIG32(NewSTCF.Subseconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = - CFE_MAKE_BIG16(Reference.AtToneLeapSeconds); - CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = - CFE_MAKE_BIG16(ClockState); - - #else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ - - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET = NewMET; - CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF = NewSTCF; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = CFE_MAKE_BIG32(NewMET.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = CFE_MAKE_BIG32(NewMET.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Seconds = CFE_MAKE_BIG32(NewSTCF.Seconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF.Subseconds = CFE_MAKE_BIG32(NewSTCF.Subseconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = CFE_MAKE_BIG16(Reference.AtToneLeapSeconds); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = CFE_MAKE_BIG16(ClockState); + +#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ + + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET = NewMET; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneSTCF = NewSTCF; CFE_TIME_Global.ToneDataCmd.Payload.AtToneLeapSeconds = Reference.AtToneLeapSeconds; - CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = ClockState; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneState = ClockState; - #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ +#endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ /* ** Send "time at the tone" command data packet... @@ -621,12 +591,11 @@ int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) } } - return(Result); + return (Result); } /* End of CFE_TIME_ToneSendTime() */ #endif /* CFE_PLATFORM_TIME_CFG_SRC_TIME */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneData() -- process "time at tone" data packet */ @@ -638,61 +607,56 @@ void CFE_TIME_ToneData(const CFE_TIME_ToneDataCmd_Payload_t *ToneDataCmd) /* ** Save the time when the data packet was received... */ - CFE_TIME_Global.ToneDataLatch = CFE_TIME_LatchClock(); + CFE_TIME_Global.ToneDataLatch = CFE_TIME_LatchClock(); /* ** Save the data packet (may be a while before the data is used)... */ - #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN +#ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN /* ** Tone data will be big-endian, convert to platform-endian. */ - CFE_TIME_Global.PendingMET.Seconds = - CFE_MAKE_BIG32(ToneDataCmd->AtToneMET.Seconds); - CFE_TIME_Global.PendingMET.Subseconds = - CFE_MAKE_BIG32(ToneDataCmd->AtToneMET.Subseconds); - CFE_TIME_Global.PendingSTCF.Seconds = - CFE_MAKE_BIG32(ToneDataCmd->AtToneSTCF.Seconds); - CFE_TIME_Global.PendingSTCF.Subseconds = - CFE_MAKE_BIG32(ToneDataCmd->AtToneSTCF.Subseconds); - CFE_TIME_Global.PendingLeaps = CFE_MAKE_BIG16(ToneDataCmd->AtToneLeapSeconds); - CFE_TIME_Global.PendingState = CFE_MAKE_BIG16(ToneDataCmd->AtToneState); - - #else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ + CFE_TIME_Global.PendingMET.Seconds = CFE_MAKE_BIG32(ToneDataCmd->AtToneMET.Seconds); + CFE_TIME_Global.PendingMET.Subseconds = CFE_MAKE_BIG32(ToneDataCmd->AtToneMET.Subseconds); + CFE_TIME_Global.PendingSTCF.Seconds = CFE_MAKE_BIG32(ToneDataCmd->AtToneSTCF.Seconds); + CFE_TIME_Global.PendingSTCF.Subseconds = CFE_MAKE_BIG32(ToneDataCmd->AtToneSTCF.Subseconds); + CFE_TIME_Global.PendingLeaps = CFE_MAKE_BIG16(ToneDataCmd->AtToneLeapSeconds); + CFE_TIME_Global.PendingState = CFE_MAKE_BIG16(ToneDataCmd->AtToneState); + +#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ CFE_TIME_Copy(&CFE_TIME_Global.PendingMET, &ToneDataCmd->AtToneMET); CFE_TIME_Copy(&CFE_TIME_Global.PendingSTCF, &ToneDataCmd->AtToneSTCF); CFE_TIME_Global.PendingLeaps = ToneDataCmd->AtToneLeapSeconds; CFE_TIME_Global.PendingState = ToneDataCmd->AtToneState; - #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ +#endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ - /* - ** If the data packet is designed to arrive after the tone... - ** - ** Check to see if the most recent tone signal matches this - ** data packet. If so, we have a matched pair and can - ** now start using the new data to compute time. - */ - #if (CFE_MISSION_TIME_AT_TONE_WAS == true) - CFE_TIME_ToneVerify(CFE_TIME_Global.ToneSignalLatch, - CFE_TIME_Global.ToneDataLatch); - #endif +/* +** If the data packet is designed to arrive after the tone... +** +** Check to see if the most recent tone signal matches this +** data packet. If so, we have a matched pair and can +** now start using the new data to compute time. +*/ +#if (CFE_MISSION_TIME_AT_TONE_WAS == true) + CFE_TIME_ToneVerify(CFE_TIME_Global.ToneSignalLatch, CFE_TIME_Global.ToneDataLatch); +#endif - /* - ** If the data packet is designed to arrive before the tone... - ** - ** We don't really need to do anything except to save the time - ** and contents of this data packet. (above) - ** - ** Note that we do not immediately start using the data packet - ** values to compute current time. We continue to use the - ** old tone/data combo until we get a new matched pair. - */ - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) - #endif +/* +** If the data packet is designed to arrive before the tone... +** +** We don't really need to do anything except to save the time +** and contents of this data packet. (above) +** +** Note that we do not immediately start using the data packet +** values to compute current time. We continue to use the +** old tone/data combo until we get a new matched pair. +*/ +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +#endif /* ** Maintain a count of tone data packets... @@ -703,7 +667,6 @@ void CFE_TIME_ToneData(const CFE_TIME_ToneDataCmd_Payload_t *ToneDataCmd) } /* End of CFE_TIME_ToneData() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneSignal() -- "tone signal" occurred recently */ @@ -727,31 +690,30 @@ void CFE_TIME_ToneData(const CFE_TIME_ToneDataCmd_Payload_t *ToneDataCmd) void CFE_TIME_ToneSignal(void) { - /* - ** If the data packet is designed to arrive after the tone signal... - ** - ** We don't really need to do anything except latch the local clock - ** at the moment of the tone. And that has already happened at - ** the time when the tone was detected. - ** - ** Note that we do not immediately start using this latched value to - ** compute current time. We continue to use the old tone/data - ** combo until we get a new matched pair. - */ - #if (CFE_MISSION_TIME_AT_TONE_WAS == true) - #endif +/* +** If the data packet is designed to arrive after the tone signal... +** +** We don't really need to do anything except latch the local clock +** at the moment of the tone. And that has already happened at +** the time when the tone was detected. +** +** Note that we do not immediately start using this latched value to +** compute current time. We continue to use the old tone/data +** combo until we get a new matched pair. +*/ +#if (CFE_MISSION_TIME_AT_TONE_WAS == true) +#endif - /* - ** If the data packet is designed to arrive before the tone signal... - ** - ** Check to see if the most recent data packet matches this - ** tone signal. If so, we have a matched pair and can - ** now start using the new data to compute time. - */ - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) - CFE_TIME_ToneVerify(CFE_TIME_Global.ToneDataLatch, - CFE_TIME_Global.ToneSignalLatch); - #endif +/* +** If the data packet is designed to arrive before the tone signal... +** +** Check to see if the most recent data packet matches this +** tone signal. If so, we have a matched pair and can +** now start using the new data to compute time. +*/ +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) + CFE_TIME_ToneVerify(CFE_TIME_Global.ToneDataLatch, CFE_TIME_Global.ToneSignalLatch); +#endif /* ** Maintain a count of tone signal packets... @@ -762,7 +724,6 @@ void CFE_TIME_ToneSignal(void) } /* End of CFE_TIME_ToneSignal() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneVerify() -- validate tone and data packet */ @@ -789,8 +750,8 @@ void CFE_TIME_ToneVerify(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) CFE_TIME_Compare_t result; CFE_TIME_SysTime_t elapsed; - static CFE_TIME_SysTime_t PrevTime1 = {0,0}; - static CFE_TIME_SysTime_t PrevTime2 = {0,0}; + static CFE_TIME_SysTime_t PrevTime1 = {0, 0}; + static CFE_TIME_SysTime_t PrevTime2 = {0, 0}; /* ** It is possible to call this func with static time value... @@ -832,8 +793,7 @@ void CFE_TIME_ToneVerify(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) /* ** Ensure that time between packet and tone is within limits... */ - if ((elapsed.Seconds != 0) || - (elapsed.Subseconds < CFE_TIME_Global.MinElapsed) || + if ((elapsed.Seconds != 0) || (elapsed.Subseconds < CFE_TIME_Global.MinElapsed) || (elapsed.Subseconds > CFE_TIME_Global.MaxElapsed)) { /* @@ -866,7 +826,6 @@ void CFE_TIME_ToneVerify(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) } /* End of CFE_TIME_ToneVerify() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_ToneUpdate() -- process "matching" tone & data packet */ @@ -875,8 +834,8 @@ void CFE_TIME_ToneVerify(CFE_TIME_SysTime_t Time1, CFE_TIME_SysTime_t Time2) void CFE_TIME_ToneUpdate(void) { - CFE_TIME_Reference_t Reference; - bool NewFlywheelStatus = false; + CFE_TIME_Reference_t Reference; + bool NewFlywheelStatus = false; volatile CFE_TIME_ReferenceState_t *NextState; /* @@ -892,7 +851,7 @@ void CFE_TIME_ToneUpdate(void) */ NextState = CFE_TIME_StartReferenceUpdate(); - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) /* ** Time servers cannot always use the new time data from the ** packet (saved as "pending" when the packet arrived). @@ -933,49 +892,49 @@ void CFE_TIME_ToneUpdate(void) ** Note: It is OK to not bother with reading the h/w MET ** since we sync'ed them at the moment of the tone. */ - NextState->AtToneMET.Seconds = CFE_TIME_Global.VirtualMET; + NextState->AtToneMET.Seconds = CFE_TIME_Global.VirtualMET; NextState->AtToneMET.Subseconds = 0; } else { - /* - ** Update "time at tone" with external MET data... - */ - #if (CFE_PLATFORM_TIME_CFG_SRC_MET == true) - NextState->AtToneMET = CFE_TIME_Global.PendingMET; +/* +** Update "time at tone" with external MET data... +*/ +#if (CFE_PLATFORM_TIME_CFG_SRC_MET == true) + NextState->AtToneMET = CFE_TIME_Global.PendingMET; CFE_TIME_Global.VirtualMET = CFE_TIME_Global.PendingMET.Seconds; - #endif +#endif - /* - ** Update "time at tone" with external GPS data... - ** - ** STCF = GPS time at the tone - local MET at the tone - ** Leaps = GPS leaps - ** - ** It is possible that a command changed the MET after it was used - ** to calculate the pending STCF -- in which case the current - ** time will jump next second when the STCF gets calculated - ** again with the new MET value. This (small) possibility can - ** be prevented by switching to "internal" mode before sending - ** set time commands... - */ - #if (CFE_PLATFORM_TIME_CFG_SRC_GPS == true) - NextState->AtToneMET.Seconds = CFE_TIME_Global.VirtualMET; +/* +** Update "time at tone" with external GPS data... +** +** STCF = GPS time at the tone - local MET at the tone +** Leaps = GPS leaps +** +** It is possible that a command changed the MET after it was used +** to calculate the pending STCF -- in which case the current +** time will jump next second when the STCF gets calculated +** again with the new MET value. This (small) possibility can +** be prevented by switching to "internal" mode before sending +** set time commands... +*/ +#if (CFE_PLATFORM_TIME_CFG_SRC_GPS == true) + NextState->AtToneMET.Seconds = CFE_TIME_Global.VirtualMET; NextState->AtToneMET.Subseconds = 0; - NextState->AtToneSTCF = CFE_TIME_Global.PendingSTCF; - NextState->AtToneLeapSeconds = CFE_TIME_Global.PendingLeaps; - #endif + NextState->AtToneSTCF = CFE_TIME_Global.PendingSTCF; + NextState->AtToneLeapSeconds = CFE_TIME_Global.PendingLeaps; +#endif - /* - ** Update "time at tone" with external time data... - ** - ** STCF = external time at the tone - local MET at the tone - */ - #if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) - NextState->AtToneMET.Seconds = CFE_TIME_Global.VirtualMET; +/* +** Update "time at tone" with external time data... +** +** STCF = external time at the tone - local MET at the tone +*/ +#if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) + NextState->AtToneMET.Seconds = CFE_TIME_Global.VirtualMET; NextState->AtToneMET.Subseconds = 0; - NextState->AtToneSTCF = CFE_TIME_Global.PendingSTCF; - #endif + NextState->AtToneSTCF = CFE_TIME_Global.PendingSTCF; +#endif } /* @@ -984,13 +943,13 @@ void CFE_TIME_ToneUpdate(void) */ if (NextState->ClockFlyState == CFE_TIME_FlywheelState_IS_FLY) { - NextState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + NextState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; - NewFlywheelStatus = true; + NewFlywheelStatus = true; } - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) /* ** Set local clock latch time that matches the tone... */ @@ -999,8 +958,8 @@ void CFE_TIME_ToneUpdate(void) /* ** Time clients need all the "time at the tone" command data... */ - NextState->AtToneMET = CFE_TIME_Global.PendingMET; - NextState->AtToneSTCF = CFE_TIME_Global.PendingSTCF; + NextState->AtToneMET = CFE_TIME_Global.PendingMET; + NextState->AtToneSTCF = CFE_TIME_Global.PendingSTCF; NextState->AtToneLeapSeconds = CFE_TIME_Global.PendingLeaps; /* @@ -1008,7 +967,7 @@ void CFE_TIME_ToneUpdate(void) */ if (CFE_TIME_Global.PendingState == CFE_TIME_ClockState_INVALID) { - NextState->ClockSetState = CFE_TIME_SetState_NOT_SET; + NextState->ClockSetState = CFE_TIME_SetState_NOT_SET; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; } else @@ -1036,9 +995,9 @@ void CFE_TIME_ToneUpdate(void) if (NextState->ClockFlyState == CFE_TIME_FlywheelState_IS_FLY) { NextState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; - NewFlywheelStatus = true; + NewFlywheelStatus = true; } - #endif /* CFE_PLATFORM_TIME_CFG_CLIENT */ +#endif /* CFE_PLATFORM_TIME_CFG_CLIENT */ /* ** Complete the time update. @@ -1050,15 +1009,13 @@ void CFE_TIME_ToneUpdate(void) */ if (NewFlywheelStatus) { - CFE_EVS_SendEvent(CFE_TIME_FLY_OFF_EID, CFE_EVS_EventType_INFORMATION, - "Stop FLYWHEEL"); + CFE_EVS_SendEvent(CFE_TIME_FLY_OFF_EID, CFE_EVS_EventType_INFORMATION, "Stop FLYWHEEL"); } return; } /* End of CFE_TIME_ToneUpdate() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_Local1HzTimerCallback() -- 1Hz callback routine */ @@ -1073,8 +1030,6 @@ void CFE_TIME_Local1HzTimerCallback(osal_id_t TimerId, void *Arg) CFE_TIME_Local1HzISR(); } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_Tone1HzISR() -- Tone signal ISR */ @@ -1091,7 +1046,6 @@ void CFE_TIME_Tone1HzISR(void) /* Start Performance Monitoring */ CFE_ES_PerfLogEntry(CFE_MISSION_TIME_TONE1HZISR_PERF_ID); - /* ** Latch the local clock when the tone signal occurred... */ @@ -1100,16 +1054,14 @@ void CFE_TIME_Tone1HzISR(void) /* ** Compute elapsed time since the previous tone signal... */ - Result = CFE_TIME_Compare(ToneSignalLatch, - CFE_TIME_Global.ToneSignalLatch); + Result = CFE_TIME_Compare(ToneSignalLatch, CFE_TIME_Global.ToneSignalLatch); if (Result == CFE_TIME_A_LT_B) { /* ** Local clock has rolled over... */ - Elapsed = CFE_TIME_Subtract(CFE_TIME_Global.MaxLocalClock, - CFE_TIME_Global.ToneSignalLatch); + Elapsed = CFE_TIME_Subtract(CFE_TIME_Global.MaxLocalClock, CFE_TIME_Global.ToneSignalLatch); Elapsed = CFE_TIME_Add(Elapsed, ToneSignalLatch); } else @@ -1137,20 +1089,20 @@ void CFE_TIME_Tone1HzISR(void) */ CFE_TIME_Global.IsToneGood = true; - /* - ** Maintain virtual MET as count of valid tone signal interrupts... - ** (not set to zero by reset command) - */ - #if (CFE_PLATFORM_TIME_CFG_VIRTUAL == true) +/* +** Maintain virtual MET as count of valid tone signal interrupts... +** (not set to zero by reset command) +*/ +#if (CFE_PLATFORM_TIME_CFG_VIRTUAL == true) CFE_TIME_Global.VirtualMET++; - #endif +#endif - /* - ** Maintain virtual MET as count read from h/w MET register... - */ - #if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) +/* +** Maintain virtual MET as count read from h/w MET register... +*/ +#if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) OS_GetLocalMET(&CFE_TIME_Global.VirtualMET); - #endif +#endif /* ** Enable tone task (we can't send a SB message from here)... @@ -1164,7 +1116,7 @@ void CFE_TIME_Tone1HzISR(void) ** (set to zero by reset command) */ CFE_TIME_Global.ToneIntErrorCounter++; - + /* Since the tone didn't occur ~1 seonds after the previous one, we ** can mark this tone as 'not good' */ @@ -1175,7 +1127,7 @@ void CFE_TIME_Tone1HzISR(void) ** Save local time latch of most recent tone signal... */ CFE_TIME_Global.ToneSignalLatch = ToneSignalLatch; - + /* Notify registered time synchronization applications */ CFE_TIME_NotifyTimeSynchApps(); @@ -1186,7 +1138,6 @@ void CFE_TIME_Tone1HzISR(void) } /* End of CFE_TIME_Tone1HzISR() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_Tone1HzTask() -- Tone 1Hz task */ @@ -1200,7 +1151,7 @@ void CFE_TIME_Tone1HzTask(void) int32 Result = CFE_ES_RegisterChildTask(); while (Result == CFE_SUCCESS) - { + { /* Increment the Main task Execution Counter */ CFE_ES_IncrementTaskCounter(); @@ -1208,7 +1159,7 @@ void CFE_TIME_Tone1HzTask(void) ** Pend on semaphore given by tone ISR (above)... */ Result = OS_BinSemTake(CFE_TIME_Global.ToneSemaphore); - + /* Start Performance Monitoring */ CFE_ES_PerfLogEntry(CFE_MISSION_TIME_TONE1HZTASK_PERF_ID); @@ -1246,7 +1197,6 @@ void CFE_TIME_Tone1HzTask(void) } /* End of CFE_TIME_Tone1HzTask() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_Local1HzStateMachine() -- */ @@ -1257,37 +1207,33 @@ void CFE_TIME_Tone1HzTask(void) void CFE_TIME_Local1HzStateMachine(void) { - CFE_TIME_Reference_t Reference; + CFE_TIME_Reference_t Reference; volatile CFE_TIME_ReferenceState_t *NextState; /* Start Performance Monitoring */ CFE_ES_PerfLogEntry(CFE_MISSION_TIME_LOCAL1HZISR_PERF_ID); - /* Zero out the Reference variable because we pass it into * a function before using it * */ - memset(&Reference, 0 , sizeof(CFE_TIME_Reference_t)); + memset(&Reference, 0, sizeof(CFE_TIME_Reference_t)); - /* - ** Apply 1Hz adjustment to STCF... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - if ((CFE_TIME_Global.OneHzAdjust.Seconds != 0) || - (CFE_TIME_Global.OneHzAdjust.Subseconds != 0)) +/* +** Apply 1Hz adjustment to STCF... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) + if ((CFE_TIME_Global.OneHzAdjust.Seconds != 0) || (CFE_TIME_Global.OneHzAdjust.Subseconds != 0)) { CFE_TIME_SysTime_t NewSTCF; NextState = CFE_TIME_StartReferenceUpdate(); if (CFE_TIME_Global.OneHzDirection == CFE_TIME_AdjustDirection_ADD) { - NewSTCF = CFE_TIME_Add(NextState->AtToneSTCF, - CFE_TIME_Global.OneHzAdjust); + NewSTCF = CFE_TIME_Add(NextState->AtToneSTCF, CFE_TIME_Global.OneHzAdjust); } else { - NewSTCF = CFE_TIME_Subtract(NextState->AtToneSTCF, - CFE_TIME_Global.OneHzAdjust); + NewSTCF = CFE_TIME_Subtract(NextState->AtToneSTCF, CFE_TIME_Global.OneHzAdjust); } NextState->AtToneSTCF = NewSTCF; @@ -1297,7 +1243,7 @@ void CFE_TIME_Local1HzStateMachine(void) */ CFE_TIME_FinishReferenceUpdate(NextState); } - #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ +#endif /* CFE_PLATFORM_TIME_CFG_SERVER */ /* ** Get reference time (calculates time since tone, etc.)... @@ -1318,9 +1264,9 @@ void CFE_TIME_Local1HzStateMachine(void) ** Change current state to "fly-wheel"... */ NextState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; - #endif +#endif CFE_TIME_Global.AutoStartFly = true; @@ -1354,8 +1300,8 @@ void CFE_TIME_Local1HzStateMachine(void) ** the local clock from completely wrapping around the ** time latched at the tone. */ - NextState->AtToneMET = Reference.CurrentMET; - NextState->AtToneLatch = Reference.CurrentLatch; + NextState->AtToneMET = Reference.CurrentMET; + NextState->AtToneLatch = Reference.CurrentLatch; /* ** Force anyone currently reading time to retry... @@ -1366,7 +1312,6 @@ void CFE_TIME_Local1HzStateMachine(void) /* Exit performance monitoring */ CFE_ES_PerfLogExit(CFE_MISSION_TIME_LOCAL1HZISR_PERF_ID); - } /* @@ -1386,7 +1331,6 @@ void CFE_TIME_Local1HzISR(void) } /* End of CFE_TIME_Local1HzISR() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_Local1HzTask() -- Local 1Hz task (not the tone) */ @@ -1403,7 +1347,7 @@ void CFE_TIME_Local1HzTask(void) while (Result == CFE_SUCCESS) { - + /* Increment the Main task Execution Counter */ CFE_ES_IncrementTaskCounter(); @@ -1411,7 +1355,7 @@ void CFE_TIME_Local1HzTask(void) ** Pend on the 1HZ semaphore (given by local 1Hz ISR)... */ Result = OS_BinSemTake(CFE_TIME_Global.LocalSemaphore); - + /* Start Performance Monitoring */ CFE_ES_PerfLogEntry(CFE_MISSION_TIME_LOCAL1HZTASK_PERF_ID); @@ -1424,9 +1368,7 @@ void CFE_TIME_Local1HzTask(void) { CFE_TIME_Global.AutoStartFly = false; - CFE_EVS_SendEvent(CFE_TIME_FLY_ON_EID, - CFE_EVS_EventType_INFORMATION, - "Start FLYWHEEL"); + CFE_EVS_SendEvent(CFE_TIME_FLY_ON_EID, CFE_EVS_EventType_INFORMATION, "Start FLYWHEEL"); } /* @@ -1451,17 +1393,15 @@ void CFE_TIME_Local1HzTask(void) } /* End of CFE_TIME_Local1HzTask() */ - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_NotifyTimeSynchApps() -- Call App Synch Callback Funcs */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_TIME_NotifyTimeSynchApps(void) +void CFE_TIME_NotifyTimeSynchApps(void) { - uint32 i; + uint32 i; CFE_TIME_SynchCallbackPtr_t Func; /* @@ -1469,7 +1409,7 @@ void CFE_TIME_NotifyTimeSynchApps(void) */ if (CFE_TIME_Global.IsToneGood) { - for (i=0; i < (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])); ++i) + for (i = 0; i < (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])); ++i) { /* IMPORTANT: * Read the global pointer only once, since a thread could be unregistering @@ -1482,7 +1422,7 @@ void CFE_TIME_NotifyTimeSynchApps(void) } } } - + return; } diff --git a/modules/time/fsw/src/cfe_time_utils.c b/modules/time/fsw/src/cfe_time_utils.c index 85b1de2fb..fdfb305bf 100644 --- a/modules/time/fsw/src/cfe_time_utils.c +++ b/modules/time/fsw/src/cfe_time_utils.c @@ -26,7 +26,7 @@ ** Author: S.Walling/Microtel ** ** Notes: -** +** */ /* @@ -42,8 +42,6 @@ #include - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_StartReferenceUpdate() */ @@ -52,7 +50,7 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ volatile CFE_TIME_ReferenceState_t *CFE_TIME_StartReferenceUpdate(void) { - uint32 Version = CFE_TIME_Global.LastVersionCounter; + uint32 Version = CFE_TIME_Global.LastVersionCounter; volatile CFE_TIME_ReferenceState_t *CurrState; volatile CFE_TIME_ReferenceState_t *NextState; @@ -64,18 +62,17 @@ volatile CFE_TIME_ReferenceState_t *CFE_TIME_StartReferenceUpdate(void) /* initially propagate all previous values to next values */ NextState->AtToneLeapSeconds = CurrState->AtToneLeapSeconds; - NextState->ClockSetState = CurrState->ClockSetState; - NextState->ClockFlyState = CurrState->ClockFlyState; - NextState->DelayDirection = CurrState->DelayDirection; - NextState->AtToneMET = CurrState->AtToneMET; - NextState->AtToneSTCF = CurrState->AtToneSTCF; - NextState->AtToneDelay = CurrState->AtToneDelay; - NextState->AtToneLatch = CurrState->AtToneLatch; + NextState->ClockSetState = CurrState->ClockSetState; + NextState->ClockFlyState = CurrState->ClockFlyState; + NextState->DelayDirection = CurrState->DelayDirection; + NextState->AtToneMET = CurrState->AtToneMET; + NextState->AtToneSTCF = CurrState->AtToneSTCF; + NextState->AtToneDelay = CurrState->AtToneDelay; + NextState->AtToneLatch = CurrState->AtToneLatch; return NextState; } - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_LatchClock() -- query local clock */ @@ -85,7 +82,7 @@ volatile CFE_TIME_ReferenceState_t *CFE_TIME_StartReferenceUpdate(void) CFE_TIME_SysTime_t CFE_TIME_LatchClock(void) { CFE_TIME_SysTime_t LatchTime; - OS_time_t LocalTime; + OS_time_t LocalTime; /* ** Get time in O/S format (seconds : microseconds)... @@ -95,14 +92,13 @@ CFE_TIME_SysTime_t CFE_TIME_LatchClock(void) /* ** Convert time to cFE format (seconds : 1/2^32 subseconds)... */ - LatchTime.Seconds = OS_TimeGetTotalSeconds(LocalTime); + LatchTime.Seconds = OS_TimeGetTotalSeconds(LocalTime); LatchTime.Subseconds = OS_TimeGetSubsecondsPart(LocalTime); - return(LatchTime); + return (LatchTime); } /* End of CFE_TIME_LatchClock() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_QueryResetVars() -- query contents of Reset Variables */ @@ -112,34 +108,34 @@ CFE_TIME_SysTime_t CFE_TIME_LatchClock(void) void CFE_TIME_QueryResetVars(void) { - CFE_TIME_ResetVars_t LocalResetVars; - uint32 DefSubsMET; - uint32 DefSubsSTCF; - int32 status; + CFE_TIME_ResetVars_t LocalResetVars; + uint32 DefSubsMET; + uint32 DefSubsSTCF; + int32 status; volatile CFE_TIME_ReferenceState_t *RefState; - uint32 resetAreaSize; - cpuaddr resetAreaAddr; - CFE_ES_ResetData_t *CFE_TIME_ResetDataPtr; - + uint32 resetAreaSize; + cpuaddr resetAreaAddr; + CFE_ES_ResetData_t * CFE_TIME_ResetDataPtr; + RefState = CFE_TIME_StartReferenceUpdate(); /* ** Get the pointer to the Reset area from the BSP */ - status = CFE_PSP_GetResetArea (&(resetAreaAddr), &(resetAreaSize)); - + status = CFE_PSP_GetResetArea(&(resetAreaAddr), &(resetAreaSize)); + if (status != CFE_PSP_SUCCESS) { /* There is something wrong with the Reset Area */ CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_BAD; } - + else { CFE_TIME_ResetDataPtr = (CFE_ES_ResetData_t *)resetAreaAddr; - + /* Get the structure from the Reset Area */ - LocalResetVars = CFE_TIME_ResetDataPtr -> TimeResetVars; + LocalResetVars = CFE_TIME_ResetDataPtr->TimeResetVars; /* ** Verify TIME data signature and clock signal selection... @@ -147,27 +143,26 @@ void CFE_TIME_QueryResetVars(void) */ if ((LocalResetVars.Signature == CFE_TIME_RESET_SIGNATURE) && ((LocalResetVars.ClockSignal == CFE_TIME_ToneSignalSelect_PRIMARY) || - (LocalResetVars.ClockSignal == CFE_TIME_ToneSignalSelect_REDUNDANT))) + (LocalResetVars.ClockSignal == CFE_TIME_ToneSignalSelect_REDUNDANT))) { /* ** Initialize TIME to valid Reset Area values... */ - RefState->AtToneMET = LocalResetVars.CurrentMET; - RefState->AtToneSTCF = LocalResetVars.CurrentSTCF; - RefState->AtToneDelay = LocalResetVars.CurrentDelay; - RefState->AtToneLeapSeconds = LocalResetVars.LeapSeconds; - CFE_TIME_Global.ClockSignal = LocalResetVars.ClockSignal; - - CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_EXISTING; - } + RefState->AtToneMET = LocalResetVars.CurrentMET; + RefState->AtToneSTCF = LocalResetVars.CurrentSTCF; + RefState->AtToneDelay = LocalResetVars.CurrentDelay; + RefState->AtToneLeapSeconds = LocalResetVars.LeapSeconds; + CFE_TIME_Global.ClockSignal = LocalResetVars.ClockSignal; + + CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_EXISTING; + } else - { + { /* ** We got a blank area from the reset variables */ - CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_NEW; + CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_NEW; } - } /* ** Initialize TIME to default values if no valid Reset data... @@ -182,18 +177,17 @@ void CFE_TIME_QueryResetVars(void) RefState->AtToneSTCF.Seconds = CFE_MISSION_TIME_DEF_STCF_SECS; RefState->AtToneSTCF.Subseconds = DefSubsSTCF; RefState->AtToneLeapSeconds = CFE_MISSION_TIME_DEF_LEAPS; - CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; + CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; RefState->AtToneDelay.Seconds = 0; RefState->AtToneDelay.Subseconds = 0; } - + CFE_TIME_FinishReferenceUpdate(RefState); return; } /* End of CFE_TIME_QueryResetVars() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_UpdateResetVars() -- update contents of Reset Variables*/ @@ -203,15 +197,15 @@ void CFE_TIME_QueryResetVars(void) void CFE_TIME_UpdateResetVars(const CFE_TIME_Reference_t *Reference) { CFE_TIME_ResetVars_t LocalResetVars; - uint32 resetAreaSize; - cpuaddr resetAreaAddr; - CFE_ES_ResetData_t *CFE_TIME_ResetDataPtr; + uint32 resetAreaSize; + cpuaddr resetAreaAddr; + CFE_ES_ResetData_t * CFE_TIME_ResetDataPtr; /* ** Update the data only if our Reset Area is valid... */ if (CFE_TIME_Global.DataStoreStatus != CFE_TIME_RESET_AREA_ERROR) { - + /* Store all of our critical variables to a ResetVars_t * then copy that to the Reset Area */ LocalResetVars.Signature = CFE_TIME_RESET_SIGNATURE; @@ -221,15 +215,15 @@ void CFE_TIME_UpdateResetVars(const CFE_TIME_Reference_t *Reference) LocalResetVars.CurrentDelay = Reference->AtToneDelay; LocalResetVars.LeapSeconds = Reference->AtToneLeapSeconds; - LocalResetVars.ClockSignal = CFE_TIME_Global.ClockSignal; - + LocalResetVars.ClockSignal = CFE_TIME_Global.ClockSignal; + /* ** Get the pointer to the Reset area from the BSP */ - if (CFE_PSP_GetResetArea (&(resetAreaAddr), &(resetAreaSize)) == CFE_PSP_SUCCESS) + if (CFE_PSP_GetResetArea(&(resetAreaAddr), &(resetAreaSize)) == CFE_PSP_SUCCESS) { - CFE_TIME_ResetDataPtr = (CFE_ES_ResetData_t *)resetAreaAddr; - CFE_TIME_ResetDataPtr -> TimeResetVars = LocalResetVars; + CFE_TIME_ResetDataPtr = (CFE_ES_ResetData_t *)resetAreaAddr; + CFE_TIME_ResetDataPtr->TimeResetVars = LocalResetVars; } } @@ -237,7 +231,6 @@ void CFE_TIME_UpdateResetVars(const CFE_TIME_Reference_t *Reference) } /* End of CFE_TIME_UpdateResetVars() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_InitData() -- initialize global time task nonzero data */ @@ -246,7 +239,7 @@ void CFE_TIME_UpdateResetVars(const CFE_TIME_Reference_t *Reference) void CFE_TIME_InitData(void) { - uint32 i; + uint32 i; volatile CFE_TIME_ReferenceState_t *RefState; /* Clear task global */ @@ -275,32 +268,32 @@ void CFE_TIME_InitData(void) /* ** Data values used to define the current clock state... */ - RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; - RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; + RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; + RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; #else - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; #endif CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; /* ** Pending data values (from "time at tone" command data packet)... */ - CFE_TIME_Global.PendingState = CFE_TIME_ClockState_INVALID; + CFE_TIME_Global.PendingState = CFE_TIME_ClockState_INVALID; /* ** Nonzero adjustment values... */ CFE_TIME_Global.OneTimeDirection = CFE_TIME_AdjustDirection_ADD; CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_ADD; - RefState->DelayDirection = CFE_TIME_AdjustDirection_ADD; + RefState->DelayDirection = CFE_TIME_AdjustDirection_ADD; /* ** Miscellaneous counters... */ - CFE_TIME_Global.VirtualMET = RefState->AtToneMET.Seconds; + CFE_TIME_Global.VirtualMET = RefState->AtToneMET.Seconds; /* ** Time window verification values... @@ -308,13 +301,13 @@ void CFE_TIME_InitData(void) CFE_TIME_Global.MinElapsed = CFE_TIME_Micro2SubSecs(CFE_MISSION_TIME_MIN_ELAPSED); CFE_TIME_Global.MaxElapsed = CFE_TIME_Micro2SubSecs(CFE_MISSION_TIME_MAX_ELAPSED); - /* - ** Range checking for external time source data... - */ - #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) +/* +** Range checking for external time source data... +*/ +#if (CFE_PLATFORM_TIME_CFG_SOURCE == true) CFE_TIME_Global.MaxDelta.Seconds = CFE_PLATFORM_TIME_MAX_DELTA_SECS; CFE_TIME_Global.MaxDelta.Subseconds = CFE_TIME_Micro2SubSecs(CFE_PLATFORM_TIME_MAX_DELTA_SUBS); - #endif +#endif /* ** Maximum local clock value (before roll-over)... @@ -333,54 +326,47 @@ void CFE_TIME_InitData(void) /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TIME_Global.HkPacket.TlmHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), + CFE_MSG_Init(&CFE_TIME_Global.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), sizeof(CFE_TIME_Global.HkPacket)); /* ** Initialize diagnostic packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TIME_Global.DiagPacket.TlmHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), + CFE_MSG_Init(&CFE_TIME_Global.DiagPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), sizeof(CFE_TIME_Global.DiagPacket)); /* ** Initialize "time at the tone" signal command packet... */ - CFE_MSG_Init(&CFE_TIME_Global.ToneSignalCmd.CmdHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), + CFE_MSG_Init(&CFE_TIME_Global.ToneSignalCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), sizeof(CFE_TIME_Global.ToneSignalCmd)); - /* - ** Initialize "time at the tone" data command packet... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - CFE_MSG_Init(&CFE_TIME_Global.ToneDataCmd.CmdHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), +/* +** Initialize "time at the tone" data command packet... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) + CFE_MSG_Init(&CFE_TIME_Global.ToneDataCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), sizeof(CFE_TIME_Global.ToneDataCmd)); - #endif +#endif /* ** Initialize simulated tone send message ("fake tone" mode only)... */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - CFE_MSG_Init(&CFE_TIME_Global.ToneSendCmd.CmdHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), + CFE_MSG_Init(&CFE_TIME_Global.ToneSendCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), sizeof(CFE_TIME_Global.ToneSendCmd)); #endif /* ** Initialize local 1Hz "wake-up" command packet (optional)... */ - CFE_MSG_Init(&CFE_TIME_Global.Local1HzCmd.CmdHeader.Msg, - CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), + CFE_MSG_Init(&CFE_TIME_Global.Local1HzCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), sizeof(CFE_TIME_Global.Local1HzCmd)); return; } /* End of CFE_TIME_InitData() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_GetHkData() -- Report local housekeeping data */ @@ -393,13 +379,13 @@ void CFE_TIME_GetHkData(const CFE_TIME_Reference_t *Reference) /* ** Get command execution counters... */ - CFE_TIME_Global.HkPacket.Payload.CommandCounter = CFE_TIME_Global.CommandCounter; + CFE_TIME_Global.HkPacket.Payload.CommandCounter = CFE_TIME_Global.CommandCounter; CFE_TIME_Global.HkPacket.Payload.CommandErrorCounter = CFE_TIME_Global.CommandErrorCounter; /* ** Current "as calculated" clock state... */ - CFE_TIME_Global.HkPacket.Payload.ClockStateAPI = (int16) CFE_TIME_CalculateState(Reference); + CFE_TIME_Global.HkPacket.Payload.ClockStateAPI = (int16)CFE_TIME_CalculateState(Reference); /* ** Current clock state flags... @@ -420,29 +406,26 @@ void CFE_TIME_GetHkData(const CFE_TIME_Reference_t *Reference) CFE_TIME_Global.HkPacket.Payload.SecondsSTCF = Reference->AtToneSTCF.Seconds; CFE_TIME_Global.HkPacket.Payload.SubsecsSTCF = Reference->AtToneSTCF.Subseconds; - /* - ** 1Hz STCF adjustment values (server only)... - */ - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +/* +** 1Hz STCF adjustment values (server only)... +*/ +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_Global.HkPacket.Payload.Seconds1HzAdj = CFE_TIME_Global.OneHzAdjust.Seconds; CFE_TIME_Global.HkPacket.Payload.Subsecs1HzAdj = CFE_TIME_Global.OneHzAdjust.Subseconds; - #endif +#endif - /* - ** Time at tone delay values (client only)... - */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) +/* +** Time at tone delay values (client only)... +*/ +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) CFE_TIME_Global.HkPacket.Payload.SecondsDelay = Reference->AtToneDelay.Seconds; CFE_TIME_Global.HkPacket.Payload.SubsecsDelay = Reference->AtToneDelay.Subseconds; - #endif - - +#endif return; } /* End of CFE_TIME_GetHkData() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_GetDiagData() -- Report diagnostics data */ @@ -452,7 +435,7 @@ void CFE_TIME_GetHkData(const CFE_TIME_Reference_t *Reference) void CFE_TIME_GetDiagData(void) { CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t TempTime; + CFE_TIME_SysTime_t TempTime; /* ** Get reference time values (local time, time at tone, etc.)... @@ -464,8 +447,8 @@ void CFE_TIME_GetDiagData(void) CFE_TIME_Copy(&CFE_TIME_Global.DiagPacket.Payload.AtToneDelay, &Reference.AtToneDelay); CFE_TIME_Copy(&CFE_TIME_Global.DiagPacket.Payload.AtToneLatch, &Reference.AtToneLatch); - CFE_TIME_Global.DiagPacket.Payload.AtToneLeapSeconds = Reference.AtToneLeapSeconds; - CFE_TIME_Global.DiagPacket.Payload.ClockStateAPI = CFE_TIME_CalculateState(&Reference); + CFE_TIME_Global.DiagPacket.Payload.AtToneLeapSeconds = Reference.AtToneLeapSeconds; + CFE_TIME_Global.DiagPacket.Payload.ClockStateAPI = CFE_TIME_CalculateState(&Reference); /* ** Data values that reflect the time (right now)... @@ -486,7 +469,7 @@ void CFE_TIME_GetDiagData(void) CFE_TIME_Global.DiagPacket.Payload.ClockSource = CFE_TIME_Global.ClockSource; CFE_TIME_Global.DiagPacket.Payload.ClockSignal = CFE_TIME_Global.ClockSignal; CFE_TIME_Global.DiagPacket.Payload.ServerFlyState = CFE_TIME_Global.ServerFlyState; - CFE_TIME_Global.DiagPacket.Payload.Forced2Fly = (int16) CFE_TIME_Global.Forced2Fly; + CFE_TIME_Global.DiagPacket.Payload.Forced2Fly = (int16)CFE_TIME_Global.Forced2Fly; /* ** Clock state flags... @@ -515,17 +498,17 @@ void CFE_TIME_GetDiagData(void) /* ** Miscellaneous counters (subject to reset command)... */ - CFE_TIME_Global.DiagPacket.Payload.ToneMatchCounter = CFE_TIME_Global.ToneMatchCounter; + CFE_TIME_Global.DiagPacket.Payload.ToneMatchCounter = CFE_TIME_Global.ToneMatchCounter; CFE_TIME_Global.DiagPacket.Payload.ToneMatchErrorCounter = CFE_TIME_Global.ToneMatchErrorCounter; - CFE_TIME_Global.DiagPacket.Payload.ToneSignalCounter = CFE_TIME_Global.ToneSignalCounter; - CFE_TIME_Global.DiagPacket.Payload.ToneDataCounter = CFE_TIME_Global.ToneDataCounter; - CFE_TIME_Global.DiagPacket.Payload.ToneIntCounter = CFE_TIME_Global.ToneIntCounter; + CFE_TIME_Global.DiagPacket.Payload.ToneSignalCounter = CFE_TIME_Global.ToneSignalCounter; + CFE_TIME_Global.DiagPacket.Payload.ToneDataCounter = CFE_TIME_Global.ToneDataCounter; + CFE_TIME_Global.DiagPacket.Payload.ToneIntCounter = CFE_TIME_Global.ToneIntCounter; CFE_TIME_Global.DiagPacket.Payload.ToneIntErrorCounter = CFE_TIME_Global.ToneIntErrorCounter; - CFE_TIME_Global.DiagPacket.Payload.ToneTaskCounter = CFE_TIME_Global.ToneTaskCounter; - CFE_TIME_Global.DiagPacket.Payload.VersionCounter = - CFE_TIME_Global.LastVersionCounter - CFE_TIME_Global.ResetVersionCounter; - CFE_TIME_Global.DiagPacket.Payload.LocalIntCounter = CFE_TIME_Global.LocalIntCounter; - CFE_TIME_Global.DiagPacket.Payload.LocalTaskCounter = CFE_TIME_Global.LocalTaskCounter; + CFE_TIME_Global.DiagPacket.Payload.ToneTaskCounter = CFE_TIME_Global.ToneTaskCounter; + CFE_TIME_Global.DiagPacket.Payload.VersionCounter = + CFE_TIME_Global.LastVersionCounter - CFE_TIME_Global.ResetVersionCounter; + CFE_TIME_Global.DiagPacket.Payload.LocalIntCounter = CFE_TIME_Global.LocalIntCounter; + CFE_TIME_Global.DiagPacket.Payload.LocalTaskCounter = CFE_TIME_Global.LocalTaskCounter; /* ** Miscellaneous counters (not subject to reset command)... @@ -558,13 +541,12 @@ void CFE_TIME_GetDiagData(void) /* ** Reset Area access status... */ - CFE_TIME_Global.DiagPacket.Payload.DataStoreStatus = CFE_TIME_Global.DataStoreStatus; + CFE_TIME_Global.DiagPacket.Payload.DataStoreStatus = CFE_TIME_Global.DataStoreStatus; return; } /* End of CFE_TIME_GetDiagData() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_GetReference() -- get reference data (time at "tone") */ @@ -573,10 +555,10 @@ void CFE_TIME_GetDiagData(void) void CFE_TIME_GetReference(CFE_TIME_Reference_t *Reference) { - CFE_TIME_SysTime_t TimeSinceTone; - CFE_TIME_SysTime_t CurrentMET; - uint32 VersionCounter; - uint32 RetryCount = 4; + CFE_TIME_SysTime_t TimeSinceTone; + CFE_TIME_SysTime_t CurrentMET; + uint32 VersionCounter; + uint32 RetryCount = 4; volatile CFE_TIME_ReferenceState_t *RefState; /* @@ -585,15 +567,15 @@ void CFE_TIME_GetReference(CFE_TIME_Reference_t *Reference) while (true) { VersionCounter = CFE_TIME_Global.LastVersionCounter; - RefState = &CFE_TIME_Global.ReferenceState[VersionCounter & CFE_TIME_REFERENCE_BUF_MASK]; + RefState = &CFE_TIME_Global.ReferenceState[VersionCounter & CFE_TIME_REFERENCE_BUF_MASK]; Reference->CurrentLatch = CFE_TIME_LatchClock(); - Reference->AtToneMET = RefState->AtToneMET; - Reference->AtToneSTCF = RefState->AtToneSTCF; - Reference->AtToneLeapSeconds = RefState->AtToneLeapSeconds; - Reference->AtToneDelay = RefState->AtToneDelay; - Reference->AtToneLatch = RefState->AtToneLatch; + Reference->AtToneMET = RefState->AtToneMET; + Reference->AtToneSTCF = RefState->AtToneSTCF; + Reference->AtToneLeapSeconds = RefState->AtToneLeapSeconds; + Reference->AtToneDelay = RefState->AtToneDelay; + Reference->AtToneLatch = RefState->AtToneLatch; Reference->ClockSetState = RefState->ClockSetState; Reference->ClockFlyState = RefState->ClockFlyState; @@ -653,11 +635,10 @@ void CFE_TIME_GetReference(CFE_TIME_Reference_t *Reference) */ CurrentMET = CFE_TIME_Add(TimeSinceTone, Reference->AtToneMET); - - /* - ** Synchronize "this" time client to the time server... - */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) +/* +** Synchronize "this" time client to the time server... +*/ +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) if (Reference->DelayDirection == CFE_TIME_AdjustDirection_ADD) { CurrentMET = CFE_TIME_Add(CurrentMET, Reference->AtToneDelay); @@ -666,7 +647,7 @@ void CFE_TIME_GetReference(CFE_TIME_Reference_t *Reference) { CurrentMET = CFE_TIME_Subtract(CurrentMET, Reference->AtToneDelay); } - #endif +#endif Reference->CurrentMET = CurrentMET; @@ -674,7 +655,6 @@ void CFE_TIME_GetReference(CFE_TIME_Reference_t *Reference) } /* End of CFE_TIME_GetReference() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_CalculateTAI() -- calculate TAI from reference data */ @@ -687,11 +667,10 @@ CFE_TIME_SysTime_t CFE_TIME_CalculateTAI(const CFE_TIME_Reference_t *Reference) TimeAsTAI = CFE_TIME_Add(Reference->CurrentMET, Reference->AtToneSTCF); - return(TimeAsTAI); + return (TimeAsTAI); } /* End of CFE_TIME_CalculateTAI() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_CalculateUTC() -- calculate UTC from reference data */ @@ -705,11 +684,10 @@ CFE_TIME_SysTime_t CFE_TIME_CalculateUTC(const CFE_TIME_Reference_t *Reference) TimeAsUTC = CFE_TIME_Add(Reference->CurrentMET, Reference->AtToneSTCF); TimeAsUTC.Seconds -= Reference->AtToneLeapSeconds; - return(TimeAsUTC); + return (TimeAsUTC); } /* End of CFE_TIME_CalculateUTC() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_CalculateState() -- determine current time state (per API) */ @@ -732,16 +710,16 @@ int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference) */ ClockState = CFE_TIME_ClockState_VALID; - /* - ** If the server is fly-wheel then the client must also - ** report fly-wheel (even if it is not)... - */ - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) +/* +** If the server is fly-wheel then the client must also +** report fly-wheel (even if it is not)... +*/ +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) if (CFE_TIME_Global.ServerFlyState == CFE_TIME_FlywheelState_IS_FLY) { ClockState = CFE_TIME_ClockState_FLYWHEEL; } - #endif +#endif } else { @@ -759,12 +737,10 @@ int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference) ClockState = CFE_TIME_ClockState_INVALID; } - - return(ClockState); + return (ClockState); } /* End of CFE_TIME_CalculateState() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetState() -- set clock state */ @@ -784,21 +760,21 @@ void CFE_TIME_SetState(int16 NewState) */ if (NewState == CFE_TIME_ClockState_FLYWHEEL) { - CFE_TIME_Global.Forced2Fly = true; - RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) + CFE_TIME_Global.Forced2Fly = true; + RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; - #endif +#endif } else if (NewState == CFE_TIME_ClockState_VALID) { - CFE_TIME_Global.Forced2Fly = false; - RefState->ClockSetState = CFE_TIME_SetState_WAS_SET; + CFE_TIME_Global.Forced2Fly = false; + RefState->ClockSetState = CFE_TIME_SetState_WAS_SET; } else { - CFE_TIME_Global.Forced2Fly = false; - RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; + CFE_TIME_Global.Forced2Fly = false; + RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; } /* @@ -810,7 +786,6 @@ void CFE_TIME_SetState(int16 NewState) } /* End of CFE_TIME_SetState() */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetSource() -- set clock source */ @@ -825,7 +800,6 @@ void CFE_TIME_SetSource(int16 NewSource) } /* End of CFE_TIME_SetSource() */ #endif /* CFE_PLATFORM_TIME_CFG_SOURCE */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetSignal() -- set tone signal (pri vs red) */ @@ -843,7 +817,6 @@ void CFE_TIME_SetSignal(int16 NewSignal) } /* End of CFE_TIME_SetSignal() */ #endif /* CFE_PLATFORM_TIME_CFG_SIGNAL */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetDelay() -- set tone delay (time client only) */ @@ -857,7 +830,7 @@ void CFE_TIME_SetDelay(CFE_TIME_SysTime_t NewDelay, int16 Direction) RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneDelay = NewDelay; + RefState->AtToneDelay = NewDelay; RefState->DelayDirection = Direction; /* @@ -870,7 +843,6 @@ void CFE_TIME_SetDelay(CFE_TIME_SysTime_t NewDelay, int16 Direction) } /* End of CFE_TIME_SetDelay() */ #endif /* CFE_PLATFORM_TIME_CFG_CLIENT */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetTime() -- set time (time server only) */ @@ -888,7 +860,7 @@ void CFE_TIME_SetTime(CFE_TIME_SysTime_t NewTime) ** time value has had leaps seconds removed from the total. */ CFE_TIME_Reference_t Reference; - CFE_TIME_SysTime_t NewSTCF; + CFE_TIME_SysTime_t NewSTCF; /* ** Get reference time values (local time, time at tone, etc.)... @@ -900,12 +872,12 @@ void CFE_TIME_SetTime(CFE_TIME_SysTime_t NewTime) */ NewSTCF = CFE_TIME_Subtract(NewTime, Reference.CurrentMET); - /* - ** Restore leap seconds if default time format is UTC... - */ - #if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) +/* +** Restore leap seconds if default time format is UTC... +*/ +#if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) NewSTCF.Seconds += Reference.AtToneLeapSeconds; - #endif +#endif RefState = CFE_TIME_StartReferenceUpdate(); @@ -921,7 +893,6 @@ void CFE_TIME_SetTime(CFE_TIME_SysTime_t NewTime) } /* End of CFE_TIME_SetTime() */ #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetMET() -- set MET (time server only) */ @@ -943,16 +914,16 @@ void CFE_TIME_SetMET(CFE_TIME_SysTime_t NewMET) /* ** Update reference values used to compute current time... */ - RefState->AtToneMET = NewMET; - CFE_TIME_Global.VirtualMET = NewMET.Seconds; - RefState->AtToneLatch = CFE_TIME_LatchClock(); + RefState->AtToneMET = NewMET; + CFE_TIME_Global.VirtualMET = NewMET.Seconds; + RefState->AtToneLatch = CFE_TIME_LatchClock(); - /* - ** Update h/w MET register... - */ - #if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) +/* +** Update h/w MET register... +*/ +#if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) OS_SetLocalMET(NewMET.Seconds); - #endif +#endif /* ** Time has changed, force anyone reading time to retry... @@ -964,7 +935,6 @@ void CFE_TIME_SetMET(CFE_TIME_SysTime_t NewMET) } /* End of CFE_TIME_SetMET() */ #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetSTCF() -- set STCF (time server only) */ @@ -990,7 +960,6 @@ void CFE_TIME_SetSTCF(CFE_TIME_SysTime_t NewSTCF) } /* End of CFE_TIME_SetSTCF() */ #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetLeapSeconds() -- set leap seconds (time server only) */ @@ -1016,7 +985,6 @@ void CFE_TIME_SetLeapSeconds(int16 NewLeaps) } /* End of CFE_TIME_SetLeapSeconds() */ #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_SetAdjust() -- one time STCF adjustment (server only) */ @@ -1026,7 +994,7 @@ void CFE_TIME_SetLeapSeconds(int16 NewLeaps) #if (CFE_PLATFORM_TIME_CFG_SERVER == true) void CFE_TIME_SetAdjust(CFE_TIME_SysTime_t NewAdjust, int16 Direction) { - CFE_TIME_SysTime_t NewSTCF; + CFE_TIME_SysTime_t NewSTCF; volatile CFE_TIME_ReferenceState_t *RefState; RefState = CFE_TIME_StartReferenceUpdate(); @@ -1055,7 +1023,6 @@ void CFE_TIME_SetAdjust(CFE_TIME_SysTime_t NewAdjust, int16 Direction) } /* End of CFE_TIME_SetAdjust() */ #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_Set1HzAdj() -- 1Hz STCF adjustment (time server only) */ @@ -1068,13 +1035,12 @@ void CFE_TIME_Set1HzAdj(CFE_TIME_SysTime_t NewAdjust, int16 Direction) /* ** Store values for 1Hz adjustment... */ - CFE_TIME_Global.OneHzAdjust = NewAdjust; - CFE_TIME_Global.OneHzDirection = Direction; + CFE_TIME_Global.OneHzAdjust = NewAdjust; + CFE_TIME_Global.OneHzDirection = Direction; } /* End of CFE_TIME_Set1HzAdj() */ #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* CFE_TIME_CleanUpApp() -- Free resources associated with App */ @@ -1083,7 +1049,7 @@ void CFE_TIME_Set1HzAdj(CFE_TIME_SysTime_t NewAdjust, int16 Direction) int32 CFE_TIME_CleanUpApp(CFE_ES_AppId_t AppId) { - int32 Status; + int32 Status; uint32 AppIndex; Status = CFE_ES_AppID_ToIndex(AppId, &AppIndex); @@ -1099,11 +1065,10 @@ int32 CFE_TIME_CleanUpApp(CFE_ES_AppId_t AppId) { Status = CFE_TIME_CALLBACK_NOT_REGISTERED; } - + return Status; } /************************/ /* End of File Comment */ /************************/ - diff --git a/modules/time/fsw/src/cfe_time_utils.h b/modules/time/fsw/src/cfe_time_utils.h index 8a605ae2a..5c5958de6 100644 --- a/modules/time/fsw/src/cfe_time_utils.h +++ b/modules/time/fsw/src/cfe_time_utils.h @@ -42,7 +42,7 @@ /*************************************************************************/ -#define CFE_TIME_NEGATIVE 0x80000000 /* ~ 68 * 31,536,000 seconds */ +#define CFE_TIME_NEGATIVE 0x80000000 /* ~ 68 * 31,536,000 seconds */ /*************************************************************************/ @@ -50,23 +50,23 @@ ** Main task definitions... */ #define CFE_TIME_TASK_NAME "CFE_TIME" -#define CFE_TIME_RESET_SIGNATURE 0xA5A55A5A +#define CFE_TIME_RESET_SIGNATURE 0xA5A55A5A /* ** Interrupt task definitions... */ -#define CFE_TIME_TASK_TONE_NAME "TIME_TONE_TASK" -#define CFE_TIME_TASK_1HZ_NAME "TIME_1HZ_TASK" -#define CFE_TIME_TASK_STACK_PTR CFE_ES_TASK_STACK_ALLOCATE -#define CFE_TIME_TASK_FLAGS 0 +#define CFE_TIME_TASK_TONE_NAME "TIME_TONE_TASK" +#define CFE_TIME_TASK_1HZ_NAME "TIME_1HZ_TASK" +#define CFE_TIME_TASK_STACK_PTR CFE_ES_TASK_STACK_ALLOCATE +#define CFE_TIME_TASK_FLAGS 0 /* ** Interrupt semaphore definitions... */ -#define CFE_TIME_SEM_TONE_NAME "TIME_TONE_SEM" -#define CFE_TIME_SEM_1HZ_NAME "TIME_1HZ_SEM" -#define CFE_TIME_SEM_VALUE 0 -#define CFE_TIME_SEM_OPTIONS 0 +#define CFE_TIME_SEM_TONE_NAME "TIME_TONE_SEM" +#define CFE_TIME_SEM_1HZ_NAME "TIME_1HZ_SEM" +#define CFE_TIME_SEM_VALUE 0 +#define CFE_TIME_SEM_OPTIONS 0 /* ** Main Task Pipe definitions... @@ -79,10 +79,10 @@ ** Reset Area state state at startup... */ -#define CFE_TIME_RESET_AREA_ERROR 1 /* no mem available */ -#define CFE_TIME_RESET_AREA_BAD 2 /* had invalid data */ -#define CFE_TIME_RESET_AREA_NEW 3 /* new memory block */ -#define CFE_TIME_RESET_AREA_EXISTING 4 /* had valid data */ +#define CFE_TIME_RESET_AREA_ERROR 1 /* no mem available */ +#define CFE_TIME_RESET_AREA_BAD 2 /* had invalid data */ +#define CFE_TIME_RESET_AREA_NEW 3 /* new memory block */ +#define CFE_TIME_RESET_AREA_EXISTING 4 /* had valid data */ /* * Definitions for time reference multi-buffering @@ -100,8 +100,8 @@ * * This must be a power of 2. */ -#define CFE_TIME_REFERENCE_BUF_DEPTH 4 -#define CFE_TIME_REFERENCE_BUF_MASK (CFE_TIME_REFERENCE_BUF_DEPTH-1) +#define CFE_TIME_REFERENCE_BUF_DEPTH 4 +#define CFE_TIME_REFERENCE_BUF_MASK (CFE_TIME_REFERENCE_BUF_DEPTH - 1) /*************************************************************************/ @@ -111,17 +111,17 @@ typedef struct { - CFE_TIME_SysTime_t AtToneMET; /* MET at time of tone */ - CFE_TIME_SysTime_t AtToneSTCF; /* STCF at time of tone */ - int16 AtToneLeapSeconds; /* Leap Seconds at time of tone */ - int16 ClockSetState; /* Time has been "set" */ - int16 ClockFlyState; /* Current fly-wheel state */ - int16 DelayDirection; /* Wheter "AtToneDelay" is add or subtract */ - CFE_TIME_SysTime_t AtToneDelay; /* Adjustment for slow tone detection */ - CFE_TIME_SysTime_t AtToneLatch; /* Local clock latched at time of tone */ - CFE_TIME_SysTime_t CurrentLatch; /* Local clock latched just "now" */ - CFE_TIME_SysTime_t TimeSinceTone; /* Time elapsed since the tone */ - CFE_TIME_SysTime_t CurrentMET; /* MET at this instant */ + CFE_TIME_SysTime_t AtToneMET; /* MET at time of tone */ + CFE_TIME_SysTime_t AtToneSTCF; /* STCF at time of tone */ + int16 AtToneLeapSeconds; /* Leap Seconds at time of tone */ + int16 ClockSetState; /* Time has been "set" */ + int16 ClockFlyState; /* Current fly-wheel state */ + int16 DelayDirection; /* Wheter "AtToneDelay" is add or subtract */ + CFE_TIME_SysTime_t AtToneDelay; /* Adjustment for slow tone detection */ + CFE_TIME_SysTime_t AtToneLatch; /* Local clock latched at time of tone */ + CFE_TIME_SysTime_t CurrentLatch; /* Local clock latched just "now" */ + CFE_TIME_SysTime_t TimeSinceTone; /* Time elapsed since the tone */ + CFE_TIME_SysTime_t CurrentMET; /* MET at this instant */ } CFE_TIME_Reference_t; @@ -130,7 +130,7 @@ typedef struct */ typedef struct { - volatile CFE_TIME_SynchCallbackPtr_t Ptr; /**< \brief Pointer to Callback function */ + volatile CFE_TIME_SynchCallbackPtr_t Ptr; /**< \brief Pointer to Callback function */ } CFE_TIME_SynchCallbackRegEntry_t; /* @@ -142,17 +142,17 @@ typedef struct */ typedef struct { - uint32 StateVersion; + uint32 StateVersion; - int16 AtToneLeapSeconds; - int16 ClockSetState; - int16 ClockFlyState; - int16 DelayDirection; + int16 AtToneLeapSeconds; + int16 ClockSetState; + int16 ClockFlyState; + int16 DelayDirection; - CFE_TIME_SysTime_t AtToneMET; - CFE_TIME_SysTime_t AtToneSTCF; - CFE_TIME_SysTime_t AtToneDelay; - CFE_TIME_SysTime_t AtToneLatch; + CFE_TIME_SysTime_t AtToneMET; + CFE_TIME_SysTime_t AtToneSTCF; + CFE_TIME_SysTime_t AtToneDelay; + CFE_TIME_SysTime_t AtToneLatch; } CFE_TIME_ReferenceState_t; @@ -163,164 +163,164 @@ typedef struct */ typedef struct { - /* - ** Task command interface counters... - */ - uint8 CommandCounter; - uint8 CommandErrorCounter; - - /* - ** Task housekeeping and diagnostics telemetry packets... - */ - CFE_TIME_HousekeepingTlm_t HkPacket; - CFE_TIME_DiagnosticTlm_t DiagPacket; - - /* - ** Task operational data (not reported in housekeeping)... - */ - CFE_SB_PipeId_t CmdPipe; - - /* - ** Task initialization data (not reported in housekeeping)... - */ - int16 ClockSource; - int16 ClockSignal; - int16 ServerFlyState; - - /* - ** Pending data values (from "time at tone" command data)... - */ - CFE_TIME_SysTime_t PendingMET; - CFE_TIME_SysTime_t PendingSTCF; - int16 PendingLeaps; - int16 PendingState; - - /* - ** STCF adjustment values... - */ - CFE_TIME_SysTime_t OneTimeAdjust; - CFE_TIME_SysTime_t OneHzAdjust; - - int16 OneTimeDirection; /* Add = true */ - int16 OneHzDirection; - - /* - ** Most recent local clock latch values... - */ - CFE_TIME_SysTime_t ToneSignalLatch; /* Latched at tone */ - CFE_TIME_SysTime_t ToneDataLatch; /* Latched at packet */ - - /* - ** Miscellaneous counters... - */ - uint32 ToneMatchCounter; /* Tone and data match */ - uint32 ToneMatchErrorCounter; /* Tone and data mismatch */ - uint32 ToneSignalCounter; /* Tone signal commands */ - uint32 ToneDataCounter; /* Tone data commands */ - uint32 ToneIntCounter; /* Tone interrupts (valid) */ - uint32 ToneIntErrorCounter; /* Tone interrupts (invalid) */ - uint32 ToneTaskCounter; /* Tone task wake-ups */ - uint32 VirtualMET; /* Software MET */ - uint32 LocalIntCounter; /* Local 1Hz interrupts */ - uint32 LocalTaskCounter; /* Local 1Hz task wake-ups */ - uint32 InternalCount; /* Time from internal data */ - uint32 ExternalCount; /* Time from external data */ - - volatile CFE_TIME_ReferenceState_t ReferenceState[CFE_TIME_REFERENCE_BUF_DEPTH]; - volatile uint32 LastVersionCounter; /* Completed Updates to "AtTone" values */ - uint32 ResetVersionCounter; /* Version counter at last counter reset */ - - /* - ** Time window verification values (converted from micro-secs)... - ** - ** Regardless of whether the tone follows the time packet, or vice - ** versa, these values define the acceptable window of time for - ** the second event to follow the first. The minimum value may - ** be as little as zero, and the maximum must be something less - ** than a second. - */ - uint32 MinElapsed; - uint32 MaxElapsed; - - /* - ** Maximum local clock value (before roll-over)... - */ - CFE_TIME_SysTime_t MaxLocalClock; - - /* - ** Clock state has been commanded into (CFE_TIME_ClockState_FLYWHEEL)... - */ - bool Forced2Fly; - - /* - ** Clock state has just transitioned into (CFE_TIME_ClockState_FLYWHEEL)... - ** (not in HK since it won't be true long enough to detect) - */ - - bool AutoStartFly; - bool IsToneGood; - - /* - ** Spare byte for alignment - */ - bool Spare; - - /* - ** Local 1Hz wake-up command packet (not related to time at tone)... - */ - CFE_TIME_1HzCmd_t Local1HzCmd; - - /* - ** Time at the tone command packets (sent by time servers)... - */ - CFE_TIME_ToneDataCmd_t ToneDataCmd; - CFE_TIME_ToneSignalCmd_t ToneSignalCmd; - - /* - * Normally "tone send" commands come from the scheduler based on the - * configured action table, so it occurs at the right point between tones. - * - * However when "fake tone" mode is enabled, then we will locally generate the - * "tone send" message as part of the Tone task, in addition to the regular - * "tone signal" message above. - */ + /* + ** Task command interface counters... + */ + uint8 CommandCounter; + uint8 CommandErrorCounter; + + /* + ** Task housekeeping and diagnostics telemetry packets... + */ + CFE_TIME_HousekeepingTlm_t HkPacket; + CFE_TIME_DiagnosticTlm_t DiagPacket; + + /* + ** Task operational data (not reported in housekeeping)... + */ + CFE_SB_PipeId_t CmdPipe; + + /* + ** Task initialization data (not reported in housekeeping)... + */ + int16 ClockSource; + int16 ClockSignal; + int16 ServerFlyState; + + /* + ** Pending data values (from "time at tone" command data)... + */ + CFE_TIME_SysTime_t PendingMET; + CFE_TIME_SysTime_t PendingSTCF; + int16 PendingLeaps; + int16 PendingState; + + /* + ** STCF adjustment values... + */ + CFE_TIME_SysTime_t OneTimeAdjust; + CFE_TIME_SysTime_t OneHzAdjust; + + int16 OneTimeDirection; /* Add = true */ + int16 OneHzDirection; + + /* + ** Most recent local clock latch values... + */ + CFE_TIME_SysTime_t ToneSignalLatch; /* Latched at tone */ + CFE_TIME_SysTime_t ToneDataLatch; /* Latched at packet */ + + /* + ** Miscellaneous counters... + */ + uint32 ToneMatchCounter; /* Tone and data match */ + uint32 ToneMatchErrorCounter; /* Tone and data mismatch */ + uint32 ToneSignalCounter; /* Tone signal commands */ + uint32 ToneDataCounter; /* Tone data commands */ + uint32 ToneIntCounter; /* Tone interrupts (valid) */ + uint32 ToneIntErrorCounter; /* Tone interrupts (invalid) */ + uint32 ToneTaskCounter; /* Tone task wake-ups */ + uint32 VirtualMET; /* Software MET */ + uint32 LocalIntCounter; /* Local 1Hz interrupts */ + uint32 LocalTaskCounter; /* Local 1Hz task wake-ups */ + uint32 InternalCount; /* Time from internal data */ + uint32 ExternalCount; /* Time from external data */ + + volatile CFE_TIME_ReferenceState_t ReferenceState[CFE_TIME_REFERENCE_BUF_DEPTH]; + volatile uint32 LastVersionCounter; /* Completed Updates to "AtTone" values */ + uint32 ResetVersionCounter; /* Version counter at last counter reset */ + + /* + ** Time window verification values (converted from micro-secs)... + ** + ** Regardless of whether the tone follows the time packet, or vice + ** versa, these values define the acceptable window of time for + ** the second event to follow the first. The minimum value may + ** be as little as zero, and the maximum must be something less + ** than a second. + */ + uint32 MinElapsed; + uint32 MaxElapsed; + + /* + ** Maximum local clock value (before roll-over)... + */ + CFE_TIME_SysTime_t MaxLocalClock; + + /* + ** Clock state has been commanded into (CFE_TIME_ClockState_FLYWHEEL)... + */ + bool Forced2Fly; + + /* + ** Clock state has just transitioned into (CFE_TIME_ClockState_FLYWHEEL)... + ** (not in HK since it won't be true long enough to detect) + */ + + bool AutoStartFly; + bool IsToneGood; + + /* + ** Spare byte for alignment + */ + bool Spare; + + /* + ** Local 1Hz wake-up command packet (not related to time at tone)... + */ + CFE_TIME_1HzCmd_t Local1HzCmd; + + /* + ** Time at the tone command packets (sent by time servers)... + */ + CFE_TIME_ToneDataCmd_t ToneDataCmd; + CFE_TIME_ToneSignalCmd_t ToneSignalCmd; + + /* + * Normally "tone send" commands come from the scheduler based on the + * configured action table, so it occurs at the right point between tones. + * + * However when "fake tone" mode is enabled, then we will locally generate the + * "tone send" message as part of the Tone task, in addition to the regular + * "tone signal" message above. + */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - CFE_TIME_FakeToneCmd_t ToneSendCmd; + CFE_TIME_FakeToneCmd_t ToneSendCmd; #endif - /* - ** Interrupt task semaphores... - */ - osal_id_t LocalSemaphore; - osal_id_t ToneSemaphore; - /* - ** Interrupt task ID's... - */ - CFE_ES_TaskId_t LocalTaskID; - CFE_ES_TaskId_t ToneTaskID; - - /* - ** Maximum difference from expected for external time sources... - */ - - CFE_TIME_SysTime_t MaxDelta; - - /* - ** Tone signal tolerance limits... - */ - uint32 ToneOverLimit; - uint32 ToneUnderLimit; - - /* - ** Reset Area ... - */ - uint32 DataStoreStatus; - - /* - ** Synchronization Callback Registry - ** One callback per app is allowed - */ - CFE_TIME_SynchCallbackRegEntry_t SynchCallback[CFE_PLATFORM_ES_MAX_APPLICATIONS]; + /* + ** Interrupt task semaphores... + */ + osal_id_t LocalSemaphore; + osal_id_t ToneSemaphore; + /* + ** Interrupt task ID's... + */ + CFE_ES_TaskId_t LocalTaskID; + CFE_ES_TaskId_t ToneTaskID; + + /* + ** Maximum difference from expected for external time sources... + */ + + CFE_TIME_SysTime_t MaxDelta; + + /* + ** Tone signal tolerance limits... + */ + uint32 ToneOverLimit; + uint32 ToneUnderLimit; + + /* + ** Reset Area ... + */ + uint32 DataStoreStatus; + + /* + ** Synchronization Callback Registry + ** One callback per app is allowed + */ + CFE_TIME_SynchCallbackRegEntry_t SynchCallback[CFE_PLATFORM_ES_MAX_APPLICATIONS]; } CFE_TIME_Global_t; @@ -329,7 +329,6 @@ typedef struct */ extern CFE_TIME_Global_t CFE_TIME_Global; - /*************************************************************************/ /* ** Function prototypes (get local clock)... @@ -339,13 +338,13 @@ CFE_TIME_SysTime_t CFE_TIME_LatchClock(void); /* ** Function prototypes (Time Services utilities data)... */ -int32 CFE_TIME_TaskInit (void); +int32 CFE_TIME_TaskInit(void); 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); -void CFE_TIME_GetDiagData(void); -void CFE_TIME_GetHkData(const CFE_TIME_Reference_t *Reference); +void CFE_TIME_InitData(void); +void CFE_TIME_QueryResetVars(void); +void CFE_TIME_UpdateResetVars(const CFE_TIME_Reference_t *Reference); +void CFE_TIME_GetDiagData(void); +void CFE_TIME_GetHkData(const CFE_TIME_Reference_t *Reference); /* ** Function prototypes (reference)... @@ -406,7 +405,6 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps); int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime); #endif - /* * Helper function for updating the "Reference" value * This is the local replacement for "OS_IntLock()" @@ -429,8 +427,7 @@ static inline void CFE_TIME_FinishReferenceUpdate(volatile CFE_TIME_ReferenceSta */ static inline volatile CFE_TIME_ReferenceState_t *CFE_TIME_GetReferenceState(void) { - return &CFE_TIME_Global.ReferenceState - [CFE_TIME_Global.LastVersionCounter & CFE_TIME_REFERENCE_BUF_MASK]; + return &CFE_TIME_Global.ReferenceState[CFE_TIME_Global.LastVersionCounter & CFE_TIME_REFERENCE_BUF_MASK]; } /* @@ -455,7 +452,6 @@ void CFE_TIME_Local1HzTask(void); void CFE_TIME_Local1HzStateMachine(void); void CFE_TIME_Local1HzTimerCallback(osal_id_t TimerId, void *Arg); - #endif /* _cfe_time_utils_ */ /************************/ diff --git a/modules/time/fsw/src/cfe_time_verify.h b/modules/time/fsw/src/cfe_time_verify.h index 539805df0..e58bbe8c0 100644 --- a/modules/time/fsw/src/cfe_time_verify.h +++ b/modules/time/fsw/src/cfe_time_verify.h @@ -45,147 +45,146 @@ ** Validate default time client/server selection... */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - #error Cannot define both CFE_PLATFORM_TIME_CFG_SERVER and CFE_PLATFORM_TIME_CFG_CLIENT as true! - #endif +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) +#error Cannot define both CFE_PLATFORM_TIME_CFG_SERVER and CFE_PLATFORM_TIME_CFG_CLIENT as true! +#endif #else - #if (CFE_PLATFORM_TIME_CFG_CLIENT != true) - #error Must define either CFE_PLATFORM_TIME_CFG_SERVER or CFE_PLATFORM_TIME_CFG_CLIENT as true! - #endif +#if (CFE_PLATFORM_TIME_CFG_CLIENT != true) +#error Must define either CFE_PLATFORM_TIME_CFG_SERVER or CFE_PLATFORM_TIME_CFG_CLIENT as true! +#endif #endif /* ** Validate default time format selection... */ #if (CFE_MISSION_TIME_CFG_DEFAULT_TAI == true) - #if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) - #error Cannot define both CFE_MISSION_TIME_CFG_DEFAULT_UTC and CFE_MISSION_TIME_CFG_DEFAULT_TAI as true! - #endif +#if (CFE_MISSION_TIME_CFG_DEFAULT_UTC == true) +#error Cannot define both CFE_MISSION_TIME_CFG_DEFAULT_UTC and CFE_MISSION_TIME_CFG_DEFAULT_TAI as true! +#endif #else - #if (CFE_MISSION_TIME_CFG_DEFAULT_UTC != true) - #error Must define either CFE_MISSION_TIME_CFG_DEFAULT_UTC or CFE_MISSION_TIME_CFG_DEFAULT_TAI as true! - #endif +#if (CFE_MISSION_TIME_CFG_DEFAULT_UTC != true) +#error Must define either CFE_MISSION_TIME_CFG_DEFAULT_UTC or CFE_MISSION_TIME_CFG_DEFAULT_TAI as true! +#endif #endif /* ** Validate time source selection... */ #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - #error Cannot define both CFE_PLATFORM_TIME_CFG_CLIENT and CFE_PLATFORM_TIME_CFG_SOURCE as true! - #endif +#if (CFE_PLATFORM_TIME_CFG_SOURCE == true) +#error Cannot define both CFE_PLATFORM_TIME_CFG_CLIENT and CFE_PLATFORM_TIME_CFG_SOURCE as true! +#endif #endif #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - #if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) - #error Cannot define CFE_PLATFORM_TIME_CFG_SOURCE as true without defining CFE_PLATFORM_TIME_CFG_VIRTUAL as true! - #endif +#if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) +#error Cannot define CFE_PLATFORM_TIME_CFG_SOURCE as true without defining CFE_PLATFORM_TIME_CFG_VIRTUAL as true! +#endif #endif /* ** Validate local MET selections... */ #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - #if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) - #error Cannot define CFE_PLATFORM_TIME_CFG_CLIENT as true without defining CFE_PLATFORM_TIME_CFG_VIRTUAL as true! - #endif +#if (CFE_PLATFORM_TIME_CFG_VIRTUAL != true) +#error Cannot define CFE_PLATFORM_TIME_CFG_CLIENT as true without defining CFE_PLATFORM_TIME_CFG_VIRTUAL as true! +#endif #endif /* ** Validate time source type selection... */ #if (CFE_PLATFORM_TIME_CFG_SRC_MET == true) - #if (CFE_PLATFORM_TIME_CFG_SOURCE != true) - #error Cannot define CFE_PLATFORM_TIME_CFG_SRC_MET as true without defining CFE_PLATFORM_TIME_CFG_SOURCE as true! - #endif - #if (CFE_PLATFORM_TIME_CFG_SRC_GPS == true) - #error Cannot define both CFE_PLATFORM_TIME_CFG_SRC_MET and CFE_PLATFORM_TIME_CFG_SRC_GPS as true! - #endif - #if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) - #error Cannot define both CFE_PLATFORM_TIME_CFG_SRC_MET and CFE_PLATFORM_TIME_CFG_SRC_TIME as true! - #endif +#if (CFE_PLATFORM_TIME_CFG_SOURCE != true) +#error Cannot define CFE_PLATFORM_TIME_CFG_SRC_MET as true without defining CFE_PLATFORM_TIME_CFG_SOURCE as true! #endif - #if (CFE_PLATFORM_TIME_CFG_SRC_GPS == true) - #if (CFE_PLATFORM_TIME_CFG_SOURCE != true) - #error Cannot define CFE_PLATFORM_TIME_CFG_SRC_GPS as true without defining CFE_PLATFORM_TIME_CFG_SOURCE as true! - #endif - #if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) - #error Cannot define both CFE_PLATFORM_TIME_CFG_SRC_GPS and CFE_PLATFORM_TIME_CFG_SRC_TIME as true! - #endif +#error Cannot define both CFE_PLATFORM_TIME_CFG_SRC_MET and CFE_PLATFORM_TIME_CFG_SRC_GPS as true! +#endif +#if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) +#error Cannot define both CFE_PLATFORM_TIME_CFG_SRC_MET and CFE_PLATFORM_TIME_CFG_SRC_TIME as true! +#endif #endif +#if (CFE_PLATFORM_TIME_CFG_SRC_GPS == true) +#if (CFE_PLATFORM_TIME_CFG_SOURCE != true) +#error Cannot define CFE_PLATFORM_TIME_CFG_SRC_GPS as true without defining CFE_PLATFORM_TIME_CFG_SOURCE as true! +#endif #if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) - #if (CFE_PLATFORM_TIME_CFG_SOURCE != true) - #error Cannot define CFE_PLATFORM_TIME_CFG_SRC_TIME as true without defining CFE_PLATFORM_TIME_CFG_SOURCE as true! - #endif +#error Cannot define both CFE_PLATFORM_TIME_CFG_SRC_GPS and CFE_PLATFORM_TIME_CFG_SRC_TIME as true! +#endif #endif +#if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) +#if (CFE_PLATFORM_TIME_CFG_SOURCE != true) +#error Cannot define CFE_PLATFORM_TIME_CFG_SRC_TIME as true without defining CFE_PLATFORM_TIME_CFG_SOURCE as true! +#endif +#endif /* ** Validate tone signal and data packet arrival selection... */ #if (CFE_MISSION_TIME_AT_TONE_WAS == true) - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) - #error Both CFE_MISSION_TIME_AT_TONE_WAS and CFE_MISSION_TIME_AT_TONE_WILL_BE have been defined as true! - #endif +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +#error Both CFE_MISSION_TIME_AT_TONE_WAS and CFE_MISSION_TIME_AT_TONE_WILL_BE have been defined as true! +#endif #else - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE != true) - #error Either CFE_MISSION_TIME_AT_TONE_WAS or CFE_MISSION_TIME_AT_TONE_WILL_BE must be defined as true! - #endif +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE != true) +#error Either CFE_MISSION_TIME_AT_TONE_WAS or CFE_MISSION_TIME_AT_TONE_WILL_BE must be defined as true! +#endif #endif /* ** Validate simulated tone signal and external time source selection... */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - #error Cannot define both CFE_MISSION_TIME_CFG_FAKE_TONE and CFE_PLATFORM_TIME_CFG_SOURCE as true! - #endif +#if (CFE_PLATFORM_TIME_CFG_SOURCE == true) +#error Cannot define both CFE_MISSION_TIME_CFG_FAKE_TONE and CFE_PLATFORM_TIME_CFG_SOURCE as true! +#endif #endif /* ** Validate simulated tone signal and data packet arrival selection... */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) - #error Cannot define both CFE_MISSION_TIME_CFG_FAKE_TONE and CFE_MISSION_TIME_AT_TONE_WILL_BE as true! - #endif +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +#error Cannot define both CFE_MISSION_TIME_CFG_FAKE_TONE and CFE_MISSION_TIME_AT_TONE_WILL_BE as true! +#endif #endif /* ** Validate task priorities... */ -#if CFE_PLATFORM_TIME_START_TASK_PRIORITY < 0 - #error CFE_PLATFORM_TIME_START_TASK_PRIORITY must be greater than or equal to zero -#elif CFE_PLATFORM_TIME_START_TASK_PRIORITY > 255 - #error CFE_PLATFORM_TIME_START_TASK_PRIORITY must be less than or equal to 255 -#endif -#if CFE_PLATFORM_TIME_TONE_TASK_PRIORITY < 0 - #error CFE_PLATFORM_TIME_TONE_TASK_PRIORITY must be greater than or equal to zero -#elif CFE_PLATFORM_TIME_TONE_TASK_PRIORITY > 255 - #error CFE_PLATFORM_TIME_TONE_TASK_PRIORITY must be less than or equal to 255 -#endif -#if CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY < 0 - #error CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY must be greater than or equal to zero -#elif CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY > 255 - #error CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY must be less than or equal to 255 -#endif +#if CFE_PLATFORM_TIME_START_TASK_PRIORITY < 0 +#error CFE_PLATFORM_TIME_START_TASK_PRIORITY must be greater than or equal to zero +#elif CFE_PLATFORM_TIME_START_TASK_PRIORITY > 255 +#error CFE_PLATFORM_TIME_START_TASK_PRIORITY must be less than or equal to 255 +#endif +#if CFE_PLATFORM_TIME_TONE_TASK_PRIORITY < 0 +#error CFE_PLATFORM_TIME_TONE_TASK_PRIORITY must be greater than or equal to zero +#elif CFE_PLATFORM_TIME_TONE_TASK_PRIORITY > 255 +#error CFE_PLATFORM_TIME_TONE_TASK_PRIORITY must be less than or equal to 255 +#endif +#if CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY < 0 +#error CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY must be greater than or equal to zero +#elif CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY > 255 +#error CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY must be less than or equal to 255 +#endif /* ** Validate task stack sizes... */ -#if CFE_PLATFORM_TIME_START_TASK_STACK_SIZE < 2048 - #error CFE_PLATFORM_TIME_START_TASK_STACK_SIZE must be greater than or equal to 2048 +#if CFE_PLATFORM_TIME_START_TASK_STACK_SIZE < 2048 +#error CFE_PLATFORM_TIME_START_TASK_STACK_SIZE must be greater than or equal to 2048 #endif #if CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE < 2048 - #error CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE must be greater than or equal to 2048 +#error CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE must be greater than or equal to 2048 #endif #if CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE < 2048 - #error CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE must be greater than or equal to 2048 -#endif +#error CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE must be greater than or equal to 2048 +#endif /*************************************************************************/ diff --git a/modules/time/ut-coverage/time_UT.c b/modules/time/ut-coverage/time_UT.c index 9bc1aa8b9..42b8b412e 100644 --- a/modules/time/ut-coverage/time_UT.c +++ b/modules/time/ut-coverage/time_UT.c @@ -43,130 +43,59 @@ /* ** External global variables */ -const char *TIME_SYSLOG_MSGS[] = -{ - NULL, - "TIME:Error reading cmd pipe,RC=0x%08X\n", - "TIME:Application Init Failed,RC=0x%08X\n", - "TIME:1Hz OS_TimerAdd failed:RC=0x%08X\n", - "TIME:1Hz OS_TimerSet failed:RC=0x%08X\n" -}; - -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_HK = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_HK_MID) -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_TONE_CMD = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_TONE_CMD_MID) -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_DATA_CMD = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_DATA_CMD_MID) -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_1HZ_CMD = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_1HZ_CMD_MID) -}; +const char *TIME_SYSLOG_MSGS[] = {NULL, "TIME:Error reading cmd pipe,RC=0x%08X\n", + "TIME:Application Init Failed,RC=0x%08X\n", "TIME:1Hz OS_TimerAdd failed:RC=0x%08X\n", + "TIME:1Hz OS_TimerSet failed:RC=0x%08X\n"}; + +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_HK = {.MsgId = + CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_HK_MID)}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_TONE_CMD = {.MsgId = + CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_TONE_CMD_MID)}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_DATA_CMD = {.MsgId = + CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_DATA_CMD_MID)}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_1HZ_CMD = {.MsgId = + CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_1HZ_CMD_MID)}; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_CMD = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_CMD_MID) -}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_CMD = {.MsgId = + CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_CMD_MID)}; #endif -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_NOOP_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_NOOP_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_RESET_COUNTERS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SEND_DIAGNOSTIC_TLM_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SEND_DIAGNOSTIC_TLM_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STATE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SET_STATE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SET_SOURCE_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SET_SIGNAL_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_ADD_DELAY_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_DELAY_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SUB_DELAY_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_TIME_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SET_TIME_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_MET_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SET_MET_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STCF_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SET_STCF_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SET_LEAP_SECONDS_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_ADD_ADJUST_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_ADJUST_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SUB_ADJUST_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_ADD_1HZ_ADJUSTMENT_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = CFE_TIME_SUB_1HZ_ADJUSTMENT_CC -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_INVALID_MID = -{ - .MsgId = CFE_SB_MSGID_RESERVED, - .CommandCode = 0 -}; -static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_INVALID_CC = -{ - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), - .CommandCode = 0x7F -}; - +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_NOOP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), + .CommandCode = CFE_TIME_NOOP_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_RESET_COUNTERS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SEND_DIAGNOSTIC_TLM_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SEND_DIAGNOSTIC_TLM_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STATE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_STATE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_SOURCE_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_SIGNAL_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_DELAY_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_DELAY_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_DELAY_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_TIME_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_TIME_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_MET_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_MET_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STCF_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_STCF_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_LEAP_SECONDS_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_ADJUST_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_ADJUST_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_ADJUST_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_1HZ_ADJUSTMENT_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_1HZ_ADJUSTMENT_CC}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_INVALID_MID = {.MsgId = CFE_SB_MSGID_RESERVED, .CommandCode = 0}; +static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_INVALID_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = 0x7F}; /* ** Global variables @@ -192,9 +121,7 @@ int32 ut_time_CallbackCalled; ** This function does not return a value. ** ******************************************************************************/ -void OS_SelectTone(int16 Signal) -{ -} +void OS_SelectTone(int16 Signal) {} #endif void UtTest_Setup(void) @@ -238,18 +165,14 @@ void Test_Main(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); CFE_TIME_TaskMain(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[1]), - "CFE_TIME_TaskMain", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[1]), "CFE_TIME_TaskMain", "Command pipe read error"); /* Test with an application initialization failure */ UT_InitData(); - UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterApp),1, -1 ); + UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterApp), 1, -1); CFE_TIME_TaskMain(); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[2]), - "CFE_TIME_TaskMain", + UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[2]), "CFE_TIME_TaskMain", "Application initialization fail"); } @@ -275,64 +198,44 @@ void Test_Init(void) ExpRtn++; #endif #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) +#if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) ExpRtn++; - #endif +#endif #endif /* account for 1Hz command, which is always enabled */ ExpRtn++; CFE_TIME_EarlyInit(); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_MSG_Init)) == ExpRtn, - "CFE_TIME_EarlyInit", - "Successful"); + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_MSG_Init)) == ExpRtn, "CFE_TIME_EarlyInit", "Successful"); /* Test successful time task initialization */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == CFE_SUCCESS, - "CFE_TIME_Task_Init", - "Successful"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == CFE_SUCCESS, "CFE_TIME_Task_Init", "Successful"); /* Test response to a failure to register an application */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterApp), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -1, - "CFE_TIME_Task_Init", - "Register application failure"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Register application failure"); /* Test response to a failure creating the first child task */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CreateChildTask), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -1, - "CFE_TIME_Task_Init", - "Child task 1 create failure"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Child task 1 create failure"); /* Test response to a failure creating the second child task */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CreateChildTask), 2, -3); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -3, - "CFE_TIME_Task_Init", - "Child task 2 create failure"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -3, "CFE_TIME_Task_Init", "Child task 2 create failure"); /* Test response to an error creating a command pipe */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -1, - "CFE_TIME_Task_Init", - "Create pipe failure"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Create pipe failure"); /* Test response to failure of the HK request subscription */ UT_InitData(); SubErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -SubErrCnt, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -SubErrCnt, "CFE_TIME_Task_Init", "HK request subscription failure"); /* Test response to failure of the tone commands subscription */ @@ -351,9 +254,7 @@ void Test_Init(void) ExpRtn = -SubLocalErrCnt; #endif - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == ExpRtn, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", "Tone commands subscription failure (client)"); /* Test response to failure of the time at the tone "data" commands @@ -374,9 +275,7 @@ void Test_Init(void) ExpRtn = -SubLocalErrCnt; #endif - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == ExpRtn, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", "Time data command subscription failure"); /* Test response to failure of the fake tone signal commands @@ -386,26 +285,22 @@ void Test_Init(void) ExpRtn = 0; #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) +#if (CFE_PLATFORM_TIME_CFG_CLIENT == true) SubErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt); ExpRtn = -SubErrCnt; - #endif +#endif - #if (CFE_PLATFORM_TIME_CFG_SERVER == true) +#if (CFE_PLATFORM_TIME_CFG_SERVER == true) SubLocalErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_SubscribeLocal), SubLocalErrCnt, -SubLocalErrCnt); ExpRtn = -SubLocalErrCnt; - #endif +#endif - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == ExpRtn, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", "Fake tone signal commands subscription failure"); #else - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Task_Init", "*Not tested* Fake tone signal commands subscription failure"); #endif @@ -418,15 +313,11 @@ void Test_Init(void) SubErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt); ExpRtn = -SubErrCnt; - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == ExpRtn, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", "Time at tone signal commands subscription failure"); #else SubErrCnt++; - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Task_Init", "*Not tested* Time at tone signal commands subscription failure"); #endif @@ -437,50 +328,34 @@ void Test_Init(void) SubErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt); ExpRtn = -SubErrCnt; - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == ExpRtn, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", "Time task ground commands subscription failure"); /* Test response to failure creating a tone semaphore */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -1, - "CFE_TIME_Task_Init", - "Tone semaphore create failure"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Tone semaphore create failure"); /* Test response to failure creating a local semaphore */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 2, -2); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -2, - "CFE_TIME_Task_Init", - "Local semaphore create failure"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -2, "CFE_TIME_Task_Init", "Local semaphore create failure"); /* Test response to an EVS register failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -1, - "CFE_TIME_Task_Init", - "EVS register failure"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "EVS register failure"); /* Test response to an error sending an initialization event */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_TaskInit() == -1, - "CFE_TIME_Task_Init", - "Send initialization event error"); + UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Send initialization event error"); /* Test response to a failure to get the ID by name */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_TimeBaseGetIdByName), OS_ERROR); CFE_TIME_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, - "CFE_TIME_Task_Init", + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_TIME_Task_Init", "Get ID by name failure"); /* Test response to an error setting up the 1Hz callback. @@ -491,18 +366,15 @@ void Test_Init(void) UT_SetDefaultReturnValue(UT_KEY(OS_TimerAdd), OS_ERROR); CFE_TIME_TaskInit(); UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1 && - UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[3]), - "CFE_TIME_Task_Init", - "1Hz OS_TimerAdd failure"); + UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1 && UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[3]), + "CFE_TIME_Task_Init", "1Hz OS_TimerAdd failure"); UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_TimerSet), OS_ERROR); CFE_TIME_TaskInit(); UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1 && UT_SyslogIsInHistory((TIME_SYSLOG_MSGS[4])), - "CFE_TIME_Task_Init", - "1Hz OS_TimerSet failure"); + "CFE_TIME_Task_Init", "1Hz OS_TimerSet failure"); } /* @@ -510,19 +382,19 @@ void Test_Init(void) */ void Test_GetTime(void) { - int result; + int result; uint16 StateFlags, ActFlags; - char testDesc[UT_MAX_MESSAGE_LENGTH]; - char timeBuf[sizeof("yyyy-ddd-hh:mm:ss.xxxxx_")]; + char testDesc[UT_MAX_MESSAGE_LENGTH]; + char timeBuf[sizeof("yyyy-ddd-hh:mm:ss.xxxxx_")]; /* Note: Time is in seconds + microseconds since 1980-001-00:00:00:00000 */ /* The time below equals 2013-001-02:03:04.56789 */ - int seconds = 1041472984; - int microsecs = 567890; - int actual; - const char *expectedMET = "2013-001-02:03:14.56789"; - const char *expectedTAI = "2013-001-03:03:14.56789"; - const char *expectedUTC = "2013-001-03:02:42.56789"; - const char *expectedSTCF = "1980-001-01:00:00.00000"; + int seconds = 1041472984; + int microsecs = 567890; + int actual; + const char * expectedMET = "2013-001-02:03:14.56789"; + const char * expectedTAI = "2013-001-03:03:14.56789"; + const char * expectedUTC = "2013-001-03:02:42.56789"; + const char * expectedSTCF = "1980-001-01:00:00.00000"; volatile CFE_TIME_ReferenceState_t *RefState; UtPrintf("Begin Test Get Time"); @@ -532,26 +404,22 @@ void Test_GetTime(void) /* Test successfully retrieving the mission elapsed time */ UT_InitData(); UT_SetBSP_Time(seconds, microsecs); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneMET.Seconds = 20; /* 20.00000 */ - RefState->AtToneMET.Subseconds = 0; - RefState->AtToneSTCF.Seconds = 3600; /* 01:00:00.00000 */ - RefState->AtToneSTCF.Subseconds = 0; - RefState->AtToneLeapSeconds = 32; - RefState->AtToneDelay.Seconds = 0; /* 0.00000 */ + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneMET.Seconds = 20; /* 20.00000 */ + RefState->AtToneMET.Subseconds = 0; + RefState->AtToneSTCF.Seconds = 3600; /* 01:00:00.00000 */ + RefState->AtToneSTCF.Subseconds = 0; + RefState->AtToneLeapSeconds = 32; + RefState->AtToneDelay.Seconds = 0; /* 0.00000 */ RefState->AtToneDelay.Subseconds = 0; - RefState->AtToneLatch.Seconds = 10; /* 10.00000 */ + RefState->AtToneLatch.Seconds = 10; /* 10.00000 */ RefState->AtToneLatch.Subseconds = 0; - RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; /* Force invalid time */ + RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; /* Force invalid time */ CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_Print(timeBuf, CFE_TIME_GetMET()); result = !strcmp(timeBuf, expectedMET); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %s, actual = %s", expectedMET, timeBuf); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_GetMET", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedMET, timeBuf); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetMET", testDesc); /* Test successfully retrieving the mission elapsed time (seconds * portion) @@ -559,14 +427,9 @@ void Test_GetTime(void) UT_InitData(); UT_SetBSP_Time(seconds, microsecs); actual = CFE_TIME_GetMETseconds(); - result = seconds + RefState->AtToneMET.Seconds - - RefState->AtToneLatch.Seconds; - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %d, actual = %d", result, actual); - UT_Report(__FILE__, __LINE__, - result == actual, - "CFE_TIME_GetMETseconds", - testDesc); + result = seconds + RefState->AtToneMET.Seconds - RefState->AtToneLatch.Seconds; + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %d, actual = %d", result, actual); + UT_Report(__FILE__, __LINE__, result == actual, "CFE_TIME_GetMETseconds", testDesc); /* Test successfully retrieving the mission elapsed time (sub-seconds * portion) @@ -574,50 +437,31 @@ void Test_GetTime(void) UT_InitData(); UT_SetBSP_Time(seconds, microsecs); actual = CFE_TIME_GetMETsubsecs(); - result = CFE_TIME_Micro2SubSecs(microsecs) + - RefState->AtToneMET.Subseconds - - RefState->AtToneLatch.Subseconds; - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %d, actual = %d", result, actual); - UT_Report(__FILE__, __LINE__, - result == actual, - "CFE_TIME_GetMETsubsecs", - testDesc); + result = CFE_TIME_Micro2SubSecs(microsecs) + RefState->AtToneMET.Subseconds - RefState->AtToneLatch.Subseconds; + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %d, actual = %d", result, actual); + UT_Report(__FILE__, __LINE__, result == actual, "CFE_TIME_GetMETsubsecs", testDesc); /* Test successfully retrieving the leap seconds */ UT_InitData(); actual = CFE_TIME_GetLeapSeconds(); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %d, actual = %d", - RefState->AtToneLeapSeconds, actual); - UT_Report(__FILE__, __LINE__, - actual == RefState->AtToneLeapSeconds, - "CFE_TIME_GetLeapSeconds", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %d, actual = %d", RefState->AtToneLeapSeconds, actual); + UT_Report(__FILE__, __LINE__, actual == RefState->AtToneLeapSeconds, "CFE_TIME_GetLeapSeconds", testDesc); /* Test successfully retrieving the international atomic time (TAI) */ UT_InitData(); UT_SetBSP_Time(seconds, microsecs); CFE_TIME_Print(timeBuf, CFE_TIME_GetTAI()); result = !strcmp(timeBuf, expectedTAI); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %s, actual = %s", expectedTAI, timeBuf); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_GetTAI", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedTAI, timeBuf); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetTAI", testDesc); /* Test successfully retrieving the coordinated universal time (UTC) */ UT_InitData(); UT_SetBSP_Time(seconds, microsecs); CFE_TIME_Print(timeBuf, CFE_TIME_GetUTC()); result = !strcmp(timeBuf, expectedUTC); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %s, actual = %s", expectedUTC, timeBuf); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_GetUTC", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedUTC, timeBuf); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetUTC", testDesc); /* Test successfully retrieving the default time (UTC or TAI) */ UT_InitData(); @@ -626,19 +470,12 @@ void Test_GetTime(void) #if (CFE_MISSION_TIME_CFG_DEFAULT_TAI == true) result = !strcmp(timeBuf, expectedTAI); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "(Default = TAI) Expected = %s, actual = %s", - expectedTAI, timeBuf); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "(Default = TAI) Expected = %s, actual = %s", expectedTAI, timeBuf); #else result = !strcmp(timeBuf, expectedUTC); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "(Default = UTC) Expected = %s, actual = %s", - expectedUTC, timeBuf); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "(Default = UTC) Expected = %s, actual = %s", expectedUTC, timeBuf); #endif - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_GetTime", - testDesc); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetTime", testDesc); /* Test successfully retrieving the spacecraft time correlation * factor (SCTF) @@ -647,85 +484,63 @@ void Test_GetTime(void) UT_SetBSP_Time(seconds, microsecs); CFE_TIME_Print(timeBuf, CFE_TIME_GetSTCF()); result = !strcmp(timeBuf, expectedSTCF); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %s, actual = %s", expectedSTCF, timeBuf); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_GetSTCF", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedSTCF, timeBuf); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetSTCF", testDesc); /* Test retrieving the time status (invalid time is expected) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_GetClockState() == CFE_TIME_ClockState_INVALID, - "CFE_TIME_GetClockState", + UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockState() == CFE_TIME_ClockState_INVALID, "CFE_TIME_GetClockState", "Invalid time"); - /* Test alternate flag values */ - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; - RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; - CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; - CFE_TIME_Global.Forced2Fly = false; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; + RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; + CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; + CFE_TIME_Global.Forced2Fly = false; CFE_TIME_Global.OneTimeDirection = CFE_TIME_AdjustDirection_SUBTRACT; - CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_SUBTRACT; - RefState->DelayDirection = CFE_TIME_AdjustDirection_SUBTRACT; - CFE_TIME_Global.IsToneGood = false; + CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_SUBTRACT; + RefState->DelayDirection = CFE_TIME_AdjustDirection_SUBTRACT; + CFE_TIME_Global.IsToneGood = false; CFE_TIME_FinishReferenceUpdate(RefState); - ActFlags = CFE_TIME_GetClockInfo(); + ActFlags = CFE_TIME_GetClockInfo(); StateFlags = 0; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) StateFlags |= CFE_TIME_FLAG_SERVER; #endif - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = 0x%04X, actual = 0x%04X", StateFlags, ActFlags); - UT_Report(__FILE__, __LINE__, - ActFlags == StateFlags, - "CFE_TIME_GetClockInfo", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = 0x%04X, actual = 0x%04X", StateFlags, ActFlags); + UT_Report(__FILE__, __LINE__, ActFlags == StateFlags, "CFE_TIME_GetClockInfo", testDesc); /* Test successfully converting the clock state data to flag values */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->ClockSetState = CFE_TIME_SetState_WAS_SET; - RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->ClockSetState = CFE_TIME_SetState_WAS_SET; + RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; RefState->DelayDirection = CFE_TIME_AdjustDirection_ADD; CFE_TIME_FinishReferenceUpdate(RefState); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; - CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; - CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; - CFE_TIME_Global.Forced2Fly = true; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; + CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; + CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; + CFE_TIME_Global.Forced2Fly = true; CFE_TIME_Global.OneTimeDirection = CFE_TIME_AdjustDirection_ADD; - CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_ADD; - CFE_TIME_Global.IsToneGood = true; + CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_ADD; + CFE_TIME_Global.IsToneGood = true; - StateFlags = CFE_TIME_FLAG_CLKSET | - CFE_TIME_FLAG_FLYING | - CFE_TIME_FLAG_SRCINT | - CFE_TIME_FLAG_SIGPRI | - CFE_TIME_FLAG_SRVFLY | - CFE_TIME_FLAG_CMDFLY | - CFE_TIME_FLAG_ADD1HZ | - CFE_TIME_FLAG_ADDADJ | - CFE_TIME_FLAG_ADDTCL | - CFE_TIME_FLAG_GDTONE; + StateFlags = CFE_TIME_FLAG_CLKSET | CFE_TIME_FLAG_FLYING | CFE_TIME_FLAG_SRCINT | CFE_TIME_FLAG_SIGPRI | + CFE_TIME_FLAG_SRVFLY | CFE_TIME_FLAG_CMDFLY | CFE_TIME_FLAG_ADD1HZ | CFE_TIME_FLAG_ADDADJ | + CFE_TIME_FLAG_ADDTCL | CFE_TIME_FLAG_GDTONE; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) StateFlags |= CFE_TIME_FLAG_SERVER; #endif ActFlags = CFE_TIME_GetClockInfo(); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = 0x%04X, actual = 0x%04X", StateFlags, ActFlags); - UT_Report(__FILE__, __LINE__, - ActFlags == StateFlags, - "CFE_TIME_GetClockInfo", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = 0x%04X, actual = 0x%04X", StateFlags, ActFlags); + UT_Report(__FILE__, __LINE__, ActFlags == StateFlags, "CFE_TIME_GetClockInfo", testDesc); } /* @@ -738,152 +553,126 @@ void Test_TimeOp(void) UtPrintf("Begin Test Time Operations"); /* Initialize to zero time values */ - time1.Subseconds = 0; - time1.Seconds = 0; - time2.Subseconds = 0; - time2.Seconds = 0; + time1.Subseconds = 0; + time1.Seconds = 0; + time2.Subseconds = 0; + time2.Seconds = 0; exp_result.Subseconds = 0; - exp_result.Seconds = 0; + exp_result.Seconds = 0; /* Test adding with both times equal zero */ UT_InitData(); result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A = time B = 0 seconds/subseconds"); /* Test subtracting with both times equal zero */ UT_InitData(); result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A = time B = 0 seconds/subseconds"); /* Test comparing with both times equal zero */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time1, time2) == CFE_TIME_EQUAL, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_EQUAL, "CFE_TIME_Compare", "Time A = time B = 0 seconds/subseconds"); /* Initialize to maximum time values */ time1.Subseconds = 0xffffffff; - time1.Seconds = 0xffffffff; + time1.Seconds = 0xffffffff; time2.Subseconds = 0xffffffff; - time2.Seconds = 0xffffffff; + time2.Seconds = 0xffffffff; /* Test adding two maximum time values (extreme time rollover case) */ UT_InitData(); exp_result.Subseconds = 0xfffffffe; - exp_result.Seconds = 0xffffffff; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + exp_result.Seconds = 0xffffffff; + result = CFE_TIME_Add(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A = time B = maximum seconds/subseconds (rollover)"); /* Test subtracting two maximum time values (zero result) */ UT_InitData(); exp_result.Subseconds = 0; - exp_result.Seconds = 0; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + exp_result.Seconds = 0; + result = CFE_TIME_Subtract(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A = time B = maximum seconds/subseconds (zero result)"); /* Test comparing two maximum time values */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time1, time2) == CFE_TIME_EQUAL, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_EQUAL, "CFE_TIME_Compare", "Time A = time B = maximum seconds/subseconds"); /* Initialize to single time value at maximum subseconds */ time1.Subseconds = 0xffffffff; - time1.Seconds = 0xffff0000; + time1.Seconds = 0xffff0000; time2.Subseconds = 0x00000001; - time2.Seconds = 0x0000ffff; + time2.Seconds = 0x0000ffff; /* Test adding two time values; time A > time B (minimal time * rollover case) */ UT_InitData(); exp_result.Subseconds = 0; - exp_result.Seconds = 0; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + exp_result.Seconds = 0; + result = CFE_TIME_Add(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A > time B (rollover)"); /* Test subtracting two time values; time A > time B */ UT_InitData(); exp_result.Subseconds = 0xfffffffe; - exp_result.Seconds = 0xfffe0001; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + exp_result.Seconds = 0xfffe0001; + result = CFE_TIME_Subtract(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A > time B"); /* Test comparing two time values; time A > time B (assumes time has * rolled over) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time1, time2) == CFE_TIME_A_LT_B, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_A_LT_B, "CFE_TIME_Compare", "Time A > time B"); /* Test adding two time values; time A < time B */ UT_InitData(); exp_result.Subseconds = 0; - exp_result.Seconds = 0; - result = CFE_TIME_Add(time2, time1); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + exp_result.Seconds = 0; + result = CFE_TIME_Add(time2, time1); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A < time B"); /* Test subtracting two time values; time A < time B (rollover) */ UT_InitData(); exp_result.Subseconds = 0x00000002; - exp_result.Seconds = 0x0001fffe; - result = CFE_TIME_Subtract(time2, time1); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + exp_result.Seconds = 0x0001fffe; + result = CFE_TIME_Subtract(time2, time1); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A < time B (rollover)"); /* Test comparing two time values; time A < time B (assumes time has * rolled over) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time2, time1) == CFE_TIME_A_GT_B, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time2, time1) == CFE_TIME_A_GT_B, "CFE_TIME_Compare", "Time A < time B"); /* Initialize so that only subseconds are different; seconds are * the same */ time1.Subseconds = 30; - time1.Seconds = 3; + time1.Seconds = 3; time2.Subseconds = 29; - time2.Seconds = 3; + time2.Seconds = 3; /* Test adding two time values; time A subseconds > time B subseconds * (seconds same) */ UT_InitData(); exp_result.Subseconds = 59; - exp_result.Seconds = 6; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + exp_result.Seconds = 6; + result = CFE_TIME_Add(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A subseconds > time B subseconds (seconds same)"); /* Test subtracting two time values; time A subseconds > time B @@ -891,20 +680,16 @@ void Test_TimeOp(void) */ UT_InitData(); exp_result.Subseconds = 1; - exp_result.Seconds = 0; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + exp_result.Seconds = 0; + result = CFE_TIME_Subtract(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A subseconds > time B subseconds (seconds same)"); /* Test comparing two time values; time A subseconds > time B subseconds * (seconds same) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time1, time2) == CFE_TIME_A_GT_B, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_A_GT_B, "CFE_TIME_Compare", "Time A subseconds > time B subseconds (seconds same)"); /* Test adding two time values; time A subseconds < time B subseconds @@ -912,11 +697,9 @@ void Test_TimeOp(void) */ UT_InitData(); exp_result.Subseconds = 59; - exp_result.Seconds = 6; - result = CFE_TIME_Add(time2, time1); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + exp_result.Seconds = 6; + result = CFE_TIME_Add(time2, time1); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A subseconds < time B subseconds (seconds same)"); /* Test subtracting two time values; time A subseconds < time B @@ -924,40 +707,34 @@ void Test_TimeOp(void) */ UT_InitData(); exp_result.Subseconds = 0xffffffff; - exp_result.Seconds = 0xffffffff; - result = CFE_TIME_Subtract(time2, time1); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + exp_result.Seconds = 0xffffffff; + result = CFE_TIME_Subtract(time2, time1); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A subseconds < time B subseconds (seconds same)"); /* Test comparing two time values; time A subseconds < time B subseconds * (seconds same) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time2, time1) == CFE_TIME_A_LT_B, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time2, time1) == CFE_TIME_A_LT_B, "CFE_TIME_Compare", "Time A subseconds < time B subseconds (seconds same)"); /* Initialize so that only seconds are different; subseconds are * the same */ time1.Subseconds = 18; - time1.Seconds = 8; + time1.Seconds = 8; time2.Subseconds = 18; - time2.Seconds = 7; + time2.Seconds = 7; /* Test adding two time values; time A seconds > time B seconds * (subseconds same) */ UT_InitData(); exp_result.Subseconds = 36; - exp_result.Seconds = 15; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + exp_result.Seconds = 15; + result = CFE_TIME_Add(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A seconds > time B seconds (subseconds same)"); /* Test subtracting two time values; time A seconds > time B seconds @@ -965,20 +742,16 @@ void Test_TimeOp(void) */ UT_InitData(); exp_result.Subseconds = 0; - exp_result.Seconds = 1; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + exp_result.Seconds = 1; + result = CFE_TIME_Subtract(time1, time2); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A seconds > time B seconds (subseconds same)"); /* Test comparing two time values; time A seconds > time B seconds * (subseconds same) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time1, time2) == CFE_TIME_A_GT_B, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_A_GT_B, "CFE_TIME_Compare", "Time A seconds > time B seconds (subseconds same)"); /* Test adding two time values; time A seconds < time B seconds @@ -986,11 +759,9 @@ void Test_TimeOp(void) */ UT_InitData(); exp_result.Subseconds = 36; - exp_result.Seconds = 15; - result = CFE_TIME_Add(time2, time1); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Add", + exp_result.Seconds = 15; + result = CFE_TIME_Add(time2, time1); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", "Time A seconds < time B seconds (subseconds same)"); /* Test subtracting two time values; time A seconds < time B seconds @@ -998,20 +769,16 @@ void Test_TimeOp(void) */ UT_InitData(); exp_result.Subseconds = 0; - exp_result.Seconds = 0xffffffff; - result = CFE_TIME_Subtract(time2, time1); - UT_Report(__FILE__, __LINE__, - memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, - "CFE_TIME_Subtract", + exp_result.Seconds = 0xffffffff; + result = CFE_TIME_Subtract(time2, time1); + UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", "Time A seconds < time B seconds (subseconds same)"); /* Test comparing two time values; time A seconds < time B seconds * (subseconds same) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Compare(time2, time1) == CFE_TIME_A_LT_B, - "CFE_TIME_Compare", + UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time2, time1) == CFE_TIME_A_LT_B, "CFE_TIME_Compare", "Time A seconds < time B seconds (subseconds same)"); } @@ -1020,10 +787,10 @@ void Test_TimeOp(void) */ void Test_ConvertTime(void) { - int result; - char testDesc[UT_MAX_MESSAGE_LENGTH]; - char timeBuf[sizeof("yyyy-ddd-hh:mm:ss.xxxxx_")]; - CFE_TIME_SysTime_t METTime; + int result; + char testDesc[UT_MAX_MESSAGE_LENGTH]; + char timeBuf[sizeof("yyyy-ddd-hh:mm:ss.xxxxx_")]; + CFE_TIME_SysTime_t METTime; volatile CFE_TIME_ReferenceState_t *RefState; #if (CFE_MISSION_TIME_CFG_DEFAULT_TAI == true) @@ -1038,27 +805,23 @@ void Test_ConvertTime(void) /* Test MET to SCTF conversion */ UT_InitData(); - METTime.Seconds = 0; - METTime.Subseconds = 0; - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneSTCF.Seconds = 7240; /* 01:00:00.00000 */ + METTime.Seconds = 0; + METTime.Subseconds = 0; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneSTCF.Seconds = 7240; /* 01:00:00.00000 */ RefState->AtToneSTCF.Subseconds = 0; - RefState->AtToneLeapSeconds = 32; + RefState->AtToneLeapSeconds = 32; CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_Print(timeBuf, CFE_TIME_MET2SCTime(METTime)); /* SC = MET + SCTF [- Leaps for UTC] */ result = !strcmp(timeBuf, expectedSCTime); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, - "Expected = %s, actual = %s", expectedSCTime, timeBuf); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_MET2SCTime", - testDesc); + snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedSCTime, timeBuf); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_MET2SCTime", testDesc); /* NOTE: Microseconds <-> Subseconds conversion routines are implemented * as part of OS_time_t in OSAL, and are coverage tested there. CFE time - * conversions are now just wrappers of these OSAL routines. + * conversions are now just wrappers of these OSAL routines. * This should only sanity-check basic values to get coverage of the CFE * wrappers. Testing of value corner cases / rounding should be limited to @@ -1066,41 +829,31 @@ void Test_ConvertTime(void) /* Test subseconds to microseconds conversion; zero subsecond value */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Sub2MicroSecs(0) == 0, - "CFE_TIME_Sub2MicroSecs", + UT_Report(__FILE__, __LINE__, CFE_TIME_Sub2MicroSecs(0) == 0, "CFE_TIME_Sub2MicroSecs", "Convert 0 subsecond value"); /* Test subseconds to microseconds conversion; half second */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Sub2MicroSecs(0x80000000) == 500000, - "CFE_TIME_Sub2MicroSecs", + UT_Report(__FILE__, __LINE__, CFE_TIME_Sub2MicroSecs(0x80000000) == 500000, "CFE_TIME_Sub2MicroSecs", "No microsecond adjustment"); /* Test subseconds to microseconds conversion; subseconds exceeds * microseconds limit */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Sub2MicroSecs(0xffffffff) == 999999, - "CFE_TIME_Sub2MicroSecs", + UT_Report(__FILE__, __LINE__, CFE_TIME_Sub2MicroSecs(0xffffffff) == 999999, "CFE_TIME_Sub2MicroSecs", "Subseconds exceeds maximum microseconds value (limit ms)"); /* Test microseconds to subseconds conversion; zero microsecond value */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Micro2SubSecs(0) == 0, - "CFE_TIME_Micro2SubSecs", + UT_Report(__FILE__, __LINE__, CFE_TIME_Micro2SubSecs(0) == 0, "CFE_TIME_Micro2SubSecs", "Convert 0 microseconds to 0 subseconds"); /* Test microseconds to subseconds conversion; microseconds exceeds * maximum limit */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Micro2SubSecs(0xffffffff) == 0xffffffff, - "CFE_TIME_Micro2SubSecs", + UT_Report(__FILE__, __LINE__, CFE_TIME_Micro2SubSecs(0xffffffff) == 0xffffffff, "CFE_TIME_Micro2SubSecs", "Microseconds exceeds maximum; set maximum subseconds value"); } @@ -1113,8 +866,8 @@ void Test_ConvertTime(void) */ void Test_Print(void) { - int result; - char testDesc[1+UT_MAX_MESSAGE_LENGTH]; + int result; + char testDesc[1 + UT_MAX_MESSAGE_LENGTH]; CFE_TIME_SysTime_t time; UtPrintf("Begin Test Print"); @@ -1122,57 +875,41 @@ void Test_Print(void) /* Test with zero time value */ UT_InitData(); time.Subseconds = 0; - time.Seconds = 0; + time.Seconds = 0; CFE_TIME_Print(testDesc, time); result = !strcmp(testDesc, "1980-001-00:00:00.00000"); - strncat(testDesc," Zero time value", - UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_Print", - testDesc); + strncat(testDesc, " Zero time value", UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); /* Test with a time value that causes seconds >= 60 when * CFE_MISSION_TIME_EPOCH_SECOND > 0 */ UT_InitData(); time.Subseconds = 0; - time.Seconds = 59; + time.Seconds = 59; CFE_TIME_Print(testDesc, time); result = !strcmp(testDesc, "1980-001-00:00:59.00000"); - strncat(testDesc, - " Seconds overflow if CFE_MISSION_TIME_EPOCH_SECOND > 0", + strncat(testDesc, " Seconds overflow if CFE_MISSION_TIME_EPOCH_SECOND > 0", UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_Print", - testDesc); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); /* Test with mission representative time values */ UT_InitData(); time.Subseconds = 215000; - time.Seconds = 1041472984; + time.Seconds = 1041472984; CFE_TIME_Print(testDesc, time); result = !strcmp(testDesc, "2013-001-02:03:04.00005"); - strncat(testDesc," Mission representative time", - UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_Print", - testDesc); + strncat(testDesc, " Mission representative time", UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); /* Test with maximum seconds and subseconds values */ UT_InitData(); time.Subseconds = 0xffffffff; - time.Seconds = 0xffffffff; + time.Seconds = 0xffffffff; CFE_TIME_Print(testDesc, time); result = !strcmp(testDesc, "2116-038-06:28:15.99999"); - strncat(testDesc," Maximum seconds/subseconds values", - UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, - result, - "CFE_TIME_Print", - testDesc); + strncat(testDesc, " Maximum seconds/subseconds values", UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); + UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); } /* @@ -1189,8 +926,8 @@ int32 ut_time_MyCallbackFunc(void) */ void Test_RegisterSyncCallbackTrue(void) { - int32 Result; - uint32 AppIndex; + int32 Result; + uint32 AppIndex; UtPrintf("Begin Test Register Synch Callback"); @@ -1204,11 +941,7 @@ void Test_RegisterSyncCallbackTrue(void) CFE_TIME_Global.SynchCallback[0].Ptr = NULL; Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == -1, - "CFE_TIME_RegisterSynchCallback", - "Bad App ID"); - + UT_Report(__FILE__, __LINE__, Result == -1, "CFE_TIME_RegisterSynchCallback", "Bad App ID"); /* Test registering the callback function the maximum number of times, * then attempt registering one more time @@ -1220,25 +953,18 @@ void Test_RegisterSyncCallbackTrue(void) * the second should fail. */ Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == CFE_SUCCESS, - "CFE_TIME_RegisterSynchCallback", + UT_Report(__FILE__, __LINE__, Result == CFE_SUCCESS, "CFE_TIME_RegisterSynchCallback", "Successfully registered callbacks"); - Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == CFE_TIME_TOO_MANY_SYNCH_CALLBACKS, - "CFE_TIME_RegisterSynchCallback", + UT_Report(__FILE__, __LINE__, Result == CFE_TIME_TOO_MANY_SYNCH_CALLBACKS, "CFE_TIME_RegisterSynchCallback", "Too Many registered callbacks"); AppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == CFE_SUCCESS, - "CFE_TIME_RegisterSynchCallback", + UT_Report(__FILE__, __LINE__, Result == CFE_SUCCESS, "CFE_TIME_RegisterSynchCallback", "Successfully registered callbacks"); /* @@ -1249,11 +975,8 @@ void Test_RegisterSyncCallbackTrue(void) AppIndex = 99999; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == CFE_TIME_TOO_MANY_SYNCH_CALLBACKS, - "CFE_TIME_RegisterSynchCallback", + UT_Report(__FILE__, __LINE__, Result == CFE_TIME_TOO_MANY_SYNCH_CALLBACKS, "CFE_TIME_RegisterSynchCallback", "App ID out of range"); - } /* @@ -1265,14 +988,12 @@ void Test_ExternalTone(void) UT_InitData(); UT_SetBSP_Time(123, 0); - CFE_TIME_Global.ToneSignalLatch.Seconds = 0; + CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_ExternalTone(); UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneSignalLatch.Seconds == 123 && - CFE_TIME_Global.ToneSignalLatch.Subseconds == 0, - "CFE_TIME_ExternalTone", - "External tone"); + CFE_TIME_Global.ToneSignalLatch.Seconds == 123 && CFE_TIME_Global.ToneSignalLatch.Subseconds == 0, + "CFE_TIME_ExternalTone", "External tone"); } /* @@ -1280,8 +1001,7 @@ void Test_ExternalTone(void) */ void Test_External(void) { -#if (CFE_PLATFORM_TIME_CFG_SRC_MET == true || \ - CFE_PLATFORM_TIME_CFG_SRC_GPS == true || \ +#if (CFE_PLATFORM_TIME_CFG_SRC_MET == true || CFE_PLATFORM_TIME_CFG_SRC_GPS == true || \ CFE_PLATFORM_TIME_CFG_SRC_TIME == true) CFE_TIME_SysTime_t settime = {5, 4}; @@ -1294,130 +1014,109 @@ void Test_External(void) * state not set */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_NOT_SET; CFE_TIME_Global.ExternalCount = 0; - settime.Seconds = 0; - settime.Subseconds = 0; + settime.Seconds = 0; + settime.Subseconds = 0; CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ExternalCount == 1, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalMET", "External MET - external source and clock state not set"); /* Test setting time data from MET using an external source with the clock * state set and time less than the minimum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 0; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 10; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 0; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 10; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalMET", "External MET - external source and time out of range (low)"); /* Test setting time data from MET using an external source with the clock * state set and time greater than the maximum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 20; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 10; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 20; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 10; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalMET", "External MET - external source and time out of range (high)"); /* Test setting time data from MET (external source, state set) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 10; - settime.Subseconds = 0; - CFE_TIME_Global.ExternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 10; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 10; + settime.Subseconds = 0; + CFE_TIME_Global.ExternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 10; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ExternalCount == 1, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalMET", "External MET - external source and time in range"); /* Test setting time data from MET (internal source) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; CFE_TIME_Global.InternalCount = 0; CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalMET", "External MET (internal source)"); #else - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", "*Not tested* External MET - external source and clock state " - "not set"); + "not set"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", "*Not tested* External MET - external source and time out of " - "range (low)"); + "range (low)"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", "*Not tested* External MET - external source and time out of " - "range (high)"); + "range (high)"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalMET", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", "*Not tested* External MET - external source and time in range"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalMET", - "*Not tested* External MET (internal source)"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", "*Not tested* External MET (internal source)"); #endif #if (CFE_PLATFORM_TIME_CFG_SRC_GPS == true) @@ -1425,136 +1124,115 @@ void Test_External(void) * state not set */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_NOT_SET; CFE_TIME_Global.ExternalCount = 0; - settime.Seconds = 0; - settime.Subseconds = 0; + settime.Seconds = 0; + settime.Subseconds = 0; CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ExternalCount == 1, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalGPS", "External GPS - external source and clock state not set"); /* Test setting time data from GPS using an external source with the clock * state set and time less than the minimum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 0; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 0; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 0; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneSTCF.Seconds = 10; + CFE_TIME_Global.AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalGPS", "External GPS - external source and time out of range (low)"); /* Test setting time data from GPS using an external source with the clock * state set and time greater than the maximum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 20; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 20; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 0; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneSTCF.Seconds = 10; + CFE_TIME_Global.AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalGPS", "External GPS - external source and time out of range (high)"); /* Test setting time data from GPS (external source, state set) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 10; - settime.Subseconds = 0; - CFE_TIME_Global.ExternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 10; + settime.Subseconds = 0; + CFE_TIME_Global.ExternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 0; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneSTCF.Seconds = 10; + CFE_TIME_Global.AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ExternalCount == 1, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalGPS", "External GPS - external source and time in range"); /* Test setting time data from GPS (internal source) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; CFE_TIME_Global.InternalCount = 0; CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalGPS", "External GPS (internal source)"); #else - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", "*Not tested* External GPS - external source and clock state " - "not set"); + "not set"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", "Not tested* External GPS - external source and time out of " - "range (low)"); + "range (low)"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", "*Not tested* External GPS - external source and time out of " - "range (high)"); + "range (high)"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalGPS", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", "*Not tested* External GPS - external source and time in range"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalGPS", - "*Not tested* External GPS (internal source)"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", "*Not tested* External GPS (internal source)"); #endif #if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) @@ -1562,136 +1240,115 @@ void Test_External(void) * state not set */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_NOT_SET; CFE_TIME_Global.ExternalCount = 0; - settime.Seconds = 0; - settime.Subseconds = 0; + settime.Seconds = 0; + settime.Subseconds = 0; CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ExternalCount == 1, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalTime", "External Time - external source and clock state not set"); /* Test setting time data from Time using an external source with the clock * state set and time less than the minimum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 0; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 0; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 0; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneSTCF.Seconds = 10; + CFE_TIME_Global.AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalTime", "External Time - external source and time out of range (low)"); /* Test setting time data from Time using an external source with the clock * state set and time greater than the maximum */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 20; - settime.Subseconds = 0; - CFE_TIME_Global.InternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 20; + settime.Subseconds = 0; + CFE_TIME_Global.InternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 0; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneSTCF.Seconds = 10; + CFE_TIME_Global.AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalTime", "External Time - external source and time out of range (high)"); /* Test setting time data from Time (external source, state set) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; - settime.Seconds = 10; - settime.Subseconds = 0; - CFE_TIME_Global.ExternalCount = 0; - CFE_TIME_Global.AtToneMET.Seconds = 0; - CFE_TIME_Global.AtToneMET.Subseconds = 0; - CFE_TIME_Global.AtToneSTCF.Seconds = 10; - CFE_TIME_Global.AtToneSTCF.Subseconds = 0; - CFE_TIME_Global.AtToneDelay.Seconds = 0; - CFE_TIME_Global.AtToneDelay.Subseconds = 0; - CFE_TIME_Global.AtToneLatch.Seconds = 0; - CFE_TIME_Global.AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxDelta.Seconds = 0; - CFE_TIME_Global.MaxDelta.Subseconds = 1; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; + settime.Seconds = 10; + settime.Subseconds = 0; + CFE_TIME_Global.ExternalCount = 0; + CFE_TIME_Global.AtToneMET.Seconds = 0; + CFE_TIME_Global.AtToneMET.Subseconds = 0; + CFE_TIME_Global.AtToneSTCF.Seconds = 10; + CFE_TIME_Global.AtToneSTCF.Subseconds = 0; + CFE_TIME_Global.AtToneDelay.Seconds = 0; + CFE_TIME_Global.AtToneDelay.Subseconds = 0; + CFE_TIME_Global.AtToneLatch.Seconds = 0; + CFE_TIME_Global.AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxDelta.Seconds = 0; + CFE_TIME_Global.MaxDelta.Subseconds = 1; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ExternalCount == 1, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalTime", "External Time - external source and time in range"); /* Test setting time data from Time (internal source) */ UT_InitData(); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; CFE_TIME_Global.InternalCount = 0; CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.InternalCount == 1, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalTime", "External Time (internal source)"); #else - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", "*Not tested* External Time - external source and clock state " - "not set"); + "not set"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", "Not tested* External Time - external source and time out of " - "range (low)"); + "range (low)"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", "*Not tested* External Time - external source and time out of " - "range (high)"); + "range (high)"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalTime", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", "*Not tested* External Time - external source and time in range"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ExternalTime", - "*Not tested* External Time (internal source)"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", "*Not tested* External Time (internal source)"); #endif /* Reset to normal value for subsequent tests */ @@ -1705,31 +1362,28 @@ void Test_PipeCmds(void) { union { - CFE_MSG_Message_t message; - CFE_MSG_CommandHeader_t cmd; - CFE_TIME_ToneDataCmd_t tonedatacmd; - 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_MSG_Message_t message; + CFE_MSG_CommandHeader_t cmd; + CFE_TIME_ToneDataCmd_t tonedatacmd; + 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 = - { - .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_HK_TLM_MID) - }; + UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_HK_TLM_MID)}; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) uint32 count; @@ -1742,47 +1396,35 @@ void Test_PipeCmds(void) /* Test sending the housekeeping telemetry request command */ UT_InitData(); 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__, - LocalSnapshotData.Count == 1, - "CFE_TIME_HousekeepingCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_SEND_HK); + UT_Report(__FILE__, __LINE__, LocalSnapshotData.Count == 1, "CFE_TIME_HousekeepingCmd", "Housekeeping telemetry request"); /* Test sending the time at the tone "signal" command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CFE_TIME_Global.ToneSignalCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_TONE_CMD); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneSignalCounter == 1, - "CFE_TIME_ToneSignalCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_TONE_CMD); + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneSignalCounter == 1, "CFE_TIME_ToneSignalCmd", "Time at tone signal"); /* Test sending the time at the tone "data" command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CFE_TIME_Global.ToneDataCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.tonedatacmd), - UT_TPID_CFE_TIME_DATA_CMD); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneDataCounter == 1, - "CFE_TIME_ToneDataCmd", - "Time at tone data"); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.tonedatacmd), UT_TPID_CFE_TIME_DATA_CMD); + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneDataCounter == 1, "CFE_TIME_ToneDataCmd", "Time at tone data"); /* Test sending the simulate time at the tone "signal" command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetBSP_Time(123, 0); - CFE_TIME_Global.ToneSignalLatch.Seconds = 0; + CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneSignalLatch.Seconds == 123 && - CFE_TIME_Global.ToneSignalLatch.Subseconds == 0, - "CFE_TIME_FakeToneCmd", - "Simulated time at tone signal"); + CFE_TIME_Global.ToneSignalLatch.Seconds == 123 && CFE_TIME_Global.ToneSignalLatch.Subseconds == 0, + "CFE_TIME_FakeToneCmd", "Simulated time at tone signal"); /* Test sending the request time at the tone "data" command */ UT_InitData(); @@ -1792,82 +1434,58 @@ void Test_PipeCmds(void) count = CFE_TIME_Global.InternalCount; #endif - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_SEND_CMD); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_SEND_CMD); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - !UT_EventIsInHistory(CFE_TIME_ID_ERR_EID) && - CFE_TIME_Global.InternalCount == count + 1, - "CFE_TIME_ToneSendCmd", - "Request time at tone data"); + !UT_EventIsInHistory(CFE_TIME_ID_ERR_EID) && CFE_TIME_Global.InternalCount == count + 1, + "CFE_TIME_ToneSendCmd", "Request time at tone data"); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_ID_ERR_EID), - "CFE_TIME_ToneSendCmd", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_ID_ERR_EID), "CFE_TIME_ToneSendCmd", "*Command not available* Request time at tone data"); #endif /* Test sending the no-op command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_NOOP_EID), - "CFE_TIME_NoopCmd", - "No-op"); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_NOOP_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_NOOP_EID), "CFE_TIME_NoopCmd", "No-op"); /* Test sending the reset counters command */ UT_InitData(); - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_RESET_EID), - "CFE_TIME_ResetCountersCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_RESET_EID), "CFE_TIME_ResetCountersCmd", "Reset counters"); /* Test sending the request diagnostics command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_CMD_SEND_DIAGNOSTIC_TLM_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DIAG_EID), - "CFE_TIME_DiagCmd", - "Request diagnostics"); + UT_TPID_CFE_TIME_CMD_SEND_DIAGNOSTIC_TLM_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_DIAG_EID), "CFE_TIME_DiagCmd", "Request diagnostics"); /* Test sending a clock state = invalid command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = CFE_TIME_ClockState_INVALID; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), - UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STATE_EID), - "CFE_TIME_SetStateCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_EID), "CFE_TIME_SetStateCmd", "Set clock state = invalid"); /* Test sending a clock state = valid command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = CFE_TIME_ClockState_VALID; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), - UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STATE_EID), - "CFE_TIME_SetStateCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_EID), "CFE_TIME_SetStateCmd", "Set clock state = valid"); /* Test sending a clock state = flywheel command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = CFE_TIME_ClockState_FLYWHEEL; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), - UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STATE_EID), - "CFE_TIME_SetStateCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_EID), "CFE_TIME_SetStateCmd", "Set clock state = flywheel"); /* Test response to sending a clock state command using an @@ -1876,29 +1494,21 @@ void Test_PipeCmds(void) UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = 99; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), - UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STATE_ERR_EID), - "CFE_TIME_SetStateCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_ERR_EID), "CFE_TIME_SetStateCmd", "Invalid clock state"); /* Test sending the set time source = internal command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.sourcecmd.Payload.TimeSource = CFE_TIME_SourceSelect_INTERNAL; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), - UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SOURCE_EID), - "CFE_TIME_SetSourceCmd", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_EID), "CFE_TIME_SetSourceCmd", "Set internal source"); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SOURCE_CFG_EID), - "CFE_TIME_SetSourceCmd", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_CFG_EID), "CFE_TIME_SetSourceCmd", "Set internal source invalid"); #endif @@ -1906,18 +1516,13 @@ void Test_PipeCmds(void) UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.sourcecmd.Payload.TimeSource = CFE_TIME_SourceSelect_EXTERNAL; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), - UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SOURCE_EID), - "CFE_TIME_SetSourceCmd", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_EID), "CFE_TIME_SetSourceCmd", "Set external source"); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SOURCE_CFG_EID), - "CFE_TIME_SetSourceCmd", + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_CFG_EID), "CFE_TIME_SetSourceCmd", "Set external source invalid"); #endif @@ -1927,59 +1532,46 @@ void Test_PipeCmds(void) UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.sourcecmd.Payload.TimeSource = -1; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), - UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SOURCE_ERR_EID), - "CFE_TIME_SetSourceCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_ERR_EID), "CFE_TIME_SetSourceCmd", "Invalid time source"); /* Test sending a set tone signal source = primary command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.signalcmd.Payload.ToneSource = CFE_TIME_ToneSignalSelect_PRIMARY; - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), - UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetSignalCmd", - "Set tone signal source = primary"); + UT_EventIsInHistory(CFE_TIME_SIGNAL_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetSignalCmd", "Set tone signal source = primary"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_CFG_EID) && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSignalCmd", - "Set tone source = primary invalid"); + UT_EventIsInHistory(CFE_TIME_SIGNAL_CFG_EID) && CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetSignalCmd", "Set tone source = primary invalid"); #endif /* Test sending a set tone signal source = redundant command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.signalcmd.Payload.ToneSource = CFE_TIME_ToneSignalSelect_REDUNDANT; - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), - UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetSignalCmd", - "Set tone signal source = redundant"); + UT_EventIsInHistory(CFE_TIME_SIGNAL_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetSignalCmd", "Set tone signal source = redundant"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_CFG_EID) && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSignalCmd", - "Set tone signal source = redundant invalid"); + UT_EventIsInHistory(CFE_TIME_SIGNAL_CFG_EID) && CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetSignalCmd", "Set tone signal source = redundant invalid"); #endif /* Test response to sending a set tone signal source command using an @@ -1989,352 +1581,269 @@ void Test_PipeCmds(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.signalcmd.Payload.ToneSource = -1; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), - UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_ERR_EID) && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSignalCmd", - "Invalid tone source"); + UT_EventIsInHistory(CFE_TIME_SIGNAL_ERR_EID) && CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetSignalCmd", "Invalid tone source"); /* Test sending a time tone add delay command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.adddelaycmd.Payload.MicroSeconds = 0; - CmdBuf.adddelaycmd.Payload.Seconds = 0; - CFE_TIME_Global.CommandCounter = 0; - CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.adddelaycmd), - UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC); + CmdBuf.adddelaycmd.Payload.Seconds = 0; + CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandErrorCounter = 0; + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.adddelaycmd), UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC); #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetDelayCmd", - "Set tone add delay"); + UT_EventIsInHistory(CFE_TIME_DELAY_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetDelayCmd", "Set tone add delay"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetDelayCmd", - "Set tone add delay invalid"); + UT_EventIsInHistory(CFE_TIME_DELAY_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetDelayCmd", "Set tone add delay invalid"); #endif /* Test sending a time tone subtract delay command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.subdelaycmd), - UT_TPID_CFE_TIME_CMD_SUB_DELAY_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.subdelaycmd), UT_TPID_CFE_TIME_CMD_SUB_DELAY_CC); #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetDelayCmd", - "Set tone subtract delay"); + UT_EventIsInHistory(CFE_TIME_DELAY_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetDelayCmd", "Set tone subtract delay"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetDelayCmd", - "Set subtract delay invalid"); + UT_EventIsInHistory(CFE_TIME_DELAY_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetDelayCmd", "Set subtract delay invalid"); #endif /* Test sending a set time command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.settimecmd), - UT_TPID_CFE_TIME_CMD_SET_TIME_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.settimecmd), UT_TPID_CFE_TIME_CMD_SET_TIME_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_TIME_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetTimeCmd", - "Set time"); + UT_EventIsInHistory(CFE_TIME_TIME_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetTimeCmd", "Set time"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_TIME_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetTimeCmd", - "Set time invalid"); + UT_EventIsInHistory(CFE_TIME_TIME_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetTimeCmd", "Set time invalid"); #endif /* Test sending a set MET command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setmetcmd), - UT_TPID_CFE_TIME_CMD_SET_MET_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setmetcmd), UT_TPID_CFE_TIME_CMD_SET_MET_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_MET_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetMETCmd", - "Set MET"); + UT_EventIsInHistory(CFE_TIME_MET_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetMETCmd", "Set MET"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_MET_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetMETCmd", - "Set MET invalid"); + UT_EventIsInHistory(CFE_TIME_MET_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetMETCmd", "Set MET invalid"); #endif /* Test sending a set STCF command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setstcfcmd), - UT_TPID_CFE_TIME_CMD_SET_STCF_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setstcfcmd), UT_TPID_CFE_TIME_CMD_SET_STCF_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STCF_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetSTCFCmd", - "Set STCF"); + UT_EventIsInHistory(CFE_TIME_STCF_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetSTCFCmd", "Set STCF"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STCF_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSTCFCmd", - "Set STCF invalid"); + UT_EventIsInHistory(CFE_TIME_STCF_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetSTCFCmd", "Set STCF invalid"); #endif /* Test sending an adjust STCF positive command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.addadjcmd), - UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.addadjcmd), UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_AdjustCmd", - "Set STCF adjust positive"); + UT_EventIsInHistory(CFE_TIME_DELTA_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_AdjustCmd", "Set STCF adjust positive"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_AdjustCmd", - "Set STCF adjust positive invalid"); + UT_EventIsInHistory(CFE_TIME_DELTA_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_AdjustCmd", "Set STCF adjust positive invalid"); #endif /* Test sending an adjust STCF negative command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.subadjcmd), - UT_TPID_CFE_TIME_CMD_SUB_ADJUST_CC); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.subadjcmd), UT_TPID_CFE_TIME_CMD_SUB_ADJUST_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_AdjustCmd", - "Set STCF adjust negative"); + UT_EventIsInHistory(CFE_TIME_DELTA_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_AdjustCmd", "Set STCF adjust negative"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_AdjustCmd", - "Set STCF adjust negative invalid"); + UT_EventIsInHistory(CFE_TIME_DELTA_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_AdjustCmd", "Set STCF adjust negative invalid"); #endif /* Test sending an adjust STCF 1 Hz positive command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.add1hzadjcmd), - UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC); + UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_1HzAdjCmd", - "Set STCF 1Hz adjust positive"); + UT_EventIsInHistory(CFE_TIME_1HZ_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust positive"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_1HzAdjCmd", - "Set STCF 1Hz adjust positive invalid"); + UT_EventIsInHistory(CFE_TIME_1HZ_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust positive invalid"); #endif /* Test sending an adjust STCF 1 Hz negative command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sub1hzadjcmd), - UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC); + UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_1HzAdjCmd", - "Set STCF 1Hz adjust negative"); + UT_EventIsInHistory(CFE_TIME_1HZ_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust negative"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_1HzAdjCmd", - "Set STCF 1Hz adjust negative invalid"); + UT_EventIsInHistory(CFE_TIME_1HZ_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust negative invalid"); #endif /* Test response to sending a tone delay command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.adddelaycmd.Payload.MicroSeconds = 1000001; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.adddelaycmd), - UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_ERR_EID), - "CFE_TIME_SetDelayCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.adddelaycmd), UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_DELAY_ERR_EID), "CFE_TIME_SetDelayCmd", "Invalid tone delay"); /* Test response to sending a set time command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.settimecmd.Payload.MicroSeconds = 1000001; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.settimecmd), - UT_TPID_CFE_TIME_CMD_SET_TIME_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_TIME_ERR_EID), - "CFE_TIME_SetTimeCmd", - "Invalid time"); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.settimecmd), UT_TPID_CFE_TIME_CMD_SET_TIME_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_TIME_ERR_EID), "CFE_TIME_SetTimeCmd", "Invalid time"); /* Test response to sending a set MET command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.setmetcmd.Payload.MicroSeconds = 1000001; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setmetcmd), - UT_TPID_CFE_TIME_CMD_SET_MET_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_MET_ERR_EID), - "CFE_TIME_SetMETCmd", - "Invalid MET"); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setmetcmd), UT_TPID_CFE_TIME_CMD_SET_MET_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_MET_ERR_EID), "CFE_TIME_SetMETCmd", "Invalid MET"); /* Test response to sending a set STCF command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.setstcfcmd.Payload.MicroSeconds = 1000001; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setstcfcmd), - UT_TPID_CFE_TIME_CMD_SET_STCF_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STCF_ERR_EID), - "CFE_TIME_SetSTCFCmd", - "Invalid STCF"); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setstcfcmd), UT_TPID_CFE_TIME_CMD_SET_STCF_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STCF_ERR_EID), "CFE_TIME_SetSTCFCmd", "Invalid STCF"); /* Test response to sending an adjust STCF command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.setstcfcmd.Payload.MicroSeconds = 1000001; - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.addadjcmd), - UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_ERR_EID), - "CFE_TIME_AdjustCmd", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.addadjcmd), UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_DELTA_ERR_EID), "CFE_TIME_AdjustCmd", "Invalid STCF adjust"); /* Test sending a set leap seconds commands */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - CFE_TIME_Global.CommandCounter = 0; + CFE_TIME_Global.CommandCounter = 0; CFE_TIME_Global.CommandErrorCounter = 0; CmdBuf.leapscmd.Payload.LeapSeconds = 0; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.leapscmd), - UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC); + UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_LEAPS_EID) && - CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetLeapSecondsCmd", - "Set leap seconds"); + UT_EventIsInHistory(CFE_TIME_LEAPS_EID) && CFE_TIME_Global.CommandCounter == 1 && + CFE_TIME_Global.CommandErrorCounter == 0, + "CFE_TIME_SetLeapSecondsCmd", "Set leap seconds"); #else UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_LEAPS_CFG_EID) && - CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetLeapSecondsCmd", - "Set leap seconds invalid"); + UT_EventIsInHistory(CFE_TIME_LEAPS_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && + CFE_TIME_Global.CommandErrorCounter == 1, + "CFE_TIME_SetLeapSecondsCmd", "Set leap seconds invalid"); #endif /* Test response to sending an invalid command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_CMD_INVALID_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_CC_ERR_EID), - "CFE_TIME_TaskPipe", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_INVALID_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_CC_ERR_EID), "CFE_TIME_TaskPipe", "Invalid command code"); /* Test response to sending a command using an invalid message ID */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_INVALID_MID); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_ID_ERR_EID), - "CFE_TIME_TaskPipe", - "Invalid message ID"); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_INVALID_MID); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_ID_ERR_EID), "CFE_TIME_TaskPipe", "Invalid message ID"); /* Test response to sending a command with a bad length */ UT_InitData(); - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, 0, - UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_LEN_ERR_EID), - "CFE_TIME_TaskPipe", - "Invalid message ID"); + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, 0, UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC); + UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_LEN_ERR_EID), "CFE_TIME_TaskPipe", "Invalid message ID"); /* Call the Task Pipe with the 1Hz command. */ /* In the 1Hz state machine it should call PSP GetTime as part, of latching the clock. This is tested only to see that the latch executed. */ UT_InitData(); - UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), - UT_TPID_CFE_TIME_1HZ_CMD); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_PSP_GetTime)) > 0, - "CFE_TIME_TaskPipe", + UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_1HZ_CMD); + UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_GetTime)) > 0, "CFE_TIME_TaskPipe", "Invoke 1Hz state machine via SB"); - } /* @@ -2348,92 +1857,66 @@ void Test_ResetArea(void) /* Test successfully updating the reset area */ UT_InitData(); - CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_EXISTING; - CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; + CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_EXISTING; + CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; UT_GetResetDataPtr()->TimeResetVars.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; CFE_TIME_UpdateResetVars(&Reference); - UT_Report(__FILE__, __LINE__, - UT_GetResetDataPtr()->TimeResetVars.ClockSignal == - CFE_TIME_Global.ClockSignal, - "CFE_TIME_UpdateResetVars", - "Successful update"); + UT_Report(__FILE__, __LINE__, UT_GetResetDataPtr()->TimeResetVars.ClockSignal == CFE_TIME_Global.ClockSignal, + "CFE_TIME_UpdateResetVars", "Successful update"); /* Tests existing and good Reset Area */ UT_InitData(); - UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, - CFE_TIME_ToneSignalSelect_PRIMARY); + UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.DataStoreStatus == - CFE_TIME_RESET_AREA_EXISTING, - "CFE_TIME_QueryResetVars", - "Initialize times using an existing reset area; time tone PRI"); + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_EXISTING, + "CFE_TIME_QueryResetVars", "Initialize times using an existing reset area; time tone PRI"); /* Tests existing and good Reset Area */ UT_InitData(); - UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, - CFE_TIME_ToneSignalSelect_REDUNDANT); + UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_REDUNDANT); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.DataStoreStatus == - CFE_TIME_RESET_AREA_EXISTING, - "CFE_TIME_QueryResetVars", - "Initialize times using an existing reset area; time tone RED"); + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_EXISTING, + "CFE_TIME_QueryResetVars", "Initialize times using an existing reset area; time tone RED"); /* Test response to a bad reset area */ UT_InitData(); - UT_SetStatusBSPResetArea(OS_ERROR, CFE_TIME_RESET_SIGNATURE, - CFE_TIME_ToneSignalSelect_PRIMARY); + UT_SetStatusBSPResetArea(OS_ERROR, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_BAD, - "CFE_TIME_QueryResetVars", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_BAD, "CFE_TIME_QueryResetVars", "Reset area error"); /* Test initializing to default time values */ UT_InitData(); - UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE + 1, - CFE_TIME_ToneSignalSelect_PRIMARY); + UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE + 1, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_NEW, - "CFE_TIME_QueryResetVars", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_NEW, "CFE_TIME_QueryResetVars", "Initialize to default values"); /* Test response to a bad clock signal selection parameter */ UT_InitData(); - UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, - CFE_TIME_ToneSignalSelect_REDUNDANT+1); + UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_REDUNDANT + 1); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_NEW, - "CFE_TIME_QueryResetVars", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_NEW, "CFE_TIME_QueryResetVars", "Bad clock signal selection"); /* Test response to a reset area error */ UT_InitData(); - CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_ERROR; - CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; + CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_ERROR; + CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; UT_GetResetDataPtr()->TimeResetVars.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; CFE_TIME_UpdateResetVars(&Reference); - UT_Report(__FILE__, __LINE__, - UT_GetResetDataPtr()->TimeResetVars.ClockSignal != - CFE_TIME_Global.ClockSignal, - "CFE_TIME_UpdateResetVars", - "Reset area error"); + UT_Report(__FILE__, __LINE__, UT_GetResetDataPtr()->TimeResetVars.ClockSignal != CFE_TIME_Global.ClockSignal, + "CFE_TIME_UpdateResetVars", "Reset area error"); /* Test failure to get reset area updating the reset area */ UT_InitData(); UT_SetStatusBSPResetArea(CFE_PSP_ERROR, 0, CFE_TIME_ToneSignalSelect_PRIMARY); - CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_EXISTING; - CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; + CFE_TIME_Global.DataStoreStatus = CFE_TIME_RESET_AREA_EXISTING; + CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; UT_GetResetDataPtr()->TimeResetVars.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; CFE_TIME_UpdateResetVars(&Reference); - UT_Report(__FILE__, __LINE__, - UT_GetResetDataPtr()->TimeResetVars.ClockSignal != - CFE_TIME_Global.ClockSignal, - "CFE_TIME_UpdateResetVars", - "Get reset area fail"); + UT_Report(__FILE__, __LINE__, UT_GetResetDataPtr()->TimeResetVars.ClockSignal != CFE_TIME_Global.ClockSignal, + "CFE_TIME_UpdateResetVars", "Get reset area fail"); } /* @@ -2441,9 +1924,9 @@ void Test_ResetArea(void) */ void Test_State(void) { - uint16 flag; - int16 ExpState; - CFE_TIME_Reference_t Reference; + uint16 flag; + int16 ExpState; + CFE_TIME_Reference_t Reference; volatile CFE_TIME_ReferenceState_t *RefState; UtPrintf("Begin Test Time State"); @@ -2452,47 +1935,39 @@ void Test_State(void) * in "no flywheel" */ UT_InitData(); - Reference.ClockSetState = CFE_TIME_SetState_WAS_SET; - Reference.ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + Reference.ClockSetState = CFE_TIME_SetState_WAS_SET; + Reference.ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; - ExpState = CFE_TIME_ClockState_VALID; - UT_Report(__FILE__, __LINE__, - CFE_TIME_CalculateState(&Reference) == ExpState, - "CFE_TIME_CalculateState", + ExpState = CFE_TIME_ClockState_VALID; + UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == ExpState, "CFE_TIME_CalculateState", "Valid time state; server state - no flywheel"); /* Test determining if the clock state is valid with the server state * in "flywheel" */ UT_InitData(); - Reference.ClockSetState = CFE_TIME_SetState_WAS_SET; - Reference.ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + Reference.ClockSetState = CFE_TIME_SetState_WAS_SET; + Reference.ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) ExpState = CFE_TIME_ClockState_FLYWHEEL; #else ExpState = CFE_TIME_ClockState_VALID; #endif - UT_Report(__FILE__, __LINE__, - CFE_TIME_CalculateState(&Reference) == ExpState, - "CFE_TIME_CalculateState", + UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == ExpState, "CFE_TIME_CalculateState", "Valid time state; server state - flywheel"); /* Test determining if the clock state = flywheel */ UT_InitData(); Reference.ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; - UT_Report(__FILE__, __LINE__, - CFE_TIME_CalculateState(&Reference) == CFE_TIME_ClockState_FLYWHEEL, - "CFE_TIME_CalculateState", - "Flywheel time state"); + UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == CFE_TIME_ClockState_FLYWHEEL, + "CFE_TIME_CalculateState", "Flywheel time state"); /* Test determining if the clock state = invalid */ UT_InitData(); Reference.ClockSetState = CFE_TIME_ClockState_INVALID; - UT_Report(__FILE__, __LINE__, - CFE_TIME_CalculateState(&Reference) == CFE_TIME_ClockState_INVALID, - "CFE_TIME_CalculateState", - "Invalid time state"); + UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == CFE_TIME_ClockState_INVALID, + "CFE_TIME_CalculateState", "Invalid time state"); /* Test alternate flag values */ UT_InitData(); @@ -2503,44 +1978,37 @@ void Test_State(void) flag = CFE_TIME_GetClockInfo(); /* Add server flag depending on configuration */ - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; - RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; + RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; RefState->DelayDirection = CFE_TIME_AdjustDirection_SUBTRACT; - /* * Atomicity Test Case: Check the flags _BEFORE_ calling FinishReferenceUpdate(). * The function should return the same flags as the previous call, even though * the global data has been updated with new values. */ - UT_Report(__FILE__, __LINE__, - CFE_TIME_GetClockInfo() == flag, - "CFE_TIME_GetStateFlags", + UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockInfo() == flag, "CFE_TIME_GetStateFlags", "State data atomic update before finish"); /* Now finish the update and the flags should be different */ CFE_TIME_FinishReferenceUpdate(RefState); - UT_Report(__FILE__, __LINE__, - CFE_TIME_GetClockInfo() != flag, - "CFE_TIME_GetStateFlags", + UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockInfo() != flag, "CFE_TIME_GetStateFlags", "State data atomic update after finish"); - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; - CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; - CFE_TIME_Global.Forced2Fly = false; + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; + CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; + CFE_TIME_Global.Forced2Fly = false; CFE_TIME_Global.OneTimeDirection = CFE_TIME_AdjustDirection_SUBTRACT; - CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_SUBTRACT; + CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_SUBTRACT; flag = CFE_TIME_GetClockInfo(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_GetClockInfo() == flag, - "CFE_TIME_GetStateFlags", + UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockInfo() == flag, "CFE_TIME_GetStateFlags", "State data with alternate flags"); - RefState = CFE_TIME_StartReferenceUpdate(); + RefState = CFE_TIME_StartReferenceUpdate(); RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; @@ -2551,21 +2019,21 @@ void Test_State(void) */ void Test_GetReference(void) { - CFE_TIME_Reference_t Reference; + CFE_TIME_Reference_t Reference; volatile CFE_TIME_ReferenceState_t *RefState; UtPrintf("Begin Test Get Reference"); /* Test with local clock rollover */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneMET.Seconds = 20; - RefState->AtToneMET.Subseconds = 0; - RefState->AtToneDelay.Seconds = 0; - RefState->AtToneDelay.Subseconds = 0; - RefState->AtToneLatch.Seconds = 10; - RefState->AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxLocalClock.Seconds = 1000; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneMET.Seconds = 20; + RefState->AtToneMET.Subseconds = 0; + RefState->AtToneDelay.Seconds = 0; + RefState->AtToneDelay.Subseconds = 0; + RefState->AtToneLatch.Seconds = 10; + RefState->AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxLocalClock.Seconds = 1000; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(0, 0); @@ -2573,33 +2041,27 @@ void Test_GetReference(void) /* CurrentMET = AtToneMET + MaxLocalClock - AtToneLatch + * BSP_Time [+ or - AtToneDelay] */ - UT_Report(__FILE__, __LINE__, - Reference.CurrentMET.Seconds == 1010 && - Reference.CurrentMET.Subseconds == 0, - "CFE_TIME_GetReference", - "Local clock < latch at tone time"); + UT_Report(__FILE__, __LINE__, Reference.CurrentMET.Seconds == 1010 && Reference.CurrentMET.Subseconds == 0, + "CFE_TIME_GetReference", "Local clock < latch at tone time"); /* Test without local clock rollover */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneMET.Seconds = 20; - RefState->AtToneMET.Subseconds = 0; - RefState->AtToneDelay.Seconds = 0; - RefState->AtToneDelay.Subseconds = 0; - RefState->AtToneLatch.Seconds = 10; - RefState->AtToneLatch.Subseconds = 0; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneMET.Seconds = 20; + RefState->AtToneMET.Subseconds = 0; + RefState->AtToneDelay.Seconds = 0; + RefState->AtToneDelay.Subseconds = 0; + RefState->AtToneLatch.Seconds = 10; + RefState->AtToneLatch.Subseconds = 0; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(15, 0); CFE_TIME_GetReference(&Reference); /* CurrentMET = AtToneMET + BSP_Time - AtToneLatch [+ or - AtToneDelay] */ - UT_Report(__FILE__, __LINE__, - Reference.CurrentMET.Seconds == 25 && - Reference.CurrentMET.Subseconds == 0, - "CFE_TIME_GetReference", - "Local clock > latch at tone time"); + UT_Report(__FILE__, __LINE__, Reference.CurrentMET.Seconds == 25 && Reference.CurrentMET.Subseconds == 0, + "CFE_TIME_GetReference", "Local clock > latch at tone time"); } /* @@ -2607,13 +2069,13 @@ void Test_GetReference(void) */ void Test_Tone(void) { - CFE_TIME_SysTime_t time1; - CFE_TIME_SysTime_t time2; + CFE_TIME_SysTime_t time1; + CFE_TIME_SysTime_t time2; volatile CFE_TIME_ReferenceState_t *RefState; - uint32 VersionSave; + uint32 VersionSave; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - int seconds = 7654321; + int seconds = 7654321; int virtualSeconds = 1234567; #endif @@ -2628,88 +2090,79 @@ void Test_Tone(void) #if (CFE_PLATFORM_TIME_CFG_SERVER == true) UT_SetBSP_Time(seconds, 0); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneMET.Seconds = 0; /* 20.00000 */ - RefState->AtToneMET.Subseconds = 0; - RefState->AtToneDelay.Seconds = 0; /* 0.00000 */ - RefState->AtToneDelay.Subseconds = 0; - RefState->AtToneLatch.Seconds = 0; /* 10.00000 */ - RefState->AtToneLatch.Subseconds = 0; - CFE_TIME_Global.VirtualMET = virtualSeconds; - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = 0; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneMET.Seconds = 0; /* 20.00000 */ + RefState->AtToneMET.Subseconds = 0; + RefState->AtToneDelay.Seconds = 0; /* 0.00000 */ + RefState->AtToneDelay.Subseconds = 0; + RefState->AtToneLatch.Seconds = 0; /* 10.00000 */ + RefState->AtToneLatch.Subseconds = 0; + CFE_TIME_Global.VirtualMET = virtualSeconds; + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds = 0; CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds = seconds; CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_ToneSend(); - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) seconds++; - #endif +#endif #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == CFE_MAKE_BIG32(seconds) && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == CFE_MAKE_BIG32(0), /* yes, I know, 0 is 0 in all endians */ - "CFE_TIME_ToneSend", - "Send tone, flywheel ON"); -#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == + CFE_MAKE_BIG32(0), /* yes, I know, 0 is 0 in all endians */ + "CFE_TIME_ToneSend", "Send tone, flywheel ON"); +#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == seconds && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == 0, - "CFE_TIME_ToneSend", - "Send tone, flywheel ON"); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == 0, + "CFE_TIME_ToneSend", "Send tone, flywheel ON"); #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ /* Test time at the tone when not in flywheel mode */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); + RefState = CFE_TIME_StartReferenceUpdate(); RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_ToneSend(); - #if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) +#if (CFE_MISSION_TIME_AT_TONE_WILL_BE == true) virtualSeconds++; - #endif +#endif #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == - CFE_MAKE_BIG32(virtualSeconds) && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == CFE_MAKE_BIG32(0), /* yes, I know, 0 is 0 in all endians */ - "CFE_TIME_ToneSend", - "Send tone, flywheel OFF"); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == CFE_MAKE_BIG32(virtualSeconds) && + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == + CFE_MAKE_BIG32(0), /* yes, I know, 0 is 0 in all endians */ + "CFE_TIME_ToneSend", "Send tone, flywheel OFF"); #else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == - virtualSeconds && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == 0, - "CFE_TIME_ToneSend", - "Send tone, flywheel OFF"); + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == virtualSeconds && + CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == 0, + "CFE_TIME_ToneSend", "Send tone, flywheel OFF"); #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ #else /* Added to prevent a missing test */ - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ToneSend", - "*Not tested* Send tone, flywheel ON"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneSend", "*Not tested* Send tone, flywheel ON"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ToneSend", + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneSend", "*Not tested* Send tone, flywheel OFF"); /* Added to prevent a missing test # */ #endif - time1.Seconds = 10; - time1.Subseconds = 0; - time2.Seconds = 10; - time2.Subseconds = 100; - RefState = CFE_TIME_StartReferenceUpdate(); + time1.Seconds = 10; + time1.Subseconds = 0; + time2.Seconds = 10; + time2.Subseconds = 100; + RefState = CFE_TIME_StartReferenceUpdate(); RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; CFE_TIME_FinishReferenceUpdate(RefState); @@ -2718,159 +2171,134 @@ void Test_Tone(void) * to known values */ UT_InitData(); - VersionSave = CFE_TIME_Global.LastVersionCounter; /* Verifies 'ForcedToFly' path */ + VersionSave = CFE_TIME_Global.LastVersionCounter; /* Verifies 'ForcedToFly' path */ CFE_TIME_Global.ToneMatchCounter = 0; - CFE_TIME_Global.Forced2Fly = false; /* Exercises '!ForcedToFly' path */ + CFE_TIME_Global.Forced2Fly = false; /* Exercises '!ForcedToFly' path */ CFE_TIME_ToneVerify(time1, time2); UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.LastVersionCounter > VersionSave && - CFE_TIME_Global.ToneMatchCounter == 1, - "CFE_TIME_ToneVerify", - "Time 1 < time 2, Forced2Fly false"); + CFE_TIME_Global.LastVersionCounter > VersionSave && CFE_TIME_Global.ToneMatchCounter == 1, + "CFE_TIME_ToneVerify", "Time 1 < time 2, Forced2Fly false"); /* Test tone validation when time 1 equals the previous time 1 value */ UT_InitData(); CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time1, time1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneMatchErrorCounter == 1, - "CFE_TIME_ToneVerify", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", "Time 1 same as previous time 1"); /* Test tone validation when time 2 equals the previous time 2 value */ UT_InitData(); CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time2, time1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneMatchErrorCounter == 1, - "CFE_TIME_ToneVerify", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", "Time 2 same as previous time 2"); /* Test tone validation with time 1 > time 2 value (clock rollover) */ UT_InitData(); - time1.Seconds = 20; - time2.Seconds = 0; - time1.Subseconds = 0; - time2.Subseconds = 100; - CFE_TIME_Global.MaxLocalClock.Seconds = 20; /* 1000.00000 */ + time1.Seconds = 20; + time2.Seconds = 0; + time1.Subseconds = 0; + time2.Subseconds = 100; + CFE_TIME_Global.MaxLocalClock.Seconds = 20; /* 1000.00000 */ CFE_TIME_Global.MaxLocalClock.Subseconds = 0; - CFE_TIME_Global.ToneMatchCounter = 0; + CFE_TIME_Global.ToneMatchCounter = 0; CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneMatchCounter == 1, - "CFE_TIME_ToneVerify", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchCounter == 1, "CFE_TIME_ToneVerify", "Time 1 > time 2 (clock rollover)"); /* Test tone validation when time between packet and tone is out of * limits (seconds) */ UT_InitData(); - time1.Seconds = 10; - time2.Seconds = 11; - time1.Subseconds = 0; - time2.Subseconds = 0; + time1.Seconds = 10; + time2.Seconds = 11; + time1.Subseconds = 0; + time2.Subseconds = 0; CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time2, time1); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneMatchErrorCounter == 1, - "CFE_TIME_ToneVerify", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", "Elapsed time out of limits (seconds)"); /* Test tone validation when time between packet and tone is out of * limits (subseconds low) */ UT_InitData(); - time1.Seconds = 12; - time2.Seconds = 12; - time1.Subseconds = 0; - time2.Subseconds = 10; - CFE_TIME_Global.MinElapsed = 20; - CFE_TIME_Global.MaxElapsed = 30; + time1.Seconds = 12; + time2.Seconds = 12; + time1.Subseconds = 0; + time2.Subseconds = 10; + CFE_TIME_Global.MinElapsed = 20; + CFE_TIME_Global.MaxElapsed = 30; CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneMatchErrorCounter == 1, - "CFE_TIME_ToneVerify", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", "Elapsed time out of limits (subseconds low)"); /* Test tone validation when time between packet and tone is out of * limits (subseconds high) */ UT_InitData(); - time1.Seconds = 13; - time2.Seconds = 13; - time1.Subseconds = 0; - time2.Subseconds = 40; - CFE_TIME_Global.MinElapsed = 20; - CFE_TIME_Global.MaxElapsed = 30; + time1.Seconds = 13; + time2.Seconds = 13; + time1.Subseconds = 0; + time2.Subseconds = 40; + CFE_TIME_Global.MinElapsed = 20; + CFE_TIME_Global.MaxElapsed = 30; CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneMatchErrorCounter == 1, - "CFE_TIME_ToneVerify", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", "Elapsed time out of limits (subseconds high)"); CFE_TIME_Global.MinElapsed = MinElapsed; CFE_TIME_Global.MaxElapsed = MaxElapsed; - time1.Seconds = 10; + time1.Seconds = 10; time1.Subseconds = 0; - time2.Seconds = 10; + time2.Seconds = 10; time2.Subseconds = 100; /* Test tone validation when time 1 < time 2 and Forced2Fly is set to * false and the clock source is external */ UT_InitData(); - VersionSave = CFE_TIME_Global.LastVersionCounter; /* Verifies 'ForcedToFly' path */ - CFE_TIME_Global.ToneMatchCounter = 0; - CFE_TIME_Global.Forced2Fly = false; /* Exercises '!ForcedToFly' path */ - CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; - CFE_TIME_Global.VirtualMET = 5; + VersionSave = CFE_TIME_Global.LastVersionCounter; /* Verifies 'ForcedToFly' path */ + CFE_TIME_Global.ToneMatchCounter = 0; + CFE_TIME_Global.Forced2Fly = false; /* Exercises '!ForcedToFly' path */ + CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; + CFE_TIME_Global.VirtualMET = 5; CFE_TIME_Global.PendingMET.Seconds = CFE_TIME_Global.VirtualMET; CFE_TIME_ToneVerify(time1, time2); UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.LastVersionCounter > VersionSave && - CFE_TIME_Global.ToneMatchCounter == 1 && - CFE_TIME_Global.VirtualMET == 5, - "CFE_TIME_ToneVerify", - "Time 1 < time 2, Forced2Fly false, Clock EXTERN"); + CFE_TIME_Global.LastVersionCounter > VersionSave && CFE_TIME_Global.ToneMatchCounter == 1 && + CFE_TIME_Global.VirtualMET == 5, + "CFE_TIME_ToneVerify", "Time 1 < time 2, Forced2Fly false, Clock EXTERN"); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) /* Test tone update using an invalid pending state */ UT_InitData(); - CFE_TIME_Global.PendingState = CFE_TIME_ClockState_INVALID; + CFE_TIME_Global.PendingState = CFE_TIME_ClockState_INVALID; CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; CFE_TIME_ToneUpdate(); UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ClockSetState == CFE_TIME_SetState_NOT_SET && - CFE_TIME_Global.ServerFlyState == CFE_TIME_FlywheelState_NO_FLY, - "CFE_TIME_ToneUpdate", - "Invalid pending state"); + CFE_TIME_Global.ServerFlyState == CFE_TIME_FlywheelState_NO_FLY, + "CFE_TIME_ToneUpdate", "Invalid pending state"); /* Test tone update using FLYWHEEL as the pending state */ UT_InitData(); - CFE_TIME_Global.PendingState = CFE_TIME_ClockState_FLYWHEEL; + CFE_TIME_Global.PendingState = CFE_TIME_ClockState_FLYWHEEL; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_ToneUpdate(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ServerFlyState == CFE_TIME_FlywheelState_IS_FLY, - "CFE_TIME_ToneUpdate", - "Pending state is FLYWHEEL"); + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ServerFlyState == CFE_TIME_FlywheelState_IS_FLY, + "CFE_TIME_ToneUpdate", "Pending state is FLYWHEEL"); #else - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ToneUpdate", - "*Not tested* Invalid pending state"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneUpdate", "*Not tested* Invalid pending state"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_ToneUpdate", - "*Not tested* Pending state is FLYWHEEL"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneUpdate", "*Not tested* Pending state is FLYWHEEL"); #endif } @@ -2880,103 +2308,86 @@ void Test_Tone(void) */ void Test_1Hz(void) { - uint16 Arg; - uint16 i; - uint32 delSec = 3; - CFE_TIME_SysTime_t time1; - CFE_TIME_SysTime_t time2; + uint16 Arg; + uint16 i; + uint32 delSec = 3; + CFE_TIME_SysTime_t time1; + CFE_TIME_SysTime_t time2; volatile CFE_TIME_ReferenceState_t *RefState; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) /* Test 1Hz STCF adjustment in positive direction */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneSTCF.Seconds = 20; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneSTCF.Seconds = 20; RefState->AtToneSTCF.Subseconds = 60; CFE_TIME_FinishReferenceUpdate(RefState); - time1.Seconds = 10; + time1.Seconds = 10; time1.Subseconds = 30; CFE_TIME_Set1HzAdj(time1, CFE_TIME_AdjustDirection_ADD); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, - RefState->AtToneSTCF.Seconds == 30 && - RefState->AtToneSTCF.Subseconds == 90, - "CFE_TIME_Set1HzAdj", - "Positive adjustment"); + UT_Report(__FILE__, __LINE__, RefState->AtToneSTCF.Seconds == 30 && RefState->AtToneSTCF.Subseconds == 90, + "CFE_TIME_Set1HzAdj", "Positive adjustment"); /* Test 1Hz STCF adjustment in negative direction */ UT_InitData(); CFE_TIME_Set1HzAdj(time1, CFE_TIME_AdjustDirection_SUBTRACT); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, - RefState->AtToneSTCF.Seconds == 20 && - RefState->AtToneSTCF.Subseconds == 60, - "CFE_TIME_Set1HzAdj", - "Negative adjustment"); + UT_Report(__FILE__, __LINE__, RefState->AtToneSTCF.Seconds == 20 && RefState->AtToneSTCF.Subseconds == 60, + "CFE_TIME_Set1HzAdj", "Negative adjustment"); #else /* These prevent missing tests when CFE_PLATFORM_TIME_CFG_SERVER is false */ - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_Local1HzISR", - "(*Not tested*) Positive adjustment"); - UT_Report(__FILE__, __LINE__, - true, - "CFE_TIME_Local1HzISR", - "(*Not tested*) Negative adjustment"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Local1HzISR", "(*Not tested*) Positive adjustment"); + UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Local1HzISR", "(*Not tested*) Negative adjustment"); #endif /* Test local 1Hz interrupt when enough time has elapsed (seconds) since * receiving a time update to automatically change the state to flywheel */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; - CFE_TIME_Global.AutoStartFly = false; - RefState->AtToneLatch.Seconds = 1; - RefState->AtToneLatch.Subseconds = 0; - CFE_TIME_Global.OneHzAdjust.Seconds = 1; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + CFE_TIME_Global.AutoStartFly = false; + RefState->AtToneLatch.Seconds = 1; + RefState->AtToneLatch.Subseconds = 0; + CFE_TIME_Global.OneHzAdjust.Seconds = 1; CFE_TIME_Global.OneHzAdjust.Subseconds = 0; CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(0, 0); - CFE_TIME_Global.MaxLocalClock.Seconds = CFE_PLATFORM_TIME_CFG_LATCH_FLY - 1; + CFE_TIME_Global.MaxLocalClock.Seconds = CFE_PLATFORM_TIME_CFG_LATCH_FLY - 1; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; CFE_TIME_Local1HzStateMachine(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.AutoStartFly == true, - "CFE_TIME_Local1HzISR", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.AutoStartFly == true, "CFE_TIME_Local1HzISR", "Auto start flywheel (seconds)"); /* Test local 1Hz interrupt when enough time has elapsed since receiving a * time update to automatically update the MET */ UT_InitData(); - time1.Seconds = 11; - time2.Seconds = 1; - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->AtToneDelay.Seconds = 0; - RefState->AtToneDelay.Subseconds = 0; - RefState->AtToneMET.Seconds = time1.Seconds; - RefState->AtToneMET.Subseconds = 0; - CFE_TIME_Global.OneHzAdjust.Seconds = 0; + time1.Seconds = 11; + time2.Seconds = 1; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->AtToneDelay.Seconds = 0; + RefState->AtToneDelay.Subseconds = 0; + RefState->AtToneMET.Seconds = time1.Seconds; + RefState->AtToneMET.Subseconds = 0; + CFE_TIME_Global.OneHzAdjust.Seconds = 0; CFE_TIME_Global.OneHzAdjust.Subseconds = 0; - RefState->AtToneLatch.Seconds = time2.Seconds; - RefState->AtToneLatch.Subseconds = 0; + RefState->AtToneLatch.Seconds = time2.Seconds; + RefState->AtToneLatch.Subseconds = 0; UT_SetBSP_Time(0, 0); - CFE_TIME_Global.MaxLocalClock.Seconds = CFE_PLATFORM_TIME_CFG_LATCH_FLY + delSec; + CFE_TIME_Global.MaxLocalClock.Seconds = CFE_PLATFORM_TIME_CFG_LATCH_FLY + delSec; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; - RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; + RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); UT_Report(__FILE__, __LINE__, - RefState->AtToneMET.Seconds == time1.Seconds + - CFE_PLATFORM_TIME_CFG_LATCH_FLY + - delSec - time2.Seconds && - RefState->AtToneLatch.Seconds == 0, - "CFE_TIME_Local1HzISR", - "Auto update MET"); + RefState->AtToneMET.Seconds == time1.Seconds + CFE_PLATFORM_TIME_CFG_LATCH_FLY + delSec - time2.Seconds && + RefState->AtToneLatch.Seconds == 0, + "CFE_TIME_Local1HzISR", "Auto update MET"); /* Test the tone signal ISR when the tone doesn't occur ~1 second after * the previous one @@ -2984,12 +2395,10 @@ void Test_1Hz(void) UT_InitData(); CFE_TIME_Global.IsToneGood = true; UT_SetBSP_Time(0, 0); - CFE_TIME_Global.ToneSignalLatch.Seconds = 1; + CFE_TIME_Global.ToneSignalLatch.Seconds = 1; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.IsToneGood == false, - "CFE_TIME_Tone1HzISR", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == false, "CFE_TIME_Tone1HzISR", "Invalid tone signal interrupt"); /* Test the tone signal ISR call to the application synch callback @@ -3012,22 +2421,18 @@ void Test_1Hz(void) } ut_time_CallbackCalled = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, - ut_time_CallbackCalled == 3, - "CFE_TIME_Tone1HzISR", + UT_Report(__FILE__, __LINE__, ut_time_CallbackCalled == 3, "CFE_TIME_Tone1HzISR", "Proper number of callbacks made"); /* Test the local 1Hz task where the binary semaphore take fails on the * second call */ UT_InitData(); - CFE_TIME_Global.AutoStartFly = true; + CFE_TIME_Global.AutoStartFly = true; CFE_TIME_Global.LocalTaskCounter = 0; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTake), 2, OS_ERROR); CFE_TIME_Local1HzTask(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.LocalTaskCounter == 1, - "CFE_TIME_Local1HzTask", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.LocalTaskCounter == 1, "CFE_TIME_Local1HzTask", "Semaphore creation pass, then fail"); /* Test the tone 1Hz task where the binary semaphore take fails on the @@ -3037,111 +2442,95 @@ void Test_1Hz(void) CFE_TIME_Global.ToneTaskCounter = 0; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTake), 2, OS_ERROR); CFE_TIME_Tone1HzTask(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneTaskCounter == 1, - "CFE_TIME_Tone1HzTask", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneTaskCounter == 1, "CFE_TIME_Tone1HzTask", "Semaphore creation pass, then fail"); /* Test the tone 1Hz task with the tone signal over the time limit */ UT_InitData(); UT_SetBSP_Time(1, CFE_TIME_Sub2MicroSecs(CFE_TIME_Global.ToneOverLimit)); - CFE_TIME_Global.IsToneGood = true; - CFE_TIME_Global.MaxLocalClock.Seconds = 0; - CFE_TIME_Global.MaxLocalClock.Subseconds = 0; - CFE_TIME_Global.ToneSignalLatch.Seconds = 0; + CFE_TIME_Global.IsToneGood = true; + CFE_TIME_Global.MaxLocalClock.Seconds = 0; + CFE_TIME_Global.MaxLocalClock.Subseconds = 0; + CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.IsToneGood == false, - "CFE_TIME_Tone1HzISR", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == false, "CFE_TIME_Tone1HzISR", "Invalid tone signal interrupt; tolerance over limit"); /* Test the tone 1Hz task with the tone signal within the time limits */ UT_InitData(); UT_SetBSP_Time(0, CFE_TIME_Sub2MicroSecs(CFE_TIME_Global.ToneUnderLimit) + 1); - CFE_TIME_Global.IsToneGood = false; - CFE_TIME_Global.ToneSignalLatch.Seconds = 0; + CFE_TIME_Global.IsToneGood = false; + CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.IsToneGood == true, - "CFE_TIME_Tone1HzISR", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == true, "CFE_TIME_Tone1HzISR", "Valid tone signal interrupt, tolerance in limits"); /* Test the tone 1Hz task with the tone signal under the time limit */ UT_InitData(); UT_SetBSP_Time(0, CFE_TIME_Sub2MicroSecs(CFE_TIME_Global.ToneUnderLimit) - 1); - CFE_TIME_Global.IsToneGood = true; - CFE_TIME_Global.ToneSignalLatch.Seconds = 0; + CFE_TIME_Global.IsToneGood = true; + CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.IsToneGood == false, - "CFE_TIME_Tone1HzISR", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == false, "CFE_TIME_Tone1HzISR", "Valid tone signal interrupt, tolerance under limits"); /* Test local 1Hz interrupt when enough time has elapsed (subseconds) since * receiving a time update to automatically change the state to flywheel */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; - CFE_TIME_Global.AutoStartFly = false; - RefState->AtToneLatch.Seconds = 1; - RefState->AtToneLatch.Subseconds = 0; - CFE_TIME_Global.OneHzAdjust.Seconds = 0; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + CFE_TIME_Global.AutoStartFly = false; + RefState->AtToneLatch.Seconds = 1; + RefState->AtToneLatch.Subseconds = 0; + CFE_TIME_Global.OneHzAdjust.Seconds = 0; CFE_TIME_Global.OneHzAdjust.Subseconds = 1; CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(0, 0); CFE_TIME_Local1HzStateMachine(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.AutoStartFly == true, - "CFE_TIME_Local1HzISR", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.AutoStartFly == true, "CFE_TIME_Local1HzISR", "Auto start flywheel (subseconds)"); /* Test local 1Hz interrupt when enough time has not elapsed since * receiving a time update to automatically change the state to flywheel */ UT_InitData(); - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; - CFE_TIME_Global.OneHzAdjust.Seconds = 0; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + CFE_TIME_Global.OneHzAdjust.Seconds = 0; CFE_TIME_Global.OneHzAdjust.Subseconds = 0; CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(1, 0); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, - RefState->ClockFlyState == CFE_TIME_FlywheelState_NO_FLY, - "CFE_TIME_Local1HzISR", + UT_Report(__FILE__, __LINE__, RefState->ClockFlyState == CFE_TIME_FlywheelState_NO_FLY, "CFE_TIME_Local1HzISR", "Do not auto start flywheel"); /* Test the local 1Hz task where auto start flywheel is disabled */ UT_InitData(); CFE_TIME_Global.LocalTaskCounter = 0; - CFE_TIME_Global.AutoStartFly = false; + CFE_TIME_Global.AutoStartFly = false; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTake), 2, OS_ERROR); CFE_TIME_Local1HzTask(); RefState = CFE_TIME_GetReferenceState(); UT_Report(__FILE__, __LINE__, - RefState->ClockFlyState == CFE_TIME_FlywheelState_NO_FLY && - !UT_EventIsInHistory(CFE_TIME_FLY_ON_EID), - "CFE_TIME_Local1HzTask", - "Do not auto start flywheel"); + RefState->ClockFlyState == CFE_TIME_FlywheelState_NO_FLY && !UT_EventIsInHistory(CFE_TIME_FLY_ON_EID), + "CFE_TIME_Local1HzTask", "Do not auto start flywheel"); /* Test the CFE_TIME_Local1HzTimerCallback function */ UT_InitData(); - CFE_TIME_Global.LocalIntCounter = 1; - RefState = CFE_TIME_StartReferenceUpdate(); - RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; - CFE_TIME_Global.OneHzAdjust.Seconds = 0; + CFE_TIME_Global.LocalIntCounter = 1; + RefState = CFE_TIME_StartReferenceUpdate(); + RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; + CFE_TIME_Global.OneHzAdjust.Seconds = 0; CFE_TIME_Global.OneHzAdjust.Subseconds = 0; CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(0, 0); CFE_TIME_Local1HzTimerCallback(OS_ObjectIdFromInteger(123), &Arg); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.LocalIntCounter == 2, - "CFE_TIME_Local1HzTimerCallback", + UT_Report(__FILE__, __LINE__, CFE_TIME_Global.LocalIntCounter == 2, "CFE_TIME_Local1HzTimerCallback", "Pass through to CFE_TIME_Local1HzISR"); } @@ -3150,9 +2539,9 @@ void Test_1Hz(void) */ void Test_UnregisterSynchCallback(void) { - uint32 i = 0; - int32 Result; - uint32 AppIndex; + uint32 i = 0; + int32 Result; + uint32 AppIndex; ut_time_CallbackCalled = 0; @@ -3163,7 +2552,6 @@ void Test_UnregisterSynchCallback(void) */ UT_InitData(); - /* Set up the sync callback table with callbacks for 3 apps */ for (i = 0; i < (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])); i++) { @@ -3182,9 +2570,7 @@ void Test_UnregisterSynchCallback(void) UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == CFE_TIME_CALLBACK_NOT_REGISTERED, - "CFE_TIME_UnregisterSynchCallback", + UT_Report(__FILE__, __LINE__, Result == CFE_TIME_CALLBACK_NOT_REGISTERED, "CFE_TIME_UnregisterSynchCallback", "Unregistered result with no callback"); /* @@ -3196,26 +2582,19 @@ void Test_UnregisterSynchCallback(void) UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == CFE_SUCCESS, - "CFE_TIME_UnregisterSynchCallback", + UT_Report(__FILE__, __LINE__, Result == CFE_SUCCESS, "CFE_TIME_UnregisterSynchCallback", "Successfully unregister callback"); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == CFE_TIME_CALLBACK_NOT_REGISTERED, - "CFE_TIME_UnregisterSynchCallback", + UT_Report(__FILE__, __LINE__, Result == CFE_TIME_CALLBACK_NOT_REGISTERED, "CFE_TIME_UnregisterSynchCallback", "Unregistered result after successful unregister"); /* Test unregistering the callback function with a bad application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1); Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, - Result == -1, - "CFE_TIME_UnregisterSynchCallback", - "Bad application ID"); + UT_Report(__FILE__, __LINE__, Result == -1, "CFE_TIME_UnregisterSynchCallback", "Bad application ID"); /* Test tone notification with an invalid time synch application */ UT_InitData(); @@ -3225,9 +2604,7 @@ void Test_UnregisterSynchCallback(void) CFE_TIME_Global.SynchCallback[i].Ptr = NULL; } CFE_TIME_NotifyTimeSynchApps(); - UT_Report(__FILE__, __LINE__, - ut_time_CallbackCalled == 0, - "CFE_TIME_NotifyTimeSynchApps", + UT_Report(__FILE__, __LINE__, ut_time_CallbackCalled == 0, "CFE_TIME_NotifyTimeSynchApps", "Invalid time synch application"); } @@ -3236,10 +2613,10 @@ void Test_UnregisterSynchCallback(void) */ void Test_CleanUpApp(void) { - uint16 i; - uint16 Count; - int32 Status = CFE_SUCCESS; - uint32 AppIndex; + uint16 i; + uint16 Count; + int32 Status = CFE_SUCCESS; + uint32 AppIndex; CFE_ES_AppId_t TestAppId; UtPrintf("Begin Test Cleanup App"); @@ -3268,10 +2645,7 @@ void Test_CleanUpApp(void) AppIndex = 4; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Status = CFE_TIME_CleanUpApp(TestAppId); - UT_Report(__FILE__, __LINE__, - Status == CFE_SUCCESS, - "CFE_TIME_CleanUpApp", - "Successful result"); + UT_Report(__FILE__, __LINE__, Status == CFE_SUCCESS, "CFE_TIME_CleanUpApp", "Successful result"); Count = 0; for (i = 0; i < (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])); i++) @@ -3283,19 +2657,13 @@ void Test_CleanUpApp(void) } /* should not have affected the callback table */ - UT_Report(__FILE__, __LINE__, - Count == 3, - "CFE_TIME_CleanUpApp", - "No Sync Callback entry cleared"); + UT_Report(__FILE__, __LINE__, Count == 3, "CFE_TIME_CleanUpApp", "No Sync Callback entry cleared"); /* Clean up an app which did have a callback */ AppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Status = CFE_TIME_CleanUpApp(TestAppId); - UT_Report(__FILE__, __LINE__, - Status == CFE_SUCCESS, - "CFE_TIME_CleanUpApp", - "Successful result"); + UT_Report(__FILE__, __LINE__, Status == CFE_SUCCESS, "CFE_TIME_CleanUpApp", "Successful result"); Count = 0; for (i = 0; i < (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])); i++) @@ -3306,20 +2674,13 @@ void Test_CleanUpApp(void) } } - UT_Report(__FILE__, __LINE__, - Count == 2, - "CFE_TIME_CleanUpApp", - "Sync Callback entry cleared"); - + UT_Report(__FILE__, __LINE__, Count == 2, "CFE_TIME_CleanUpApp", "Sync Callback entry cleared"); /* Test response to a bad application ID - * This is effectively a no-op but here for coverage */ AppIndex = 99999; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); Status = CFE_TIME_CleanUpApp(CFE_ES_APPID_UNDEFINED); - UT_Report(__FILE__, __LINE__, - Status == CFE_TIME_CALLBACK_NOT_REGISTERED, - "CFE_TIME_CleanUpApp", + UT_Report(__FILE__, __LINE__, Status == CFE_TIME_CALLBACK_NOT_REGISTERED, "CFE_TIME_CleanUpApp", "Bad application ID"); } - From 40b48f5dcc48da4219f34772c8e88276dc04f494 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Wed, 10 Mar 2021 21:58:00 -0500 Subject: [PATCH 2/7] Fix #1161, create format-check GitHub Actions workflow Adds a continuous integration check to ensure new commits adhere to standard format. Some minor format fix --- .github/workflows/format-check.yml | 51 ++++++++++++++++++++++++++++++ modules/core_api/fsw/inc/cfe_es.h | 6 ++-- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/format-check.yml diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml new file mode 100644 index 000000000..ec48a19f0 --- /dev/null +++ b/.github/workflows/format-check.yml @@ -0,0 +1,51 @@ +name: Format Check + +# Run on main push and pull requests +on: + push: + pull_request: + +jobs: + + static-analysis: + name: Run format check + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + + - name: Install format checker + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' + sudo apt-get update && sudo apt-get install clang-format-10 + + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + + - name: Checkout + uses: actions/checkout@v2 + with: + path: repo + + - name: Generate format differences + run: | + cd repo + find . -name "*.[ch]" -exec clang-format-10 -i -style=file {} + + git diff > $GITHUB_WORKSPACE/style_differences.txt + + - name: Archive Static Analysis Artifacts + uses: actions/upload-artifact@v2 + with: + name: style_differences + path: style_differences.txt + + - name: Error on differences + run: | + if [[ -s style_differences.txt ]]; + then + cat style_differences.txt + exit -1 + fi diff --git a/modules/core_api/fsw/inc/cfe_es.h b/modules/core_api/fsw/inc/cfe_es.h index d69d4ef02..0a9ed536e 100644 --- a/modules/core_api/fsw/inc/cfe_es.h +++ b/modules/core_api/fsw/inc/cfe_es.h @@ -336,9 +336,9 @@ CFE_Status_t CFE_ES_DeleteApp(CFE_ES_AppId_t AppID); ** None ** ** \param[in] ExitStatus Acceptable values are: \arg #CFE_ES_RunStatus_APP_EXIT - \copybrief CFE_ES_RunStatus_APP_EXIT - \arg #CFE_ES_RunStatus_APP_ERROR - \copybrief CFE_ES_RunStatus_APP_ERROR - \arg #CFE_ES_RunStatus_CORE_APP_INIT_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_INIT_ERROR - \arg #CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR +** \arg #CFE_ES_RunStatus_APP_ERROR - \copybrief CFE_ES_RunStatus_APP_ERROR +** \arg #CFE_ES_RunStatus_CORE_APP_INIT_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_INIT_ERROR +** \arg #CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR - \copybrief CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR ** ** ** \sa #CFE_ES_RunLoop, #CFE_ES_RegisterApp From d554b5eae705b7c1d7b702ccc3340e8c38963359 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 15 Mar 2021 18:15:42 -0400 Subject: [PATCH 3/7] Fix #1130, Clean trailing whitespace: Cmake Removes trailing whitespace in: - CMakeLists.txt - *.cmake --- CMakeLists.txt | 44 ++--- cmake/arch_build.cmake | 142 ++++++++-------- cmake/global_functions.cmake | 50 +++--- cmake/mission_build.cmake | 154 +++++++++--------- cmake/mission_defaults.cmake | 28 ++-- cmake/sample_defs/arch_build_custom.cmake | 14 +- cmake/sample_defs/global_build_options.cmake | 2 +- cmake/sample_defs/mission_build_custom.cmake | 6 +- cmake/sample_defs/targets.cmake | 8 +- .../toolchain-i686-rtems4.11.cmake | 4 +- cmake/sample_defs/toolchain-i686-rtems5.cmake | 4 +- ...olchain-powerpc-440_softfp-linux-gnu.cmake | 8 +- .../toolchain-ppc-vxworks6.9.cmake | 2 +- cmake/target/CMakeLists.txt | 50 +++--- modules/core_api/CMakeLists.txt | 6 +- modules/core_api/arch_build.cmake | 6 +- modules/core_api/mission_build.cmake | 8 +- modules/core_api/ut-stubs/CMakeLists.txt | 2 +- modules/core_private/CMakeLists.txt | 4 +- modules/core_private/arch_build.cmake | 6 +- modules/core_private/ut-stubs/CMakeLists.txt | 2 +- modules/es/CMakeLists.txt | 2 +- modules/fs/CMakeLists.txt | 2 +- modules/msg/mission_build.cmake | 6 +- modules/msg/ut-coverage/CMakeLists.txt | 2 +- modules/resourceid/CMakeLists.txt | 2 +- modules/resourceid/mission_build.cmake | 8 +- modules/resourceid/ut-coverage/CMakeLists.txt | 4 +- modules/sbr/ut-coverage/CMakeLists.txt | 2 +- modules/tbl/CMakeLists.txt | 2 +- 30 files changed, 290 insertions(+), 290 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e1348424..1765e5dec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,35 +4,35 @@ # This will build cFS for all target machine(s) defined by the mission # # Note that the target CPUs may use different architectures, therefore each -# architecture must be done as a separate sub-build since none of the binaries +# architecture must be done as a separate sub-build since none of the binaries # can be shared. # # This is actually two build scripts in one: # - A "top-level" script which divides the overall build by architecture # (This is run when TARGETSYSTEM is unset) -# - An architecture-specific build that generates the binaries +# - An architecture-specific build that generates the binaries # (This is run when TARGETSYSTEM is set) # # This file implements the common operation sequence between the mission build -# and the architecture-specific sub build. It relies on several functions +# and the architecture-specific sub build. It relies on several functions # that are implemented in a separate include files: -# -# initialize_globals: -# This function sets up the basic global variables such as MISSION_SOURCE_DIR, -# MISSIONCONFIG, ENABLE_UNIT_TESTS, SIMULATION and others. These are the -# basic variables that must exist _before_ the mission configuration is read. -# -# read_targetconfig: +# +# initialize_globals: +# This function sets up the basic global variables such as MISSION_SOURCE_DIR, +# MISSIONCONFIG, ENABLE_UNIT_TESTS, SIMULATION and others. These are the +# basic variables that must exist _before_ the mission configuration is read. +# +# read_targetconfig: # Parse the information from targets.cmake and create the build lists. Note -# this function is common to both mission and arch-specific builds. -# +# this function is common to both mission and arch-specific builds. +# # prepare: # Use the information in the target config to set up additional variables # and satisfy any preequisites for targets. Most importantly this stage # is reposible for finding the actual location of all source files for apps # listed in the mission configuration, along with collecting any supplemental -# sources, such as EDS files or additional compiler flags. -# +# sources, such as EDS files or additional compiler flags. +# # process_arch: # This is called multiple times, once for each CPU architecture specfied in # the main targets.cmake file. At the mission level, this creates a sub @@ -40,7 +40,7 @@ # specific level (inside the sub-project) it generates the actual library and # executable targets. # -# +# ########################################################################## # Squelch a warning when building on Win32/Cygwin @@ -53,7 +53,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE # The minimum CMake version is chosen because v3.5.1 is what is # available by default with Ubuntu 16.04 LTS at the time of development -# RHEL/CentOS users should install the "cmake3" package from EPEL repo +# RHEL/CentOS users should install the "cmake3" package from EPEL repo cmake_minimum_required(VERSION 3.5) # This top-level file does not define ANY targets directly but we know @@ -69,20 +69,20 @@ enable_testing() # Include the global routines include("cmake/global_functions.cmake") -# Load a sub-script that defines the other functions, +# Load a sub-script that defines the other functions, # depending on whether TARGETSYSTEM is defined or not if (TARGETSYSTEM) # Arch-specific/CPU build mode -- use the "arch_build" implementation - set(IS_CFS_ARCH_BUILD TRUE) + set(IS_CFS_ARCH_BUILD TRUE) include("cmake/arch_build.cmake") else (TARGETSYSTEM) # Host System/Top Level build mode -- use the "mission_build" implementation - set(IS_CFS_MISSION_BUILD TRUE) + set(IS_CFS_MISSION_BUILD TRUE) include("cmake/mission_build.cmake") endif (TARGETSYSTEM) # Call the initialization function defined by the sub-script -# This is implemented differently depending on whether this is a +# This is implemented differently depending on whether this is a # top-level or arch-specific build initialize_globals() @@ -92,7 +92,7 @@ initialize_globals() # file may override as necessary. include("cmake/mission_defaults.cmake") include(${MISSION_DEFS}/targets.cmake) - + # Scan the list of targets and organize by target system type. read_targetconfig() @@ -115,7 +115,7 @@ elseif (IS_CFS_MISSION_BUILD) endif (IS_CFS_ARCH_BUILD) # Call the prepare function defined by the sub-script -# This is implemented differently depending on whether this is a +# This is implemented differently depending on whether this is a # top-level or arch-specific build prepare() diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index 1defe0cdd..cd2575b52 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -6,7 +6,7 @@ # to build cFE/cFS for each target processor # # Note that the target CPUs may use different architectures, therefore each -# architecture must be done as a separate sub-build since none of the binaries +# architecture must be done as a separate sub-build since none of the binaries # can be shared. # ################################################################## @@ -14,9 +14,9 @@ # define a custom property to track dependencies on CFE module targets. # users should not typically maniplate this directly define_property(TARGET PROPERTY CFE_MODULE_DEPENDENCIES - BRIEF_DOCS + BRIEF_DOCS "A set of CFE module dependencies" - FULL_DOCS + FULL_DOCS "This is a CFE-specific target property that is added to CFE modules that contains the module dependencies" ) @@ -26,11 +26,11 @@ define_property(TARGET PROPERTY CFE_MODULE_DEPENDENCIES # FUNCTION: initialize_globals # # Set up global mission configuration variables. -# This function determines the mission configuration directory and +# This function determines the mission configuration directory and # also reads any startup state info from file(s) on the disk -# +# # In the CPU (cross) build this only reads a cache file that was -# generated by the mission (top-level) build. Therefore all +# generated by the mission (top-level) build. Therefore all # architecture-specific cross builds will get the same settings. # function(initialize_globals) @@ -57,7 +57,7 @@ function(initialize_globals) unset(VARNAME) unset(PARENTVARS) set(MISSION_IMPORTED_VARS ${MISSION_IMPORTED_VARS} PARENT_SCOPE) - + endfunction(initialize_globals) @@ -73,8 +73,8 @@ function(add_psp_module MOD_NAME MOD_SRC_FILES) # Create the module add_library(${MOD_NAME} STATIC ${MOD_SRC_FILES} ${ARGN}) target_link_libraries(${MOD_NAME} PRIVATE psp_module_api) - - target_compile_definitions(${MOD_NAME} PRIVATE + + target_compile_definitions(${MOD_NAME} PRIVATE _CFE_PSP_MODULE_ ) @@ -96,16 +96,16 @@ function(add_cfe_app APP_NAME APP_SRC_FILES) else() set(APPTYPE "STATIC") endif() - + # Create the app module add_library(${APP_NAME} ${APPTYPE} ${APP_SRC_FILES} ${ARGN}) target_link_libraries(${APP_NAME} core_api) - + # An "install" step is only needed for dynamic/runtime loaded apps if (APP_DYNAMIC_TARGET_LIST) cfs_app_do_install(${APP_NAME} ${APP_DYNAMIC_TARGET_LIST}) endif (APP_DYNAMIC_TARGET_LIST) - + endfunction(add_cfe_app) ################################################################## @@ -156,15 +156,15 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES) # then use "elf2cfetbl" to convert to a .tbl file set(TBL_LIST) foreach(TBL ${TBL_SRC_FILES} ${ARGN}) - + # Get name without extension (NAME_WE) and append to list of tables get_filename_component(TBLWE ${TBL} NAME_WE) - + foreach(TGT ${APP_STATIC_TARGET_LIST} ${APP_DYNAMIC_TARGET_LIST}) set(TABLE_DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/tables_${TGT}") file(MAKE_DIRECTORY ${TABLE_DESTDIR}) list(APPEND TBL_LIST "${TABLE_DESTDIR}/${TBLWE}.tbl") - + # Check if an override exists at the mission level (recommended practice) # This allows a mission to implement a customized table without modifying # the original - this also makes for easier merging/updating if needed. @@ -185,10 +185,10 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES) endif() if (NOT EXISTS "${TBL_SRC}") - message(FATAL_ERROR "ERROR: No source file for table ${TBLWE}") + message(FATAL_ERROR "ERROR: No source file for table ${TBLWE}") else() message("NOTE: Selected ${TBL_SRC} as source for ${TBLWE}") - endif() + endif() # NOTE: On newer CMake versions this should become an OBJECT library which makes this simpler. # On older versions one may not referece the TARGET_OBJECTS property from the custom command. @@ -217,12 +217,12 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES) install(FILES ${TABLE_DESTDIR}/${TBLWE}.tbl DESTINATION ${TGT}/${INSTALL_SUBDIR}) endforeach(TGT ${APP_STATIC_TARGET_LIST} ${APP_DYNAMIC_TARGET_LIST}) - + endforeach(TBL ${TBL_SRC_FILES} ${ARGN}) - # Make a custom target that depends on all the tables + # Make a custom target that depends on all the tables add_custom_target(${APP_NAME}_tables ALL DEPENDS ${TBL_LIST}) - + endfunction(add_cfe_tables) ################################################################## @@ -239,7 +239,7 @@ endfunction(add_cfe_tables) function(add_cfe_coverage_dependency MODULE_NAME UNIT_NAME DEPENDENCY_MODULE) # the stub library correlating to the module should be named: - # coverage-${MODULE_NAME}-stubs + # coverage-${MODULE_NAME}-stubs # (assuming it was added by the add_cfe_coverage_stubs above) set(DEP_LIST) foreach(DEP ${DEPENDENCY_MODULE} ${ARGN}) @@ -257,7 +257,7 @@ endfunction(add_cfe_coverage_dependency) # # FUNCTION: add_cfe_coverage_test # -# Add executable target for coverage testing. This builds the target +# Add executable target for coverage testing. This builds the target # units with extra compiler flags for coverage instrumentation, along with # a "testrunner" executable to run the tests. It also registers # that testrunner with ctest via the add_test() function. @@ -283,11 +283,11 @@ function(add_cfe_coverage_test MODULE_NAME UNIT_NAME TESTCASE_SRC UT_SRCS) # This is done so that special coverage-specific compile flags can be used on these files add_library(${OBJECT_TARGET} OBJECT ${UT_SRCS} - ) - + ) + # Apply the UT_COVERAGE_COMPILE_FLAGS to the units under test # This should enable coverage analysis on platforms that support this - target_compile_options(${OBJECT_TARGET} PRIVATE + target_compile_options(${OBJECT_TARGET} PRIVATE ${UT_COVERAGE_COMPILE_FLAGS} ) @@ -305,7 +305,7 @@ function(add_cfe_coverage_test MODULE_NAME UNIT_NAME TESTCASE_SRC UT_SRCS) ${TESTCASE_SRC} $ ) - + # Include the same set of include dirs/definitions that is used from the app target target_include_directories(${RUNNER_TARGET} PUBLIC $ @@ -316,13 +316,13 @@ function(add_cfe_coverage_test MODULE_NAME UNIT_NAME TESTCASE_SRC UT_SRCS) # This also needs to be linked with UT_COVERAGE_LINK_FLAGS (for coverage) # This is also linked with any other stub libraries needed, - # as well as the UT assert framework + # as well as the UT assert framework target_link_libraries(${RUNNER_TARGET} ${UT_COVERAGE_LINK_FLAGS} ut_core_api_stubs ut_assert ) - + # for whatever app/lib dependencies the real FSW app had, the unit test # should have the same dependencies but on the stubs instead. get_target_property(MODULE_DEPENDENCIES ${MODULE_NAME} CFE_MODULE_DEPENDENCIES) @@ -343,7 +343,7 @@ endfunction(add_cfe_coverage_test) # # FUNCTION: add_cfe_coverage_unit_include # -# Add an "override" include directory for a specific unit test +# Add an "override" include directory for a specific unit test # # This can be used if a coverage test needs to override certain # C library header files only for a specific unit under test. The @@ -355,7 +355,7 @@ endfunction(add_cfe_coverage_test) # function(add_cfe_coverage_unit_include MODULE_NAME UNIT_NAME OVERRIDE_INCLUDE_DIRS) # For the object target only, the "override" includes should be injected - # into the include path. Note it is important that this is only included + # into the include path. Note it is important that this is only included # for the specific unit under test (object lib) not the coverage # test executable or test cases, since these typically need the real # version of these functions. @@ -377,7 +377,7 @@ endfunction(add_cfe_coverage_unit_include) # NOTE: The first argument (MODULE_NAME) should match a name that was previously # passed to the add_cfe_app() function - as this references that previous # target to use the same compile definitions and include paths. -# (however this does also allow extra stub libs to be created that are not +# (however this does also allow extra stub libs to be created that are not # related to an existing module) # # The stub library target name follows the pattern: @@ -386,8 +386,8 @@ endfunction(add_cfe_coverage_unit_include) # The calling script may call target_link_libraries() (or other target functions) # to customize this target as needed. # -# NOTE: To simplify linking and avoid possible problems there should ideally be a 1:1 -# relationship between module source files and the stub files. Each stub file +# NOTE: To simplify linking and avoid possible problems there should ideally be a 1:1 +# relationship between module source files and the stub files. Each stub file # should provide the same set of functions that the fsw source file provides. # (although its is not strictly required, it does help keep things more manageable). # @@ -395,11 +395,11 @@ function(add_cfe_coverage_stubs MODULE_NAME STUB_SRCS) set(STUB_TARGET "coverage-${MODULE_NAME}-stubs") - add_library(${STUB_TARGET} STATIC + add_library(${STUB_TARGET} STATIC ${STUB_SRCS} ${ARGN} ) - # If the MODULE_NAME refers to an existing CFE APP/LIB target, then + # If the MODULE_NAME refers to an existing CFE APP/LIB target, then # use the same set of include dirs/definitions that is used from the app target # This is not required; "extra" stub libs may be created that are not # directly associated with an existing module. @@ -429,7 +429,7 @@ function(cfe_exec_do_install CPU_NAME) # By default just stage it to a directory of the same name install(TARGETS core-${CPU_NAME} DESTINATION ${CPU_NAME}) - + endfunction(cfe_exec_do_install) ################################################################## @@ -443,9 +443,9 @@ endfunction(cfe_exec_do_install) function(cfs_app_do_install APP_NAME) # override the default behavior of attaching a "lib" prefix - set_target_properties(${APP_NAME} PROPERTIES + set_target_properties(${APP_NAME} PROPERTIES PREFIX "" OUTPUT_NAME "${APP_NAME}") - + # Create the install targets for this shared/modular app foreach(TGT ${ARGN}) install(TARGETS ${APP_NAME} DESTINATION ${TGT}/${INSTALL_SUBDIR}) @@ -461,7 +461,7 @@ endfunction(cfs_app_do_install) # in the public interface for this module. A synthetic .c source file # is created which has a "#include" of each individual header, which # then compiled as part of the validation. The intent is to confirm -# that each header is valid in a standalone fashion and have no +# that each header is valid in a standalone fashion and have no # implicit prerequisites. # function(cfs_app_check_intf MODULE_NAME) @@ -509,12 +509,12 @@ function(prepare) if (SIMULATION) add_definitions(-DSIMULATION=${SIMULATION}) endif (SIMULATION) - + # Check that PSPNAME is set properly for this arch if (NOT CFE_SYSTEM_PSPNAME) if (CMAKE_CROSSCOMPILING) message(FATAL_ERROR "Cross-compile toolchain ${CMAKE_TOOLCHAIN_FILE} must define CFE_SYSTEM_PSPNAME") - elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR + elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") # Export the variables determined here up to the parent scope SET(CFE_SYSTEM_PSPNAME "pc-linux" PARENT_SCOPE) @@ -523,7 +523,7 @@ function(prepare) message(FATAL_ERROR "Do not know how to set CFE_SYSTEM_PSPNAME on ${CMAKE_SYSTEM_NAME} system") endif() endif (NOT CFE_SYSTEM_PSPNAME) - + # Truncate the global TGTSYS_LIST to be only the target architecture set(TGTSYS_LIST ${TARGETSYSTEM} PARENT_SCOPE) @@ -531,15 +531,15 @@ function(prepare) set(BUILD_CONFIG ${BUILD_CONFIG_${TARGETSYSTEM}}) list(REMOVE_AT BUILD_CONFIG 0) set(BUILD_CONFIG ${BUILD_CONFIG} PARENT_SCOPE) - + # Pull in any application-specific platform-scope configuration # This may include user configuration files such as cfe_platform_cfg.h, - # or any other configuration/preparation that needs to happen at + # or any other configuration/preparation that needs to happen at # platform/arch scope. foreach(DEP_NAME ${MISSION_DEPS}) include("${${DEP_NAME}_MISSION_DIR}/arch_build.cmake" OPTIONAL) endforeach(DEP_NAME ${MISSION_DEPS}) - + endfunction(prepare) @@ -552,22 +552,22 @@ endfunction(prepare) # function(process_arch SYSVAR) - # Check if something actually uses this arch; + # Check if something actually uses this arch; # if this list is empty then do nothing, skip building osal/psp if (NOT DEFINED TGTSYS_${SYSVAR}) return() endif() - + # Generate a list of targets that share this system architecture set(INSTALL_TARGET_LIST ${TGTSYS_${SYSVAR}}) - + # Assume use of an OSAL BSP of the same name as the CFE PSP # This can be overridden by the PSP-specific build_options but normally this is expected. set(CFE_PSP_EXPECTED_OSAL_BSPTYPE ${CFE_SYSTEM_PSPNAME}) - + # Include any specific compiler flags or config from the selected PSP include(${MISSION_SOURCE_DIR}/psp/fsw/${CFE_SYSTEM_PSPNAME}/make/build_options.cmake) - + if (NOT DEFINED OSAL_SYSTEM_BSPTYPE) # Implicitly use the OSAL BSP that corresponds with the CFE PSP set(OSAL_SYSTEM_BSPTYPE ${CFE_PSP_EXPECTED_OSAL_BSPTYPE}) @@ -576,18 +576,18 @@ function(process_arch SYSVAR) # Not calling this a fatal error because it could possibly be intended during development message(WARNING "Mismatched PSP/BSP: ${CFE_SYSTEM_PSPNAME} implies ${CFE_PSP_EXPECTED_OSAL_BSPTYPE}, but ${OSAL_SYSTEM_BSPTYPE} is configured") endif() - + # The "inc" directory in the binary dir contains the generated wrappers, if any include_directories(${MISSION_BINARY_DIR}/inc) include_directories(${CMAKE_BINARY_DIR}/inc) - # Add a custom target for "headercheck" - this is a special target confirms that + # Add a custom target for "headercheck" - this is a special target confirms that # checks the sanity of headers within the public interface of modules add_custom_target(check-headers) # Configure OSAL target first, as it also determines important compiler flags add_subdirectory("${osal_MISSION_DIR}" osal) - + # The OSAL displays its selected OS, so it is logical to display the selected PSP # This can help with debugging if things go wrong. message(STATUS "PSP Selection: ${CFE_SYSTEM_PSPNAME}") @@ -597,19 +597,19 @@ function(process_arch SYSVAR) # Also extract the "-D" options within CFLAGS and inform Doxygen about these string(REGEX MATCHALL "-D[A-Za-z0-9_=]+" DOXYGEN_DEFINED_MACROS "${CMAKE_C_FLAGS}") string(REGEX REPLACE "-D" " " DOXYGEN_DEFINED_MACROS "${DOXYGEN_DEFINED_MACROS}") - file(APPEND "${MISSION_BINARY_DIR}/doc/mission-content.doxyfile" + file(APPEND "${MISSION_BINARY_DIR}/doc/mission-content.doxyfile" "PREDEFINED += ${DOXYGEN_DEFINED_MACROS}\n" "INPUT += ${MISSION_SOURCE_DIR}/osal/src/os/${OSAL_SYSTEM_OSTYPE}\n" "INPUT += ${MISSION_SOURCE_DIR}/psp/fsw/${CFE_SYSTEM_PSPNAME}\n" "INPUT += ${CMAKE_BINARY_DIR}/inc") # Append to usersguide.doxyfile - file(APPEND "${MISSION_BINARY_DIR}/doc/cfe-usersguide.doxyfile" + file(APPEND "${MISSION_BINARY_DIR}/doc/cfe-usersguide.doxyfile" "INPUT += ${MISSION_SOURCE_DIR}/psp/fsw/${CFE_SYSTEM_PSPNAME}/src\n" "INPUT += ${CMAKE_BINARY_DIR}/inc") - + # The PSP and/or OSAL should have defined where to install the binaries. - # If not, just install them in /cf as a default (this can be modified + # If not, just install them in /cf as a default (this can be modified # by the packaging script if it is wrong for the target) if (NOT INSTALL_SUBDIR) set(INSTALL_SUBDIR cf) @@ -638,19 +638,19 @@ function(process_arch SYSVAR) add_subdirectory("${${DEP}_MISSION_DIR}" ${DEP}) endif(NOT DEP STREQUAL "osal") endforeach(DEP ${MISSION_CORE_MODULES}) - - # For the PSP it may define the FSW as either + + # For the PSP it may define the FSW as either # "psp-${CFE_SYSTEM_PSPNAME}" or just simply "psp" if (NOT TARGET psp) add_library(psp ALIAS psp-${CFE_SYSTEM_PSPNAME}) endif (NOT TARGET psp) - + # Process each PSP module that is referenced on this system architecture (any cpu) - foreach(PSPMOD ${TGTSYS_${SYSVAR}_PSPMODULES}) + foreach(PSPMOD ${TGTSYS_${SYSVAR}_PSPMODULES}) message(STATUS "Building PSP Module: ${PSPMOD}") add_subdirectory("${${PSPMOD}_MISSION_DIR}" psp/${PSPMOD}) endforeach() - + # Process each app that is used on this system architecture # First Pass: Assemble the list of apps that should be compiled foreach(APP ${TGTSYS_${SYSVAR}_APPS} ${TGTSYS_${SYSVAR}_STATICAPPS}) @@ -658,14 +658,14 @@ function(process_arch SYSVAR) endforeach() foreach(TGTNAME ${TGTSYS_${SYSVAR}}) - + # Append to the app install list for this CPU foreach(APP ${${TGTNAME}_APPLIST} ${${TGTNAME}_STATIC_APPLIST}) list(APPEND TGTLIST_${APP} ${TGTNAME}) endforeach(APP ${${TGTNAME}_APPLIST}) - + endforeach(TGTNAME ${TGTSYS_${SYSVAR}}) - + foreach(APP ${TGTSYS_${SYSVAR}_STATICAPPS}) set(APP_STATIC_TARGET_LIST ${TGTLIST_${APP}}) message(STATUS "Building Static App: ${APP} targets=${APP_STATIC_TARGET_LIST}") @@ -680,14 +680,14 @@ function(process_arch SYSVAR) add_subdirectory("${${APP}_MISSION_DIR}" apps/${APP}) endforeach() unset(APP_DYNAMIC_TARGET_LIST) - + # Process each target that shares this system architecture - # Second Pass: Build and link final target executable + # Second Pass: Build and link final target executable foreach(TGTNAME ${TGTSYS_${SYSVAR}}) - + # Target to generate the actual executable file add_subdirectory(cmake/target ${TGTNAME}) - + foreach(INSTFILE ${${TGTNAME}_FILELIST}) if(EXISTS ${MISSION_DEFS}/${TGTNAME}/${INSTFILE}) set(FILESRC ${MISSION_DEFS}/${TGTNAME}/${INSTFILE}) @@ -707,7 +707,7 @@ function(process_arch SYSVAR) message("WARNING: Install file ${INSTFILE} for ${TGTNAME} not found") endif (FILESRC) endforeach(INSTFILE ${${TGTNAME}_FILELIST}) - endforeach(TGTNAME ${TGTSYS_${SYSVAR}}) - + endforeach(TGTNAME ${TGTSYS_${SYSVAR}}) + endfunction(process_arch SYSVAR) diff --git a/cmake/global_functions.cmake b/cmake/global_functions.cmake index 0571b06b7..8289363cc 100644 --- a/cmake/global_functions.cmake +++ b/cmake/global_functions.cmake @@ -15,7 +15,7 @@ include(CMakeParseArguments) # FUNCTION: generate_c_headerfile # # Generates a C header file in the build directory. -# First argument is the file name to write. All remaining arguments will be +# First argument is the file name to write. All remaining arguments will be # concatenated and written to the file. # function(generate_c_headerfile FILE_NAME) @@ -31,15 +31,15 @@ function(generate_c_headerfile FILE_NAME) get_filename_component(FILE_GUARD "${FILE_NAME}" NAME) string(REGEX REPLACE "[^A-Za-z0-9]" "_" FILE_GUARD "${FILE_GUARD}") string(TOUPPER "GENERATED_INCLUDE_${FILE_GUARD}" FILE_GUARD) - set(GENERATED_FILE_HEADER + set(GENERATED_FILE_HEADER "/* Generated header file. Do not edit */\n\n" "#ifndef ${FILE_GUARD}\n" "#define ${FILE_GUARD}\n\n" ) - set(GENERATED_FILE_TRAILER + set(GENERATED_FILE_TRAILER "#endif /* ${FILE_GUARD} */\n" ) - + # Use configure_file() to write the file, as this automatically # has the logic to not update the timestamp on the file unless it changes. string(REPLACE ";" "" GENERATED_FILE_CONTENT "${ARGN}") @@ -49,7 +49,7 @@ function(generate_c_headerfile FILE_NAME) "${CFE_SOURCE_DIR}/cmake/cfe_generated_file.h.in" "${FILE_NAME}" @ONLY) - + endfunction(generate_c_headerfile) ################################################################## @@ -63,7 +63,7 @@ endfunction(generate_c_headerfile) # # This also supports "stacking" multiple component files together by specifying more than one # source file for the wrapper. -# +# # This function now accepts named parameters: # FILE_NAME - the name of the file to write # FALLBACK_FILE - if no files are found in "defs" using the name match, this file will be used instead. @@ -76,10 +76,10 @@ function(generate_config_includefile) if (NOT GENCONFIG_ARG_OUTPUT_DIRECTORY) set(GENCONFIG_ARG_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/inc") endif (NOT GENCONFIG_ARG_OUTPUT_DIRECTORY) - + set(WRAPPER_FILE_CONTENT) set(ITEM_FOUND FALSE) - + # Assemble a list of file names to test for # Check for existence of a file in defs directory with an exact matching name # Then Check for existence of file(s) with a matching prefix+suffix @@ -89,7 +89,7 @@ function(generate_config_includefile) list(APPEND CHECK_PATH_LIST "${MISSION_DEFS}/${PREFIX}_${GENCONFIG_ARG_MATCH_SUFFIX}") endforeach() endif(GENCONFIG_ARG_MATCH_SUFFIX) - + # Check for existence of files, and add to content if present # Note that all files are appended/concatenated together. foreach(SRC_LOCAL_PATH ${CHECK_PATH_LIST}) @@ -103,14 +103,14 @@ function(generate_config_includefile) endforeach() # If _no_ files were found in the above loop, - # then check for and use the fallback file. + # then check for and use the fallback file. # (if specified by the caller it should always exist) # Also produce a message on the console showing whether mission config or fallback was used if (ITEM_FOUND) message(STATUS "Generated ${GENCONFIG_ARG_FILE_NAME} from ${MISSION_DEFS} configuration") elseif (GENCONFIG_ARG_FALLBACK_FILE) file(TO_NATIVE_PATH "${GENCONFIG_ARG_FALLBACK_FILE}" SRC_NATIVE_PATH) - list(APPEND WRAPPER_FILE_CONTENT + list(APPEND WRAPPER_FILE_CONTENT "\n\n/* No configuration for ${GENCONFIG_ARG_FILE_NAME}, using fallback */\n" "#include \"${GENCONFIG_ARG_FALLBACK_FILE}\"\n") message(STATUS "Using ${GENCONFIG_ARG_FALLBACK_FILE} for ${GENCONFIG_ARG_FILE_NAME}") @@ -118,10 +118,10 @@ function(generate_config_includefile) message("ERROR: No implementation for ${GENCONFIG_ARG_FILE_NAME} found") message(FATAL_ERROR "Tested: ${CHECK_PATH_LIST}") endif() - + # Generate a header file generate_c_headerfile("${GENCONFIG_ARG_OUTPUT_DIRECTORY}/${GENCONFIG_ARG_FILE_NAME}" ${WRAPPER_FILE_CONTENT}) - + endfunction(generate_config_includefile) @@ -134,7 +134,7 @@ endfunction(generate_config_includefile) # TGTSYS_LIST: list of CPU architectures used in the build. Note this # will always contain a "native" target (for tools at least) which # is forced to be last. -# MISSION_APPS: full list of applications specified in the whole mission +# MISSION_APPS: full list of applications specified in the whole mission # SYSID_: set for each entry of TGTSYS_LIST, and indicates the # toolchain specified in the target file for that CPU arch. # TGTSYS_: set to a list of CPU numbers that utilize the same arch @@ -148,7 +148,7 @@ function(read_targetconfig) set(TGTSYS_LIST) set(MISSION_APPS) set(MISSION_PSPMODULES) - + # This while loop checks for a sequential set of variables prefixed with TGT_ # where is a sequence number starting with 1. The first "gap" (undefined name) # is treated as the end of list. @@ -165,8 +165,8 @@ function(read_targetconfig) # by default if PROCESSORID isn't specified, then use TGTID number. if(NOT DEFINED TGT${TGTID}_PROCESSORID) set(TGT${TGTID}_PROCESSORID ${TGTID}) - endif() - + endif() + # Translate the TGT prefix to the CPU name prefix # also propagate the value to parent scope foreach(PROP PROCESSORID @@ -181,9 +181,9 @@ function(read_targetconfig) set(${CPUNAME}_${PROP} ${TGT${TGTID}_${PROP}}) set(${CPUNAME}_${PROP} ${${CPUNAME}_${PROP}} PARENT_SCOPE) endforeach() - list(APPEND MISSION_CPUNAMES ${CPUNAME}) + list(APPEND MISSION_CPUNAMES ${CPUNAME}) endwhile() - + foreach(CPUNAME ${MISSION_CPUNAMES}) if (SIMULATION) # if simulation use simulation system architecture for all targets @@ -201,15 +201,15 @@ function(read_targetconfig) set(${CPUNAME}_PLATFORM "default" "${CPUNAME}") set(${CPUNAME}_PLATFORM "${${CPUNAME}_PLATFORM}" PARENT_SCOPE) endif() - + set(BUILD_CONFIG ${TOOLCHAIN_NAME} ${${CPUNAME}_PLATFORM}) - + # convert to a the string which is safe for a variable name string(REGEX REPLACE "[^A-Za-z0-9]" "_" SYSVAR "${BUILD_CONFIG}") # save the unmodified name for future reference set(BUILD_CONFIG_${SYSVAR} "${BUILD_CONFIG}" PARENT_SCOPE) - + # if the "global" applist is not empty, append to every CPU applist if (MISSION_GLOBAL_APPLIST) list(APPEND ${CPUNAME}_APPLIST ${MISSION_GLOBAL_APPLIST}) @@ -229,7 +229,7 @@ function(read_targetconfig) list(APPEND TGTSYS_${SYSVAR}_PSPMODULES ${${CPUNAME}_PSP_MODULELIST}) list(APPEND MISSION_APPS ${${CPUNAME}_APPLIST} ${${CPUNAME}_STATIC_APPLIST}) list(APPEND MISSION_PSPMODULES ${${CPUNAME}_PSP_MODULELIST}) - + endforeach() # Remove duplicate entries in the generated lists @@ -246,7 +246,7 @@ function(read_targetconfig) set(MISSION_APPS ${MISSION_APPS} PARENT_SCOPE) set(MISSION_PSPMODULES ${MISSION_PSPMODULES} PARENT_SCOPE) set(MISSION_CPUNAMES ${MISSION_CPUNAMES} PARENT_SCOPE) - + foreach(SYSVAR ${TGTSYS_LIST}) set(TGTSYS_${SYSVAR} ${TGTSYS_${SYSVAR}} PARENT_SCOPE) if(TGTSYS_${SYSVAR}_APPS) @@ -262,5 +262,5 @@ function(read_targetconfig) set(TGTSYS_${SYSVAR}_PSPMODULES ${TGTSYS_${SYSVAR}_PSPMODULES} PARENT_SCOPE) endif(TGTSYS_${SYSVAR}_PSPMODULES) endforeach(SYSVAR ${TGTSYS_LIST}) - + endfunction(read_targetconfig) diff --git a/cmake/mission_build.cmake b/cmake/mission_build.cmake index c8961a293..6568eea2c 100644 --- a/cmake/mission_build.cmake +++ b/cmake/mission_build.cmake @@ -5,7 +5,7 @@ # This manages the overall top-level build environment # # Note that the target CPUs may use different architectures, therefore each -# architecture must be done as a separate sub-build since none of the binaries +# architecture must be done as a separate sub-build since none of the binaries # can be shared. # # This is a normal (non-cross) build recipe and a custom target @@ -22,7 +22,7 @@ # FUNCTION: initialize_globals # # Set up global mission configuration variables. -# In the top level mode (this file)t reads extracts state info from +# In the top level mode (this file)t reads extracts state info from # configuration files within the project source tree (the _defs directory) # function(initialize_globals) @@ -32,7 +32,7 @@ function(initialize_globals) if (NOT DEFINED MISSION_BINARY_DIR) set(MISSION_BINARY_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Top level mission binary directory") endif (NOT DEFINED MISSION_BINARY_DIR) - + # this is the parent (mission) build and variable values must be determined # Obtain the "real" top-level source directory and set it in parent scope if (NOT DEFINED MISSION_SOURCE_DIR) @@ -54,7 +54,7 @@ function(initialize_globals) string(REPLACE "_defs" "" MCTEMP ${DEFDIRS}) message(STATUS "Mission configuration ${MCTEMP} automatically selected") endif ("${MCTEMP}" STREQUAL "") - # Set the MISSIONCONFIG as a CMake cache variable so it will be preserved for future runs + # Set the MISSIONCONFIG as a CMake cache variable so it will be preserved for future runs set(MISSIONCONFIG ${MCTEMP} CACHE STRING "Mission configuration selection") unset(MCTEMP) endif(NOT MISSIONCONFIG) @@ -63,11 +63,11 @@ function(initialize_globals) # The issue with environment variables is that they are transient and may change at any time, # such as if the build is invoked from a different shell. Whenever the build system is regenerated # in the future, we need to use the same values for these options even if the user has modified them - # in the local environment. + # in the local environment. set(SIMULATION $ENV{SIMULATION} CACHE STRING "Enable simulation mode using specified toolchain") set(ENABLE_UNIT_TESTS $ENV{ENABLE_UNIT_TESTS} CACHE BOOL "Enable build of unit tests") - - # Export values to parent level + + # Export values to parent level set(MISSION_DEFS ${MISSION_SOURCE_DIR}/${MISSIONCONFIG}_defs CACHE PATH "Full path to mission definitions directory") endfunction(initialize_globals) @@ -180,7 +180,7 @@ function(prepare) add_custom_target(mission-install COMMAND $(MAKE) install) add_custom_target(mission-clean COMMAND $(MAKE) clean) add_custom_target(mission-prebuild) - + # Locate the source location for all the apps found within the target file # This is done by searching through the list of paths to find a matching name # The environment variable is cached so it will be retained across runs. @@ -190,17 +190,17 @@ function(prepare) string(REPLACE ":" ";" CFS_APP_PATH "${CFS_APP_PATH}") set(MISSION_MODULE_SEARCH_PATH ${CFS_APP_PATH} ${MISSION_MODULE_SEARCH_PATH}) - # The "MISSION_DEPS" list is the complete set of all dependencies used in the build. + # The "MISSION_DEPS" list is the complete set of all dependencies used in the build. # This reflects all modules for all CPUs. It is set as a usage convenience - # for iterating through the full set of dependencies regardless of which level + # for iterating through the full set of dependencies regardless of which level # or context each dependency relates to (CFE, PSP, apps, etc). set(MISSION_DEPS ${MISSION_APPS} ${MISSION_CORE_MODULES} ${MISSION_PSPMODULES}) set(APP_MISSING_COUNT 0) - + message(STATUS "Search path for modules: ${MISSION_MODULE_SEARCH_PATH}") - + # Now search for the rest of CFS applications/libraries/modules - these may exist in - # any directory within the search path. + # any directory within the search path. foreach(APP ${MISSION_DEPS}) set (APPFOUND FALSE) foreach(APPSRC ${MISSION_MODULE_SEARCH_PATH} ${${APP}_SEARCH_PATH}) @@ -220,7 +220,7 @@ function(prepare) math(EXPR APP_MISSING_COUNT "${APP_MISSING_COUNT} + 1") endif() endforeach() - + if (APP_MISSING_COUNT GREATER 0) message(FATAL_ERROR "Target build incomplete, source for ${APP_MISSING_COUNT} module(s) not found.") endif (APP_MISSING_COUNT GREATER 0) @@ -231,11 +231,11 @@ function(prepare) foreach(DEP ${MISSION_DEPS}) set(${DEP}_MISSION_DIR ${${DEP}_MISSION_DIR} PARENT_SCOPE) endforeach(DEP ${MISSION_DEPS}) - + # Doxygen-based documentation generation targets # Create a directory for documentation output file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/doc") - + # Generate a customized Doxyfile file for the Doxygen docs. # This file must be present in the directory where "doxygen" is executed # If the user has provided a "Doxyfile" in their top level documentation directory, @@ -245,13 +245,13 @@ function(prepare) if (EXISTS "${MISSION_SOURCE_DIR}/doc/Doxyfile") list(APPEND MISSION_DOXYFILE_USER_CONTENT "@INCLUDE = ${MISSION_SOURCE_DIR}/doc/Doxyfile\n") endif (EXISTS "${MISSION_SOURCE_DIR}/doc/Doxyfile") - + foreach(APP ${MISSION_DEPS}) # OSAL is handled specially, as only part of it is used if (NOT APP STREQUAL "osal") if (EXISTS "${${APP}_MISSION_DIR}/docs/${APP}.doxyfile.in") # If the module provides its own doxyfile, then include it directly - # This allows for app-specific fine-tuning of the sources, based on its own source tree + # This allows for app-specific fine-tuning of the sources, based on its own source tree configure_file("${${APP}_MISSION_DIR}/docs/${APP}.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/${APP}.doxyfile") list(APPEND MISSION_DOXYFILE_USER_CONTENT "@INCLUDE = ${CMAKE_BINARY_DIR}/doc/${APP}.doxyfile\n") @@ -261,17 +261,17 @@ function(prepare) endif() endif() endforeach() - - # In all cases it is assumed to include the CFE documentation as well (could be configurable?) + + # In all cases it is assumed to include the CFE documentation as well (could be configurable?) file(WRITE "${CMAKE_BINARY_DIR}/doc/mission-content.doxyfile" ${MISSION_DOXYFILE_USER_CONTENT}) - + configure_file("${CFE_SOURCE_DIR}/cmake/cfe-common.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/cfe-common.doxyfile") - + configure_file("${CFE_SOURCE_DIR}/cmake/osal-common.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/osal-common.doxyfile") - + configure_file("${CFE_SOURCE_DIR}/cmake/mission-detaildesign.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/mission-detaildesign.doxyfile") @@ -280,7 +280,7 @@ function(prepare) # have the documentation associated with each macro definition. configure_file("${osal_MISSION_DIR}/osconfig.h.in" "${CMAKE_BINARY_DIR}/doc/osconfig-example.h") - + # The user guide should include the doxygen from the _public_ API files from CFE + OSAL # NOTE: the userguide is built against the headers of the default core apps. Even if # an alternate version of the module is in use, it should adhere to the same interface. @@ -291,59 +291,59 @@ function(prepare) foreach(MODULE core_api es evs fs msg sb tbl time) list(APPEND SUBMODULE_HEADER_PATHS "${${MODULE}_MISSION_DIR}/fsw/inc/*.h") endforeach() - file(GLOB MISSION_USERGUIDE_HEADERFILES + file(GLOB MISSION_USERGUIDE_HEADERFILES ${SUBMODULE_HEADER_PATHS} "${CMAKE_BINARY_DIR}/doc/osconfig-example.h" ) - - string(REPLACE ";" " \\\n" MISSION_USERGUIDE_HEADERFILES "${MISSION_USERGUIDE_HEADERFILES}") + + string(REPLACE ";" " \\\n" MISSION_USERGUIDE_HEADERFILES "${MISSION_USERGUIDE_HEADERFILES}") # OSAL API GUIDE include PUBLIC API - file(GLOB MISSION_OSAL_HEADERFILES + file(GLOB MISSION_OSAL_HEADERFILES "${osal_MISSION_DIR}/src/os/inc/*.h" "${CMAKE_BINARY_DIR}/doc/osconfig-example.h") - string(REPLACE ";" " \\\n" MISSION_OSAL_HEADERFILES "${MISSION_OSAL_HEADERFILES}") + string(REPLACE ";" " \\\n" MISSION_OSAL_HEADERFILES "${MISSION_OSAL_HEADERFILES}") configure_file("${CFE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/cfe-usersguide.doxyfile") configure_file("${CFE_SOURCE_DIR}/cmake/osalguide.doxyfile.in" - "${CMAKE_BINARY_DIR}/doc/osalguide.doxyfile") - - add_custom_target(mission-doc - doxygen mission-detaildesign.doxyfile - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc") - - add_custom_target(cfe-usersguide - doxygen cfe-usersguide.doxyfile - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc") - - add_custom_target(osalguide - doxygen osalguide.doxyfile + "${CMAKE_BINARY_DIR}/doc/osalguide.doxyfile") + + add_custom_target(mission-doc + doxygen mission-detaildesign.doxyfile + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc") + + add_custom_target(cfe-usersguide + doxygen cfe-usersguide.doxyfile WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc") - + + add_custom_target(osalguide + doxygen osalguide.doxyfile + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc") + # Pull in any application-specific mission-scope configuration # This may include user configuration files such as cfe_mission_cfg.h, - # msgid definitions, or any other configuration/preparation that needs to + # msgid definitions, or any other configuration/preparation that needs to # happen at mission/global scope. foreach(DEP_NAME ${MISSION_DEPS}) include("${${DEP_NAME}_MISSION_DIR}/mission_build.cmake" OPTIONAL) endforeach(DEP_NAME ${MISSION_DEPS}) - + # Certain runtime variables need to be "exported" to the subordinate build, such as # the specific arch settings and the location of all the apps. This is done by creating # a temporary file within the dir and then the subprocess will read that file and re-create # variables out of them. The alternative to this is to specify many "-D" parameters to the # subordinate build but that would not scale well to many vars. - set(VARLIST - "MISSION_NAME" - "SIMULATION" - "MISSION_DEFS" - "MISSION_SOURCE_DIR" - "MISSION_BINARY_DIR" - "MISSIONCONFIG" - "MISSION_APPS" - "MISSION_PSPMODULES" + set(VARLIST + "MISSION_NAME" + "SIMULATION" + "MISSION_DEFS" + "MISSION_SOURCE_DIR" + "MISSION_BINARY_DIR" + "MISSIONCONFIG" + "MISSION_APPS" + "MISSION_PSPMODULES" "MISSION_DEPS" "ENABLE_UNIT_TESTS" ) @@ -384,8 +384,8 @@ function(prepare) # Add a dependency on the table generator tool as this is required for table builds # The "elf2cfetbl" target should have been added by the "tools" above - add_dependencies(mission-prebuild elf2cfetbl) - + add_dependencies(mission-prebuild elf2cfetbl) + # Build version information should be generated as part of the pre-build process add_dependencies(mission-prebuild mission-version) @@ -393,7 +393,7 @@ function(prepare) if (IS_DIRECTORY ${MISSION_DEFS}/functional-test AND DEFINED FT_INSTALL_SUBDIR) install(DIRECTORY ${MISSION_DEFS}/functional-test/ DESTINATION ${FT_INSTALL_SUBDIR}) endif() - + endfunction(prepare) ################################################################## @@ -408,7 +408,7 @@ function(process_arch TARGETSYSTEM) # The "BUILD_CONFIG" is a list of items to uniquely identify this build # The first element in the list is the toolchain name, followed by config name(s) set(BUILD_CONFIG ${BUILD_CONFIG_${TARGETSYSTEM}}) - list(GET BUILD_CONFIG 0 ARCH_TOOLCHAIN_NAME) + list(GET BUILD_CONFIG 0 ARCH_TOOLCHAIN_NAME) list(REMOVE_AT BUILD_CONFIG 0) # convert to a the string which is safe for a directory name string(REGEX REPLACE "[^A-Za-z0-9]" "_" ARCH_CONFIG_NAME "${BUILD_CONFIG}") @@ -433,7 +433,7 @@ function(process_arch TARGETSYSTEM) # Do not supply any toolchain file option to the subprocess set(SELECTED_TOOLCHAIN_FILE) endif () - + # Execute CMake subprocess to create a binary build tree for the specific CPU architecture execute_process( COMMAND ${CMAKE_COMMAND} @@ -444,44 +444,44 @@ function(process_arch TARGETSYSTEM) -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${SELECTED_TOOLCHAIN_FILE} ${CFE_SOURCE_DIR} - WORKING_DIRECTORY - "${ARCH_BINARY_DIR}" - RESULT_VARIABLE + WORKING_DIRECTORY + "${ARCH_BINARY_DIR}" + RESULT_VARIABLE RESULT ) if (NOT RESULT EQUAL 0) message(FATAL_ERROR "Failed to configure ${TARGETSYSTEM}") - endif (NOT RESULT EQUAL 0) - + endif (NOT RESULT EQUAL 0) + # Hook the "make all", "make clean", and "make install" targets for the subordinate build # to top-level build targets prefixed by the CPU architecture. - add_custom_target(${TARGETSYSTEM}-all - COMMAND - $(MAKE) all - WORKING_DIRECTORY + add_custom_target(${TARGETSYSTEM}-all + COMMAND + $(MAKE) all + WORKING_DIRECTORY "${ARCH_BINARY_DIR}" ) - add_custom_target(${TARGETSYSTEM}-clean - COMMAND - $(MAKE) clean - WORKING_DIRECTORY + add_custom_target(${TARGETSYSTEM}-clean + COMMAND + $(MAKE) clean + WORKING_DIRECTORY "${ARCH_BINARY_DIR}" ) - add_custom_target(${TARGETSYSTEM}-install - COMMAND - $(MAKE) install - WORKING_DIRECTORY + add_custom_target(${TARGETSYSTEM}-install + COMMAND + $(MAKE) install + WORKING_DIRECTORY "${ARCH_BINARY_DIR}" ) # All subordinate builds depend on the generated files being present first add_dependencies(${TARGETSYSTEM}-install mission-prebuild) - add_dependencies(${TARGETSYSTEM}-all mission-prebuild) + add_dependencies(${TARGETSYSTEM}-all mission-prebuild) add_dependencies(mission-all ${TARGETSYSTEM}-all) add_dependencies(mission-clean ${TARGETSYSTEM}-clean) add_dependencies(mission-install ${TARGETSYSTEM}-install) - + endfunction(process_arch TARGETSYSTEM) diff --git a/cmake/mission_defaults.cmake b/cmake/mission_defaults.cmake index 14d2c9769..e023e791a 100644 --- a/cmake/mission_defaults.cmake +++ b/cmake/mission_defaults.cmake @@ -11,15 +11,15 @@ # of the CFE core executable on every target. These can be used to amend # or override parts of the CFE core on a mission-specific basis. # The "intf" modules are headers only, and define the interface(s) between components -set(MISSION_CORE_MODULES - "core_api" - "core_private" - "es" - "evs" - "fs" - "sb" - "tbl" - "time" +set(MISSION_CORE_MODULES + "core_api" + "core_private" + "es" + "evs" + "fs" + "sb" + "tbl" + "time" "osal" "psp" "msg" @@ -30,17 +30,17 @@ set(MISSION_CORE_MODULES # The "MISSION_GLOBAL_APPLIST" is a set of apps/libs that will be built # for every defined and target. These are built as dynamic modules # and must be loaded explicitly via startup script or command. -# This list is effectively appended to every TGTx_APPLIST in targets.cmake. +# This list is effectively appended to every TGTx_APPLIST in targets.cmake. set(MISSION_GLOBAL_APPLIST) # The "MISSION_GLOBAL_STATIC_APPLIST" is similar to MISSION_GLOBAL_APPLIST -# but the apps are statically linked. -# This list is effectively appended to every TGTx_STATIC_APPLIST in targets.cmake. +# but the apps are statically linked. +# This list is effectively appended to every TGTx_STATIC_APPLIST in targets.cmake. set(MISSION_GLOBAL_STATIC_APPLIST) # The "MISSION_MODULE_SEARCH_PATH" is a list of subdirectories -# which will be searched for modules (apps and libs) specified in -# the targets.cmake file. It may also be locally extended by setting +# which will be searched for modules (apps and libs) specified in +# the targets.cmake file. It may also be locally extended by setting # the environment variable "CFS_APP_PATH" set(MISSION_MODULE_SEARCH_PATH "apps" # general purpose $[top}/apps directory diff --git a/cmake/sample_defs/arch_build_custom.cmake b/cmake/sample_defs/arch_build_custom.cmake index ac1dd99b4..77fc54a64 100644 --- a/cmake/sample_defs/arch_build_custom.cmake +++ b/cmake/sample_defs/arch_build_custom.cmake @@ -4,35 +4,35 @@ # # This file will be automatically included in the arch-specific build scope # -# Definitions and options specified here will be used when cross-compiling +# Definitions and options specified here will be used when cross-compiling # _all_ FSW code for _all_ targets defined in targets.cmake. # # Avoid machine-specific code generation options in this file (e.g. -f,-m options); such # options should be localized to the toolchain file such that they will only be # included on the machines where they apply. -# +# # CAUTION: In heterogeneous environments where different cross compilers are # used for different CPUs, particularly if from different vendors, it is likely # that compile options will need to be different as well. # # In general, options in this file can only be used in cases where all CPUs use a -# compiler from the same vendor and/or are all GCC based such that they accept similar +# compiler from the same vendor and/or are all GCC based such that they accept similar # command line options. # -# This file can alternatively be named as "arch_build_custom_${TARGETSYSTEM}.cmake" +# This file can alternatively be named as "arch_build_custom_${TARGETSYSTEM}.cmake" # where ${TARGETSYSTEM} represents the system type, matching the toolchain. # # These example options assume a GCC-style toolchain is used for cross compilation, -# and uses the same warning options that are applied at the mission level. +# and uses the same warning options that are applied at the mission level. # add_compile_options( - -std=c99 # Target the C99 standard (without gcc extensions) + -std=c99 # Target the C99 standard (without gcc extensions) -pedantic # Issue all the warnings demanded by strict ISO C -Wall # Warn about most questionable operations -Wstrict-prototypes # Warn about missing prototypes -Wwrite-strings # Warn if not treating string literals as "const" -Wpointer-arith # Warn about suspicious pointer operations -Wcast-align # Warn about casts that increase alignment requirements - -Werror # Treat warnings as errors (code should be clean) + -Werror # Treat warnings as errors (code should be clean) ) diff --git a/cmake/sample_defs/global_build_options.cmake b/cmake/sample_defs/global_build_options.cmake index 486dc2aa0..d2d93cca8 100644 --- a/cmake/sample_defs/global_build_options.cmake +++ b/cmake/sample_defs/global_build_options.cmake @@ -14,7 +14,7 @@ # If the OMIT_DEPRECATED flag is specified, then define the respective macros # that omit the deprecated features from the build. This is conditional in this -# example for CI purposes, so it can be tested both ways. Most projects would +# example for CI purposes, so it can be tested both ways. Most projects would # likely set this only one way. set(OMIT_DEPRECATED $ENV{OMIT_DEPRECATED} CACHE STRING "Omit deprecated elements") if (OMIT_DEPRECATED) diff --git a/cmake/sample_defs/mission_build_custom.cmake b/cmake/sample_defs/mission_build_custom.cmake index 92506bc9a..01e940e60 100644 --- a/cmake/sample_defs/mission_build_custom.cmake +++ b/cmake/sample_defs/mission_build_custom.cmake @@ -6,19 +6,19 @@ # # Definitions and options specified here will be used when building local tools and # other code that runs on the development host, but do _NOT_ apply to flight software -# (embedded) code or anything built for the target machine. +# (embedded) code or anything built for the target machine. # # These options assume a GCC toolchain but a similar set should be applicable to clang. # add_compile_options( - -std=c99 # Target the C99 standard (without gcc extensions) + -std=c99 # Target the C99 standard (without gcc extensions) -pedantic # Issue all the warnings demanded by strict ISO C -Wall # Warn about most questionable operations -Wstrict-prototypes # Warn about missing prototypes -Wwrite-strings # Warn if not treating string literals as "const" -Wpointer-arith # Warn about suspicious pointer operations -Wcast-align # Warn about casts that increase alignment requirements - -Werror # Treat warnings as errors (code should be clean) + -Werror # Treat warnings as errors (code should be clean) ) # The _XOPEN_SOURCE directive is required for glibc to enable conformance with the diff --git a/cmake/sample_defs/targets.cmake b/cmake/sample_defs/targets.cmake index 20e18cb38..d2ea58a7b 100644 --- a/cmake/sample_defs/targets.cmake +++ b/cmake/sample_defs/targets.cmake @@ -83,13 +83,13 @@ SET(SPACECRAFT_ID 0x42) # The "MISSION_GLOBAL_APPLIST" is a set of apps/libs that will be built # for every defined and target. These are built as dynamic modules # and must be loaded explicitly via startup script or command. -# This list is effectively appended to every TGTx_APPLIST in targets.cmake. +# This list is effectively appended to every TGTx_APPLIST in targets.cmake. # Example: list(APPEND MISSION_GLOBAL_APPLIST sample_app sample_lib) # The "MISSION_GLOBAL_STATIC_APPLIST" is similar to MISSION_GLOBAL_APPLIST -# but the apps are statically linked. -# This list is effectively appended to every TGTx_STATIC_APPLIST in targets.cmake. +# but the apps are statically linked. +# This list is effectively appended to every TGTx_STATIC_APPLIST in targets.cmake. # Example: # list(APPEND MISSION_GLOBAL_STATIC_APPLIST my_static_app) @@ -104,7 +104,7 @@ SET(cpu1_PROCESSORID 1) SET(cpu1_APPLIST ci_lab to_lab sch_lab) SET(cpu1_FILELIST cfe_es_startup.scr) -# CPU2 example. This is not built by default anymore but +# CPU2 example. This is not built by default anymore but # serves as an example of how one would configure multiple cpus. SET(cpu2_PROCESSORID 2) SET(cpu2_APPLIST ci_lab to_lab sch_lab) diff --git a/cmake/sample_defs/toolchain-i686-rtems4.11.cmake b/cmake/sample_defs/toolchain-i686-rtems4.11.cmake index fb0945629..92b9d73f7 100644 --- a/cmake/sample_defs/toolchain-i686-rtems4.11.cmake +++ b/cmake/sample_defs/toolchain-i686-rtems4.11.cmake @@ -4,8 +4,8 @@ # 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 +# 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. diff --git a/cmake/sample_defs/toolchain-i686-rtems5.cmake b/cmake/sample_defs/toolchain-i686-rtems5.cmake index 6c2205a73..fa1212832 100644 --- a/cmake/sample_defs/toolchain-i686-rtems5.cmake +++ b/cmake/sample_defs/toolchain-i686-rtems5.cmake @@ -4,8 +4,8 @@ # 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 +# 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. diff --git a/cmake/sample_defs/toolchain-powerpc-440_softfp-linux-gnu.cmake b/cmake/sample_defs/toolchain-powerpc-440_softfp-linux-gnu.cmake index 3ae936f6a..16aa8ca39 100644 --- a/cmake/sample_defs/toolchain-powerpc-440_softfp-linux-gnu.cmake +++ b/cmake/sample_defs/toolchain-powerpc-440_softfp-linux-gnu.cmake @@ -3,11 +3,11 @@ # In this sample application, the cross toolchain is configured to # use a cross compiler for the PowerPC 440 processor which is used on -# the IBM "Bamboo" development board. The GCC toolchain is named +# the IBM "Bamboo" development board. The GCC toolchain is named # accordingly and assumed to be installed in "/opt/x-tools". # Basic cross system configuration -SET(PPC440_BR_TOP "$ENV{PPC440_BR_TOP}" +SET(PPC440_BR_TOP "$ENV{PPC440_BR_TOP}" CACHE PATH "Top directory for Linux buildroot filesystem project") SET(CMAKE_SYSTEM_NAME Linux) @@ -20,7 +20,7 @@ SET(CMAKE_C_COMPILER "${PPC440_BR_TOP}/host/usr/bin/powerpc-440_softfp-linux-g SET(CMAKE_CXX_COMPILER "${PPC440_BR_TOP}/host/usr/bin/powerpc-440_softfp-linux-gnu-g++") # where is the target environment -SET(CMAKE_FIND_ROOT_PATH "/opt/x-tools/powerpc-440_softfp-linux-gnu/powerpc-440_softfp-linux-gnu/sysroot" +SET(CMAKE_FIND_ROOT_PATH "/opt/x-tools/powerpc-440_softfp-linux-gnu/powerpc-440_softfp-linux-gnu/sysroot" "${PPC440_BR_TOP}/staging") # search for programs in the build host directories @@ -30,7 +30,7 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -# these settings are specific to cFE/OSAL and determines +# these settings are specific to cFE/OSAL and determines # which abstraction layers are built when this toolchain is used SET(CFE_SYSTEM_PSPNAME pc-linux) SET(OSAL_SYSTEM_BSPTYPE pc-linux) diff --git a/cmake/sample_defs/toolchain-ppc-vxworks6.9.cmake b/cmake/sample_defs/toolchain-ppc-vxworks6.9.cmake index e33754b41..8c879c485 100644 --- a/cmake/sample_defs/toolchain-ppc-vxworks6.9.cmake +++ b/cmake/sample_defs/toolchain-ppc-vxworks6.9.cmake @@ -57,5 +57,5 @@ SET(CMAKE_PREFIX_PATH /) SET(CFE_SYSTEM_PSPNAME mcp750-vxworks) include_directories(${WIND_BASE}/target/h/wrn/coreip) -include_directories(${WIND_BASE}/target/h) +include_directories(${WIND_BASE}/target/h) diff --git a/cmake/target/CMakeLists.txt b/cmake/target/CMakeLists.txt index 10e935ef8..33ad47da0 100644 --- a/cmake/target/CMakeLists.txt +++ b/cmake/target/CMakeLists.txt @@ -2,10 +2,10 @@ # # cFS executable target recipe # -# This CMake script integrates the CFE core, PSP, and selected CFS +# This CMake script integrates the CFE core, PSP, and selected CFS # apps into a final executable target. # -# No additional source code is built here, it only serves as a final build +# No additional source code is built here, it only serves as a final build # stage to link the libraries together. # ################################################################## @@ -124,7 +124,7 @@ add_executable(core-${TGTNAME} src/target_config.c ) -target_compile_definitions(core-${TGTNAME} PRIVATE +target_compile_definitions(core-${TGTNAME} PRIVATE CFE_DEFAULT_MODULE_EXTENSION="${CMAKE_SHARED_MODULE_SUFFIX}" CFE_DEFAULT_CORE_FILENAME="$" CFE_CPU_NAME_VALUE="${TGTNAME}" @@ -136,9 +136,9 @@ target_include_directories(core-${TGTNAME} PRIVATE "${CMAKE_BINARY_DIR}/${CFE_CORE_TARGET}/inc" ) -# This next section provides a method for adding the "-u" switch to the +# This next section provides a method for adding the "-u" switch to the # linker in order to make sure the linker includes certain symbols in the link. -# This problem may exist for the entry point or other symbols if the +# This problem may exist for the entry point or other symbols if the # linker doesn't know that they are unresolved when it links those files. set (TARGET_LINK_FLAGS) foreach(SYM ${CFE_ENTRY_SYM}) @@ -148,38 +148,38 @@ endforeach() set_target_properties(core-${TGTNAME} PROPERTIES LINK_FLAGS "${TARGET_LINK_FLAGS}") # We may need to use the "--whole-archive" flags to CFE, OSAL, and PSP to ensure that ALL -# symbols make their way into the final executable. The "--enable-exports" +# symbols make their way into the final executable. The "--enable-exports" # (enabled by the ENABLE_EXPORTS property) does not apply to static libs on the link line # This is only a concern when relying on the dynamic module loader, if we are statically # linking the entire CFE system into a single binary then no special help is needed. if (${TGTNAME}_APPLIST) set_target_properties(core-${TGTNAME} PROPERTIES ENABLE_EXPORTS TRUE) - + if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") # The option pair for GNU gcc/ld tools set(START_WHOLE_ARCHIVE "--whole-archive") set(STOP_WHOLE_ARCHIVE "--no-whole-archive") - + # the linker option prefix may or may not be needed, see below - set(COMPILER_LINKER_OPTION_PREFIX "-Wl,") + set(COMPILER_LINKER_OPTION_PREFIX "-Wl,") else() # Other toolchain options may be added here endif() # Determine if a pass-through prefix is needed for a linker option. # This prefix is required if the link is invoked through gcc, - # but will fail if calling the linker directory + # but will fail if calling the linker directory # Unfortunately there is no way to directly get this info, # but the platform should set CMAKE_EXE_EXPORTS_C_FLAG # for the ENABLE_EXPORTS property, so this just checks # if this starts with -Wl, and if so, use it here too. - if (DEFINED COMPILER_LINKER_OPTION_PREFIX AND + if (DEFINED COMPILER_LINKER_OPTION_PREFIX AND "${CMAKE_EXE_EXPORTS_C_FLAG}" MATCHES "^${COMPILER_LINKER_OPTION_PREFIX}") set(START_WHOLE_ARCHIVE "${COMPILER_LINKER_OPTION_PREFIX}${START_WHOLE_ARCHIVE}") set(STOP_WHOLE_ARCHIVE "${COMPILER_LINKER_OPTION_PREFIX}${STOP_WHOLE_ARCHIVE}") endif() - + endif (${TGTNAME}_APPLIST) # Collect any additional libraries that should be included on the link line @@ -187,31 +187,31 @@ endif (${TGTNAME}_APPLIST) set(CFE_LINK_WHOLE_LIBS ${MISSION_CORE_MODULES} ) -set(CFE_LINK_NORMAL_LIBS +set(CFE_LINK_NORMAL_LIBS ${${TGTNAME}_PSP_MODULELIST} ${${TGTNAME}_STATIC_APPLIST} ) # Handle the list of "embedded files" that should be linked into CFE. # These are arbitrary files in the mission config that are converted -# into C data structures and linked with the executable. This is +# into C data structures and linked with the executable. This is # a helpful feature for use when statically linking the CFE. if (DEFINED ${TGTNAME}_EMBED_FILELIST) set(EMBFILE_GENSRC_LIST) # a list of C source files to compile set(EMBFILE_CONTENT_LIST) # a list of content targets for dependencies file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/embed") # work area - + # Loop through each entry, which should be of the form: # VARIABLE_NAME,FILE_NAME - # Where "VARIABLE_NAME" indicates the name to use for the + # Where "VARIABLE_NAME" indicates the name to use for the # generated C data structure, and FILE_NAME is the data file # that it is sourced from (no paths, it will be searched). foreach(LISTENT ${${TGTNAME}_EMBED_FILELIST}) string(REPLACE "," ";" LISTENT ${LISTENT}) # split on the comma list(GET LISTENT 0 EMBNAME) # EMBNAME => C variable name list(GET LISTENT 1 EMBFILE) # EMBFILE => File name - + # Find the real source of the file and store in FILESRC if(EXISTS ${MISSION_DEFS}/${TGTNAME}_${EMBFILE}) set(FILESRC ${MISSION_DEFS}/${TGTNAME}_${EMBFILE}) @@ -239,10 +239,10 @@ if (DEFINED ${TGTNAME}_EMBED_FILELIST) "#include \"${EMBNAME}.inc\"\n" "};\n" "const unsigned long ${EMBNAME}_SIZE = sizeof(${EMBNAME}_DATA);\n") - + list(APPEND EMBFILE_GENSRC_LIST "${CMAKE_CURRENT_BINARY_DIR}/embed/${EMBNAME}.c") list(APPEND EMBFILE_CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/embed/${EMBNAME}.inc") - + endforeach(LISTENT ${${TGTNAME}_EMBED_FILELIST}) # Finally, generate a static library that contains all embeded binary files @@ -253,17 +253,17 @@ if (DEFINED ${TGTNAME}_EMBED_FILELIST) add_custom_target(${TGTNAME}_embed_content DEPENDS ${EMBFILE_CONTENT_LIST}) add_dependencies(${TGTNAME}_embed_files ${TGTNAME}_embed_content) list(APPEND CFE_LINK_NORMAL_LIBS ${TGTNAME}_embed_files) - -endif (DEFINED ${TGTNAME}_EMBED_FILELIST) + +endif (DEFINED ${TGTNAME}_EMBED_FILELIST) target_link_libraries(core-${TGTNAME} # The following libs should be included whole, even if they - # do not necessarily resolve any symbols, because they may be needed by apps - ${START_WHOLE_ARCHIVE} + # do not necessarily resolve any symbols, because they may be needed by apps + ${START_WHOLE_ARCHIVE} ${CFE_LINK_WHOLE_LIBS} ${STOP_WHOLE_ARCHIVE} - - # The remainder are static libraries that should only be + + # The remainder are static libraries that should only be # included if they resolve an undefined symbol (normal link logic) ${CFE_LINK_NORMAL_LIBS} ${OSAL_LINK_LIBS} diff --git a/modules/core_api/CMakeLists.txt b/modules/core_api/CMakeLists.txt index 6a2014234..4ecff11e8 100644 --- a/modules/core_api/CMakeLists.txt +++ b/modules/core_api/CMakeLists.txt @@ -1,10 +1,10 @@ ################################################################## # -# cFE Global/Public Application Interface +# cFE Global/Public Application Interface # ################################################################## -# NOTE: This module is shared headers and configuration only, it has has no +# NOTE: This module is shared headers and configuration only, it has has no # source files of its own. It just defines the intefaces betwen the CFE core # modules and other private headers that define CFE internal shared data objects. add_library(core_api INTERFACE) @@ -14,7 +14,7 @@ target_include_directories(core_api INTERFACE fsw/inc) # The list of modules that comprise the "CFE app interface" # This is the set of APIs that applications and libraries may call directly -# The include path to all of them is +# The include path to all of them is set(core_api_MODULES es evs fs msg resourceid sb tbl time osal psp) # Propagate any INTERFACE-level include dirs and compile defintions from diff --git a/modules/core_api/arch_build.cmake b/modules/core_api/arch_build.cmake index 053fbc40f..fe0b72634 100644 --- a/modules/core_api/arch_build.cmake +++ b/modules/core_api/arch_build.cmake @@ -3,16 +3,16 @@ # CFE arch/platform build setup # # This file is evaluated as part of the "prepare" stage -# and can be used to set up prerequisites for the build, +# and can be used to set up prerequisites for the build, # such as generating header files -# +# ########################################################### # Generate the "cfe_platform_cfg.h" and "cfe_msgids.h" header files # these must come from mission config generate_config_includefile( - FILE_NAME "cfe_msgids.h" + FILE_NAME "cfe_msgids.h" MATCH_SUFFIX "msgids.h" PREFIXES ${BUILD_CONFIG} ) diff --git a/modules/core_api/mission_build.cmake b/modules/core_api/mission_build.cmake index 83b78a6aa..34eff598a 100644 --- a/modules/core_api/mission_build.cmake +++ b/modules/core_api/mission_build.cmake @@ -3,21 +3,21 @@ # CFE mission build setup # # This file is evaluated as part of the "prepare" stage -# and can be used to set up prerequisites for the build, +# and can be used to set up prerequisites for the build, # such as generating header files -# +# ########################################################### # Generate the "cfe_mission_cfg.h" and "cfe_perfids.h" header files # these must come from mission config generate_config_includefile( - FILE_NAME "cfe_mission_cfg.h" + FILE_NAME "cfe_mission_cfg.h" MATCH_SUFFIX "mission_cfg.h" PREFIXES ${MISSIONCONFIG} ) generate_config_includefile( - FILE_NAME "cfe_perfids.h" + FILE_NAME "cfe_perfids.h" MATCH_SUFFIX "perfids.h" PREFIXES ${MISSIONCONFIG} ) diff --git a/modules/core_api/ut-stubs/CMakeLists.txt b/modules/core_api/ut-stubs/CMakeLists.txt index 362778b9d..c5bad60fd 100644 --- a/modules/core_api/ut-stubs/CMakeLists.txt +++ b/modules/core_api/ut-stubs/CMakeLists.txt @@ -15,7 +15,7 @@ include_directories(${osal_MISSION_DIR}/ut_assert/inc) # # Create the generic stubs library # -add_library(ut_${DEP}_stubs STATIC +add_library(ut_${DEP}_stubs STATIC src/ut_es_stubs.c src/ut_evs_stubs.c src/ut_msg_stubs.c diff --git a/modules/core_private/CMakeLists.txt b/modules/core_private/CMakeLists.txt index 6912ced6f..9f1b54430 100644 --- a/modules/core_private/CMakeLists.txt +++ b/modules/core_private/CMakeLists.txt @@ -1,6 +1,6 @@ ################################################################## # -# cFE Inter-module interface +# cFE Inter-module interface # ################################################################## @@ -10,7 +10,7 @@ add_library(core_private INTERFACE) # code compiled as CFE core internal will have _CFE_CORE_ macro set target_compile_definitions(core_private INTERFACE _CFE_CORE_) -target_include_directories(core_private INTERFACE +target_include_directories(core_private INTERFACE fsw/inc # includes shared typedefs among CFE core apps, not called/used by apps ${CFE_SOURCE_DIR}/cmake/target/inc # allow CFE core apps to get "target_config.h" file ) diff --git a/modules/core_private/arch_build.cmake b/modules/core_private/arch_build.cmake index 0de378fab..6bba56507 100644 --- a/modules/core_private/arch_build.cmake +++ b/modules/core_private/arch_build.cmake @@ -3,16 +3,16 @@ # CFE arch/platform build setup # # This file is evaluated as part of the "prepare" stage -# and can be used to set up prerequisites for the build, +# and can be used to set up prerequisites for the build, # such as generating header files -# +# ########################################################### # Generate the "cfe_platform_cfg.h" and "cfe_msgids.h" header files # these must come from mission config generate_config_includefile( - FILE_NAME "cfe_platform_cfg.h" + FILE_NAME "cfe_platform_cfg.h" MATCH_SUFFIX "platform_cfg.h" PREFIXES ${BUILD_CONFIG} ) diff --git a/modules/core_private/ut-stubs/CMakeLists.txt b/modules/core_private/ut-stubs/CMakeLists.txt index ca2150efa..0060e108d 100644 --- a/modules/core_private/ut-stubs/CMakeLists.txt +++ b/modules/core_private/ut-stubs/CMakeLists.txt @@ -12,7 +12,7 @@ # # Create the generic stubs library # -add_library(ut_${DEP}_stubs STATIC +add_library(ut_${DEP}_stubs STATIC src/ut_osprintf_stubs.c src/ut_support.c ) diff --git a/modules/es/CMakeLists.txt b/modules/es/CMakeLists.txt index c3d1cb1d6..0e8ebe701 100644 --- a/modules/es/CMakeLists.txt +++ b/modules/es/CMakeLists.txt @@ -7,7 +7,7 @@ project(CFE_ES C) # Executive services source files -set(es_SOURCES +set(es_SOURCES fsw/src/cfe_es_api.c fsw/src/cfe_es_apps.c fsw/src/cfe_es_backgroundtask.c diff --git a/modules/fs/CMakeLists.txt b/modules/fs/CMakeLists.txt index a6fc75603..db9b570d6 100644 --- a/modules/fs/CMakeLists.txt +++ b/modules/fs/CMakeLists.txt @@ -7,7 +7,7 @@ project(CFE_FS C) # File services source files -set(fs_SOURCES +set(fs_SOURCES fsw/src/cfe_fs_api.c fsw/src/cfe_fs_priv.c fsw/src/cfe_fs_api.c diff --git a/modules/msg/mission_build.cmake b/modules/msg/mission_build.cmake index 2ff86e581..7be0cea6b 100644 --- a/modules/msg/mission_build.cmake +++ b/modules/msg/mission_build.cmake @@ -3,9 +3,9 @@ # MSG mission build setup # # This file is evaluated as part of the "prepare" stage -# and can be used to set up prerequisites for the build, +# and can be used to set up prerequisites for the build, # such as generating header files -# +# ########################################################### # Extended header inclusion selection @@ -17,7 +17,7 @@ endif (MISSION_INCLUDE_CCSDSEXT_HEADER) # Generate the header definition files, use local default for this module) generate_config_includefile( - FILE_NAME "cfe_msg_hdr.h" + FILE_NAME "cfe_msg_hdr.h" FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/option_inc/${MSG_HDR_FILE}" ) diff --git a/modules/msg/ut-coverage/CMakeLists.txt b/modules/msg/ut-coverage/CMakeLists.txt index 2e36147e6..e7c509576 100644 --- a/modules/msg/ut-coverage/CMakeLists.txt +++ b/modules/msg/ut-coverage/CMakeLists.txt @@ -50,7 +50,7 @@ add_executable(${DEP}_UT ${ut_${DEP}_tests}) # Add include to get private defaults target_include_directories(${DEP}_UT PRIVATE ../fsw/src) -# Also add the UT_COVERAGE_LINK_FLAGS to the link command +# Also add the UT_COVERAGE_LINK_FLAGS to the link command # This should enable coverage analysis on platforms that support this target_link_libraries(${DEP}_UT ${UT_COVERAGE_LINK_FLAGS} diff --git a/modules/resourceid/CMakeLists.txt b/modules/resourceid/CMakeLists.txt index 819135dad..34e568bb8 100644 --- a/modules/resourceid/CMakeLists.txt +++ b/modules/resourceid/CMakeLists.txt @@ -7,7 +7,7 @@ project(CFE_RESOURCEID C) # Module library -set(resourceid_SOURCES +set(resourceid_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/fsw/src/cfe_resourceid_api.c ) add_library(resourceid STATIC ${resourceid_SOURCES}) diff --git a/modules/resourceid/mission_build.cmake b/modules/resourceid/mission_build.cmake index 0b9a02189..9319c48d6 100644 --- a/modules/resourceid/mission_build.cmake +++ b/modules/resourceid/mission_build.cmake @@ -3,9 +3,9 @@ # Resource ID mission build setup # # This file is evaluated as part of the "prepare" stage -# and can be used to set up prerequisites for the build, +# and can be used to set up prerequisites for the build, # such as generating header files -# +# ########################################################### # Check if strict/enforcing typedef should be used @@ -17,7 +17,7 @@ endif () # Generate the header definition files, use local default for this module) generate_config_includefile( - FILE_NAME "cfe_resourceid_typedef.h" + FILE_NAME "cfe_resourceid_typedef.h" FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/option_inc/${RESOURCEID_HDR_FILE}" ) @@ -25,7 +25,7 @@ generate_config_includefile( # Currently the "osal compatible" version is the only provided implementation, # but missions can provide their own if desired to override this. generate_config_includefile( - FILE_NAME "cfe_resourceid_basevalue.h" + FILE_NAME "cfe_resourceid_basevalue.h" FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/option_inc/cfe_resourceid_osal_compatible.h" ) diff --git a/modules/resourceid/ut-coverage/CMakeLists.txt b/modules/resourceid/ut-coverage/CMakeLists.txt index 7be770ae3..31781fd0e 100644 --- a/modules/resourceid/ut-coverage/CMakeLists.txt +++ b/modules/resourceid/ut-coverage/CMakeLists.txt @@ -9,7 +9,7 @@ # Unit test object library sources, options, and includes add_library(ut_resourceid_OBJS OBJECT ${resourceid_SOURCES}) -target_compile_options(ut_resourceid_OBJS PRIVATE +target_compile_options(ut_resourceid_OBJS PRIVATE ${UT_COVERAGE_COMPILE_FLAGS} ) target_include_directories(ut_resourceid_OBJS PRIVATE @@ -22,7 +22,7 @@ add_executable(resourceid_UT test_cfe_resourceid.c $ Date: Mon, 15 Mar 2021 18:25:13 -0400 Subject: [PATCH 4/7] Fix #1130, Clean trailing whitespace: Doxygen Removes trailing whitespace in: - *.dox - *doxyfile.in --- cmake/cfe-common.doxyfile.in | 4 +- cmake/mission-detaildesign.doxyfile.in | 4 +- cmake/osal-common.doxyfile.in | 12 +- docs/src/cfe_es.dox | 404 +++++++++---------- docs/src/cfe_evs.dox | 312 +++++++-------- docs/src/cfe_glossary.dox | 54 +-- docs/src/cfe_sb.dox | 4 +- docs/src/cfe_tbl.dox | 138 +++---- docs/src/cfe_time.dox | 528 ++++++++++++------------- docs/src/cfe_xref.dox | 2 +- docs/src/cfs_versions.dox | 2 +- docs/src/ddd_main.dox | 2 +- docs/src/main.dox | 108 ++--- docs/src/osal_fs.dox | 12 +- 14 files changed, 793 insertions(+), 793 deletions(-) diff --git a/cmake/cfe-common.doxyfile.in b/cmake/cfe-common.doxyfile.in index 0fe72ca2f..b4aec8684 100644 --- a/cmake/cfe-common.doxyfile.in +++ b/cmake/cfe-common.doxyfile.in @@ -90,7 +90,7 @@ PAPER_TYPE = letter #--------------------------------------------------------------------------- COMPACT_RTF = YES #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO HAVE_DOT = YES @@ -102,7 +102,7 @@ CALL_GRAPH = YES GRAPHICAL_HIERARCHY = NO MAX_DOT_GRAPH_DEPTH = 1000 #--------------------------------------------------------------------------- -# Configuration::additions related to the search engine +# Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO #--------------------------------------------------------------------------- diff --git a/cmake/mission-detaildesign.doxyfile.in b/cmake/mission-detaildesign.doxyfile.in index 2ec3f3863..0e9aa60d7 100644 --- a/cmake/mission-detaildesign.doxyfile.in +++ b/cmake/mission-detaildesign.doxyfile.in @@ -24,10 +24,10 @@ INPUT += @MISSION_DEFS@ \ @MISSION_SOURCE_DIR@/cfe/modules/sbr/fsw \ @MISSION_SOURCE_DIR@/cfe/modules/tbl/fsw \ @MISSION_SOURCE_DIR@/cfe/modules/time/fsw - + STRIP_FROM_PATH += @MISSION_DEFS@ #--------------------------------------------------------------------------- -# The user content doxyfile contains paths to the mission-specific applications +# The user content doxyfile contains paths to the mission-specific applications #--------------------------------------------------------------------------- @INCLUDE = @CMAKE_BINARY_DIR@/doc/mission-content.doxyfile diff --git a/cmake/osal-common.doxyfile.in b/cmake/osal-common.doxyfile.in index 4525e2477..c52f671fa 100644 --- a/cmake/osal-common.doxyfile.in +++ b/cmake/osal-common.doxyfile.in @@ -32,13 +32,13 @@ WARN_LOGFILE = @CMAKE_BINARY_DIR@/doc/warnings.log #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -STRIP_FROM_PATH = @MISSION_SOURCE_DIR@ +STRIP_FROM_PATH = @MISSION_SOURCE_DIR@ # Always include a standard set of CFE documentation in the input set # This is applicable to both users guide and detail design outputs -INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfs_versions.dox -INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/osal_fs.dox -INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/osal_timer.dox +INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfs_versions.dox +INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/osal_fs.dox +INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/osal_timer.dox FILE_PATTERNS = *.c *.cpp *.cc *.C *.h *.hh *.hpp *.H *.dox *.md RECURSIVE = YES @@ -61,7 +61,7 @@ PAPER_TYPE = letter #--------------------------------------------------------------------------- COMPACT_RTF = YES #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO HAVE_DOT = YES @@ -73,6 +73,6 @@ CALL_GRAPH = YES GRAPHICAL_HIERARCHY = NO MAX_DOT_GRAPH_DEPTH = 1000 #--------------------------------------------------------------------------- -# Configuration::additions related to the search engine +# Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO diff --git a/docs/src/cfe_es.dox b/docs/src/cfe_es.dox index fdb3cdcf4..593c41f3b 100644 --- a/docs/src/cfe_es.dox +++ b/docs/src/cfe_es.dox @@ -1,20 +1,20 @@ /** \page cfeesovr cFE Executive Services Overview - Executive Services (ES) is one of the five core Flight Executive components. - ES is the primary interface to the underlying Operating System, providing a - high level interface to system control facilities. The ES component is - responsible for starting up and restarting the cFE, starting up, shutting - down, and restarting cFE Applications, logging errors and performance data, - and providing a persistent memory store for cFE Applications. - - The interfaces to the ES task include the Ground Interface (commands and - telemetry) and the Application Programmer Interfaces (APIs). The ES task + Executive Services (ES) is one of the five core Flight Executive components. + ES is the primary interface to the underlying Operating System, providing a + high level interface to system control facilities. The ES component is + responsible for starting up and restarting the cFE, starting up, shutting + down, and restarting cFE Applications, logging errors and performance data, + and providing a persistent memory store for cFE Applications. + + The interfaces to the ES task include the Ground Interface (commands and + telemetry) and the Application Programmer Interfaces (APIs). The ES task interfaces to the OS through the OS Abstraction Layer (OSAL) and platform through the Platform Support Package (PSP). - The functionality provided by the ES task include Software Reset, - Application and Child Task Mangement, Basic File System, Performance Data + The functionality provided by the ES task include Software Reset, + Application and Child Task Mangement, Basic File System, Performance Data Collection, Critical Data Store, Memory Pool, System Log, Shell Command. For additional detail on Executive Services, see the following sections: @@ -44,7 +44,7 @@
  • \subpage cfeesugversion
  • \subpage cfeesugfaq
    - + **/ /** @@ -52,7 +52,7 @@ The following sections describe terminology that is very relevant to understanding the Executive Services: - +
    • \subpage cfeesugappterm
    • \subpage cfeesugtaskterm
      @@ -67,18 +67,18 @@ \page cfeesugappterm "Application" and "cFE Application"
      Application
      - + The term 'Application' as defined in the \ref cfeglossary is a set of data and functions that is treated as a single entity by the cFE. cFE resources are allocated on a per-Application basis. Applications are made up of a Main Task and zero or more Child Tasks.
      cFE Application
      - + A 'cFE Application' is an application that is external to the cFE and designed to interface to the cFE through the APIs. It is created through an entry in the \ref cfeesugstartupterm (with the 'Object Type' field set to CFE_APP) or - by way of the #CFE_ES_START_APP_CC ground command. + by way of the #CFE_ES_START_APP_CC ground command. When referring to one of the five applications internal to the cFE (ES, EVS, SB, TIME or TBL), the term 'Service' or 'Core Application' is typically used. @@ -163,24 +163,24 @@
    - Immediately after the cFE completes its initialization, the ES Application first - looks for the volatile startup script. The location in the file system is defined - by the cFE platform configuration parameter named #CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE. - This configuration parameter contains a path as well as a filename. If the file - is found, ES begins to startup the applications that are listed in the file. If + Immediately after the cFE completes its initialization, the ES Application first + looks for the volatile startup script. The location in the file system is defined + by the cFE platform configuration parameter named #CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE. + This configuration parameter contains a path as well as a filename. If the file + is found, ES begins to startup the applications that are listed in the file. If ES does not find the file, it attempts to open the #CFE_PLATFORM_ES_NONVOL_STARTUP_FILE. - - If ES finds the volatile startup script, the attempt to open the nonvolatile startup + + If ES finds the volatile startup script, the attempt to open the nonvolatile startup script is bypassed. - Any errors encountered in the startup script processing are written to the - \ref cfeesugsyslogsrv. The \ref cfeesugsyslogsrv + Any errors encountered in the startup script processing are written to the + \ref cfeesugsyslogsrv. The \ref cfeesugsyslogsrv may also contain positive acknowledge messages regarding the startup script processing. - The startup script delivered with the - cFE (cfe_es_startup.scr) also has some detailed information about the fields + The startup script delivered with the + cFE (cfe_es_startup.scr) also has some detailed information about the fields and the settings. - + Next: \ref cfeesugswreset
    Prev: \ref cfeesugappstart
    Up To: \ref cfeesugterm @@ -189,22 +189,22 @@ /** \page cfeesugswreset Software Reset - The ES Software Reset provides a command to + The ES Software Reset provides a command to \link #CFE_ES_RESTART_CC reset the cFE \endlink as well as \link #CFE_ES_RESTART_APP_CC resetting individual applications.\endlink - Because applications are dependent on the cFE services, it is not possible - to reset the cFE without affecting the applications. Therefore, a command to reset the - cFE will also reset every application that is running at the time the command is received. + Because applications are dependent on the cFE services, it is not possible + to reset the cFE without affecting the applications. Therefore, a command to reset the + cFE will also reset every application that is running at the time the command is received. - Also include is the Exception and Reset (ER) Log, which has a command for + Also include is the Exception and Reset (ER) Log, which has a command for \link #CFE_ES_WRITE_ER_LOG_CC dumping \endlink or \link #CFE_ES_CLEAR_ER_LOG_CC clearing \endlink the log and telemetry to show the number of entries in the log. In addition to the ER log, the user may find information about the most recent reset in the ES task housekeeping telemetry. - The ES Software Reset also provides a command to + The ES Software Reset also provides a command to \link #CFE_ES_SET_MAX_PR_COUNT_CC set the maximum number of processor resets \endlink - before ES issues a power-on reset. There is a corresponding 'processor resets' counter - in ES housekeeping telemetry that may be \link #CFE_ES_RESET_PR_COUNT_CC reset through another + before ES issues a power-on reset. There is a corresponding 'processor resets' counter + in ES housekeeping telemetry that may be \link #CFE_ES_RESET_PR_COUNT_CC reset through another ES command.\endlink Next: \ref cfeesugresettype
    @@ -215,17 +215,17 @@ /** \page cfeesugresettype Reset Types and Subtypes - The Reset Type is sent to the ground in the ES housekeeping packet and tells - how the current running version of the cFE was invoked. The possible Reset - Types expected in the telemetry field are #CFE_PSP_RST_TYPE_POWERON and - #CFE_PSP_RST_TYPE_PROCESSOR. There is a third Reset Type defined in the ES - code as #CFE_ES_APP_RESTART which applies only to restarting an individual - application and is covered in more detail in the section titled Application + The Reset Type is sent to the ground in the ES housekeeping packet and tells + how the current running version of the cFE was invoked. The possible Reset + Types expected in the telemetry field are #CFE_PSP_RST_TYPE_POWERON and + #CFE_PSP_RST_TYPE_PROCESSOR. There is a third Reset Type defined in the ES + code as #CFE_ES_APP_RESTART which applies only to restarting an individual + application and is covered in more detail in the section titled Application and Child Task. - The Reset Subtype is also sent in the ES housekeeping packet and gives more - detail about the type of reset that started the execution of the current - running version of the cFE. The possible Reset Subtypes are + The Reset Subtype is also sent in the ES housekeeping packet and gives more + detail about the type of reset that started the execution of the current + running version of the cFE. The possible Reset Subtypes are #CFE_PSP_RST_SUBTYPE_POWER_CYCLE, #CFE_PSP_RST_SUBTYPE_PUSH_BUTTON, #CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, #CFE_PSP_RST_SUBTYPE_HW_WATCHDOG, #CFE_PSP_RST_SUBTYPE_RESET_COMMAND, #CFE_PSP_RST_SUBTYPE_EXCEPTION, #CFE_PSP_RST_SUBTYPE_UNDEFINED_RESET, #CFE_PSP_RST_SUBTYPE_HWDEBUG_RESET, #CFE_PSP_RST_SUBTYPE_BANKSWITCH_RESET. @@ -238,24 +238,24 @@ /** \page cfeesugresetlog Exception and Reset (ER) Log - The Exception and Reset Log contains detailed information about past - resets and exceptions. To view the information the #CFE_ES_WRITE_ER_LOG_CC - command must be sent. This command will write the log to a binary file. - The path and filename may be specified in the command. If the filename - command field contains an empty string, the configuration parameter - #CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE is used to specify the path and filename. - Use the ground system to get the file and display the contents. There + The Exception and Reset Log contains detailed information about past + resets and exceptions. To view the information the #CFE_ES_WRITE_ER_LOG_CC + command must be sent. This command will write the log to a binary file. + The path and filename may be specified in the command. If the filename + command field contains an empty string, the configuration parameter + #CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE is used to specify the path and filename. + Use the ground system to get the file and display the contents. There is also a command to clear the ER log, #CFE_ES_CLEAR_ER_LOG_CC. - The size of the ER log is defined by the platform configuration parameter - #CFE_PLATFORM_ES_ER_LOG_ENTRIES This log is preserved after a processor reset and - held in the ES reset area. + The size of the ER log is defined by the platform configuration parameter + #CFE_PLATFORM_ES_ER_LOG_ENTRIES This log is preserved after a processor reset and + held in the ES reset area. - A count of the number of entries in the log is present in the ES - housekeeping telemetry. This count can be used with the configuration + A count of the number of entries in the log is present in the ES + housekeeping telemetry. This count can be used with the configuration parameter #CFE_PLATFORM_ES_ER_LOG_ENTRIES to calculate the fullness of the log. - The information contained in a single log entry is defined by the + The information contained in a single log entry is defined by the structure CFE_ES_ERLog_t. Next: \ref cfeesugappsrv
    @@ -266,20 +266,20 @@ /** \page cfeesugappsrv Application and Child Task Management - The ES Application and Child Task Management provides the user with full - control over starting and stopping applications as well as querying - information regarding applications, tasks and library routines. + The ES Application and Child Task Management provides the user with full + control over starting and stopping applications as well as querying + information regarding applications, tasks and library routines. - There is no command to start or stop a child task. Child tasks can - be controlled (started, stopped or deleted) only by the parent - application through an API call. + There is no command to start or stop a child task. Child tasks can + be controlled (started, stopped or deleted) only by the parent + application through an API call. - This provides a way for the user to load a set of library - routines, (via the startup script) without starting a corresponding - task. See the section related to library routines for more detail. + This provides a way for the user to load a set of library + routines, (via the startup script) without starting a corresponding + task. See the section related to library routines for more detail. - The ES task maintains a counter for the number of registered - applications, number of registered child tasks and the number of + The ES task maintains a counter for the number of registered + applications, number of registered child tasks and the number of registered libraries in the ES housekeeping data. Next: \ref cfeesugappstart
    @@ -290,29 +290,29 @@ /** \page cfeesugappstart Starting an Application - There are two ways to start an application, through the ground - command #CFE_ES_START_APP_CC or through the startup script. In - either case, the object file must be loaded on board before the - command is sent or before the startup script is executed. The - startup script contains a list of applications and library - routines to load and start immediately after the cFE finishes - its startup sequence. The parameters in the command, match the + There are two ways to start an application, through the ground + command #CFE_ES_START_APP_CC or through the startup script. In + either case, the object file must be loaded on board before the + command is sent or before the startup script is executed. The + startup script contains a list of applications and library + routines to load and start immediately after the cFE finishes + its startup sequence. The parameters in the command, match the elements of an entry in the startup script. - The format of the Start Application command, is defined in the + The format of the Start Application command, is defined in the structure #CFE_ES_StartAppCmd_t. The members of the structure - include, application name, entry point, filename, stack size, + include, application name, entry point, filename, stack size, load address, exception action and priority. - If the command fails for any reason, an error event will be sent - stating the reason for the failure. There may be additional - information in the system log that can be viewed by sending - the ES command to dump the system log. + If the command fails for any reason, an error event will be sent + stating the reason for the failure. There may be additional + information in the system log that can be viewed by sending + the ES command to dump the system log. - After starting an application, the ES task sends an informational - event message displaying the application name, filename of the - object and the application ID. The new application will then show - up in the query list downloaded in response to the + After starting an application, the ES task sends an informational + event message displaying the application name, filename of the + object and the application ID. The new application will then show + up in the query list downloaded in response to the #CFE_ES_QUERY_ALL_CC command. Next: \ref cfeesugappstop
    @@ -322,37 +322,37 @@ /** \page cfeesugappstop Stopping an Application - Stopping an application can be done through the ground command - #CFE_ES_STOP_APP_CC. This command will terminate the application - execution and all child tasks created by the application, free - the system resources that it allocated and delete the corresponding + Stopping an application can be done through the ground command + #CFE_ES_STOP_APP_CC. This command will terminate the application + execution and all child tasks created by the application, free + the system resources that it allocated and delete the corresponding object file. - The process of stopping an application is done in a controlled manner - when the application is properly using the return code from the call - to the #CFE_ES_RunLoop. When the application properly uses this function, - the ES task starts a timer and (via the return code) tells the - application to exit at its own convenience. This gives the application - time to free its own resources and do any cleanup that may be required - before terminating itself by calling CFE_ES_ExitApp. If the timer expires - and the application still exists, then ES must 'kill' the application. - When the application is killed, ES attempts to cleanup the applications - resources as best it could. In this case there is no guarantee that all + The process of stopping an application is done in a controlled manner + when the application is properly using the return code from the call + to the #CFE_ES_RunLoop. When the application properly uses this function, + the ES task starts a timer and (via the return code) tells the + application to exit at its own convenience. This gives the application + time to free its own resources and do any cleanup that may be required + before terminating itself by calling CFE_ES_ExitApp. If the timer expires + and the application still exists, then ES must 'kill' the application. + When the application is killed, ES attempts to cleanup the applications + resources as best it could. In this case there is no guarantee that all the system resources are properly released. - The format of the Stop Application command, is defined in the structure - #CFE_ES_AppNameCmd_t. The only parameter in the command is an application - name. + The format of the Stop Application command, is defined in the structure + #CFE_ES_AppNameCmd_t. The only parameter in the command is an application + name. - If the command fails for any reason, an error event will be sent stating - the reason for the failure. There may be additional information in the - system log that can be viewed by sending the ES command to dump the - system log. + If the command fails for any reason, an error event will be sent stating + the reason for the failure. There may be additional information in the + system log that can be viewed by sending the ES command to dump the + system log. - After stopping an application, the ES task sends a debug message stating - the name of the application. After executing the command, the application - (or any resources it allocated) should no longer be listed in any cFE - tables or files. + After stopping an application, the ES task sends a debug message stating + the name of the application. After executing the command, the application + (or any resources it allocated) should no longer be listed in any cFE + tables or files. Next: \ref cfeesugapprestart
    Prev: \ref cfeesugappstart
    @@ -372,8 +372,8 @@ When requested, ES stops the application, unloads the object file, loads the object file using the previous file name, and restarts an application using the parameters defined when the application was previously started, either through - the startup script or by way of the #CFE_ES_START_APP_CC command. - + the startup script or by way of the #CFE_ES_START_APP_CC command. + Next: \ref cfeesugappreload
    Prev: \ref cfeesugappstop
    Up To: \ref cfeesugappsrv @@ -387,7 +387,7 @@ This command performes the same actions as #CFE_ES_RESTART_APP_CC only using the new file. - + Next: \ref cfeesugapplist
    Prev: \ref cfeesugapprestart
    Up To: \ref cfeesugappsrv @@ -396,22 +396,22 @@ /** \page cfeesugapplist Listing Current Applications - There are two options for receiving information about applications, - the #CFE_ES_QUERY_ONE_CC command can be used to get details about a - single application. This command takes an application name as its - only parameter and the application information is sent as a software + There are two options for receiving information about applications, + the #CFE_ES_QUERY_ONE_CC command can be used to get details about a + single application. This command takes an application name as its + only parameter and the application information is sent as a software bus packet that can be telemetered to the ground. - + Or the #CFE_ES_QUERY_ALL_CC command can be used to get information about all the applications that are currently registered with ES. This command writes the application data to a file and has a one parameter which specifies the path and filename of the output file. - + For either command, the following Application information is made available: - +
    • Application ID - The Application ID assigned by the cFE to the Application
      -
    • Type Identifier - Identifies whether the Application is a CORE App +
    • Type Identifier - Identifies whether the Application is a CORE App or an EXTERNAL App
    • Name - The Application Name
    • Entry Point - The symbolic name for the entry point into the Application
      @@ -428,9 +428,9 @@
    • Main Task Name - The name of the main task associated with the Application
    • Number of Child Tasks - The number of child tasks spawned by the main task
    - - For a description of the format in which this data is dumped, see #CFE_ES_AppInfo_t. - + + For a description of the format in which this data is dumped, see #CFE_ES_AppInfo_t. + Next: \ref cfeesugtasklist
    Prev: \ref cfeesugappreload
    Up To: \ref cfeesugappsrv @@ -439,10 +439,10 @@ /** \page cfeesugtasklist Listing Current Tasks - The #CFE_ES_QUERY_ALL_TASKS_CC command is used to get a list of child + The #CFE_ES_QUERY_ALL_TASKS_CC command is used to get a list of child tasks that are currently registered with ES. The following information is provided for each registered task: - +
    • Task ID - The Task ID associated with the specified task
    • Task Name - The name of the Task
      @@ -451,8 +451,8 @@
    • Application Name - The name of the Application the Task is associated with
    - - + + Next: \ref cfeesugloadlibs
    Prev: \ref cfeesugapplist
    Up To: \ref cfeesugappsrv @@ -461,14 +461,14 @@ /** \page cfeesugloadlibs Loading Common Libraries - Library routines may be loaded only through the startup script. There - is an option that allows a library routine initialization function - to be executed after the library is loaded. Refer to the cFE Application - Developers Guide for more information regarding Library Routines and - startup scripts. The startup script delivered with the cFE - (cfe_es_startup.scr) also has some detailed information + Library routines may be loaded only through the startup script. There + is an option that allows a library routine initialization function + to be executed after the library is loaded. Refer to the cFE Application + Developers Guide for more information regarding Library Routines and + startup scripts. The startup script delivered with the cFE + (cfe_es_startup.scr) also has some detailed information about library routines. - + Next: \ref cfeesugfilesrv
    Prev: \ref cfeesugtasklist
    Up To: \ref cfeesugappsrv @@ -479,7 +479,7 @@ ES provides minimal functionality to initialize, read, and write cfe File headers. - + Next: \ref cfeesugperfsrv
    Prev: \ref cfeesugloadlibs
    Up To: \ref cfeesugappsrv @@ -492,11 +492,11 @@ information for each software application similar to how a logic analyzer can trigger and filter data. - API calls are inserted by the development team at key points in the - code. The basic operation is to start the data collection, wait - some amount of time, then send the command to stop the data - collection. When the stop command is received, the ES task writes - all the data from the buffer to a file. The file can then be + API calls are inserted by the development team at key points in the + code. The basic operation is to start the data collection, wait + some amount of time, then send the command to stop the data + collection. When the stop command is received, the ES task writes + all the data from the buffer to a file. The file can then be imported to analysis tools for viewing. The size of the buffer is configurable through the #CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE platform configuration parameter. @@ -519,14 +519,14 @@ \page cfeesugperftrig Performance Data Collection Trigger Masks The trigger mask is used to control - precisely when to start collecting the data. There is a bit in the - trigger mask for every marker used in the code. After a start command + precisely when to start collecting the data. There is a bit in the + trigger mask for every marker used in the code. After a start command is received, the trigger mask is read and dictates when to begin storing data in the buffer. - If the trigger mask is set to all zeros, then the collection will begin - immediately after the start command and continue until a stop command - is received. In this case the buffer behaves in a 'circular' manner. + If the trigger mask is set to all zeros, then the collection will begin + immediately after the start command and continue until a stop command + is received. In this case the buffer behaves in a 'circular' manner. Next: \ref cfeesugperfstart
    Prev: \ref cfeesugperfsrv
    @@ -545,7 +545,7 @@ Count' to zero. If this counter is zero, it is ok to send the start command. If any errors are encountered when the start command is received, the details will be displayed in an error event message. - + Next: \ref cfeesugperfstop
    Prev: \ref cfeesugperftrig
    Up To: \ref cfeesugperfsrv @@ -554,19 +554,19 @@ /** \page cfeesugperfstop Stopping the Collection of Performance Data - The #CFE_ES_STOP_PERF_DATA_CC command is used to stop the data collection - process and write the buffer data to a file. The path and filename may be - specified in the command. If the filename command field contains an empty - string, the configuration parameter #CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME is - used to specify the path and filename. The number of entries written to - the file is determined by the 'data count' variable, which is sent in the - ES housekeeping telemetry packet. To ensure cpu hogging does not occur - during the write process, ES creates a low priority child task to perform - the file write operation. This child task will write a number of entries, - then sleep for a short time to give tasks of lower priority a chance to - run. The number of entries between delays, and the delay time is displayed + The #CFE_ES_STOP_PERF_DATA_CC command is used to stop the data collection + process and write the buffer data to a file. The path and filename may be + specified in the command. If the filename command field contains an empty + string, the configuration parameter #CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME is + used to specify the path and filename. The number of entries written to + the file is determined by the 'data count' variable, which is sent in the + ES housekeeping telemetry packet. To ensure cpu hogging does not occur + during the write process, ES creates a low priority child task to perform + the file write operation. This child task will write a number of entries, + then sleep for a short time to give tasks of lower priority a chance to + run. The number of entries between delays, and the delay time is displayed in the debug event at the time the stop command is received. - + Next: \ref cfeesugperfview
    Prev: \ref cfeesugperfstart
    Up To: \ref cfeesugperfsrv @@ -575,10 +575,10 @@ /** \page cfeesugperfview Viewing the Collection of Performance Data - To view the performance data, the file created as a result of the stop + To view the performance data, the file created as a result of the stop command must be transferred to the ground and imported into a viewing tool. See https://github.com/nasa/perfutils-java as an example. - + Next: \ref cfeesugcdssrv
    Prev: \ref cfeesugperfstop
    Up To: \ref cfeesugperfsrv @@ -593,7 +593,7 @@ Application developer to design a mechanism for retaining software state information through a Processor Reset. The cFE provides the Critical Data Store to assist the developer in meeting these requirements. - + The Critical Data Store is an area of memory that is not cleared during a Processor Reset. In addition, the contents of memory are validated when accessed with a Data Integrity Value that helps to ensure the contents have not been corrupted. Each @@ -601,7 +601,7 @@ this area of memory in a number of ways to ensure the contents survive a Processor Reset. Applications can allocate a section of this memory for their use in a way similar to the \ref cfetblovr. - + When an Application registers a Critical Data Store (CDS), the Executive Services allocates a section of the Critical Data Store memory for the application's use and assigns the Application specified name to the memory area. The operator can find @@ -609,9 +609,9 @@ \link #CFE_ES_DUMP_CDS_REGISTRY_CC Dump CDS Registry Command. \endlink This command will dump the contents of the CDS Registry maintained by the Executive Services into a file that can be downlinked and examined by the operator. - + The CDS Registry dump will identify the following information for each registered CDS: - +
    • Handle - the numeric identifier used by an Application to access the contents of the CDS
      @@ -623,10 +623,10 @@ which Application registered the CDS. CDSName is the name the Application assigned to the CDS.
    - + The format of the CDS Registry Dump File is a cFE Standard File header (see #CFE_FS_Header_t) followed by one or more CDS Registry Dump File Records (see #CFE_ES_CDSRegDumpRec_t). - + Next: \ref cfeesugmempoolsrv
    Prev: \ref cfeesugperfsrv
    Up To: \ref cfeesovr @@ -634,23 +634,23 @@ /** \page cfeesugmempoolsrv Memory Pool - + Refer to the cFE Application Developers Guide for additional information. Applications that are designed for generic missions, frequently have to wait - until run-time before allocating memory for buffers, data records, etc. - + until run-time before allocating memory for buffers, data records, etc. + The cFE provides a memory allocation algorithm that may be used by an application to manage its block of memory. The user provides a pointer to its memory block and a list of block sizes and the cFE provides 'get' and 'put' - API's to the user for managing its memory pool. - + API's to the user for managing its memory pool. + Run-time memory allocation in an embedded system can be risky because of the potential problem of memory fragmentation. Memory fragmentation is also referred to as External Fragmentation and is defined in the wikipedia as: - + \verbatim - + External fragmentation is the phenomenon in which free storage becomes divided into many small pieces over time. It is a weakness of certain storage allocation algorithms, occurring when an application allocates and deallocates @@ -660,17 +660,17 @@ because it is divided into pieces that are too small to satisfy the demands of the application. The term "external" refers to the fact that the unusable storage is outside the allocated regions. - + \endverbatim - + To help prevent this from happening, the cFE has integrated a memory allocation algorithm that is designed to create blocks at run-time, based on the size of the blocks requested. After a reset, there are no blocks created, the memory pool is said to be unconfigured. As requests for memory blocks are made, the memory pool first tries to use blocks that have been created but are no longer in use. If it cannot find an available block, it will create a new - one. The created blocks remain until a reset occurs. - + one. The created blocks remain until a reset occurs. + This algorithm is recommended when the size of the requests and the peak rate of requests can be pre-determined. It is highly recommended that adequate margin is designed into the pool size. The memory pool should never get close @@ -679,23 +679,23 @@ fail, regardless of whether the created blocks are in-use or not. The margin on the memory pool can be monitored by viewing the 'free bytes' member of the memory pool statistics. The memory pool statistics are dumped only when - commanded by way of the ES command #CFE_ES_SEND_MEM_POOL_STATS_CC. - + commanded by way of the ES command #CFE_ES_SEND_MEM_POOL_STATS_CC. + A user of the ES memory pool begins by tailoring the memory pool for the particular use, by defining a list of block sizes and allocating a block of memory. These block size definitions simply give the memory pool a set of sizes to choose from. They do not configure the memory pool in any way and they do not affect the size of the pool. The cFE defines a default set of - block sizes in the cfe_platform_cfg.h file. - + block sizes in the cfe_platform_cfg.h file. + If the default block sizes are used, the application will create the pool using the simpler #CFE_ES_PoolCreate API. This API takes a pointer to the first byte of the memory pool (allocated by the application) and a size parameter. The API returns a handle to be used for the get and put requests. - + If the defaults are not sufficient, the user must define the block sizes and use the #CFE_ES_PoolCreateEx API. - + After receiving a positive response from the PoolCreate API, the memory pool is ready to accept requests, but at this point it is completely unconfigured (meaning there are no blocks created). The first valid request (via @@ -704,20 +704,20 @@ block depends on the size definitions mentioned earlier. If there is not an exact match between the requested and defined sizes, then the memory pool will create and return the smallest block that meets the following criteria: is a - defined size and large enough to hold the request. - + defined size and large enough to hold the request. + If another request for that size comes in before the first block was released through the #CFE_ES_PutPoolBuf API, then the memory pool will create a second block of that size and return a pointer to the second block. If both blocks were then released through the #CFE_ES_PutPoolBuf API and the memory pool statistics were dumped via the #CFE_ES_SEND_MEM_POOL_STATS_CC command, the number of blocks created would be two. The number of 'free bytes' in the pool would - be the size of the pool minus the sum of the following items: + be the size of the pool minus the sum of the following items: - the size of the two blocks created (even though they are not 'in-use'). - a buffer descriptor for each of the two blocks created (2 * 12 bytes) - a 168 byte pool descriptor Refer to the cFE Applications Developers Guide for more details. - + This allocation algorithm does have its limits. There are certain conditions that can place the memory pool in an undesired state. For instance, if a burst of get requests were received for the same block size, the memory pool may @@ -729,28 +729,28 @@ highly recommended that the memory pool statistics be carefully monitored to ensure that the 'free-bytes' margin is sufficient (which is typically dictated by mission requirements). - + An operator can obtain information about an Application's Memory Pool by using the \link #CFE_ES_SEND_MEM_POOL_STATS_CC Telemeter Memory Pool Statistics Command. \endlink - + This command will cause Executive Services to extract pertinent statistics from the data used to manage the Memory Pool and telemeter them to the ground in the \link #CFE_ES_MemStatsTlm_t Memory Pool Statistics Telemetry Packet. \endlink - + In order to obtain the statistics associated with a memory pool, the operator MUST have the correct Memory Handle as reported by the Application who owns the Memory Pool. It should be noted that an inappropriate Memory Pool - Handle can (and likely will) cause the system software to crash! + Handle can (and likely will) cause the system software to crash! Within the cFE itself, there are three cFE Core Applications that make use of the Executive Services Memory Pool API. These are Software Bus (SB), Event Services (EVS) and Table Services (TBL). Each of these cFE Core Applications report their memory pool handles in telemetry. - + The \link #CFE_ES_MemStatsTlm_t Memory Pool Statistics Telemetry Packet \endlink contains the following information: - +
    • Memory Pool Handle - the handle, as provided by the operator in the \link #CFE_ES_SEND_MEM_POOL_STATS_CC Telemeter Memory Pool Statistics Command. \endlink @@ -761,7 +761,7 @@
    • Number of Errors - The total number of errors encountered when a block was released
    • Number of Free Bytes - The total number of bytes in the Memory Pool that have never been allocated to a Memory Block
      -
    • Block Statistics - For each specified size of memory block (of which there are +
    • Block Statistics - For each specified size of memory block (of which there are #CFE_MISSION_ES_POOL_MAX_BUCKETS), the following statistics are kept
      • Block Size - The size, in bytes, of all blocks of this type
        @@ -771,7 +771,7 @@ previously but are no longer being used
    - + Next: \ref cfeesugsyslogsrv
    Prev: \ref cfeesugcdssrv
    Up To: \ref cfeesovr @@ -793,7 +793,7 @@ The size of the System log is defined by the platform configuration parameter #CFE_PLATFORM_ES_SYSTEM_LOG_SIZE. This log is preserved after a processor reset and - held in the ES reset area. + held in the ES reset area. A count of the number of entries in the log is present in the ES housekeeping telemetry. @@ -807,7 +807,7 @@ \page cfeesugversion Version Identification Version information is reported at startup, and upon receipt of a No-op command - + Next: \ref cfeesugfaq
    Prev: \ref cfeesugsyslogsrv
    Up To: \ref cfeesovr @@ -817,15 +817,15 @@ \page cfeesugfaq Executive Services Frequently Asked Questions - + Prev: \ref cfeesugversion
    Up To: \ref cfeesovr **/ -/** +/** \page cfeescmds cFE Executive Services Commands - The following is a list of commands that are processed by the cFE Executive Services Task. + The following is a list of commands that are processed by the cFE Executive Services Task. **/ /** diff --git a/docs/src/cfe_evs.dox b/docs/src/cfe_evs.dox index c15a0efea..9f0404320 100644 --- a/docs/src/cfe_evs.dox +++ b/docs/src/cfe_evs.dox @@ -1,9 +1,9 @@ /** \page cfeevsovr cFE Event Services Overview - - Event Services (EVS) provides centralized control for the processing of event messages - originating from the EVS task itself, other cFE core applications (ES, SB, TIME, and TBL), - and from cFE applications. Event messages are asynchronous messages that are used to + + Event Services (EVS) provides centralized control for the processing of event messages + originating from the EVS task itself, other cFE core applications (ES, SB, TIME, and TBL), + and from cFE applications. Event messages are asynchronous messages that are used to inform the operator of a significant event from within the context of a registered application or core service. EVS provides various ways to filter event messages in order to manage event message generation. @@ -11,9 +11,9 @@ Note for messages outside the context of a registered appliction (for example early in app initialization or if registration fails) #CFE_ES_WriteToSysLog can be used for reporting. - + For more information on cFE Event Services, see the following sections: - +
    • \subpage cfeevsugmsgformat
    • \subpage cfeevsuglog
      @@ -23,14 +23,14 @@
    • \subpage cfeevsugcounters
    • \subpage cfeevsugresetctrs
    • \subpage cfeevsugprocreset
      -
    • \subpage cfeevsugfaq
      +
    • \subpage cfeevsugfaq
    - + **/ /** - \page cfeevsugmsgformat Event Message Format - + \page cfeevsugmsgformat Event Message Format + Event messages are software bus messages that contain the following fields:
      @@ -49,35 +49,35 @@ from which the event was generated. Note that the Spacecraft ID is defined in the cfe_mission_cfg.h file; The Processor ID is defined in the appropriate cfe_platform_cfg.h file. - The Application Name refers to the Application that issued the event message + The Application Name refers to the Application that issued the event message as specified on application startup (either startup script or app start command). The Event ID is an Application unique number that identifies the event. - The Message is an ASCII text string describing the - event. Event messages may have parameters associated with the event message. - EVS formats the parameters such that they are part of the ASCII text string + The Message is an ASCII text string describing the + event. Event messages may have parameters associated with the event message. + EVS formats the parameters such that they are part of the ASCII text string that make up the event message. - In order to accommodate missions that have limited telemetry bandwidth, EVS - can be configured such that the ASCII text string part of the event message - is omitted, thus reducing the size of each event message. This is referred - to as Short Format; Event messages including the ASCII text string are referred - to as Long Format. The default setting is specified in the cfe_platform_cfg.h file. + In order to accommodate missions that have limited telemetry bandwidth, EVS + can be configured such that the ASCII text string part of the event message + is omitted, thus reducing the size of each event message. This is referred + to as Short Format; Event messages including the ASCII text string are referred + to as Long Format. The default setting is specified in the cfe_platform_cfg.h file. EVS also provides commands in order to set the mode (short or long). - Since the design of the cFE's Software Bus is based on run-time registration, no - predetermined message routing is defined, hence it is not truly correct to say - that events are generated as telemetry. Technically, EVS generates events in - the form of software bus messages. Applications such as Telemetry Output and - Data Storage can then subscribe to these messages making them telemetry. For - the purposes of this document, any references to telemetry assumes that a telemetry - application subscribes to the EVS event software bus message and routes it to the + Since the design of the cFE's Software Bus is based on run-time registration, no + predetermined message routing is defined, hence it is not truly correct to say + that events are generated as telemetry. Technically, EVS generates events in + the form of software bus messages. Applications such as Telemetry Output and + Data Storage can then subscribe to these messages making them telemetry. For + the purposes of this document, any references to telemetry assumes that a telemetry + application subscribes to the EVS event software bus message and routes it to the ground as telemetry. Note that short format event messages on the Software Bus have different message lengths than long form messages and do not include any part of the long format message string. - The EVS can be configured via ground command to send event messages out one or - more message ports. These message ports may include ports such as debug, console, - and UART. Messages sent out of the message ports will be in ASCII text format. + The EVS can be configured via ground command to send event messages out one or + more message ports. These message ports may include ports such as debug, console, + and UART. Messages sent out of the message ports will be in ASCII text format. This is generally used for lab purposes. Note that the event mode (short or long) does affect the event message content sent out these message ports. @@ -88,28 +88,28 @@ /** \page cfeevsuglog Local Event Log - - In addition to generating a software bus message, EVS logs the event message to a - Local Event Log. Note that this is an optional feature that must be enabled via - the cfe_platform_cfg.h file. The Local Event Log resides on the same processor - as the EVS which is used to store events without relying on an external bus. In - multi-processor cFE configurations the Local Event Buffer preserves event messages - during non-deterministic processor initialization sequences and during failure - scenarios. In order to obtain the contents of the Local Event Log, a command must - be sent to write the contents of the buffer to a file which can then be sent to the + + In addition to generating a software bus message, EVS logs the event message to a + Local Event Log. Note that this is an optional feature that must be enabled via + the cfe_platform_cfg.h file. The Local Event Log resides on the same processor + as the EVS which is used to store events without relying on an external bus. In + multi-processor cFE configurations the Local Event Buffer preserves event messages + during non-deterministic processor initialization sequences and during failure + scenarios. In order to obtain the contents of the Local Event Log, a command must + be sent to write the contents of the buffer to a file which can then be sent to the ground via a file transfer mechanism. Note that event messages stored in the EVS Local Event Log are always long format messages and are not affected by the event mode (short or long). - EVS provides a command in order to \link #CFE_EVS_CLEAR_LOG_CC clear the Local Event Log \endlink. + EVS provides a command in order to \link #CFE_EVS_CLEAR_LOG_CC clear the Local Event Log \endlink.

      Local Event Log Mode

      - EVS can be configured to control the Local Event Log to either discard or overwrite - the contents of the log when it becomes full. If the mode is set to overwrite, the - log is treated like a circular buffer, overwriting the oldest event message contained + EVS can be configured to control the Local Event Log to either discard or overwrite + the contents of the log when it becomes full. If the mode is set to overwrite, the + log is treated like a circular buffer, overwriting the oldest event message contained in the log first. This control is configured by default in the cfe_platform_cfg.h - file but can be modified by \link #CFE_EVS_SET_LOG_MODE_CC a command \endlink. + file but can be modified by \link #CFE_EVS_SET_LOG_MODE_CC a command \endlink. Next: \ref cfeevsugmsgcntrl
      @@ -119,15 +119,15 @@ /** \page cfeevsugmsgcntrl Event Message Control - - In order for an application to be serviced by EVS, it must be registered with EVS. - EVS provides various commands in order to control the event messages that are - generated as software bus messages. + + In order for an application to be serviced by EVS, it must be registered with EVS. + EVS provides various commands in order to control the event messages that are + generated as software bus messages.

      Event Message Control - By Type

      - The highest level of event message control that EVS provides is the ability to - enable and disable event message types. As mentioned above, there are four event + The highest level of event message control that EVS provides is the ability to + enable and disable event message types. As mentioned above, there are four event types. They are:
        @@ -137,66 +137,66 @@
      1. CRITICAL
      - When commands are sent to \link #CFE_EVS_ENABLE_EVENT_TYPE_CC enable \endlink - or \link #CFE_EVS_DISABLE_EVENT_TYPE_CC disable \endlink a particular type of event - message, ALL event messages of the specified type are affected. Typically, event - meesages of type DEBUG are disabled on-orbit. Note that EVS provides the capability - to affect multiple types within one command using a bit mask. Note also that the - configuration parameter #CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG in the cfe_platform_cfg.h file - specifies which event message types are enabled/disabled by default. + When commands are sent to \link #CFE_EVS_ENABLE_EVENT_TYPE_CC enable \endlink + or \link #CFE_EVS_DISABLE_EVENT_TYPE_CC disable \endlink a particular type of event + message, ALL event messages of the specified type are affected. Typically, event + meesages of type DEBUG are disabled on-orbit. Note that EVS provides the capability + to affect multiple types within one command using a bit mask. Note also that the + configuration parameter #CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG in the cfe_platform_cfg.h file + specifies which event message types are enabled/disabled by default.

      Event Message Control - By Application

      - Commands are available to \link #CFE_EVS_ENABLE_APP_EVENTS_CC enable \endlink and - \link #CFE_EVS_DISABLE_APP_EVENTS_CC disable \endlink the generation of event messages - for a particular application. The result is that ALL event messages for the specified + Commands are available to \link #CFE_EVS_ENABLE_APP_EVENTS_CC enable \endlink and + \link #CFE_EVS_DISABLE_APP_EVENTS_CC disable \endlink the generation of event messages + for a particular application. The result is that ALL event messages for the specified Application are affected (i.e. enabled or disabled). -

      Event Message Control - By Event Type for an Application

      +

      Event Message Control - By Event Type for an Application

      EVS also provides the capability to \link #CFE_EVS_ENABLE_APP_EVENT_TYPE_CC enable \endlink - / \link #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC disable \endlink an event type for a particular - application. Note that EVS provides the capability to affect multiple event types + / \link #CFE_EVS_DISABLE_APP_EVENT_TYPE_CC disable \endlink an event type for a particular + application. Note that EVS provides the capability to affect multiple event types within one command using a bit mask.

      Event Message Control - Individual Events

      - - There are two ways to control the generation of individual events depending on - whether the application's event message has been registered with EVS or not. + + There are two ways to control the generation of individual events depending on + whether the application's event message has been registered with EVS or not.

      Modifying a registered event message filter

      - When an application registers with EVS, the application has the option of specifying - the events that it wants to register for filtering along with the - \ref cfeevsugmsgfilter (only the Binary Filtering Scheme - exists currently). Note that applications are limited in the number of events that + When an application registers with EVS, the application has the option of specifying + the events that it wants to register for filtering along with the + \ref cfeevsugmsgfilter (only the Binary Filtering Scheme + exists currently). Note that applications are limited in the number of events that they can register for filtering (see #CFE_PLATFORM_EVS_MAX_EVENT_FILTERS in cfe_platform_cfg.h - for the mission defined limit). The filtering method uses a mask to determine if the - message is forwarded to the software bus, making it available in telemetry (see - \ref cfeevsugmsgfilter for a description on filtering). Commands are available to - \link #CFE_EVS_SET_FILTER_CC modify the filter mask \endlink for any registered event. + for the mission defined limit). The filtering method uses a mask to determine if the + message is forwarded to the software bus, making it available in telemetry (see + \ref cfeevsugmsgfilter for a description on filtering). Commands are available to + \link #CFE_EVS_SET_FILTER_CC modify the filter mask \endlink for any registered event. - An on-orbit mission, for example, might be experiencing a problem resulting in an - application's event message being repeatedly issued, flooding the downlink. If the - event message for the application is registered with EVS, then a command can be issued - to set the event message filter to the specified value in order to prevent flooding of - the downlink. + An on-orbit mission, for example, might be experiencing a problem resulting in an + application's event message being repeatedly issued, flooding the downlink. If the + event message for the application is registered with EVS, then a command can be issued + to set the event message filter to the specified value in order to prevent flooding of + the downlink.

      Adding/Removing an event message for filtering

      - Commands are also available to add filtering for those events that are not registered + Commands are also available to add filtering for those events that are not registered for filtering. Once an event is \link #CFE_EVS_ADD_EVENT_FILTER_CC registered for filtering \endlink, the filter can be modified (see above) or \link #CFE_EVS_DELETE_EVENT_FILTER_CC removed \endlink. - An on-orbit mission, for example, might be experiencing a problem resulting in a event - message being repeatedly issued, flooding the downlink. If the event message was not - registered with EVS for filtering then the ground can add (i.e. register) the offending - application's event for filtering (much like an application registers the event during - initialization). + An on-orbit mission, for example, might be experiencing a problem resulting in a event + message being repeatedly issued, flooding the downlink. If the event message was not + registered with EVS for filtering then the ground can add (i.e. register) the offending + application's event for filtering (much like an application registers the event during + initialization). - EVS also supports the ability to \link #CFE_EVS_DELETE_EVENT_FILTER_CC remove \endlink - (i.e. unregister) an application's event message. Once it is removed, the event will no - longer be filtered. Note that commands issued to disable events by event type, by application + EVS also supports the ability to \link #CFE_EVS_DELETE_EVENT_FILTER_CC remove \endlink + (i.e. unregister) an application's event message. Once it is removed, the event will no + longer be filtered. Note that commands issued to disable events by event type, by application or by event type for an application are still valid and could affect this particular event. @@ -207,34 +207,34 @@ /** \page cfeevsugmsgfilter Event Message Filtering - - EVS uses a hexadecimal bit mask that controls how often a message is filtered. An event's - filter mask is bit-wise ANDed with the event's event counter. There is one event counter - for each event ID. If the result of the ANDing is zero then the message is sent. + + EVS uses a hexadecimal bit mask that controls how often a message is filtered. An event's + filter mask is bit-wise ANDed with the event's event counter. There is one event counter + for each event ID. If the result of the ANDing is zero then the message is sent. Filter masks can be set so that one out of 1, 2, 4, 8 - events are sent. Some examples of - masks that use this pattern are: (0x0000, Every one), (0x0001, One of every 2), (0x0003, - One of every 4), and (0x0007, One of every 8. + events are sent. Some examples of + masks that use this pattern are: (0x0000, Every one), (0x0001, One of every 2), (0x0003, + One of every 4), and (0x0007, One of every 8. - Filter masks can also be set so that only the first n events are sent. For example, the - mask 0xFFFF generates one event message and then stops. Note that when the filter counter + Filter masks can also be set so that only the first n events are sent. For example, the + mask 0xFFFF generates one event message and then stops. Note that when the filter counter is reset to zero by command, this will restart the counting and enable n more events to be sent. Event messages will be filtered until CFE_EVS_MAX_FILTER_COUNT events of the filtered event ID from the application have been received. After this, the filtering will become locked - (no more of that event will be received by the ground) until the filter is either reset or + (no more of that event will be received by the ground) until the filter is either reset or deleted by ground command. This is to prevent the counter from rolling over, which would cause some filters to behave improperly. An event message will be sent when this maximum count is reached. - The following shows an example of how filtering works using a filter mask of x'0001', resulting + The following shows an example of how filtering works using a filter mask of x'0001', resulting in sending every other event:
        - packet x + packet x packet X+1 packet X+2 packet X+3 @@ -272,16 +272,16 @@ No Yes   -
      + - In this example, the ground uses a filter mask of x'FFFE' resulting in the first two + In this example, the ground uses a filter mask of x'FFFE' resulting in the first two events being sent and then no more.
        - packet x + packet x packet X+1 packet X+2 packet X+3 @@ -319,7 +319,7 @@ No No   -
      + See cfe_evs.h for predefined macro values which can be used for masks. @@ -330,12 +330,12 @@ /** \page cfeevsugregistry EVS Registry - - EVS maintains information on each registered application and all events registered - for an application. - + + EVS maintains information on each registered application and all events registered + for an application. + The registry contains the following information for each Registered Application: - +
      • Active Flag - If equal to FALSE (0), all events from this Application are Filtered
      • Event Count - Total number of events issued by this Application. Note that this value @@ -345,8 +345,8 @@
      • Mask - Binary Filter mask value (see \ref cfeevsugmsgfilter for an explanation)
      • Count - Current number of times this Event ID has been issued by this Application
      - - + + Next: \ref cfeevsugcounters
      Prev: \ref cfeevsugmsgfilter
      Up To: \ref cfeevsovr @@ -354,24 +354,24 @@ /** \page cfeevsugcounters EVS Counters - + There are 2 types of counters in EVS housekeeping telemetry: - +
      • Total events sent counter
      • Number of events sent for each Application
      - The difference is that the first one is the sum of all of the event messages sent. Both of these - represent events that are actually sent (by EVS to the software bus). If an event message is + The difference is that the first one is the sum of all of the event messages sent. Both of these + represent events that are actually sent (by EVS to the software bus). If an event message is filtered or disabled, neither counter is incremented. - - There are other counters available that show how many event messages were generated by an App, - however, these are only available for those events that are registered for filtering hence if you - have a message that is not registered for filtering and the message type (e.g. DEBUG) is disabled - then you won't know if the event was ever issued by an application. These counters are available + + There are other counters available that show how many event messages were generated by an App, + however, these are only available for those events that are registered for filtering hence if you + have a message that is not registered for filtering and the message type (e.g. DEBUG) is disabled + then you won't know if the event was ever issued by an application. These counters are available by sending a command to \link #CFE_EVS_WRITE_APP_DATA_FILE_CC write the EVS Application Data \endlink - and transferring the file to the ground. + and transferring the file to the ground. Next: \ref cfeevsugresetctrs
      @@ -381,19 +381,19 @@ /** \page cfeevsugresetctrs Resetting EVS Counters - + As far as reset commands, there are 4 commands available: - +
      1. \link #CFE_EVS_RESET_COUNTERS_CC Reset the total events sent counter \endlink
        -
      2. \link #CFE_EVS_RESET_APP_COUNTER_CC Reset the events sent counter for a particular Application \endlink - +
      3. \link #CFE_EVS_RESET_APP_COUNTER_CC Reset the events sent counter for a particular Application \endlink - e.g. reset the LC application events counter
        -
      4. \link #CFE_EVS_RESET_FILTER_CC Reset all of the event counters for a particular registered event for a +
      5. \link #CFE_EVS_RESET_FILTER_CC Reset all of the event counters for a particular registered event for a particular Application \endlink - e.g. Reset event counter for Event ID 5 for the LC Application.
        -
      6. \link #CFE_EVS_RESET_ALL_FILTERS_CC Reset all of the event counters for ALL registered events for - a particular App \endlink - e.g. Reset all registered event counters for LC.
        +
      7. \link #CFE_EVS_RESET_ALL_FILTERS_CC Reset all of the event counters for ALL registered events for + a particular App \endlink - e.g. Reset all registered event counters for LC.
      - + Note that there is currently no way to reset ALL of the events sent counters for all of the Apps with one command. @@ -404,12 +404,12 @@ /** \page cfeevsugprocreset Effects of a Processor Reset on EVS - - On a processor reset, the EVS Registry is cleared such that applications must re-register - with EVS in order to use EVS services. All counters are also cleared with the exceptions - of those listed below. - On a processor reset, the following EVS data is preserved (if the cFE is configured to + On a processor reset, the EVS Registry is cleared such that applications must re-register + with EVS in order to use EVS services. All counters are also cleared with the exceptions + of those listed below. + + On a processor reset, the following EVS data is preserved (if the cFE is configured to include an \ref cfeevsuglog): @@ -420,13 +420,13 @@
    • Local Event Log overflow counter
    - The Local Event Log Mode (overwrite/discard) is set to the configured value specified in the + The Local Event Log Mode (overwrite/discard) is set to the configured value specified in the cfe_platform_cfg.h file. The default value is Discard (1). Discard mode will guarantee the contents of the event log are preserved over a processor restart. - This provides the ground with the capability to write the Local Event Log to a file and + This provides the ground with the capability to write the Local Event Log to a file and transfer it to the ground in order to help debug a reset. - + Next: \ref cfeevsugfaq
    Prev: \ref cfeevsugresetctrs
    @@ -441,43 +441,43 @@ My telemetry stream is being flooded with the same event message. How do I make it stop?   - The most direct way to stop an event message from flooding your downlink - stream is to send a command to EVS to filter the offending event (see - \ref cfeevsugmsgcntrl or \link #CFE_EVS_SET_FILTER_CC \EVS_SETBINFLTRMASK \endlink). - In order to stop the event message from being sent, a bit mask of \c '0xFFFF' should - be used. If the event is not currently registered for filtering, the event message + The most direct way to stop an event message from flooding your downlink + stream is to send a command to EVS to filter the offending event (see + \ref cfeevsugmsgcntrl or \link #CFE_EVS_SET_FILTER_CC \EVS_SETBINFLTRMASK \endlink). + In order to stop the event message from being sent, a bit mask of \c '0xFFFF' should + be used. If the event is not currently registered for filtering, the event message must be added using the command \link #CFE_EVS_ADD_EVENT_FILTER_CC \EVS_ADDEVTFLTR \endlink. (Q) I filtered an event message and would now like to see it again. What do I do in order to see those events again?   - If the event message that you are interested is registered with EVS for filtering, + If the event message that you are interested is registered with EVS for filtering, then you have 2 options: - +
      -
    1. You can use the \link #CFE_EVS_SET_FILTER_CC \EVS_SETBINFLTRMASK \endlink command - using a bit mask of \c '0x0000' which will result in getting all of the events for +
    2. You can use the \link #CFE_EVS_SET_FILTER_CC \EVS_SETBINFLTRMASK \endlink command + using a bit mask of \c '0x0000' which will result in getting all of the events for that Event Id

      or

      -
    3. You can remove the registration of that event with EVS - (see \link #CFE_EVS_DELETE_EVENT_FILTER_CC \EVS_DELEVTFLTR \endlink).
      +
    4. You can remove the registration of that event with EVS + (see \link #CFE_EVS_DELETE_EVENT_FILTER_CC \EVS_DELEVTFLTR \endlink).
      Note that option (1) is the preferred method.
    (Q) What is the purpose of DEBUG event messages?   - Event message of type "DEBUG" are primarily used during flight software development - in order to provide information that is most likely not needed on orbit. Some commands - send debug event messages as verification that a command request was received. When - writing the EVS local event log to a file, for example, an event message of type DEBUG - is issued. On orbit, this event message is probably not needed. Instead, the command + Event message of type "DEBUG" are primarily used during flight software development + in order to provide information that is most likely not needed on orbit. Some commands + send debug event messages as verification that a command request was received. When + writing the EVS local event log to a file, for example, an event message of type DEBUG + is issued. On orbit, this event message is probably not needed. Instead, the command counter is used for command verification. (Q) How do I find out which events are registered for filtering?   EVS provides a command (\link #CFE_EVS_WRITE_APP_DATA_FILE_CC \EVS_WRITEAPPDATA2FILE \endlink) - which generates a file containing all of the applications that have registered with EVS and - all of the filters that are registered for each application. Note that EVS merely generates + which generates a file containing all of the applications that have registered with EVS and + all of the filters that are registered for each application. Note that EVS merely generates the file. The file must be transferred to the ground in order to view it. (Q) Why do I see event messages in my console window? @@ -496,11 +496,11 @@ Prev: \ref cfeevsugprocreset
    Up To: \ref cfeevsovr **/ - -/** + +/** ** \page cfeevscmds cFE Event Services Commands ** -** The following is a list of commands that are processed by the cFE Event Services Task. +** The following is a list of commands that are processed by the cFE Event Services Task. **/ /** diff --git a/docs/src/cfe_glossary.dox b/docs/src/cfe_glossary.dox index 6f2bf0c88..c0f8067b4 100644 --- a/docs/src/cfe_glossary.dox +++ b/docs/src/cfe_glossary.dox @@ -1,69 +1,69 @@ /** \page cfeglossary Glossary of Terms - +
    Term Definition
    \anchor cfeadg_application Application (or App) - A set of data and functions that is treated as a single entity - by the cFE. cFE resources are allocated on a per-Application - basis. Applications are made up of a Main Task and zero or + A set of data and functions that is treated as a single entity + by the cFE. cFE resources are allocated on a per-Application + basis. Applications are made up of a Main Task and zero or more Child Tasks.
    \anchor cfeadg_applicationid Application ID A processor unique reference to an Application.
    - NOTE: This is different from a CCSDS Application ID which is + NOTE: This is different from a CCSDS Application ID which is referred to as an "APID."
    \anchor cfeadg_api Application Programmer's Interface (API) - A set of routines, protocols, and tools for building software + A set of routines, protocols, and tools for building software applications
    \anchor cfeadg_psp Platform Support Package (PSP) - A collection of user-provided facilities that interface an OS - and the cFE with a specific hardware platform. The PSP is + A collection of user-provided facilities that interface an OS + and the cFE with a specific hardware platform. The PSP is responsible for hardware initialization.
    \anchor cfeadg_childtask Child Task - A separate thread of execution that is spawned by an + A separate thread of execution that is spawned by an Application's Main Task.
    \anchor cfeadg_command Command - A Software Bus Message defined by the receiving Application. - Commands can originate from other onboard Applications or + A Software Bus Message defined by the receiving Application. + Commands can originate from other onboard Applications or from the ground.
    \anchor cfeadg_cfe Core Flight Executive (cFE) - A runtime environment and a set of services for hosting FSW + A runtime environment and a set of services for hosting FSW Applications
    \anchor cfeadg_cds Critical Data Store (CDS) - A collection of data that is not modified by the OS or + A collection of data that is not modified by the OS or cFE following a Processor Reset.
    \anchor cfeadg_crc Cyclic Redundancy Check - A polynomial based method for checking that a data set + A polynomial based method for checking that a data set has remained unchanged from one time period to another.
    \anchor cfeadg_developer Developer Anyone who is coding a cFE Application.
    \anchor cfeadg_eventdata Event Data - Data describing an Event that is supplied to the cFE - Event Service. The cFE includes this data in an + Data describing an Event that is supplied to the cFE + Event Service. The cFE includes this data in an \ref cfeadg_eventmessage "Event Message".
    \anchor cfeadg_eventfilter Event Filter - A numeric value (bit mask) used to determine how - frequently to output an application Event Message + A numeric value (bit mask) used to determine how + frequently to output an application Event Message defined by its \ref cfeadg_eventid "Event ID".
    \anchor cfeadg_eventformatmode Event Format Mode - Defines the Event Message Format downlink option: short or long. + Defines the Event Message Format downlink option: short or long. The short format is used when there is limited telemetry bandwidth - and is binary. The long format is in ASCII and is used for + and is binary. The long format is in ASCII and is used for logging to a Local Event Log and to an Event Message Port.
    \anchor cfeadg_eventid Event ID @@ -71,17 +71,17 @@
    \anchor cfeadg_eventtype Event Type A numeric literal used to identify the type of an Application event. - An event type may be #CFE_EVS_EventType_DEBUG, #CFE_EVS_EventType_INFORMATION, + An event type may be #CFE_EVS_EventType_DEBUG, #CFE_EVS_EventType_INFORMATION, #CFE_EVS_EventType_ERROR, or #CFE_EVS_EventType_CRITICAL.
    \anchor cfeadg_eventmessage Event Message - A data item used to notify the user and/or an external - \ref cfeadg_application "Application" of a significant event. - Event Messages include a time-stamp of when the message was - generated, a processor unique identifier, an + A data item used to notify the user and/or an external + \ref cfeadg_application "Application" of a significant event. + Event Messages include a time-stamp of when the message was + generated, a processor unique identifier, an \ref cfeadg_applicationid "Application ID", the - \ref cfeadg_eventtype "Event Type" (DEBUG,INFO,ERROR or CRITICAL), - and \ref cfeadg_eventdata "Event Data". An Event Message can + \ref cfeadg_eventtype "Event Type" (DEBUG,INFO,ERROR or CRITICAL), + and \ref cfeadg_eventdata "Event Data". An Event Message can either be real-time or playback from a Local Event Log.
    **/ diff --git a/docs/src/cfe_sb.dox b/docs/src/cfe_sb.dox index 2dc795568..2212c01fe 100644 --- a/docs/src/cfe_sb.dox +++ b/docs/src/cfe_sb.dox @@ -72,7 +72,7 @@ from header implementation, often abbreviated as message ID, MsgId, or MID. Header and message identifier values should not be accessed directly to avoid implementation specific dependencies. - + Telemetry packets typically contain a timestamp that indicates when the packet was produced. Command packets typically contain a command code that identifies the particular type of command. @@ -506,7 +506,7 @@ How many copies of the message are performed in a typical message delivery?
      There is a single copy of the message performed when sending a message - (from the callers memory space) using CFE_SB_TransmitMsg. + (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 diff --git a/docs/src/cfe_tbl.dox b/docs/src/cfe_tbl.dox index e0aedb8a8..59121495f 100644 --- a/docs/src/cfe_tbl.dox +++ b/docs/src/cfe_tbl.dox @@ -22,14 +22,14 @@
  • \subpage cfetblugregistry
  • \subpage cfetblugtelemetry
  • \subpage cfetblugprocreset
    -
  • \subpage cfetblugfaq
    +
  • \subpage cfetblugfaq
    **/ /** \page cfetblugmanage Managing Tables - + In order to effectively manage tables, an operator needs to understand how cFE Applications manage tables from their end. There are a number of methods that cFE Applications typically use to manage their tables. Each method is appropriate based upon the nature of the contents @@ -38,7 +38,7 @@ cFE Applications are required to periodically check to see if their table is to be validated, updated (or in the case of dump-only tables, dumped). Most Applications perform this periodic management at the same time as housekeeping requests are processed. This table management is - performed by the cFE Application that "owns" a table (ie - the cFE Application that registered + performed by the cFE Application that "owns" a table (ie - the cFE Application that registered the table with cFE Table Services). It is possible for cFE Applications to "share" a table with other cFE Applications. An Application that shares a table does not typically perform any of the management duties associated with that table. @@ -112,7 +112,7 @@
  • \subpage cfetblugdumponly
    - + Next: \ref cfetblugsnglbuff
    Prev: \ref cfetblugmanage
    Up To: \ref cfetblovr @@ -134,10 +134,10 @@ Since inactive single buffered table images share a common resource, it may not be prudent for an operator to load an image and then delay on the image's activation for an extended period of time. - - Single buffered tables are allowed to be critical (see \ref cfetblugcritical), dump-only + + Single buffered tables are allowed to be critical (see \ref cfetblugcritical), dump-only (see \ref cfetblugdumponly) and/or have a user-defined address (see \ref cfetbluguserdef). - + Next: \ref cfetblugdblbuff
    Up To: \ref cfetblugtypes **/ @@ -150,23 +150,23 @@ table data. With a dedicated inactive table image available, double buffered tables are then capable of efficiently swapping table contents and/or delaying the activation of a table's contents for an indeterminate amount of time. - + Some cFE Applications prefer to delay the Activation of a table until a specified time (e.g. - a Spacecraft Ephemeris). These tables are typically defined as double buffered tables so that the Inactive image can be left sitting untouched for an extended period of time without interfering with shared resources for other tables. Then the Application can perform the Update when the time is right. - + Applications which have unusually large tables may decide to conserve memory resources by making them double buffered. This is because the shared buffers used by single buffered tables must be sized to match the largest table. If there is one table that is unusually large, there is little reason to allocate up to #CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS number of buffers that size. A double buffered table will only allocate ONE extra buffer of that size. - + Performance minded Applications that are required to perform processing with tight timing deadlines may choose to use double buffered tables because the Update for a double buffered table is deterministic and quick. - + Next: \ref cfetblugvalfunc
    Prev: \ref cfetblugsnglbuff
    Up To: \ref cfetblugtypes @@ -174,15 +174,15 @@ /** \page cfetblugvalfunc Tables with Validation Functions - + Applications that associate Validation Functions with their tables when the tables are registered are effectively requiring that the contents of a table be logically Validated before it is Activated. The cFE will refuse to let a table with an associated Validation Function be Activated until a successful Validation on the Inactive table image has occurred. - + Tables that are NOT assigned a Validation Function are assumed to be valid regardless of the contents of the table image. These tables do not require a Validation Command prior to Activation. - + Next: \ref cfetblugcritical
    Prev: \ref cfetblugdblbuff
    Up To: \ref cfetblugtypes @@ -190,15 +190,15 @@ /** \page cfetblugcritical Critical Tables - + Applications that must be able to recover quickly from a Processor Reset may select the "Critical" table option when registering their table. Table Services automatically creates a Critical Data Store for the table and ensures that the contents of the Critical Data Store are updated whenever a Table Activation occurs. - + If a Processor Reset happens, when the Application attempts to Register the table again, Table Services automatically locates the associated Critical Data Store and initializes the Table with the saved contents. - + Next: \ref cfetbluguserdef
    Prev: \ref cfetblugvalfunc
    Up To: \ref cfetblugtypes @@ -206,18 +206,18 @@ /** \page cfetbluguserdef User Defined Address Tables - + In order to provide a mechanism for Flight Software Maintenance teams to quickly create a table image for dumping contents of memory that isn't normally loaded by the ground, there is an option to create User-Defined Address tables. These tables, when they are first registered, provide a memory address where the Active image of the table is to be maintained. Normally, the address is specified by Table Services from its memory pool. - + By specifying the address, the Flight Software Maintenance team can create a Dump-Only table that contains the contents of a data structure that is not normally accessible via telemetry or table dumps. Then, on command, the Flight Software Maintenance team can periodically dump the data structure's contents to an on-board file(s) that can then be transferred to the ground for later analysis. - + Next: \ref cfetblugdumponly
    Prev: \ref cfetblugcritical
    Up To: \ref cfetblugtypes @@ -225,19 +225,19 @@ /** \page cfetblugdumponly Dump Only Tables - + On occasion, cFE Applications require a segment of memory in which the Application writes data. The typical cFE Table is not normally modified directly by an Application but only via Load and Activate commands from either the Ground or Stored Command Processor. However, for those situations where an Application wishes to modify the contents of a data structure and the Application is limited in its telemtry bandwidth so that the modified data cannot be telemetered, the Application can create a Dump-Only table. - + Dump-Only tables are not allowed to be modified via the Load/Validate/Activate process most other tables are. They are only supposed to be modified by onboard Applications. The Operator can still command a Dump which will be processed by the table's owning Application when it manages its tables. By letting the Application perform the dump, the Operator can feel confident that the table contents are a complete snapshot in time and not corrupted by taking a snapshot while the Application was in the process of modifying its contents. - + Next: \ref cfetblugregistry
    Prev: \ref cfetbluguserdef
    Up To: \ref cfetblugtypes @@ -245,10 +245,10 @@ /** \page cfetblugregistry Table Registry - + When Applications register tables, Table Services retains pertinent information on the table in the Table Registry. The following information (along with other information that is less important for an operator) is kept for each table: - +
    • The Application ID of the Application that Registered the table
    • The full name of the table @@ -265,7 +265,7 @@
    • The filename of the last file loaded into the table
    • The File Creation Time for the last file used to load the contents of the table
    - + This information can be obtained by either sending the Dump Registry command which will put all of the information from the Table Registry into an onboard file for later downlink or the operator can send a command to Telemeter the Registry Entry for a single table. This will cause the pertinent registry entry @@ -277,7 +277,7 @@ failed to register the table but nothing related to why the restoration from CDS might have failed. There is, however, a message written to the System Error Log by Table Services that can be dumped by the ground to get this information. Note that failure to restore a table from CDS is not an expected error and - requires some sort of data corruption to occur. + requires some sort of data corruption to occur. Next: \ref cfetblugtelemetry
    Prev: \ref cfetblugtypes
    @@ -286,12 +286,12 @@ /** \page cfetblugtelemetry Table Services Telemetry - + Table Services produces two different telemetry packets. The first packet, referred to as the Table Services Housekeeping Packet, is routinely produced by Table Services upon receipt of the Housekeeping Request message that is typically sent to all Applications by an on board scheduler. The contents and format of this packet are described in detail at #CFE_TBL_HousekeepingTlm_t. - + Next: \ref cfetblugprocreset
    Prev: \ref cfetblugregistry
    Up To: \ref cfetblovr @@ -299,17 +299,17 @@ /** \page cfetblugprocreset Effects of Processor Reset on Tables - + When a processor resets, the Table Registry is re-initialized. All Applications must, therefore, re-register and re-initialize their tables. The one exception, however, is if the Application has previously tagged a table as "Critical" during Table Registration, then Table Services will attempt to locate a table image for that table stored in the Critical Data Store. Table Services also attempts to locate the Critical Table Registry which is also maintained in the Critical Data Store. - + If Table Services is able to find a valid table image for a Critical table in the Critical Data Store, the contents of the table are automatically loaded into the table and the Application is notified that the table does not require additional initialization. - + Next: \ref cfetblugfaq
    Prev: \ref cfetblugtelemetry
    Up To: \ref cfetblovr @@ -317,17 +317,17 @@ /** \page cfetblugfaq Frequently Asked Questions about Table Services - +
    (Q) Is it an error to load a table image that is smaller than the registered size?
      Table images that are smaller than the declared size of a table fall into one of two categories. - + If the starting offset of the table image (as specified in the Table Image secondary file header) is not equal to zero, then the table image is considered to be a "partial" table load. Partial loads are valid as long as a table has been previously loaded with a non-"partial" table image. - + If the starting offset of the table image is zero and the size is less than the declared size of the table, the image is considered "short" but valid. This feature allows application developers to use variable length tables. @@ -343,8 +343,8 @@
    (Q) What commands do I use to load a table with a new image?
      - There are a number of steps required to load a table. - -# The operator needs to create a cFE Table Services compatible table image file with the + There are a number of steps required to load a table. + -# The operator needs to create a cFE Table Services compatible table image file with the desired data contained in it. This can be accomplished by creating a 'C' source file, compiling it with the appropriate cross compiler for the onboard platform and then running the elf2cfetbl utility on the resultant object file. @@ -357,64 +357,64 @@ results of the validation are reported in Table Services Housekeeping Telemetry. If a table does not have a validation function associated with it, the operator may wish to compare the computed CRC to verify the table contents match what was intended. - -# Upon successful validation, the operator then sends the + -# Upon successful validation, the operator then sends the \link #CFE_TBL_ACTIVATE_CC Activate Command. \endlink The application owning the table should, within a reasonable amount of time, perform a table update and send an event message.
    (Q) What causes cFE Table Services to generate the following sys log message: - + CFE_TBL:GetAddressInternal-App(\%d) attempt to access unowned Tbl Handle=\%d
      - When an application sharing its table(s) with one or more applications is reloaded, the reloaded application's - table handle(s) are released. cFE Table Services sees that the table(s) are shared and keeps a 'shadow' version - of the table in the Table Services registry. The registry will show the released, shared tables with no name. - When the applications sharing the table attempt to access the table via the 'old', released handle, Table Services - will return an error code to the applications and generate the sys log message. The applications may then unregister - the 'old' handle(s) in order to remove the released, shared table(s) from the Table Services registry and share the + When an application sharing its table(s) with one or more applications is reloaded, the reloaded application's + table handle(s) are released. cFE Table Services sees that the table(s) are shared and keeps a 'shadow' version + of the table in the Table Services registry. The registry will show the released, shared tables with no name. + When the applications sharing the table attempt to access the table via the 'old', released handle, Table Services + will return an error code to the applications and generate the sys log message. The applications may then unregister + the 'old' handle(s) in order to remove the released, shared table(s) from the Table Services registry and share the newly loaded application table(s).
    (Q) When does the Table Services Abort Table Load command need to be issued?
      - The Abort command should be used whenever a table image has been loaded but the application has not yet activated it and + The Abort command should be used whenever a table image has been loaded but the application has not yet activated it and the operator no longer wants the table to be loaded. - - The purpose of the Abort command is to free a previously allocated table buffer. It should be noted, however, that multiple - table loads to the SAME table without an intervening activation or abort, will simply OVERWRITE the previous table load using + + The purpose of the Abort command is to free a previously allocated table buffer. It should be noted, however, that multiple + table loads to the SAME table without an intervening activation or abort, will simply OVERWRITE the previous table load using the SAME buffer. - + Therefore, the most likely scenarios that would lead to a needed abort are as follows: - +
    1. Operator loads a table and realizes immediately that the load is not wanted.
    2. - -
    3. Operator loads a table and performs a validation on it. Regardless of whether - the table passes or fails the validation, if the operator no longer wants to - activate the table, the abort command should be issued. - - It should be noted that a table image that fails activation is retained in the - inactive buffer for diagnosis, if necessary. It is NOT released until it is + +
    4. Operator loads a table and performs a validation on it. Regardless of whether + the table passes or fails the validation, if the operator no longer wants to + activate the table, the abort command should be issued. + + It should be noted that a table image that fails activation is retained in the + inactive buffer for diagnosis, if necessary. It is NOT released until it is aborted or overwritten and successfully validated and activated.
    5. - -
    6. A table image was loaded; the image was successfully validated; the command for - activation was sent; but the application fails to perform the activation. - - The Abort command will free the table buffer and clear the activation request. - - This situation can occur when either the application is improperly designed and - fails to adequately manage its tables (sometimes seen in the lab during development) + +
    7. A table image was loaded; the image was successfully validated; the command for + activation was sent; but the application fails to perform the activation. + + The Abort command will free the table buffer and clear the activation request. + + This situation can occur when either the application is improperly designed and + fails to adequately manage its tables (sometimes seen in the lab during development) or the application is "hung" and not performing as it should.
    - + Prev: \ref cfetblugprocreset
    Up To: \ref cfetblovr **/ -/** +/** ** \page cfetblcmds cFE Table Services Commands ** -** The following is a list of commands that are processed by the cFE Table Services Task. +** The following is a list of commands that are processed by the cFE Table Services Task. **/ /** diff --git a/docs/src/cfe_time.dox b/docs/src/cfe_time.dox index aa5ed060b..f12ffa796 100644 --- a/docs/src/cfe_time.dox +++ b/docs/src/cfe_time.dox @@ -1,19 +1,19 @@ /** \page cfetimeovr cFE Time Services Overview - The cFE Time Service (TIME) is one of the cFE core services. TIME provides time - correlation, distribution and synchronization services. TIME exists in two varieties: - a Time Server responsible for maintaining the master time reference for all remote systems, + The cFE Time Service (TIME) is one of the cFE core services. TIME provides time + correlation, distribution and synchronization services. TIME exists in two varieties: + a Time Server responsible for maintaining the master time reference for all remote systems, and a Time Client responsible for synchronizing to that master time reference. - Since TIME is a generic implementation aimed to meet the needs of a variety of - mission configurations, there are numerous configuration parameters, which dictate - the behavior of TIME (see cfe_mission_cfg.h and cfe_platform_cfg.h for the specific - mission configuration). + Since TIME is a generic implementation aimed to meet the needs of a variety of + mission configurations, there are numerous configuration parameters, which dictate + the behavior of TIME (see cfe_mission_cfg.h and cfe_platform_cfg.h for the specific + mission configuration). - With the exception of those sections specific to Time Clients and Servers, this - document assumes the most common physical environment - one instantiation of cFE - installed on a single processor. Therefore, TIME represents cFE Time Services + With the exception of those sections specific to Time Clients and Servers, this + document assumes the most common physical environment - one instantiation of cFE + installed on a single processor. Therefore, TIME represents cFE Time Services configured as a Time Server. For additional detail on Time Services and how to manage it, see the following sections: @@ -57,7 +57,7 @@
  • \subpage cfetimeugsetmet
    -
  • \subpage cfetimeugfaq
    +
  • \subpage cfetimeugfaq
    **/ @@ -65,55 +65,55 @@ /** \page cfetimeugcomponents Time Components - Time knowledge is stored in several pieces, so that the time information can more + Time knowledge is stored in several pieces, so that the time information can more easily be manipulated and utilized. These components include: - The Ground Epoch is an arbitrary date and time that establishes the zero point - for spacecraft time calculations. The selection of the epoch is mission specific, - although in the past, it was common to select the same epoch as defined for the - Operating System used by the computers hosting the ground system software. Recent - mission epoch selections have also included using zero seconds after midnight, - Jan 1, 2001. - - Spacecraft Time is the number of seconds (and fraction of a second) since the - ground epoch. Spacecraft time is the sum of Mission Elapsed Time (MET) and the - Spacecraft Time Correlation Factor (STCF). By definition, MET is a measure of - time since launch or separation. However, for most missions the MET actually - represents the amount of time since powering on the hardware containing the MET + The Ground Epoch is an arbitrary date and time that establishes the zero point + for spacecraft time calculations. The selection of the epoch is mission specific, + although in the past, it was common to select the same epoch as defined for the + Operating System used by the computers hosting the ground system software. Recent + mission epoch selections have also included using zero seconds after midnight, + Jan 1, 2001. + + Spacecraft Time is the number of seconds (and fraction of a second) since the + ground epoch. Spacecraft time is the sum of Mission Elapsed Time (MET) and the + Spacecraft Time Correlation Factor (STCF). By definition, MET is a measure of + time since launch or separation. However, for most missions the MET actually + represents the amount of time since powering on the hardware containing the MET timer. The STCF correlates the MET to the ground epoch. - The Tone is the signal that MET seconds have incremented. In most hardware - configurations, the tone is synonymous with the 1 PPS signal. The tone signal - may be generated by a local hardware timer, or by an external event (GPS receiver, - spacewire time tick, 1553 bus signal, etc). TIME may also be configured to - simulate the tone for lab environments that do not have the necessary hardware - to provide a tone signal. Note that MET sub-seconds will be zero at the instant - of the tone. + The Tone is the signal that MET seconds have incremented. In most hardware + configurations, the tone is synonymous with the 1 PPS signal. The tone signal + may be generated by a local hardware timer, or by an external event (GPS receiver, + spacewire time tick, 1553 bus signal, etc). TIME may also be configured to + simulate the tone for lab environments that do not have the necessary hardware + to provide a tone signal. Note that MET sub-seconds will be zero at the instant + of the tone. Time at the Tone is the spacecraft time at the most recent "valid" tone. - Time since the Tone is the amount of time since the tone (usually less than one - second). This value is often measured using the local processor clock. Upon - detecting the tone signal, TIME stores the contents of the local processor clock + Time since the Tone is the amount of time since the tone (usually less than one + second). This value is often measured using the local processor clock. Upon + detecting the tone signal, TIME stores the contents of the local processor clock to facilitate this measurement. - Thus, Current Spacecraft Time is the sum of "time at the tone" and + Thus, Current Spacecraft Time is the sum of "time at the tone" and "time since the tone". - Leap Seconds occur to keep clocks correlated to astronomical observations. The - modern definition of a second (9,192,631,770 oscillations of a cesium-133 atom) - is constant while the earth's rotation has been slow by a small fraction of a - second per day. The International Earth Rotation and Reference System Service - (IERS) maintains the count of leap seconds as a signed whole number that is - subject to update twice a year. Although it is possible to have a negative - leap second count if the earth rotates too fast, it is highly unlikely. The initial - count of leap seconds (10) was established in January of 1972 and the first leap second - was added to the initial count in June of 1972. The most recent leap seconds are announced - by the International Earth Rotation Service (IERS): - https://www.iers.org in IERS Bulletin C (leap second announcements). Search the IERS site - for "Bulletin C" to obtain the latest issue/announcement. - - + Leap Seconds occur to keep clocks correlated to astronomical observations. The + modern definition of a second (9,192,631,770 oscillations of a cesium-133 atom) + is constant while the earth's rotation has been slow by a small fraction of a + second per day. The International Earth Rotation and Reference System Service + (IERS) maintains the count of leap seconds as a signed whole number that is + subject to update twice a year. Although it is possible to have a negative + leap second count if the earth rotates too fast, it is highly unlikely. The initial + count of leap seconds (10) was established in January of 1972 and the first leap second + was added to the initial count in June of 1972. The most recent leap seconds are announced + by the International Earth Rotation Service (IERS): + https://www.iers.org in IERS Bulletin C (leap second announcements). Search the IERS site + for "Bulletin C" to obtain the latest issue/announcement. + + Next: \ref cfetimeugstruct
    Up To: \ref cfetimeovr **/ @@ -121,12 +121,12 @@ /** \page cfetimeugstruct Time Structure - The cFE implementation of the System Time Structure is a modified version of the - CCSDS Unsegmented Time Code (CUC) which includes 4 bytes of seconds, and 4 bytes of - subseconds, where a subsecond is equivalent to 1/(2^32) seconds. The system time - structure is used by TIME to store current time, time at the tone, time since the + The cFE implementation of the System Time Structure is a modified version of the + CCSDS Unsegmented Time Code (CUC) which includes 4 bytes of seconds, and 4 bytes of + subseconds, where a subsecond is equivalent to 1/(2^32) seconds. The system time + structure is used by TIME to store current time, time at the tone, time since the tone, the MET, the STCF and command arguments for time adjustments. Note that typically - the 32 bits of seconds and the upper 16 bits of subseconds are used for time stamping + the 32 bits of seconds and the upper 16 bits of subseconds are used for time stamping Software bus messages, but this is dependent on the underlying defintion. The system time structure is defined as follows: @@ -138,7 +138,7 @@ } CFE_TIME_SysTime_t; \endverbatim - + Next: \ref cfetimeugformat
    Prev: \ref cfetimeugcomponents
    Up To: \ref cfetimeovr @@ -147,37 +147,37 @@ /** \page cfetimeugformat Time Formats - International Atomic Time (TAI) is one of two time formats supported by cFE TIME. - TAI is the number of seconds and sub-seconds elapsed since the ground epoch as measured - with the atomic clock previously described. TAI has no reference to leap seconds and is - calculated using the following equation: + International Atomic Time (TAI) is one of two time formats supported by cFE TIME. + TAI is the number of seconds and sub-seconds elapsed since the ground epoch as measured + with the atomic clock previously described. TAI has no reference to leap seconds and is + calculated using the following equation: \verbatim - TAI = MET + STCF + TAI = MET + STCF \endverbatim - - It should be noted that TAI is only "true" TAI when the selected ground epoch is the same - as the TAI epoch (zero seconds after midnight, January 1, 1958). However, nothing precludes - configuring cFE TIME to calculate time in the TAI format and setting the STCF to correlate + + It should be noted that TAI is only "true" TAI when the selected ground epoch is the same + as the TAI epoch (zero seconds after midnight, January 1, 1958). However, nothing precludes + configuring cFE TIME to calculate time in the TAI format and setting the STCF to correlate to any other epoch definition. - Coordinated Universal Time (UTC) is the other time format supported by cFE TIME. UTC - differs from TAI in the fact that UTC includes a leap seconds adjustment. TIME computes UTC - using the following equation: + Coordinated Universal Time (UTC) is the other time format supported by cFE TIME. UTC + differs from TAI in the fact that UTC includes a leap seconds adjustment. TIME computes UTC + using the following equation: \verbatim UTC = TAI - Leap Seconds. \endverbatim - - The preceding UTC equation might seem to imply that TAI includes leap seconds and UTC does - not - which is not the case. In fact, the UTC calculation includes a leap seconds adjustment - that subtracts leap seconds from the same time components used to create TAI. Alternatively, + + The preceding UTC equation might seem to imply that TAI includes leap seconds and UTC does + not - which is not the case. In fact, the UTC calculation includes a leap seconds adjustment + that subtracts leap seconds from the same time components used to create TAI. Alternatively, it might be less confusing to express the UTC equation as follows: \verbatim UTC = MET + STCF - Leap Seconds \endverbatim - + Next: \ref cfetimeugconfig
    Prev: \ref cfetimeugcomponents
    @@ -187,46 +187,46 @@ /** \page cfetimeugconfig Time Configuration - All configurations of TIME require a local processor source for a 1Hz interrupt and access - to a local clock with a resolution fine enough that it can be used to measure short periods - of elapsed time. The local interrupt is used to wake-up TIME at a regular interval for the - purpose of verifying that the tone is being received. The local clock is used to measure - time since the tone and to provide coarse verification that the tone is occurring at - approximately one second intervals. The presumption is that the tone is the most accurate - timer in the system and, within reason, is to be trusted. Note that nothing precludes the - use of the MET as the local clock, assuming the MET is both local and provides sub-second + All configurations of TIME require a local processor source for a 1Hz interrupt and access + to a local clock with a resolution fine enough that it can be used to measure short periods + of elapsed time. The local interrupt is used to wake-up TIME at a regular interval for the + purpose of verifying that the tone is being received. The local clock is used to measure + time since the tone and to provide coarse verification that the tone is occurring at + approximately one second intervals. The presumption is that the tone is the most accurate + timer in the system and, within reason, is to be trusted. Note that nothing precludes the + use of the MET as the local clock, assuming the MET is both local and provides sub-second data. However, the tone must not be used as the source for the local 1Hz interrupt. - Consider the following brief description of three hypothetical hardware configurations. - These sample systems may be used as reference examples to help clarify the descriptions + Consider the following brief description of three hypothetical hardware configurations. + These sample systems may be used as reference examples to help clarify the descriptions of the various TIME configuration selections. - In the first system, there is no MET timer and therefore no tone signal. The MET is a count - of the number of "fake" tones generated by TIME software. There is no validation performed - regarding the quality of time data. This hardware configuration is a common lab environment + In the first system, there is no MET timer and therefore no tone signal. The MET is a count + of the number of "fake" tones generated by TIME software. There is no validation performed + regarding the quality of time data. This hardware configuration is a common lab environment using COTS equipment. - In the second system, the MET timer is a hardware register that is directly accessible by TIME. - When MET seconds increment, a processor interrupt signals the tone. Upon detecting the tone, - TIME can read the MET to establish the time at the tone. To verify that the tone is valid, - TIME need only validate that this tone signal occurred approximately one second after the + In the second system, the MET timer is a hardware register that is directly accessible by TIME. + When MET seconds increment, a processor interrupt signals the tone. Upon detecting the tone, + TIME can read the MET to establish the time at the tone. To verify that the tone is valid, + TIME need only validate that this tone signal occurred approximately one second after the previous tone signal (as measured with the local clock). - In the third system, the MET is located on hardware connected via spacewire. When MET seconds - increment, a spacewire time tick triggers a local processor interrupt to signal the tone. - Shortly after announcing the tone, the hardware containing the MET also generates a spacewire + In the third system, the MET is located on hardware connected via spacewire. When MET seconds + increment, a spacewire time tick triggers a local processor interrupt to signal the tone. + Shortly after announcing the tone, the hardware containing the MET also generates a spacewire data packet containing the MET value corresponding to the tone. TIME must wait until both - the tone and data packet have been received before validating the tone. The tone must have - occurred approximately one second after the previous tone signal and the data packet must + the tone and data packet have been received before validating the tone. The tone must have + occurred approximately one second after the previous tone signal and the data packet must have been received within a specified window in time following the tone. - The hardware design choice for how the tone signal is distributed is not material to TIME - configuration. The software detecting the tone need only call the cFE API function announcing + The hardware design choice for how the tone signal is distributed is not material to TIME + configuration. The software detecting the tone need only call the cFE API function announcing the arrival of the tone. This function is designed to be called from interrupt handlers. For detail on each of the individual configuration settings for cFE Time Services, see the following sections: - +
    • \subpage cfetimeugformsel
    • \subpage cfetimeugfaketone
      @@ -250,9 +250,9 @@ Time format is defined in the mission configuration header file. - This selection defines the default time format as TAI or UTC. The API functions - to get time in either specific format are still enabled, but the API function to - get time in the default format will follow this selection. Enable one, and only + This selection defines the default time format as TAI or UTC. The API functions + to get time in either specific format are still enabled, but the API function to + get time in the default format will follow this selection. Enable one, and only one, of the following time format definitions: \verbatim @@ -261,15 +261,15 @@ \endverbatim or - + \verbatim #define CFE_MISSION_TIME_CFG_DEFAULT_TAI FALSE #define CFE_MISSION_TIME_CFG_DEFAULT_UTC TRUE \endverbatim - The choice of time format is a mission specific decision and is not directly + The choice of time format is a mission specific decision and is not directly affected by the hardware configuration. - + \sa #CFE_MISSION_TIME_CFG_DEFAULT_TAI, #CFE_MISSION_TIME_CFG_DEFAULT_UTC
      @@ -282,9 +282,9 @@ The fake tone is defined in the mission configuration header file. - If this selection is set to TRUE, TIME will generate a "fake" tone signal by calling - the same API function as would be called upon detection of the "real" tone signal. - Enable the fake tone only for hardware configurations that do not provide a tone + If this selection is set to TRUE, TIME will generate a "fake" tone signal by calling + the same API function as would be called upon detection of the "real" tone signal. + Enable the fake tone only for hardware configurations that do not provide a tone signal. \verbatim @@ -294,7 +294,7 @@ Hypothetical hardware configuration number one (described above) would enable the fake tone signal. \sa #CFE_MISSION_TIME_CFG_FAKE_TONE - + Next: \ref cfetimeugtoneorder
      Prev: \ref cfetimeugformsel
      Up To: \ref cfetimeugconfig @@ -305,10 +305,10 @@ Tone and data order is defined in the mission configuration header file. - This selection defines which comes first - the tone or the time at the - tone data. Does the time data describe the tone that already occurred, - or the tone that has not yet occurred? This decision may be driven by - the hardware design but can also be arbitrary. Enable one, and only one, + This selection defines which comes first - the tone or the time at the + tone data. Does the time data describe the tone that already occurred, + or the tone that has not yet occurred? This decision may be driven by + the hardware design but can also be arbitrary. Enable one, and only one, of the following: \verbatim @@ -316,12 +316,12 @@ #define CFE_MISSION_TIME_AT_TONE_WILL_BE \endverbatim - Hypothetical hardware configuration number three (described \ref cfetimeugconfig above) would + Hypothetical hardware configuration number three (described \ref cfetimeugconfig above) would enable "time at the tone was". \sa #CFE_MISSION_TIME_AT_TONE_WAS, #CFE_MISSION_TIME_AT_TONE_WILL_BE - + Next: \ref cfetimeugtonewindow
      Prev: \ref cfetimeugfaketone
      Up To: \ref cfetimeugconfig @@ -332,8 +332,8 @@ The tone and data window is defined in the mission configuration header file. - In concert with the definition of tone and data order, this selection defines - the valid window in time for the second of the pair to follow the first. + In concert with the definition of tone and data order, this selection defines + the valid window in time for the second of the pair to follow the first. Both must be defined, units are micro-seconds. \verbatim @@ -341,13 +341,13 @@ #define CFE_MISSION_TIME_MAX_ELAPSED 100000 \endverbatim - Hypothetical hardware configuration number three (described above) might use - these values which describe a window that begins immediately after the tone + Hypothetical hardware configuration number three (described above) might use + these values which describe a window that begins immediately after the tone and lasts for one tenth of a second. \sa #CFE_MISSION_TIME_MIN_ELAPSED, #CFE_MISSION_TIME_MAX_ELAPSED - + Next: \ref cfetimeugserver
      Prev: \ref cfetimeugtoneorder
      Up To: \ref cfetimeugconfig @@ -356,12 +356,12 @@ /** \page cfetimeugserver Specifying Time Server/Client - Configure TIME as a client only when the target system has multiple processors - running separate instantiations of the cFE. One instantiation must be configured - as the server and the remainder configured as clients. If the target system has + Configure TIME as a client only when the target system has multiple processors + running separate instantiations of the cFE. One instantiation must be configured + as the server and the remainder configured as clients. If the target system has only one processor running the cFE, then TIME must be configured as a server. - Enable one, and only one, of the following definitions in the platform configuration + Enable one, and only one, of the following definitions in the platform configuration header file: \verbatim @@ -370,7 +370,7 @@ \endverbatim or - + \verbatim #define CFE_PLATFORM_TIME_CFG_SERVER FALSE #define CFE_PLATFORM_TIME_CFG_CLIENT TRUE @@ -378,7 +378,7 @@ \sa #CFE_PLATFORM_TIME_CFG_SERVER, #CFE_PLATFORM_TIME_CFG_CLIENT - + Next: \ref cfetimeugendian
      Prev: \ref cfetimeugtonewindow
      Up To: \ref cfetimeugconfig @@ -387,7 +387,7 @@ /** \page cfetimeugendian Specifying Time Tone Byte Order - By default, the CFE time tone message is a payload of integers in + By default, the CFE time tone message is a payload of integers in platform-endian order (containing the tone's timestamp, the leap seconds, and state information.) In some configurations, it may be better to have the payload produced in big-endian order--particularly in mixed-endian @@ -408,14 +408,14 @@ /** \page cfetimeugvirtualmet Virtual MET - This configuration option refers to whether the MET is local to this instantiation + This configuration option refers to whether the MET is local to this instantiation of TIME. If the MET is not local then TIME must be configured as using a virtual MET. - Therefore, all TIME clients must be configured as using a virtual MET. If the MET was - local to any TIME client, then that instantiation of TIME would have to be the server. + Therefore, all TIME clients must be configured as using a virtual MET. If the MET was + local to any TIME client, then that instantiation of TIME would have to be the server. + + TIME servers must be configured as using a virtual MET - TIME servers must be configured as using a virtual MET - Next: \ref cfetimeugsource
      Prev: \ref cfetimeugendian
      @@ -425,15 +425,15 @@ /** \page cfetimeugsource Specifying Time Source - TIME configuration provides the ability to specify where the source for time data - is originating - either internal or external. In hypothetical system one, the MET - is internal. In system two, TIME cannot directly read the MET, therefore time data + TIME configuration provides the ability to specify where the source for time data + is originating - either internal or external. In hypothetical system one, the MET + is internal. In system two, TIME cannot directly read the MET, therefore time data must be received from an external source. - This selection also enables a command interface to switch between internal and - external input. When commanded to use internal time data, TIME will ignore the - external data. However, TIME will continue to use the API function as the trigger - to generate a "time at the tone" command packet regardless of the internal/external + This selection also enables a command interface to switch between internal and + external input. When commanded to use internal time data, TIME will ignore the + external data. However, TIME will continue to use the API function as the trigger + to generate a "time at the tone" command packet regardless of the internal/external command selection. Set the following definition to TRUE only for TIME servers using an external time data source. @@ -442,16 +442,16 @@ #define CFE_PLATFORM_TIME_CFG_SOURCE TRUE \endverbatim - The remainder of this section pertains only to TIME servers configured to accept + The remainder of this section pertains only to TIME servers configured to accept external time data. - When configured to accept external time data, TIME requires an additional definition - for the type of external data (GPS, MET, spacecraft time, etc.). This selection - will enable an API function specific to the selected data type. Regardless of how - the time data is received, the receiver need only pass the data to the appropriate + When configured to accept external time data, TIME requires an additional definition + for the type of external data (GPS, MET, spacecraft time, etc.). This selection + will enable an API function specific to the selected data type. Regardless of how + the time data is received, the receiver need only pass the data to the appropriate API function. - TIME servers using an external time data source must set one, and only one, of + TIME servers using an external time data source must set one, and only one, of the following to TRUE, for example: \verbatim @@ -460,14 +460,14 @@ #define CFE_PLATFORM_TIME_CFG_SRC_TIME FALSE \endverbatim - configuration definitions for the particular source. + configuration definitions for the particular source. - If the cfe_platform_cfg.h file contains "#define CFE_PLATFORM_TIME_CFG_SOURCE TRUE" then time is - configured to allow switching between internal and external time sources - (see #CFE_TIME_SET_SOURCE_CC). If this configuration parameter is set to FALSE then + If the cfe_platform_cfg.h file contains "#define CFE_PLATFORM_TIME_CFG_SOURCE TRUE" then time is + configured to allow switching between internal and external time sources + (see #CFE_TIME_SET_SOURCE_CC). If this configuration parameter is set to FALSE then the command to set the source will be rejected. - If this configuration parameter is set to TRUE then ONE and ONLY ONE of the following configuration + If this configuration parameter is set to TRUE then ONE and ONLY ONE of the following configuration parameters must also be set TRUE in order to specify the external time source, for example: \verbatim @@ -476,15 +476,15 @@ #define CFE_PLATFORM_TIME_CFG_SRC_TIME FALSE \endverbatim - Note that Internal MET source depends on available hardware. It may be the local + Note that Internal MET source depends on available hardware. It may be the local count of tone signals, the contents of a hardware register or an OS specific time function. - Note also that when configured to use an external time source, commands to set the + Note also that when configured to use an external time source, commands to set the time will be overwritten. \sa #CFE_PLATFORM_TIME_CFG_SRC_MET, #CFE_PLATFORM_TIME_CFG_SRC_GPS, #CFE_PLATFORM_TIME_CFG_SRC_TIME - + Next: \ref cfetimeugsignal
      Prev: \ref cfetimeugvirtualmet
      Up To: \ref cfetimeugconfig @@ -493,8 +493,8 @@ /** \page cfetimeugsignal Specifying Time Signal - Some hardware configurations support a primary and redundant tone signal selection. - Setting the following configuration definition to TRUE will result in enabling a TIME + Some hardware configurations support a primary and redundant tone signal selection. + Setting the following configuration definition to TRUE will result in enabling a TIME command to select the active tone signal. \verbatim @@ -504,7 +504,7 @@ Note: this feature requires additional custom software to make the physical signal switch. \sa #CFE_PLATFORM_TIME_CFG_SIGNAL - + Next: \ref cfetimeugparadigm
      Prev: \ref cfetimeugsource
      Up To: \ref cfetimeugconfig @@ -516,45 +516,45 @@ In order for the cFE Time Services to work for a particular mission, the methods of obtaining time, distributing time and translating time must follow some standard paradigms used in previous missions. The following describes this expected context: - - Mission dependent hardware provides the Tone. When this Tone message is received, - TIME latches the local time based on the local clock. Note that in lab environments, - a simulated Tone capability exists which uses an SB message. Mission dependent - hardware also provides the "time at the tone" message based on the hardware latched - time and the reference times stored by TIME Server. The TIME Client then updates - its local reference time based on the local hardware latched time at the Tone and - the provided Time-at-Tone message packet when certain checks (such as the Validity bit + + Mission dependent hardware provides the Tone. When this Tone message is received, + TIME latches the local time based on the local clock. Note that in lab environments, + a simulated Tone capability exists which uses an SB message. Mission dependent + hardware also provides the "time at the tone" message based on the hardware latched + time and the reference times stored by TIME Server. The TIME Client then updates + its local reference time based on the local hardware latched time at the Tone and + the provided Time-at-Tone message packet when certain checks (such as the Validity bit being set) pass. - When used in an environment that includes multiple processors, each running a separate - instantiation of cFE software, the presumption is that TIME will be distributed in a - client/server relationship. In this model, one processor will have TIME configured - as the server and the other processors as clients. The TIME server will maintain the - various time components and publish a "time at the tone" message to provide synchronized - time to the TIME clients. Environments that have only a single instance of TIME must be + When used in an environment that includes multiple processors, each running a separate + instantiation of cFE software, the presumption is that TIME will be distributed in a + client/server relationship. In this model, one processor will have TIME configured + as the server and the other processors as clients. The TIME server will maintain the + various time components and publish a "time at the tone" message to provide synchronized + time to the TIME clients. Environments that have only a single instance of TIME must be configured as a TIME server. - In all configurations, the final step in calculating the time "right now" for any + In all configurations, the final step in calculating the time "right now" for any instantiation of TIME is to use a local processor clock to measure the "time since the tone". - The specific MET hardware properties will determine whether the MET value can be modified. - However, the cFE design is such that there should never be a need to purposefully change or + The specific MET hardware properties will determine whether the MET value can be modified. + However, the cFE design is such that there should never be a need to purposefully change or reset the MET. - Regardless of the physical hardware implementation for the MET (elapsed seconds, - elapsed ticks, etc.), cFE TIME will convert the hardware MET value into a System Time - Format structure for time calculations and will report the converted value in telemetry. + Regardless of the physical hardware implementation for the MET (elapsed seconds, + elapsed ticks, etc.), cFE TIME will convert the hardware MET value into a System Time + Format structure for time calculations and will report the converted value in telemetry. cFE TIME will also maintain and report the STCF in a System Time Format structure. - cFE TIME has no knowledge of the current epoch; it is up to the user to keep time on the - spacecraft correlated to an epoch. An exception might appear to be the epoch definition - required in the cFE mission configuration definition file. However, this definition is for - use only by the API functions that convert spacecraft time and file system time, and the - API function that prints spacecraft time as a date and time text string. The cFE "get time" + cFE TIME has no knowledge of the current epoch; it is up to the user to keep time on the + spacecraft correlated to an epoch. An exception might appear to be the epoch definition + required in the cFE mission configuration definition file. However, this definition is for + use only by the API functions that convert spacecraft time and file system time, and the + API function that prints spacecraft time as a date and time text string. The cFE "get time" functions are independent of the ground epoch. - The mission configuration parameters, #CFE_MISSION_TIME_CFG_DEFAULT_TAI and #CFE_MISSION_TIME_CFG_DEFAULT_UTC - specify the default time format. Applications are encouraged to use the #CFE_TIME_GetTime API, + The mission configuration parameters, #CFE_MISSION_TIME_CFG_DEFAULT_TAI and #CFE_MISSION_TIME_CFG_DEFAULT_UTC + specify the default time format. Applications are encouraged to use the #CFE_TIME_GetTime API, which returns time in the format specified by this configuration parameter. @@ -567,8 +567,8 @@ /** \page cfetimeugflywheeling Flywheeling - Flywheeling occurs when TIME is not getting a valid tone signal or external "time at the tone" - message. While this has minimal impact on internal operations, it can result in the drifting + Flywheeling occurs when TIME is not getting a valid tone signal or external "time at the tone" + message. While this has minimal impact on internal operations, it can result in the drifting apart of times being stored by different spacecraft systems. Flywheeling occurs when at least one of the following conditions is true:
      @@ -590,25 +590,25 @@ /** \page cfetimeugstate Time State - Clock state is a combination of factors, most significantly whether the spacecraft time has - been accurately set and whether Time Service is operating in FLYWHEEL mode. A ground + Clock state is a combination of factors, most significantly whether the spacecraft time has + been accurately set and whether Time Service is operating in FLYWHEEL mode. A ground command is provided to set the state to reflect when the ground has determined the spacecraft - time is now correct, or that time is no longer correct. This information will be distributed - to Time Clients, and in turn, to any interested sub-systems. If time has not been set then TIME - services reports the state of time as invalid, regardless of whether time is flywheeling or not. - Also, this command may be used to force a Time Server or Time Client into FLYWHEEL mode. - Use of FLYWHEEL mode is mainly for debug purposes although, in extreme circumstances, it - may be of value to force Time Service not to rely on normal time updates. Note that when - commanded into FLYWHEEL mode, the Time Service will remain so until receipt of another - "set state" command setting the state into a mode other than FLYWHEEL. Note also that - setting the clock state to VALID or INVALID on a Time Client that is currently getting - time updates from the Time Server will have very limited effect. As soon as the Time - Client receives the next time update, the VALID/INVALID selection will be set to that of - the Time Server. However, setting a Time Client to FLYWHEEL cannot be overridden by the - Time Server since the Time Client will ignore time updates from the Time Server while in + time is now correct, or that time is no longer correct. This information will be distributed + to Time Clients, and in turn, to any interested sub-systems. If time has not been set then TIME + services reports the state of time as invalid, regardless of whether time is flywheeling or not. + Also, this command may be used to force a Time Server or Time Client into FLYWHEEL mode. + Use of FLYWHEEL mode is mainly for debug purposes although, in extreme circumstances, it + may be of value to force Time Service not to rely on normal time updates. Note that when + commanded into FLYWHEEL mode, the Time Service will remain so until receipt of another + "set state" command setting the state into a mode other than FLYWHEEL. Note also that + setting the clock state to VALID or INVALID on a Time Client that is currently getting + time updates from the Time Server will have very limited effect. As soon as the Time + Client receives the next time update, the VALID/INVALID selection will be set to that of + the Time Server. However, setting a Time Client to FLYWHEEL cannot be overridden by the + Time Server since the Time Client will ignore time updates from the Time Server while in FLYWHEEL mode. - - + + Next: \ref cfetimeuginit
      Prev: \ref cfetimeugflywheeling
      Up To: \ref cfetimeovr @@ -618,17 +618,17 @@ /** \page cfetimeuginit Initialization - No action is required by the ground to initialize the TIME software; however, time + No action is required by the ground to initialize the TIME software; however, time variables in the TIME Server must be set by command to allow correct time to propagate. - + For a description of what happens during each type of reset, see below:
      - +
      • \subpage cfetimeugpoweron
      • \subpage cfetimeugprocessor
      - - + + Next: \ref cfetimeugpoweron
      Prev: \ref cfetimeugstate
      Up To: \ref cfetimeovr @@ -638,10 +638,10 @@ /** \page cfetimeugpoweron Power-On Reset - TIME initializes all counters in housekeeping telemetry, sets the Validity + TIME initializes all counters in housekeeping telemetry, sets the Validity state to Invalid, and initializes the STCF, Leap Seconds, and 1 Hz Adjustment to zero. - - + + Next: \ref cfetimeugprocessor
      Up To: \ref cfetimeuginit **/ @@ -659,10 +659,10 @@
    • Current Time Client Delay (if applicable)
    - Note that since it is virtually impossible for TIME services to validate the - actual data that is saved across a processor reset, a signature pattern is - written to the preserved area. On a processor reset, TIME queries that - signature to make sure that it matches what is expected. If the signature + Note that since it is virtually impossible for TIME services to validate the + actual data that is saved across a processor reset, a signature pattern is + written to the preserved area. On a processor reset, TIME queries that + signature to make sure that it matches what is expected. If the signature does not match, then TIME is initialized as if a cFE power-on reset occurred. Next: \ref cfetimeugnormal
    @@ -676,13 +676,13 @@ The following sections describe the operator's resposibilities for maintaining time under nominal conditions:
    - +
    • \subpage cfetimeugclientops
    • \subpage cfetimeugserverops
    - - + + Next: \ref cfetimeugclientops
    Prev: \ref cfetimeuginit
    Up To: \ref cfetimeovr @@ -693,11 +693,11 @@ \page cfetimeugclientops Client Under normal operation, TIME Client systems do not require any attention from the ground, - however TIME clients do provide commands to set the persistent latency between the server - and client. Latency can be either added or subtracted to the current TIME client time + however TIME clients do provide commands to set the persistent latency between the server + and client. Latency can be either added or subtracted to the current TIME client time calculation to account for the latency. - - + + Next: \ref cfetimeugserverops
    Up To: \ref cfetimeugnormal **/ @@ -709,14 +709,14 @@ TIME Servers require maintenance by the operations team to ensure the spacecraft is maintaining a time that can be successfully correlated to other entities. The following sections describe the commands that the operations team can use to help maintain a proper time reference:
    - +
    • \subpage cfetimeugsettime
    • \subpage cfetimeugadjust
    • \subpage cfetimeugsetmet
    - - + + Next: \ref cfetimeugsettime
    Prev: \ref cfetimeugclientops
    Up To: \ref cfetimeugnormal @@ -726,28 +726,28 @@ /** \page cfetimeugsettime Setting Time - The Time Server provides commands to set time. The new time value represents the - desired offset from mission-defined time epoch and takes effect immediately upon - execution of this command. Time Service will calculate a new STCF value based - on the current MET and the desired new time using one of the following: + The Time Server provides commands to set time. The new time value represents the + desired offset from mission-defined time epoch and takes effect immediately upon + execution of this command. Time Service will calculate a new STCF value based + on the current MET and the desired new time using one of the following: If Time Service is configured to compute current time as TAI: - + \verbatim - STCF = new time - current MET - current time = current MET + STCF + STCF = new time - current MET + current time = current MET + STCF \endverbatim - + If Time Service is configured to compute current time as UTC: - + \verbatim STCF = ((new time) - (current MET)) + Leap Seconds current time = ((current MET) + STCF) - Leap Seconds \endverbatim - + \sa #CFE_TIME_SET_TIME_CC - - + + Next: \ref cfetimeugadjust
    Up To: \ref cfetimeugserverops **/ @@ -756,29 +756,29 @@ /** \page cfetimeugadjust Adjusting Time - The TIME Server includes commands to set the STCF, Leap Seconds, + The TIME Server includes commands to set the STCF, Leap Seconds, and Validity state. The STCF should be set implicity using the #CFE_TIME_SET_TIME_CC or explicitly using #CFE_TIME_SET_STCF_CC. TIME provides the ability to command a one time adjustment (#CFE_TIME_ADD_ADJUST_CC and #CFE_TIME_SUB_ADJUST_CC) to the current STCF. In addition there is a 1Hz adjustment (#CFE_TIME_ADD_1HZ_ADJUSTMENT_CC and #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC) - that can be made to the STCF to compensate for oscillator drift. - Mission specific ground correlation should be used to assist in - determining the proper values to use. The Leap Seconds should be + that can be made to the STCF to compensate for oscillator drift. + Mission specific ground correlation should be used to assist in + determining the proper values to use. The Leap Seconds should be set to the current TAI-UTC. Note that the International Earth - Rotation and Reference Systems Service Bulletin C, which defines - the current difference, reports it as UTC-TAI, and thus that value - must be negated. The Leap Seconds value will always be a positive - number. The Validity state does not have to be set to invalid to - change the STCF or Leap Seconds, and should be set to valid at - any time that the TIME Server time reference should be synchronized + Rotation and Reference Systems Service Bulletin C, which defines + the current difference, reports it as UTC-TAI, and thus that value + must be negated. The Leap Seconds value will always be a positive + number. The Validity state does not have to be set to invalid to + change the STCF or Leap Seconds, and should be set to valid at + any time that the TIME Server time reference should be synchronized to by the other systems. - - \sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_SUB_ADJUST_CC, #CFE_TIME_SET_STCF_CC, + + \sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_SUB_ADJUST_CC, #CFE_TIME_SET_STCF_CC, #CFE_TIME_ADD_1HZ_ADJUSTMENT_CC, #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC, #CFE_TIME_SET_LEAP_SECONDS_CC - - + + Next: \ref cfetimeugsetmet
    Prev: \ref cfetimeugsettime
    Up To: \ref cfetimeugserverops @@ -788,19 +788,19 @@ /** \page cfetimeugsetmet Setting MET - The TIME Server provides the capability to set the MET. Note that the - MET (as implemented for cFE Time Service) is a logical representation - and not a physical timer. Thus, setting the MET is not dependent on - whether the hardware supports a MET register that can be written to. - Note also that Time Service "assumes" that during normal operation, - the MET is synchronized to the tone signal. Therefore, unless operating - in FLYWHEEL mode, the sub-seconds portion of the MET will be set to zero - at the next tone signal interrupt. The new MET takes effect immediately + The TIME Server provides the capability to set the MET. Note that the + MET (as implemented for cFE Time Service) is a logical representation + and not a physical timer. Thus, setting the MET is not dependent on + whether the hardware supports a MET register that can be written to. + Note also that Time Service "assumes" that during normal operation, + the MET is synchronized to the tone signal. Therefore, unless operating + in FLYWHEEL mode, the sub-seconds portion of the MET will be set to zero + at the next tone signal interrupt. The new MET takes effect immediately upon execution of this command. - + \sa #CFE_TIME_SET_MET_CC - - + + Next: \ref cfetimeugfaq
    Prev: \ref cfetimeugadjust
    Up To: \ref cfetimeugserverops @@ -812,20 +812,20 @@
    (Q) - +
     
    - - + + Prev: \ref cfetimeugnormal
    Up To: \ref cfetimeovr **/ -/** +/** ** \page cfetimecmds cFE Time Services Commands ** -** The following is a list of commands that are processed by the cFE Time Services Task. +** The following is a list of commands that are processed by the cFE Time Services Task. **/ /** diff --git a/docs/src/cfe_xref.dox b/docs/src/cfe_xref.dox index abee13ef4..9469fe59b 100644 --- a/docs/src/cfe_xref.dox +++ b/docs/src/cfe_xref.dox @@ -12,7 +12,7 @@ ** \page cfecmdmnems cFE Command Mnemonic Cross Reference ** ** The following cross reference maps the cFE command codes to Command Mnemonics. -** To learn about the details of a particular command, click on its associated +** To learn about the details of a particular command, click on its associated ** command code.
    ** **/ diff --git a/docs/src/cfs_versions.dox b/docs/src/cfs_versions.dox index f7b1a061d..ddd7593a1 100644 --- a/docs/src/cfs_versions.dox +++ b/docs/src/cfs_versions.dox @@ -19,7 +19,7 @@ The REVISION number shall be incremented on changes that benefit from unique identification such as bug fixes or major documentation updates. The Revision number may also be updated if there are other changes contained within a release that make it desirable for applications to distinguish one release from another. - WARNING: The revision number is set to the number 99 in development builds. To distinguish between development builds refer to the BUILD_NUMBER and BUILD_BASELINE detailed in the section "Identifying Development Builds". + WARNING: The revision number is set to the number 99 in development builds. To distinguish between development builds refer to the BUILD_NUMBER and BUILD_BASELINE detailed in the section "Identifying Development Builds". The Major, Minor, and Revision numbers are provided in this header file as part of the API definition; this macro must expand to a simple integer value, so that it can be used in simple if directives by the macro preprocessor. diff --git a/docs/src/ddd_main.dox b/docs/src/ddd_main.dox index 0fe1b4769..fabe2707f 100644 --- a/docs/src/ddd_main.dox +++ b/docs/src/ddd_main.dox @@ -47,7 +47,7 @@
  • \subpage cfetlmmnems
  • \subpage cfeapi
    - +

    Other Core Flight Executive Reference Material

    • \subpage cfeappdevguide
      diff --git a/docs/src/main.dox b/docs/src/main.dox index d606c38db..9ecc545cb 100644 --- a/docs/src/main.dox +++ b/docs/src/main.dox @@ -62,22 +62,22 @@ /** \page cfebackground Background - The Core Flight Executive (cFE) is an application development and run-time environment. The cFE - provides a set of core services including Software Bus (messaging), Time, Event (Alerts), Executive - (startup and runtime), and Table services. The cFE defines an application programming interface (API) + The Core Flight Executive (cFE) is an application development and run-time environment. The cFE + provides a set of core services including Software Bus (messaging), Time, Event (Alerts), Executive + (startup and runtime), and Table services. The cFE defines an application programming interface (API) for each service which serves as the basis for application development.
      - - The cFE Software Bus service provides a publish and subscribe messaging system that allows applications - to easily plug and play into the system. Applications subscribe to cFE services at runtime, making - system modifications easy. Facilitating rapid prototyping, new applications can be compiled, linked, loaded, - and started without requiring the entire system to be rebuilt. + + The cFE Software Bus service provides a publish and subscribe messaging system that allows applications + to easily plug and play into the system. Applications subscribe to cFE services at runtime, making + system modifications easy. Facilitating rapid prototyping, new applications can be compiled, linked, loaded, + and started without requiring the entire system to be rebuilt. \image html CFSPubSub.jpg - - Each service comes complete with a built in application that allows users to interface with each service. To - support reuse and project independence, the cFE contains a configurable set of requirements and code. The configurable - parameters allow the cFE to be tailored for each environment including desk-top and closed loop simulation environments. - This provides the ability to run and test software applications on a developer's desktop and then deploy that same software + + Each service comes complete with a built in application that allows users to interface with each service. To + support reuse and project independence, the cFE contains a configurable set of requirements and code. The configurable + parameters allow the cFE to be tailored for each environment including desk-top and closed loop simulation environments. + This provides the ability to run and test software applications on a developer's desktop and then deploy that same software without changes to the embedded system. In addition the cFE includes the following software development tools:
      • Unit Test Framework (UTF) for unit testing applications developed via the cFE
      • @@ -85,59 +85,59 @@
      • Table Builder
      • Command and Telemetry utilities
      - The cFE is one of the components of the Core Flight System (cFS), a platform and project independent reusable - software framework and set of reusable software applications. There are three key aspects to the cFS architecture: - a dynamic run-time environment, layered software, and a component based design. The combination of these key aspects - along with an implementation targeted to the embedded software domain makes it suitable for reuse on any number of - NASA flight projects and/or embedded software systems.
      + The cFE is one of the components of the Core Flight System (cFS), a platform and project independent reusable + software framework and set of reusable software applications. There are three key aspects to the cFS architecture: + a dynamic run-time environment, layered software, and a component based design. The combination of these key aspects + along with an implementation targeted to the embedded software domain makes it suitable for reuse on any number of + NASA flight projects and/or embedded software systems.
      - The pivotal design feature, abstracting the software architecture from the hardware and forming the basis of reuse, - is component layering. Each layer of the architecture "hides" its implementation and technology details from the other - layers by defining and using standard Application Programming Interfaces (APIs). The internals of a layer can be changed - without affecting other layers' internals and components.
      + The pivotal design feature, abstracting the software architecture from the hardware and forming the basis of reuse, + is component layering. Each layer of the architecture "hides" its implementation and technology details from the other + layers by defining and using standard Application Programming Interfaces (APIs). The internals of a layer can be changed + without affecting other layers' internals and components.
      \image html CFSLayers.jpg - The layers include an OS Abstraction Layer (OSAL), Platform Support Package (PSP) layer, core Flight Executive (cFE) layer, - and an Application layer. The cFE layer runs on top of the PSP and OSAL layers. The cFE comes complete with a build - environment, deployment guide, API reference guide, and provides a sample PSP. The OSAL is available open source and - once integrated into the cFE build environment, developers will be ready to build and run the system and start developing + The layers include an OS Abstraction Layer (OSAL), Platform Support Package (PSP) layer, core Flight Executive (cFE) layer, + and an Application layer. The cFE layer runs on top of the PSP and OSAL layers. The cFE comes complete with a build + environment, deployment guide, API reference guide, and provides a sample PSP. The OSAL is available open source and + once integrated into the cFE build environment, developers will be ready to build and run the system and start developing their mission/project specific applications that easily plug and play into the system. - +

      Core Flight Executive (cFE) Goals

      - The main long term goal of the cFE is to form the basis for a platform and project - independent reusable software framework. The cFE with the OSAL allow the development - of portable embedded system software that is independent of a particular Real Time - Operating System and hardware platform. A secondary long term goal is to create a - standardized, product-line approach for development of embedded aerospace flight + The main long term goal of the cFE is to form the basis for a platform and project + independent reusable software framework. The cFE with the OSAL allow the development + of portable embedded system software that is independent of a particular Real Time + Operating System and hardware platform. A secondary long term goal is to create a + standardized, product-line approach for development of embedded aerospace flight software.

      Functional and Community Goals

      - The cFE allows embedded system software to be developed and tested on desktop workstations - and ported to the target platform without changing a single line of code, providing a shorter - development and debug time. The cFE is an enabler of software collaboration amongst all users - promoting the growth of the application and library layers where new applications, libraries, + The cFE allows embedded system software to be developed and tested on desktop workstations + and ported to the target platform without changing a single line of code, providing a shorter + development and debug time. The cFE is an enabler of software collaboration amongst all users + promoting the growth of the application and library layers where new applications, libraries, tools, and lessons learned can be contributed and shared.
      - It is important for application developers to realize the long term and functional - goals of the cFE. With a standard set of services providing a standard API, all - applications developed with the cFE have an opportunity to become useful on - future missions through code reuse. In order to achieve this goal, - applications must be written with care to ensure that their code does not - have dependencies on specific hardware, software or compilers. The cFE and - the underlying generic operating system API (OS API) have been designed to - insulate the cFE Application developer from hardware and software dependencies. - The developer, however, must make the effort to identify the proper methods - through the cFE and OS API to satisfy their software requirements and not - be tempted to take a "short-cut" and accomplish their goal with a direct + It is important for application developers to realize the long term and functional + goals of the cFE. With a standard set of services providing a standard API, all + applications developed with the cFE have an opportunity to become useful on + future missions through code reuse. In order to achieve this goal, + applications must be written with care to ensure that their code does not + have dependencies on specific hardware, software or compilers. The cFE and + the underlying generic operating system API (OS API) have been designed to + insulate the cFE Application developer from hardware and software dependencies. + The developer, however, must make the effort to identify the proper methods + through the cFE and OS API to satisfy their software requirements and not + be tempted to take a "short-cut" and accomplish their goal with a direct hardware or operating system software interface. **/ /** \page cfeappdocs Applicable Documents - +
      Document Title @@ -163,13 +163,13 @@ /** \page cfedependencies Dependencies - The Core Flight Executive (cFE) is required to be built with the Operating System Abstraction Layer (OSAL) and Platform Support Package (PSP) - componenets of the Core Flight System (cFS). It is always recommended to build with the latest versions of each of the components as + The Core Flight Executive (cFE) is required to be built with the Operating System Abstraction Layer (OSAL) and Platform Support Package (PSP) + componenets of the Core Flight System (cFS). It is always recommended to build with the latest versions of each of the components as backward compatability may not be supported.
      - - Several internal data structures within the cFE use the "char" data type. This data type is typically 1 byte in storage size with a value - range -128 to 127 or 0 to 255. The size of the "char" data type and whether or not the type is signed or unsigned can change across - platforms. The cFE assumes use of the "char" data type as an 8-bit type. + + Several internal data structures within the cFE use the "char" data type. This data type is typically 1 byte in storage size with a value + range -128 to 127 or 0 to 255. The size of the "char" data type and whether or not the type is signed or unsigned can change across + platforms. The cFE assumes use of the "char" data type as an 8-bit type. **/ diff --git a/docs/src/osal_fs.dox b/docs/src/osal_fs.dox index fd8b2de7d..6a8b8cf29 100644 --- a/docs/src/osal_fs.dox +++ b/docs/src/osal_fs.dox @@ -6,7 +6,7 @@ volume view regardless of the underlying system type. For example, vxWorks uses MS-DOS style volume names and directories where a vxWorks RAM disk might have the volume “RAM:0”. With this File System API, volumes are represented - as Unix-style paths where each volume is mounted on the root file system: + as Unix-style paths where each volume is mounted on the root file system:
      • RAM:0/file1.dat becomes /mnt/ram/file1.dat @@ -36,7 +36,7 @@ directory “.”. In the example of “/tmp” all of the directories created for the volumes would be under “/tmp” on the Linux file system. For a real disk device in Linux, such as a RAM disk, this field is the device - name “/dev/ram0”. + name “/dev/ram0”.
      • Volume Type: This field defines the type of volume. The types are: FS_BASED which uses the existing file system, RAM_DISK which uses a RAM_DISK device in vxWorks, RTEMS, or Linux, FLASH_DISK_FORMAT which uses @@ -45,7 +45,7 @@ before it’s use, EEPROM which is for an EEPROM or PROM based system.
      • Volatile Flag: This flag indicates that the volume or disk is a volatile disk (RAM disk ) or a non-volatile disk, that retains its contents when - the system is rebooted. This should be set to TRUE or FALSE. + the system is rebooted. This should be set to TRUE or FALSE.
      • Free Flag: This is an internal flag that should be set to FALSE or zero.
      • Is Mounted Flag: This is an internal flag that should be set to FALSE or zero. Note that a “pre-mounted” FS_BASED path can be set up by setting @@ -60,7 +60,7 @@ **/ /** -\page osalfsfd File Descriptors In Osal +\page osalfsfd File Descriptors In Osal The OSAL uses abstracted file descriptors. This means that the file descriptors passed back from the OS_open and OS_creat calls will only work with other OSAL OS_* @@ -72,7 +72,7 @@ instance, the path of the file that the file descriptor points to can be easily retrieved. Also, the OSAL task ID of the task that opened the file can also be retrieved easily. Both of these pieces of information are very useful when trying to determine statistics for a task, or the entire system. This information can all - be retrieved with a single API, OS_FDGetInfo. + be retrieved with a single API, OS_FDGetInfo. All of possible file system calls are not implemented. "Special" files requiring OS specific control/operations are by nature not portable. Abstraction in this case is @@ -83,7 +83,7 @@ instance, the path of the file that the file descriptor points to can be easily There are some small drawbacks with the OSAL file descriptors. Because the related information is kept in a table, there is a define called OS_MAX_NUM_OPEN_FILES that defines the maximum number of file descriptors available. This is a configuration -parameter, and can be changed to fit your needs. +parameter, and can be changed to fit your needs. Also, if you open or create a file not using the OSAL calls (OS_open or OS_creat) then none of the other OS_* calls that accept a file descriptor as a parameter will From dc3ab6e157478f28d2a93eea82e19b52cc1cb5dc Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 15 Mar 2021 18:25:21 -0400 Subject: [PATCH 5/7] Fix #1130, Clean trailing whitespace: XML --- modules/core_api/eds/base_types.xml | 34 +- modules/core_api/eds/ccsds_spacepacket.xml | 68 +-- modules/core_api/eds/cfe_fs.xml | 16 +- modules/core_api/eds/config.xml | 12 +- modules/core_private/eds/base_types.xml | 34 +- modules/core_private/eds/config.xml | 12 +- modules/es/eds/cfe_es.xml | 560 ++++++++++----------- modules/evs/eds/cfe_evs.xml | 26 +- modules/sb/eds/cfe_sb.xml | 60 +-- modules/tbl/eds/cfe_tbl.xml | 34 +- modules/time/eds/cfe_time.xml | 110 ++-- 11 files changed, 483 insertions(+), 483 deletions(-) diff --git a/modules/core_api/eds/base_types.xml b/modules/core_api/eds/base_types.xml index 55d7c7679..9f510458c 100644 --- a/modules/core_api/eds/base_types.xml +++ b/modules/core_api/eds/base_types.xml @@ -19,12 +19,12 @@ See the License for the specific language governing permissions and limitations under the License. - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes stardard data types used throughout the Core Flight System - + --> @@ -35,7 +35,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -99,12 +99,12 @@ double - + - - - + - + diff --git a/modules/core_api/eds/ccsds_spacepacket.xml b/modules/core_api/eds/ccsds_spacepacket.xml index 4599eced7..8f89d41d7 100644 --- a/modules/core_api/eds/ccsds_spacepacket.xml +++ b/modules/core_api/eds/ccsds_spacepacket.xml @@ -18,14 +18,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes objects as defined by CCSDS book 133 Space Packet Protocol and utilized by the Core Fligh System (cFS) - + --> @@ -37,7 +37,7 @@ - + @@ -46,35 +46,35 @@ - + - + - + - + - + Command codes in CFE range are 7 bits (0-127). The most signficant bit (codes 128-255) are reserved. @@ -84,21 +84,21 @@ - + - - + --> The Primary message header that is present in all CCSDS Space Protocol packets @@ -113,7 +113,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -137,14 +137,14 @@ - + - + The APID qualifier header extension that is present in CCSDS version 2 @@ -157,11 +157,11 @@ - - + --> The APID qualified primary header that is present in all CCSDS Space Protocol version 2 packets @@ -173,7 +173,7 @@ - + The secondary message header that is present in all cFE command messages @@ -183,7 +183,7 @@ - + The secondary message header that is present in all cFE telemetry messages @@ -193,13 +193,13 @@ - + - + @@ -217,15 +217,15 @@ - + - - + + - + diff --git a/modules/core_api/eds/cfe_fs.xml b/modules/core_api/eds/cfe_fs.xml index 99d107b4e..da85a5912 100644 --- a/modules/core_api/eds/cfe_fs.xml +++ b/modules/core_api/eds/cfe_fs.xml @@ -19,13 +19,13 @@ See the License for the specific language governing permissions and limitations under the License. - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes all interface objects for the File Services (CFE_FS) - core application - + core application + --> @@ -143,7 +143,7 @@ - + @@ -159,7 +159,7 @@ - + diff --git a/modules/core_api/eds/config.xml b/modules/core_api/eds/config.xml index 1635b02e4..6c2dbd824 100644 --- a/modules/core_api/eds/config.xml +++ b/modules/core_api/eds/config.xml @@ -19,11 +19,11 @@ See the License for the specific language governing permissions and limitations under the License. - Purpose: + Purpose: Assign values to basic configuration parameters of the Core Flight System (cFS). The CFS EDS toolchain uses values defined here to - as substitutions for the ${} syntax in EDS files. - + as substitutions for the ${} syntax in EDS files. + --> @@ -33,17 +33,17 @@ - + - + - + diff --git a/modules/core_private/eds/base_types.xml b/modules/core_private/eds/base_types.xml index 55d7c7679..9f510458c 100644 --- a/modules/core_private/eds/base_types.xml +++ b/modules/core_private/eds/base_types.xml @@ -19,12 +19,12 @@ See the License for the specific language governing permissions and limitations under the License. - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes stardard data types used throughout the Core Flight System - + --> @@ -35,7 +35,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -99,12 +99,12 @@ double - + - - - + - + diff --git a/modules/core_private/eds/config.xml b/modules/core_private/eds/config.xml index 1635b02e4..6c2dbd824 100644 --- a/modules/core_private/eds/config.xml +++ b/modules/core_private/eds/config.xml @@ -19,11 +19,11 @@ See the License for the specific language governing permissions and limitations under the License. - Purpose: + Purpose: Assign values to basic configuration parameters of the Core Flight System (cFS). The CFS EDS toolchain uses values defined here to - as substitutions for the ${} syntax in EDS files. - + as substitutions for the ${} syntax in EDS files. + --> @@ -33,17 +33,17 @@ - + - + - + diff --git a/modules/es/eds/cfe_es.xml b/modules/es/eds/cfe_es.xml index 5fbe33fee..517e1e778 100644 --- a/modules/es/eds/cfe_es.xml +++ b/modules/es/eds/cfe_es.xml @@ -19,18 +19,18 @@ See the License for the specific language governing permissions and limitations under the License. - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes all interface objects for the Executive Services (CFE_ES) - core application - + core application + --> - + @@ -38,7 +38,7 @@ - + @@ -54,7 +54,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -77,11 +77,11 @@ - + These values are used with the CFE_ES_WaitForSystemState() API call to synchronize application startup. - + @note These are defined in order so that relational comparisons e.g. if (STATEA < STATEB) are possible @@ -95,12 +95,12 @@ - + The normal progression of APP states: UNDEFINED -> EARLY_INIT -> LATE_INIT -> RUNNING -> WAITING -> STOPPED - + @note These are defined in order so that relational comparisons e.g. if (STATEA < STATEB) are possible @@ -114,18 +114,18 @@ - - + + - + - + CFE_ES_AppInfo_t is a structure that is used to provide @@ -240,7 +240,7 @@ - + @@ -248,13 +248,13 @@ - + - + @@ -284,7 +284,7 @@ - + For command details, see #CFE_ES_RESTART_CC @@ -293,7 +293,7 @@ - + For command details, see #CFE_ES_SHELL_CMD_CC @@ -303,13 +303,13 @@ - + - + For command details, see #CFE_ES_OVERWRITE_SYSLOG_CC @@ -323,7 +323,7 @@ - + For command details, see #CFE_ES_START_APP_CC. @@ -342,7 +342,7 @@ - + For command details, see #CFE_ES_STOP_APP_CC, #CFE_ES_RESTART_APP_CC, #CFE_ES_QUERY_ONE_CC @@ -351,7 +351,7 @@ - + For command details, see #CFE_ES_RELOAD_APP_CC @@ -361,7 +361,7 @@ - + For command details, see #CFE_ES_SET_MAX_PR_COUNT_CC @@ -370,7 +370,7 @@ - + For command details, see #CFE_ES_DELETE_CDS_CC @@ -379,7 +379,7 @@ - + For command details, see #CFE_ES_PERF_STARTDATA_CC @@ -388,7 +388,7 @@ - + For command details, see #CFE_ES_PERF_STOPDATA_CC @@ -397,7 +397,7 @@ - + For command details, see #CFE_ES_PERF_SETFILTERMASK_CC @@ -407,7 +407,7 @@ - + For command details, see #CFE_ES_PERF_SETTRIGMASK_CC @@ -417,7 +417,7 @@ - + \brief Telemeter Memory Pool Statistics Command. @@ -428,7 +428,7 @@ - + For command details, see #CFE_ES_DUMP_CDS_REG_CC @@ -437,13 +437,13 @@ - + - + @@ -454,7 +454,7 @@ - + @@ -649,18 +649,18 @@ - + - \brief ASCII text string containing output from OS Shell + \brief ASCII text string containing output from OS Shell that was received in response to an OS Shell Command - + @@ -687,16 +687,16 @@ - + \cfeescmd Executive Services No-Op \par Description - - This command performs no other function than to increment the - command execution counter. The command may be used to verify + + This command performs no other function than to increment the + command execution counter. The command may be used to verify general aliveness of the Executive Services task. \cfecmdmnemonic \ES_NOOP @@ -704,19 +704,19 @@ #CFE_ES_NoArgsCmd_t \par Command Verification - - Successful execution of this command may be verified with the + + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_NOOP_INF_EID informational event message will + - The #CFE_ES_NOOP_INF_EID informational event message will be generated \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - the #CFE_ES_LEN_ERR_EID error event message will be generated @@ -734,8 +734,8 @@ \cfeescmd Executive Services Reset Counters \par Description - - This command resets the following counters within the Executive + + This command resets the following counters within the Executive Services housekeeping telemetry: - Command Execution Counter - Command Error Counter @@ -745,28 +745,28 @@ #CFE_ES_NoArgsCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_RESET_INF_EID informational event message will be + - The #CFE_ES_RESET_INF_EID informational event message will be generated \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - the #CFE_ES_LEN_ERR_EID error event message will be generated \par Criticality - - This command is not inherently dangerous. However, it is - possible for ground systems and on-board safing procedures - to be designed such that they react to changes in the counter + + This command is not inherently dangerous. However, it is + possible for ground systems and on-board safing procedures + to be designed such that they react to changes in the counter values that are reset by this command. \sa #CFE_ES_RESET_PR_COUNT_CC @@ -781,15 +781,15 @@ \cfeescmd Executive Services Processor / Power-On Reset \par Description - + This command restarts the cFE in one of two modes. The Power-On Reset will cause the cFE to restart as though the power were first applied to the processor. The Processor Reset will attempt to retain the contents of the volatile disk and the contents of the Critical Data Store. - NOTE: If a requested Processor Reset should cause the + NOTE: If a requested Processor Reset should cause the Processor Reset Counter (\b \c \ES_PROCRESETCNT) to exceed OR EQUAL the limit #CFE_ES_MAX_PROCESSOR_RESETS (which is reported in - housekeeping telemetry as \b \c \ES_MAXPROCRESETS), + housekeeping telemetry as \b \c \ES_MAXPROCRESETS), the command is \b AUTOMATICALLY upgraded to a Power-On Reset. \cfecmdmnemonic \ES_RESET @@ -797,8 +797,8 @@ #CFE_ES_RestartCmd_t \par Command Verification - - Successful execution of this command (as a Processor Reset) + + Successful execution of this command (as a Processor Reset) may be verified with the following telemetry: - \b \c \ES_PROCRESETCNT - processor reset counter will increment - New entries in the Exception Reset Log and System Log can be found @@ -809,18 +809,18 @@ command execution. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The \link #CFE_ES_RestartCmd_t.RestartType Restart Type \endlink was - not a recognized value. - + not a recognized value. + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - the #CFE_ES_BOOT_ERR_EID error event message will be generated \par Criticality - + This command is, by definition, dangerous. Significant loss of data will occur. All processes and the cFE itself will be stopped and restarted. With the Power-On reset option, all data on the @@ -842,12 +842,12 @@ \cfeescmd Executive Services O/S Shell Command \par Description - + This command passes an ASCII string as a command line to the underlying realtime operating system shell. Any response to the command is both written to the shell command output file and sent as a series of shell command output telemetry packets. - + If the shell command output filename argument is empty, then #CFE_ES_DEFAULT_SHELL_FILENAME will be used as the filename. \cfecmdmnemonic \ES_SHELL @@ -856,16 +856,16 @@ #CFE_ES_ShellCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_SHELL_INF_EID informational event message will be + - The #CFE_ES_SHELL_INF_EID informational event message will be generated \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - Failure to create the shell command output file @@ -874,14 +874,14 @@ - There was an error while performing a #OS_lseek on the shell command output file - There was an error while redirecting the shell command response to the shell command output file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - the #CFE_ES_SHELL_ERR_EID error event message will be generated - Additional information on the error should be found in the System Log \par Criticality - + This command should be used with caution. Interfering with the operation of the underlying realtime operating system can cause significant problems. @@ -899,8 +899,8 @@ \cfeescmd Load and Start an Application \par Description - - This command starts the specified application with the + + This command starts the specified application with the specified start address, stack size, etc options. \cfecmdmnemonic \ES_STARTAPP @@ -908,16 +908,16 @@ #CFE_ES_StartAppCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_START_INF_EID informational event message will be + - The #CFE_ES_START_INF_EID informational event message will be generated \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The specified application filename string is either a NULL string @@ -929,14 +929,14 @@ - The specified exception action is neither #CFE_ES_ExceptionAction_RESTART_APP (0) or #CFE_ES_ExceptionAction_PROC_RESTART (1) - The Operating System was unable to load the specified application file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + This command is not inherently dangerous although system resources could be taxed beyond their limits with the starting of erroneous or invalid applications. @@ -956,12 +956,12 @@ \cfeescmd Stop and Unload Application \par Description - + This command halts and removes the specified Application from the system. \b NOTE: This command should never be used on the Command Ingest application. This would prevent further commands from entering the system. If Command Ingest needs to - be stopped and restarted, use #CFE_ES_RESTART_APP_CC or + be stopped and restarted, use #CFE_ES_RESTART_APP_CC or #CFE_ES_RELOAD_APP_CC. \cfecmdmnemonic \ES_STOPAPP @@ -969,35 +969,35 @@ #CFE_ES_AppNameCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_STOP_DBG_EID debug event message will be + - The #CFE_ES_STOP_DBG_EID debug event message will be generated. NOTE: This event message only identifies that the stop has been started, not that is has completed. - Once the stop has successfully completed, the list of Applications - and Tasks created in response to the \b \c \ES_WRITEAPPINFO2FILE, - \b \c \ES_WRITETASKINFO2FILE should no longer contain the + and Tasks created in response to the \b \c \ES_WRITEAPPINFO2FILE, + \b \c \ES_WRITETASKINFO2FILE should no longer contain the specified application. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The specified application name is not recognized as an active application - The specified application is one of the cFE's Core applications (ES, EVS, SB, TBL, TIME) - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued forall error + - A command specific error event message is issued forall error cases - Additional information on the reason for command failure may be found in the System Log \par Criticality - + This command is not inherently dangerous, however the removal of certain applications (e.g. - Spacecraft Attitude and Control) may have a detrimental effect on the spacecraft. @@ -1017,7 +1017,7 @@ \cfeescmd Stops and Restarts an Application \par Description - + This command halts and restarts the specified Application. This command does \b NOT reload the application from the onboard filesystem. @@ -1027,31 +1027,31 @@ #CFE_ES_AppNameCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_RESTART_APP_DBG_EID debug event message will be + - The #CFE_ES_RESTART_APP_DBG_EID debug event message will be generated. NOTE: This event message only identifies that the act of stopping the application has begun, not that is has completed. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The specified application name is not recognized as an active application - The specified application is one of the cFE's Core applications (ES, EVS, SB, TBL, TIME) - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases - Additional information on the reason for command failure may be found in the System Log \par Criticality - + This command is not inherently dangerous, however the restarting of certain applications (e.g. - Spacecraft Attitude and Control) may have a detrimental effect on the spacecraft. @@ -1071,10 +1071,10 @@ \cfeescmd Stops, Unloads, Loads from a File and Restarts an Application \par Description - + This command halts and removes the specified Application from the system. Then it immediately loads the Application from - the command specified file and restarts it. This command is + the command specified file and restarts it. This command is especially useful for restarting a Command Ingest Application since once it has been stopped, no further commands can come in to restart it. @@ -1084,31 +1084,31 @@ #CFE_ES_AppReloadCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_RELOAD_APP_DBG_EID debug event message will be + - The #CFE_ES_RELOAD_APP_DBG_EID debug event message will be generated. NOTE: This event message only identifies that the act of stopping the application has begun, not that is has completed. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The specified application name is not recognized as an active application - The specified application is one of the cFE's Core applications (ES, EVS, SB, TBL, TIME) - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases - Additional information on the reason for command failure may be found in the System Log \par Criticality - + This command is not inherently dangerous, however the restarting of certain applications (e.g. - Spacecraft Attitude and Control) may have a detrimental effect on the spacecraft. @@ -1128,7 +1128,7 @@ \cfeescmd Request Executive Services Information on a Specified Application \par Description - + This command takes the information kept by Executive Services on the specified application and telemeters it to the ground. \cfecmdmnemonic \ES_QUERYAPP @@ -1137,25 +1137,25 @@ #CFE_ES_AppNameCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_ONE_APP_EID debug event message will be + - The #CFE_ES_ONE_APP_EID debug event message will be generated. NOTE: This event message only identifies that the act of stopping the application has begun, not that is has completed. - Receipt of the #CFE_ES_APP_TLM_t telemetry packet \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The specified application name is not recognized as an active application - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality @@ -1176,7 +1176,7 @@ \cfeescmd Writes all Executive Services Information on All Applications to a File \par Description - + This command takes the information kept by Executive Services on all of the registered applications and writes it to the specified file. \cfecmdmnemonic \ES_WRITEAPPINFO2FILE @@ -1185,33 +1185,33 @@ #CFE_ES_QueryAllCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_ALL_APPS_EID debug event message will be + - The #CFE_ES_ALL_APPS_EID debug event message will be generated. - The file specified in the command (or the default specified - by the #CFE_ES_DEFAULT_APP_LOG_FILE configuration parameter) will be + by the #CFE_ES_DEFAULT_APP_LOG_FILE configuration parameter) will be updated with the lastest information. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - An Error occurs while trying to write to the file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - - This command is not inherently dangerous. It will create a new - file in the file system (or overwrite an existing one) and could, - if performed repeatedly without sufficient file management by the + + This command is not inherently dangerous. It will create a new + file in the file system (or overwrite an existing one) and could, + if performed repeatedly without sufficient file management by the operator, fill the file system. \sa #CFE_ES_QUERY_ONE_CC, #CFE_ES_QUERY_ALL_TASKS_CC @@ -1229,7 +1229,7 @@ \cfeescmd Clear Executive Services System Log \par Description - + This command clears the contents of the Executive Services System Log. \cfecmdmnemonic \ES_CLEARSYSLOG @@ -1237,28 +1237,28 @@ #CFE_ES_NoArgsCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_SYSLOG1_INF_EID informational event message will be + - The #CFE_ES_SYSLOG1_INF_EID informational event message will be generated. - \b \c \ES_SYSLOGBYTEUSED - System Log Bytes Used will go to zero - \b \c \ES_SYSLOGENTRIES - Number of System Log Entries will go to zero \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + This command is not dangerous. However, any previously logged data will be lost. @@ -1275,7 +1275,7 @@ \cfeescmd Writes contents of Executive Services System Log to a File \par Description - + This command causes the contents of the Executive Services System Log to be written to a log file. \cfecmdmnemonic \ES_WRITESYSLOG2FILE @@ -1284,33 +1284,33 @@ #CFE_ES_WriteSyslogCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_SYSLOG2_EID debug event message will be + - The #CFE_ES_SYSLOG2_EID debug event message will be generated. - The file specified in the command (or the default specified - by the #CFE_ES_DEFAULT_SYSLOG_FILE configuration parameter) will be + by the #CFE_ES_DEFAULT_SYSLOG_FILE configuration parameter) will be updated with the lastest information. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - An Error occurs while trying to write to the file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - - This command is not inherently dangerous. It will create a new - file in the file system (or overwrite an existing one) and could, - if performed repeatedly without sufficient file management by the + + This command is not inherently dangerous. It will create a new + file in the file system (or overwrite an existing one) and could, + if performed repeatedly without sufficient file management by the operator, fill the file system. \sa #CFE_ES_CLEAR_SYSLOG_CC, #CFE_ES_CLEAR_ERLOG_CC, #CFE_ES_WRITE_ERLOG_CC, @@ -1329,7 +1329,7 @@ \cfeescmd Clears the contents of the Exeception and Reset Log \par Description - + This command causes the contents of the Executive Services Exception and Reset Log to be cleared. \cfecmdmnemonic \ES_CLEARERLOG @@ -1338,27 +1338,27 @@ #CFE_ES_NoArgsCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_ERLOG1_INF_EID informational event message will be + - The #CFE_ES_ERLOG1_INF_EID informational event message will be generated. - \b \c \ES_ERLOGINDEX - Index into Exception Reset Log goes to zero \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + This command is not dangerous. However, any previously logged data will be lost. @@ -1374,7 +1374,7 @@ \cfeescmd Writes Exeception and Reset Log to a File \par Description - + This command causes the contents of the Executive Services Exception and Reset Log to be written to the specified file. \cfecmdmnemonic \ES_WRITEERLOG2FILE @@ -1383,33 +1383,33 @@ #CFE_ES_WriteERlogCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_ERLOG2_EID debug event message will be + - The #CFE_ES_ERLOG2_EID debug event message will be generated. - The file specified in the command (or the default specified - by the #CFE_ES_DEFAULT_ER_LOG_FILE configuration parameter) will be + by the #CFE_ES_DEFAULT_ER_LOG_FILE configuration parameter) will be updated with the lastest information. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - An Error occurs while trying to write to the file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - - This command is not inherently dangerous. It will create a new - file in the file system (or overwrite an existing one) and could, - if performed repeatedly without sufficient file management by the + + This command is not inherently dangerous. It will create a new + file in the file system (or overwrite an existing one) and could, + if performed repeatedly without sufficient file management by the operator, fill the file system. \sa #CFE_ES_CLEAR_SYSLOG_CC, #CFE_ES_WRITE_SYSLOG_CC, #CFE_ES_CLEAR_ERLOG_CC @@ -1427,7 +1427,7 @@ \cfeescmd Start Performance Analyzer \par Description - + This command causes the Performance Analyzer to begin collecting data using the specified trigger mode. \cfecmdmnemonic \ES_STARTLADATA @@ -1435,37 +1435,37 @@ #CFE_ES_PerfStartCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - \b \c \ES_PERFSTATE - Current performance analyzer state will change to either WAITING FOR TRIGGER or, if conditions are appropriate fast enough, TRIGGERED. - - \b \c \ES_PERFMODE - Performance Analyzer Mode will change to the commanded trigger mode (TRIGGER START, + - \b \c \ES_PERFMODE - Performance Analyzer Mode will change to the commanded trigger mode (TRIGGER START, TRIGGER CENTER, or TRIGGER END). - \b \c \ES_PERFTRIGCNT - Performance Trigger Count will go to zero - \b \c \ES_PERFDATASTART - Data Start Index will go to zero - \b \c \ES_PERFDATAEND - Data End Index will go to zero - \b \c \ES_PERFDATACNT - Performance Data Counter will go to zero - - The #CFE_ES_PERF_STARTCMD_EID debug event message will be + - The #CFE_ES_PERF_STARTCMD_EID debug event message will be generated. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - A previous #CFE_ES_PERF_STOPDATA_CC command has not completely finished. - An invalid trigger mode is requested. - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + This command is not inherently dangerous but may cause a small increase in CPU utilization as the performance analyzer data is collected. @@ -1484,7 +1484,7 @@ \cfeescmd Stop Performance Analyzer \par Description - + This command stops the Performance Analyzer from collecting any more data. \cfecmdmnemonic \ES_STOPLADATA @@ -1492,34 +1492,34 @@ #CFE_ES_PerfStopCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - \b \c \ES_PERFSTATE - Current performance analyzer state will change to - IDLE. - - The #CFE_ES_PERF_STOPCMD_EID debug event message will be + IDLE. + - The #CFE_ES_PERF_STOPCMD_EID debug event message will be generated. - The file specified in the command (or the default specified - by the #CFE_ES_DEFAULT_PERF_DUMP_FILENAME configuration parameter) will be + by the #CFE_ES_DEFAULT_PERF_DUMP_FILENAME configuration parameter) will be updated with the lastest information. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - A previous Stop Performance Analyzer command is still in process - An error occurred while spawning the child task responsible for dumping the Performance Analyzer data to a file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + This command is not inherently dangerous. An additional low priority child task will be spawned, however, to dump the performance analyzer data to a file. @@ -1538,7 +1538,7 @@ \cfeescmd Set Performance Analyzer's Filter Masks \par Description - + This command sets the Performance Analyzer's Filter Masks. \cfecmdmnemonic \ES_LAFILTERMASK @@ -1546,29 +1546,29 @@ #CFE_ES_SetPerfFilterMaskCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - \B \C \ES_PERFFLTRMASK - the current performance filter mask value(s) should reflect the commanded value - - The #CFE_ES_PERF_FILTMSKCMD_EID debug event message will be + - The #CFE_ES_PERF_FILTMSKCMD_EID debug event message will be generated. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The Filter Mask ID number is out of range - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + Changing the filter masks may cause a small change in the Performance Analyzer's CPU utilization. @@ -1594,29 +1594,29 @@ #CFE_ES_PerfSetTrigMaskCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - \b \c \ES_PERFTRIGMASK - the current performance trigger mask value(s) should reflect the commanded value - - The #CFE_ES_PERF_TRIGMSKCMD_EID debug event message will be + - The #CFE_ES_PERF_TRIGMSKCMD_EID debug event message will be generated. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The Trigger Mask ID number is out of range - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + Changing the trigger masks may cause a small change in the Performance Analyzer's CPU utilization. @@ -1635,7 +1635,7 @@ \cfeescmd Set Executive Services System Log Mode to Discard/Overwrite \par Description - + This command allows the user to configure the Executive Services to either discard new System Log messages when it is full or to overwrite the oldest messages. @@ -1645,29 +1645,29 @@ #CFE_ES_OverWriteSysLogCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - \b \c \ES_SYSLOGMODE - Current System Log Mode should reflect the commanded value - - The #CFE_ES_SYSLOGMODE_EID debug event message will be + - The #CFE_ES_SYSLOGMODE_EID debug event message will be generated. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The desired mode is neither #CFE_ES_LogMode_OVERWRITE or #CFE_ES_LogMode_DISCARD - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + None. (It should be noted that "Overwrite" mode would allow a message identifying the cause of a problem to be lost by a subsequent flood of additional messages). @@ -1687,9 +1687,9 @@ \cfeescmd Resets the Processor Reset Counter to Zero \par Description - + This command allows the user to reset the Processor Reset Counter to zero. - The Processor Reset Counter counts the number of Processor Resets that + The Processor Reset Counter counts the number of Processor Resets that have occurred so as to identify when a Processor Reset should automatically be upgraded to a full Power-On Reset. \cfecmdmnemonic \ES_RESETPRCNT @@ -1698,27 +1698,27 @@ #CFE_ES_NoArgsCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - \b \c \ES_PROCRESETCNT - Current number of processor resets will go to zero - - The #CFE_ES_RESET_PR_COUNT_EID informational event message will be + - The #CFE_ES_RESET_PR_COUNT_EID informational event message will be generated. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + This command is not critical. The only impact would be that the system would have to have more processor resets before an automatic power-on reset occurred. @@ -1735,7 +1735,7 @@ \cfeescmd Configure the Maximum Number of Processor Resets before a Power-On Reset \par Description - + This command allows the user to specify the number of Processor Resets that are allowed before the next Processor Reset is upgraded to a Power-On Reset. \cfecmdmnemonic \ES_SETMAXPRCNT @@ -1744,28 +1744,28 @@ #CFE_ES_SetMaxPRCountCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - \b \c \ES_MAXPROCRESETS - Current maximum number of processor resets + - \b \c \ES_MAXPROCRESETS - Current maximum number of processor resets before an automatic power-on reset will go to the command specified value. - - The #CFE_ES_SET_MAX_PR_COUNT_EID informational event message will be + - The #CFE_ES_SET_MAX_PR_COUNT_EID informational event message will be generated. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + If the operator were to set the Maximum Processor Reset Count to too high a value, the processor would require an inordinate number of consecutive processor resets before an automatic power-on reset would occur. This could potentially leave the @@ -1787,7 +1787,7 @@ \cfeescmd Delete Critical Data Store \par Description - + This command allows the user to delete a Critical Data Store that was created by an Application that is now no longer executing. \cfecmdmnemonic \ES_DELETECDS @@ -1796,32 +1796,32 @@ #CFE_ES_DeleteCDSCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_CDS_DELETED_INFO_EID informational event message will be + - The #CFE_ES_CDS_DELETED_INFO_EID informational event message will be generated. - The specified CDS should no longer appear in a CDS Registry dump generated upon receipt of the #CFE_ES_DUMP_CDS_REG_CC command \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The specified CDS is the CDS portion of a Critical Table. See #CFE_TBL_DELETE_CDS_CC. - The specified CDS is not found in the CDS Registry - The specified CDS is associated with an Application that is still active - An error occurred while accessing the CDS memory (see the System Log for more details) - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + This command is not critical because it is not possible to delete a CDS that is associated with an active application. However, deleting a CDS does eliminate any "history" that an application may be wishing to keep. @@ -1841,7 +1841,7 @@ \cfeescmd Telemeter Memory Pool Statistics \par Description - + This command allows the user to obtain a snapshot of the statistics maintained for a specified memory pool. \cfecmdmnemonic \ES_SendMemPoolStats @@ -1850,31 +1850,31 @@ #CFE_ES_SendMemPoolStatsCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_TLM_POOL_STATS_INFO_EID debug event message will be + - The #CFE_ES_TLM_POOL_STATS_INFO_EID debug event message will be generated. - The \link #CFE_ES_MEMSTATS_TLM_t Memory Pool Statistics Telemetry Packet \endlink is produced \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - The specified handle is not associated with a known memory pool - The specified handle caused a processor exception because it improperly identified a segment of memory - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - + An incorrect Memory Pool Handle value can cause a system crash. Extreme care should be taken to ensure the memory handle value used in the command is correct. @@ -1892,7 +1892,7 @@ \cfeescmd Dump Critical Data Store Registry to a File \par Description - + This command allows the user to dump the Critical Data Store Registry to an onboard file. \cfecmdmnemonic \ES_DumpCDSRegistry @@ -1901,32 +1901,32 @@ #CFE_ES_DumpCDSRegistryCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_CDS_REG_DUMP_INF_EID debug event message will be + - The #CFE_ES_CDS_REG_DUMP_INF_EID debug event message will be generated. - The file specified in the command (or the default specified - by the #CFE_ES_DEFAULT_CDS_REG_DUMP_FILE configuration parameter) will be + by the #CFE_ES_DEFAULT_CDS_REG_DUMP_FILE configuration parameter) will be updated with the lastest information. \par Error Conditions - + This command may fail for the following reason(s): - Error occurred while trying to create the dump file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - - This command is not inherently dangerous. It will create a new - file in the file system (or overwrite an existing one) and could, - if performed repeatedly without sufficient file management by the + + This command is not inherently dangerous. It will create a new + file in the file system (or overwrite an existing one) and could, + if performed repeatedly without sufficient file management by the operator, fill the file system. \sa #CFE_ES_DELETE_CDS_CC, #CFE_TBL_DELETE_CDS_CC @@ -1944,7 +1944,7 @@ \cfeescmd Writes a list of All Executive Services Tasks to a File \par Description - + This command takes the information kept by Executive Services on all of the registered tasks and writes it to the specified file. \cfecmdmnemonic \ES_WRITETASKINFO2FILE @@ -1953,33 +1953,33 @@ #CFE_ES_QueryAllTasksCmd_t \par Command Verification - + Successful execution of this command may be verified with the following telemetry: - - \b \c \ES_CMDPC - command execution counter will + - \b \c \ES_CMDPC - command execution counter will increment - - The #CFE_ES_TASKINFO_EID debug event message will be + - The #CFE_ES_TASKINFO_EID debug event message will be generated. - The file specified in the command (or the default specified - by the #CFE_ES_DEFAULT_TASK_LOG_FILE configuration parameter) will be + by the #CFE_ES_DEFAULT_TASK_LOG_FILE configuration parameter) will be updated with the lastest information. \par Error Conditions - + This command may fail for the following reason(s): - The command packet length is incorrect - An Error occurs while trying to write to the file - + Evidence of failure may be found in the following telemetry: - \b \c \ES_CMDEC - command error counter will increment - - A command specific error event message is issued for all error + - A command specific error event message is issued for all error cases \par Criticality - - This command is not inherently dangerous. It will create a new - file in the file system (or overwrite an existing one) and could, - if performed repeatedly without sufficient file management by the + + This command is not inherently dangerous. It will create a new + file in the file system (or overwrite an existing one) and could, + if performed repeatedly without sufficient file management by the operator, fill the file system. \sa #CFE_ES_QUERY_ALL_CC, CFE_ES_QUERY_ONE_CC @@ -1991,9 +1991,9 @@ - + - + @@ -2039,7 +2039,7 @@ - + @@ -2050,6 +2050,6 @@ - + diff --git a/modules/evs/eds/cfe_evs.xml b/modules/evs/eds/cfe_evs.xml index da8d92a6f..1ebc1f262 100644 --- a/modules/evs/eds/cfe_evs.xml +++ b/modules/evs/eds/cfe_evs.xml @@ -19,18 +19,18 @@ See the License for the specific language governing permissions and limitations under the License. - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes all interface objects for the Event Services (CFE_EVS) - core application - + core application + --> - + @@ -38,7 +38,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -1275,7 +1275,7 @@ - + @@ -1320,7 +1320,7 @@ - + diff --git a/modules/sb/eds/cfe_sb.xml b/modules/sb/eds/cfe_sb.xml index d9f122e02..57f1a939d 100644 --- a/modules/sb/eds/cfe_sb.xml +++ b/modules/sb/eds/cfe_sb.xml @@ -19,13 +19,13 @@ See the License for the specific language governing permissions and limitations under the License. - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes all interface objects for the Software Bus (CFE_SB) - core application - + core application + --> @@ -206,7 +206,7 @@ - + @@ -380,9 +380,9 @@ - @@ -873,9 +873,9 @@ - + - + Basic message routing service over the CFE software bus. Messages are routed based on the Application ID field @@ -891,10 +891,10 @@ - + - This represents the access interface used for passing message datagrams + This represents the access interface used for passing message datagrams to and from the message transfer service (MTS). It operates using publish/subscribe semantics, where messages are sent and received using an abstract idenifier referred to as a software bus message ID. This essentially acts as a filter on the underlying @@ -913,20 +913,20 @@ - - + + Higher level interface to publish a message via the CFE software bus. cFS applications may define their - own application-specific interface of this type to indicate the message(s) it will publish via + own application-specific interface of this type to indicate the message(s) it will publish via the software bus. This is typically the various types of telemetry that the application generates. @@ -948,13 +948,13 @@ - + Interface to listen for a message from the CFE software bus. cFS application data sheets may derive their - own application-specific interface from this base to indicate the type of message(s) it will subscribe to - via the software bus. This is typically the various telecommand messages that the application supports. - + own application-specific interface from this base to indicate the type of message(s) it will subscribe to + via the software bus. This is typically the various telecommand messages that the application supports. + This is a receive-only interface; the Telemetry interface provides the equivalent send function. @@ -977,14 +977,14 @@ - + - + @@ -993,7 +993,7 @@ - + @@ -1002,7 +1002,7 @@ - + @@ -1011,7 +1011,7 @@ - + @@ -1072,6 +1072,6 @@ - + diff --git a/modules/tbl/eds/cfe_tbl.xml b/modules/tbl/eds/cfe_tbl.xml index 0791b5b09..df2670c18 100644 --- a/modules/tbl/eds/cfe_tbl.xml +++ b/modules/tbl/eds/cfe_tbl.xml @@ -18,19 +18,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes all interface objects for the Table Services (CFE_TBL) - core application - + core application + --> - + @@ -38,7 +38,7 @@ - + @@ -79,7 +79,7 @@ #CFE_TBL_BufferSelect_INACTIVE=Inactive Table, #CFE_TBL_BufferSelect_ACTIVE=Active Table - + Selects either the "Inactive" (#CFE_TBL_BufferSelect_INACTIVE) buffer or the "Active" (#CFE_TBL_BufferSelect_ACTIVE) buffer to be dumped @@ -355,13 +355,13 @@ + sent to OTHER apps. It is not one of the commands that TBL receives --> - + @@ -479,7 +479,7 @@ - The table image file was unable to be opened. Either the file does not exist at the specified location, the filename is in error, or the file system has been corrupted. - + Evidence of failure may be found in the following telemetry: - \b \c \TBL_CMDEC - command error counter will increment - Command specific error event messages are issued for all error cases @@ -569,7 +569,7 @@ - \b \c \TBL_LASTVALCRC - calculated data integrity value will be updated - The #CFE_TBL_VAL_REQ_MADE_INF_EID debug event message (indicating the application is being notified of a validation request) - + If the specified table has an associated validation function, then the following telemetry will also change: - Either \b \c \TBL_VALSUCCESSCTR OR \b \c \TBL_VALFAILEDCTR will increment @@ -677,7 +677,7 @@ - Error occurred during write operation to file. Possible causes might be insufficient space in the file system or the filename or file path is improperly specified. - + Evidence of failure may be found in the following telemetry: - \b \c \TBL_CMDEC - command error counter will increment - An Error specific event message @@ -831,7 +831,7 @@ - + @@ -876,6 +876,6 @@ - + diff --git a/modules/time/eds/cfe_time.xml b/modules/time/eds/cfe_time.xml index bc3c03019..c146b6bd7 100644 --- a/modules/time/eds/cfe_time.xml +++ b/modules/time/eds/cfe_time.xml @@ -19,13 +19,13 @@ See the License for the specific language governing permissions and limitations under the License. - This document adheres to the Electronic Data Sheet (EDS) XML schema - as prescribed in CCSDS book 876.0. - - Purpose: + This document adheres to the Electronic Data Sheet (EDS) XML schema + as prescribed in CCSDS book 876.0. + + Purpose: This describes all interface objects for the Time Services (CFE_TIME) - core application - + core application + --> @@ -64,24 +64,24 @@ - The spacecraft time has not been set since the last clock + The spacecraft time has not been set since the last clock reset. Times returned by clock routines have no relationship to any ground-based time reference. - + - The spacecraft time has been set at least once since the last - clock reset, and it is synchronized with the primary on-board + The spacecraft time has been set at least once since the last + clock reset, and it is synchronized with the primary on-board time base. Times returned by clock routines can be trusted. - + - The spacecraft time has been set at least once since the last - clock reset, but it is not currently synchronized with the - primary on-board time base. Times returned by clock routines - are a "best guess" based on a non-optimal oscillator. + The spacecraft time has been set at least once since the last + clock reset, but it is not currently synchronized with the + primary on-board time base. Times returned by clock routines + are a "best guess" based on a non-optimal oscillator. @@ -94,7 +94,7 @@ - + @@ -102,7 +102,7 @@ - + @@ -110,7 +110,7 @@ - + @@ -118,7 +118,7 @@ - + @@ -126,7 +126,7 @@ - + \par Description @@ -589,7 +589,7 @@ via configuration parameters, this command provides a common method for switching between the local processor clock and an external source for time data. - + When commanded to accept external time data (GPS, MET, spacecraft time, etc.), the Time Server will enable input via an API function specific to the configuration definitions for the particular source. @@ -597,7 +597,7 @@ the external data. However, the Time Server will continue to use the API function as the trigger to generate a "time at the tone" command packet regardless of the internal/external command selection. - + Notes: - Operating in FLYWHEEL mode is not considered a choice related to clock source, but rather an element of the clock state. See below @@ -621,7 +621,7 @@ - Invalid Source selection (a value other than #CFE_TIME_SourceSelect_INTERNAL or #CFE_TIME_SourceSelect_EXTERNAL was specified) - Time source selection not allowed on this platform - + Evidence of failure may be found in the following telemetry: - \b \c \TIME_CMDEC - Command Error counter will increment - Error specific event message (either #CFE_TIME_SOURCE_CFG_EID or #CFE_TIME_SOURCE_ERR_EID) @@ -648,18 +648,18 @@ of clock state. Clock state is a combination of factors, most significantly whether the spacecraft time has been accurately set, and whether Time Service is operating in FLYWHEEL mode. - + This command may be used to notify the Time Server that spacecraft time is now correct, or that time is no longer correct. This information will be distributed to Time Clients, and in turn, to any interested sub-systems. - + Also, this command may be used to force a Time Server or Time Client into FLYWHEEL mode. Use of FLYWHEEL mode is mainly for debug purposes although in extreme circumstances, it may be of value to force Time Service not to rely on normal time updates. Note that when commanded into FLYWHEEL mode, the Time Service will remain so until receipt of another "set state" command setting the state into a mode other than FLYWHEEL. - + Note also that setting the clock state to VALID or INVALID on a Time Client that is currently getting time updates from the Time Server will have very limited effect. As soon as the Time Client receives the next time update, the VALID/INVALID @@ -683,7 +683,7 @@ - Invalid State selection (a value other than #CFE_TIME_ClockState_INVALID, #CFE_TIME_ClockState_VALID or #CFE_TIME_ClockState_FLYWHEEL was specified) - Time source selection not allowed on this platform - + Evidence of failure may be found in the following telemetry: - \b \c \TIME_CMDEC - Command Error counter will increment - Error specific event message (#CFE_TIME_STATE_ERR_EID) @@ -733,7 +733,7 @@ \par Error Conditions - An invalid number of microseconds was specified (must be less than 1 million) - Platorm receiving the command is not a Time Client - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_DELAY_CFG_EID or #CFE_TIME_DELAY_ERR_EID) @@ -762,7 +762,7 @@ calculation for Time Clients, so this command has no meaning for Time Servers. Each Time Client can have a unique latency setting. The latency value is a positive number of seconds and microseconds that represent the deviation from the time maintained by the Time Server. - + Note that it is unimaginable that the seconds value will ever be anything but zero. \cfecmdmnemonic \TIME_SUBCLOCKLAT @@ -780,7 +780,7 @@ \par Error Conditions - An invalid number of microseconds was specified (must be less than 1 million) - Platorm receiving the command is not a Time Client - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_DELAY_CFG_EID or #CFE_TIME_DELAY_ERR_EID) @@ -811,11 +811,11 @@ this command. Time Service will calculate a new STCF value based on the current MET and the desired new time using one of the following: - + If Time Service is configured to compute current time as TAI - STCF = (new time) - (current MET) - (current time) = (current MET) + STCF - + If Time Service is configured to compute current time as UTC - STCF = ((new time) - (current MET)) + (Leap Seconds) - (current time) = ((curent MET) + STCF) - (Leap Seconds) @@ -835,7 +835,7 @@ \par Error Conditions - An invalid number of microseconds was specified (must be less than 1 million) - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_TIME_CFG_EID or #CFE_TIME_TIME_ERR_EID) @@ -860,15 +860,15 @@ \par Description This command sets the Mission Elapsed Timer (MET) to the specified value. - + Note that the MET (as implemented for cFE Time Service) is a logical representation and not a physical timer. Thus, setting the MET is not dependent on whether the hardware supports a MET register that can be written to. - + Note also that Time Service "assumes" that during normal operation, the MET is synchronized to the tone signal. Therefore, unless operating in FLYWHEEL mode, the sub-seconds portion of the MET will be set to zero at the next tone signal interrupt. - + The new MET takes effect immediately upon execution of this command. \cfecmdmnemonic \TIME_SETCLOCKMET @@ -886,7 +886,7 @@ \par Error Conditions - An invalid number of microseconds was specified (must be less than 1 million) - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_MET_CFG_EID or #CFE_TIME_MET_ERR_EID) @@ -931,7 +931,7 @@ \par Error Conditions - An invalid number of microseconds was specified (must be less than 1 million) - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_STCF_CFG_EID or #CFE_TIME_STCF_ERR_EID) @@ -974,7 +974,7 @@ \par Error Conditions - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_LEAPS_CFG_EID) @@ -1017,7 +1017,7 @@ \par Error Conditions - An invalid number of microseconds was specified (must be less than 1 million) - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_DELTA_ERR_EID or #CFE_TIME_DELTA_CFG_EID) @@ -1059,7 +1059,7 @@ \par Error Conditions - An invalid number of microseconds was specified (must be less than 1 million) - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event messages will be issued (#CFE_TIME_DELTA_ERR_EID or #CFE_TIME_DELTA_CFG_EID) @@ -1087,14 +1087,14 @@ rather than micro-seconds as an input argument. This change occurred after the determination was made that one micro-second is too large an increment for a constant 1Hz adjustment. - + This command continuously adjusts the Spacecraft Time Correlation Factor (STCF) every second, by adding the specified value. The adjustment to the STCF is applied in the Time Service local 1Hz interrupt handler. As the local 1Hz interrupt is not synchronized to the tone signal, one cannot say when the adjustment will occur, other than once a second, at about the same time relative to the tone. - + There was some debate about whether the maximum 1Hz clock drift correction factor would ever need to exceed some small fraction of a second. But, the decision was made to provide the capability to make 1Hz adjustments greater @@ -1115,7 +1115,7 @@ \par Error Conditions - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID) @@ -1143,14 +1143,14 @@ rather than micro-seconds as an input argument. This change occurred after the determination was made that one micro-second is too large an increment for a constant 1Hz adjustment. - + This command continuously adjusts the Spacecraft Time Correlation Factor (STCF) every second, by subtracting the specified value. The adjustment to the STCF is applied in the Time Service local 1Hz interrupt handler. As the local 1Hz interrupt is not synchronized to the tone signal, one cannot say when the adjustment will occur, other than once a second, at about the same time relative to the tone. - + There was some debate about whether the maximum 1Hz clock drift correction factor would ever need to exceed some small fraction of a second. But, the decision was made to provide the capability to make 1Hz adjustments greater @@ -1171,7 +1171,7 @@ \par Error Conditions - Platorm receiving the command is not a Time Server - + Evidence of Failure may be found in the following telemetry: - \b \c \TIME_CMDEC - command error counter will increment - Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID) @@ -1200,7 +1200,7 @@ choice is the selection of primary or redundant tone signal. The selection may be available to both the Time Server and Time Clients, depending on hardware configuration. - + Notes: - This command is only valid when the #CFE_PLATFORM_TIME_CFG_SIGNAL configuration parameter in the cfe_platform_cfg.h file has been set to true. @@ -1223,7 +1223,7 @@ - Invalid Signal selection (a value other than #CFE_TIME_ToneSignalSelect_PRIMARY or #CFE_TIME_ToneSignalSelect_REDUNDANT was specified) - Multiple Tone Signal Sources not available on this platform - + Evidence of failure may be found in the following telemetry: - \b \c \TIME_CMDEC - Command Error counter will increment - Error specific event message (either #CFE_TIME_SIGNAL_CFG_EID or #CFE_TIME_SIGNAL_ERR_EID) @@ -1246,21 +1246,21 @@ - + - + - + - + @@ -1303,7 +1303,7 @@ - + @@ -1335,6 +1335,6 @@ - + From f257ae542f1c1cb8f477ca563318cc5c3134c556 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 15 Mar 2021 18:26:15 -0400 Subject: [PATCH 6/7] Fix #1130, Clean trailing whitespace: Other Excludes .md, .pdf, and .doc --- .travis.yml | 2 +- cmake/sample_defs/cpu1_cfe_es_startup.scr | 8 +- docs/Makefile | 3 +- docs/cFE_FunctionalRequirements.csv | 196 +++++++++++----------- 4 files changed, 104 insertions(+), 105 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b098f179..5ed0addd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,4 +26,4 @@ script: cat cppcheck_flight_cfe.txt exit -1 fi - + diff --git a/cmake/sample_defs/cpu1_cfe_es_startup.scr b/cmake/sample_defs/cpu1_cfe_es_startup.scr index d0510376a..990942c52 100644 --- a/cmake/sample_defs/cpu1_cfe_es_startup.scr +++ b/cmake/sample_defs/cpu1_cfe_es_startup.scr @@ -14,13 +14,13 @@ CFE_APP, sch_lab, SCH_Lab_AppMain, SCH_LAB_APP, 80, 16384, 0x0, 0; ! 7. Load Address -- This is the Optional Load Address for the App or Library. Currently not implemented ! so keep it at 0x0. ! 8. Exception Action -- This is the Action the cFE should take if the App has an exception. -! 0 = Just restart the Application +! 0 = Just restart the Application ! Non-Zero = Do a cFE Processor Reset ! ! Other Notes: ! 1. The software will not try to parse anything after the first '!' character it sees. That ! is the End of File marker. -! 2. Common Application file extensions: +! 2. Common Application file extensions: ! Linux = .so ( ci.so ) ! OS X = .bundle ( ci.bundle ) ! Cygwin = .dll ( ci.dll ) @@ -28,6 +28,6 @@ CFE_APP, sch_lab, SCH_Lab_AppMain, SCH_LAB_APP, 80, 16384, 0x0, 0; ! RTEMS with S-record Loader = .s3r ( ci.s3r ) ! RTEMS with CEXP Loader = .o ( ci.o ) ! 3. The filename field (2) no longer requires a fully-qualified filename; the path and extension -! may be omitted. If omitted, the standard virtual path (/cf) and a platform-specific default +! may be omitted. If omitted, the standard virtual path (/cf) and a platform-specific default ! extension will be used, which is derived from the build system. - + diff --git a/docs/Makefile b/docs/Makefile index 577cdbca0..8d43eb2d5 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -11,10 +11,9 @@ PANDOC_PDF_OPTS := -s -V documentclass=article -V geometry:margin=0.75in --smart # PANDOC_PDF_OPTS := -s -V documentclass=article -V geometry:margin=0.75in --toc --toc-depth=2 %.pdf: %.md Makefile - pandoc $(PANDOC_FMT_OPTS) $(PANDOC_PDF_OPTS) $(PANDOC_EXTRA_OPTS) -o $@ $< + pandoc $(PANDOC_FMT_OPTS) $(PANDOC_PDF_OPTS) $(PANDOC_EXTRA_OPTS) -o $@ $< # For version description documents (and possibly others) use -N for numbered sections $(wildcard cFE*version_description.pdf): PANDOC_EXTRA_OPTS = -N all: $(MD_FILES:.md=.pdf) - diff --git a/docs/cFE_FunctionalRequirements.csv b/docs/cFE_FunctionalRequirements.csv index 72dce9752..8793bb771 100644 --- a/docs/cFE_FunctionalRequirements.csv +++ b/docs/cFE_FunctionalRequirements.csv @@ -22,11 +22,11 @@ ES: Zero Command Counters,cES1004,"Upon receipt of a Command, the cFE shall set ES: Start Application,cES1005,"Upon receipt of a Command, the cFE shall create the Command specified Application by defining the Application in the System Resources Definition using information from the Command specified file, and beginning execution of the Application.",A basic feature of the cFE is to be able to dynamically (while the cFE is running) start applications. This requirement allows for an application to be created and started from one of the cFE file systems. ES: Start Application - Command Contents,cES1005.1,"The Command shall include the following parameters: -- Application Path/Filename -- Application Entry Point -- Application Name -- Application Priority -- Application Stack Size +- Application Path/Filename +- Application Entry Point +- Application Name +- Application Priority +- Application Stack Size - Exception Action (restart application or perform processor reset)", ES: Start Application - Location,cES1005.2,The Command specified cFE Application file shall be in any valid cFE file system including the volatile file system and the non-volatile file system.,"The command itself does not care about where the cFE Application comes from, it is specified In the path." ES: Start Application - Reject Undefined,cES1005.3,"If the Command specified Application is undefined then the cFE shall reject the Command, increment the invalid command counter and generate an event message.",Can't start an undefined application. @@ -43,32 +43,32 @@ ES: Reload Application - Reject On Missing File,cES1008.2,"If the specified cFE ES: Reload Application - Delete On Non-Parameter Error,cES1008.3,"If the cFE Application Reload fails due to a non-parameter error, then the cFE shall delete the Application, increment the invalid Command counter, and generate an event message.","If the Application is already stopped and there is an error restarting it, then the cFE application will be deleted. Should the old Application be restarted? Need to be able to reset the cFE in the event that there is a critical problem. As a result of the Power On Reset, all code and data are re-initialized and the cFE is returned to a default power-on state. This reset is initiated through a common interface." ES: Power On Reset,cES1009,"Upon receipt of a Command, the cFE shall perform a Power On Reset of the Core Flight Executive.","On a flight processor or other embedded processor this command results in rebooting the processor board through the Boot Software. On a desktop system this command will result in the restarting of the cFE, but not the operating system. Note: If the cFE implementation includes more than one cFE core images, it is the responsibility of the Boot Software to select which cFE image is booted." ES: Processor Reset,cES1010,"Upon receipt of a Command, the cFE shall perform a Processor Reset of the Core Flight Executive.",Need to be able to restart the cFE in the event that there is a problem with the Real Time OS or cFE Core software. Note that restarting the cFE will result in a restart of all of the cFE applications. -ES: Application Status Message,cES1011,"Upon receipt of a Command, the cFE shall generate a message that contains a summary of the Command specified Application's properties and state as defined in the Systems Resources Definition including: +ES: Application Status Message,cES1011,"Upon receipt of a Command, the cFE shall generate a message that contains a summary of the Command specified Application's properties and state as defined in the Systems Resources Definition including: -- cFE Application Name -- cFE Application Filename -- cFE Application Entry Point -- cFE Application Priority -- cFE Application Stack Size -- cFE Application Memory Start Address -- cFE Application Memory Size +- cFE Application Name +- cFE Application Filename +- cFE Application Entry Point +- cFE Application Priority +- cFE Application Stack Size +- cFE Application Memory Start Address +- cFE Application Memory Size - cFE Application Child Task Count","In order to support remote Application management then the Application's properties and current state need to be externally observable. Because the ground interface is with Applications rather than Tasks, Task information should be included as well." ES: Application Status Record To File,cES1012,"Upon receipt of a Command, the cFE shall generate a Command specified file that contains all properties and states of all cFE Applications that are defined in the Systems Resources Definition.",May want information about all applications and tasks defined in the Systems Resources Definition in order to diagnose a problem. ES: Application Status Record To File - Default Filename,cES1012.1,"If a file is not specified, the cFE shall use the `` filename.",Want to specify a default if the user does not want to specify a new filename. ES: System Log,cES1014,The cFE shall maintain an Executive Services System Log which contains a series of ASCII text strings describing significant events or errors.,"Examples of ES System Log information includes: ""Created new cFE Application: StoredCommand.app"" or ""Could Not Create OS Queue"" or ""File not found error: /eebank1/StoredCommand.app"" This requirement states that the cFE needs to maintain this information. There is a separate requirement for the creation of a file to transfer the information to the ground. Note that the information can also be obtained with a raw memory read." ES: System Log - Timestamps,cES1014.1,Each entry in the Executive Services System Log shall be time tagged with the time that the event happened.,Need to be able to determine when the event occurred. -ES: System Log - Calculate Usage,cES1014.2,"The cFE shall calculate the number of bytes used and number of entries in +ES: System Log - Calculate Usage,cES1014.2,"The cFE shall calculate the number of bytes used and number of entries in Executive Services System Log.","Ground operations need indication of how full the System Log is so that they can clear it, if necessary, in order to make room for new entries (or at least write it to a file to preserve it)." ES: System Log - Overwrite On Full,cES1014.2.1,If the Executive Services System Log is full and the System Log Mode is set to OVERWRITE then the cFE shall write all new entries from the top of the log.,Want to provide the capability to continuously record all new System Messages. ES: System Log - Discard On Full,cES1014.2.2,If the Executive Services Syste Log is full and the System Log Mode is set to DISCARD then the cFE shall discard all new entries.,Want to provide capability to stop writing to the System Log in order to preserve to Log which may contain important anomalous messages. ES: System Log - Clear On Command,cES1015,"Upon receipt of a Command, the cFE shall clear the Executive Services System Log.",Want to be able to clear the Executive Services System Log Buffer so that only the new information is saved. ES: System Log - Write To File,cES1016,"Upon receipt of a Command, the cFE shall copy the information contained in the Executive Services System Log into a Command specified file.",We did not want to count on a file system for storing the ES System errors in the event that there was a problem with the file system or the file system was not mounted yet. We did want to provide an easy ground interface for getting the data to the ground ES: System Log - Default Filename,cES1016.1,"If a file is not specified, the cFE shall use the `` filename.",Want to provide a default in the event a user does not want to have to specify one. -ES: Exception and Reset Log,cES1017,"The cFE shall maintain an Executive Services Exception and Reset Log which will log critical system data for exceptions and resets including: +ES: Exception and Reset Log,cES1017,"The cFE shall maintain an Executive Services Exception and Reset Log which will log critical system data for exceptions and resets including: -- A time stamp -- Processor Context information -- Critical system variables +- A time stamp +- Processor Context information +- Critical system variables - ASCII string stating the reason for the reset","Want to be able to save state information prior to a restart (processor, power-on, application, task etc) to help with diagnosing problems. There is a separate requirement for the creation of a file to transfer the information to the ground." ES: Exception and Reset Log - Clear On Command,cES1018,"Upon receipt of a Command, the cFE shall clear the Executive Services Exception and Reset Log.",Want to be able to clear the Executive Services Exception and Reset Log so that only the new information is saved. ES: Exception and Reset Log - Write To File,cES1019,"Upon receipt of a Command, the cFE shall copy the information contained in the Executive Services Exception and Reset Log Buffer into a Command specified file.","The cFE Exception and Reset Log contains a large amount of data, and is variable in size. It is easier to dump the contents to a file." @@ -183,16 +183,16 @@ ES: Processor Reset Process Non-Volatile Startup File,cES1519,If the system star ES: Processor Reset Process Non-Volatile Startup File - Start Apps,cES1519.1,The cFE shall create and start cFE Applications according to the entry in the cFE Startup File.,The cFE supports loading and creating new cFE Applications during system startup. ES: Processor Reset Process Non-Volatile Startup File - Init Libs,cES1519.2,The cFE shall create and initialize Shared Libraries according to the entry in the cFE Startup File.,The cFE supports loading and initializing cFE Shared Libraries during system startup. ES: Processor Reset Exception and Reset Log Entry,cES1520,"Upon a Processor Reset, the cFE shall make an entry in the Executive Services Exception and Reset Log recording the Processor Reset.",The purpose of the Executive Services Exception and Reset Log is to log all resets and all exceptions that occur. -ES: Processor Reset Preservation List,cES1521,"Upon a Processor Reset, the cFE shall preserve the following: +ES: Processor Reset Preservation List,cES1521,"Upon a Processor Reset, the cFE shall preserve the following: -- Boot Source -- Reset Type -- Reset Subtype -- Reset Reason -- Number of Processor Resets -- Maximum Processor Resets -- Number of entries in System Log -- Size of System Log +- Boot Source +- Reset Type +- Reset Subtype +- Reset Reason +- Number of Processor Resets +- Maximum Processor Resets +- Number of entries in System Log +- Size of System Log - Number of bytes used in the System Log",The purpose of the Executive Services Exception and Reset Log is to log all resets and all exceptions that occur. ES: Processor Reset Set System Log Mode,cES1522,"Upon a Processor Reset, the cFE shall set the System Log Mode to `` default mode.","Typically want to preserve the System Events that may have captured the cause of the processor reset, but system can be configured as desired." ES: Power On Reset Set System Log Mode,cES1523,"Upon a Power-On Reset, the cFE shall set the System Log Mode to `` default mode.","Typically want to overwrite the System Events during normal operations to store the most recent events, but system can be configured as desired." @@ -207,18 +207,18 @@ EVS: Set Event Format Mode,cEVS3001,"Upon receipt of Command, the cFE shall set EVS: NOOP Event,cEVS3002,Upon receipt of Command the cFE shall generate a NO-OP event message.,This command is useful as a general sub-system aliveness test. EVS: Zero Counters,cEVS3003,"Upon receipt of Command the cFE shall set the following counters to zero in Event Services telemetry: -- Valid Command Counter -- Invalid Command Counter -- Event Message Sent Counter -- Event Message Truncation Counter +- Valid Command Counter +- Invalid Command Counter +- Event Message Sent Counter +- Event Message Truncation Counter - Unregistered Application Send Counter",This command is a common feature in heritage sub-system software design. -EVS: Write Application Data File,cEVS3004,"Upon receipt of Command, the cFE shall write the following information to the Command specified cFE EVS Application Data file for each registered Application: +EVS: Write Application Data File,cEVS3004,"Upon receipt of Command, the cFE shall write the following information to the Command specified cFE EVS Application Data file for each registered Application: -- Application Event Message Sent Counter -- Application Event Service Enable Status -- Application Event Type Enable Statuses (one for each Event Type) -- Application Event IDs (for events to be filtered) -- Application Binary Filter Masks (one per registered Event ID) +- Application Event Message Sent Counter +- Application Event Service Enable Status +- Application Event Type Enable Statuses (one for each Event Type) +- Application Event IDs (for events to be filtered) +- Application Binary Filter Masks (one per registered Event ID) - Application Binary Filter Counters (one per registered Event ID)","Visibility of Application information is essential for FSW diagnostics, testing and maintenance." EVS: Write Application Data File - Default Filename,cEVS3004.1,"If a file is not specified, the cFE shall use the `` filename.",Want to provide a default in the event that a user does not want to specify. EVS: Valid Command Counter,cEVS3005,"Upon receipt of valid command, the cFE shall increment the valid command counter.",The ground needs the capability to verify that the command was received and accepted by the cFE. Details of valid commands are documented in the cFE User's Guide. @@ -235,20 +235,20 @@ EVS: Write Local Event Log To File,cEVS3015,"_(OPTIONAL)_ Upon receipt of Comman EVS: Write Local Event Log To File - Default Filename,cEVS3015.1,"If a file is not specified, the cFE shall use the `` filename.",Want to provide a default in the event that a user does not want to specify one. EVS: Write Local Event Log Order,cEVS3016,_(OPTIONAL)_ The cFE shall write each Event Message from the earliest logged message to the most recently logged message.,"Ground operators like to see the progression of events in the order that they occurred. In a scenario when a time correction has been made, the earliest logged may not necessarily mean the oldest time stamp. This type of playback may not be desirable for Event Logs of considerable size. It is worthwhile for cFE users to keep Event Logs relatively small." EVS: Control Message Port Routing,cEVS3017,"Upon receipt of Command the cFE shall enable/disable, as specified in the Command, the routing of all future Event Messages to the Command specified Event Message Port.","Event Message Output Ports may not be available or needed; therefore the ability to configure sending to an Event Message Port is useful." -EVS: Housekeeping Message,cEVS3018,"Upon receipt of a Message, the cFE shall generate a housekeeping message that includes the following Event Services items: +EVS: Housekeeping Message,cEVS3018,"Upon receipt of a Message, the cFE shall generate a housekeeping message that includes the following Event Services items: - Valid Command Counter -- Invalid Command Counter +- Invalid Command Counter - SB Event Format Mode -- Event Message Sent Counter -- Event Message Truncation Counter -- Unregistered Application Send Counter -- Event Message Output Port Enable Statuses -- _(OPTIONAL)_ Local Event Log Full Flag -- _(OPTIONAL)_ Local Event Log Overflow Counter -- _(OPTIONAL)_ Logging Mode +- Event Message Sent Counter +- Event Message Truncation Counter +- Unregistered Application Send Counter +- Event Message Output Port Enable Statuses +- _(OPTIONAL)_ Local Event Log Full Flag +- _(OPTIONAL)_ Local Event Log Overflow Counter +- _(OPTIONAL)_ Logging Mode - For each registered Application: - o Application Event Message Sent Counter + o Application Event Message Sent Counter o Application Event Service Enable Status",Generate housekeeping message for system awareness and management. EVS: Add Event Filter,cEVS3019,Upon receipt of Command the cFE shall add the specified Event Filter for the specified cFE Application and Event ID.,Want to provide the ability for filters to be added at runtime. Original implentation did not provide this capability which resulted in modifications to Applications for those events that were not registered (i.e. forgotten). EVS: Add Event Filter - Reject Already Filtered ,cEVS3019.1,"If the Event ID is already registered for filtering, the cFE shall reject the command and generate an event message.",Filter is done on a per Event ID basis. @@ -259,28 +259,28 @@ EVS: Register App,cEVS3100,"Upon receipt of Request, the cFE shall register an A EVS: Register App - Create Filter Counter,cEVS3100.1,"Upon receipt of Request to register an Application for event service, the cFE shall create one Application Binary Filter Counter per registered Event ID.",Supports the cFE's Binary Filtering Algorithm. EVS: Register App - Create Sent Message Counter,cEVS3100.2,"Upon receipt of Request to register an Application for event service, the cFE shall create an Application Event Message Sent Counter.",Supports the cFE's dynamic Application model. EVS: Register App - Default Event Enable Status,cEVS3100.3,"Upon receipt of Request to register an Application for event service, the cFE shall use the `` Application Event Type Enable Statuses for each event.","By default each platform should have a standard configuration for each event message type (eg. DEBUGs disable. INFO, ERROR and CRITICAL events DISABLED) that should be applied to all events. Commands are available to modify the settings." -EVS: Unregister App,cEVS3101,"Upon receipt of Request, the cFE shall un-register an Application from using event services, deleting the following Application data: +EVS: Unregister App,cEVS3101,"Upon receipt of Request, the cFE shall un-register an Application from using event services, deleting the following Application data: -- Application Event Message Sent Counter -- Application Event Service Enable Status -- Application Event Type Enable Statuses (one for each Event Type) -- Application Filtered Event IDs -- Application Binary Filter Masks (one per registered Event ID) +- Application Event Message Sent Counter +- Application Event Service Enable Status +- Application Event Type Enable Statuses (one for each Event Type) +- Application Filtered Event IDs +- Application Binary Filter Masks (one per registered Event ID) - Application Binary Filter Counters (one per registered Event ID)",Supports the cFE's dynamic Application model allowing applications to clean up after themselves. EVS: Message Types,cEVS3102,The cFE shall support the following Event Message Types: Debug Informational Error Critical.,Supports cFE event services. -EVS: Create Message,cEVS3103,"Upon receipt of a Request to send an Event Message, the cFE shall create a Short or Long Event Message, as specified by the SB Event Format Mode, ONLY if the following cFE conditions are met: +EVS: Create Message,cEVS3103,"Upon receipt of a Request to send an Event Message, the cFE shall create a Short or Long Event Message, as specified by the SB Event Format Mode, ONLY if the following cFE conditions are met: -1. The requesting Application's Event Service Enable Status is Enabled. -2. The requesting Application's registered message filtering algorithm indicates the message should be sent. +1. The requesting Application's Event Service Enable Status is Enabled. +2. The requesting Application's registered message filtering algorithm indicates the message should be sent. 3. The requesting Application's Event Type Enable Status is Enabled for the Event Type of the request-specified Event Message.",Supports cFE event services. EVS: Create Message - Unregistered App,cEVS3103.1,If the requesting Application has been determined to be unregistered the cFE shall increment the Unregistered Application Send Counter and send an event message.,Provides ground operators the ability to see when unregistered applications are using event services. -EVS: Create Message - Data Types,cEVS3103.2,"The cFE shall support the following data types within an applications Request specified Event Data: +EVS: Create Message - Data Types,cEVS3103.2,"The cFE shall support the following data types within an applications Request specified Event Data: -- Signed Character -- Unsigned Character -- Short Integer -- Unsigned Short Integer -- Long Integer +- Signed Character +- Unsigned Character +- Short Integer +- Unsigned Short Integer +- Long Integer - Unsigned Long Integer",Not all processors supported under the cFE will allow floating point or real types. EVS: Create Message - Increment Filter Counter,cEVS3103.3,"If the request specified Event ID has been registered for binary event filtering, the cFE shall increment the request specified Application's Binary Filter Counter for the request-specified Event ID.",Support binary event filtering algorithm. EVS: Create Message - Increment Filter Counter - Retain Maximum Value,cEVS3103.3.1,"If the Binary Filter Counter has reached its maximum `` value, the cFE shall retain the maximum value (i.e. do not rollover to zero).",Preventing a counter rollover to zero eliminates the case when a user may think no events have occurred when in fact many events have occurred. @@ -307,29 +307,29 @@ EVS: Preserve Event Log Reset Mode On Processor Reset,cEVS3207,"_(OPTIONAL)_ Upo EVS: Preserve Log Full State On Processor Reset,cEVS3208,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Local Event Log Full state.",Retain the cFE state across Processor Resets. EVS: Preserve Log Overflow Counter On Processor Reset,cEVS3210,"_(OPTIONAL)_ Upon a Processor Reset, the cFE shall preserve the Local Event Log Overflow Counter.",Retain the cFE state across Processor Resets. SB: NOOP Event,cSB4000,"Upon receipt of a Command, the cFE shall generate a NO-OP event message.",This command is useful as a general sub-system aliveness test. -SB: Zero Counters,cSB4001,"Upon receipt of Command the cFE shall set to zero the following counters in housekeeping telemetry: +SB: Zero Counters,cSB4001,"Upon receipt of Command the cFE shall set to zero the following counters in housekeeping telemetry: -- Valid command counter -- Invalid command counter -- No subscriptions counter -- Message send error counter -- Message receive error counter -- Create Pipe error counter -- Subscribe error counter -- Pipe Overflow error counter +- Valid command counter +- Invalid command counter +- No subscriptions counter +- Message send error counter +- Message receive error counter +- Create Pipe error counter +- Subscribe error counter +- Pipe Overflow error counter - MsdID-to-pipe limit error counter",Providing a clear counter command eliminates the need for operators or onboard scripts to keep track of the last value of the counter. SB: Statistics Message,cSB4002,"Upon receipt of a Command, the cFE shall send an SB Message containing the SB statistics.","Visibility of the SB statistics is essential for FSW diagnostics, testing, and maintenance." SB: Save Routing To File,cSB4003,"Upon receipt of a Command, the cFE shall save the SB routing information to the Command specified file.","Visibility of the SB routing information is essential for FSW diagnostics, testing, and maintenance." SB: Save Routing To File - Default Filename,cSB4003.1,"If a file is not specified, the cFE shall use the `` Filename.",Want to provide a default in the event that a user does not want to specify one. SB: Control Message Route To Pipe,cSB4004,"Upon receipt of a Command, the cFE shall enable or disable routing the command specified message to the command specified pipe.","Supports testing and maintenance. In testing, it may be desirable to enable/disable routing a message to a diagnostic application." -SB: Housekeeping Message,cSB4005,"Upon receipt of a Message, the cFE shall generate a housekeeping message that includes the following Software Bus items: +SB: Housekeeping Message,cSB4005,"Upon receipt of a Message, the cFE shall generate a housekeeping message that includes the following Software Bus items: -- Valid command counter -- Invalid command counter -- No subscriptions counter -- Message send error counter -- Message receive error counter -- Pipe overflow error counter +- Valid command counter +- Invalid command counter +- No subscriptions counter +- Message send error counter +- Message receive error counter +- Pipe overflow error counter - MsgId-to-pipe limit error counter",Generate housekeeping message for system awareness and management. SB: Save Pipe Info To File,cSB4007,"Upon receipt of a Command, the cFE shall save the Pipe information to the Command specified a file.","This gives detailed information about each pipe such as owner of the pipe, queue depth and send errors which can be used for diagnostics purposes." SB: Save Pipe Info To File - Default Filename,cSB4007.1,"If a file is not specified, the cFE shall use the `` filename.",Want to provide a default in the event that a user does not want to specify one. @@ -414,13 +414,13 @@ TBL: Write Table Registry To File,cTBL6005,Upon receipt of Command the cFE shall TBL: Write Table Registry To File - Default File Name,cTBL6005.1,"If a file is not specified, the cFE shall use the `` filename.",Want to provide a default in the event that a user does not want to specify one. TBL: Table Registry Message,cTBL6006,Upon receipt of Command the cFE shall telemeter the contents of the Table Registry associated with a Command specified Table.,"Operations personnel may wish to see the attributes (double or single-buffered, dump-only, etc), a history of what file(s) was/were last loaded into the Active Table Image, what time the load(s) occurred, etc." TBL: NOOP Event,cTBL6007,Upon receipt of Command the cFE shall generate a NO-OP event message.,This command is useful as a general sub-system aliveness test. -TBL: Zero Counters,cTBL6008,"Upon receipt of Command the cFE shall set the following counters reported in telemetry to zero: +TBL: Zero Counters,cTBL6008,"Upon receipt of Command the cFE shall set the following counters reported in telemetry to zero: -- Valid Command Counter -- Invalid Command Counter -- Number of Validation Requests -- Number of successful Table Validations -- Number of Unsuccessful Validations +- Valid Command Counter +- Invalid Command Counter +- Number of Validation Requests +- Number of successful Table Validations +- Number of Unsuccessful Validations - Number of Completed Validations",This command is a common feature in heritage sub-system software design. TBL: Valid Command Counter,cTBL6009,"Upon receipt of valid command, the cFE shall increment the valid command counter.",The ground needs the capability to verify that the command was received a accepted by the cFE. Details of valid commands are documented in the cFE User's Guide. TBL: Invalid Command Counter,cTBL6010,"Upon receipt of an invalid command, the cFE shall in increment the invalid command counter.",The ground needs an indicator if a command is rejected by the cFE. Details of what makes a command invalid are documented in the cFE User's Guide. @@ -461,16 +461,16 @@ TBL: Provide Data Address - Modified Notification,cTBL6305.2,"If a Table has bee TBL: Unlock,cTBL6306,"Upon receipt of Request, the cFE shall unlock the contents of the Request specified Table.","The Table Service must wait for an Application to be done with the contents of the Table before considering modifying its contents. This ensures data integrity while the Application accesses the Table contents. More than one Application can access a Table. Therefore, a reference count will be necessary to ensure that all access is complete before a Table can be modified." TBL: Update With Pending Load,cTBL6308,"Upon receipt of Request, the cFE shall update the request specified Table if a load is pending and it is unlocked.",This gives control to the Application as to when the table update occurs. TB: Update With Pending Load - Locked,cTBL6308.1,"If a Table is locked when an update Request is made, an appropriate error code shall be returned to the calling Application and the update shall not occur.",The Application should be made aware that the table is not being updated because it is locked. -TBL: Provide Table Info,cTBL6309,"Upon receipt of Request, the cFE shall provide the following information to the calling Application for the specified Table: +TBL: Provide Table Info,cTBL6309,"Upon receipt of Request, the cFE shall provide the following information to the calling Application for the specified Table: -- Size of the table -- Number of Users the access to the table (sharing) -- Filename of the last file used to modify the table -- File creation time of last file used to modify the table +- Size of the table +- Number of Users the access to the table (sharing) +- Filename of the last file used to modify the table +- File creation time of last file used to modify the table - Time of last modification -- Flag indicating if the Table has been initialized -- Flag indicating if the Table is dump only -- Flag indicating if the Table has a dedicated buffer +- Flag indicating if the Table has been initialized +- Flag indicating if the Table is dump only +- Flag indicating if the Table has a dedicated buffer - Flag indicating if the table is maintained in the Critical Data Store",Applications such as Checksum need to obtain info such as size of the table. The API is a more generic solution. TBL: Pending Action Status,cTBL6310,"Upon receipt of Request the cFE shall indicate if the specified table has a validation, update, or dump pending.","Applications must periodically check to see if they need to perform updates, validations or dumps." TBL: Provide Data Addresses,cTBL6311,"Upon receipt of Request, the cFE shall provide the calling Application with the addresses of the data for the tables requested if more than one table is needed.",Applications may need to work with more than one table at a time. @@ -507,13 +507,13 @@ TIME: Valid Command Counter,cTIME2003,"Upon receipt of valid command, the cFE sh TIME: Invalid Command Counter,cTIME2004,"Upon receipt of an invalid command, the cFE shall in increment the invalid command counter.",The ground needs an indicator if a command is rejected by the cFE. Details of what makes a command invalid are documented in the cFE User's Guide. TIME: Set Leap Seconds,cTIME2005,Upon receipt of Command the cFE shall set the number of Leap Seconds to the Command-specified value.,The decision to introduce a leap second in UTC is the responsibility of the International Earth Rotation Service (IERS). The count of Leap Seconds has been incremented about every 500 days since 1972. It is therefore likely that a mission will need to update. TIME: Set STCF,cTIME2006,Upon receipt of Command the cFE shall set the STCF to the Command specified value.,"The cFE must be provided with the appropriate correlation factor, that when combined with the current MET and Leap Seconds values, will result in current time. Historically this command has been referred to as 'jam loading' time." -TIME: Update STCF Given Current Time,cTIME2007,Upon receipt of Command the cFE shall compute a new value for STCF using the Command-specified value as current time.,"This command provides a useful alternative to setting the STCF -explicitly, as the command does not require knowledge of the current MET value. If the default time format is TAI then the new value for STCF is the +TIME: Update STCF Given Current Time,cTIME2007,Upon receipt of Command the cFE shall compute a new value for STCF using the Command-specified value as current time.,"This command provides a useful alternative to setting the STCF +explicitly, as the command does not require knowledge of the current MET value. If the default time format is TAI then the new value for STCF is the Command-specified time value less MET." TIME: Delta Adjust STCF,cTIME2009,Upon receipt of Command the cFE shall make a continuous 1Hz delta adjustment to the STCF by the Command-specified value.,"Upon receipt of a Command to make a 'continuous' adjustment to the STCF, the cFE shall adjust the STCF each second by the Command-specified value. The commanded value is signed so a positive or negative adjustment may be made." TIME: Switch Tone Signal Source,cTIME2010,Upon receipt of Command the cFE shall switch to the Command-specified Tone Signal source.,"The behavior of this command is hardware specific, but provides the capability to command Tone Signal source selection if implemented at the hardware level." TIME: Diagnostic Message,cTIME2011,Upon receipt of Command the cFE shall generate a Software Bus message that includes time diagnostic information.,"When testing or debugging the time application, more details about time services are required." -TIME: External Time Update Mode,cTIME2012,"Upon receipt of Command the cFE Time Services shall set the External Time Update Mode to the specified value, either use or ignore Tone Signal and Data when updating time.",Historically referred to as forced flywheeling. This provides an easy way to test local time calculations and compare against external time or force internal timekeeping operationally. +TIME: External Time Update Mode,cTIME2012,"Upon receipt of Command the cFE Time Services shall set the External Time Update Mode to the specified value, either use or ignore Tone Signal and Data when updating time.",Historically referred to as forced flywheeling. This provides an easy way to test local time calculations and compare against external time or force internal timekeeping operationally. TIME: External Time Update Mode - Ignore Updates,cTIME2012.1,The cFE shall propagate time internally when set to ignore external time updates.,"Ignore external time updates and update time internally when configured to do so. Will still accept Tone Signal and Data, but won't update timekeeping based on the externally provided timing information." TIME: External Time Update Mode - Use Updates,cTIME2012.2,The cFE shall update timekeeping when a Tone Signal and Data pair have been received when set to use external time updates.,"Use external time updates to update timekeeping values when configured to do so. Timekeeping in this context is intentionally vague since it depends on system mode, configuration and hardware implementation. This requirement just covers using the external data, not how exactly it is used." TIME: Add To SCTF,cTIME2013,Upon receipt of Command the cFE shall add the Command specified value to SCTF.,One time (aka jump) value added to SCTF supports time adjustment for time servers or time clients that are set to ignore external Tone updates. @@ -549,19 +549,19 @@ TIME: Get Clock State Flags,cTIME2320,"Upon receipt of a Request, the cFE shall TIME: Convert MET to Spacecraft Time,cTIME2321,"Upon receipt of a Request, the cFE shall convert the provided MET to spacecraft time.",Converts the provided MET to spacecraft time based on current configuration of the system. TIME: Trigger 1Hz Cycle Processing,cTIME2322,"Upon receipt of a Request, the cFE shall trigger the 1 Hz processing cycle.","Allows API triggered 1 Hz processing to support synchronization. Actually processing depends on configuration such as registered synchronization callbacks, virtualized MET, etc so it's left as generic language in this requirement." TIME: Trigger Tone Signal Processing,cTIME2323,"Upon receipt of a Request, the cFE shall trigger the Tone Signal processing cycle.","Allows API triggered Tone Signal processing to support synchronization. Actually processing depends on configuration such as registered synchronization callbacks, virtualized MET, etc so it's left as generic language in this requirement." -TIME: Power On Reset Default Values,cTIME2500,"Upon a Power-on Reset the cFE shall set the following time elements to their `` default values: +TIME: Power On Reset Default Values,cTIME2500,"Upon a Power-on Reset the cFE shall set the following time elements to their `` default values: - Time Status Data - STCF - Leap Seconds","At power on, the presumption is that the MET h/w register has been reset. It is common to set the STCF and Leap Seconds at startup such that time is computed to a known and recognizable value." -TIME: Processor Reset CDS Values,cTIME2501,"Upon a Processor Reset the cFE shall acquire the following time elements from the `` Critical Data Store: +TIME: Processor Reset CDS Values,cTIME2501,"Upon a Processor Reset the cFE shall acquire the following time elements from the `` Critical Data Store: - Time Status Data - STCF - Leap Seconds","Time is a critical system resource and every effort should be made to preserve it. Following a processor reset, the presumption is that the MET h/w register is unaffected and that previously 'good' values for STCF and Leap Seconds can still be used to correct." TIME: Processor Reset Verify CDS,cTIME2502,Upon a Processor Reset the cFE shall verify the Critical Data Store used to store time values.,"Verification of potentially damaged stored data is a standard practice. Note that because time can be any value, verification potentially involves using a pattern." TIME: Processor Reset Verify CDS - Initialize On Failure,cTIME2502.1,"If the critical data store is not valid, all of the time elements shall be initialized in the same fashion as following a power-on reset.",If the CDS can't be trusted then need to initialize to default values. -TIME: CDS Elements,cTIME2700,"During normal operation, the cFE shall preserve the following time elements in the `` Critical Data Store: +TIME: CDS Elements,cTIME2700,"During normal operation, the cFE shall preserve the following time elements in the `` Critical Data Store: - Time Status Data - STCF From 9aee2c5235549b2daabde2267f7ec7032b3cc681 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:07:52 -0400 Subject: [PATCH 7/7] Bump to v6.8.0-rc1+dev41 --- README.md | 6 ++++++ modules/core_api/fsw/inc/cfe_version.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f38113a4..baad5e009 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ The detailed cFE user's guide can be viewed at + ### Development Build: v6.8.0-rc1+dev402 - HOTFIX 20210312, updates to work with older CMake diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index 29de9ac86..ccd34295d 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -32,7 +32,7 @@ */ /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 402 /*!< Development Build: Number of commits since baseline */ +#define CFE_BUILD_NUMBER 412 /*!< 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 \ */