diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index a950de2..0000000 --- a/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -*.h linguist-language=c - -*.css linguist-documentation=true -*.htm linguist-documentation=true -*.html linguist-documentation=true -*.prc linguist-documentation=true diff --git a/CMakeLists.txt b/CMakeLists.txt index 996fe85..6921671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,3 +9,11 @@ aux_source_directory(fsw/src APP_SRC_FILES) # Create the app module add_cfe_app(mm ${APP_SRC_FILES}) + +# If UT is enabled, then add the tests from the subdirectory +# Note that this is an app, and therefore does not provide +# stub functions, as other entities would not typically make +# direct function calls into this application. +if (ENABLE_UNIT_TESTS) + add_subdirectory(unit-test) +endif (ENABLE_UNIT_TESTS) diff --git a/README.md b/README.md index 8382cc4..b242eba 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,57 @@ -# Memory Manager +core Flight System (cFS) Memory Manager Application (MM) +====================================================== -NASA core Flight System Memory Manager Application +Open Source Release Readme +========================== -## Description +MM Release 2.5.0 -The Memory Manager application (MM) is a core Flight System (cFS) application that is a plug in to the Core Flight Executive (cFE) component of the cFS. +Date: 9/2/2021 -The cFS is a platform and project independent reusable software framework and set of reusable applications developed by NASA Goddard Space Flight Center. This framework is used as the basis for the flight software for satellite data systems and instruments, but can be used on other embedded systems. More information on the cFS can be found at [http://cfs.gsfc.nasa.gov](http://cfs.gsfc.nasa.gov) +Introduction +------------- + The Memory Manager application (MM) is a core Flight System (cFS) application + that is a plug in to the Core Flight Executive (cFE) component of the cFS. + + The MM application is used for the loading and dumping system memory. MM + provides an operator interface to the memory manipulation functions contained + in the PSP (Platform Support Package) and OSAL (Operating System Abstraction + Layer) components of the cFS. MM provides the ability to load and dump memory + via command parameters, as well as, from files. If the operating system + supports symbolic addressing, MM allows specifying the memory address using a + symbolic address. -The MM application is used for the loading and dumping system memory. MM provides an operator interface to the memory manipulation functions contained in the PSP (Platform Support Package) and OSAL (Operating System Abstraction Layer) components of the cFS. MM provides the ability to load and dump memory via command parameters, as well as, from files. Supports symbolic addressing. + The MM application is written in C and depends on the cFS Operating System + Abstraction Layer (OSAL) and cFE components. There is additional MM application + specific configuration information contained in the application user's guide. -MM requires use of the [cFS application library](https://github.com/nasa/cfs_lib). + Developer's guide information can be generated using Doxygen: + doxygen mm_doxygen_config.txt -## License + This software is licensed under the NASA Open Source Agreement. + http://ti.arc.nasa.gov/opensource/nosa -This software is licensed under the NASA Open Source Agreement. http://ti.arc.nasa.gov/opensource/nosa + +Software Included +------------------ + + Memory Manager application (MM) 2.5.0 + + +Software Required +------------------ + + cFS Caelum + + Note: An integrated bundle including the cFE, OSAL, and PSP can + be obtained at https://github.com/nasa/cfs + +About cFS +---------- + The cFS is a platform and project independent reusable software framework and + set of reusable applications developed by NASA Goddard Space Flight Center. + This framework is used as the basis for the flight software for satellite data + systems and instruments, but can be used on other embedded systems. More + information on the cFS can be found at http://cfs.gsfc.nasa.gov + +EOF diff --git a/cfs-mm-app-OSS-readme.txt b/cfs-mm-app-OSS-readme.txt deleted file mode 100644 index c4de6b1..0000000 --- a/cfs-mm-app-OSS-readme.txt +++ /dev/null @@ -1,89 +0,0 @@ -core Flight System (cFS) Memory Manager Application (MM) -Open Source Release Readme - -MM Release 2.4.1 - -Date: -November 17, 2016 - -Introduction: - The Memory Manager application (MM) is a core Flight System (cFS) application - that is a plug in to the Core Flight Executive (cFE) component of the cFS. - - The cFS is a platform and project independent reusable software framework and - set of reusable applications developed by NASA Goddard Space Flight Center. - This framework is used as the basis for the flight software for satellite data - systems and instruments, but can be used on other embedded systems. More - information on the cFS can be found at http://cfs.gsfc.nasa.gov - - The MM application is used for the loading and dumping system memory. MM - provides an operator interface to the memory manipulation functions contained - in the PSP (Platform Support Package) and OSAL (Operating System Abstraction - Layer) components of the cFS. MM provides the ability to load and dump memory - via command parameters, as well as, from files. If the operating system - supports symbolic addressing, MM allows specifying the memory address using a - symbolic address. - - The MM application is written in C and depends on the cFS Operating System - Abstraction Layer (OSAL) and cFE components. To build and run the MM - application, follow the cFS Deployment Guide instructions contained in - cFE-6.4.1-OSS-release/docs. There is additional MM application specific - configuration information contained in the application user's guide - available in cfs-mm-2.4.0-OSS-release/docs/users_guide - - There are also "Quick start" instructions provided in - cFE-6.5.0-OSS-release/cfe-OSS-readme.txt - - The OSAL is available at http://sourceforge.net/projects/osal/ and - github.com/nasa/ - - The cFE is available at http://sourceforge.net/projects/coreflightexec - - This software is licensed under the NASA Open Source Agreement. - http://ti.arc.nasa.gov/opensource/nosa - - -Software Included: - Memory Manager application (MM) 2.4.1 - - -Software Required: - - Operating System Abstraction Layer 4.2.0 or higher can be - obtained at http://sourceforge.net/projects/osal or - github.com/nasa/osal - - core Flight Executive 6.5.0 or higher can be obtained at - http://sorceforge.net/projects/coreflightexec - - -Runtime Targets Supported: - The "out of the box" targets in the cFE 6.4.1 distribution include: - 1. 32 bit x86 Linux ( CentOS 6.x ) - 2. Motorola MCP750 PowerPC vxWorks 6.4 - -Other targets: - Other targets are included, but may take additional work to - run. They are included as examples of other target - environments. - 1. mcf5235-rtems - This is for the Axiom MCF5235 Coldfire board running - RTEMS 4.10. It requires a static loader component for the - OS abstraction layer. The static loader is currently - not available as open source, so this target is not - considered complete. RTEMS 4.11 will have a dynamic - loader which will be supported by a future release - of the OS Abstraction Layer, completing the RTEMS support - for the cFE. - - Once RTEMS 4.11 is released, the goal is to support - an RTEMS simulator platform such as SPARC/sis or - quemu. - - 2. mac-osx and pc-cygwin - These targets are included for examples. They - will most likely be removed in the future. - The pc-linux target is highly recommended. If you - have a windows or mac computer it is relatively easy to - set up a free virtual machine environment with 32 bit - Cent OS 5.x. - -EOF \ No newline at end of file diff --git a/docs/MM_DevelopersGuide.docx b/docs/MM_DevelopersGuide.docx new file mode 100644 index 0000000..0f459da Binary files /dev/null and b/docs/MM_DevelopersGuide.docx differ diff --git a/docs/MM_RequirementsToDesignTrace.docx b/docs/MM_RequirementsToDesignTrace.docx new file mode 100644 index 0000000..dd1a9c7 Binary files /dev/null and b/docs/MM_RequirementsToDesignTrace.docx differ diff --git a/docs/MM_v2.4.2_VersionDescriptionDocument.pdf b/docs/MM_v2.4.2_VersionDescriptionDocument.pdf new file mode 100644 index 0000000..923461c Binary files /dev/null and b/docs/MM_v2.4.2_VersionDescriptionDocument.pdf differ diff --git a/docs/MM_v2.5.0_VersionDescriptionDocument.pdf b/docs/MM_v2.5.0_VersionDescriptionDocument.pdf new file mode 100644 index 0000000..ee52ac8 Binary files /dev/null and b/docs/MM_v2.5.0_VersionDescriptionDocument.pdf differ diff --git a/docs/dox_src/users_guide/cfs_mm.dox b/docs/dox_src/users_guide/cfs_mm.dox index 754bf58..92edad1 100644 --- a/docs/dox_src/users_guide/cfs_mm.dox +++ b/docs/dox_src/users_guide/cfs_mm.dox @@ -40,6 +40,8 @@ Member added to project c:/MKSDATA/MKS-REPOSITORY/CFS-REPOSITORY/mm/docs/dox_src/users_guide/project.pj \endverbatim + + Next: \ref cfsmmintro
**/ /** @@ -113,8 +115,9 @@ UTC Universal time code - Prev: \ref cfsmmrevhist
- Next: \ref cfsmmovr + + Next: \ref cfsmmovr
+ Prev: \ref cfsmmrevhist **/ /** @@ -151,8 +154,9 @@
  • \subpage cfsmmugsymbols

    - Prev: \ref cfsmmintro
    - Next: \ref cfsmmopr + + Next: \ref cfsmmopr
    + Prev: \ref cfsmmintro **/ /** @@ -208,7 +212,11 @@ The MM secondary header defined by the #MM_LoadDumpFileHeader_t data type. A variable size block of binary data that holds the memory contents dumped or the data to be loaded. - + + On some operating systems, MM also provides the ability to dump the symbol + table to a file. The resulting symbol table file does not include the + standard cFE file header. + Next: \ref cfsmmugsymbols
    Prev: \ref cfsmmugmemtypes
    Up To: \ref cfsmmovr @@ -457,7 +465,10 @@ #MM_MISSION_REV defines the mission-level revision number. The default value is 0. This value is appended to the major version, minor version, and revision numbers. It should be an integer value greater than or equal to 0. - + + Next: \ref cfsmmcmds
    + Prev: \ref cfsmmreq + **/ /** @@ -470,6 +481,11 @@ The following is a list of commands that are processed by the CFS Memory Manager Application. + + Next: \ref cfsmmtlm
    + Prev: \ref cfsmmdg + + **/ /** @@ -482,6 +498,11 @@ The following are telemetry packets generated by the CFS Memory Manager Application. + + Next: \ref cfsmmtbl
    + Prev: \ref cfsmmcmds + + **/ /** @@ -494,6 +515,11 @@ The CFS Memory Manager application does not utilize or manage any software tables. + + Next: \ref cfsmmcfg
    + Prev: \ref cfsmmtlm + + **/ /** @@ -507,15 +533,27 @@ The following are configuration parameters used to configure the CFS Memory Manager Application either for each platform or for a mission as a whole. + + Next: \ref cfsmmcons
    + Prev: \ref cfsmmtbl + + **/ /** \page cfsmmcons CFS Memory Manager Operational Constraints - No unique operational constraints have been identified for the MM application. + When loading memory from a file, it is the responsibility of the operators to + ensure that newly loaded symbol data fits within old symbol space. There is + currently no ability in MM to unload a symbol and load it back or dynamically + check for dependencies for the new code. + + + The Dump Symbol Table to File command does not work on the Linux operating + system. Next: \ref cfsmmfaqs
    - Prev: \ref cfsmmtbl + Prev: \ref cfsmmcfg **/ /** @@ -564,4 +602,4 @@ Prev: \ref cfsmmcons -**/ \ No newline at end of file +**/ diff --git a/fsw/mission_inc/mm_mission_cfg.h b/fsw/mission_inc/mm_mission_cfg.h index e0eb95c..c39d5a8 100644 --- a/fsw/mission_inc/mm_mission_cfg.h +++ b/fsw/mission_inc/mm_mission_cfg.h @@ -1,40 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_mission_cfg.h 1.1 2015/07/28 12:21:06EDT rperera Exp $ +** File: mm_mission_cfg.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager constants that can ** be configured from one mission to another ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS Development Standards Document -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_mission_cfg.h $ -** Revision 1.1 2015/07/28 12:21:06EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/mission_inc/project.pj -** Revision 1.3 2015/03/31 10:56:45EDT sstrege -** Added cfe_mission_cfg.h include -** Revision 1.2 2015/03/02 14:26:44EST sstrege -** Added copyright information -** Revision 1.1 2008/09/05 13:11:52EDT dahardison -** Initial revision -** Member added to project c:/MKSDATA/MKS-REPOSITORY/CFS-REPOSITORY/mm/fsw/mission_inc/project.pj -** *************************************************************************/ #ifndef _mm_mission_cfg_ #define _mm_mission_cfg_ @@ -45,40 +24,40 @@ #include "cfe_mission_cfg.h" /** \mmcfg CRC type for interrupts disabled loads -** +** ** \par Description: -** CFE CRC type to use when processing the "memory load with +** CFE CRC type to use when processing the "memory load with ** interrupts disabled" (#MM_LOAD_MEM_WID_CC) command. ** ** \par Limits: -** This must be one of the CRC types supported by the +** This must be one of the CRC types supported by the ** #CFE_ES_CalculateCRC function. */ -#define MM_LOAD_WID_CRC_TYPE CFE_ES_DEFAULT_CRC +#define MM_LOAD_WID_CRC_TYPE CFE_MISSION_ES_DEFAULT_CRC /** \mmcfg CRC type for load files -** +** ** \par Description: ** CFE CRC type to use when processing memory loads ** from a file. ** ** \par Limits: -** This must be one of the CRC types supported by the +** This must be one of the CRC types supported by the ** #CFE_ES_CalculateCRC function. */ -#define MM_LOAD_FILE_CRC_TYPE CFE_ES_DEFAULT_CRC +#define MM_LOAD_FILE_CRC_TYPE CFE_MISSION_ES_DEFAULT_CRC /** \mmcfg CRC type for dump files -** +** ** \par Description: ** CFE CRC type to use when processing memory dumps ** to a file. ** ** \par Limits: -** This must be one of the CRC types supported by the +** This must be one of the CRC types supported by the ** #CFE_ES_CalculateCRC function. */ -#define MM_DUMP_FILE_CRC_TYPE CFE_ES_DEFAULT_CRC +#define MM_DUMP_FILE_CRC_TYPE CFE_MISSION_ES_DEFAULT_CRC #endif /*_mm_mission_cfg_*/ diff --git a/fsw/mission_inc/mm_perfids.h b/fsw/mission_inc/mm_perfids.h index e0792dd..8fff5b5 100644 --- a/fsw/mission_inc/mm_perfids.h +++ b/fsw/mission_inc/mm_perfids.h @@ -1,33 +1,18 @@ /************************************************************************* -** File: -** $Id: mm_perfids.h 1.1 2015/07/28 12:21:08EDT rperera Exp $ +** File: mm_perfids.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** CFS Memory Manager (MM) Application Performance IDs ** -** Notes: -** -** $Log: mm_perfids.h $ -** Revision 1.1 2015/07/28 12:21:08EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/mission_inc/project.pj -** Revision 1.3 2015/03/02 14:26:52EST sstrege -** Added copyright information -** Revision 1.2 2010/05/21 15:35:03EDT jmdagost -** CHanged performance IDs to decimal values specified in the CFS Development Standards. -** Revision 1.1 2008/05/22 15:01:11EDT dahardison -** Initial revision -** Member added to project c:/MKSDATA/MKS-REPOSITORY/CFS-REPOSITORY/mm/fsw/mission_inc/project.pj -** *************************************************************************/ #ifndef _mm_perfids_ #define _mm_perfids_ @@ -36,13 +21,13 @@ ** Macro Definitions *************************************************************************/ /** -** \name MM CFS Application Performance IDs */ +** \name MM CFS Application Performance IDs */ /** \{ */ -#define MM_APPMAIN_PERF_ID 30 -#define MM_SEGBREAK_PERF_ID 31 -#define MM_EEPROM_POKE_PERF_ID 32 -#define MM_EEPROM_FILELOAD_PERF_ID 33 -#define MM_EEPROM_FILL_PERF_ID 34 +#define MM_APPMAIN_PERF_ID 30 +#define MM_SEGBREAK_PERF_ID 31 +#define MM_EEPROM_POKE_PERF_ID 32 +#define MM_EEPROM_FILELOAD_PERF_ID 33 +#define MM_EEPROM_FILL_PERF_ID 34 /** \} */ #endif /*_mm_perfids_*/ diff --git a/fsw/platform_inc/mm_msgids.h b/fsw/platform_inc/mm_msgids.h index 3ca7e2b..3db78ee 100644 --- a/fsw/platform_inc/mm_msgids.h +++ b/fsw/platform_inc/mm_msgids.h @@ -1,31 +1,18 @@ /************************************************************************* -** File: -** $Id: mm_msgids.h 1.1 2015/07/28 12:21:18EDT rperera Exp $ +** File: mm_msgids.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** CFS Memory Manager (MM) Application Message IDs ** -** Notes: -** -** $Log: mm_msgids.h $ -** Revision 1.1 2015/07/28 12:21:18EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/platform_inc/project.pj -** Revision 1.2 2015/03/02 14:26:59EST sstrege -** Added copyright information -** Revision 1.1 2008/05/22 14:59:11EDT dahardison -** Initial revision -** Member added to project c:/MKSDATA/MKS-REPOSITORY/CFS-REPOSITORY/mm/fsw/platform_inc/project.pj -** *************************************************************************/ #ifndef _mm_msgids_ #define _mm_msgids_ @@ -34,16 +21,16 @@ ** Macro Definitions *************************************************************************/ /** -** \name MM Command Message IDs */ +** \name MM Command Message IDs */ /** \{ */ -#define MM_CMD_MID 0x1888 /**< \brief Msg ID for cmds to mm */ -#define MM_SEND_HK_MID 0x1889 /**< \brief Msg ID to request mm HK */ +#define MM_CMD_MID 0x1888 /**< \brief Msg ID for cmds to mm */ +#define MM_SEND_HK_MID 0x1889 /**< \brief Msg ID to request mm HK */ /** \} */ /** -** \name MM Telemetry Message ID */ +** \name MM Telemetry Message ID */ /** \{ */ -#define MM_HK_TLM_MID 0x0887 /**< \brief MM Housekeeping Telemetry */ +#define MM_HK_TLM_MID 0x0887 /**< \brief MM Housekeeping Telemetry */ /** \} */ #endif /*_mm_msgids_*/ diff --git a/fsw/platform_inc/mm_platform_cfg.h b/fsw/platform_inc/mm_platform_cfg.h index 23f0258..3eabad0 100644 --- a/fsw/platform_inc/mm_platform_cfg.h +++ b/fsw/platform_inc/mm_platform_cfg.h @@ -1,53 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_platform_cfg.h 1.3 2016/10/31 16:33:42EDT mdeschu Exp $ +** File: mm_platform_cfg.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager constants that can ** be configured from one platform to another ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS Development Standards Document -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_platform_cfg.h $ -** Revision 1.3 2016/10/31 16:33:42EDT mdeschu -** Change MM dump file CFE subtype from 0 to 4D4D5354 (MMST in ascii hex) -** Revision 1.2 2016/10/31 16:30:38EDT mdeschu -** Move CFE subtype and description to public platform config header -** Revision 1.1 2015/07/28 12:21:20EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/platform_inc/project.pj -** Revision 1.9 2015/03/02 14:26:59EST sstrege -** Added copyright information -** Revision 1.8 2010/11/29 13:34:44EST jmdagost -** Changed 8, 16, and 32-bit memory type definitions to TRUE/FALSE. -** Revision 1.7 2010/11/26 13:03:54EST jmdagost -** Added mission revision revision number (moved from mm_version.h) -** Revision 1.6 2010/11/24 17:08:01EST jmdagost -** Add max number of bytes definition for symbol table dump -** Revision 1.5 2008/09/05 13:15:30EDT dahardison -** Moved CRC configuration parameters to mm_mission_cfg.h to be more -** consistent with other CFS applications -** Revision 1.4 2008/05/22 15:03:09EDT dahardison -** Moved message and performance monitor IDs to mm_msgids.h and -** mm_perfids.h -** Revision 1.3 2008/05/19 15:22:24EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_platform_cfg_ #define _mm_platform_cfg_ @@ -62,10 +28,8 @@ ** \par Limits: ** The file header data type for the value is 32 bits unsigned, ** thus the value can be anything from zero to 4,294,967,295. -** (limit is not verified) */ -#define MM_CFE_HDR_SUBTYPE 0x4D4D5354 - +#define MM_CFE_HDR_SUBTYPE 0x4D4D5354 /** ** \mmcfg Memory Management File -- cFE file header description @@ -78,63 +42,64 @@ ** The string length (including string terminator) cannot exceed ** #CFE_FS_HDR_DESC_MAX_LEN. (limit is not verified) */ -#define MM_CFE_HDR_DESCRIPTION "Memory Manager dump file" - +#define MM_CFE_HDR_DESCRIPTION "Memory Manager dump file" /** \mmcfg Maximum number of bytes for a file load to RAM memory -** +** ** \par Description: -** Maximum number of bytes that can be loaded into RAM from a +** Maximum number of bytes that can be loaded into RAM from a ** single load file. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** However, setting this value to a large number will increase -** the likelyhood of MM being late responding to housekeeping -** requests since it cannot process such a request while a load +** This parameter is limited only by the maximum value of the +** uint32 type. +** However, setting this value to a large number will increase +** the likelihood of MM being late responding to housekeeping +** requests since it cannot process such a request while a load ** or dump is in progress. */ -#define MM_MAX_LOAD_FILE_DATA_RAM (1024*1024) +#define MM_MAX_LOAD_FILE_DATA_RAM (1024 * 1024) /** \mmcfg Maximum number of bytes for a file load to EEPROM memory -** +** ** \par Description: -** Maximum number of bytes that can be loaded into EEPROM from a +** Maximum number of bytes that can be loaded into EEPROM from a ** single load file. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** However, setting this value to a large number will increase -** the likelyhood of MM being late responding to housekeeping -** requests since it cannot process such a request while a load +** This parameter is limited only by the maximum value of the +** uint32 type. +** However, setting this value to a large number will increase +** the likelihood of MM being late responding to housekeeping +** requests since it cannot process such a request while a load ** or dump is in progress. */ -#define MM_MAX_LOAD_FILE_DATA_EEPROM (128*1024) +#define MM_MAX_LOAD_FILE_DATA_EEPROM (128 * 1024) /** \mmcfg Maximum number of bytes for an uninterruptable load -** +** ** \par Description: -** Maximum number of bytes that can be loaded with the -** "memory load with interrupts disabled" (#MM_LOAD_MEM_WID_CC) +** Maximum number of bytes that can be loaded with the +** "memory load with interrupts disabled" (#MM_LOAD_MEM_WID_CC) ** command. ** ** \par Limits: ** This parameter is limited to the size of an uint8 which -** is the data type used to specify the number of bytes to +** is the data type used to specify the number of bytes to ** load in the command message. -* -** If this data type is made bigger, changing this value to a -** large number will increase the amount of time interrupts are -** disabled during the load. It should also be kept small enough -** to avoid packet segmentation for the command protocal being +* +** If this data type is made bigger, changing this value to a +** large number will increase the amount of time interrupts are +** disabled during the load. It should also be kept small enough +** to avoid packet segmentation for the command protocal being ** used. */ -#define MM_MAX_UNINTERRUPTABLE_DATA 200 +#define MM_MAX_UNINTERRUPTIBLE_DATA 200 /** \mmcfg Maximum number of bytes per load data segment -** +** ** \par Description: -** Maximum number of bytes MM will load per task cycle +** Maximum number of bytes MM will load per task cycle ** to prevent CPU hogging (segmented load). ** ** \par Limits: @@ -143,293 +108,310 @@ ** the amount of time available for other tasks to execute and ** increase MM CPU utilization during load operations. */ -#define MM_MAX_LOAD_DATA_SEG 200 +#define MM_MAX_LOAD_DATA_SEG 200 /** \mmcfg Maximum number of bytes for a file dump from RAM memory -** +** ** \par Description: ** Maximum number of bytes that can be dumped from RAM into a ** single dump file. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** However, setting this value to a large number will increase -** the likelyhood of MM being late responding to housekeeping -** requests since it cannot process such a request while a load +** This parameter is limited only by the maximum value of the +** uint32 type. +** However, setting this value to a large number will increase +** the likelihood of MM being late responding to housekeeping +** requests since it cannot process such a request while a load ** or dump is in progress. */ -#define MM_MAX_DUMP_FILE_DATA_RAM (1024*1024) +#define MM_MAX_DUMP_FILE_DATA_RAM (1024 * 1024) /** \mmcfg Maximum number of bytes for a file dump from EEPROM memory -** +** ** \par Description: ** Maximum number of bytes that can be dumped from EEPROM into a ** single dump file. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** However, setting this value to a large number will increase -** the likelyhood of MM being late responding to housekeeping -** requests since it cannot process such a request while a load +** This parameter is limited only by the maximum value of the +** uint32 type. +** However, setting this value to a large number will increase +** the likelihood of MM being late responding to housekeeping +** requests since it cannot process such a request while a load ** or dump is in progress. */ -#define MM_MAX_DUMP_FILE_DATA_EEPROM (128*1024) +#define MM_MAX_DUMP_FILE_DATA_EEPROM (128 * 1024) /** \mmcfg Maximum number of bytes for a symbol table file dump -** +** ** \par Description: ** Maximum number of bytes that can be dumped from the symbol table ** into a single dump file. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** However, setting this value to a large number will impact +** This parameter is limited only by the maximum value of the +** uint32 type. +** However, setting this value to a large number will impact ** the OSAL since it is responsible for generating the dump file. */ -#define MM_MAX_DUMP_FILE_DATA_SYMTBL (128*1024) +#define MM_MAX_DUMP_FILE_DATA_SYMTBL (128 * 1024) /** \mmcfg Maximum number of bytes per dump data segment -** +** ** \par Description: -** Maximum number of bytes MM will dump per task cycle +** Maximum number of bytes MM will dump per task cycle ** to prevent CPU hogging (segmented dump). ** ** \par Limits: -** The MM app does not place a limit on this parameter. +** This parameter is limited only by the maximum value of the +** uint32 type. ** However, setting this value to a large number will decrease ** the amount of time available for other tasks to execute and ** increase MM CPU utilization during dump operations. */ -#define MM_MAX_DUMP_DATA_SEG 200 +#define MM_MAX_DUMP_DATA_SEG 200 /** \mmcfg Maximum number of bytes for a fill to RAM memory -** +** ** \par Description: -** Maximum number of bytes that can be loaded into RAM with a +** Maximum number of bytes that can be loaded into RAM with a ** single memory fill command. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** However, setting this value to a large number will increase -** the likelyhood of MM being late responding to housekeeping +** This parameter is limited only by the maximum value of the +** uint32 type. +** However, setting this value to a large number will increase +** the likelihood of MM being late responding to housekeeping ** requests since it cannot process such a request while a fill ** operation is in progress. */ -#define MM_MAX_FILL_DATA_RAM (1024*1024) +#define MM_MAX_FILL_DATA_RAM (1024 * 1024) /** \mmcfg Maximum number of bytes for a fill to EEPROM memory -** +** ** \par Description: -** Maximum number of bytes that can be loaded into EEPROM with a +** Maximum number of bytes that can be loaded into EEPROM with a ** single memory fill command. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** However, setting this value to a large number will increase -** the likelyhood of MM being late responding to housekeeping +** This parameter is limited only by the maximum value of the +** uint32 type. +** However, setting this value to a large number will increase +** the likelihood of MM being late responding to housekeeping ** requests since it cannot process such a request while a fill ** operation is in progress. */ -#define MM_MAX_FILL_DATA_EEPROM (128*1024) +#define MM_MAX_FILL_DATA_EEPROM (128 * 1024) /** \mmcfg Maximum number of bytes per fill data segment -** +** ** \par Description: -** Maximum number of bytes MM will fill per task cycle +** Maximum number of bytes MM will fill per task cycle ** to prevent CPU hogging (segmented fill). ** ** \par Limits: -** The MM app does not place a limit on this parameter. +** This parameter is limited only by the maximum value of the +** uint32 type. ** However, setting this value to a large number will decrease ** the amount of time available for other tasks to execute and ** increase MM CPU utilization during memory fill operations. */ -#define MM_MAX_FILL_DATA_SEG 200 +#define MM_MAX_FILL_DATA_SEG 200 /** \mmcfg Optional MEM32 compile switch -** +** ** \par Description: ** Compile switch to include code for the optional MM_MEM32 memory. -** The value should be set to TRUE or FALSE. A value of TRUE will -** include the code. +** If defined the code will be included. Otherwise the code will be +** excluded. ** ** \par Limits: ** n/a */ -#define MM_OPT_CODE_MEM32_MEMTYPE TRUE +#define MM_OPT_CODE_MEM32_MEMTYPE /** \mmcfg Maximum number of bytes for a file load to MEM32 memory -** +** ** \par Description: -** Maximum number of bytes that can be loaded into the optional +** Maximum number of bytes that can be loaded into the optional ** MEM32 memory type from a single load file. ** ** \par Limits: ** This value should be longword aligned. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the +** uint32 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a load or dump is in progress. */ -#define MM_MAX_LOAD_FILE_DATA_MEM32 (1024*1024) +#define MM_MAX_LOAD_FILE_DATA_MEM32 (1024 * 1024) /** \mmcfg Maximum number of bytes for a file dump from MEM32 memory -** +** ** \par Description: -** Maximum number of bytes that can be dumped from the optional +** Maximum number of bytes that can be dumped from the optional ** MEM32 memory type to a single dump file. ** ** \par Limits: ** This value should be longword aligned. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the +** uint32 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a load or dump is in progress. */ -#define MM_MAX_DUMP_FILE_DATA_MEM32 (1024*1024) +#define MM_MAX_DUMP_FILE_DATA_MEM32 (1024 * 1024) /** \mmcfg Maximum number of bytes for a fill to MEM32 memory -** +** ** \par Description: ** Maximum number of bytes that can be loaded into the optional ** MEM32 memory type with a single memory fill command. ** ** \par Limits: ** This value should be longword aligned. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the +** uint16 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a memory fill operation ** is in progress. */ -#define MM_MAX_FILL_DATA_MEM32 (1024*1024) +#define MM_MAX_FILL_DATA_MEM32 (1024 * 1024) /** \mmcfg Optional MEM16 compile switch -** +** ** \par Description: ** Compile switch to include code for the optional MM_MEM16 memory. -** The value should be set to TRUE or FALSE. A value of TRUE will -** include the code. +** If defined the the code will be included. Otherwise it will be +** excluded. ** ** \par Limits: ** n/a */ -#define MM_OPT_CODE_MEM16_MEMTYPE TRUE +#define MM_OPT_CODE_MEM16_MEMTYPE /** \mmcfg Maximum number of bytes for a file load to MEM16 memory -** +** ** \par Description: -** Maximum number of bytes that can be loaded into the optional +** Maximum number of bytes that can be loaded into the optional ** MEM16 memory type from a single load file. ** ** \par Limits: ** This value should be word aligned. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the +** uint16 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a load or dump is in progress. */ -#define MM_MAX_LOAD_FILE_DATA_MEM16 (1024*1024) +#define MM_MAX_LOAD_FILE_DATA_MEM16 (1024 * 1024) /** \mmcfg Maximum number of bytes for a file dump from MEM16 memory -** +** ** \par Description: -** Maximum number of bytes that can be dumped from the optional +** Maximum number of bytes that can be dumped from the optional ** MEM16 memory type to a single dump file. ** ** \par Limits: ** This value should be word aligned. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** Setting this value to a large number will increase the likelyhood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a load or dump is in progress. */ -#define MM_MAX_DUMP_FILE_DATA_MEM16 (1024*1024) +#define MM_MAX_DUMP_FILE_DATA_MEM16 (1024 * 1024) /** \mmcfg Maximum number of bytes for a fill to MEM16 memory -** +** ** \par Description: ** Maximum number of bytes that can be loaded into the optional ** MEM16 memory type with a single memory fill command. ** ** \par Limits: ** This value should be word aligned. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the +** uint16 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a memory fill operation ** is in progress. */ -#define MM_MAX_FILL_DATA_MEM16 (1024*1024) +#define MM_MAX_FILL_DATA_MEM16 (1024 * 1024) /** \mmcfg Optional MEM8 compile switch -** +** ** \par Description: ** Compile switch to include code for the optional MM_MEM8 memory. -** The value should be set to TRUE or FALSE. A value of TRUE will -** include the code. +** If defined the code will be included. Otherwise the code will be +** excluded. ** ** \par Limits: ** n/a */ -#define MM_OPT_CODE_MEM8_MEMTYPE TRUE +#define MM_OPT_CODE_MEM8_MEMTYPE /** \mmcfg Maximum number of bytes for a file load to MEM8 memory -** +** ** \par Description: -** Maximum number of bytes that can be loaded into the optional +** Maximum number of bytes that can be loaded into the optional ** MEM8 memory type from a single load file. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the uint8 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a load or dump is in progress. */ -#define MM_MAX_LOAD_FILE_DATA_MEM8 (1024*1024) +#define MM_MAX_LOAD_FILE_DATA_MEM8 (1024 * 1024) /** \mmcfg Maximum number of bytes for a file dump from MEM8 memory -** +** ** \par Description: -** Maximum number of bytes that can be dumped from the optional +** Maximum number of bytes that can be dumped from the optional ** MEM8 memory type to a single dump file. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the uint8 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a load or dump is in progress. */ -#define MM_MAX_DUMP_FILE_DATA_MEM8 (1024*1024) +#define MM_MAX_DUMP_FILE_DATA_MEM8 (1024 * 1024) /** \mmcfg Maximum number of bytes for a fill to MEM8 memory -** +** ** \par Description: ** Maximum number of bytes that can be loaded into the optional ** MEM8 memory type with a single memory fill command. ** ** \par Limits: -** The MM app does not place a limit on this parameter. -** Setting this value to a large number will increase the likelyhood -** of MM being late responding to housekeeping requests since it +** This parameter is limited by the maximum value of the uint8 type. +** Setting this value to a large number will increase the likelihood +** of MM being late responding to housekeeping requests since it ** cannot process such a request while a memory fill operation ** is in progress. */ -#define MM_MAX_FILL_DATA_MEM8 (1024*1024) +#define MM_MAX_FILL_DATA_MEM8 (1024 * 1024) /** \mmcfg Segment break processor delay -** +** ** \par Description: -** How many milliseconds to delay between segments for dump, load, -** and fill operations. A value of zero cycles through the +** How many milliseconds to delay between segments for dump, load, +** and fill operations. A value of zero cycles through the ** OS scheduler, giving up what's left of the current timeslice. ** ** \par Limits: ** The MM app does not place a limit on this parameter. ** However, setting this value to a large number will increase the -** time required to process load, dump, and fill requests. -** It will also increase the likelyhood of MM being late responding -** to housekeeping requests since it cannot process such a request +** time required to process load, dump, and fill requests. +** It will also increase the likelyhood of MM being late responding +** to housekeeping requests since it cannot process such a request ** while a memory operation is in progress. */ -#define MM_PROCESSOR_CYCLE 0 +#define MM_PROCESSOR_CYCLE 0 /** \mmcfg Mission specific version number for MM application -** +** ** \par Description: ** An application version number consists of four parts: ** major version number, minor version number, revision @@ -441,7 +423,7 @@ ** Must be defined as a numeric value that is greater than ** or equal to zero. */ -#define MM_MISSION_REV 0 +#define MM_MISSION_REV 0 #endif /*_mm_platform_cfg_*/ diff --git a/fsw/src/mm_app.c b/fsw/src/mm_app.c index e3645d5..a4234fc 100644 --- a/fsw/src/mm_app.c +++ b/fsw/src/mm_app.c @@ -1,61 +1,20 @@ /************************************************************************ -** File: -** $Id: mm_app.c 1.3 2016/10/30 00:48:50EDT mdeschu Exp $ +** File: mm_app.c ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** The CFS Memory Manager (MM) Application provides onboard hardware -** and software maintenance services by processing commands for memory +** and software maintenance services by processing commands for memory ** operations and read and write accesses to memory mapped hardware. ** -** $Log: mm_app.c $ -** Revision 1.3 2016/10/30 00:48:50EDT mdeschu -** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent -** Revision 1.2 2015/12/29 15:22:45EST czogby -** Move function prototypes from .c files into .h files -** Revision 1.1 2015/07/28 12:21:35EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.17 2015/04/14 15:29:04EDT lwalling -** Removed unnecessary backslash characters from string format definitions -** Revision 1.16 2015/03/30 17:34:00EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.15 2015/03/20 14:16:55EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.14 2015/03/02 14:26:42EST sstrege -** Added copyright information -** Revision 1.13 2011/11/30 15:58:34EST jmdagost -** Removed unused local variable and function call, initialized local variables. -** Revision 1.12 2010/12/08 14:38:59EST jmdagost -** Added filename validation for symbol table dump command. -** Revision 1.11 2010/11/29 08:47:30EST jmdagost -** Added support for EEPROM write-enable/disable commands -** Revision 1.10 2010/11/26 13:04:49EST jmdagost -** Included mm_platform_cfg.h to access mission revision number. -** Revision 1.9 2010/11/24 17:09:20EST jmdagost -** Implemented the MM Write Symbol Table to File command -** Revision 1.8 2009/04/18 15:29:37EDT dkobe -** Corrected doxygen comments -** Revision 1.7 2008/09/06 15:33:57EDT dahardison -** Added support for new init and noop event strings with version information -** Revision 1.6 2008/09/06 15:01:15EDT dahardison -** Updated to support the symbol lookup ground command -** Revision 1.5 2008/09/05 14:27:44EDT dahardison -** Updated references of local HK variables and the MM_HousekeepingCmd -** function accordingly for changes related to DCR 3611 -** Revision 1.4 2008/05/22 15:15:05EDT dahardison -** Added header includes for mm_msgids.h and mm_perfids.h -** Revision 1.3 2008/05/19 15:22:53EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ /************************************************************************ @@ -85,77 +44,75 @@ MM_AppData_t MM_AppData; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void MM_AppMain(void) { - int32 Status = CFE_SUCCESS; - - /* - ** Register the application with Executive Services - */ - CFE_ES_RegisterApp(); - - /* - ** Create the first Performance Log entry - */ - CFE_ES_PerfLogEntry(MM_APPMAIN_PERF_ID); - - /* - ** Perform application specific initialization - */ - Status = MM_AppInit(); - if (Status != CFE_SUCCESS) - { - MM_AppData.RunStatus = CFE_ES_APP_ERROR; - } - - /* - ** Application main loop - */ - while(CFE_ES_RunLoop(&MM_AppData.RunStatus) == TRUE) - { - /* - ** Performance Log exit stamp - */ - CFE_ES_PerfLogExit(MM_APPMAIN_PERF_ID); - - /* - ** Pend on the arrival of the next Software Bus message - */ - Status = CFE_SB_RcvMsg(&MM_AppData.MsgPtr, MM_AppData.CmdPipe, CFE_SB_PEND_FOREVER); - - /* - ** Performance Log entry stamp - */ - CFE_ES_PerfLogEntry(MM_APPMAIN_PERF_ID); - - /* - ** Check the return status from the software bus - */ - if (Status == CFE_SUCCESS) - { - /* Process Software Bus message */ - MM_AppPipe(MM_AppData.MsgPtr); - } - else - { - /* - ** Exit on pipe read error - */ - CFE_EVS_SendEvent(MM_PIPE_ERR_EID, CFE_EVS_ERROR, - "SB Pipe Read Error, App will exit. RC = 0x%08X", (unsigned int)Status); - - MM_AppData.RunStatus = CFE_ES_APP_ERROR; - - } - } /* end CFS_ES_RunLoop while */ - - /* - ** Performance Log exit stamp - */ - CFE_ES_PerfLogExit(MM_APPMAIN_PERF_ID); - - /* - ** Exit the application - */ - CFE_ES_ExitApp(MM_AppData.RunStatus); + int32 Status = CFE_SUCCESS; + CFE_SB_Buffer_t *BufPtr = NULL; + + /* + ** Create the first Performance Log entry + */ + CFE_ES_PerfLogEntry(MM_APPMAIN_PERF_ID); + + /* + ** Perform application specific initialization + */ + Status = MM_AppInit(); + if (Status != CFE_SUCCESS) + { + MM_AppData.RunStatus = CFE_ES_RunStatus_APP_ERROR; + } + + /* + ** Application main loop + */ + while (CFE_ES_RunLoop(&MM_AppData.RunStatus) == true) + { + /* + ** Performance Log exit stamp + */ + CFE_ES_PerfLogExit(MM_APPMAIN_PERF_ID); + + /* + ** Pend on the arrival of the next Software Bus message + */ + Status = CFE_SB_ReceiveBuffer(&BufPtr, MM_AppData.CmdPipe, MM_SB_TIMEOUT); + /* + ** Performance Log entry stamp + */ + CFE_ES_PerfLogEntry(MM_APPMAIN_PERF_ID); + + /* + ** Check the return status from the software bus + */ + if ((Status == CFE_SUCCESS) && (BufPtr != NULL)) + { + /* Process Software Bus message */ + MM_AppPipe(BufPtr); + } + else if (Status == CFE_SB_TIME_OUT) + { + /* No action, but also no error */ + } + else + { + /* + ** Exit on pipe read error + */ + CFE_EVS_SendEvent(MM_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, + "SB Pipe Read Error, App will exit. RC = 0x%08X", (unsigned int)Status); + + MM_AppData.RunStatus = CFE_ES_RunStatus_APP_ERROR; + } + } /* end CFS_ES_RunLoop while */ + + /* + ** Performance Log exit stamp + */ + CFE_ES_PerfLogExit(MM_APPMAIN_PERF_ID); + + /* + ** Exit the application + */ + CFE_ES_ExitApp(MM_AppData.RunStatus); } /* end MM_AppMain */ @@ -166,106 +123,95 @@ void MM_AppMain(void) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int32 MM_AppInit(void) { - int32 Status = CFE_SUCCESS; - - /* - ** MM doesn't use the critical data store and - ** doesn't need to identify power on vs. processor resets. - ** If this changes add it here as shown in the qq_app.c template - */ - - /* - ** Setup the RunStatus variable - */ - MM_AppData.RunStatus = CFE_ES_APP_RUN; - - /* - ** Initialize application command execution counters - */ - MM_AppData.CmdCounter = 0; - MM_AppData.ErrCounter = 0; - - /* - ** Initialize application configuration data - */ - strcpy(MM_AppData.PipeName, "MM_CMD_PIPE"); - MM_AppData.PipeDepth = MM_CMD_PIPE_DEPTH; - - MM_AppData.LimitHK = MM_HK_LIMIT; - MM_AppData.LimitCmd = MM_CMD_LIMIT; - - /* - ** Register for event services - */ - Status = CFE_EVS_Register(NULL, 0, CFE_EVS_BINARY_FILTER); - - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("MM App: Error Registering For Event Services, RC = 0x%08X\n", (unsigned int)Status); - return (Status); - } - - /* - ** Initialize the local housekeeping telemetry packet (clear user data area) - */ - CFE_SB_InitMsg(&MM_AppData.HkPacket, MM_HK_TLM_MID, sizeof(MM_HkPacket_t), TRUE); - - /* - ** Create Software Bus message pipe - */ - Status = CFE_SB_CreatePipe(&MM_AppData.CmdPipe, MM_AppData.PipeDepth, MM_AppData.PipeName); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("MM App: Error Creating SB Pipe, RC = 0x%08X\n", (unsigned int)Status); - return (Status); - } - - /* - ** Subscribe to Housekeeping request commands - */ - Status = CFE_SB_Subscribe(MM_SEND_HK_MID, MM_AppData.CmdPipe); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("MM App: Error Subscribing to HK Request, RC = 0x%08X\n", (unsigned int)Status); - return (Status); - } - - /* - ** Subscribe to MM ground command packets - */ - Status = CFE_SB_Subscribe(MM_CMD_MID, MM_AppData.CmdPipe); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("MM App: Error Subscribing to MM Command, RC = 0x%08X\n", (unsigned int)Status); - return (Status); - } - - /* - ** MM doesn't use tables. If this changes add table registration - ** and initialization here as shown in the qq_app.c template - */ - - /* - ** MM doesn't use the critical data store. If this changes add CDS - ** creation here as shown in the qq_app.c template - */ - - /* - ** Initialize MM housekeeping information - */ - MM_ResetHk(); - - /* - ** Application startup event message - */ - CFE_EVS_SendEvent(MM_INIT_INF_EID, CFE_EVS_INFORMATION, - "MM Initialized. Version %d.%d.%d.%d", - MM_MAJOR_VERSION, - MM_MINOR_VERSION, - MM_REVISION, - MM_MISSION_REV); - - return(CFE_SUCCESS); + int32 Status = CFE_SUCCESS; + + /* + ** MM doesn't use the critical data store and + ** doesn't need to identify power on vs. processor resets. + ** If this changes add it here as shown in the qq_app.c template + */ + + /* + ** Setup the RunStatus variable + */ + MM_AppData.RunStatus = CFE_ES_RunStatus_APP_RUN; + + /* + ** Initialize application command execution counters + */ + MM_AppData.HkPacket.CmdCounter = 0; + MM_AppData.HkPacket.ErrCounter = 0; + + /* + ** Register for event services + */ + Status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); + + if (Status != CFE_SUCCESS) + { + CFE_ES_WriteToSysLog("MM App: Error Registering For Event Services, RC = 0x%08X\n", (unsigned int)Status); + return (Status); + } + + /* + ** Initialize the local housekeeping telemetry packet (clear user data area) + */ + CFE_MSG_Init(&MM_AppData.HkPacket.TlmHeader.Msg, MM_HK_TLM_MID, sizeof(MM_HkPacket_t)); + + /* + ** Create Software Bus message pipe + */ + Status = CFE_SB_CreatePipe(&MM_AppData.CmdPipe, MM_CMD_PIPE_DEPTH, "MM_CMD_PIPE"); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(MM_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Error Creating SB Pipe, RC = 0x%08X", Status); + return (Status); + } + + /* + ** Subscribe to Housekeeping request commands + */ + Status = CFE_SB_Subscribe(MM_SEND_HK_MID, MM_AppData.CmdPipe); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(MM_HK_SUB_ERR_EID, CFE_EVS_EventType_ERROR, "Error Subscribing to HK Request, RC = 0x%08X", + Status); + return (Status); + } + + /* + ** Subscribe to MM ground command packets + */ + Status = CFE_SB_Subscribe(MM_CMD_MID, MM_AppData.CmdPipe); + if (Status != CFE_SUCCESS) + { + CFE_EVS_SendEvent(MM_CMD_SUB_ERR_EID, CFE_EVS_EventType_ERROR, "Error Subscribing to MM Command, RC = 0x%08X", + Status); + return (Status); + } + + /* + ** MM doesn't use tables. If this changes add table registration + ** and initialization here as shown in the qq_app.c template + */ + + /* + ** MM doesn't use the critical data store. If this changes add CDS + ** creation here as shown in the qq_app.c template + */ + + /* + ** Initialize MM housekeeping information + */ + MM_ResetHk(); + + /* + ** Application startup event message + */ + CFE_EVS_SendEvent(MM_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "MM Initialized. Version %d.%d.%d.%d", + MM_MAJOR_VERSION, MM_MINOR_VERSION, MM_REVISION, MM_MISSION_REV); + + return (CFE_SUCCESS); } /* end MM_AppInit */ @@ -274,102 +220,117 @@ int32 MM_AppInit(void) /* Process a command pipe message */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_AppPipe(CFE_SB_MsgPtr_t msg) +void MM_AppPipe(const CFE_SB_Buffer_t *BufPtr) { - CFE_SB_MsgId_t MessageID = 0; - uint16 CommandCode = 0; - - MessageID = CFE_SB_GetMsgId(msg); - switch (MessageID) - { - /* - ** Housekeeping telemetry request - */ - case MM_SEND_HK_MID: - MM_HousekeepingCmd(msg); - break; - - /* - ** MM ground commands - */ - case MM_CMD_MID: - MM_ResetHk(); /* Clear all "Last Action" data */ - CommandCode = CFE_SB_GetCmdCode(msg); - switch (CommandCode) - { - case MM_NOOP_CC: - MM_NoopCmd(msg); - break; - - case MM_RESET_CC: - MM_ResetCmd(msg); - break; - - case MM_PEEK_CC: - MM_PeekCmd(msg); - break; - - case MM_POKE_CC: - MM_PokeCmd(msg); - break; - - case MM_LOAD_MEM_WID_CC: - MM_LoadMemWIDCmd(msg); - break; - - case MM_LOAD_MEM_FROM_FILE_CC: - MM_LoadMemFromFileCmd(msg); - break; - - case MM_DUMP_MEM_TO_FILE_CC: - MM_DumpMemToFileCmd(msg); - break; - - case MM_DUMP_IN_EVENT_CC: - MM_DumpInEventCmd(msg); - break; - - case MM_FILL_MEM_CC: - MM_FillMemCmd(msg); - break; - - case MM_LOOKUP_SYM_CC: - MM_LookupSymbolCmd(msg); - break; - - case MM_SYMTBL_TO_FILE_CC: - MM_SymTblToFileCmd(msg); - break; - - case MM_ENABLE_EEPROM_WRITE_CC: - MM_EepromWriteEnaCmd(msg); - break; - - case MM_DISABLE_EEPROM_WRITE_CC: - MM_EepromWriteDisCmd(msg); - break; - - default: - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_CC1_ERR_EID, CFE_EVS_ERROR, - "Invalid ground command code: ID = 0x%X, CC = %d", - MessageID, CommandCode); - break; - } - break; - - /* - ** Unrecognized Message ID - */ - default: - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_MID_ERR_EID, CFE_EVS_ERROR, - "Invalid command pipe message ID: 0x%X", MessageID); - break; - - } /* end switch */ - - return; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t CommandCode = 0; + + CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID); + + bool CmdResult = false; + + switch (MessageID) + { + /* + ** Housekeeping telemetry request + */ + case MM_SEND_HK_MID: + MM_HousekeepingCmd(BufPtr); + break; + + /* + ** MM ground commands + */ + case MM_CMD_MID: + MM_ResetHk(); /* Clear all "Last Action" data */ + + CFE_MSG_GetFcnCode(&BufPtr->Msg, &CommandCode); + switch (CommandCode) + { + case MM_NOOP_CC: + CmdResult = MM_NoopCmd(BufPtr); + break; + + case MM_RESET_CC: + CmdResult = MM_ResetCmd(BufPtr); + break; + + case MM_PEEK_CC: + CmdResult = MM_PeekCmd(BufPtr); + break; + + case MM_POKE_CC: + CmdResult = MM_PokeCmd(BufPtr); + break; + + case MM_LOAD_MEM_WID_CC: + CmdResult = MM_LoadMemWIDCmd(BufPtr); + break; + + case MM_LOAD_MEM_FROM_FILE_CC: + CmdResult = MM_LoadMemFromFileCmd(BufPtr); + break; + + case MM_DUMP_MEM_TO_FILE_CC: + CmdResult = MM_DumpMemToFileCmd(BufPtr); + break; + + case MM_DUMP_IN_EVENT_CC: + CmdResult = MM_DumpInEventCmd(BufPtr); + break; + + case MM_FILL_MEM_CC: + CmdResult = MM_FillMemCmd(BufPtr); + break; + + case MM_LOOKUP_SYM_CC: + CmdResult = MM_LookupSymbolCmd(BufPtr); + break; + + case MM_SYMTBL_TO_FILE_CC: + CmdResult = MM_SymTblToFileCmd(BufPtr); + break; + + case MM_ENABLE_EEPROM_WRITE_CC: + CmdResult = MM_EepromWriteEnaCmd(BufPtr); + break; + + case MM_DISABLE_EEPROM_WRITE_CC: + CmdResult = MM_EepromWriteDisCmd(BufPtr); + break; + + default: + CmdResult = false; + CFE_EVS_SendEvent(MM_CC1_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid ground command code: ID = 0x%08X, CC = %d", MessageID, CommandCode); + break; + } + + if (CommandCode != MM_RESET_CC) + { + if (CmdResult == true) + { + MM_AppData.HkPacket.CmdCounter++; + } + else + { + MM_AppData.HkPacket.ErrCounter++; + } + } + break; + + /* + ** Unrecognized Message ID + */ + default: + MM_AppData.HkPacket.ErrCounter++; + CFE_EVS_SendEvent(MM_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%08X", + MessageID); + break; + + } /* end switch */ + + return; } /* End MM_AppPipe */ @@ -378,41 +339,29 @@ void MM_AppPipe(CFE_SB_MsgPtr_t msg) /* Housekeeping request */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_HousekeepingCmd(CFE_SB_MsgPtr_t msg) +void MM_HousekeepingCmd(const CFE_SB_Buffer_t *BufPtr) { - uint16 ExpectedLength = sizeof (MM_NoArgsCmd_t); - - /* - ** Verify command packet length - */ - if (MM_VerifyCmdLength(msg, ExpectedLength)) - { - /* - ** Copy local housekeeping variables to packet structure - */ - MM_AppData.HkPacket.CmdCounter = MM_AppData.CmdCounter; - MM_AppData.HkPacket.ErrCounter = MM_AppData.ErrCounter; - MM_AppData.HkPacket.LastAction = MM_AppData.LastAction; - MM_AppData.HkPacket.MemType = MM_AppData.MemType; - MM_AppData.HkPacket.Address = MM_AppData.Address; - MM_AppData.HkPacket.DataValue = MM_AppData.DataValue; - MM_AppData.HkPacket.BytesProcessed = MM_AppData.BytesProcessed; - - strncpy(MM_AppData.HkPacket.FileName, MM_AppData.FileName, OS_MAX_PATH_LEN); - - /* - ** Send housekeeping telemetry packet - */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &MM_AppData.HkPacket); - CFE_SB_SendMsg((CFE_SB_Msg_t *) &MM_AppData.HkPacket); - - /* - ** This command does not affect the command execution counter - */ - - } /* end if */ - - return; + size_t ExpectedLength = sizeof(MM_NoArgsCmd_t); + + /* + ** Verify command packet length + */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + + /* + ** Send housekeeping telemetry packet + */ + CFE_SB_TimeStampMsg(&MM_AppData.HkPacket.TlmHeader.Msg); + CFE_SB_TransmitMsg(&MM_AppData.HkPacket.TlmHeader.Msg, true); + + /* + ** This command does not affect the command execution counter + */ + + } /* end if */ + + return; } /* end MM_HousekeepingCmd */ @@ -421,27 +370,23 @@ void MM_HousekeepingCmd(CFE_SB_MsgPtr_t msg) /* Noop command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_NoopCmd(CFE_SB_MsgPtr_t msg) +bool MM_NoopCmd(const CFE_SB_Buffer_t *BufPtr) { - uint16 ExpectedLength = sizeof(MM_NoArgsCmd_t); - - /* - ** Verify command packet length - */ - if(MM_VerifyCmdLength(msg, ExpectedLength)) - { - MM_AppData.LastAction = MM_NOOP; - MM_AppData.CmdCounter++; - - CFE_EVS_SendEvent(MM_NOOP_INF_EID, CFE_EVS_INFORMATION, - "No-op command. Version %d.%d.%d.%d", - MM_MAJOR_VERSION, - MM_MINOR_VERSION, - MM_REVISION, - MM_MISSION_REV); - } - - return; + size_t ExpectedLength = sizeof(MM_NoArgsCmd_t); + bool Result = false; + /* + ** Verify command packet length + */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + MM_AppData.HkPacket.LastAction = MM_NOOP; + Result = true; + + CFE_EVS_SendEvent(MM_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command. Version %d.%d.%d.%d", + MM_MAJOR_VERSION, MM_MINOR_VERSION, MM_REVISION, MM_MISSION_REV); + } + + return Result; } /* end MM_NoopCmd */ @@ -450,24 +395,24 @@ void MM_NoopCmd(CFE_SB_MsgPtr_t msg) /* Reset counters command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_ResetCmd(CFE_SB_MsgPtr_t msg) +bool MM_ResetCmd(const CFE_SB_Buffer_t *BufPtr) { - uint16 ExpectedLength = sizeof(MM_NoArgsCmd_t); - - /* - ** Verify command packet length - */ - if(MM_VerifyCmdLength(msg, ExpectedLength)) - { - MM_AppData.LastAction = MM_RESET; - MM_AppData.CmdCounter = 0; - MM_AppData.ErrCounter = 0; - - CFE_EVS_SendEvent(MM_RESET_DBG_EID, CFE_EVS_DEBUG, - "Reset counters command received"); - } - - return; + size_t ExpectedLength = sizeof(MM_NoArgsCmd_t); + bool Result = false; + /* + ** Verify command packet length + */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + MM_AppData.HkPacket.LastAction = MM_RESET; + MM_AppData.HkPacket.CmdCounter = 0; + MM_AppData.HkPacket.ErrCounter = 0; + + CFE_EVS_SendEvent(MM_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "Reset counters command received"); + Result = true; + } + + return Result; } /* end MM_ResetCmd */ @@ -476,65 +421,63 @@ void MM_ResetCmd(CFE_SB_MsgPtr_t msg) /* Lookup symbol name command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_LookupSymbolCmd(CFE_SB_MsgPtr_t msg) +bool MM_LookupSymbolCmd(const CFE_SB_Buffer_t *BufPtr) { - int32 OS_Status = OS_ERROR; /* Set to error instead of success since we explicitly test for success */ - uint32 ResolvedAddr = 0; - MM_LookupSymCmd_t *CmdPtr = NULL; - uint16 ExpectedLength = sizeof(MM_LookupSymCmd_t); - - /* - ** Verify command packet length - */ - if(MM_VerifyCmdLength(msg, ExpectedLength)) - { - CmdPtr = ((MM_LookupSymCmd_t *) msg); - - /* - ** NUL terminate the very end of the symbol name string as a - ** safety measure - */ - CmdPtr->SymName[OS_MAX_SYM_LEN - 1] = '\0'; - - /* - ** Check if the symbol name string is a nul string - */ - if(strlen(CmdPtr->SymName) == 0) - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_NUL_ERR_EID, CFE_EVS_ERROR, - "NUL (empty) string specified as symbol name"); - } - else - { - /* - ** If symbol name is not an empty string look it up using the OSAL API - */ - OS_Status = OS_SymbolLookup(&ResolvedAddr, CmdPtr->SymName); - if (OS_Status == OS_SUCCESS) - { - /* Update telemetry */ - MM_AppData.LastAction = MM_SYM_LOOKUP; - MM_AppData.Address = ResolvedAddr; - MM_AppData.CmdCounter++; - - CFE_EVS_SendEvent(MM_SYM_LOOKUP_INF_EID, CFE_EVS_INFORMATION, - "Symbol Lookup Command: Name = '%s' Addr = 0x%08X", - CmdPtr->SymName, (unsigned int)ResolvedAddr); - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - CmdPtr->SymName); - } - - } /* end strlen(CmdPtr->SymName) == 0 else */ - - } /* end MM_VerifyCmdLength if */ - - return; + int32 OS_Status = OS_ERROR; /* Set to error instead of success since we explicitly test for success */ + cpuaddr ResolvedAddr = 0; + MM_LookupSymCmd_t *CmdPtr = NULL; + size_t ExpectedLength = sizeof(MM_LookupSymCmd_t); + bool Result = false; + + /* + ** Verify command packet length + */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_LookupSymCmd_t *)BufPtr); + + /* + ** NUL terminate the very end of the symbol name string as a + ** safety measure + */ + CmdPtr->SymName[OS_MAX_SYM_LEN - 1] = '\0'; + + /* + ** Check if the symbol name string is a nul string + */ + if (strlen(CmdPtr->SymName) == 0) + { + CFE_EVS_SendEvent(MM_SYMNAME_NUL_ERR_EID, CFE_EVS_EventType_ERROR, + "NUL (empty) string specified as symbol name"); + } + else + { + /* + ** If symbol name is not an empty string look it up using the OSAL API + */ + OS_Status = OS_SymbolLookup(&ResolvedAddr, CmdPtr->SymName); + if (OS_Status == OS_SUCCESS) + { + /* Update telemetry */ + MM_AppData.HkPacket.LastAction = MM_SYM_LOOKUP; + MM_AppData.HkPacket.Address = ResolvedAddr; + + CFE_EVS_SendEvent(MM_SYM_LOOKUP_INF_EID, CFE_EVS_EventType_INFORMATION, + "Symbol Lookup Command: Name = '%s' Addr = 0x%08X", CmdPtr->SymName, + (unsigned int)ResolvedAddr); + Result = true; + } + else + { + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", CmdPtr->SymName); + } + + } /* end strlen(CmdPtr->SymName) == 0 else */ + + } /* end MM_VerifyCmdLength if */ + + return Result; } /* end MM_LookupSymbolCmd */ @@ -543,77 +486,73 @@ void MM_LookupSymbolCmd(CFE_SB_MsgPtr_t msg) /* Dump symbol table to file command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_SymTblToFileCmd(CFE_SB_MsgPtr_t msg) +bool MM_SymTblToFileCmd(const CFE_SB_Buffer_t *BufPtr) { - boolean Valid = TRUE; - int32 OS_Status = OS_ERROR; /* Set to error instead of success since we explicitly test for success */ - MM_SymTblToFileCmd_t *CmdPtr = NULL; - uint16 ExpectedLength = sizeof(MM_SymTblToFileCmd_t); - - /* - ** Verify command packet length - */ - if(MM_VerifyCmdLength(msg, ExpectedLength)) - { - CmdPtr = ((MM_SymTblToFileCmd_t *) msg); - - /* - ** NUL terminate the very end of the filename string as a - ** safety measure - */ - CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; - - /* - ** Check if the filename string is a nul string - */ - if(strlen(CmdPtr->FileName) == 0) - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMFILENAME_NUL_ERR_EID, CFE_EVS_ERROR, - "NUL (empty) string specified as symbol dump file name"); - } - else - { - Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); - - if (Valid == TRUE) - { - /* - ** If filename is good pass it to the OSAL API - */ - OS_Status = OS_SymbolTableDump(CmdPtr->FileName, MM_MAX_DUMP_FILE_DATA_SYMTBL); - if (OS_Status == OS_SUCCESS) - { - /* Update telemetry */ - MM_AppData.LastAction = MM_SYMTBL_SAVE; - strncpy(MM_AppData.FileName, CmdPtr->FileName, OS_MAX_PATH_LEN); - MM_AppData.CmdCounter++; - - CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_INF_EID, CFE_EVS_INFORMATION, - "Symbol Table Dump to File Started: Name = '%s'", - CmdPtr->FileName); - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_FAIL_ERR_EID, CFE_EVS_ERROR, - "Error dumping symbol table, OS_Status= 0x%X, File='%s'", - (unsigned int)OS_Status, CmdPtr->FileName); - } - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_INVALID_ERR_EID, CFE_EVS_ERROR, - "Illegal characters in target filename, File='%s'", - CmdPtr->FileName); - } - - } /* end strlen(CmdPtr->FileName) == 0 else */ - - } /* end MM_VerifyCmdLength if */ - - return; + bool Valid = true; + int32 OS_Status = OS_ERROR; /* Set to error instead of success since we explicitly test for success */ + MM_SymTblToFileCmd_t *CmdPtr = NULL; + size_t ExpectedLength = sizeof(MM_SymTblToFileCmd_t); + bool Result = false; + + /* + ** Verify command packet length + */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_SymTblToFileCmd_t *)BufPtr); + + /* + ** NUL terminate the very end of the filename string as a + ** safety measure + */ + CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; + + /* + ** Check if the filename string is a nul string + */ + if (strlen(CmdPtr->FileName) == 0) + { + CFE_EVS_SendEvent(MM_SYMFILENAME_NUL_ERR_EID, CFE_EVS_EventType_ERROR, + "NUL (empty) string specified as symbol dump file name"); + } + else + { + Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); + + if (Valid == true) + { + /* + ** If filename is good pass it to the OSAL API + */ + OS_Status = OS_SymbolTableDump(CmdPtr->FileName, MM_MAX_DUMP_FILE_DATA_SYMTBL); + if (OS_Status == OS_SUCCESS) + { + /* Update telemetry */ + MM_AppData.HkPacket.LastAction = MM_SYMTBL_SAVE; + strncpy(MM_AppData.HkPacket.FileName, CmdPtr->FileName, OS_MAX_PATH_LEN); + + CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_INF_EID, CFE_EVS_EventType_INFORMATION, + "Symbol Table Dump to File Started: Name = '%s'", CmdPtr->FileName); + Result = true; + } + else + { + CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_FAIL_ERR_EID, CFE_EVS_EventType_ERROR, + "Error dumping symbol table, OS_Status= 0x%X, File='%s'", (unsigned int)OS_Status, + CmdPtr->FileName); + } + } + else + { + CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_INVALID_ERR_EID, CFE_EVS_EventType_ERROR, + "Illegal characters in target filename, File='%s'", CmdPtr->FileName); + } + + } /* end strlen(CmdPtr->FileName) == 0 else */ + + } /* end MM_VerifyCmdLength if */ + + return Result; } /* end MM_SymTblToFileCmd */ @@ -622,45 +561,45 @@ void MM_SymTblToFileCmd(CFE_SB_MsgPtr_t msg) /* EEPROM write-enable command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_EepromWriteEnaCmd(CFE_SB_MsgPtr_t msg) +bool MM_EepromWriteEnaCmd(const CFE_SB_Buffer_t *BufPtr) { - int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */ - MM_EepromWriteEnaCmd_t *CmdPtr = NULL; - uint16 ExpectedLength = sizeof(MM_EepromWriteEnaCmd_t); - - /* - ** Verify command packet length - */ - if(MM_VerifyCmdLength(msg, ExpectedLength)) - { - CmdPtr = ((MM_EepromWriteEnaCmd_t *) msg); - - /* - ** Call the cFE to write-enable the requested bank - */ - cFE_Status = CFE_PSP_EepromWriteEnable(CmdPtr->Bank); - if (cFE_Status == CFE_PSP_SUCCESS) - { - /* Update telemetry */ - MM_AppData.LastAction = MM_EEPROMWRITE_ENA; - MM_AppData.MemType = MM_EEPROM; - MM_AppData.CmdCounter++; - - CFE_EVS_SendEvent(MM_EEPROM_WRITE_ENA_INF_EID, CFE_EVS_INFORMATION, - "EEPROM bank %d write enabled, cFE_Status= 0x%X", - (int)CmdPtr->Bank, (unsigned int)cFE_Status); - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_EEPROM_WRITE_ENA_ERR_EID, CFE_EVS_ERROR, - "Error requesting EEPROM bank %d write enable, cFE_Status= 0x%X", - (int)CmdPtr->Bank, (unsigned int)cFE_Status); - } - - } /* end MM_VerifyCmdLength if */ - - return; + int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */ + MM_EepromWriteEnaCmd_t *CmdPtr = NULL; + size_t ExpectedLength = sizeof(MM_EepromWriteEnaCmd_t); + bool Result = false; + + /* + ** Verify command packet length + */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_EepromWriteEnaCmd_t *)BufPtr); + + /* + ** Call the cFE to write-enable the requested bank + */ + cFE_Status = CFE_PSP_EepromWriteEnable(CmdPtr->Bank); + if (cFE_Status == CFE_PSP_SUCCESS) + { + /* Update telemetry */ + MM_AppData.HkPacket.LastAction = MM_EEPROMWRITE_ENA; + MM_AppData.HkPacket.MemType = MM_EEPROM; + + CFE_EVS_SendEvent(MM_EEPROM_WRITE_ENA_INF_EID, CFE_EVS_EventType_INFORMATION, + "EEPROM bank %d write enabled, cFE_Status= 0x%X", (int)CmdPtr->Bank, + (unsigned int)cFE_Status); + Result = true; + } + else + { + CFE_EVS_SendEvent(MM_EEPROM_WRITE_ENA_ERR_EID, CFE_EVS_EventType_ERROR, + "Error requesting EEPROM bank %d write enable, cFE_Status= 0x%X", (int)CmdPtr->Bank, + (unsigned int)cFE_Status); + } + + } /* end MM_VerifyCmdLength if */ + + return Result; } /* end MM_EepromWriteEnaCmd */ @@ -669,45 +608,44 @@ void MM_EepromWriteEnaCmd(CFE_SB_MsgPtr_t msg) /* EEPROM write-disable command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_EepromWriteDisCmd(CFE_SB_MsgPtr_t msg) +bool MM_EepromWriteDisCmd(const CFE_SB_Buffer_t *BufPtr) { - int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */ - MM_EepromWriteDisCmd_t *CmdPtr = NULL; - uint16 ExpectedLength = sizeof(MM_EepromWriteDisCmd_t); - - /* - ** Verify command packet length - */ - if(MM_VerifyCmdLength(msg, ExpectedLength)) - { - CmdPtr = ((MM_EepromWriteDisCmd_t *) msg); - - /* - ** Call the cFE to write-enable the requested bank - */ - cFE_Status = CFE_PSP_EepromWriteDisable(CmdPtr->Bank); - if (cFE_Status == CFE_PSP_SUCCESS) - { - /* Update telemetry */ - MM_AppData.LastAction = MM_EEPROMWRITE_DIS; - MM_AppData.MemType = MM_EEPROM; - MM_AppData.CmdCounter++; - - CFE_EVS_SendEvent(MM_EEPROM_WRITE_DIS_INF_EID, CFE_EVS_INFORMATION, - "EEPROM bank %d write disabled, cFE_Status= 0x%X", - (int)CmdPtr->Bank, (unsigned int)cFE_Status); - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_EEPROM_WRITE_DIS_ERR_EID, CFE_EVS_ERROR, - "Error requesting EEPROM bank %d write disable, cFE_Status= 0x%X", - (int)CmdPtr->Bank, (unsigned int)cFE_Status); - } - - } /* end MM_VerifyCmdLength if */ - - return; + int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */ + MM_EepromWriteDisCmd_t *CmdPtr = NULL; + size_t ExpectedLength = sizeof(MM_EepromWriteDisCmd_t); + bool Result = false; + + /* + ** Verify command packet length + */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_EepromWriteDisCmd_t *)BufPtr); + + /* + ** Call the cFE to write-enable the requested bank + */ + cFE_Status = CFE_PSP_EepromWriteDisable(CmdPtr->Bank); + if (cFE_Status == CFE_PSP_SUCCESS) + { + /* Update telemetry */ + MM_AppData.HkPacket.LastAction = MM_EEPROMWRITE_DIS; + MM_AppData.HkPacket.MemType = MM_EEPROM; + Result = true; + CFE_EVS_SendEvent(MM_EEPROM_WRITE_DIS_INF_EID, CFE_EVS_EventType_INFORMATION, + "EEPROM bank %d write disabled, cFE_Status= 0x%X", (int)CmdPtr->Bank, + (unsigned int)cFE_Status); + } + else + { + CFE_EVS_SendEvent(MM_EEPROM_WRITE_DIS_ERR_EID, CFE_EVS_EventType_ERROR, + "Error requesting EEPROM bank %d write disable, cFE_Status= 0x%X", (int)CmdPtr->Bank, + (unsigned int)cFE_Status); + } + + } /* end MM_VerifyCmdLength if */ + + return Result; } /* end MM_EepromWriteDisCmd */ diff --git a/fsw/src/mm_app.h b/fsw/src/mm_app.h index ef12212..5d6fbd6 100644 --- a/fsw/src/mm_app.h +++ b/fsw/src/mm_app.h @@ -1,46 +1,19 @@ /************************************************************************ -** File: -** $Id: mm_app.h 1.2 2015/12/29 15:22:20EST czogby Exp $ +** File: mm_app.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: -** Unit specification for the Core Flight System (CFS) -** Memory Manger (MM) Application. -** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_app.h $ -** Revision 1.2 2015/12/29 15:22:20EST czogby -** Move function prototypes from .c files into .h files -** Revision 1.1 2015/07/28 12:21:36EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.8 2015/04/06 15:41:02EDT lwalling -** Verify results of calls to PSP memory read/write/copy/set functions -** Revision 1.7 2015/03/30 17:33:56EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.6 2015/03/20 14:16:53EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.5 2015/03/02 14:26:41EST sstrege -** Added copyright information -** Revision 1.4 2008/09/05 14:24:51EDT dahardison -** Updated declaration of local HK variables -** Revision 1.3 2008/05/19 15:22:56EDT dahardison -** Version after completion of unit testing -** +** Purpose: +** Unit specification for the Core Flight System (CFS) +** Memory Manger (MM) Application. +** *************************************************************************/ #ifndef _mm_app_ #define _mm_app_ @@ -55,66 +28,66 @@ ** Macro Definitions *************************************************************************/ /** -** \name MM Command Pipe Parameters */ +** \name MM Command Pipe Parameters */ +/** \{ */ +#define MM_CMD_PIPE_DEPTH (3 * CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT) +/** \} */ + +/** +** \name MM Command Pipe Parameters */ /** \{ */ -#define MM_CMD_PIPE_DEPTH 12 -#define MM_HK_LIMIT 2 -#define MM_CMD_LIMIT 4 +#define MM_VERIFY_DUMP 0 +#define MM_VERIFY_LOAD 1 +#define MM_VERIFY_EVENT 2 +#define MM_VERIFY_FILL 3 +#define MM_VERIFY_WID 4 +#define MM_VERIFY_TYPES 5 /** \} */ +#define MM_MAX_MEM_TYPE_STR_LEN 11 /* length of MM_EEPROM + \0 */ + +/** +** \brief Wakeup for MM +** +** \par Description +** Wakes up MM every 1 second for routine maintenance whether a +** message was received or not. +*/ + +#define MM_SB_TIMEOUT 1000 + /************************************************************************ ** Type Definitions *************************************************************************/ -/** +/** ** \brief MM global data structure */ -typedef struct -{ - MM_HkPacket_t HkPacket; /**< \brief Housekeeping telemetry packet */ - - CFE_SB_MsgPtr_t MsgPtr; /**< \brief Pointer to command message */ - CFE_SB_PipeId_t CmdPipe; /**< \brief Command pipe ID */ - - uint32 RunStatus; /**< \brief Application run status */ - - char PipeName[16]; /**< \brief Command pipe name */ - uint16 PipeDepth; /**< \brief Command pipe message depth */ - - uint8 LimitHK; /**< \brief Houskeeping messages limit */ - uint8 LimitCmd; /**< \brief Command messages limit */ +typedef struct +{ + MM_HkPacket_t HkPacket; /**< \brief Housekeeping telemetry packet */ + + CFE_SB_PipeId_t CmdPipe; /**< \brief Command pipe ID */ + + uint32 RunStatus; /**< \brief Application run status */ + + uint32 LoadBuffer[MM_MAX_LOAD_DATA_SEG / 4]; /**< \brief Load file i/o buffer */ + uint32 DumpBuffer[MM_MAX_DUMP_DATA_SEG / 4]; /**< \brief Dump file i/o buffer */ + uint32 FillBuffer[MM_MAX_FILL_DATA_SEG / 4]; /**< \brief Fill memory buffer */ - uint8 CmdCounter; /**< \brief MM Application Command Counter */ - uint8 ErrCounter; /**< \brief MM Application Command Error Counter */ - uint8 LastAction; /**< \brief Last command action executed */ - uint8 MemType; /**< \brief Memory type for last command */ - uint32 Address; /**< \brief Fully resolved address used for last - command */ - uint32 DataValue; /**< \brief Last command data value -- may be - fill pattern or peek/poke value */ - uint32 BytesProcessed; /**< \brief Bytes processed for last command */ - - char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of the data file - used for last command, - where applicable */ - - uint32 LoadBuffer[MM_MAX_LOAD_DATA_SEG / 4]; /**< \brief Load file i/o buffer */ - uint32 DumpBuffer[MM_MAX_DUMP_DATA_SEG / 4]; /**< \brief Dump file i/o buffer */ - uint32 FillBuffer[MM_MAX_FILL_DATA_SEG / 4]; /**< \brief Fill memory buffer */ - -} MM_AppData_t; +} MM_AppData_t; /************************************************************************ ** Exported Functions *************************************************************************/ /************************************************************************/ /** \brief CFS Memory Manager (MM) application entry point -** +** ** \par Description ** Memory Manager application entry point and main process loop. ** ** \par Assumptions, External Events, and Notes: ** None -** +** *************************************************************************/ void MM_AppMain(void); @@ -123,16 +96,16 @@ void MM_AppMain(void); *************************************************************************/ /************************************************************************/ /** \brief Initialize the memory manager CFS application -** +** ** \par Description -** Memory manager application initialization routine. This -** function performs all the required startup steps to +** Memory manager application initialization routine. This +** function performs all the required startup steps to ** get the application registered with the cFE services so -** it can begin to receive command messages. +** it can begin to receive command messages. ** ** \par Assumptions, External Events, and Notes: ** None -** +** ** \returns ** \retcode #CFE_SUCCESS \retdesc \copydoc CFE_SUCCESS \endcode ** \retstmt Return codes from #CFE_EVS_Register \endcode @@ -141,11 +114,11 @@ void MM_AppMain(void); ** \endreturns ** *************************************************************************/ -int32 MM_AppInit(void); +int32 MM_AppInit(void); /************************************************************************/ /** \brief Process a command pipe message -** +** ** \par Description ** Processes a single software bus command pipe message. Checks ** the message and command IDs and calls the appropriate routine @@ -153,50 +126,50 @@ int32 MM_AppInit(void); ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] msg A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #CFE_SB_RcvMsg ** *************************************************************************/ -void MM_AppPipe(CFE_SB_MsgPtr_t msg); - +void MM_AppPipe(const CFE_SB_Buffer_t *msg); + /************************************************************************/ /** \brief Process housekeeping request -** +** ** \par Description ** Processes an on-board housekeeping request message. ** ** \par Assumptions, External Events, and Notes: ** This command does not affect the command execution counter -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] msg A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** *************************************************************************/ -void MM_HousekeepingCmd(CFE_SB_MsgPtr_t msg); - +void MM_HousekeepingCmd(const CFE_SB_Buffer_t *msg); + /************************************************************************/ /** \brief Process noop command -** +** ** \par Description ** Processes a noop ground command. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] msg A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_NOOP_CC ** *************************************************************************/ -void MM_NoopCmd(CFE_SB_MsgPtr_t msg); +bool MM_NoopCmd(const CFE_SB_Buffer_t *msg); /************************************************************************/ /** \brief Process reset counters command -** +** ** \par Description ** Processes a reset counters ground command which will reset ** the memory manager commmand error and command execution counters @@ -204,96 +177,95 @@ void MM_NoopCmd(CFE_SB_MsgPtr_t msg); ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_RESET_CC ** *************************************************************************/ -void MM_ResetCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_ResetCmd(const CFE_SB_Buffer_t *BufPtr); /************************************************************************/ /** \brief Process lookup symbol command -** +** ** \par Description -** Processes a lookup symbol ground command which takes a +** Processes a lookup symbol ground command which takes a ** symbol name and tries to resolve it to an address using the ** #OS_SymbolLookup OSAL function. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] msg A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_LOOKUP_SYM_CC ** *************************************************************************/ -void MM_LookupSymbolCmd(CFE_SB_MsgPtr_t msg); +bool MM_LookupSymbolCmd(const CFE_SB_Buffer_t *msg); /************************************************************************/ /** \brief Dump symbol table to file command -** +** ** \par Description -** Processes a dump symbol table to file ground command which calls +** Processes a dump symbol table to file ground command which calls ** the #OS_SymbolTableDump OSAL function using the specified dump ** file name. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] msg A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_SYMTBL_TO_FILE_CC ** *************************************************************************/ -void MM_SymTblToFileCmd(CFE_SB_MsgPtr_t msg); +bool MM_SymTblToFileCmd(const CFE_SB_Buffer_t *msg); /************************************************************************/ /** \brief Write-enable EEPROM command -** +** ** \par Description -** Processes a EEPROM write enable ground command which calls +** Processes a EEPROM write enable ground command which calls ** the #CFE_PSP_EepromWriteEnable cFE function using the specified ** bank number. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] msg A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_ENABLE_EEPROM_WRITE_CC ** *************************************************************************/ -void MM_EepromWriteEnaCmd(CFE_SB_MsgPtr_t msg); +bool MM_EepromWriteEnaCmd(const CFE_SB_Buffer_t *msg); /************************************************************************/ /** \brief Write-disable EEPROM command -** +** ** \par Description -** Processes a EEPROM write disable ground command which calls +** Processes a EEPROM write disable ground command which calls ** the #CFE_PSP_EepromWriteDisable cFE function using the specified ** bank number. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] msg A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_DISABLE_EEPROM_WRITE_CC ** *************************************************************************/ -void MM_EepromWriteDisCmd(CFE_SB_MsgPtr_t msg); +bool MM_EepromWriteDisCmd(const CFE_SB_Buffer_t *msg); /************************************************************************ ** Exported Data *************************************************************************/ -extern MM_AppData_t MM_AppData; - +extern MM_AppData_t MM_AppData; #endif /* _mm_app_ */ diff --git a/fsw/src/mm_dump.c b/fsw/src/mm_dump.c index 8f6b7c0..5cc45ec 100644 --- a/fsw/src/mm_dump.c +++ b/fsw/src/mm_dump.c @@ -1,60 +1,18 @@ /************************************************************************* -** File: -** $Id: mm_dump.c 1.6 2016/10/31 00:15:54EDT mdeschu Exp $ +** File: mm_dump.c ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Functions used for processing CFS Memory Manager memory dump commands ** -** $Log: mm_dump.c $ -** Revision 1.6 2016/10/31 00:15:54EDT mdeschu -** Add missing default switch case to MM_DumpMemToFileCmd and MM_FillDumpInEventBuffer -** Revision 1.5 2016/10/30 00:48:50EDT mdeschu -** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent -** Revision 1.4 2016/10/28 17:49:17EDT mdeschu -** Trac #32: Fix MM SendEvent buffer overrun -** Revision 1.3 2015/12/29 15:25:54EST czogby -** Move function prototypes from .c files into .h files -** Revision 1.2 2015/12/15 13:10:44EST czogby -** Change error message to print value of SegmentSize -** Revision 1.1 2015/07/28 12:21:38EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.15 2015/04/14 15:29:03EDT lwalling -** Removed unnecessary backslash characters from string format definitions -** Revision 1.14 2015/04/06 15:41:25EDT lwalling -** Verify results of calls to PSP memory read/write/copy/set functions -** Revision 1.13 2015/03/30 17:34:00EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.12 2015/03/20 14:16:25EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.11 2015/03/02 14:26:57EST sstrege -** Added copyright information -** Revision 1.10 2010/11/29 13:35:23EST jmdagost -** Replaced ifdef tests with if-true tests. -** Revision 1.9 2010/05/26 15:22:46EDT jmdagost -** In function MM_FillDumpInEventBuffer, put local variable declaration in a pre-processor conditional. -** Revision 1.8 2009/06/18 10:17:11EDT rmcgraw -** DCR8291:1 Changed OS_MEM_ #defines to CFE_PSP_MEM_ -** Revision 1.7 2009/06/10 14:04:22EDT rmcgraw -** DCR82191:1 Changed os_bsp to cfe_psp and OS_Mem to CFE_PSP_Mem -** Revision 1.6 2008/09/05 14:24:09EDT dahardison -** Updated references to local HK variables -** Revision 1.5 2008/09/05 13:14:45EDT dahardison -** Added inclusion of mm_mission_cfg.h -** Revision 1.4 2008/05/22 15:09:30EDT dahardison -** Changed inclusion of cfs_lib.h to cfs_utils.h -** Revision 1.3 2008/05/19 15:22:59EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ /************************************************************************* @@ -80,156 +38,141 @@ extern MM_AppData_t MM_AppData; /* */ /* Memory peek command */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_PeekCmd(CFE_SB_MsgPtr_t MessagePtr) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_PeekCmd(const CFE_SB_Buffer_t *BufPtr) { - boolean Valid = TRUE; - MM_PeekCmd_t *CmdPtr; - uint32 SrcAddress; - uint16 ExpectedLength = sizeof(MM_PeekCmd_t); - - /* Verify command packet length */ - if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - { - CmdPtr = ((MM_PeekCmd_t *)MessagePtr); - - /* Resolve the symbolic address in command message */ - Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); - - if(Valid == TRUE) - { - /* Run necessary checks on command parameters */ - Valid = MM_VerifyPeekPokeParams(SrcAddress, CmdPtr->MemType, CmdPtr->DataSize); - - /* Check the specified memory type and call the appropriate routine */ - if(Valid == TRUE) - { - /* - ** We use this single peek routine for all memory types - ** (including the optional ones) - */ - MM_PeekMem(CmdPtr, SrcAddress); - } - - } /* end CFS_ResolveSymAddr if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - CmdPtr->SrcSymAddress.SymName); - } - - } /* end MM_VerifyCmdLength if */ - - return; - + bool Valid = true; + MM_PeekCmd_t *CmdPtr; + cpuaddr SrcAddress; + uint16 ExpectedLength = sizeof(MM_PeekCmd_t); + bool Result = false; + + /* Verify command packet length */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_PeekCmd_t *)BufPtr); + + /* Resolve the symbolic address in command message */ + Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); + + if (Valid == true) + { + /* Run necessary checks on command parameters */ + Valid = MM_VerifyPeekPokeParams(SrcAddress, CmdPtr->MemType, CmdPtr->DataSize); + + /* Check the specified memory type and call the appropriate routine */ + if (Valid == true) + { + /* + ** We use this single peek routine for all memory types + ** (including the optional ones) + */ + Result = MM_PeekMem(CmdPtr, SrcAddress); + } + + } /* end CFS_ResolveSymAddr if */ + else + { + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", CmdPtr->SrcSymAddress.SymName); + } + + } /* end MM_VerifyCmdLength if */ + + return Result; + } /* end MM_PeekCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Read 8,16, or 32 bits of data from any given input address */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_PeekMem (MM_PeekCmd_t *CmdPtr, - uint32 SrcAddress) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_PeekMem(const MM_PeekCmd_t *CmdPtr, cpuaddr SrcAddress) { - boolean ValidPeek = TRUE; - uint8 ByteValue = 0; - uint16 WordValue = 0; - uint32 DWordValue = 0; - int32 PSP_Status = 0; - uint32 BytesProcessed = 0; - uint32 DataValue = 0; - - /* - ** Read the requested number of bytes and report in an event message - */ - switch(CmdPtr->DataSize) - { - case MM_BYTE_BIT_WIDTH: - - PSP_Status = CFE_PSP_MemRead8(SrcAddress, &ByteValue); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataValue = (uint32) ByteValue; - BytesProcessed = sizeof (uint8); - CFE_EVS_SendEvent(MM_PEEK_BYTE_INF_EID, CFE_EVS_INFORMATION, - "Peek Command: Addr = 0x%08X Size = 8 bits Data = 0x%02X", - (unsigned int)SrcAddress, ByteValue); - } - else - { - ValidPeek = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - (unsigned int)PSP_Status, (unsigned int)SrcAddress); - } - break; - - case MM_WORD_BIT_WIDTH: - - PSP_Status = CFE_PSP_MemRead16(SrcAddress, &WordValue); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataValue = (uint32) WordValue; - BytesProcessed = sizeof (uint16); - CFE_EVS_SendEvent(MM_PEEK_WORD_INF_EID, CFE_EVS_INFORMATION, - "Peek Command: Addr = 0x%08X Size = 16 bits Data = 0x%04X", - (unsigned int)SrcAddress, (unsigned short)DataValue); - } - else - { - ValidPeek = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - (unsigned int)PSP_Status, (unsigned int)SrcAddress); - } - break; - - case MM_DWORD_BIT_WIDTH: - - PSP_Status = CFE_PSP_MemRead32(SrcAddress, &DWordValue); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataValue = DWordValue; - BytesProcessed = sizeof(uint32); - CFE_EVS_SendEvent(MM_PEEK_DWORD_INF_EID, CFE_EVS_INFORMATION, - "Peek Command: Addr = 0x%08X Size = 32 bits Data = 0x%08X", - (unsigned int)SrcAddress, (unsigned int)DataValue); - } - else - { - ValidPeek = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - (unsigned int)PSP_Status, (unsigned int)SrcAddress); - } - break; - - /* - ** We don't need a default case, a bad DataSize will get caught - ** in the MM_VerifyPeekPokeParams function and we won't get here - */ - default: - break; - } - - if (ValidPeek) - { - MM_AppData.CmdCounter++; - MM_AppData.LastAction = MM_PEEK; - MM_AppData.MemType = CmdPtr->MemType; - MM_AppData.Address = SrcAddress; - MM_AppData.BytesProcessed = BytesProcessed; - MM_AppData.DataValue = DataValue; - } - - return; - + bool ValidPeek = false; + uint8 ByteValue = 0; + uint16 WordValue = 0; + uint32 DWordValue = 0; + int32 PSP_Status = 0; + uint32 BytesProcessed = 0; + uint32 DataValue = 0; + uint8 DataSize = 0; + uint32 EventID = 0; + + /* + ** Read the requested number of bytes and report in an event message + */ + switch (CmdPtr->DataSize) + { + case MM_BYTE_BIT_WIDTH: + + PSP_Status = CFE_PSP_MemRead8(SrcAddress, &ByteValue); + DataSize = 8; + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataValue = (uint32)ByteValue; + BytesProcessed = sizeof(uint8); + EventID = MM_PEEK_BYTE_INF_EID; + ValidPeek = true; + } + break; + + case MM_WORD_BIT_WIDTH: + + PSP_Status = CFE_PSP_MemRead16(SrcAddress, &WordValue); + DataSize = 16; + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataValue = (uint32)WordValue; + BytesProcessed = sizeof(uint16); + EventID = MM_PEEK_WORD_INF_EID; + ValidPeek = true; + } + break; + + case MM_DWORD_BIT_WIDTH: + + PSP_Status = CFE_PSP_MemRead32(SrcAddress, &DWordValue); + DataSize = 32; + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataValue = DWordValue; + BytesProcessed = sizeof(uint32); + EventID = MM_PEEK_DWORD_INF_EID; + ValidPeek = true; + } + break; + + /* + ** We don't need a default case, a bad DataSize will get caught + ** in the MM_VerifyPeekPokeParams function and we won't get here + */ + default: + break; + } + + if (ValidPeek) + { + MM_AppData.HkPacket.LastAction = MM_PEEK; + MM_AppData.HkPacket.MemType = CmdPtr->MemType; + MM_AppData.HkPacket.Address = SrcAddress; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + MM_AppData.HkPacket.DataValue = DataValue; + + CFE_EVS_SendEvent(EventID, CFE_EVS_EventType_INFORMATION, + "Peek Command: Addr = %p Size = %d bits Data = 0x%08X", (void *)SrcAddress, DataSize, + (unsigned int)DataValue); + } + else + { + CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP read memory error: RC=%d, Address=%p, MemType=MEM%d", PSP_Status, (void *)SrcAddress, + DataSize); + } + + return ValidPeek; + } /* end MM_PeekMem */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -237,812 +180,508 @@ void MM_PeekMem (MM_PeekCmd_t *CmdPtr, /* Dump memory to file comand */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_DumpMemToFileCmd(CFE_SB_MsgPtr_t MessagePtr) +bool MM_DumpMemToFileCmd(const CFE_SB_Buffer_t *BufPtr) { - boolean Valid = TRUE; - int32 OS_Status = OS_SUCCESS; - int32 FileHandle; - uint32 SrcAddress = 0; - MM_DumpMemToFileCmd_t *CmdPtr; - CFE_FS_Header_t CFEFileHeader; - MM_LoadDumpFileHeader_t MMFileHeader; - uint16 ExpectedLength = sizeof(MM_DumpMemToFileCmd_t); - - /* Verify command packet length */ - if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - { - CmdPtr = ((MM_DumpMemToFileCmd_t *)MessagePtr); - - /* - ** NUL terminate the very end of the file name string array as a - ** safety measure - */ - CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; - - /* Verify filename doesn't have any illegal characters */ - Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); - if(Valid == TRUE) - { - /* Resolve the symbolic address in command message */ - Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); - - if(Valid == TRUE) - { - /* Run necessary checks on command parameters */ - Valid = MM_VerifyFileDumpParams(SrcAddress, CmdPtr->MemType, CmdPtr->NumOfBytes); - - if(Valid == TRUE) + bool Valid = false; + int32 OS_Status = OS_SUCCESS; + osal_id_t FileHandle; + cpuaddr SrcAddress; + MM_DumpMemToFileCmd_t * CmdPtr; + CFE_FS_Header_t CFEFileHeader; + MM_LoadDumpFileHeader_t MMFileHeader; + uint16 ExpectedLength = sizeof(MM_DumpMemToFileCmd_t); + + /* Verify command packet length */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_DumpMemToFileCmd_t *)BufPtr); + + /* + ** NUL terminate the very end of the file name string array as a + ** safety measure + */ + CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; + + /* Verify filename doesn't have any illegal characters */ + Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); + if (Valid == true) + { + /* Resolve the symbolic address in command message */ + Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); + + if (Valid == true) { - /* - ** Initialize the cFE primary file header structure - */ - CFE_PSP_MemSet(&CFEFileHeader, 0, sizeof(CFE_FS_Header_t)); - CFEFileHeader.SubType = MM_CFE_HDR_SUBTYPE; - strcpy(&CFEFileHeader.Description[0], MM_CFE_HDR_DESCRIPTION); - - /* - ** Initialize the MM secondary file header structure - */ - CFE_PSP_MemSet(&MMFileHeader, 0, sizeof(MM_LoadDumpFileHeader_t)); - MMFileHeader.SymAddress.SymName[0] = MM_CLEAR_SYMNAME; - - /* - ** Copy command data to file secondary header - */ - MMFileHeader.SymAddress.Offset = SrcAddress; - MMFileHeader.MemType = CmdPtr->MemType; - MMFileHeader.NumOfBytes = CmdPtr->NumOfBytes; - - /* - ** Create and open dump file - */ - if((FileHandle = OS_creat(CmdPtr->FileName, OS_READ_WRITE)) >= 0) - { - /* Write the file headers */ - Valid = MM_WriteFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); - if(Valid == TRUE) - { - switch(MMFileHeader.MemType) - { - case MM_RAM: - case MM_EEPROM: - Valid = MM_DumpMemToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - break; - -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - Valid = MM_DumpMem32ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - break; + /* Run necessary checks on command parameters */ + Valid = MM_VerifyLoadDumpParams(SrcAddress, CmdPtr->MemType, CmdPtr->NumOfBytes, MM_VERIFY_DUMP); + + if (Valid == true) + { + /* + ** Initialize the cFE primary file header structure + */ + memset(&CFEFileHeader, 0, sizeof(CFE_FS_Header_t)); + CFEFileHeader.SubType = MM_CFE_HDR_SUBTYPE; + strncpy(&CFEFileHeader.Description[0], MM_CFE_HDR_DESCRIPTION, CFE_FS_HDR_DESC_MAX_LEN); + + /* + ** Initialize the MM secondary file header structure + */ + memset(&MMFileHeader, 0, sizeof(MM_LoadDumpFileHeader_t)); + MMFileHeader.SymAddress.SymName[0] = MM_CLEAR_SYMNAME; + + /* + ** Copy command data to file secondary header + */ + MMFileHeader.SymAddress.Offset = SrcAddress; + MMFileHeader.MemType = CmdPtr->MemType; + MMFileHeader.NumOfBytes = CmdPtr->NumOfBytes; + + /* + ** Create and open dump file + */ + OS_Status = OS_OpenCreate(&FileHandle, CmdPtr->FileName, + OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_WRITE); + if (OS_Status == OS_SUCCESS) + { + /* Write the file headers */ + Valid = MM_WriteFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); + if (Valid == true) + { + switch (MMFileHeader.MemType) + { + case MM_RAM: + case MM_EEPROM: + Valid = MM_DumpMemToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); + break; + +#ifdef MM_OPT_CODE_MEM32_MEMTYPE + case MM_MEM32: + Valid = MM_DumpMem32ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); + break; #endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - Valid = MM_DumpMem16ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - break; + +#ifdef MM_OPT_CODE_MEM16_MEMTYPE + case MM_MEM16: + Valid = MM_DumpMem16ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); + break; #endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - Valid = MM_DumpMem8ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - break; -#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - default: - /* This branch will never be executed. MMFileHeader.MemType will always - * be valid value for this switch statement it is verified via - * MM_VerifyFileDumpParams */ - break; - } - - if(Valid == TRUE) - { - /* - ** Compute CRC of dumped data - */ - OS_lseek(FileHandle, (sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t)), OS_SEEK_SET); - - OS_Status = CFS_ComputeCRCFromFile(FileHandle, &MMFileHeader.Crc, MM_DUMP_FILE_CRC_TYPE); - if(OS_Status == OS_SUCCESS) - { - /* - ** Rewrite the file headers. The subfunctions will take care of moving - ** the file pointer to the beginning of the file so we don't need to do it - ** here. - */ - Valid = MM_WriteFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); - - } /* end CFS_ComputeCRCFromFile if */ - else + +#ifdef MM_OPT_CODE_MEM8_MEMTYPE + case MM_MEM8: + Valid = MM_DumpMem8ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); + break; +#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ + default: + /* This branch will never be executed. MMFileHeader.MemType will always + * be valid value for this switch statement it is verified via + * MM_VerifyFileLoadDumpParams */ + Valid = false; + break; + } + + if (Valid == true) + { + /* + ** Compute CRC of dumped data + */ + OS_Status = + OS_lseek(FileHandle, (sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t)), + OS_SEEK_SET); + if (OS_Status != (sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t))) + { + Valid = false; + } + else + { + OS_Status = + CFS_ComputeCRCFromFile(FileHandle, &MMFileHeader.Crc, MM_DUMP_FILE_CRC_TYPE); + if (OS_Status == OS_SUCCESS) + { + /* + ** Rewrite the file headers. The subfunctions will take care of moving + ** the file pointer to the beginning of the file so we don't need to do it + ** here. + */ + Valid = MM_WriteFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, + &MMFileHeader); + + } /* end CFS_ComputeCRCFromFile if */ + else + { + Valid = false; + CFE_EVS_SendEvent( + MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFS_ComputeCRCFromFile error received: RC = 0x%08X File = '%s'", + (unsigned int)OS_Status, CmdPtr->FileName); + } + } + + } /* end Valid == true if */ + + if (Valid == true) + { + CFE_EVS_SendEvent( + MM_DMP_MEM_FILE_INF_EID, CFE_EVS_EventType_INFORMATION, + "Dump Memory To File Command: Dumped %d bytes from address 0x%08X to file '%s'", + (int)MM_AppData.HkPacket.BytesProcessed, (unsigned int)SrcAddress, + CmdPtr->FileName); + /* + ** Update last action statistics + */ + MM_AppData.HkPacket.LastAction = MM_DUMP_TO_FILE; + strncpy(MM_AppData.HkPacket.FileName, CmdPtr->FileName, OS_MAX_PATH_LEN); + MM_AppData.HkPacket.MemType = CmdPtr->MemType; + MM_AppData.HkPacket.Address = SrcAddress; + MM_AppData.HkPacket.BytesProcessed = CmdPtr->NumOfBytes; + } + + } /* end MM_WriteFileHeaders if */ + + /* Close dump file */ + if ((OS_Status = OS_close(FileHandle)) != OS_SUCCESS) { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_ERROR, - "CFS_ComputeCRCFromFile error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, - CmdPtr->FileName); - } - - } /* end Valid == TRUE if */ - - if(Valid == TRUE) - { - MM_AppData.CmdCounter++; - CFE_EVS_SendEvent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, - "Dump Memory To File Command: Dumped %d bytes from address 0x%08X to file '%s'", - (int)MM_AppData.BytesProcessed, (unsigned int)SrcAddress, CmdPtr->FileName); - /* - ** Update last action statistics - */ - MM_AppData.LastAction = MM_DUMP_TO_FILE; - strncpy(MM_AppData.FileName, CmdPtr->FileName, OS_MAX_PATH_LEN); - MM_AppData.MemType = CmdPtr->MemType; - MM_AppData.Address = SrcAddress; - MM_AppData.BytesProcessed = CmdPtr->NumOfBytes; - } - - } /* end MM_WriteFileHeaders if */ - - /* - ** Don't need an 'else' here. MM_WriteFileHeaders will increment - ** the error counter and generate an event message if needed. - */ - - /* Close dump file */ - if((OS_Status = OS_close(FileHandle)) != OS_SUCCESS) - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_CLOSE_ERR_EID, CFE_EVS_ERROR, - "OS_close error received: RC = 0x%08X File = '%s'", - (unsigned int)OS_Status, CmdPtr->FileName); - } - - } /* end OS_creat if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_CREAT_ERR_EID, CFE_EVS_ERROR, - "OS_creat error received: RC = 0x%08X File = '%s'", - (unsigned int)FileHandle, CmdPtr->FileName); - } - - } /* end MM_VerifyFileDumpParams if */ - - } /* end CFS_ResolveSymAddr if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - CmdPtr->SrcSymAddress.SymName); - } - } /* end IsValidFilename if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_CMD_FNAME_ERR_EID, CFE_EVS_ERROR, - "Command specified filename invalid: Name = '%s'", CmdPtr->FileName); - } - - } /* end MM_VerifyCmdLength if */ - - return; - + Valid = false; + CFE_EVS_SendEvent(MM_OS_CLOSE_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_close error received: RC = 0x%08X File = '%s'", + (unsigned int)OS_Status, CmdPtr->FileName); + } + + } /* end OS_OpenCreate if */ + else + { + Valid = false; + CFE_EVS_SendEvent(MM_OS_CREAT_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_OpenCreate error received: RC = %d File = '%s'", (int)OS_Status, + CmdPtr->FileName); + } + + } /* end MM_VerifyFileLoadDumpParams if */ + + } /* end CFS_ResolveSymAddr if */ + else + { + Valid = false; + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", CmdPtr->SrcSymAddress.SymName); + } + } /* end IsValidFilename if */ + else + { + Valid = false; + CFE_EVS_SendEvent(MM_CMD_FNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Command specified filename invalid: Name = '%s'", CmdPtr->FileName); + } + + } /* end MM_VerifyCmdLength if */ + + return Valid; + } /* end MM_DumpMemoryToFileCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Dump the requested number of bytes from memory to a file */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_DumpMemToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_DumpMemToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader) { - boolean ValidDump = FALSE; - int32 OS_Status; - int32 PSP_Status; - uint32 BytesRemaining = FileHeader->NumOfBytes; - uint32 BytesProcessed = 0; - uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - uint8 *SourcePtr = (uint8 *)FileHeader->SymAddress.Offset; - uint8 *ioBuffer = (uint8 *) &MM_AppData.DumpBuffer[0]; - - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - { - SegmentSize = BytesRemaining; - } - - PSP_Status = CFE_PSP_MemCpy(ioBuffer, SourcePtr, SegmentSize); - if (PSP_Status == CFE_PSP_SUCCESS) - { - OS_Status = OS_write(FileHandle, ioBuffer, SegmentSize); - if (OS_Status == SegmentSize) - { + bool ValidDump = false; + int32 OS_Status; + uint32 BytesRemaining = FileHeader->NumOfBytes; + uint32 BytesProcessed = 0; + uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; + uint8 *SourcePtr = (uint8 *)(FileHeader->SymAddress.Offset); + uint8 *ioBuffer = (uint8 *)&MM_AppData.DumpBuffer[0]; + + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) + { + SegmentSize = BytesRemaining; + } + + memcpy(ioBuffer, SourcePtr, SegmentSize); + + OS_Status = OS_write(FileHandle, ioBuffer, SegmentSize); + if (OS_Status == SegmentSize) + { SourcePtr += SegmentSize; BytesRemaining -= SegmentSize; BytesProcessed += SegmentSize; /* Prevent CPU hogging between dump segments */ - if (BytesRemaining != 0) + if (BytesRemaining != 0) { - MM_SegmentBreak(); + MM_SegmentBreak(); } - } - else - { + } + else + { BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - "OS_write error received: RC = 0x%08X, Expected = %d, File = '%s'", - (unsigned int)OS_Status, (int)SegmentSize, FileName); - } - } - else - { - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - (unsigned int)PSP_Status, (unsigned int) SourcePtr, (unsigned int)ioBuffer, (unsigned int)SegmentSize); - } - } - - /* Update last action statistics */ - if (BytesProcessed == FileHeader->NumOfBytes) - { - ValidDump = TRUE; - MM_AppData.LastAction = MM_DUMP_TO_FILE; - MM_AppData.MemType = FileHeader->MemType; - MM_AppData.Address = FileHeader->SymAddress.Offset; - MM_AppData.BytesProcessed = BytesProcessed; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - } - - return(ValidDump); - -} /* end MM_DumpMemToFile */ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* */ -/* Verify dump memory to file command parameters */ -/* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyFileDumpParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes) -{ - boolean Valid = TRUE; - int32 OS_Status; - - switch(MemType) - { - case MM_RAM: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_RAM)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; - - case MM_EEPROM: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_EEPROM)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; - -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_MEM32)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_MEM16)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_MEM8)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - - default: - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - "Invalid memory type specified: MemType = %d", MemType); - break; - } - - return (Valid); + CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_write error received: RC = %d, Expected = %d, File = '%s'", OS_Status, + (int)SegmentSize, FileName); + } + } + + /* Update last action statistics */ + if (BytesProcessed == FileHeader->NumOfBytes) + { + ValidDump = true; + MM_AppData.HkPacket.LastAction = MM_DUMP_TO_FILE; + MM_AppData.HkPacket.MemType = FileHeader->MemType; + MM_AppData.HkPacket.Address = FileHeader->SymAddress.Offset; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + } + + return (ValidDump); -} /* end MM_VerifyFileDumpParams */ +} /* end MM_DumpMemToFile */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Write the cFE primary and and MM secondary file headers */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_WriteFileHeaders(char *FileName, - int32 FileHandle, - CFE_FS_Header_t *CFEHeader, - MM_LoadDumpFileHeader_t *MMHeader) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_WriteFileHeaders(const char *FileName, int32 FileHandle, CFE_FS_Header_t *CFEHeader, + const MM_LoadDumpFileHeader_t *MMHeader) { - boolean Valid = TRUE; - int32 OS_Status; - - /* - ** Write out the primary cFE file header - */ - OS_Status = CFE_FS_WriteHeader(FileHandle, CFEHeader); - if(OS_Status != sizeof(CFE_FS_Header_t)) - { - /* We either got an error or didn't write as much data as expected */ - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_CFE_FS_WRITEHDR_ERR_EID, CFE_EVS_ERROR, - "CFE_FS_WriteHeader error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)OS_Status, sizeof(CFE_FS_Header_t), FileName); - - - } /* end CFE_FS_WriteHeader if */ - else - { - /* - ** Write out the secondary MM file header - */ - OS_Status = OS_write(FileHandle, MMHeader, sizeof(MM_LoadDumpFileHeader_t)); - if(OS_Status != sizeof(MM_LoadDumpFileHeader_t)) - { - /* We either got an error or didn't read as much data as expected */ - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)OS_Status, sizeof(MM_LoadDumpFileHeader_t), FileName); - - } /* end OS_write if */ - - } /* end CFE_FS_WriteHeader else */ - - return (Valid); - + bool Valid = true; + int32 OS_Status; + + /* + ** Write out the primary cFE file header + */ + OS_Status = CFE_FS_WriteHeader(FileHandle, CFEHeader); + if (OS_Status != sizeof(CFE_FS_Header_t)) + { + /* We either got an error or didn't write as much data as expected */ + Valid = false; + CFE_EVS_SendEvent(MM_CFE_FS_WRITEHDR_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_FS_WriteHeader error received: RC = %d Expected = %d File = '%s'", OS_Status, + (int)sizeof(CFE_FS_Header_t), FileName); + + } /* end CFE_FS_WriteHeader if */ + else + { + /* + ** Write out the secondary MM file header + */ + OS_Status = OS_write(FileHandle, MMHeader, sizeof(MM_LoadDumpFileHeader_t)); + if (OS_Status != sizeof(MM_LoadDumpFileHeader_t)) + { + /* We either got an error or didn't read as much data as expected */ + Valid = false; + CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_write error received: RC = %d Expected = %d File = '%s'", OS_Status, + (int)sizeof(MM_LoadDumpFileHeader_t), FileName); + + } /* end OS_write if */ + + } /* end CFE_FS_WriteHeader else */ + + return (Valid); + } /* end MM_WriteFileHeaders */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Dump memory in event message command */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_DumpInEventCmd(CFE_SB_MsgPtr_t MessagePtr) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_DumpInEventCmd(const CFE_SB_Buffer_t *BufPtr) { - boolean Valid = TRUE; - MM_DumpInEventCmd_t *CmdPtr; - uint32 i; - uint32 SrcAddress; - uint16 ExpectedLength = sizeof(MM_DumpInEventCmd_t); - uint8 *BytePtr; - char TempString[MM_DUMPINEVENT_TEMP_CHARS]; -static char EventString[CFE_EVS_MAX_MESSAGE_LENGTH]; - - /* - ** Allocate a dump buffer. It's declared this way to ensure it stays - ** longword aligned since MM_MAX_DUMP_INEVENT_BYTES can be adjusted - ** by changing the maximum event message string size. - */ - uint32 DumpBuffer[(MM_MAX_DUMP_INEVENT_BYTES + 3)/4]; - - /* Verify command packet length */ - if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - { - CmdPtr = ((MM_DumpInEventCmd_t *)MessagePtr); - - /* Resolve the symbolic source address in the command message */ - Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); - - if(Valid == TRUE) - { - /* Run necessary checks on command parameters */ - Valid = MM_VerifyDumpInEventParams(SrcAddress, CmdPtr->MemType, CmdPtr->NumOfBytes); - - if(Valid == TRUE) - { - /* Fill a local data buffer with the dump words */ - Valid = MM_FillDumpInEventBuffer(SrcAddress, CmdPtr, (uint8 *)DumpBuffer); - - if(Valid == TRUE) + bool Valid = false; + MM_DumpInEventCmd_t *CmdPtr; + uint32 i; + cpuaddr SrcAddress; + uint16 ExpectedLength = sizeof(MM_DumpInEventCmd_t); + uint8 * BytePtr; + char TempString[MM_DUMPINEVENT_TEMP_CHARS]; + static char EventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; + + /* + ** Allocate a dump buffer. It's declared this way to ensure it stays + ** longword aligned since MM_MAX_DUMP_INEVENT_BYTES can be adjusted + ** by changing the maximum event message string size. + */ + uint32 DumpBuffer[(MM_MAX_DUMP_INEVENT_BYTES + 3) / 4]; + + /* Verify command packet length */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_DumpInEventCmd_t *)BufPtr); + + /* Resolve the symbolic source address in the command message */ + Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); + + if (Valid == true) + { + /* Run necessary checks on command parameters */ + Valid = MM_VerifyLoadDumpParams(SrcAddress, CmdPtr->MemType, CmdPtr->NumOfBytes, MM_VERIFY_EVENT); + + if (Valid == true) { - /* - ** Prepare event message string header - ** 13 characters, not counting NUL terminator - */ - strcpy(EventString, "Memory Dump: "); - - /* - ** Build dump data string - ** Each byte of data requires 5 characters of string space - ** Note this really only allows up to ~15 bytes using default config - */ - BytePtr = (uint8 *)DumpBuffer; - for (i = 0; i < CmdPtr->NumOfBytes && i < MM_MAX_DUMP_INEVENT_BYTES; i++) - { - sprintf(TempString, "0x%02X ", *BytePtr); - strcat(EventString, TempString); - BytePtr++; - } - - /* - ** Append tail - ** This adds up to 33 characters including the NUL terminator - */ - sprintf(TempString, "from address: 0x%08lX", (unsigned long)SrcAddress); - strcat(EventString, TempString); - - /* Send it out */ - CFE_EVS_SendEvent(MM_DUMP_INEVENT_INF_EID, CFE_EVS_INFORMATION, "%s", EventString); - /* Update telemetry */ - MM_AppData.LastAction = MM_DUMP_INEVENT; - MM_AppData.MemType = CmdPtr->MemType; - MM_AppData.Address = SrcAddress; - MM_AppData.BytesProcessed = CmdPtr->NumOfBytes; - MM_AppData.CmdCounter++; - } /* end MM_FillDumpInEventBuffer if */ - } /* end MM_VerifyDumpInEventParams if */ - } /* end CFS_ResolveSymAddr if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - CmdPtr->SrcSymAddress.SymName); - } - - } /* end MM_VerifyCmdLength if */ - - return; - + /* Fill a local data buffer with the dump words */ + Valid = MM_FillDumpInEventBuffer(SrcAddress, CmdPtr, (uint8 *)DumpBuffer); + + if (Valid == true) + { + /* + ** Prepare event message string header + ** 13 characters, not counting NUL terminator + */ + strncpy(EventString, "Memory Dump: ", CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); + + /* + ** Build dump data string + ** Each byte of data requires 5 characters of string space + ** Note this really only allows up to ~15 bytes using default config + */ + BytePtr = (uint8 *)DumpBuffer; + for (i = 0; i < CmdPtr->NumOfBytes; i++) + { + snprintf(TempString, MM_DUMPINEVENT_TEMP_CHARS, "0x%02X ", *BytePtr); + strncat(EventString, TempString, strlen(TempString)); + BytePtr++; + } + + /* + ** Append tail + ** This adds up to 33 characters including the NUL terminator + */ + snprintf(TempString, MM_DUMPINEVENT_TEMP_CHARS, "from address: 0x%08lX", (unsigned long)SrcAddress); + strncat(EventString, TempString, strlen(TempString)); + + /* Send it out */ + CFE_EVS_SendEvent(MM_DUMP_INEVENT_INF_EID, CFE_EVS_EventType_INFORMATION, "%s", EventString); + + /* Update telemetry */ + MM_AppData.HkPacket.LastAction = MM_DUMP_INEVENT; + MM_AppData.HkPacket.MemType = CmdPtr->MemType; + MM_AppData.HkPacket.Address = SrcAddress; + MM_AppData.HkPacket.BytesProcessed = CmdPtr->NumOfBytes; + } /* end MM_FillDumpInEventBuffer if */ + } /* end MM_VerifyFileLoadDumpParams if */ + } /* end CFS_ResolveSymAddr if */ + else + { + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", CmdPtr->SrcSymAddress.SymName); + } + + } /* end MM_VerifyCmdLength if */ + + return Valid; + } /* end MM_DumpWordsInEventCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* Verify dump memory in event messsage command parameters */ +/* Fill a buffer with data to be dumped in an event message string */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyDumpInEventParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_FillDumpInEventBuffer(cpuaddr SrcAddress, const MM_DumpInEventCmd_t *CmdPtr, void *DumpBuffer) { - boolean Valid = TRUE; - int32 OS_Status; - - /* - ** Verify dump size is within limits. The limit is dictated by the - ** maximum event message string length and applies to all memory - ** types - */ - if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_INEVENT_BYTES)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - else - { - /* - ** Run a bunch of other sanity checks - */ - switch(MemType) - { - case MM_RAM: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - break; - - case MM_EEPROM: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - } +#if defined(MM_OPT_CODE_MEM8_MEMTYPE) || defined(MM_OPT_CODE_MEM16_MEMTYPE) || defined(MM_OPT_CODE_MEM32_MEMTYPE) + uint32 i; +#endif + int32 PSP_Status; + bool Valid = true; + + /* Initialize buffer */ + memset(DumpBuffer, 0, MM_MAX_DUMP_INEVENT_BYTES); + + switch (CmdPtr->MemType) + { + case MM_RAM: + case MM_EEPROM: + memcpy((void *)DumpBuffer, (void *)SrcAddress, CmdPtr->NumOfBytes); break; -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) +#ifdef MM_OPT_CODE_MEM32_MEMTYPE + case MM_MEM32: + for (i = 0; i < (CmdPtr->NumOfBytes / 4); i++) { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); + PSP_Status = CFE_PSP_MemRead32(SrcAddress, (uint32 *)DumpBuffer); + if (PSP_Status == CFE_PSP_SUCCESS) + { + SrcAddress += sizeof(uint32); + DumpBuffer = (uint8 *)DumpBuffer + sizeof(uint32); + } + else + { + /* CFE_PSP_MemRead32 error */ + Valid = false; + CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM32", PSP_Status, + (void *)SrcAddress, (void *)DumpBuffer); + /* Stop load dump buffer loop */ + break; + } } break; #endif /* MM_OPT_CODE_MEM32_MEMTYPE */ -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) +#ifdef MM_OPT_CODE_MEM16_MEMTYPE + case MM_MEM16: + for (i = 0; i < (CmdPtr->NumOfBytes / 2); i++) { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); + PSP_Status = CFE_PSP_MemRead16(SrcAddress, (uint16 *)DumpBuffer); + if (PSP_Status == CFE_PSP_SUCCESS) + { + SrcAddress += sizeof(uint16); + DumpBuffer = (uint8 *)DumpBuffer + sizeof(uint16); + } + else + { + /* CFE_PSP_MemRead16 error */ + Valid = false; + CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM16", PSP_Status, + (void *)SrcAddress, (void *)DumpBuffer); + /* Stop load dump buffer loop */ + break; + } } break; #endif /* MM_OPT_CODE_MEM16_MEMTYPE */ -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) +#ifdef MM_OPT_CODE_MEM8_MEMTYPE + case MM_MEM8: + for (i = 0; i < CmdPtr->NumOfBytes; i++) { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); + PSP_Status = CFE_PSP_MemRead8(SrcAddress, (uint8 *)DumpBuffer); + if (PSP_Status == CFE_PSP_SUCCESS) + { + SrcAddress++; + DumpBuffer = (uint8 *)DumpBuffer + 1; + } + else + { + /* CFE_PSP_MemRead8 error */ + Valid = false; + CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM8", PSP_Status, + (void *)SrcAddress, (void *)DumpBuffer); + /* Stop load dump buffer loop */ + break; + } } break; - - default: - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - "Invalid memory type specified: MemType = %d", MemType); +#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ + default: + /* This branch will never be executed. CmdPtr->MemType will always + * be valid value for this switch statement it is verified via + * MM_VerifyFileLoadDumpParams */ + Valid = false; break; -#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - } - - } /* end SizeInBytes else */ - - return (Valid); - -} /* end MM_VerifyDumpInEventParams */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* */ -/* Fill a buffer with data to be dumped in an event message string */ -/* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_FillDumpInEventBuffer(uint32 SrcAddress, - MM_DumpInEventCmd_t *CmdPtr, - uint8 *DumpBuffer) -{ -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) || (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) || (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - uint32 i; -#endif - int32 PSP_Status; - boolean Valid = TRUE; - - /* Initialize buffer */ - PSP_Status = CFE_PSP_MemSet(DumpBuffer, 0, MM_MAX_DUMP_INEVENT_BYTES); - - switch (CmdPtr->MemType) - { - case MM_RAM: - case MM_EEPROM: - PSP_Status = CFE_PSP_MemCpy((void *)DumpBuffer, (void *)SrcAddress, CmdPtr->NumOfBytes); - if (PSP_Status != CFE_PSP_SUCCESS) - { - CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer, (unsigned int)CmdPtr->NumOfBytes); - MM_AppData.ErrCounter++; - Valid = FALSE; - } - break; - - #if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - for (i = 0; i < (CmdPtr->NumOfBytes / 4); i++) - { - PSP_Status = CFE_PSP_MemRead32(SrcAddress, (uint32 *)DumpBuffer); - if (PSP_Status == CFE_PSP_SUCCESS) - { - SrcAddress += sizeof (uint32); - DumpBuffer += sizeof (uint32); - } - else - { - /* CFE_PSP_MemRead32 error */ - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM32", - (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer); - /* Stop load dump buffer loop */ - break; - } - } - break; - #endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - - #if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - for (i = 0; i < (CmdPtr->NumOfBytes / 2); i++) - { - PSP_Status = CFE_PSP_MemRead16(SrcAddress, (uint16 *)DumpBuffer); - if (PSP_Status == CFE_PSP_SUCCESS) - { - SrcAddress += sizeof (uint16); - DumpBuffer += sizeof (uint16); - } - else - { - /* CFE_PSP_MemRead16 error */ - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM16", - (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer); - /* Stop load dump buffer loop */ - break; - } - } - break; - #endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - - #if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - for (i = 0; i < CmdPtr->NumOfBytes; i++) - { - PSP_Status = CFE_PSP_MemRead8(SrcAddress, DumpBuffer); - if (PSP_Status == CFE_PSP_SUCCESS) - { - SrcAddress ++; - DumpBuffer ++; - } - else - { - /* CFE_PSP_MemRead8 error */ - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM8", - (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer); - /* Stop load dump buffer loop */ - break; - } - } - break; - #endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - default: - /* This branch will never be executed. CmdPtr->MemType will always - * be valid value for this switch statement it is verified via - * MM_VerifyDumpInEventParams */ - break; - - } /* end CmdPtr->MemType switch */ - - return(Valid); - + } /* end CmdPtr->MemType switch */ + + return (Valid); + } /* end FillDumpInEventBuffer */ /************************/ diff --git a/fsw/src/mm_dump.h b/fsw/src/mm_dump.h index 1e63fd6..f0c13c4 100644 --- a/fsw/src/mm_dump.h +++ b/fsw/src/mm_dump.h @@ -1,39 +1,18 @@ /************************************************************************* -** File: -** $Id: mm_dump.h 1.3 2016/10/28 17:49:18EDT mdeschu Exp $ +** File: mm_dump.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager memory dump ground commands. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_dump.h $ -** Revision 1.3 2016/10/28 17:49:18EDT mdeschu -** Trac #32: Fix MM SendEvent buffer overrun -** Revision 1.2 2015/12/29 15:22:20EST czogby -** Move function prototypes from .c files into .h files -** Revision 1.1 2015/07/28 12:21:40EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.4 2015/03/02 14:26:51EST sstrege -** Added copyright information -** Revision 1.3 2008/05/19 15:23:03EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_dump_ #define _mm_dump_ @@ -50,8 +29,8 @@ *************************************************************************/ /* ** This macro defines the maximum number of bytes that can be dumped -** in an event message string based upon the setting of the -** CFE_EVS_MAX_MESSAGE_LENGTH configuration parameter. +** in an event message string based upon the setting of the +** CFE_MISSION_EVS_MAX_MESSAGE_LENGTH configuration parameter. ** ** The event message format is: ** Message head "Memory Dump: " 13 characters @@ -59,20 +38,20 @@ ** Message tail "from address: 0xFFFFFFFF" 33 characters including NUL on 64-bit system */ /** -** \name Maximum dump bytes in an event string */ +** \name Maximum dump bytes in an event string */ /** \{ */ -#define MM_MAX_DUMP_INEVENT_BYTES ((CFE_EVS_MAX_MESSAGE_LENGTH - (13 + 33)) / 5) +#define MM_MAX_DUMP_INEVENT_BYTES ((CFE_MISSION_EVS_MAX_MESSAGE_LENGTH - (13 + 33)) / 5) /** \} */ /* ** This macro defines the size of the scratch buffer used to build ** the dump in event message string. Set it to the size of the -** largest piece shown above including room for a NUL terminator. +** largest piece shown above including room for a NUL terminator. */ /** -** \name Dump in an event scratch string size */ +** \name Dump in an event scratch string size */ /** \{ */ -#define MM_DUMPINEVENT_TEMP_CHARS 36 +#define MM_DUMPINEVENT_TEMP_CHARS 36 /** \} */ /************************************************************************* @@ -80,95 +59,62 @@ *************************************************************************/ /************************************************************************/ /** \brief Memory peek -** +** ** \par Description -** Support function for #MM_PeekCmd. This routine will read +** Support function for #MM_PeekCmd. This routine will read ** 8, 16, or 32 bits of data and send it in an event message. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] CmdPtr A #MM_PeekCmd_t pointer to the peek +** +** \param [in] CmdPtr A #MM_PeekCmd_t pointer to the peek ** command message ** -** \param [in] SrcAddress The source address for the peek operation -** +** \param [in] SrcAddress The source address for the peek operation +** *************************************************************************/ -void MM_PeekMem (MM_PeekCmd_t *CmdPtr, - uint32 SrcAddress); +bool MM_PeekMem(const MM_PeekCmd_t *CmdPtr, cpuaddr SrcAddress); /************************************************************************/ /** \brief Memory dump to file -** +** ** \par Description -** Support function for #MM_DumpMemToFileCmd. This routine will +** Support function for #MM_DumpMemToFileCmd. This routine will ** read an address range and store the data in a file. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] FileHandle The open file handle of the dump file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the dump file +** +** \param [in] FileName A pointer to a character string holding ** the dump file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the dump file header structure initialized -** with data based upon the command message +** with data based upon the command message ** parameters ** ** \returns ** \retstmt Returns TRUE if the dump completed successfully \endcode ** \retstmt Returns FALSE if the dump failed due to an error \endcode ** \endreturns -** -*************************************************************************/ -boolean MM_DumpMemToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader); - -/************************************************************************/ -/** \brief Verify memory dump to file parameters -** -** \par Description -** This routine will run various checks on the source address, -** memory type, and data size (in bytes) for a dump memory to -** file command. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \param [in] Address The source address for the requested -** dump operation -** -** \param [in] MemType The source memory type for the requested -** dump operation -** -** \param [in] SizeInBytes The number of bytes for the requested -** dump operation -** -** \returns -** \retstmt Returns TRUE if all the parameter checks passed \endcode -** \retstmt Returns FALSE any parameter check failed \endcode -** \endreturns ** *************************************************************************/ -boolean MM_VerifyFileDumpParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes); +bool MM_DumpMemToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader); /************************************************************************/ /** \brief Write the cFE primary and and MM secondary file headers -** +** ** \par Description -** Support function for #MM_DumpMemToFileCmd. This routine will +** Support function for #MM_DumpMemToFileCmd. This routine will ** write the cFE primary and MM secondary headers to the ** file specified by the FileHandle. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] FileName A pointer to a character string holding +** +** \param [in] FileName A pointer to a character string holding ** the file name (used only for error event ** messages). ** @@ -180,7 +126,7 @@ boolean MM_VerifyFileDumpParams(uint32 Address, ** cFE primary file header structure to be ** written. ** -** \param [in] MMHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] MMHeader A #MM_LoadDumpFileHeader_t pointer to ** the MM secondary file header structure ** to be written. ** @@ -188,58 +134,26 @@ boolean MM_VerifyFileDumpParams(uint32 Address, ** \retstmt Returns TRUE if the headers were written successfully \endcode ** \retstmt Returns FALSE if a write error occurred \endcode ** \endreturns -** -*************************************************************************/ -boolean MM_WriteFileHeaders(char *FileName, - int32 FileHandle, - CFE_FS_Header_t *CFEHeader, - MM_LoadDumpFileHeader_t *MMHeader); - -/************************************************************************/ -/** \brief Verify memory dump in event message parameters -** -** \par Description -** This routine will run various checks on the source address, -** memory type, and data size (in bytes) for a dump memory in -** event message command. -** -** \par Assumptions, External Events, and Notes: -** None -** -** \param [in] Address The source address for the requested -** dump operation -** -** \param [in] MemType The source memory type for the requested -** dump operation -** -** \param [in] SizeInBytes The number of bytes for the requested -** dump operation -** -** \returns -** \retstmt Returns TRUE if all the parameter checks passed \endcode -** \retstmt Returns FALSE any parameter check failed \endcode -** \endreturns ** *************************************************************************/ -boolean MM_VerifyDumpInEventParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes); +bool MM_WriteFileHeaders(const char *FileName, int32 FileHandle, CFE_FS_Header_t *CFEHeader, + const MM_LoadDumpFileHeader_t *MMHeader); /************************************************************************/ /** \brief Fill dump memory in event message buffer -** +** ** \par Description -** Support function for #MM_DumpInEventCmd. This routine will +** Support function for #MM_DumpInEventCmd. This routine will ** read an address range and store the data in a byte array. ** It will properly adjust for optional memory types that may ** require 16 or 32 bit reads. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] SrcAddress The source address to read from ** -** \param [in] CmdPtr A #MM_DumpInEventCmd_t pointer to the +** \param [in] SrcAddress The source address to read from +** +** \param [in] CmdPtr A #MM_DumpInEventCmd_t pointer to the ** dump in event command message ** ** \param [in] DumpBuffer A pointer to the byte array to store @@ -254,65 +168,63 @@ boolean MM_VerifyDumpInEventParams(uint32 Address, ** \endreturns ** *************************************************************************/ -boolean MM_FillDumpInEventBuffer(uint32 SrcAddress, - MM_DumpInEventCmd_t *CmdPtr, - uint8 *DumpBuffer); +bool MM_FillDumpInEventBuffer(cpuaddr SrcAddress, const MM_DumpInEventCmd_t *CmdPtr, void *DumpBuffer); /************************************************************************/ /** \brief Process memory peek command -** +** ** \par Description ** Processes the memory peek command that will read a memory ** location and report the data in an event message. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_PEEK_CC ** *************************************************************************/ -void MM_PeekCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_PeekCmd(const CFE_SB_Buffer_t *BufPtr); /************************************************************************/ /** \brief Process memory dump to file command -** +** ** \par Description -** Processes the memory dump to file command that will read a +** Processes the memory dump to file command that will read a ** address range of memory and store the data in a command ** specified file. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_DUMP_MEM_TO_FILE_CC ** *************************************************************************/ -void MM_DumpMemToFileCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_DumpMemToFileCmd(const CFE_SB_Buffer_t *BufPtr); /************************************************************************/ /** \brief Process memory dump in event command -** +** ** \par Description -** Processes the memory dump in event command that will read +** Processes the memory dump in event command that will read ** up to #MM_MAX_DUMP_INEVENT_BYTES from memory and report ** the data in an event message. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_DUMP_IN_EVENT_CC, #MM_MAX_DUMP_INEVENT_BYTES ** *************************************************************************/ -void MM_DumpInEventCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_DumpInEventCmd(const CFE_SB_Buffer_t *BufPtr); #endif /* _mm_dump_ */ diff --git a/fsw/src/mm_events.h b/fsw/src/mm_events.h index 94439a2..383fede 100644 --- a/fsw/src/mm_events.h +++ b/fsw/src/mm_events.h @@ -1,62 +1,25 @@ /************************************************************************ -** File: -** $Id: mm_events.h 1.1 2015/07/28 12:21:42EDT rperera Exp $ +** File: mm_events.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manger event identifers. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS Development Standards Document -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_events.h $ -** Revision 1.1 2015/07/28 12:21:42EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.13 2015/04/06 15:41:22EDT lwalling -** Verify results of calls to PSP memory read/write/copy/set functions -** Revision 1.12 2015/03/02 14:26:33EST sstrege -** Added copyright information -** Revision 1.11 2011/12/05 15:16:32EST jmdagost -** Added zero-bytes-read event message for memory loads from file. -** Revision 1.10 2010/12/08 14:38:29EST jmdagost -** Added "bad filename" event to symbol table dump cmd, updated subsequent event numbers. -** Revision 1.9 2010/11/29 08:47:12EST jmdagost -** Added support for EEPROM write-enable/disable commands -** Revision 1.8 2010/11/24 17:07:24EST jmdagost -** Added event messages for Write Symbol Table To File command -** Revision 1.7 2009/06/12 14:37:32EDT rmcgraw -** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem -** Revision 1.6 2008/09/06 15:33:30EDT dahardison -** Modified doxygen comment blocks for new init and noop -** event strings with version information -** Revision 1.5 2008/09/06 15:01:09EDT dahardison -** Updated to support the symbol lookup ground command -** Revision 1.4 2008/09/05 12:34:20EDT dahardison -** Added an event message for a housekeeping request with a bad message length -** Revision 1.3 2008/05/19 15:23:05EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_events_ #define _mm_events_ /** \brief 'MM Initialized. Version \%d.\%d.\%d.\%d' ** \event 'MM Initialized. Version \%d.\%d.\%d.\%d' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -66,13 +29,13 @@ ** ** The \c Version fields contain the #MM_MAJOR_VERSION, ** #MM_MINOR_VERSION, #MM_REVISION, and #MM_MISSION_REV -** version identifiers. +** version identifiers. */ -#define MM_INIT_INF_EID 1 +#define MM_INIT_INF_EID 1 /** \brief 'No-op command. Version \%d.\%d.\%d.\%d' ** \event 'No-op command. Version \%d.\%d.\%d.\%d' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -81,40 +44,40 @@ ** ** The \c Version fields contain the #MM_MAJOR_VERSION, ** #MM_MINOR_VERSION, #MM_REVISION, and #MM_MISSION_REV -** version identifiers. +** version identifiers. */ -#define MM_NOOP_INF_EID 2 +#define MM_NOOP_INF_EID 2 /** \brief 'Reset counters command received' ** \event 'Reset counters command received' -** -** \par Type: DEBUG +** +** \par Type: INFORMATIONAL ** ** \par Cause: ** ** This event message is issued when a reset counters command has -** been received. +** been received. */ -#define MM_RESET_DBG_EID 3 +#define MM_RESET_INF_EID 3 /** \brief 'Load Memory WID Command: Wrote \%d bytes to address: 0x\%08X' ** \event 'Load Memory WID Command: Wrote \%d bytes to address: 0x\%08X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: ** ** This event message is issued when a memory load with interrupts disabled -** command has been executed. +** command has been executed. ** ** The \c bytes field identifies how many bytes were written, the \c address -** field shows the fully resolved destination address of the load. +** field shows the fully resolved destination address of the load. */ -#define MM_LOAD_WID_INF_EID 4 +#define MM_LOAD_WID_INF_EID 4 /** \brief 'Load Memory From File Command: Loaded \%d bytes to address 0x\%08X from file '\%s'' ** \event 'Load Memory From File Command: Loaded \%d bytes to address 0x\%08X from file '\%s'' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -124,13 +87,13 @@ ** ** The \c bytes field identifies how many bytes were written, the \c address ** field shows the fully resolved destination address of the load, the \c file -** field identifies the name of the file used for the load. +** field identifies the name of the file used for the load. */ -#define MM_LD_MEM_FILE_INF_EID 5 +#define MM_LD_MEM_FILE_INF_EID 5 /** \brief 'Fill Memory Command: Filled \%d bytes at address: 0x\%08X with pattern: 0x\%08X' ** \event 'Fill Memory Command: Filled \%d bytes at address: 0x\%08X with pattern: 0x\%08X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -139,13 +102,13 @@ ** ** The \c bytes field identifies how many bytes were written, the \c address ** field shows the fully resolved destination address of the fill, the \c pattern -** field identifies the fill pattern used. +** field identifies the fill pattern used. */ -#define MM_FILL_INF_EID 6 +#define MM_FILL_INF_EID 6 /** \brief 'Peek Command: Addr = 0x\%08X Size = 8 bits Data = 0x\%02X' ** \event 'Peek Command: Addr = 0x\%08X Size = 8 bits Data = 0x\%02X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -153,14 +116,14 @@ ** This event message is issued when an 8 bit memory peek command has been ** executed. ** -** The \c Addr field shows the fully resolved address of the source +** The \c Addr field shows the fully resolved address of the source ** memory location and the \c Data field contains the data read. */ -#define MM_PEEK_BYTE_INF_EID 7 +#define MM_PEEK_BYTE_INF_EID 7 /** \brief 'Peek Command: Addr = 0x\%08X Size = 16 bits Data = 0x\%04X' ** \event 'Peek Command: Addr = 0x\%08X Size = 16 bits Data = 0x\%04X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -168,14 +131,14 @@ ** This event message is issued when a 16 bit memory peek command has been ** executed. ** -** The \c Addr field shows the fully resolved address of the source +** The \c Addr field shows the fully resolved address of the source ** memory location and the \c Data field contains the data read. */ -#define MM_PEEK_WORD_INF_EID 8 +#define MM_PEEK_WORD_INF_EID 8 /** \brief 'Peek Command: Addr = 0x\%08X Size = 32 bits Data = 0x\%08X' ** \event 'Peek Command: Addr = 0x\%08X Size = 32 bits Data = 0x\%08X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -183,14 +146,14 @@ ** This event message is issued when a 32 bit memory peek command has been ** executed. ** -** The \c Addr field shows the fully resolved address of the source +** The \c Addr field shows the fully resolved address of the source ** memory location and the \c Data field contains the data read. */ -#define MM_PEEK_DWORD_INF_EID 9 +#define MM_PEEK_DWORD_INF_EID 9 /** \brief 'Poke Command: Addr = 0x\%08X Size = 8 bits Data = 0x\%02X' ** \event 'Poke Command: Addr = 0x\%08X Size = 8 bits Data = 0x\%02X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -198,14 +161,14 @@ ** This event message is issued when an 8 bit memory poke command has been ** executed. ** -** The \c Addr field shows the fully resolved address of the destination +** The \c Addr field shows the fully resolved address of the destination ** memory location and the \c Data field contains the data written. */ -#define MM_POKE_BYTE_INF_EID 10 +#define MM_POKE_BYTE_INF_EID 10 /** \brief 'Poke Command: Addr = 0x\%08X Size = 16 bits Data = 0x\%04X' ** \event 'Poke Command: Addr = 0x\%08X Size = 16 bits Data = 0x\%04X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -213,14 +176,14 @@ ** This event message is issued when an 16 bit memory poke command has been ** executed. ** -** The \c Addr field shows the fully resolved address of the destination +** The \c Addr field shows the fully resolved address of the destination ** memory location and the \c Data field contains the data written. */ -#define MM_POKE_WORD_INF_EID 11 +#define MM_POKE_WORD_INF_EID 11 /** \brief 'Poke Command: Addr = 0x\%08X Size = 32 bits Data = 0x\%08X' ** \event 'Poke Command: Addr = 0x\%08X Size = 32 bits Data = 0x\%08X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -228,30 +191,30 @@ ** This event message is issued when an 32 bit memory poke command has been ** executed. ** -** The \c Addr field shows the fully resolved address of the destination +** The \c Addr field shows the fully resolved address of the destination ** memory location and the \c Data field contains the data written. */ -#define MM_POKE_DWORD_INF_EID 12 +#define MM_POKE_DWORD_INF_EID 12 /** \brief 'Dump Memory To File Command: Dumped \%d bytes from address 0x\%08X to file '\%s'' ** \event 'Dump Memory To File Command: Dumped \%d bytes from address 0x\%08X to file '\%s'' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: ** ** This event message is issued when a dump memory to file command has -** been executed. +** been executed. ** ** The \c bytes field identifies how many bytes were read, the \c address ** field shows the fully resolved source address of the dump, the \c file -** field identifies the name of the file used for the dump. +** field identifies the name of the file used for the dump. */ -#define MM_DMP_MEM_FILE_INF_EID 13 +#define MM_DMP_MEM_FILE_INF_EID 13 /** \brief 'Memory Dump: 0x\%02X from address: 0x\%08lX' ** \event 'Memory Dump: 0x\%02X from address: 0x\%08lX' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -260,28 +223,28 @@ ** command. ** ** The \c 0x\%02X field is a single byte of data and will be repeated according -** to the requested number of dump bytes, the \c address field shows the fully +** to the requested number of dump bytes, the \c address field shows the fully ** resolved source address of the dump. */ -#define MM_DUMP_INEVENT_INF_EID 14 +#define MM_DUMP_INEVENT_INF_EID 14 /** \brief 'SB Pipe Read Error, App will exit. RC = 0x\%08X' ** \event 'SB Pipe Read Error, App will exit. RC = 0x\%08X' -** +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a call to #CFE_SB_RcvMsg fails. +** This event message is issued when a call to #CFE_SB_RcvMsg fails. ** ** The \c RC field is the return code from the #CFE_SB_RcvMsg function ** call that generated the error. */ -#define MM_PIPE_ERR_EID 15 +#define MM_PIPE_ERR_EID 15 /** \brief 'Invalid command pipe message ID: 0x\%X' ** \event 'Invalid command pipe message ID: 0x\%X' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -289,46 +252,46 @@ ** This event message is issued when a software bus message is received ** with an invalid message ID. ** -** The \c message \c ID field contains the message ID that generated +** The \c message \c ID field contains the message ID that generated ** the error. */ -#define MM_MID_ERR_EID 16 +#define MM_MID_ERR_EID 16 /** \brief 'Invalid ground command code: ID = 0x\%X, CC = \%d' ** \event 'Invalid ground command code: ID = 0x\%X, CC = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a software bus message is received -** with an invalid command code. +** with an invalid command code. ** ** The \c ID field contains the message ID, the \c CC field contains ** the command code that generated the error. */ -#define MM_CC1_ERR_EID 17 +#define MM_CC1_ERR_EID 17 /** \brief 'Invalid msg length: ID = 0x\%04X, CC = \%d, Len = \%d, Expected = \%d' ** \event 'Invalid msg length: ID = 0x\%04X, CC = \%d, Len = \%d, Expected = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when command message is received with a message -** length that doesn't match the expected value. +** length that doesn't match the expected value. ** -** The \c ID field contains the message ID, the \c CC field contains the +** The \c ID field contains the message ID, the \c CC field contains the ** command code, the \c Len field is the actual length returned by the ** CFE_SB_GetTotalMsgLength call, and the \c Expected field is the expected ** length for messages with that command code. */ -#define MM_LEN_ERR_EID 18 +#define MM_LEN_ERR_EID 18 /** \brief 'Invalid memory type specified: MemType = \%d' ** \event 'Invalid memory type specified: MemType = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -337,13 +300,13 @@ ** unrecognized or unsupported memory type specified. ** ** The \c MemType field is the invalid memory type specifier that was -** received in the command message. +** received in the command message. */ -#define MM_MEMTYPE_ERR_EID 19 +#define MM_MEMTYPE_ERR_EID 19 /** \brief 'Symbolic address can't be resolved: Name = '\%s'' ** \event 'Symbolic address can't be resolved: Name = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -352,77 +315,77 @@ ** resolved by the OSAPI. ** ** The \c Name field is the symbol name string that generated -** the error. +** the error. */ -#define MM_SYMNAME_ERR_EID 20 +#define MM_SYMNAME_ERR_EID 20 /** \brief 'Data size in bytes invalid or exceeds limits: Data Size = \%d' ** \event 'Data size in bytes invalid or exceeds limits: Data Size = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a command or load file specifies a number -** of bytes that is either zero or exceeds the limits specified by the +** of bytes that is either zero or exceeds the limits specified by the ** MM configuration parameters ** ** The \c Data \c Size field is the data size in bytes that generated the -** error. +** error. */ -#define MM_DATA_SIZE_BYTES_ERR_EID 21 +#define MM_DATA_SIZE_BYTES_ERR_EID 21 /** \brief 'Data size in bits invalid: Data Size = \%d' ** \event 'Data size in bits invalid: Data Size = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a command specified bit width +** This event message is issued when a command specified bit width ** for a peek or poke operation is either undefined or not valid for the -** specified memory type. +** specified memory type. ** ** The \c Data \c Size field is the data size in bits that generated the -** error. +** error. */ -#define MM_DATA_SIZE_BITS_ERR_EID 22 +#define MM_DATA_SIZE_BITS_ERR_EID 22 /** \brief 'Data and address not 32 bit aligned: Addr = 0x\%08X Size = \%d' ** \event 'Data and address not 32 bit aligned: Addr = 0x\%08X Size = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when command execution requires 32 bit wide -** memory access and the data size and address specified are not both 32 bit +** memory access and the data size and address specified are not both 32 bit ** aligned. ** -** The \c Addr field is the address and the \c Size field is the +** The \c Addr field is the address and the \c Size field is the ** specified size in bytes, that failed the alignment check. */ -#define MM_ALIGN32_ERR_EID 23 +#define MM_ALIGN32_ERR_EID 23 /** \brief 'Data and address not 16 bit aligned: Addr = 0x\%08X Size = \%d' ** \event 'Data and address not 16 bit aligned: Addr = 0x\%08X Size = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when command execution requires 16 bit wide -** memory access and the data size and address specified are not both 16 bit +** memory access and the data size and address specified are not both 16 bit ** aligned. ** -** The \c Addr field is the address and the \c Size field is the +** The \c Addr field is the address and the \c Size field is the ** specified size in bytes, that failed the alignment check. */ -#define MM_ALIGN16_ERR_EID 24 +#define MM_ALIGN16_ERR_EID 24 /** \brief 'CFE_PSP_MemValidate error received: RC = 0x\%08X Addr = 0x\%08X Size = \%d MemType = \%d' ** \event 'CFE_PSP_MemValidate error received: RC = 0x\%08X Addr = 0x\%08X Size = \%d MemType = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -434,211 +397,211 @@ ** the \c Addr field is the address, \c Size field is the specified size in bytes, ** and the \c MemType field is the memory type of the address range that failed validation. */ -#define MM_OS_MEMVALIDATE_ERR_EID 25 +#define MM_OS_MEMVALIDATE_ERR_EID 25 /** \brief 'Load file CRC failure: Expected = 0x\%X Calculated = 0x\%X File = '\%s'' ** \event 'Load file CRC failure: Expected = 0x\%X Calculated = 0x\%X File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a CRC computation on the data in +** This event message is issued when a CRC computation on the data in ** a load file does not return the expected result that is specified in -** the load file header. +** the load file header. ** -** The \c Expected field is the expected result, the -** \c Calculated field is the computed value, and \c File is the +** The \c Expected field is the expected result, the +** \c Calculated field is the computed value, and \c File is the ** name of the file where the mismatch was detected */ -#define MM_LOAD_FILE_CRC_ERR_EID 26 +#define MM_LOAD_FILE_CRC_ERR_EID 26 /** \brief 'Interrupts Disabled Load CRC failure: Expected = 0x\%X Calculated = 0x\%X' ** \event 'Interrupts Disabled Load CRC failure: Expected = 0x\%X Calculated = 0x\%X' -** +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a CRC computation on the data in -** a load with interrupts disabled command message does not return the -** expected result that is specified in the command message header. +** This event message is issued when a CRC computation on the data in +** a load with interrupts disabled command message does not return the +** expected result that is specified in the command message header. ** -** The \c Expected field is the expected result and the +** The \c Expected field is the expected result and the ** \c Calculated field is the computed value. */ -#define MM_LOAD_WID_CRC_ERR_EID 27 +#define MM_LOAD_WID_CRC_ERR_EID 27 /** \brief 'OS_EepromWrite8 error received: RC = 0x\%08X Addr = 0x\%08X' ** \event 'OS_EepromWrite8 error received: RC = 0x\%08X Addr = 0x\%08X' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_EepromWrite8 function -** returns some value other than #OS_SUCCESS. +** returns some value other than #OS_SUCCESS. ** -** The \c RC field is the return code from the #OS_EepromWrite8 call, +** The \c RC field is the return code from the #OS_EepromWrite8 call, ** the \c Addr field is the address that the write was attempted to. */ -#define MM_OS_EEPROMWRITE8_ERR_EID 28 +#define MM_OS_EEPROMWRITE8_ERR_EID 28 /** \brief 'OS_EepromWrite16 error received: RC = 0x\%08X Addr = 0x\%08X' ** \event 'OS_EepromWrite16 error received: RC = 0x\%08X Addr = 0x\%08X' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_EepromWrite16 function -** returns some value other than #OS_SUCCESS. +** returns some value other than #OS_SUCCESS. ** -** The \c RC field is the return code from the #OS_EepromWrite16 call, +** The \c RC field is the return code from the #OS_EepromWrite16 call, ** the \c Addr field is the address that the write was attempted to. */ -#define MM_OS_EEPROMWRITE16_ERR_EID 29 +#define MM_OS_EEPROMWRITE16_ERR_EID 29 /** \brief 'OS_EepromWrite32 error received: RC = 0x\%08X Addr = 0x\%08X' ** \event 'OS_EepromWrite32 error received: RC = 0x\%08X Addr = 0x\%08X' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_EepromWrite32 function -** returns some value other than #OS_SUCCESS. +** returns some value other than #OS_SUCCESS. ** -** The \c RC field is the return code from the #OS_EepromWrite32 call, +** The \c RC field is the return code from the #OS_EepromWrite32 call, ** the \c Addr field is the address that the write was attempted to. */ -#define MM_OS_EEPROMWRITE32_ERR_EID 30 +#define MM_OS_EEPROMWRITE32_ERR_EID 30 -/** \brief 'OS_creat error received: RC = 0x\%08X File = '\%s'' -** \event 'OS_creat error received: RC = 0x\%08X File = '\%s'' -** +/** \brief 'OS_OpenCreate error received: RC = 0x\%08X File = '\%s'' +** \event 'OS_OpenCreate error received: RC = 0x\%08X File = '\%s'' +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a call to the #OS_creat function -** returns some value other than #OS_SUCCESS. +** This event message is issued when a call to the #OS_OpenCreate function +** returns some value other than #OS_SUCCESS. ** -** The \c RC field is the return code and \c File is the filename -** from the #OS_creat call that generated the error. +** The \c RC field is the return code and \c File is the filename +** from the #OS_OpenCreate call that generated the error. */ -#define MM_OS_CREAT_ERR_EID 31 +#define MM_OS_CREAT_ERR_EID 31 -/** \brief 'OS_open error received: RC = 0x\%08X File = '\%s'' -** \event 'OS_open error received: RC = 0x\%08X File = '\%s'' -** +/** \brief 'OS_OpenCreate error received: RC = 0x\%08X File = '\%s'' +** \event 'OS_OpenCreate error received: RC = 0x\%08X File = '\%s'' +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a call to the #OS_open function -** returns some value other than #OS_SUCCESS. +** This event message is issued when a call to the #OS_OpenCreate function +** returns some value other than #OS_SUCCESS. ** -** The \c RC field is the return code and \c File is the filename -** from the #OS_open call that generated the error. +** The \c RC field is the return code and \c File is the filename +** from the #OS_OpenCreate call that generated the error. */ -#define MM_OS_OPEN_ERR_EID 32 +#define MM_OS_OPEN_ERR_EID 32 /** \brief 'OS_close error received: RC = 0x\%08X File = '\%s'' ** \event 'OS_close error received: RC = 0x\%08X File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_close function -** returns some value other than #OS_SUCCESS. +** returns some value other than #OS_SUCCESS. ** -** The \c RC field is the return code and \c File is the filename -** from the #OS_close call that generated the error. +** The \c RC field is the return code and \c File is the filename +** from the #OS_close call that generated the error. */ -#define MM_OS_CLOSE_ERR_EID 33 +#define MM_OS_CLOSE_ERR_EID 33 /** \brief 'OS_read error received: RC = 0x\%08X File = '\%s'' ** \event 'OS_read error received: RC = 0x\%08X File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_read function -** returns a negative error code. +** returns a negative error code. ** -** The \c RC field is the return code and \c File is the filename -** from the #OS_read call that generated the error. +** The \c RC field is the return code and \c File is the filename +** from the #OS_read call that generated the error. */ -#define MM_OS_READ_ERR_EID 34 +#define MM_OS_READ_ERR_EID 34 /** \brief 'OS_read error received: RC = 0x\%08X Expected = \%d File = '\%s'' ** \event 'OS_read error received: RC = 0x\%08X Expected = \%d File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_read function -** returns some value other than the expected number of bytes read. +** returns some value other than the expected number of bytes read. ** ** The \c RC field is the return code, the \c Expected field is the -** expected return value and the \c File is the filename from the -** #OS_read call that generated the error. +** expected return value and the \c File is the filename from the +** #OS_read call that generated the error. */ -#define MM_OS_READ_EXP_ERR_EID 35 +#define MM_OS_READ_EXP_ERR_EID 35 /** \brief 'OS_write error received: RC = 0x\%08X Expected = \%d File = '\%s'' ** \event 'OS_write error received: RC = 0x\%08X Expected = \%d File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_read function -** returns some value other than the expected number of bytes written. +** returns some value other than the expected number of bytes written. ** ** The \c RC field is the return code, the \c Expected field is the -** expected return value and the \c File is the filename from the -** #OS_write call that generated the error. +** expected return value and the \c File is the filename from the +** #OS_write call that generated the error. */ -#define MM_OS_WRITE_EXP_ERR_EID 36 +#define MM_OS_WRITE_EXP_ERR_EID 36 /** \brief 'OS_stat error received: RC = 0x\%08X File = '\%s'' ** \event 'OS_stat error received: RC = 0x\%08X File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_stat function -** returns some value other than #OS_SUCCESS. +** returns some value other than #OS_SUCCESS. ** ** The \c RC field is the return code and \c File is the filename -** from the #OS_stat call that generated the error. +** from the #OS_stat call that generated the error. */ -#define MM_OS_STAT_ERR_EID 37 +#define MM_OS_STAT_ERR_EID 37 /** \brief 'CFS_ComputeCRCFromFile error received: RC = 0x\%08X File = '\%s'' ** \event 'CFS_ComputeCRCFromFile error received: RC = 0x\%08X File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a call to the #CFS_ComputeCRCFromFile -** function returns some value other than #OS_SUCCESS. +** This event message is issued when a call to the #CFS_ComputeCRCFromFile +** function returns some value other than #OS_SUCCESS. ** ** The \c RC field is the return code and \c File is the filename -** from the #CFS_ComputeCRCFromFile call that generated the error. +** from the #CFS_ComputeCRCFromFile call that generated the error. */ -#define MM_CFS_COMPUTECRCFROMFILE_ERR_EID 38 +#define MM_CFS_COMPUTECRCFROMFILE_ERR_EID 38 /** \brief 'Command specified filename invalid: Name = '\%s'' ** \event 'Command specified filename invalid: Name = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -647,35 +610,35 @@ ** message fails a check for prohibited characters ** ** The \c Name field holds the filename string that generated -** the error. +** the error. */ -#define MM_CMD_FNAME_ERR_EID 39 +#define MM_CMD_FNAME_ERR_EID 39 /** \brief 'Load file size error: Reported by OS = \%d Expected = \%d File = '\%s'' ** \event 'Load file size error: Reported by OS = \%d Expected = \%d File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a load memory from file command ** is processed and the size of the load file in bytes (as reported by the -** filesystem) doesn't match what would be expected based upon the load byte -** count specified in the file header. +** filesystem) doesn't match what would be expected based upon the load byte +** count specified in the file header. ** ** The \c Reported \c by \c OS field holds size of the file in bytes as -** reported by the operating system, the \c Expected field holds the +** reported by the operating system, the \c Expected field holds the ** expected byte count that is the sum of number of load bytes specified -** in the file header and the size of the file header itself. The +** in the file header and the size of the file header itself. The ** \c Name field holds the name of the load file that generated -** the error. -** +** the error. +** */ -#define MM_LD_FILE_SIZE_ERR_EID 40 +#define MM_LD_FILE_SIZE_ERR_EID 40 /** \brief 'Load file failed parameters check: File = '\%s'' ** \event 'Load file failed parameters check: File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -687,62 +650,62 @@ ** name of the file that failed. ** ** The \c File field holds the name of the file that failed the -** parameter checks. +** parameter checks. */ -#define MM_FILE_LOAD_PARAMS_ERR_EID 41 +#define MM_FILE_LOAD_PARAMS_ERR_EID 41 /** \brief 'CFE_FS_ReadHeader error received: RC = 0x\%08X Expected = \%d File = '\%s'' ** \event 'CFE_FS_ReadHeader error received: RC = 0x\%08X Expected = \%d File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #CFE_FS_ReadHeader function -** returns some value other than the expected number of bytes read. +** returns some value other than the expected number of bytes read. ** ** The \c RC field is the return code, the \c Expected field is the -** expected return value and the \c File is the filename from the -** #CFE_FS_ReadHeader call that generated the error. +** expected return value and the \c File is the filename from the +** #CFE_FS_ReadHeader call that generated the error. */ -#define MM_CFE_FS_READHDR_ERR_EID 42 +#define MM_CFE_FS_READHDR_ERR_EID 42 /** \brief 'CFE_FS_WriteHeader error received: RC = 0x\%08X Expected = \%d File = '\%s'' ** \event 'CFE_FS_WriteHeader error received: RC = 0x\%08X Expected = \%d File = '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #CFE_FS_WriteHeader function -** returns some value other than the expected number of bytes written. +** returns some value other than the expected number of bytes written. ** ** The \c RC field is the return code, the \c Expected field is the -** expected return value and the \c File is the filename from the -** #CFE_FS_WriteHeader call that generated the error. +** expected return value and the \c File is the filename from the +** #CFE_FS_WriteHeader call that generated the error. */ -#define MM_CFE_FS_WRITEHDR_ERR_EID 43 +#define MM_CFE_FS_WRITEHDR_ERR_EID 43 /** \brief 'Invalid HK request msg length: ID = 0x\%04X, CC = \%d, Len = \%d, Expected = \%d' ** \event 'Invalid HK request msg length: ID = 0x\%04X, CC = \%d, Len = \%d, Expected = \%d' -** +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when housekeeping request message is received -** with a message length that doesn't match the expected value. +** This event message is issued when housekeeping request message is received +** with a message length that doesn't match the expected value. ** -** The \c ID field contains the message ID, the \c CC field contains the +** The \c ID field contains the message ID, the \c CC field contains the ** command code, the \c Len field is the actual length returned by the ** CFE_SB_GetTotalMsgLength call, and the \c Expected field is the expected ** length. */ -#define MM_HKREQ_LEN_ERR_EID 44 +#define MM_HKREQ_LEN_ERR_EID 44 /** \brief 'Symbol Lookup Command: Name = '\%s' Addr = 0x\%08X' ** \event 'Symbol Lookup Command: Name = '\%s' Addr = 0x\%08X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -750,14 +713,14 @@ ** This event message is issued when an symbol lookup command has been ** successfully executed. ** -** The \c Name field holds the symbol name string, the \c Addr field shows +** The \c Name field holds the symbol name string, the \c Addr field shows ** the fully resolved address */ -#define MM_SYM_LOOKUP_INF_EID 45 +#define MM_SYM_LOOKUP_INF_EID 45 /** \brief 'NUL (empty) string specified as symbol name' ** \event 'NUL (empty) string specified as symbol name' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -765,11 +728,11 @@ ** This event message is issued when a NUL string has been specified ** as the symbol name in a lookup symbol command */ -#define MM_SYMNAME_NUL_ERR_EID 46 +#define MM_SYMNAME_NUL_ERR_EID 46 /** \brief 'Symbol Table Dump to File Started: Name = '\%s'' ** \event 'Symbol Table Dump to File Started: Name = '\%s'' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -779,11 +742,11 @@ ** ** The \c Name field holds the requested dump file name string */ -#define MM_SYMTBL_TO_FILE_INF_EID 47 +#define MM_SYMTBL_TO_FILE_INF_EID 47 /** \brief 'NUL (empty) string specified as symbol dump file name' ** \event 'NUL (empty) string specified as symbol dump file name' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -791,11 +754,11 @@ ** This event message is issued when a NUL string has been specified ** as the dump file name in a dump symbol table to file command */ -#define MM_SYMFILENAME_NUL_ERR_EID 48 +#define MM_SYMFILENAME_NUL_ERR_EID 48 /** \brief 'Error dumping symbol table, OS_Status= 0x%X, File='%s'' ** \event 'Error dumping symbol table, OS Status= 0x%X, File='%s'' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -806,11 +769,11 @@ ** The \c OS_Status field holds the return code from the call to #OS_SymbolTableDump ** The \c File field holds the requested dump file name string */ -#define MM_SYMTBL_TO_FILE_FAIL_ERR_EID 49 +#define MM_SYMTBL_TO_FILE_FAIL_ERR_EID 49 /** \brief 'Illegal characters in target filename, File='%s'' ** \event 'Illegal characters in target filename, File='%s'' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -820,11 +783,11 @@ ** ** The \c File field holds the requested dump file name string */ -#define MM_SYMTBL_TO_FILE_INVALID_ERR_EID 50 +#define MM_SYMTBL_TO_FILE_INVALID_ERR_EID 50 /** \brief 'EEPROM bank %d write enabled, cFE_Status= 0x%X' ** \event 'EEPROM bank %d write enabled, cFE_Status= 0x%X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -835,11 +798,11 @@ ** The \c bank field identifies the requested EEPROM bank to be write-enabled ** The \c CFE_Status field holds the return code from the call to #CFE_PSP_EepromWriteEnable */ -#define MM_EEPROM_WRITE_ENA_INF_EID 51 +#define MM_EEPROM_WRITE_ENA_INF_EID 51 /** \brief 'Error requesting EEPROM bank %d write enable, cFE_Status= 0x%X' ** \event 'Error requesting EEPROM bank %d write enable, cFE_Status= 0x%X' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -850,11 +813,11 @@ ** The \c bank field identifies the requested EEPROM bank to be write-enabled ** The \c CFE_Status field holds the return code from the call to #CFE_PSP_EepromWriteEnable */ -#define MM_EEPROM_WRITE_ENA_ERR_EID 52 +#define MM_EEPROM_WRITE_ENA_ERR_EID 52 /** \brief 'EEPROM bank %d write disabled, cFE_Status= 0x%X' ** \event 'EEPROM bank %d write disabled, cFE_Status= 0x%X' -** +** ** \par Type: INFORMATIONAL ** ** \par Cause: @@ -865,11 +828,11 @@ ** The \c bank field identifies the requested EEPROM bank to be write-disabled ** The \c CFE_Status field holds the return code from the call to #CFE_PSP_EepromWriteDisable */ -#define MM_EEPROM_WRITE_DIS_INF_EID 53 +#define MM_EEPROM_WRITE_DIS_INF_EID 53 /** \brief 'Error requesting EEPROM bank %d write disable, cFE_Status= 0x%X' ** \event 'Error requesting EEPROM bank %d write disable, cFE_Status= 0x%X' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -880,25 +843,25 @@ ** The \c bank field identifies the requested EEPROM bank to be write-disabled ** The \c CFE_Status field holds the return code from the call to #CFE_PSP_EepromWriteDisable */ -#define MM_EEPROM_WRITE_DIS_ERR_EID 54 +#define MM_EEPROM_WRITE_DIS_ERR_EID 54 /** \brief 'Zero bytes read by OS_read of file '\%s'' ** \event 'Zero bytes read by OS_read of file '\%s'' -** +** ** \par Type: ERROR ** ** \par Cause: ** ** This event message is issued when a call to the #OS_read function -** returns zero total bytes read. +** returns zero total bytes read. ** -** The \c File is the filename that #OS_Read attempted to read. +** The \c File is the filename that #OS_Read attempted to read. */ -#define MM_OS_ZERO_READ_ERR_EID 55 +#define MM_OS_ZERO_READ_ERR_EID 55 /** \brief 'PSP read memory error: RC=0x\%08X, Src=0x\%08X, Tgt=0x\%08X, Type='%s'' ** \event 'PSP read memory error: RC=0x\%08X, Src=0x\%08X, Tgt=0x\%08X, Type='%s'' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -911,11 +874,11 @@ ** \c Tgt is the storage location from the function call that generated the error. ** The \c Type field will indicate MEM8, MEM16 or MEM32. */ -#define MM_PSP_READ_ERR_EID 56 +#define MM_PSP_READ_ERR_EID 56 /** \brief 'PSP write memory error: RC=0x\%08X, Address=0x\%08X, MemType='%s'' ** \event 'PSP write memory error: RC=0x\%08X, Address=0x\%08X, MemType='%s'' -** +** ** \par Type: ERROR ** ** \par Cause: @@ -928,39 +891,81 @@ ** from the function call that generated the error. The \c MemType ** field will indicate MEM8, MEM16 or MEM32. */ -#define MM_PSP_WRITE_ERR_EID 57 +#define MM_PSP_WRITE_ERR_EID 57 -/** \brief 'PSP copy memory error: RC=0x\%08X, Src=0x\%08X, Tgt=0x\%08X, Size=0x\%08X' -** \event 'PSP copy memory error: RC=0x\%08X, Src=0x\%08X, Tgt=0x\%08X, Size=0x\%08X' -** +/** \brief 'Error Creating SB Pipe, RC = 0x\%08X' +** \event 'Error Creating SB Pipe, RC = 0x\%08X' +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a call to #CFE_PSP_MemCpy returns something -** other than CFE_PSP_SUCCESS. +** This event message is issued when a call to #CFE_SB_CreatePipe returns +** something other than CFE_SUCCESS. +** +** The \c RC field is the function return code. +*/ +#define MM_CR_PIPE_ERR_EID 60 + +/** \brief 'Error Subscribing to HK Request, RC = 0x\%08X' +** \event 'Error Subscribing to HK Request, RC = 0x\%08X' +** +** \par Type: ERROR +** +** \par Cause: ** -** The \c RC field is the function return code and \c Src and \c Tgt are the source -** and target for the copy. The \c Size field is the length of the copy. +** This event message is issued when a call to #CFE_SB_Subscribe returns +** something other than CFE_SUCCESS when called for MM_SEND_HK_MID. +** +** The \c RC field is the function return code. */ -#define MM_PSP_COPY_ERR_EID 58 +#define MM_HK_SUB_ERR_EID 61 -/** \brief 'PSP set memory error: RC=0x\%08X, Tgt=0x\%08X, Size=0x\%08X' -** \event 'PSP set memory error: RC=0x\%08X, Tgt=0x\%08X, Size=0x\%08X' -** +/** \brief 'Error Subscribing to MM Command, RC = 0x\%08X' +** \event 'Error Subscribing to MM Command, RC = 0x\%08X' +** ** \par Type: ERROR ** ** \par Cause: ** -** This event message is issued when a call to #CFE_PSP_MemSet returns something -** other than CFE_PSP_SUCCESS. +** This event message is issued when a call to #CFE_SB_Subscribe returns +** something other than CFE_SUCCESS when called for MM_CMD_MID. +** +** The \c RC field is the function return code. +*/ +#define MM_CMD_SUB_ERR_EID 62 + +/** \brief 'MM_FillMem32 NumOfBytes not multiple of 4. Reducing from %d to %d.' +** \event 'MM_FillMem32 NumOfBytes not multiple of 4. Reducing from %d to %d.' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is issued when a call to #MM_FillMem32 is called with a +** NumOfBytes value that is not divisible by 4. +** +** The \c from field is the original NumOfBytes parameter. +** The \c to field is the rounded down NumOfBytes value +*/ +#define MM_FILL_MEM32_ALIGN_WARN_INF_EID 63 + +/** \brief 'MM_FillMem16 NumOfBytes not multiple of 2. Reducing from %d to %d.' +** \event 'MM_FillMem16 NumOfBytes not multiple of 2. Reducing from %d to %d.' +** +** \par Type: INFORMATION +** +** \par Cause: +** +** This event message is issued when a call to #MM_FillMem16 is called with a +** NumOfBytes value that is not divisible by 2. ** -** The \c RC field is the function return code and \c Tgt is the target for the -** memory set. The \c Size field is the length of the memory set. +** The \c from field is the original NumOfBytes parameter. +** The \c to field is the rounded down NumOfBytes value */ -#define MM_PSP_SET_ERR_EID 59 +#define MM_FILL_MEM16_ALIGN_WARN_INF_EID 64 -#endif /* _mm_events_ */ +#endif /* _mm_events_h_ */ /************************/ /* End of File Comment */ diff --git a/fsw/src/mm_filedefs.h b/fsw/src/mm_filedefs.h index 54e53c5..6b4e457 100644 --- a/fsw/src/mm_filedefs.h +++ b/fsw/src/mm_filedefs.h @@ -1,39 +1,20 @@ /************************************************************************* -** File: -** $Id: mm_filedefs.h 1.2 2016/10/31 16:30:38EDT mdeschu Exp $ +** File: mm_filedefs.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager file structures. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS Development Standards Document -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_filedefs.h $ -** Revision 1.2 2016/10/31 16:30:38EDT mdeschu -** Move CFE subtype and description to public platform config header -** Revision 1.1 2015/07/28 12:21:44EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.4 2015/03/02 14:27:02EST sstrege -** Added copyright information -** Revision 1.3 2008/05/19 15:23:13EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ + #ifndef _mm_filedefs_ #define _mm_filedefs_ @@ -46,7 +27,6 @@ ** Macro Definitions *************************************************************************/ - /************************************************************************* ** Type Definitions *************************************************************************/ @@ -55,15 +35,16 @@ We use the same header structure for both dump and load files so a dump file can be reloaded back into memory if desired (providing a memory save and restore capability). This MM header is the secondary header, the - standard cFE file header is primary header for all load and dump files. -*/ -typedef struct { - CFS_SymAddr_t SymAddress; /**< \brief Symbolic load address or fully - resolved dump address */ - uint32 NumOfBytes; /**< \brief Bytes to load or bytes dumped */ - uint32 Crc; /**< \brief CRC value for load or dump data */ - uint8 MemType; /**< \brief Memory type used */ - uint8 Spare[3]; /**< \brief Structure Padding */ + standard cFE file header is primary header for all load and dump files. +*/ +typedef struct +{ + CFS_SymAddr_t SymAddress; /**< \brief Symbolic load address or fully + resolved dump address */ + uint32 NumOfBytes; /**< \brief Bytes to load or bytes dumped */ + uint32 Crc; /**< \brief CRC value for load or dump data */ + uint8 MemType; /**< \brief Memory type used */ + uint8 Spare[3]; /**< \brief Structure Padding */ } MM_LoadDumpFileHeader_t; diff --git a/fsw/src/mm_load.c b/fsw/src/mm_load.c index 05ea5b8..53bf55f 100644 --- a/fsw/src/mm_load.c +++ b/fsw/src/mm_load.c @@ -1,70 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_load.c 1.4 2016/10/30 00:48:49EDT mdeschu Exp $ +** File: mm_load.c ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: -** Provides functions for the execution of the CFS Memory Manager +** Purpose: +** Provides functions for the execution of the CFS Memory Manager ** load and fill ground commands ** -** $Log: mm_load.c $ -** Revision 1.4 2016/10/30 00:48:49EDT mdeschu -** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent -** Revision 1.3 2016/10/28 18:01:15EDT mdeschu -** Ticket #33: MM - Use OSAL file stat macros if they are defined -** Revision 1.2 2015/12/29 15:22:21EST czogby -** Move function prototypes from .c files into .h files -** Revision 1.1 2015/07/28 12:21:46EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.21 2015/04/14 15:29:00EDT lwalling -** Removed unnecessary backslash characters from string format definitions -** Revision 1.20 2015/04/07 10:16:04EDT lwalling -** Report bytes processed for RAM and EEPROM fill commands -** Revision 1.19 2015/04/06 15:41:15EDT lwalling -** Verify results of calls to PSP memory read/write/copy/set functions -** Revision 1.18 2015/03/30 17:33:57EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.17 2015/03/20 14:30:18EDT lwalling -** Remove unnecessary include of osapi-os-filesys.h -** Revision 1.16 2015/03/20 14:16:53EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.15 2015/03/02 14:27:05EST sstrege -** Added copyright information -** Revision 1.14 2011/12/05 15:17:19EST jmdagost -** Added check for zero bytes read from file load (with event message on error) -** Revision 1.13 2010/11/29 13:35:20EST jmdagost -** Replaced ifdef tests with if-true tests. -** Revision 1.12 2010/11/29 08:48:40EST jmdagost -** Removed in-line calls to enable/disable EEPROM bank writes (now done via command) -** Revision 1.11 2009/07/31 12:28:08EDT jmdagost -** Modified calls to EepromWrite enable and disable to include temporary argument of bank 0. This allows us to -** use the updated PSP functions. -** Revision 1.10 2009/07/23 07:41:20EDT wmoleski -** Updating the OS_EepromWrite32 call to CFE_PSP_EepromWrite32 -** Revision 1.9 2009/07/22 10:05:40EDT wmoleski -** OS_EepromWritexxx calls changed to CFE_PSP_EepromWritexxx calls for cFE 6.0.0 -** Revision 1.8 2009/06/18 10:17:11EDT rmcgraw -** DCR8291:1 Changed OS_MEM_ #defines to CFE_PSP_MEM_ -** Revision 1.7 2009/06/12 14:37:32EDT rmcgraw -** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem -** Revision 1.6 2008/09/05 14:24:24EDT dahardison -** Updated references to local HK variables -** Revision 1.5 2008/09/05 13:14:40EDT dahardison -** Added inclusion of mm_mission_cfg.h -** Revision 1.4 2008/05/22 15:13:21EDT dahardison -** Changed inclusion of cfs_lib.h to cfs_utils.h -** Revision 1.3 2008/05/19 15:23:15EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ /************************************************************************* @@ -85,65 +34,63 @@ /************************************************************************* ** External Data *************************************************************************/ -extern MM_AppData_t MM_AppData; +extern MM_AppData_t MM_AppData; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* Memory poke ground command */ +/* Memory poke ground command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_PokeCmd(CFE_SB_MsgPtr_t MessagePtr) +bool MM_PokeCmd(const CFE_SB_Buffer_t *BufPtr) { - boolean Valid = TRUE; - uint32 DestAddress; - MM_PokeCmd_t *CmdPtr; - uint16 ExpectedLength = sizeof(MM_PokeCmd_t); - - /* Verify command packet length */ - if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - { - CmdPtr = ((MM_PokeCmd_t *)MessagePtr); - - /* Resolve the symbolic address in command message */ - Valid = CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress); - - if(Valid == TRUE) - { - /* Run necessary checks on command parameters */ - Valid = MM_VerifyPeekPokeParams(DestAddress, CmdPtr->MemType, CmdPtr->DataSize); - - /* Check the specified memory type and call the appropriate routine */ - if(Valid == TRUE) - { - /* Check if we need special EEPROM processing */ - if (CmdPtr->MemType == MM_EEPROM) + bool Valid = false; + cpuaddr DestAddress; + MM_PokeCmd_t *CmdPtr; + uint16 ExpectedLength = sizeof(MM_PokeCmd_t); + + /* Verify command packet length */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_PokeCmd_t *)BufPtr); + + /* Resolve the symbolic address in command message */ + Valid = CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress); + + if (Valid == true) + { + /* Run necessary checks on command parameters */ + Valid = MM_VerifyPeekPokeParams(DestAddress, CmdPtr->MemType, CmdPtr->DataSize); + + /* Check the specified memory type and call the appropriate routine */ + if (Valid == true) { - MM_PokeEeprom(CmdPtr, DestAddress); - } - else - { - /* - ** We can use this routine for all other memory types - * (including the optional ones) - */ - MM_PokeMem(CmdPtr, DestAddress); - } - - } /* end MM_VerifyPeekPokeParams if */ - - } /* end CFS_ResolveSymAddr */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - CmdPtr->DestSymAddress.SymName); - } - - } /* end MM_VerifyCmdLength if */ - - return; - + /* Check if we need special EEPROM processing */ + if (CmdPtr->MemType == MM_EEPROM) + { + MM_PokeEeprom(CmdPtr, DestAddress); + } + else + { + /* + ** We can use this routine for all other memory types + * (including the optional ones) + */ + MM_PokeMem(CmdPtr, DestAddress); + } + + } /* end MM_VerifyPeekPokeParams if */ + + } /* end CFS_ResolveSymAddr */ + else + { + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", CmdPtr->DestSymAddress.SymName); + } + + } /* end MM_VerifyCmdLength if */ + + return Valid; + } /* end MM_PokeCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -151,534 +98,465 @@ void MM_PokeCmd(CFE_SB_MsgPtr_t MessagePtr) /* Write 8, 16, or 32 bits of data to any RAM memory address */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_PokeMem (MM_PokeCmd_t *CmdPtr, - uint32 DestAddress) +bool MM_PokeMem(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress) { - uint8 ByteValue; - uint16 WordValue; - int32 PSP_Status; - uint32 DataValue = 0; - uint32 BytesProcessed = 0; - boolean ValidPoke = FALSE; - - /* Write input number of bits to destination address */ - switch(CmdPtr->DataSize) - { - case MM_BYTE_BIT_WIDTH: - ByteValue = (uint8) CmdPtr->Data; - DataValue = (uint32) ByteValue; - BytesProcessed = sizeof (uint8); - if ((PSP_Status = CFE_PSP_MemWrite8(DestAddress, ByteValue)) == CFE_PSP_SUCCESS) - { - CFE_EVS_SendEvent(MM_POKE_BYTE_INF_EID, CFE_EVS_INFORMATION, - "Poke Command: Addr = 0x%08X, Size = 8 bits, Data = 0x%02X", - (unsigned int)DestAddress, ByteValue); - ValidPoke = TRUE; - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - (unsigned int)PSP_Status, (unsigned int)DestAddress); - } - break; - - case MM_WORD_BIT_WIDTH: - WordValue = (uint16)CmdPtr->Data; - DataValue = (uint32) WordValue; - BytesProcessed = sizeof (uint16); - if ((PSP_Status = CFE_PSP_MemWrite16(DestAddress, WordValue)) == CFE_PSP_SUCCESS) - { - CFE_EVS_SendEvent(MM_POKE_WORD_INF_EID, CFE_EVS_INFORMATION, - "Poke Command: Addr = 0x%08X, Size = 16 bits, Data = 0x%04X", - (unsigned int)DestAddress, WordValue); - ValidPoke = TRUE; - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - (unsigned int)PSP_Status, (unsigned int)DestAddress); - } - break; - - case MM_DWORD_BIT_WIDTH: - DataValue = CmdPtr->Data; - BytesProcessed = sizeof (uint32); - if ((PSP_Status = CFE_PSP_MemWrite32(DestAddress, DataValue)) == CFE_PSP_SUCCESS) - { - CFE_EVS_SendEvent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, - "Poke Command: Addr = 0x%08X, Size = 32 bits, Data = 0x%08X", - (unsigned int)DestAddress, (unsigned int)DataValue); - ValidPoke = TRUE; - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - (unsigned int)PSP_Status, (unsigned int)DestAddress); - } - break; - - /* - ** We don't need a default case, a bad DataSize will get caught - ** in the MM_VerifyPeekPokeParams function and we won't get here - */ - default: - break; - } - - if (ValidPoke) - { - /* Update cmd counter and last action stats */ - MM_AppData.CmdCounter++; - MM_AppData.LastAction = MM_POKE; - MM_AppData.MemType = CmdPtr->MemType; - MM_AppData.Address = DestAddress; - MM_AppData.DataValue = DataValue; - MM_AppData.BytesProcessed = BytesProcessed; - } - - return; - + uint8 ByteValue; + uint16 WordValue; + int32 PSP_Status = CFE_PSP_SUCCESS; + uint32 DataValue = 0; + uint32 BytesProcessed = 0; + bool ValidPoke = false; + uint8 DataSize = 0; /* only used for giving MEM type/size in events */ + uint32 EventID = 0; + + /* Write input number of bits to destination address */ + switch (CmdPtr->DataSize) + { + case MM_BYTE_BIT_WIDTH: + ByteValue = (uint8)CmdPtr->Data; + DataValue = (uint32)ByteValue; + BytesProcessed = sizeof(uint8); + DataSize = 8; + if ((PSP_Status = CFE_PSP_MemWrite8(DestAddress, ByteValue)) == CFE_PSP_SUCCESS) + { + EventID = MM_POKE_BYTE_INF_EID; + ValidPoke = true; + } + break; + + case MM_WORD_BIT_WIDTH: + WordValue = (uint16)CmdPtr->Data; + DataValue = (uint32)WordValue; + BytesProcessed = sizeof(uint16); + DataSize = 16; + if ((PSP_Status = CFE_PSP_MemWrite16(DestAddress, WordValue)) == CFE_PSP_SUCCESS) + { + EventID = MM_POKE_WORD_INF_EID; + ValidPoke = true; + } + break; + + case MM_DWORD_BIT_WIDTH: + DataValue = CmdPtr->Data; + BytesProcessed = sizeof(uint32); + DataSize = 32; + if ((PSP_Status = CFE_PSP_MemWrite32(DestAddress, DataValue)) == CFE_PSP_SUCCESS) + { + EventID = MM_POKE_DWORD_INF_EID; + ValidPoke = true; + } + break; + + /* + ** We don't need a default case, a bad DataSize will get caught + ** in the MM_VerifyPeekPokeParams function and we won't get here + */ + default: + break; + } + + if (ValidPoke) + { + /* Update cmd counter and last action stats */ + MM_AppData.HkPacket.LastAction = MM_POKE; + MM_AppData.HkPacket.MemType = CmdPtr->MemType; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.DataValue = DataValue; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + + CFE_EVS_SendEvent(EventID, CFE_EVS_EventType_INFORMATION, + "Poke Command: Addr = 0x%08X, Size = %d bits, Data = 0x%08X", (unsigned int)DestAddress, + DataSize, (unsigned int)DataValue); + } + else + { + CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM%d", (unsigned int)PSP_Status, + (unsigned int)DestAddress, DataSize); + } + + return ValidPoke; + } /* end MM_PokeMem */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* Write 8, 16, or 32 bits of data to any EEPROM memory address */ +/* Write 8, 16, or 32 bits of data to any EEPROM memory address */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_PokeEeprom (MM_PokeCmd_t *CmdPtr, - uint32 DestAddress) +bool MM_PokeEeprom(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress) { - uint8 ByteValue; - uint16 WordValue; - int32 PSP_Status; - uint32 DataValue = 0; - uint32 BytesProcessed = 0; - boolean ValidPoke = FALSE; - - CFE_ES_PerfLogEntry(MM_EEPROM_POKE_PERF_ID); - - /* Write input number of bits to destination address */ - switch(CmdPtr->DataSize) - { - case MM_BYTE_BIT_WIDTH: - ByteValue = (uint8) CmdPtr->Data; - DataValue = (uint32) ByteValue; - BytesProcessed = sizeof (uint8); - PSP_Status = CFE_PSP_EepromWrite8(DestAddress, ByteValue); - if (PSP_Status != CFE_PSP_SUCCESS) - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_EEPROMWRITE8_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_EepromWrite8 error received: RC = 0x%08X, Addr = 0x%08X", - (unsigned int)PSP_Status, (unsigned int)DestAddress); - } - else - { - CFE_EVS_SendEvent(MM_POKE_BYTE_INF_EID, CFE_EVS_INFORMATION, - "Poke Command: Addr = 0x%08X, Size = 8 bits, Data = 0x%02X", - (unsigned int)DestAddress, ByteValue); - ValidPoke = TRUE; - } - break; - - case MM_WORD_BIT_WIDTH: - WordValue = (uint16)CmdPtr->Data; - DataValue = (uint32) WordValue; - BytesProcessed = sizeof (uint16); - PSP_Status = CFE_PSP_EepromWrite16(DestAddress, WordValue); - if (PSP_Status != CFE_PSP_SUCCESS) - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_EEPROMWRITE16_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_EepromWrite16 error received: RC = 0x%08X, Addr = 0x%08X", - (unsigned int)PSP_Status, (unsigned int)DestAddress); - } - else - { - CFE_EVS_SendEvent(MM_POKE_WORD_INF_EID, CFE_EVS_INFORMATION, - "Poke Command: Addr = 0x%08X, Size = 16 bits, Data = 0x%04X", - (unsigned int)DestAddress, WordValue); - ValidPoke = TRUE; - } - break; - - case MM_DWORD_BIT_WIDTH: - DataValue = CmdPtr->Data; - BytesProcessed = sizeof (uint32); - PSP_Status = CFE_PSP_EepromWrite32(DestAddress, CmdPtr->Data); - if (PSP_Status != CFE_PSP_SUCCESS) - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_EEPROMWRITE32_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_EepromWrite32 error received: RC = 0x%08X, Addr = 0x%08X", - (unsigned int)PSP_Status, (unsigned int)DestAddress); - } - else - { - CFE_EVS_SendEvent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, - "Poke Command: Addr = 0x%08X, Size = 32 bits, Data = 0x%08X", - (unsigned int)DestAddress, (unsigned int)(CmdPtr->Data)); - ValidPoke = TRUE; - } - break; - - /* - ** We don't need a default case, a bad DataSize will get caught - ** in the MM_VerifyPeekPokeParams function and we won't get here - */ - default: - break; - } - - if (ValidPoke) - { - /* Update cmd counter and last action stats */ - MM_AppData.CmdCounter++; - MM_AppData.LastAction = MM_POKE; - MM_AppData.MemType = CmdPtr->MemType; - MM_AppData.Address = DestAddress; - MM_AppData.DataValue = DataValue; - MM_AppData.BytesProcessed = BytesProcessed; - } - - CFE_ES_PerfLogExit(MM_EEPROM_POKE_PERF_ID); - - return; - -} /* end MM_PokeEeprom */ + uint8 ByteValue; + uint16 WordValue; + int32 PSP_Status; + uint32 DataValue = 0; + uint32 BytesProcessed = 0; + bool ValidPoke = false; + + CFE_ES_PerfLogEntry(MM_EEPROM_POKE_PERF_ID); + + /* Write input number of bits to destination address */ + switch (CmdPtr->DataSize) + { + case MM_BYTE_BIT_WIDTH: + ByteValue = (uint8)CmdPtr->Data; + DataValue = (uint32)ByteValue; + BytesProcessed = sizeof(uint8); + PSP_Status = CFE_PSP_EepromWrite8(DestAddress, ByteValue); + if (PSP_Status != CFE_PSP_SUCCESS) + { + CFE_EVS_SendEvent(MM_OS_EEPROMWRITE8_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_EepromWrite8 error received: RC = 0x%08X, Addr = 0x%08X", + (unsigned int)PSP_Status, (unsigned int)DestAddress); + } + else + { + CFE_EVS_SendEvent(MM_POKE_BYTE_INF_EID, CFE_EVS_EventType_INFORMATION, + "Poke Command: Addr = 0x%08X, Size = 8 bits, Data = 0x%02X", + (unsigned int)DestAddress, ByteValue); + ValidPoke = true; + } + break; + + case MM_WORD_BIT_WIDTH: + WordValue = (uint16)CmdPtr->Data; + DataValue = (uint32)WordValue; + BytesProcessed = sizeof(uint16); + PSP_Status = CFE_PSP_EepromWrite16(DestAddress, WordValue); + if (PSP_Status != CFE_PSP_SUCCESS) + { + CFE_EVS_SendEvent(MM_OS_EEPROMWRITE16_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_EepromWrite16 error received: RC = 0x%08X, Addr = 0x%08X", + (unsigned int)PSP_Status, (unsigned int)DestAddress); + } + else + { + CFE_EVS_SendEvent(MM_POKE_WORD_INF_EID, CFE_EVS_EventType_INFORMATION, + "Poke Command: Addr = 0x%08X, Size = 16 bits, Data = 0x%04X", + (unsigned int)DestAddress, WordValue); + ValidPoke = true; + } + break; -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* */ -/* Load memory with interrupts disabled */ -/* Only valid for RAM addresses */ -/* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_LoadMemWIDCmd(CFE_SB_MsgPtr_t MessagePtr) -{ - MM_LoadMemWIDCmd_t *CmdPtr; - int32 LockKey; - int32 PSP_Status; - uint32 ComputedCRC = 0; - uint32 DestAddress; - uint16 ExpectedLength = sizeof(MM_LoadMemWIDCmd_t); - - /* Verify command packet length */ - if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - { - CmdPtr = ((MM_LoadMemWIDCmd_t *)MessagePtr); - - /* Resolve the symbolic address in command message */ - if (CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress) == TRUE) - { - /* - ** Run some necessary checks on command parameters - ** NOTE: A load with interrupts disabled command is only valid for RAM addresses - */ - if (MM_VerifyLoadWIDParams(DestAddress, CmdPtr->NumOfBytes) == TRUE) - { - /* Verify data integrity check value */ - ComputedCRC = CFE_ES_CalculateCRC(CmdPtr->DataArray, - CmdPtr->NumOfBytes, - 0, MM_LOAD_WID_CRC_TYPE); - /* - ** If the CRC matches do the load - */ - if(ComputedCRC == CmdPtr->Crc) + case MM_DWORD_BIT_WIDTH: + DataValue = CmdPtr->Data; + BytesProcessed = sizeof(uint32); + PSP_Status = CFE_PSP_EepromWrite32(DestAddress, CmdPtr->Data); + if (PSP_Status != CFE_PSP_SUCCESS) { - /* Lock current interrupts */ - LockKey = OS_IntLock(); - - /* Load input data to input memory address */ - PSP_Status = CFE_PSP_MemCpy((void *)DestAddress, - CmdPtr->DataArray, - CmdPtr->NumOfBytes); - - /* Restore interrupt state */ - OS_IntUnlock(LockKey); - - if (PSP_Status == CFE_PSP_SUCCESS) - { - MM_AppData.CmdCounter++; - CFE_EVS_SendEvent(MM_LOAD_WID_INF_EID, CFE_EVS_INFORMATION, - "Load Memory WID Command: Wrote %d bytes to address: 0x%08X", - (int)CmdPtr->NumOfBytes, (unsigned int)DestAddress); - - /* Update last action statistics */ - MM_AppData.LastAction = MM_LOAD_WID; - MM_AppData.Address = DestAddress; - MM_AppData.MemType = MM_RAM; - MM_AppData.BytesProcessed = CmdPtr->NumOfBytes; - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - (unsigned int)PSP_Status, (unsigned int)(CmdPtr->DataArray), - (unsigned int)DestAddress, (unsigned int)(CmdPtr->NumOfBytes)); - } + CFE_EVS_SendEvent(MM_OS_EEPROMWRITE32_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_EepromWrite32 error received: RC = 0x%08X, Addr = 0x%08X", + (unsigned int)PSP_Status, (unsigned int)DestAddress); } else { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_LOAD_WID_CRC_ERR_EID, CFE_EVS_ERROR, - "Interrupts Disabled Load CRC failure: Expected = 0x%X Calculated = 0x%X", - (unsigned int)CmdPtr->Crc, (unsigned int)ComputedCRC); - } - - } /* end MM_VerifyLoadWIDParams */ - - } /* end CFS_ResolveSymAddr if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - CmdPtr->DestSymAddress.SymName); - } - - } /* end MM_VerifyCmdLength if */ - - return; - -} /* end MM_LoadMemWIDCmd */ + CFE_EVS_SendEvent(MM_POKE_DWORD_INF_EID, CFE_EVS_EventType_INFORMATION, + "Poke Command: Addr = 0x%08X, Size = 32 bits, Data = 0x%08X", + (unsigned int)DestAddress, (unsigned int)(CmdPtr->Data)); + ValidPoke = true; + } + break; + + /* + ** We don't need a default case, a bad DataSize will get caught + ** in the MM_VerifyPeekPokeParams function and we won't get here + */ + default: + break; + } + + if (ValidPoke) + { + /* Update cmd counter and last action stats */ + MM_AppData.HkPacket.LastAction = MM_POKE; + MM_AppData.HkPacket.MemType = CmdPtr->MemType; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.DataValue = DataValue; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + } + + CFE_ES_PerfLogExit(MM_EEPROM_POKE_PERF_ID); + + return ValidPoke; + +} /* end MM_PokeEeprom */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* Verify load memory with interrupts disabled parameters */ +/* Load memory with interrupts disabled */ +/* Only valid for RAM addresses */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyLoadWIDParams(uint32 Address, - uint32 SizeInBytes) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_LoadMemWIDCmd(const CFE_SB_Buffer_t *BufPtr) { - boolean Valid = TRUE; - int32 PSP_Status; - - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_UNINTERRUPTABLE_DATA)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - - return (Valid); - -} /* end MM_VerifyLoadWIDParams */ + MM_LoadMemWIDCmd_t *CmdPtr; + uint32 ComputedCRC = 0; + cpuaddr DestAddress; + uint16 ExpectedLength = sizeof(MM_LoadMemWIDCmd_t); + bool CmdResult = false; + + /* Verify command packet length */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_LoadMemWIDCmd_t *)BufPtr); + + /* Resolve the symbolic address in command message */ + if (CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress) == true) + { + /* + ** Run some necessary checks on command parameters + ** NOTE: A load with interrupts disabled command is only valid for RAM addresses + */ + if (MM_VerifyLoadDumpParams(DestAddress, MM_RAM, CmdPtr->NumOfBytes, MM_VERIFY_WID) == true) + { + /* Verify data integrity check value */ + ComputedCRC = CFE_ES_CalculateCRC(CmdPtr->DataArray, CmdPtr->NumOfBytes, 0, MM_LOAD_WID_CRC_TYPE); + /* + ** If the CRC matches do the load + */ + if (ComputedCRC == CmdPtr->Crc) + { + + /* Load input data to input memory address */ + memcpy((void *)DestAddress, CmdPtr->DataArray, CmdPtr->NumOfBytes); + + CmdResult = true; + CFE_EVS_SendEvent(MM_LOAD_WID_INF_EID, CFE_EVS_EventType_INFORMATION, + "Load Memory WID Command: Wrote %d bytes to address: 0x%08X", + (int)CmdPtr->NumOfBytes, (unsigned int)DestAddress); + + /* Update last action statistics */ + MM_AppData.HkPacket.LastAction = MM_LOAD_WID; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.MemType = MM_RAM; + MM_AppData.HkPacket.BytesProcessed = CmdPtr->NumOfBytes; + } + else + { + CFE_EVS_SendEvent(MM_LOAD_WID_CRC_ERR_EID, CFE_EVS_EventType_ERROR, + "Interrupts Disabled Load CRC failure: Expected = 0x%X Calculated = 0x%X", + (unsigned int)CmdPtr->Crc, (unsigned int)ComputedCRC); + } + + } /* end MM_VerifyLoadWIDParams */ + + } /* end CFS_ResolveSymAddr if */ + else + { + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", CmdPtr->DestSymAddress.SymName); + } + + } /* end MM_VerifyCmdLength if */ + + return CmdResult; + +} /* end MM_LoadMemWIDCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* Load memory from a file command */ +/* Load memory from a file command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_LoadMemFromFileCmd(CFE_SB_MsgPtr_t MessagePtr) +bool MM_LoadMemFromFileCmd(const CFE_SB_Buffer_t *BufPtr) { - boolean Valid = TRUE; - int32 FileHandle; - int32 OS_Status = OS_SUCCESS; - uint32 DestAddress; - MM_LoadMemFromFileCmd_t *CmdPtr; - CFE_FS_Header_t CFEFileHeader; - MM_LoadDumpFileHeader_t MMFileHeader; - uint32 ComputedCRC; - uint16 ExpectedLength = sizeof(MM_LoadMemFromFileCmd_t); - - /* Verify command packet length */ - if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - { - CmdPtr = ((MM_LoadMemFromFileCmd_t *)MessagePtr); - - /* - ** NUL terminate the very end of the file name string array as a - ** safety measure - */ - CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; - - /* Verify filename doesn't have any illegal characters */ - Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); - if(Valid == TRUE) - { - /* Open load file for reading */ - if((FileHandle = OS_open(CmdPtr->FileName, OS_READ_ONLY, 0)) >= OS_SUCCESS) - { - /* Read in the file headers */ - Valid = MM_ReadFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); - if(Valid == TRUE) + bool Valid = false; + osal_id_t FileHandle; + int32 OS_Status = OS_SUCCESS; + cpuaddr DestAddress; + MM_LoadMemFromFileCmd_t *CmdPtr; + CFE_FS_Header_t CFEFileHeader; + MM_LoadDumpFileHeader_t MMFileHeader; + uint32 ComputedCRC; + uint16 ExpectedLength = sizeof(MM_LoadMemFromFileCmd_t); + + /* Verify command packet length */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + CmdPtr = ((MM_LoadMemFromFileCmd_t *)BufPtr); + + /* + ** NUL terminate the very end of the file name string array as a + ** safety measure + */ + CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; + + /* Verify filename doesn't have any illegal characters */ + Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); + if (Valid == true) + { + /* Open load file for reading */ + OS_Status = OS_OpenCreate(&FileHandle, CmdPtr->FileName, OS_FILE_FLAG_NONE, OS_READ_ONLY); + if (OS_Status == OS_SUCCESS) { - /* Verify the file size is correct */ - Valid = MM_VerifyLoadFileSize(CmdPtr->FileName, &MMFileHeader); - if(Valid == TRUE) - { - /* Verify data integrity check value */ - OS_Status = CFS_ComputeCRCFromFile(FileHandle, &ComputedCRC, MM_LOAD_FILE_CRC_TYPE); - if(OS_Status == OS_SUCCESS) - { - /* - ** Reset the file pointer to the start of the load data, need to do this - ** because CFS_ComputeCRCFromFile reads to the end of file - */ - OS_lseek(FileHandle, (sizeof(CFE_FS_Header_t) - + sizeof(MM_LoadDumpFileHeader_t)), OS_SEEK_SET); - - /* Check the computed CRC against the file header CRC */ - if(ComputedCRC == MMFileHeader.Crc) - { - /* Resolve symbolic address in file header */ - Valid = CFS_ResolveSymAddr(&(MMFileHeader.SymAddress), &DestAddress); - - if(Valid == TRUE) + /* Read in the file headers */ + Valid = MM_ReadFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); + if (Valid == true) + { + /* Verify the file size is correct */ + Valid = MM_VerifyLoadFileSize(CmdPtr->FileName, &MMFileHeader); + if (Valid == true) + { + /* Verify data integrity check value */ + OS_Status = CFS_ComputeCRCFromFile(FileHandle, &ComputedCRC, MM_LOAD_FILE_CRC_TYPE); + if (OS_Status == OS_SUCCESS) { - /* Run necessary checks on command parameters */ - Valid = MM_VerifyFileLoadParams(DestAddress, MMFileHeader.MemType, - MMFileHeader.NumOfBytes); - if(Valid == TRUE) - { - /* Call the load routine for the specified memory type */ - switch(MMFileHeader.MemType) - { - case MM_RAM: - case MM_EEPROM: - Valid = MM_LoadMemFromFile(FileHandle, CmdPtr->FileName, - &MMFileHeader, DestAddress); - break; - -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - Valid = MM_LoadMem32FromFile(FileHandle, CmdPtr->FileName, - &MMFileHeader, DestAddress); - break; + /* + ** Reset the file pointer to the start of the load data, need to do this + ** because CFS_ComputeCRCFromFile reads to the end of file + */ + OS_Status = OS_lseek( + FileHandle, (sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t)), OS_SEEK_SET); + if (OS_Status != (sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t))) + { + Valid = false; + } + /* Check the computed CRC against the file header CRC */ + if ((ComputedCRC == MMFileHeader.Crc) && (Valid == true)) + { + /* Resolve symbolic address in file header */ + Valid = CFS_ResolveSymAddr(&(MMFileHeader.SymAddress), &DestAddress); + + if (Valid == true) + { + /* Run necessary checks on command parameters */ + Valid = MM_VerifyLoadDumpParams(DestAddress, MMFileHeader.MemType, + MMFileHeader.NumOfBytes, MM_VERIFY_LOAD); + if (Valid == true) + { + /* Call the load routine for the specified memory type */ + switch (MMFileHeader.MemType) + { + case MM_RAM: + case MM_EEPROM: + Valid = MM_LoadMemFromFile(FileHandle, CmdPtr->FileName, &MMFileHeader, + DestAddress); + break; + +#ifdef MM_OPT_CODE_MEM32_MEMTYPE + case MM_MEM32: + Valid = MM_LoadMem32FromFile(FileHandle, CmdPtr->FileName, + &MMFileHeader, DestAddress); + break; #endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - Valid = MM_LoadMem16FromFile(FileHandle, CmdPtr->FileName, - &MMFileHeader, DestAddress); - break; + +#ifdef MM_OPT_CODE_MEM16_MEMTYPE + case MM_MEM16: + Valid = MM_LoadMem16FromFile(FileHandle, CmdPtr->FileName, + &MMFileHeader, DestAddress); + break; #endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - Valid = MM_LoadMem8FromFile(FileHandle, CmdPtr->FileName, - &MMFileHeader, DestAddress); - break; + +#ifdef MM_OPT_CODE_MEM8_MEMTYPE + case MM_MEM8: + Valid = MM_LoadMem8FromFile(FileHandle, CmdPtr->FileName, &MMFileHeader, + DestAddress); + break; #endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - - /* - ** We don't need a default case, a bad MemType will get caught - ** in the MM_VerifyFileLoadParams function and we won't get here - */ - default: - break; - } - - if(Valid == TRUE) - { - MM_AppData.CmdCounter++; - CFE_EVS_SendEvent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, - "Load Memory From File Command: Loaded %d bytes to address 0x%08X from file '%s'", - (int)MM_AppData.BytesProcessed, (unsigned int)DestAddress, CmdPtr->FileName); - } - - } /* end MM_VerifyFileLoadParams if */ - else - { - /* - ** We don't need to increment the error counter here, it was done by the - ** MM_VerifyFileLoadParams routine when the error was first discovered. - ** We send this event as a supplemental message with the filename attached. - */ - CFE_EVS_SendEvent(MM_FILE_LOAD_PARAMS_ERR_EID, CFE_EVS_ERROR, - "Load file failed parameters check: File = '%s'", CmdPtr->FileName); - } - - } /* end CFS_ResolveSymAddr if */ + + /* + ** We don't need a default case, a bad MemType will get caught + ** in the MM_VerifyFileLoadParams function and we won't get here + */ + default: + Valid = false; + break; + } + + if (Valid == true) + { + CFE_EVS_SendEvent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_EventType_INFORMATION, + "Load Memory From File Command: Loaded %d bytes to " + "address 0x%08X from file '%s'", + (int)MM_AppData.HkPacket.BytesProcessed, + (unsigned int)DestAddress, CmdPtr->FileName); + } + + } /* end MM_VerifyFileLoadParams if */ + else + { + /* + ** We don't need to increment the error counter here, it was done by the + ** MM_VerifyFileLoadParams routine when the error was first discovered. + ** We send this event as a supplemental message with the filename attached. + */ + CFE_EVS_SendEvent(MM_FILE_LOAD_PARAMS_ERR_EID, CFE_EVS_EventType_ERROR, + "Load file failed parameters check: File = '%s'", + CmdPtr->FileName); + } + + } /* end CFS_ResolveSymAddr if */ + else + { + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", + MMFileHeader.SymAddress.SymName); + } + + } /* end ComputedCRC == MMFileHeader.Crc if */ + else + { + Valid = false; + CFE_EVS_SendEvent( + MM_LOAD_FILE_CRC_ERR_EID, CFE_EVS_EventType_ERROR, + "Load file CRC failure: Expected = 0x%X Calculated = 0x%X File = '%s'", + (unsigned int)MMFileHeader.Crc, (unsigned int)ComputedCRC, CmdPtr->FileName); + } + + } /* end CFS_ComputeCRCFromFile if */ else { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - MMFileHeader.SymAddress.SymName); - } - - } /* end ComputedCRC == MMFileHeader.Crc if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_LOAD_FILE_CRC_ERR_EID, CFE_EVS_ERROR, - "Load file CRC failure: Expected = 0x%X Calculated = 0x%X File = '%s'", - (unsigned int)MMFileHeader.Crc, (unsigned int)ComputedCRC, CmdPtr->FileName); - } - - } /* end CFS_ComputeCRCFromFile if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_ERROR, - "CFS_ComputeCRCFromFile error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, - CmdPtr->FileName); - } - - } /* end MM_VerifyLoadFileSize */ - - /* - ** Don't need an 'else' here. MM_VerifyLoadFileSize will increment - ** the error counter and generate an event message if needed. - */ - - } /* end MM_ReadFileHeaders if */ - - /* - ** Don't need an 'else' here. MM_ReadFileHeaders will increment - ** the error counter and generate an event message if needed. - */ - - /* Close the load file for all cases after the open call succeeds */ - OS_Status = OS_close(FileHandle); - if(OS_Status != OS_SUCCESS) + Valid = false; + CFE_EVS_SendEvent(MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFS_ComputeCRCFromFile error received: RC = 0x%08X File = '%s'", + (unsigned int)OS_Status, CmdPtr->FileName); + } + + } /* end MM_VerifyLoadFileSize */ + + /* + ** Don't need an 'else' here. MM_VerifyLoadFileSize will increment + ** the error counter and generate an event message if needed. + */ + + } /* end MM_ReadFileHeaders if */ + + /* + ** Don't need an 'else' here. MM_ReadFileHeaders will increment + ** the error counter and generate an event message if needed. + */ + + /* Close the load file for all cases after the open call succeeds */ + OS_Status = OS_close(FileHandle); + if (OS_Status != OS_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent(MM_OS_CLOSE_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_close error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, + CmdPtr->FileName); + } + + } /* end OS_OpenCreate if */ + else { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_CLOSE_ERR_EID, CFE_EVS_ERROR, - "OS_close error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, - CmdPtr->FileName); - } - - } /* end OS_open if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_OPEN_ERR_EID, CFE_EVS_ERROR, - "OS_open error received: RC = 0x%08X File = '%s'", (unsigned int)FileHandle, - CmdPtr->FileName); - } - - } /* end IsValidFilename if */ - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_CMD_FNAME_ERR_EID, CFE_EVS_ERROR, - "Command specified filename invalid: Name = '%s'", CmdPtr->FileName); - } - - } /* end MM_VerifyCmdLength if */ - - return; - + Valid = false; + CFE_EVS_SendEvent(MM_OS_OPEN_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_OpenCreate error received: RC = %d File = '%s'", (int)OS_Status, + CmdPtr->FileName); + } + + } /* end IsValidFilename if */ + else + { + Valid = false; + CFE_EVS_SendEvent(MM_CMD_FNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Command specified filename invalid: Name = '%s'", CmdPtr->FileName); + } + + } /* end MM_VerifyCmdLength if */ + + return Valid; + } /* end LoadMemFromFileCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -686,646 +564,307 @@ void MM_LoadMemFromFileCmd(CFE_SB_MsgPtr_t MessagePtr) /* Loads memory from a file */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_LoadMemFromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress) +bool MM_LoadMemFromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress) { - boolean Valid = FALSE; - int32 BytesRemaining = FileHeader->NumOfBytes; - int32 BytesProcessed = 0; - int32 ReadLength; - int32 PSP_Status; - uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - uint8 *ioBuffer = (uint8 *) &MM_AppData.LoadBuffer[0]; - uint8 *TargetPointer = (uint8 *) DestAddress; - - if(FileHeader->MemType == MM_EEPROM) - { - CFE_ES_PerfLogEntry(MM_EEPROM_FILELOAD_PERF_ID); - } - - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - { - SegmentSize = BytesRemaining; - } - - if ((ReadLength = OS_read(FileHandle, ioBuffer, SegmentSize)) == SegmentSize) - { - PSP_Status = CFE_PSP_MemCpy(TargetPointer, ioBuffer, SegmentSize); - - if (PSP_Status == CFE_PSP_SUCCESS) - { + bool Valid = false; + int32 BytesRemaining = FileHeader->NumOfBytes; + int32 BytesProcessed = 0; + int32 ReadLength; + uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; + uint8 *ioBuffer = (uint8 *)&MM_AppData.LoadBuffer[0]; + uint8 *TargetPointer = (uint8 *)DestAddress; + + if (FileHeader->MemType == MM_EEPROM) + { + CFE_ES_PerfLogEntry(MM_EEPROM_FILELOAD_PERF_ID); + } + + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) + { + SegmentSize = BytesRemaining; + } + + if ((ReadLength = OS_read(FileHandle, ioBuffer, SegmentSize)) == SegmentSize) + { + memcpy(TargetPointer, ioBuffer, SegmentSize); + BytesRemaining -= SegmentSize; BytesProcessed += SegmentSize; - TargetPointer += SegmentSize; + TargetPointer += SegmentSize; /* Prevent CPU hogging between load segments */ - if (BytesRemaining != 0) + if (BytesRemaining != 0) { - MM_SegmentBreak(); + MM_SegmentBreak(); } - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - (unsigned int)PSP_Status, (unsigned int)ioBuffer, (unsigned int)TargetPointer, (unsigned int)SegmentSize); + } + else + { + CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", (unsigned int)ReadLength, + (int)SegmentSize, FileName); BytesRemaining = 0; - } - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)ReadLength, (int)SegmentSize, FileName); - BytesRemaining = 0; - } - } - - /* Update last action statistics */ - if (BytesProcessed == FileHeader->NumOfBytes) - { - Valid = TRUE; - MM_AppData.LastAction = MM_LOAD_FROM_FILE; - MM_AppData.MemType = FileHeader->MemType; - MM_AppData.Address = DestAddress; - MM_AppData.BytesProcessed = BytesProcessed; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - } - - return(Valid); - -} /* end MM_LoadMemFromFile */ + } + } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* */ -/* Verify load memory from a file parameters */ -/* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyFileLoadParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes) -{ - boolean Valid = TRUE; - int32 PSP_Status; - - switch(MemType) - { - case MM_RAM: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_RAM)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; - - case MM_EEPROM: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_EEPROM)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; - -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_MEM32)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_MEM16)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ + if (FileHeader->MemType == MM_EEPROM) + { + CFE_ES_PerfLogExit(MM_EEPROM_FILELOAD_PERF_ID); + } -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_MEM8)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - - default: - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - "Invalid memory type specified: MemType = %d", MemType); - break; + /* Update last action statistics */ + if (BytesProcessed == FileHeader->NumOfBytes) + { + Valid = true; + MM_AppData.HkPacket.LastAction = MM_LOAD_FROM_FILE; + MM_AppData.HkPacket.MemType = FileHeader->MemType; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + } - } /* end MemType switch */ + return (Valid); - return (Valid); - -} /* end MM_VerifyFileLoadParams */ +} /* end MM_LoadMemFromFile */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Verify load file size */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyLoadFileSize(char *FileName, - MM_LoadDumpFileHeader_t *FileHeader) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_VerifyLoadFileSize(const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader) { - boolean Valid = TRUE; - int32 OS_Status; - uint32 ExpectedSize; - int32 ActualSize; /* The size returned by OS_stat is signed */ - os_fstat_t FileStats; - - /* - ** Get the filesystem statistics on our load file - */ - OS_Status = OS_stat(FileName, &FileStats); - if(OS_Status != OS_FS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_STAT_ERR_EID, CFE_EVS_ERROR, - "OS_stat error received: RC = 0x%08X File = '%s'", - (unsigned int)OS_Status, FileName); - } - else - { - /* - ** Check the reported size of the file against what it should be based - ** upon the number of load bytes specified in the file header - */ + bool Valid = true; + int32 OS_Status; + uint32 ExpectedSize; + int32 ActualSize; /* The size returned by OS_stat is signed */ + os_fstat_t FileStats; + + /* + ** Get the filesystem statistics on our load file + */ + OS_Status = OS_stat(FileName, &FileStats); + if (OS_Status != OS_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent(MM_OS_STAT_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_stat error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, FileName); + } + else + { + /* + ** Check the reported size of the file against what it should be based + ** upon the number of load bytes specified in the file header + */ #ifdef OS_FILESTAT_SIZE - ActualSize = OS_FILESTAT_SIZE(FileStats); + ActualSize = OS_FILESTAT_SIZE(FileStats); #else - ActualSize = FileStats.st_size; + ActualSize = FileStats.st_size; #endif - ExpectedSize = FileHeader->NumOfBytes + sizeof(CFE_FS_Header_t) - + sizeof(MM_LoadDumpFileHeader_t); - if(ActualSize != ExpectedSize) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - - /* - ** Note: passing FileStats.st_size in this event message will cause - ** a segmentation fault under cygwin during unit testing, so we added - ** the variable ActualSize to this function. - */ - CFE_EVS_SendEvent(MM_LD_FILE_SIZE_ERR_EID, CFE_EVS_ERROR, - "Load file size error: Reported by OS = %d Expected = %d File = '%s'", - (int)ActualSize, (int)ExpectedSize, FileName); - } - - } - - return (Valid); - + ExpectedSize = FileHeader->NumOfBytes + sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t); + if (ActualSize != ExpectedSize) + { + Valid = false; + + /* + ** Note: passing FileStats.st_size in this event message will cause + ** a segmentation fault under cygwin during unit testing, so we added + ** the variable ActualSize to this function. + */ + CFE_EVS_SendEvent(MM_LD_FILE_SIZE_ERR_EID, CFE_EVS_EventType_ERROR, + "Load file size error: Reported by OS = %d Expected = %d File = '%s'", (int)ActualSize, + (int)ExpectedSize, FileName); + } + } + + return (Valid); + } /* end MM_VerifyLoadFileSize */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Read the cFE primary and and MM secondary file headers */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_ReadFileHeaders(char *FileName, - int32 FileHandle, - CFE_FS_Header_t *CFEHeader, - MM_LoadDumpFileHeader_t *MMHeader) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_ReadFileHeaders(const char *FileName, int32 FileHandle, CFE_FS_Header_t *CFEHeader, + MM_LoadDumpFileHeader_t *MMHeader) { - boolean Valid = TRUE; - int32 OS_Status; - - /* - ** Read in the primary cFE file header - */ - OS_Status = CFE_FS_ReadHeader(CFEHeader, FileHandle); - if(OS_Status != sizeof(CFE_FS_Header_t)) - { - /* We either got an error or didn't read as much data as expected */ - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_CFE_FS_READHDR_ERR_EID, CFE_EVS_ERROR, - "CFE_FS_ReadHeader error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)OS_Status, sizeof(CFE_FS_Header_t), FileName); - - - } /* end CFE_FS_ReadHeader if */ - else - { - /* - ** Read in the secondary MM file header - */ - OS_Status = OS_read(FileHandle, MMHeader, sizeof(MM_LoadDumpFileHeader_t)); - if(OS_Status != sizeof(MM_LoadDumpFileHeader_t)) - { - /* We either got an error or didn't read as much data as expected */ - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_READ_EXP_ERR_EID, CFE_EVS_ERROR, - "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)OS_Status, sizeof(MM_LoadDumpFileHeader_t), FileName); - - } /* end OS_read if */ - - } /* end CFE_FS_ReadHeader else */ - - return (Valid); - -} /* end MM_ReadFileHeaders */ + bool Valid = true; + int32 OS_Status; + + /* + ** Read in the primary cFE file header + */ + OS_Status = CFE_FS_ReadHeader(CFEHeader, FileHandle); + if (OS_Status != sizeof(CFE_FS_Header_t)) + { + /* We either got an error or didn't read as much data as expected */ + Valid = false; + CFE_EVS_SendEvent(MM_CFE_FS_READHDR_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_FS_ReadHeader error received: RC = 0x%08X Expected = %u File = '%s'", + (unsigned int)OS_Status, (unsigned int)sizeof(CFE_FS_Header_t), FileName); + + } /* end CFE_FS_ReadHeader if */ + else + { + /* + ** Read in the secondary MM file header + */ + OS_Status = OS_read(FileHandle, MMHeader, sizeof(MM_LoadDumpFileHeader_t)); + if (OS_Status != sizeof(MM_LoadDumpFileHeader_t)) + { + /* We either got an error or didn't read as much data as expected */ + Valid = false; + CFE_EVS_SendEvent(MM_OS_READ_EXP_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_read error received: RC = 0x%08X Expected = %u File = '%s'", (unsigned int)OS_Status, + (unsigned int)sizeof(MM_LoadDumpFileHeader_t), FileName); + + } /* end OS_read if */ + + } /* end CFE_FS_ReadHeader else */ + + return (Valid); +} /* end MM_ReadFileHeaders */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ -/* Fill memory command */ +/* Fill memory command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_FillMemCmd(CFE_SB_MsgPtr_t MessagePtr) +bool MM_FillMemCmd(const CFE_SB_Buffer_t *BufPtr) { - uint32 DestAddress; - MM_FillMemCmd_t *CmdPtr = (MM_FillMemCmd_t *) MessagePtr; - uint16 ExpectedLength = sizeof(MM_FillMemCmd_t); - - /* Verify command packet length */ - if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - { - /* Resolve symbolic address */ - if (CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress) == TRUE) - { - /* Run necessary checks on command parameters */ - if (MM_VerifyFillParams(DestAddress, CmdPtr->MemType, CmdPtr->NumOfBytes) == TRUE) - { - switch(CmdPtr->MemType) + cpuaddr DestAddress; + MM_FillMemCmd_t *CmdPtr = (MM_FillMemCmd_t *)BufPtr; + uint16 ExpectedLength = sizeof(MM_FillMemCmd_t); + bool CmdResult = false; + + /* Verify command packet length */ + if (MM_VerifyCmdLength(&BufPtr->Msg, ExpectedLength)) + { + /* Resolve symbolic address */ + if (CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress) == true) + { + /* Run necessary checks on command parameters */ + if (MM_VerifyLoadDumpParams(DestAddress, CmdPtr->MemType, CmdPtr->NumOfBytes, MM_VERIFY_FILL) == true) { - case MM_RAM: - case MM_EEPROM: - MM_FillMem(DestAddress, CmdPtr); - break; - - #if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - MM_FillMem32(DestAddress, CmdPtr); - break; - #endif - - #if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - MM_FillMem16(DestAddress, CmdPtr); - break; - #endif - - #if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - MM_FillMem8(DestAddress, CmdPtr); - break; - #endif - - /* - ** We don't need a default case, a bad MemType will get caught - ** in the MM_VerifyFillParams function and we won't get here - */ - default: - break; - } - - if (MM_AppData.LastAction == MM_FILL) - { - MM_AppData.CmdCounter++; - CFE_EVS_SendEvent(MM_FILL_INF_EID, CFE_EVS_INFORMATION, - "Fill Memory Command: Filled %d bytes at address: 0x%08X with pattern: 0x%08X", - (int)MM_AppData.BytesProcessed, (unsigned int)DestAddress, (unsigned int)MM_AppData.DataValue); + switch (CmdPtr->MemType) + { + case MM_RAM: + case MM_EEPROM: + CmdResult = MM_FillMem(DestAddress, CmdPtr); + break; + +#ifdef MM_OPT_CODE_MEM32_MEMTYPE + case MM_MEM32: + CmdResult = MM_FillMem32(DestAddress, CmdPtr); + break; +#endif + +#ifdef MM_OPT_CODE_MEM16_MEMTYPE + case MM_MEM16: + CmdResult = MM_FillMem16(DestAddress, CmdPtr); + break; +#endif + +#ifdef MM_OPT_CODE_MEM8_MEMTYPE + case MM_MEM8: + CmdResult = MM_FillMem8(DestAddress, CmdPtr); + break; +#endif + + /* + ** We don't need a default case, a bad MemType will get caught + ** in the MM_VerifyLoadDumpParams function and we won't get here + */ + default: + CmdResult = false; + break; + } + + if (MM_AppData.HkPacket.LastAction == MM_FILL) + { + CFE_EVS_SendEvent(MM_FILL_INF_EID, CFE_EVS_EventType_INFORMATION, + "Fill Memory Command: Filled %d bytes at address: 0x%08X with pattern: 0x%08X", + (int)MM_AppData.HkPacket.BytesProcessed, (unsigned int)DestAddress, + (unsigned int)MM_AppData.HkPacket.DataValue); + } } - } - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - "Symbolic address can't be resolved: Name = '%s'", - CmdPtr->DestSymAddress.SymName); - } - } - - return; - -} /* end MM_FillMemCmd */ + } + else + { + CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_EventType_ERROR, + "Symbolic address can't be resolved: Name = '%s'", CmdPtr->DestSymAddress.SymName); + } + } + return CmdResult; + +} /* end MM_FillMemCmd */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Fill memory with the command specified fill pattern */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_FillMem(uint32 DestAddress, - MM_FillMemCmd_t *CmdPtr) +bool MM_FillMem(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr) { - uint16 i; - int32 PSP_Status; - boolean Valid = TRUE; - uint32 BytesProcessed = 0; - uint32 BytesRemaining = CmdPtr->NumOfBytes; - uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; - uint8 *TargetPointer = (uint8 *) DestAddress; - uint8 *FillBuffer = (uint8 *) &MM_AppData.FillBuffer[0]; - - /* Create a scratch buffer with one fill segment */ - for (i = 0; i < (MM_MAX_FILL_DATA_SEG/sizeof(uint32)); i++) - { - FillBuffer[i] = CmdPtr->FillPattern; - } - - /* Start EEPROM performance monitor */ - if(CmdPtr->MemType == MM_EEPROM) - { - CFE_ES_PerfLogEntry(MM_EEPROM_FILL_PERF_ID); - } - - /* Fill memory one segment at a time */ - while (BytesRemaining != 0) - { - /* Last fill segment may be partial size */ - if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - { - SegmentSize = BytesRemaining; - } - - PSP_Status = CFE_PSP_MemCpy(TargetPointer, FillBuffer, SegmentSize); - - if (PSP_Status == CFE_PSP_SUCCESS) - { - TargetPointer += SegmentSize; - BytesProcessed += SegmentSize; - BytesRemaining -= SegmentSize; - } - else - { - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - (unsigned int)PSP_Status, (unsigned int)FillBuffer, (unsigned int)TargetPointer, (unsigned int)SegmentSize); - BytesRemaining = 0; - Valid = FALSE; - } - } - - /* Stop EEPROM performance monitor */ - if(CmdPtr->MemType == MM_EEPROM) - { - CFE_ES_PerfLogExit(MM_EEPROM_FILL_PERF_ID); - } - - /* Update last action statistics */ - if (Valid) - { - MM_AppData.LastAction = MM_FILL; - MM_AppData.MemType = CmdPtr->MemType; - MM_AppData.Address = DestAddress; - MM_AppData.DataValue = CmdPtr->FillPattern; - MM_AppData.BytesProcessed = BytesProcessed; - } - - return; - -}/* End MM_FillMem */ - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* */ -/* Verify fill memory parameters */ -/* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyFillParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes) -{ - boolean Valid = TRUE; - int32 PSP_Status; - - switch(MemType) - { - case MM_RAM: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_RAM)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; - - case MM_EEPROM: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_EEPROM)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; - -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_MEM32)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_MEM16)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (PSP_Status != CFE_PSP_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - } - else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_MEM8)) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - } - break; -#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - - default: - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - "Invalid memory type specified: MemType = %d", MemType); - break; - - } /* end MemType switch */ - - return (Valid); - -} /* end MM_VerifyFillParams */ + uint16 i; + bool Valid = true; + uint32 BytesProcessed = 0; + uint32 BytesRemaining = CmdPtr->NumOfBytes; + uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; + uint8 *TargetPointer = (uint8 *)DestAddress; + uint8 *FillBuffer = (uint8 *)&MM_AppData.FillBuffer[0]; + + /* Create a scratch buffer with one fill segment */ + for (i = 0; i < (MM_MAX_FILL_DATA_SEG / sizeof(uint32)); i++) + { + FillBuffer[i] = CmdPtr->FillPattern; + } + + /* Start EEPROM performance monitor */ + if (CmdPtr->MemType == MM_EEPROM) + { + CFE_ES_PerfLogEntry(MM_EEPROM_FILL_PERF_ID); + } + + /* Fill memory one segment at a time */ + while (BytesRemaining != 0) + { + /* Last fill segment may be partial size */ + if (BytesRemaining < MM_MAX_FILL_DATA_SEG) + { + SegmentSize = BytesRemaining; + } + + memcpy(TargetPointer, FillBuffer, SegmentSize); + + TargetPointer += SegmentSize; + BytesProcessed += SegmentSize; + BytesRemaining -= SegmentSize; + } + + /* Stop EEPROM performance monitor */ + if (CmdPtr->MemType == MM_EEPROM) + { + CFE_ES_PerfLogExit(MM_EEPROM_FILL_PERF_ID); + } + + /* Update last action statistics */ + MM_AppData.HkPacket.LastAction = MM_FILL; + MM_AppData.HkPacket.MemType = CmdPtr->MemType; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.DataValue = CmdPtr->FillPattern; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + + return Valid; + +} /* End MM_FillMem */ /************************/ /* End of File Comment */ diff --git a/fsw/src/mm_load.h b/fsw/src/mm_load.h index 967c3c9..3ae45dd 100644 --- a/fsw/src/mm_load.h +++ b/fsw/src/mm_load.h @@ -1,39 +1,21 @@ /************************************************************************* -** File: -** $Id: mm_load.h 1.2 2015/12/29 15:22:46EST czogby Exp $ +** File: mm_load.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager routines that process ** memory load and fill ground commands ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_load.h $ -** Revision 1.2 2015/12/29 15:22:46EST czogby -** Move function prototypes from .c files into .h files -** Revision 1.1 2015/07/28 12:21:48EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.4 2015/03/02 14:27:03EST sstrege -** Added copyright information -** Revision 1.3 2008/05/19 15:23:17EDT dahardison -** Version after completion of unit testing -** **************************************************************************/ + #ifndef _mm_load_ #define _mm_load_ @@ -49,193 +31,130 @@ *************************************************************************/ /************************************************************************/ /** \brief Memory poke -** +** ** \par Description -** Support function for #MM_PokeCmd. This routine will write +** Support function for #MM_PokeCmd. This routine will write ** 8, 16, or 32 bits of data to a single ram address. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] CmdPtr A #MM_PokeCmd_t pointer to the poke +** +** \param [in] CmdPtr A #MM_PokeCmd_t pointer to the poke ** command message ** -** \param [in] DestAddress The destination address for the poke +** \param [in] DestAddress The destination address for the poke ** operation ** *************************************************************************/ -void MM_PokeMem(MM_PokeCmd_t *CmdPtr, - uint32 DestAddress); +bool MM_PokeMem(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress); /************************************************************************/ /** \brief Eeprom poke -** +** ** \par Description -** Support function for #MM_PokeCmd. This routine will write +** Support function for #MM_PokeCmd. This routine will write ** 8, 16, or 32 bits of data to a single EEPROM address. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] CmdPtr A #MM_PokeCmd_t pointer to the poke +** +** \param [in] CmdPtr A #MM_PokeCmd_t pointer to the poke ** command message ** -** \param [in] DestAddress The destination address for the poke +** \param [in] DestAddress The destination address for the poke ** operation ** *************************************************************************/ -void MM_PokeEeprom (MM_PokeCmd_t *CmdPtr, - uint32 DestAddress); +bool MM_PokeEeprom(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress); /************************************************************************/ /** \brief Load memory with interrupts disabled -** +** ** \par Description -** Support function for #MM_LoadMemWIDCmd. This routine will -** load up to #MM_MAX_UNINTERRUPTABLE_DATA bytes into +** Support function for #MM_LoadMemWIDCmd. This routine will +** load up to #MM_MAX_UNINTERRUPTIBLE_DATA bytes into ** ram with interrupts disabled during the actual load ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] CmdPtr A #MM_LoadMemWIDCmd_t pointer to the +** +** \param [in] CmdPtr A #MM_LoadMemWIDCmd_t pointer to the ** command message ** -** \param [in] DestAddress The destination address for the load +** \param [in] DestAddress The destination address for the load ** operation ** *************************************************************************/ -boolean MM_LoadMemWID(MM_LoadMemWIDCmd_t *CmdPtr, - uint32 DestAddress); - -/************************************************************************/ -/** \brief Verify load memory with interrupts disabled parameters -** -** \par Description -** This routine will run various checks on the destination address -** and data size (in bytes) for a load memory with interrupts -** disabled command. -** -** \par Assumptions, External Events, and Notes: -** This command is only valid for ram addresses so no -** memory type checks are performed -** -** \param [in] Address The destination address for the requested -** load operation -** -** \param [in] SizeInBytes The number of bytes for the requested -** load operation -** -** \returns -** \retstmt Returns TRUE if all the parameter checks passed \endcode -** \retstmt Returns FALSE any parameter check failed \endcode -** \endreturns -** -*************************************************************************/ -boolean MM_VerifyLoadWIDParams(uint32 Address, - uint32 SizeInBytes); +bool MM_LoadMemWID(const MM_LoadMemWIDCmd_t *CmdPtr, cpuaddr DestAddress); /************************************************************************/ /** \brief Memory load from file -** +** ** \par Description -** Support function for #MM_LoadMemFromFileCmd. This routine will +** Support function for #MM_LoadMemFromFileCmd. This routine will ** read a file and write the data to memory ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] FileHandle The open file handle of the load file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the load file +** +** \param [in] FileName A pointer to a character string holding ** the load file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the load file header structure ** -** \param [in] DestAddress The destination address for the requested -** load operation -** +** \param [in] DestAddress The destination address for the requested +** load operation +** ** \returns ** \retstmt Returns TRUE if the load completed successfully \endcode ** \retstmt Returns FALSE if the load failed due to an error \endcode ** \endreturns -** -*************************************************************************/ -boolean MM_LoadMemFromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress); - -/************************************************************************/ -/** \brief Verify load memory from file parameters -** -** \par Description -** This routine will run various checks on the destination address, -** memory type, and data size (in bytes) for a load memory from -** file command -** -** \par Assumptions, External Events, and Notes: -** None -** -** \param [in] Address The destination address for the requested -** load operation -** -** \param [in] MemType The destination memory type for the requested -** load operation -** -** \param [in] SizeInBytes The number of bytes for the requested -** load operation -** -** \returns -** \retstmt Returns TRUE if all the parameter checks passed \endcode -** \retstmt Returns FALSE any parameter check failed \endcode -** \endreturns ** *************************************************************************/ -boolean MM_VerifyFileLoadParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes); +bool MM_LoadMemFromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress); /************************************************************************/ /** \brief Verify load file size -** +** ** \par Description -** Support function for #MM_LoadMemFromFileCmd. This routine will +** Support function for #MM_LoadMemFromFileCmd. This routine will ** check if the size of a load file as reported by the filesystem -** is what it should be based upon the number of load bytes +** is what it should be based upon the number of load bytes ** specified in the MM file header. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] FileName A pointer to a character string holding +** +** \param [in] FileName A pointer to a character string holding ** the load file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the load file header structure ** ** \returns ** \retstmt Returns TRUE if the load file size is as expected \endcode ** \retstmt Returns FALSE if the load file size is not as expected \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_VerifyLoadFileSize(char *FileName, - MM_LoadDumpFileHeader_t *FileHeader); +bool MM_VerifyLoadFileSize(const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader); /************************************************************************/ /** \brief Read the cFE primary and and MM secondary file headers -** +** ** \par Description -** Support function for #MM_LoadMemFromFileCmd. This routine will +** Support function for #MM_LoadMemFromFileCmd. This routine will ** read the cFE primary and MM secondary headers from the ** file specified by the FileHandle. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] FileName A pointer to a character string holding +** +** \param [in] FileName A pointer to a character string holding ** the file name (used only for error event ** messages). ** @@ -243,150 +162,119 @@ boolean MM_VerifyLoadFileSize(char *FileName, ** call to #OS_open that is associated with ** the file whose headers are to be read. ** -** \param [in] CFEHeader A #CFE_FS_Header_t pointer to +** \param [in] CFEHeader A #CFE_FS_Header_t pointer to ** the cFE primary file header structure. ** -** \param [in] MMHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] MMHeader A #MM_LoadDumpFileHeader_t pointer to ** the MM secondary file header structure ** -** \param [out] *CFEHeader Contents of the cFE primary file header +** \param [out] *CFEHeader Contents of the cFE primary file header ** structure for the specified file. ** -** \param [out] *MMHeader Contents of the MM secondary file header +** \param [out] *MMHeader Contents of the MM secondary file header ** structure for the specified file. ** ** \returns ** \retstmt Returns TRUE if the headers were read successfully \endcode ** \retstmt Returns FALSE if a read error occurred \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_ReadFileHeaders(char *FileName, - int32 FileHandle, - CFE_FS_Header_t *CFEHeader, - MM_LoadDumpFileHeader_t *MMHeader); +bool MM_ReadFileHeaders(const char *FileName, int32 FileHandle, CFE_FS_Header_t *CFEHeader, + MM_LoadDumpFileHeader_t *MMHeader); /************************************************************************/ /** \brief Fill memory -** +** ** \par Description -** Support function for #MM_FillMemCmd. This routine will +** Support function for #MM_FillMemCmd. This routine will ** load memory with a command specified fill pattern ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] DestAddr The destination address for the fill +** +** \param [in] DestAddr The destination address for the fill ** operation ** ** \param [in] CmdPtr A #MM_FillMemCmd_t pointer to the fill ** command message ** *************************************************************************/ -void MM_FillMem (uint32 DestAddr, - MM_FillMemCmd_t *CmdPtr); - -/************************************************************************/ -/** \brief Verify memory fill parameters -** -** \par Description -** This routine will run various checks on the destination address, -** memory type, and data size (in bytes) for a memory fill command -** -** \par Assumptions, External Events, and Notes: -** None -** -** \param [in] Address The destination address for the requested -** fill operation -** -** \param [in] MemType The destination memory type for the -** requested fill operation -** -** \param [in] SizeInBytes The number of bytes to fill -** -** \returns -** \retstmt Returns TRUE if all the parameter checks passed \endcode -** \retstmt Returns FALSE any parameter check failed \endcode -** \endreturns -** -*************************************************************************/ -boolean MM_VerifyFillParams(uint32 Address, - uint8 MemType, - uint32 SizeInBytes); +bool MM_FillMem(cpuaddr DestAddr, const MM_FillMemCmd_t *CmdPtr); /************************************************************************/ /** \brief Process memory poke command -** +** ** \par Description ** Processes the memory poke command that will load a memory ** location with data specified in the command message. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_POKE_CC ** *************************************************************************/ -void MM_PokeCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_PokeCmd(const CFE_SB_Buffer_t *BufPtr); /************************************************************************/ /** \brief Process load memory with interrupts disabled command -** +** ** \par Description ** Processes the load memory with interrupts disabled command -** that will load up to #MM_MAX_UNINTERRUPTABLE_DATA bytes into +** that will load up to #MM_MAX_UNINTERRUPTIBLE_DATA bytes into ** ram with interrupts disabled during the actual load ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_LOAD_MEM_WID_CC ** *************************************************************************/ -void MM_LoadMemWIDCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_LoadMemWIDCmd(const CFE_SB_Buffer_t *BufPtr); /************************************************************************/ /** \brief Process memory load from file command -** +** ** \par Description -** Processes the memory load from file command that will read a -** file and store the data in the command specified address range +** Processes the memory load from file command that will read a +** file and store the data in the command specified address range ** of memory. ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_LOAD_MEM_FROM_FILE_CC ** *************************************************************************/ -void MM_LoadMemFromFileCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_LoadMemFromFileCmd(const CFE_SB_Buffer_t *BufPtr); /************************************************************************/ /** \brief Process memory fill command -** +** ** \par Description ** Processes the memory fill command that will load an address -** range of memory with the command specified fill pattern +** range of memory with the command specified fill pattern ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] MessagePtr A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] BufPtr A #CFE_SB_Buffer_t* pointer that +** references the software bus message ** ** \sa #MM_FILL_MEM_CC ** *************************************************************************/ -void MM_FillMemCmd(CFE_SB_MsgPtr_t MessagePtr); +bool MM_FillMemCmd(const CFE_SB_Buffer_t *BufPtr); #endif /* _mm_load_ */ diff --git a/fsw/src/mm_mem16.c b/fsw/src/mm_mem16.c index ef7fa77..dc9b901 100644 --- a/fsw/src/mm_mem16.c +++ b/fsw/src/mm_mem16.c @@ -1,53 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_mem16.c 1.2 2016/10/30 00:48:51EDT mdeschu Exp $ +** File: mm_mem16.c ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright � 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Provides CFS Memory Manager functions that are used ** for the conditionally compiled MM_MEM16 optional memory type. ** -** $Log: mm_mem16.c $ -** Revision 1.2 2016/10/30 00:48:51EDT mdeschu -** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent -** Revision 1.1 2015/07/28 12:21:49EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.15 2015/04/14 15:29:04EDT lwalling -** Removed unnecessary backslash characters from string format definitions -** Revision 1.14 2015/04/06 15:41:25EDT lwalling -** Verify results of calls to PSP memory read/write/copy/set functions -** Revision 1.13 2015/04/02 09:10:56EDT lwalling -** Added Valid = TRUE for MM_LoadMem8/16/32FromFile() -** Revision 1.12 2015/04/01 11:41:15EDT lwalling -** Add ptr type to ioBuffer name, fix code indentation, change if (=) to if (==) -** Revision 1.11 2015/03/30 17:34:01EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.10 2015/03/20 14:16:12EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.9 2015/03/02 14:27:09EST sstrege -** Added copyright information -** Revision 1.8 2011/12/05 15:17:21EST jmdagost -** Added check for zero bytes read from file load (with event message on error) -** Revision 1.7 2011/06/23 12:02:39EDT jmdagost -** Corrected type for local BytesRead, initialized local variables. -** Revision 1.6 2010/11/29 13:35:23EST jmdagost -** Replaced ifdef tests with if-true tests. -** Revision 1.5 2009/06/12 14:37:27EDT rmcgraw -** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem -** Revision 1.4 2008/09/05 14:23:52EDT dahardison -** Updated references to local HK variables -** Revision 1.3 2008/05/19 15:23:20EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ /************************************************************************* @@ -63,269 +29,268 @@ ** The code in this file is optional. ** See mm_platform_cfg.h to set this compiler switch. */ -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) +#ifdef MM_OPT_CODE_MEM16_MEMTYPE /************************************************************************* ** External Data *************************************************************************/ extern MM_AppData_t MM_AppData; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Load memory from a file using only 16 bit wide writes */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_LoadMem16FromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_LoadMem16FromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress) { - uint32 i = 0; - int32 ReadLength = 0; - int32 PSP_Status = CFE_PSP_SUCCESS; - int32 BytesProcessed = 0; - int32 BytesRemaining = FileHeader->NumOfBytes; - uint16 *DataPointer16 = (uint16 *) DestAddress; - uint16 *ioBuffer16 = (uint16 *) &MM_AppData.LoadBuffer[0]; - uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - boolean Valid = FALSE; + uint32 i = 0; + int32 ReadLength = 0; + int32 PSP_Status = CFE_PSP_SUCCESS; + int32 BytesProcessed = 0; + int32 BytesRemaining = FileHeader->NumOfBytes; + uint16 *DataPointer16 = (uint16 *)DestAddress; + uint16 *ioBuffer16 = (uint16 *)&MM_AppData.LoadBuffer[0]; + uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; + bool Valid = false; - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - /* Read file data into i/o buffer */ - if ((ReadLength = OS_read(FileHandle, ioBuffer16, SegmentSize)) != SegmentSize) - { - MM_AppData.ErrCounter++; - BytesRemaining = 0; - CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)ReadLength, (int)SegmentSize, FileName); - } - else - { - /* Load memory from i/o buffer using 16 bit wide writes */ - for (i = 0; i < (SegmentSize / sizeof(uint16)); i++) - { - PSP_Status = CFE_PSP_MemWrite16((uint32) DataPointer16, ioBuffer16[i]); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataPointer16++; - } - else + /* Read file data into i/o buffer */ + if ((ReadLength = OS_read(FileHandle, ioBuffer16, SegmentSize)) != SegmentSize) + { + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", (unsigned int)ReadLength, + (int)SegmentSize, FileName); + } + else + { + /* Load memory from i/o buffer using 16 bit wide writes */ + for (i = 0; i < (SegmentSize / sizeof(uint16)); i++) { - /* CFE_PSP_MemWrite16 error */ - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - (unsigned int)PSP_Status, (unsigned int)DataPointer16); - /* Stop load segment loop */ - break; + PSP_Status = CFE_PSP_MemWrite16((cpuaddr)DataPointer16, ioBuffer16[i]); + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataPointer16++; + } + else + { + /* CFE_PSP_MemWrite16 error */ + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP write memory error: RC=0x%08X, Address=%p, MemType=MEM16", + (unsigned int)PSP_Status, (void *)DataPointer16); + /* Stop load segment loop */ + break; + } } - } - if (PSP_Status == CFE_PSP_SUCCESS) - { - BytesProcessed += SegmentSize; - BytesRemaining -= SegmentSize; - - /* Prevent CPU hogging between load segments */ - if (BytesRemaining != 0) + if (PSP_Status == CFE_PSP_SUCCESS) { - MM_SegmentBreak(); + BytesProcessed += SegmentSize; + BytesRemaining -= SegmentSize; + + /* Prevent CPU hogging between load segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } } - } - } - } - - /* Update last action statistics */ - if (BytesProcessed == FileHeader->NumOfBytes) - { - Valid = TRUE; - MM_AppData.LastAction = MM_LOAD_FROM_FILE; - MM_AppData.MemType = MM_MEM16; - MM_AppData.Address = DestAddress; - MM_AppData.BytesProcessed = BytesProcessed; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - } + } + } - return(Valid); - -} /* end MM_LoadMem16FromFile */ + /* Update last action statistics */ + if (BytesProcessed == FileHeader->NumOfBytes) + { + Valid = true; + MM_AppData.HkPacket.LastAction = MM_LOAD_FROM_FILE; + MM_AppData.HkPacket.MemType = MM_MEM16; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + } + + return (Valid); +} /* end MM_LoadMem16FromFile */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Dump the requested number of bytes from memory to a file using */ /* only 16 bit wide reads */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_DumpMem16ToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_DumpMem16ToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader) { - boolean Valid = TRUE; - int32 OS_Status = OS_ERROR; - int32 PSP_Status = CFE_PSP_SUCCESS; - uint32 i = 0; - uint32 BytesProcessed = 0; - uint32 BytesRemaining = FileHeader->NumOfBytes; - uint16 *DataPointer16 = (uint16 *) FileHeader->SymAddress.Offset; - uint16 *ioBuffer16 = (uint16 *) &MM_AppData.DumpBuffer[0]; - uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + bool Valid = true; + int32 OS_Status = OS_ERROR; + int32 PSP_Status = CFE_PSP_SUCCESS; + uint32 i = 0; + uint32 BytesProcessed = 0; + uint32 BytesRemaining = FileHeader->NumOfBytes; + uint16 *DataPointer16 = (uint16 *)(FileHeader->SymAddress.Offset); + uint16 *ioBuffer16 = (uint16 *)&MM_AppData.DumpBuffer[0]; + uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - /* Load RAM data into i/o buffer */ - for (i = 0; i < SegmentSize; i++) - { - if ((PSP_Status = CFE_PSP_MemRead16((uint32) DataPointer16, &ioBuffer16[i])) == CFE_PSP_SUCCESS) - { - DataPointer16++; - } - else - { - /* CFE_PSP_MemRead16 error */ - Valid = FALSE; - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM16", - (unsigned int)PSP_Status, (unsigned int)DataPointer16, (unsigned int)&ioBuffer16[i]); - /* Stop load i/o buffer loop */ - break; - } - } + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - /* Check for error loading i/o buffer */ - if (PSP_Status == CFE_PSP_SUCCESS) - { - /* Write i/o buffer contents to file */ - if ((OS_Status = OS_write(FileHandle, ioBuffer16, SegmentSize)) == SegmentSize) - { - /* Update process counters */ - BytesRemaining -= SegmentSize; - BytesProcessed += SegmentSize; + /* Load RAM data into i/o buffer */ + for (i = 0; i < (SegmentSize / sizeof(uint16)); i++) + { + if ((PSP_Status = CFE_PSP_MemRead16((cpuaddr)DataPointer16, &ioBuffer16[i])) == CFE_PSP_SUCCESS) + { + DataPointer16++; + } + else + { + /* CFE_PSP_MemRead16 error */ + Valid = false; + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP read memory error: RC=0x%08X, Src=%p, Tgt=%p, Type=MEM16", + (unsigned int)PSP_Status, (void *)DataPointer16, (void *)&ioBuffer16[i]); + /* Stop load i/o buffer loop */ + break; + } + } - /* Prevent CPU hogging between dump segments */ - if (BytesRemaining != 0) + /* Check for error loading i/o buffer */ + if (PSP_Status == CFE_PSP_SUCCESS) + { + /* Write i/o buffer contents to file */ + if ((OS_Status = OS_write(FileHandle, ioBuffer16, SegmentSize)) == SegmentSize) { - MM_SegmentBreak(); + /* Update process counters */ + BytesRemaining -= SegmentSize; + BytesProcessed += SegmentSize; + + /* Prevent CPU hogging between dump segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } } - } - else - { - /* OS_write error */ - Valid = FALSE; - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)OS_Status, (int)SegmentSize, FileName); - } - } - } + else + { + /* OS_write error */ + Valid = false; + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", + (unsigned int)OS_Status, (int)SegmentSize, FileName); + } + } + } - if (Valid) - { - /* Update last action statistics */ - MM_AppData.LastAction = MM_DUMP_TO_FILE; - MM_AppData.MemType = MM_MEM16; - MM_AppData.Address = FileHeader->SymAddress.Offset; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - MM_AppData.BytesProcessed = BytesProcessed; - } + if (Valid) + { + /* Update last action statistics */ + MM_AppData.HkPacket.LastAction = MM_DUMP_TO_FILE; + MM_AppData.HkPacket.MemType = MM_MEM16; + MM_AppData.HkPacket.Address = FileHeader->SymAddress.Offset; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + } - return(Valid); + return (Valid); } /* end MM_DumpMem16ToFile */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Fill memory with the command specified fill pattern using only */ /* 16 bit wide writes */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_FillMem16(uint32 DestAddress, - MM_FillMemCmd_t *CmdPtr) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_FillMem16(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr) { - uint32 i = 0; - int32 PSP_Status = CFE_PSP_SUCCESS; - uint32 BytesProcessed = 0; - uint32 BytesRemaining = CmdPtr->NumOfBytes; - uint16 FillPattern16 = (uint16) CmdPtr->FillPattern; - uint16 *DataPointer16 = (uint16 *) DestAddress; - uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; + uint32 i = 0; + int32 PSP_Status = CFE_PSP_SUCCESS; + uint32 BytesProcessed = 0; + uint32 BytesRemaining = CmdPtr->NumOfBytes; + uint32 NewBytesRemaining = 0; + uint16 FillPattern16 = (uint16)CmdPtr->FillPattern; + uint16 *DataPointer16 = (uint16 *)DestAddress; + uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; + bool Result = true; - while (BytesRemaining != 0) - { - /* Set size of next segment */ - if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + /* Check fill size and warn if not a multiple of 2 */ + if ((BytesRemaining % 2) != 0) + { + NewBytesRemaining = BytesRemaining - (BytesRemaining % 2); + CFE_EVS_SendEvent(MM_FILL_MEM16_ALIGN_WARN_INF_EID, CFE_EVS_EventType_INFORMATION, + "MM_FillMem16 NumOfBytes not multiple of 2. Reducing from %d to %d.", BytesRemaining, + NewBytesRemaining); + BytesRemaining = NewBytesRemaining; + } - /* Fill next segment */ - for (i = 0; i < (SegmentSize / sizeof(uint16)); i++) - { - PSP_Status = CFE_PSP_MemWrite16((uint32) DataPointer16, FillPattern16); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataPointer16++; - } - else - { - /* CFE_PSP_MemWrite16 error */ - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - (unsigned int)PSP_Status, (unsigned int)DataPointer16); - /* Stop fill segment loop */ - break; - } - } + while (BytesRemaining != 0) + { + /* Set size of next segment */ + if (BytesRemaining < MM_MAX_FILL_DATA_SEG) + { + SegmentSize = BytesRemaining; + } + + /* Fill next segment */ + for (i = 0; i < (SegmentSize / sizeof(uint16)); i++) + { + PSP_Status = CFE_PSP_MemWrite16((cpuaddr)DataPointer16, FillPattern16); + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataPointer16++; + } + else + { + /* CFE_PSP_MemWrite16 error */ + Result = false; + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP write memory error: RC=0x%08X, Address=%p, MemType=MEM16", + (unsigned int)PSP_Status, (void *)DataPointer16); + /* Stop fill segment loop */ + break; + } + } - if (PSP_Status == CFE_PSP_SUCCESS) - { - /* Update process counters */ - BytesRemaining -= SegmentSize; - BytesProcessed += SegmentSize; + if (PSP_Status == CFE_PSP_SUCCESS) + { + /* Update process counters */ + BytesRemaining -= SegmentSize; + BytesProcessed += SegmentSize; - /* Prevent CPU hogging between fill segments */ - if (BytesRemaining != 0) - { - MM_SegmentBreak(); - } - } - } + /* Prevent CPU hogging between fill segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } + } + } - /* Update last action statistics */ - if (BytesProcessed == CmdPtr->NumOfBytes) - { - MM_AppData.LastAction = MM_FILL; - MM_AppData.MemType = MM_MEM16; - MM_AppData.Address = DestAddress; - MM_AppData.DataValue = (uint32) FillPattern16; - MM_AppData.BytesProcessed = BytesProcessed; - } + /* Update last action statistics */ + if (BytesProcessed == CmdPtr->NumOfBytes) + { + MM_AppData.HkPacket.LastAction = MM_FILL; + MM_AppData.HkPacket.MemType = MM_MEM16; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.DataValue = (uint32)FillPattern16; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + } - return; - -}/* End MM_FillMem16 */ + return Result; +} /* End MM_FillMem16 */ #endif /* MM_OPT_CODE_MEM16_MEMTYPE */ diff --git a/fsw/src/mm_mem16.h b/fsw/src/mm_mem16.h index 8a59bfa..1a082c8 100644 --- a/fsw/src/mm_mem16.h +++ b/fsw/src/mm_mem16.h @@ -1,37 +1,21 @@ /************************************************************************* -** File: -** $Id: mm_mem16.h 1.1 2015/07/28 12:21:51EDT rperera Exp $ +** File: mm_mem16.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager functions that are used ** for the conditionally compiled MM_MEM16 optional memory type. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_mem16.h $ -** Revision 1.1 2015/07/28 12:21:51EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.4 2015/03/02 14:27:06EST sstrege -** Added copyright information -** Revision 1.3 2008/05/19 15:23:22EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ + #ifndef _mm_mem16_ #define _mm_mem16_ @@ -45,91 +29,86 @@ *************************************************************************/ /************************************************************************/ /** \brief Memory16 load from file -** +** ** \par Description -** Support function for #MM_LoadMemFromFileCmd. This routine will +** Support function for #MM_LoadMemFromFileCmd. This routine will ** read a file and write the data to memory that is defined to ** only be 16 bit accessible ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM16 memory ** type -** -** \param [in] FileHandle The open file handle of the load file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the load file +** +** \param [in] FileName A pointer to a character string holding ** the load file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the load file header structure ** -** \param [in] DestAddress The destination address for the requested -** load operation -** +** \param [in] DestAddress The destination address for the requested +** load operation +** ** \returns ** \retstmt Returns TRUE if the load completed successfully \endcode ** \retstmt Returns FALSE if the load failed due to an error \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_LoadMem16FromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress); +bool MM_LoadMem16FromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress); /************************************************************************/ /** \brief Memory16 dump to file -** +** ** \par Description -** Support function for #MM_DumpMemToFileCmd. This routine will +** Support function for #MM_DumpMemToFileCmd. This routine will ** read an address range that is defined to only be 16 bit ** accessible and store the data in a file ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM16 memory ** type -** -** \param [in] FileHandle The open file handle of the dump file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the dump file +** +** \param [in] FileName A pointer to a character string holding ** the dump file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the dump file header structure initialized -** with data based upon the command message +** with data based upon the command message ** parameters ** ** \returns ** \retstmt Returns TRUE if the dump completed successfully \endcode ** \retstmt Returns FALSE if the dump failed due to an error \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_DumpMem16ToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader); +bool MM_DumpMem16ToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader); /************************************************************************/ /** \brief Fill memory16 -** +** ** \par Description -** Support function for #MM_FillMemCmd. This routine will +** Support function for #MM_FillMemCmd. This routine will ** load memory that is defined to only be 16 bit accessible ** with a command specified fill pattern ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM16 memory ** type -** -** \param [in] DestAddress The destination address for the fill +** +** \param [in] DestAddress The destination address for the fill ** operation ** ** \param [in] CmdPtr A #MM_FillMemCmd_t pointer to the fill ** command message ** *************************************************************************/ -void MM_FillMem16(uint32 DestAddress, - MM_FillMemCmd_t *CmdPtr); +bool MM_FillMem16(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr); #endif /* _mm_mem16_ */ diff --git a/fsw/src/mm_mem32.c b/fsw/src/mm_mem32.c index 8b081ac..94e3c23 100644 --- a/fsw/src/mm_mem32.c +++ b/fsw/src/mm_mem32.c @@ -1,55 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_mem32.c 1.2 2016/10/30 00:48:50EDT mdeschu Exp $ +** File: mm_mem32.c ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright � 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Provides CFS Memory Manager functions that are used ** for the conditionally compiled MM_MEM32 optional memory type. ** -** $Log: mm_mem32.c $ -** Revision 1.2 2016/10/30 00:48:50EDT mdeschu -** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent -** Revision 1.1 2015/07/28 12:21:53EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.16 2015/04/14 15:29:02EDT lwalling -** Removed unnecessary backslash characters from string format definitions -** Revision 1.15 2015/04/06 15:41:24EDT lwalling -** Verify results of calls to PSP memory read/write/copy/set functions -** Revision 1.14 2015/04/02 09:10:56EDT lwalling -** Added Valid = TRUE for MM_LoadMem8/16/32FromFile() -** Revision 1.13 2015/04/01 13:52:29EDT lwalling -** change if (=) to if (==) -** Revision 1.12 2015/04/01 11:41:15EDT lwalling -** Add ptr type to ioBuffer name, fix code indentation, change if (=) to if (==) -** Revision 1.11 2015/03/30 17:33:59EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.10 2015/03/20 14:16:52EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.9 2015/03/02 14:26:34EST sstrege -** Added copyright information -** Revision 1.8 2011/12/05 15:17:21EST jmdagost -** Added check for zero bytes read from file load (with event message on error) -** Revision 1.7 2011/06/23 12:02:38EDT jmdagost -** Corrected type for local BytesRead, initialized local variables. -** Revision 1.6 2010/11/29 13:35:22EST jmdagost -** Replaced ifdef tests with if-true tests. -** Revision 1.5 2009/06/12 14:37:31EDT rmcgraw -** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem -** Revision 1.4 2008/09/05 14:24:17EDT dahardison -** Updated references to local HK variables -** Revision 1.3 2008/05/19 15:23:24EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ /************************************************************************* @@ -65,270 +29,269 @@ ** The code in this file is optional. ** See mm_platform_cfg.h to set this compiler switch. */ -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) +#ifdef MM_OPT_CODE_MEM32_MEMTYPE /************************************************************************* ** External Data *************************************************************************/ -extern MM_AppData_t MM_AppData; - +extern MM_AppData_t MM_AppData; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Load memory from a file using only 32 bit wide writes */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_LoadMem32FromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_LoadMem32FromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress) { - uint32 i = 0; - int32 ReadLength = 0; - int32 PSP_Status = CFE_PSP_SUCCESS; - int32 BytesProcessed = 0; - int32 BytesRemaining = FileHeader->NumOfBytes; - uint32 *DataPointer32 = (uint32 *) DestAddress; - uint32 *ioBuffer32 = (uint32 *) &MM_AppData.LoadBuffer[0]; - uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - boolean Valid = FALSE; + uint32 i = 0; + int32 ReadLength = 0; + int32 PSP_Status = CFE_PSP_SUCCESS; + int32 BytesProcessed = 0; + int32 BytesRemaining = FileHeader->NumOfBytes; + uint32 *DataPointer32 = (uint32 *)DestAddress; + uint32 *ioBuffer32 = (uint32 *)&MM_AppData.LoadBuffer[0]; + uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; + bool Valid = false; - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - /* Read file data into i/o buffer */ - if ((ReadLength = OS_read(FileHandle, ioBuffer32, SegmentSize)) != SegmentSize) - { - MM_AppData.ErrCounter++; - BytesRemaining = 0; - CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)ReadLength, (int)SegmentSize, FileName); - } - else - { - /* Load memory from i/o buffer using 32 bit wide writes */ - for (i = 0; i < (SegmentSize / sizeof(uint32)); i++) - { - PSP_Status = CFE_PSP_MemWrite32((uint32) DataPointer32, ioBuffer32[i]); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataPointer32++; - } - else + /* Read file data into i/o buffer */ + if ((ReadLength = OS_read(FileHandle, ioBuffer32, SegmentSize)) != SegmentSize) + { + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", (unsigned int)ReadLength, + (int)SegmentSize, FileName); + } + else + { + /* Load memory from i/o buffer using 32 bit wide writes */ + for (i = 0; i < (SegmentSize / sizeof(uint32)); i++) { - /* CFE_PSP_MemWrite32 error */ - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - (unsigned int)PSP_Status, (unsigned int)DataPointer32); - /* Stop load segment loop */ - break; + PSP_Status = CFE_PSP_MemWrite32((cpuaddr)DataPointer32, ioBuffer32[i]); + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataPointer32++; + } + else + { + /* CFE_PSP_MemWrite32 error */ + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP write memory error: RC=%d, Address=%p, MemType=MEM32", PSP_Status, + (void *)DataPointer32); + /* Stop load segment loop */ + break; + } } - } - if (PSP_Status == CFE_PSP_SUCCESS) - { - BytesProcessed += SegmentSize; - BytesRemaining -= SegmentSize; - - /* Prevent CPU hogging between load segments */ - if (BytesRemaining != 0) + if (PSP_Status == CFE_PSP_SUCCESS) { - MM_SegmentBreak(); + BytesProcessed += SegmentSize; + BytesRemaining -= SegmentSize; + + /* Prevent CPU hogging between load segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } } - } - } - } - - /* Update last action statistics */ - if (BytesProcessed == FileHeader->NumOfBytes) - { - Valid = TRUE; - MM_AppData.LastAction = MM_LOAD_FROM_FILE; - MM_AppData.MemType = MM_MEM32; - MM_AppData.Address = DestAddress; - MM_AppData.BytesProcessed = BytesProcessed; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - } + } + } - return(Valid); - -} /* end MM_LoadMem32FromFile */ + /* Update last action statistics */ + if (BytesProcessed == FileHeader->NumOfBytes) + { + Valid = true; + MM_AppData.HkPacket.LastAction = MM_LOAD_FROM_FILE; + MM_AppData.HkPacket.MemType = MM_MEM32; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + } + + return (Valid); +} /* end MM_LoadMem32FromFile */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Dump the requested number of bytes from memory to a file using */ /* only 32 bit wide reads */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_DumpMem32ToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_DumpMem32ToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader) { - boolean Valid = TRUE; - int32 OS_Status = OS_ERROR; - int32 PSP_Status = CFE_PSP_SUCCESS; - uint32 i = 0; - uint32 BytesProcessed = 0; - uint32 BytesRemaining = FileHeader->NumOfBytes; - uint32 *DataPointer32 = (uint32 *) FileHeader->SymAddress.Offset; - uint32 *ioBuffer32 = (uint32 *) &MM_AppData.DumpBuffer[0]; - uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + bool Valid = true; + int32 OS_Status = OS_ERROR; + int32 PSP_Status = CFE_PSP_SUCCESS; + uint32 i = 0; + uint32 BytesProcessed = 0; + uint32 BytesRemaining = FileHeader->NumOfBytes; + uint32 *DataPointer32 = (uint32 *)(FileHeader->SymAddress.Offset); + uint32 *ioBuffer32 = (uint32 *)&MM_AppData.DumpBuffer[0]; + uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - /* Load RAM data into i/o buffer */ - for (i = 0; i < SegmentSize; i++) - { - PSP_Status = CFE_PSP_MemRead32((uint32) DataPointer32, &ioBuffer32[i]); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataPointer32++; - } - else - { - /* CFE_PSP_MemRead32 error */ - Valid = FALSE; - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM32", - (unsigned int)PSP_Status, (unsigned int)DataPointer32, (unsigned int)&ioBuffer32[i]); - /* Stop load i/o buffer loop */ - break; - } - } + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - /* Check for error loading i/o buffer */ - if (PSP_Status == CFE_PSP_SUCCESS) - { - /* Write i/o buffer contents to file */ - if ((OS_Status = OS_write(FileHandle, ioBuffer32, SegmentSize)) == SegmentSize) - { - /* Update process counters */ - BytesRemaining -= SegmentSize; - BytesProcessed += SegmentSize; + /* Load RAM data into i/o buffer */ + for (i = 0; i < (SegmentSize / sizeof(uint32)); i++) + { + PSP_Status = CFE_PSP_MemRead32((cpuaddr)DataPointer32, &ioBuffer32[i]); + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataPointer32++; + } + else + { + /* CFE_PSP_MemRead32 error */ + Valid = false; + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP read memory error: RC=0x%08X, Src=%p, Tgt=%p, Type=MEM32", + (unsigned int)PSP_Status, (void *)DataPointer32, (void *)&ioBuffer32[i]); + /* Stop load i/o buffer loop */ + break; + } + } - /* Prevent CPU hogging between dump segments */ - if (BytesRemaining != 0) + /* Check for error loading i/o buffer */ + if (PSP_Status == CFE_PSP_SUCCESS) + { + /* Write i/o buffer contents to file */ + if ((OS_Status = OS_write(FileHandle, ioBuffer32, SegmentSize)) == SegmentSize) { - MM_SegmentBreak(); + /* Update process counters */ + BytesRemaining -= SegmentSize; + BytesProcessed += SegmentSize; + + /* Prevent CPU hogging between dump segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } } - } - else - { - /* OS_write error */ - Valid = FALSE; - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)OS_Status, (int)SegmentSize, FileName); - } - } - } + else + { + /* OS_write error */ + Valid = false; + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", + (unsigned int)OS_Status, (int)SegmentSize, FileName); + } + } + } - if (Valid) - { - /* Update last action statistics */ - MM_AppData.LastAction = MM_DUMP_TO_FILE; - MM_AppData.MemType = MM_MEM32; - MM_AppData.Address = FileHeader->SymAddress.Offset; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - MM_AppData.BytesProcessed = BytesProcessed; - } + if (Valid) + { + /* Update last action statistics */ + MM_AppData.HkPacket.LastAction = MM_DUMP_TO_FILE; + MM_AppData.HkPacket.MemType = MM_MEM32; + MM_AppData.HkPacket.Address = FileHeader->SymAddress.Offset; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + } - return(Valid); + return (Valid); } /* end MM_DumpMem32ToFile */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Fill memory with the command specified fill pattern using only */ /* 32 bit wide writes */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_FillMem32(uint32 DestAddress, - MM_FillMemCmd_t *CmdPtr) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_FillMem32(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr) { - uint32 i = 0; - int32 PSP_Status = CFE_PSP_SUCCESS; - uint32 BytesProcessed = 0; - uint32 BytesRemaining = CmdPtr->NumOfBytes; - uint32 FillPattern32 = CmdPtr->FillPattern; - uint32 *DataPointer32 = (uint32 *) DestAddress; - uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; + uint32 i = 0; + int32 PSP_Status = CFE_PSP_SUCCESS; + uint32 BytesProcessed = 0; + uint32 BytesRemaining = CmdPtr->NumOfBytes; + uint32 NewBytesRemaining = 0; + uint32 FillPattern32 = CmdPtr->FillPattern; + uint32 *DataPointer32 = (uint32 *)(DestAddress); + uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; + bool Result = true; - while (BytesRemaining != 0) - { - /* Set size of next segment */ - if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + /* Check fill size and warn if not a multiple of 4 */ + if ((BytesRemaining % 4) != 0) + { + NewBytesRemaining = BytesRemaining - (BytesRemaining % 4); + CFE_EVS_SendEvent(MM_FILL_MEM32_ALIGN_WARN_INF_EID, CFE_EVS_EventType_INFORMATION, + "MM_FillMem32 NumOfBytes not multiple of 4. Reducing from %d to %d.", BytesRemaining, + NewBytesRemaining); + BytesRemaining = NewBytesRemaining; + } - /* Fill next segment */ - for (i = 0; i < (SegmentSize / sizeof(uint32)); i++) - { - PSP_Status = CFE_PSP_MemWrite32((uint32) DataPointer32, FillPattern32); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataPointer32++; - } - else - { - /* CFE_PSP_MemWrite32 error */ - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - (unsigned int)PSP_Status, (unsigned int)DataPointer32); - /* Stop fill segment loop */ - break; - } - } + while (BytesRemaining != 0) + { + /* Set size of next segment */ + if (BytesRemaining < MM_MAX_FILL_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - if (PSP_Status == CFE_PSP_SUCCESS) - { - /* Update process counters */ - BytesRemaining -= SegmentSize; - BytesProcessed += SegmentSize; + /* Fill next segment */ + for (i = 0; i < (SegmentSize / sizeof(uint32)); i++) + { + PSP_Status = CFE_PSP_MemWrite32((cpuaddr)DataPointer32, FillPattern32); + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataPointer32++; + } + else + { + /* CFE_PSP_MemWrite32 error */ + BytesRemaining = 0; + Result = false; + CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP write memory error: RC=0x%08X, Address=%p, MemType=MEM32", + (unsigned int)PSP_Status, (void *)DataPointer32); + /* Stop fill segment loop */ + break; + } + } - /* Prevent CPU hogging between fill segments */ - if (BytesRemaining != 0) - { - MM_SegmentBreak(); - } - } - } + if (PSP_Status == CFE_PSP_SUCCESS) + { + /* Update process counters */ + BytesRemaining -= SegmentSize; + BytesProcessed += SegmentSize; + + /* Prevent CPU hogging between fill segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } + } + } - /* Update last action statistics */ - if (BytesProcessed == CmdPtr->NumOfBytes) - { - MM_AppData.LastAction = MM_FILL; - MM_AppData.MemType = MM_MEM32; - MM_AppData.Address = DestAddress; - MM_AppData.DataValue = FillPattern32; - MM_AppData.BytesProcessed = BytesProcessed; - } + /* Update last action statistics */ + if (BytesProcessed == CmdPtr->NumOfBytes) + { + MM_AppData.HkPacket.LastAction = MM_FILL; + MM_AppData.HkPacket.MemType = MM_MEM32; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.DataValue = FillPattern32; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + } - return; - -}/* End MM_FillMem32 */ + return Result; +} /* End MM_FillMem32 */ #endif /* MM_OPT_CODE_MEM32_MEMTYPE */ diff --git a/fsw/src/mm_mem32.h b/fsw/src/mm_mem32.h index 8485f90..d22bc6a 100644 --- a/fsw/src/mm_mem32.h +++ b/fsw/src/mm_mem32.h @@ -1,36 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_mem32.h 1.1 2015/07/28 12:21:55EDT rperera Exp $ +** File: mm_mem32.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager functions that are used ** for the conditionally compiled MM_MEM32 optional memory type. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_mem32.h $ -** Revision 1.1 2015/07/28 12:21:55EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.4 2015/03/02 14:26:31EST sstrege -** Added copyright information -** Revision 1.3 2008/05/19 15:23:26EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_mem32_ #define _mm_mem32_ @@ -45,91 +28,86 @@ *************************************************************************/ /************************************************************************/ /** \brief Memory32 load from file -** +** ** \par Description -** Support function for #MM_LoadMemFromFileCmd. This routine will +** Support function for #MM_LoadMemFromFileCmd. This routine will ** read a file and write the data to memory that is defined to ** only be 32 bit accessible ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM32 memory ** type -** -** \param [in] FileHandle The open file handle of the load file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the load file +** +** \param [in] FileName A pointer to a character string holding ** the load file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the load file header structure ** -** \param [in] DestAddress The destination address for the requested -** load operation -** +** \param [in] DestAddress The destination address for the requested +** load operation +** ** \returns ** \retstmt Returns TRUE if the load completed successfully \endcode ** \retstmt Returns FALSE if the load failed due to an error \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_LoadMem32FromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress); +bool MM_LoadMem32FromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress); /************************************************************************/ /** \brief Memory32 dump to file -** +** ** \par Description -** Support function for #MM_DumpMemToFileCmd. This routine will +** Support function for #MM_DumpMemToFileCmd. This routine will ** read an address range that is defined to only be 32 bit ** accessible and store the data in a file ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM32 memory ** type -** -** \param [in] FileHandle The open file handle of the dump file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the dump file +** +** \param [in] FileName A pointer to a character string holding ** the dump file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the dump file header structure initialized -** with data based upon the command message +** with data based upon the command message ** parameters ** ** \returns ** \retstmt Returns TRUE if the dump completed successfully \endcode ** \retstmt Returns FALSE if the dump failed due to an error \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_DumpMem32ToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader); +bool MM_DumpMem32ToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader); /************************************************************************/ /** \brief Fill memory32 -** +** ** \par Description -** Support function for #MM_FillMemCmd. This routine will +** Support function for #MM_FillMemCmd. This routine will ** load memory that is defined to only be 32 bit accessible ** with a command specified fill pattern ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM32 memory ** type -** -** \param [in] DestAddress The destination address for the fill +** +** \param [in] DestAddress The destination address for the fill ** operation ** ** \param [in] CmdPtr A #MM_FillMemCmd_t pointer to the fill ** command message ** *************************************************************************/ -void MM_FillMem32(uint32 DestAddress, - MM_FillMemCmd_t *CmdPtr); +bool MM_FillMem32(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr); #endif /* _mm_mem32_ */ diff --git a/fsw/src/mm_mem8.c b/fsw/src/mm_mem8.c index de52c52..b0c52bd 100644 --- a/fsw/src/mm_mem8.c +++ b/fsw/src/mm_mem8.c @@ -1,53 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_mem8.c 1.2 2016/10/30 00:48:50EDT mdeschu Exp $ +** File: mm_mem8.c ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Provides CFS Memory Manager functions that are used ** for the conditionally compiled MM_MEM8 optional memory type. ** -** $Log: mm_mem8.c $ -** Revision 1.2 2016/10/30 00:48:50EDT mdeschu -** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent -** Revision 1.1 2015/07/28 12:21:57EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.15 2015/04/14 15:29:01EDT lwalling -** Removed unnecessary backslash characters from string format definitions -** Revision 1.14 2015/04/06 15:41:23EDT lwalling -** Verify results of calls to PSP memory read/write/copy/set functions -** Revision 1.13 2015/04/02 09:10:45EDT lwalling -** Added Valid = TRUE for MM_LoadMem8/16/32FromFile() -** Revision 1.12 2015/04/01 11:41:14EDT lwalling -** Add ptr type to ioBuffer name, fix code indentation, change if (=) to if (==) -** Revision 1.11 2015/03/30 17:33:59EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.10 2015/03/20 14:16:24EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.9 2015/03/02 14:26:29EST sstrege -** Added copyright information -** Revision 1.8 2011/12/05 15:17:20EST jmdagost -** Added check for zero bytes read from file load (with event message on error) -** Revision 1.7 2011/06/23 12:02:37EDT jmdagost -** Corrected type for local BytesRead, initialized local variables. -** Revision 1.6 2010/11/29 13:35:21EST jmdagost -** Replaced ifdef tests with if-true tests. -** Revision 1.5 2009/06/12 14:37:28EDT rmcgraw -** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem -** Revision 1.4 2008/09/05 14:24:02EDT dahardison -** Updated references to local HK variables -** Revision 1.3 2008/05/19 15:23:28EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ /************************************************************************* @@ -63,268 +29,257 @@ ** The code in this file is optional. ** See mm_platform_cfg.h to set this compiler switch. */ -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) +#ifdef MM_OPT_CODE_MEM8_MEMTYPE /************************************************************************* ** External Data *************************************************************************/ -extern MM_AppData_t MM_AppData; +extern MM_AppData_t MM_AppData; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Load memory from a file using only 8 bit wide writes */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_LoadMem8FromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_LoadMem8FromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress) { - uint32 i = 0; - int32 ReadLength = 0; - int32 PSP_Status = CFE_PSP_SUCCESS; - int32 BytesProcessed = 0; - int32 BytesRemaining = FileHeader->NumOfBytes; - uint8 *DataPointer8 = (uint8 *) DestAddress; - uint8 *ioBuffer8 = (uint8 *) &MM_AppData.LoadBuffer[0]; - uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - boolean Valid = FALSE; + uint32 i = 0; + int32 ReadLength = 0; + int32 PSP_Status = CFE_PSP_SUCCESS; + int32 BytesProcessed = 0; + int32 BytesRemaining = FileHeader->NumOfBytes; + uint8 *DataPointer8 = (uint8 *)DestAddress; + uint8 *ioBuffer8 = (uint8 *)&MM_AppData.LoadBuffer[0]; + uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; + bool Valid = false; - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - /* Read file data into i/o buffer */ - if ((ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize) - { - MM_AppData.ErrCounter++; - BytesRemaining = 0; - CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)ReadLength, (int)SegmentSize, FileName); - } - else - { - /* Load memory from i/o buffer using 8 bit wide writes */ - for (i = 0; i < SegmentSize; i++) - { - PSP_Status = CFE_PSP_MemWrite8((uint32) DataPointer8, ioBuffer8[i]); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataPointer8++; - } - else + /* Read file data into i/o buffer */ + if ((ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize) + { + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", (unsigned int)ReadLength, + (int)SegmentSize, FileName); + } + else + { + /* Load memory from i/o buffer using 8 bit wide writes */ + for (i = 0; i < SegmentSize; i++) { - /* CFE_PSP_MemWrite8 error */ - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - (unsigned int)PSP_Status, (unsigned int) DataPointer8); - /* Stop load segment loop */ - break; + PSP_Status = CFE_PSP_MemWrite8((cpuaddr)DataPointer8, ioBuffer8[i]); + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataPointer8++; + } + else + { + /* CFE_PSP_MemWrite8 error */ + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP write memory error: RC=0x%08X, Address=%p, MemType=MEM8", + (unsigned int)PSP_Status, (void *)DataPointer8); + /* Stop load segment loop */ + break; + } } - } - if (PSP_Status == CFE_PSP_SUCCESS) - { - BytesProcessed += SegmentSize; - BytesRemaining -= SegmentSize; - - /* Prevent CPU hogging between load segments */ - if (BytesRemaining != 0) + if (PSP_Status == CFE_PSP_SUCCESS) { - MM_SegmentBreak(); + BytesProcessed += SegmentSize; + BytesRemaining -= SegmentSize; + + /* Prevent CPU hogging between load segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } } - } - } - } - - /* Update last action statistics */ - if (BytesProcessed == FileHeader->NumOfBytes) - { - Valid = TRUE; - MM_AppData.LastAction = MM_LOAD_FROM_FILE; - MM_AppData.MemType = MM_MEM8; - MM_AppData.Address = DestAddress; - MM_AppData.BytesProcessed = BytesProcessed; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - } + } + } - return(Valid); - -} /* end MM_LoadMem8FromFile */ + /* Update last action statistics */ + if (BytesProcessed == FileHeader->NumOfBytes) + { + Valid = true; + MM_AppData.HkPacket.LastAction = MM_LOAD_FROM_FILE; + MM_AppData.HkPacket.MemType = MM_MEM8; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + } + + return (Valid); +} /* end MM_LoadMem8FromFile */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Dump the requested number of bytes from memory to a file using */ /* only 8 bit wide reads */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_DumpMem8ToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_DumpMem8ToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader) { - boolean Valid = TRUE; - int32 OS_Status = OS_ERROR; - int32 PSP_Status = CFE_PSP_SUCCESS; - uint32 i = 0; - uint32 BytesProcessed = 0; - uint32 BytesRemaining = FileHeader->NumOfBytes; - uint8 *DataPointer8 = (uint8 *) FileHeader->SymAddress.Offset; - uint8 *ioBuffer8 = (uint8 *) &MM_AppData.DumpBuffer[0]; - uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - - while (BytesRemaining != 0) - { - if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + bool Valid = true; + int32 OS_Status = OS_ERROR; + int32 PSP_Status = CFE_PSP_SUCCESS; + uint32 i = 0; + uint32 BytesProcessed = 0; + uint32 BytesRemaining = FileHeader->NumOfBytes; + uint8 *DataPointer8 = (uint8 *)(FileHeader->SymAddress.Offset); + uint8 *ioBuffer8 = (uint8 *)&MM_AppData.DumpBuffer[0]; + uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - /* Load RAM data into i/o buffer */ - for (i = 0; i < SegmentSize; i++) - { - if ((PSP_Status = CFE_PSP_MemRead8((uint32) DataPointer8, &ioBuffer8[i])) == CFE_PSP_SUCCESS) - { - DataPointer8++; - } - else - { - /* CFE_PSP_MemRead8 error */ - Valid = FALSE; - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM8", - (unsigned int)PSP_Status, (unsigned int) DataPointer8, (unsigned int) &ioBuffer8[i]); - /* Stop load i/o buffer loop */ - break; - } - } + while (BytesRemaining != 0) + { + if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - /* Check for error loading i/o buffer */ - if (PSP_Status == CFE_PSP_SUCCESS) - { - /* Write i/o buffer contents to file */ - if ((OS_Status = OS_write(FileHandle, ioBuffer8, SegmentSize)) == SegmentSize) - { - /* Update process counters */ - BytesRemaining -= SegmentSize; - BytesProcessed += SegmentSize; + /* Load RAM data into i/o buffer */ + for (i = 0; i < SegmentSize; i++) + { + if ((PSP_Status = CFE_PSP_MemRead8((cpuaddr)DataPointer8, &ioBuffer8[i])) == CFE_PSP_SUCCESS) + { + DataPointer8++; + } + else + { + /* CFE_PSP_MemRead8 error */ + Valid = false; + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP read memory error: RC=0x%08X, Src=%p, Tgt=%p, Type=MEM8", + (unsigned int)PSP_Status, (void *)DataPointer8, (void *)&ioBuffer8[i]); + /* Stop load i/o buffer loop */ + break; + } + } - /* Prevent CPU hogging between dump segments */ - if (BytesRemaining != 0) + /* Check for error loading i/o buffer */ + if (PSP_Status == CFE_PSP_SUCCESS) + { + /* Write i/o buffer contents to file */ + if ((OS_Status = OS_write(FileHandle, ioBuffer8, SegmentSize)) == SegmentSize) { - MM_SegmentBreak(); + /* Update process counters */ + BytesRemaining -= SegmentSize; + BytesProcessed += SegmentSize; + + /* Prevent CPU hogging between dump segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } } - } - else - { - /* OS_write error */ - Valid = FALSE; - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - (unsigned int)OS_Status, (int)SegmentSize, FileName); - } - } - } + else + { + /* OS_write error */ + Valid = false; + BytesRemaining = 0; + CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR, + "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", + (unsigned int)OS_Status, (int)SegmentSize, FileName); + } + } + } - if (Valid) - { - /* Update last action statistics */ - MM_AppData.LastAction = MM_DUMP_TO_FILE; - MM_AppData.MemType = MM_MEM8; - MM_AppData.Address = FileHeader->SymAddress.Offset; - strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - MM_AppData.BytesProcessed = BytesProcessed; - } + if (Valid) + { + /* Update last action statistics */ + MM_AppData.HkPacket.LastAction = MM_DUMP_TO_FILE; + MM_AppData.HkPacket.MemType = MM_MEM8; + MM_AppData.HkPacket.Address = FileHeader->SymAddress.Offset; + strncpy(MM_AppData.HkPacket.FileName, FileName, OS_MAX_PATH_LEN); + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + } - return(Valid); + return (Valid); } /* end MM_DumpMem8ToFile */ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Fill memory with the command specified fill pattern using only */ /* 8 bit wide writes */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void MM_FillMem8(uint32 DestAddress, - MM_FillMemCmd_t *CmdPtr) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_FillMem8(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr) { - uint32 i = 0; - int32 PSP_Status = CFE_PSP_SUCCESS; - uint32 BytesProcessed = 0; - uint32 BytesRemaining = CmdPtr->NumOfBytes; - uint8 FillPattern8 = (uint8) CmdPtr->FillPattern; - uint8 *DataPointer8 = (uint8 *) DestAddress; - uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; + uint32 i = 0; + int32 PSP_Status = CFE_PSP_SUCCESS; + uint32 BytesProcessed = 0; + uint32 BytesRemaining = CmdPtr->NumOfBytes; + uint8 FillPattern8 = (uint8)CmdPtr->FillPattern; + uint8 *DataPointer8 = (uint8 *)DestAddress; + uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; + bool Result = true; - while (BytesRemaining != 0) - { - /* Set size of next segment */ - if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - { - SegmentSize = BytesRemaining; - } + while (BytesRemaining != 0) + { + /* Set size of next segment */ + if (BytesRemaining < MM_MAX_FILL_DATA_SEG) + { + SegmentSize = BytesRemaining; + } - /* Fill next segment */ - for (i = 0; i < SegmentSize; i++) - { - PSP_Status = CFE_PSP_MemWrite8((uint32) DataPointer8, FillPattern8); - if (PSP_Status == CFE_PSP_SUCCESS) - { - DataPointer8++; - } - else - { - /* CFE_PSP_MemWrite8 error */ - BytesRemaining = 0; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - (unsigned int)PSP_Status, (unsigned int)DataPointer8); - /* Stop fill segment loop */ - break; - } - } + /* Fill next segment */ + for (i = 0; i < SegmentSize; i++) + { + PSP_Status = CFE_PSP_MemWrite8((cpuaddr)DataPointer8, FillPattern8); + if (PSP_Status == CFE_PSP_SUCCESS) + { + DataPointer8++; + } + else + { + /* CFE_PSP_MemWrite8 error */ + BytesRemaining = 0; + Result = false; + CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR, + "PSP write memory error: RC=0x%08X, Address=%p, MemType=MEM8", + (unsigned int)PSP_Status, (void *)DataPointer8); + /* Stop fill segment loop */ + break; + } + } - if (PSP_Status == CFE_PSP_SUCCESS) - { - /* Update process counters */ - BytesRemaining -= SegmentSize; - BytesProcessed += SegmentSize; + if (PSP_Status == CFE_PSP_SUCCESS) + { + /* Update process counters */ + BytesRemaining -= SegmentSize; + BytesProcessed += SegmentSize; - /* Prevent CPU hogging between fill segments */ - if (BytesRemaining != 0) - { - MM_SegmentBreak(); - } - } - } + /* Prevent CPU hogging between fill segments */ + if (BytesRemaining != 0) + { + MM_SegmentBreak(); + } + } + } - /* Update last action statistics */ - if (BytesProcessed == CmdPtr->NumOfBytes) - { - MM_AppData.LastAction = MM_FILL; - MM_AppData.MemType = MM_MEM8; - MM_AppData.Address = DestAddress; - MM_AppData.DataValue = (uint32) FillPattern8; - MM_AppData.BytesProcessed = BytesProcessed; - } + /* Update last action statistics */ + if (BytesProcessed == CmdPtr->NumOfBytes) + { + MM_AppData.HkPacket.LastAction = MM_FILL; + MM_AppData.HkPacket.MemType = MM_MEM8; + MM_AppData.HkPacket.Address = DestAddress; + MM_AppData.HkPacket.DataValue = (uint32)FillPattern8; + MM_AppData.HkPacket.BytesProcessed = BytesProcessed; + } - return; - -}/* End MM_FillMem8 */ + return Result; +} /* End MM_FillMem8 */ #endif /* MM_OPT_CODE_MEM8_MEMTYPE */ diff --git a/fsw/src/mm_mem8.h b/fsw/src/mm_mem8.h index 649e0dd..bb944de 100644 --- a/fsw/src/mm_mem8.h +++ b/fsw/src/mm_mem8.h @@ -1,36 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_mem8.h 1.1 2015/07/28 12:21:58EDT rperera Exp $ +** File: mm_mem8.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager functions that are used ** for the conditionally compiled MM_MEM8 optional memory type. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_mem8.h $ -** Revision 1.1 2015/07/28 12:21:58EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.4 2015/03/02 14:27:11EST sstrege -** Added copyright information -** Revision 1.3 2008/05/19 15:23:31EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_mem8_ #define _mm_mem8_ @@ -45,91 +28,86 @@ *************************************************************************/ /************************************************************************/ /** \brief Memory8 load from file -** +** ** \par Description -** Support function for #MM_LoadMemFromFileCmd. This routine will +** Support function for #MM_LoadMemFromFileCmd. This routine will ** read a file and write the data to memory that is defined to ** only be 8 bit accessible ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM8 memory ** type -** -** \param [in] FileHandle The open file handle of the load file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the load file +** +** \param [in] FileName A pointer to a character string holding ** the load file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the load file header structure ** -** \param [in] DestAddress The destination address for the requested -** load operation -** +** \param [in] DestAddress The destination address for the requested +** load operation +** ** \returns ** \retstmt Returns TRUE if the load completed successfully \endcode ** \retstmt Returns FALSE if the load failed due to an error \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_LoadMem8FromFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader, - uint32 DestAddress); +bool MM_LoadMem8FromFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader, + cpuaddr DestAddress); /************************************************************************/ /** \brief Memory8 dump to file -** +** ** \par Description -** Support function for #MM_DumpMemToFileCmd. This routine will +** Support function for #MM_DumpMemToFileCmd. This routine will ** read an address range that is defined to only be 8 bit ** accessible and store the data in a file ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM8 memory ** type -** -** \param [in] FileHandle The open file handle of the dump file ** -** \param [in] FileName A pointer to a character string holding +** \param [in] FileHandle The open file handle of the dump file +** +** \param [in] FileName A pointer to a character string holding ** the dump file name ** -** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to +** \param [in] FileHeader A #MM_LoadDumpFileHeader_t pointer to ** the dump file header structure initialized -** with data based upon the command message +** with data based upon the command message ** parameters ** ** \returns ** \retstmt Returns TRUE if the dump completed successfully \endcode ** \retstmt Returns FALSE if the dump failed due to an error \endcode ** \endreturns -** +** *************************************************************************/ -boolean MM_DumpMem8ToFile(uint32 FileHandle, - char *FileName, - MM_LoadDumpFileHeader_t *FileHeader); +bool MM_DumpMem8ToFile(uint32 FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader); /************************************************************************/ /** \brief Fill memory8 -** +** ** \par Description -** Support function for #MM_FillMemCmd. This routine will +** Support function for #MM_FillMemCmd. This routine will ** load memory that is defined to only be 8 bit accessible ** with a command specified fill pattern ** ** \par Assumptions, External Events, and Notes: ** This function is specific to the optional #MM_MEM8 memory ** type -** -** \param [in] DestAddress The destination address for the fill +** +** \param [in] DestAddress The destination address for the fill ** operation ** ** \param [in] CmdPtr A #MM_FillMemCmd_t pointer to the fill ** command message ** *************************************************************************/ -void MM_FillMem8 (uint32 DestAddress, - MM_FillMemCmd_t *CmdPtr); +bool MM_FillMem8(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr); #endif /* _mm_mem8_ */ diff --git a/fsw/src/mm_msg.h b/fsw/src/mm_msg.h index 6b8cb03..b0acae2 100644 --- a/fsw/src/mm_msg.h +++ b/fsw/src/mm_msg.h @@ -1,54 +1,26 @@ /************************************************************************ -** File: -** $Id: mm_msg.h 1.1 2015/07/28 12:22:00EDT rperera Exp $ +** File: mm_msg.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: -** Specification for the CFS Memory Manager command and telemetry +** Purpose: +** Specification for the CFS Memory Manager command and telemetry ** message data types. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS Development Standards Document -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** ** Notes: ** Constant and enumerated types related to these message structures -** are defined in mm_msgdefs.h. They are kept separate to allow easy +** are defined in mm_msgdefs.h. They are kept separate to allow easy ** integration with ASIST RDL files which can't handle typedef -** declarations (see the main comment block in mm_msgdefs.h for more +** declarations (see the main comment block in mm_msgdefs.h for more ** info). ** -** $Log: mm_msg.h $ -** Revision 1.1 2015/07/28 12:22:00EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.9 2015/03/20 14:16:54EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.8 2015/03/02 14:26:35EST sstrege -** Added copyright information -** Revision 1.7 2010/11/29 08:46:50EST jmdagost -** Added support for EEPROM write-enable/disable commands -** Revision 1.6 2010/11/24 17:04:37EST jmdagost -** Add filename argument to symbol table dump command structure -** Revision 1.5 2008/09/06 15:00:50EDT dahardison -** Updated to support the symbol lookup ground command -** Revision 1.4 2008/05/22 15:08:41EDT dahardison -** Changed inclusion of cfs_lib.h to cfs_utils.h -** Moved #defines to mm_msgdefs.h so they can be included -** in ASIST RDL files. -** Revision 1.3 2008/05/19 15:23:33EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_msg_ #define _mm_msg_ @@ -64,178 +36,193 @@ /************************************************************************ ** Type Definitions *************************************************************************/ -/** +/** ** \brief No Arguments Command ** For command details see #MM_NOOP_CC, #MM_RESET_CC */ typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - + CFE_MSG_CommandHeader_t CmdHeader; } MM_NoArgsCmd_t; -/** +/** ** \brief Memory Peek Command ** For command details see #MM_PEEK_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; - uint8 DataSize; /**< \brief Size of the data to be read */ - uint8 MemType; /**< \brief Memory type to peek data from */ - uint8 Padding[2]; /**< \brief Structure padding */ - CFS_SymAddr_t SrcSymAddress; /**< \brief Symbolic source peek address */ + uint8 DataSize; /**< \brief Size of the data to be read */ + uint8 MemType; /**< \brief Memory type to peek data from */ + uint8 Padding[2]; /**< \brief Structure padding */ + CFS_SymAddr_t SrcSymAddress; /**< \brief Symbolic source peek address */ } MM_PeekCmd_t; -/** +/** ** \brief Memory Poke Command ** For command details see #MM_POKE_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; - uint8 DataSize; /**< \brief Size of the data to be written */ - uint8 MemType; /**< \brief Memory type to poke data to */ - uint8 Padding[2]; /**< \brief Structure padding */ - uint32 Data; /**< \brief Data to be written */ - CFS_SymAddr_t DestSymAddress; /**< \brief Symbolic destination poke address */ + uint8 DataSize; /**< \brief Size of the data to be written */ + uint8 MemType; /**< \brief Memory type to poke data to */ + uint8 Padding[2]; /**< \brief Structure padding */ + uint32 Data; /**< \brief Data to be written */ + CFS_SymAddr_t DestSymAddress; /**< \brief Symbolic destination poke address */ } MM_PokeCmd_t; -/** +/** ** \brief Memory Load With Interrupts Disabled Command ** For command details see #MM_LOAD_MEM_WID_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; - uint8 NumOfBytes; /**< \brief Number of bytes to be loaded */ - uint8 Padding[3]; /**< \brief Structure padding */ - uint32 Crc; /**< \brief Data check value */ - CFS_SymAddr_t DestSymAddress; /**< \brief Symbolic destination load address */ - uint8 DataArray[MM_MAX_UNINTERRUPTABLE_DATA]; /**< \brief Data to be loaded */ + uint8 NumOfBytes; /**< \brief Number of bytes to be loaded */ + uint8 Padding[3]; /**< \brief Structure padding */ + uint32 Crc; /**< \brief Data check value */ + CFS_SymAddr_t DestSymAddress; /**< \brief Symbolic destination load address */ + uint8 DataArray[MM_MAX_UNINTERRUPTIBLE_DATA]; /**< \brief Data to be loaded */ } MM_LoadMemWIDCmd_t; -/** +/** ** \brief Dump Memory In Event Message Command ** For command details see #MM_DUMP_IN_EVENT_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - - uint8 MemType; /**< \brief Memory dump type */ - uint8 NumOfBytes; /**< \brief Number of bytes to be dumped */ - uint16 Padding; /**< \brief Structure padding */ - CFS_SymAddr_t SrcSymAddress; /**< \brief Symbolic source address */ - +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + uint8 MemType; /**< \brief Memory dump type */ + uint8 NumOfBytes; /**< \brief Number of bytes to be dumped */ + uint16 Padding; /**< \brief Structure padding */ + CFS_SymAddr_t SrcSymAddress; /**< \brief Symbolic source address */ + } MM_DumpInEventCmd_t; -/** +/** ** \brief Memory Load From File Command ** For command details see #MM_LOAD_MEM_FROM_FILE_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; - char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of memory load file */ + char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of memory load file */ } MM_LoadMemFromFileCmd_t; -/** +/** ** \brief Memory Dump To File Command ** For command details see #MM_DUMP_MEM_TO_FILE_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; - uint8 MemType; /**< \brief Memory dump type */ - uint8 Padding[3]; /**< \brief Structure padding */ - uint32 NumOfBytes; /**< \brief Number of bytes to be dumped */ - CFS_SymAddr_t SrcSymAddress; /**< \brief Symbol plus optional offset */ - char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of memory dump file */ + uint8 MemType; /**< \brief Memory dump type */ + uint8 Padding[3]; /**< \brief Structure padding */ + uint32 NumOfBytes; /**< \brief Number of bytes to be dumped */ + CFS_SymAddr_t SrcSymAddress; /**< \brief Symbol plus optional offset */ + char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of memory dump file */ } MM_DumpMemToFileCmd_t; -/** +/** ** \brief Memory Fill Command ** For command details see #MM_FILL_MEM_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - uint8 MemType; /**< \brief Memory type */ - uint8 Padding[3]; /**< \brief Structure padding */ - uint32 NumOfBytes; /**< \brief Number of bytes to fill */ - uint32 FillPattern; /**< \brief Fill pattern to use */ - CFS_SymAddr_t DestSymAddress; /**< \brief Symbol plus optional offset */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + uint8 MemType; /**< \brief Memory type */ + uint8 Padding[3]; /**< \brief Structure padding */ + uint32 NumOfBytes; /**< \brief Number of bytes to fill */ + uint32 FillPattern; /**< \brief Fill pattern to use */ + CFS_SymAddr_t DestSymAddress; /**< \brief Symbol plus optional offset */ } MM_FillMemCmd_t; -/** +/** ** \brief Symbol Table Lookup Command ** For command details see #MM_LOOKUP_SYM_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - char SymName[OS_MAX_SYM_LEN]; /**< \brief Symbol name string */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + char SymName[OS_MAX_SYM_LEN]; /**< \brief Symbol name string */ } MM_LookupSymCmd_t; -/** +/** ** \brief Save Symbol Table To File Command ** For command details see #MM_SYMTBL_TO_FILE_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of symbol dump file */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of symbol dump file */ } MM_SymTblToFileCmd_t; -/** +/** ** \brief EEPROM Write Enable Command ** For command details see #MM_ENABLE_EEPROM_WRITE_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - uint32 Bank; /**< \brief EEPROM bank number to write-enable */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + uint32 Bank; /**< \brief EEPROM bank number to write-enable */ } MM_EepromWriteEnaCmd_t; -/** +/** ** \brief EEPROM Write Disable Command ** For command details see #MM_DISABLE_EEPROM_WRITE_CC */ -typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - uint32 Bank; /**< \brief EEPROM bank number to write-disable */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; + + uint32 Bank; /**< \brief EEPROM bank number to write-disable */ } MM_EepromWriteDisCmd_t; -/** +/** ** \mmtlm Housekeeping Packet Structure */ typedef struct { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE SB Tlm Msg Hdr */ - - uint8 CmdCounter; /**< \mmtlmmnemonic \MM_CMDPC - \brief MM Application Command Counter */ - uint8 ErrCounter; /**< \mmtlmmnemonic \MM_CMDEC - \brief MM Application Command Error Counter */ - uint8 LastAction; /**< \mmtlmmnemonic \MM_LASTACTION - \brief Last command action executed */ - uint8 MemType; /**< \mmtlmmnemonic \MM_MEMTYPE - \brief Memory type for last command */ - uint32 Address; /**< \mmtlmmnemonic \MM_ADDR - \brief Fully resolved address used for last command */ - uint32 DataValue; /**< \mmtlmmnemonic \MM_DATAVALUE - \brief Last command data value -- may be - fill pattern or peek/poke value */ - uint32 BytesProcessed; /**< \mmtlmmnemonic \MM_BYTESPROCESSED - \brief Bytes processed for last command */ - char FileName[OS_MAX_PATH_LEN]; /**< \mmtlmmnemonic \MM_FILENAME - \brief Name of the data file used for last command, where applicable */ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief cFE SB Tlm Msg Hdr */ + + uint8 CmdCounter; /**< \mmtlmmnemonic \MM_CMDPC + \brief MM Application Command Counter */ + uint8 ErrCounter; /**< \mmtlmmnemonic \MM_CMDEC + \brief MM Application Command Error Counter */ + uint8 LastAction; /**< \mmtlmmnemonic \MM_LASTACTION + \brief Last command action executed */ + uint8 MemType; /**< \mmtlmmnemonic \MM_MEMTYPE + \brief Memory type for last command */ + cpuaddr Address; /**< \mmtlmmnemonic \MM_ADDR + \brief Fully resolved address used for last command */ + uint32 DataValue; /**< \mmtlmmnemonic \MM_DATAVALUE + \brief Last command data value -- may be + fill pattern or peek/poke value */ + uint32 BytesProcessed; /**< \mmtlmmnemonic \MM_BYTESPROCESSED + \brief Bytes processed for last command */ + char FileName[OS_MAX_PATH_LEN]; /**< \mmtlmmnemonic \MM_FILENAME + \brief Name of the data file used for last command, where applicable */ } MM_HkPacket_t; #endif /* _mm_msg_ */ @@ -243,4 +230,3 @@ typedef struct /************************/ /* End of File Comment */ /************************/ - diff --git a/fsw/src/mm_msgdefs.h b/fsw/src/mm_msgdefs.h index c8a9888..bdb11ae 100644 --- a/fsw/src/mm_msgdefs.h +++ b/fsw/src/mm_msgdefs.h @@ -1,58 +1,27 @@ /************************************************************************ -** File: -** $Id: mm_msgdefs.h 1.1 2015/07/28 12:22:02EDT rperera Exp $ +** File: mm_msgdefs.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: -** Specification for the CFS Memory Manager command and telemetry +** Purpose: +** Specification for the CFS Memory Manager command and telemetry ** message constant definitions. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS Development Standards Document -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** ** Notes: -** These Macro definitions have been put in this file (instead of -** mm_msg.h) so this file can be included directly into ASIST build -** test scripts. ASIST RDL files can accept C language #defines but +** These Macro definitions have been put in this file (instead of +** mm_msg.h) so this file can be included directly into ASIST build +** test scripts. ASIST RDL files can accept C language #defines but ** can't handle type definitions. As a result: DO NOT PUT ANY -** TYPEDEFS OR STRUCTURE DEFINITIONS IN THIS FILE! -** ADD THEM TO mm_msg.h IF NEEDED! -** -** $Log: mm_msgdefs.h $ -** Revision 1.1 2015/07/28 12:22:02EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.9 2015/04/01 14:50:28EDT sstrege -** Added criticality information to doxygen command descriptions -** Revision 1.8 2015/03/30 17:33:45EDT lwalling -** Create common process to maintain and report last action statistics -** Revision 1.7 2015/03/02 14:26:40EST sstrege -** Added copyright information -** Revision 1.6 2010/12/08 14:29:38EST jmdagost -** Corrected typos in doxygen links -** Revision 1.5 2010/11/29 08:46:52EST jmdagost -** Added support for EEPROM write-enable/disable commands -** Revision 1.4 2010/11/24 17:06:29EST jmdagost -** Update ducumentation for Save Symbol Table To File command. -** Revision 1.3 2009/04/18 15:29:36EDT dkobe -** Corrected doxygen comments -** Revision 1.2 2008/09/06 15:00:40EDT dahardison -** Updated to support the symbol lookup ground command -** Revision 1.1 2008/05/22 15:16:48EDT dahardison -** Initial revision -** Member added to project c:/MKSDATA/MKS-REPOSITORY/CFS-REPOSITORY/mm/fsw/src/project.pj -** +** TYPEDEFS OR STRUCTURE DEFINITIONS IN THIS FILE! +** ADD THEM TO mm_msg.h IF NEEDED! +** *************************************************************************/ #ifndef _mm_msgdefs_ #define _mm_msgdefs_ @@ -61,54 +30,55 @@ ** Macro Definitions *************************************************************************/ /** -** \name MM Data Sizes for Peeks and Pokes */ +** \name MM Data Sizes for Peeks and Pokes */ /** \{ */ -#define MM_BYTE_BIT_WIDTH 8 -#define MM_WORD_BIT_WIDTH 16 -#define MM_DWORD_BIT_WIDTH 32 +#define MM_BYTE_BIT_WIDTH 8 +#define MM_WORD_BIT_WIDTH 16 +#define MM_DWORD_BIT_WIDTH 32 /** \} */ /** -** \name MM Memory Types */ +** \name MM Memory Types */ /** \{ */ -#define MM_NOMEMTYPE 0 /**< \brief Used to indicate that no memtype specified */ -#define MM_RAM 1 /**< \brief Normal RAM, no special access required */ -#define MM_EEPROM 2 /**< \brief EEPROM, requires special access for writes */ -#define MM_MEM8 3 /**< \brief Optional memory type that is only 8-bit read/write */ -#define MM_MEM16 4 /**< \brief Optional memory type that is only 16-bit read/write */ -#define MM_MEM32 5 /**< \brief Optional memory type that is only 32-bit read/write */ +#define MM_NOMEMTYPE 0 /**< \brief Used to indicate that no memtype specified */ +#define MM_RAM 1 /**< \brief Normal RAM, no special access required */ +#define MM_EEPROM 2 /**< \brief EEPROM, requires special access for writes */ +#define MM_MEM8 3 /**< \brief Optional memory type that is only 8-bit read/write */ +#define MM_MEM16 4 /**< \brief Optional memory type that is only 16-bit read/write */ +#define MM_MEM32 5 /**< \brief Optional memory type that is only 32-bit read/write */ +#define MM_NUM_MEMTYPES 6 /** \} */ /** -** \name Misc Initialization Values */ +** \name Misc Initialization Values */ /** \{ */ -#define MM_CLEAR_SYMNAME '\0' /**< \brief Used to clear out symbol name strings */ -#define MM_CLEAR_FNAME '\0' /**< \brief Used to clear out file name strings */ -#define MM_CLEAR_ADDR 0 /**< \brief Used to clear out memory address variables */ -#define MM_CLEAR_PATTERN 0 /**< \brief Used to clear out fill and test patterns */ +#define MM_CLEAR_SYMNAME '\0' /**< \brief Used to clear out symbol name strings */ +#define MM_CLEAR_FNAME '\0' /**< \brief Used to clear out file name strings */ +#define MM_CLEAR_ADDR 0 /**< \brief Used to clear out memory address variables */ +#define MM_CLEAR_PATTERN 0 /**< \brief Used to clear out fill and test patterns */ /** \} */ /** -** \name HK MM Last Action Identifiers */ +** \name HK MM Last Action Identifiers */ /** \{ */ -#define MM_NOACTION 0 /**< \brief Used to clear out HK action variable */ -#define MM_PEEK 1 -#define MM_POKE 2 -#define MM_LOAD_FROM_FILE 3 -#define MM_LOAD_WID 4 -#define MM_DUMP_TO_FILE 5 -#define MM_DUMP_INEVENT 6 -#define MM_FILL 7 -#define MM_SYM_LOOKUP 8 -#define MM_SYMTBL_SAVE 9 -#define MM_EEPROMWRITE_ENA 10 -#define MM_EEPROMWRITE_DIS 11 -#define MM_NOOP 12 -#define MM_RESET 13 +#define MM_NOACTION 0 /**< \brief Used to clear out HK action variable */ +#define MM_PEEK 1 +#define MM_POKE 2 +#define MM_LOAD_FROM_FILE 3 +#define MM_LOAD_WID 4 +#define MM_DUMP_TO_FILE 5 +#define MM_DUMP_INEVENT 6 +#define MM_FILL 7 +#define MM_SYM_LOOKUP 8 +#define MM_SYMTBL_SAVE 9 +#define MM_EEPROMWRITE_ENA 10 +#define MM_EEPROMWRITE_DIS 11 +#define MM_NOOP 12 +#define MM_RESET 13 /** \} */ -/** \mmcmd Noop -** +/** \mmcmd Noop +** ** \par Description ** Implements the Noop command that insures the MM task is alive ** @@ -121,14 +91,14 @@ ** Successful execution of this command may be verified with ** the following telemetry: ** - \b \c \MM_CMDPC - command counter will increment -** - The #MM_NOOP_INF_EID informational event message will be +** - The #MM_NOOP_INF_EID informational event message will be ** generated when the command is received -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** @@ -137,10 +107,10 @@ ** ** \sa #MM_RESET_CC */ -#define MM_NOOP_CC 0 +#define MM_NOOP_CC 0 /** \mmcmd Reset Counters -** +** ** \par Description ** Resets the MM housekeeping counters ** @@ -154,14 +124,14 @@ ** the following telemetry: ** - \b \c \MM_CMDPC - command counter will be cleared ** - \b \c \MM_CMDEC - command error counter will be cleared -** - The #MM_RESET_DBG_EID informational event message will be +** - The #MM_RESET_DBG_EID informational event message will be ** generated when the command is executed -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** @@ -170,10 +140,10 @@ ** ** \sa #MM_NOOP_CC */ -#define MM_RESET_CC 1 +#define MM_RESET_CC 1 /** \mmcmd Memory Peek -** +** ** \par Description ** Reads 8,16, or 32 bits of data from any given input address ** @@ -188,17 +158,17 @@ ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_PEEK ** - \b \c \MM_MEMTYPE - will be set to the commanded memory type -** - \b \c \MM_ADDR - will be set to the fully resolved destination +** - \b \c \MM_ADDR - will be set to the fully resolved destination ** memory address ** - \b \c \MM_BYTESPROCESSED - will be set to the byte size of the -** peek operation (1, 2, or 4) +** peek operation (1, 2, or 4) ** - The #MM_PEEK_BYTE_INF_EID informational event message will ** be generated with the peek data if the data size was 8 bits ** - The #MM_PEEK_WORD_INF_EID informational event message will ** be generated with the peek data if the data size was 16 bits ** - The #MM_PEEK_DWORD_INF_EID informational event message will ** be generated with the peek data if the data size was 32 bits -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected @@ -207,8 +177,8 @@ ** - The specified memory type is invalid ** - The address range fails validation check ** - The address and data size are not properly aligned -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_SYMNAME_ERR_EID @@ -220,20 +190,20 @@ ** ** \par Criticality ** It is the responsibility of the user to verify the DestSymAddress and -** MemType in the command. It is possible to generate a machine check -** exception when accessing I/O memory addresses/registers and other types of memory. -** The user is cautioned to use extreme care. +** MemType in the command. It is possible to generate a machine check +** exception when accessing I/O memory addresses/registers and other types of memory. +** The user is cautioned to use extreme care. ** -** Note: Valid memory ranges are defined within a hardcoded structure contained in the +** Note: Valid memory ranges are defined within a hardcoded structure contained in the ** PSP layer (CFE_PSP_MemoryTable) however, not every address within the defined ranges ** may be valid. ** ** \sa #MM_POKE_CC */ -#define MM_PEEK_CC 2 +#define MM_PEEK_CC 2 /** \mmcmd Memory Poke -** +** ** \par Description ** Writes 8, 16, or 32 bits of data to any memory address ** @@ -248,17 +218,17 @@ ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_POKE ** - \b \c \MM_MEMTYPE - will be set to the commanded memory type -** - \b \c \MM_ADDR - will be set to the fully resolved source +** - \b \c \MM_ADDR - will be set to the fully resolved source ** memory address ** - \b \c \MM_BYTESPROCESSED - will be set to the byte size of the -** poke operation (1, 2, or 4) +** poke operation (1, 2, or 4) ** - The #MM_POKE_BYTE_INF_EID informational event message will ** be generated if the data size was 8 bits ** - The #MM_POKE_WORD_INF_EID informational event message will ** be generated if the data size was 16 bits ** - The #MM_POKE_DWORD_INF_EID informational event message will ** be generated if the data size was 32 bits -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected @@ -268,8 +238,8 @@ ** - The address range fails validation check ** - The address and data size are not properly aligned ** - An EEPROM write error occured -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_SYMNAME_ERR_EID @@ -283,29 +253,29 @@ ** - Error specific event message #MM_OS_EEPROMWRITE32_ERR_EID ** ** \par Criticality -** It is the responsibility of the user to verify the DestSymAddress, -** MemType, and Data in the command. It is highly recommended -** to verify the success or failure of the memory poke. The poke may be verified -** by issuing a subsequent peek command and evaluating the returned value. It is -** possible to destroy critical information with this command causing unknown -** consequences. In addition, it is possible to generate a machine check exception -** when accessing I/O memory addresses/registers and other types of memory. The user +** It is the responsibility of the user to verify the DestSymAddress, +** MemType, and Data in the command. It is highly recommended +** to verify the success or failure of the memory poke. The poke may be verified +** by issuing a subsequent peek command and evaluating the returned value. It is +** possible to destroy critical information with this command causing unknown +** consequences. In addition, it is possible to generate a machine check exception +** when accessing I/O memory addresses/registers and other types of memory. The user ** is cautioned to use extreme care. ** -** Note: Valid memory ranges are defined within a hardcoded structure contained in the +** Note: Valid memory ranges are defined within a hardcoded structure contained in the ** PSP layer (CFE_PSP_MemoryTable) however, not every address within the defined ranges ** may be valid. ** ** \sa #MM_PEEK_CC */ -#define MM_POKE_CC 3 +#define MM_POKE_CC 3 /** \mmcmd Memory Load With Interrupts Disabled -** +** ** \par Description -** Reprogram processor memory with input data. Loads up to -** #MM_MAX_UNINTERRUPTABLE_DATA data bytes into RAM with -** interrupts disabled +** Reprogram processor memory with input data. Loads up to +** #MM_MAX_UNINTERRUPTIBLE_DATA data bytes into RAM with +** interrupts disabled ** ** \mmcmdmnemonic \MM_LOADWID ** @@ -317,13 +287,13 @@ ** the following telemetry: ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_LOAD_WID -** - \b \c \MM_ADDR - will be set to the fully resolved +** - \b \c \MM_ADDR - will be set to the fully resolved ** destination memory address ** - \b \c \MM_BYTESPROCESSED - will be set to the number of bytes ** loaded -** - The #MM_LOAD_WID_INF_EID information event message will be +** - The #MM_LOAD_WID_INF_EID information event message will be ** generated when the command is executed -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected @@ -331,8 +301,8 @@ ** - The computed CRC doesn't match the command message value ** - The address range fails validation check ** - Invalid data size specified in command message -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_SYMNAME_ERR_EID @@ -341,27 +311,27 @@ ** - Error specific event message #MM_DATA_SIZE_BYTES_ERR_EID ** ** \par Criticality -** It is the responsibility of the user to verify the DestSymAddress, -** NumOfBytes, and DataArray contents in the command. It is -** highly recommended to verify the success or failure of the memory load. The -** load may be verified by dumping memory and evaluating the dump contents. It -** is possible to destroy critical information with this command causing unknown -** consequences. In addition, it is possible to generate a machine check exception -** when accessing I/O memory addresses/registers and other types of memory. The +** It is the responsibility of the user to verify the DestSymAddress, +** NumOfBytes, and DataArray contents in the command. It is +** highly recommended to verify the success or failure of the memory load. The +** load may be verified by dumping memory and evaluating the dump contents. It +** is possible to destroy critical information with this command causing unknown +** consequences. In addition, it is possible to generate a machine check exception +** when accessing I/O memory addresses/registers and other types of memory. The ** user is cautioned to use extreme care. ** -** Note: Valid memory ranges are defined within a hardcoded structure contained in the +** Note: Valid memory ranges are defined within a hardcoded structure contained in the ** PSP layer (CFE_PSP_MemoryTable) however, not every address within the defined ranges ** may be valid. ** */ -#define MM_LOAD_MEM_WID_CC 4 +#define MM_LOAD_MEM_WID_CC 4 /** \mmcmd Memory Load From File -** +** ** \par Description -** Reprograms processor memory with the data contained within the given -** input file +** Reprograms processor memory with the data contained within the given +** input file ** ** \mmcmdmnemonic \MM_LOADFILE ** @@ -374,32 +344,32 @@ ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_LOAD_FROM_FILE ** - \b \c \MM_MEMTYPE - will be set to the commanded memory type -** - \b \c \MM_ADDR - will be set to the fully resolved +** - \b \c \MM_ADDR - will be set to the fully resolved ** destination memory address ** - \b \c \MM_BYTESPROCESSED - will be set to the number of bytes ** loaded ** - \b \c \MM_FILENAME - will be set to the load file name ** - The #MM_LD_MEM_FILE_INF_EID informational event message will -** be generated -** +** be generated +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected ** - Command specified filename is invalid -** - #OS_open call fails +** - #OS_OpenCreate call fails ** - #OS_close call fails ** - #OS_read doesn't read the expected number of bytes ** - The #CFS_ComputeCRCFromFile call fails ** - The computed CRC doesn't match the load file value ** - A symbol name was specified that can't be resolved ** - #CFE_FS_ReadHeader call fails -** - #OS_read call fails +** - #OS_read call fails ** - The address range fails validation check ** - The specified data size is invalid ** - The address and data size are not properly aligned ** - The specified memory type is invalid -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_CMD_FNAME_ERR_EID @@ -419,27 +389,27 @@ ** - Error specific event message #MM_MEMTYPE_ERR_EID ** ** \par Criticality -** It is the responsibility of the user to verify the contents of the load file -** in the command. It is highly recommended to verify the success or failure of -** the memory load. The load may be verified by dumping memory and evaluating the -** dump contents. It is possible to destroy critical information with this command -** causing unknown consequences. In addition, it is possible to generate a machine -** check exception when accessing I/O memory addresses/registers and other types of +** It is the responsibility of the user to verify the contents of the load file +** in the command. It is highly recommended to verify the success or failure of +** the memory load. The load may be verified by dumping memory and evaluating the +** dump contents. It is possible to destroy critical information with this command +** causing unknown consequences. In addition, it is possible to generate a machine +** check exception when accessing I/O memory addresses/registers and other types of ** memory. The user is cautioned to use extreme care. ** -** Note: Valid memory ranges are defined within a hardcoded structure contained in the +** Note: Valid memory ranges are defined within a hardcoded structure contained in the ** PSP layer (CFE_PSP_MemoryTable) however, not every address within the defined ranges ** may be valid. ** ** \sa #MM_DUMP_MEM_TO_FILE_CC */ -#define MM_LOAD_MEM_FROM_FILE_CC 5 +#define MM_LOAD_MEM_FROM_FILE_CC 5 /** \mmcmd Memory Dump To File -** +** ** \par Description -** Dumps the input number of bytes from processor memory -** to a file +** Dumps the input number of bytes from processor memory +** to a file ** ** \mmcmdmnemonic \MM_DUMPFILE ** @@ -452,20 +422,20 @@ ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_DUMP_TO_FILE ** - \b \c \MM_MEMTYPE - will be set to the commanded memory type -** - \b \c \MM_ADDR - will be set to the fully resolved +** - \b \c \MM_ADDR - will be set to the fully resolved ** source memory address ** - \b \c \MM_BYTESPROCESSED - will be set to the number of bytes ** dumped ** - \b \c \MM_FILENAME - will be set to the dump file name ** - The #MM_DMP_MEM_FILE_INF_EID informational event message will -** be generated -** +** be generated +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected ** - Command specified filename is invalid ** - A symbol name was specified that can't be resolved -** - #OS_creat call fails +** - #OS_OpenCreate call fails ** - #CFE_FS_WriteHeader call fails ** - #OS_close call fails ** - #OS_write doesn't write the expected number of bytes @@ -475,8 +445,8 @@ ** - The specified data size is invalid ** - The address and data size are not properly aligned ** - The specified memory type is invalid -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_CMD_FNAME_ERR_EID @@ -494,22 +464,22 @@ ** ** \par Criticality ** It is the responsibility of the user to verify the SrcSymAddress, -** NumOfBytes, and MemType in the command. It is possible to -** generate a machine check exception when accessing I/O memory addresses/registers +** NumOfBytes, and MemType in the command. It is possible to +** generate a machine check exception when accessing I/O memory addresses/registers ** and other types of memory. The user is cautioned to use extreme care. ** -** Note: Valid memory ranges are defined within a hardcoded structure contained in the +** Note: Valid memory ranges are defined within a hardcoded structure contained in the ** PSP layer (CFE_PSP_MemoryTable) however, not every address within the defined ranges ** may be valid. ** ** \sa #MM_LOAD_MEM_FROM_FILE_CC */ -#define MM_DUMP_MEM_TO_FILE_CC 6 +#define MM_DUMP_MEM_TO_FILE_CC 6 /** \mmcmd Dump In Event Message -** +** ** \par Description -** Dumps up to #MM_MAX_DUMP_INEVENT_BYTES of memory in an event message +** Dumps up to #MM_MAX_DUMP_INEVENT_BYTES of memory in an event message ** ** \mmcmdmnemonic \MM_DUMPEVT ** @@ -522,13 +492,13 @@ ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_DUMP_INEVENT ** - \b \c \MM_MEMTYPE - will be set to the commanded memory type -** - \b \c \MM_ADDR - will be set to the fully resolved +** - \b \c \MM_ADDR - will be set to the fully resolved ** source memory address ** - \b \c \MM_BYTESPROCESSED - will be set to the number of bytes ** dumped ** - The #MM_DUMP_INEVENT_INF_EID informational event message will ** be generated with the dump data -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected @@ -537,8 +507,8 @@ ** - The specified data size is invalid ** - The address and data size are not properly aligned ** - The specified memory type is invalid -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_SYMNAME_ERR_EID @@ -550,22 +520,22 @@ ** ** \par Criticality ** It is the responsibility of the user to verify the SrcSymAddress, -** NumOfBytes, and MemType in the command. It is possible to -** generate a machine check exception when accessing I/O memory addresses/registers +** NumOfBytes, and MemType in the command. It is possible to +** generate a machine check exception when accessing I/O memory addresses/registers ** and other types of memory. The user is cautioned to use extreme care. ** -** Note: Valid memory ranges are defined within a hardcoded structure contained in the +** Note: Valid memory ranges are defined within a hardcoded structure contained in the ** PSP layer (CFE_PSP_MemoryTable) however, not every address within the defined ranges ** may be valid. ** */ -#define MM_DUMP_IN_EVENT_CC 7 +#define MM_DUMP_IN_EVENT_CC 7 -/** \mmcmd Memory Fill -** +/** \mmcmd Memory Fill +** ** \par Description -** Reprograms processor memory with the fill pattern contained -** within the command message +** Reprograms processor memory with the fill pattern contained +** within the command message ** ** \mmcmdmnemonic \MM_FILL ** @@ -578,14 +548,14 @@ ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_FILL ** - \b \c \MM_MEMTYPE - will be set to the commanded memory type -** - \b \c \MM_ADDR - will be set to the fully resolved +** - \b \c \MM_ADDR - will be set to the fully resolved ** destination memory address ** - \b \c MM_FILLPATTERN - will be set to the fill pattern used ** - \b \c \MM_BYTESPROCESSED - will be set to the number of bytes ** filled ** - The #MM_FILL_INF_EID informational event message will ** be generated when the command is executed -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected @@ -594,8 +564,8 @@ ** - The specified data size is invalid ** - The address and data size are not properly aligned ** - The specified memory type is invalid -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_SYMNAME_ERR_EID @@ -606,24 +576,24 @@ ** - Error specific event message #MM_MEMTYPE_ERR_EID ** ** \par Criticality -** It is the responsibility of the user to verify the DestSymAddress, -** and NumOfBytes in the command. It is highly recommended to verify -** the success or failure of the memory fill. The fill may be verified by -** dumping memory and evaluating the dump contents. It is possible to destroy -** critical information with this command causing unknown consequences. In -** addition, it is possible to generate a machine check exception when accessing -** I/O memory addresses/registers and other types of memory. The user +** It is the responsibility of the user to verify the DestSymAddress, +** and NumOfBytes in the command. It is highly recommended to verify +** the success or failure of the memory fill. The fill may be verified by +** dumping memory and evaluating the dump contents. It is possible to destroy +** critical information with this command causing unknown consequences. In +** addition, it is possible to generate a machine check exception when accessing +** I/O memory addresses/registers and other types of memory. The user ** is cautioned to use extreme care. ** -** Note: Valid memory ranges are defined within a hardcoded structure contained in the +** Note: Valid memory ranges are defined within a hardcoded structure contained in the ** PSP layer (CFE_PSP_MemoryTable) however, not every address within the defined ranges ** may be valid. ** */ -#define MM_FILL_MEM_CC 8 +#define MM_FILL_MEM_CC 8 /** \mmcmd Symbol Table Lookup -** +** ** \par Description ** Queries the system symbol table and reports the resolved address ** in telemetry and an informational event message @@ -638,16 +608,16 @@ ** the following telemetry: ** - \b \c \MM_CMDPC - command counter will increment ** - \b \c \MM_LASTACTION - will be set to #MM_SYM_LOOKUP -** - \b \c \MM_ADDR - will be set to the fully resolved +** - \b \c \MM_ADDR - will be set to the fully resolved ** memory address -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected ** - An empty string was specified as the symbol name ** - A symbol name was specified that can't be resolved -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_SYMNAME_NUL_ERR_EID @@ -658,10 +628,10 @@ ** ** \sa #MM_SYMTBL_TO_FILE_CC */ -#define MM_LOOKUP_SYM_CC 9 +#define MM_LOOKUP_SYM_CC 9 /** \mmcmd Save Symbol Table To File -** +** ** \par Description ** Saves the system symbol table to a file that can be transfered ** to the ground @@ -679,14 +649,14 @@ ** - \b \c \MM_FILENAME - will be set to the dump file name ** - The #MM_SYMTBL_TO_FILE_INF_EID informational event message will ** be generated when the command is executed -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected ** - An empty string was specified as the dump filename ** - The OSAL returns a status other than success to the command -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_SYMFILENAME_NUL_ERR_EID @@ -700,10 +670,10 @@ ** ** \sa #MM_LOOKUP_SYM_CC */ -#define MM_SYMTBL_TO_FILE_CC 10 +#define MM_SYMTBL_TO_FILE_CC 10 /** \mmcmd EEPROM Write Enable -** +** ** \par Description ** Enables writing to a specified EEPROM bank ** @@ -719,30 +689,30 @@ ** - \b \c \MM_LASTACTION - will be set to #MM_EEPROMWRITE_ENA ** - The #MM_EEPROM_WRITE_ENA_INF_EID informational event message will ** be generated when the command is executed -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected ** - Non-success return status from PSP write enable -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_EEPROM_WRITE_ENA_ERR_EID ** ** \par Criticality -** Extreme caution is advised in the use of this command. It is intended to be -** used only as a maintence tool for patching the default FSW image. This command -** will leave the EEPROM bank in a very vulnerable state. Once a patch has been -** completed the #MM_DISABLE_EEPROM_WRITE_CC command must be issued to protect the +** Extreme caution is advised in the use of this command. It is intended to be +** used only as a maintence tool for patching the default FSW image. This command +** will leave the EEPROM bank in a very vulnerable state. Once a patch has been +** completed the #MM_DISABLE_EEPROM_WRITE_CC command must be issued to protect the ** EEPROM bank from being inadvertently written. ** ** \sa #MM_DISABLE_EEPROM_WRITE_CC */ -#define MM_ENABLE_EEPROM_WRITE_CC 11 +#define MM_ENABLE_EEPROM_WRITE_CC 11 /** \mmcmd EEPROM Write Disable -** +** ** \par Description ** Disables writing to a specified EEPROM bank ** @@ -758,13 +728,13 @@ ** - \b \c \MM_LASTACTION - will be set to #MM_EEPROMWRITE_DIS ** - The #MM_EEPROM_WRITE_DIS_INF_EID informational event message will ** be generated when the command is executed -** +** ** \par Error Conditions ** This command may fail for the following reason(s): ** - Command packet length not as expected ** - Non-success return status from PSP write disable -** -** \par Evidence of failure may be found in the following telemetry: +** +** \par Evidence of failure may be found in the following telemetry: ** - \b \c \MM_CMDEC - command error counter will increment ** - Error specific event message #MM_LEN_ERR_EID ** - Error specific event message #MM_EEPROM_WRITE_DIS_ERR_EID @@ -774,7 +744,7 @@ ** ** \sa #MM_ENABLE_EEPROM_WRITE_CC */ -#define MM_DISABLE_EEPROM_WRITE_CC 12 +#define MM_DISABLE_EEPROM_WRITE_CC 12 #endif /* _mm_msgdefs_ */ diff --git a/fsw/src/mm_utils.c b/fsw/src/mm_utils.c index 42d6b6c..8e97937 100644 --- a/fsw/src/mm_utils.c +++ b/fsw/src/mm_utils.c @@ -1,46 +1,18 @@ /************************************************************************* -** File: -** $Id: mm_utils.c 1.2 2016/10/30 00:48:49EDT mdeschu Exp $ +** File: mm_utils.c ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Utility functions used for processing CFS memory manager commands ** -** $Log: mm_utils.c $ -** Revision 1.2 2016/10/30 00:48:49EDT mdeschu -** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent -** Revision 1.1 2015/07/28 12:22:04EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.11 2015/03/20 14:16:35EDT lwalling -** Add last peek/poke/fill command data value to housekeeping telemetry -** Revision 1.10 2015/03/02 14:27:10EST sstrege -** Added copyright information -** Revision 1.9 2010/11/29 13:35:17EST jmdagost -** Replaced ifdef tests with if-true tests. -** Revision 1.8 2009/06/18 10:17:09EDT rmcgraw -** DCR8291:1 Changed OS_MEM_ #defines to CFE_PSP_MEM_ -** Revision 1.7 2009/06/12 14:37:28EDT rmcgraw -** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem -** Revision 1.6 2008/09/05 14:24:12EDT dahardison -** Updated references to local HK variables -** Revision 1.5 2008/09/05 12:33:08EDT dahardison -** Modified the MM_VerifyCmdLength routine to issue a special error event message and -** not increment the command error counter if a housekeeping request is received -** with a bad command length -** Revision 1.4 2008/05/22 15:13:56EDT dahardison -** Changed inclusion of cfs_lib.h to cfs_utils.h -** Revision 1.3 2008/05/19 15:23:35EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ /************************************************************************* @@ -52,6 +24,7 @@ #include "mm_msgids.h" #include "mm_events.h" #include "cfs_utils.h" +#include "mm_dump.h" #include /************************************************************************* @@ -63,19 +36,19 @@ extern MM_AppData_t MM_AppData; /* */ /* Reset the local housekeeping variables to default parameters */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void MM_ResetHk(void) { - - MM_AppData.LastAction = MM_NOACTION; - MM_AppData.MemType = MM_NOMEMTYPE; - MM_AppData.Address = MM_CLEAR_ADDR; - MM_AppData.DataValue = MM_CLEAR_PATTERN; - MM_AppData.BytesProcessed = 0; - MM_AppData.FileName[0] = MM_CLEAR_FNAME; - - return; - + + MM_AppData.HkPacket.LastAction = MM_NOACTION; + MM_AppData.HkPacket.MemType = MM_NOMEMTYPE; + MM_AppData.HkPacket.Address = MM_CLEAR_ADDR; + MM_AppData.HkPacket.DataValue = MM_CLEAR_PATTERN; + MM_AppData.HkPacket.BytesProcessed = 0; + MM_AppData.HkPacket.FileName[0] = MM_CLEAR_FNAME; + + return; + } /* end MM_ResetHk */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -85,22 +58,22 @@ void MM_ResetHk(void) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void MM_SegmentBreak(void) { - /* - ** Performance Log entry stamp - */ - CFE_ES_PerfLogEntry(MM_SEGBREAK_PERF_ID); - - /* - ** Give something else the chance to run - */ - OS_TaskDelay(MM_PROCESSOR_CYCLE); - - /* - ** Performance Log exit stamp - */ - CFE_ES_PerfLogExit(MM_SEGBREAK_PERF_ID); - - return; + /* + ** Performance Log entry stamp + */ + CFE_ES_PerfLogEntry(MM_SEGBREAK_PERF_ID); + + /* + ** Give something else the chance to run + */ + OS_TaskDelay(MM_PROCESSOR_CYCLE); + + /* + ** Performance Log exit stamp + */ + CFE_ES_PerfLogExit(MM_SEGBREAK_PERF_ID); + + return; } /* End of MM_SegmentBreak */ @@ -109,45 +82,45 @@ void MM_SegmentBreak(void) /* Verify command packet length */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyCmdLength(CFE_SB_MsgPtr_t msg, - uint16 ExpectedLength) +bool MM_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) { - boolean result = TRUE; - uint16 CommandCode; - uint16 ActualLength; - CFE_SB_MsgId_t MessageID; - - /* - ** Verify the message packet length... - */ - ActualLength = CFE_SB_GetTotalMsgLength(msg); - if (ExpectedLength != ActualLength) - { - MessageID = CFE_SB_GetMsgId(msg); - CommandCode = CFE_SB_GetCmdCode(msg); - - if (MessageID == MM_SEND_HK_MID) - { - /* - ** For a bad HK request, just send the event. We only increment - ** the error counter for ground commands and not internal messages. - */ - CFE_EVS_SendEvent(MM_HKREQ_LEN_ERR_EID, CFE_EVS_ERROR, - "Invalid HK request msg length: ID = 0x%04X, CC = %d, Len = %d, Expected = %d", - MessageID, CommandCode, ActualLength, ExpectedLength); - } - else - { - CFE_EVS_SendEvent(MM_LEN_ERR_EID, CFE_EVS_ERROR, - "Invalid msg length: ID = 0x%04X, CC = %d, Len = %d, Expected = %d", - MessageID, CommandCode, ActualLength, ExpectedLength); - MM_AppData.ErrCounter++; - } - - result = FALSE; - } - - return(result); + bool result = true; + size_t ActualLength = 0; + CFE_MSG_FcnCode_t CommandCode = 0; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + + /* + ** Verify the message packet length... + */ + + CFE_MSG_GetSize(MsgPtr, &ActualLength); + if (ExpectedLength != ActualLength) + { + + CFE_MSG_GetMsgId(MsgPtr, &MessageID); + CFE_MSG_GetFcnCode(MsgPtr, &CommandCode); + + if (MessageID == MM_SEND_HK_MID) + { + /* + ** For a bad HK request, just send the event. We only increment + ** the error counter for ground commands and not internal messages. + */ + CFE_EVS_SendEvent(MM_HKREQ_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid HK request msg length: ID = 0x%08X, CC = %d, Len = %d, Expected = %d", MessageID, + CommandCode, (int)ActualLength, (int)ExpectedLength); + } + else + { + CFE_EVS_SendEvent(MM_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid msg length: ID = 0x%08X, CC = %d, Len = %d, Expected = %d", MessageID, + CommandCode, (int)ActualLength, (int)ExpectedLength); + } + + result = false; + } + + return (result); } /* End of MM_VerifyCmdLength */ @@ -155,176 +128,345 @@ boolean MM_VerifyCmdLength(CFE_SB_MsgPtr_t msg, /* */ /* Verify peek and poke command parameters */ /* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -boolean MM_VerifyPeekPokeParams(uint32 Address, - uint8 MemType, - uint8 SizeInBits) +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_VerifyPeekPokeParams(cpuaddr Address, uint8 MemType, uint8 SizeInBits) { - boolean Valid = TRUE; - uint8 SizeInBytes; - int32 OS_Status; - - switch(SizeInBits) - { - case MM_BYTE_BIT_WIDTH: - SizeInBytes = 1; - break; - - case MM_WORD_BIT_WIDTH: - SizeInBytes = 2; - if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, SizeInBytes); - - - } - break; - - case MM_DWORD_BIT_WIDTH: - SizeInBytes = 4; - if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - (unsigned int)Address, SizeInBytes); - } - break; - - default: - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - "Data size in bits invalid: Data Size = %d", SizeInBits); - break; - } - - /* Do other checks if this one passed */ - if (Valid == TRUE) - { - switch(MemType) - { - case MM_RAM: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - } + bool Valid = true; + uint8 SizeInBytes; + int32 OS_Status; + + switch (SizeInBits) + { + case MM_BYTE_BIT_WIDTH: + SizeInBytes = 1; break; - - case MM_EEPROM: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - - if (OS_Status != OS_SUCCESS) + + case MM_WORD_BIT_WIDTH: + SizeInBytes = 2; + if (CFS_Verify16Aligned(Address, SizeInBytes) != true) { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_EEPROM); + Valid = false; + CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_EventType_ERROR, + "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", (unsigned int)Address, + SizeInBytes); } break; - -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - case MM_MEM32: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - } - /* - ** Peeks and Pokes must be 32 bits wide for this memory type - */ - else if (SizeInBytes != 4) + + case MM_DWORD_BIT_WIDTH: + SizeInBytes = 4; + if (CFS_Verify32Aligned(Address, SizeInBytes) != true) { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - "Data size in bits invalid: Data Size = %d", SizeInBits); + Valid = false; + CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_EventType_ERROR, + "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", (unsigned int)Address, + SizeInBytes); } break; -#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - case MM_MEM16: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - } - /* - ** Peeks and Pokes must be 16 bits wide for this memory type - */ - else if (SizeInBytes != 2) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - "Data size in bits invalid: Data Size = %d", SizeInBits); - } + default: + Valid = false; + CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_EventType_ERROR, + "Data size in bits invalid: Data Size = %d", SizeInBits); break; + } + + /* Do other checks if this one passed */ + if (Valid == true) + { + switch (MemType) + { + case MM_RAM: + OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); + + if (OS_Status != CFE_PSP_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d " + "MemType = MEM_RAM", + (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes); + } + break; + + case MM_EEPROM: + OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); + + if (OS_Status != CFE_PSP_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d " + "MemType = MEM_EEPROM", + (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes); + } + break; + +#ifdef MM_OPT_CODE_MEM32_MEMTYPE + case MM_MEM32: + OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); + + if (OS_Status != CFE_PSP_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent( + MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = MEM32", + (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes); + } + /* + ** Peeks and Pokes must be 32 bits wide for this memory type + */ + else if (SizeInBytes != 4) + { + Valid = false; + CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_EventType_ERROR, + "Data size in bits invalid: Data Size = %d", SizeInBits); + } + break; +#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ + +#ifdef MM_OPT_CODE_MEM16_MEMTYPE + case MM_MEM16: + OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); + + if (OS_Status != CFE_PSP_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent( + MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = MEM16", + (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes); + } + /* + ** Peeks and Pokes must be 16 bits wide for this memory type + */ + else if (SizeInBytes != 2) + { + Valid = false; + CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_EventType_ERROR, + "Data size in bits invalid: Data Size = %d", SizeInBits); + } + break; #endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - case MM_MEM8: - OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - - if (OS_Status != OS_SUCCESS) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - } - /* - ** Peeks and Pokes must be 8 bits wide for this memory type - */ - else if (SizeInBytes != 1) - { - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - "Data size in bits invalid: Data Size = %d", SizeInBits); - } - break; + +#ifdef MM_OPT_CODE_MEM8_MEMTYPE + case MM_MEM8: + OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); + + if (OS_Status != CFE_PSP_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent( + MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = MEM8", + (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes); + } + /* + ** Peeks and Pokes must be 8 bits wide for this memory type + */ + else if (SizeInBytes != 1) + { + Valid = false; + CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_EventType_ERROR, + "Data size in bits invalid: Data Size = %d", SizeInBits); + } + break; #endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - - default: - Valid = FALSE; - MM_AppData.ErrCounter++; - CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - "Invalid memory type specified: MemType = %d", MemType); - break; - - } /* end switch */ - } /* end Valid == TRUE if */ - - return (Valid); + default: + Valid = false; + CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid memory type specified: MemType = %d", MemType); + break; + + } /* end switch */ + + } /* end Valid == true if */ + + return (Valid); } /* end MM_VerifyPeekPokeParams */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* */ +/* Verify load/dump memory parameters */ +/* */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +bool MM_VerifyLoadDumpParams(cpuaddr Address, uint8 MemType, uint32 SizeInBytes, uint8 VerifyType) +{ + bool Valid = true; + int32 PSP_Status; + uint32 MaxSize = 0; + uint32 PSP_MemType = 0; + char MemTypeStr[MM_MAX_MEM_TYPE_STR_LEN]; + + if ((VerifyType != MM_VERIFY_LOAD) && (VerifyType != MM_VERIFY_DUMP) && (VerifyType != MM_VERIFY_EVENT) && + (VerifyType != MM_VERIFY_FILL) && (VerifyType != MM_VERIFY_WID)) + { + Valid = false; + } + + /* The DumpInEvent and LoadMemWID commands use the same max size for all + * memory types. Therefore if one of these is the command being verified, + * the max size can be set here rather than in the switch statement */ + if (VerifyType == MM_VERIFY_EVENT) + { + MaxSize = MM_MAX_DUMP_INEVENT_BYTES; + } + else if (VerifyType == MM_VERIFY_WID) + { + MaxSize = MM_MAX_UNINTERRUPTIBLE_DATA; + } + + if (Valid) + { + /* All memory types and verification types do fundamentally the same set + of checks. This switch-case statement sets up the values used to + perform the checks at the end of the function. Two memory types + also require special handling which is performed in the appropriate + case. */ + switch (MemType) + { + /* else clauses are not needed in the VerifyType checks because the + VerifyType is checked above and if the MaxSize is left unchanged, + it will force an error when the size is checked as it should */ + case MM_RAM: + if (VerifyType == MM_VERIFY_LOAD) + { + MaxSize = MM_MAX_LOAD_FILE_DATA_RAM; + } + else if (VerifyType == MM_VERIFY_DUMP) + { + MaxSize = MM_MAX_DUMP_FILE_DATA_RAM; + } + else if (VerifyType == MM_VERIFY_FILL) + { + MaxSize = MM_MAX_FILL_DATA_RAM; + } + PSP_MemType = CFE_PSP_MEM_RAM; + snprintf(MemTypeStr, MM_MAX_MEM_TYPE_STR_LEN, "%s", "MEM_RAM"); + break; + case MM_EEPROM: + if (VerifyType == MM_VERIFY_LOAD) + { + MaxSize = MM_MAX_LOAD_FILE_DATA_EEPROM; + } + else if (VerifyType == MM_VERIFY_DUMP) + { + MaxSize = MM_MAX_DUMP_FILE_DATA_EEPROM; + } + else if (VerifyType == MM_VERIFY_FILL) + { + MaxSize = MM_MAX_FILL_DATA_EEPROM; + } + PSP_MemType = CFE_PSP_MEM_EEPROM; + snprintf(MemTypeStr, MM_MAX_MEM_TYPE_STR_LEN, "%s", "MEM_EEPROM"); + break; +#ifdef MM_OPT_CODE_MEM32_MEMTYPE + case MM_MEM32: + if (VerifyType == MM_VERIFY_LOAD) + { + MaxSize = MM_MAX_LOAD_FILE_DATA_MEM32; + } + else if (VerifyType == MM_VERIFY_DUMP) + { + MaxSize = MM_MAX_DUMP_FILE_DATA_MEM32; + } + else if (VerifyType == MM_VERIFY_FILL) + { + MaxSize = MM_MAX_FILL_DATA_MEM32; + } + PSP_MemType = CFE_PSP_MEM_RAM; + snprintf(MemTypeStr, MM_MAX_MEM_TYPE_STR_LEN, "%s", "MEM32"); + if (CFS_Verify32Aligned(Address, SizeInBytes) != true) + { + Valid = false; + CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_EventType_ERROR, + "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", + (unsigned int)Address, (int)SizeInBytes); + } + break; +#endif +#ifdef MM_OPT_CODE_MEM16_MEMTYPE + case MM_MEM16: + if (VerifyType == MM_VERIFY_LOAD) + { + MaxSize = MM_MAX_LOAD_FILE_DATA_MEM16; + } + else if (VerifyType == MM_VERIFY_DUMP) + { + MaxSize = MM_MAX_DUMP_FILE_DATA_MEM16; + } + else if (VerifyType == MM_VERIFY_FILL) + { + MaxSize = MM_MAX_FILL_DATA_MEM16; + } + PSP_MemType = CFE_PSP_MEM_RAM; + snprintf(MemTypeStr, MM_MAX_MEM_TYPE_STR_LEN, "%s", "MEM16"); + if (CFS_Verify16Aligned(Address, SizeInBytes) != true) + { + Valid = false; + CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_EventType_ERROR, + "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", + (unsigned int)Address, (int)SizeInBytes); + } + break; +#endif +#ifdef MM_OPT_CODE_MEM8_MEMTYPE + case MM_MEM8: + if (VerifyType == MM_VERIFY_LOAD) + { + MaxSize = MM_MAX_LOAD_FILE_DATA_MEM8; + } + else if (VerifyType == MM_VERIFY_DUMP) + { + MaxSize = MM_MAX_DUMP_FILE_DATA_MEM8; + } + else if (VerifyType == MM_VERIFY_FILL) + { + MaxSize = MM_MAX_FILL_DATA_MEM8; + } + PSP_MemType = CFE_PSP_MEM_RAM; + snprintf(MemTypeStr, MM_MAX_MEM_TYPE_STR_LEN, "%s", "MEM8"); + break; +#endif + default: + Valid = false; + CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid memory type specified: MemType = %d", MemType); + + break; + } /* end MemType switch */ + } + + if (Valid) + { + if ((SizeInBytes == 0) || (SizeInBytes > MaxSize)) + { + Valid = false; + CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_EventType_ERROR, + "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); + } + } + + if (Valid) + { + PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, PSP_MemType); + + if (PSP_Status != CFE_PSP_SUCCESS) + { + Valid = false; + CFE_EVS_SendEvent( + MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_EventType_ERROR, + "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %s", + (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, MemTypeStr); + } + } + + return (Valid); + +} /* end MM_VerifyFileLoadDumpParams */ + /************************/ /* End of File Comment */ /************************/ diff --git a/fsw/src/mm_utils.h b/fsw/src/mm_utils.h index fac9d50..8619c2d 100644 --- a/fsw/src/mm_utils.h +++ b/fsw/src/mm_utils.h @@ -1,37 +1,18 @@ /************************************************************************* -** File: -** $Id: mm_utils.h 1.1 2015/07/28 12:22:06EDT rperera Exp $ +** File: mm_utils.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Specification for the CFS Memory Manager utility functions. ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_utils.h $ -** Revision 1.1 2015/07/28 12:22:06EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.5 2015/03/02 14:27:07EST sstrege -** Added copyright information -** Revision 1.4 2008/09/05 14:23:56EDT dahardison -** Updated references to local HK variables -** Revision 1.3 2008/05/19 15:23:39EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_utils_ #define _mm_utils_ @@ -47,7 +28,7 @@ /************************************************************************/ /** \brief Reset housekeeping variables -** +** ** \par Description ** Sets the local memory manager housekeeping variables to default ** values. This routine gets called before each command is @@ -56,27 +37,27 @@ ** \par Assumptions, External Events, and Notes: ** This function does not zero the command execution counter ** or the command error counter -** +** *************************************************************************/ void MM_ResetHk(void); - + /************************************************************************/ /** \brief Segment break -** +** ** \par Description -** This routine gets called during each segment break in a load, +** This routine gets called during each segment break in a load, ** dump, or memory fill operation and handles any processing ** that needs to be done during those breaks ** ** \par Assumptions, External Events, and Notes: ** None -** +** *************************************************************************/ void MM_SegmentBreak(void); - + /************************************************************************/ /** \brief Verify command message length -** +** ** \par Description ** This routine will check if the actual length of a software bus ** command message matches the expected length and send an @@ -84,53 +65,82 @@ void MM_SegmentBreak(void); ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] msg A #CFE_SB_MsgPtr_t pointer that -** references the software bus message +** +** \param [in] MsgPtr A #CFE_MSG_Message_t* pointer that +** references the software bus message ** ** \param [in] ExpectedLength The expected length of the message ** based upon the command code ** ** \returns -** \retstmt Returns TRUE if the length is as expected \endcode -** \retstmt Returns FALSE if the length is not as expected \endcode +** \retstmt Returns true if the length is as expected \endcode +** \retstmt Returns false if the length is not as expected \endcode ** \endreturns ** ** \sa #MM_LEN_ERR_EID ** *************************************************************************/ -boolean MM_VerifyCmdLength(CFE_SB_MsgPtr_t msg, - uint16 ExpectedLength); +bool MM_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); /************************************************************************/ /** \brief Verify memory peek and poke parameters -** +** ** \par Description -** This routine will run various checks on the specified address, +** This routine will run various checks on the specified address, ** memory type, and data size (in bits) for a memory peek or ** memory poke command ** ** \par Assumptions, External Events, and Notes: ** None -** -** \param [in] Address The source or destination address for the -** requested peek or poke operation ** -** \param [in] MemType The source or destination memory type for +** \param [in] Address The source or destination address for the +** requested peek or poke operation +** +** \param [in] MemType The source or destination memory type for ** the requested peek or poke operation -** -** \param [in] SizeInBits The bit width for the requested -** peek or poke operation +** +** \param [in] SizeInBits The bit width for the requested +** peek or poke operation +** +** \returns +** \retstmt Returns true if all the parameter checks passed \endcode +** \retstmt Returns false any parameter check failed \endcode +** \endreturns +** +*************************************************************************/ +bool MM_VerifyPeekPokeParams(cpuaddr Address, uint8 MemType, uint8 SizeInBits); + +/************************************************************************/ +/** \brief Verify memory load and dump parameters +** +** \par Description +** This routine will run various checks on the specified address, +** memory type, and data size (in bits) for a memory load or +** memory dump command. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param [in] Address The source or destination address for the +** requested load or dump operation +** +** \param [in] MemType The source or destination memory type for +** the requested load or dump operation +** +** \param [in] SizeInBits The bit width for the requested +** load or dump operation +** +** \param [in] VerifyType Flag indicating whether the requested +** operation is a load or a dump. ** ** \returns -** \retstmt Returns TRUE if all the parameter checks passed \endcode -** \retstmt Returns FALSE any parameter check failed \endcode +** \retstmt Returns true if all the parameter checks passed \endcode +** \retstmt Returns false any parameter check failed \endcode ** \endreturns ** *************************************************************************/ -boolean MM_VerifyPeekPokeParams(uint32 Address, - uint8 MemType, - uint8 SizeInBits); + +bool MM_VerifyLoadDumpParams(cpuaddr Address, uint8 MemType, uint32 SizeInBytes, uint8 VerifyType); #endif /* _mm_utils_ */ diff --git a/fsw/src/mm_verify.h b/fsw/src/mm_verify.h index de7f1d7..c4d53a4 100644 --- a/fsw/src/mm_verify.h +++ b/fsw/src/mm_verify.h @@ -1,43 +1,19 @@ /************************************************************************* -** File: -** $Id: mm_verify.h 1.1 2015/07/28 12:22:08EDT rperera Exp $ +** File: mm_verify.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: +** Purpose: ** Contains CFS Memory Manager macros that run preprocessor checks ** on mission configurable parameters ** -** References: -** Flight Software Branch C Coding Standard Version 1.2 -** CFS Development Standards Document -** CFS MM Heritage Analysis Document -** CFS MM CDR Package -** -** Notes: -** -** $Log: mm_verify.h $ -** Revision 1.1 2015/07/28 12:22:08EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.7 2015/03/02 14:26:30EST sstrege -** Added copyright information -** Revision 1.6 2011/11/30 15:54:48EST jmdagost -** Deleted tests of the default algorithm definitions. -** Revision 1.5 2010/11/29 13:28:52EST jmdagost -** Updated and corrected verification tests. -** Revision 1.4 2008/09/05 13:14:30EDT dahardison -** Added inclusion of mm_mission_cfg.h -** Revision 1.3 2008/05/19 15:23:42EDT dahardison -** Version after completion of unit testing -** *************************************************************************/ #ifndef _mm_verify_ #define _mm_verify_ @@ -47,108 +23,230 @@ *************************************************************************/ #include "mm_mission_cfg.h" #include "mm_platform_cfg.h" +#include "stdint.h" /************************************************************************* ** Macro Definitions *************************************************************************/ + +/* +** Maximum value of the subtype +*/ +#if MM_CFE_HDR_SUBTYPE > UINT32_MAX +#error MM_CFE_HDR_SUBTYPE cannot exceed the uint32 maximum value +#endif + +/* +** Maximum number of bytes for a file load to RAM memory +*/ +#if MM_MAX_LOAD_FILE_DATA_RAM > UINT32_MAX +#error MM_MAX_LOAD_FILE_DATA_RAM cannot exceed the uint32 maximum value +#endif + +/* +** Maximum number of bytes for a file load to EEPROM memory +*/ +#if MM_MAX_LOAD_FILE_DATA_EEPROM > UINT32_MAX +#error MM_MAX_LOAD_FILE_DATA_EEPROM cannot exceed the uint32 maximum value +#endif + /* ** Maximum number of bytes for an uninterruptable load */ -#if MM_MAX_UNINTERRUPTABLE_DATA < 1 - #error MM_MAX_UNINTERRUPTABLE_DATA cannot be less than 1 -#elif MM_MAX_UNINTERRUPTABLE_DATA > 255 - #error MM_MAX_UNINTERRUPTABLE_DATA should be less than 256 Bytes -#endif +#if MM_MAX_UNINTERRUPTIBLE_DATA < 1 +#error MM_MAX_UNINTERRUPTIBLE_DATA cannot be less than 1 +#elif MM_MAX_UNINTERRUPTIBLE_DATA > 255 +#error MM_MAX_UNINTERRUPTIBLE_DATA should be less than 256 Bytes +#endif -#if (MM_OPT_CODE_MEM32_MEMTYPE != TRUE) && (MM_OPT_CODE_MEM32_MEMTYPE != FALSE) - #error MM_OPT_CODE_MEM32_MEMTYPE must be either TRUE or FALSE +/* +** Maximum number of bytes for a file dump from RAM memory +*/ +#if MM_MAX_DUMP_FILE_DATA_RAM > UINT32_MAX +#error MM_MAX_DUMP_FILE_DATA_RAM cannot exceed the uint32 maximum value #endif -#if (MM_OPT_CODE_MEM16_MEMTYPE != TRUE) && (MM_OPT_CODE_MEM16_MEMTYPE != FALSE) - #error MM_OPT_CODE_MEM16_MEMTYPE must be either TRUE or FALSE +/* +** Maximum number of bytes for a file dump from EEPROM memory +*/ +#if MM_MAX_DUMP_FILE_DATA_EEPROM > UINT32_MAX +#error MM_MAX_DUMP_FILE_DATA_EEPROM cannot exceed the uint32 maximum value +#endif + +/* +** Maximum number of bytes for a file dump of the symbol table +*/ +#if MM_MAX_DUMP_FILE_DATA_SYMTBL > UINT32_MAX +#error MM_MAX_DUMP_FILE_DATA_SYMTBL cannot exceed the uint32 maximum value +#endif + +/* +** Maximum number of bytes that can be dumped per task cycle +*/ +#if MM_MAX_DUMP_DATA_SEG > UINT32_MAX +#error MM_MAX_DUMP_DATA_SEG cannot exceed the uint32 maximum value #endif -#if (MM_OPT_CODE_MEM8_MEMTYPE != TRUE) && (MM_OPT_CODE_MEM8_MEMTYPE != FALSE) - #error MM_OPT_CODE_MEM8_MEMTYPE must be either TRUE or FALSE +/* +** Maximum number of bytes for a fill to RAM memory +*/ +#if MM_MAX_FILL_DATA_RAM > UINT32_MAX +#error MM_MAX_FILL_DATA_RAM cannot exceed the uint32 maximum value +#endif + +/* +** Maximum number of bytes for a fill to EEPROM memory +*/ +#if MM_MAX_FILL_DATA_EEPROM > UINT32_MAX +#error MM_MAX_FILL_DATA_EEPROM cannot exceed the uint32 maximum value +#endif + +/* +** Maximum number of bytes that can be filled per task cycle +*/ +#if MM_MAX_FILL_DATA_SEG > UINT32_MAX +#error MM_MAX_FILL_DATA_SEG cannot exceed the uint32 maximum value #endif /* ** Minimum size for max load file defaults */ #if MM_MAX_LOAD_FILE_DATA_RAM < 1 - #error MM_MAX_LOAD_FILE_DATA_RAM cannot be less than 1 +#error MM_MAX_LOAD_FILE_DATA_RAM cannot be less than 1 #endif #if MM_MAX_LOAD_FILE_DATA_EEPROM < 1 - #error MM_MAX_LOAD_FILE_DATA_EEPROM cannot be less than 1 +#error MM_MAX_LOAD_FILE_DATA_EEPROM cannot be less than 1 #endif /* ** Minimum size for max load data segment */ #if MM_MAX_LOAD_DATA_SEG < 4 - #error MM_MAX_LOAD_DATA_SEG cannot be less than 4 +#error MM_MAX_LOAD_DATA_SEG cannot be less than 4 #endif /* ** Minimum size for max fill data segment */ #if MM_MAX_FILL_DATA_SEG < 4 - #error MM_MAX_FILL_DATA_SEG cannot be less than 4 +#error MM_MAX_FILL_DATA_SEG cannot be less than 4 #endif /* ** Dump, load, and fill data segment sizes */ #if (MM_MAX_LOAD_DATA_SEG % 4) != 0 - #error MM_MAX_LOAD_DATA_SEG should be longword aligned -#endif +#error MM_MAX_LOAD_DATA_SEG should be longword aligned +#endif #if (MM_MAX_DUMP_DATA_SEG % 4) != 0 - #error MM_MAX_DUMP_DATA_SEG should be longword aligned -#endif +#error MM_MAX_DUMP_DATA_SEG should be longword aligned +#endif #if (MM_MAX_FILL_DATA_SEG % 4) != 0 - #error MM_MAX_FILL_DATA_SEG should be longword aligned -#endif +#error MM_MAX_FILL_DATA_SEG should be longword aligned +#endif /* -** Optional MEM32 Configurable Parameters +** Optional MEM32 Configurable Parameters */ -#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) +#ifdef MM_OPT_CODE_MEM32_MEMTYPE #if (MM_MAX_LOAD_FILE_DATA_MEM32 % 4) != 0 - #error MM_MAX_LOAD_FILE_DATA_MEM32 should be longword aligned -#endif +#error MM_MAX_LOAD_FILE_DATA_MEM32 should be longword aligned +#endif #if (MM_MAX_DUMP_FILE_DATA_MEM32 % 4) != 0 - #error MM_MAX_DUMP_FILE_DATA_MEM32 should be longword aligned -#endif +#error MM_MAX_DUMP_FILE_DATA_MEM32 should be longword aligned +#endif #if (MM_MAX_FILL_DATA_MEM32 % 4) != 0 - #error MM_MAX_FILL_DATA_MEM32 should be longword aligned -#endif +#error MM_MAX_FILL_DATA_MEM32 should be longword aligned +#endif + +/* Maximum number of bytes for a file load to MEM32 memory */ +#if MM_MAX_LOAD_FILE_DATA_MEM32 > UINT32_MAX +#error MM_MAX_LOAD_FILE_DATA_MEM32 cannot exceed the uint32 maximum value +#endif -#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ +/* Maximum number of bytes for a file dump from MEM32 memory */ +#if MM_MAX_DUMP_FILE_DATA_MEM32 > UINT32_MAX +#error MM_MAX_DUMP_FILE_DATA_MEM32 cannot exceed the uint32 maximum value +#endif + +/* Maximum number of bytes for a fill to MEM32 memory */ +#if MM_MAX_FILL_DATA_MEM32 > UINT32_MAX +#error MM_MAX_FILL_DATA_MEM32 cannot exceed the uint32 maximum value +#endif + +#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ /* -** Optional MEM16 Configurable Parameters +** Optional MEM16 Configurable Parameters */ -#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) +#ifdef MM_OPT_CODE_MEM16_MEMTYPE #if (MM_MAX_LOAD_FILE_DATA_MEM16 % 2) != 0 - #error MM_MAX_LOAD_FILE_DATA_MEM16 should be word aligned -#endif +#error MM_MAX_LOAD_FILE_DATA_MEM16 should be word aligned +#endif #if (MM_MAX_DUMP_FILE_DATA_MEM16 % 2) != 0 - #error MM_MAX_DUMP_FILE_DATA_MEM16 should be word aligned -#endif +#error MM_MAX_DUMP_FILE_DATA_MEM16 should be word aligned +#endif #if (MM_MAX_FILL_DATA_MEM16 % 2) != 0 - #error MM_MAX_FILL_DATA_MEM16 should be word aligned -#endif +#error MM_MAX_FILL_DATA_MEM16 should be word aligned +#endif + +/* Maximum number of bytes for a fill to MEM16 memory */ +#if MM_MAX_FILL_DATA_MEM16 > UINT32_MAX +#error MM_MAX_FILL_DATA_MEM16 cannot exceed the uint32 maximum value +#endif -#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ +/* Maximum number of bytes for a file load to MEM16 memory */ +#if MM_MAX_LOAD_FILE_DATA_MEM16 > UINT32_MAX +#error MM_MAX_LOAD_FILE_DATA_MEM16 cannot exceed the uint32 maximum value +#endif + +/* Maximum number of bytes for a file dump from MEM16 memory */ +#if MM_MAX_DUMP_FILE_DATA_MEM16 > UINT32_MAX +#error MM_MAX_DUMP_FILE_DATA_MEM16 cannot exceed the uint32 maximum value +#endif + +#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ + +/* +** Optional MEM8 Configurable Parameters +*/ +#ifdef MM_OPT_CODE_MEM8_MEMTYPE + +/* Maximum number of bytes for a fill to MEM8 memory */ +#if MM_MAX_FILL_DATA_MEM8 > UINT32_MAX +#error MM_MAX_FILL_DATA_MEM8 cannot exceed the uint32 maximum value +#endif + +/* Maximum number of bytes for a file load to MEM8 memory */ +#if MM_MAX_LOAD_FILE_DATA_MEM8 > UINT32_MAX +#error MM_MAX_LOAD_FILE_DATA_MEM8 cannot exceed the uint32 maximum value +#endif + +/* Maximum number of bytes for a file dump from MEM8 memory */ +#if MM_MAX_DUMP_FILE_DATA_MEM8 > UINT32_MAX +#error MM_MAX_DUMP_FILE_DATA_MEM8 cannot exceed the uint32 maximum value +#endif + +#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ + +#if MM_LOAD_WID_CRC_TYPE != CFE_MISSION_ES_DEFAULT_CRC +#error MM_LOAD_WID_CRC_TYPE must be a type supported by CFE_ES_CalculateCRC +#endif +#if MM_LOAD_FILE_CRC_TYPE != CFE_MISSION_ES_DEFAULT_CRC +#error MM_LOAD_FILE_CRC_TYPE must be a type supported by CFE_ES_CalculateCRC +#endif +#if MM_DUMP_FILE_CRC_TYPE != CFE_MISSION_ES_DEFAULT_CRC +#error MM_DUMP_FILE_CRC_TYPE must be a type supported by CFE_ES_CalculateCRC +#endif #endif /*_mm_verify_*/ diff --git a/fsw/src/mm_version.h b/fsw/src/mm_version.h index 9d37884..ec9d193 100644 --- a/fsw/src/mm_version.h +++ b/fsw/src/mm_version.h @@ -1,40 +1,19 @@ /************************************************************************ -** File: -** $Id: mm_version.h 1.1.2.3 2016/11/17 16:42:16EST sstrege Exp $ +** File: mm_version.h ** -** Copyright © 2007-2014 United States Government as represented by the -** Administrator of the National Aeronautics and Space Administration. -** All Other Rights Reserved. +** Copyright © 2007-2014 United States Government as represented by the +** Administrator of the National Aeronautics and Space Administration. +** All Other Rights Reserved. ** ** This software was created at NASA's Goddard Space Flight Center. -** This software is governed by the NASA Open Source Agreement and may be -** used, distributed and modified only pursuant to the terms of that +** This software is governed by the NASA Open Source Agreement and may be +** used, distributed and modified only pursuant to the terms of that ** agreement. ** -** Purpose: -** Contains version tags for the Core Flight System (CFS) -** Memory Manager (MM) Application. +** Purpose: +** Contains version tags for the Core Flight System (CFS) +** Memory Manager (MM) Application. ** -** Notes: -** -** $Log: mm_version.h $ -** Revision 1.1.2.3 2016/11/17 16:42:16EST sstrege -** Changing version number for the release to 2.4.1 -** Revision 1.1.2.2 2016/11/04 13:24:48EDT sstrege -** Changing version number for the branch tip to 9.9.9 -** Revision 1.1.2.1 2016/11/04 13:21:04EDT sstrege -** Changing the version number for the branch to 2.4.1 -** Revision 1.1 2015/07/28 12:22:09EDT rperera -** Initial revision -** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj -** Revision 1.2.3.1 2015/03/02 14:28:56EST sstrege -** Added copyright information -** Revision 1.2 2010/11/26 13:04:19EST jmdagost -** Moved mission revision number to mm_platform_cfg.h -** Revision 1.1 2008/09/06 15:31:23EDT dahardison -** Initial revision -** Member added to project c:/MKSDATA/MKS-REPOSITORY/CFS-REPOSITORY/mm/fsw/src/project.pj -** *************************************************************************/ #ifndef _mm_version_ #define _mm_version_ @@ -43,11 +22,11 @@ ** Macro Definitions *************************************************************************/ /** -** \name MM Version Identifiers */ +** \name MM Version Identifiers */ /** \{ */ -#define MM_MAJOR_VERSION 2 -#define MM_MINOR_VERSION 4 -#define MM_REVISION 1 +#define MM_MAJOR_VERSION 2 +#define MM_MINOR_VERSION 5 +#define MM_REVISION 0 /** \} */ #endif /* _mm_version_ */ diff --git a/fsw/unit_test/README.txt b/fsw/unit_test/README.txt deleted file mode 100644 index 3eb0722..0000000 --- a/fsw/unit_test/README.txt +++ /dev/null @@ -1,74 +0,0 @@ -############################################################################## -## $Id: README.txt 1.4 2016/10/31 22:11:03EDT mdeschu Exp $ -## -## Purpose: CFS MM application unit test instructions, results, and code coverage -## -## Author: Charles Zogby -## -## $Log: README.txt $ -## Revision 1.4 2016/10/31 22:11:03EDT mdeschu -## Update gcov results, README and log file for MM unit tests for 2.4.1 -## Revision 1.3 2016/10/24 18:35:24EDT czogby -## Code Walkthough Updates -## Revision 1.2 2016/03/04 20:07:42EST czogby -## Update log file for run with official release of MM 2.4.0 -## Revision 1.1 2016/02/03 17:11:38EST czogby -## Initial revision -## Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj -############################################################################## - - -------------------------- -MM Unit Test Instructions -------------------------- -This unit test was run in a virtual machine running CentOS and uses the ut-assert stubs and default hooks for the -cFE, OSAL and PSP. The ut-assert framework, stubs, and hooks are located in the directory cfe/tools/ut-assert and -are configuration managed in MKS in the FSW tools repository on server tlserver3. - -Note: Not testing any variations in preprocessor macro definitions - default values -in mm_platform_config.c cause all #if statements to evalute to TRUE - -To run the unit test enter the following commands at the command line prompt in -unit test directory. - -make clean -make -make run -make gcov - -MM 2.4.1.0 Unit Test Results: - -Tests Executed: 249 -Assert Pass Count: 1035 -Assert Fail Count: 0 - -gcov: '../src/mm_mem32.c' 100.00% 109 -gcov: '../src/mm_mem8.c' 100.00% 108 -gcov: '../src/mm_dump.c' 100.00% 343 -gcov: '../src/mm_app.c' 100.00% 192 -gcov: '../src/mm_load.c' 100.00% 432 -gcov: '../src/mm_mem16.c' 100.00% 108 -gcov: '../src/mm_utils.c' 100.00% 93 - -========================================================================== -mm_mem32.c - 100.00% coverage - -========================================================================== -mm_mem8.c - 100.00% coverage - -========================================================================== -mm_dump.c - 100.00% coverage - -========================================================================== -mm_app.c - 100.00% coverage - -========================================================================== -mm_load.c - 100.00% coverage - -========================================================================== -mm_mem16.c - 100.00% coverage - -========================================================================== -mm_utils.c - 100.00% coverage - -========================================================================== diff --git a/fsw/unit_test/makefile b/fsw/unit_test/makefile deleted file mode 100644 index d4d0cdc..0000000 --- a/fsw/unit_test/makefile +++ /dev/null @@ -1,175 +0,0 @@ -############################################################################## -## File: -## $Id: makefile 1.5 2016/10/31 00:20:55EDT mdeschu Exp $ -## -## Purpose: -## Makefile for building the CFS File Manager (MM) UT Assert unit tests -## -## $Log: makefile $ -## Revision 1.5 2016/10/31 00:20:55EDT mdeschu -## Use -std=c99 option in place of '-ansi' option in unit tests regarding Babelfish ticket #39 -## Revision 1.4 2016/07/26 14:21:20EDT czogby -## Replace hard-coded paths with environment variables set in setvars.sh -## Revision 1.3 2016/06/23 19:19:36EDT czogby -## Add C Macro Definition to Makefile for New cFE -## Revision 1.2 2016/05/04 18:59:32EDT czogby -## Update MM to Compile With New UT-Assert PSP Files -## Revision 1.1 2016/02/03 17:11:35EST czogby -## Initial revision -## Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj -## -############################################################################## -## GNU Makefile for building UT unit tests - -# -# Supported MAKEFILE targets: -# clean - deletes object files, executables, output files, and gcov files -# all - makes mm_testrunner.exe -# run - runs mm_testrunner.exe -# gcov - prints a GCOV coverage report (make all, make run, make gcov) -# -# GCOV is disabled by default. If you are using the source level debugger you will want to -# disable GCOV. To enable GCOV you can override the ENABLE_GCOV variable on the command line -# by setting it to TRUE. For example "make ENABLE_GCOV=TRUE". -# - -# -# VPATH specifies the search paths for source files outside of the current directory. Note that -# all object files will be created in the current directory even if the source file is not in the -# current directory. -# -VPATH := . -VPATH += $(UT_ASSERT_SRC)/src -VPATH += $(CFS_MISSION)/apps/cfs_lib/fsw/src -VPATH += ../src -VPATH += ../for_build - -MM_PATH=../../ - -# -# INCLUDES specifies the search paths for include files outside of the current directory. -# Note that the -I is required. -# -INCLUDES := -I. -INCLUDES += -I$(UT_ASSERT_SRC)/inc -INCLUDES += -I$(CFS_MISSION)/build/pc-linux/inc -INCLUDES += -I$(APP_DIR)/cfs_lib/fsw/public_inc -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/os/inc -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/src/inc -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/src/time -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/src/sb -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/src/es -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/src/evs -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/src/fs -INCLUDES += -I$(CFE_DIR)/fsw/cfe-core/src/tbl -INCLUDES += -I$(CFE_DIR)/fsw/mission_inc -INCLUDES += -I$(CFE_DIR)/fsw/platform_inc/cpu1 -INCLUDES += -I$(OSAL_DIR)/src/os/inc -INCLUDES += -I$(OSAL_DIR)/build/inc -INCLUDES += -I$(PSP_DIR)/fsw/inc -INCLUDES += -I$(PSP_DIR)/fsw/pc-linux/inc -INCLUDES += -I$(PSP_DIR)/fsw/pc-linux/inc -INCLUDES += -I$(MM_PATH)/fsw/src -INCLUDES += -I$(MM_PATH)/fsw/mission_inc -INCLUDES += -I$(MM_PATH)/fsw/platform_inc - -# -# FLIGHT_OBJS specifies flight software object files. -# -FLIGHT_OBJS := mm_app.o mm_dump.o mm_load.o mm_mem8.o mm_mem16.o mm_mem32.o mm_utils.o - -# -# UT_OBJS specifies unit test object files. -# -UT_OBJS := ut_osapi_stubs.o -UT_OBJS += ut_osfileapi_stubs.o -UT_OBJS += ut_cfe_sb_stubs.o -UT_OBJS += ut_cfe_es_stubs.o -UT_OBJS += ut_cfe_evs_stubs.o -UT_OBJS += ut_cfe_time_stubs.o -UT_OBJS += ut_cfe_fs_stubs.o -UT_OBJS += ut_cfe_psp_memutils_stubs.o -UT_OBJS += ut_cfe_psp_eeprom_stubs.o -UT_OBJS += ut_cfe_psp_ram_stubs.o -UT_OBJS += ut_cfe_psp_memrange_stubs.o -UT_OBJS += ut_cfe_psp_watchdog_stubs.o -UT_OBJS += ut_cfe_psp_timer_stubs.o -UT_OBJS += ut_cfe_tbl_stubs.o -UT_OBJS += ut_cfe_sb_hooks.o -UT_OBJS += ut_cfe_es_hooks.o -UT_OBJS += ut_cfe_evs_hooks.o -UT_OBJS += ut_cfe_tbl_hooks.o -UT_OBJS += ut_cfe_time_hooks.o -UT_OBJS += utassert.o -UT_OBJS += utlist.o -UT_OBJS += uttest.o -UT_OBJS += uttools.o -UT_OBJS += mm_app_test.o -UT_OBJS += mm_load_test.o -UT_OBJS += mm_mem8_test.o -UT_OBJS += mm_mem16_test.o -UT_OBJS += mm_mem32_test.o -UT_OBJS += mm_dump_test.o -UT_OBJS += mm_utils_test.o -UT_OBJS += mm_testrunner.o -UT_OBJS += mm_test_utils.o -UT_OBJS += cfs_utils.o - -# -# UT_TEST_RUNNER specifies the name of the test runner. -# -UT_TEST_RUNNER = mm_testrunner.exe - -############################################################################### - -COMPILER=gcc -LINKER=gcc - -# -# Compiler and Linker Options -# -GCOV_COPT = -fprofile-arcs -ftest-coverage -pg -p -GCOV_LOPT = -pg -p -fprofile-arcs -ftest-coverage -lgcov -lm - -#WARNINGS = -Wall -W -ansi -Werror -Wstrict-prototypes -Wundef -WARNINGS = -Wall -std=c99 -Wstrict-prototypes -Wundef -DEBUGGER = -g - -COPT = $(WARNINGS) $(DEBUGGER) $(GCOV_COPT) -DSOFTWARE_LITTLE_BIT_ORDER -D_EL -D_ix86_ -DUT_VERBOSE -DOSAPI_NO_SPECIAL_ATTRIBS - -LOPT = $(GCOV_LOPT) - -############################################################################### -## Rule to make the specified TARGET -## -%.exe: %.o - $(LINKER) $(LOPT) $^ -o $*.exe - -############################################################################### -## "C" COMPILER RULE -## -%.o: %.c - $(COMPILER) -c $(COPT) $(INCLUDES) $< - -############################################################################## -## - -all:$(UT_TEST_RUNNER) - -$(UT_TEST_RUNNER): $(UT_OBJS) $(FLIGHT_OBJS) - -clean :: - rm -f *.o *.exe *.gcda *.gcno *.gcov gmon.out - -run :: - ./$(UT_TEST_RUNNER) - -gcov :: - @echo - @gcov $(FLIGHT_OBJS:.o=.gcda) | sed 'N;s/\n/ /' | \ - sed -n '/File/p' | sed '/ads/d' | sed -e '/\.h/d' | \ - sed 's/ Lines executed:/ /; s/File/gcov:/; s/of// ' - @rm -f *.gcda *.gcno - @echo - -# end of file diff --git a/fsw/unit_test/mm_app.c.gcov b/fsw/unit_test/mm_app.c.gcov deleted file mode 100644 index 45da4b4..0000000 --- a/fsw/unit_test/mm_app.c.gcov +++ /dev/null @@ -1,720 +0,0 @@ - -: 0:Source:../src/mm_app.c - -: 0:Programs:7 - -: 1:/************************************************************************ - -: 2:** File: - -: 3:** $Id: mm_app.c.gcov 1.3 2016/10/31 22:11:02EDT mdeschu Exp $ - -: 4:** - -: 5:** Copyright © 2007-2014 United States Government as represented by the - -: 6:** Administrator of the National Aeronautics and Space Administration. - -: 7:** All Other Rights Reserved. - -: 8:** - -: 9:** This software was created at NASA's Goddard Space Flight Center. - -: 10:** This software is governed by the NASA Open Source Agreement and may be - -: 11:** used, distributed and modified only pursuant to the terms of that - -: 12:** agreement. - -: 13:** - -: 14:** Purpose: - -: 15:** The CFS Memory Manager (MM) Application provides onboard hardware - -: 16:** and software maintenance services by processing commands for memory - -: 17:** operations and read and write accesses to memory mapped hardware. - -: 18:** - -: 19:** $Log: mm_app.c.gcov $ - -: 19:** Revision 1.3 2016/10/31 22:11:02EDT mdeschu - -: 19:** Update gcov results, README and log file for MM unit tests for 2.4.1 - -: 20:** Revision 1.3 2016/10/30 00:48:50EDT mdeschu - -: 21:** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent - -: 22:** Revision 1.2 2015/12/29 15:22:45EST czogby - -: 23:** Move function prototypes from .c files into .h files - -: 24:** Revision 1.1 2015/07/28 12:21:35EDT rperera - -: 25:** Initial revision - -: 26:** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj - -: 27:** Revision 1.17 2015/04/14 15:29:04EDT lwalling - -: 28:** Removed unnecessary backslash characters from string format definitions - -: 29:** Revision 1.16 2015/03/30 17:34:00EDT lwalling - -: 30:** Create common process to maintain and report last action statistics - -: 31:** Revision 1.15 2015/03/20 14:16:55EDT lwalling - -: 32:** Add last peek/poke/fill command data value to housekeeping telemetry - -: 33:** Revision 1.14 2015/03/02 14:26:42EST sstrege - -: 34:** Added copyright information - -: 35:** Revision 1.13 2011/11/30 15:58:34EST jmdagost - -: 36:** Removed unused local variable and function call, initialized local variables. - -: 37:** Revision 1.12 2010/12/08 14:38:59EST jmdagost - -: 38:** Added filename validation for symbol table dump command. - -: 39:** Revision 1.11 2010/11/29 08:47:30EST jmdagost - -: 40:** Added support for EEPROM write-enable/disable commands - -: 41:** Revision 1.10 2010/11/26 13:04:49EST jmdagost - -: 42:** Included mm_platform_cfg.h to access mission revision number. - -: 43:** Revision 1.9 2010/11/24 17:09:20EST jmdagost - -: 44:** Implemented the MM Write Symbol Table to File command - -: 45:** Revision 1.8 2009/04/18 15:29:37EDT dkobe - -: 46:** Corrected doxygen comments - -: 47:** Revision 1.7 2008/09/06 15:33:57EDT dahardison - -: 48:** Added support for new init and noop event strings with version information - -: 49:** Revision 1.6 2008/09/06 15:01:15EDT dahardison - -: 50:** Updated to support the symbol lookup ground command - -: 51:** Revision 1.5 2008/09/05 14:27:44EDT dahardison - -: 52:** Updated references of local HK variables and the MM_HousekeepingCmd - -: 53:** function accordingly for changes related to DCR 3611 - -: 54:** Revision 1.4 2008/05/22 15:15:05EDT dahardison - -: 55:** Added header includes for mm_msgids.h and mm_perfids.h - -: 56:** Revision 1.3 2008/05/19 15:22:53EDT dahardison - -: 57:** Version after completion of unit testing - -: 58:** - -: 59:*************************************************************************/ - -: 60: - -: 61:/************************************************************************ - -: 62:** Includes - -: 63:*************************************************************************/ - -: 64:#include "mm_app.h" - -: 65:#include "mm_perfids.h" - -: 66:#include "mm_msgids.h" - -: 67:#include "mm_load.h" - -: 68:#include "mm_dump.h" - -: 69:#include "mm_utils.h" - -: 70:#include "mm_events.h" - -: 71:#include "mm_verify.h" - -: 72:#include "mm_version.h" - -: 73:#include "mm_platform_cfg.h" - -: 74:#include - -: 75: - -: 76:/************************************************************************ - -: 77:** MM global data - -: 78:*************************************************************************/ - -: 79:MM_AppData_t MM_AppData; - -: 80: - -: 81:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 82:/* */ - -: 83:/* MM application entry point and main process loop */ - -: 84:/* */ - -: 85:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 3: 86:void MM_AppMain(void) - -: 87:{ - 3: 88: int32 Status = CFE_SUCCESS; - -: 89: - -: 90: /* - -: 91: ** Register the application with Executive Services - -: 92: */ - 3: 93: CFE_ES_RegisterApp(); - -: 94: - -: 95: /* - -: 96: ** Create the first Performance Log entry - -: 97: */ - 3: 98: CFE_ES_PerfLogEntry(MM_APPMAIN_PERF_ID); - -: 99: - -: 100: /* - -: 101: ** Perform application specific initialization - -: 102: */ - 3: 103: Status = MM_AppInit(); - 3: 104: if (Status != CFE_SUCCESS) - -: 105: { - 1: 106: MM_AppData.RunStatus = CFE_ES_APP_ERROR; - -: 107: } - -: 108: - -: 109: /* - -: 110: ** Application main loop - -: 111: */ - 8: 112: while(CFE_ES_RunLoop(&MM_AppData.RunStatus) == TRUE) - -: 113: { - -: 114: /* - -: 115: ** Performance Log exit stamp - -: 116: */ - 2: 117: CFE_ES_PerfLogExit(MM_APPMAIN_PERF_ID); - -: 118: - -: 119: /* - -: 120: ** Pend on the arrival of the next Software Bus message - -: 121: */ - 2: 122: Status = CFE_SB_RcvMsg(&MM_AppData.MsgPtr, MM_AppData.CmdPipe, CFE_SB_PEND_FOREVER); - -: 123: - -: 124: /* - -: 125: ** Performance Log entry stamp - -: 126: */ - 2: 127: CFE_ES_PerfLogEntry(MM_APPMAIN_PERF_ID); - -: 128: - -: 129: /* - -: 130: ** Check the return status from the software bus - -: 131: */ - 2: 132: if (Status == CFE_SUCCESS) - -: 133: { - -: 134: /* Process Software Bus message */ - 1: 135: MM_AppPipe(MM_AppData.MsgPtr); - -: 136: } - -: 137: else - -: 138: { - -: 139: /* - -: 140: ** Exit on pipe read error - -: 141: */ - 1: 142: CFE_EVS_SendEvent(MM_PIPE_ERR_EID, CFE_EVS_ERROR, - -: 143: "SB Pipe Read Error, App will exit. RC = 0x%08X", (unsigned int)Status); - -: 144: - 1: 145: MM_AppData.RunStatus = CFE_ES_APP_ERROR; - -: 146: - -: 147: } - -: 148: } /* end CFS_ES_RunLoop while */ - -: 149: - -: 150: /* - -: 151: ** Performance Log exit stamp - -: 152: */ - 3: 153: CFE_ES_PerfLogExit(MM_APPMAIN_PERF_ID); - -: 154: - -: 155: /* - -: 156: ** Exit the application - -: 157: */ - 3: 158: CFE_ES_ExitApp(MM_AppData.RunStatus); - -: 159: - 3: 160:} /* end MM_AppMain */ - -: 161: - -: 162:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 163:/* */ - -: 164:/* MM initialization */ - -: 165:/* */ - -: 166:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 8: 167:int32 MM_AppInit(void) - -: 168:{ - 8: 169: int32 Status = CFE_SUCCESS; - -: 170: - -: 171: /* - -: 172: ** MM doesn't use the critical data store and - -: 173: ** doesn't need to identify power on vs. processor resets. - -: 174: ** If this changes add it here as shown in the qq_app.c template - -: 175: */ - -: 176: - -: 177: /* - -: 178: ** Setup the RunStatus variable - -: 179: */ - 8: 180: MM_AppData.RunStatus = CFE_ES_APP_RUN; - -: 181: - -: 182: /* - -: 183: ** Initialize application command execution counters - -: 184: */ - 8: 185: MM_AppData.CmdCounter = 0; - 8: 186: MM_AppData.ErrCounter = 0; - -: 187: - -: 188: /* - -: 189: ** Initialize application configuration data - -: 190: */ - 8: 191: strcpy(MM_AppData.PipeName, "MM_CMD_PIPE"); - 8: 192: MM_AppData.PipeDepth = MM_CMD_PIPE_DEPTH; - -: 193: - 8: 194: MM_AppData.LimitHK = MM_HK_LIMIT; - 8: 195: MM_AppData.LimitCmd = MM_CMD_LIMIT; - -: 196: - -: 197: /* - -: 198: ** Register for event services - -: 199: */ - 8: 200: Status = CFE_EVS_Register(NULL, 0, CFE_EVS_BINARY_FILTER); - -: 201: - 8: 202: if (Status != CFE_SUCCESS) - -: 203: { - 2: 204: CFE_ES_WriteToSysLog("MM App: Error Registering For Event Services, RC = 0x%08X\n", (unsigned int)Status); - 2: 205: return (Status); - -: 206: } - -: 207: - -: 208: /* - -: 209: ** Initialize the local housekeeping telemetry packet (clear user data area) - -: 210: */ - 6: 211: CFE_SB_InitMsg(&MM_AppData.HkPacket, MM_HK_TLM_MID, sizeof(MM_HkPacket_t), TRUE); - -: 212: - -: 213: /* - -: 214: ** Create Software Bus message pipe - -: 215: */ - 6: 216: Status = CFE_SB_CreatePipe(&MM_AppData.CmdPipe, MM_AppData.PipeDepth, MM_AppData.PipeName); - 6: 217: if (Status != CFE_SUCCESS) - -: 218: { - 1: 219: CFE_ES_WriteToSysLog("MM App: Error Creating SB Pipe, RC = 0x%08X\n", (unsigned int)Status); - 1: 220: return (Status); - -: 221: } - -: 222: - -: 223: /* - -: 224: ** Subscribe to Housekeeping request commands - -: 225: */ - 5: 226: Status = CFE_SB_Subscribe(MM_SEND_HK_MID, MM_AppData.CmdPipe); - 5: 227: if (Status != CFE_SUCCESS) - -: 228: { - 1: 229: CFE_ES_WriteToSysLog("MM App: Error Subscribing to HK Request, RC = 0x%08X\n", (unsigned int)Status); - 1: 230: return (Status); - -: 231: } - -: 232: - -: 233: /* - -: 234: ** Subscribe to MM ground command packets - -: 235: */ - 4: 236: Status = CFE_SB_Subscribe(MM_CMD_MID, MM_AppData.CmdPipe); - 4: 237: if (Status != CFE_SUCCESS) - -: 238: { - 1: 239: CFE_ES_WriteToSysLog("MM App: Error Subscribing to MM Command, RC = 0x%08X\n", (unsigned int)Status); - 1: 240: return (Status); - -: 241: } - -: 242: - -: 243: /* - -: 244: ** MM doesn't use tables. If this changes add table registration - -: 245: ** and initialization here as shown in the qq_app.c template - -: 246: */ - -: 247: - -: 248: /* - -: 249: ** MM doesn't use the critical data store. If this changes add CDS - -: 250: ** creation here as shown in the qq_app.c template - -: 251: */ - -: 252: - -: 253: /* - -: 254: ** Initialize MM housekeeping information - -: 255: */ - 3: 256: MM_ResetHk(); - -: 257: - -: 258: /* - -: 259: ** Application startup event message - -: 260: */ - 3: 261: CFE_EVS_SendEvent(MM_INIT_INF_EID, CFE_EVS_INFORMATION, - -: 262: "MM Initialized. Version %d.%d.%d.%d", - -: 263: MM_MAJOR_VERSION, - -: 264: MM_MINOR_VERSION, - -: 265: MM_REVISION, - -: 266: MM_MISSION_REV); - -: 267: - 3: 268: return(CFE_SUCCESS); - -: 269: - -: 270:} /* end MM_AppInit */ - -: 271: - -: 272:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 273:/* */ - -: 274:/* Process a command pipe message */ - -: 275:/* */ - -: 276:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 16: 277:void MM_AppPipe(CFE_SB_MsgPtr_t msg) - -: 278:{ - 16: 279: CFE_SB_MsgId_t MessageID = 0; - 16: 280: uint16 CommandCode = 0; - -: 281: - 16: 282: MessageID = CFE_SB_GetMsgId(msg); - 16: 283: switch (MessageID) - -: 284: { - -: 285: /* - -: 286: ** Housekeeping telemetry request - -: 287: */ - -: 288: case MM_SEND_HK_MID: - 1: 289: MM_HousekeepingCmd(msg); - 1: 290: break; - -: 291: - -: 292: /* - -: 293: ** MM ground commands - -: 294: */ - -: 295: case MM_CMD_MID: - 14: 296: MM_ResetHk(); /* Clear all "Last Action" data */ - 14: 297: CommandCode = CFE_SB_GetCmdCode(msg); - 14: 298: switch (CommandCode) - -: 299: { - -: 300: case MM_NOOP_CC: - 1: 301: MM_NoopCmd(msg); - 1: 302: break; - -: 303: - -: 304: case MM_RESET_CC: - 1: 305: MM_ResetCmd(msg); - 1: 306: break; - -: 307: - -: 308: case MM_PEEK_CC: - 1: 309: MM_PeekCmd(msg); - 1: 310: break; - -: 311: - -: 312: case MM_POKE_CC: - 1: 313: MM_PokeCmd(msg); - 1: 314: break; - -: 315: - -: 316: case MM_LOAD_MEM_WID_CC: - 1: 317: MM_LoadMemWIDCmd(msg); - 1: 318: break; - -: 319: - -: 320: case MM_LOAD_MEM_FROM_FILE_CC: - 1: 321: MM_LoadMemFromFileCmd(msg); - 1: 322: break; - -: 323: - -: 324: case MM_DUMP_MEM_TO_FILE_CC: - 1: 325: MM_DumpMemToFileCmd(msg); - 1: 326: break; - -: 327: - -: 328: case MM_DUMP_IN_EVENT_CC: - 1: 329: MM_DumpInEventCmd(msg); - 1: 330: break; - -: 331: - -: 332: case MM_FILL_MEM_CC: - 1: 333: MM_FillMemCmd(msg); - 1: 334: break; - -: 335: - -: 336: case MM_LOOKUP_SYM_CC: - 1: 337: MM_LookupSymbolCmd(msg); - 1: 338: break; - -: 339: - -: 340: case MM_SYMTBL_TO_FILE_CC: - 1: 341: MM_SymTblToFileCmd(msg); - 1: 342: break; - -: 343: - -: 344: case MM_ENABLE_EEPROM_WRITE_CC: - 1: 345: MM_EepromWriteEnaCmd(msg); - 1: 346: break; - -: 347: - -: 348: case MM_DISABLE_EEPROM_WRITE_CC: - 1: 349: MM_EepromWriteDisCmd(msg); - 1: 350: break; - -: 351: - -: 352: default: - 1: 353: MM_AppData.ErrCounter++; - 1: 354: CFE_EVS_SendEvent(MM_CC1_ERR_EID, CFE_EVS_ERROR, - -: 355: "Invalid ground command code: ID = 0x%X, CC = %d", - -: 356: MessageID, CommandCode); - -: 357: break; - -: 358: } - 14: 359: break; - -: 360: - -: 361: /* - -: 362: ** Unrecognized Message ID - -: 363: */ - -: 364: default: - 1: 365: MM_AppData.ErrCounter++; - 1: 366: CFE_EVS_SendEvent(MM_MID_ERR_EID, CFE_EVS_ERROR, - -: 367: "Invalid command pipe message ID: 0x%X", MessageID); - -: 368: break; - -: 369: - -: 370: } /* end switch */ - -: 371: - 16: 372: return; - -: 373: - -: 374:} /* End MM_AppPipe */ - -: 375: - -: 376:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 377:/* */ - -: 378:/* Housekeeping request */ - -: 379:/* */ - -: 380:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 2: 381:void MM_HousekeepingCmd(CFE_SB_MsgPtr_t msg) - -: 382:{ - 2: 383: uint16 ExpectedLength = sizeof (MM_NoArgsCmd_t); - -: 384: - -: 385: /* - -: 386: ** Verify command packet length - -: 387: */ - 2: 388: if (MM_VerifyCmdLength(msg, ExpectedLength)) - -: 389: { - -: 390: /* - -: 391: ** Copy local housekeeping variables to packet structure - -: 392: */ - 2: 393: MM_AppData.HkPacket.CmdCounter = MM_AppData.CmdCounter; - 2: 394: MM_AppData.HkPacket.ErrCounter = MM_AppData.ErrCounter; - 2: 395: MM_AppData.HkPacket.LastAction = MM_AppData.LastAction; - 2: 396: MM_AppData.HkPacket.MemType = MM_AppData.MemType; - 2: 397: MM_AppData.HkPacket.Address = MM_AppData.Address; - 2: 398: MM_AppData.HkPacket.DataValue = MM_AppData.DataValue; - 2: 399: MM_AppData.HkPacket.BytesProcessed = MM_AppData.BytesProcessed; - -: 400: - 2: 401: strncpy(MM_AppData.HkPacket.FileName, MM_AppData.FileName, OS_MAX_PATH_LEN); - -: 402: - -: 403: /* - -: 404: ** Send housekeeping telemetry packet - -: 405: */ - 2: 406: CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &MM_AppData.HkPacket); - 2: 407: CFE_SB_SendMsg((CFE_SB_Msg_t *) &MM_AppData.HkPacket); - -: 408: - -: 409: /* - -: 410: ** This command does not affect the command execution counter - -: 411: */ - -: 412: - -: 413: } /* end if */ - -: 414: - 2: 415: return; - -: 416: - -: 417:} /* end MM_HousekeepingCmd */ - -: 418: - -: 419:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 420:/* */ - -: 421:/* Noop command */ - -: 422:/* */ - -: 423:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 1: 424:void MM_NoopCmd(CFE_SB_MsgPtr_t msg) - -: 425:{ - 1: 426: uint16 ExpectedLength = sizeof(MM_NoArgsCmd_t); - -: 427: - -: 428: /* - -: 429: ** Verify command packet length - -: 430: */ - 1: 431: if(MM_VerifyCmdLength(msg, ExpectedLength)) - -: 432: { - 1: 433: MM_AppData.LastAction = MM_NOOP; - 1: 434: MM_AppData.CmdCounter++; - -: 435: - 1: 436: CFE_EVS_SendEvent(MM_NOOP_INF_EID, CFE_EVS_INFORMATION, - -: 437: "No-op command. Version %d.%d.%d.%d", - -: 438: MM_MAJOR_VERSION, - -: 439: MM_MINOR_VERSION, - -: 440: MM_REVISION, - -: 441: MM_MISSION_REV); - -: 442: } - -: 443: - 1: 444: return; - -: 445: - -: 446:} /* end MM_NoopCmd */ - -: 447: - -: 448:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 449:/* */ - -: 450:/* Reset counters command */ - -: 451:/* */ - -: 452:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 1: 453:void MM_ResetCmd(CFE_SB_MsgPtr_t msg) - -: 454:{ - 1: 455: uint16 ExpectedLength = sizeof(MM_NoArgsCmd_t); - -: 456: - -: 457: /* - -: 458: ** Verify command packet length - -: 459: */ - 1: 460: if(MM_VerifyCmdLength(msg, ExpectedLength)) - -: 461: { - 1: 462: MM_AppData.LastAction = MM_RESET; - 1: 463: MM_AppData.CmdCounter = 0; - 1: 464: MM_AppData.ErrCounter = 0; - -: 465: - 1: 466: CFE_EVS_SendEvent(MM_RESET_DBG_EID, CFE_EVS_DEBUG, - -: 467: "Reset counters command received"); - -: 468: } - -: 469: - 1: 470: return; - -: 471: - -: 472:} /* end MM_ResetCmd */ - -: 473: - -: 474:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 475:/* */ - -: 476:/* Lookup symbol name command */ - -: 477:/* */ - -: 478:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 4: 479:void MM_LookupSymbolCmd(CFE_SB_MsgPtr_t msg) - -: 480:{ - 4: 481: int32 OS_Status = OS_ERROR; /* Set to error instead of success since we explicitly test for success */ - 4: 482: uint32 ResolvedAddr = 0; - 4: 483: MM_LookupSymCmd_t *CmdPtr = NULL; - 4: 484: uint16 ExpectedLength = sizeof(MM_LookupSymCmd_t); - -: 485: - -: 486: /* - -: 487: ** Verify command packet length - -: 488: */ - 4: 489: if(MM_VerifyCmdLength(msg, ExpectedLength)) - -: 490: { - 4: 491: CmdPtr = ((MM_LookupSymCmd_t *) msg); - -: 492: - -: 493: /* - -: 494: ** NUL terminate the very end of the symbol name string as a - -: 495: ** safety measure - -: 496: */ - 4: 497: CmdPtr->SymName[OS_MAX_SYM_LEN - 1] = '\0'; - -: 498: - -: 499: /* - -: 500: ** Check if the symbol name string is a nul string - -: 501: */ - 4: 502: if(strlen(CmdPtr->SymName) == 0) - -: 503: { - 2: 504: MM_AppData.ErrCounter++; - 2: 505: CFE_EVS_SendEvent(MM_SYMNAME_NUL_ERR_EID, CFE_EVS_ERROR, - -: 506: "NUL (empty) string specified as symbol name"); - -: 507: } - -: 508: else - -: 509: { - -: 510: /* - -: 511: ** If symbol name is not an empty string look it up using the OSAL API - -: 512: */ - 2: 513: OS_Status = OS_SymbolLookup(&ResolvedAddr, CmdPtr->SymName); - 2: 514: if (OS_Status == OS_SUCCESS) - -: 515: { - -: 516: /* Update telemetry */ - 1: 517: MM_AppData.LastAction = MM_SYM_LOOKUP; - 1: 518: MM_AppData.Address = ResolvedAddr; - 1: 519: MM_AppData.CmdCounter++; - -: 520: - 1: 521: CFE_EVS_SendEvent(MM_SYM_LOOKUP_INF_EID, CFE_EVS_INFORMATION, - -: 522: "Symbol Lookup Command: Name = '%s' Addr = 0x%08X", - -: 523: CmdPtr->SymName, (unsigned int)ResolvedAddr); - -: 524: } - -: 525: else - -: 526: { - 1: 527: MM_AppData.ErrCounter++; - 1: 528: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 529: "Symbolic address can't be resolved: Name = '%s'", - -: 530: CmdPtr->SymName); - -: 531: } - -: 532: - -: 533: } /* end strlen(CmdPtr->SymName) == 0 else */ - -: 534: - -: 535: } /* end MM_VerifyCmdLength if */ - -: 536: - 4: 537: return; - -: 538: - -: 539:} /* end MM_LookupSymbolCmd */ - -: 540: - -: 541:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 542:/* */ - -: 543:/* Dump symbol table to file command */ - -: 544:/* */ - -: 545:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 5: 546:void MM_SymTblToFileCmd(CFE_SB_MsgPtr_t msg) - -: 547:{ - 5: 548: boolean Valid = TRUE; - 5: 549: int32 OS_Status = OS_ERROR; /* Set to error instead of success since we explicitly test for success */ - 5: 550: MM_SymTblToFileCmd_t *CmdPtr = NULL; - 5: 551: uint16 ExpectedLength = sizeof(MM_SymTblToFileCmd_t); - -: 552: - -: 553: /* - -: 554: ** Verify command packet length - -: 555: */ - 5: 556: if(MM_VerifyCmdLength(msg, ExpectedLength)) - -: 557: { - 5: 558: CmdPtr = ((MM_SymTblToFileCmd_t *) msg); - -: 559: - -: 560: /* - -: 561: ** NUL terminate the very end of the filename string as a - -: 562: ** safety measure - -: 563: */ - 5: 564: CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; - -: 565: - -: 566: /* - -: 567: ** Check if the filename string is a nul string - -: 568: */ - 5: 569: if(strlen(CmdPtr->FileName) == 0) - -: 570: { - 2: 571: MM_AppData.ErrCounter++; - 2: 572: CFE_EVS_SendEvent(MM_SYMFILENAME_NUL_ERR_EID, CFE_EVS_ERROR, - -: 573: "NUL (empty) string specified as symbol dump file name"); - -: 574: } - -: 575: else - -: 576: { - 3: 577: Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); - -: 578: - 3: 579: if (Valid == TRUE) - -: 580: { - -: 581: /* - -: 582: ** If filename is good pass it to the OSAL API - -: 583: */ - 2: 584: OS_Status = OS_SymbolTableDump(CmdPtr->FileName, MM_MAX_DUMP_FILE_DATA_SYMTBL); - 2: 585: if (OS_Status == OS_SUCCESS) - -: 586: { - -: 587: /* Update telemetry */ - 1: 588: MM_AppData.LastAction = MM_SYMTBL_SAVE; - 1: 589: strncpy(MM_AppData.FileName, CmdPtr->FileName, OS_MAX_PATH_LEN); - 1: 590: MM_AppData.CmdCounter++; - -: 591: - 1: 592: CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_INF_EID, CFE_EVS_INFORMATION, - -: 593: "Symbol Table Dump to File Started: Name = '%s'", - -: 594: CmdPtr->FileName); - -: 595: } - -: 596: else - -: 597: { - 1: 598: MM_AppData.ErrCounter++; - 1: 599: CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_FAIL_ERR_EID, CFE_EVS_ERROR, - -: 600: "Error dumping symbol table, OS_Status= 0x%X, File='%s'", - -: 601: (unsigned int)OS_Status, CmdPtr->FileName); - -: 602: } - -: 603: } - -: 604: else - -: 605: { - 1: 606: MM_AppData.ErrCounter++; - 1: 607: CFE_EVS_SendEvent(MM_SYMTBL_TO_FILE_INVALID_ERR_EID, CFE_EVS_ERROR, - -: 608: "Illegal characters in target filename, File='%s'", - -: 609: CmdPtr->FileName); - -: 610: } - -: 611: - -: 612: } /* end strlen(CmdPtr->FileName) == 0 else */ - -: 613: - -: 614: } /* end MM_VerifyCmdLength if */ - -: 615: - 5: 616: return; - -: 617: - -: 618:} /* end MM_SymTblToFileCmd */ - -: 619: - -: 620:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 621:/* */ - -: 622:/* EEPROM write-enable command */ - -: 623:/* */ - -: 624:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 3: 625:void MM_EepromWriteEnaCmd(CFE_SB_MsgPtr_t msg) - -: 626:{ - 3: 627: int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */ - 3: 628: MM_EepromWriteEnaCmd_t *CmdPtr = NULL; - 3: 629: uint16 ExpectedLength = sizeof(MM_EepromWriteEnaCmd_t); - -: 630: - -: 631: /* - -: 632: ** Verify command packet length - -: 633: */ - 3: 634: if(MM_VerifyCmdLength(msg, ExpectedLength)) - -: 635: { - 3: 636: CmdPtr = ((MM_EepromWriteEnaCmd_t *) msg); - -: 637: - -: 638: /* - -: 639: ** Call the cFE to write-enable the requested bank - -: 640: */ - 3: 641: cFE_Status = CFE_PSP_EepromWriteEnable(CmdPtr->Bank); - 3: 642: if (cFE_Status == CFE_PSP_SUCCESS) - -: 643: { - -: 644: /* Update telemetry */ - 2: 645: MM_AppData.LastAction = MM_EEPROMWRITE_ENA; - 2: 646: MM_AppData.MemType = MM_EEPROM; - 2: 647: MM_AppData.CmdCounter++; - -: 648: - 2: 649: CFE_EVS_SendEvent(MM_EEPROM_WRITE_ENA_INF_EID, CFE_EVS_INFORMATION, - -: 650: "EEPROM bank %d write enabled, cFE_Status= 0x%X", - -: 651: (int)CmdPtr->Bank, (unsigned int)cFE_Status); - -: 652: } - -: 653: else - -: 654: { - 1: 655: MM_AppData.ErrCounter++; - 1: 656: CFE_EVS_SendEvent(MM_EEPROM_WRITE_ENA_ERR_EID, CFE_EVS_ERROR, - -: 657: "Error requesting EEPROM bank %d write enable, cFE_Status= 0x%X", - -: 658: (int)CmdPtr->Bank, (unsigned int)cFE_Status); - -: 659: } - -: 660: - -: 661: } /* end MM_VerifyCmdLength if */ - -: 662: - 3: 663: return; - -: 664: - -: 665:} /* end MM_EepromWriteEnaCmd */ - -: 666: - -: 667:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 668:/* */ - -: 669:/* EEPROM write-disable command */ - -: 670:/* */ - -: 671:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 3: 672:void MM_EepromWriteDisCmd(CFE_SB_MsgPtr_t msg) - -: 673:{ - 3: 674: int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */ - 3: 675: MM_EepromWriteDisCmd_t *CmdPtr = NULL; - 3: 676: uint16 ExpectedLength = sizeof(MM_EepromWriteDisCmd_t); - -: 677: - -: 678: /* - -: 679: ** Verify command packet length - -: 680: */ - 3: 681: if(MM_VerifyCmdLength(msg, ExpectedLength)) - -: 682: { - 3: 683: CmdPtr = ((MM_EepromWriteDisCmd_t *) msg); - -: 684: - -: 685: /* - -: 686: ** Call the cFE to write-enable the requested bank - -: 687: */ - 3: 688: cFE_Status = CFE_PSP_EepromWriteDisable(CmdPtr->Bank); - 3: 689: if (cFE_Status == CFE_PSP_SUCCESS) - -: 690: { - -: 691: /* Update telemetry */ - 2: 692: MM_AppData.LastAction = MM_EEPROMWRITE_DIS; - 2: 693: MM_AppData.MemType = MM_EEPROM; - 2: 694: MM_AppData.CmdCounter++; - -: 695: - 2: 696: CFE_EVS_SendEvent(MM_EEPROM_WRITE_DIS_INF_EID, CFE_EVS_INFORMATION, - -: 697: "EEPROM bank %d write disabled, cFE_Status= 0x%X", - -: 698: (int)CmdPtr->Bank, (unsigned int)cFE_Status); - -: 699: } - -: 700: else - -: 701: { - 1: 702: MM_AppData.ErrCounter++; - 1: 703: CFE_EVS_SendEvent(MM_EEPROM_WRITE_DIS_ERR_EID, CFE_EVS_ERROR, - -: 704: "Error requesting EEPROM bank %d write disable, cFE_Status= 0x%X", - -: 705: (int)CmdPtr->Bank, (unsigned int)cFE_Status); - -: 706: } - -: 707: - -: 708: } /* end MM_VerifyCmdLength if */ - -: 709: - 3: 710: return; - -: 711: - -: 712:} /* end MM_EepromWriteDisCmd */ - -: 713: - -: 714:/************************/ - -: 715:/* End of File Comment */ - -: 716:/************************/ diff --git a/fsw/unit_test/mm_app_test.c b/fsw/unit_test/mm_app_test.c deleted file mode 100644 index 63ce0e4..0000000 --- a/fsw/unit_test/mm_app_test.c +++ /dev/null @@ -1,937 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_app_test.c 1.5.1.1 2016/11/17 16:35:29EST sstrege Exp $ - ** - ** Purpose: - ** This file contains unit test cases for the functions contained in the file mm_app.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_app_test.c $ - ** Revision 1.5.1.1 2016/11/17 16:35:29EST sstrege - ** - ** Revision 1.6 2016/11/17 12:51:15EST mdeschu - ** Remove references to temporary header file mm_test_exports.h - ** Revision 1.5 2016/10/24 18:34:56EDT czogby - ** Code Walkthough Updates - ** Revision 1.4 2016/05/04 19:06:43EDT czogby - ** Update MM to Compile With New UT-Assert PSP Files - ** Revision 1.3 2016/03/04 20:15:48EST czogby - ** Use Constants for Version Number Checks - ** Revision 1.2 2016/03/04 20:00:58EST czogby - ** Need Temporary Header File to Import Some MM Functions Into Unit Tests - ** Revision 1.1 2016/02/03 17:11:36EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_app_test.h" -#include "mm_app.h" -#include "mm_msg.h" -#include "mm_msgdefs.h" -#include "mm_msgids.h" -#include "mm_events.h" -#include "mm_version.h" -#include "mm_test_utils.h" -#include "ut_osapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_es_hooks.h" -#include "ut_cfe_evs_stubs.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_psp_eeprom_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include -#include -#include - -/* - * Function Definitions - */ - -void MM_APP_TEST_CFE_ES_ExitAppHook(uint32 ExitStatus) -{ - MM_AppData.CmdCounter++; -} - -void MM_AppMain_Test_Nominal(void) -{ - /* Set to exit loop after first run */ - Ut_CFE_ES_SetReturnCode(UT_CFE_ES_RUNLOOP_INDEX, FALSE, 2); - - /* Set to prevent call to CFE_SB_RcvMsg from returning an error */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_RCVMSG_INDEX, CFE_SUCCESS, 1); - - /* Set to prevent segmentation fault */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, MM_SEND_HK_MID, 1); - - /* Set to prevent segmentation fault */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETTOTALMSGLENGTH_INDEX, sizeof(MM_NoArgsCmd_t), 1); - - /* Used to verify completion of MM_AppMain by incrementing MM_AppData.CmdCounter */ - Ut_CFE_ES_SetFunctionHook(UT_CFE_ES_EXITAPP_INDEX, &MM_APP_TEST_CFE_ES_ExitAppHook); - - /* Execute the function being tested */ - MM_AppMain(); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - /* Generates 1 event message we don't care about in this test */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppMain_Test_Nominal */ - -void MM_AppMain_Test_AppInitError(void) -{ - /* Set to exit loop after first run */ - Ut_CFE_ES_SetReturnCode(UT_CFE_ES_RUNLOOP_INDEX, FALSE, 2); - - /* Set to prevent call to CFE_SB_RcvMsg from returning an error */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_RCVMSG_INDEX, CFE_SUCCESS, 1); - - /* Set to prevent segmentation fault */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, MM_SEND_HK_MID, 1); - - /* Set to prevent segmentation fault */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETTOTALMSGLENGTH_INDEX, sizeof(MM_NoArgsCmd_t), 1); - - /* Set to satisfy condition "Status != CFE_SUCCESS" */ - Ut_CFE_EVS_SetReturnCode(UT_CFE_EVS_REGISTER_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_AppMain(); - - /* Verify results */ - UtAssert_True (MM_AppData.RunStatus == CFE_ES_APP_ERROR, "MM_AppData.RunStatus == CFE_ES_APP_ERROR"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_AppMain_Test_AppInitError */ - -void MM_AppMain_Test_SBError(void) -{ - /* Set to exit loop after first run */ - Ut_CFE_ES_SetReturnCode(UT_CFE_ES_RUNLOOP_INDEX, FALSE, 2); - - /* Set to generate error message MM_PIPE_ERR_EID */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_RCVMSG_INDEX, -1, 1); - - /* Set to prevent segmentation fault */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, MM_SEND_HK_MID, 1); - - /* Set to prevent segmentation fault */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETTOTALMSGLENGTH_INDEX, sizeof(MM_NoArgsCmd_t), 1); - - /* Used to verify completion of MM_AppMain by incrementing MM_AppData.CmdCounter. */ - Ut_CFE_ES_SetFunctionHook(UT_CFE_ES_EXITAPP_INDEX, &MM_APP_TEST_CFE_ES_ExitAppHook); - - /* Execute the function being tested */ - MM_AppMain(); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PIPE_ERR_EID, CFE_EVS_ERROR, "SB Pipe Read Error, App will exit. RC = 0xFFFFFFFF"), - "SB Pipe Read Error, App will exit. RC = 0xFFFFFFFF"); - - /* Generates 1 event message we don't care about in this test */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 2, "Ut_CFE_EVS_GetEventQueueDepth() == 2"); - -} /* end MM_AppMain_Test_SBError */ - -void MM_AppInit_Test_Nominal(void) -{ - int32 Result; - char Message[125]; - - /* Initialize all elements to 1, in order verify that elements initialized to 0 by MM_AppInit are actually initialized */ - CFE_PSP_MemSet(&MM_AppData, 1, sizeof(MM_AppData_t)); - - /* Execute the function being tested */ - Result = MM_AppInit(); - - /* Verify results */ - UtAssert_True (Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - UtAssert_True (MM_AppData.RunStatus == CFE_ES_APP_RUN, "MM_AppData.RunStatus == CFE_ES_APP_RUN"); - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 0, "MM_AppData.ErrCounter == 0"); - UtAssert_True (strncmp(MM_AppData.PipeName, "MM_CMD_PIPE", 16) == 0, "strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0"); - UtAssert_True (MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH, "MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH"); - UtAssert_True (MM_AppData.LimitHK == MM_HK_LIMIT, "MM_AppData.LimitHK == MM_HK_LIMIT"); - UtAssert_True (MM_AppData.LimitCmd == MM_CMD_LIMIT, "MM_AppData.LimitCmd == MM_CMD_LIMIT"); - - sprintf(Message, "MM Initialized. Version %d.%d.%d.%d", MM_MAJOR_VERSION, MM_MINOR_VERSION, MM_REVISION, MM_MISSION_REV); - UtAssert_True (Ut_CFE_EVS_EventSent(MM_INIT_INF_EID, CFE_EVS_INFORMATION, Message), Message); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppInit_Test_Nominal */ - -void MM_AppInit_Test_EVSRegisterError(void) -{ - int32 Result; - - /* Initialize all elements to 1, in order verify that elements initialized to 0 by MM_AppInit are actually initialized */ - CFE_PSP_MemSet(&MM_AppData, 1, sizeof(MM_AppData_t)); - - /* Set to generate system log message "MM App: Error Registering For Event Services " */ - Ut_CFE_EVS_SetReturnCode(UT_CFE_EVS_REGISTER_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_AppInit(); - - /* Verify results */ - UtAssert_True (Result == -1, "Result == -1"); - - UtAssert_True (MM_AppData.RunStatus == CFE_ES_APP_RUN, "MM_AppData.RunStatus == CFE_ES_APP_RUN"); - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 0, "MM_AppData.ErrCounter == 0"); - UtAssert_True (strncmp(MM_AppData.PipeName, "MM_CMD_PIPE", 16) == 0, "strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0"); - UtAssert_True (MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH, "MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH"); - UtAssert_True (MM_AppData.LimitHK == MM_HK_LIMIT, "MM_AppData.LimitHK == MM_HK_LIMIT"); - UtAssert_True (MM_AppData.LimitCmd == MM_CMD_LIMIT, "MM_AppData.LimitCmd == MM_CMD_LIMIT"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - - UtAssert_True - (Ut_CFE_ES_SysLogWritten("MM App: Error Registering For Event Services, RC = 0xFFFFFFFF\n"), - "MM App: Error Registering For Event Services, RC = 0xFFFFFFFF\n"); - - UtAssert_True (Ut_CFE_ES_GetSysLogQueueDepth() == 1, "Ut_CFE_ES_GetSysLogQueueDepth() == 1"); - -} /* end MM_AppInit_Test_EVSRegisterError */ - -void MM_AppInit_Test_SBCreatePipeError(void) -{ - int32 Result; - - /* Initialize all elements to 1, in order verify that elements initialized to 0 by MM_AppInit are actually initialized */ - CFE_PSP_MemSet(&MM_AppData, 1, sizeof(MM_AppData_t)); - - /* Set to generate system log message "MM App: Error Creating SB Pipe" */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_CREATEPIPE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_AppInit(); - - /* Verify results */ - UtAssert_True (Result == -1, "Result == -1"); - - UtAssert_True (MM_AppData.RunStatus == CFE_ES_APP_RUN, "MM_AppData.RunStatus == CFE_ES_APP_RUN"); - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 0, "MM_AppData.ErrCounter == 0"); - UtAssert_True (strncmp(MM_AppData.PipeName, "MM_CMD_PIPE", 16) == 0, "strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0"); - UtAssert_True (MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH, "MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH"); - UtAssert_True (MM_AppData.LimitHK == MM_HK_LIMIT, "MM_AppData.LimitHK == MM_HK_LIMIT"); - UtAssert_True (MM_AppData.LimitCmd == MM_CMD_LIMIT, "MM_AppData.LimitCmd == MM_CMD_LIMIT"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - - UtAssert_True - (Ut_CFE_ES_SysLogWritten("MM App: Error Creating SB Pipe, RC = 0xFFFFFFFF\n"), - "MM App: Error Creating SB Pipe, RC = 0xFFFFFFFF\n"); - - UtAssert_True (Ut_CFE_ES_GetSysLogQueueDepth() == 1, "Ut_CFE_ES_GetSysLogQueueDepth() == 1"); - -} /* end MM_AppInit_Test_SBCreatePipeError */ - -void MM_AppInit_Test_SBSubscribeHKError(void) -{ - int32 Result; - - /* Initialize all elements to 1, in order verify that elements initialized to 0 by MM_AppInit are actually initialized */ - CFE_PSP_MemSet(&MM_AppData, 1, sizeof(MM_AppData_t)); - - /* Set to generate system log message "MM App: Error Subscribing to HK Request" */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_SUBSCRIBE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_AppInit(); - - /* Verify results */ - UtAssert_True (Result == -1, "Result == -1"); - - UtAssert_True (MM_AppData.RunStatus == CFE_ES_APP_RUN, "MM_AppData.RunStatus == CFE_ES_APP_RUN"); - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 0, "MM_AppData.ErrCounter == 0"); - UtAssert_True (strncmp(MM_AppData.PipeName, "MM_CMD_PIPE", 16) == 0, "strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0"); - UtAssert_True (MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH, "MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH"); - UtAssert_True (MM_AppData.LimitHK == MM_HK_LIMIT, "MM_AppData.LimitHK == MM_HK_LIMIT"); - UtAssert_True (MM_AppData.LimitCmd == MM_CMD_LIMIT, "MM_AppData.LimitCmd == MM_CMD_LIMIT"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - - UtAssert_True - (Ut_CFE_ES_SysLogWritten("MM App: Error Subscribing to HK Request, RC = 0xFFFFFFFF\n"), - "MM App: Error Subscribing to HK Request, RC = 0xFFFFFFFF\n"); - - UtAssert_True (Ut_CFE_ES_GetSysLogQueueDepth() == 1, "Ut_CFE_ES_GetSysLogQueueDepth() == 1"); - -} /* end MM_AppInit_Test_SBSubscribeHKError */ - -void MM_AppInit_Test_SBSubscribeMMError(void) -{ - int32 Result; - - /* Initialize all elements to 1, in order verify that elements initialized to 0 by MM_AppInit are actually initialized */ - CFE_PSP_MemSet(&MM_AppData, 1, sizeof(MM_AppData_t)); - - /* Set to generate system log message "MM App: Error Subscribing to MM Command" */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_SUBSCRIBE_INDEX, -1, 2); - - /* Execute the function being tested */ - Result = MM_AppInit(); - - /* Verify results */ - UtAssert_True (Result == -1, "Result == -1"); - - UtAssert_True (MM_AppData.RunStatus == CFE_ES_APP_RUN, "MM_AppData.RunStatus == CFE_ES_APP_RUN"); - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 0, "MM_AppData.ErrCounter == 0"); - UtAssert_True (strncmp(MM_AppData.PipeName, "MM_CMD_PIPE", 16) == 0, "strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0"); - UtAssert_True (MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH, "MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH"); - UtAssert_True (MM_AppData.LimitHK == MM_HK_LIMIT, "MM_AppData.LimitHK == MM_HK_LIMIT"); - UtAssert_True (MM_AppData.LimitCmd == MM_CMD_LIMIT, "MM_AppData.LimitCmd == MM_CMD_LIMIT"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - - UtAssert_True - (Ut_CFE_ES_SysLogWritten("MM App: Error Subscribing to MM Command, RC = 0xFFFFFFFF\n"), - "MM App: Error Subscribing to MM Command, RC = 0xFFFFFFFF\n"); - - UtAssert_True (Ut_CFE_ES_GetSysLogQueueDepth() == 1, "Ut_CFE_ES_GetSysLogQueueDepth() == 1"); - -} /* end MM_AppInit_Test_SBSubscribeMMError */ - -void MM_AppPipe_Test_Noop(void) -{ - MM_NoArgsCmd_t CmdPacket; - char Message[125]; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_NoArgsCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_NOOP_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - sprintf(Message, "No-op command. Version %d.%d.%d.%d", MM_MAJOR_VERSION, MM_MINOR_VERSION, MM_REVISION, MM_MISSION_REV); - UtAssert_True (Ut_CFE_EVS_EventSent(MM_NOOP_INF_EID, CFE_EVS_INFORMATION, Message), Message); - /* Note: this event message is generated in subfunction MM_NoopCmd. It is checked here to verify that the subfunction has been reached. */ - - UtAssert_True (MM_AppData.LastAction == MM_NOOP, "MM_AppData.LastAction == MM_NOOP"); - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); -} /* end MM_AppPipe_Test_Noop */ - -void MM_AppPipe_Test_Reset(void) -{ - MM_NoArgsCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_NoArgsCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_RESET_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_RESET_DBG_EID, CFE_EVS_DEBUG, "Reset counters command received"), - "Reset counters command received"); - /* Note: this event message is generated in subfunction MM_ResetCmd. It is checked here to verify that the subfunction has been reached. */ - - UtAssert_True (MM_AppData.LastAction == MM_RESET, "MM_AppData.LastAction == MM_RESET"); - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 0, "MM_AppData.ErrCounter == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_Reset */ - -void MM_AppPipe_Test_Peek(void) -{ - MM_PeekCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PeekCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_PEEK_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_PeekCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_Peek */ - -void MM_AppPipe_Test_Poke(void) -{ - MM_PokeCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_PokeCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_Poke */ - -void MM_AppPipe_Test_LoadMemWID(void) -{ - MM_LoadMemWIDCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemWIDCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_WID_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_LoadMemWIDCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_LoadMemWID */ - -void MM_AppPipe_Test_LoadMemFromFile(void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_LoadMemFromFileCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_LoadMemFromFile */ - -void MM_AppPipe_Test_DumpMemToFile(void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_DumpMemToFileCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_DumpMemToFile */ - -void MM_AppPipe_Test_DumpInEvent(void) -{ - MM_DumpInEventCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_IN_EVENT_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_DumpInEventCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_DumpInEvent */ - -void MM_AppPipe_Test_FillMem(void) -{ - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_FillMemCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_FillMem */ - -void MM_AppPipe_Test_LookupSymbol(void) -{ - MM_LookupSymCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LookupSymCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOOKUP_SYM_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_LookupSymbolCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_LookupSymbol */ - -void MM_AppPipe_Test_SymTblToFile(void) -{ - MM_SymTblToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_SymTblToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_SYMTBL_TO_FILE_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_SymTblToFileCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_SymTblToFile */ - -void MM_AppPipe_Test_EnableEepromWrite(void) -{ - MM_EepromWriteEnaCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_EepromWriteEnaCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_ENABLE_EEPROM_WRITE_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_EepromWriteEnaCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_EnableEepromWrite */ - -void MM_AppPipe_Test_DisableEepromWrite(void) -{ - MM_EepromWriteDisCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_EepromWriteDisCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DISABLE_EEPROM_WRITE_CC); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message in subfunction MM_EepromWriteDisCmd. Event message count = 1 verifies that the subfunction has been reached. */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_DisableEepromWrite */ - -void MM_AppPipe_Test_InvalidCommandCode(void) -{ - MM_NoArgsCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_NoArgsCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, 99); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_CC1_ERR_EID, CFE_EVS_ERROR, "Invalid ground command code: ID = 0x1888, CC = 99"), - "Invalid ground command code: ID = 0x1888, CC = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_InvalidCommandCode */ - -void MM_AppPipe_Test_InvalidCommandPipeMessageID(void) -{ - MM_NoArgsCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, 15, sizeof(MM_NoArgsCmd_t), TRUE); - - /* Execute the function being tested */ - MM_AppPipe((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_MID_ERR_EID, CFE_EVS_ERROR, "Invalid command pipe message ID: 0xF"), - "Invalid command pipe message ID: 0xF"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_AppPipe_Test_InvalidCommandPipeMessageID */ - -void MM_HousekeepingCmd_Test(void) -{ - MM_NoArgsCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_HK_TLM_MID, sizeof(MM_NoArgsCmd_t), TRUE); - - MM_AppData.CmdCounter = 1; - MM_AppData.ErrCounter = 2; - MM_AppData.LastAction = 3; - MM_AppData.MemType = 4; - MM_AppData.Address = 5; - MM_AppData.DataValue = 6; - MM_AppData.BytesProcessed = 7; - - strncpy(MM_AppData.FileName, "name", OS_MAX_PATH_LEN); - - /* Execute the function being tested */ - MM_HousekeepingCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.HkPacket.CmdCounter == 1, "MM_AppData.HkPacket.CmdCounter == 1"); - UtAssert_True (MM_AppData.HkPacket.ErrCounter == 2, "MM_AppData.HkPacket.ErrCounter == 2"); - UtAssert_True (MM_AppData.HkPacket.LastAction == 3, "MM_AppData.HkPacket.LastAction == 3"); - UtAssert_True (MM_AppData.HkPacket.MemType == 4, "MM_AppData.HkPacket.MemType == 4"); - UtAssert_True (MM_AppData.HkPacket.Address == 5, "MM_AppData.HkPacket.Address == 5"); - UtAssert_True (MM_AppData.HkPacket.DataValue == 6, "MM_AppData.HkPacket.DataValue == 6"); - UtAssert_True (MM_AppData.HkPacket.BytesProcessed == 7, "MM_AppData.HkPacket.BytesProcessed == 7"); - - UtAssert_True - (strncmp(MM_AppData.HkPacket.FileName, MM_AppData.FileName, OS_MAX_PATH_LEN) == 0, - "strncmp(MM_AppData.HkPacket.FileName, MM_AppData.FileName, OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_HousekeepingCmd_Test */ - -void MM_LookupSymbolCmd_Test_Nominal(void) -{ - MM_LookupSymCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LookupSymCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOOKUP_SYM_CC); - - strncpy(CmdPacket.SymName, "name", OS_MAX_PATH_LEN); - - /* Execute the function being tested */ - MM_LookupSymbolCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_SYM_LOOKUP, "MM_AppData.LastAction == MM_SYM_LOOKUP"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYM_LOOKUP_INF_EID, CFE_EVS_INFORMATION, "Symbol Lookup Command: Name = 'name' Addr = 0x00000000"), - "Symbol Lookup Command: Name = 'name' Addr = 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LookupSymbolCmd_Test_Nominal */ - -void MM_LookupSymbolCmd_Test_SymbolNameNull(void) -{ - MM_LookupSymCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LookupSymCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOOKUP_SYM_CC); - - strncpy(CmdPacket.SymName, "", OS_MAX_PATH_LEN); - - /* Execute the function being tested */ - MM_LookupSymbolCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_NUL_ERR_EID, CFE_EVS_ERROR, "NUL (empty) string specified as symbol name"), - "NUL (empty) string specified as symbol name"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LookupSymbolCmd_Test_SymbolNameNull */ - -void MM_LookupSymbolCmd_Test_SymbolLookupError(void) -{ - MM_LookupSymCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LookupSymCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOOKUP_SYM_CC); - - strncpy(CmdPacket.SymName, "name", OS_MAX_PATH_LEN); - - /* Set to generate error message MM_SYMNAME_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_LookupSymbolCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'name'"), - "Symbolic address can't be resolved: Name = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LookupSymbolCmd_Test_SymbolLookupError */ - -void MM_SymTblToFileCmd_Test_Nominal(void) -{ - MM_SymTblToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_SymTblToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_SYMTBL_TO_FILE_CC); - - strncpy(CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Set to satisfy condition "OS_Status == OS_SUCCESS" */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLTABLEDUMP_INDEX, CFE_SUCCESS, 1); - - /* Execute the function being tested */ - MM_SymTblToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_SYMTBL_SAVE, "MM_AppData.LastAction == MM_SYMTBL_SAVE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMTBL_TO_FILE_INF_EID, CFE_EVS_INFORMATION, "Symbol Table Dump to File Started: Name = 'name'"), - "Symbol Table Dump to File Started: Name = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_SymTblToFileCmd_Test_Nominal */ - -void MM_SymTblToFileCmd_Test_SymbolFilenameNull(void) -{ - MM_SymTblToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_SymTblToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_SYMTBL_TO_FILE_CC); - - strncpy(CmdPacket.FileName, "", OS_MAX_PATH_LEN); - - /* Execute the function being tested */ - MM_SymTblToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMFILENAME_NUL_ERR_EID, CFE_EVS_ERROR, "NUL (empty) string specified as symbol dump file name"), - "NUL (empty) string specified as symbol dump file name"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_SymTblToFileCmd_Test_SymbolFilenameNull */ - -void MM_SymTblToFileCmd_Test_SymbolTableDumpError(void) -{ - MM_SymTblToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_SymTblToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_SYMTBL_TO_FILE_CC); - - strncpy(CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Set to generate error message MM_SYMTBL_TO_FILE_FAIL_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLTABLEDUMP_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_SymTblToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMTBL_TO_FILE_FAIL_ERR_EID, CFE_EVS_ERROR, "Error dumping symbol table, OS_Status= 0xFFFFFFFF, File='name'"), - "Error dumping symbol table, OS_Status= 0xFFFFFFFF, File='name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_SymTblToFileCmd_Test_SymbolTableDumpError */ - -void MM_SymTblToFileCmd_Test_IllegalCharacters(void) -{ - MM_SymTblToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_SymTblToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_SYMTBL_TO_FILE_CC); - - strncpy(CmdPacket.FileName, "***name***", OS_MAX_PATH_LEN); - - /* Execute the function being tested */ - MM_SymTblToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMTBL_TO_FILE_INVALID_ERR_EID, CFE_EVS_ERROR, "Illegal characters in target filename, File='***name***'"), - "Illegal characters in target filename, File='***name***'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_SymTblToFileCmd_Test_IllegalCharacters */ - -void MM_EepromWriteEnaCmd_Test_Nominal(void) -{ - MM_EepromWriteEnaCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_EepromWriteEnaCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_ENABLE_EEPROM_WRITE_CC); - - CmdPacket.Bank = 1; - - /* Execute the function being tested */ - MM_EepromWriteEnaCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_EEPROMWRITE_ENA, "MM_AppData.LastAction == MM_EEPROMWRITE_ENA"); - UtAssert_True (MM_AppData.MemType == MM_EEPROM, "MM_AppData.MemType == MM_EEPROM"); - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_EEPROM_WRITE_ENA_INF_EID, CFE_EVS_INFORMATION, "EEPROM bank 1 write enabled, cFE_Status= 0x0"), - "EEPROM bank 1 write enabled, cFE_Status= 0x0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_EepromWriteEnaCmd_Test_Nominal */ - -void MM_EepromWriteEnaCmd_Test_Error(void) -{ - MM_EepromWriteEnaCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_EepromWriteEnaCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_ENABLE_EEPROM_WRITE_CC); - - CmdPacket.Bank = 1; - - /* Set to generate error message MM_EEPROM_WRITE_ENA_ERR_EID */ - Ut_CFE_PSP_EEPROM_SetReturnCode(UT_CFE_PSP_EEPROM_WRITEENABLE_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_EepromWriteEnaCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_EEPROM_WRITE_ENA_ERR_EID, CFE_EVS_ERROR, "Error requesting EEPROM bank 1 write enable, cFE_Status= 0xF"), - "Error requesting EEPROM bank 1 write enable, cFE_Status= 0xF"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_EepromWriteEnaCmd_Test_Error */ - -void MM_EepromWriteDisCmd_Test_Nominal(void) -{ - MM_EepromWriteDisCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_EepromWriteDisCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DISABLE_EEPROM_WRITE_CC); - - CmdPacket.Bank = 1; - - /* Execute the function being tested */ - MM_EepromWriteDisCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_EEPROMWRITE_DIS, "MM_AppData.LastAction == MM_EEPROMWRITE_DIS"); - UtAssert_True (MM_AppData.MemType == MM_EEPROM, "MM_AppData.MemType == MM_EEPROM"); - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_EEPROM_WRITE_DIS_INF_EID, CFE_EVS_INFORMATION, "EEPROM bank 1 write disabled, cFE_Status= 0x0"), - "EEPROM bank 1 write disabled, cFE_Status= 0x0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_EepromWriteDisCmd_Test_Nominal */ - -void MM_EepromWriteDisCmd_Test_Error(void) -{ - MM_EepromWriteDisCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_EepromWriteDisCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DISABLE_EEPROM_WRITE_CC); - - CmdPacket.Bank = 1; - - /* Set to generate error message MM_EEPROM_WRITE_DIS_ERR_EID */ - Ut_CFE_PSP_EEPROM_SetReturnCode(UT_CFE_PSP_EEPROM_WRITEDISABLE_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_EepromWriteDisCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_EEPROM_WRITE_DIS_ERR_EID, CFE_EVS_ERROR, "Error requesting EEPROM bank 1 write disable, cFE_Status= 0xF"), - "Error requesting EEPROM bank 1 write edisable, cFE_Status= 0xF"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_EepromWriteDisCmd_Test_Error */ - -void MM_App_Test_AddTestCases(void) -{ - UtTest_Add(MM_AppMain_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_AppMain_Test_Nominal"); - UtTest_Add(MM_AppMain_Test_AppInitError, MM_Test_Setup, MM_Test_TearDown, "MM_AppMain_Test_AppInitError"); - UtTest_Add(MM_AppMain_Test_SBError, MM_Test_Setup, MM_Test_TearDown, "MM_AppMain_Test_SBError"); - UtTest_Add(MM_AppInit_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_AppInit_Test_Nominal"); - UtTest_Add(MM_AppInit_Test_EVSRegisterError, MM_Test_Setup, MM_Test_TearDown, "MM_AppInit_Test_EVSRegisterError"); - UtTest_Add(MM_AppInit_Test_SBCreatePipeError, MM_Test_Setup, MM_Test_TearDown, "MM_AppInit_Test_SBCreatePipeError"); - UtTest_Add(MM_AppInit_Test_SBSubscribeHKError, MM_Test_Setup, MM_Test_TearDown, "MM_AppInit_Test_SBSubscribeHKError"); - UtTest_Add(MM_AppInit_Test_SBSubscribeMMError, MM_Test_Setup, MM_Test_TearDown, "MM_AppInit_Test_SBSubscribeMMError"); - UtTest_Add(MM_AppPipe_Test_Noop, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_Noop"); - UtTest_Add(MM_AppPipe_Test_Reset, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_Reset"); - UtTest_Add(MM_AppPipe_Test_Peek, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_Peek"); - UtTest_Add(MM_AppPipe_Test_Poke, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_Poke"); - UtTest_Add(MM_AppPipe_Test_LoadMemWID, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_LoadMemWID"); - UtTest_Add(MM_AppPipe_Test_LoadMemFromFile, MM_Test_Setup, MM_Test_TearDown, "LoadMemFromFile"); - UtTest_Add(MM_AppPipe_Test_DumpMemToFile, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_DumpMemToFile"); - UtTest_Add(MM_AppPipe_Test_DumpInEvent, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_DumpInEvent"); - UtTest_Add(MM_AppPipe_Test_FillMem, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_FillMem"); - UtTest_Add(MM_AppPipe_Test_LookupSymbol, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_LookupSymbol"); - UtTest_Add(MM_AppPipe_Test_SymTblToFile, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_SymTblToFile"); - UtTest_Add(MM_AppPipe_Test_EnableEepromWrite, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_EnableEepromWrite"); - UtTest_Add(MM_AppPipe_Test_DisableEepromWrite, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_DisableEepromWrite"); - UtTest_Add(MM_AppPipe_Test_InvalidCommandCode, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_InvalidCommandCode"); - UtTest_Add(MM_AppPipe_Test_InvalidCommandPipeMessageID, MM_Test_Setup, MM_Test_TearDown, "MM_AppPipe_Test_InvalidCommandPipeMessageID"); - UtTest_Add(MM_HousekeepingCmd_Test, MM_Test_Setup, MM_Test_TearDown, "MM_HousekeepingCmd_Test"); - UtTest_Add(MM_LookupSymbolCmd_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_LookupSymbolCmd_Test_Nominal"); - UtTest_Add(MM_LookupSymbolCmd_Test_SymbolNameNull, MM_Test_Setup, MM_Test_TearDown, "MM_LookupSymbolCmd_Test_SymbolNameNull"); - UtTest_Add(MM_LookupSymbolCmd_Test_SymbolLookupError, MM_Test_Setup, MM_Test_TearDown, "MM_LookupSymbolCmd_Test_SymbolLookupError"); - UtTest_Add(MM_SymTblToFileCmd_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_SymTblToFileCmd_Test_Nominal"); - UtTest_Add(MM_SymTblToFileCmd_Test_SymbolFilenameNull, MM_Test_Setup, MM_Test_TearDown, "MM_SymTblToFileCmd_Test_SymbolFilenameNull"); - UtTest_Add(MM_SymTblToFileCmd_Test_SymbolTableDumpError, MM_Test_Setup, MM_Test_TearDown, "MM_SymTblToFileCmd_Test_SymbolTableDumpError"); - UtTest_Add(MM_SymTblToFileCmd_Test_IllegalCharacters, MM_Test_Setup, MM_Test_TearDown, "MM_SymTblToFileCmd_Test_IllegalCharacters"); - UtTest_Add(MM_EepromWriteEnaCmd_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_EepromWriteEnaCmd_Test_Nominal"); - UtTest_Add(MM_EepromWriteEnaCmd_Test_Error, MM_Test_Setup, MM_Test_TearDown, "MM_EepromWriteEnaCmd_Test_Error"); - UtTest_Add(MM_EepromWriteDisCmd_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_EepromWriteDisCmd_Test_Nominal"); - UtTest_Add(MM_EepromWriteDisCmd_Test_Error, MM_Test_Setup, MM_Test_TearDown, "MM_EepromWriteDisCmd_Test_Error"); -} /* end MM_App_Test_AddTestCases */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_app_test.h b/fsw/unit_test/mm_app_test.h deleted file mode 100644 index ecff4d4..0000000 --- a/fsw/unit_test/mm_app_test.h +++ /dev/null @@ -1,34 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_app_test.h 1.3 2016/03/03 21:24:58EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes for the unit test cases for mm_app_test.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_app_test.h $ - ** Revision 1.3 2016/03/03 21:24:58EST czogby - ** Add Integrity headers to all unit testl .h files - *************************************************************************/ - -/* - * Includes - */ - -#include "utassert.h" -#include "uttest.h" - -/* - * Function Prototypes - */ - -void MM_App_Test_AddTestCases(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_dump.c.gcov b/fsw/unit_test/mm_dump.c.gcov deleted file mode 100644 index 66b881f..0000000 --- a/fsw/unit_test/mm_dump.c.gcov +++ /dev/null @@ -1,1054 +0,0 @@ - -: 0:Source:../src/mm_dump.c - -: 0:Programs:7 - -: 1:/************************************************************************* - -: 2:** File: - -: 3:** $Id: mm_dump.c.gcov 1.3 2016/10/31 22:10:57EDT mdeschu Exp $ - -: 4:** - -: 5:** Copyright © 2007-2014 United States Government as represented by the - -: 6:** Administrator of the National Aeronautics and Space Administration. - -: 7:** All Other Rights Reserved. - -: 8:** - -: 9:** This software was created at NASA's Goddard Space Flight Center. - -: 10:** This software is governed by the NASA Open Source Agreement and may be - -: 11:** used, distributed and modified only pursuant to the terms of that - -: 12:** agreement. - -: 13:** - -: 14:** Purpose: - -: 15:** Functions used for processing CFS Memory Manager memory dump commands - -: 16:** - -: 17:** $Log: mm_dump.c.gcov $ - -: 17:** Revision 1.3 2016/10/31 22:10:57EDT mdeschu - -: 17:** Update gcov results, README and log file for MM unit tests for 2.4.1 - -: 18:** Revision 1.6 2016/10/31 00:15:54EDT mdeschu - -: 19:** Add missing default switch case to MM_DumpMemToFileCmd and MM_FillDumpInEventBuffer - -: 20:** Revision 1.5 2016/10/30 00:48:50EDT mdeschu - -: 21:** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent - -: 22:** Revision 1.4 2016/10/28 17:49:17EDT mdeschu - -: 23:** Trac #32: Fix MM SendEvent buffer overrun - -: 24:** Revision 1.3 2015/12/29 15:25:54EST czogby - -: 25:** Move function prototypes from .c files into .h files - -: 26:** Revision 1.2 2015/12/15 13:10:44EST czogby - -: 27:** Change error message to print value of SegmentSize - -: 28:** Revision 1.1 2015/07/28 12:21:38EDT rperera - -: 29:** Initial revision - -: 30:** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj - -: 31:** Revision 1.15 2015/04/14 15:29:03EDT lwalling - -: 32:** Removed unnecessary backslash characters from string format definitions - -: 33:** Revision 1.14 2015/04/06 15:41:25EDT lwalling - -: 34:** Verify results of calls to PSP memory read/write/copy/set functions - -: 35:** Revision 1.13 2015/03/30 17:34:00EDT lwalling - -: 36:** Create common process to maintain and report last action statistics - -: 37:** Revision 1.12 2015/03/20 14:16:25EDT lwalling - -: 38:** Add last peek/poke/fill command data value to housekeeping telemetry - -: 39:** Revision 1.11 2015/03/02 14:26:57EST sstrege - -: 40:** Added copyright information - -: 41:** Revision 1.10 2010/11/29 13:35:23EST jmdagost - -: 42:** Replaced ifdef tests with if-true tests. - -: 43:** Revision 1.9 2010/05/26 15:22:46EDT jmdagost - -: 44:** In function MM_FillDumpInEventBuffer, put local variable declaration in a pre-processor conditional. - -: 45:** Revision 1.8 2009/06/18 10:17:11EDT rmcgraw - -: 46:** DCR8291:1 Changed OS_MEM_ #defines to CFE_PSP_MEM_ - -: 47:** Revision 1.7 2009/06/10 14:04:22EDT rmcgraw - -: 48:** DCR82191:1 Changed os_bsp to cfe_psp and OS_Mem to CFE_PSP_Mem - -: 49:** Revision 1.6 2008/09/05 14:24:09EDT dahardison - -: 50:** Updated references to local HK variables - -: 51:** Revision 1.5 2008/09/05 13:14:45EDT dahardison - -: 52:** Added inclusion of mm_mission_cfg.h - -: 53:** Revision 1.4 2008/05/22 15:09:30EDT dahardison - -: 54:** Changed inclusion of cfs_lib.h to cfs_utils.h - -: 55:** Revision 1.3 2008/05/19 15:22:59EDT dahardison - -: 56:** Version after completion of unit testing - -: 57:** - -: 58:*************************************************************************/ - -: 59: - -: 60:/************************************************************************* - -: 61:** Includes - -: 62:*************************************************************************/ - -: 63:#include "mm_app.h" - -: 64:#include "mm_dump.h" - -: 65:#include "mm_events.h" - -: 66:#include "mm_mem32.h" - -: 67:#include "mm_mem16.h" - -: 68:#include "mm_mem8.h" - -: 69:#include "mm_utils.h" - -: 70:#include "mm_mission_cfg.h" - -: 71:#include "cfs_utils.h" - -: 72:#include - -: 73: - -: 74:/************************************************************************* - -: 75:** External Data - -: 76:*************************************************************************/ - -: 77:extern MM_AppData_t MM_AppData; - -: 78: - -: 79:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 80:/* */ - -: 81:/* Memory peek command */ - -: 82:/* */ - -: 83:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 3: 84:void MM_PeekCmd(CFE_SB_MsgPtr_t MessagePtr) - -: 85:{ - 3: 86: boolean Valid = TRUE; - -: 87: MM_PeekCmd_t *CmdPtr; - -: 88: uint32 SrcAddress; - 3: 89: uint16 ExpectedLength = sizeof(MM_PeekCmd_t); - -: 90: - -: 91: /* Verify command packet length */ - 3: 92: if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - -: 93: { - 3: 94: CmdPtr = ((MM_PeekCmd_t *)MessagePtr); - -: 95: - -: 96: /* Resolve the symbolic address in command message */ - 3: 97: Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); - -: 98: - 3: 99: if(Valid == TRUE) - -: 100: { - -: 101: /* Run necessary checks on command parameters */ - 2: 102: Valid = MM_VerifyPeekPokeParams(SrcAddress, CmdPtr->MemType, CmdPtr->DataSize); - -: 103: - -: 104: /* Check the specified memory type and call the appropriate routine */ - 2: 105: if(Valid == TRUE) - -: 106: { - -: 107: /* - -: 108: ** We use this single peek routine for all memory types - -: 109: ** (including the optional ones) - -: 110: */ - 1: 111: MM_PeekMem(CmdPtr, SrcAddress); - -: 112: } - -: 113: - -: 114: } /* end CFS_ResolveSymAddr if */ - -: 115: else - -: 116: { - 1: 117: MM_AppData.ErrCounter++; - 1: 118: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 119: "Symbolic address can't be resolved: Name = '%s'", - -: 120: CmdPtr->SrcSymAddress.SymName); - -: 121: } - -: 122: - -: 123: } /* end MM_VerifyCmdLength if */ - -: 124: - 3: 125: return; - -: 126: - -: 127:} /* end MM_PeekCmd */ - -: 128: - -: 129:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 130:/* */ - -: 131:/* Read 8,16, or 32 bits of data from any given input address */ - -: 132:/* */ - -: 133:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 7: 134:void MM_PeekMem (MM_PeekCmd_t *CmdPtr, - -: 135: uint32 SrcAddress) - -: 136:{ - 7: 137: boolean ValidPeek = TRUE; - 7: 138: uint8 ByteValue = 0; - 7: 139: uint16 WordValue = 0; - 7: 140: uint32 DWordValue = 0; - 7: 141: int32 PSP_Status = 0; - 7: 142: uint32 BytesProcessed = 0; - 7: 143: uint32 DataValue = 0; - -: 144: - -: 145: /* - -: 146: ** Read the requested number of bytes and report in an event message - -: 147: */ - 7: 148: switch(CmdPtr->DataSize) - -: 149: { - -: 150: case MM_BYTE_BIT_WIDTH: - -: 151: - 2: 152: PSP_Status = CFE_PSP_MemRead8(SrcAddress, &ByteValue); - 2: 153: if (PSP_Status == CFE_PSP_SUCCESS) - -: 154: { - 1: 155: DataValue = (uint32) ByteValue; - 1: 156: BytesProcessed = sizeof (uint8); - 1: 157: CFE_EVS_SendEvent(MM_PEEK_BYTE_INF_EID, CFE_EVS_INFORMATION, - -: 158: "Peek Command: Addr = 0x%08X Size = 8 bits Data = 0x%02X", - -: 159: (unsigned int)SrcAddress, ByteValue); - -: 160: } - -: 161: else - -: 162: { - 1: 163: ValidPeek = FALSE; - 1: 164: MM_AppData.ErrCounter++; - 1: 165: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 166: "PSP read memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - -: 167: (unsigned int)PSP_Status, (unsigned int)SrcAddress); - -: 168: } - 2: 169: break; - -: 170: - -: 171: case MM_WORD_BIT_WIDTH: - -: 172: - 2: 173: PSP_Status = CFE_PSP_MemRead16(SrcAddress, &WordValue); - 2: 174: if (PSP_Status == CFE_PSP_SUCCESS) - -: 175: { - 1: 176: DataValue = (uint32) WordValue; - 1: 177: BytesProcessed = sizeof (uint16); - 1: 178: CFE_EVS_SendEvent(MM_PEEK_WORD_INF_EID, CFE_EVS_INFORMATION, - -: 179: "Peek Command: Addr = 0x%08X Size = 16 bits Data = 0x%04X", - 1: 180: (unsigned int)SrcAddress, (unsigned short)DataValue); - -: 181: } - -: 182: else - -: 183: { - 1: 184: ValidPeek = FALSE; - 1: 185: MM_AppData.ErrCounter++; - 1: 186: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 187: "PSP read memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - -: 188: (unsigned int)PSP_Status, (unsigned int)SrcAddress); - -: 189: } - 2: 190: break; - -: 191: - -: 192: case MM_DWORD_BIT_WIDTH: - -: 193: - 3: 194: PSP_Status = CFE_PSP_MemRead32(SrcAddress, &DWordValue); - 3: 195: if (PSP_Status == CFE_PSP_SUCCESS) - -: 196: { - 2: 197: DataValue = DWordValue; - 2: 198: BytesProcessed = sizeof(uint32); - 2: 199: CFE_EVS_SendEvent(MM_PEEK_DWORD_INF_EID, CFE_EVS_INFORMATION, - -: 200: "Peek Command: Addr = 0x%08X Size = 32 bits Data = 0x%08X", - -: 201: (unsigned int)SrcAddress, (unsigned int)DataValue); - -: 202: } - -: 203: else - -: 204: { - 1: 205: ValidPeek = FALSE; - 1: 206: MM_AppData.ErrCounter++; - 1: 207: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 208: "PSP read memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - -: 209: (unsigned int)PSP_Status, (unsigned int)SrcAddress); - -: 210: } - -: 211: break; - -: 212: - -: 213: /* - -: 214: ** We don't need a default case, a bad DataSize will get caught - -: 215: ** in the MM_VerifyPeekPokeParams function and we won't get here - -: 216: */ - -: 217: default: - -: 218: break; - -: 219: } - -: 220: - 7: 221: if (ValidPeek) - -: 222: { - 4: 223: MM_AppData.CmdCounter++; - 4: 224: MM_AppData.LastAction = MM_PEEK; - 4: 225: MM_AppData.MemType = CmdPtr->MemType; - 4: 226: MM_AppData.Address = SrcAddress; - 4: 227: MM_AppData.BytesProcessed = BytesProcessed; - 4: 228: MM_AppData.DataValue = DataValue; - -: 229: } - -: 230: - 7: 231: return; - -: 232: - -: 233:} /* end MM_PeekMem */ - -: 234: - -: 235:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 236:/* */ - -: 237:/* Dump memory to file comand */ - -: 238:/* */ - -: 239:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 11: 240:void MM_DumpMemToFileCmd(CFE_SB_MsgPtr_t MessagePtr) - -: 241:{ - 11: 242: boolean Valid = TRUE; - 11: 243: int32 OS_Status = OS_SUCCESS; - -: 244: int32 FileHandle; - 11: 245: uint32 SrcAddress = 0; - -: 246: MM_DumpMemToFileCmd_t *CmdPtr; - -: 247: CFE_FS_Header_t CFEFileHeader; - -: 248: MM_LoadDumpFileHeader_t MMFileHeader; - 11: 249: uint16 ExpectedLength = sizeof(MM_DumpMemToFileCmd_t); - -: 250: - -: 251: /* Verify command packet length */ - 11: 252: if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - -: 253: { - 11: 254: CmdPtr = ((MM_DumpMemToFileCmd_t *)MessagePtr); - -: 255: - -: 256: /* - -: 257: ** NUL terminate the very end of the file name string array as a - -: 258: ** safety measure - -: 259: */ - 11: 260: CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; - -: 261: - -: 262: /* Verify filename doesn't have any illegal characters */ - 11: 263: Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); - 11: 264: if(Valid == TRUE) - -: 265: { - -: 266: /* Resolve the symbolic address in command message */ - 9: 267: Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); - -: 268: - 9: 269: if(Valid == TRUE) - -: 270: { - -: 271: /* Run necessary checks on command parameters */ - 8: 272: Valid = MM_VerifyFileDumpParams(SrcAddress, CmdPtr->MemType, CmdPtr->NumOfBytes); - -: 273: - 8: 274: if(Valid == TRUE) - -: 275: { - -: 276: /* - -: 277: ** Initialize the cFE primary file header structure - -: 278: */ - 8: 279: CFE_PSP_MemSet(&CFEFileHeader, 0, sizeof(CFE_FS_Header_t)); - 8: 280: CFEFileHeader.SubType = MM_CFE_HDR_SUBTYPE; - 8: 281: strcpy(&CFEFileHeader.Description[0], MM_CFE_HDR_DESCRIPTION); - -: 282: - -: 283: /* - -: 284: ** Initialize the MM secondary file header structure - -: 285: */ - 8: 286: CFE_PSP_MemSet(&MMFileHeader, 0, sizeof(MM_LoadDumpFileHeader_t)); - 8: 287: MMFileHeader.SymAddress.SymName[0] = MM_CLEAR_SYMNAME; - -: 288: - -: 289: /* - -: 290: ** Copy command data to file secondary header - -: 291: */ - 8: 292: MMFileHeader.SymAddress.Offset = SrcAddress; - 8: 293: MMFileHeader.MemType = CmdPtr->MemType; - 8: 294: MMFileHeader.NumOfBytes = CmdPtr->NumOfBytes; - -: 295: - -: 296: /* - -: 297: ** Create and open dump file - -: 298: */ - 8: 299: if((FileHandle = OS_creat(CmdPtr->FileName, OS_READ_WRITE)) >= 0) - -: 300: { - -: 301: /* Write the file headers */ - 7: 302: Valid = MM_WriteFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); - 7: 303: if(Valid == TRUE) - -: 304: { - 7: 305: switch(MMFileHeader.MemType) - -: 306: { - -: 307: case MM_RAM: - -: 308: case MM_EEPROM: - 2: 309: Valid = MM_DumpMemToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - 2: 310: break; - -: 311: - -: 312:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 313: case MM_MEM32: - 1: 314: Valid = MM_DumpMem32ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - 1: 315: break; - -: 316:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 317: - -: 318:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 319: case MM_MEM16: - 1: 320: Valid = MM_DumpMem16ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - 1: 321: break; - -: 322:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 323: - -: 324:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 325: case MM_MEM8: - 3: 326: Valid = MM_DumpMem8ToFile(FileHandle, CmdPtr->FileName, &MMFileHeader); - -: 327: break; - -: 328:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 329: default: - -: 330: /* This branch will never be executed. MMFileHeader.MemType will always - -: 331: * be valid value for this switch statement it is verified via - -: 332: * MM_VerifyFileDumpParams */ - -: 333: break; - -: 334: } - -: 335: - 7: 336: if(Valid == TRUE) - -: 337: { - -: 338: /* - -: 339: ** Compute CRC of dumped data - -: 340: */ - 7: 341: OS_lseek(FileHandle, (sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t)), OS_SEEK_SET); - -: 342: - 7: 343: OS_Status = CFS_ComputeCRCFromFile(FileHandle, &MMFileHeader.Crc, MM_DUMP_FILE_CRC_TYPE); - 7: 344: if(OS_Status == OS_SUCCESS) - -: 345: { - -: 346: /* - -: 347: ** Rewrite the file headers. The subfunctions will take care of moving - -: 348: ** the file pointer to the beginning of the file so we don't need to do it - -: 349: ** here. - -: 350: */ - 6: 351: Valid = MM_WriteFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); - -: 352: - -: 353: } /* end CFS_ComputeCRCFromFile if */ - -: 354: else - -: 355: { - 1: 356: MM_AppData.ErrCounter++; - 1: 357: CFE_EVS_SendEvent(MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_ERROR, - -: 358: "CFS_ComputeCRCFromFile error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, - -: 359: CmdPtr->FileName); - -: 360: } - -: 361: - -: 362: } /* end Valid == TRUE if */ - -: 363: - 7: 364: if(Valid == TRUE) - -: 365: { - 7: 366: MM_AppData.CmdCounter++; - 7: 367: CFE_EVS_SendEvent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, - -: 368: "Dump Memory To File Command: Dumped %d bytes from address 0x%08X to file '%s'", - -: 369: (int)MM_AppData.BytesProcessed, (unsigned int)SrcAddress, CmdPtr->FileName); - -: 370: /* - -: 371: ** Update last action statistics - -: 372: */ - 7: 373: MM_AppData.LastAction = MM_DUMP_TO_FILE; - 7: 374: strncpy(MM_AppData.FileName, CmdPtr->FileName, OS_MAX_PATH_LEN); - 7: 375: MM_AppData.MemType = CmdPtr->MemType; - 7: 376: MM_AppData.Address = SrcAddress; - 7: 377: MM_AppData.BytesProcessed = CmdPtr->NumOfBytes; - -: 378: } - -: 379: - -: 380: } /* end MM_WriteFileHeaders if */ - -: 381: - -: 382: /* - -: 383: ** Don't need an 'else' here. MM_WriteFileHeaders will increment - -: 384: ** the error counter and generate an event message if needed. - -: 385: */ - -: 386: - -: 387: /* Close dump file */ - 7: 388: if((OS_Status = OS_close(FileHandle)) != OS_SUCCESS) - -: 389: { - 1: 390: MM_AppData.ErrCounter++; - 1: 391: CFE_EVS_SendEvent(MM_OS_CLOSE_ERR_EID, CFE_EVS_ERROR, - -: 392: "OS_close error received: RC = 0x%08X File = '%s'", - -: 393: (unsigned int)OS_Status, CmdPtr->FileName); - -: 394: } - -: 395: - -: 396: } /* end OS_creat if */ - -: 397: else - -: 398: { - 1: 399: MM_AppData.ErrCounter++; - 1: 400: CFE_EVS_SendEvent(MM_OS_CREAT_ERR_EID, CFE_EVS_ERROR, - -: 401: "OS_creat error received: RC = 0x%08X File = '%s'", - -: 402: (unsigned int)FileHandle, CmdPtr->FileName); - -: 403: } - -: 404: - -: 405: } /* end MM_VerifyFileDumpParams if */ - -: 406: - -: 407: } /* end CFS_ResolveSymAddr if */ - -: 408: else - -: 409: { - 1: 410: MM_AppData.ErrCounter++; - 1: 411: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 412: "Symbolic address can't be resolved: Name = '%s'", - -: 413: CmdPtr->SrcSymAddress.SymName); - -: 414: } - -: 415: } /* end IsValidFilename if */ - -: 416: else - -: 417: { - 2: 418: MM_AppData.ErrCounter++; - 2: 419: CFE_EVS_SendEvent(MM_CMD_FNAME_ERR_EID, CFE_EVS_ERROR, - -: 420: "Command specified filename invalid: Name = '%s'", CmdPtr->FileName); - -: 421: } - -: 422: - -: 423: } /* end MM_VerifyCmdLength if */ - -: 424: - 11: 425: return; - -: 426: - -: 427:} /* end MM_DumpMemoryToFileCmd */ - -: 428: - -: 429:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 430:/* */ - -: 431:/* Dump the requested number of bytes from memory to a file */ - -: 432:/* */ - -: 433:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 6: 434:boolean MM_DumpMemToFile(uint32 FileHandle, - -: 435: char *FileName, - -: 436: MM_LoadDumpFileHeader_t *FileHeader) - -: 437:{ - 6: 438: boolean ValidDump = FALSE; - -: 439: int32 OS_Status; - -: 440: int32 PSP_Status; - 6: 441: uint32 BytesRemaining = FileHeader->NumOfBytes; - 6: 442: uint32 BytesProcessed = 0; - 6: 443: uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - 6: 444: uint8 *SourcePtr = (uint8 *)FileHeader->SymAddress.Offset; - 6: 445: uint8 *ioBuffer = (uint8 *) &MM_AppData.DumpBuffer[0]; - -: 446: - 19: 447: while (BytesRemaining != 0) - -: 448: { - 7: 449: if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - -: 450: { - 5: 451: SegmentSize = BytesRemaining; - -: 452: } - -: 453: - 7: 454: PSP_Status = CFE_PSP_MemCpy(ioBuffer, SourcePtr, SegmentSize); - 7: 455: if (PSP_Status == CFE_PSP_SUCCESS) - -: 456: { - 6: 457: OS_Status = OS_write(FileHandle, ioBuffer, SegmentSize); - 6: 458: if (OS_Status == SegmentSize) - -: 459: { - 5: 460: SourcePtr += SegmentSize; - 5: 461: BytesRemaining -= SegmentSize; - 5: 462: BytesProcessed += SegmentSize; - -: 463: - -: 464: /* Prevent CPU hogging between dump segments */ - 5: 465: if (BytesRemaining != 0) - -: 466: { - 1: 467: MM_SegmentBreak(); - -: 468: } - -: 469: } - -: 470: else - -: 471: { - 1: 472: BytesRemaining = 0; - 1: 473: MM_AppData.ErrCounter++; - 1: 474: CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - -: 475: "OS_write error received: RC = 0x%08X, Expected = %d, File = '%s'", - -: 476: (unsigned int)OS_Status, (int)SegmentSize, FileName); - -: 477: } - -: 478: } - -: 479: else - -: 480: { - 1: 481: BytesRemaining = 0; - 1: 482: MM_AppData.ErrCounter++; - 1: 483: CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - -: 484: "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - -: 485: (unsigned int)PSP_Status, (unsigned int) SourcePtr, (unsigned int)ioBuffer, (unsigned int)SegmentSize); - -: 486: } - -: 487: } - -: 488: - -: 489: /* Update last action statistics */ - 6: 490: if (BytesProcessed == FileHeader->NumOfBytes) - -: 491: { - 4: 492: ValidDump = TRUE; - 4: 493: MM_AppData.LastAction = MM_DUMP_TO_FILE; - 4: 494: MM_AppData.MemType = FileHeader->MemType; - 4: 495: MM_AppData.Address = FileHeader->SymAddress.Offset; - 4: 496: MM_AppData.BytesProcessed = BytesProcessed; - 4: 497: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - -: 498: } - -: 499: - 6: 500: return(ValidDump); - -: 501: - -: 502:} /* end MM_DumpMemToFile */ - -: 503: - -: 504:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 505:/* */ - -: 506:/* Verify dump memory to file command parameters */ - -: 507:/* */ - -: 508:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 31: 509:boolean MM_VerifyFileDumpParams(uint32 Address, - -: 510: uint8 MemType, - -: 511: uint32 SizeInBytes) - -: 512:{ - 31: 513: boolean Valid = TRUE; - -: 514: int32 OS_Status; - -: 515: - 31: 516: switch(MemType) - -: 517: { - -: 518: case MM_RAM: - 5: 519: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 520: - 5: 521: if (OS_Status != OS_SUCCESS) - -: 522: { - 1: 523: Valid = FALSE; - 1: 524: MM_AppData.ErrCounter++; - 1: 525: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 526: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 527: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 528: } - 4: 529: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_RAM)) - -: 530: { - 2: 531: Valid = FALSE; - 2: 532: MM_AppData.ErrCounter++; - 2: 533: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 534: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 535: } - 5: 536: break; - -: 537: - -: 538: case MM_EEPROM: - 5: 539: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 540: - 5: 541: if (OS_Status != OS_SUCCESS) - -: 542: { - 1: 543: Valid = FALSE; - 1: 544: MM_AppData.ErrCounter++; - 1: 545: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 546: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 547: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 548: } - 4: 549: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_EEPROM)) - -: 550: { - 2: 551: Valid = FALSE; - 2: 552: MM_AppData.ErrCounter++; - 2: 553: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 554: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 555: } - 5: 556: break; - -: 557: - -: 558:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 559: case MM_MEM32: - 6: 560: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 561: - 6: 562: if (OS_Status != OS_SUCCESS) - -: 563: { - 1: 564: Valid = FALSE; - 1: 565: MM_AppData.ErrCounter++; - 1: 566: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 567: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 568: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 569: } - 7: 570: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_MEM32)) - -: 571: { - 2: 572: Valid = FALSE; - 2: 573: MM_AppData.ErrCounter++; - 2: 574: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 575: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 576: } - 3: 577: else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - -: 578: { - 1: 579: Valid = FALSE; - 1: 580: MM_AppData.ErrCounter++; - 1: 581: CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - -: 582: "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - -: 583: (unsigned int)Address, (int)SizeInBytes); - -: 584: } - 6: 585: break; - -: 586:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 587: - -: 588:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 589: case MM_MEM16: - 6: 590: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 591: - 6: 592: if (OS_Status != OS_SUCCESS) - -: 593: { - 1: 594: Valid = FALSE; - 1: 595: MM_AppData.ErrCounter++; - 1: 596: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 597: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 598: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 599: } - 7: 600: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_MEM16)) - -: 601: { - 2: 602: Valid = FALSE; - 2: 603: MM_AppData.ErrCounter++; - 2: 604: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 605: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 606: } - 3: 607: else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - -: 608: { - 1: 609: Valid = FALSE; - 1: 610: MM_AppData.ErrCounter++; - 1: 611: CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - -: 612: "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - -: 613: (unsigned int)Address, (int)SizeInBytes); - -: 614: } - 6: 615: break; - -: 616:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 617: - -: 618:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 619: case MM_MEM8: - 8: 620: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 621: - 8: 622: if (OS_Status != OS_SUCCESS) - -: 623: { - 1: 624: Valid = FALSE; - 1: 625: MM_AppData.ErrCounter++; - 1: 626: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 627: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 628: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 629: } - 7: 630: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_FILE_DATA_MEM8)) - -: 631: { - 2: 632: Valid = FALSE; - 2: 633: MM_AppData.ErrCounter++; - 2: 634: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 635: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 636: } - 8: 637: break; - -: 638:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 639: - -: 640: default: - 1: 641: Valid = FALSE; - 1: 642: MM_AppData.ErrCounter++; - 1: 643: CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - -: 644: "Invalid memory type specified: MemType = %d", MemType); - -: 645: break; - -: 646: } - -: 647: - 31: 648: return (Valid); - -: 649: - -: 650:} /* end MM_VerifyFileDumpParams */ - -: 651: - -: 652:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 653:/* */ - -: 654:/* Write the cFE primary and and MM secondary file headers */ - -: 655:/* */ - -: 656:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 16: 657:boolean MM_WriteFileHeaders(char *FileName, - -: 658: int32 FileHandle, - -: 659: CFE_FS_Header_t *CFEHeader, - -: 660: MM_LoadDumpFileHeader_t *MMHeader) - -: 661:{ - 16: 662: boolean Valid = TRUE; - -: 663: int32 OS_Status; - -: 664: - -: 665: /* - -: 666: ** Write out the primary cFE file header - -: 667: */ - 16: 668: OS_Status = CFE_FS_WriteHeader(FileHandle, CFEHeader); - 16: 669: if(OS_Status != sizeof(CFE_FS_Header_t)) - -: 670: { - -: 671: /* We either got an error or didn't write as much data as expected */ - 1: 672: Valid = FALSE; - 1: 673: MM_AppData.ErrCounter++; - 1: 674: CFE_EVS_SendEvent(MM_CFE_FS_WRITEHDR_ERR_EID, CFE_EVS_ERROR, - -: 675: "CFE_FS_WriteHeader error received: RC = 0x%08X Expected = %d File = '%s'", - -: 676: (unsigned int)OS_Status, sizeof(CFE_FS_Header_t), FileName); - -: 677: - -: 678: - -: 679: } /* end CFE_FS_WriteHeader if */ - -: 680: else - -: 681: { - -: 682: /* - -: 683: ** Write out the secondary MM file header - -: 684: */ - 15: 685: OS_Status = OS_write(FileHandle, MMHeader, sizeof(MM_LoadDumpFileHeader_t)); - 15: 686: if(OS_Status != sizeof(MM_LoadDumpFileHeader_t)) - -: 687: { - -: 688: /* We either got an error or didn't read as much data as expected */ - 1: 689: Valid = FALSE; - 1: 690: MM_AppData.ErrCounter++; - 1: 691: CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - -: 692: "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - -: 693: (unsigned int)OS_Status, sizeof(MM_LoadDumpFileHeader_t), FileName); - -: 694: - -: 695: } /* end OS_write if */ - -: 696: - -: 697: } /* end CFE_FS_WriteHeader else */ - -: 698: - 16: 699: return (Valid); - -: 700: - -: 701:} /* end MM_WriteFileHeaders */ - -: 702: - -: 703:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 704:/* */ - -: 705:/* Dump memory in event message command */ - -: 706:/* */ - -: 707:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 3: 708:void MM_DumpInEventCmd(CFE_SB_MsgPtr_t MessagePtr) - -: 709:{ - 3: 710: boolean Valid = TRUE; - -: 711: MM_DumpInEventCmd_t *CmdPtr; - -: 712: uint32 i; - -: 713: uint32 SrcAddress; - 3: 714: uint16 ExpectedLength = sizeof(MM_DumpInEventCmd_t); - -: 715: uint8 *BytePtr; - -: 716: char TempString[MM_DUMPINEVENT_TEMP_CHARS]; - -: 717:static char EventString[CFE_EVS_MAX_MESSAGE_LENGTH]; - -: 718: - -: 719: /* - -: 720: ** Allocate a dump buffer. It's declared this way to ensure it stays - -: 721: ** longword aligned since MM_MAX_DUMP_INEVENT_BYTES can be adjusted - -: 722: ** by changing the maximum event message string size. - -: 723: */ - -: 724: uint32 DumpBuffer[(MM_MAX_DUMP_INEVENT_BYTES + 3)/4]; - -: 725: - -: 726: /* Verify command packet length */ - 3: 727: if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - -: 728: { - 3: 729: CmdPtr = ((MM_DumpInEventCmd_t *)MessagePtr); - -: 730: - -: 731: /* Resolve the symbolic source address in the command message */ - 3: 732: Valid = CFS_ResolveSymAddr(&(CmdPtr->SrcSymAddress), &SrcAddress); - -: 733: - 3: 734: if(Valid == TRUE) - -: 735: { - -: 736: /* Run necessary checks on command parameters */ - 2: 737: Valid = MM_VerifyDumpInEventParams(SrcAddress, CmdPtr->MemType, CmdPtr->NumOfBytes); - -: 738: - 2: 739: if(Valid == TRUE) - -: 740: { - -: 741: /* Fill a local data buffer with the dump words */ - 1: 742: Valid = MM_FillDumpInEventBuffer(SrcAddress, CmdPtr, (uint8 *)DumpBuffer); - -: 743: - 1: 744: if(Valid == TRUE) - -: 745: { - -: 746: /* - -: 747: ** Prepare event message string header - -: 748: ** 13 characters, not counting NUL terminator - -: 749: */ - 1: 750: strcpy(EventString, "Memory Dump: "); - -: 751: - -: 752: /* - -: 753: ** Build dump data string - -: 754: ** Each byte of data requires 5 characters of string space - -: 755: ** Note this really only allows up to ~15 bytes using default config - -: 756: */ - 1: 757: BytePtr = (uint8 *)DumpBuffer; - 2: 758: for (i = 0; i < CmdPtr->NumOfBytes && i < MM_MAX_DUMP_INEVENT_BYTES; i++) - -: 759: { - 1: 760: sprintf(TempString, "0x%02X ", *BytePtr); - 1: 761: strcat(EventString, TempString); - 1: 762: BytePtr++; - -: 763: } - -: 764: - -: 765: /* - -: 766: ** Append tail - -: 767: ** This adds up to 33 characters including the NUL terminator - -: 768: */ - 1: 769: sprintf(TempString, "from address: 0x%08lX", (unsigned long)SrcAddress); - 1: 770: strcat(EventString, TempString); - -: 771: - -: 772: /* Send it out */ - 1: 773: CFE_EVS_SendEvent(MM_DUMP_INEVENT_INF_EID, CFE_EVS_INFORMATION, "%s", EventString); - -: 774: /* Update telemetry */ - 1: 775: MM_AppData.LastAction = MM_DUMP_INEVENT; - 1: 776: MM_AppData.MemType = CmdPtr->MemType; - 1: 777: MM_AppData.Address = SrcAddress; - 1: 778: MM_AppData.BytesProcessed = CmdPtr->NumOfBytes; - 1: 779: MM_AppData.CmdCounter++; - -: 780: } /* end MM_FillDumpInEventBuffer if */ - -: 781: } /* end MM_VerifyDumpInEventParams if */ - -: 782: } /* end CFS_ResolveSymAddr if */ - -: 783: else - -: 784: { - 1: 785: MM_AppData.ErrCounter++; - 1: 786: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 787: "Symbolic address can't be resolved: Name = '%s'", - -: 788: CmdPtr->SrcSymAddress.SymName); - -: 789: } - -: 790: - -: 791: } /* end MM_VerifyCmdLength if */ - -: 792: - 3: 793: return; - -: 794: - -: 795:} /* end MM_DumpWordsInEventCmd */ - -: 796: - -: 797:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 798:/* */ - -: 799:/* Verify dump memory in event messsage command parameters */ - -: 800:/* */ - -: 801:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 17: 802:boolean MM_VerifyDumpInEventParams(uint32 Address, - -: 803: uint8 MemType, - -: 804: uint32 SizeInBytes) - -: 805:{ - 17: 806: boolean Valid = TRUE; - -: 807: int32 OS_Status; - -: 808: - -: 809: /* - -: 810: ** Verify dump size is within limits. The limit is dictated by the - -: 811: ** maximum event message string length and applies to all memory - -: 812: ** types - -: 813: */ - 20: 814: if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_DUMP_INEVENT_BYTES)) - -: 815: { - 3: 816: Valid = FALSE; - 3: 817: MM_AppData.ErrCounter++; - 3: 818: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 819: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 820: } - -: 821: else - -: 822: { - -: 823: /* - -: 824: ** Run a bunch of other sanity checks - -: 825: */ - 14: 826: switch(MemType) - -: 827: { - -: 828: case MM_RAM: - 3: 829: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 830: - 3: 831: if (OS_Status != OS_SUCCESS) - -: 832: { - 1: 833: Valid = FALSE; - 1: 834: MM_AppData.ErrCounter++; - 1: 835: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 836: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 837: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 838: } - 3: 839: break; - -: 840: - -: 841: case MM_EEPROM: - 2: 842: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 843: - 2: 844: if (OS_Status != OS_SUCCESS) - -: 845: { - 1: 846: Valid = FALSE; - 1: 847: MM_AppData.ErrCounter++; - 1: 848: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 849: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 850: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 851: } - 2: 852: break; - -: 853: - -: 854:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 855: case MM_MEM32: - 3: 856: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 857: - 3: 858: if (OS_Status != OS_SUCCESS) - -: 859: { - 1: 860: Valid = FALSE; - 1: 861: MM_AppData.ErrCounter++; - 1: 862: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 863: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 864: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 865: } - 2: 866: else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - -: 867: { - 1: 868: Valid = FALSE; - 1: 869: MM_AppData.ErrCounter++; - 1: 870: CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - -: 871: "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - -: 872: (unsigned int)Address, (int)SizeInBytes); - -: 873: } - 3: 874: break; - -: 875:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 876: - -: 877:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 878: case MM_MEM16: - 3: 879: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 880: - 3: 881: if (OS_Status != OS_SUCCESS) - -: 882: { - 1: 883: Valid = FALSE; - 1: 884: MM_AppData.ErrCounter++; - 1: 885: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 886: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 887: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 888: } - 2: 889: else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - -: 890: { - 1: 891: Valid = FALSE; - 1: 892: MM_AppData.ErrCounter++; - 1: 893: CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - -: 894: "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - -: 895: (unsigned int)Address, (int)SizeInBytes); - -: 896: } - 3: 897: break; - -: 898:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 899: - -: 900:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 901: case MM_MEM8: - 2: 902: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 903: - 2: 904: if (OS_Status != OS_SUCCESS) - -: 905: { - 1: 906: Valid = FALSE; - 1: 907: MM_AppData.ErrCounter++; - 1: 908: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 909: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 910: (unsigned int)OS_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 911: } - 2: 912: break; - -: 913: - -: 914: default: - 1: 915: Valid = FALSE; - 1: 916: MM_AppData.ErrCounter++; - 1: 917: CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - -: 918: "Invalid memory type specified: MemType = %d", MemType); - -: 919: break; - -: 920:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 921: } - -: 922: - -: 923: } /* end SizeInBytes else */ - -: 924: - 17: 925: return (Valid); - -: 926: - -: 927:} /* end MM_VerifyDumpInEventParams */ - -: 928: - -: 929:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 930:/* */ - -: 931:/* Fill a buffer with data to be dumped in an event message string */ - -: 932:/* */ - -: 933:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 10: 934:boolean MM_FillDumpInEventBuffer(uint32 SrcAddress, - -: 935: MM_DumpInEventCmd_t *CmdPtr, - -: 936: uint8 *DumpBuffer) - -: 937:{ - -: 938:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) || (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) || (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 939: uint32 i; - -: 940:#endif - -: 941: int32 PSP_Status; - 10: 942: boolean Valid = TRUE; - -: 943: - -: 944: /* Initialize buffer */ - 10: 945: PSP_Status = CFE_PSP_MemSet(DumpBuffer, 0, MM_MAX_DUMP_INEVENT_BYTES); - -: 946: - 10: 947: switch (CmdPtr->MemType) - -: 948: { - -: 949: case MM_RAM: - -: 950: case MM_EEPROM: - 4: 951: PSP_Status = CFE_PSP_MemCpy((void *)DumpBuffer, (void *)SrcAddress, CmdPtr->NumOfBytes); - 4: 952: if (PSP_Status != CFE_PSP_SUCCESS) - -: 953: { - 1: 954: CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - -: 955: "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - -: 956: (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer, (unsigned int)CmdPtr->NumOfBytes); - 1: 957: MM_AppData.ErrCounter++; - 1: 958: Valid = FALSE; - -: 959: } - 4: 960: break; - -: 961: - -: 962: #if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 963: case MM_MEM32: - 6: 964: for (i = 0; i < (CmdPtr->NumOfBytes / 4); i++) - -: 965: { - 2: 966: PSP_Status = CFE_PSP_MemRead32(SrcAddress, (uint32 *)DumpBuffer); - 2: 967: if (PSP_Status == CFE_PSP_SUCCESS) - -: 968: { - 1: 969: SrcAddress += sizeof (uint32); - 1: 970: DumpBuffer += sizeof (uint32); - -: 971: } - -: 972: else - -: 973: { - -: 974: /* CFE_PSP_MemRead32 error */ - 1: 975: Valid = FALSE; - 1: 976: MM_AppData.ErrCounter++; - 1: 977: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 978: "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM32", - -: 979: (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer); - -: 980: /* Stop load dump buffer loop */ - 1: 981: break; - -: 982: } - -: 983: } - 2: 984: break; - -: 985: #endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 986: - -: 987: #if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 988: case MM_MEM16: - 6: 989: for (i = 0; i < (CmdPtr->NumOfBytes / 2); i++) - -: 990: { - 2: 991: PSP_Status = CFE_PSP_MemRead16(SrcAddress, (uint16 *)DumpBuffer); - 2: 992: if (PSP_Status == CFE_PSP_SUCCESS) - -: 993: { - 1: 994: SrcAddress += sizeof (uint16); - 1: 995: DumpBuffer += sizeof (uint16); - -: 996: } - -: 997: else - -: 998: { - -: 999: /* CFE_PSP_MemRead16 error */ - 1: 1000: Valid = FALSE; - 1: 1001: MM_AppData.ErrCounter++; - 1: 1002: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 1003: "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM16", - -: 1004: (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer); - -: 1005: /* Stop load dump buffer loop */ - 1: 1006: break; - -: 1007: } - -: 1008: } - 2: 1009: break; - -: 1010: #endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 1011: - -: 1012: #if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 1013: case MM_MEM8: - 6: 1014: for (i = 0; i < CmdPtr->NumOfBytes; i++) - -: 1015: { - 2: 1016: PSP_Status = CFE_PSP_MemRead8(SrcAddress, DumpBuffer); - 2: 1017: if (PSP_Status == CFE_PSP_SUCCESS) - -: 1018: { - 1: 1019: SrcAddress ++; - 1: 1020: DumpBuffer ++; - -: 1021: } - -: 1022: else - -: 1023: { - -: 1024: /* CFE_PSP_MemRead8 error */ - 1: 1025: Valid = FALSE; - 1: 1026: MM_AppData.ErrCounter++; - 1: 1027: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 1028: "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM8", - -: 1029: (unsigned int)PSP_Status, (unsigned int)SrcAddress, (unsigned int)DumpBuffer); - -: 1030: /* Stop load dump buffer loop */ - 1: 1031: break; - -: 1032: } - -: 1033: } - -: 1034: break; - -: 1035: #endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 1036: default: - -: 1037: /* This branch will never be executed. CmdPtr->MemType will always - -: 1038: * be valid value for this switch statement it is verified via - -: 1039: * MM_VerifyDumpInEventParams */ - -: 1040: break; - -: 1041: - -: 1042: } /* end CmdPtr->MemType switch */ - -: 1043: - 10: 1044: return(Valid); - -: 1045: - -: 1046:} /* end FillDumpInEventBuffer */ - -: 1047: - -: 1048:/************************/ - -: 1049:/* End of File Comment */ - -: 1050:/************************/ diff --git a/fsw/unit_test/mm_dump_test.c b/fsw/unit_test/mm_dump_test.c deleted file mode 100644 index d712c7e..0000000 --- a/fsw/unit_test/mm_dump_test.c +++ /dev/null @@ -1,2152 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_dump_test.c 1.6.1.1 2016/11/17 16:35:29EST sstrege Exp $ - ** - ** Purpose: - ** This file contains unit test cases for the functions contained in the file mm_dump.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_dump_test.c $ - ** Revision 1.6.1.1 2016/11/17 16:35:29EST sstrege - ** - ** Revision 1.7 2016/11/17 12:51:16EST mdeschu - ** Remove references to temporary header file mm_test_exports.h - ** Revision 1.6 2016/10/30 08:58:28EDT mdeschu - ** Updated Unit test MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooLarge - ** - ** Babelfish Ticket #32 (DCR 145938) changes default maximum number of bytes - ** (MM_MAX_DUMP_INEVENT_BYTES) from 16 to 15 - ** Revision 1.5 2016/10/30 01:29:15EDT mdeschu - ** in MM_DumpMemToFile_Test_WriteError Set expected to be SegmentSize in relation to fix in DCR 141232 - ** Revision 1.4 2016/10/24 18:35:08EDT czogby - ** Code Walkthough Updates - ** Revision 1.3 2016/05/04 19:01:15EDT czogby - ** Update MM to Compile With New UT-Assert PSP Files - ** Revision 1.2 2016/03/04 20:00:58EST czogby - ** Need Temporary Header File to Import Some MM Functions Into Unit Tests - ** Revision 1.1 2016/02/03 17:11:36EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_dump_test.h" -#include "mm_dump.h" -#include "mm_msg.h" -#include "mm_msgdefs.h" -#include "mm_msgids.h" -#include "mm_events.h" -#include "mm_filedefs.h" -#include "mm_version.h" -#include "mm_test_utils.h" -#include "ut_osapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_es_hooks.h" -#include "ut_cfe_evs_stubs.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_psp_ram_stubs.h" -#include "ut_cfe_psp_memrange_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include -#include -#include - -/* - * Function Definitions - */ - -void MM_PeekCmd_Test_Nominal (void) -{ - MM_PeekCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PeekCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_PEEK_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = 32; - - /* Execute the function being tested */ - MM_PeekCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - /* Generates 1 event message we don't care about in this test */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekCmd_Test_Nominal */ - -void MM_PeekCmd_Test_SymNameError (void) -{ - MM_PeekCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PeekCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_PEEK_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = 32; - - strncpy(CmdPacket.SrcSymAddress.SymName, "name", OS_MAX_PATH_LEN); - - /* Set to generate error message MM_SYMNAME_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PeekCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'name'"), - "Symbolic address can't be resolved: Name = 'name'"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekCmd_Test_SymNameError */ - -void MM_PeekMem_Test_Byte (void) -{ - MM_PeekCmd_t CmdPacket; - uint32 SrcAddress = 1; - - CmdPacket.DataSize = MM_BYTE_BIT_WIDTH; - CmdPacket.MemType = MM_RAM; - - /* Execute the function being tested */ - MM_PeekMem(&CmdPacket, SrcAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PEEK_BYTE_INF_EID, CFE_EVS_INFORMATION, "Peek Command: Addr = 0x00000001 Size = 8 bits Data = 0x00"), - "Peek Command: Addr = 0x00000001 Size = 8 bits Data = 0x00"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_PEEK, "MM_AppData.LastAction == MM_PEEK"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.Address == 1, "MM_AppData.Address == 1"); - UtAssert_True (MM_AppData.BytesProcessed == 1, "MM_AppData.BytesProcessed == 1"); - UtAssert_True (MM_AppData.DataValue == 0, "MM_AppData.DataValue == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekMem_Test_Byte */ - -void MM_PeekMem_Test_ByteError (void) -{ - MM_PeekCmd_t CmdPacket; - uint32 SrcAddress = 1; - - CmdPacket.DataSize = MM_BYTE_BIT_WIDTH; - - /* Set to generate error message MM_PSP_READ_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD8_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PeekMem(&CmdPacket, SrcAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, "PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"), - "PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekMem_Test_ByteError */ - -void MM_PeekMem_Test_Word (void) -{ - MM_PeekCmd_t CmdPacket; - uint32 SrcAddress = 1; - - CmdPacket.DataSize = MM_WORD_BIT_WIDTH; - CmdPacket.MemType = MM_RAM; - - /* Execute the function being tested */ - MM_PeekMem(&CmdPacket, SrcAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PEEK_WORD_INF_EID, CFE_EVS_INFORMATION, "Peek Command: Addr = 0x00000001 Size = 16 bits Data = 0x0000"), - "Peek Command: Addr = 0x00000001 Size = 16 bits Data = 0x0000"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_PEEK, "MM_AppData.LastAction == MM_PEEK"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.Address == 1, "MM_AppData.Address == 1"); - UtAssert_True (MM_AppData.BytesProcessed == 2, "MM_AppData.BytesProcessed == 2"); - UtAssert_True (MM_AppData.DataValue == 0, "MM_AppData.DataValue == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekMem_Test_Word */ - -void MM_PeekMem_Test_WordError (void) -{ - MM_PeekCmd_t CmdPacket; - uint32 SrcAddress = 1; - - CmdPacket.DataSize = MM_WORD_BIT_WIDTH; - - /* Set to generate error message MM_PSP_READ_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD16_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PeekMem(&CmdPacket, SrcAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, "PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"), - "PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekMem_Test_WordError */ - -void MM_PeekMem_Test_DWord (void) -{ - MM_PeekCmd_t CmdPacket; - uint32 SrcAddress = 1; - - CmdPacket.DataSize = MM_DWORD_BIT_WIDTH; - CmdPacket.MemType = MM_RAM; - - /* Execute the function being tested */ - MM_PeekMem(&CmdPacket, SrcAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PEEK_DWORD_INF_EID, CFE_EVS_INFORMATION, "Peek Command: Addr = 0x00000001 Size = 32 bits Data = 0x00000000"), - "Peek Command: Addr = 0x00000001 Size = 32 bits Data = 0x00000000"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_PEEK, "MM_AppData.LastAction == MM_PEEK"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.Address == 1, "MM_AppData.Address == 1"); - UtAssert_True (MM_AppData.BytesProcessed == 4, "MM_AppData.BytesProcessed == 4"); - UtAssert_True (MM_AppData.DataValue == 0, "MM_AppData.DataValue == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekMem_Test_DWord */ - -void MM_PeekMem_Test_DWordError (void) -{ - MM_PeekCmd_t CmdPacket; - uint32 SrcAddress = 1; - - CmdPacket.DataSize = MM_DWORD_BIT_WIDTH; - - /* Set to generate error message MM_PSP_READ_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD32_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PeekMem(&CmdPacket, SrcAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, "PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"), - "PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PeekMem_Test_DWordError */ - -void MM_DumpMemToFileCmd_Test_RAM (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_RAM; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"), - "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_RAM */ - -void MM_DumpMemToFileCmd_Test_EEPROM (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"), - "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_EEPROM */ - -void MM_DumpMemToFileCmd_Test_MEM32 (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM32; - CmdPacket.NumOfBytes = 4; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Dump Memory To File Command: Dumped 4 bytes from address 0x00000000 to file 'filename'"), - "Dump Memory To File Command: Dumped 4 bytes from address 0x00000000 to file 'filename'"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_MEM32 */ - -void MM_DumpMemToFileCmd_Test_MEM16 (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM16; - CmdPacket.NumOfBytes = 2; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Dump Memory To File Command: Dumped 2 bytes from address 0x00000000 to file 'filename'"), - "Dump Memory To File Command: Dumped 2 bytes from address 0x00000000 to file 'filename'"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_MEM16 */ - -void MM_DumpMemToFileCmd_Test_MEM8 (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"), - "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_MEM8 */ - -void MM_DumpMemToFileCmd_Test_ComputeCRCError (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Set to generate error message MM_DMP_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"), - "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_ERROR, "CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'filename'"), - "CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'filename'"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 2, "Ut_CFE_EVS_GetEventQueueDepth() == 2"); - -} /* end MM_DumpMemToFileCmd_Test_ComputeCRCError */ - -void MM_DumpMemToFileCmd_Test_CloseError (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Set to generate error message MM_DMP_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_CLOSE_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DMP_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"), - "Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename'"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_CLOSE_ERR_EID, CFE_EVS_ERROR, "OS_close error received: RC = 0xFFFFFFFF File = 'filename'"), - "OS_close error received: RC = 0xFFFFFFFF File = 'filename'"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 2, "Ut_CFE_EVS_GetEventQueueDepth() == 2"); - -} /* end MM_DumpMemToFileCmd_Test_CloseError */ - -void MM_DumpMemToFileCmd_Test_CreatError (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Set to generate error message MM_OS_CREAT_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_CREAT_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_CREAT_ERR_EID, CFE_EVS_ERROR, "OS_creat error received: RC = 0xFFFFFFFF File = 'filename'"), - "OS_creat error received: RC = 0xFFFFFFFF File = 'filename'"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_CreatError */ - -void MM_DumpMemToFileCmd_Test_SymNameError (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "filename", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Set to generate error message MM_SYMNAME_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'SymName'"), - "Symbolic address can't be resolved: Name = 'SymName'"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_SymNameError */ - -void MM_DumpMemToFileCmd_Test_FilenameError (void) -{ - MM_DumpMemToFileCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_DumpMemToFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_DUMP_MEM_TO_FILE_CC); - - strncpy(CmdPacket.SrcSymAddress.SymName, "SymName", OS_MAX_PATH_LEN); - CmdPacket.SrcSymAddress.Offset = 0; - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - strncpy (CmdPacket.FileName, "***", OS_MAX_PATH_LEN); - - /* Set to satisfy 2 instances of condition "Valid == TRUE": after comment "Write the file headers" and comment "end Valid == TRUE if" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - Ut_CFE_FS_ContinueReturnCodeAfterCountZero(UT_CFE_FS_WRITEHDR_INDEX); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, sizeof(MM_LoadDumpFileHeader_t), 1); - - /* Set to satisfy condition "Valid == TRUE" before comment "Compute CRC of dumped data" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Set to generate error message MM_CMD_FNAME_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_CREAT_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_DumpMemToFileCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_CMD_FNAME_ERR_EID, CFE_EVS_ERROR, "Command specified filename invalid: Name = '***'"), - "Command specified filename invalid: Name = '***'"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFileCmd_Test_FilenameError */ - -void MM_DumpMemToFile_Test_Nominal (void) -{ - boolean Result; - - uint32 FileHandle = 1; - char FileName[OS_MAX_PATH_LEN]; - MM_LoadDumpFileHeader_t FileHeader; - - strncpy (FileName, "filename", OS_MAX_PATH_LEN); - - FileHeader.NumOfBytes = 1; - FileHeader.SymAddress.Offset = 1; - FileHeader.MemType = MM_RAM; - - /* Execute the function being tested */ - Result = MM_DumpMemToFile(FileHandle, FileName, &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == FileHeader.MemType, "MM_AppData.MemType == FileHeader.MemType"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == 1, "MM_AppData.BytesProcessed == 1"); - UtAssert_True (strncmp(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMemToFile_Test_Nominal */ - -void MM_DumpMemToFile_Test_CPUHogging (void) -{ - boolean Result; - - uint32 FileHandle = 1; - char FileName[OS_MAX_PATH_LEN]; - MM_LoadDumpFileHeader_t FileHeader; - - strncpy (FileName, "filename", OS_MAX_PATH_LEN); - - FileHeader.NumOfBytes = 2 * MM_MAX_DUMP_DATA_SEG; - FileHeader.SymAddress.Offset = 1; - FileHeader.MemType = MM_RAM; - - /* Execute the function being tested */ - Result = MM_DumpMemToFile(FileHandle, FileName, &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == FileHeader.MemType, "MM_AppData.MemType == FileHeader.MemType"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == 2 * MM_MAX_DUMP_DATA_SEG, "MM_AppData.BytesProcessed == 2 * MM_MAX_DUMP_DATA_SEG"); - UtAssert_True (strncmp(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMemToFile_Test_CPUHogging */ - -void MM_DumpMemToFile_Test_WriteError (void) -{ - boolean Result; - - uint32 FileHandle = 1; - char FileName[OS_MAX_PATH_LEN]; - MM_LoadDumpFileHeader_t FileHeader; - - strncpy (FileName, "filename", OS_MAX_PATH_LEN); - - FileHeader.NumOfBytes = 1; - FileHeader.SymAddress.Offset = 1; - FileHeader.MemType = MM_RAM; - - /* Set to generate error message MM_OS_WRITE_EXP_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMemToFile(FileHandle, FileName, &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, "OS_write error received: RC = 0xFFFFFFFF, Expected = 1, File = 'filename'"), - "OS_write error received: RC = 0xFFFFFFFF, Expected = 1, File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFile_Test_WriteError */ - -void MM_DumpMemToFile_Test_CopyError (void) -{ - boolean Result; - - uint32 FileHandle = 1; - char FileName[OS_MAX_PATH_LEN]; - MM_LoadDumpFileHeader_t FileHeader; - char ErrorMessage[125]; - - strncpy (FileName, "filename", OS_MAX_PATH_LEN); - - FileHeader.NumOfBytes = 1; - FileHeader.SymAddress.Offset = 1; - FileHeader.MemType = MM_RAM; - - /* Set to generate error message MM_PSP_COPY_ERR_EID */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMemToFile(FileHandle, FileName, &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP copy memory error: RC=0xFFFFFFFF, Src=0x00000001, Tgt=0x%08X, Size=0x00000001", (unsigned int)(&MM_AppData.DumpBuffer[0])); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMemToFile_Test_CopyError */ - -void MM_VerifyFileDumpParams_Test_RAM (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyFileDumpParams_Test_RAM */ - -void MM_VerifyFileDumpParams_Test_EEPROM (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyFileDumpParams_Test_EEPROM */ - -void MM_VerifyFileDumpParams_Test_MEM32 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 4; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyFileDumpParams_Test_MEM32 */ - -void MM_VerifyFileDumpParams_Test_MEM16 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 2; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyFileDumpParams_Test_MEM16 */ - -void MM_VerifyFileDumpParams_Test_MEM8 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyFileDumpParams_Test_MEM8 */ - -void MM_VerifyFileDumpParams_Test_RAMRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_RAMRangeError */ - -void MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooSmall */ - -void MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = MM_MAX_DUMP_FILE_DATA_RAM + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooLarge */ - -void MM_VerifyFileDumpParams_Test_EEPROMRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_EEPROMRangeError */ - -void MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooSmall */ - -void MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = MM_MAX_DUMP_FILE_DATA_EEPROM + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 131073"), - "Data size in bytes invalid or exceeds limits: Data Size = 131073"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooLarge */ - -void MM_VerifyFileDumpParams_Test_MEM32RangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 4; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM32RangeError */ - -void MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooSmall */ - -void MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = MM_MAX_DUMP_FILE_DATA_MEM32 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooLarge */ - -void MM_VerifyFileDumpParams_Test_MEM32AlignmentError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 3; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, "Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3"), - "Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM32AlignmentError */ - -void MM_VerifyFileDumpParams_Test_MEM16RangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 2; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM16RangeError */ - -void MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooSmall */ - -void MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = MM_MAX_DUMP_FILE_DATA_MEM16 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooLarge */ - -void MM_VerifyFileDumpParams_Test_MEM16AlignmentError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 3; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, "Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3"), - "Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM16AlignmentError */ - -void MM_VerifyFileDumpParams_Test_MEM8RangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM8RangeError */ - -void MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooSmall */ - -void MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = MM_MAX_DUMP_FILE_DATA_MEM8 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooLarge */ - -void MM_VerifyFileDumpParams_Test_InvalidMemoryType (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = 99; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileDumpParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, "Invalid memory type specified: MemType = 99"), - "Invalid memory type specified: MemType = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileDumpParams_Test_InvalidMemoryType */ - -void MM_WriteFileHeaders_Test_Nominal (void) -{ - boolean Result; - - char FileName[OS_MAX_PATH_LEN]; - int32 FileHandle = 1; - CFE_FS_Header_t CFEHeader; - MM_LoadDumpFileHeader_t MMHeader; - - strncpy (FileName, "filename", OS_MAX_PATH_LEN); - - MMHeader.NumOfBytes = 1; - MMHeader.SymAddress.Offset = 0; - MMHeader.MemType = MM_RAM; - - /* Set to fail condition "OS_Status != sizeof(CFE_FS_Header_t)" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Execute the function being tested */ - Result = MM_WriteFileHeaders(FileName, FileHandle, &CFEHeader, &MMHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_WriteFileHeaders_Test_Nominal */ - -void MM_WriteFileHeaders_Test_WriteHeaderError (void) -{ - boolean Result; - - char FileName[OS_MAX_PATH_LEN]; - int32 FileHandle = 1; - CFE_FS_Header_t CFEHeader; - MM_LoadDumpFileHeader_t MMHeader; - - strncpy (FileName, "filename", OS_MAX_PATH_LEN); - - MMHeader.NumOfBytes = 1; - MMHeader.SymAddress.Offset = 0; - MMHeader.MemType = MM_RAM; - - /* Set to generate error message MM_CFE_FS_WRITEHDR_ERR_EID */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_WriteFileHeaders(FileName, FileHandle, &CFEHeader, &MMHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_CFE_FS_WRITEHDR_ERR_EID, CFE_EVS_ERROR, "CFE_FS_WriteHeader error received: RC = 0xFFFFFFFF Expected = 64 File = 'filename'"), - "CFE_FS_WriteHeader error received: RC = 0xFFFFFFFF Expected = 64 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_WriteFileHeaders_Test_WriteHeaderError */ - -void MM_WriteFileHeaders_Test_WriteError (void) -{ - boolean Result; - - char FileName[OS_MAX_PATH_LEN]; - int32 FileHandle = 1; - CFE_FS_Header_t CFEHeader; - MM_LoadDumpFileHeader_t MMHeader; - - strncpy (FileName, "filename", OS_MAX_PATH_LEN); - - MMHeader.NumOfBytes = 1; - MMHeader.SymAddress.Offset = 0; - MMHeader.MemType = MM_RAM; - - /* Set to fail condition "OS_Status != sizeof(CFE_FS_Header_t)" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_WRITEHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Set to generate error message MM_OS_WRITE_EXP_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_WriteFileHeaders(FileName, FileHandle, &CFEHeader, &MMHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, "OS_write error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename'"), - "OS_write error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_WriteFileHeaders_Test_WriteError */ - -void MM_DumpInEventCmd_Test_Nominal (void) -{ - MM_DumpInEventCmd_t MessagePtr; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_RAM; - MessagePtr.NumOfBytes = 1; - MessagePtr.SrcSymAddress.Offset = 0; - - strncpy(MessagePtr.SrcSymAddress.SymName, "", OS_MAX_PATH_LEN); - - /* Set to satisfy condition "Valid == TRUE" before comment "Prepare event message string header" */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_DumpInEventCmd((CFE_SB_MsgPtr_t)(&MessagePtr)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DUMP_INEVENT_INF_EID, CFE_EVS_INFORMATION, "Memory Dump: 0x00 from address: 0x00000000"), - "Memory Dump: 0x00 from address: 0x00000000"); - - UtAssert_True (MM_AppData.LastAction == MM_DUMP_INEVENT, "MM_AppData.LastAction == MM_DUMP_INEVENT"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == 1, "MM_AppData.BytesProcessed == 1"); - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpInEventCmd_Test_Nominal */ - -void MM_DumpInEventCmd_Test_SymNameError (void) -{ - MM_DumpInEventCmd_t MessagePtr; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_RAM; - MessagePtr.NumOfBytes = 1; - MessagePtr.SrcSymAddress.Offset = 0; - - strncpy(MessagePtr.SrcSymAddress.SymName, "name", OS_MAX_PATH_LEN); - - /* Set to generate error message MM_SYMNAME_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_DumpInEventCmd((CFE_SB_MsgPtr_t)(&MessagePtr)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'name'"), - "Symbolic address can't be resolved: Name = 'name'"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpInEventCmd_Test_SymNameError */ - -void MM_VerifyDumpInEventParams_Test_RAM (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyDumpInEventParams_Test_RAM */ - -void MM_VerifyDumpInEventParams_Test_EEPROM (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyDumpInEventParams_Test_EEPROM */ - -void MM_VerifyDumpInEventParams_Test_MEM32 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 4; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM32 */ - -void MM_VerifyDumpInEventParams_Test_MEM16 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 2; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM16 */ - -void MM_VerifyDumpInEventParams_Test_MEM8 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM8 */ - -void MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooSmall */ - -void MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = MM_MAX_DUMP_INEVENT_BYTES + 1; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 16"), - "Data size in bytes invalid or exceeds limits: Data Size = 16"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooLarge */ - -void MM_VerifyDumpInEventParams_Test_RAMRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_RAMRangeError */ - -void MM_VerifyDumpInEventParams_Test_EEPROMRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_EEPROMRangeError */ - -void MM_VerifyDumpInEventParams_Test_MEM32RangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 4; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM32RangeError */ - -void MM_VerifyDumpInEventParams_Test_MEM32AlignmentError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 3; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, "Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3"), - "Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM32AlignmentError */ - -void MM_VerifyDumpInEventParams_Test_MEM16RangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 2; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM16RangeError */ - -void MM_VerifyDumpInEventParams_Test_MEM16AlignmentError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 3; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, "Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3"), - "Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM16AlignmentError */ - -void MM_VerifyDumpInEventParams_Test_MEM8RangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_MEM32RangeError */ - -void MM_VerifyDumpInEventParams_Test_InvalidMemType (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = 99; - uint32 SizeInBytes = 3; - - /* Execute the function being tested */ - Result = MM_VerifyDumpInEventParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, "Invalid memory type specified: MemType = 99"), - "Invalid memory type specified: MemType = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyDumpInEventParams_Test_InvalidMemType */ - -void MM_FillDumpInEventBuffer_Test_RAM (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_RAM; - MessagePtr.NumOfBytes = 1; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillDumpInEventBuffer_Test_RAM */ - -void MM_FillDumpInEventBuffer_Test_EEPROM (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_EEPROM; - MessagePtr.NumOfBytes = 1; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillDumpInEventBuffer_Test_EEPROM */ - -void MM_FillDumpInEventBuffer_Test_MEM32 (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_MEM32; - MessagePtr.NumOfBytes = 4; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillDumpInEventBuffer_Test_MEM32 */ - -void MM_FillDumpInEventBuffer_Test_MEM16 (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_MEM16; - MessagePtr.NumOfBytes = 2; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillDumpInEventBuffer_Test_MEM16 */ - -void MM_FillDumpInEventBuffer_Test_MEM8 (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_MEM8; - MessagePtr.NumOfBytes = 1; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillDumpInEventBuffer_Test_MEM8 */ - -void MM_FillDumpInEventBuffer_Test_EEPROMCopyError (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - char ErrorMessage[125]; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_EEPROM; - MessagePtr.NumOfBytes = 1; - MessagePtr.SrcSymAddress.Offset = 0; - - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP copy memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x%08X, Size=0x00000001", (unsigned int)(&MM_AppData.DumpBuffer[0])); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillDumpInEventBuffer_Test_EEPROMCopyError */ - -void MM_FillDumpInEventBuffer_Test_MEM32ReadError (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - char ErrorMessage[125]; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_MEM32; - MessagePtr.NumOfBytes = 4; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Set to generate error message MM_PSP_READ_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD32_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x%08X, Type=MEM32", (unsigned int)(&MM_AppData.DumpBuffer[0])); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillDumpInEventBuffer_Test_MEM32ReadError */ - -void MM_FillDumpInEventBuffer_Test_MEM16ReadError (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - char ErrorMessage[125]; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_MEM16; - MessagePtr.NumOfBytes = 4; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Set to generate error message MM_PSP_READ_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD16_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x%08X, Type=MEM16", (unsigned int)(&MM_AppData.DumpBuffer[0])); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillDumpInEventBuffer_Test_MEM16ReadError */ - -void MM_FillDumpInEventBuffer_Test_MEM8ReadError (void) -{ - boolean Result; - MM_DumpInEventCmd_t MessagePtr; - uint32 SrcAddress = 0; - char ErrorMessage[125]; - - CFE_SB_InitMsg (&MessagePtr, MM_CMD_MID, sizeof(MM_DumpInEventCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&MessagePtr, MM_DUMP_IN_EVENT_CC); - - MessagePtr.MemType = MM_MEM8; - MessagePtr.NumOfBytes = 4; - MessagePtr.SrcSymAddress.Offset = 0; - - /* Set to generate error message MM_PSP_READ_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD8_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_FillDumpInEventBuffer(SrcAddress, &MessagePtr, (uint8 *)(&MM_AppData.DumpBuffer[0])); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x%08X, Type=MEM8", (unsigned int)(&MM_AppData.DumpBuffer[0])); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillDumpInEventBuffer_Test_MEM8ReadError */ - -void MM_Dump_Test_AddTestCases(void) -{ - UtTest_Add(MM_PeekCmd_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_PeekCmd_Test_Nominal"); - UtTest_Add(MM_PeekCmd_Test_SymNameError, MM_Test_Setup, MM_Test_TearDown, "MM_PeekCmd_Test_SymNameError"); - UtTest_Add(MM_PeekMem_Test_Byte, MM_Test_Setup, MM_Test_TearDown, "MM_PeekMem_Test_Byte"); - UtTest_Add(MM_PeekMem_Test_ByteError, MM_Test_Setup, MM_Test_TearDown, "MM_PeekMem_Test_ByteError"); - UtTest_Add(MM_PeekMem_Test_Word, MM_Test_Setup, MM_Test_TearDown, "MM_PeekMem_Test_Word"); - UtTest_Add(MM_PeekMem_Test_WordError, MM_Test_Setup, MM_Test_TearDown, "MM_PeekMem_Test_WordError"); - UtTest_Add(MM_PeekMem_Test_DWord, MM_Test_Setup, MM_Test_TearDown, "MM_PeekMem_Test_DWord"); - UtTest_Add(MM_PeekMem_Test_DWordError, MM_Test_Setup, MM_Test_TearDown, "MM_PeekMem_Test_DWordError"); - - UtTest_Add(MM_DumpMemToFileCmd_Test_RAM, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_RAM"); - UtTest_Add(MM_DumpMemToFileCmd_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_EEPROM"); - UtTest_Add(MM_DumpMemToFileCmd_Test_MEM32, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_MEM32"); - UtTest_Add(MM_DumpMemToFileCmd_Test_MEM16, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_MEM16"); - UtTest_Add(MM_DumpMemToFileCmd_Test_MEM8, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_MEM8"); - UtTest_Add(MM_DumpMemToFileCmd_Test_ComputeCRCError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_ComputeCRCError"); - UtTest_Add(MM_DumpMemToFileCmd_Test_CloseError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_CloseError"); - UtTest_Add(MM_DumpMemToFileCmd_Test_CreatError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_CreatError"); - UtTest_Add(MM_DumpMemToFileCmd_Test_SymNameError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_SymNameError"); - UtTest_Add(MM_DumpMemToFileCmd_Test_FilenameError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFileCmd_Test_FilenameError"); - - UtTest_Add(MM_DumpMemToFile_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFile_Test_Nominal"); - UtTest_Add(MM_DumpMemToFile_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFile_Test_CPUHogging"); - UtTest_Add(MM_DumpMemToFile_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFile_Test_WriteError"); - UtTest_Add(MM_DumpMemToFile_Test_CopyError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMemToFile_Test_CopyError"); - - UtTest_Add(MM_VerifyFileDumpParams_Test_RAM, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_RAM"); - UtTest_Add(MM_VerifyFileDumpParams_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_EEPROM"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM32, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM32"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM16, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM16"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM8, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM8"); - UtTest_Add(MM_VerifyFileDumpParams_Test_RAMRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_RAMRangeError"); - UtTest_Add(MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooSmall"); - UtTest_Add(MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooLarge"); - UtTest_Add(MM_VerifyFileDumpParams_Test_EEPROMRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_EEPROMRangeError"); - UtTest_Add(MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooSmall"); - UtTest_Add(MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooLarge"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM32RangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM32RangeError"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooSmall"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooLarge"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM32AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM32AlignmentError"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM16RangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM16RangeError"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooSmall"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooLarge"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM16AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM16AlignmentError"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM8RangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM8RangeError"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooSmall"); - UtTest_Add(MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooLarge"); - UtTest_Add(MM_VerifyFileDumpParams_Test_InvalidMemoryType, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileDumpParams_Test_InvalidMemoryType"); - - UtTest_Add(MM_WriteFileHeaders_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_WriteFileHeaders_Test_Nominal"); - UtTest_Add(MM_WriteFileHeaders_Test_WriteHeaderError, MM_Test_Setup, MM_Test_TearDown, "MM_WriteFileHeaders_Test_WriteHeaderError"); - UtTest_Add(MM_WriteFileHeaders_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_WriteFileHeaders_Test_WriteError"); - - UtTest_Add(MM_DumpInEventCmd_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_DumpInEventCmd_Test_Nominal"); - UtTest_Add(MM_DumpInEventCmd_Test_SymNameError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpInEventCmd_Test_SymNameError"); - - UtTest_Add(MM_VerifyDumpInEventParams_Test_RAM, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_RAM"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_EEPROM"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM32, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM32"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM16, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM16"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM8, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM8"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooSmall"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooLarge"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_RAMRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_RAMRangeError"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_EEPROMRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_EEPROMRangeError"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM32RangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM32RangeError"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM32AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM32AlignmentError"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM16RangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM16RangeError"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM16AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM16AlignmentError"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_MEM8RangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_MEM8RangeError"); - UtTest_Add(MM_VerifyDumpInEventParams_Test_InvalidMemType, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyDumpInEventParams_Test_InvalidMemType"); - - UtTest_Add(MM_FillDumpInEventBuffer_Test_RAM, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_RAM"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_EEPROM"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_MEM32, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_MEM32"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_MEM16, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_MEM16"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_MEM8, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_MEM8"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_EEPROMCopyError, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_EEPROMCopyError"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_MEM32ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_MEM32ReadError"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_MEM16ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_MEM16ReadError"); - UtTest_Add(MM_FillDumpInEventBuffer_Test_MEM8ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_FillDumpInEventBuffer_Test_MEM8ReadError"); -}/* end MM_Dump_Test_AddTestCases */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_dump_test.h b/fsw/unit_test/mm_dump_test.h deleted file mode 100644 index 9f24021..0000000 --- a/fsw/unit_test/mm_dump_test.h +++ /dev/null @@ -1,34 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_dump_test.h 1.3 2016/03/03 21:24:59EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes for the unit test cases for mm_dump_test.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_dump_test.h $ - ** Revision 1.3 2016/03/03 21:24:59EST czogby - ** Add Integrity headers to all unit testl .h files - *************************************************************************/ - -/* - * Includes - */ - -#include "utassert.h" -#include "uttest.h" - -/* - * Function Prototypes - */ - -void MM_Dump_Test_AddTestCases(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_load.c.gcov b/fsw/unit_test/mm_load.c.gcov deleted file mode 100644 index 360c936..0000000 --- a/fsw/unit_test/mm_load.c.gcov +++ /dev/null @@ -1,1336 +0,0 @@ - -: 0:Source:../src/mm_load.c - -: 0:Programs:7 - -: 1:/************************************************************************* - -: 2:** File: - -: 3:** $Id: mm_load.c.gcov 1.3 2016/10/31 22:11:03EDT mdeschu Exp $ - -: 4:** - -: 5:** Copyright © 2007-2014 United States Government as represented by the - -: 6:** Administrator of the National Aeronautics and Space Administration. - -: 7:** All Other Rights Reserved. - -: 8:** - -: 9:** This software was created at NASA's Goddard Space Flight Center. - -: 10:** This software is governed by the NASA Open Source Agreement and may be - -: 11:** used, distributed and modified only pursuant to the terms of that - -: 12:** agreement. - -: 13:** - -: 14:** Purpose: - -: 15:** Provides functions for the execution of the CFS Memory Manager - -: 16:** load and fill ground commands - -: 17:** - -: 18:** $Log: mm_load.c.gcov $ - -: 18:** Revision 1.3 2016/10/31 22:11:03EDT mdeschu - -: 18:** Update gcov results, README and log file for MM unit tests for 2.4.1 - -: 19:** Revision 1.4 2016/10/30 00:48:49EDT mdeschu - -: 20:** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent - -: 21:** Revision 1.3 2016/10/28 18:01:15EDT mdeschu - -: 22:** Ticket #33: MM - Use OSAL file stat macros if they are defined - -: 23:** Revision 1.2 2015/12/29 15:22:21EST czogby - -: 24:** Move function prototypes from .c files into .h files - -: 25:** Revision 1.1 2015/07/28 12:21:46EDT rperera - -: 26:** Initial revision - -: 27:** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj - -: 28:** Revision 1.21 2015/04/14 15:29:00EDT lwalling - -: 29:** Removed unnecessary backslash characters from string format definitions - -: 30:** Revision 1.20 2015/04/07 10:16:04EDT lwalling - -: 31:** Report bytes processed for RAM and EEPROM fill commands - -: 32:** Revision 1.19 2015/04/06 15:41:15EDT lwalling - -: 33:** Verify results of calls to PSP memory read/write/copy/set functions - -: 34:** Revision 1.18 2015/03/30 17:33:57EDT lwalling - -: 35:** Create common process to maintain and report last action statistics - -: 36:** Revision 1.17 2015/03/20 14:30:18EDT lwalling - -: 37:** Remove unnecessary include of osapi-os-filesys.h - -: 38:** Revision 1.16 2015/03/20 14:16:53EDT lwalling - -: 39:** Add last peek/poke/fill command data value to housekeeping telemetry - -: 40:** Revision 1.15 2015/03/02 14:27:05EST sstrege - -: 41:** Added copyright information - -: 42:** Revision 1.14 2011/12/05 15:17:19EST jmdagost - -: 43:** Added check for zero bytes read from file load (with event message on error) - -: 44:** Revision 1.13 2010/11/29 13:35:20EST jmdagost - -: 45:** Replaced ifdef tests with if-true tests. - -: 46:** Revision 1.12 2010/11/29 08:48:40EST jmdagost - -: 47:** Removed in-line calls to enable/disable EEPROM bank writes (now done via command) - -: 48:** Revision 1.11 2009/07/31 12:28:08EDT jmdagost - -: 49:** Modified calls to EepromWrite enable and disable to include temporary argument of bank 0. This allows us to - -: 50:** use the updated PSP functions. - -: 51:** Revision 1.10 2009/07/23 07:41:20EDT wmoleski - -: 52:** Updating the OS_EepromWrite32 call to CFE_PSP_EepromWrite32 - -: 53:** Revision 1.9 2009/07/22 10:05:40EDT wmoleski - -: 54:** OS_EepromWritexxx calls changed to CFE_PSP_EepromWritexxx calls for cFE 6.0.0 - -: 55:** Revision 1.8 2009/06/18 10:17:11EDT rmcgraw - -: 56:** DCR8291:1 Changed OS_MEM_ #defines to CFE_PSP_MEM_ - -: 57:** Revision 1.7 2009/06/12 14:37:32EDT rmcgraw - -: 58:** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem - -: 59:** Revision 1.6 2008/09/05 14:24:24EDT dahardison - -: 60:** Updated references to local HK variables - -: 61:** Revision 1.5 2008/09/05 13:14:40EDT dahardison - -: 62:** Added inclusion of mm_mission_cfg.h - -: 63:** Revision 1.4 2008/05/22 15:13:21EDT dahardison - -: 64:** Changed inclusion of cfs_lib.h to cfs_utils.h - -: 65:** Revision 1.3 2008/05/19 15:23:15EDT dahardison - -: 66:** Version after completion of unit testing - -: 67:** - -: 68:*************************************************************************/ - -: 69: - -: 70:/************************************************************************* - -: 71:** Includes - -: 72:*************************************************************************/ - -: 73:#include "mm_app.h" - -: 74:#include "mm_load.h" - -: 75:#include "mm_perfids.h" - -: 76:#include "mm_events.h" - -: 77:#include "mm_utils.h" - -: 78:#include "mm_mem32.h" - -: 79:#include "mm_mem16.h" - -: 80:#include "mm_mem8.h" - -: 81:#include "mm_mission_cfg.h" - -: 82:#include "cfs_utils.h" - -: 83:#include - -: 84: - -: 85:/************************************************************************* - -: 86:** External Data - -: 87:*************************************************************************/ - -: 88:extern MM_AppData_t MM_AppData; - -: 89: - -: 90:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 91:/* */ - -: 92:/* Memory poke ground command */ - -: 93:/* */ - -: 94:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 4: 95:void MM_PokeCmd(CFE_SB_MsgPtr_t MessagePtr) - -: 96:{ - 4: 97: boolean Valid = TRUE; - -: 98: uint32 DestAddress; - -: 99: MM_PokeCmd_t *CmdPtr; - 4: 100: uint16 ExpectedLength = sizeof(MM_PokeCmd_t); - -: 101: - -: 102: /* Verify command packet length */ - 4: 103: if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - -: 104: { - 4: 105: CmdPtr = ((MM_PokeCmd_t *)MessagePtr); - -: 106: - -: 107: /* Resolve the symbolic address in command message */ - 4: 108: Valid = CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress); - -: 109: - 4: 110: if(Valid == TRUE) - -: 111: { - -: 112: /* Run necessary checks on command parameters */ - 3: 113: Valid = MM_VerifyPeekPokeParams(DestAddress, CmdPtr->MemType, CmdPtr->DataSize); - -: 114: - -: 115: /* Check the specified memory type and call the appropriate routine */ - 3: 116: if(Valid == TRUE) - -: 117: { - -: 118: /* Check if we need special EEPROM processing */ - 2: 119: if (CmdPtr->MemType == MM_EEPROM) - -: 120: { - 1: 121: MM_PokeEeprom(CmdPtr, DestAddress); - -: 122: } - -: 123: else - -: 124: { - -: 125: /* - -: 126: ** We can use this routine for all other memory types - -: 127: * (including the optional ones) - -: 128: */ - 1: 129: MM_PokeMem(CmdPtr, DestAddress); - -: 130: } - -: 131: - -: 132: } /* end MM_VerifyPeekPokeParams if */ - -: 133: - -: 134: } /* end CFS_ResolveSymAddr */ - -: 135: else - -: 136: { - 1: 137: MM_AppData.ErrCounter++; - 1: 138: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 139: "Symbolic address can't be resolved: Name = '%s'", - -: 140: CmdPtr->DestSymAddress.SymName); - -: 141: } - -: 142: - -: 143: } /* end MM_VerifyCmdLength if */ - -: 144: - 4: 145: return; - -: 146: - -: 147:} /* end MM_PokeCmd */ - -: 148: - -: 149:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 150:/* */ - -: 151:/* Write 8, 16, or 32 bits of data to any RAM memory address */ - -: 152:/* */ - -: 153:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 7: 154:void MM_PokeMem (MM_PokeCmd_t *CmdPtr, - -: 155: uint32 DestAddress) - -: 156:{ - -: 157: uint8 ByteValue; - -: 158: uint16 WordValue; - -: 159: int32 PSP_Status; - 7: 160: uint32 DataValue = 0; - 7: 161: uint32 BytesProcessed = 0; - 7: 162: boolean ValidPoke = FALSE; - -: 163: - -: 164: /* Write input number of bits to destination address */ - 7: 165: switch(CmdPtr->DataSize) - -: 166: { - -: 167: case MM_BYTE_BIT_WIDTH: - 2: 168: ByteValue = (uint8) CmdPtr->Data; - 2: 169: DataValue = (uint32) ByteValue; - 2: 170: BytesProcessed = sizeof (uint8); - 2: 171: if ((PSP_Status = CFE_PSP_MemWrite8(DestAddress, ByteValue)) == CFE_PSP_SUCCESS) - -: 172: { - 1: 173: CFE_EVS_SendEvent(MM_POKE_BYTE_INF_EID, CFE_EVS_INFORMATION, - -: 174: "Poke Command: Addr = 0x%08X, Size = 8 bits, Data = 0x%02X", - -: 175: (unsigned int)DestAddress, ByteValue); - 1: 176: ValidPoke = TRUE; - -: 177: } - -: 178: else - -: 179: { - 1: 180: MM_AppData.ErrCounter++; - 1: 181: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 182: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - -: 183: (unsigned int)PSP_Status, (unsigned int)DestAddress); - -: 184: } - 2: 185: break; - -: 186: - -: 187: case MM_WORD_BIT_WIDTH: - 2: 188: WordValue = (uint16)CmdPtr->Data; - 2: 189: DataValue = (uint32) WordValue; - 2: 190: BytesProcessed = sizeof (uint16); - 2: 191: if ((PSP_Status = CFE_PSP_MemWrite16(DestAddress, WordValue)) == CFE_PSP_SUCCESS) - -: 192: { - 1: 193: CFE_EVS_SendEvent(MM_POKE_WORD_INF_EID, CFE_EVS_INFORMATION, - -: 194: "Poke Command: Addr = 0x%08X, Size = 16 bits, Data = 0x%04X", - -: 195: (unsigned int)DestAddress, WordValue); - 1: 196: ValidPoke = TRUE; - -: 197: } - -: 198: else - -: 199: { - 1: 200: MM_AppData.ErrCounter++; - 1: 201: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 202: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - -: 203: (unsigned int)PSP_Status, (unsigned int)DestAddress); - -: 204: } - 2: 205: break; - -: 206: - -: 207: case MM_DWORD_BIT_WIDTH: - 3: 208: DataValue = CmdPtr->Data; - 3: 209: BytesProcessed = sizeof (uint32); - 3: 210: if ((PSP_Status = CFE_PSP_MemWrite32(DestAddress, DataValue)) == CFE_PSP_SUCCESS) - -: 211: { - 2: 212: CFE_EVS_SendEvent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, - -: 213: "Poke Command: Addr = 0x%08X, Size = 32 bits, Data = 0x%08X", - -: 214: (unsigned int)DestAddress, (unsigned int)DataValue); - 2: 215: ValidPoke = TRUE; - -: 216: } - -: 217: else - -: 218: { - 1: 219: MM_AppData.ErrCounter++; - 1: 220: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 221: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - -: 222: (unsigned int)PSP_Status, (unsigned int)DestAddress); - -: 223: } - -: 224: break; - -: 225: - -: 226: /* - -: 227: ** We don't need a default case, a bad DataSize will get caught - -: 228: ** in the MM_VerifyPeekPokeParams function and we won't get here - -: 229: */ - -: 230: default: - -: 231: break; - -: 232: } - -: 233: - 7: 234: if (ValidPoke) - -: 235: { - -: 236: /* Update cmd counter and last action stats */ - 4: 237: MM_AppData.CmdCounter++; - 4: 238: MM_AppData.LastAction = MM_POKE; - 4: 239: MM_AppData.MemType = CmdPtr->MemType; - 4: 240: MM_AppData.Address = DestAddress; - 4: 241: MM_AppData.DataValue = DataValue; - 4: 242: MM_AppData.BytesProcessed = BytesProcessed; - -: 243: } - -: 244: - 7: 245: return; - -: 246: - -: 247:} /* end MM_PokeMem */ - -: 248: - -: 249:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 250:/* */ - -: 251:/* Write 8, 16, or 32 bits of data to any EEPROM memory address */ - -: 252:/* */ - -: 253:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 7: 254:void MM_PokeEeprom (MM_PokeCmd_t *CmdPtr, - -: 255: uint32 DestAddress) - -: 256:{ - -: 257: uint8 ByteValue; - -: 258: uint16 WordValue; - -: 259: int32 PSP_Status; - 7: 260: uint32 DataValue = 0; - 7: 261: uint32 BytesProcessed = 0; - 7: 262: boolean ValidPoke = FALSE; - -: 263: - 7: 264: CFE_ES_PerfLogEntry(MM_EEPROM_POKE_PERF_ID); - -: 265: - -: 266: /* Write input number of bits to destination address */ - 7: 267: switch(CmdPtr->DataSize) - -: 268: { - -: 269: case MM_BYTE_BIT_WIDTH: - 2: 270: ByteValue = (uint8) CmdPtr->Data; - 2: 271: DataValue = (uint32) ByteValue; - 2: 272: BytesProcessed = sizeof (uint8); - 2: 273: PSP_Status = CFE_PSP_EepromWrite8(DestAddress, ByteValue); - 2: 274: if (PSP_Status != CFE_PSP_SUCCESS) - -: 275: { - 1: 276: MM_AppData.ErrCounter++; - 1: 277: CFE_EVS_SendEvent(MM_OS_EEPROMWRITE8_ERR_EID, CFE_EVS_ERROR, - -: 278: "CFE_PSP_EepromWrite8 error received: RC = 0x%08X, Addr = 0x%08X", - -: 279: (unsigned int)PSP_Status, (unsigned int)DestAddress); - -: 280: } - -: 281: else - -: 282: { - 1: 283: CFE_EVS_SendEvent(MM_POKE_BYTE_INF_EID, CFE_EVS_INFORMATION, - -: 284: "Poke Command: Addr = 0x%08X, Size = 8 bits, Data = 0x%02X", - -: 285: (unsigned int)DestAddress, ByteValue); - 1: 286: ValidPoke = TRUE; - -: 287: } - 2: 288: break; - -: 289: - -: 290: case MM_WORD_BIT_WIDTH: - 2: 291: WordValue = (uint16)CmdPtr->Data; - 2: 292: DataValue = (uint32) WordValue; - 2: 293: BytesProcessed = sizeof (uint16); - 2: 294: PSP_Status = CFE_PSP_EepromWrite16(DestAddress, WordValue); - 2: 295: if (PSP_Status != CFE_PSP_SUCCESS) - -: 296: { - 1: 297: MM_AppData.ErrCounter++; - 1: 298: CFE_EVS_SendEvent(MM_OS_EEPROMWRITE16_ERR_EID, CFE_EVS_ERROR, - -: 299: "CFE_PSP_EepromWrite16 error received: RC = 0x%08X, Addr = 0x%08X", - -: 300: (unsigned int)PSP_Status, (unsigned int)DestAddress); - -: 301: } - -: 302: else - -: 303: { - 1: 304: CFE_EVS_SendEvent(MM_POKE_WORD_INF_EID, CFE_EVS_INFORMATION, - -: 305: "Poke Command: Addr = 0x%08X, Size = 16 bits, Data = 0x%04X", - -: 306: (unsigned int)DestAddress, WordValue); - 1: 307: ValidPoke = TRUE; - -: 308: } - 2: 309: break; - -: 310: - -: 311: case MM_DWORD_BIT_WIDTH: - 3: 312: DataValue = CmdPtr->Data; - 3: 313: BytesProcessed = sizeof (uint32); - 3: 314: PSP_Status = CFE_PSP_EepromWrite32(DestAddress, CmdPtr->Data); - 3: 315: if (PSP_Status != CFE_PSP_SUCCESS) - -: 316: { - 1: 317: MM_AppData.ErrCounter++; - 1: 318: CFE_EVS_SendEvent(MM_OS_EEPROMWRITE32_ERR_EID, CFE_EVS_ERROR, - -: 319: "CFE_PSP_EepromWrite32 error received: RC = 0x%08X, Addr = 0x%08X", - -: 320: (unsigned int)PSP_Status, (unsigned int)DestAddress); - -: 321: } - -: 322: else - -: 323: { - 2: 324: CFE_EVS_SendEvent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, - -: 325: "Poke Command: Addr = 0x%08X, Size = 32 bits, Data = 0x%08X", - 2: 326: (unsigned int)DestAddress, (unsigned int)(CmdPtr->Data)); - 2: 327: ValidPoke = TRUE; - -: 328: } - -: 329: break; - -: 330: - -: 331: /* - -: 332: ** We don't need a default case, a bad DataSize will get caught - -: 333: ** in the MM_VerifyPeekPokeParams function and we won't get here - -: 334: */ - -: 335: default: - -: 336: break; - -: 337: } - -: 338: - 7: 339: if (ValidPoke) - -: 340: { - -: 341: /* Update cmd counter and last action stats */ - 4: 342: MM_AppData.CmdCounter++; - 4: 343: MM_AppData.LastAction = MM_POKE; - 4: 344: MM_AppData.MemType = CmdPtr->MemType; - 4: 345: MM_AppData.Address = DestAddress; - 4: 346: MM_AppData.DataValue = DataValue; - 4: 347: MM_AppData.BytesProcessed = BytesProcessed; - -: 348: } - -: 349: - 7: 350: CFE_ES_PerfLogExit(MM_EEPROM_POKE_PERF_ID); - -: 351: - 7: 352: return; - -: 353: - -: 354:} /* end MM_PokeEeprom */ - -: 355: - -: 356:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 357:/* */ - -: 358:/* Load memory with interrupts disabled */ - -: 359:/* Only valid for RAM addresses */ - -: 360:/* */ - -: 361:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 5: 362:void MM_LoadMemWIDCmd(CFE_SB_MsgPtr_t MessagePtr) - -: 363:{ - -: 364: MM_LoadMemWIDCmd_t *CmdPtr; - -: 365: int32 LockKey; - -: 366: int32 PSP_Status; - 5: 367: uint32 ComputedCRC = 0; - -: 368: uint32 DestAddress; - 5: 369: uint16 ExpectedLength = sizeof(MM_LoadMemWIDCmd_t); - -: 370: - -: 371: /* Verify command packet length */ - 5: 372: if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - -: 373: { - 5: 374: CmdPtr = ((MM_LoadMemWIDCmd_t *)MessagePtr); - -: 375: - -: 376: /* Resolve the symbolic address in command message */ - 5: 377: if (CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress) == TRUE) - -: 378: { - -: 379: /* - -: 380: ** Run some necessary checks on command parameters - -: 381: ** NOTE: A load with interrupts disabled command is only valid for RAM addresses - -: 382: */ - 4: 383: if (MM_VerifyLoadWIDParams(DestAddress, CmdPtr->NumOfBytes) == TRUE) - -: 384: { - -: 385: /* Verify data integrity check value */ - 3: 386: ComputedCRC = CFE_ES_CalculateCRC(CmdPtr->DataArray, - 3: 387: CmdPtr->NumOfBytes, - -: 388: 0, MM_LOAD_WID_CRC_TYPE); - -: 389: /* - -: 390: ** If the CRC matches do the load - -: 391: */ - 3: 392: if(ComputedCRC == CmdPtr->Crc) - -: 393: { - -: 394: /* Lock current interrupts */ - 2: 395: LockKey = OS_IntLock(); - -: 396: - -: 397: /* Load input data to input memory address */ - 4: 398: PSP_Status = CFE_PSP_MemCpy((void *)DestAddress, - 2: 399: CmdPtr->DataArray, - 2: 400: CmdPtr->NumOfBytes); - -: 401: - -: 402: /* Restore interrupt state */ - 2: 403: OS_IntUnlock(LockKey); - -: 404: - 2: 405: if (PSP_Status == CFE_PSP_SUCCESS) - -: 406: { - 1: 407: MM_AppData.CmdCounter++; - 1: 408: CFE_EVS_SendEvent(MM_LOAD_WID_INF_EID, CFE_EVS_INFORMATION, - -: 409: "Load Memory WID Command: Wrote %d bytes to address: 0x%08X", - -: 410: (int)CmdPtr->NumOfBytes, (unsigned int)DestAddress); - -: 411: - -: 412: /* Update last action statistics */ - 1: 413: MM_AppData.LastAction = MM_LOAD_WID; - 1: 414: MM_AppData.Address = DestAddress; - 1: 415: MM_AppData.MemType = MM_RAM; - 1: 416: MM_AppData.BytesProcessed = CmdPtr->NumOfBytes; - -: 417: } - -: 418: else - -: 419: { - 1: 420: MM_AppData.ErrCounter++; - 2: 421: CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - -: 422: "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - 1: 423: (unsigned int)PSP_Status, (unsigned int)(CmdPtr->DataArray), - 1: 424: (unsigned int)DestAddress, (unsigned int)(CmdPtr->NumOfBytes)); - -: 425: } - -: 426: } - -: 427: else - -: 428: { - 1: 429: MM_AppData.ErrCounter++; - 1: 430: CFE_EVS_SendEvent(MM_LOAD_WID_CRC_ERR_EID, CFE_EVS_ERROR, - -: 431: "Interrupts Disabled Load CRC failure: Expected = 0x%X Calculated = 0x%X", - -: 432: (unsigned int)CmdPtr->Crc, (unsigned int)ComputedCRC); - -: 433: } - -: 434: - -: 435: } /* end MM_VerifyLoadWIDParams */ - -: 436: - -: 437: } /* end CFS_ResolveSymAddr if */ - -: 438: else - -: 439: { - 1: 440: MM_AppData.ErrCounter++; - 1: 441: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 442: "Symbolic address can't be resolved: Name = '%s'", - -: 443: CmdPtr->DestSymAddress.SymName); - -: 444: } - -: 445: - -: 446: } /* end MM_VerifyCmdLength if */ - -: 447: - 5: 448: return; - -: 449: - -: 450:} /* end MM_LoadMemWIDCmd */ - -: 451: - -: 452:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 453:/* */ - -: 454:/* Verify load memory with interrupts disabled parameters */ - -: 455:/* */ - -: 456:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 8: 457:boolean MM_VerifyLoadWIDParams(uint32 Address, - -: 458: uint32 SizeInBytes) - -: 459:{ - 8: 460: boolean Valid = TRUE; - -: 461: int32 PSP_Status; - -: 462: - 8: 463: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 464: - 8: 465: if (PSP_Status != CFE_PSP_SUCCESS) - -: 466: { - 1: 467: Valid = FALSE; - 1: 468: MM_AppData.ErrCounter++; - 1: 469: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 470: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 471: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 472: } - 7: 473: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_UNINTERRUPTABLE_DATA)) - -: 474: { - 3: 475: Valid = FALSE; - 3: 476: MM_AppData.ErrCounter++; - 3: 477: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 478: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 479: } - -: 480: - 8: 481: return (Valid); - -: 482: - -: 483:} /* end MM_VerifyLoadWIDParams */ - -: 484: - -: 485:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 486:/* */ - -: 487:/* Load memory from a file command */ - -: 488:/* */ - -: 489:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 13: 490:void MM_LoadMemFromFileCmd(CFE_SB_MsgPtr_t MessagePtr) - -: 491:{ - 13: 492: boolean Valid = TRUE; - -: 493: int32 FileHandle; - 13: 494: int32 OS_Status = OS_SUCCESS; - -: 495: uint32 DestAddress; - -: 496: MM_LoadMemFromFileCmd_t *CmdPtr; - -: 497: CFE_FS_Header_t CFEFileHeader; - -: 498: MM_LoadDumpFileHeader_t MMFileHeader; - -: 499: uint32 ComputedCRC; - 13: 500: uint16 ExpectedLength = sizeof(MM_LoadMemFromFileCmd_t); - -: 501: - -: 502: /* Verify command packet length */ - 13: 503: if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - -: 504: { - 13: 505: CmdPtr = ((MM_LoadMemFromFileCmd_t *)MessagePtr); - -: 506: - -: 507: /* - -: 508: ** NUL terminate the very end of the file name string array as a - -: 509: ** safety measure - -: 510: */ - 13: 511: CmdPtr->FileName[OS_MAX_PATH_LEN - 1] = '\0'; - -: 512: - -: 513: /* Verify filename doesn't have any illegal characters */ - 13: 514: Valid = CFS_IsValidFilename(CmdPtr->FileName, strlen(CmdPtr->FileName)); - 13: 515: if(Valid == TRUE) - -: 516: { - -: 517: /* Open load file for reading */ - 11: 518: if((FileHandle = OS_open(CmdPtr->FileName, OS_READ_ONLY, 0)) >= OS_SUCCESS) - -: 519: { - -: 520: /* Read in the file headers */ - 10: 521: Valid = MM_ReadFileHeaders(CmdPtr->FileName, FileHandle, &CFEFileHeader, &MMFileHeader); - 10: 522: if(Valid == TRUE) - -: 523: { - -: 524: /* Verify the file size is correct */ - 10: 525: Valid = MM_VerifyLoadFileSize(CmdPtr->FileName, &MMFileHeader); - 10: 526: if(Valid == TRUE) - -: 527: { - -: 528: /* Verify data integrity check value */ - 10: 529: OS_Status = CFS_ComputeCRCFromFile(FileHandle, &ComputedCRC, MM_LOAD_FILE_CRC_TYPE); - 10: 530: if(OS_Status == OS_SUCCESS) - -: 531: { - -: 532: /* - -: 533: ** Reset the file pointer to the start of the load data, need to do this - -: 534: ** because CFS_ComputeCRCFromFile reads to the end of file - -: 535: */ - 9: 536: OS_lseek(FileHandle, (sizeof(CFE_FS_Header_t) - -: 537: + sizeof(MM_LoadDumpFileHeader_t)), OS_SEEK_SET); - -: 538: - -: 539: /* Check the computed CRC against the file header CRC */ - 9: 540: if(ComputedCRC == MMFileHeader.Crc) - -: 541: { - -: 542: /* Resolve symbolic address in file header */ - 8: 543: Valid = CFS_ResolveSymAddr(&(MMFileHeader.SymAddress), &DestAddress); - -: 544: - 8: 545: if(Valid == TRUE) - -: 546: { - -: 547: /* Run necessary checks on command parameters */ - 7: 548: Valid = MM_VerifyFileLoadParams(DestAddress, MMFileHeader.MemType, - -: 549: MMFileHeader.NumOfBytes); - 7: 550: if(Valid == TRUE) - -: 551: { - -: 552: /* Call the load routine for the specified memory type */ - 6: 553: switch(MMFileHeader.MemType) - -: 554: { - -: 555: case MM_RAM: - -: 556: case MM_EEPROM: - 2: 557: Valid = MM_LoadMemFromFile(FileHandle, CmdPtr->FileName, - -: 558: &MMFileHeader, DestAddress); - 2: 559: break; - -: 560: - -: 561:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 562: case MM_MEM32: - 1: 563: Valid = MM_LoadMem32FromFile(FileHandle, CmdPtr->FileName, - -: 564: &MMFileHeader, DestAddress); - 1: 565: break; - -: 566:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 567: - -: 568:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 569: case MM_MEM16: - 1: 570: Valid = MM_LoadMem16FromFile(FileHandle, CmdPtr->FileName, - -: 571: &MMFileHeader, DestAddress); - 1: 572: break; - -: 573:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 574: - -: 575:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 576: case MM_MEM8: - 2: 577: Valid = MM_LoadMem8FromFile(FileHandle, CmdPtr->FileName, - -: 578: &MMFileHeader, DestAddress); - -: 579: break; - -: 580:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 581: - -: 582: /* - -: 583: ** We don't need a default case, a bad MemType will get caught - -: 584: ** in the MM_VerifyFileLoadParams function and we won't get here - -: 585: */ - -: 586: default: - -: 587: break; - -: 588: } - -: 589: - 6: 590: if(Valid == TRUE) - -: 591: { - 6: 592: MM_AppData.CmdCounter++; - 6: 593: CFE_EVS_SendEvent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, - -: 594: "Load Memory From File Command: Loaded %d bytes to address 0x%08X from file '%s'", - -: 595: (int)MM_AppData.BytesProcessed, (unsigned int)DestAddress, CmdPtr->FileName); - -: 596: } - -: 597: - -: 598: } /* end MM_VerifyFileLoadParams if */ - -: 599: else - -: 600: { - -: 601: /* - -: 602: ** We don't need to increment the error counter here, it was done by the - -: 603: ** MM_VerifyFileLoadParams routine when the error was first discovered. - -: 604: ** We send this event as a supplemental message with the filename attached. - -: 605: */ - 1: 606: CFE_EVS_SendEvent(MM_FILE_LOAD_PARAMS_ERR_EID, CFE_EVS_ERROR, - -: 607: "Load file failed parameters check: File = '%s'", CmdPtr->FileName); - -: 608: } - -: 609: - -: 610: } /* end CFS_ResolveSymAddr if */ - -: 611: else - -: 612: { - 1: 613: MM_AppData.ErrCounter++; - 1: 614: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 615: "Symbolic address can't be resolved: Name = '%s'", - -: 616: MMFileHeader.SymAddress.SymName); - -: 617: } - -: 618: - -: 619: } /* end ComputedCRC == MMFileHeader.Crc if */ - -: 620: else - -: 621: { - 1: 622: MM_AppData.ErrCounter++; - 1: 623: CFE_EVS_SendEvent(MM_LOAD_FILE_CRC_ERR_EID, CFE_EVS_ERROR, - -: 624: "Load file CRC failure: Expected = 0x%X Calculated = 0x%X File = '%s'", - -: 625: (unsigned int)MMFileHeader.Crc, (unsigned int)ComputedCRC, CmdPtr->FileName); - -: 626: } - -: 627: - -: 628: } /* end CFS_ComputeCRCFromFile if */ - -: 629: else - -: 630: { - 1: 631: MM_AppData.ErrCounter++; - 1: 632: CFE_EVS_SendEvent(MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_ERROR, - -: 633: "CFS_ComputeCRCFromFile error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, - -: 634: CmdPtr->FileName); - -: 635: } - -: 636: - -: 637: } /* end MM_VerifyLoadFileSize */ - -: 638: - -: 639: /* - -: 640: ** Don't need an 'else' here. MM_VerifyLoadFileSize will increment - -: 641: ** the error counter and generate an event message if needed. - -: 642: */ - -: 643: - -: 644: } /* end MM_ReadFileHeaders if */ - -: 645: - -: 646: /* - -: 647: ** Don't need an 'else' here. MM_ReadFileHeaders will increment - -: 648: ** the error counter and generate an event message if needed. - -: 649: */ - -: 650: - -: 651: /* Close the load file for all cases after the open call succeeds */ - 10: 652: OS_Status = OS_close(FileHandle); - 10: 653: if(OS_Status != OS_SUCCESS) - -: 654: { - 1: 655: MM_AppData.ErrCounter++; - 1: 656: CFE_EVS_SendEvent(MM_OS_CLOSE_ERR_EID, CFE_EVS_ERROR, - -: 657: "OS_close error received: RC = 0x%08X File = '%s'", (unsigned int)OS_Status, - -: 658: CmdPtr->FileName); - -: 659: } - -: 660: - -: 661: } /* end OS_open if */ - -: 662: else - -: 663: { - 1: 664: MM_AppData.ErrCounter++; - 1: 665: CFE_EVS_SendEvent(MM_OS_OPEN_ERR_EID, CFE_EVS_ERROR, - -: 666: "OS_open error received: RC = 0x%08X File = '%s'", (unsigned int)FileHandle, - -: 667: CmdPtr->FileName); - -: 668: } - -: 669: - -: 670: } /* end IsValidFilename if */ - -: 671: else - -: 672: { - 2: 673: MM_AppData.ErrCounter++; - 2: 674: CFE_EVS_SendEvent(MM_CMD_FNAME_ERR_EID, CFE_EVS_ERROR, - -: 675: "Command specified filename invalid: Name = '%s'", CmdPtr->FileName); - -: 676: } - -: 677: - -: 678: } /* end MM_VerifyCmdLength if */ - -: 679: - 13: 680: return; - -: 681: - -: 682:} /* end LoadMemFromFileCmd */ - -: 683: - -: 684:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 685:/* */ - -: 686:/* Loads memory from a file */ - -: 687:/* */ - -: 688:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 5: 689:boolean MM_LoadMemFromFile(uint32 FileHandle, - -: 690: char *FileName, - -: 691: MM_LoadDumpFileHeader_t *FileHeader, - -: 692: uint32 DestAddress) - -: 693:{ - 5: 694: boolean Valid = FALSE; - 5: 695: int32 BytesRemaining = FileHeader->NumOfBytes; - 5: 696: int32 BytesProcessed = 0; - -: 697: int32 ReadLength; - -: 698: int32 PSP_Status; - 5: 699: uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - 5: 700: uint8 *ioBuffer = (uint8 *) &MM_AppData.LoadBuffer[0]; - 5: 701: uint8 *TargetPointer = (uint8 *) DestAddress; - -: 702: - 5: 703: if(FileHeader->MemType == MM_EEPROM) - -: 704: { - 4: 705: CFE_ES_PerfLogEntry(MM_EEPROM_FILELOAD_PERF_ID); - -: 706: } - -: 707: - 16: 708: while (BytesRemaining != 0) - -: 709: { - 6: 710: if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - -: 711: { - 4: 712: SegmentSize = BytesRemaining; - -: 713: } - -: 714: - 6: 715: if ((ReadLength = OS_read(FileHandle, ioBuffer, SegmentSize)) == SegmentSize) - -: 716: { - 5: 717: PSP_Status = CFE_PSP_MemCpy(TargetPointer, ioBuffer, SegmentSize); - -: 718: - 5: 719: if (PSP_Status == CFE_PSP_SUCCESS) - -: 720: { - 4: 721: BytesRemaining -= SegmentSize; - 4: 722: BytesProcessed += SegmentSize; - 4: 723: TargetPointer += SegmentSize; - -: 724: - -: 725: /* Prevent CPU hogging between load segments */ - 4: 726: if (BytesRemaining != 0) - -: 727: { - 1: 728: MM_SegmentBreak(); - -: 729: } - -: 730: } - -: 731: else - -: 732: { - 1: 733: MM_AppData.ErrCounter++; - 1: 734: CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - -: 735: "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - -: 736: (unsigned int)PSP_Status, (unsigned int)ioBuffer, (unsigned int)TargetPointer, (unsigned int)SegmentSize); - 1: 737: BytesRemaining = 0; - -: 738: } - -: 739: } - -: 740: else - -: 741: { - 1: 742: MM_AppData.ErrCounter++; - 1: 743: CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - -: 744: "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - -: 745: (unsigned int)ReadLength, (int)SegmentSize, FileName); - 1: 746: BytesRemaining = 0; - -: 747: } - -: 748: } - -: 749: - -: 750: /* Update last action statistics */ - 5: 751: if (BytesProcessed == FileHeader->NumOfBytes) - -: 752: { - 3: 753: Valid = TRUE; - 3: 754: MM_AppData.LastAction = MM_LOAD_FROM_FILE; - 3: 755: MM_AppData.MemType = FileHeader->MemType; - 3: 756: MM_AppData.Address = DestAddress; - 3: 757: MM_AppData.BytesProcessed = BytesProcessed; - 3: 758: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - -: 759: } - -: 760: - 5: 761: return(Valid); - -: 762: - -: 763:} /* end MM_LoadMemFromFile */ - -: 764: - -: 765:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 766:/* */ - -: 767:/* Verify load memory from a file parameters */ - -: 768:/* */ - -: 769:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 25: 770:boolean MM_VerifyFileLoadParams(uint32 Address, - -: 771: uint8 MemType, - -: 772: uint32 SizeInBytes) - -: 773:{ - 25: 774: boolean Valid = TRUE; - -: 775: int32 PSP_Status; - -: 776: - 25: 777: switch(MemType) - -: 778: { - -: 779: case MM_RAM: - 4: 780: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 781: - 4: 782: if (PSP_Status != CFE_PSP_SUCCESS) - -: 783: { - 1: 784: Valid = FALSE; - 1: 785: MM_AppData.ErrCounter++; - 1: 786: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 787: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 788: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 789: } - 3: 790: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_RAM)) - -: 791: { - 2: 792: Valid = FALSE; - 2: 793: MM_AppData.ErrCounter++; - 2: 794: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 795: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 796: } - 4: 797: break; - -: 798: - -: 799: case MM_EEPROM: - 4: 800: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 801: - 4: 802: if (PSP_Status != CFE_PSP_SUCCESS) - -: 803: { - 1: 804: Valid = FALSE; - 1: 805: MM_AppData.ErrCounter++; - 1: 806: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 807: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 808: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 809: } - 3: 810: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_EEPROM)) - -: 811: { - 2: 812: Valid = FALSE; - 2: 813: MM_AppData.ErrCounter++; - 2: 814: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 815: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 816: } - 4: 817: break; - -: 818: - -: 819:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 820: case MM_MEM32: - 5: 821: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 822: - 5: 823: if (PSP_Status != CFE_PSP_SUCCESS) - -: 824: { - 1: 825: Valid = FALSE; - 1: 826: MM_AppData.ErrCounter++; - 1: 827: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 828: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 829: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 830: } - 6: 831: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_MEM32)) - -: 832: { - 2: 833: Valid = FALSE; - 2: 834: MM_AppData.ErrCounter++; - 2: 835: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 836: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 837: } - 2: 838: else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - -: 839: { - 1: 840: Valid = FALSE; - 1: 841: MM_AppData.ErrCounter++; - 1: 842: CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - -: 843: "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - -: 844: (unsigned int)Address, (int)SizeInBytes); - -: 845: } - 5: 846: break; - -: 847:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 848: - -: 849:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 850: case MM_MEM16: - 5: 851: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 852: - 5: 853: if (PSP_Status != CFE_PSP_SUCCESS) - -: 854: { - 1: 855: Valid = FALSE; - 1: 856: MM_AppData.ErrCounter++; - 1: 857: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 858: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 859: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 860: } - 6: 861: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_MEM16)) - -: 862: { - 2: 863: Valid = FALSE; - 2: 864: MM_AppData.ErrCounter++; - 2: 865: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 866: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 867: } - 2: 868: else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - -: 869: { - 1: 870: Valid = FALSE; - 1: 871: MM_AppData.ErrCounter++; - 1: 872: CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - -: 873: "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - -: 874: (unsigned int)Address, (int)SizeInBytes); - -: 875: } - 5: 876: break; - -: 877:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 878: - -: 879:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 880: case MM_MEM8: - 5: 881: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 882: - 5: 883: if (PSP_Status != CFE_PSP_SUCCESS) - -: 884: { - 1: 885: Valid = FALSE; - 1: 886: MM_AppData.ErrCounter++; - 1: 887: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 888: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 889: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 890: } - 4: 891: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_LOAD_FILE_DATA_MEM8)) - -: 892: { - 2: 893: Valid = FALSE; - 2: 894: MM_AppData.ErrCounter++; - 2: 895: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 896: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 897: } - 5: 898: break; - -: 899:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 900: - -: 901: default: - 2: 902: Valid = FALSE; - 2: 903: MM_AppData.ErrCounter++; - 2: 904: CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - -: 905: "Invalid memory type specified: MemType = %d", MemType); - -: 906: break; - -: 907: - -: 908: } /* end MemType switch */ - -: 909: - 25: 910: return (Valid); - -: 911: - -: 912:} /* end MM_VerifyFileLoadParams */ - -: 913: - -: 914:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 915:/* */ - -: 916:/* Verify load file size */ - -: 917:/* */ - -: 918:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 12: 919:boolean MM_VerifyLoadFileSize(char *FileName, - -: 920: MM_LoadDumpFileHeader_t *FileHeader) - -: 921:{ - -: 922: - 12: 923: boolean Valid = TRUE; - -: 924: int32 OS_Status; - -: 925: uint32 ExpectedSize; - -: 926: int32 ActualSize; /* The size returned by OS_stat is signed */ - -: 927: os_fstat_t FileStats; - -: 928: - -: 929: /* - -: 930: ** Get the filesystem statistics on our load file - -: 931: */ - 12: 932: OS_Status = OS_stat(FileName, &FileStats); - 12: 933: if(OS_Status != OS_FS_SUCCESS) - -: 934: { - 1: 935: Valid = FALSE; - 1: 936: MM_AppData.ErrCounter++; - 1: 937: CFE_EVS_SendEvent(MM_OS_STAT_ERR_EID, CFE_EVS_ERROR, - -: 938: "OS_stat error received: RC = 0x%08X File = '%s'", - -: 939: (unsigned int)OS_Status, FileName); - -: 940: } - -: 941: else - -: 942: { - -: 943: /* - -: 944: ** Check the reported size of the file against what it should be based - -: 945: ** upon the number of load bytes specified in the file header - -: 946: */ - -: 947:#ifdef OS_FILESTAT_SIZE - -: 948: ActualSize = OS_FILESTAT_SIZE(FileStats); - -: 949:#else - 11: 950: ActualSize = FileStats.st_size; - -: 951:#endif - 11: 952: ExpectedSize = FileHeader->NumOfBytes + sizeof(CFE_FS_Header_t) - -: 953: + sizeof(MM_LoadDumpFileHeader_t); - 11: 954: if(ActualSize != ExpectedSize) - -: 955: { - 1: 956: Valid = FALSE; - 1: 957: MM_AppData.ErrCounter++; - -: 958: - -: 959: /* - -: 960: ** Note: passing FileStats.st_size in this event message will cause - -: 961: ** a segmentation fault under cygwin during unit testing, so we added - -: 962: ** the variable ActualSize to this function. - -: 963: */ - 1: 964: CFE_EVS_SendEvent(MM_LD_FILE_SIZE_ERR_EID, CFE_EVS_ERROR, - -: 965: "Load file size error: Reported by OS = %d Expected = %d File = '%s'", - -: 966: (int)ActualSize, (int)ExpectedSize, FileName); - -: 967: } - -: 968: - -: 969: } - -: 970: - 12: 971: return (Valid); - -: 972: - -: 973:} /* end MM_VerifyLoadFileSize */ - -: 974: - -: 975:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 976:/* */ - -: 977:/* Read the cFE primary and and MM secondary file headers */ - -: 978:/* */ - -: 979:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 12: 980:boolean MM_ReadFileHeaders(char *FileName, - -: 981: int32 FileHandle, - -: 982: CFE_FS_Header_t *CFEHeader, - -: 983: MM_LoadDumpFileHeader_t *MMHeader) - -: 984:{ - 12: 985: boolean Valid = TRUE; - -: 986: int32 OS_Status; - -: 987: - -: 988: /* - -: 989: ** Read in the primary cFE file header - -: 990: */ - 12: 991: OS_Status = CFE_FS_ReadHeader(CFEHeader, FileHandle); - 12: 992: if(OS_Status != sizeof(CFE_FS_Header_t)) - -: 993: { - -: 994: /* We either got an error or didn't read as much data as expected */ - 1: 995: Valid = FALSE; - 1: 996: MM_AppData.ErrCounter++; - 1: 997: CFE_EVS_SendEvent(MM_CFE_FS_READHDR_ERR_EID, CFE_EVS_ERROR, - -: 998: "CFE_FS_ReadHeader error received: RC = 0x%08X Expected = %d File = '%s'", - -: 999: (unsigned int)OS_Status, sizeof(CFE_FS_Header_t), FileName); - -: 1000: - -: 1001: - -: 1002: } /* end CFE_FS_ReadHeader if */ - -: 1003: else - -: 1004: { - -: 1005: /* - -: 1006: ** Read in the secondary MM file header - -: 1007: */ - 11: 1008: OS_Status = OS_read(FileHandle, MMHeader, sizeof(MM_LoadDumpFileHeader_t)); - 11: 1009: if(OS_Status != sizeof(MM_LoadDumpFileHeader_t)) - -: 1010: { - -: 1011: /* We either got an error or didn't read as much data as expected */ - 1: 1012: Valid = FALSE; - 1: 1013: MM_AppData.ErrCounter++; - 1: 1014: CFE_EVS_SendEvent(MM_OS_READ_EXP_ERR_EID, CFE_EVS_ERROR, - -: 1015: "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - -: 1016: (unsigned int)OS_Status, sizeof(MM_LoadDumpFileHeader_t), FileName); - -: 1017: - -: 1018: } /* end OS_read if */ - -: 1019: - -: 1020: } /* end CFE_FS_ReadHeader else */ - -: 1021: - 12: 1022: return (Valid); - -: 1023: - -: 1024:} /* end MM_ReadFileHeaders */ - -: 1025: - -: 1026: - -: 1027:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 1028:/* */ - -: 1029:/* Fill memory command */ - -: 1030:/* */ - -: 1031:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 7: 1032:void MM_FillMemCmd(CFE_SB_MsgPtr_t MessagePtr) - -: 1033:{ - -: 1034: uint32 DestAddress; - 7: 1035: MM_FillMemCmd_t *CmdPtr = (MM_FillMemCmd_t *) MessagePtr; - 7: 1036: uint16 ExpectedLength = sizeof(MM_FillMemCmd_t); - -: 1037: - -: 1038: /* Verify command packet length */ - 7: 1039: if(MM_VerifyCmdLength(MessagePtr, ExpectedLength)) - -: 1040: { - -: 1041: /* Resolve symbolic address */ - 7: 1042: if (CFS_ResolveSymAddr(&(CmdPtr->DestSymAddress), &DestAddress) == TRUE) - -: 1043: { - -: 1044: /* Run necessary checks on command parameters */ - 6: 1045: if (MM_VerifyFillParams(DestAddress, CmdPtr->MemType, CmdPtr->NumOfBytes) == TRUE) - -: 1046: { - 5: 1047: switch(CmdPtr->MemType) - -: 1048: { - -: 1049: case MM_RAM: - -: 1050: case MM_EEPROM: - 2: 1051: MM_FillMem(DestAddress, CmdPtr); - 2: 1052: break; - -: 1053: - -: 1054: #if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 1055: case MM_MEM32: - 1: 1056: MM_FillMem32(DestAddress, CmdPtr); - 1: 1057: break; - -: 1058: #endif - -: 1059: - -: 1060: #if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 1061: case MM_MEM16: - 1: 1062: MM_FillMem16(DestAddress, CmdPtr); - 1: 1063: break; - -: 1064: #endif - -: 1065: - -: 1066: #if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 1067: case MM_MEM8: - 1: 1068: MM_FillMem8(DestAddress, CmdPtr); - -: 1069: break; - -: 1070: #endif - -: 1071: - -: 1072: /* - -: 1073: ** We don't need a default case, a bad MemType will get caught - -: 1074: ** in the MM_VerifyFillParams function and we won't get here - -: 1075: */ - -: 1076: default: - -: 1077: break; - -: 1078: } - -: 1079: - 5: 1080: if (MM_AppData.LastAction == MM_FILL) - -: 1081: { - 5: 1082: MM_AppData.CmdCounter++; - 5: 1083: CFE_EVS_SendEvent(MM_FILL_INF_EID, CFE_EVS_INFORMATION, - -: 1084: "Fill Memory Command: Filled %d bytes at address: 0x%08X with pattern: 0x%08X", - -: 1085: (int)MM_AppData.BytesProcessed, (unsigned int)DestAddress, (unsigned int)MM_AppData.DataValue); - -: 1086: } - -: 1087: } - -: 1088: } - -: 1089: else - -: 1090: { - 1: 1091: MM_AppData.ErrCounter++; - 1: 1092: CFE_EVS_SendEvent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, - -: 1093: "Symbolic address can't be resolved: Name = '%s'", - -: 1094: CmdPtr->DestSymAddress.SymName); - -: 1095: } - -: 1096: } - -: 1097: - 7: 1098: return; - -: 1099: - -: 1100:} /* end MM_FillMemCmd */ - -: 1101: - -: 1102: - -: 1103:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 1104:/* */ - -: 1105:/* Fill memory with the command specified fill pattern */ - -: 1106:/* */ - -: 1107:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 4: 1108:void MM_FillMem(uint32 DestAddress, - -: 1109: MM_FillMemCmd_t *CmdPtr) - -: 1110:{ - -: 1111: uint16 i; - -: 1112: int32 PSP_Status; - 4: 1113: boolean Valid = TRUE; - 4: 1114: uint32 BytesProcessed = 0; - 4: 1115: uint32 BytesRemaining = CmdPtr->NumOfBytes; - 4: 1116: uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; - 4: 1117: uint8 *TargetPointer = (uint8 *) DestAddress; - 4: 1118: uint8 *FillBuffer = (uint8 *) &MM_AppData.FillBuffer[0]; - -: 1119: - -: 1120: /* Create a scratch buffer with one fill segment */ - 204: 1121: for (i = 0; i < (MM_MAX_FILL_DATA_SEG/sizeof(uint32)); i++) - -: 1122: { - 200: 1123: FillBuffer[i] = CmdPtr->FillPattern; - -: 1124: } - -: 1125: - -: 1126: /* Start EEPROM performance monitor */ - 4: 1127: if(CmdPtr->MemType == MM_EEPROM) - -: 1128: { - 3: 1129: CFE_ES_PerfLogEntry(MM_EEPROM_FILL_PERF_ID); - -: 1130: } - -: 1131: - -: 1132: /* Fill memory one segment at a time */ - 12: 1133: while (BytesRemaining != 0) - -: 1134: { - -: 1135: /* Last fill segment may be partial size */ - 4: 1136: if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - -: 1137: { - 4: 1138: SegmentSize = BytesRemaining; - -: 1139: } - -: 1140: - 4: 1141: PSP_Status = CFE_PSP_MemCpy(TargetPointer, FillBuffer, SegmentSize); - -: 1142: - 4: 1143: if (PSP_Status == CFE_PSP_SUCCESS) - -: 1144: { - 3: 1145: TargetPointer += SegmentSize; - 3: 1146: BytesProcessed += SegmentSize; - 3: 1147: BytesRemaining -= SegmentSize; - -: 1148: } - -: 1149: else - -: 1150: { - 1: 1151: MM_AppData.ErrCounter++; - 1: 1152: CFE_EVS_SendEvent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, - -: 1153: "PSP copy memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Size=0x%08X", - -: 1154: (unsigned int)PSP_Status, (unsigned int)FillBuffer, (unsigned int)TargetPointer, (unsigned int)SegmentSize); - 1: 1155: BytesRemaining = 0; - 1: 1156: Valid = FALSE; - -: 1157: } - -: 1158: } - -: 1159: - -: 1160: /* Stop EEPROM performance monitor */ - 4: 1161: if(CmdPtr->MemType == MM_EEPROM) - -: 1162: { - 3: 1163: CFE_ES_PerfLogExit(MM_EEPROM_FILL_PERF_ID); - -: 1164: } - -: 1165: - -: 1166: /* Update last action statistics */ - 4: 1167: if (Valid) - -: 1168: { - 3: 1169: MM_AppData.LastAction = MM_FILL; - 3: 1170: MM_AppData.MemType = CmdPtr->MemType; - 3: 1171: MM_AppData.Address = DestAddress; - 3: 1172: MM_AppData.DataValue = CmdPtr->FillPattern; - 3: 1173: MM_AppData.BytesProcessed = BytesProcessed; - -: 1174: } - -: 1175: - 4: 1176: return; - -: 1177: - -: 1178:}/* End MM_FillMem */ - -: 1179: - -: 1180: - -: 1181:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 1182:/* */ - -: 1183:/* Verify fill memory parameters */ - -: 1184:/* */ - -: 1185:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 24: 1186:boolean MM_VerifyFillParams(uint32 Address, - -: 1187: uint8 MemType, - -: 1188: uint32 SizeInBytes) - -: 1189:{ - 24: 1190: boolean Valid = TRUE; - -: 1191: int32 PSP_Status; - -: 1192: - 24: 1193: switch(MemType) - -: 1194: { - -: 1195: case MM_RAM: - 4: 1196: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 1197: - 4: 1198: if (PSP_Status != CFE_PSP_SUCCESS) - -: 1199: { - 1: 1200: Valid = FALSE; - 1: 1201: MM_AppData.ErrCounter++; - 1: 1202: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 1203: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 1204: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 1205: } - 3: 1206: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_RAM)) - -: 1207: { - 2: 1208: Valid = FALSE; - 2: 1209: MM_AppData.ErrCounter++; - 2: 1210: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 1211: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 1212: } - 4: 1213: break; - -: 1214: - -: 1215: case MM_EEPROM: - 4: 1216: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 1217: - 4: 1218: if (PSP_Status != CFE_PSP_SUCCESS) - -: 1219: { - 1: 1220: Valid = FALSE; - 1: 1221: MM_AppData.ErrCounter++; - 1: 1222: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 1223: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 1224: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 1225: } - 3: 1226: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_EEPROM)) - -: 1227: { - 2: 1228: Valid = FALSE; - 2: 1229: MM_AppData.ErrCounter++; - 2: 1230: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 1231: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 1232: } - 4: 1233: break; - -: 1234: - -: 1235:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 1236: case MM_MEM32: - 5: 1237: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 1238: - 5: 1239: if (PSP_Status != CFE_PSP_SUCCESS) - -: 1240: { - 1: 1241: Valid = FALSE; - 1: 1242: MM_AppData.ErrCounter++; - 1: 1243: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 1244: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 1245: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 1246: } - 6: 1247: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_MEM32)) - -: 1248: { - 2: 1249: Valid = FALSE; - 2: 1250: MM_AppData.ErrCounter++; - 2: 1251: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 1252: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 1253: } - 2: 1254: else if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - -: 1255: { - 1: 1256: Valid = FALSE; - 1: 1257: MM_AppData.ErrCounter++; - 1: 1258: CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - -: 1259: "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - -: 1260: (unsigned int)Address, (int)SizeInBytes); - -: 1261: } - 5: 1262: break; - -: 1263:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 1264: - -: 1265:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 1266: case MM_MEM16: - 5: 1267: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 1268: - 5: 1269: if (PSP_Status != CFE_PSP_SUCCESS) - -: 1270: { - 1: 1271: Valid = FALSE; - 1: 1272: MM_AppData.ErrCounter++; - 1: 1273: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 1274: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 1275: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 1276: } - 6: 1277: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_MEM16)) - -: 1278: { - 2: 1279: Valid = FALSE; - 2: 1280: MM_AppData.ErrCounter++; - 2: 1281: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 1282: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 1283: } - 2: 1284: else if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - -: 1285: { - 1: 1286: Valid = FALSE; - 1: 1287: MM_AppData.ErrCounter++; - 1: 1288: CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - -: 1289: "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - -: 1290: (unsigned int)Address, (int)SizeInBytes); - -: 1291: } - 5: 1292: break; - -: 1293:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 1294: - -: 1295:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 1296: case MM_MEM8: - 4: 1297: PSP_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 1298: - 4: 1299: if (PSP_Status != CFE_PSP_SUCCESS) - -: 1300: { - 1: 1301: Valid = FALSE; - 1: 1302: MM_AppData.ErrCounter++; - 1: 1303: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 1304: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 1305: (unsigned int)PSP_Status, (unsigned int)Address, (int)SizeInBytes, CFE_PSP_MEM_RAM); - -: 1306: } - 3: 1307: else if((SizeInBytes == 0) || (SizeInBytes > MM_MAX_FILL_DATA_MEM8)) - -: 1308: { - 2: 1309: Valid = FALSE; - 2: 1310: MM_AppData.ErrCounter++; - 2: 1311: CFE_EVS_SendEvent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, - -: 1312: "Data size in bytes invalid or exceeds limits: Data Size = %d", (int)SizeInBytes); - -: 1313: } - 4: 1314: break; - -: 1315:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 1316: - -: 1317: default: - 2: 1318: Valid = FALSE; - 2: 1319: MM_AppData.ErrCounter++; - 2: 1320: CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - -: 1321: "Invalid memory type specified: MemType = %d", MemType); - -: 1322: break; - -: 1323: - -: 1324: } /* end MemType switch */ - -: 1325: - 24: 1326: return (Valid); - -: 1327: - -: 1328:} /* end MM_VerifyFillParams */ - -: 1329: - -: 1330:/************************/ - -: 1331:/* End of File Comment */ - -: 1332:/************************/ diff --git a/fsw/unit_test/mm_load_test.c b/fsw/unit_test/mm_load_test.c deleted file mode 100644 index c4a6ea3..0000000 --- a/fsw/unit_test/mm_load_test.c +++ /dev/null @@ -1,2603 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_load_test.c 1.5.1.1 2016/11/17 16:35:30EST sstrege Exp $ - ** - ** Purpose: - ** This file contains unit test cases for the functions contained in the file mm_load.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_load_test.c $ - ** Revision 1.5.1.1 2016/11/17 16:35:30EST sstrege - ** - ** Revision 1.6 2016/11/17 12:51:17EST mdeschu - ** Remove references to temporary header file mm_test_exports.h - ** Revision 1.5 2016/10/31 22:09:12EDT mdeschu - ** Adding std=c99 to unit test makefile as per babelfish ticket #39 caused compiler error with unknown - ** Symbol S_IFREG. Removed setting File stat st_mode to S_IFREG in StatHook1. Has no effect on unit tests. - ** Revision 1.4 2016/10/24 18:35:23EDT czogby - ** Code Walkthough Updates - ** Revision 1.3 2016/05/04 19:01:15EDT czogby - ** Update MM to Compile With New UT-Assert PSP Files - ** Revision 1.2 2016/03/04 20:00:58EST czogby - ** Need Temporary Header File to Import Some MM Functions Into Unit Tests - ** Revision 1.1 2016/02/03 17:11:36EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_load_test.h" -#include "mm_load.h" -#include "mm_msg.h" -#include "mm_msgdefs.h" -#include "mm_msgids.h" -#include "mm_events.h" -#include "mm_filedefs.h" -#include "mm_version.h" -#include "mm_test_utils.h" -#include "ut_osapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_es_hooks.h" -#include "ut_cfe_evs_stubs.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_psp_eeprom_stubs.h" -#include "ut_cfe_psp_ram_stubs.h" -#include "ut_cfe_psp_memrange_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include -#include -#include - -/* - * Function Definitions - */ - -int32 UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1( uint32 *SymbolAddress, char *SymbolName ) -{ - *SymbolAddress = 0; - - return OS_SUCCESS; -} /* end UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1 */ - -int8 UT_MM_CFE_OSFILEAPI_ReadHook1_MemType; -int32 UT_MM_CFE_OSFILEAPI_ReadHook_RunCount; -int32 UT_MM_CFE_OSFILEAPI_ReadHook1(int32 filedes, void *buffer, uint32 nbytes) -{ - ((MM_LoadDumpFileHeader_t *)(buffer))->NumOfBytes = 4; - ((MM_LoadDumpFileHeader_t *)(buffer))->Crc = 0; - ((MM_LoadDumpFileHeader_t *)(buffer))->MemType = UT_MM_CFE_OSFILEAPI_ReadHook1_MemType; - ((MM_LoadDumpFileHeader_t *)(buffer))->SymAddress.Offset = 0; - - strncpy(((MM_LoadDumpFileHeader_t *)(buffer))->SymAddress.SymName, "name", OS_MAX_PATH_LEN); - - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount++; - - if (UT_MM_CFE_OSFILEAPI_ReadHook_RunCount == 1) - return sizeof(MM_LoadDumpFileHeader_t); - else if (UT_MM_CFE_OSFILEAPI_ReadHook_RunCount == 2) - return 0; - else - return 4; - - return 0; -} /* end UT_MM_CFE_OSFILEAPI_ReadHook1 */ - -int32 UT_MM_CFE_OSFILEAPI_ReadHook2(int32 filedes, void *buffer, uint32 nbytes) -{ - ((MM_LoadDumpFileHeader_t *)(buffer))->NumOfBytes = 4; - ((MM_LoadDumpFileHeader_t *)(buffer))->Crc = 99; - ((MM_LoadDumpFileHeader_t *)(buffer))->MemType = MM_RAM; - ((MM_LoadDumpFileHeader_t *)(buffer))->SymAddress.Offset = 0; - - strncpy(((MM_LoadDumpFileHeader_t *)(buffer))->SymAddress.SymName, "name", OS_MAX_PATH_LEN); - - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount++; - - if (UT_MM_CFE_OSFILEAPI_ReadHook_RunCount == 1) - return sizeof(MM_LoadDumpFileHeader_t); - else if (UT_MM_CFE_OSFILEAPI_ReadHook_RunCount == 2) - return 0; - else - return 4; - - return 0; -} /* end UT_MM_CFE_OSFILEAPI_ReadHook2 */ - -int32 UT_MM_CFE_OSFILEAPI_ReadHook3(int32 filedes, void *buffer, uint32 nbytes) -{ - ((MM_LoadDumpFileHeader_t *)(buffer))->NumOfBytes = 4; - ((MM_LoadDumpFileHeader_t *)(buffer))->Crc = 0; - ((MM_LoadDumpFileHeader_t *)(buffer))->MemType = MM_RAM; - ((MM_LoadDumpFileHeader_t *)(buffer))->SymAddress.Offset = 0; - - strncpy(((MM_LoadDumpFileHeader_t *)(buffer))->SymAddress.SymName, "name", OS_MAX_PATH_LEN); - - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount++; - - if (UT_MM_CFE_OSFILEAPI_ReadHook_RunCount == 1) - return sizeof(MM_LoadDumpFileHeader_t); - else if (UT_MM_CFE_OSFILEAPI_ReadHook_RunCount == 2) - return -1; - else - return 4; - - return 0; -} /* end UT_MM_CFE_OSFILEAPI_ReadHook3 */ - -int32 UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1(const char *path, os_fstat_t *filestats) -{ - filestats->st_size = 4 + sizeof(CFE_FS_Header_t) + sizeof(MM_LoadDumpFileHeader_t); - - return OS_FS_SUCCESS; -} /* end UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1 */ - -void MM_PokeCmd_Test_EEPROM (void) -{ - MM_PokeCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.DataSize = 32; - - /* Execute the function being tested */ - MM_PokeCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000"), - "Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeCmd_Test_EEPROM */ - -void MM_PokeCmd_Test_NonEEPROM (void) -{ - MM_PokeCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = 32; - - /* Execute the function being tested */ - MM_PokeCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000"), - "Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeCmd_Test_NonEEPROM */ - -void MM_PokeCmd_Test_SymNameError (void) -{ - MM_PokeCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = 32; - - strncpy(CmdPacket.DestSymAddress.SymName, "name", OS_MAX_PATH_LEN); - - /* Set to generate error message MM_SYMNAME_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PokeCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'name'"), - "Symbolic address can't be resolved: Name = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeCmd_Test_SymNameError */ - -void MM_PokeMem_Test_8bit (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = MM_BYTE_BIT_WIDTH; - CmdPacket.Data = (uint8)(5); - - DestAddress = 1; - - /* Execute the function being tested */ - MM_PokeMem(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_BYTE_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05"), - "Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_POKE, "MM_AppData.LastAction == MM_POKE"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == 5, "MM_AppData.DataValue == 5"); - UtAssert_True (MM_AppData.BytesProcessed == 1, "MM_AppData.BytesProcessed == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeMem_Test_8bit */ - -void MM_PokeMem_Test_8bitError (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = MM_BYTE_BIT_WIDTH; - CmdPacket.Data = (uint8)(5); - - DestAddress = 1; - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE8_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PokeMem(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeMem_Test_8bitError */ - -void MM_PokeMem_Test_16bit (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = MM_WORD_BIT_WIDTH; - CmdPacket.Data = (uint16)(5); - - DestAddress = 1; - - /* Execute the function being tested */ - MM_PokeMem(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_WORD_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x0005"), - "Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x05"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_POKE, "MM_AppData.LastAction == MM_POKE"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == 5, "MM_AppData.DataValue == 5"); - UtAssert_True (MM_AppData.BytesProcessed == 2, "MM_AppData.BytesProcessed == 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeMem_Test_16bit */ - -void MM_PokeMem_Test_16bitError (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = MM_WORD_BIT_WIDTH; - CmdPacket.Data = (uint16)(5); - - DestAddress = 1; - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE16_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PokeMem(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeMem_Test_16bitError */ - -void MM_PokeMem_Test_32bit (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = MM_DWORD_BIT_WIDTH; - CmdPacket.Data = (uint32)(5); - - DestAddress = 1; - - /* Execute the function being tested */ - MM_PokeMem(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x00000005"), - "Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x05"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_POKE, "MM_AppData.LastAction == MM_POKE"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == 5, "MM_AppData.DataValue == 5"); - UtAssert_True (MM_AppData.BytesProcessed == 4, "MM_AppData.BytesProcessed == 4"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeMem_Test_32bit */ - -void MM_PokeMem_Test_32bitError (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.DataSize = MM_DWORD_BIT_WIDTH; - CmdPacket.Data = (uint32)(5); - - DestAddress = 1; - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE32_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PokeMem(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeMem_Test_32bitError */ - -void MM_PokeEeprom_Test_8bit (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.DataSize = MM_BYTE_BIT_WIDTH; - CmdPacket.Data = (uint8)(5); - - DestAddress = 1; - - /* Execute the function being tested */ - MM_PokeEeprom(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_BYTE_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05"), - "Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_POKE, "MM_AppData.LastAction == MM_POKE"); - UtAssert_True (MM_AppData.MemType == MM_EEPROM, "MM_AppData.MemType == MM_EEPROM"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == 5, "MM_AppData.DataValue == 5"); - UtAssert_True (MM_AppData.BytesProcessed == 1, "MM_AppData.BytesProcessed == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeEeprom_Test_8bit */ - -void MM_PokeEeprom_Test_8bitError (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.DataSize = MM_BYTE_BIT_WIDTH; - CmdPacket.Data = (uint8)(5); - - DestAddress = 1; - - /* Set to generate error message MM_OS_EEPROMWRITE8_ERR_EID */ - Ut_CFE_PSP_EEPROM_SetReturnCode(UT_CFE_PSP_EEPROM_WRITE8_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PokeEeprom(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_EEPROMWRITE8_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_EepromWrite8 error received: RC = 0xFFFFFFFF, Addr = 0x00000001"), - "CFE_PSP_EepromWrite8 error received: RC = 0xFFFFFFFF, Addr = 0x00000001"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeEeprom_Test_8bitError */ - -void MM_PokeEeprom_Test_16bit (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.DataSize = MM_WORD_BIT_WIDTH; - CmdPacket.Data = (uint16)(5); - - DestAddress = 1; - - /* Execute the function being tested */ - MM_PokeEeprom(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_WORD_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x0005"), - "Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x05"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_POKE, "MM_AppData.LastAction == MM_POKE"); - UtAssert_True (MM_AppData.MemType == MM_EEPROM, "MM_AppData.MemType == MM_EEPROM"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == 5, "MM_AppData.DataValue == 5"); - UtAssert_True (MM_AppData.BytesProcessed == 2, "MM_AppData.BytesProcessed == 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeEeprom_Test_16bit */ - -void MM_PokeEeprom_Test_16bitError (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.DataSize = MM_WORD_BIT_WIDTH; - CmdPacket.Data = (uint16)(5); - - DestAddress = 1; - - /* Set to generate error message MM_OS_EEPROMWRITE16_ERR_EID */ - Ut_CFE_PSP_EEPROM_SetReturnCode(UT_CFE_PSP_EEPROM_WRITE16_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PokeEeprom(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_EEPROMWRITE16_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_EepromWrite16 error received: RC = 0xFFFFFFFF, Addr = 0x00000001"), - "CFE_PSP_EepromWrite16 error received: RC = 0xFFFFFFFF, Addr = 0x00000001"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeEeprom_Test_16bitError */ - -void MM_PokeEeprom_Test_32bit (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.DataSize = MM_DWORD_BIT_WIDTH; - CmdPacket.Data = (uint32)(5); - - DestAddress = 1; - - /* Execute the function being tested */ - MM_PokeEeprom(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_POKE_DWORD_INF_EID, CFE_EVS_INFORMATION, "Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x00000005"), - "Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x05"); - - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.LastAction == MM_POKE, "MM_AppData.LastAction == MM_POKE"); - UtAssert_True (MM_AppData.MemType == MM_EEPROM, "MM_AppData.MemType == MM_EEPROM"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == 5, "MM_AppData.DataValue == 5"); - UtAssert_True (MM_AppData.BytesProcessed == 4, "MM_AppData.BytesProcessed == 4"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeEeprom_Test_32bit */ - -void MM_PokeEeprom_Test_32bitError (void) -{ - MM_PokeCmd_t CmdPacket; - uint32 DestAddress; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PokeCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_POKE_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.DataSize = MM_DWORD_BIT_WIDTH; - CmdPacket.Data = (uint32)(5); - - DestAddress = 1; - - /* Set to generate error message MM_OS_EEPROMWRITE32_ERR_EID */ - Ut_CFE_PSP_EEPROM_SetReturnCode(UT_CFE_PSP_EEPROM_WRITE32_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_PokeEeprom(&CmdPacket, DestAddress); - - /* Verify results */ - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_EEPROMWRITE32_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_EepromWrite32 error received: RC = 0xFFFFFFFF, Addr = 0x00000001"), - "CFE_PSP_EepromWrite32 error received: RC = 0xFFFFFFFF, Addr = 0x00000001"); - - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_PokeEeprom_Test_32bitError */ - -void MM_LoadMemWIDCmd_Test_Nominal (void) -{ - MM_LoadMemWIDCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemWIDCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_WID_CC); - - CmdPacket.DataArray[0] = 1; - CmdPacket.DataArray[1] = 2; - CmdPacket.NumOfBytes = 2; - CmdPacket.Crc = 0; - CmdPacket.DestSymAddress.Offset = 1; - - strncpy (CmdPacket.DestSymAddress.SymName, "", OS_MAX_PATH_LEN); - - /* Set to prevent segmentation fault */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_LoadMemWIDCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LOAD_WID_INF_EID, CFE_EVS_INFORMATION, "Load Memory WID Command: Wrote 2 bytes to address: 0x00000001"), - "Load Memory WID Command: Wrote 2 bytes to address: 0x00000001"); - - UtAssert_True (MM_AppData.LastAction == MM_LOAD_WID, "MM_AppData.LastAction == MM_LOAD_WID"); - UtAssert_True (MM_AppData.Address == 1, "MM_AppData.Address == 1"); - UtAssert_True (MM_AppData.MemType == MM_RAM, "MM_AppData.MemType == MM_RAM"); - UtAssert_True (MM_AppData.BytesProcessed == 2, "MM_AppData.BytesProcessed == 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemWIDCmd_Test_Nominal */ - -void MM_LoadMemWIDCmd_Test_CopyError (void) -{ - MM_LoadMemWIDCmd_t CmdPacket; - char Message[125]; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemWIDCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_WID_CC); - - CmdPacket.NumOfBytes = 2; - CmdPacket.Crc = 0; - CmdPacket.DestSymAddress.Offset = 1; - CmdPacket.DestSymAddress.SymName[0] = '\0'; - - strncpy (CmdPacket.DestSymAddress.SymName, "", OS_MAX_PATH_LEN); - - /* Set to generate error message MM_PSP_COPY_ERR_EID */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_LoadMemWIDCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf(Message, "PSP copy memory error: RC=0xFFFFFFFF, Src=0x%08X, Tgt=0x00000001, Size=0x00000002", (unsigned int)&CmdPacket.DataArray); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, Message), - Message); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemWIDCmd_Test_CopyError */ - -void MM_LoadMemWIDCmd_Test_CRCError (void) -{ - MM_LoadMemWIDCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemWIDCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_WID_CC); - - CmdPacket.DataArray[0] = 1; - CmdPacket.DataArray[1] = 2; - CmdPacket.NumOfBytes = 2; - CmdPacket.Crc = 1; - CmdPacket.DestSymAddress.Offset = 1; - - strncpy (CmdPacket.DestSymAddress.SymName, "", OS_MAX_PATH_LEN); - - /* Set to prevent CFE_PSP_MemCpy from causing any problems */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_LoadMemWIDCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LOAD_WID_CRC_ERR_EID, CFE_EVS_ERROR, "Interrupts Disabled Load CRC failure: Expected = 0x1 Calculated = 0x0"), - "Interrupts Disabled Load CRC failure: Expected = 0x1 Calculated = 0x0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemWIDCmd_Test_CRCError */ - -void MM_LoadMemWIDCmd_Test_SymNameErr (void) -{ - MM_LoadMemWIDCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemWIDCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_WID_CC); - - CmdPacket.DataArray[0] = 1; - CmdPacket.DataArray[1] = 2; - CmdPacket.NumOfBytes = 2; - CmdPacket.Crc = 0; - CmdPacket.DestSymAddress.Offset = 1; - - strncpy (CmdPacket.DestSymAddress.SymName, "name", OS_MAX_PATH_LEN); - - /* Set to prevent CFE_PSP_MemCpy from causing any problems */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Set to generate error message MM_SYMNAME_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_LoadMemWIDCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'name'"), - "Symbolic address can't be resolved: Name = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemWIDCmd_Test_SymNameErr */ - -void MM_VerifyLoadWIDParams_Test_Nominal (void) -{ - uint32 Address = 0; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - MM_VerifyLoadWIDParams(Address, SizeInBytes); - - /* Verify results */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyLoadWIDParams_Test_Nominal */ - -void MM_VerifyLoadWIDParams_Test_MemValidateError (void) -{ - uint32 Address = 0; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_VerifyLoadWIDParams(Address, SizeInBytes); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyLoadWIDParams_Test_MemValidateError */ - -void MM_VerifyLoadWIDParams_Test_DataSizeErrorTooSmall (void) -{ - uint32 Address = 0; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - MM_VerifyLoadWIDParams(Address, SizeInBytes); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyLoadWIDParams_Test_DataSizeErrorTooSmall */ - -void MM_VerifyLoadWIDParams_Test_DataSizeErrorTooLarge (void) -{ - uint32 Address = 0; - uint32 SizeInBytes = MM_MAX_UNINTERRUPTABLE_DATA + 1; - - /* Execute the function being tested */ - MM_VerifyLoadWIDParams(Address, SizeInBytes); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 201"), - "Data size in bytes invalid or exceeds limits: Data Size = 201"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyLoadWIDParams_Test_DataSizeErrorTooLarge */ - -void MM_LoadMemFromFileCmd_Test_RAM (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_RAM; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"), - "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_RAM */ - -void MM_LoadMemFromFileCmd_Test_EEPROM (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_EEPROM; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Set to prevent segmentation fault */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - Ut_CFE_PSP_MEMUTILS_ContinueReturnCodeAfterCountZero(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"), - "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_EEPROM */ - -void MM_LoadMemFromFileCmd_Test_MEM32 (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM32; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"), - "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_MEM32 */ - -void MM_LoadMemFromFileCmd_Test_MEM16 (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM16; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"), - "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_MEM16 */ - -void MM_LoadMemFromFileCmd_Test_MEM8 (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM8; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LD_MEM_FILE_INF_EID, CFE_EVS_INFORMATION, "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"), - "Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_MEM8 */ - -void MM_LoadMemFromFileCmd_Test_LoadParamsError (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = 99; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, "Invalid memory type specified: MemType = 99"), - "Invalid memory type specified: MemType = 99"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_FILE_LOAD_PARAMS_ERR_EID, CFE_EVS_ERROR, "Load file failed parameters check: File = 'name'"), - "Load file failed parameters check: File = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 2, "Ut_CFE_EVS_GetEventQueueDepth() == 2"); - -} /* end MM_LoadMemFromFileCmd_Test_LoadParamsError */ - -void MM_LoadMemFromFileCmd_Test_SymNameError (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM8; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Set to generate error message MM_SYMNAME_ERR_EID */ - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'name'"), - "Symbolic address can't be resolved: Name = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_SymNameError */ - -void MM_LoadMemFromFileCmd_Test_LoadFileCRCError (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM8; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to CFS_ComputeCRCFromFile to fail, in order to generate error message MM_LOAD_FILE_CRC_ERR_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook2); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LOAD_FILE_CRC_ERR_EID, CFE_EVS_ERROR, "Load file CRC failure: Expected = 0x63 Calculated = 0x0 File = 'name'"), - "Load file CRC failure: Expected = 0x63 Calculated = 0x0 File = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_LoadFileCRCError */ - -void MM_LoadMemFromFileCmd_Test_ComputeCRCError (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM8; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes condition "ComputedCRC == MMFileHeader.Crc" to fail, in order to generate error message MM_CFS_COMPUTECRCFROMFILE_ERR_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook3); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_CFS_COMPUTECRCFROMFILE_ERR_EID, CFE_EVS_ERROR, "CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'name'"), - "CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_ComputeCRCError */ - -void MM_LoadMemFromFileCmd_Test_CloseError (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM8; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Set to generate error message MM_OS_CLOSE_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_CLOSE_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_CLOSE_ERR_EID, CFE_EVS_ERROR, "OS_close error received: RC = 0xFFFFFFFF File = 'name'"), - "OS_close error received: RC = 0xFFFFFFFF File = 'name'"); - - /* Generates 1 event message we don't care about in this test */ - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 2, "Ut_CFE_EVS_GetEventQueueDepth() == 2"); - -} /* end MM_LoadMemFromFileCmd_Test_CloseError */ - -void MM_LoadMemFromFileCmd_Test_OpenError (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM8; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "name", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Set to generate error message MM_OS_OPEN_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_OPEN_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_OPEN_ERR_EID, CFE_EVS_ERROR, "OS_open error received: RC = 0xFFFFFFFF File = 'name'"), - "OS_open error received: RC = 0xFFFFFFFF File = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_OpenError */ - -void MM_LoadMemFromFileCmd_Test_InvalidFilename (void) -{ - MM_LoadMemFromFileCmd_t CmdPacket; - - UT_MM_CFE_OSFILEAPI_ReadHook1_MemType = MM_MEM8; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_LoadMemFromFileCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_LOAD_MEM_FROM_FILE_CC); - - strncpy (CmdPacket.FileName, "***name***", OS_MAX_PATH_LEN); - - /* Causes call to MM_VerifyLoadFileSize to return TRUE, in order to satisfy the immediately following condition "Valid == TRUE" */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Set to satisfy condition "Valid == TRUE" immediately following call to MM_ReadFileHeaders */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Causes call to CFS_ResolveSymAddr to return a known value for DestAddress */ - Ut_OSAPI_SetFunctionHook(UT_OSAPI_SYMBOLLOOKUP_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSAPI_SymbolLookupHook1); - - /* Causes call to MM_LoadMemFromFile to return TRUE, in order to generate event message MM_LD_MEM_FILE_INF_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_READ_INDEX, &UT_MM_CFE_OSFILEAPI_ReadHook1); - UT_MM_CFE_OSFILEAPI_ReadHook_RunCount = 0; - - /* Set to generate error message MM_CMD_FNAME_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_OPEN_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_LoadMemFromFileCmd((CFE_SB_MsgPtr_t)&CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 0, "MM_AppData.CmdCounter == 0"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_CMD_FNAME_ERR_EID, CFE_EVS_ERROR, "Command specified filename invalid: Name = '***name***'"), - "Command specified filename invalid: Name = '***name***'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFileCmd_Test_InvalidFilename */ - -void MM_LoadMemFromFile_Test_PreventCPUHogging (void) -{ - boolean Result; - MM_LoadDumpFileHeader_t FileHeader; - FileHeader.MemType = MM_EEPROM; - FileHeader.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - - /* Set to satisfy condition "(ReadLength = OS_read(FileHandle, ioBuffer, SegmentSize)) == SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, MM_MAX_LOAD_DATA_SEG, 1); - Ut_OSFILEAPI_ContinueReturnCodeAfterCountZero(UT_OSFILEAPI_READ_INDEX); - - /* Execute the function being tested */ - Result = MM_LoadMemFromFile(0, "filename", &FileHeader, 0); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_LOAD_FROM_FILE, "MM_AppData.LastAction == MM_LOAD_FROM_FILE"); - UtAssert_True (MM_AppData.MemType == MM_EEPROM, "MM_AppData.MemType == MM_EEPROM"); - UtAssert_True (MM_AppData.Address == 0, "MM_AppData.Address == 0"); - UtAssert_True (MM_AppData.BytesProcessed == 2*MM_MAX_LOAD_DATA_SEG, "MM_AppData.BytesProcessed == 2*MM_MAX_LOAD_DATA_SEG"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "strncmp(MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_LoadMemFromFile_Test_PreventCPUHogging */ - -void MM_LoadMemFromFile_Test_MemCpyError (void) -{ - boolean Result; - MM_LoadDumpFileHeader_t FileHeader; - FileHeader.MemType = MM_EEPROM; - FileHeader.NumOfBytes = 2; - char ErrorMessage[125]; - - /* Set to generate error message MM_PSP_COPY_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, 2, 1); - - /* Set to generate error message MM_PSP_COPY_ERR_EID */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_LoadMemFromFile(0, "filename", &FileHeader, 0); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP copy memory error: RC=0xFFFFFFFF, Src=0x%08X, Tgt=0x00000000, Size=0x00000002", (unsigned int)(&MM_AppData.LoadBuffer[0])); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFile_Test_MemCpyError */ - -void MM_LoadMemFromFile_Test_ReadError (void) -{ - boolean Result; - MM_LoadDumpFileHeader_t FileHeader; - FileHeader.MemType = MM_EEPROM; - FileHeader.NumOfBytes = 2; - - /* Execute the function being tested */ - Result = MM_LoadMemFromFile(0, "filename", &FileHeader, 0); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, "OS_read error received: RC = 0x00000000 Expected = 2 File = 'filename'"), - "OS_read error received: RC = 0x00000000 Expected = 2 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMemFromFile_Test_ReadError */ - -void MM_VerifyFileLoadParams_Test_RAMValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_RAMValidateRangeError */ - -void MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooSmall */ - -void MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = MM_MAX_LOAD_FILE_DATA_RAM + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooLarge */ - -void MM_VerifyFileLoadParams_Test_EEPROMValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_EEPROMValidateRangeError */ - -void MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooSmall */ - -void MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = MM_MAX_LOAD_FILE_DATA_EEPROM +1; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 131073"), - "Data size in bytes invalid or exceeds limits: Data Size = 131073"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooLarge */ - -void MM_VerifyFileLoadParams_Test_MEM32ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - /* NOTE: MemType passed into the function is not the same as "MemType" reported by error message - in error message it's always either CFE_PSP_MEM_RAM or CFE_PSP_MEM_EEPROM */ - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM32ValidateRangeError */ - -void MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooSmall */ - -void MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = MM_MAX_LOAD_FILE_DATA_MEM32 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooLarge */ - -void MM_VerifyFileLoadParams_Test_MEM32AlignmentError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, "Data and address not 32 bit aligned: Addr = 0x00000000 Size = 1"), - "Data and address not 32 bit aligned: Addr = 0x00000000 Size = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM32AlignmentError */ - -void MM_VerifyFileLoadParams_Test_MEM16ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - /* NOTE: MemType passed into the function is not the same as "MemType" reported by error message - in error message it's always either CFE_PSP_MEM_RAM or CFE_PSP_MEM_EEPROM */ - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM16ValidateRangeError */ - -void MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooSmall */ - -void MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = MM_MAX_LOAD_FILE_DATA_MEM16 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooLarge */ - -void MM_VerifyFileLoadParams_Test_MEM16AlignmentError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, "Data and address not 16 bit aligned: Addr = 0x00000000 Size = 1"), - "Data and address not 16 bit aligned: Addr = 0x00000000 Size = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM16AlignmentError */ - -void MM_VerifyFileLoadParams_Test_MEM8ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - /* NOTE: MemType passed into the function is not the same as "MemType" reported by error message - in error message it's always either CFE_PSP_MEM_RAM or CFE_PSP_MEM_EEPROM */ - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM8ValidateRangeError */ - -void MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooSmall */ - -void MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = MM_MAX_LOAD_FILE_DATA_MEM8 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooLarge */ - -void MM_VerifyFileLoadParams_Test_InvalidMemTypeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = 99; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFileLoadParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, "Invalid memory type specified: MemType = 99"), - "Invalid memory type specified: MemType = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFileLoadParams_Test_InvalidMemTypeError */ - -void MM_VerifyLoadFileSize_Test_StatError (void) -{ - boolean Result; - MM_LoadDumpFileHeader_t FileHeader; - - /* Set to generate error message MM_OS_STAT_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_STAT_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyLoadFileSize("filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_STAT_ERR_EID, CFE_EVS_ERROR, "OS_stat error received: RC = 0xFFFFFFFF File = 'filename'"), - "OS_stat error received: RC = 0xFFFFFFFF File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyLoadFileSize_Test_StatError */ - -void MM_VerifyLoadFileSize_Test_SizeError (void) -{ - boolean Result; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 0; - - /* Generates error message MM_LD_FILE_SIZE_ERR_EID */ - Ut_OSFILEAPI_SetFunctionHook(UT_OSFILEAPI_STAT_INDEX, &UT_MM_CMD_UTILS_TEST_CFE_OSFILEAPI_StatHook1); - - /* Execute the function being tested */ - Result = MM_VerifyLoadFileSize("filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LD_FILE_SIZE_ERR_EID, CFE_EVS_ERROR, "Load file size error: Reported by OS = 148 Expected = 144 File = 'filename'"), - "Load file size error: Reported by OS = 148 Expected = 144 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyLoadFileSize_Test_SizeError */ - -void MM_ReadFileHeaders_Test_ReadHeaderError (void) -{ - boolean Result; - int32 FileHandle = 1; - CFE_FS_Header_t CFEHeader; - MM_LoadDumpFileHeader_t MMHeader; - - /* Execute the function being tested */ - Result = MM_ReadFileHeaders("filename", FileHandle, &CFEHeader, &MMHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_CFE_FS_READHDR_ERR_EID, CFE_EVS_ERROR, "CFE_FS_ReadHeader error received: RC = 0x00000000 Expected = 64 File = 'filename'"), - "CFE_FS_ReadHeader error received: RC = 0x00000000 Expected = 64 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_ReadFileHeaders_Test_ReadHeaderError */ - -void MM_ReadFileHeaders_Test_ReadError (void) -{ - boolean Result; - int32 FileHandle = 1; - CFE_FS_Header_t CFEHeader; - MM_LoadDumpFileHeader_t MMHeader; - - /* Set to satisfy condition "OS_Status != sizeof(CFE_FS_Header_t)" */ - Ut_CFE_FS_SetReturnCode(UT_CFE_FS_READHDR_INDEX, sizeof(CFE_FS_Header_t), 1); - - /* Set to generate error message MM_OS_READ_EXP_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_ReadFileHeaders("filename", FileHandle, &CFEHeader, &MMHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_READ_EXP_ERR_EID, CFE_EVS_ERROR, "OS_read error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename'"), - "OS_read error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_ReadFileHeaders_Test_ReadError */ - -void MM_FillMemCmd_Test_RAM (void) -{ - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_RAM; - CmdPacket.NumOfBytes = 1; - - /* Set to prevent unintended error messages resulting from values set by call to CFE_PSP_MemCpy in MM_FillMem */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, CFE_PSP_SUCCESS, 1); - - /* Execute the function being tested */ - MM_FillMemCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_FILL_INF_EID, CFE_EVS_INFORMATION, "Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000"), - "Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMemCmd_Test_RAM */ - -void MM_FillMemCmd_Test_EEPROM (void) -{ - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.NumOfBytes = 1; - - /* Execute the function being tested */ - MM_FillMemCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_FILL_INF_EID, CFE_EVS_INFORMATION, "Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000"), - "Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMemCmd_Test_EEPROM */ - -void MM_FillMemCmd_Test_MEM32 (void) -{ - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_MEM32; - CmdPacket.NumOfBytes = 4; - - /* Execute the function being tested */ - MM_FillMemCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_FILL_INF_EID, CFE_EVS_INFORMATION, "Fill Memory Command: Filled 4 bytes at address: 0x00000000 with pattern: 0x00000000"), - "Fill Memory Command: Filled 4 bytes at address: 0x00000000 with pattern: 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMemCmd_Test_MEM32 */ - -void MM_FillMemCmd_Test_MEM16 (void) -{ - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_MEM16; - CmdPacket.NumOfBytes = 2; - - /* Execute the function being tested */ - MM_FillMemCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_FILL_INF_EID, CFE_EVS_INFORMATION, "Fill Memory Command: Filled 2 bytes at address: 0x00000000 with pattern: 0x00000000"), - "Fill Memory Command: Filled 2 bytes at address: 0x00000000 with pattern: 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMemCmd_Test_MEM16 */ - -void MM_FillMemCmd_Test_MEM8 (void) -{ - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - /* Execute the function being tested */ - MM_FillMemCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.CmdCounter == 1, "MM_AppData.CmdCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_FILL_INF_EID, CFE_EVS_INFORMATION, "Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000"), - "Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMemCmd_Test_MEM8 */ - -void MM_FillMemCmd_Test_SymNameError (void) -{ - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_MEM8; - CmdPacket.NumOfBytes = 1; - - strncpy(CmdPacket.DestSymAddress.SymName, "name", OS_MAX_PATH_LEN); - - Ut_OSAPI_SetReturnCode(UT_OSAPI_SYMBOLLOOKUP_INDEX, -1, 1); - Ut_OSAPI_ContinueReturnCodeAfterCountZero(UT_OSAPI_SYMBOLLOOKUP_INDEX); - - /* Execute the function being tested */ - MM_FillMemCmd((CFE_SB_MsgPtr_t)(&CmdPacket)); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_SYMNAME_ERR_EID, CFE_EVS_ERROR, "Symbolic address can't be resolved: Name = 'name'"), - "Symbolic address can't be resolved: Name = 'name'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMemCmd_Test_SymNameError */ - -void MM_FillMem_Test_Nominal (void) -{ - uint32 DestAddress = 0; - MM_FillMemCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.NumOfBytes = 2; - - /* Execute the function being tested */ - MM_FillMem(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_FILL, "MM_AppData.LastAction == MM_FILL"); - UtAssert_True (MM_AppData.MemType == CmdPacket.MemType, "MM_AppData.MemType == CmdPacket.MemType"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == CmdPacket.FillPattern, "MM_AppData.DataValue == CmdPacket.FillPattern"); - UtAssert_True (MM_AppData.BytesProcessed == 2, "MM_AppData.BytesProcessed == 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillMem_Test_Nominal */ - -void MM_FillMem_Test_MemCpyError (void) -{ - uint32 DestAddress = 0; - MM_FillMemCmd_t CmdPacket; - char ErrorMessage[125]; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_FillMemCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_FILL_MEM_CC); - - CmdPacket.MemType = MM_EEPROM; - CmdPacket.NumOfBytes = 2; - - /* Set to generate error message MM_PSP_COPY_ERR_EID */ - Ut_CFE_PSP_MEMUTILS_SetReturnCode(UT_CFE_PSP_MEMUTILS_MEMCPY_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_FillMem(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP copy memory error: RC=0xFFFFFFFF, Src=0x%08X, Tgt=0x00000000, Size=0x00000002", (unsigned int)(&MM_AppData.FillBuffer[0])); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_COPY_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMem_Test_MemCpyError */ - -void MM_VerifyFillParams_Test_RAMValidateRangeError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_RAMValidateRangeError */ - -void MM_VerifyFillParams_Test_RAMDataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_RAMDataSizeErrorTooSmall */ - -void MM_VerifyFillParams_Test_RAMDataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_RAM; - uint32 SizeInBytes = MM_MAX_FILL_DATA_RAM + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_RAMDataSizeErrorTooLarge */ - -void MM_VerifyFillParams_Test_EEPROMValidateRangeError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 2"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_EEPROMValidateRangeError */ - -void MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooSmall */ - -void MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_EEPROM; - uint32 SizeInBytes = MM_MAX_FILL_DATA_EEPROM + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 131073"), - "Data size in bytes invalid or exceeds limits: Data Size = 131073"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooLarge */ - -void MM_VerifyFillParams_Test_MEM32ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 4; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 4 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 4 MemType = 1"); - - /* NOTE: MemType passed into the function is not the same as "MemType" reported by error message - in error message it's always either CFE_PSP_MEM_RAM or CFE_PSP_MEM_EEPROM */ - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM32ValidateRangeError */ - -void MM_VerifyFillParams_Test_MEM32DataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM32DataSizeErrorTooSmall */ - -void MM_VerifyFillParams_Test_MEM32DataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = MM_MAX_FILL_DATA_MEM32 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM32DataSizeErrorTooLarge */ - -void MM_VerifyFillParams_Test_MEM32AlignmentError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM32; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, "Data and address not 32 bit aligned: Addr = 0x00000001 Size = 1"), - "Data and address not 32 bit aligned: Addr = 0x00000001 Size = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM32AlignmentError */ - -void MM_VerifyFillParams_Test_MEM16ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 2; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 2 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 2 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM16ValidateRangeError */ - -void MM_VerifyFillParams_Test_MEM16DataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM16DataSizeErrorTooSmall */ - -void MM_VerifyFillParams_Test_MEM16DataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = MM_MAX_FILL_DATA_MEM16 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM16DataSizeErrorTooLarge */ - -void MM_VerifyFillParams_Test_MEM16AlignmentError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM16; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, "Data and address not 16 bit aligned: Addr = 0x00000001 Size = 1"), - "Data and address not 16 bit aligned: Addr = 0x00000001 Size = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM16AlignmentError */ - -void MM_VerifyFillParams_Test_MEM8ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 1; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM16ValidateRangeError */ - -void MM_VerifyFillParams_Test_MEM8DataSizeErrorTooSmall (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = 0; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 0"), - "Data size in bytes invalid or exceeds limits: Data Size = 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM8DataSizeErrorTooSmall */ - -void MM_VerifyFillParams_Test_MEM8DataSizeErrorTooLarge (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM8; - uint32 SizeInBytes = MM_MAX_FILL_DATA_MEM8 + 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BYTES_ERR_EID, CFE_EVS_ERROR, "Data size in bytes invalid or exceeds limits: Data Size = 1048577"), - "Data size in bytes invalid or exceeds limits: Data Size = 1048577"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM8DataSizeErrorTooLarge */ - -void MM_VerifyFillParams_Test_InvalidMemTypeError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = 99; - uint32 SizeInBytes = 1; - - /* Execute the function being tested */ - Result = MM_VerifyFillParams(Address, MemType, SizeInBytes); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, "Invalid memory type specified: MemType = 99"), - "Invalid memory type specified: MemType = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyFillParams_Test_MEM8InvalidMemTypeError */ - -/* Note: Can not test the case of MM_LoadMemFromFileCmd where it gets a bad MemType, because the previous call to MM_VerifyFileLoadParams would return FALSE, causing the relevant block of code to be skipped */ -/* Note: No need for MM_LoadMemFromFile_Test_Nominal, MM_VerifyFileLoadParams_Test_Nominal, MM_VerifyLoadFileSize_Test_Nominal, MM_ReadFileHeaders_Test_Nominal, MM_VerifyFillParams_Test_Nominal - already covered */ - -void MM_Load_Test_AddTestCases(void) -{ - UtTest_Add(MM_PokeCmd_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_PokeCmd_Test_EEPROM"); - UtTest_Add(MM_PokeCmd_Test_NonEEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_PokeCmd_Test_NonEEPROM"); - UtTest_Add(MM_PokeCmd_Test_SymNameError, MM_Test_Setup, MM_Test_TearDown, "MM_PokeCmd_Test_SymNameError"); - UtTest_Add(MM_PokeMem_Test_8bit, MM_Test_Setup, MM_Test_TearDown, "MM_PokeMem_Test_8bit"); - UtTest_Add(MM_PokeMem_Test_8bitError, MM_Test_Setup, MM_Test_TearDown, "MM_PokeMem_Test_8bitError"); - UtTest_Add(MM_PokeMem_Test_16bit, MM_Test_Setup, MM_Test_TearDown, "MM_PokeMem_Test_16bit"); - UtTest_Add(MM_PokeMem_Test_16bitError, MM_Test_Setup, MM_Test_TearDown, "MM_PokeMem_Test_16bitError"); - UtTest_Add(MM_PokeMem_Test_32bit, MM_Test_Setup, MM_Test_TearDown, "MM_PokeMem_Test_32bit"); - UtTest_Add(MM_PokeMem_Test_32bitError, MM_Test_Setup, MM_Test_TearDown, "MM_PokeMem_Test_32bitError"); - UtTest_Add(MM_PokeEeprom_Test_8bit, MM_Test_Setup, MM_Test_TearDown, "MM_PokeEeprom_Test_8bit"); - UtTest_Add(MM_PokeEeprom_Test_8bitError, MM_Test_Setup, MM_Test_TearDown, "MM_PokeEeprom_Test_8bitError"); - UtTest_Add(MM_PokeEeprom_Test_16bit, MM_Test_Setup, MM_Test_TearDown, "MM_PokeEeprom_Test_16bit"); - UtTest_Add(MM_PokeEeprom_Test_16bitError, MM_Test_Setup, MM_Test_TearDown, "MM_PokeEeprom_Test_16bitError"); - UtTest_Add(MM_PokeEeprom_Test_32bit, MM_Test_Setup, MM_Test_TearDown, "MM_PokeEeprom_Test_32bit"); - UtTest_Add(MM_PokeEeprom_Test_32bitError, MM_Test_Setup, MM_Test_TearDown, "MM_PokeEeprom_Test_32bitError"); - UtTest_Add(MM_LoadMemWIDCmd_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemWIDCmd_Test_Nominal"); - UtTest_Add(MM_LoadMemWIDCmd_Test_CopyError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemWIDCmd_Test_CopyError"); - UtTest_Add(MM_LoadMemWIDCmd_Test_CRCError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemWIDCmd_Test_CRCError"); - UtTest_Add(MM_LoadMemWIDCmd_Test_SymNameErr, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemWIDCmd_Test_SymNameErr"); - UtTest_Add(MM_VerifyLoadWIDParams_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyLoadWIDParams_Test_Nominal"); - UtTest_Add(MM_VerifyLoadWIDParams_Test_MemValidateError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyLoadWIDParams_Test_MemValidateError"); - UtTest_Add(MM_VerifyLoadWIDParams_Test_DataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyLoadWIDParams_Test_DataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyLoadWIDParams_Test_DataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyLoadWIDParams_Test_DataSizeErrorTooLarge"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_RAM, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_RAM"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_EEPROM"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_MEM32, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_MEM32"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_MEM16, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_MEM16"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_MEM8, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_MEM8"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_LoadParamsError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_LoadParamsError"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_SymNameError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_SymNameError"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_LoadFileCRCError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_LoadFileCRCError"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_ComputeCRCError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_ComputeCRCError"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_CloseError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_CloseError"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_OpenError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_OpenError"); - UtTest_Add(MM_LoadMemFromFileCmd_Test_InvalidFilename, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFileCmd_Test_InvalidFilename"); - UtTest_Add(MM_LoadMemFromFile_Test_PreventCPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFile_Test_PreventCPUHogging"); - UtTest_Add(MM_LoadMemFromFile_Test_MemCpyError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFile_Test_MemCpyError"); - UtTest_Add(MM_LoadMemFromFile_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMemFromFile_Test_ReadError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_RAMValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_RAMValidateRangeError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFileLoadParams_Test_EEPROMValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_EEPROMValidateRangeError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM32ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM32ValidateRangeError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM32AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM32AlignmentError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM16ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM16ValidateRangeError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM16AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM16AlignmentError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM8ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM8ValidateRangeError"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFileLoadParams_Test_InvalidMemTypeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFileLoadParams_Test_InvalidMemTypeError"); - UtTest_Add(MM_VerifyLoadFileSize_Test_StatError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyLoadFileSize_Test_StatError"); - UtTest_Add(MM_VerifyLoadFileSize_Test_SizeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyLoadFileSize_Test_SizeError"); - UtTest_Add(MM_ReadFileHeaders_Test_ReadHeaderError, MM_Test_Setup, MM_Test_TearDown, "MM_ReadFileHeaders_Test_ReadHeaderError"); - UtTest_Add(MM_ReadFileHeaders_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_ReadFileHeaders_Test_ReadError"); - UtTest_Add(MM_FillMemCmd_Test_RAM, MM_Test_Setup, MM_Test_TearDown, "MM_FillMemCmd_Test_RAM"); - UtTest_Add(MM_FillMemCmd_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_FillMemCmd_Test_EEPROM"); - UtTest_Add(MM_FillMemCmd_Test_MEM32, MM_Test_Setup, MM_Test_TearDown, "MM_FillMemCmd_Test_MEM32"); - UtTest_Add(MM_FillMemCmd_Test_MEM16, MM_Test_Setup, MM_Test_TearDown, "MM_FillMemCmd_Test_MEM16"); - UtTest_Add(MM_FillMemCmd_Test_MEM8, MM_Test_Setup, MM_Test_TearDown, "MM_FillMemCmd_Test_MEM8"); - UtTest_Add(MM_FillMemCmd_Test_SymNameError, MM_Test_Setup, MM_Test_TearDown, "MM_FillMemCmd_Test_SymNameError"); - UtTest_Add(MM_FillMem_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem_Test_Nominal"); - UtTest_Add(MM_FillMem_Test_MemCpyError, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem_Test_MemCpyError"); - UtTest_Add(MM_VerifyFillParams_Test_RAMValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_RAMValidateRangeError"); - UtTest_Add(MM_VerifyFillParams_Test_RAMDataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_RAMDataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFillParams_Test_RAMDataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_RAMDataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFillParams_Test_EEPROMValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_EEPROMValidateRangeError"); - UtTest_Add(MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFillParams_Test_MEM32ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM32ValidateRangeError"); - UtTest_Add(MM_VerifyFillParams_Test_MEM32DataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM32DataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFillParams_Test_MEM32DataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM32DataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFillParams_Test_MEM32AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM32AlignmentError"); - UtTest_Add(MM_VerifyFillParams_Test_MEM16ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM16ValidateRangeError"); - UtTest_Add(MM_VerifyFillParams_Test_MEM16DataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM16DataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFillParams_Test_MEM16DataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM16DataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFillParams_Test_MEM16AlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM16AlignmentError"); - UtTest_Add(MM_VerifyFillParams_Test_MEM8ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM8ValidateRangeError"); - UtTest_Add(MM_VerifyFillParams_Test_MEM8DataSizeErrorTooSmall, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM8DataSizeErrorTooSmall"); - UtTest_Add(MM_VerifyFillParams_Test_MEM8DataSizeErrorTooLarge, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_MEM8DataSizeErrorTooLarge"); - UtTest_Add(MM_VerifyFillParams_Test_InvalidMemTypeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyFillParams_Test_InvalidMemTypeError"); -} /* end MM_Load_Test_AddTestCases */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_load_test.h b/fsw/unit_test/mm_load_test.h deleted file mode 100644 index cb24fa6..0000000 --- a/fsw/unit_test/mm_load_test.h +++ /dev/null @@ -1,34 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_load_test.h 1.3 2016/03/03 21:24:59EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes for the unit test cases for mm_load_test.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_load_test.h $ - ** Revision 1.3 2016/03/03 21:24:59EST czogby - ** Add Integrity headers to all unit testl .h files - *************************************************************************/ - -/* - * Includes - */ - -#include "utassert.h" -#include "uttest.h" - -/* - * Function Prototypes - */ - -void MM_Load_Test_AddTestCases(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_mem16.c.gcov b/fsw/unit_test/mm_mem16.c.gcov deleted file mode 100644 index c676b9d..0000000 --- a/fsw/unit_test/mm_mem16.c.gcov +++ /dev/null @@ -1,338 +0,0 @@ - -: 0:Source:../src/mm_mem16.c - -: 0:Programs:7 - -: 1:/************************************************************************* - -: 2:** File: - -: 3:** $Id: mm_mem16.c.gcov 1.3 2016/10/31 22:10:57EDT mdeschu Exp $ - -: 4:** - -: 5:** Copyright © 2007-2014 United States Government as represented by the - -: 6:** Administrator of the National Aeronautics and Space Administration. - -: 7:** All Other Rights Reserved. - -: 8:** - -: 9:** This software was created at NASA's Goddard Space Flight Center. - -: 10:** This software is governed by the NASA Open Source Agreement and may be - -: 11:** used, distributed and modified only pursuant to the terms of that - -: 12:** agreement. - -: 13:** - -: 14:** Purpose: - -: 15:** Provides CFS Memory Manager functions that are used - -: 16:** for the conditionally compiled MM_MEM16 optional memory type. - -: 17:** - -: 18:** $Log: mm_mem16.c.gcov $ - -: 18:** Revision 1.3 2016/10/31 22:10:57EDT mdeschu - -: 18:** Update gcov results, README and log file for MM unit tests for 2.4.1 - -: 19:** Revision 1.2 2016/10/30 00:48:51EDT mdeschu - -: 20:** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent - -: 21:** Revision 1.1 2015/07/28 12:21:49EDT rperera - -: 22:** Initial revision - -: 23:** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj - -: 24:** Revision 1.15 2015/04/14 15:29:04EDT lwalling - -: 25:** Removed unnecessary backslash characters from string format definitions - -: 26:** Revision 1.14 2015/04/06 15:41:25EDT lwalling - -: 27:** Verify results of calls to PSP memory read/write/copy/set functions - -: 28:** Revision 1.13 2015/04/02 09:10:56EDT lwalling - -: 29:** Added Valid = TRUE for MM_LoadMem8/16/32FromFile() - -: 30:** Revision 1.12 2015/04/01 11:41:15EDT lwalling - -: 31:** Add ptr type to ioBuffer name, fix code indentation, change if (=) to if (==) - -: 32:** Revision 1.11 2015/03/30 17:34:01EDT lwalling - -: 33:** Create common process to maintain and report last action statistics - -: 34:** Revision 1.10 2015/03/20 14:16:12EDT lwalling - -: 35:** Add last peek/poke/fill command data value to housekeeping telemetry - -: 36:** Revision 1.9 2015/03/02 14:27:09EST sstrege - -: 37:** Added copyright information - -: 38:** Revision 1.8 2011/12/05 15:17:21EST jmdagost - -: 39:** Added check for zero bytes read from file load (with event message on error) - -: 40:** Revision 1.7 2011/06/23 12:02:39EDT jmdagost - -: 41:** Corrected type for local BytesRead, initialized local variables. - -: 42:** Revision 1.6 2010/11/29 13:35:23EST jmdagost - -: 43:** Replaced ifdef tests with if-true tests. - -: 44:** Revision 1.5 2009/06/12 14:37:27EDT rmcgraw - -: 45:** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem - -: 46:** Revision 1.4 2008/09/05 14:23:52EDT dahardison - -: 47:** Updated references to local HK variables - -: 48:** Revision 1.3 2008/05/19 15:23:20EDT dahardison - -: 49:** Version after completion of unit testing - -: 50:** - -: 51:*************************************************************************/ - -: 52: - -: 53:/************************************************************************* - -: 54:** Includes - -: 55:*************************************************************************/ - -: 56:#include "mm_mem16.h" - -: 57:#include "mm_app.h" - -: 58:#include "mm_events.h" - -: 59:#include "mm_utils.h" - -: 60:#include - -: 61: - -: 62:/* - -: 63:** The code in this file is optional. - -: 64:** See mm_platform_cfg.h to set this compiler switch. - -: 65:*/ - -: 66:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 67: - -: 68:/************************************************************************* - -: 69:** External Data - -: 70:*************************************************************************/ - -: 71:extern MM_AppData_t MM_AppData; - -: 72: - -: 73: - -: 74:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 75:/* */ - -: 76:/* Load memory from a file using only 16 bit wide writes */ - -: 77:/* */ - -: 78:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 5: 79:boolean MM_LoadMem16FromFile(uint32 FileHandle, - -: 80: char *FileName, - -: 81: MM_LoadDumpFileHeader_t *FileHeader, - -: 82: uint32 DestAddress) - -: 83:{ - 5: 84: uint32 i = 0; - 5: 85: int32 ReadLength = 0; - 5: 86: int32 PSP_Status = CFE_PSP_SUCCESS; - 5: 87: int32 BytesProcessed = 0; - 5: 88: int32 BytesRemaining = FileHeader->NumOfBytes; - 5: 89: uint16 *DataPointer16 = (uint16 *) DestAddress; - 5: 90: uint16 *ioBuffer16 = (uint16 *) &MM_AppData.LoadBuffer[0]; - 5: 91: uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - 5: 92: boolean Valid = FALSE; - -: 93: - 16: 94: while (BytesRemaining != 0) - -: 95: { - 6: 96: if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - -: 97: { - 4: 98: SegmentSize = BytesRemaining; - -: 99: } - -: 100: - -: 101: /* Read file data into i/o buffer */ - 6: 102: if ((ReadLength = OS_read(FileHandle, ioBuffer16, SegmentSize)) != SegmentSize) - -: 103: { - 1: 104: MM_AppData.ErrCounter++; - 1: 105: BytesRemaining = 0; - 1: 106: CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - -: 107: "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - -: 108: (unsigned int)ReadLength, (int)SegmentSize, FileName); - -: 109: } - -: 110: else - -: 111: { - -: 112: /* Load memory from i/o buffer using 16 bit wide writes */ - 416: 113: for (i = 0; i < (SegmentSize / sizeof(uint16)); i++) - -: 114: { - 204: 115: PSP_Status = CFE_PSP_MemWrite16((uint32) DataPointer16, ioBuffer16[i]); - 204: 116: if (PSP_Status == CFE_PSP_SUCCESS) - -: 117: { - 203: 118: DataPointer16++; - -: 119: } - -: 120: else - -: 121: { - -: 122: /* CFE_PSP_MemWrite16 error */ - 1: 123: BytesRemaining = 0; - 1: 124: MM_AppData.ErrCounter++; - 1: 125: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 126: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - -: 127: (unsigned int)PSP_Status, (unsigned int)DataPointer16); - -: 128: /* Stop load segment loop */ - 1: 129: break; - -: 130: } - -: 131: } - -: 132: - 5: 133: if (PSP_Status == CFE_PSP_SUCCESS) - -: 134: { - 4: 135: BytesProcessed += SegmentSize; - 4: 136: BytesRemaining -= SegmentSize; - -: 137: - -: 138: /* Prevent CPU hogging between load segments */ - 4: 139: if (BytesRemaining != 0) - -: 140: { - 1: 141: MM_SegmentBreak(); - -: 142: } - -: 143: } - -: 144: } - -: 145: } - -: 146: - -: 147: /* Update last action statistics */ - 5: 148: if (BytesProcessed == FileHeader->NumOfBytes) - -: 149: { - 3: 150: Valid = TRUE; - 3: 151: MM_AppData.LastAction = MM_LOAD_FROM_FILE; - 3: 152: MM_AppData.MemType = MM_MEM16; - 3: 153: MM_AppData.Address = DestAddress; - 3: 154: MM_AppData.BytesProcessed = BytesProcessed; - 3: 155: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - -: 156: } - -: 157: - 5: 158: return(Valid); - -: 159: - -: 160:} /* end MM_LoadMem16FromFile */ - -: 161: - -: 162: - -: 163:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 164:/* */ - -: 165:/* Dump the requested number of bytes from memory to a file using */ - -: 166:/* only 16 bit wide reads */ - -: 167:/* */ - -: 168:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 5: 169:boolean MM_DumpMem16ToFile(uint32 FileHandle, - -: 170: char *FileName, - -: 171: MM_LoadDumpFileHeader_t *FileHeader) - -: 172:{ - 5: 173: boolean Valid = TRUE; - 5: 174: int32 OS_Status = OS_ERROR; - 5: 175: int32 PSP_Status = CFE_PSP_SUCCESS; - 5: 176: uint32 i = 0; - 5: 177: uint32 BytesProcessed = 0; - 5: 178: uint32 BytesRemaining = FileHeader->NumOfBytes; - 5: 179: uint16 *DataPointer16 = (uint16 *) FileHeader->SymAddress.Offset; - 5: 180: uint16 *ioBuffer16 = (uint16 *) &MM_AppData.DumpBuffer[0]; - 5: 181: uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - -: 182: - 16: 183: while (BytesRemaining != 0) - -: 184: { - 6: 185: if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - -: 186: { - 4: 187: SegmentSize = BytesRemaining; - -: 188: } - -: 189: - -: 190: /* Load RAM data into i/o buffer */ - 824: 191: for (i = 0; i < SegmentSize; i++) - -: 192: { - 407: 193: if ((PSP_Status = CFE_PSP_MemRead16((uint32) DataPointer16, &ioBuffer16[i])) == CFE_PSP_SUCCESS) - -: 194: { - 406: 195: DataPointer16++; - -: 196: } - -: 197: else - -: 198: { - -: 199: /* CFE_PSP_MemRead16 error */ - 1: 200: Valid = FALSE; - 1: 201: BytesRemaining = 0; - 1: 202: MM_AppData.ErrCounter++; - 1: 203: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 204: "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM16", - 1: 205: (unsigned int)PSP_Status, (unsigned int)DataPointer16, (unsigned int)&ioBuffer16[i]); - -: 206: /* Stop load i/o buffer loop */ - 1: 207: break; - -: 208: } - -: 209: } - -: 210: - -: 211: /* Check for error loading i/o buffer */ - 6: 212: if (PSP_Status == CFE_PSP_SUCCESS) - -: 213: { - -: 214: /* Write i/o buffer contents to file */ - 5: 215: if ((OS_Status = OS_write(FileHandle, ioBuffer16, SegmentSize)) == SegmentSize) - -: 216: { - -: 217: /* Update process counters */ - 4: 218: BytesRemaining -= SegmentSize; - 4: 219: BytesProcessed += SegmentSize; - -: 220: - -: 221: /* Prevent CPU hogging between dump segments */ - 4: 222: if (BytesRemaining != 0) - -: 223: { - 1: 224: MM_SegmentBreak(); - -: 225: } - -: 226: } - -: 227: else - -: 228: { - -: 229: /* OS_write error */ - 1: 230: Valid = FALSE; - 1: 231: BytesRemaining = 0; - 1: 232: MM_AppData.ErrCounter++; - 1: 233: CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - -: 234: "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - -: 235: (unsigned int)OS_Status, (int)SegmentSize, FileName); - -: 236: } - -: 237: } - -: 238: } - -: 239: - 5: 240: if (Valid) - -: 241: { - -: 242: /* Update last action statistics */ - 3: 243: MM_AppData.LastAction = MM_DUMP_TO_FILE; - 3: 244: MM_AppData.MemType = MM_MEM16; - 3: 245: MM_AppData.Address = FileHeader->SymAddress.Offset; - 3: 246: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - 3: 247: MM_AppData.BytesProcessed = BytesProcessed; - -: 248: } - -: 249: - 5: 250: return(Valid); - -: 251: - -: 252:} /* end MM_DumpMem16ToFile */ - -: 253: - -: 254: - -: 255:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 256:/* */ - -: 257:/* Fill memory with the command specified fill pattern using only */ - -: 258:/* 16 bit wide writes */ - -: 259:/* */ - -: 260:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 4: 261:void MM_FillMem16(uint32 DestAddress, - -: 262: MM_FillMemCmd_t *CmdPtr) - -: 263:{ - 4: 264: uint32 i = 0; - 4: 265: int32 PSP_Status = CFE_PSP_SUCCESS; - 4: 266: uint32 BytesProcessed = 0; - 4: 267: uint32 BytesRemaining = CmdPtr->NumOfBytes; - 4: 268: uint16 FillPattern16 = (uint16) CmdPtr->FillPattern; - 4: 269: uint16 *DataPointer16 = (uint16 *) DestAddress; - 4: 270: uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; - -: 271: - 13: 272: while (BytesRemaining != 0) - -: 273: { - -: 274: /* Set size of next segment */ - 5: 275: if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - -: 276: { - 3: 277: SegmentSize = BytesRemaining; - -: 278: } - -: 279: - -: 280: /* Fill next segment */ - 414: 281: for (i = 0; i < (SegmentSize / sizeof(uint16)); i++) - -: 282: { - 203: 283: PSP_Status = CFE_PSP_MemWrite16((uint32) DataPointer16, FillPattern16); - 203: 284: if (PSP_Status == CFE_PSP_SUCCESS) - -: 285: { - 202: 286: DataPointer16++; - -: 287: } - -: 288: else - -: 289: { - -: 290: /* CFE_PSP_MemWrite16 error */ - 1: 291: BytesRemaining = 0; - 1: 292: MM_AppData.ErrCounter++; - 1: 293: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 294: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM16", - -: 295: (unsigned int)PSP_Status, (unsigned int)DataPointer16); - -: 296: /* Stop fill segment loop */ - 1: 297: break; - -: 298: } - -: 299: } - -: 300: - 5: 301: if (PSP_Status == CFE_PSP_SUCCESS) - -: 302: { - -: 303: /* Update process counters */ - 4: 304: BytesRemaining -= SegmentSize; - 4: 305: BytesProcessed += SegmentSize; - -: 306: - -: 307: /* Prevent CPU hogging between fill segments */ - 4: 308: if (BytesRemaining != 0) - -: 309: { - 1: 310: MM_SegmentBreak(); - -: 311: } - -: 312: } - -: 313: } - -: 314: - -: 315: /* Update last action statistics */ - 4: 316: if (BytesProcessed == CmdPtr->NumOfBytes) - -: 317: { - 3: 318: MM_AppData.LastAction = MM_FILL; - 3: 319: MM_AppData.MemType = MM_MEM16; - 3: 320: MM_AppData.Address = DestAddress; - 3: 321: MM_AppData.DataValue = (uint32) FillPattern16; - 3: 322: MM_AppData.BytesProcessed = BytesProcessed; - -: 323: } - -: 324: - 4: 325: return; - -: 326: - -: 327:}/* End MM_FillMem16 */ - -: 328: - -: 329: - -: 330:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 331: - -: 332:/************************/ - -: 333:/* End of File Comment */ - -: 334:/************************/ diff --git a/fsw/unit_test/mm_mem16_test.c b/fsw/unit_test/mm_mem16_test.c deleted file mode 100644 index 1109c18..0000000 --- a/fsw/unit_test/mm_mem16_test.c +++ /dev/null @@ -1,362 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_mem16_test.c 1.4.1.1 2016/11/17 16:35:29EST sstrege Exp $ - ** - ** Purpose: - ** This file contains unit test cases for the functions contained in the file mm_mem16.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_mem16_test.c $ - ** Revision 1.4.1.1 2016/11/17 16:35:29EST sstrege - ** - ** Revision 1.5 2016/11/17 12:51:15EST mdeschu - ** Remove references to temporary header file mm_test_exports.h - ** Revision 1.4 2016/10/24 18:35:23EDT czogby - ** Code Walkthough Updates - ** Revision 1.3 2016/05/04 18:59:33EDT czogby - ** Update MM to Compile With New UT-Assert PSP Files - ** Revision 1.2 2016/03/04 20:00:57EST czogby - ** Need Temporary Header File to Import Some MM Functions Into Unit Tests - ** Revision 1.1 2016/02/03 17:11:37EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_mem16_test.h" -#include "mm_mem16.h" -#include "mm_msg.h" -#include "mm_msgdefs.h" -#include "mm_msgids.h" -#include "mm_events.h" -#include "mm_filedefs.h" -#include "mm_version.h" -#include "mm_test_utils.h" -#include "ut_osapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_es_hooks.h" -#include "ut_cfe_evs_stubs.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_psp_ram_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include -#include -#include - -/* - * Function Definitions - */ - -void MM_LoadMem16FromFile_Test_Nominal (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, FileHeader.NumOfBytes, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem16FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_LOAD_FROM_FILE, "MM_AppData.LastAction == MM_LOAD_FROM_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM16, "MM_AppData.MemType == MM_MEM16"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_LoadMem16FromFile_Test_Nominal */ - -void MM_LoadMem16FromFile_Test_CPUHogging (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - - /* Set to always fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, MM_MAX_LOAD_DATA_SEG, 1); - Ut_OSFILEAPI_ContinueReturnCodeAfterCountZero(UT_OSFILEAPI_READ_INDEX); - - /* Execute the function being tested */ - Result = MM_LoadMem16FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_LOAD_FROM_FILE, "MM_AppData.LastAction == MM_LOAD_FROM_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM16, "MM_AppData.MemType == MM_MEM16"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_LoadMem16FromFile_Test_CPUHogging */ - -void MM_LoadMem16FromFile_Test_ReadError (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to generate error message MM_OS_READ_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem16FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, "OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"), - "OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMem16FromFile_Test_ReadError */ - -void MM_LoadMem16FromFile_Test_WriteError (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, FileHeader.NumOfBytes, 1); - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE16_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem16FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMem16FromFile_Test_WriteError */ - -void MM_DumpMem16ToFile_Test_Nominal (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - FileHeader.SymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_DumpMem16ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM16, "MM_AppData.MemType == MM_MEM16"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMem16ToFile_Test_Nominal */ - -void MM_DumpMem16ToFile_Test_CPUHogging (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - FileHeader.SymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_DumpMem16ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM16, "MM_AppData.MemType == MM_MEM16"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMem16ToFile_Test_CPUHogging */ - -void MM_DumpMem16ToFile_Test_ReadError (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - char ErrorMessage[125]; - - FileHeader.NumOfBytes = 2; - - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD16_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMem16ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP read memory error: RC=0xFFFFFFFF, Src=0x%08X, Tgt=0x%08X, Type=MEM16", (unsigned int)FileHeader.SymAddress.Offset, (unsigned int)&MM_AppData.DumpBuffer[0]); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMem16ToFile_Test_ReadError */ - -void MM_DumpMem16ToFile_Test_WriteError (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to generate error message MM_OS_WRITE_EXP_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMem16ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, "OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"), - "OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMem16ToFile_Test_WriteError */ - -void MM_FillMem16_Test_Nominal (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2; - CmdPacket.FillPattern = 3; - - /* Execute the function being tested */ - MM_FillMem16(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_FILL, "MM_AppData.LastAction == MM_FILL"); - UtAssert_True (MM_AppData.MemType == MM_MEM16, "MM_AppData.MemType == MM_MEM16"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == CmdPacket.FillPattern, "MM_AppData.DataValue == CmdPacket.FillPattern"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillMem16_Test_Nominal */ - -void MM_FillMem16_Test_CPUHogging (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - CmdPacket.FillPattern = 3; - - /* Execute the function being tested */ - MM_FillMem16(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_FILL, "MM_AppData.LastAction == MM_FILL"); - UtAssert_True (MM_AppData.MemType == MM_MEM16, "MM_AppData.MemType == MM_MEM16"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == CmdPacket.FillPattern, "MM_AppData.DataValue == CmdPacket.FillPattern"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillMem16_Test_CPUHogging */ - -void MM_FillMem16_Test_WriteError (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2; - CmdPacket.FillPattern = 3; - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE16_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_FillMem16(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMem16_Test_WriteError */ - -void MM_Mem16_Test_AddTestCases(void) -{ - UtTest_Add(MM_LoadMem16FromFile_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem16FromFile_Test_Nominal"); - UtTest_Add(MM_LoadMem16FromFile_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem16FromFile_Test_CPUHogging"); - UtTest_Add(MM_LoadMem16FromFile_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem16FromFile_Test_ReadError"); - UtTest_Add(MM_LoadMem16FromFile_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem16FromFile_Test_WriteError"); - UtTest_Add(MM_DumpMem16ToFile_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem16ToFile_Test_Nominal"); - UtTest_Add(MM_DumpMem16ToFile_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem16ToFile_Test_CPUHogging"); - UtTest_Add(MM_DumpMem16ToFile_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem16ToFile_Test_ReadError"); - UtTest_Add(MM_DumpMem16ToFile_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem16ToFile_Test_WriteError"); - UtTest_Add(MM_FillMem16_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem16_Test_Nominal"); - UtTest_Add(MM_FillMem16_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem16_Test_CPUHogging"); - UtTest_Add(MM_FillMem16_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem16_Test_WriteError"); -} /* end MM_Mem16_Test_AddTestCases */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_mem16_test.h b/fsw/unit_test/mm_mem16_test.h deleted file mode 100644 index 65c0b67..0000000 --- a/fsw/unit_test/mm_mem16_test.h +++ /dev/null @@ -1,34 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_mem16_test.h 1.3 2016/03/03 21:24:59EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes for the unit test cases for mm_mem16_test.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_mem16_test.h $ - ** Revision 1.3 2016/03/03 21:24:59EST czogby - ** Add Integrity headers to all unit testl .h files - *************************************************************************/ - -/* - * Includes - */ - -#include "utassert.h" -#include "uttest.h" - -/* - * Function Prototypes - */ - -void MM_Mem16_Test_AddTestCases(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_mem32.c.gcov b/fsw/unit_test/mm_mem32.c.gcov deleted file mode 100644 index a32454f..0000000 --- a/fsw/unit_test/mm_mem32.c.gcov +++ /dev/null @@ -1,341 +0,0 @@ - -: 0:Source:../src/mm_mem32.c - -: 0:Programs:7 - -: 1:/************************************************************************* - -: 2:** File: - -: 3:** $Id: mm_mem32.c.gcov 1.3 2016/10/31 22:11:03EDT mdeschu Exp $ - -: 4:** - -: 5:** Copyright © 2007-2014 United States Government as represented by the - -: 6:** Administrator of the National Aeronautics and Space Administration. - -: 7:** All Other Rights Reserved. - -: 8:** - -: 9:** This software was created at NASA's Goddard Space Flight Center. - -: 10:** This software is governed by the NASA Open Source Agreement and may be - -: 11:** used, distributed and modified only pursuant to the terms of that - -: 12:** agreement. - -: 13:** - -: 14:** Purpose: - -: 15:** Provides CFS Memory Manager functions that are used - -: 16:** for the conditionally compiled MM_MEM32 optional memory type. - -: 17:** - -: 18:** $Log: mm_mem32.c.gcov $ - -: 18:** Revision 1.3 2016/10/31 22:11:03EDT mdeschu - -: 18:** Update gcov results, README and log file for MM unit tests for 2.4.1 - -: 19:** Revision 1.2 2016/10/30 00:48:50EDT mdeschu - -: 20:** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent - -: 21:** Revision 1.1 2015/07/28 12:21:53EDT rperera - -: 22:** Initial revision - -: 23:** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj - -: 24:** Revision 1.16 2015/04/14 15:29:02EDT lwalling - -: 25:** Removed unnecessary backslash characters from string format definitions - -: 26:** Revision 1.15 2015/04/06 15:41:24EDT lwalling - -: 27:** Verify results of calls to PSP memory read/write/copy/set functions - -: 28:** Revision 1.14 2015/04/02 09:10:56EDT lwalling - -: 29:** Added Valid = TRUE for MM_LoadMem8/16/32FromFile() - -: 30:** Revision 1.13 2015/04/01 13:52:29EDT lwalling - -: 31:** change if (=) to if (==) - -: 32:** Revision 1.12 2015/04/01 11:41:15EDT lwalling - -: 33:** Add ptr type to ioBuffer name, fix code indentation, change if (=) to if (==) - -: 34:** Revision 1.11 2015/03/30 17:33:59EDT lwalling - -: 35:** Create common process to maintain and report last action statistics - -: 36:** Revision 1.10 2015/03/20 14:16:52EDT lwalling - -: 37:** Add last peek/poke/fill command data value to housekeeping telemetry - -: 38:** Revision 1.9 2015/03/02 14:26:34EST sstrege - -: 39:** Added copyright information - -: 40:** Revision 1.8 2011/12/05 15:17:21EST jmdagost - -: 41:** Added check for zero bytes read from file load (with event message on error) - -: 42:** Revision 1.7 2011/06/23 12:02:38EDT jmdagost - -: 43:** Corrected type for local BytesRead, initialized local variables. - -: 44:** Revision 1.6 2010/11/29 13:35:22EST jmdagost - -: 45:** Replaced ifdef tests with if-true tests. - -: 46:** Revision 1.5 2009/06/12 14:37:31EDT rmcgraw - -: 47:** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem - -: 48:** Revision 1.4 2008/09/05 14:24:17EDT dahardison - -: 49:** Updated references to local HK variables - -: 50:** Revision 1.3 2008/05/19 15:23:24EDT dahardison - -: 51:** Version after completion of unit testing - -: 52:** - -: 53:*************************************************************************/ - -: 54: - -: 55:/************************************************************************* - -: 56:** Includes - -: 57:*************************************************************************/ - -: 58:#include "mm_mem32.h" - -: 59:#include "mm_app.h" - -: 60:#include "mm_events.h" - -: 61:#include "mm_utils.h" - -: 62:#include - -: 63: - -: 64:/* - -: 65:** The code in this file is optional. - -: 66:** See mm_platform_cfg.h to set this compiler switch. - -: 67:*/ - -: 68:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 69: - -: 70:/************************************************************************* - -: 71:** External Data - -: 72:*************************************************************************/ - -: 73:extern MM_AppData_t MM_AppData; - -: 74: - -: 75: - -: 76:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 77:/* */ - -: 78:/* Load memory from a file using only 32 bit wide writes */ - -: 79:/* */ - -: 80:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 5: 81:boolean MM_LoadMem32FromFile(uint32 FileHandle, - -: 82: char *FileName, - -: 83: MM_LoadDumpFileHeader_t *FileHeader, - -: 84: uint32 DestAddress) - -: 85:{ - 5: 86: uint32 i = 0; - 5: 87: int32 ReadLength = 0; - 5: 88: int32 PSP_Status = CFE_PSP_SUCCESS; - 5: 89: int32 BytesProcessed = 0; - 5: 90: int32 BytesRemaining = FileHeader->NumOfBytes; - 5: 91: uint32 *DataPointer32 = (uint32 *) DestAddress; - 5: 92: uint32 *ioBuffer32 = (uint32 *) &MM_AppData.LoadBuffer[0]; - 5: 93: uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - 5: 94: boolean Valid = FALSE; - -: 95: - 16: 96: while (BytesRemaining != 0) - -: 97: { - 6: 98: if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - -: 99: { - 4: 100: SegmentSize = BytesRemaining; - -: 101: } - -: 102: - -: 103: /* Read file data into i/o buffer */ - 6: 104: if ((ReadLength = OS_read(FileHandle, ioBuffer32, SegmentSize)) != SegmentSize) - -: 105: { - 1: 106: MM_AppData.ErrCounter++; - 1: 107: BytesRemaining = 0; - 1: 108: CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - -: 109: "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - -: 110: (unsigned int)ReadLength, (int)SegmentSize, FileName); - -: 111: } - -: 112: else - -: 113: { - -: 114: /* Load memory from i/o buffer using 32 bit wide writes */ - 214: 115: for (i = 0; i < (SegmentSize / sizeof(uint32)); i++) - -: 116: { - 103: 117: PSP_Status = CFE_PSP_MemWrite32((uint32) DataPointer32, ioBuffer32[i]); - 103: 118: if (PSP_Status == CFE_PSP_SUCCESS) - -: 119: { - 102: 120: DataPointer32++; - -: 121: } - -: 122: else - -: 123: { - -: 124: /* CFE_PSP_MemWrite32 error */ - 1: 125: BytesRemaining = 0; - 1: 126: MM_AppData.ErrCounter++; - 1: 127: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 128: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - -: 129: (unsigned int)PSP_Status, (unsigned int)DataPointer32); - -: 130: /* Stop load segment loop */ - 1: 131: break; - -: 132: } - -: 133: } - -: 134: - 5: 135: if (PSP_Status == CFE_PSP_SUCCESS) - -: 136: { - 4: 137: BytesProcessed += SegmentSize; - 4: 138: BytesRemaining -= SegmentSize; - -: 139: - -: 140: /* Prevent CPU hogging between load segments */ - 4: 141: if (BytesRemaining != 0) - -: 142: { - 1: 143: MM_SegmentBreak(); - -: 144: } - -: 145: } - -: 146: } - -: 147: } - -: 148: - -: 149: /* Update last action statistics */ - 5: 150: if (BytesProcessed == FileHeader->NumOfBytes) - -: 151: { - 3: 152: Valid = TRUE; - 3: 153: MM_AppData.LastAction = MM_LOAD_FROM_FILE; - 3: 154: MM_AppData.MemType = MM_MEM32; - 3: 155: MM_AppData.Address = DestAddress; - 3: 156: MM_AppData.BytesProcessed = BytesProcessed; - 3: 157: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - -: 158: } - -: 159: - 5: 160: return(Valid); - -: 161: - -: 162:} /* end MM_LoadMem32FromFile */ - -: 163: - -: 164: - -: 165:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 166:/* */ - -: 167:/* Dump the requested number of bytes from memory to a file using */ - -: 168:/* only 32 bit wide reads */ - -: 169:/* */ - -: 170:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 5: 171:boolean MM_DumpMem32ToFile(uint32 FileHandle, - -: 172: char *FileName, - -: 173: MM_LoadDumpFileHeader_t *FileHeader) - -: 174:{ - 5: 175: boolean Valid = TRUE; - 5: 176: int32 OS_Status = OS_ERROR; - 5: 177: int32 PSP_Status = CFE_PSP_SUCCESS; - 5: 178: uint32 i = 0; - 5: 179: uint32 BytesProcessed = 0; - 5: 180: uint32 BytesRemaining = FileHeader->NumOfBytes; - 5: 181: uint32 *DataPointer32 = (uint32 *) FileHeader->SymAddress.Offset; - 5: 182: uint32 *ioBuffer32 = (uint32 *) &MM_AppData.DumpBuffer[0]; - 5: 183: uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - -: 184: - 16: 185: while (BytesRemaining != 0) - -: 186: { - 6: 187: if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - -: 188: { - 4: 189: SegmentSize = BytesRemaining; - -: 190: } - -: 191: - -: 192: /* Load RAM data into i/o buffer */ - 828: 193: for (i = 0; i < SegmentSize; i++) - -: 194: { - 409: 195: PSP_Status = CFE_PSP_MemRead32((uint32) DataPointer32, &ioBuffer32[i]); - 409: 196: if (PSP_Status == CFE_PSP_SUCCESS) - -: 197: { - 408: 198: DataPointer32++; - -: 199: } - -: 200: else - -: 201: { - -: 202: /* CFE_PSP_MemRead32 error */ - 1: 203: Valid = FALSE; - 1: 204: BytesRemaining = 0; - 1: 205: MM_AppData.ErrCounter++; - 1: 206: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 207: "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM32", - 1: 208: (unsigned int)PSP_Status, (unsigned int)DataPointer32, (unsigned int)&ioBuffer32[i]); - -: 209: /* Stop load i/o buffer loop */ - 1: 210: break; - -: 211: } - -: 212: } - -: 213: - -: 214: /* Check for error loading i/o buffer */ - 6: 215: if (PSP_Status == CFE_PSP_SUCCESS) - -: 216: { - -: 217: /* Write i/o buffer contents to file */ - 5: 218: if ((OS_Status = OS_write(FileHandle, ioBuffer32, SegmentSize)) == SegmentSize) - -: 219: { - -: 220: /* Update process counters */ - 4: 221: BytesRemaining -= SegmentSize; - 4: 222: BytesProcessed += SegmentSize; - -: 223: - -: 224: /* Prevent CPU hogging between dump segments */ - 4: 225: if (BytesRemaining != 0) - -: 226: { - 1: 227: MM_SegmentBreak(); - -: 228: } - -: 229: } - -: 230: else - -: 231: { - -: 232: /* OS_write error */ - 1: 233: Valid = FALSE; - 1: 234: BytesRemaining = 0; - 1: 235: MM_AppData.ErrCounter++; - 1: 236: CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - -: 237: "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - -: 238: (unsigned int)OS_Status, (int)SegmentSize, FileName); - -: 239: } - -: 240: } - -: 241: } - -: 242: - 5: 243: if (Valid) - -: 244: { - -: 245: /* Update last action statistics */ - 3: 246: MM_AppData.LastAction = MM_DUMP_TO_FILE; - 3: 247: MM_AppData.MemType = MM_MEM32; - 3: 248: MM_AppData.Address = FileHeader->SymAddress.Offset; - 3: 249: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - 3: 250: MM_AppData.BytesProcessed = BytesProcessed; - -: 251: } - -: 252: - 5: 253: return(Valid); - -: 254: - -: 255:} /* end MM_DumpMem32ToFile */ - -: 256: - -: 257: - -: 258:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 259:/* */ - -: 260:/* Fill memory with the command specified fill pattern using only */ - -: 261:/* 32 bit wide writes */ - -: 262:/* */ - -: 263:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 4: 264:void MM_FillMem32(uint32 DestAddress, - -: 265: MM_FillMemCmd_t *CmdPtr) - -: 266:{ - 4: 267: uint32 i = 0; - 4: 268: int32 PSP_Status = CFE_PSP_SUCCESS; - 4: 269: uint32 BytesProcessed = 0; - 4: 270: uint32 BytesRemaining = CmdPtr->NumOfBytes; - 4: 271: uint32 FillPattern32 = CmdPtr->FillPattern; - 4: 272: uint32 *DataPointer32 = (uint32 *) DestAddress; - 4: 273: uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; - -: 274: - 13: 275: while (BytesRemaining != 0) - -: 276: { - -: 277: /* Set size of next segment */ - 5: 278: if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - -: 279: { - 3: 280: SegmentSize = BytesRemaining; - -: 281: } - -: 282: - -: 283: /* Fill next segment */ - 212: 284: for (i = 0; i < (SegmentSize / sizeof(uint32)); i++) - -: 285: { - 102: 286: PSP_Status = CFE_PSP_MemWrite32((uint32) DataPointer32, FillPattern32); - 102: 287: if (PSP_Status == CFE_PSP_SUCCESS) - -: 288: { - 101: 289: DataPointer32++; - -: 290: } - -: 291: else - -: 292: { - -: 293: /* CFE_PSP_MemWrite32 error */ - 1: 294: BytesRemaining = 0; - 1: 295: MM_AppData.ErrCounter++; - 1: 296: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 297: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM32", - -: 298: (unsigned int)PSP_Status, (unsigned int)DataPointer32); - -: 299: /* Stop fill segment loop */ - 1: 300: break; - -: 301: } - -: 302: } - -: 303: - 5: 304: if (PSP_Status == CFE_PSP_SUCCESS) - -: 305: { - -: 306: /* Update process counters */ - 4: 307: BytesRemaining -= SegmentSize; - 4: 308: BytesProcessed += SegmentSize; - -: 309: - -: 310: /* Prevent CPU hogging between fill segments */ - 4: 311: if (BytesRemaining != 0) - -: 312: { - 1: 313: MM_SegmentBreak(); - -: 314: } - -: 315: } - -: 316: } - -: 317: - -: 318: /* Update last action statistics */ - 4: 319: if (BytesProcessed == CmdPtr->NumOfBytes) - -: 320: { - 3: 321: MM_AppData.LastAction = MM_FILL; - 3: 322: MM_AppData.MemType = MM_MEM32; - 3: 323: MM_AppData.Address = DestAddress; - 3: 324: MM_AppData.DataValue = FillPattern32; - 3: 325: MM_AppData.BytesProcessed = BytesProcessed; - -: 326: } - -: 327: - 4: 328: return; - -: 329: - -: 330:}/* End MM_FillMem32 */ - -: 331: - -: 332: - -: 333:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 334: - -: 335:/************************/ - -: 336:/* End of File Comment */ - -: 337:/************************/ diff --git a/fsw/unit_test/mm_mem32_test.c b/fsw/unit_test/mm_mem32_test.c deleted file mode 100644 index 1d49d3f..0000000 --- a/fsw/unit_test/mm_mem32_test.c +++ /dev/null @@ -1,362 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_mem32_test.c 1.4.1.1 2016/11/17 16:35:29EST sstrege Exp $ - ** - ** Purpose: - ** This file contains unit test cases for the functions contained in the file mm_mem32.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_mem32_test.c $ - ** Revision 1.4.1.1 2016/11/17 16:35:29EST sstrege - ** - ** Revision 1.5 2016/11/17 12:51:15EST mdeschu - ** Remove references to temporary header file mm_test_exports.h - ** Revision 1.4 2016/10/24 18:35:23EDT czogby - ** Code Walkthough Updates - ** Revision 1.3 2016/05/04 18:59:33EDT czogby - ** Update MM to Compile With New UT-Assert PSP Files - ** Revision 1.2 2016/03/04 20:00:57EST czogby - ** Need Temporary Header File to Import Some MM Functions Into Unit Tests - ** Revision 1.1 2016/02/03 17:11:37EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_mem32_test.h" -#include "mm_mem32.h" -#include "mm_msg.h" -#include "mm_msgdefs.h" -#include "mm_msgids.h" -#include "mm_events.h" -#include "mm_filedefs.h" -#include "mm_version.h" -#include "mm_test_utils.h" -#include "ut_osapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_es_hooks.h" -#include "ut_cfe_evs_stubs.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_psp_ram_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include -#include -#include - -/* - * Function Definitions - */ - -void MM_LoadMem32FromFile_Test_Nominal (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 4; - - /* Set to fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, FileHeader.NumOfBytes, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem32FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_LOAD_FROM_FILE, "MM_AppData.LastAction == MM_LOAD_FROM_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM32, "MM_AppData.MemType == MM_MEM32"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_LoadMem32FromFile_Test_Nominal */ - -void MM_LoadMem32FromFile_Test_CPUHogging (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - - /* Set to always fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, MM_MAX_LOAD_DATA_SEG, 1); - Ut_OSFILEAPI_ContinueReturnCodeAfterCountZero(UT_OSFILEAPI_READ_INDEX); - - /* Execute the function being tested */ - Result = MM_LoadMem32FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_LOAD_FROM_FILE, "MM_AppData.LastAction == MM_LOAD_FROM_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM32, "MM_AppData.MemType == MM_MEM32"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_LoadMem32FromFile_Test_CPUHogging */ - -void MM_LoadMem32FromFile_Test_ReadError (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 4; - - /* Set to generate error message MM_OS_READ_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem32FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, "OS_read error received: RC = 0xFFFFFFFF Expected = 4 File = 'filename'"), - "OS_read error received: RC = 0xFFFFFFFF Expected = 4 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMem32FromFile_Test_ReadError */ - -void MM_LoadMem32FromFile_Test_WriteError (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 4; - - /* Set to fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, FileHeader.NumOfBytes, 1); - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE32_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem32FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMem32FromFile_Test_WriteError */ - -void MM_DumpMem32ToFile_Test_Nominal (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - FileHeader.SymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_DumpMem32ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM32, "MM_AppData.MemType == MM_MEM32"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMem32ToFile_Test_Nominal */ - -void MM_DumpMem32ToFile_Test_CPUHogging (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - FileHeader.SymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_DumpMem32ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM32, "MM_AppData.MemType == MM_MEM32"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMem32ToFile_Test_CPUHogging */ - -void MM_DumpMem32ToFile_Test_ReadError (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - char ErrorMessage[125]; - - FileHeader.NumOfBytes = 2; - - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD32_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMem32ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP read memory error: RC=0xFFFFFFFF, Src=0x%08X, Tgt=0x%08X, Type=MEM32", (unsigned int)FileHeader.SymAddress.Offset, (unsigned int)&MM_AppData.DumpBuffer[0]); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMem32ToFile_Test_ReadError */ - -void MM_DumpMem32ToFile_Test_WriteError (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to generate error message MM_OS_WRITE_EXP_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMem32ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, "OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"), - "OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMem32ToFile_Test_WriteError */ - -void MM_FillMem32_Test_Nominal (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2; - CmdPacket.FillPattern = 3; - - /* Execute the function being tested */ - MM_FillMem32(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_FILL, "MM_AppData.LastAction == MM_FILL"); - UtAssert_True (MM_AppData.MemType == MM_MEM32, "MM_AppData.MemType == MM_MEM32"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == CmdPacket.FillPattern, "MM_AppData.DataValue == CmdPacket.FillPattern"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillMem32_Test_Nominal */ - -void MM_FillMem32_Test_CPUHogging (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - CmdPacket.FillPattern = 3; - - /* Execute the function being tested */ - MM_FillMem32(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_FILL, "MM_AppData.LastAction == MM_FILL"); - UtAssert_True (MM_AppData.MemType == MM_MEM32, "MM_AppData.MemType == MM_MEM32"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == CmdPacket.FillPattern, "MM_AppData.DataValue == CmdPacket.FillPattern"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillMem32_Test_CPUHogging */ - -void MM_FillMem32_Test_WriteError (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 4; - CmdPacket.FillPattern = 3; - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE32_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_FillMem32(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMem32_Test_WriteError */ - -void MM_Mem32_Test_AddTestCases(void) -{ - UtTest_Add(MM_LoadMem32FromFile_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem32FromFile_Test_Nominal"); - UtTest_Add(MM_LoadMem32FromFile_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem32FromFile_Test_CPUHogging"); - UtTest_Add(MM_LoadMem32FromFile_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem32FromFile_Test_ReadError"); - UtTest_Add(MM_LoadMem32FromFile_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem32FromFile_Test_WriteError"); - UtTest_Add(MM_DumpMem32ToFile_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem32ToFile_Test_Nominal"); - UtTest_Add(MM_DumpMem32ToFile_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem32ToFile_Test_CPUHogging"); - UtTest_Add(MM_DumpMem32ToFile_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem32ToFile_Test_ReadError"); - UtTest_Add(MM_DumpMem32ToFile_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem32ToFile_Test_WriteError"); - UtTest_Add(MM_FillMem32_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem32_Test_Nominal"); - UtTest_Add(MM_FillMem32_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem32_Test_CPUHogging"); - UtTest_Add(MM_FillMem32_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem32_Test_WriteError"); -} /* end MM_Mem32_Test_AddTestCases */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_mem32_test.h b/fsw/unit_test/mm_mem32_test.h deleted file mode 100644 index 0e10a9f..0000000 --- a/fsw/unit_test/mm_mem32_test.h +++ /dev/null @@ -1,34 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_mem32_test.h 1.3 2016/03/03 21:24:59EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes for the unit test cases for mm_mem32_test.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_mem32_test.h $ - ** Revision 1.3 2016/03/03 21:24:59EST czogby - ** Add Integrity headers to all unit testl .h files - *************************************************************************/ - -/* - * Includes - */ - -#include "utassert.h" -#include "uttest.h" - -/* - * Function Prototypes - */ - -void MM_Mem32_Test_AddTestCases(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_mem8.c.gcov b/fsw/unit_test/mm_mem8.c.gcov deleted file mode 100644 index 308612e..0000000 --- a/fsw/unit_test/mm_mem8.c.gcov +++ /dev/null @@ -1,337 +0,0 @@ - -: 0:Source:../src/mm_mem8.c - -: 0:Programs:7 - -: 1:/************************************************************************* - -: 2:** File: - -: 3:** $Id: mm_mem8.c.gcov 1.3 2016/10/31 22:10:57EDT mdeschu Exp $ - -: 4:** - -: 5:** Copyright © 2007-2014 United States Government as represented by the - -: 6:** Administrator of the National Aeronautics and Space Administration. - -: 7:** All Other Rights Reserved. - -: 8:** - -: 9:** This software was created at NASA's Goddard Space Flight Center. - -: 10:** This software is governed by the NASA Open Source Agreement and may be - -: 11:** used, distributed and modified only pursuant to the terms of that - -: 12:** agreement. - -: 13:** - -: 14:** Purpose: - -: 15:** Provides CFS Memory Manager functions that are used - -: 16:** for the conditionally compiled MM_MEM8 optional memory type. - -: 17:** - -: 18:** $Log: mm_mem8.c.gcov $ - -: 18:** Revision 1.3 2016/10/31 22:10:57EDT mdeschu - -: 18:** Update gcov results, README and log file for MM unit tests for 2.4.1 - -: 19:** Revision 1.2 2016/10/30 00:48:50EDT mdeschu - -: 20:** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent - -: 21:** Revision 1.1 2015/07/28 12:21:57EDT rperera - -: 22:** Initial revision - -: 23:** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj - -: 24:** Revision 1.15 2015/04/14 15:29:01EDT lwalling - -: 25:** Removed unnecessary backslash characters from string format definitions - -: 26:** Revision 1.14 2015/04/06 15:41:23EDT lwalling - -: 27:** Verify results of calls to PSP memory read/write/copy/set functions - -: 28:** Revision 1.13 2015/04/02 09:10:45EDT lwalling - -: 29:** Added Valid = TRUE for MM_LoadMem8/16/32FromFile() - -: 30:** Revision 1.12 2015/04/01 11:41:14EDT lwalling - -: 31:** Add ptr type to ioBuffer name, fix code indentation, change if (=) to if (==) - -: 32:** Revision 1.11 2015/03/30 17:33:59EDT lwalling - -: 33:** Create common process to maintain and report last action statistics - -: 34:** Revision 1.10 2015/03/20 14:16:24EDT lwalling - -: 35:** Add last peek/poke/fill command data value to housekeeping telemetry - -: 36:** Revision 1.9 2015/03/02 14:26:29EST sstrege - -: 37:** Added copyright information - -: 38:** Revision 1.8 2011/12/05 15:17:20EST jmdagost - -: 39:** Added check for zero bytes read from file load (with event message on error) - -: 40:** Revision 1.7 2011/06/23 12:02:37EDT jmdagost - -: 41:** Corrected type for local BytesRead, initialized local variables. - -: 42:** Revision 1.6 2010/11/29 13:35:21EST jmdagost - -: 43:** Replaced ifdef tests with if-true tests. - -: 44:** Revision 1.5 2009/06/12 14:37:28EDT rmcgraw - -: 45:** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem - -: 46:** Revision 1.4 2008/09/05 14:24:02EDT dahardison - -: 47:** Updated references to local HK variables - -: 48:** Revision 1.3 2008/05/19 15:23:28EDT dahardison - -: 49:** Version after completion of unit testing - -: 50:** - -: 51:*************************************************************************/ - -: 52: - -: 53:/************************************************************************* - -: 54:** Includes - -: 55:*************************************************************************/ - -: 56:#include "mm_mem8.h" - -: 57:#include "mm_app.h" - -: 58:#include "mm_events.h" - -: 59:#include "mm_utils.h" - -: 60:#include - -: 61: - -: 62:/* - -: 63:** The code in this file is optional. - -: 64:** See mm_platform_cfg.h to set this compiler switch. - -: 65:*/ - -: 66:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 67: - -: 68:/************************************************************************* - -: 69:** External Data - -: 70:*************************************************************************/ - -: 71:extern MM_AppData_t MM_AppData; - -: 72: - -: 73:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 74:/* */ - -: 75:/* Load memory from a file using only 8 bit wide writes */ - -: 76:/* */ - -: 77:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 6: 78:boolean MM_LoadMem8FromFile(uint32 FileHandle, - -: 79: char *FileName, - -: 80: MM_LoadDumpFileHeader_t *FileHeader, - -: 81: uint32 DestAddress) - -: 82:{ - 6: 83: uint32 i = 0; - 6: 84: int32 ReadLength = 0; - 6: 85: int32 PSP_Status = CFE_PSP_SUCCESS; - 6: 86: int32 BytesProcessed = 0; - 6: 87: int32 BytesRemaining = FileHeader->NumOfBytes; - 6: 88: uint8 *DataPointer8 = (uint8 *) DestAddress; - 6: 89: uint8 *ioBuffer8 = (uint8 *) &MM_AppData.LoadBuffer[0]; - 6: 90: uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG; - 6: 91: boolean Valid = FALSE; - -: 92: - 19: 93: while (BytesRemaining != 0) - -: 94: { - 7: 95: if (BytesRemaining < MM_MAX_LOAD_DATA_SEG) - -: 96: { - 5: 97: SegmentSize = BytesRemaining; - -: 98: } - -: 99: - -: 100: /* Read file data into i/o buffer */ - 7: 101: if ((ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize) - -: 102: { - 1: 103: MM_AppData.ErrCounter++; - 1: 104: BytesRemaining = 0; - 1: 105: CFE_EVS_SendEvent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, - -: 106: "OS_read error received: RC = 0x%08X Expected = %d File = '%s'", - -: 107: (unsigned int)ReadLength, (int)SegmentSize, FileName); - -: 108: } - -: 109: else - -: 110: { - -: 111: /* Load memory from i/o buffer using 8 bit wide writes */ - 832: 112: for (i = 0; i < SegmentSize; i++) - -: 113: { - 411: 114: PSP_Status = CFE_PSP_MemWrite8((uint32) DataPointer8, ioBuffer8[i]); - 411: 115: if (PSP_Status == CFE_PSP_SUCCESS) - -: 116: { - 410: 117: DataPointer8++; - -: 118: } - -: 119: else - -: 120: { - -: 121: /* CFE_PSP_MemWrite8 error */ - 1: 122: BytesRemaining = 0; - 1: 123: MM_AppData.ErrCounter++; - 1: 124: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 125: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - -: 126: (unsigned int)PSP_Status, (unsigned int) DataPointer8); - -: 127: /* Stop load segment loop */ - 1: 128: break; - -: 129: } - -: 130: } - -: 131: - 6: 132: if (PSP_Status == CFE_PSP_SUCCESS) - -: 133: { - 5: 134: BytesProcessed += SegmentSize; - 5: 135: BytesRemaining -= SegmentSize; - -: 136: - -: 137: /* Prevent CPU hogging between load segments */ - 5: 138: if (BytesRemaining != 0) - -: 139: { - 1: 140: MM_SegmentBreak(); - -: 141: } - -: 142: } - -: 143: } - -: 144: } - -: 145: - -: 146: /* Update last action statistics */ - 6: 147: if (BytesProcessed == FileHeader->NumOfBytes) - -: 148: { - 4: 149: Valid = TRUE; - 4: 150: MM_AppData.LastAction = MM_LOAD_FROM_FILE; - 4: 151: MM_AppData.MemType = MM_MEM8; - 4: 152: MM_AppData.Address = DestAddress; - 4: 153: MM_AppData.BytesProcessed = BytesProcessed; - 4: 154: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - -: 155: } - -: 156: - 6: 157: return(Valid); - -: 158: - -: 159:} /* end MM_LoadMem8FromFile */ - -: 160: - -: 161: - -: 162:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 163:/* */ - -: 164:/* Dump the requested number of bytes from memory to a file using */ - -: 165:/* only 8 bit wide reads */ - -: 166:/* */ - -: 167:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 7: 168:boolean MM_DumpMem8ToFile(uint32 FileHandle, - -: 169: char *FileName, - -: 170: MM_LoadDumpFileHeader_t *FileHeader) - -: 171:{ - 7: 172: boolean Valid = TRUE; - 7: 173: int32 OS_Status = OS_ERROR; - 7: 174: int32 PSP_Status = CFE_PSP_SUCCESS; - 7: 175: uint32 i = 0; - 7: 176: uint32 BytesProcessed = 0; - 7: 177: uint32 BytesRemaining = FileHeader->NumOfBytes; - 7: 178: uint8 *DataPointer8 = (uint8 *) FileHeader->SymAddress.Offset; - 7: 179: uint8 *ioBuffer8 = (uint8 *) &MM_AppData.DumpBuffer[0]; - 7: 180: uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG; - -: 181: - 22: 182: while (BytesRemaining != 0) - -: 183: { - 8: 184: if (BytesRemaining < MM_MAX_DUMP_DATA_SEG) - -: 185: { - 6: 186: SegmentSize = BytesRemaining; - -: 187: } - -: 188: - -: 189: /* Load RAM data into i/o buffer */ - 830: 190: for (i = 0; i < SegmentSize; i++) - -: 191: { - 408: 192: if ((PSP_Status = CFE_PSP_MemRead8((uint32) DataPointer8, &ioBuffer8[i])) == CFE_PSP_SUCCESS) - -: 193: { - 407: 194: DataPointer8++; - -: 195: } - -: 196: else - -: 197: { - -: 198: /* CFE_PSP_MemRead8 error */ - 1: 199: Valid = FALSE; - 1: 200: BytesRemaining = 0; - 1: 201: MM_AppData.ErrCounter++; - 1: 202: CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, - -: 203: "PSP read memory error: RC=0x%08X, Src=0x%08X, Tgt=0x%08X, Type=MEM8", - 1: 204: (unsigned int)PSP_Status, (unsigned int) DataPointer8, (unsigned int) &ioBuffer8[i]); - -: 205: /* Stop load i/o buffer loop */ - 1: 206: break; - -: 207: } - -: 208: } - -: 209: - -: 210: /* Check for error loading i/o buffer */ - 8: 211: if (PSP_Status == CFE_PSP_SUCCESS) - -: 212: { - -: 213: /* Write i/o buffer contents to file */ - 7: 214: if ((OS_Status = OS_write(FileHandle, ioBuffer8, SegmentSize)) == SegmentSize) - -: 215: { - -: 216: /* Update process counters */ - 6: 217: BytesRemaining -= SegmentSize; - 6: 218: BytesProcessed += SegmentSize; - -: 219: - -: 220: /* Prevent CPU hogging between dump segments */ - 6: 221: if (BytesRemaining != 0) - -: 222: { - 1: 223: MM_SegmentBreak(); - -: 224: } - -: 225: } - -: 226: else - -: 227: { - -: 228: /* OS_write error */ - 1: 229: Valid = FALSE; - 1: 230: BytesRemaining = 0; - 1: 231: MM_AppData.ErrCounter++; - 1: 232: CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, - -: 233: "OS_write error received: RC = 0x%08X Expected = %d File = '%s'", - -: 234: (unsigned int)OS_Status, (int)SegmentSize, FileName); - -: 235: } - -: 236: } - -: 237: } - -: 238: - 7: 239: if (Valid) - -: 240: { - -: 241: /* Update last action statistics */ - 5: 242: MM_AppData.LastAction = MM_DUMP_TO_FILE; - 5: 243: MM_AppData.MemType = MM_MEM8; - 5: 244: MM_AppData.Address = FileHeader->SymAddress.Offset; - 5: 245: strncpy(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN); - 5: 246: MM_AppData.BytesProcessed = BytesProcessed; - -: 247: } - -: 248: - 7: 249: return(Valid); - -: 250: - -: 251:} /* end MM_DumpMem8ToFile */ - -: 252: - -: 253: - -: 254:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 255:/* */ - -: 256:/* Fill memory with the command specified fill pattern using only */ - -: 257:/* 8 bit wide writes */ - -: 258:/* */ - -: 259:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 4: 260:void MM_FillMem8(uint32 DestAddress, - -: 261: MM_FillMemCmd_t *CmdPtr) - -: 262:{ - 4: 263: uint32 i = 0; - 4: 264: int32 PSP_Status = CFE_PSP_SUCCESS; - 4: 265: uint32 BytesProcessed = 0; - 4: 266: uint32 BytesRemaining = CmdPtr->NumOfBytes; - 4: 267: uint8 FillPattern8 = (uint8) CmdPtr->FillPattern; - 4: 268: uint8 *DataPointer8 = (uint8 *) DestAddress; - 4: 269: uint32 SegmentSize = MM_MAX_FILL_DATA_SEG; - -: 270: - 13: 271: while (BytesRemaining != 0) - -: 272: { - -: 273: /* Set size of next segment */ - 5: 274: if (BytesRemaining < MM_MAX_FILL_DATA_SEG) - -: 275: { - 3: 276: SegmentSize = BytesRemaining; - -: 277: } - -: 278: - -: 279: /* Fill next segment */ - 816: 280: for (i = 0; i < SegmentSize; i++) - -: 281: { - 404: 282: PSP_Status = CFE_PSP_MemWrite8((uint32) DataPointer8, FillPattern8); - 404: 283: if (PSP_Status == CFE_PSP_SUCCESS) - -: 284: { - 403: 285: DataPointer8++; - -: 286: } - -: 287: else - -: 288: { - -: 289: /* CFE_PSP_MemWrite8 error */ - 1: 290: BytesRemaining = 0; - 1: 291: MM_AppData.ErrCounter++; - 1: 292: CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, - -: 293: "PSP write memory error: RC=0x%08X, Address=0x%08X, MemType=MEM8", - -: 294: (unsigned int)PSP_Status, (unsigned int)DataPointer8); - -: 295: /* Stop fill segment loop */ - 1: 296: break; - -: 297: } - -: 298: } - -: 299: - 5: 300: if (PSP_Status == CFE_PSP_SUCCESS) - -: 301: { - -: 302: /* Update process counters */ - 4: 303: BytesRemaining -= SegmentSize; - 4: 304: BytesProcessed += SegmentSize; - -: 305: - -: 306: /* Prevent CPU hogging between fill segments */ - 4: 307: if (BytesRemaining != 0) - -: 308: { - 1: 309: MM_SegmentBreak(); - -: 310: } - -: 311: } - -: 312: } - -: 313: - -: 314: /* Update last action statistics */ - 4: 315: if (BytesProcessed == CmdPtr->NumOfBytes) - -: 316: { - 3: 317: MM_AppData.LastAction = MM_FILL; - 3: 318: MM_AppData.MemType = MM_MEM8; - 3: 319: MM_AppData.Address = DestAddress; - 3: 320: MM_AppData.DataValue = (uint32) FillPattern8; - 3: 321: MM_AppData.BytesProcessed = BytesProcessed; - -: 322: } - -: 323: - 4: 324: return; - -: 325: - -: 326:}/* End MM_FillMem8 */ - -: 327: - -: 328: - -: 329:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 330: - -: 331:/************************/ - -: 332:/* End of File Comment */ - -: 333:/************************/ diff --git a/fsw/unit_test/mm_mem8_test.c b/fsw/unit_test/mm_mem8_test.c deleted file mode 100644 index bf9e3b9..0000000 --- a/fsw/unit_test/mm_mem8_test.c +++ /dev/null @@ -1,363 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_mem8_test.c 1.4.1.1 2016/11/17 16:35:29EST sstrege Exp $ - ** - ** Purpose: - ** This file contains unit test cases for the functions contained in the file mm_mem8.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_mem8_test.c $ - ** Revision 1.4.1.1 2016/11/17 16:35:29EST sstrege - ** - ** Revision 1.5 2016/11/17 12:51:14EST mdeschu - ** Remove references to temporary header file mm_test_exports.h - ** Revision 1.4 2016/10/24 18:35:24EDT czogby - ** Code Walkthough Updates - ** Revision 1.3 2016/05/04 18:59:33EDT czogby - ** Update MM to Compile With New UT-Assert PSP Files - ** Revision 1.2 2016/03/04 20:00:57EST czogby - ** Need Temporary Header File to Import Some MM Functions Into Unit Tests - ** Revision 1.1 2016/02/03 17:11:37EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_mem8_test.h" -#include "mm_mem8.h" -#include "mm_msg.h" -#include "mm_msgdefs.h" -#include "mm_msgids.h" -#include "mm_events.h" -#include "mm_filedefs.h" -#include "mm_version.h" -#include "mm_test_utils.h" -#include "ut_osapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_es_hooks.h" -#include "ut_cfe_evs_stubs.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_psp_ram_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include -#include -#include - -/* - * Function Definitions - */ - -void MM_LoadMem8FromFile_Test_Nominal (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, FileHeader.NumOfBytes, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem8FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_LOAD_FROM_FILE, "MM_AppData.LastAction == MM_LOAD_FROM_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM8, "MM_AppData.MemType == MM_MEM8"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_LoadMem8FromFile_Test_Nominal */ - -void MM_LoadMem8FromFile_Test_CPUHogging (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - - /* Set to always fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, MM_MAX_LOAD_DATA_SEG, 1); - Ut_OSFILEAPI_ContinueReturnCodeAfterCountZero(UT_OSFILEAPI_READ_INDEX); - - /* Execute the function being tested */ - Result = MM_LoadMem8FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_LOAD_FROM_FILE, "MM_AppData.LastAction == MM_LOAD_FROM_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM8, "MM_AppData.MemType == MM_MEM8"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_LoadMem8FromFile_Test_CPUHogging */ - -void MM_LoadMem8FromFile_Test_ReadError (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to generate error message MM_OS_READ_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem8FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_READ_ERR_EID, CFE_EVS_ERROR, "OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"), - "OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMem8FromFile_Test_ReadError */ - -void MM_LoadMem8FromFile_Test_WriteError (void) -{ - boolean Result; - uint32 DestAddress = 1; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to fail condition "(ReadLength = OS_read(FileHandle, ioBuffer8, SegmentSize)) != SegmentSize" */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_READ_INDEX, FileHeader.NumOfBytes, 1); - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE8_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_LoadMem8FromFile(FileHandle, "filename", &FileHeader, DestAddress); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_LoadMem8FromFile_Test_WriteError */ - -void MM_DumpMem8ToFile_Test_Nominal (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - FileHeader.SymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_DumpMem8ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM8, "MM_AppData.MemType == MM_MEM8"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMem8ToFile_Test_Nominal */ - -void MM_DumpMem8ToFile_Test_CPUHogging (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - FileHeader.SymAddress.Offset = 0; - - /* Execute the function being tested */ - Result = MM_DumpMem8ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - UtAssert_True (MM_AppData.LastAction == MM_DUMP_TO_FILE, "MM_AppData.LastAction == MM_DUMP_TO_FILE"); - UtAssert_True (MM_AppData.MemType == MM_MEM8, "MM_AppData.MemType == MM_MEM8"); - UtAssert_True (MM_AppData.Address == FileHeader.SymAddress.Offset, "MM_AppData.Address == FileHeader.SymAddress.Offset"); - UtAssert_True (MM_AppData.BytesProcessed == FileHeader.NumOfBytes, "MM_AppData.BytesProcessed == FileHeader.NumOfBytes"); - UtAssert_True (strncmp(MM_AppData.FileName, "filename", OS_MAX_PATH_LEN) == 0, "MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_DumpMem8ToFile_Test_CPUHogging */ - -void MM_DumpMem8ToFile_Test_ReadError (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - char ErrorMessage[125]; - - FileHeader.NumOfBytes = 2; - - /* Set to generate error message MM_PSP_READ_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMREAD8_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMem8ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - sprintf (ErrorMessage, "PSP read memory error: RC=0xFFFFFFFF, Src=0x%08X, Tgt=0x%08X, Type=MEM8", (unsigned int)FileHeader.SymAddress.Offset, (unsigned int)&MM_AppData.DumpBuffer[0]); - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_READ_ERR_EID, CFE_EVS_ERROR, ErrorMessage), - ErrorMessage); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMem8ToFile_Test_ReadError */ - -void MM_DumpMem8ToFile_Test_WriteError (void) -{ - boolean Result; - uint32 FileHandle = 1; - MM_LoadDumpFileHeader_t FileHeader; - - FileHeader.NumOfBytes = 2; - - /* Set to generate error message MM_OS_WRITE_EXP_ERR_EID */ - Ut_OSFILEAPI_SetReturnCode(UT_OSFILEAPI_WRITE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_DumpMem8ToFile(FileHandle, "filename", &FileHeader); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_ERROR, "OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"), - "OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename'"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_DumpMem8ToFile_Test_WriteError */ - -void MM_FillMem8_Test_Nominal (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2; - CmdPacket.FillPattern = 3; - - /* Execute the function being tested */ - MM_FillMem8(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_FILL, "MM_AppData.LastAction == MM_FILL"); - UtAssert_True (MM_AppData.MemType == MM_MEM8, "MM_AppData.MemType == MM_MEM8"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == CmdPacket.FillPattern, "MM_AppData.DataValue == CmdPacket.FillPattern"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillMem8_Test_Nominal */ - -void MM_FillMem8_Test_CPUHogging (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2*MM_MAX_LOAD_DATA_SEG; - CmdPacket.FillPattern = 3; - - /* Execute the function being tested */ - MM_FillMem8(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_FILL, "MM_AppData.LastAction == MM_FILL"); - UtAssert_True (MM_AppData.MemType == MM_MEM8, "MM_AppData.MemType == MM_MEM8"); - UtAssert_True (MM_AppData.Address == DestAddress, "MM_AppData.Address == DestAddress"); - UtAssert_True (MM_AppData.DataValue == CmdPacket.FillPattern, "MM_AppData.DataValue == CmdPacket.FillPattern"); - UtAssert_True (MM_AppData.BytesProcessed == CmdPacket.NumOfBytes, "MM_AppData.BytesProcessed == CmdPacket.NumOfBytes"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_FillMem8_Test_CPUHogging */ - -void MM_FillMem8_Test_WriteError (void) -{ - MM_FillMemCmd_t CmdPacket; - uint32 DestAddress = 1; - - CmdPacket.NumOfBytes = 2; - CmdPacket.FillPattern = 3; - - /* Set to generate error message MM_PSP_WRITE_ERR_EID */ - Ut_CFE_PSP_RAM_SetReturnCode(UT_CFE_PSP_RAM_MEMWRITE8_INDEX, -1, 1); - - /* Execute the function being tested */ - MM_FillMem8(DestAddress, &CmdPacket); - - /* Verify results */ - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_PSP_WRITE_ERR_EID, CFE_EVS_ERROR, "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"), - "PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_FillMem8_Test_WriteError */ - -void MM_Mem8_Test_AddTestCases(void) -{ - UtTest_Add(MM_LoadMem8FromFile_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem8FromFile_Test_Nominal"); - UtTest_Add(MM_LoadMem8FromFile_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem8FromFile_Test_CPUHogging"); - UtTest_Add(MM_LoadMem8FromFile_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem8FromFile_Test_ReadError"); - UtTest_Add(MM_LoadMem8FromFile_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_LoadMem8FromFile_Test_WriteError"); - UtTest_Add(MM_DumpMem8ToFile_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem8ToFile_Test_Nominal"); - UtTest_Add(MM_DumpMem8ToFile_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem8ToFile_Test_CPUHogging"); - UtTest_Add(MM_DumpMem8ToFile_Test_ReadError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem8ToFile_Test_ReadError"); - UtTest_Add(MM_DumpMem8ToFile_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_DumpMem8ToFile_Test_WriteError"); - UtTest_Add(MM_FillMem8_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem8_Test_Nominal"); - UtTest_Add(MM_FillMem8_Test_CPUHogging, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem8_Test_CPUHogging"); - UtTest_Add(MM_FillMem8_Test_WriteError, MM_Test_Setup, MM_Test_TearDown, "MM_FillMem8_Test_WriteError"); -} /* end MM_Mem8_Test_AddTestCases */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_mem8_test.h b/fsw/unit_test/mm_mem8_test.h deleted file mode 100644 index 2728baa..0000000 --- a/fsw/unit_test/mm_mem8_test.h +++ /dev/null @@ -1,34 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_mem8_test.h 1.3 2016/03/03 21:24:59EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes for the unit test cases for mm_mem8_test.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_mem8_test.h $ - ** Revision 1.3 2016/03/03 21:24:59EST czogby - ** Add Integrity headers to all unit testl .h files - *************************************************************************/ - -/* - * Includes - */ - -#include "utassert.h" -#include "uttest.h" - -/* - * Function Prototypes - */ - -void MM_Mem8_Test_AddTestCases(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_test_log.txt b/fsw/unit_test/mm_test_log.txt deleted file mode 100644 index cc81ce1..0000000 --- a/fsw/unit_test/mm_test_log.txt +++ /dev/null @@ -1,1787 +0,0 @@ -############################################################################## -## $Id: mm_test_log.txt 1.5 2016/10/31 22:10:58EDT mdeschu Exp $ -## -## Purpose: CFS MM application unit test baseline output log -## -## Author: Charles Zogby -## -## $Log: mm_test_log.txt $ -## Revision 1.5 2016/10/31 22:10:58EDT mdeschu -## Update gcov results, README and log file for MM unit tests for 2.4.1 -## Revision 1.4 2016/10/24 18:35:24EDT czogby -## Code Walkthough Updates -## Revision 1.3 2016/03/04 20:07:42EST czogby -## Update log file for run with official release of MM 2.4.0 -## Revision 1.2 2016/02/08 16:50:33EST czogby -## Add MKS Header to mm_test_log.txt -############################################################################## - -MM 2.4.1.0 Unit Test Output: - -./mm_testrunner.exe - -Running Test: MM_AppMain_Test_Nominal -INFO EVENT ID=1 MM Initialized. Version 2.4.1.0 -PKT: 08 87 C0 00 00 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -PASS: MM_AppData.CmdCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppMain_Test_AppInitError -SYSTEM LOG: MM App: Error Registering For Event Services, RC = 0xFFFFFFFF - -PASS: MM_AppData.RunStatus == CFE_ES_APP_ERROR -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_AppMain_Test_SBError -INFO EVENT ID=1 MM Initialized. Version 2.4.1.0 -ERROR EVENT ID=15 SB Pipe Read Error, App will exit. RC = 0xFFFFFFFF -PASS: MM_AppData.CmdCounter == 1 -PASS: SB Pipe Read Error, App will exit. RC = 0xFFFFFFFF -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 2 - -Running Test: MM_AppInit_Test_Nominal -INFO EVENT ID=1 MM Initialized. Version 2.4.1.0 -PASS: Result == CFE_SUCCESS -PASS: MM_AppData.RunStatus == CFE_ES_APP_RUN -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 0 -PASS: strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0 -PASS: MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH -PASS: MM_AppData.LimitHK == MM_HK_LIMIT -PASS: MM_AppData.LimitCmd == MM_CMD_LIMIT -PASS: MM Initialized. Version 2.4.1.0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppInit_Test_EVSRegisterError -SYSTEM LOG: MM App: Error Registering For Event Services, RC = 0xFFFFFFFF - -PASS: Result == -1 -PASS: MM_AppData.RunStatus == CFE_ES_APP_RUN -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 0 -PASS: strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0 -PASS: MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH -PASS: MM_AppData.LimitHK == MM_HK_LIMIT -PASS: MM_AppData.LimitCmd == MM_CMD_LIMIT -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 -PASS: MM App: Error Registering For Event Services, RC = 0xFFFFFFFF - -PASS: Ut_CFE_ES_GetSysLogQueueDepth() == 1 - -Running Test: MM_AppInit_Test_SBCreatePipeError -SYSTEM LOG: MM App: Error Creating SB Pipe, RC = 0xFFFFFFFF - -PASS: Result == -1 -PASS: MM_AppData.RunStatus == CFE_ES_APP_RUN -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 0 -PASS: strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0 -PASS: MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH -PASS: MM_AppData.LimitHK == MM_HK_LIMIT -PASS: MM_AppData.LimitCmd == MM_CMD_LIMIT -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 -PASS: MM App: Error Creating SB Pipe, RC = 0xFFFFFFFF - -PASS: Ut_CFE_ES_GetSysLogQueueDepth() == 1 - -Running Test: MM_AppInit_Test_SBSubscribeHKError -SYSTEM LOG: MM App: Error Subscribing to HK Request, RC = 0xFFFFFFFF - -PASS: Result == -1 -PASS: MM_AppData.RunStatus == CFE_ES_APP_RUN -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 0 -PASS: strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0 -PASS: MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH -PASS: MM_AppData.LimitHK == MM_HK_LIMIT -PASS: MM_AppData.LimitCmd == MM_CMD_LIMIT -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 -PASS: MM App: Error Subscribing to HK Request, RC = 0xFFFFFFFF - -PASS: Ut_CFE_ES_GetSysLogQueueDepth() == 1 - -Running Test: MM_AppInit_Test_SBSubscribeMMError -SYSTEM LOG: MM App: Error Subscribing to MM Command, RC = 0xFFFFFFFF - -PASS: Result == -1 -PASS: MM_AppData.RunStatus == CFE_ES_APP_RUN -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 0 -PASS: strncmp(MM_AppData.PipeName, 'MM_CMD_PIPE', 16) == 0 -PASS: MM_AppData.PipeDepth == MM_CMD_PIPE_DEPTH -PASS: MM_AppData.LimitHK == MM_HK_LIMIT -PASS: MM_AppData.LimitCmd == MM_CMD_LIMIT -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 -PASS: MM App: Error Subscribing to MM Command, RC = 0xFFFFFFFF - -PASS: Ut_CFE_ES_GetSysLogQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_Noop -INFO EVENT ID=2 No-op command. Version 2.4.1.0 -PASS: No-op command. Version 2.4.1.0 -PASS: MM_AppData.LastAction == MM_NOOP -PASS: MM_AppData.CmdCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_Reset -DEBUG EVENT ID=3 Reset counters command received -PASS: Reset counters command received -PASS: MM_AppData.LastAction == MM_RESET -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_Peek -ERROR EVENT ID=22 Data size in bits invalid: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_Poke -ERROR EVENT ID=22 Data size in bits invalid: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_LoadMemWID -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: LoadMemFromFile -ERROR EVENT ID=39 Command specified filename invalid: Name = '' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_DumpMemToFile -ERROR EVENT ID=39 Command specified filename invalid: Name = '' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_DumpInEvent -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_FillMem -ERROR EVENT ID=19 Invalid memory type specified: MemType = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_LookupSymbol -ERROR EVENT ID=46 NUL (empty) string specified as symbol name -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_SymTblToFile -ERROR EVENT ID=48 NUL (empty) string specified as symbol dump file name -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_EnableEepromWrite -INFO EVENT ID=51 EEPROM bank 0 write enabled, cFE_Status= 0x0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_DisableEepromWrite -INFO EVENT ID=53 EEPROM bank 0 write disabled, cFE_Status= 0x0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_InvalidCommandCode -ERROR EVENT ID=17 Invalid ground command code: ID = 0x1888, CC = 99 -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid ground command code: ID = 0x1888, CC = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_AppPipe_Test_InvalidCommandPipeMessageID -ERROR EVENT ID=16 Invalid command pipe message ID: 0xF -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid command pipe message ID: 0xF -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_HousekeepingCmd_Test -PKT: 00 00 00 00 00 00 00 -PASS: MM_AppData.HkPacket.CmdCounter == 1 -PASS: MM_AppData.HkPacket.ErrCounter == 2 -PASS: MM_AppData.HkPacket.LastAction == 3 -PASS: MM_AppData.HkPacket.MemType == 4 -PASS: MM_AppData.HkPacket.Address == 5 -PASS: MM_AppData.HkPacket.DataValue == 6 -PASS: MM_AppData.HkPacket.BytesProcessed == 7 -PASS: strncmp(MM_AppData.HkPacket.FileName, MM_AppData.FileName, OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LookupSymbolCmd_Test_Nominal -INFO EVENT ID=45 Symbol Lookup Command: Name = 'name' Addr = 0x00000000 -PASS: MM_AppData.LastAction == MM_SYM_LOOKUP -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.CmdCounter == 1 -PASS: Symbol Lookup Command: Name = 'name' Addr = 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LookupSymbolCmd_Test_SymbolNameNull -ERROR EVENT ID=46 NUL (empty) string specified as symbol name -PASS: MM_AppData.ErrCounter == 1 -PASS: NUL (empty) string specified as symbol name -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LookupSymbolCmd_Test_SymbolLookupError -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'name' -PASS: MM_AppData.ErrCounter == 1 -PASS: Symbolic address can't be resolved: Name = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_SymTblToFileCmd_Test_Nominal -INFO EVENT ID=47 Symbol Table Dump to File Started: Name = 'name' -PASS: MM_AppData.LastAction == MM_SYMTBL_SAVE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.CmdCounter == 1 -PASS: Symbol Table Dump to File Started: Name = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_SymTblToFileCmd_Test_SymbolFilenameNull -ERROR EVENT ID=48 NUL (empty) string specified as symbol dump file name -PASS: MM_AppData.ErrCounter == 1 -PASS: NUL (empty) string specified as symbol dump file name -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_SymTblToFileCmd_Test_SymbolTableDumpError -ERROR EVENT ID=49 Error dumping symbol table, OS_Status= 0xFFFFFFFF, File='name' -PASS: MM_AppData.ErrCounter == 1 -PASS: Error dumping symbol table, OS_Status= 0xFFFFFFFF, File='name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_SymTblToFileCmd_Test_IllegalCharacters -ERROR EVENT ID=50 Illegal characters in target filename, File='***name***' -PASS: MM_AppData.ErrCounter == 1 -PASS: Illegal characters in target filename, File='***name***' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_EepromWriteEnaCmd_Test_Nominal -INFO EVENT ID=51 EEPROM bank 1 write enabled, cFE_Status= 0x0 -PASS: MM_AppData.LastAction == MM_EEPROMWRITE_ENA -PASS: MM_AppData.MemType == MM_EEPROM -PASS: MM_AppData.CmdCounter == 1 -PASS: EEPROM bank 1 write enabled, cFE_Status= 0x0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_EepromWriteEnaCmd_Test_Error -ERROR EVENT ID=52 Error requesting EEPROM bank 1 write enable, cFE_Status= 0xFFFFFFFF -PASS: MM_AppData.ErrCounter == 1 -PASS: Error requesting EEPROM bank 1 write enable, cFE_Status= 0xF -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_EepromWriteDisCmd_Test_Nominal -INFO EVENT ID=53 EEPROM bank 1 write disabled, cFE_Status= 0x0 -PASS: MM_AppData.LastAction == MM_EEPROMWRITE_DIS -PASS: MM_AppData.MemType == MM_EEPROM -PASS: MM_AppData.CmdCounter == 1 -PASS: EEPROM bank 1 write disabled, cFE_Status= 0x0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_EepromWriteDisCmd_Test_Error -ERROR EVENT ID=54 Error requesting EEPROM bank 1 write disable, cFE_Status= 0xFFFFFFFF -PASS: MM_AppData.ErrCounter == 1 -PASS: Error requesting EEPROM bank 1 write edisable, cFE_Status= 0xF -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeCmd_Test_EEPROM -INFO EVENT ID=12 Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000 -PASS: Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeCmd_Test_NonEEPROM -INFO EVENT ID=12 Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000 -PASS: Poke Command: Addr = 0x00000000, Size = 32 bits, Data = 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeCmd_Test_SymNameError -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'name' -PASS: MM_AppData.ErrCounter == 1 -PASS: Symbolic address can't be resolved: Name = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeMem_Test_8bit -INFO EVENT ID=10 Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05 -PASS: Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_POKE -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == 5 -PASS: MM_AppData.BytesProcessed == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeMem_Test_8bitError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeMem_Test_16bit -INFO EVENT ID=11 Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x0005 -PASS: Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x05 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_POKE -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == 5 -PASS: MM_AppData.BytesProcessed == 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeMem_Test_16bitError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeMem_Test_32bit -INFO EVENT ID=12 Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x00000005 -PASS: Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x05 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_POKE -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == 5 -PASS: MM_AppData.BytesProcessed == 4 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeMem_Test_32bitError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeEeprom_Test_8bit -INFO EVENT ID=10 Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05 -PASS: Poke Command: Addr = 0x00000001, Size = 8 bits, Data = 0x05 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_POKE -PASS: MM_AppData.MemType == MM_EEPROM -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == 5 -PASS: MM_AppData.BytesProcessed == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeEeprom_Test_8bitError -ERROR EVENT ID=28 CFE_PSP_EepromWrite8 error received: RC = 0xFFFFFFFF, Addr = 0x00000001 -PASS: CFE_PSP_EepromWrite8 error received: RC = 0xFFFFFFFF, Addr = 0x00000001 -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeEeprom_Test_16bit -INFO EVENT ID=11 Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x0005 -PASS: Poke Command: Addr = 0x00000001, Size = 16 bits, Data = 0x05 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_POKE -PASS: MM_AppData.MemType == MM_EEPROM -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == 5 -PASS: MM_AppData.BytesProcessed == 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeEeprom_Test_16bitError -ERROR EVENT ID=29 CFE_PSP_EepromWrite16 error received: RC = 0xFFFFFFFF, Addr = 0x00000001 -PASS: CFE_PSP_EepromWrite16 error received: RC = 0xFFFFFFFF, Addr = 0x00000001 -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeEeprom_Test_32bit -INFO EVENT ID=12 Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x00000005 -PASS: Poke Command: Addr = 0x00000001, Size = 32 bits, Data = 0x05 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_POKE -PASS: MM_AppData.MemType == MM_EEPROM -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == 5 -PASS: MM_AppData.BytesProcessed == 4 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PokeEeprom_Test_32bitError -ERROR EVENT ID=30 CFE_PSP_EepromWrite32 error received: RC = 0xFFFFFFFF, Addr = 0x00000001 -PASS: CFE_PSP_EepromWrite32 error received: RC = 0xFFFFFFFF, Addr = 0x00000001 -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemWIDCmd_Test_Nominal -INFO EVENT ID=4 Load Memory WID Command: Wrote 2 bytes to address: 0x00000001 -PASS: MM_AppData.CmdCounter == 1 -PASS: Load Memory WID Command: Wrote 2 bytes to address: 0x00000001 -PASS: MM_AppData.LastAction == MM_LOAD_WID -PASS: MM_AppData.Address == 1 -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.BytesProcessed == 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemWIDCmd_Test_CopyError -ERROR EVENT ID=58 PSP copy memory error: RC=0xFFFFFFFF, Src=0xFF8493F8, Tgt=0x00000001, Size=0x00000002 -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP copy memory error: RC=0xFFFFFFFF, Src=0xFF8493F8, Tgt=0x00000001, Size=0x00000002 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemWIDCmd_Test_CRCError -ERROR EVENT ID=27 Interrupts Disabled Load CRC failure: Expected = 0x1 Calculated = 0x0 -PASS: MM_AppData.ErrCounter == 1 -PASS: Interrupts Disabled Load CRC failure: Expected = 0x1 Calculated = 0x0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemWIDCmd_Test_SymNameErr -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'name' -PASS: MM_AppData.ErrCounter == 1 -PASS: Symbolic address can't be resolved: Name = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyLoadWIDParams_Test_Nominal -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyLoadWIDParams_Test_MemValidateError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyLoadWIDParams_Test_DataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyLoadWIDParams_Test_DataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 201 -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 201 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_RAM -INFO EVENT ID=5 Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: MM_AppData.CmdCounter == 1 -PASS: Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_EEPROM -INFO EVENT ID=5 Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: MM_AppData.CmdCounter == 1 -PASS: Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_MEM32 -INFO EVENT ID=5 Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: MM_AppData.CmdCounter == 1 -PASS: Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_MEM16 -INFO EVENT ID=5 Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: MM_AppData.CmdCounter == 1 -PASS: Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_MEM8 -INFO EVENT ID=5 Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: MM_AppData.CmdCounter == 1 -PASS: Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_LoadParamsError -ERROR EVENT ID=19 Invalid memory type specified: MemType = 99 -ERROR EVENT ID=41 Load file failed parameters check: File = 'name' -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid memory type specified: MemType = 99 -PASS: Load file failed parameters check: File = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 2 - -Running Test: MM_LoadMemFromFileCmd_Test_SymNameError -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'name' -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 1 -PASS: Symbolic address can't be resolved: Name = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_LoadFileCRCError -ERROR EVENT ID=26 Load file CRC failure: Expected = 0x63 Calculated = 0x0 File = 'name' -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 1 -PASS: Load file CRC failure: Expected = 0x63 Calculated = 0x0 File = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_ComputeCRCError -ERROR EVENT ID=38 CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'name' -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 1 -PASS: CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_CloseError -INFO EVENT ID=5 Load Memory From File Command: Loaded 4 bytes to address 0x00000000 from file 'name' -ERROR EVENT ID=33 OS_close error received: RC = 0xFFFFFFFF File = 'name' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_close error received: RC = 0xFFFFFFFF File = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 2 - -Running Test: MM_LoadMemFromFileCmd_Test_OpenError -ERROR EVENT ID=32 OS_open error received: RC = 0xFFFFFFFF File = 'name' -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_open error received: RC = 0xFFFFFFFF File = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFileCmd_Test_InvalidFilename -ERROR EVENT ID=39 Command specified filename invalid: Name = '***name***' -PASS: MM_AppData.CmdCounter == 0 -PASS: MM_AppData.ErrCounter == 1 -PASS: Command specified filename invalid: Name = '***name***' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFile_Test_PreventCPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_LOAD_FROM_FILE -PASS: MM_AppData.MemType == MM_EEPROM -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == 2*MM_MAX_LOAD_DATA_SEG -PASS: strncmp(MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LoadMemFromFile_Test_MemCpyError -ERROR EVENT ID=58 PSP copy memory error: RC=0xFFFFFFFF, Src=0x080AC5EC, Tgt=0x00000000, Size=0x00000002 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP copy memory error: RC=0xFFFFFFFF, Src=0x080AC5EC, Tgt=0x00000000, Size=0x00000002 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMemFromFile_Test_ReadError -ERROR EVENT ID=34 OS_read error received: RC = 0x00000000 Expected = 2 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_read error received: RC = 0x00000000 Expected = 2 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_RAMValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_RAMDataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_EEPROMValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_EEPROMDataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 131073 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 131073 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM32ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM32DataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM32AlignmentError -ERROR EVENT ID=23 Data and address not 32 bit aligned: Addr = 0x00000000 Size = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 32 bit aligned: Addr = 0x00000000 Size = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM16ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM16DataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM16AlignmentError -ERROR EVENT ID=24 Data and address not 16 bit aligned: Addr = 0x00000000 Size = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 16 bit aligned: Addr = 0x00000000 Size = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM8ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_MEM8DataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileLoadParams_Test_InvalidMemTypeError -ERROR EVENT ID=19 Invalid memory type specified: MemType = 99 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid memory type specified: MemType = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyLoadFileSize_Test_StatError -ERROR EVENT ID=37 OS_stat error received: RC = 0xFFFFFFFF File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_stat error received: RC = 0xFFFFFFFF File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyLoadFileSize_Test_SizeError -ERROR EVENT ID=40 Load file size error: Reported by OS = 148 Expected = 144 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Load file size error: Reported by OS = 148 Expected = 144 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_ReadFileHeaders_Test_ReadHeaderError -ERROR EVENT ID=42 CFE_FS_ReadHeader error received: RC = 0x00000000 Expected = 64 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_FS_ReadHeader error received: RC = 0x00000000 Expected = 64 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_ReadFileHeaders_Test_ReadError -ERROR EVENT ID=35 OS_read error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_read error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMemCmd_Test_RAM -INFO EVENT ID=6 Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: MM_AppData.CmdCounter == 1 -PASS: Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMemCmd_Test_EEPROM -INFO EVENT ID=6 Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: MM_AppData.CmdCounter == 1 -PASS: Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMemCmd_Test_MEM32 -INFO EVENT ID=6 Fill Memory Command: Filled 4 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: MM_AppData.CmdCounter == 1 -PASS: Fill Memory Command: Filled 4 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMemCmd_Test_MEM16 -INFO EVENT ID=6 Fill Memory Command: Filled 2 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: MM_AppData.CmdCounter == 1 -PASS: Fill Memory Command: Filled 2 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMemCmd_Test_MEM8 -INFO EVENT ID=6 Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: MM_AppData.CmdCounter == 1 -PASS: Fill Memory Command: Filled 1 bytes at address: 0x00000000 with pattern: 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMemCmd_Test_SymNameError -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'name' -PASS: MM_AppData.ErrCounter == 1 -PASS: Symbolic address can't be resolved: Name = 'name' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMem_Test_Nominal -PASS: MM_AppData.LastAction == MM_FILL -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == CmdPacket.FillPattern -PASS: MM_AppData.BytesProcessed == 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillMem_Test_MemCpyError -ERROR EVENT ID=58 PSP copy memory error: RC=0xFFFFFFFF, Src=0x080AC77C, Tgt=0x00000000, Size=0x00000002 -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP copy memory error: RC=0xFFFFFFFF, Src=0x080AC77C, Tgt=0x00000000, Size=0x00000002 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_RAMValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_RAMDataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_RAMDataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_EEPROMValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 2 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_EEPROMDataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 131073 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 131073 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM32ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 4 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 4 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM32DataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM32DataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM32AlignmentError -ERROR EVENT ID=23 Data and address not 32 bit aligned: Addr = 0x00000001 Size = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 32 bit aligned: Addr = 0x00000001 Size = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM16ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 2 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 2 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM16DataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM16DataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM16AlignmentError -ERROR EVENT ID=24 Data and address not 16 bit aligned: Addr = 0x00000001 Size = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 16 bit aligned: Addr = 0x00000001 Size = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM8ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000001 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM8DataSizeErrorTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_MEM8DataSizeErrorTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFillParams_Test_InvalidMemTypeError -ERROR EVENT ID=19 Invalid memory type specified: MemType = 99 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid memory type specified: MemType = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMem8FromFile_Test_Nominal -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_LOAD_FROM_FILE -PASS: MM_AppData.MemType == MM_MEM8 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LoadMem8FromFile_Test_CPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_LOAD_FROM_FILE -PASS: MM_AppData.MemType == MM_MEM8 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LoadMem8FromFile_Test_ReadError -ERROR EVENT ID=34 OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMem8FromFile_Test_WriteError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMem8ToFile_Test_Nominal -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == MM_MEM8 -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMem8ToFile_Test_CPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == MM_MEM8 -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMem8ToFile_Test_ReadError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Src=0xF76EF008, Tgt=0x080AC6B4, Type=MEM8 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP read memory error: RC=0xFFFFFFFF, Src=0xF76EF008, Tgt=0x080AC6B4, Type=MEM8 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMem8ToFile_Test_WriteError -ERROR EVENT ID=36 OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMem8_Test_Nominal -PASS: MM_AppData.LastAction == MM_FILL -PASS: MM_AppData.MemType == MM_MEM8 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == CmdPacket.FillPattern -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillMem8_Test_CPUHogging -PASS: MM_AppData.LastAction == MM_FILL -PASS: MM_AppData.MemType == MM_MEM8 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == CmdPacket.FillPattern -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillMem8_Test_WriteError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMem16FromFile_Test_Nominal -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_LOAD_FROM_FILE -PASS: MM_AppData.MemType == MM_MEM16 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LoadMem16FromFile_Test_CPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_LOAD_FROM_FILE -PASS: MM_AppData.MemType == MM_MEM16 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LoadMem16FromFile_Test_ReadError -ERROR EVENT ID=34 OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_read error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMem16FromFile_Test_WriteError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMem16ToFile_Test_Nominal -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == MM_MEM16 -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMem16ToFile_Test_CPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == MM_MEM16 -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMem16ToFile_Test_ReadError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Src=0xF76EF008, Tgt=0x080AC6B4, Type=MEM16 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP read memory error: RC=0xFFFFFFFF, Src=0xF76EF008, Tgt=0x080AC6B4, Type=MEM16 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMem16ToFile_Test_WriteError -ERROR EVENT ID=36 OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMem16_Test_Nominal -PASS: MM_AppData.LastAction == MM_FILL -PASS: MM_AppData.MemType == MM_MEM16 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == CmdPacket.FillPattern -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillMem16_Test_CPUHogging -PASS: MM_AppData.LastAction == MM_FILL -PASS: MM_AppData.MemType == MM_MEM16 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == CmdPacket.FillPattern -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillMem16_Test_WriteError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMem32FromFile_Test_Nominal -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_LOAD_FROM_FILE -PASS: MM_AppData.MemType == MM_MEM32 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LoadMem32FromFile_Test_CPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_LOAD_FROM_FILE -PASS: MM_AppData.MemType == MM_MEM32 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_LoadMem32FromFile_Test_ReadError -ERROR EVENT ID=34 OS_read error received: RC = 0xFFFFFFFF Expected = 4 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_read error received: RC = 0xFFFFFFFF Expected = 4 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_LoadMem32FromFile_Test_WriteError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMem32ToFile_Test_Nominal -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == MM_MEM32 -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMem32ToFile_Test_CPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == MM_MEM32 -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == FileHeader.NumOfBytes -PASS: MM_AppData.FileName, 'filename', OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMem32ToFile_Test_ReadError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Src=0xF76EF008, Tgt=0x080AC6B4, Type=MEM32 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP read memory error: RC=0xFFFFFFFF, Src=0xF76EF008, Tgt=0x080AC6B4, Type=MEM32 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMem32ToFile_Test_WriteError -ERROR EVENT ID=36 OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_write error received: RC = 0xFFFFFFFF Expected = 2 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillMem32_Test_Nominal -PASS: MM_AppData.LastAction == MM_FILL -PASS: MM_AppData.MemType == MM_MEM32 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == CmdPacket.FillPattern -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillMem32_Test_CPUHogging -PASS: MM_AppData.LastAction == MM_FILL -PASS: MM_AppData.MemType == MM_MEM32 -PASS: MM_AppData.Address == DestAddress -PASS: MM_AppData.DataValue == CmdPacket.FillPattern -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillMem32_Test_WriteError -ERROR EVENT ID=57 PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP write memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekCmd_Test_Nominal -INFO EVENT ID=9 Peek Command: Addr = 0x00000000 Size = 32 bits Data = 0x00000000 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekCmd_Test_SymNameError -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'name' -PASS: Symbolic address can't be resolved: Name = 'name' -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekMem_Test_Byte -INFO EVENT ID=7 Peek Command: Addr = 0x00000001 Size = 8 bits Data = 0x00 -PASS: Peek Command: Addr = 0x00000001 Size = 8 bits Data = 0x00 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_PEEK -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.Address == 1 -PASS: MM_AppData.BytesProcessed == 1 -PASS: MM_AppData.DataValue == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekMem_Test_ByteError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM8 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekMem_Test_Word -INFO EVENT ID=8 Peek Command: Addr = 0x00000001 Size = 16 bits Data = 0x0000 -PASS: Peek Command: Addr = 0x00000001 Size = 16 bits Data = 0x0000 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_PEEK -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.Address == 1 -PASS: MM_AppData.BytesProcessed == 2 -PASS: MM_AppData.DataValue == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekMem_Test_WordError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM16 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekMem_Test_DWord -INFO EVENT ID=9 Peek Command: Addr = 0x00000001 Size = 32 bits Data = 0x00000000 -PASS: Peek Command: Addr = 0x00000001 Size = 32 bits Data = 0x00000000 -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_PEEK -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.Address == 1 -PASS: MM_AppData.BytesProcessed == 4 -PASS: MM_AppData.DataValue == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_PeekMem_Test_DWordError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: PSP read memory error: RC=0xFFFFFFFF, Address=0x00000001, MemType=MEM32 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_RAM -INFO EVENT ID=13 Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_EEPROM -INFO EVENT ID=13 Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_MEM32 -INFO EVENT ID=13 Dump Memory To File Command: Dumped 4 bytes from address 0x00000000 to file 'filename' -PASS: Dump Memory To File Command: Dumped 4 bytes from address 0x00000000 to file 'filename' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_MEM16 -INFO EVENT ID=13 Dump Memory To File Command: Dumped 2 bytes from address 0x00000000 to file 'filename' -PASS: Dump Memory To File Command: Dumped 2 bytes from address 0x00000000 to file 'filename' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_MEM8 -INFO EVENT ID=13 Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_ComputeCRCError -ERROR EVENT ID=38 CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'filename' -INFO EVENT ID=13 Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: CFS_ComputeCRCFromFile error received: RC = 0xFFFFFFFF File = 'filename' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 2 - -Running Test: MM_DumpMemToFileCmd_Test_CloseError -INFO EVENT ID=13 Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -ERROR EVENT ID=33 OS_close error received: RC = 0xFFFFFFFF File = 'filename' -PASS: Dump Memory To File Command: Dumped 1 bytes from address 0x00000000 to file 'filename' -PASS: OS_close error received: RC = 0xFFFFFFFF File = 'filename' -PASS: MM_AppData.CmdCounter == 1 -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: strncmp(MM_AppData.FileName, CmdPacket.FileName, OS_MAX_PATH_LEN) == 0 -PASS: MM_AppData.MemType == CmdPacket.MemType -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == CmdPacket.NumOfBytes -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 2 - -Running Test: MM_DumpMemToFileCmd_Test_CreatError -ERROR EVENT ID=31 OS_creat error received: RC = 0xFFFFFFFF File = 'filename' -PASS: OS_creat error received: RC = 0xFFFFFFFF File = 'filename' -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_SymNameError -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'SymName' -PASS: Symbolic address can't be resolved: Name = 'SymName' -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFileCmd_Test_FilenameError -ERROR EVENT ID=39 Command specified filename invalid: Name = '***' -PASS: Command specified filename invalid: Name = '***' -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFile_Test_Nominal -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == FileHeader.MemType -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == 1 -PASS: strncmp(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMemToFile_Test_CPUHogging -PASS: Result == TRUE -PASS: MM_AppData.LastAction == MM_DUMP_TO_FILE -PASS: MM_AppData.MemType == FileHeader.MemType -PASS: MM_AppData.Address == FileHeader.SymAddress.Offset -PASS: MM_AppData.BytesProcessed == 2 * MM_MAX_DUMP_DATA_SEG -PASS: strncmp(MM_AppData.FileName, FileName, OS_MAX_PATH_LEN) == 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_DumpMemToFile_Test_WriteError -ERROR EVENT ID=36 OS_write error received: RC = 0xFFFFFFFF, Expected = 1, File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_write error received: RC = 0xFFFFFFFF, Expected = 1, File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpMemToFile_Test_CopyError -ERROR EVENT ID=58 PSP copy memory error: RC=0xFFFFFFFF, Src=0x00000001, Tgt=0x080AC6B4, Size=0x00000001 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP copy memory error: RC=0xFFFFFFFF, Src=0x00000001, Tgt=0x080AC6B4, Size=0x00000001 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_RAM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyFileDumpParams_Test_EEPROM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyFileDumpParams_Test_MEM32 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyFileDumpParams_Test_MEM16 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyFileDumpParams_Test_MEM8 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyFileDumpParams_Test_RAMRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_RAMInvalidSizeTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_EEPROMRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_EEPROMInvalidSizeTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 131073 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 131073 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM32RangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM32InvalidSizeTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM32AlignmentError -ERROR EVENT ID=23 Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM16RangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM16InvalidSizeTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM16AlignmentError -ERROR EVENT ID=24 Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM8RangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_MEM8InvalidSizeTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 1048577 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyFileDumpParams_Test_InvalidMemoryType -ERROR EVENT ID=19 Invalid memory type specified: MemType = 99 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid memory type specified: MemType = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_WriteFileHeaders_Test_Nominal -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_WriteFileHeaders_Test_WriteHeaderError -ERROR EVENT ID=43 CFE_FS_WriteHeader error received: RC = 0xFFFFFFFF Expected = 64 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_FS_WriteHeader error received: RC = 0xFFFFFFFF Expected = 64 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_WriteFileHeaders_Test_WriteError -ERROR EVENT ID=36 OS_write error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename' -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: OS_write error received: RC = 0xFFFFFFFF Expected = 80 File = 'filename' -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpInEventCmd_Test_Nominal -INFO EVENT ID=14 Memory Dump: 0x00 from address: 0x00000000 -PASS: Memory Dump: 0x00 from address: 0x00000000 -PASS: MM_AppData.LastAction == MM_DUMP_INEVENT -PASS: MM_AppData.MemType == MM_RAM -PASS: MM_AppData.Address == 0 -PASS: MM_AppData.BytesProcessed == 1 -PASS: MM_AppData.CmdCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_DumpInEventCmd_Test_SymNameError -ERROR EVENT ID=20 Symbolic address can't be resolved: Name = 'name' -PASS: Symbolic address can't be resolved: Name = 'name' -PASS: MM_AppData.ErrCounter == 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_RAM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyDumpInEventParams_Test_EEPROM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM32 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM16 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM8 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooSmall -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 0 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_InvalidDataSizeTooLarge -ERROR EVENT ID=21 Data size in bytes invalid or exceeds limits: Data Size = 16 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bytes invalid or exceeds limits: Data Size = 16 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_RAMRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_EEPROMRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM32RangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM32AlignmentError -ERROR EVENT ID=23 Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 32 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM16RangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM16AlignmentError -ERROR EVENT ID=24 Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 16 bit aligned: Addr = 0x00000000 Size = 3 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_MEM8RangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyDumpInEventParams_Test_InvalidMemType -ERROR EVENT ID=19 Invalid memory type specified: MemType = 99 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid memory type specified: MemType = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillDumpInEventBuffer_Test_RAM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillDumpInEventBuffer_Test_EEPROM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillDumpInEventBuffer_Test_MEM32 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillDumpInEventBuffer_Test_MEM16 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillDumpInEventBuffer_Test_MEM8 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_FillDumpInEventBuffer_Test_EEPROMCopyError -ERROR EVENT ID=58 PSP copy memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Size=0x00000001 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP copy memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Size=0x00000001 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillDumpInEventBuffer_Test_MEM32ReadError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Type=MEM32 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Type=MEM32 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillDumpInEventBuffer_Test_MEM16ReadError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Type=MEM16 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Type=MEM16 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_FillDumpInEventBuffer_Test_MEM8ReadError -ERROR EVENT ID=56 PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Type=MEM8 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: PSP read memory error: RC=0xFFFFFFFF, Src=0x00000000, Tgt=0x080AC6B4, Type=MEM8 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_ResetHk_Test -PASS: MM_AppData.LastAction == MM_NOACTION -PASS: MM_AppData.MemType == MM_NOMEMTYPE -PASS: MM_AppData.Address == MM_CLEAR_ADDR -PASS: MM_AppData.DataValue == MM_CLEAR_PATTERN -PASS: MM_AppData.BytesProcessed == 0 -PASS: MM_AppData.FileName[0] == MM_CLEAR_FNAME -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyCmdLength_Test_Nominal -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyCmdLength_Test_HKRequestLengthError -ERROR EVENT ID=44 Invalid HK request msg length: ID = 0x1889, CC = 2, Len = 80, Expected = 99 -PASS: Result == FALSE -PASS: Invalid HK request msg length: ID = 0x1889, CC = 2, Len = 80, Expected = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyCmdLength_Test_LengthError -ERROR EVENT ID=18 Invalid msg length: ID = 0x0005, CC = 2, Len = 80, Expected = 99 -PASS: Result == FALSE -PASS: Invalid msg length: ID = 0x0005, CC = 2, Len = 80, Expected = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_ByteWidthRAM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyPeekPokeParams_Test_WordWidthMEM16 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyPeekPokeParams_Test_DWordWidthMEM32 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyPeekPokeParams_Test_WordWidthAlignmentError -ERROR EVENT ID=24 Data and address not 16 bit aligned: Addr = 0x00000001 Size = 2 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 16 bit aligned: Addr = 0x00000001 Size = 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_DWordWidthAlignmentError -ERROR EVENT ID=23 Data and address not 32 bit aligned: Addr = 0x00000001 Size = 4 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data and address not 32 bit aligned: Addr = 0x00000001 Size = 4 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_InvalidDataSize -ERROR EVENT ID=22 Data size in bits invalid: Data Size = 55 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bits invalid: Data Size = 55 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_EEPROM -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyPeekPokeParams_Test_MEM8 -PASS: Result == TRUE -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 0 - -Running Test: MM_VerifyPeekPokeParams_Test_RAMValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_EEPROMValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_MEM32ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_MEM32InvalidDataSize -ERROR EVENT ID=22 Data size in bits invalid: Data Size = 8 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bits invalid: Data Size = 8 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_MEM16ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_MEM16InvalidDataSize -ERROR EVENT ID=22 Data size in bits invalid: Data Size = 8 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bits invalid: Data Size = 8 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_MEM8ValidateRangeError -ERROR EVENT ID=25 CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_MEM8InvalidDataSize -ERROR EVENT ID=22 Data size in bits invalid: Data Size = 32 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Data size in bits invalid: Data Size = 32 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Running Test: MM_VerifyPeekPokeParams_Test_InvalidMemType -ERROR EVENT ID=19 Invalid memory type specified: MemType = 99 -PASS: Result == FALSE -PASS: MM_AppData.ErrCounter == 1 -PASS: Invalid memory type specified: MemType = 99 -PASS: Ut_CFE_EVS_GetEventQueueDepth() == 1 - -Tests Executed: 249 -Assert Pass Count: 1035 -Assert Fail Count: 0 - - -gcov: '../src/mm_mem32.c' 100.00% 109 -gcov: '../src/mm_mem8.c' 100.00% 108 -gcov: '../src/mm_dump.c' 100.00% 343 -gcov: '../src/mm_app.c' 100.00% 192 -gcov: '../src/mm_load.c' 100.00% 432 -gcov: '../src/mm_mem16.c' 100.00% 108 -gcov: '../src/mm_utils.c' 100.00% 93 - - diff --git a/fsw/unit_test/mm_test_utils.c b/fsw/unit_test/mm_test_utils.c deleted file mode 100644 index 78328dd..0000000 --- a/fsw/unit_test/mm_test_utils.c +++ /dev/null @@ -1,56 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_test_utils.c 1.1 2016/02/03 17:11:38EST czogby Exp $ - ** - ** Purpose: - ** This file contains unit test utilities for the MM application. - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_test_utils.c $ - ** Revision 1.1 2016/02/03 17:11:38EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_test_utils.h" -#include "mm_msg.h" - -extern MM_AppData_t MM_AppData; - -/* - * Function Definitions - */ - -void MM_Test_Setup(void) -{ - /* initialize test environment to default state for every test */ - - CFE_PSP_MemSet(&MM_AppData, 0, sizeof(MM_AppData_t)); - - Ut_CFE_EVS_Reset(); - Ut_CFE_FS_Reset(); - Ut_CFE_TIME_Reset(); - Ut_CFE_TBL_Reset(); - Ut_CFE_SB_Reset(); - Ut_CFE_ES_Reset(); - Ut_OSAPI_Reset(); - Ut_OSFILEAPI_Reset(); -} /* end MM_Test_Setup */ - -void MM_Test_TearDown(void) -{ - /* cleanup test environment */ -} /* end MM_Test_TearDown */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_test_utils.h b/fsw/unit_test/mm_test_utils.h deleted file mode 100644 index ee30f6d..0000000 --- a/fsw/unit_test/mm_test_utils.h +++ /dev/null @@ -1,48 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_test_utils.h 1.1 2016/02/03 17:11:38EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes and global variables for the unit test utilities for the MM application. - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_test_utils.h $ - ** Revision 1.1 2016/02/03 17:11:38EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_app.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_tbl_hooks.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include "ut_osapi_stubs.h" -#include "ut_osfileapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_evs_stubs.h" -#include - -/* - * Function Definitions - */ - -void MM_Test_Setup(void); -void MM_Test_TearDown(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_testrunner.c b/fsw/unit_test/mm_testrunner.c deleted file mode 100644 index d8b4fdf..0000000 --- a/fsw/unit_test/mm_testrunner.c +++ /dev/null @@ -1,52 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_testrunner.c 1.1 2016/02/03 17:11:38EST czogby Exp $ - ** - ** Purpose: - ** This file contains the unit test runner for the MM application. - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_testrunner.c $ - ** Revision 1.1 2016/02/03 17:11:38EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "uttest.h" -#include "mm_app_test.h" -#include "mm_load_test.h" -#include "mm_mem8_test.h" -#include "mm_mem16_test.h" -#include "mm_mem32_test.h" -#include "mm_dump_test.h" -#include "mm_utils_test.h" - -/* - * Function Definitions - */ - -int main(void) -{ - MM_App_Test_AddTestCases(); - MM_Load_Test_AddTestCases(); - MM_Mem8_Test_AddTestCases(); - MM_Mem16_Test_AddTestCases(); - MM_Mem32_Test_AddTestCases(); - MM_Dump_Test_AddTestCases(); - MM_Utils_Test_AddTestCases(); - - return(UtTest_Run()); -} /* end main */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_utils.c.gcov b/fsw/unit_test/mm_utils.c.gcov deleted file mode 100644 index d2e5013..0000000 --- a/fsw/unit_test/mm_utils.c.gcov +++ /dev/null @@ -1,334 +0,0 @@ - -: 0:Source:../src/mm_utils.c - -: 0:Programs:7 - -: 1:/************************************************************************* - -: 2:** File: - -: 3:** $Id: mm_utils.c.gcov 1.3 2016/10/31 22:11:25EDT mdeschu Exp $ - -: 4:** - -: 5:** Copyright © 2007-2014 United States Government as represented by the - -: 6:** Administrator of the National Aeronautics and Space Administration. - -: 7:** All Other Rights Reserved. - -: 8:** - -: 9:** This software was created at NASA's Goddard Space Flight Center. - -: 10:** This software is governed by the NASA Open Source Agreement and may be - -: 11:** used, distributed and modified only pursuant to the terms of that - -: 12:** agreement. - -: 13:** - -: 14:** Purpose: - -: 15:** Utility functions used for processing CFS memory manager commands - -: 16:** - -: 17:** $Log: mm_utils.c.gcov $ - -: 17:** Revision 1.3 2016/10/31 22:11:25EDT mdeschu - -: 17:** Update gcov results for 2.4.1 MM - -: 18:** Revision 1.2 2016/10/30 00:48:49EDT mdeschu - -: 19:** Use c-style casts to clean up compiler warnings in calls to CFE_EVS_SendEvent - -: 20:** Revision 1.1 2015/07/28 12:22:04EDT rperera - -: 21:** Initial revision - -: 22:** Member added to project /CFS-APPs-PROJECT/mm/fsw/src/project.pj - -: 23:** Revision 1.11 2015/03/20 14:16:35EDT lwalling - -: 24:** Add last peek/poke/fill command data value to housekeeping telemetry - -: 25:** Revision 1.10 2015/03/02 14:27:10EST sstrege - -: 26:** Added copyright information - -: 27:** Revision 1.9 2010/11/29 13:35:17EST jmdagost - -: 28:** Replaced ifdef tests with if-true tests. - -: 29:** Revision 1.8 2009/06/18 10:17:09EDT rmcgraw - -: 30:** DCR8291:1 Changed OS_MEM_ #defines to CFE_PSP_MEM_ - -: 31:** Revision 1.7 2009/06/12 14:37:28EDT rmcgraw - -: 32:** DCR82191:1 Changed OS_Mem function calls to CFE_PSP_Mem - -: 33:** Revision 1.6 2008/09/05 14:24:12EDT dahardison - -: 34:** Updated references to local HK variables - -: 35:** Revision 1.5 2008/09/05 12:33:08EDT dahardison - -: 36:** Modified the MM_VerifyCmdLength routine to issue a special error event message and - -: 37:** not increment the command error counter if a housekeeping request is received - -: 38:** with a bad command length - -: 39:** Revision 1.4 2008/05/22 15:13:56EDT dahardison - -: 40:** Changed inclusion of cfs_lib.h to cfs_utils.h - -: 41:** Revision 1.3 2008/05/19 15:23:35EDT dahardison - -: 42:** Version after completion of unit testing - -: 43:** - -: 44:*************************************************************************/ - -: 45: - -: 46:/************************************************************************* - -: 47:** Includes - -: 48:*************************************************************************/ - -: 49:#include "mm_app.h" - -: 50:#include "mm_utils.h" - -: 51:#include "mm_perfids.h" - -: 52:#include "mm_msgids.h" - -: 53:#include "mm_events.h" - -: 54:#include "cfs_utils.h" - -: 55:#include - -: 56: - -: 57:/************************************************************************* - -: 58:** External Data - -: 59:*************************************************************************/ - -: 60:extern MM_AppData_t MM_AppData; - -: 61: - -: 62:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 63:/* */ - -: 64:/* Reset the local housekeeping variables to default parameters */ - -: 65:/* */ - -: 66:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 18: 67:void MM_ResetHk(void) - -: 68:{ - -: 69: - 18: 70: MM_AppData.LastAction = MM_NOACTION; - 18: 71: MM_AppData.MemType = MM_NOMEMTYPE; - 18: 72: MM_AppData.Address = MM_CLEAR_ADDR; - 18: 73: MM_AppData.DataValue = MM_CLEAR_PATTERN; - 18: 74: MM_AppData.BytesProcessed = 0; - 18: 75: MM_AppData.FileName[0] = MM_CLEAR_FNAME; - -: 76: - 18: 77: return; - -: 78: - -: 79:} /* end MM_ResetHk */ - -: 80: - -: 81:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 82:/* */ - -: 83:/* Process a load, dump, or fill segment break */ - -: 84:/* */ - -: 85:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 11: 86:void MM_SegmentBreak(void) - -: 87:{ - -: 88: /* - -: 89: ** Performance Log entry stamp - -: 90: */ - 11: 91: CFE_ES_PerfLogEntry(MM_SEGBREAK_PERF_ID); - -: 92: - -: 93: /* - -: 94: ** Give something else the chance to run - -: 95: */ - 11: 96: OS_TaskDelay(MM_PROCESSOR_CYCLE); - -: 97: - -: 98: /* - -: 99: ** Performance Log exit stamp - -: 100: */ - 11: 101: CFE_ES_PerfLogExit(MM_SEGBREAK_PERF_ID); - -: 102: - 11: 103: return; - -: 104: - -: 105:} /* End of MM_SegmentBreak */ - -: 106: - -: 107:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 108:/* */ - -: 109:/* Verify command packet length */ - -: 110:/* */ - -: 111:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 68: 112:boolean MM_VerifyCmdLength(CFE_SB_MsgPtr_t msg, - -: 113: uint16 ExpectedLength) - -: 114:{ - 68: 115: boolean result = TRUE; - -: 116: uint16 CommandCode; - -: 117: uint16 ActualLength; - -: 118: CFE_SB_MsgId_t MessageID; - -: 119: - -: 120: /* - -: 121: ** Verify the message packet length... - -: 122: */ - 68: 123: ActualLength = CFE_SB_GetTotalMsgLength(msg); - 68: 124: if (ExpectedLength != ActualLength) - -: 125: { - 2: 126: MessageID = CFE_SB_GetMsgId(msg); - 2: 127: CommandCode = CFE_SB_GetCmdCode(msg); - -: 128: - 2: 129: if (MessageID == MM_SEND_HK_MID) - -: 130: { - -: 131: /* - -: 132: ** For a bad HK request, just send the event. We only increment - -: 133: ** the error counter for ground commands and not internal messages. - -: 134: */ - 1: 135: CFE_EVS_SendEvent(MM_HKREQ_LEN_ERR_EID, CFE_EVS_ERROR, - -: 136: "Invalid HK request msg length: ID = 0x%04X, CC = %d, Len = %d, Expected = %d", - -: 137: MessageID, CommandCode, ActualLength, ExpectedLength); - -: 138: } - -: 139: else - -: 140: { - 1: 141: CFE_EVS_SendEvent(MM_LEN_ERR_EID, CFE_EVS_ERROR, - -: 142: "Invalid msg length: ID = 0x%04X, CC = %d, Len = %d, Expected = %d", - -: 143: MessageID, CommandCode, ActualLength, ExpectedLength); - 1: 144: MM_AppData.ErrCounter++; - -: 145: } - -: 146: - 2: 147: result = FALSE; - -: 148: } - -: 149: - 68: 150: return(result); - -: 151: - -: 152:} /* End of MM_VerifyCmdLength */ - -: 153: - -: 154:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -: 155:/* */ - -: 156:/* Verify peek and poke command parameters */ - -: 157:/* */ - -: 158:/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - 22: 159:boolean MM_VerifyPeekPokeParams(uint32 Address, - -: 160: uint8 MemType, - -: 161: uint8 SizeInBits) - -: 162:{ - 22: 163: boolean Valid = TRUE; - -: 164: uint8 SizeInBytes; - -: 165: int32 OS_Status; - -: 166: - 22: 167: switch(SizeInBits) - -: 168: { - -: 169: case MM_BYTE_BIT_WIDTH: - 9: 170: SizeInBytes = 1; - 9: 171: break; - -: 172: - -: 173: case MM_WORD_BIT_WIDTH: - 3: 174: SizeInBytes = 2; - 3: 175: if (CFS_Verify16Aligned(Address, SizeInBytes) != TRUE) - -: 176: { - 1: 177: Valid = FALSE; - 1: 178: MM_AppData.ErrCounter++; - 1: 179: CFE_EVS_SendEvent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, - -: 180: "Data and address not 16 bit aligned: Addr = 0x%08X Size = %d", - -: 181: (unsigned int)Address, SizeInBytes); - -: 182: - -: 183: - -: 184: } - 3: 185: break; - -: 186: - -: 187: case MM_DWORD_BIT_WIDTH: - 7: 188: SizeInBytes = 4; - 7: 189: if (CFS_Verify32Aligned(Address, SizeInBytes) != TRUE) - -: 190: { - 1: 191: Valid = FALSE; - 1: 192: MM_AppData.ErrCounter++; - 1: 193: CFE_EVS_SendEvent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, - -: 194: "Data and address not 32 bit aligned: Addr = 0x%08X Size = %d", - -: 195: (unsigned int)Address, SizeInBytes); - -: 196: } - 7: 197: break; - -: 198: - -: 199: default: - 3: 200: Valid = FALSE; - 3: 201: MM_AppData.ErrCounter++; - 3: 202: CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - -: 203: "Data size in bits invalid: Data Size = %d", SizeInBits); - -: 204: break; - -: 205: } - -: 206: - -: 207: /* Do other checks if this one passed */ - 22: 208: if (Valid == TRUE) - -: 209: { - 17: 210: switch(MemType) - -: 211: { - -: 212: case MM_RAM: - 4: 213: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 214: - 4: 215: if (OS_Status != OS_SUCCESS) - -: 216: { - 1: 217: Valid = FALSE; - 1: 218: MM_AppData.ErrCounter++; - 1: 219: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 220: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 221: (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 222: } - 4: 223: break; - -: 224: - -: 225: case MM_EEPROM: - 3: 226: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 227: - 3: 228: if (OS_Status != OS_SUCCESS) - -: 229: { - 1: 230: Valid = FALSE; - 1: 231: MM_AppData.ErrCounter++; - 1: 232: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 233: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 234: (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_EEPROM); - -: 235: } - 3: 236: break; - -: 237: - -: 238:#if (MM_OPT_CODE_MEM32_MEMTYPE == TRUE) - -: 239: case MM_MEM32: - 3: 240: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 241: - 3: 242: if (OS_Status != OS_SUCCESS) - -: 243: { - 1: 244: Valid = FALSE; - 1: 245: MM_AppData.ErrCounter++; - 1: 246: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 247: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 248: (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 249: } - -: 250: /* - -: 251: ** Peeks and Pokes must be 32 bits wide for this memory type - -: 252: */ - 2: 253: else if (SizeInBytes != 4) - -: 254: { - 1: 255: Valid = FALSE; - 1: 256: MM_AppData.ErrCounter++; - 1: 257: CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - -: 258: "Data size in bits invalid: Data Size = %d", SizeInBits); - -: 259: } - 3: 260: break; - -: 261:#endif /* MM_OPT_CODE_MEM32_MEMTYPE */ - -: 262: - -: 263:#if (MM_OPT_CODE_MEM16_MEMTYPE == TRUE) - -: 264: case MM_MEM16: - 3: 265: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 266: - 3: 267: if (OS_Status != OS_SUCCESS) - -: 268: { - 1: 269: Valid = FALSE; - 1: 270: MM_AppData.ErrCounter++; - 1: 271: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 272: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 273: (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 274: } - -: 275: /* - -: 276: ** Peeks and Pokes must be 16 bits wide for this memory type - -: 277: */ - 2: 278: else if (SizeInBytes != 2) - -: 279: { - 1: 280: Valid = FALSE; - 1: 281: MM_AppData.ErrCounter++; - 1: 282: CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - -: 283: "Data size in bits invalid: Data Size = %d", SizeInBits); - -: 284: } - 3: 285: break; - -: 286:#endif /* MM_OPT_CODE_MEM16_MEMTYPE */ - -: 287: - -: 288:#if (MM_OPT_CODE_MEM8_MEMTYPE == TRUE) - -: 289: case MM_MEM8: - 3: 290: OS_Status = CFE_PSP_MemValidateRange(Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 291: - 3: 292: if (OS_Status != OS_SUCCESS) - -: 293: { - 1: 294: Valid = FALSE; - 1: 295: MM_AppData.ErrCounter++; - 1: 296: CFE_EVS_SendEvent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, - -: 297: "CFE_PSP_MemValidateRange error received: RC = 0x%08X Addr = 0x%08X Size = %d MemType = %d", - -: 298: (unsigned int)OS_Status, (unsigned int)Address, SizeInBytes, CFE_PSP_MEM_RAM); - -: 299: } - -: 300: /* - -: 301: ** Peeks and Pokes must be 8 bits wide for this memory type - -: 302: */ - 2: 303: else if (SizeInBytes != 1) - -: 304: { - 1: 305: Valid = FALSE; - 1: 306: MM_AppData.ErrCounter++; - 1: 307: CFE_EVS_SendEvent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, - -: 308: "Data size in bits invalid: Data Size = %d", SizeInBits); - -: 309: } - 3: 310: break; - -: 311:#endif /* MM_OPT_CODE_MEM8_MEMTYPE */ - -: 312: - -: 313: default: - 1: 314: Valid = FALSE; - 1: 315: MM_AppData.ErrCounter++; - 1: 316: CFE_EVS_SendEvent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, - -: 317: "Invalid memory type specified: MemType = %d", MemType); - -: 318: break; - -: 319: - -: 320: } /* end switch */ - -: 321: - -: 322: } /* end Valid == TRUE if */ - -: 323: - 22: 324: return (Valid); - -: 325: - -: 326:} /* end MM_VerifyPeekPokeParams */ - -: 327: - -: 328:/************************/ - -: 329:/* End of File Comment */ - -: 330:/************************/ diff --git a/fsw/unit_test/mm_utils_test.c b/fsw/unit_test/mm_utils_test.c deleted file mode 100644 index d48ba59..0000000 --- a/fsw/unit_test/mm_utils_test.c +++ /dev/null @@ -1,552 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_utils_test.c 1.4.1.1 2016/11/17 16:39:10EST sstrege Exp $ - ** - ** Purpose: - ** This file contains unit test cases for the functions contained in the file mm_utils.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_utils_test.c $ - ** Revision 1.4.1.1 2016/11/17 16:39:10EST sstrege - ** - ** Revision 1.5 2016/11/17 12:51:16EST mdeschu - ** Remove references to temporary header file mm_test_exports.h - ** Revision 1.4 2016/10/24 18:35:24EDT czogby - ** Code Walkthough Updates - ** Revision 1.3 2016/05/04 19:01:14EDT czogby - ** Update MM to Compile With New UT-Assert PSP Files - ** Revision 1.2 2016/03/04 20:00:58EST czogby - ** Need Temporary Header File to Import Some MM Functions Into Unit Tests - ** Revision 1.1 2016/02/03 17:11:38EST czogby - ** Initial revision - ** Member added to project /CFS-APPs-PROJECT/mm/fsw/unit_test/project.pj - *************************************************************************/ - -/* - * Includes - */ - -#include "mm_utils_test.h" -#include "mm_utils.h" -#include "mm_msg.h" -#include "mm_msgdefs.h" -#include "mm_msgids.h" -#include "mm_events.h" -#include "mm_filedefs.h" -#include "mm_version.h" -#include "mm_test_utils.h" -#include "ut_osapi_stubs.h" -#include "ut_cfe_sb_stubs.h" -#include "ut_cfe_es_stubs.h" -#include "ut_cfe_es_hooks.h" -#include "ut_cfe_evs_stubs.h" -#include "ut_cfe_evs_hooks.h" -#include "ut_cfe_time_stubs.h" -#include "ut_cfe_psp_memutils_stubs.h" -#include "ut_cfe_psp_memrange_stubs.h" -#include "ut_cfe_tbl_stubs.h" -#include "ut_cfe_fs_stubs.h" -#include "ut_cfe_time_stubs.h" -#include -#include -#include - -/* - * Function Definitions - */ - -void MM_ResetHk_Test (void) -{ - MM_AppData.LastAction = 1; - MM_AppData.MemType = 2; - MM_AppData.Address = 3; - MM_AppData.DataValue = 4; - MM_AppData.BytesProcessed = 5; - MM_AppData.FileName[0] = 6; - - /* Execute the function being tested */ - MM_ResetHk(); - - /* Verify results */ - UtAssert_True (MM_AppData.LastAction == MM_NOACTION, "MM_AppData.LastAction == MM_NOACTION"); - UtAssert_True (MM_AppData.MemType == MM_NOMEMTYPE, "MM_AppData.MemType == MM_NOMEMTYPE"); - UtAssert_True (MM_AppData.Address == MM_CLEAR_ADDR, "MM_AppData.Address == MM_CLEAR_ADDR"); - UtAssert_True (MM_AppData.DataValue == MM_CLEAR_PATTERN, "MM_AppData.DataValue == MM_CLEAR_PATTERN"); - UtAssert_True (MM_AppData.BytesProcessed == 0, "MM_AppData.BytesProcessed == 0"); - UtAssert_True (MM_AppData.FileName[0] == MM_CLEAR_FNAME, "MM_AppData.FileName[0] == MM_CLEAR_FNAME"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_ResetHk_Test */ - -void MM_VerifyCmdLength_Test_Nominal (void) -{ - boolean Result; - uint16 ExpectedLength = 80; - MM_PeekCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PeekCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_PEEK_CC); - - /* Execute the function being tested */ - Result = MM_VerifyCmdLength((CFE_SB_MsgPtr_t)(&CmdPacket), ExpectedLength); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyCmdLength_Test_Nominal */ - -void MM_VerifyCmdLength_Test_HKRequestLengthError (void) -{ - boolean Result; - uint16 ExpectedLength = 99; - MM_PeekCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PeekCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_PEEK_CC); - - /* Set to satisfy condition "MessageID == MM_SEND_HK_MID" */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, MM_SEND_HK_MID, 1); - - /* Execute the function being tested */ - Result = MM_VerifyCmdLength((CFE_SB_MsgPtr_t)(&CmdPacket), ExpectedLength); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_HKREQ_LEN_ERR_EID, CFE_EVS_ERROR, "Invalid HK request msg length: ID = 0x1889, CC = 2, Len = 80, Expected = 99"), - "Invalid HK request msg length: ID = 0x1889, CC = 2, Len = 80, Expected = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyCmdLength_Test_HKRequestLengthError */ - -void MM_VerifyCmdLength_Test_LengthError (void) -{ - boolean Result; - uint16 ExpectedLength = 99; - MM_PeekCmd_t CmdPacket; - - CFE_SB_InitMsg (&CmdPacket, MM_CMD_MID, sizeof(MM_PeekCmd_t), TRUE); - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t)&CmdPacket, MM_PEEK_CC); - - /* Set to fail condition "MessageID == MM_SEND_HK_MID" */ - Ut_CFE_SB_SetReturnCode(UT_CFE_SB_GETMSGID_INDEX, 5, 1); - - /* Execute the function being tested */ - Result = MM_VerifyCmdLength((CFE_SB_MsgPtr_t)(&CmdPacket), ExpectedLength); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_LEN_ERR_EID, CFE_EVS_ERROR, "Invalid msg length: ID = 0x0005, CC = 2, Len = 80, Expected = 99"), - "Invalid msg length: ID = 0x0005, CC = 2, Len = 80, Expected = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyCmdLength_Test_LengthError */ - -void MM_VerifyPeekPokeParams_Test_ByteWidthRAM (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint8 SizeInBits = 8; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyPeekPokeParams_Test_ByteWidthRAM */ - -void MM_VerifyPeekPokeParams_Test_WordWidthMEM16 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint8 SizeInBits = 16; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyPeekPokeParams_Test_WordWidthMEM16 */ - -void MM_VerifyPeekPokeParams_Test_DWordWidthMEM32 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint8 SizeInBits = 32; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyPeekPokeParams_Test_DWordWidthMEM32 */ - -void MM_VerifyPeekPokeParams_Test_WordWidthAlignmentError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM16; - uint8 SizeInBits = 16; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN16_ERR_EID, CFE_EVS_ERROR, "Data and address not 16 bit aligned: Addr = 0x00000001 Size = 2"), - "Data and address not 16 bit aligned: Addr = 0x00000001 Size = 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_WordWidthAlignmentError */ - -void MM_VerifyPeekPokeParams_Test_DWordWidthAlignmentError (void) -{ - boolean Result; - uint32 Address = 1; - uint8 MemType = MM_MEM32; - uint8 SizeInBits = 32; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_ALIGN32_ERR_EID, CFE_EVS_ERROR, "Data and address not 32 bit aligned: Addr = 0x00000001 Size = 4"), - "Data and address not 32 bit aligned: Addr = 0x00000001 Size = 4"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_DWordWidthAlignmentError */ - -void MM_VerifyPeekPokeParams_Test_EEPROM (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint8 SizeInBits = 8; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyPeekPokeParams_Test_EEPROM */ - -void MM_VerifyPeekPokeParams_Test_MEM8 (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint8 SizeInBits = 8; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == TRUE, "Result == TRUE"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 0, "Ut_CFE_EVS_GetEventQueueDepth() == 0"); - -} /* end MM_VerifyPeekPokeParams_Test_MEM8 */ - -void MM_VerifyPeekPokeParams_Test_RAMValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_RAM; - uint8 SizeInBits = 8; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_RAMValidateRangeError */ - -void MM_VerifyPeekPokeParams_Test_EEPROMValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_EEPROM; - uint8 SizeInBits = 8; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 2"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_EEPROMValidateRangeError */ - -void MM_VerifyPeekPokeParams_Test_MEM32ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint8 SizeInBits = 32; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 4 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_MEM32ValidateRangeError */ - -void MM_VerifyPeekPokeParams_Test_MEM16ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint8 SizeInBits = 16; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 2 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_MEM16ValidateRangeError */ - -void MM_VerifyPeekPokeParams_Test_MEM8ValidateRangeError (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint8 SizeInBits = 8; - - /* Set to generate error message MM_OS_MEMVALIDATE_ERR_EID */ - Ut_CFE_PSP_MEMRANGE_SetReturnCode(UT_CFE_PSP_MEMRANGE_MEMVALIDATERANGE_INDEX, -1, 1); - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_OS_MEMVALIDATE_ERR_EID, CFE_EVS_ERROR, "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"), - "CFE_PSP_MemValidateRange error received: RC = 0xFFFFFFFF Addr = 0x00000000 Size = 1 MemType = 1"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_MEM8ValidateRangeError */ - -void MM_VerifyPeekPokeParams_Test_InvalidDataSize (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint8 SizeInBits = 55; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, "Data size in bits invalid: Data Size = 55"), - "Data size in bits invalid: Data Size = 55"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_InvalidDataSize */ - -void MM_VerifyPeekPokeParams_Test_MEM32InvalidDataSize (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM32; - uint8 SizeInBits = 8; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, "Data size in bits invalid: Data Size = 8"), - "Data size in bits invalid: Data Size = 8"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_MEM32InvalidDataSize */ - -void MM_VerifyPeekPokeParams_Test_MEM16InvalidDataSize (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM16; - uint8 SizeInBits = 8; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, "Data size in bits invalid: Data Size = 8"), - "Data size in bits invalid: Data Size = 8"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_MEM16InvalidDataSize */ - -void MM_VerifyPeekPokeParams_Test_MEM8InvalidDataSize (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = MM_MEM8; - uint8 SizeInBits = 32; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_DATA_SIZE_BITS_ERR_EID, CFE_EVS_ERROR, "Data size in bits invalid: Data Size = 32"), - "Data size in bits invalid: Data Size = 32"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_MEM8InvalidDataSize */ - -void MM_VerifyPeekPokeParams_Test_InvalidMemType (void) -{ - boolean Result; - uint32 Address = 0; - uint8 MemType = 99; - uint8 SizeInBits = 8; - - /* Execute the function being tested */ - Result = MM_VerifyPeekPokeParams(Address, MemType, SizeInBits); - - /* Verify results */ - UtAssert_True (Result == FALSE, "Result == FALSE"); - UtAssert_True (MM_AppData.ErrCounter == 1, "MM_AppData.ErrCounter == 1"); - - UtAssert_True - (Ut_CFE_EVS_EventSent(MM_MEMTYPE_ERR_EID, CFE_EVS_ERROR, "Invalid memory type specified: MemType = 99"), - "Invalid memory type specified: MemType = 99"); - - UtAssert_True (Ut_CFE_EVS_GetEventQueueDepth() == 1, "Ut_CFE_EVS_GetEventQueueDepth() == 1"); - -} /* end MM_VerifyPeekPokeParams_Test_InvalidMemType */ - -void MM_Utils_Test_AddTestCases(void) -{ - UtTest_Add(MM_ResetHk_Test, MM_Test_Setup, MM_Test_TearDown, "MM_ResetHk_Test"); - /* MM_SegmentBreak: Nothing to test, and code already covered by other tests */ - - UtTest_Add(MM_VerifyCmdLength_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyCmdLength_Test_Nominal"); - UtTest_Add(MM_VerifyCmdLength_Test_HKRequestLengthError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyCmdLength_Test_HKRequestLengthError"); - UtTest_Add(MM_VerifyCmdLength_Test_LengthError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyCmdLength_Test_LengthError"); - - UtTest_Add(MM_VerifyPeekPokeParams_Test_ByteWidthRAM, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_ByteWidthRAM"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_WordWidthMEM16, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_WordWidthMEM16"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_DWordWidthMEM32, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_DWordWidthMEM32"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_WordWidthAlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_WordWidthAlignmentError"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_DWordWidthAlignmentError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_DWordWidthAlignmentError"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_InvalidDataSize, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_InvalidDataSize"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_EEPROM, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_EEPROM"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_MEM8, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_MEM8"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_RAMValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_RAMValidateRangeError"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_EEPROMValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_EEPROMValidateRangeError"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_MEM32ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_MEM32ValidateRangeError"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_MEM32InvalidDataSize, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_MEM32InvalidDataSize"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_MEM16ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_MEM16ValidateRangeError"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_MEM16InvalidDataSize, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_MEM16InvalidDataSize"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_MEM8ValidateRangeError, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_MEM8ValidateRangeError"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_MEM8InvalidDataSize, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_MEM8InvalidDataSize"); - UtTest_Add(MM_VerifyPeekPokeParams_Test_InvalidMemType, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyPeekPokeParams_Test_InvalidMemType"); -} /* end MM_Utils_Test_AddTestCases */ - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/fsw/unit_test/mm_utils_test.h b/fsw/unit_test/mm_utils_test.h deleted file mode 100644 index d1dfe32..0000000 --- a/fsw/unit_test/mm_utils_test.h +++ /dev/null @@ -1,34 +0,0 @@ - /************************************************************************* - ** File: - ** $Id: mm_utils_test.h 1.3 2016/03/03 21:24:59EST czogby Exp $ - ** - ** Purpose: - ** This file contains the function prototypes for the unit test cases for mm_utils_test.c - ** - ** References: - ** Flight Software Branch C Coding Standard Version 1.2 - ** CFS Development Standards Document - ** Notes: - ** - ** $Log: mm_utils_test.h $ - ** Revision 1.3 2016/03/03 21:24:59EST czogby - ** Add Integrity headers to all unit testl .h files - *************************************************************************/ - -/* - * Includes - */ - -#include "utassert.h" -#include "uttest.h" - -/* - * Function Prototypes - */ - -void MM_Utils_Test_AddTestCases(void); - - -/************************/ -/* End of File Comment */ -/************************/ diff --git a/mm_doxygen_config.txt b/mm_doxygen_config.txt new file mode 100644 index 0000000..ad05f5f --- /dev/null +++ b/mm_doxygen_config.txt @@ -0,0 +1,2575 @@ +# Doxyfile 1.8.16 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "cFS_MM" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. +PROJECT_BRIEF = + + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = cfs_mm_user_guide + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) + +ALIASES += "event=\xrefitem mmevents \"Event Message\" \"MM Event Message Cross Reference\" " \ + "mmcfg=\xrefitem cfsmmcfg \"Purpose\" \"MM Configuration Parameters\" " \ + "mmcmd=\xrefitem cfsmmcmds \"Purpose\" \"MM Command Reference\" " \ + "mmtlm=\xrefitem cfsmmtlm \"Purpose\" \"MM Telemetry Reference\" " \ + "mmtlmmnemonic=\xrefitem mmtlmmnems \"Telemetry Mnemonic(s)\" \"MM Telemetry Mnemonic Cross Reference\" " + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is +# Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# (including Cygwin) ands Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# The default value is: NO. + +WARN_NO_PARAMDOC = YES + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = fsw/ + +INPUT += docs/dox_src/users_guide + +INPUT += docs/dox_src/mnem_maps + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = unit_test + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = docs/dox_src/users_guide + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = readme.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files +# were built. This is equivalent to specifying the "-p" option to a clang tool, +# such as clang-check. These options will then be passed to the parser. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/xcode/), introduced with OSX +# 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /