diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a334603..f0d128ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,5 @@ project(CFS_CF C) -include_directories(fsw/src) -include_directories(fsw/mission_inc) -include_directories(fsw/platform_inc) include_directories(${CFS_IO_LIB_MISSION_DIR}/fsw/public_inc) set(APP_SRC_FILES @@ -24,6 +21,9 @@ set(APP_SRC_FILES # Create the app module add_cfe_app(cf ${APP_SRC_FILES}) +# This permits direct access to public headers in the fsw/inc directory +target_include_directories(cf PUBLIC fsw/inc) + # configuration table add_cfe_tables(cf fsw/tables/cf_def_config.c) diff --git a/README.md b/README.md index 805ff15a..0c8a8f6d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -#core Flight System (cFS) CFDP Application (CF) +# core Flight System (cFS) CFDP Application (CF) ## Introduction diff --git a/docs/cf_FunctionalRequirements.csv b/docs/cf_FunctionalRequirements.csv index a0a4bd66..cc294896 100644 --- a/docs/cf_FunctionalRequirements.csv +++ b/docs/cf_FunctionalRequirements.csv @@ -10,15 +10,16 @@ CF2000,CF2000,"When CF receives a CFDP receive-file protocol-directive PDU, CF s CF2001,CF2001,CF shall extract uplinked CFDP PDUs from cFE-SB messages.,CF application is a cFS compliant component that must implement the cFS architectural patterns CF2002,CF2002,CF shall extract file data from File-Data PDUs and reconstruct an identical copy of the extracted file from the meta-data-specified directory.,Basic CFDP function with fault handling defined in sub requirements CF2002.1,CF2002.1,"If CF detects that a ""fault"" has occurred, CF shall close out the transaction and issue an ""Error"" cFE event message.","For robust and secure operations, errors in execution must be detected and handled with appropriate constraints on resource use and state machine iterations. ""Close out"" is intentionally vague since the action needs to be appropriate for the transmission class. As long as the transaction doesn't hang and become stale the requirement is met. Note ""cancel"" is overly specific, there's a cancel transaction command that is different than what is done here." -CF2002.1.2,CF2002.1.2,"CF shall detect the following scenarios and identify them as faults: -1. Positive Ack Limit Reached -2. Filestore Rejection -3. File-CRC Mismatch Failure -4. File-Size Error -5. NAK Limit Reached +CF2002.1.2,CF2002.1.2,"CF shall detect the following scenarios and identify them as faults: +1. Positive Ack Limit Reached +2. Filestore Rejection +3. File-CRC Mismatch Failure +4. File-Size Error +5. NAK Limit Reached 6. Inactivity Limit Reached",Fault scenarios explicitly listed and tested for specification compliance. CF3000,CF3000,"When CF receives a ""Transfer File"" command, CF shall play back the file indicated by the command-specified: filename, source path, destination path, keep/delete flag, service class, priority, channel, and peer-entity id. ","Also referred to as ""playback file"" command. Basic function of file transfer required to operate cFS flight systems. " CF3000.1,CF3000.1,"When CF receives a ""Transfer File"" command, if the command-specified is open, CF reject the command.",Open files are in a uncertain state and may change during transfer potential containing erroneous data or cause other undefined behaviors +CF3000.2,CF3000.2, CF3000.3,CF3000.3,"When CF receives a ""Transfer File"" command, if the command-specified file is not found, CF shall reject the command.","For robust and secure operations, command must be validated prior to execution. Provides operational interface as to why the command was not executed." CF3000.4,CF3000.4,"When CF receives a ""Transfer File"" command, if the playback-pending queue is full, CF shall reject the command.","For robust and secure operations, command must be validated prior to execution. Provides operational interface as to why the command was not executed. Filterable is required to avoid multiple events when commands are sequenced." CF3000.5,CF3000.5,"When CF receives a ""Transfer File"" command, if the command-specified playback-channel number is not valid, CF shall reject the command.","For robust and secure operations, command must be validated prior to execution" @@ -33,37 +34,38 @@ CF3005,CF3005,CF shall encapsulate and publish CFDP-PDUs as cFE-SB messages.,CF CF3005.1,CF3005.1,Each CF channel shall have a unique cFE-SB Message ID.,"Playback channels may have different message routes to destination. In cFS, the Message ID provides that routing identifier. Unique cFE-SB Message IDs can avoid data corruption and memory problems. " CF3005.1.1,CF3005.1.1,The CF-channel cFE-SB Message IDs shall be specified in a CF configuration table.,"Run-time configuration table supports ease of deployment, operation maintenance, fault management, and data path configuration." CF3006,CF3006,The PDU output rate shall be controllable from outside the CF Application.,"As a data source in a real-time resourced constrained system, CF must not send more data than the receiver can reliably process or forward" -CF3007,CF3007,"While there are multiple transactions in the playback-pending queue for a given channel, CF shall wait for the ""EOF Sent"" marker on the file currently being played back before starting playback for the next file in the queue. ","Provides predictable file-in-order delivery. This does not imply that the ""EOF Sent"" has been acknowledged by the receiving peer entity. - +CF3007,CF3007,"While there are multiple transactions in the playback-pending queue for a given channel, CF shall wait for the ""EOF Sent"" marker on the file currently being played back before starting playback for the next file in the queue. ","Provides predictable file-in-order delivery. This does not imply that the ""EOF Sent"" has been acknowledged by the receiving peer entity. + Although CCSDS 3.1.2 says ""The CFDP entity shall be implemented such that virtually any number of transactions may be concurrently in various stages of transmission or reception at a single CFDP entity."" this number must be constrained for performance." CF3008,CF3008,"While there is no playback in progress, CF shall check the playback-pending channel queue for files at the configuration-table-defied frequency.",Supports automation of playback queuing CF3009,CF3009,The CF channel playback-pending-queue depth shall be configurable.,Supports recovery of file transfer operations to a known configuration and state CF3010,CF3010,The CF file-transfer history-queue depth shall be configurable.,Operational interface to support user knowledge of which files have been transferred and in what order. CF4000,CF4000,The number of CF channels shall be defined by a CF configuration table.,Table-defined configurations support cFS architecture goals of scalability and reconfiguration of mission variability points CF4000.1,CF4000.1,CF-channel parameters shall be defined by a CF configuration table.,Table-defined configurations support cFS architecture goals of scalability and reconfiguration of mission variability points -CF4000.1.1,CF4000.1.1,"The ""CF Configuration Table"" shall include the following parameters: --- Engine parameter(s) -1. Local entity ID --- Channel parameters (per-channel) -2. Dequeue Enable -3. Transmit PDU MID -4. Receive PDU MID -5. Handshake Semaphore Name -6. Acknowledge timer limit -7. Non-acknowledge timer limit -8. Acknowledge retry limit -9. Non-acknowledge retry limit -10. Inactivity timer limit --- Polling Directory Parameters (per-polling directory) -11. Enable State -12. CFDP Class -13. Priority -14. Source Path -15. Destination Path +CF4000.1.1,CF4000.1.1,"The ""CF Configuration Table"" shall include the following parameters: +-- Engine parameter(s) +1. Local entity ID +-- Channel parameters (per-channel) +2. Dequeue Enable +3. Transmit PDU MID +4. Receive PDU MID +5. Handshake Semaphore Name +6. Acknowledge timer limit +7. Non-acknowledge timer limit +8. Acknowledge retry limit +9. Non-acknowledge retry limit +10. Inactivity timer limit +-- Polling Directory Parameters (per-polling directory) +11. Enable State +12. CFDP Class +13. Priority +14. Source Path +15. Destination Path 16. Peer Entity Id","Engine, channel, and polling directory configuration parameters for operational flexibility." -CF4000.2,CF4000.2,Each CF channel shall have a dedicated and independent pending queue. ,"Playback channels should be independent to avoid one channels from stalling another channel. - +CF4000.2,CF4000.2,Each CF channel shall have a dedicated and independent pending queue. ,"Playback channels should be independent to avoid one channels from stalling another channel. + The channel dictates the SB MsgId / Apid that the playback data PDUs will be generated with. Separate queues also helps when the one channel is throttled - e.g. if there are two channels and one is slow and one is faster, a playback requests to the slow channel may block the faster channel if they shared a single pending queue." +CF4000.3,CF4000.3 CF4001,CF4001,"When CF receives an ""Enable Polling"" command, CF shall enable poll-directory processing.",Operational interface CF4001.1,CF4001.1,CF Polling Directories shall be polled for files at the configuration-table-defined frequency.,Operational interface to support optimization of resource utilization and file transfer bandwidth CF4001.2.1,CF4001.2.1,CF shall send all files in the polling directory at the configuration-table-specified priority level.,Operational interface for resource management @@ -73,30 +75,33 @@ CF5000.1,CF5000.1,"When CF receives a ""Freeze Channel"" command, CF shall pause CF5000.2,CF5000.2,"While a channel is frozen, when a new transaction is received for that channel, CF shall not process that transaction.",A frozen channel cannot receive new transactions CF5001,CF5001,"When CF receives a ""Thaw Channel"" command, CF shall re-enable the command-specified channel.",Operational Interface CF5001.1,CF5001.1,"When CF receives a ""Thaw Channel"" command, CF shall resume processing all paused transactions for the command-specified channel.","Operational interface that resumes all transactions at their current state. (timers, suspend,…) Typical used for contact scheduling" -CF5002,CF5002,"The following parameters shall be configurable by a CF command: -1. CFDP channel Ack-Timer Value (seconds) -2. CFDP channel NAK-Timer Value (seconds) -3. CFDP channel Inactivity-Timeout Value (seconds) -4. CFDP channel Maximum Ack Timeouts (integer counts) -5. CFDP channel Maximum NAK Timeouts (integer counts)","Operational interface to support mission variability and reconfiguration +CF5002,CF5002,"The following parameters shall be configurable by a CF command: +1. CFDP channel Ack-Timer Value (seconds) +2. CFDP channel NAK-Timer Value (seconds) +3. CFDP channel Inactivity-Timeout Value (seconds) +4. CFDP channel Maximum Ack Timeouts (integer counts) +5. CFDP channel Maximum NAK Timeouts (integer counts)","Operational interface to support mission variability and reconfiguration " -CF5002.1,CF5002.1,"The default values for the CFDP channel protocol parameters below shall be defined by a CF Configuration Table: -1. CFDP channel Ack-Timer Value (seconds) -2. CFDP channel NAK-Timer Value (seconds) -3. CFDP channel Inactivity-Timeout Value (seconds) -4. CFDP channel Maximum Ack Timeouts (integer counts) +CF5002.1,CF5002.1,"The default values for the CFDP channel protocol parameters below shall be defined by a CF Configuration Table: +1. CFDP channel Ack-Timer Value (seconds) +2. CFDP channel NAK-Timer Value (seconds) +3. CFDP channel Inactivity-Timeout Value (seconds) +4. CFDP channel Maximum Ack Timeouts (integer counts) 5. CFDP channel Maximum NAK Timeouts (integer counts)",Ensure CF starts in a known and valid operational state CF5002.2,CF5002.2,"When CF receives a ""Set CFDP Channel Protocol Configuration"" command, CF shall set the command-specified parameter to the command-specified value and issue a cFE event message that confirms the change. ",Operational Interface CF5002.3,CF5002.3,"When CF receives a ""Set CFDP Channel Protocol Configuration"" command, if the command-specified parameter is invalid, CF shall reject the command. ",Command validity check for robust operation CF5002.4,CF5002.4,"When CF receives a ""Set CFDP Channel Protocol Configuration"" command, if the command-specified parameter *value* is invalid, CF shall reject the command.",Command validity check for robust operation CF5003,CF5003,"When CF receives a ""Get CFDP Channel-Protocol Configuration Parameter"" command, CF shall issue an event message containing the current value of the command-specified configuration-table parameter.",Operational interface CF5003.1,CF5003.1,"When CF receives a ""Get CFDP Channel-Protocol Configuration Parameter"" command, if the command-specified parameter is invalid, CF shall reject the command. ",Operational robustness +CF5004,CF5004,"When CF receives a ""Get Full CFDP Channel-Protocol Configuration"" command, CF shall publish all CFDP Channel Protocol Configuration parameters to a cFS-SB message. ",Compatibility with cFE App behavior. Message can be downlinked as Housekeeping Data or sent to another app for consumption CF5005,CF5005,"When CF receives a ""Cancel Transaction"" command, CF shall cancel the transaction indicated by the command-specified Entity ID and transaction-sequence number.",Support an operational interface to control transactions. Transaction-Id provides a mechanism to scale to large systems and avoid performance issues with string searches CF5005.1,CF5005.1,"When CF receives a ""Cancel Transaction"" command, if the command-specified transaction is not in progress, CF shall reject the command.",Support an operational interface to provide operator feedback. CF5006,CF5006,"When CF receives an ""Abandon Transaction"" command, CF shall abandon the command-specified transaction.",Support an operational interface to provide operator feedback. CF5006.1,CF5006.1,"When CF receives an ""Abandon Transaction"" command, if the command-specified transaction is not in progress, CF shall reject the command.",Support an operational interface to provide operator feedback. CF5007,CF5007,"When CF receives an ""Abandon All Transactions"" command, CF shall abandon all transactions.",Operational interface that removes transaction state for all active transaction. CF5007.1,CF5007.1,"When CF receives an ""Abandon All Transactions"" command, if there are no transactions in progress, CF shall reject the command.",Support an operational interface to provide operator feedback. +CF5008,CF5008, +CF5008.1,CF5008.1, CF5009,CF5009,"When CF receives a ""Write Active Transactions"" command, CF shall write all active transactions to a file. ",Operational interface supporting operator insight into transfer sequence and state CF5012,CF5012,The CF maximum-uplink PDU size shall be defined and configured at compile time.,Support constraints for security checks and resource utilization. CF5013,CF5013,The CF maximum number of simultaneous per-channel transactions shall be defined and configured at compile time. ,Channel concept extended to allow independent operations when other channels may be blocked due to maximum transactions @@ -116,6 +121,8 @@ CF5020.1,CF5020.1,"When CF receives a ""Purge Queue"" command, if the command-sp CF5020.2,CF5020.2,"When CF receives a ""Purge Queue"" command, if the command-specified channel is not defined, CF shall reject the command. ",Ensure robust operations and provide operator feedback. CF5021,CF5021,"When CF receives a ""Write Queue"" command, CF shall write the command-specified queue's contents to the command-specified file.",Operational interface to allow insight into file transfer order. CF5021.1,CF5021.1,"When CF receives a ""Write Queue"" command, if the command-specified queue is not defined, CF shall reject the command. ",Ensure robust operations and provide operator feedback. +CF5022,CF5022,"When CF receives a ""De-Queue File"" command, CF shall remove the command-specified file from its current queue.",Support an operational interface to provide operator feedback. +CF5022.1,CF5022.1,"When CF receives a ""De-Queue File"" command, if the command-specified file is not found, CF shall reject the command. ",Ensure robust operations and provide operator feedback. CF5023,CF5023,"The maximum number of transmissions, that is, the sum of simultaneous transmit and receive transactions, shall be defined at compile time.",Supports scaling resource use for mission variability CF5024,CF5024,"When CF receives a file-transfer request, if the requested file's size is larger than 2^32 bytes, CF shall reject the request and issue an error event message.",Constrain resources use and exclude implementation complexity of CCSDS Large-file-size header extensions. CFDP-1S-01 CF5025,CF5025,"When CF receives a PDU, if the size of the Entity ID fields are too large for the configured internal storage, CF shall reject the PDU and issue an error event message.",Prevent silent truncation of variable length Entity ID fields in PDU by checking the configured storage size and rejecting PDUs that with an Entity ID field that would be truncated. @@ -126,33 +133,35 @@ CF5030.2,CF5030.2,The highest file-transfer priority level shall be zero.,Standa CF5031,CF5031,CF shall send NAK re-transmissions in the order received at the same priority as the NAK-targeted file,PDU re-transmission priority should be the same as the original request. To not do so would allow a form of priority inversion where a large number of NAKs on a lower priority transfer would suppress re-transmission of higher priority transfers. CF5040,CF5040,"CF shall support CFDP file transfers in ""Unacknowledged""(Class-1) Service Mode.","Basic file transfer function. Unacknowledged Mode, also called unreliable mode, is used for non-critical data or operations without bi-directional data paths." CF5041,CF5041,"CF shall support CFDP file transfer in ""Acknowledged"" (Class-2) Service, Mode.","Basic file transfer function. Acknowledged Mode, also called reliable mode, is used for critical data and/or operations with bi-directional data paths." -CF6000,CF6000,"The CF Housekeeping message shall include -1. Command Counter -2. Command Error Counter --- Per-Channel HouseKeeping Entries -4. Number of transactions on the various queues -5. Frozen Status -6. Number of Valid PDUs Received -7. Number of Receive-Transaction Errors -8. Number of Sent PDUs -9. Number of Acknowledge Retry Limit Exceeded Faults -10. Number of Non-Acknowledge Retry Limit Exceeded Faults -11. Number of Inactivity Timer-Limit Faults -12. Number of CRC Mismatch Faults -13. Number of Filestore Rejection Faults (can be split by type) +CF6000,CF6000,"The CF Housekeeping message shall include +1. Command Counter +2. Command Error Counter +-- Per-Channel HouseKeeping Entries +4. Number of transactions on the various queues +5. Frozen Status +6. Number of Valid PDUs Received +7. Number of Receive-Transaction Errors +8. Number of Sent PDUs +9. Number of Acknowledge Retry Limit Exceeded Faults +10. Number of Non-Acknowledge Retry Limit Exceeded Faults +11. Number of Inactivity Timer-Limit Faults +12. Number of CRC Mismatch Faults +13. Number of Filestore Rejection Faults (can be split by type) 14. Number of Filesize Mismatch Faults",Operator interface that provides detailed status on operational state -CF6001,CF6001,"The CF End of Transaction message shall include -1. Transaction identifier -2. Channel number -3. Direction of transaction -4. Filenames associated with transaction -5. Transaction state -6. Condition code -7. Source EID of transaction -8. Peer EID of transaction -9. File size +CF6001,CF6001,"The CF End of Transaction message shall include +1. Transaction identifier +2. Channel number +3. Direction of transaction +4. Filenames associated with transaction +5. Transaction state +6. Condition code +7. Source EID of transaction +8. Peer EID of transaction +9. File size 10. CRC state",Operator interface that provides detailed information on transaction CF6001.1,CF6001.1,"When a transaction terminates, CF shall generate an End of Transaction information packet",Operational awareness of transaction closure and potential automation of follow-on actions +CF6001.2,CF6001.2,"If a transaction has reached the FIN or EOF state, the CF End of Transaction message Condition Code shall be set to the CFDP condition code for that transaction.", +CF6001.3,CF6001.3,"If the transaction has not reached the FIN or EOF state, the CF End of Transaction message Condition Code shall indicate why the transaction stopped early.", CF7000,CF7000,"When CF is initialized, CF shall initialize the the housekeeping counters/numbers to zero and the frozen status as ""thawed"".",All variable must be set to a known valid state on initialization to support reliable functioning CF7001,CF7001,"When CF is initialized, CF shall load valid CF Configuration Tables.",All variables must be set to a known valid state on initialization to support reliable functioning. Table interface supports operational reconfiguration of CF functions. CF7001.1,CF7001.1,"If a CF Configuration Table fails validation, CF shall issue an error cFE event message and exit.",Support constraints for security checks and resource utilization. Without a valid configuration CF can not initialize to a functional state. diff --git a/docs/dox_src/CMakeLists.txt b/docs/dox_src/CMakeLists.txt index 60fa6ebe..d3829d53 100644 --- a/docs/dox_src/CMakeLists.txt +++ b/docs/dox_src/CMakeLists.txt @@ -26,12 +26,16 @@ configure_file( @ONLY ) -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html" "${CMAKE_CURRENT_BINARY_DIR}/ALWAYSBUILD" +add_custom_target(cf-usersguide-html COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/cf-usersguide.doxyfile WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) +# This requires some of the intermediate files from the CFE doc build to be +# in place prior to running doxygen for CF +add_dependencies(cf-usersguide-html doc-prebuild) + add_custom_target(cf-usersguide COMMAND echo "CF UsersGuide: file://${CMAKE_CURRENT_BINARY_DIR}/html/index.html" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/ALWAYSBUILD" + DEPENDS cf-usersguide-html ) diff --git a/docs/dox_src/cfs_cf.dox b/docs/dox_src/cfs_cf.dox index 26da018a..f724736a 100644 --- a/docs/dox_src/cfs_cf.dox +++ b/docs/dox_src/cfs_cf.dox @@ -3,61 +3,31 @@ **/ -/** - * \page cfscfeventspg CFS CFDP Events - * - * \ref cfscfevents - */ - -/** - * \page cfscfcfgpg CFS CFDP Configuration - * - * \ref cfscfmissioncfg - * - * \ref cfscfplatformcfg - */ - -/** - * \page cfscfcmdspg CFS CFDP Commands - * - * \ref cfscfcmdmid - * - * \ref cfscfcmdstructs - * - * \ref cfscfcmdcodes - */ - -/** - * \page cfscftlmpg CFS CFDP Telemetry - * - * \ref cfscftlmmid - * - * \ref cfscftlm - */ - /** \page cfscfintro CFS CFDP Introduction

Scope

- This document provides a complete specification for the commands and telemetry associated - with the CFS CFDP (CF) application software. The document is intended primarily - for users of the software (operations personal, test engineers, and maintenance personnel). - The deployment guide section, is intended for mission - developers when deploying and configuring the CF application software for a mission - flight software build environment. + This document provides a design and operational overview along with a complete specification + for the commands and telemetry associated with the CFS CFDP (CF) application software. + + The document is intended primarily for users of the software (operations personal, test + engineers, and maintenance personnel). The deployment guide section, is intended for mission + developers when deploying and configuring the CF application software for a mission + flight software build environment. \ref cfscfversion @@ -101,24 +71,72 @@ TLM Telemetry UTC Universal time code + + Prev: \ref cfscffrontpageCFS
+ Next: \ref cfscfovr + **/ /** \page cfscfovr CFS CFDP Overview - CF is a cFS application for providing CFDP (CCSDS File Delivery Protocol) services. - Its primary function is to provide file receive and transmit functionality to this + CF is a cFS application for providing CFDP (CCSDS File Delivery Protocol) services + that was designed to interface to the Core Flight Executive (cFE). + Its primary function is to provide file receive and transmit functionality to this protocol. It works by mapping CFDP PDUs on and off cFS's software bus. - -

CF Design Overview

- + + CF is a highly configurable application that is designed to be used on a wide + range of flight missions. CF obtains its initial configuration through a + configuration table and its platform and mission configuration files. The + table contains default configuration settings and is loaded during CF + initialization. The platform and mission configuration files are compile-time + configuration parameters. + + To transfer files using CFDP, the CF application must communicate with a CFDP + compliant peer. CF may be configured to have any number of peers. The ASIST and + ITOS ground systems contain a compliant peer that may be used for flight to + ground (and ground to flight) transfers. + + CF sends and receives file information and file-data in Protocol Data Units + (PDUs) that are compliant with the CFDP standard protocol defined in the CCSDS + 727.0-B-4 Blue Book. The PDUs are transferred to and from the CF application + via CCSDS packets on the software bus. The system must be configured to get + the PDU packets from the peer to the software bus (and vice-versa). + + On a typical spacecraft using the cFE, science files and engineering files are + continuously being created and queued for downlink. When transmission begins, + the files are converted into a series of PDUs by CF, one after another + essentially creating a continuous stream of file-data PDUs. + The CFS CFDP application is a CFDP implementation written specifically for CFS. The goal was bounded, small, time and space efficent implementation of the CFDP features necessary for flight. CF implements Class 1 and 2 send and receive, as well as logic to cancel, suspend, resume, abandon, freeze, etc. Messages utilize "zero-copy" software bus buffers. + CF configuration is mainly through the configuration table. + + There are special features listed in the CFDP standard that are not applicable + to flight software and are therefore not supported by this version of CF. See + the constraints section of this document for more information. + + Prev: \ref cfscfintro
+ Next: \ref cfscfovrdsn + +**/ + +/** + \page cfscfovrdsn CFS CFDP Design - Configuration is mainly through the configuration table. + The CF Application has an operational interface consisting of one table, two + different telemetry messages and twenty commands. + + CF is an event driven, single threaded application that wakes up when one of + the following four messages are received on its software bus pipe. Ground + command, Housekeeping Request command, Incoming PDU or the Wake-up command. + The Wake-up command tells CF to do file transaction processing. This command + is typically sent periodically by the scheduler. The amount of + file-transaction processing that is executed when this command is received, is + configurable through the table parameter engine-cycles per wake-up.

Key differences from CF v2.X

@@ -126,22 +144,31 @@ - There's no more memory pool. Everything is set up with limits both in platform config for static memory limits and the configuration table for dynamic timing and functionality limits. - Much smaller code footprint. CF 3.0 is light-weight flight-only app. It does not provide any ground engine support. -**/ + For simplicity, the examples through-out this document refer to a typical + operational scenario whereby the peer to the CF application is located on the + ground. The CF applications knows only of incoming file transactions and + outgoing file transactions. The terms uplink, downlink and playback are + often used, but only apply when the peer is located on the ground. CF may be + configured to have more than one peer. One peer may be located onboard the + spacecraft while another is located on the ground. + + Prev: \ref cfscfovr
+ Next: \ref cfscfopr + +**/ /** \page cfscfopr CFS CFDP Operation -

Initialization

+

Initialization

CF initialization is the same for Power On Resets and Processor Resets. Standard application initialization activites are performed such as status and tracking initialization, message initialization and subscription, table initialization and registering with event services. -

Run Time

- -

Handling of Outgoing Messages

+

Outgoing Messages

The priority of CF's use of available outgoing messages on each wakeup is: @@ -154,7 +181,7 @@ active TX transfer will send new filedata PDUs. It will keep sending them until there are no more messages on that wakeup (or the throttling semaphore stops it.) -

Received messages

+

Incoming Messages

Operationally, the flow of input packets from ground into CF should be throttled at some rate appropriate for ingest. CF @@ -162,10 +189,10 @@ processed per wakeup, and both CF and the ingest app need to be able to handle this. -

Temporary file/directory use

+

Temporary file and directory use

Currently the temporary directory is only used to store class 2 RX file data - in temporary files on a transaction that has not yet received a metadata PDU. + in temporary files on a transaction that has not yet received a metadata PDU. When/if the metadata is received for that transaction, OS_mv is used to transition the temporary file to the desired destination location. Note that OS_mv attempts a rename first (faster but does not work across file systems), and if that @@ -176,21 +203,286 @@ use the temporary location for all receipts with an atomic transfer of the file after successful reception and verification (where applicable) of all the file data. -**/ +

Engine

+ + The CF application has a single internal core referred to as the engine. The + engine is capable of transmitting and receiving a configurable number of + transactions simultaneously.The engine builds outgoing Protocol Data Units + (PDUs) and interprets the incoming PDUs. It handles all details regarding the + CFDP standard protocol which is defined in the CCSDS 727.0-B-4 Blue Book. The + engine processes the file transactions when it is 'cycled'. The number of + engine cycles per wake up is a configuration parameter defined in the table. + At most one PDU will be sent on a single engine cycle. + Typically, the peer node also has an engine. When CF is transferring files to + and from the ground, the peer is sometimes referred to as the ground engine. + When faults and timeouts occur, it is important to indicate which engine + detected the event. + +

Starting a Transaction

+ + To transfer a file from the ground to the spacecraft, a 'put' request is given + to the ground engine. There is no ground command telling CF to 'get' a file. + The first indication to CF that an uplink transaction has started, is the + receipt of the first PDU sent by the ground and received by CF. + + To transfer a file from the spacecraft to the ground, a transmit file ground + command is sent to CF. This ground command translates into a 'put' request to + the flight engine. + + The CFDP protocol does not support the concept of a 'get' request. The request + to transfer a file is always made with a 'put' request at the source peer + (i.e. where the file is located). + +

Transaction Class

+ + All transfers are sent and received in one of two modes, class 1 or class 2. + The CF application is capable of sending and receiving in class 1 and class 2. + Class 1 transfers are similar to UDP in that they send the data once and + expect no feedback from the peer. Class 2 transfers are more reliable and + attempt to fill in data that may have been dropped on the first attempt. + Class 2 transfers are analogous to TCP. + +

Queue Entries

+ + The CF application keeps track of files in queue entries. There is one queue + entry per transaction. The queue entries contain information such as filename + and path, priority, class, channel etc. about each transaction. For incoming + file transactions, the queue entry starts on the incoming active queue and is + moved to the incoming history queue when the transaction is complete. For + outgoing transactions, all queue entries start out on the pending queue (in + response to a playback file command for example). The queue entry is then + moved to the outgoing active queue when the transaction begins and to the + history queue when complete. + +

Queues

+ + The CF application tracks pending transactions, active transactions and + completed transactions in its queues. For downlink (or outgoing) transactions + there are three queues per channel, a pending queue, an active queue and a + history queue. All queues hold queue entries that are described in the 'Queue + Entries' section of this document. When a request to downlink a file is + received, a queue entry is created and placed on the pending queue. When the + transaction begins, the corresponding queue entry is moved from the pending + queue to the active queue. After the transaction completes, (whether + successful or not) the queue entry is moved from the active queue to the + history queue. The history queue has a fixed depth, defined by the user in the + CF configuration table. If a transaction is added when the history queue is + full, the oldest queue entry is deleted. + + For uplink (or incoming) transactions there are two queues, an active queue + and a history queue. Uplink transactions do not have a pending queue as with + outgoing transactions. When an uplink transaction begins, a queue entry is + added to the active queue. When the transaction completes, the queue entry is + moved from the active queue to the history queue. The history queue depth is + specified by the user in the CF configuration table. When the history queue is + full and an active transaction finishes, the oldest entry on the history queue + is deleted. + +

Incoming File Transactions

+ + When files are transferred in the uplink direction, the ground peer receives + the initial request to send the file. This action causes the ground peer to + send a series of PDUs that are routed to the CF application. The CF + application does not get a request to receive a file. The first indication to + the CF application that an uplink transaction has started, is the receipt of + the first PDU of the transaction. + + The CF application is capable of receiving files in class 1 or class 2 mode on + a per-file basis. The class mode is embedded in the PDUs received. + + The message ID for incoming PDUs is defined in the CF configuration table. + + When a file is uploaded to the spacecraft in class 2 mode, the CF app must + acknowledge the receipt of the file by sending an acknowledgment PDU to the + ground. This response must be sent on a specified output channel (output + channels are described later). The channel number for this response is defined + by the user in the configuration table. + + The CF application keeps a list of all incoming transactions in its internal + queues. There are two queues designated for incoming transfers. The incoming + active queue holds information about all incoming transactions that are + currently active. The incoming history queue holds information about all + incoming transactions that are complete. The full contents of either queue can + be viewed on command. The depth of the history queue is defined in the table. + +

Outgoing File Transactions

+ + All outgoing file transactions are initiated by the CF application in response + to a playback file command, a playback directory command or a file found in a + polling directory. The peer entity does not request to receive a file. All + outgoing file transactions are inserted into a pending queue by CF before they + are actually sent. The CF application reads the pending queue (if reading is + enabled) and starts the next transaction immediately after the data from the + previous file has been sent. This process of queueing files and sending them + sequentially, prevents the engine from being inundated when the user requests + to send multiple files. Once the transactions begins, the queue entry is moved + to the outgoing active queue and then to the outgoing history queue when it's + complete. The engine processes the outgoing file transactions when it is + 'cycled'. The number of engine cycles per wake up is defined in the table. At + most one PDU will be sent on a single engine cycle. + +

Output Channels

+ + The CF application supports sending files to a configurable number of + destinations. The output channels are configured through table parameters. + Each channel has a pending queue, active queue and history queue. All queue + entries for outgoing transactions start out on the pending queue, then get + moved to the active queue when the transaction begins. After the transaction + is complete the queue entry is moved to the history queue. The queues may be + viewed by command at any time. The pending queue reads may be enabled or + disabled at anytime. Each channel has a dedicated throttling semaphore, peer + entity ID, message ID for outgoing PDUs and a configurable number of polling + directories. File output transactions may occur simultaneously on different + channels. The engine processes all active outgoing transactions in a + round-robin fashion so as not to starve any one transaction. CF is not + capable of prioritizing across channels. + +

Queueing Files for Output

+ + There are three ways to request a file (or files) to be sent. The file + transmit command, the directory playback command or through poll directory + processing. The CF polling directory feature continually checks a directory + for files and after detecting a new file in the directory, inserts a queue + entry containing the file name (and other info) on the pending queue. + +

Priority

+ + Each file-send transaction has an associated priority which is specified by + the user. The priority of the transaction determines where it is inserted in + the pending queue. High priority transactions get inserted toward the front of + the queue. There are 256 levels of priority, zero being the highest. Priority + is given as a command parameter for the playback file command and the playback + directory command. For poll directory processing, each polling directory has + an associated priority given as a table parameter. Please note that this + priority applies only within a channel. CF does not support prioritization + across channels. Prioritization across channels (if needed) would typically be + implemented by the application receiving the PDUs. + +

Preserve Setting

+ + When an outgoing file transaction is successfully complete, the user may want + the file to be deleted by CF. The preserve setting allows the user to specify + whether the file is deleted or not. The preserve setting gives two choices, + delete or keep. This setting is specified as a parameter in the transmit file + command, the playback directory command and on each polling directory. If a + file transaction is not successful, the file cannot be deleted by CF. + +

Throttling Semaphore

+ + Throttling outgoing PDUs may be necessary when the application that receives + the outgoing PDUs (typically TO) needs to control the flow of packets. The + throttling semaphore is a counting semaphore that is shared between another + application and CF. Throttling may be configured as in-use or not-in-use on a + per-channel basis. To configure as in-use, the receiving app must create a + counting semaphore during initialization, using the name defined in the CF + table. After creation, the receiving app must 'give' the semaphore each time + it is ready to receive a PDU. On the CF side, CF attempts to get the semaphore + ID by calling an OSAL function to Get-SemaphoreID-by-Name during CF + initialization. The name defined in the table is given as a parameter to this + call. CF has code to ensure that this call is executed after the receiving app + initializes. If the attempt to Get-SemaphoreID-by-Name fails, then throttling + on that channel is not-in-use and PDUs are sent whenever the engine has a PDU + ready to output. If successful, each time the engine has a PDU to output, CF + will attempt a non-blocking 'take' on the throttling semaphore. If the 'take' + is successful, the green light counter in telemetry is incremented and the PDU + is sent on the software bus. If the 'take' is not successful, the PDU is held + by the engine, the red-light counter is incremented and the 'take' is called + again on the next engine cycle. + +

Polling Directories

+ + A polling directory is a directory that is polled by CF periodically. CF does + not create these directories. They must be created before they can be enabled. + When files are found in a polling directory that is enabled, the files are + automatically queued by CF for output. The polling rate is configurable and + each channel has a configurable number of polling directories. Each polling + directory has an enable, a class setting, a priority setting, a preserve + setting and a destination directory. When enabled, CF will periodically check + the polling directories for files. When a file is found, CF will place the + file information on the pending queue if it is closed and not already on the + queue and not currently active. All polling directories are checked at the + same frequency which is defined by the table parameter + NumWakeupsPerPollDirChk. Setting this parameter to one will cause CF to check + the polling directories at the fastest possible rate, every time it receives a + 'wake-up' command. Checking polling directories is a processor-intensive + effort, it is best to keep the polling rate as low as possible. + +

Efficiency

+ + The CF application can be a processor intensive application. Some operating + systems have significant overhead associated with file system operations. + Opening and closing a file, querying the file system for file size, deleting + the file, opening directories, looping through a directory list can consume a + considerable amount of processor time. For this reason, transmitting small + files at a high rate for long periods of time may be a worst-case-timing + scenario. File system overhead is less of an issue when file sizes are large. + The terms 'large' and 'small' used here are relative to the downlink rate. + With a downlink rate of 1 Mbps for example, a good file size would be 1 MByte + or larger. + + Also, it is best to keep the number of files on the pending queue to a + minimum. When the number of files on the pending queue is high, (such as + hundreds) prioritization and standard checking causes CF processing to be + significant each time a file is added to the queue. + + Polling directory processing is also subject to file system overhead. It is + recommended that the rate of poll processing be kept low and unused polling + directories should be disabled. + +

Memory Use

+ + CF uses statically allocated memory based on configuration parameters defined + in the platform configuration file. This static memory is used for queue entries. + The life cycle of a queue entry begins when a request to queue a file for downlink + is received. Or in the case of incoming transactions, the queue entry is reserved + when the meta-data PDU is received by CF. For the incoming transaction case, the + queue entry starts out on the incoming active queue, then the entry is moved to + the history queue when the transaction completes. For outgoing transactions, the + queue entry starts out on the pending queue, then moves to the active queue when + the transaction begins, then moves to the history queue when the transaction is + complete. + + The history queue has a sliding window affect. When the queue is full and a + new transaction needs to be added, the oldest transaction will be removed, + making room for the new transaction. + + The history queue depth is a configuration parameter and specified in the CF + configuration table. When the queue entry is 'pushed-off' the history queue, + the memory for the queue will be available. + + For incoming file transactions, CF uses a statically allocated buffer for the + incoming pdu. The size of this buffer is defined by the platform configuration + parameter, CF_MAX_PDU_SIZE. The incoming PDU's are copied from the Software Bus + into this buffer and then passed to the engine. + + For outgoing file transactions, the engine uses a statically allocated buffer for + PDUs. The size of this buffer is defined by platform configuration parameter, + CF_MAX_PDU_SIZE. The engine informs the CF app when it has a PDU + ready to go out. In response to this, the CF app checks with the downlink app + (e.g. TO) to see if it is ready to receive a PDU. This is done by the CF app + trying to 'take' the throttling semaphore defined in the CF configuration + table. If the CF app successfully 'takes' the semaphore, it gives a green + light to the engine and the PDU is then released by the engine and sent to the + software bus via the zero-copy delivery mode. There is a green light counter + and a red light counter for each output channel in telemetry. + + Prev: \ref cfscfovrdsn
+ Next: \ref cfscfdg +**/ /** \page cfscfdg CFS CFDP Deployment Guide Follow the general guidelines below for platform deployment of the CFDP app. - +

Configuration

CF uses two sets of configuration parameters: compile-time configurable parameters - in the cf_platform_cfg.h file and run-time configurable parameters in the cf_def_cfg.c + in the cf_platform_cfg.h file and run-time configurable parameters in the cf_def_cfg.c file. Most parameters are included in the cf_def_cfg.c file for maximum flexibility. - CF expects to receive a CF_WAKEUP_MID message from the SCH (scheduler) app at a fixed - rate. The number of wakeups per second is reflected in the configuration table. This + CF expects to receive a CF_WAKEUP_MID message from the SCH (scheduler) app at a fixed + rate. The number of wakeups per second is reflected in the configuration table. This drives CF's timing.

Channels

@@ -200,12 +492,9 @@ message IDs for incoming and outgoing PDUs to be unique per channel. Each channel can be configured with polling directories as well. - In CF 3.0 each channel has an upper-bound on its state, and this is part of the - static memory allocation requirement. -

Flow Control

- By default, CF assumes that a per-channel semaphore is provided by the Telemetry Output + By default, CF assumes that a per-channel semaphore is provided by the Telemetry Output (TO) application or an equivalent application. The semaphore name is defined in the CF configuration table and must match the name of the semaphore created by TO. If TO does not create a semaphore, the semaphore name can be left as an empty string @@ -223,8 +512,8 @@

Scheduler

- CF as a whole expects the CF_WAKEUP_MID message as described earlier at a fixed rate. - If the number of wakeups per second is changed in SCH, then the ticks_per_second + CF as a whole expects the CF_WAKEUP_MID message as described earlier at a fixed rate. + If the number of wakeups per second is changed in SCH, then the ticks_per_second configuration parameter in the CF configuration table must also be updated.

Endianness

@@ -235,14 +524,875 @@

Integration with TO

TO's pipe needs to be able to receive packets of #CF_MAX_PDU_SIZE + + Prev: \ref cfscfopr
+ Next: \ref cfscfcfgpg + +**/ + +/** + * \page cfscfcfgpg CFS CFDP Configuration + + The CF application provides the user with a set of compile-time configuration + parameters as well as a set of run-time configuration parameters. All + compile-time configuration parameters are specified in headers files. There + are three header files used by the CF application, cf_platform_cfg.h, + cf_perfids.h and cf_msgids.h. For details regarding the compile-time + configuration parameters, refer to the header files. + + * \ref cfscfmissioncfg + * + * \ref cfscfplatformcfg + + All run-time configuration parameters are specified in the CF configuration + table. + + * \ref cfscftbl + + Prev: \ref cfscfdg
+ Next: \ref cfscfcmdspg + + */ + +/** + * \page cfscfcmdspg CFS CFDP Commands + * + * \subpage cfscfcmddesc + * + * \ref cfscfcmdmid + * + * \ref cfscfcmdstructs + * + * \ref cfscfcmdcodes + + Prev: \ref cfscftbl
+ Next: \ref cfscftlmpg + + */ + +/** + \page cfscfcmddesc CFS CFDP Command Descriptions + +

Noop Command

+ + The CF Noop command is sent to CF using message ID #CF_CMD_MID with command + code #CF_NOOP_CC. This command is useful for verifying that the command + interface to the CF Application is working. It also causes an event message + to be generated that contains the CF Application's version information. + It should be noted that the version information can also be obtained when the + Application starts up. After CF has successfully initialized itself, an event + message is generated that indicates successful initialization and also includes the + Application's version information. Both of these event messages are + 'Informational' and are NOT filtered by default. + + +

Reset Counters Command

+ + The CF Reset counters command is sent to CF using message ID #CF_CMD_MID with + command code #CF_RESET_CC. This command is used to reset the counters in the + housekeeping telemetry packet. All counters can be reset or they can be reset + by category. The categories are command counters, fault counters, incoming + file counters and outgoing file counters. + + When the command is executed successfully, the command counter will be zero + and an event message will be generated. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + * \par Command Structure + * #CF_UnionArgs_Payload_t where byte[0] specifies the counters type, byte[1-3] don't care: + * - 0 = all counters + * - 1 = command counters + * - 2 = fault counters + * - 3 = up counters + * - 4 = down counters + typedef union CF_UnionArgs_Payload + { + uint32 dword; + uint16 hword[2]; + uint8 byte[4]; + } +CF_UnionArgs_Payload_t; +\endverbatim + + The command parameter byte[0] identifies which category of counters to + reset.counters.The value should be set to one of five possible values defined in the reset enumeration. + + \verbatim typedef enum { + CF_Reset_all = 0, + CF_Reset_command = 1, + CF_Reset_fault = 2, + CF_Reset_up = 3, + CF_Reset_down = 4 + } CF_Reset_t; + \endverbatim + + + +

Transmit File Command

+ + The CF Transmit File command is sent to CF using message ID #CF_CMD_MID with + command code #CF_TX_FILE_CC. + + This command is used to queue a file to be sent by the CF application. To + 'transmit' a file means to output, or send a file. + + When the command is executed successfully, the command counter will increment + and an event will be generated. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + typedef struct CF_TxFileCmd + { + CFE_MSG_CommandHeader_t cmd_header; + uint8 cfdp_class; + uint8 keep; + uint8 chan_num; + uint8 priority; + CF_EntityId_t dest_id; + char src_filename[CF_FILENAME_MAX_LEN]; + char dst_filename[CF_FILENAME_MAX_LEN]; + } CF_TxFileCmd_t; + \endverbatim + + The first parameter, \c cfdp_class, identifies whether the file will be transferred + using #CF_CFDP_CLASS_1 or #CF_CFDP_CLASS_2. For Class 1 transfers, CF will send the data + once and expect no feedback from the peer. Class 2 transfers are more reliable + and attempt to fill in data that may have been dropped on the first attempt. + + The second parameter, \c keep, specifies whether the file will be deleted + or preserved by CF after the transfer successfully completes. To have the file + deleted by CF, set this parameter to zero. If this parameter is set to one, + the file will not be deleted. Regardless of the setting, if the file-transfer + is not successful the file will not be deleted. + + The third parameter, \c chan_num, specifies the output channel in which the + file will be sent. The value range for this parameter is 0 to + (#CF_NUM_CHANNELS - 1). #CF_NUM_CHANNELS is specified in the + CF platform configuration file. + + The fourth parameter, \c priority, specifies where the file is placed on the + pending queue. High priority files are placed at the front of the queue. A + value of zero is the highest priority. A value of 255 is the lowest priority. + + The fifth parameter, \c src_filename, specifies the path name and filename to + send. This parameter is a string with max size equal to #CF_FILENAME_MAX_LEN + bytes. The src_filename must be an existing file. The string must begin + with a forward slash, have no spaces and be properly terminated. + + The last parameter, \c dst_filename, specifies the destination path name and + filename. This parameter is a string with max size equal to #CF_FILENAME_MAX_LEN + bytes. This parameter is delivered to the peer so that the peer knows + where to store the file. The peer engine dictates the requirements of this + string. The CF application allows this string to be NULL in which case the + peer engine will store the incoming file in the default directory. If the + string is not NULL, CF requires that it is properly terminated and contains no + spaces. This parameter can be used to rename the file after it's received at + the destination. + + + +

Playback Directory Command

+ + The CF Playback Directory command is sent to CF using message ID #CF_CMD_MID + with command code #CF_PLAYBACK_DIR_CC. The command causes an event message + to be generated. This command is used to queue the files that are located + in the specified directory at the time the command is received. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + To 'playback' a directory means to send all files in that directory. To queue + the files for sending, the class must be 1 or 2, the channel must be in-use, + the files must be closed and not be active or pending, the preserve parameter + must be 0 (Delete) or 1 (Keep), the path names must include no spaces and be + properly terminated. The src_filename must begin and end with a forward slash. All + possible values for Priority are valid. A priority value of zero is the + highest priority. + + \verbatim + typedef CF_TxFileCmd_t CF_PlaybackDirCmd_t; + typedef struct CF_TxFileCmd + { + CFE_MSG_CommandHeader_t cmd_header; + uint8 cfdp_class; + uint8 keep; + uint8 chan_num; + uint8 priority; + CF_EntityId_t dest_id; + char src_filename[CF_FILENAME_MAX_LEN]; + char dst_filename[CF_FILENAME_MAX_LEN]; + } CF_TxFileCmd_t; + \endverbatim + + The first parameter, \c cfdp_class, identifies whether the files will be + transferred using #CF_CFDP_CLASS_1 or #CF_CFDP_CLASS_2. For Class 1 transfers, CF will + send the data once and expect no feedback from the peer. Class 2 transfers are + more reliable and attempt to fill in data that may have been dropped on the + first attempt. + + The second parameter, \c keep, specifies whether the files will be deleted + or preserved by CF after the transfer successfully completes. To have the + files deleted by CF, set this parameter to zero. If this parameter is set to + one, the file will not be deleted. Regardless of the setting, if the + file-transfer is not successful the file will not be deleted. + + The third parameter, \c chan_num, specifies the output channel in which the files + will be sent. All files in the directory will be sent on the specified + channel. The value range for this parameter is 0 to (#CF_NUM_CHANNELS + - 1). #CF_NUM_CHANNELS is specified in the CF platform configuration + file. + + The fourth parameter, \c priority, specifies where the files are placed on the + pending queue. All files in the directory will be queued with the given + priority. High priority files are placed at the front of the queue. A value of + zero is the highest priority. A value of 255 is the lowest priority. + + The fifth parameter, \c src_filename, specifies the path name where the files are + located. The string must have no spaces, be properly terminated and have a + forward slash as the last character. This parameter is a string with max size + equal to #CF_FILENAME_MAX_LEN characters. + + The last parameter, \c dst_filename, specifies where the files are to be stored + after they are received by the peer. This parameter is a string with max size + equal to #CF_FILENAME_MAX_LEN bytes. This parameter is delivered to the peer so + that the peer knows where to store the file. The peer engine dictates the requirements + of this string. The CF application allows this string to be NULL in which case the + peer engine will store the incoming files in the default directory. If the string + is not NULL, CF requires that it is properly terminated, contains no spaces and ends + with a forward slash. There is no way to rename the files at the destination as in + the Playback File command. + + +

Freeze Command

+ + The CF Freeze command is sent to CF using message ID #CF_CMD_MID with command + code #CF_FREEZE_CC. The freeze command has no command parameters. This command + is used to freeze all transactions. The freeze command should be applied to + both the source and destination peers at nearly the same time. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. This event message is an + 'Informational' type and is NOT filtered by default. If the command is not successful, + the command error counter will increment and an error event will be generated + indicating the reason for failure. + + +

Thaw Command

+ + The CF Thaw command is sent to CF using message ID #CF_CMD_MID with command + code #CF_THAW_CC. The thaw command has no command parameters. This command is + used to thaw all transactions that were commanded to 'freeze' earlier. The + thaw command should be applied to both the source and destination peers at + nearly the same time. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. This event message is an + 'Informational' type and is NOT filtered by default. If the command is not successful, + the command error counter will increment and an error event will be generated + indicating the reason for failure. + + +

Suspend Command

+ + The CF Suspend command is sent to CF using message ID #CF_CMD_MID with command + code #CF_SUSPEND_CC. This command is used to suspend one or all transactions. + The suspend command has one command parameter that indicates what transaction + to suspend. See details below. The suspend command should be applied to both + the source and destination peers at nearly the same time. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. This event message is an + 'Informational' type and is NOT filtered by default. If the command is not successful, + the command error counter will increment and an error event will be generated + indicating the reason for failure. + + NOTE: Suspending an outgoing transaction before EOF is sent, will pause the + flow of PDUs on that channel. This happens because the next file is started + when the current file EOF is sent. If a user wishes to stop the current transaction + (before the EOF is sent) and still allow the next pending file to begin, the + current transaction should be cancelled (or abandoned) in lieu of being + suspended. Canceling is always a better option than abandoning. + + NOTE: When a suspended transaction is cancelled, the cancel does not take + affect until the transaction is resumed. + + \verbatim + typedef struct CF_TransactionCmd + { + CFE_MSG_CommandHeader_t cmd_header; + CF_TransactionSeq_t ts; + CF_EntityId_t eid; + uint8 chan; + uint8 spare[3]; + } CF_TransactionCmd_t; + + \endverbatim + + The \c ts parameter specifies the transaction sequence number to suspend. + The \c eid parameter specifies the entity id used in the transaction. + The \c chan parameter can specify a single channel, all channels, or the channel + corresponding to the transaction sequence number. + + +

Resume Command

+ + The CF Resume command is sent to CF using message ID #CF_CMD_MID with command + code #CF_RESUME_CC. This command is used to resume a suspended transaction or + all transactions. The resume command has one command parameter that indicates + what transaction to resume. See details below. The resume command should be + applied to both the source and destination peers at nearly the same time. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. This event message is an + 'Informational' type and is NOT filtered by default. If the command is not successful, + the command error counter will increment and an error event will be generated + indicating the reason for failure. + + \verbatim + typedef struct CF_TransactionCmd + { + CFE_MSG_CommandHeader_t cmd_header; + CF_TransactionSeq_t ts; + CF_EntityId_t eid; + uint8 chan; + uint8 spare[3]; + } CF_TransactionCmd_t; + + \endverbatim + + The \c ts parameter specifies the transaction sequence number to resume. + The \c eid parameter specifies the entity id used in the transaction. + The \c chan parameter can specify a single channel, all channels, or the channel + corresponding to the transaction sequence number. + + +

Cancel Command

+ + The CF Cancel command is sent to CF using message ID #CF_CMD_MID with command + code #CF_CANCEL_CC. This command is used to cancel a transaction or all + transactions. The cancel command has one command parameter that indicates what + transaction to cancel. See details below. The cancel command should be sent + to the source entity only. For example, uplink transactions should be + cancelled at the ground engine. The CF application should not receive a cancel + command in this case. The CF application will learn of the cancel request + through the protocol messages. Downlink transactions and outgoing transactions + (with respect to CF) should be cancelled by sending this CF cancel command. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. This event message is an + 'Informational' type and is NOT filtered by default. If the command is not successful, + the command error counter will increment and an error event will be generated + indicating the reason for failure. + + NOTE: If a Cancel command is received by CF on an outgoing transaction that + is suspended, the cancel does not take affect until the transaction is + resumed. + + + \verbatim + typedef struct CF_TransactionCmd + { + CFE_MSG_CommandHeader_t cmd_header; + CF_TransactionSeq_t ts; + CF_EntityId_t eid; + uint8 chan; + uint8 spare[3]; + } CF_TransactionCmd_t; + + \endverbatim + + The \c ts parameter specifies the transaction sequence number to cancel. + The \c eid parameter specifies the entity id used in the transaction. + The \c chan parameter can specify a single channel, all channels, or the channel + corresponding to the transaction sequence number. + + +

Abandon Command

+ + The CF Abandon command is sent to CF using message ID #CF_CMD_MID with command + code #CF_ABANDON_CC. This command is used to abandon a transaction or all + transactions. The abandon command has one command parameter that indicates + what transaction to abandon. See details below. The abandon command should be + applied to both the source and destination peers at nearly the same time. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. This event message is an 'Informational' + type and is NOT filtered by default. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + When the command is executed successfully, the command counter is incremented + and an event message will be generated. This event message is an + 'Informational' type and is NOT filtered by default. If the command is not successful, + the command error counter will increment and an error event will be generated + indicating the reason for failure. + + NOTE: Unlike the cancel command, if a suspended transaction is abandoned, the + transaction will be abandoned at the time the abandon command is received. + Likewise, if a frozen transaction is abandoned, the transaction will be + abandoned when the abandoned cmd is received. + + \verbatim + typedef struct CF_TransactionCmd + { + CFE_MSG_CommandHeader_t cmd_header; + CF_TransactionSeq_t ts; + CF_EntityId_t eid; + uint8 chan; + uint8 spare[3]; + } CF_TransactionCmd_t; + + \endverbatim + + The \c ts parameter specifies the transaction sequence number to abandon. + The \c eid parameter specifies the entity id used in the transaction. + The \c chan parameter can specify a single channel, all channels, or the channel + corresponding to the transaction sequence number. + + + +

Set MIB Parameter Command

+ + The CF Set MIB Parameter command is sent to CF using message ID #CF_CMD_MID + with command code #CF_SET_MIB_PARAM_CC. This command is used to change the + flight engine Message Information Base (MIB). The MIB is a term used in the + CCSDS blue book that can be interpreted as the engine configuration + parameters. The command has two command parameters, Param indicates which + parameter to change, and Value indicates the new setting. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated displaying the parameter values received. + This event message is an 'Informational' type and is NOT filtered by default. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + This command may be used to change any flight MIB parameter. + + NOTE: Changing these parameters will change the actual table values, thereby + changing the checksum of the CF configuration table. + + \verbatim + typedef struct CF_SetParamCmd + { + CFE_MSG_CommandHeader_t cmd_header; + uint32 value; + uint8 key; + uint8 chan_num; + uint8 spare[2]; + } CF_SetParamCmd_t; + + \endverbatim + + The \c value parameter specifies the new value of the engine + parameter. + + The \c key parameter specifies which engine parameter to set. + + The \c chan_num parameter specifies the channel number to set. + + +

Get MIB Parameter Command

+ + The CF Set MIB Parameter command is sent to CF using message ID #CF_CMD_MID + with command code #CF_GET_MIB_PARAM_CC. This command is used to view a single + Message Information Base (MIB) parameter. The MIB is a term used in the CCSDS + blue book that can be interpreted as the engine configuration parameters. + + The command has two command parameter, key indicates which parameter to + view and the channel number specifies the channel configuration to use. + The parameter given and its current setting will be displayed in the event. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated displaying the given parameter value + and the current setting for that parameter. This event message is an 'Informational' + type and is NOT filtered by default. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + This command may be used to view any flight MIB parameter. + + \verbatim + typedef struct CF_GetParamCmd + { + CFE_MSG_CommandHeader_t cmd_header; + uint8 key; + uint8 chan_num; + } CF_GetParamCmd_t; + + \endverbatim + + The \c key parameter specifies which engine parameter to get. + + The \c chan_num parameter specifies the channel number to get the data from. + + +

Write Queue Information Command

+ + + The CF Write Queue Information command is sent to CF using message ID +#CF_CMD_MID with command code #CF_WRITE_QUEUE_CC. + + This command is used to write the contents of a single queue to a file. CF has + a pending, queue, an active queue and a history queue for each output channel. + CF also has an active queue and a history queue for incoming transactions. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + typedef struct CF_WriteQueueCmd + { + CFE_MSG_CommandHeader_t cmd_header; + uint8 type; + uint8 chan; + uint8 queue; + uint8 spare; + + char filename[CF_FILENAME_MAX_LEN]; + } CF_WriteQueueCmd_t; + + \endverbatim + + The first parameter, \c type, specifies the queue type. The queue type may be + uplink (incoming), or downlink (outgoing), or both, + + The second parameter, \c chan, is necessary only if the type parameter is set + to a value of two (downlink). If the Type parameter is set to a value of one + (uplink), the code does not read this parameter. Chan specifies the downlink + channel that owns the queue. The value range for this parameter is 0 to + (#CF_NUM_CHANNELS - 1). #CF_NUM_CHANNELS is specified in the + CF platform configuration file. + + The third parameter, \c queue, identifies which queue contents will be written + to the file. A value of 0 for pending queue, 1 for active and 2 for history. + Because there is no uplink pending queue, a value of zero is not valid when + the Type parameter is set to one (uplink). + + The fourth parameter, \c filename, specifies the name of the file that will + receive the queue data. This parameter is a string with max size equal to +#CF_FILENAME_MAX_LEN bytes specified in the CF platform configuration file. + + +

Enable Dequeue Command

+ + The CF Enable Dequeue command is sent to CF using message ID #CF_CMD_MID with + command code #CF_ENABLE_DEQUEUE_CC. + + This command is used to enable reading from the pending queue on a particular + channel. It has one parameter (channel) and is sent when the pending queue + reads are disabled for that channel. The pending queue holds the names of the + files that are waiting to be sent out by CF. This command has no affect on + incoming file transactions. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + * Command Structure + * #CF_UnionArgs_Payload_t where byte[0] specifies the channel number or all channels + * - 255 = all channels + * - else = single channel + typedef union CF_UnionArgs_Payload + { + uint32 dword; + uint16 hword[2]; + uint8 byte[4]; + } CF_UnionArgs_Payload_t; + \endverbatim + + The first and only parameter, \c byte[0], specifies which pending queue to enable. + Each channel has one pending queue. The value range for this parameter is 0 to + 255. A value of 255 specifies all channels. All other values are for a single channel. + + +

Disable Dequeue Command

+ + The CF Enable Dequeue command is sent to CF using message ID #CF_CMD_MID with + command code #CF_DISABLE_DEQUEUE_CC. + + This command is used to disable reading from the pending queue on a particular + channel. It has one parameter (channel) and sent when the user would like to + stop sending files on a particular channel. + + NOTE: This command does not stop a file transaction that is in progress on the + specified channel. Use the cancel command to stop a file transaction that is + in progress. + + + When the command is executed successfully, the command counter is incremented + and the an event message will be generated. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + * Command Structure + * #CF_UnionArgs_Payload_t where byte[0] specifies the channel number or all channels + * - 255 = all channels + * - else = single channel + + typedef union CF_UnionArgs_Payload + { + uint32 dword; + uint16 hword[2]; + uint8 byte[4]; + } CF_UnionArgs_Payload_t; + \endverbatim + + The first and only parameter, \c byte[0], specifies which pending queue to enable. + Each channel has one pending queue. The value range for this parameter is 0 to + 255. A value of 255 specifies all channels. All other values are for a single channel. + + +

Enable Directory Polling Command

+ + The CF Enable Directory Polling command is sent to CF using message ID +#CF_CMD_MID with command code #CF_ENABLE_DIR_POLLING_CC. + + This command is used to enable one or all polling directories on a particular + channel. CF will check polling directories for filenames and queue them for + output, only if the polling directory is enabled. Polling directory processing + consumes a fair amount of CPU utilization. Opening directories periodically + and looping through hidden files, closed files and files that have already + been queued can take a substantial amount of CPU time. It is recommended to + keep polling directories disabled when they are not actively receiving files. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + * Command Structure + * #CF_UnionArgs_Payload_t + * + * byte[0] specifies the channel number or all channels + * - 255 = all channels + * - else = single channel + * + * byte[1] specifies the polling directory index + * - 255 = all polling directories + * - else = single polling directory index + * + + typedef union CF_UnionArgs_Payload + { + uint32 dword; + uint16 hword[2]; + uint8 byte[4]; + } CF_UnionArgs_Payload_t; + \endverbatim + + The first parameter, \c byte[0], specifies which channel contains the polling + directory to enable. The value range for this parameter is 0 to 255. A value + of 255 specifies all channels. All other values are for a single channel. + + The second parameter, \c byte[1], specifies which polling directory to enable. To + enable all polling directories on a specific channel, set this parameter to + 0xFF. The polling directories are numbered from zero to + (CF_MAX_POLLING_DIRS_PER_CHAN - 1). CF_MAX_POLLING_DIRS_PER_CHAN is specified + in the CF platform configuration file. The polling directory number may be obtained + by viewing the contents of the CF configuration table. + + +

Disable Directory Polling Command

+ + The CF Enable Directory Polling command is sent to CF using message ID +#CF_CMD_MID with command code #CF_DISABLE_DIR_POLLING_CC. + + This command is used to disable one or all polling directories on a particular + channel. CF will check polling directories for filenames and queue them for + output, only if the polling directory is enabled. Polling directory processing + consumes a fair amount of CPU utilization. Opening directories periodically + and looping through hidden files, closed files and files that have already + been queued can take a substantial amount of CPU time. It is recommended to + keep polling directories disabled when they are not actively receiving files. + + When the command is executed successfully, the command counter is incremented + and and event message will be generated. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + * Command Structure + * #CF_UnionArgs_Payload_t + * + * byte[0] specifies the channel number or all channels + * - 255 = all channels + * - else = single channel + * + * byte[1] specifies the polling directory index + * - 255 = all polling directories + * - else = single polling directory index + * + + typedef union CF_UnionArgs_Payload + { + uint32 dword; + uint16 hword[2]; + uint8 byte[4]; + } CF_UnionArgs_Payload_t; + \endverbatim + + The first parameter, \c byte[0], specifies which channel contains the polling + directory to disable. The value range for this parameter is 0 to 255. A value + of 255 specifies all channels. All other values are for a single channel. + + The second parameter, \c byte[1], specifies which polling directory to disable. To + disable all polling directories on a specific channel, set this parameter to + 0xFF. The polling directories are numbered from zero to + (CF_MAX_POLLING_DIRS_PER_CHAN - 1). CF_MAX_POLLING_DIRS_PER_CHAN is specified + in the CF platform configuration file. The polling directory number may be obtained + by viewing the contents of the CF configuration table. + + +

Purge Queue Command

+ + The CF Write Queue Information command is sent to CF using message ID +#CF_CMD_MID with command code #CF_PURGE_QUEUE_CC. + + This command is used to remove all entries on a single queue. CF has a + pending queue, an active queue, and a history queue for each channel. + Only the pending and history queues can be purged. + + When the command is executed successfully, the command counter is incremented + and an event message will be generated indicating that the node has been removed. + + If the command is not successful, the command error counter will increment and + an error event will be generated indicating the reason for failure. + + \verbatim + * Command Structure + * #CF_UnionArgs_Payload_t + * + * byte[0] specifies the channel number or all channels + * - 255 = all channels + * - else = single channel + * + * byte[1] specifies the queue + * - 0 = Pending queue + * - 1 = History queue + * - 2 = Both pending and history queue + * + + typedef union CF_UnionArgs_Payload + { + uint32 dword; + uint16 hword[2]; + uint8 byte[4]; + } CF_UnionArgs_Payload_t; + \endverbatim + + The first parameter, \c byte[0], specifies a single channel id or a value + indicating all channels. + + The second parameter, \c byte[1], identifies which queue will be purged. + A value of 0 for pending queue, 1 for history and 2 for both. + +

Enable Engine Command

+ + The CF Enable Engine command is sent to CF using message ID +#CF_CMD_MID with command code #CF_ENABLE_ENGINE_CC. The command has no + command parameters and is used to reinitialize engine and enable processing. + Note configuration table updates are not processed while the engine is enabled. + + +

Enable Disable Command

+ + The CF Enable Engine command is sent to CF using message ID +#CF_CMD_MID with command code #CF_DISABLE_ENGINE_CC. The command has no + command parameters and is used to disable engine processing. + Note configuration table updates can be performed while the engine is disabled, + and when the engine is re-enabled the new configuration will take affect. + + Prev: \ref cfscfcfgpg
+ Next: \ref cfscftlmpg +**/ + +/** + * \page cfscftlmpg CFS CFDP Telemetry + * + * \subpage cfscftlmdesc + * + * \ref cfscftlmmid + * + * \ref cfscftlm + * + + Prev: \ref cfscfcmdspg
+ Next: \ref cfscfeventspg + */ + +/** + \page cfscftlmdesc CFS CFDP Telemetry Descriptions + +

CF Housekeeping Telemetry Packet

+ + The Housekeeping Telemetry packet is sent by CF to the software bus on + command. When CF receives the CF_SEND_HK_MID command, a packet is constructed + and sent by CF. CF typically receives this command every four or five seconds. + + +

CF End of Transaction Packet

+ + The End of Transaction packet is sent to the software bus upon completion + of a file send or receive transaction. A packet with message ID #CF_EOT_TLM_MID is + constructed and sent by CF. The packet contains information about the last + completed transaction which includes sequence number, channel, direction, state, + status, EID, file size, CRC result, and filenames. + + Prev: \ref cfscftlmpg
+ Next: \ref cfscftbl **/ + + +/** + * \page cfscfeventspg CFS CFDP Events + * + * \ref cfscfevents + * + Prev: \ref cfscftlmpg
+ Next: \ref cfscfcons + */ + + /** \page cfscftbl CFS CFDP Table Definitions + + The CF application has one table used for configuration. This table is + accessed during initialization and updated by CF when changes to the table + parameters are made through CF commands or CFE table services. + The table contains default configuration settings. Many table configuration + settings can be adjusted by command. These adjustments will modify the table + and are therefore reflected if the table is dumped. These adjustments will + also change the table checksum. The configuration table is loaded at the time + the application is started. CF supports table updates during runtime only when + the engine is disabled. + CF utilzes a CFS table for run-time configuration defined by #CF_ConfigTable_t. The channel configuration is in #CF_ConfigTable_t.chan which contains a polling element defined by #CF_PollDir_t. + + Prev: \ref cfscfcfgpg
+ Next: \ref cfscfcons + **/ /** @@ -250,6 +1400,62 @@ CF is currently limited by the Software Bus performance. Future work may include implementing a point-to-point interface for high speed transfers. + + The CFDP standard CCSDS 727.0-B-4 allows a variety of data-type sizes for + Source and Destination Entity ID's, Transaction ID and PDU Header length. + Currently, this application does not support the following: + 1. an Entity ID length other than the size defined in cf_platform_cfg.h + 2. a transaction ID length other than the size defined in cf_platform_cfg.h + 3. a PDU header size greater than CF_CFDP_MAX_HEADER_SIZE bytes + + The stack size for the CF application must be monitored and must be no less + than 16384 bytes. Depending on the CF configuration, the stack size may need + to be set higher than 16384. The stack size is specified int he cfe_es_startup.scr + file that is located in the /mission/build/xxx/exe area. + + Poll directories must not have subdirectories, otherwise errors will occur + at put request time. + + All files in polling directories must be closed. + + The same file cannot be sent on two channels at same time. + + Spaces are not allowed in filenames. + + Segmentation control as described in the blue book is not supported by this + version of CFS CF application. All outgoing transactions will have the + segmentation control bit in the meta-data PDU set to - 'Recorded Boundaries + Not Respected'. + + This version of CF does not support keep alive procedures that are detailed in + section 4.1.6.5 of CFDP CCSDS 727.0-B-4 Blue Book. + + Invalid file structures are not supported by this version of the CF + application. Invalid file structures are described in 4.1.6.1.1.8 of CFDP + CCSDS 727.0-B-4 Blue Book and apply only when record boundaries are respected + (see segmentation control above). + + Only transmission modes unacknowledged (class 1) and acknowledged (class 2) are + supported by the CF application. + + The CFDP Application will fail on startup if the following conditions are not met: + + + + Each one of these conditions will generate a unique event message and will cause the CF + Application to terminate before processing any CF command pipe messages. + + Prev: \ref cfscfeventspg
+ Next: \ref cfscffaqs + **/ /** diff --git a/fsw/src/cf_events.h b/fsw/inc/cf_events.h similarity index 100% rename from fsw/src/cf_events.h rename to fsw/inc/cf_events.h diff --git a/fsw/inc/cf_extern_typedefs.h b/fsw/inc/cf_extern_typedefs.h new file mode 100644 index 00000000..413b6942 --- /dev/null +++ b/fsw/inc/cf_extern_typedefs.h @@ -0,0 +1,73 @@ +/************************************************************************ + * NASA Docket No. GSC-18,447-1, and identified as “CFS CFDP (CF) + * Application version 3.0.0” + * + * Copyright (c) 2019 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * + * Declarations and prototypes for cf_extern_typedefs module + */ + +#ifndef CF_EXTERN_TYPEDEFS_H +#define CF_EXTERN_TYPEDEFS_H + +#include "cf_platform_cfg.h" + +/** + * @brief Values for CFDP file transfer class + * + * The CFDP specification prescribes two classes/modes of file + * transfer protocol operation - unacknowledged/simple or + * acknowledged/reliable. + * + * Defined per section 7.1 of CCSDS 727.0-B-5 + */ +typedef enum +{ + CF_CFDP_CLASS_1 = 0, /**< \brief CFDP class 1 - Unreliable transfer */ + CF_CFDP_CLASS_2 = 1, /**< \brief CFDP class 2 - Reliable transfer */ +} CF_CFDP_Class_t; + +/** + * @brief CF queue identifiers + */ +typedef enum +{ + CF_QueueIdx_PEND = 0, /**< \brief first one on this list is active */ + CF_QueueIdx_TXA = 1, + CF_QueueIdx_TXW = 2, + CF_QueueIdx_RX = 3, + CF_QueueIdx_HIST = 4, + CF_QueueIdx_HIST_FREE = 5, + CF_QueueIdx_FREE = 6, + CF_QueueIdx_NUM = 7, +} CF_QueueIdx_t; + +/** + * @brief Cache of source and destination filename + * + * This pairs a source and destination file name together + * to be retained for future reference in the transaction/history + */ +typedef struct CF_TxnFilenames +{ + char src_filename[CF_FILENAME_MAX_LEN]; + char dst_filename[CF_FILENAME_MAX_LEN]; +} CF_TxnFilenames_t; + +#endif /* CF_EXTERN_TYPEDEFS_H */ \ No newline at end of file diff --git a/fsw/src/cf_msg.h b/fsw/inc/cf_msg.h similarity index 99% rename from fsw/src/cf_msg.h rename to fsw/inc/cf_msg.h index 559d6858..4d36989b 100644 --- a/fsw/src/cf_msg.h +++ b/fsw/inc/cf_msg.h @@ -28,7 +28,7 @@ #include "cfe.h" #include "cf_platform_cfg.h" -#include "cf_cfdp.h" +#include "cf_extern_typedefs.h" #include "cf_tbldefs.h" #define CF_ALL_CHANNELS (255) @@ -139,7 +139,7 @@ typedef struct CF_EotPacket uint32 channel; /**< \brief Channel number */ uint32 direction; /**< \brief direction of this transaction */ uint32 state; /**< \brief Transaction state */ - uint32 cc; /**< \brief final condition code of operation */ + uint32 txn_stat; /**< \brief final status code of transaction (extended CFDP CC) */ CF_EntityId_t src_eid; /**< \brief the source eid of the transaction */ CF_EntityId_t peer_eid; /**< \brief peer_eid is always the "other guy", same src_eid for RX */ uint32 fsize; /**< \brief File size */ @@ -167,7 +167,6 @@ typedef union */ typedef enum { - /** * \brief No-op * diff --git a/fsw/platform_inc/cf_msgids.h b/fsw/inc/cf_msgids.h similarity index 100% rename from fsw/platform_inc/cf_msgids.h rename to fsw/inc/cf_msgids.h diff --git a/fsw/mission_inc/cf_perfids.h b/fsw/inc/cf_perfids.h similarity index 100% rename from fsw/mission_inc/cf_perfids.h rename to fsw/inc/cf_perfids.h diff --git a/fsw/platform_inc/cf_platform_cfg.h b/fsw/inc/cf_platform_cfg.h similarity index 94% rename from fsw/platform_inc/cf_platform_cfg.h rename to fsw/inc/cf_platform_cfg.h index 8f0c4ba3..5b356b76 100644 --- a/fsw/platform_inc/cf_platform_cfg.h +++ b/fsw/inc/cf_platform_cfg.h @@ -326,6 +326,28 @@ typedef uint32 CF_TransactionSeq_t; */ #define CF_RCVMSG_TIMEOUT (100) +/** + * @brief Limits the number of retries to obtain the CF throttle sem + * + * @par Description + * If the CF throttle sem is not available during CF startup, the initialization + * will retry after a short delay. + * + * @sa CF_STARTUP_SEM_TASK_DELAY + */ +#define CF_STARTUP_SEM_MAX_RETRIES 25 + +/** + * @brief Number of milliseconds to wait if CF throttle sem is not available + * + * @par Description + * If the CF throttle sem is not available during CF startup, the initialization + * will delay for this period of time before trying again + * + * @sa CF_STARTUP_SEM_MAX_RETRIES + */ +#define CF_STARTUP_SEM_TASK_DELAY 100 + /** * \brief Mission specific version number * diff --git a/fsw/src/cf_tbldefs.h b/fsw/inc/cf_tbldefs.h similarity index 99% rename from fsw/src/cf_tbldefs.h rename to fsw/inc/cf_tbldefs.h index 122c6807..ca55204e 100644 --- a/fsw/src/cf_tbldefs.h +++ b/fsw/inc/cf_tbldefs.h @@ -26,7 +26,7 @@ #define CF_TBLDEFS_H #include "cf_platform_cfg.h" -#include "cf_cfdp_pdu.h" +#include "cf_extern_typedefs.h" /** * \brief Configuration entry for directory polling diff --git a/fsw/src/cf_app.c b/fsw/src/cf_app.c index 9dd0f600..835032ef 100644 --- a/fsw/src/cf_app.c +++ b/fsw/src/cf_app.c @@ -39,8 +39,6 @@ CF_AppData_t CF_AppData; /*---------------------------------------------------------------- - * - * Function: CF_HkCmd * * Application-scope internal function * See description in cf_app.h for argument/return detail @@ -53,8 +51,6 @@ void CF_HkCmd(void) } /*---------------------------------------------------------------- - * - * Function: CF_CheckTables * * Application-scope internal function * See description in cf_app.h for argument/return detail @@ -108,8 +104,6 @@ void CF_CheckTables(void) } /*---------------------------------------------------------------- - * - * Function: CF_ValidateConfigTable * * Application-scope internal function * See description in cf_app.h for argument/return detail @@ -149,8 +143,6 @@ int32 CF_ValidateConfigTable(void *tbl_ptr) } /*---------------------------------------------------------------- - * - * Function: CF_TableInit * * Application-scope internal function * See description in cf_app.h for argument/return detail @@ -206,8 +198,6 @@ int32 CF_TableInit(void) } /*---------------------------------------------------------------- - * - * Function: CF_Init * * Application-scope internal function * See description in cf_app.h for argument/return detail @@ -277,8 +267,6 @@ int32 CF_Init(void) } /*---------------------------------------------------------------- - * - * Function: CF_WakeUp * * Application-scope internal function * See description in cf_app.h for argument/return detail @@ -292,8 +280,6 @@ void CF_WakeUp(void) } /*---------------------------------------------------------------- - * - * Function: CF_ProcessMsg * * Application-scope internal function * See description in cf_app.h for argument/return detail @@ -329,8 +315,6 @@ void CF_ProcessMsg(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_AppMain * * Entry point function * See description in cf_app.h for argument/return detail diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index d8fef048..b61e6280 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -47,8 +47,6 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeStart * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -83,8 +81,6 @@ void CF_CFDP_EncodeStart(CF_EncoderState_t *penc, void *msgbuf, CF_Logical_PduBu } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeStart * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -119,8 +115,6 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ArmAckTimer * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -133,8 +127,6 @@ void CF_CFDP_ArmAckTimer(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_GetClass * * Internal helper routine only, not part of API. * @@ -146,8 +138,6 @@ static inline CF_CFDP_Class_t CF_CFDP_GetClass(const CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_IsSender * * Internal helper routine only, not part of API. * @@ -161,8 +151,6 @@ static inline int CF_CFDP_IsSender(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ArmInactTimer * * Internal helper routine only, not part of API. * @@ -173,8 +161,6 @@ static inline void CF_CFDP_ArmInactTimer(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DispatchRecv * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -194,8 +180,6 @@ void CF_CFDP_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DispatchTx * * Internal helper routine only, not part of API. * @@ -209,8 +193,6 @@ static void CF_CFDP_DispatchTx(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_FindUnusedChunks * * Internal helper routine only, not part of API. * @@ -227,8 +209,6 @@ static CF_ChunkWrapper_t *CF_CFDP_FindUnusedChunks(CF_Channel_t *c, CF_Direction } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_SetPduLength * * Internal helper routine only, not part of API. * @@ -250,8 +230,6 @@ static void CF_CFDP_SetPduLength(CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ConstructPduHeader * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -322,8 +300,6 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF } /*---------------------------------------------------------------- - * - * Function: CF_strnlen * * Internal helper routine only, not part of API. * @@ -340,8 +316,6 @@ static inline size_t CF_strnlen(const char *s, size_t maxlen) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_SendMd * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -363,7 +337,6 @@ CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t) } else { - md = &ph->int_header.md; CF_Assert((t->state == CF_TxnState_S1) || (t->state == CF_TxnState_S2)); @@ -387,8 +360,6 @@ CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_SendFd * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -409,8 +380,6 @@ CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_AppendTlv * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -448,8 +417,6 @@ void CF_CFDP_AppendTlv(CF_Logical_TlvList_t *ptlv_list, CF_CFDP_TlvType_t tlv_ty } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_SendEof * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -471,11 +438,11 @@ CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t) { eof = &ph->int_header.eof; - eof->cc = t->history->cc; + eof->cc = CF_TxnStatus_To_ConditionCode(t->history->txn_stat); eof->crc = t->crc.result; eof->size = t->fsize; - if (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) + if (eof->cc != CF_CFDP_ConditionCode_NO_ERROR) { CF_CFDP_AppendTlv(&eof->tlv_list, CF_CFDP_TLV_TYPE_ENTITY_ID); } @@ -489,8 +456,6 @@ CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_SendAck * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -542,8 +507,6 @@ CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_SendFin * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -584,8 +547,6 @@ CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_SendNak * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -602,7 +563,6 @@ CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } else { - CF_Assert(CF_CFDP_GetClass(t) == CF_CFDP_CLASS_2); nak = &ph->int_header.nak; @@ -621,8 +581,6 @@ CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvPh * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -683,8 +641,6 @@ int CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvMd * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -708,7 +664,6 @@ int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } else { - /* store the expected file size in transaction */ t->fsize = md->size; @@ -757,8 +712,6 @@ int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvFd * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -787,6 +740,7 @@ int CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_SHORT, CFE_EVS_EventType_ERROR, "CF: filedata pdu too short: %lu bytes received", (unsigned long)CF_CODEC_GET_SIZE(ph->pdec)); + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR); ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = -1; } @@ -795,6 +749,7 @@ int CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) /* If recv PDU has the "segment_meta_flag" set, this is not currently handled in CF. */ CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_UNSUPPORTED, CFE_EVS_EventType_ERROR, "CF: filedata pdu with segment metadata received"); + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR); ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = -1; } @@ -803,8 +758,6 @@ int CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvEof * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -827,8 +780,6 @@ int CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvAck * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -852,8 +803,6 @@ int CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvFin * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -878,8 +827,6 @@ int CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvNak * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -902,8 +849,6 @@ int CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvDrop * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -915,8 +860,6 @@ void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RecvIdle * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1001,8 +944,6 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_InitEngine * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1051,8 +992,27 @@ int32 CF_CFDP_InitEngine(void) if (CF_AppData.config_table->chan[i].sem_name[0]) { - ret = OS_CountSemGetIdByName(&CF_AppData.engine.channels[i].sem_id, - CF_AppData.config_table->chan[i].sem_name); + /* + * There is a start up race condition because CFE starts all apps at the same time, + * and if this sem is instantiated by another app, it may not be created yet. + * + * Therefore if OSAL returns OS_ERR_NAME_NOT_FOUND, assume this is what is going + * on, delay a bit and try again. + */ + ret = OS_ERR_NAME_NOT_FOUND; + for (j = 0; j < CF_STARTUP_SEM_MAX_RETRIES; ++j) + { + ret = OS_CountSemGetIdByName(&CF_AppData.engine.channels[i].sem_id, + CF_AppData.config_table->chan[i].sem_name); + + if (ret != OS_ERR_NAME_NOT_FOUND) + { + break; + } + + OS_TaskDelay(CF_STARTUP_SEM_TASK_DELAY); + } + if (ret != OS_SUCCESS) { CFE_EVS_SendEvent(CF_EID_ERR_INIT_SEM, CFE_EVS_EventType_ERROR, @@ -1094,8 +1054,6 @@ int32 CF_CFDP_InitEngine(void) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_CycleTxFirstActive * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1132,8 +1090,6 @@ int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_CycleTx * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1177,8 +1133,6 @@ void CF_CFDP_CycleTx(CF_Channel_t *c) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DoTick * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1212,8 +1166,6 @@ int CF_CFDP_DoTick(CF_CListNode_t *node, void *context) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_TickTransactions * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1277,8 +1229,6 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_InitTxnTxFile * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1293,8 +1243,6 @@ void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_TxFile_Initiate * * Internal helper routine only, not part of API. * @@ -1327,8 +1275,6 @@ static void CF_CFDP_TxFile_Initiate(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_cl } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_TxFile * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1351,7 +1297,6 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP } else { - t = CF_FindUnusedTransaction(&CF_AppData.engine.channels[chan]); CF_Assert(t); /* should always have a free transaction at this point */ @@ -1372,8 +1317,6 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_PlaybackDir_Initiate * * Internal helper routine only, not part of API. * @@ -1413,8 +1356,6 @@ static int32 CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *src_file } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_PlaybackDir * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1445,8 +1386,6 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ProcessPlaybackDirectory * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1454,10 +1393,8 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF *-----------------------------------------------------------------*/ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) { - os_dirent_t dirent; CF_Transaction_t *pt; - int32 status; - + os_dirent_t dirent; /* either there's no transaction (first one) or the last one was finished, so check for a new one */ memset(&dirent, 0, sizeof(dirent)); @@ -1475,27 +1412,25 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) continue; } - { - pt = CF_FindUnusedTransaction(c); - CF_Assert(pt); /* should be impossible not to have one because there are limits on the number of uses of - them */ + pt = CF_FindUnusedTransaction(c); + CF_Assert(pt); /* should be impossible not to have one because there are limits on the number of uses of + them */ - /* the -1 below is to make room for the slash */ - snprintf(pt->history->fnames.src_filename, sizeof(pt->history->fnames.src_filename), "%.*s/%.*s", - CF_FILENAME_MAX_PATH - 1, p->fnames.src_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); - snprintf(pt->history->fnames.dst_filename, sizeof(pt->history->fnames.dst_filename), "%.*s/%.*s", - CF_FILENAME_MAX_PATH - 1, p->fnames.dst_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); + /* the -1 below is to make room for the slash */ + snprintf(pt->history->fnames.src_filename, sizeof(pt->history->fnames.src_filename), "%.*s/%.*s", + CF_FILENAME_MAX_PATH - 1, p->fnames.src_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); + snprintf(pt->history->fnames.dst_filename, sizeof(pt->history->fnames.dst_filename), "%.*s/%.*s", + CF_FILENAME_MAX_PATH - 1, p->fnames.dst_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); - /* in case snprintf didn't have room for NULL terminator */ - pt->history->fnames.src_filename[CF_FILENAME_MAX_LEN - 1] = 0; - pt->history->fnames.dst_filename[CF_FILENAME_MAX_LEN - 1] = 0; + /* in case snprintf didn't have room for NULL terminator */ + pt->history->fnames.src_filename[CF_FILENAME_MAX_LEN - 1] = 0; + pt->history->fnames.dst_filename[CF_FILENAME_MAX_LEN - 1] = 0; - CF_CFDP_TxFile_Initiate(pt, p->cfdp_class, p->keep, (c - CF_AppData.engine.channels), p->priority, - p->dest_id); + CF_CFDP_TxFile_Initiate(pt, p->cfdp_class, p->keep, (c - CF_AppData.engine.channels), p->priority, + p->dest_id); - pt->p = p; - ++p->num_ts; - } + pt->p = p; + ++p->num_ts; } else { @@ -1514,8 +1449,6 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_UpdatePollPbCounted * * Internal helper routine only, not part of API. * @@ -1540,8 +1473,6 @@ static void CF_CFDP_UpdatePollPbCounted(CF_Playback_t *pb, int up, uint8 *counte } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ProcessPlaybackDirectories * * Internal helper routine only, not part of API. * @@ -1560,8 +1491,6 @@ static void CF_CFDP_ProcessPlaybackDirectories(CF_Channel_t *c) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ProcessPollingDirectories * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1630,8 +1559,6 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_CycleEngine * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1672,8 +1599,6 @@ void CF_CFDP_CycleEngine(void) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ResetTransaction * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1743,7 +1668,19 @@ void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) /*---------------------------------------------------------------- * - * Function: CF_CFDP_SendEotPkt + * Application-scope internal function + * See description in cf_cfdp_r.h for argument/return detail + * + *-----------------------------------------------------------------*/ +void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) +{ + if (!CF_TxnStatus_IsError(t->history->txn_stat)) + { + t->history->txn_stat = txn_stat; + } +} + +/*---------------------------------------------------------------- * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1766,7 +1703,7 @@ void CF_CFDP_SendEotPkt(CF_Transaction_t *t) PktBuf->eot.direction = t->history->dir; PktBuf->eot.fnames = t->history->fnames; PktBuf->eot.state = t->state; - PktBuf->eot.cc = t->history->cc; + PktBuf->eot.txn_stat = t->history->txn_stat; PktBuf->eot.src_eid = t->history->src_eid; PktBuf->eot.peer_eid = t->history->peer_eid; PktBuf->eot.seq_num = t->history->seq_num; @@ -1782,8 +1719,6 @@ void CF_CFDP_SendEotPkt(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_CopyStringFromLV * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1804,8 +1739,6 @@ int CF_CFDP_CopyStringFromLV(char *buf, size_t buf_maxsz, const CF_Logical_Lv_t } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_CancelTransaction * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1817,14 +1750,12 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *t) if (!t->flags.com.canceled) { t->flags.com.canceled = 1; - t->history->cc = CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED; + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_CANCEL_REQUEST_RECEIVED); fns[!!CF_CFDP_IsSender(t)](t); } } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_CloseFiles * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail @@ -1841,8 +1772,6 @@ int CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DisableEngine * * Application-scope internal function * See description in cf_cfdp.h for argument/return detail diff --git a/fsw/src/cf_cfdp.h b/fsw/src/cf_cfdp.h index f36cbb46..f5543e69 100644 --- a/fsw/src/cf_cfdp.h +++ b/fsw/src/cf_cfdp.h @@ -93,6 +93,20 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical */ void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history); +/************************************************************************/ +/** @brief Helper function to store transaction status code only + * + * This records the status in the history block but does not set FIN flag + * or take any other protocol/state machine actions. + * + * @par Assumptions, External Events, and Notes: + * t must not be NULL. + * + * @param t Pointer to the transaction object + * @param txn_stat Status Code value to set within transaction + */ +void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat); + /************************************************************************/ /** @brief Send an end of transaction packet. * diff --git a/fsw/src/cf_cfdp_dispatch.c b/fsw/src/cf_cfdp_dispatch.c index 39528946..8a3efc65 100644 --- a/fsw/src/cf_cfdp_dispatch.c +++ b/fsw/src/cf_cfdp_dispatch.c @@ -32,8 +32,6 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_DispatchRecv * * Application-scope internal function * See description in cf_cfdp_dispatch.h for argument/return detail @@ -70,7 +68,7 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, } else { - if (t->history->cc == CF_CFDP_ConditionCode_NO_ERROR) + if (!CF_TxnStatus_IsError(t->history->txn_stat)) { selected_handler = fd_fn; } @@ -91,8 +89,6 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_DispatchRecv * * Application-scope internal function * See description in cf_cfdp_dispatch.h for argument/return detail @@ -149,8 +145,6 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_DispatchTransmit * * Application-scope internal function * See description in cf_cfdp_dispatch.h for argument/return detail @@ -168,8 +162,6 @@ void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSen } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_TxStateDispatch * * Application-scope internal function * See description in cf_cfdp_dispatch.h for argument/return detail @@ -188,8 +180,6 @@ void CF_CFDP_TxStateDispatch(CF_Transaction_t *t, const CF_CFDP_TxnSendDispatchT } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_RxStateDispatch * * Application-scope internal function * See description in cf_cfdp_dispatch.h for argument/return detail diff --git a/fsw/src/cf_cfdp_pdu.h b/fsw/src/cf_cfdp_pdu.h index 6a3fff35..d60f19d6 100644 --- a/fsw/src/cf_cfdp_pdu.h +++ b/fsw/src/cf_cfdp_pdu.h @@ -41,7 +41,6 @@ #include "common_types.h" #include "cf_platform_cfg.h" -#include "cf_platform_cfg.h" #include @@ -142,7 +141,6 @@ typedef struct CF_CFDP_PduHeader CF_CFDP_uint8_t eid_tsn_lengths; /**< \brief Lengths of the EID+TSN data (bitfields) */ /* variable-length data goes here - it is at least 3 additional bytes */ - } CF_CFDP_PduHeader_t; /** @@ -216,21 +214,6 @@ typedef enum CF_CFDP_FileDirective_INVALID_MAX = 13, /**< \brief Maximum used to limit range */ } CF_CFDP_FileDirective_t; -/** - * @brief Values for CFDP file transfer class - * - * The CFDP specification prescribes two classes/modes of file - * transfer protocol operation - unacknowledged/simple or - * acknowledged/reliable. - * - * Defined per section 7.1 of CCSDS 727.0-B-5 - */ -typedef enum -{ - CF_CFDP_CLASS_1 = 0, /**< \brief CFDP class 1 - Unreliable transfer */ - CF_CFDP_CLASS_2 = 1, /**< \brief CFDP class 2 - Reliable transfer */ -} CF_CFDP_Class_t; - /** * @brief Values for "acknowledgment transfer status" * @@ -316,7 +299,6 @@ typedef struct CF_CFDP_PduEof CF_CFDP_uint8_t cc; CF_CFDP_uint32_t crc; CF_CFDP_uint32_t size; - } CF_CFDP_PduEof_t; /** @@ -327,7 +309,6 @@ typedef struct CF_CFDP_PduEof typedef struct CF_CFDP_PduFin { CF_CFDP_uint8_t flags; - } CF_CFDP_PduFin_t; /** @@ -361,7 +342,6 @@ typedef struct CF_CFDP_PduNak { CF_CFDP_uint32_t scope_start; CF_CFDP_uint32_t scope_end; - } CF_CFDP_PduNak_t; /** @@ -373,7 +353,6 @@ typedef struct CF_CFDP_PduMd { CF_CFDP_uint8_t segmentation_control; CF_CFDP_uint32_t size; - } CF_CFDP_PduMd_t; /** diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index 68e2426a..96c5ea15 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -39,22 +39,18 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_SetCc * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_SetCc(CF_Transaction_t *t, CF_CFDP_ConditionCode_t cc) +void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) { - t->history->cc = cc; + CF_CFDP_SetTxnStatus(t, txn_stat); t->flags.rx.send_fin = 1; } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R1_Reset * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -66,8 +62,6 @@ void CF_CFDP_R1_Reset(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_Reset * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -76,8 +70,8 @@ void CF_CFDP_R1_Reset(CF_Transaction_t *t) void CF_CFDP_R2_Reset(CF_Transaction_t *t) { if ((t->state_data.r.sub_state == CF_RxSubState_WAIT_FOR_FIN_ACK) || - (t->state_data.r.r2.eof_cc != CF_CFDP_ConditionCode_NO_ERROR) || - (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) || t->flags.com.canceled) + (t->state_data.r.r2.eof_cc != CF_CFDP_ConditionCode_NO_ERROR) || CF_TxnStatus_IsError(t->history->txn_stat) || + t->flags.com.canceled) { CF_CFDP_R1_Reset(t); /* it's done */ } @@ -89,8 +83,6 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_CheckCrc * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -115,8 +107,6 @@ int CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_Complete * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -130,7 +120,7 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) /* checking if r2 is complete. Check nak list, and send NAK if appropriate */ /* if all data is present, then there will be no gaps in the chunk */ - if (t->history->cc == CF_CFDP_ConditionCode_NO_ERROR) + if (!CF_TxnStatus_IsError(t->history->txn_stat)) { /* first, check if md is received. If not, send specialized nak */ if (!t->flags.rx.md_recv) @@ -167,9 +157,9 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); send_fin = 1; ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.nak_limit; - t->history->cc = CF_CFDP_ConditionCode_NAK_LIMIT_REACHED; /* don't use CF_CFDP_R2_SetCc because many - places in this function set send_fin */ - t->state_data.r.r2.acknak_count = 0; /* reset for fin/ack */ + /* don't use CF_CFDP_R2_SetFinTxnStatus because many places in this function set send_fin */ + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NAK_LIMIT_REACHED); + t->state_data.r.r2.acknak_count = 0; /* reset for fin/ack */ } else { @@ -179,8 +169,11 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) if (send_fin) { - t->flags.rx.send_fin = 1; t->flags.rx.complete = 1; /* latch completeness, since send_fin is cleared later */ + + /* the transaction is now considered complete, but this will not overwrite an + * error status code if there was one set */ + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_NO_ERROR); } /* always go to CF_RxSubState_FILEDATA, and let tick change state */ @@ -189,8 +182,6 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_ProcessFd * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -221,7 +212,7 @@ int CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) "CF R%d(%lu:%lu): failed to seek offset %ld, got %ld", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)fd->offset, (long)fret); - t->history->cc = CF_CFDP_ConditionCode_FILE_SIZE_ERROR; + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; ret = -1; /* connection will reset in caller */ } @@ -236,9 +227,9 @@ int CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) "CF R%d(%lu:%lu): OS_write expected %ld, got %ld", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)fd->data_len, (long)fret); + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_write; - t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; - ret = -1; /* connection will reset in caller */ + ret = -1; /* connection will reset in caller */ } else { @@ -251,8 +242,6 @@ int CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_SubstateRecvEof * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -292,8 +281,6 @@ int CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R1_SubstateRecvEof * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -326,8 +313,6 @@ void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_SubstateRecvEof * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -364,6 +349,7 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } else { + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_From_ConditionCode(t->state_data.r.r2.eof_cc)); CF_CFDP_R2_Reset(t); } } @@ -372,7 +358,7 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) /* bad eof sent? */ if (ret == CF_RxEofRet_FSIZE_MISMATCH) { - CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); } else { @@ -384,8 +370,6 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R1_SubstateRecvFileData * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -415,8 +399,6 @@ void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_SubstateRecvFileData * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -462,8 +444,6 @@ void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_GapCompute * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -496,8 +476,6 @@ void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, vo } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_SubstateSendNak * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -579,8 +557,6 @@ int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_Init * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -621,7 +597,7 @@ void CF_CFDP_R_Init(CF_Transaction_t *t) t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ if (t->state == CF_TxnState_R2) { - CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); } else { @@ -635,8 +611,6 @@ void CF_CFDP_R_Init(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_CalcCrcChunk * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -685,7 +659,7 @@ int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) "CF R%d(%lu:%lu): failed to seek offset %lu, got %ld", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (unsigned long)t->state_data.r.r2.rx_crc_calc_bytes, (long)fret); - t->history->cc = CF_CFDP_ConditionCode_FILE_SIZE_ERROR; /* should be ok to use this one */ + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; success = false; break; @@ -699,7 +673,7 @@ int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) "CF R%d(%lu:%lu): failed to read file expected %lu, got %ld", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (unsigned long)read_size, (long)fret); - t->history->cc = CF_CFDP_ConditionCode_FILE_SIZE_ERROR; /* should be ok to use this one */ + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read; success = false; break; @@ -725,7 +699,7 @@ int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) } else { - CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILE_CHECKSUM_FAILURE); + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILE_CHECKSUM_FAILURE); } t->flags.com.crc_calc = 1; @@ -737,8 +711,6 @@ int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_SubstateSendFin * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -749,7 +721,7 @@ int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) CF_SendRet_t sret; int ret = 0; - if (t->history->cc == CF_CFDP_ConditionCode_NO_ERROR && !t->flags.com.crc_calc) + if (!CF_TxnStatus_IsError(t->history->txn_stat) && !t->flags.com.crc_calc) { /* no error, and haven't checked crc -- so start checking it */ if (CF_CFDP_R2_CalcCrcChunk(t)) @@ -760,7 +732,8 @@ int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) if (ret != -1) { - sret = CF_CFDP_SendFin(t, t->state_data.r.r2.dc, t->state_data.r.r2.fs, t->history->cc); + sret = CF_CFDP_SendFin(t, t->state_data.r.r2.dc, t->state_data.r.r2.fs, + CF_TxnStatus_To_ConditionCode(t->history->txn_stat)); CF_Assert(sret != CF_SendRet_ERROR); /* CF_CFDP_SendFin does not return CF_SendRet_ERROR */ t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; /* whether or not fin send successful, ok to transition state */ @@ -775,8 +748,6 @@ int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_Recv_fin_ack * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -799,8 +770,6 @@ void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_RecvMd * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -839,7 +808,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) (unsigned long)t->history->seq_num, (unsigned long)t->fsize, (unsigned long)t->state_data.r.r2.eof_size); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_size_mismatch; - CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); success = false; } } @@ -861,7 +830,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)status); t->fd = OS_OBJECT_ID_UNDEFINED; - CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_rename; success = false; } @@ -875,7 +844,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) "CF R%d(%lu:%lu): failed to open renamed file in R2, error=%ld", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)ret); - CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ success = false; @@ -903,8 +872,6 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R1_Recv * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -923,8 +890,6 @@ void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R2_Recv * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -951,8 +916,6 @@ void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_Cancel * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -972,8 +935,6 @@ void CF_CFDP_R_Cancel(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_SendInactivityEvent * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -988,8 +949,6 @@ void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_R_Tick * * Application-scope internal function * See description in cf_cfdp_r.h for argument/return detail @@ -1014,7 +973,7 @@ void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont /* unused */) { CF_CFDP_R_SendInactivityEvent(t); - CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_INACTIVITY_DETECTED); + CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_INACTIVITY_DETECTED); t->flags.rx.inactivity_fired = 1; } else @@ -1076,6 +1035,7 @@ void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont /* unused */) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_ACK_LIMIT, CFE_EVS_EventType_ERROR, "CF R2(%lu:%lu): ack limit reached, no fin-ack", (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_ACK_LIMIT_NO_FIN); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit; CF_CFDP_R2_Reset(t); success = false; diff --git a/fsw/src/cf_cfdp_r.h b/fsw/src/cf_cfdp_r.h index 656f66af..1e512dbb 100644 --- a/fsw/src/cf_cfdp_r.h +++ b/fsw/src/cf_cfdp_r.h @@ -104,15 +104,15 @@ void CF_CFDP_R_Cancel(CF_Transaction_t *t); void CF_CFDP_R_Init(CF_Transaction_t *t); /************************************************************************/ -/** @brief Helper function to store condition code set send_fin flag. +/** @brief Helper function to store transaction status code and set send_fin flag. * * @par Assumptions, External Events, and Notes: * t must not be NULL. * * @param t Pointer to the transaction object - * @param cc Condition Code value to set within transaction + * @param txn_stat Status Code value to set within transaction */ -void CF_CFDP_R2_SetCc(CF_Transaction_t *t, CF_CFDP_ConditionCode_t cc); +void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat); /************************************************************************/ /** @brief CFDP R1 transaction reset function. diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index 7ff64202..85a3a995 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -41,8 +41,6 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_Reset * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -54,8 +52,6 @@ static inline void CF_CFDP_S_Reset(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_SendEof * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -72,8 +68,6 @@ CF_SendRet_t CF_CFDP_S_SendEof(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S1_SubstateSendEof * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -91,8 +85,6 @@ void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_SubstateSendEof * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -111,8 +103,6 @@ void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_SendFileData * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -234,8 +224,6 @@ int32 CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_ } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_SubstateSendFileData * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -257,7 +245,7 @@ void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) else if (bytes_processed < 0) { /* IO error -- change state and send EOF */ - t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); t->state_data.s.sub_state = CF_TxSubState_EOF; } else @@ -267,8 +255,6 @@ void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_CheckAndRespondNak * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -324,8 +310,6 @@ int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_SubstateSendFileData * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -341,6 +325,7 @@ void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t) } else if (ret < 0) { + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NAK_RESPONSE_ERROR); CF_CFDP_S_Reset(t); } else @@ -350,8 +335,6 @@ void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_SubstateSendMetadata * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -443,7 +426,7 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) if (!success) { - t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); CF_CFDP_S_Reset(t); } @@ -452,8 +435,6 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_SubstateSendFinAck * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -465,13 +446,12 @@ void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *t) if (CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_FIN, t->state_data.s.s2.fin_cc, t->history->peer_eid, t->history->seq_num) != CF_SendRet_NO_MSG) { + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NO_ERROR); CF_CFDP_S_Reset(t); } } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_EarlyFin * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -483,12 +463,11 @@ void CF_CFDP_S2_EarlyFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_EARLY_FIN, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): got early fin -- cancelling", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_EARLY_FIN); CF_CFDP_S_Reset(t); } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_Fin * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -501,8 +480,6 @@ void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_Nak * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -569,8 +546,6 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_Nak_Arm * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -583,8 +558,6 @@ void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_WaitForEofAck * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -596,7 +569,7 @@ void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) { /* don't send fin if error. Don't check the eof CC, just go with * the stored one we sent before */ - if (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) + if (CF_TxnStatus_IsError(t->history->txn_stat)) { CF_CFDP_S_Reset(t); } @@ -616,8 +589,6 @@ void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S1_Recv * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -631,8 +602,6 @@ void CF_CFDP_S1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_Recv * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -669,8 +638,6 @@ void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S1_Tx * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -689,8 +656,6 @@ void CF_CFDP_S1_Tx(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S2_Tx * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -709,8 +674,6 @@ void CF_CFDP_S2_Tx(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_Cancel * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -726,8 +689,6 @@ void CF_CFDP_S_Cancel(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_Tick * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail @@ -750,6 +711,8 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_INACT_TIMER, CFE_EVS_EventType_ERROR, "CF S2(%lu:%lu): inactivity timer expired", (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_INACTIVITY_DETECTED); + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer; CF_CFDP_S_Reset(t); } @@ -772,6 +735,7 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_ACK_LIMIT, CFE_EVS_EventType_ERROR, "CF S2(%lu:%lu), ack limit reached, no eof-ack", (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_ACK_LIMIT_NO_EOF); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit; /* no reason to reset this timer, as it isn't used again */ @@ -787,6 +751,7 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) } else if (sret == CF_SendRet_ERROR) { + CF_CFDP_SetTxnStatus(t, CF_TxnStatus_SEND_EOF_FAILURE); CF_CFDP_S_Reset(t); /* can't go on, error occurred */ early_exit = true; } @@ -813,8 +778,6 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_S_Tick_Nak * * Application-scope internal function * See description in cf_cfdp_s.h for argument/return detail diff --git a/fsw/src/cf_cfdp_sbintf.c b/fsw/src/cf_cfdp_sbintf.c index 2c0ce9ba..c0ec9325 100644 --- a/fsw/src/cf_cfdp_sbintf.c +++ b/fsw/src/cf_cfdp_sbintf.c @@ -53,8 +53,6 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_CFDP_MsgOutGet * * Application-scope internal function * See description in cf_cfdp_sbintf.h for argument/return detail @@ -139,8 +137,6 @@ CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_Send * * Application-scope internal function * See description in cf_cfdp_sbintf.h for argument/return detail @@ -168,8 +164,6 @@ void CF_CFDP_Send(uint8 chan_num, const CF_Logical_PduBuffer_t *ph) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_ReceiveMessage * * Application-scope internal function * See description in cf_cfdp_sbintf.h for argument/return detail diff --git a/fsw/src/cf_cfdp_types.h b/fsw/src/cf_cfdp_types.h index 900100c8..812b9ba1 100644 --- a/fsw/src/cf_cfdp_types.h +++ b/fsw/src/cf_cfdp_types.h @@ -34,6 +34,7 @@ #include "common_types.h" #include "cf_cfdp_pdu.h" #include "cf_platform_cfg.h" +#include "cf_msg.h" #include "cf_clist.h" #include "cf_chunk.h" #include "cf_timer.h" @@ -113,18 +114,6 @@ typedef enum CF_RxEofRet_INVALID = 3, } CF_RxEofRet_t; -/** - * @brief Cache of source and destination filename - * - * This pairs a source and destination file name together - * to be retained for future reference in the transaction/history - */ -typedef struct CF_TxnFilenames -{ - char src_filename[CF_FILENAME_MAX_LEN]; - char dst_filename[CF_FILENAME_MAX_LEN]; -} CF_TxnFilenames_t; - /** * @brief Direction identifier * @@ -137,6 +126,56 @@ typedef enum CF_Direction_NUM = 2, } CF_Direction_t; +/** + * @brief Values for Transaction Status code + * + * This enum defines the possible values representing the + * result of a transaction. This is a superset of the condition codes + * defined in CCSDS book 727 (condition codes) but with additional + * values for local conditions that the blue book does not have, + * such as protocol/state machine or decoding errors. + * + * The values here are designed to not overlap with the condition + * codes defined in the blue book, but can be translated to one + * of those codes for the purposes of FIN/ACK/EOF PDUs. + */ +typedef enum +{ + /** + * The undefined status is a placeholder for new transactions before a value is set. + */ + CF_TxnStatus_UNDEFINED = -1, + + /* Status codes 0-15 share the same values/meanings as the CFDP condition code (CC) */ + CF_TxnStatus_NO_ERROR = CF_CFDP_ConditionCode_NO_ERROR, + CF_TxnStatus_POS_ACK_LIMIT_REACHED = CF_CFDP_ConditionCode_POS_ACK_LIMIT_REACHED, + CF_TxnStatus_KEEP_ALIVE_LIMIT_REACHED = CF_CFDP_ConditionCode_KEEP_ALIVE_LIMIT_REACHED, + CF_TxnStatus_INVALID_TRANSMISSION_MODE = CF_CFDP_ConditionCode_INVALID_TRANSMISSION_MODE, + CF_TxnStatus_FILESTORE_REJECTION = CF_CFDP_ConditionCode_FILESTORE_REJECTION, + CF_TxnStatus_FILE_CHECKSUM_FAILURE = CF_CFDP_ConditionCode_FILE_CHECKSUM_FAILURE, + CF_TxnStatus_FILE_SIZE_ERROR = CF_CFDP_ConditionCode_FILE_SIZE_ERROR, + CF_TxnStatus_NAK_LIMIT_REACHED = CF_CFDP_ConditionCode_NAK_LIMIT_REACHED, + CF_TxnStatus_INACTIVITY_DETECTED = CF_CFDP_ConditionCode_INACTIVITY_DETECTED, + CF_TxnStatus_INVALID_FILE_STRUCTURE = CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE, + CF_TxnStatus_CHECK_LIMIT_REACHED = CF_CFDP_ConditionCode_CHECK_LIMIT_REACHED, + CF_TxnStatus_UNSUPPORTED_CHECKSUM_TYPE = CF_CFDP_ConditionCode_UNSUPPORTED_CHECKSUM_TYPE, + CF_TxnStatus_SUSPEND_REQUEST_RECEIVED = CF_CFDP_ConditionCode_SUSPEND_REQUEST_RECEIVED, + CF_TxnStatus_CANCEL_REQUEST_RECEIVED = CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED, + + /* Additional status codes for items not representable in a CFDP CC, these can be set in + * transactions that did not make it to the point of sending FIN/EOF. */ + CF_TxnStatus_PROTOCOL_ERROR = 16, + CF_TxnStatus_ACK_LIMIT_NO_FIN = 17, + CF_TxnStatus_ACK_LIMIT_NO_EOF = 18, + CF_TxnStatus_NAK_RESPONSE_ERROR = 19, + CF_TxnStatus_SEND_EOF_FAILURE = 20, + CF_TxnStatus_EARLY_FIN = 21, + + /* keep last */ + CF_TxnStatus_MAX = 22 + +} CF_TxnStatus_t; + /** * @brief CF History entry * @@ -144,13 +183,13 @@ typedef enum */ typedef struct CF_History { - CF_TxnFilenames_t fnames; /**< \brief file names associated with this history entry */ - CF_CListNode_t cl_node; /**< \brief for connection to a CList */ - CF_Direction_t dir; /**< \brief direction of this history entry */ - CF_CFDP_ConditionCode_t cc; /**< \brief final condition code of operation */ - CF_EntityId_t src_eid; /**< \brief the source eid of the transaction */ - CF_EntityId_t peer_eid; /**< \brief peer_eid is always the "other guy", same src_eid for RX */ - CF_TransactionSeq_t seq_num; /**< \brief transaction identifier, stays constant for entire transfer */ + CF_TxnFilenames_t fnames; /**< \brief file names associated with this history entry */ + CF_CListNode_t cl_node; /**< \brief for connection to a CList */ + CF_Direction_t dir; /**< \brief direction of this history entry */ + CF_TxnStatus_t txn_stat; /**< \brief final status of operation */ + CF_EntityId_t src_eid; /**< \brief the source eid of the transaction */ + CF_EntityId_t peer_eid; /**< \brief peer_eid is always the "other guy", same src_eid for RX */ + CF_TransactionSeq_t seq_num; /**< \brief transaction identifier, stays constant for entire transfer */ } CF_History_t; /** @@ -339,24 +378,8 @@ typedef struct CF_Transaction * Please ignore the duplicate declarations of the "all" flags. */ CF_StateFlags_t flags; - } CF_Transaction_t; -/** - * @brief CF queue identifiers - */ -typedef enum -{ - CF_QueueIdx_PEND = 0, /**< \brief first one on this list is active */ - CF_QueueIdx_TXA = 1, - CF_QueueIdx_TXW = 2, - CF_QueueIdx_RX = 3, - CF_QueueIdx_HIST = 4, - CF_QueueIdx_HIST_FREE = 5, - CF_QueueIdx_FREE = 6, - CF_QueueIdx_NUM = 7, -} CF_QueueIdx_t; - /** * @brief Identifies the type of timer tick being processed */ diff --git a/fsw/src/cf_chunk.c b/fsw/src/cf_chunk.c index 4a532045..af21a870 100644 --- a/fsw/src/cf_chunk.c +++ b/fsw/src/cf_chunk.c @@ -37,8 +37,6 @@ #include "cf_chunk.h" /*---------------------------------------------------------------- - * - * Function: CF_Chunks_EraseRange * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -57,8 +55,6 @@ void CF_Chunks_EraseRange(CF_ChunkList_t *chunks, CF_ChunkIdx_t start, CF_ChunkI } /*---------------------------------------------------------------- - * - * Function: CF_Chunks_EraseChunk * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -76,8 +72,6 @@ void CF_Chunks_EraseChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t erase_index) } /*---------------------------------------------------------------- - * - * Function: CF_Chunks_InsertChunk * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -99,8 +93,6 @@ void CF_Chunks_InsertChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t index_before, c } /*---------------------------------------------------------------- - * - * Function: CF_Chunks_FindInsertPosition * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -133,8 +125,6 @@ CF_ChunkIdx_t CF_Chunks_FindInsertPosition(CF_ChunkList_t *chunks, const CF_Chun } /*---------------------------------------------------------------- - * - * Function: CF_Chunks_CombinePrevious * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -172,8 +162,6 @@ int CF_Chunks_CombinePrevious(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_ } /*---------------------------------------------------------------- - * - * Function: CF_Chunks_CombineNext * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -201,7 +189,6 @@ int CF_Chunks_CombineNext(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chun /* If index advanced the range of chunks can be combined */ if (i != combined_i) { - /* End is the max of last combined chunk end or new chunk end */ chunk_end = CF_Chunk_MAX(chunks->chunks[combined_i - 1].offset + chunks->chunks[combined_i - 1].size, chunk_end); @@ -219,8 +206,6 @@ int CF_Chunks_CombineNext(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chun } /*---------------------------------------------------------------- - * - * Function: CF_Chunks_FindSmallestSize * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -243,8 +228,6 @@ CF_ChunkIdx_t CF_Chunks_FindSmallestSize(const CF_ChunkList_t *chunks) } /*---------------------------------------------------------------- - * - * Function: CF_Chunks_Insert * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -289,8 +272,6 @@ void CF_Chunks_Insert(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t } /*---------------------------------------------------------------- - * - * Function: CF_ChunkListAdd * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -310,8 +291,6 @@ void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSi } /*---------------------------------------------------------------- - * - * Function: CF_ChunkList_RemoveFromFirst * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -338,8 +317,6 @@ void CF_ChunkList_RemoveFromFirst(CF_ChunkList_t *chunks, CF_ChunkSize_t size) } /*---------------------------------------------------------------- - * - * Function: CF_ChunkList_GetFirstChunk * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -351,8 +328,6 @@ const CF_Chunk_t *CF_ChunkList_GetFirstChunk(const CF_ChunkList_t *chunks) } /*---------------------------------------------------------------- - * - * Function: CF_ChunkListInit * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -367,8 +342,6 @@ void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t max_chunks, CF_Chunk } /*---------------------------------------------------------------- - * - * Function: CF_ChunkListReset * * Application-scope internal function * See description in cf_chunk.h for argument/return detail @@ -381,8 +354,6 @@ void CF_ChunkListReset(CF_ChunkList_t *chunks) } /*---------------------------------------------------------------- - * - * Function: CF_ChunkList_ComputeGaps * * Application-scope internal function * See description in cf_chunk.h for argument/return detail diff --git a/fsw/src/cf_clist.c b/fsw/src/cf_clist.c index 3f7af2cd..07d0632f 100644 --- a/fsw/src/cf_clist.c +++ b/fsw/src/cf_clist.c @@ -33,8 +33,6 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_CList_InitNode * * Application-scope internal function * See description in cf_clist.h for argument/return detail @@ -47,8 +45,6 @@ void CF_CList_InitNode(CF_CListNode_t *node) } /*---------------------------------------------------------------- - * - * Function: CF_CList_InsertFront * * Application-scope internal function * See description in cf_clist.h for argument/return detail @@ -78,8 +74,6 @@ void CF_CList_InsertFront(CF_CListNode_t **head, CF_CListNode_t *node) } /*---------------------------------------------------------------- - * - * Function: CF_CList_InsertBack * * Application-scope internal function * See description in cf_clist.h for argument/return detail @@ -110,8 +104,6 @@ void CF_CList_InsertBack(CF_CListNode_t **head, CF_CListNode_t *node) } /*---------------------------------------------------------------- - * - * Function: CF_CList_Pop * * Application-scope internal function * See description in cf_clist.h for argument/return detail @@ -133,8 +125,6 @@ CF_CListNode_t *CF_CList_Pop(CF_CListNode_t **head) } /*---------------------------------------------------------------- - * - * Function: CF_CList_Remove * * Application-scope internal function * See description in cf_clist.h for argument/return detail @@ -170,8 +160,6 @@ void CF_CList_Remove(CF_CListNode_t **head, CF_CListNode_t *node) } /*---------------------------------------------------------------- - * - * Function: CF_CList_InsertAfter * * Application-scope internal function * See description in cf_clist.h for argument/return detail @@ -193,8 +181,6 @@ void CF_CList_InsertAfter(CF_CListNode_t **head, CF_CListNode_t *start, CF_CList } /*---------------------------------------------------------------- - * - * Function: CF_CList_Traverse * * Application-scope internal function * See description in cf_clist.h for argument/return detail @@ -234,8 +220,6 @@ void CF_CList_Traverse(CF_CListNode_t *start, CF_CListFn_t fn, void *context) } /*---------------------------------------------------------------- - * - * Function: CF_CList_Traverse_R * * Application-scope internal function * See description in cf_clist.h for argument/return detail diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index 79dcbe0d..53eb8130 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -39,8 +39,6 @@ #include /*---------------------------------------------------------------- - * - * Function: CF_CmdNoop * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -54,8 +52,6 @@ void CF_CmdNoop(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdReset * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -124,8 +120,6 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdTxFile * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -169,8 +163,6 @@ void CF_CmdTxFile(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdPlaybackDir * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -215,8 +207,6 @@ void CF_CmdPlaybackDir(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_DoChanAction * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -252,8 +242,6 @@ int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_ChanActionFn_ } /*---------------------------------------------------------------- - * - * Function: CF_DoFreezeThaw * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -267,8 +255,6 @@ int CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) } /*---------------------------------------------------------------- - * - * Function: CF_CmdFreeze * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -291,8 +277,6 @@ void CF_CmdFreeze(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdThaw * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -315,8 +299,6 @@ void CF_CmdThaw(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_FindTransactionBySequenceNumberAllChannels * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -345,8 +327,6 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumberAllChannels(CF_TransactionSe } /*---------------------------------------------------------------- - * - * Function: CF_TsnChanAction * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -394,8 +374,6 @@ int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAct } /*---------------------------------------------------------------- - * - * Function: CF_DoSuspRes_Txn * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -415,8 +393,6 @@ void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context) } /*---------------------------------------------------------------- - * - * Function: CF_DoSuspRes * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -458,8 +434,6 @@ void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action) } /*---------------------------------------------------------------- - * - * Function: CF_CmdSuspend * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -471,8 +445,6 @@ void CF_CmdSuspend(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdResume * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -484,8 +456,6 @@ void CF_CmdResume(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdCancel_Txn * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -497,8 +467,6 @@ void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored) } /*---------------------------------------------------------------- - * - * Function: CF_CmdCancel * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -521,8 +489,6 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdAbandon_Txn * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -534,8 +500,6 @@ void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored) } /*---------------------------------------------------------------- - * - * Function: CF_CmdAbandon * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -558,8 +522,6 @@ void CF_CmdAbandon(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_DoEnableDisableDequeue * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -573,8 +535,6 @@ int CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *con } /*---------------------------------------------------------------- - * - * Function: CF_CmdEnableDequeue * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -598,8 +558,6 @@ void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdDisableDequeue * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -623,8 +581,6 @@ void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_DoEnableDisablePolldir * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -657,8 +613,6 @@ int CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t * } /*---------------------------------------------------------------- - * - * Function: CF_CmdEnablePolldir * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -684,8 +638,6 @@ void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdDisablePolldir * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -711,8 +663,6 @@ void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_PurgeHistory * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -726,8 +676,6 @@ int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) } /*---------------------------------------------------------------- - * - * Function: CF_PurgeTransaction * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -741,8 +689,6 @@ int CF_PurgeTransaction(CF_CListNode_t *n, void *ignored) } /*---------------------------------------------------------------- - * - * Function: CF_DoPurgeQueue * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -793,8 +739,6 @@ int CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd) } /*---------------------------------------------------------------- - * - * Function: CF_CmdPurgeQueue * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -816,8 +760,6 @@ void CF_CmdPurgeQueue(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdWriteQueue * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -951,8 +893,6 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdValidateChunkSize * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -969,8 +909,6 @@ int CF_CmdValidateChunkSize(uint32 val, uint8 chan_num /* ignored */) } /*---------------------------------------------------------------- - * - * Function: CF_CmdValidateMaxOutgoing * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -990,8 +928,6 @@ int CF_CmdValidateMaxOutgoing(uint32 val, uint8 chan_num) } /*---------------------------------------------------------------- - * - * Function: CF_CmdGetSetParam * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -1148,8 +1084,6 @@ void CF_CmdGetSetParam(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, } /*---------------------------------------------------------------- - * - * Function: CF_CmdSetParam * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -1162,8 +1096,6 @@ void CF_CmdSetParam(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdGetParam * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -1176,8 +1108,6 @@ void CF_CmdGetParam(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdEnableEngine * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -1208,8 +1138,6 @@ void CF_CmdEnableEngine(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_CmdDisableEngine * * Application-scope internal function * See description in cf_cmd.h for argument/return detail @@ -1232,8 +1160,6 @@ void CF_CmdDisableEngine(CFE_SB_Buffer_t *msg) } /*---------------------------------------------------------------- - * - * Function: CF_ProcessGroundCommand * * Application-scope internal function * See description in cf_cmd.h for argument/return detail diff --git a/fsw/src/cf_codec.c b/fsw/src/cf_codec.c index 5fee046e..c2855e47 100644 --- a/fsw/src/cf_codec.c +++ b/fsw/src/cf_codec.c @@ -124,8 +124,6 @@ static const CF_Codec_BitField_t CF_CFDP_PduFileData_SEGMENT_METADATA_LENGTH = */ /*---------------------------------------------------------------- - * - * Function: CF_Codec_Store_uint8 * * Internal helper routine only, not part of API. * @@ -136,8 +134,6 @@ static inline void CF_Codec_Store_uint8(CF_CFDP_uint8_t *pdst, uint8 val) } /*---------------------------------------------------------------- - * - * Function: CF_Codec_Store_uint16 * * Internal helper routine only, not part of API. * @@ -150,8 +146,6 @@ static inline void CF_Codec_Store_uint16(CF_CFDP_uint16_t *pdst, uint16 val) } /*---------------------------------------------------------------- - * - * Function: CF_Codec_Store_uint32 * * Internal helper routine only, not part of API. * @@ -168,8 +162,6 @@ static inline void CF_Codec_Store_uint32(CF_CFDP_uint32_t *pdst, uint32 val) } /*---------------------------------------------------------------- - * - * Function: CF_Codec_Store_uint64 * * Internal helper routine only, not part of API. * @@ -194,8 +186,6 @@ static inline void CF_Codec_Store_uint64(CF_CFDP_uint64_t *pdst, uint64 val) } /*---------------------------------------------------------------- - * - * Function: CF_Codec_Load_uint8 * * Internal helper routine only, not part of API. * @@ -206,8 +196,6 @@ static inline void CF_Codec_Load_uint8(uint8 *pdst, const CF_CFDP_uint8_t *psrc) } /*---------------------------------------------------------------- - * - * Function: CF_Codec_Load_uint16 * * Internal helper routine only, not part of API. * @@ -224,8 +212,6 @@ static inline void CF_Codec_Load_uint16(uint16 *pdst, const CF_CFDP_uint16_t *ps } /*---------------------------------------------------------------- - * - * Function: CF_Codec_Load_uint32 * * Internal helper routine only, not part of API. * @@ -246,8 +232,6 @@ static inline void CF_Codec_Load_uint32(uint32 *pdst, const CF_CFDP_uint32_t *ps } /*---------------------------------------------------------------- - * - * Function: CF_Codec_Load_uint64 * * Internal helper routine only, not part of API. * @@ -276,8 +260,6 @@ static inline void CF_Codec_Load_uint64(uint64 *pdst, const CF_CFDP_uint64_t *ps } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_CodecCheckSize * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -300,8 +282,6 @@ bool CF_CFDP_CodecCheckSize(CF_CodecState_t *state, size_t chunksize) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DoEncodeChunk * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -320,8 +300,6 @@ void *CF_CFDP_DoEncodeChunk(CF_EncoderState_t *state, size_t chunksize) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DoDecodeChunk * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -340,8 +318,6 @@ const void *CF_CFDP_DoDecodeChunk(CF_DecoderState_t *state, size_t chunksize) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_GetValueEncodedSize * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -361,8 +337,6 @@ uint8 CF_CFDP_GetValueEncodedSize(uint64 Value) } /*---------------------------------------------------------------- - * - * Function: CF_EncodeIntegerInSize * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -388,8 +362,6 @@ void CF_EncodeIntegerInSize(CF_EncoderState_t *state, uint64 value, uint8 encode } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeHeaderWithoutSize * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -426,8 +398,6 @@ void CF_CFDP_EncodeHeaderWithoutSize(CF_EncoderState_t *state, CF_Logical_PduHea } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeHeaderFinalSize * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -458,8 +428,6 @@ void CF_CFDP_EncodeHeaderFinalSize(CF_EncoderState_t *state, CF_Logical_PduHeade } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeFileDirectiveHeader * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -478,8 +446,6 @@ void CF_CFDP_EncodeFileDirectiveHeader(CF_EncoderState_t *state, CF_Logical_PduF } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeLV * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -510,8 +476,6 @@ void CF_CFDP_EncodeLV(CF_EncoderState_t *state, CF_Logical_Lv_t *pllv) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeTLV * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -550,8 +514,6 @@ void CF_CFDP_EncodeTLV(CF_EncoderState_t *state, CF_Logical_Tlv_t *pltlv) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeSegmentRequest * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -570,8 +532,6 @@ void CF_CFDP_EncodeSegmentRequest(CF_EncoderState_t *state, CF_Logical_SegmentRe } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeAllTlv * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -588,8 +548,6 @@ void CF_CFDP_EncodeAllTlv(CF_EncoderState_t *state, CF_Logical_TlvList_t *pltlv) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeAllSegments * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -606,8 +564,6 @@ void CF_CFDP_EncodeAllSegments(CF_EncoderState_t *state, CF_Logical_SegmentList_ } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeMd * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -632,8 +588,6 @@ void CF_CFDP_EncodeMd(CF_EncoderState_t *state, CF_Logical_PduMd_t *plmd) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeFileDataHeader * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -671,8 +625,6 @@ void CF_CFDP_EncodeFileDataHeader(CF_EncoderState_t *state, bool with_meta, CF_L } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeEof * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -695,8 +647,6 @@ void CF_CFDP_EncodeEof(CF_EncoderState_t *state, CF_Logical_PduEof_t *pleof) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeFin * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -719,8 +669,6 @@ void CF_CFDP_EncodeFin(CF_EncoderState_t *state, CF_Logical_PduFin_t *plfin) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeAck * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -744,8 +692,6 @@ void CF_CFDP_EncodeAck(CF_EncoderState_t *state, CF_Logical_PduAck_t *plack) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeNak * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -766,8 +712,6 @@ void CF_CFDP_EncodeNak(CF_EncoderState_t *state, CF_Logical_PduNak_t *plnak) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_EncodeCrc * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -785,8 +729,6 @@ void CF_CFDP_EncodeCrc(CF_EncoderState_t *state, uint32 *plcrc) } /*---------------------------------------------------------------- - * - * Function: CF_DecodeIntegerInSize * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -815,8 +757,6 @@ uint64 CF_DecodeIntegerInSize(CF_DecoderState_t *state, uint8 decode_size) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeHeader * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -863,8 +803,6 @@ int32 CF_CFDP_DecodeHeader(CF_DecoderState_t *state, CF_Logical_PduHeader_t *plh } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeFileDirectiveHeader * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -885,8 +823,6 @@ void CF_CFDP_DecodeFileDirectiveHeader(CF_DecoderState_t *state, CF_Logical_PduF } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeLV * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -905,8 +841,6 @@ void CF_CFDP_DecodeLV(CF_DecoderState_t *state, CF_Logical_Lv_t *pllv) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeTLV * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -938,8 +872,6 @@ void CF_CFDP_DecodeTLV(CF_DecoderState_t *state, CF_Logical_Tlv_t *pltlv) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeSegmentRequest * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -958,8 +890,6 @@ void CF_CFDP_DecodeSegmentRequest(CF_DecoderState_t *state, CF_Logical_SegmentRe } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeMd * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -983,8 +913,6 @@ void CF_CFDP_DecodeMd(CF_DecoderState_t *state, CF_Logical_PduMd_t *plmd) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeFileDataHeader * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -1047,8 +975,6 @@ void CF_CFDP_DecodeFileDataHeader(CF_DecoderState_t *state, bool with_meta, CF_L } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeCrc * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -1066,8 +992,6 @@ void CF_CFDP_DecodeCrc(CF_DecoderState_t *state, uint32 *plcrc) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeEof * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -1089,8 +1013,6 @@ void CF_CFDP_DecodeEof(CF_DecoderState_t *state, CF_Logical_PduEof_t *pleof) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeFin * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -1112,8 +1034,6 @@ void CF_CFDP_DecodeFin(CF_DecoderState_t *state, CF_Logical_PduFin_t *plfin) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeAck * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -1135,8 +1055,6 @@ void CF_CFDP_DecodeAck(CF_DecoderState_t *state, CF_Logical_PduAck_t *plack) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeNak * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -1157,8 +1075,6 @@ void CF_CFDP_DecodeNak(CF_DecoderState_t *state, CF_Logical_PduNak_t *plnak) } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeAllTlv * * Application-scope internal function * See description in cf_codec.h for argument/return detail @@ -1194,8 +1110,6 @@ void CF_CFDP_DecodeAllTlv(CF_DecoderState_t *state, CF_Logical_TlvList_t *pltlv, } /*---------------------------------------------------------------- - * - * Function: CF_CFDP_DecodeAllSegments * * Application-scope internal function * See description in cf_codec.h for argument/return detail diff --git a/fsw/src/cf_crc.c b/fsw/src/cf_crc.c index 494e4569..d8e6bfa1 100644 --- a/fsw/src/cf_crc.c +++ b/fsw/src/cf_crc.c @@ -34,8 +34,6 @@ #include /*---------------------------------------------------------------- - * - * Function: CF_CRC_Start * * Application-scope internal function * See description in cf_crc.h for argument/return detail @@ -47,8 +45,6 @@ void CF_CRC_Start(CF_Crc_t *c) } /*---------------------------------------------------------------- - * - * Function: CF_CRC_Digest * * Application-scope internal function * See description in cf_crc.h for argument/return detail @@ -74,8 +70,6 @@ void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len) } /*---------------------------------------------------------------- - * - * Function: CF_CRC_Finalize * * Application-scope internal function * See description in cf_crc.h for argument/return detail diff --git a/fsw/src/cf_logical_pdu.h b/fsw/src/cf_logical_pdu.h index 8aa2a2eb..2324c9de 100644 --- a/fsw/src/cf_logical_pdu.h +++ b/fsw/src/cf_logical_pdu.h @@ -117,7 +117,6 @@ typedef struct CF_Logical_PduHeader CF_EntityId_t source_eid; /**< \brief Source entity ID (normalized) */ CF_EntityId_t destination_eid; /**< \brief Destination entity ID (normalized) */ CF_TransactionSeq_t sequence_num; /**< \brief Sequence number (normalized) */ - } CF_Logical_PduHeader_t; /** @@ -164,7 +163,6 @@ typedef union CF_Logical_TlvData { CF_EntityId_t eid; /**< \brief Valid when type=ENTITY_ID (6) */ const void * data_ptr; /**< \brief Source of actual data in original location (other string/binary types) */ - } CF_Logical_TlvData_t; /** @@ -203,7 +201,6 @@ typedef struct CF_Logical_SegmentList * and may be 0 if the PDU does not contain any such fields. */ CF_Logical_SegmentRequest_t segments[CF_PDU_MAX_SEGMENTS]; - } CF_Logical_SegmentList_t; typedef struct CF_Logical_TlvList @@ -211,7 +208,6 @@ typedef struct CF_Logical_TlvList uint8 num_tlv; /**< \brief number of valid entries in the TLV list */ CF_Logical_Tlv_t tlv[CF_PDU_MAX_TLV]; - } CF_Logical_TlvList_t; /** @@ -229,7 +225,6 @@ typedef struct CF_Logical_PduEof * \brief Set of all TLV blobs in this PDU. */ CF_Logical_TlvList_t tlv_list; - } CF_Logical_PduEof_t; /** @@ -260,7 +255,6 @@ typedef struct CF_Logical_PduAck uint8 ack_subtype_code; /**< \brief depends on ack_directive_code */ CF_CFDP_ConditionCode_t cc; CF_CFDP_AckTxnStatus_t txn_status; - } CF_Logical_PduAck_t; /** @@ -277,7 +271,6 @@ typedef struct CF_Logical_PduMd CF_Logical_Lv_t source_filename; CF_Logical_Lv_t dest_filename; - } CF_Logical_PduMd_t; /** @@ -292,7 +285,6 @@ typedef struct CF_Logical_PduNak * \brief Set of all segments in this PDU. */ CF_Logical_SegmentList_t segment_list; - } CF_Logical_PduNak_t; typedef struct CF_Logical_PduFileDataHeader @@ -309,7 +301,6 @@ typedef struct CF_Logical_PduFileDataHeader const void *data_ptr; /**< \brief pointer to read-only data blob within encoded PDU */ size_t data_len; /**< \brief Length of data blob within encoded PDU (derived field) */ - } CF_Logical_PduFileDataHeader_t; /** @@ -326,7 +317,6 @@ typedef union CF_Logical_IntHeader CF_Logical_PduMd_t md; /**< \brief valid when pdu_type=0 + directive_code=METADATA (7) */ CF_Logical_PduNak_t nak; /**< \brief valid when pdu_type=0 + directive_code=NAK (8) */ CF_Logical_PduFileDataHeader_t fd; /**< \brief valid when pdu_type=1 (directive_code is not applicable) */ - } CF_Logical_IntHeader_t; /** @@ -373,7 +363,6 @@ typedef struct CF_Logical_PduBuffer * does not permit for any other size. */ uint32 content_crc; - } CF_Logical_PduBuffer_t; #endif /* !CF_LOGICAL_PDU_H */ diff --git a/fsw/src/cf_timer.c b/fsw/src/cf_timer.c index 96c05324..ff55322f 100644 --- a/fsw/src/cf_timer.c +++ b/fsw/src/cf_timer.c @@ -35,8 +35,6 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_Timer_Sec2Ticks * * Application-scope internal function * See description in cf_timer.h for argument/return detail @@ -48,8 +46,6 @@ uint32 CF_Timer_Sec2Ticks(CF_Timer_Seconds_t sec) } /*---------------------------------------------------------------- - * - * Function: CF_Timer_InitRelSec * * Application-scope internal function * See description in cf_timer.h for argument/return detail @@ -61,8 +57,6 @@ void CF_Timer_InitRelSec(CF_Timer_t *t, uint32 rel_sec) } /*---------------------------------------------------------------- - * - * Function: CF_Timer_Expired * * Application-scope internal function * See description in cf_timer.h for argument/return detail @@ -74,8 +68,6 @@ int CF_Timer_Expired(const CF_Timer_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_Timer_Tick * * Application-scope internal function * See description in cf_timer.h for argument/return detail diff --git a/fsw/src/cf_utils.c b/fsw/src/cf_utils.c index ea0cc3e9..3c927a52 100644 --- a/fsw/src/cf_utils.c +++ b/fsw/src/cf_utils.c @@ -35,8 +35,6 @@ #include "cf_assert.h" /*---------------------------------------------------------------- - * - * Function: CF_FindUnusedTransaction * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -83,8 +81,6 @@ CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c) } /*---------------------------------------------------------------- - * - * Function: CF_ResetHistory * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -97,8 +93,6 @@ void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h) } /*---------------------------------------------------------------- - * - * Function: CF_FreeTransaction * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -117,8 +111,6 @@ void CF_FreeTransaction(CF_Transaction_t *t) } /*---------------------------------------------------------------- - * - * Function: CF_FindTransactionBySequenceNumber_Impl * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -139,8 +131,6 @@ int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_Trans } /*---------------------------------------------------------------- - * - * Function: CF_FindTransactionBySequenceNumber * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -173,8 +163,6 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac } /*---------------------------------------------------------------- - * - * Function: CF_WriteHistoryEntryToFile * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -195,9 +183,9 @@ int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) { case 0: CF_Assert(h->dir < CF_Direction_NUM); - snprintf(linebuf, sizeof(linebuf), "SEQ (%lu, %lu)\tDIR: %s\tPEER %lu\tCC: %u\t", + snprintf(linebuf, sizeof(linebuf), "SEQ (%lu, %lu)\tDIR: %s\tPEER %lu\tSTAT: %d\t", (unsigned long)h->src_eid, (unsigned long)h->seq_num, CF_DSTR[h->dir], - (unsigned long)h->peer_eid, (unsigned int)h->cc); + (unsigned long)h->peer_eid, (int)h->txn_stat); break; case 1: snprintf(linebuf, sizeof(linebuf), "SRC: %s\t", h->fnames.src_filename); @@ -222,8 +210,6 @@ int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) } /*---------------------------------------------------------------- - * - * Function: CF_Traverse_WriteHistoryQueueEntryToFile * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -251,8 +237,6 @@ int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg) } /*---------------------------------------------------------------- - * - * Function: CF_Traverse_WriteTxnQueueEntryToFile * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -275,8 +259,6 @@ int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) } /*---------------------------------------------------------------- - * - * Function: CF_WriteTxnQueueDataToFile * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -295,8 +277,6 @@ int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q) } /*---------------------------------------------------------------- - * - * Function: CF_WriteHistoryQueueDataToFile * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -316,8 +296,6 @@ int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction } /*---------------------------------------------------------------- - * - * Function: CF_PrioSearch * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -342,8 +320,6 @@ int CF_PrioSearch(CF_CListNode_t *node, void *context) } /*---------------------------------------------------------------- - * - * Function: CF_InsertSortPrio * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -387,8 +363,6 @@ void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) } /*---------------------------------------------------------------- - * - * Function: CF_TraverseAllTransactions_Impl * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -403,8 +377,6 @@ int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *arg } /*---------------------------------------------------------------- - * - * Function: CF_TraverseAllTransactions * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -421,8 +393,6 @@ int CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t } /*---------------------------------------------------------------- - * - * Function: CF_TraverseAllTransactions_All_Channels * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -438,8 +408,6 @@ int CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, } /*---------------------------------------------------------------- - * - * Function: CF_WrappedOpenCreate * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -456,8 +424,6 @@ int32 CF_WrappedOpenCreate(osal_id_t *fd, const char *fname, int32 flags, int32 } /*---------------------------------------------------------------- - * - * Function: CF_WrappedClose * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -479,8 +445,6 @@ void CF_WrappedClose(osal_id_t fd) } /*---------------------------------------------------------------- - * - * Function: CF_WrappedRead * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -497,8 +461,6 @@ int32 CF_WrappedRead(osal_id_t fd, void *buf, size_t read_size) } /*---------------------------------------------------------------- - * - * Function: CF_WrappedWrite * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -515,8 +477,6 @@ int32 CF_WrappedWrite(osal_id_t fd, const void *buf, size_t write_size) } /*---------------------------------------------------------------- - * - * Function: CF_WrappedLseek * * Application-scope internal function * See description in cf_utils.h for argument/return detail @@ -530,3 +490,99 @@ int32 CF_WrappedLseek(osal_id_t fd, off_t offset, int mode) CFE_ES_PerfLogExit(CF_PERF_ID_FSEEK); return ret; } + +/*---------------------------------------------------------------- + * + * Function: CF_TxnStatus_IsError + * + * Application-scope internal function + * See description in cf_utils.h for argument/return detail + * + *-----------------------------------------------------------------*/ +bool CF_TxnStatus_IsError(CF_TxnStatus_t txn_stat) +{ + /* The value of CF_TxnStatus_UNDEFINED (-1) indicates a transaction is in progress and no error + * has occurred yet. This will be will be set to CF_TxnStatus_NO_ERROR (0) after successful + * completion of the transaction (FIN/EOF). Anything else indicates a problem has occurred. */ + return (txn_stat > CF_TxnStatus_NO_ERROR); +} + +/*---------------------------------------------------------------- + * + * Function: CF_TxnStatus_To_ConditionCode + * + * Application-scope internal function + * See description in cf_utils.h for argument/return detail + * + *-----------------------------------------------------------------*/ +CF_CFDP_ConditionCode_t CF_TxnStatus_To_ConditionCode(CF_TxnStatus_t txn_stat) +{ + CF_CFDP_ConditionCode_t result; + + if (!CF_TxnStatus_IsError(txn_stat)) + { + /* If no status has been set (CF_TxnStatus_UNDEFINED), treat that as NO_ERROR for + * the purpose of CFDP CC. This can occur e.g. when sending ACK PDUs and no errors + * have happened yet, but the transaction is not yet complete and thus not final. */ + result = CF_CFDP_ConditionCode_NO_ERROR; + } + else + { + switch (txn_stat) + { + /* The definition of CF_TxnStatus_t is such that the 4-bit codes (0-15) share the same + * numeric values as the CFDP condition codes, and can be put directly into the 4-bit + * CC field of a FIN/ACK/EOF PDU. Extended codes use the upper bits (>15) to differentiate */ + case CF_TxnStatus_NO_ERROR: + case CF_TxnStatus_POS_ACK_LIMIT_REACHED: + case CF_TxnStatus_KEEP_ALIVE_LIMIT_REACHED: + case CF_TxnStatus_INVALID_TRANSMISSION_MODE: + case CF_TxnStatus_FILESTORE_REJECTION: + case CF_TxnStatus_FILE_CHECKSUM_FAILURE: + case CF_TxnStatus_FILE_SIZE_ERROR: + case CF_TxnStatus_NAK_LIMIT_REACHED: + case CF_TxnStatus_INACTIVITY_DETECTED: + case CF_TxnStatus_INVALID_FILE_STRUCTURE: + case CF_TxnStatus_CHECK_LIMIT_REACHED: + case CF_TxnStatus_UNSUPPORTED_CHECKSUM_TYPE: + case CF_TxnStatus_SUSPEND_REQUEST_RECEIVED: + case CF_TxnStatus_CANCEL_REQUEST_RECEIVED: + result = (CF_CFDP_ConditionCode_t)txn_stat; + break; + + /* Extended status codes below here --- + * There are no CFDP CCs to directly represent these status codes. Normally this should + * not happen as the engine should not be sending a CFDP CC (FIN/ACK/EOF PDU) for a + * transaction that is not in a valid CFDP-defined state. This should be translated + * to the closest CFDP CC per the intent/meaning of the transaction status code. */ + + case CF_TxnStatus_ACK_LIMIT_NO_FIN: + case CF_TxnStatus_ACK_LIMIT_NO_EOF: + /* this is similar to the inactivity timeout (no fin-ack) */ + result = CF_CFDP_ConditionCode_INACTIVITY_DETECTED; + break; + + default: + /* Catch-all: any invalid protocol state will cancel the transaction, and thus this + * is the closest CFDP CC in practice for all other unhandled errors. */ + result = CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED; + break; + } + } + + return result; +} + +/*---------------------------------------------------------------- + * + * Function: CF_TxnStatus_From_ConditionCode + * + * Application-scope internal function + * See description in cf_utils.h for argument/return detail + * + *-----------------------------------------------------------------*/ +CF_TxnStatus_t CF_TxnStatus_From_ConditionCode(CF_CFDP_ConditionCode_t cc) +{ + /* All CFDP CC values directly correspond to a Transaction Status of the same numeric value */ + return (CF_TxnStatus_t)cc; +} diff --git a/fsw/src/cf_utils.h b/fsw/src/cf_utils.h index 80e9e660..74db8d4c 100644 --- a/fsw/src/cf_utils.h +++ b/fsw/src/cf_utils.h @@ -473,4 +473,48 @@ int32 CF_WrappedWrite(osal_id_t fd, const void *buf, size_t write_size); */ int32 CF_WrappedLseek(osal_id_t fd, off_t offset, int mode); +/************************************************************************/ +/** @brief Converts the internal transaction status to a CFDP condition code + * + * Transaction status is a superset of condition codes, and includes + * other error conditions for which CFDP will not send FIN/ACK/EOF + * and thus there is no corresponding condition code. + * + * @par Assumptions, External Events, and Notes: + * Not all transaction status codes directly correlate to a CFDP CC + * + * @param txn_stat Transaction status + * + * @returns CFDP protocol condition code + */ +CF_CFDP_ConditionCode_t CF_TxnStatus_To_ConditionCode(CF_TxnStatus_t txn_stat); + +/************************************************************************/ +/** @brief Converts a CFDP condition code to an internal transaction status + * + * @par Assumptions, External Events, and Notes: + * None + * + * @param cc CFDP condition code + * + * @returns Transaction status code + */ +CF_TxnStatus_t CF_TxnStatus_From_ConditionCode(CF_CFDP_ConditionCode_t cc); + +/************************************************************************/ +/** @brief Check if the internal transaction status represents an error + * + * @par Assumptions, External Events, and Notes: + * Transaction status is a superset of condition codes, and includes + * other error conditions for which CFDP will not send FIN/ACK/EOF + * and thus there is no corresponding condition code. + * + * @param txn_stat Transaction status + * + * @returns Boolean value indicating if the transaction is in an errorred state + * @retval true if the an error has occurred during the transaction + * @retval false if no error has occurred during the transaction yet + */ +bool CF_TxnStatus_IsError(CF_TxnStatus_t txn_stat); + #endif /* !CF_UTILS_H */ diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt index 916e8249..ba60e92a 100644 --- a/unit-test/CMakeLists.txt +++ b/unit-test/CMakeLists.txt @@ -63,6 +63,8 @@ add_cfe_coverage_stubs(cf_internal target_link_libraries(coverage-cf_internal-stubs ut_core_api_stubs ut_assert) target_include_directories(coverage-cf_internal-stubs PUBLIC utilities) +target_include_directories(coverage-cf_internal-stubs PUBLIC ../fsw/inc) +target_include_directories(coverage-cf_internal-stubs PUBLIC ../fsw/src) # Generate a dedicated "testrunner" executable for each test file # Accomplish this by cycling through all the app's source files, diff --git a/unit-test/cf_app_tests.c b/unit-test/cf_app_tests.c index eba8d7f7..1bb2f885 100644 --- a/unit-test/cf_app_tests.c +++ b/unit-test/cf_app_tests.c @@ -32,14 +32,12 @@ void cf_app_tests_Setup(void) { cf_tests_Setup(); -} /* end cf_app_tests_Setup */ +} void CF_App_Tests_Teardown(void) { cf_tests_Teardown(); -} /* end CF_App_Tests_Teardown */ - -/* end cf_app_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -61,8 +59,6 @@ void UT_UpdatedDefaultHandler_CFE_SB_ReceiveBuffer(void *UserObj, UT_EntryKey_t UT_Stub_CopyToLocal(UT_KEY(CFE_SB_ReceiveBuffer), BufPtr, sizeof(*BufPtr)); } -/* end cf_app_tests helpers */ - /******************************************************************************* ** ** CF_HkCmd tests - full coverage @@ -71,7 +67,6 @@ void UT_UpdatedDefaultHandler_CFE_SB_ReceiveBuffer(void *UserObj, UT_EntryKey_t void Test_CF_HkCmd(void) { - /* Act */ CF_HkCmd(); @@ -81,8 +76,6 @@ void Test_CF_HkCmd(void) UtAssert_STUB_COUNT(CFE_TIME_GetTime, 1); } -/* end CF_HkCmd tests */ - /******************************************************************************* ** ** CF_CheckTables tests - full coverage @@ -99,7 +92,7 @@ void Test_CF_CheckTables_DoNotReleaseAddressBecauseEngineIsEnabled(void) /* Assert */ UtAssert_STUB_COUNT(CFE_TBL_ReleaseAddress, 0); -} /* end Test_CF_CheckTables_DoNotReleaseAddressBecauseEngineIsEnabled */ +} void Test_CF_CheckTables_CallTo_CFE_TBL_ReleaseAddress_ReturnsNot_CFE_SUCCESS_SendEvent(void) { @@ -111,7 +104,7 @@ void Test_CF_CheckTables_CallTo_CFE_TBL_ReleaseAddress_ReturnsNot_CFE_SUCCESS_Se /* Assert */ UtAssert_STUB_COUNT(CFE_TBL_ReleaseAddress, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_CheckTables_CallTo_CFE_TBL_ReleaseAddress_ReturnsNot_CFE_SUCCESS_SendEvent */ +} void Test_CF_CheckTables_CallTo_CFE_TBL_Manage_ReturnsNot_CFE_SUCCESS_SendEvent(void) { @@ -124,7 +117,7 @@ void Test_CF_CheckTables_CallTo_CFE_TBL_Manage_ReturnsNot_CFE_SUCCESS_SendEvent( UtAssert_STUB_COUNT(CFE_TBL_ReleaseAddress, 1); UtAssert_STUB_COUNT(CFE_TBL_Manage, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_CheckTables_CallTo_CFE_TBL_Manage_ReturnsNot_CFE_SUCCESS_SendEvent */ +} void Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_ReturnsNot_CFE_SUCCESS_Or_CFE_TBL_INFO_UPDATED_SendEvent(void) { @@ -138,7 +131,7 @@ void Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_ReturnsNot_CFE_SUCCESS_Or_CFE UtAssert_STUB_COUNT(CFE_TBL_Manage, 1); UtAssert_STUB_COUNT(CFE_TBL_GetAddress, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_ReturnsNot_CFE_SUCCESS_Or_CFE_TBL_INFO_UPDATED_SendEvent */ +} void Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_SUCCESS(void) { @@ -150,7 +143,7 @@ void Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_SUCCESS(void) UtAssert_STUB_COUNT(CFE_TBL_Manage, 1); UtAssert_STUB_COUNT(CFE_TBL_GetAddress, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_SUCCESS */ +} void Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED(void) { @@ -164,9 +157,7 @@ void Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED( UtAssert_STUB_COUNT(CFE_TBL_Manage, 1); UtAssert_STUB_COUNT(CFE_TBL_GetAddress, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED */ - -/* end CF_CheckTables tests */ +} /******************************************************************************* ** @@ -182,19 +173,19 @@ CF_ConfigTable_t dummy_table; /* CF_ValidateConfigTable tests specific functions */ void cf_config_table_tests_set_dummy_table_to_nominal(void) { - // all values for dummy_table.ticks_per_second nominal except 0 + /* all values for dummy_table.ticks_per_second nominal except 0 */ dummy_table.ticks_per_second = Any_uint32_Except(0); - // all values (except 0) & 3ff == 0 are nominal (1024 byte aligned) + /* all values (except 0) & 3ff == 0 are nominal (1024 byte aligned) */ dummy_table.rx_crc_calc_bytes_per_wakeup = Any_uint32_Except(0) << 10; - // all values less than sizeof(CF_CFDP_PduFileDataContent_t) are nominal + /* all values less than sizeof(CF_CFDP_PduFileDataContent_t) are nominal */ dummy_table.outgoing_file_chunk_size = Any_uint16_LessThan(sizeof(CF_CFDP_PduFileDataContent_t)); -} /* end cf_config_table_tests_set_dummy_table_to_nominal */ +} void Setup_cf_config_table_tests(void) { cf_app_tests_Setup(); cf_config_table_tests_set_dummy_table_to_nominal(); -} /* end Setup_cf_config_table_tests */ +} /* end CF_ValidateConfigTable tests specific items */ @@ -211,7 +202,7 @@ void Test_CF_ValidateConfigTable_FailBecauseTableTicksPerSecondIs0(void) /* Assert */ UtAssert_INT32_EQ(result, -1); -} /* end Test_CF_ValidateConfigTable_FailBecauseTableTicksPerSecondIs0 */ +} void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIs0(void) { @@ -227,7 +218,7 @@ void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIs0(void) /* Assert */ UtAssert_INT32_EQ(result, -2); -} /* end Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIs0 */ +} void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIsNot1024ByteAligned(void) { @@ -246,7 +237,7 @@ void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIsNot1024ByteAlign /* Assert */ UtAssert_INT32_EQ(result, -2); -} /* end Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIsNot1024ByteAligned */ +} void Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArray(void) { @@ -254,7 +245,7 @@ void Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArra CF_ConfigTable_t *arg_table = &dummy_table; int32 result; - // outgoing_file_chunk_size set to greater than sizeof(CF_CFDP_PduFileDataContent_t) + /* outgoing_file_chunk_size set to greater than sizeof(CF_CFDP_PduFileDataContent_t) */ arg_table->ticks_per_second = 1; arg_table->rx_crc_calc_bytes_per_wakeup = 0x0400; /* 1024 aligned */ arg_table->outgoing_file_chunk_size = sizeof(CF_CFDP_PduFileDataContent_t) + 1; @@ -264,7 +255,7 @@ void Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArra /* Assert */ UtAssert_INT32_EQ(result, -3); -} /* end Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArray */ +} void Test_CF_ValidateConfigTable_Success(void) { @@ -281,9 +272,7 @@ void Test_CF_ValidateConfigTable_Success(void) /* Assert */ UtAssert_INT32_EQ(result, CFE_SUCCESS); -} /* end Test_CF_ValidateConfigTable_Success */ - -/* end CF_ValidateConfigTable tests */ +} /******************************************************************************* ** @@ -303,7 +292,7 @@ void Test_CF_TableInit_FailBecause_CFE_TBL_Register_DidNotReturnSuccess(void) /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_INIT_TBL_REG); -} /* end Test_CF_TableInit_FailBecause_CFE_TBL_Register_DidNotReturnSuccess */ +} void Test_CF_TableInit_FailBecause_CFE_TBL_Load_DidNotReturnSuccess(void) { @@ -317,7 +306,7 @@ void Test_CF_TableInit_FailBecause_CFE_TBL_Load_DidNotReturnSuccess(void) /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_INIT_TBL_LOAD); -} /* end Test_CF_TableInit_FailBecause_CFE_TBL_Load_DidNotReturnSuccess */ +} void Test_CF_TableInit_FailBecause_CFE_TBL_Manage_DidNotReturnSuccess(void) { @@ -332,7 +321,7 @@ void Test_CF_TableInit_FailBecause_CFE_TBL_Manage_DidNotReturnSuccess(void) /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_INIT_TBL_MANAGE); -} /* end Test_CF_TableInit_FailBecause_CFE_TBL_Manage_DidNotReturnSuccess */ +} void Test_CF_TableInit_FailBecause_CFE_TBL_GetAddress_DidNotReturnSuccess(void) { @@ -347,7 +336,7 @@ void Test_CF_TableInit_FailBecause_CFE_TBL_GetAddress_DidNotReturnSuccess(void) /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_INIT_TBL_GETADDR); -} /* end Test_CF_TableInit_FailBecause_CFE_TBL_GetAddress_DidNotReturnSuccess */ +} void Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_SUCCESS_SuccessAndDoNotSendEvent(void) { @@ -356,7 +345,7 @@ void Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_SUCCESS_SuccessAndDoN /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_SUCCESS_SuccessAndDoNotSendEvent */ +} void Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED_SuccessAndDoNotSendEvent(void) { @@ -368,9 +357,7 @@ void Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED_Succ /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED_SuccessAndDoNotSendEvent */ - -/* end CF_TableInit tests */ +} /******************************************************************************* ** @@ -391,7 +378,7 @@ void Test_CF_Init_CallTo_CFE_EVS_Register_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_Wri UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); -} /* end Test_CF_Init_CallTo_CFE_EVS_Register_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus */ +} void Test_CF_Init_CallTo_CFE_SB_CreatePipe_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus(void) { @@ -408,7 +395,7 @@ void Test_CF_Init_CallTo_CFE_SB_CreatePipe_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_Wr UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); -} /* end Test_CF_Init_CallTo_CFE_SB_CreatePipe_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus */ +} void Test_CF_Init_FirstCallTo_CFE_SB_Subscribe_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus(void) { @@ -426,7 +413,7 @@ void Test_CF_Init_FirstCallTo_CFE_SB_Subscribe_ReturnsNot_CFE_SUCCESS_Call_CFE_E UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 1); UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); -} /* end Test_CF_Init_FirstCallTo_CFE_SB_Subscribe_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus */ +} /* NOTE: multi call test for CFE_SB_Subscribe would be helpful but not necessary for coverage */ @@ -447,7 +434,7 @@ void Test_CF_Init_CallTo_CF_TableInit_ReturnsNot_CFE_SUCCESS_ReturnErrorStatus(v UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 3); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_Init_CallTo_CF_TableInit_ReturnsNot_CFE_SUCCESS_ReturnErrorStatus */ +} void Test_CF_Init_CallTo_CF_CFDP_InitEngine_ReturnsNot_CFE_SUCCESS_ReturnErrorStatus(void) { @@ -465,7 +452,7 @@ void Test_CF_Init_CallTo_CF_CFDP_InitEngine_ReturnsNot_CFE_SUCCESS_ReturnErrorSt UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 3); UtAssert_STUB_COUNT(CF_CFDP_InitEngine, 1); -} /* end Test_CF_Init_CallTo_CF_CFDP_InitEngine_ReturnsNot_CFE_SUCCESS_ReturnErrorStatus */ +} void Test_CF_Init_CallTo_CFE_EVS_SendEvent_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus(void) { @@ -482,10 +469,9 @@ void Test_CF_Init_CallTo_CFE_EVS_SendEvent_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_Wr UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 3); - // UtAssert_STUB_COUNT(CF_TableInit, 1); UtAssert_STUB_COUNT(CF_CFDP_InitEngine, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_Init_CallTo_CFE_EVS_SendEvent_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus */ +} void Test_CF_Init_Success(void) { @@ -494,9 +480,7 @@ void Test_CF_Init_Success(void) /* Assert */ UtAssert_STUB_COUNT(CFE_MSG_Init, 1); -} /* end Test_CF_Init_Success */ - -/* end CF_Init tests */ +} /******************************************************************************* ** @@ -514,7 +498,7 @@ void Test_CF_WakeUp(void) /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_CycleEngine, 1); -} /* end Test_CF_WakeUp */ +} /******************************************************************************* ** @@ -539,7 +523,7 @@ void Test_CF_ProcessMsg_ProcessGroundCommand(void) /* Assert */ UtAssert_STUB_COUNT(CFE_MSG_GetMsgId, 1); UtAssert_STUB_COUNT(CF_ProcessGroundCommand, 1); -} /* end Test_CF_ProcessMsg_ProcessGroundCommand */ +} void Test_CF_ProcessMsg_WakeUp(void) { @@ -558,8 +542,7 @@ void Test_CF_ProcessMsg_WakeUp(void) /* Assert */ UtAssert_STUB_COUNT(CFE_MSG_GetMsgId, 1); UtAssert_STUB_COUNT(CF_CFDP_CycleEngine, 1); - -} /* end Test_CF_ProcessMsg_WakeUp */ +} void Test_CF_ProcessMsg_SendHk(void) { @@ -578,7 +561,7 @@ void Test_CF_ProcessMsg_SendHk(void) UtAssert_STUB_COUNT(CFE_MSG_GetMsgId, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_STUB_COUNT(CFE_MSG_SetMsgTime, 1); /* Confirms CF_HkCmd path was taken */ -} /* end Test_CF_ProcessMsg_SendHk */ +} void Test_CF_ProcessMsg_UnrecognizedCommandEnterDefaultPath(void) { @@ -595,10 +578,7 @@ void Test_CF_ProcessMsg_UnrecognizedCommandEnterDefaultPath(void) UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_INIT_CMD_LENGTH); - -} /* end Test_CF_ProcessMsg_UnrecognizedCommandEnterDefaultPath */ - -/* end CF_ProcessMsg tests */ +} /******************************************************************************* ** @@ -622,8 +602,7 @@ void Test_CF_AppMain_CallTo_CF_Init_DoNotReturn_CFE_SUCCESS_Set_CF_AppData_run_s UtAssert_STUB_COUNT(CFE_ES_RunLoop, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_UINT32_EQ(CF_AppData.run_status, CFE_ES_RunStatus_APP_ERROR); -} /* end Test_CF_AppMain_CallTo_CF_Init_DoNotReturn_CFE_SUCCESS_Set_CF_AppData_run_status_To_CFE_ES_RunStatus_APP_ERROR - */ +} void Test_CF_AppMain_CFE_SB_ReceiveBuffer_Cases(void) { @@ -711,9 +690,7 @@ void Test_CF_AppMain_RunLoopCallTo_CFE_SB_ReceiveBuffer_Returns_CFE_SUCCESS_AndV UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2); /* Assert for CF_ProcessMsg */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); -} /* end Test_CF_AppMain_RunLoopCallTo_CFE_SB_ReceiveBuffer_Returns_CFE_SUCCESS_AndValid_msg_Call_CF_ProcessMsg */ - -/* end CF_AppMain tests */ +} /******************************************************************************* ** @@ -743,7 +720,7 @@ void add_CF_CheckTables_tests(void) CF_App_Tests_Teardown, "Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_SUCCESS"); UtTest_Add(Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED, Setup_cf_config_table_tests, CF_App_Tests_Teardown, "Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED"); -} /* end add_CF_CheckTables_tests */ +} void add_CF_ValidateConfigTable_tests(void) { @@ -759,7 +736,7 @@ void add_CF_ValidateConfigTable_tests(void) "Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArray"); UtTest_Add(Test_CF_ValidateConfigTable_Success, Setup_cf_config_table_tests, CF_App_Tests_Teardown, "Test_CF_ValidateConfigTable_Success"); -} /* end add_CF_ValidateConfigTable_tests */ +} void add_CF_TableInit_tests(void) { @@ -777,7 +754,7 @@ void add_CF_TableInit_tests(void) UtTest_Add(Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED_SuccessAndDoNotSendEvent, cf_app_tests_Setup, CF_App_Tests_Teardown, "Test_CF_TableInit_When_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED_SuccessAndDoNotSendEvent"); -} /* end add_CF_TableInit_tests */ +} void add_CF_Init_tests(void) { @@ -803,12 +780,12 @@ void add_CF_Init_tests(void) cf_app_tests_Setup, CF_App_Tests_Teardown, "Test_CF_Init_CallTo_CFE_EVS_SendEvent_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_WriteToSysLog_ReturnErrorStatus"); UtTest_Add(Test_CF_Init_Success, cf_app_tests_Setup, CF_App_Tests_Teardown, "Test_CF_Init_Success"); -} /* end add_CF_Init_tests */ +} void add_CF_WakeUp_tests(void) { UtTest_Add(Test_CF_WakeUp, cf_app_tests_Setup, CF_App_Tests_Teardown, "Test_CF_WakeUp"); -} /* end add_CF_WakeUp_tests */ +} void add_CF_ProcessMsg_tests(void) { @@ -818,7 +795,7 @@ void add_CF_ProcessMsg_tests(void) UtTest_Add(Test_CF_ProcessMsg_SendHk, cf_app_tests_Setup, CF_App_Tests_Teardown, "Test_CF_ProcessMsg_SendHk"); UtTest_Add(Test_CF_ProcessMsg_UnrecognizedCommandEnterDefaultPath, cf_app_tests_Setup, CF_App_Tests_Teardown, "Test_CF_ProcessMsg_UnrecognizedCommandEnterDefaultPath"); -} /* end add_CF_ProcessMsg_tests */ +} void add_CF_AppMain_tests(void) { @@ -833,9 +810,7 @@ void add_CF_AppMain_tests(void) Test_CF_AppMain_RunLoopCallTo_CFE_SB_ReceiveBuffer_Returns_CFE_SUCCESS_AndValid_msg_Call_CF_ProcessMsg, cf_app_tests_Setup, CF_App_Tests_Teardown, "Test_CF_AppMain_RunLoopCallTo_CFE_SB_ReceiveBuffer_Returns_CFE_SUCCESS_AndValid_msg_Call_CF_ProcessMsg"); -} /* end add_CF_AppMain_tests */ - -/* end cf_app_tests UtTest_Add groups */ +} /******************************************************************************* ** @@ -862,5 +837,4 @@ void UtTest_Setup(void) add_CF_ProcessMsg_tests(); add_CF_AppMain_tests(); -} -/* end cf_app_tests.c */ +} \ No newline at end of file diff --git a/unit-test/cf_cfdp_dispatch_tests.c b/unit-test/cf_cfdp_dispatch_tests.c index 52d37124..3e8416e9 100644 --- a/unit-test/cf_cfdp_dispatch_tests.c +++ b/unit-test/cf_cfdp_dispatch_tests.c @@ -109,15 +109,12 @@ void cf_cfdp_dispatch_tests_Setup(void) /* make sure global data is wiped between tests */ memset(&CF_AppData, 0, sizeof(CF_AppData)); - -} /* end cf_cfdp_dispatch_tests_Setup */ +} void cf_cfdp_dispatch_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_cfdp_dispatch_tests_Teardown */ - -/* end cf_cfdp_dispatch_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -163,7 +160,7 @@ void Test_CF_CFDP_R_DispatchRecv(void) /* file data with error */ UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); ph->pdu_header.pdu_type = 1; - t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; + UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, NULL)); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped, 1); @@ -316,7 +313,4 @@ void UtTest_Setup(void) "CF_CFDP_TxStateDispatch"); UtTest_Add(Test_CF_CFDP_RxStateDispatch, cf_cfdp_dispatch_tests_Setup, cf_cfdp_dispatch_tests_Teardown, "CF_CFDP_RxStateDispatch"); - -} /* end UtTest_Setup for cf_cfdp_dispatch_tests.c */ - -/* end cf_cfdp_dispatch_tests.c */ +} \ No newline at end of file diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index c6fdbc8a..4776acee 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -114,6 +114,9 @@ static void UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_t setup, CF_Logical_PduBuf /* reset the event ID capture between each sub-case */ UT_CF_ResetEventCapture(); + + /* Capture calls to CF_CFDP_SetTxnState() to capture transaction status */ + UT_SetHandlerFunction(UT_KEY(CF_CFDP_SetTxnStatus), UT_AltHandler_CaptureTransactionStatus, &ut_history.txn_stat); } /******************************************************************************* @@ -128,15 +131,12 @@ void cf_cfdp_r_tests_Setup(void) /* make sure global data is wiped between tests */ memset(&CF_AppData, 0, sizeof(CF_AppData)); - -} /* end cf_cfdp_r_tests_Setup */ +} void cf_cfdp_r_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_cfdp_r_tests_Teardown */ - -/* end cf_cfdp_r_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -203,7 +203,7 @@ void Test_CF_CFDP_R_Tick(void) UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); UtAssert_BOOL_TRUE(t->flags.rx.inactivity_fired); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_INACTIVITY_DETECTED); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_INACTIVITY_DETECTED); /* in R2 state, send_ack set */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); @@ -386,20 +386,20 @@ void Test_CF_CFDP_R_Init(void) UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CREAT); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 2); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); } -void Test_CF_CFDP_R2_SetCc(void) +void Test_CF_CFDP_R2_SetFinTxnStatus(void) { /* Test case for: - * void CF_CFDP_R2_SetCc(CF_Transaction_t *t, CF_CFDP_ConditionCode_t cc); + * void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_CFDP_ConditionCode_t cc); */ CF_Transaction_t *t; /* nominal, should save whatever cc is passed, and set "send_fin" */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE)); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE); + UtAssert_VOIDCALL(CF_CFDP_R2_SetFinTxnStatus(t, CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE)); + UtAssert_STUB_COUNT(CF_CFDP_SetTxnStatus, 1); UtAssert_BOOL_TRUE(t->flags.rx.send_fin); } @@ -441,7 +441,7 @@ void Test_CF_CFDP_R2_Reset(void) UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->history->cc = CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE; /* not NO_ERROR */ + UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); UtAssert_VOIDCALL(CF_CFDP_R2_Reset(t)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 3); @@ -496,7 +496,7 @@ void Test_CF_CFDP_R2_Complete(void) /* test with error cc */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; + UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 0)); /* nominal, send nak */ @@ -579,7 +579,7 @@ void Test_CF_CFDP_R_ProcessFd(void) UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), -1); UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_WRITE); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* call again, but with a failed lseek */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); @@ -591,7 +591,7 @@ void Test_CF_CFDP_R_ProcessFd(void) UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), -1); UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_SEEK_FD); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); /* these stats should have been updated during the course of this test */ UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_write, 1); @@ -726,7 +726,7 @@ void Test_CF_CFDP_R2_SubstateRecvEof(void) t->fsize = 0xbbb; t->flags.rx.md_recv = true; UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(t, ph)); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); } void Test_CF_CFDP_R1_SubstateRecvFileData(void) @@ -795,6 +795,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData(void) /* failure in CF_CFDP_R_ProcessFd (via failure of CF_WrappedWrite) */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); UT_SetDeferredRetcode(UT_KEY(CF_WrappedWrite), 1, -1); UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(t, ph)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* this resets the transaction */ @@ -925,7 +926,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk(void) t->state_data.r.r2.eof_crc = 0xdeadbeef; UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), 0); UtAssert_BOOL_TRUE(t->flags.com.crc_calc); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILE_CHECKSUM_FAILURE); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_CHECKSUM_FAILURE); /* nominal with file larger than rx_crc_calc_bytes_per_wakeup */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); @@ -963,7 +964,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk(void) UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_READ); UtAssert_BOOL_FALSE(t->flags.com.crc_calc); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read, 1); /* failure of lseek */ @@ -976,7 +977,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk(void) UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_SEEK_CRC); UtAssert_BOOL_FALSE(t->flags.com.crc_calc); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); } @@ -1001,9 +1002,9 @@ void Test_CF_CFDP_R2_SubstateSendFin(void) UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendFin), 1, CF_SendRet_NO_MSG); UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(t), -1); - /* non-success condition code */ + /* non-success transaction status code */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; + UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(t), 0); /* already calculated crc */ @@ -1069,21 +1070,21 @@ void Test_CF_CFDP_R2_RecvMd(void) t->flags.rx.eof_recv = true; UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_EOF_MD_SIZE); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); /* OS_mv failure */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); UT_SetDeferredRetcode(UT_KEY(OS_mv), 1, -1); UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_RENAME); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* reopen failure */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedOpenCreate), 1, -1); UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_OPEN); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* CF_CFDP_RecvMd failure */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); @@ -1120,7 +1121,8 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_R_Tick, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R_Tick"); UtTest_Add(Test_CF_CFDP_R_Cancel, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R_Cancel"); UtTest_Add(Test_CF_CFDP_R_Init, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R_Init"); - UtTest_Add(Test_CF_CFDP_R2_SetCc, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R2_SetCc"); + UtTest_Add(Test_CF_CFDP_R2_SetFinTxnStatus, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, + "CF_CFDP_R2_SetFinTxnStatus"); UtTest_Add(Test_CF_CFDP_R1_Reset, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R1_Reset"); UtTest_Add(Test_CF_CFDP_R2_Reset, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R2_Reset"); UtTest_Add(Test_CF_CFDP_R_CheckCrc, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R_CheckCrc"); @@ -1148,7 +1150,4 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_R2_RecvMd, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R2_RecvMd"); UtTest_Add(Test_CF_CFDP_R_SendInactivityEvent, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "CF_CFDP_R_SendInactivityEvent"); - -} /* end UtTest_Setup for cf_cfdp_r_tests.c */ - -/* end cf_cfdp_r_tests.c */ +} \ No newline at end of file diff --git a/unit-test/cf_cfdp_s_tests.c b/unit-test/cf_cfdp_s_tests.c index 3c60a8da..d68c7c4e 100644 --- a/unit-test/cf_cfdp_s_tests.c +++ b/unit-test/cf_cfdp_s_tests.c @@ -87,6 +87,7 @@ static void UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_t setup, CF_Logical_PduBuf /* certain pointers should be connected even if they were not asked for, * as internal code may assume these are set (test cases may un-set) */ ut_transaction.history = &ut_history; + ut_history.txn_stat = CF_TxnStatus_UNDEFINED; CF_AppData.config_table = &ut_config_table; if (pdu_buffer_p) @@ -137,6 +138,9 @@ static void UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_t setup, CF_Logical_PduBuf /* reset the event ID capture between each sub-case */ UT_CF_ResetEventCapture(); + + /* Capture calls to CF_CFDP_SetTxnState() to capture transaction status */ + UT_SetHandlerFunction(UT_KEY(CF_CFDP_SetTxnStatus), UT_AltHandler_CaptureTransactionStatus, &ut_history.txn_stat); } /******************************************************************************* @@ -151,15 +155,12 @@ void cf_cfdp_s_tests_Setup(void) /* make sure global data is wiped between tests */ memset(&CF_AppData, 0, sizeof(CF_AppData)); - -} /* end cf_cfdp_s_tests_Setup */ +} void cf_cfdp_s_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_cfdp_s_tests_Teardown */ - -/* end cf_cfdp_s_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -533,7 +534,7 @@ void Test_CF_CFDP_S_SubstateSendFileData(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, t->fsize); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(t)); UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_EOF); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_NO_ERROR); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_UNDEFINED); /* nominal, less than whole file at once */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); @@ -543,14 +544,14 @@ void Test_CF_CFDP_S_SubstateSendFileData(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, config->outgoing_file_chunk_size); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(t)); UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_FILEDATA); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_NO_ERROR); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_UNDEFINED); /* error during read */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, -1); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(t)); UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_EOF); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); } void Test_CF_CFDP_S_CheckAndRespondNak(void) @@ -676,7 +677,7 @@ void Test_CF_CFDP_S_SubstateSendMetadata(void) UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_OPEN); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 2); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* first CF_WrappedLseek fails */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); @@ -684,7 +685,7 @@ void Test_CF_CFDP_S_SubstateSendMetadata(void) UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_END); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* second CF_WrappedLseek fails */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); @@ -692,21 +693,21 @@ void Test_CF_CFDP_S_SubstateSendMetadata(void) UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_BEG); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 2); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* CF_CFDP_SendMd fails w/ ERROR */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendMd), 1, CF_SendRet_ERROR); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEND_MD); - UtAssert_UINT32_EQ(t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* CF_CFDP_SendMd fails w/ NO_MSG (no event here) */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendMd), 1, CF_SendRet_NO_MSG); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_UINT32_EQ(t->history->cc, 0); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_UNDEFINED); /* everything works */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); @@ -849,9 +850,9 @@ void Test_CF_CFDP_S2_WaitForEofAck(void) UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_EOF); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); - /* with condition code */ + /* with error status */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->history->cc = CF_CFDP_ConditionCode_FILE_CHECKSUM_FAILURE; + UT_SetDefaultReturnValue(UT_KEY(CF_TxnStatus_IsError), true); UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(t, ph)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } @@ -893,7 +894,4 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_S2_Nak_Arm, cf_cfdp_s_tests_Setup, cf_cfdp_s_tests_Teardown, "CF_CFDP_S2_Nak_Arm"); UtTest_Add(Test_CF_CFDP_S2_WaitForEofAck, cf_cfdp_s_tests_Setup, cf_cfdp_s_tests_Teardown, "CF_CFDP_S2_WaitForEofAck"); - -} /* end UtTest_Setup for cf_cfdp_s_tests.c */ - -/* end cf_cfdp_s_tests.c */ +} diff --git a/unit-test/cf_cfdp_sbintf_tests.c b/unit-test/cf_cfdp_sbintf_tests.c index b0737868..15ff10ff 100644 --- a/unit-test/cf_cfdp_sbintf_tests.c +++ b/unit-test/cf_cfdp_sbintf_tests.c @@ -180,8 +180,6 @@ static void UT_CFDP_SetupBasicTestState(UT_CF_Setup_t setup, CF_Logical_PduBuffe UT_CF_ResetEventCapture(); } -/* end cf_cfdp_tests local utility functions */ - /******************************************************************************* ** ** cf_cfdp_tests Setup and Teardown @@ -197,13 +195,12 @@ void cf_cfdp_tests_Setup(void) * previously left in here. */ memset(&CF_AppData, 0, sizeof(CF_AppData)); - -} /* end cf_cfdp_tests_Setup */ +} void cf_cfdp_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_cfdp_tests_Teardown */ +} /******************************************************************************* ** @@ -404,7 +401,4 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_MsgOutGet, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_MsgOutGet"); UtTest_Add(Test_CF_CFDP_Send, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_Send"); - -} /* end UtTest_Setup for cf_cfdp_tests.c */ - -/* end cf_cfdp_tests.c */ +} diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index 4712b435..83e354d6 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -144,8 +144,6 @@ static void UT_CFDP_SetupBasicTestState(UT_CF_Setup_t setup, CF_Logical_PduBuffe UT_CF_ResetEventCapture(); } -/* end cf_cfdp_tests local utility functions */ - /******************************************************************************* ** ** cf_cfdp_tests Setup and Teardown @@ -161,15 +159,12 @@ void cf_cfdp_tests_Setup(void) * previously left in here. */ memset(&CF_AppData, 0, sizeof(CF_AppData)); - -} /* end cf_cfdp_tests_Setup */ +} void cf_cfdp_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_cfdp_tests_Teardown */ - -/* end cf_cfdp_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -361,6 +356,7 @@ void Test_CF_CFDP_RecvFd(void) UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); CF_CODEC_SET_DONE(ph->pdec); UtAssert_INT32_EQ(CF_CFDP_RecvFd(t, ph), -1); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_FD_SHORT); /* deode errors: crc part */ @@ -374,6 +370,7 @@ void Test_CF_CFDP_RecvFd(void) UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); ph->pdu_header.segment_meta_flag = 1; UtAssert_INT32_EQ(CF_CFDP_RecvFd(t, ph), -1); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_FD_UNSUPPORTED); } @@ -468,6 +465,7 @@ void Test_CF_CFDP_RecvDrop(void) UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); UtAssert_VOIDCALL(CF_CFDP_RecvDrop(t, ph)); } + void Test_CF_CFDP_RecvIdle(void) { /* Test case for: @@ -633,6 +631,7 @@ void Test_CF_CFDP_SendMd(void) UtAssert_STRINGBUF_EQ(md->source_filename.data_ptr, md->source_filename.length, h->fnames.src_filename, sizeof(h->fnames.src_filename)); } + void Test_CF_CFDP_SendFd(void) { /* Test case for: @@ -675,10 +674,10 @@ void Test_CF_CFDP_SendEof(void) UtAssert_INT32_EQ(CF_CFDP_SendEof(t), CF_SendRet_SUCCESS); UtAssert_ZERO(eof->tlv_list.num_tlv); - /* test with an alternate condition code, which should append a TLV */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, &h, &t, NULL); - eof = &ph->int_header.eof; - h->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; + /* test with a transaction error status, which should append a TLV */ + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, &h, &t, NULL); + eof = &ph->int_header.eof; + UT_SetDefaultReturnValue(UT_KEY(CF_TxnStatus_To_ConditionCode), CF_CFDP_ConditionCode_FILESTORE_REJECTION); UtAssert_INT32_EQ(CF_CFDP_SendEof(t), CF_SendRet_SUCCESS); UtAssert_UINT32_EQ(eof->tlv_list.num_tlv, 1); UtAssert_STUB_COUNT(CF_CFDP_Send, 2); @@ -864,12 +863,30 @@ void Test_CF_CFDP_InitEngine(void) UtAssert_INT32_EQ(CF_CFDP_InitEngine(), 0); UtAssert_BOOL_TRUE(CF_AppData.engine.enabled); - /* failure of OS_CountSemGetIdByName */ + /* failure of OS_CountSemGetIdByName for non-name reason */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, NULL, &config); config->chan[0].sem_name[0] = 'u'; UT_SetDefaultReturnValue(UT_KEY(OS_CountSemGetIdByName), OS_ERROR); UtAssert_INT32_EQ(CF_CFDP_InitEngine(), OS_ERROR); UtAssert_BOOL_FALSE(CF_AppData.engine.enabled); + UT_CF_AssertEventID(CF_EID_ERR_INIT_SEM); + + /* Max retries of OS_CountSemGetIdByName - sem was never created at all */ + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, NULL, &config); + config->chan[0].sem_name[0] = 'u'; + UT_SetDefaultReturnValue(UT_KEY(OS_CountSemGetIdByName), OS_ERR_NAME_NOT_FOUND); + UtAssert_INT32_EQ(CF_CFDP_InitEngine(), OS_ERR_NAME_NOT_FOUND); + UtAssert_BOOL_FALSE(CF_AppData.engine.enabled); + UT_CF_AssertEventID(CF_EID_ERR_INIT_SEM); + + /* Retry of OS_CountSemGetIdByName, when sem was created late, and thus + * got return OS_ERR_NAME_NOT_FOUND followed by OS_SUCCESS */ + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, NULL, &config); + config->chan[0].sem_name[0] = 'u'; + UT_SetDefaultReturnValue(UT_KEY(OS_CountSemGetIdByName), OS_SUCCESS); + UT_SetDeferredRetcode(UT_KEY(OS_CountSemGetIdByName), 1, OS_ERR_NAME_NOT_FOUND); + UtAssert_INT32_EQ(CF_CFDP_InitEngine(), 0); + UtAssert_BOOL_TRUE(CF_AppData.engine.enabled); /* failure of CFE_SB_CreatePipe */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, NULL, &config); @@ -1392,6 +1409,29 @@ void Test_CF_CFDP_ResetTransaction(void) UtAssert_STUB_COUNT(CF_FreeTransaction, 8); } +void Test_CF_CFDP_SetTxnStatus(void) +{ + /* Test case for: + * void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) + */ + + CF_Transaction_t *t; + + /* nominal call */ + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); + UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NO_ERROR)); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_NO_ERROR); + + /* set an error */ + UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION)); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + + /* confirm errors are "sticky" */ + UT_SetDefaultReturnValue(UT_KEY(CF_TxnStatus_IsError), true); + UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NO_ERROR)); + UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); +} + void Test_CF_CFDP_SendEotPkt(void) { CF_EotPktBuf_t PktBuf; @@ -1502,6 +1542,7 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_DoTick, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_DoTick"); UtTest_Add(Test_CF_CFDP_TickTransactions, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_TickTransactions"); UtTest_Add(Test_CF_CFDP_ResetTransaction, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_ResetTransaction"); + UtTest_Add(Test_CF_CFDP_SetTxnStatus, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_SetTxnStatus"); UtTest_Add(Test_CF_CFDP_SendEotPkt, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "Test_CF_CFDP_SendEotPkt"); UtTest_Add(Test_CF_CFDP_CancelTransaction, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_CancelTransaction"); @@ -1538,7 +1579,4 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_SendFin, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_SendFin"); UtTest_Add(Test_CF_CFDP_SendNak, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_SendNak"); UtTest_Add(Test_CF_CFDP_AppendTlv, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_AppendTlv"); - -} /* end UtTest_Setup for cf_cfdp_tests.c */ - -/* end cf_cfdp_tests.c */ +} \ No newline at end of file diff --git a/unit-test/cf_chunk_tests.c b/unit-test/cf_chunk_tests.c index c6efe419..1dd0dbb2 100644 --- a/unit-test/cf_chunk_tests.c +++ b/unit-test/cf_chunk_tests.c @@ -74,7 +74,6 @@ void UT_CF_Chunk_SetupFull(CF_ChunkList_t *CList) /* Print the chunk list to the UT log (test debug helper) */ void UT_CF_Chunk_Print(CF_ChunkList_t *CList) { - CF_ChunkIdx_t cidx; UtPrintf("Chunk list: index{offset, size}"); diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index 05238652..72ff8b99 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -80,14 +80,12 @@ typedef union void cf_cmd_tests_Setup(void) { cf_tests_Setup(); -} /* end cf_cmd_tests_Setup */ +} void cf_cmd_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_cmd_tests_Teardown */ - -/* end cf_cmd_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -134,8 +132,6 @@ CF_TransactionSeq_t Any_CF_TransactionSeq_t(void) return (CF_TransactionSeq_t)Any_uint32(); } -/* end cf_cmd_tests specific Any functions */ - /******************************************************************************* ** ** cf_cmd_tests dummy test functions @@ -191,10 +187,7 @@ void Test_CF_CmdNoop_SendNoopEventAndAcceptCommand(void) UT_CF_AssertEventID(CF_EID_INF_CMD_NOOP); /* Assert to show counter incremented */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* Test_CF_CmdNoop_SendNoopEventAndAcceptCommand */ - -/* end CF_CmdNoop tests */ +} /******************************************************************************* ** @@ -224,7 +217,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIsEqTo_5_SendEventAndRejectCommand(vo UT_CF_AssertEventID(CF_EID_ERR_CMD_RESET_INVALID); /* Assert incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end Test_CF_CmdReset_tests_WhenCommandByteIsEqTo_5_SendEventAndRejectCommand */ +} void Test_CF_CmdReset_tests_WhenCommandByteIsGreaterThan_5_SendEventAndRejectCommand(void) { @@ -248,7 +241,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIsGreaterThan_5_SendEventAndRejectCom UT_CF_AssertEventID(CF_EID_ERR_CMD_RESET_INVALID); /* Assert incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end Test_CF_CmdReset_tests_WhenCommandByteIsGreaterThan_5_SendEventAndRejectCommand */ +} void Test_CF_CmdReset_tests_WhenCommandByteIs_command_AndResetHkCmdAndErrCountSendEvent(void) { @@ -272,7 +265,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_command_AndResetHkCmdAndErrCountSe UT_CF_AssertEventID(CF_EID_INF_CMD_RESET); UtAssert_ZERO(CF_AppData.hk.counters.cmd); UtAssert_ZERO(CF_AppData.hk.counters.err); -} /* end Test_CF_CmdReset_tests_WhenCommandByteIs_command_AndResetHkCmdAndErrCountSendEvent */ +} void Test_CF_CmdReset_tests_WhenCommandByteIs_fault_ResetAllHkFaultCountSendEventAndAcceptCommand(void) { @@ -332,8 +325,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_fault_ResetAllHkFaultCountSendEven } /* Assert to show counter incremented */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdReset_tests_WhenCommandByteIs_fault_ResetAllHkFaultCountSendEventAndAcceptCommand */ +} void Test_CF_CmdReset_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountSendEventAndAcceptCommand(void) { @@ -381,8 +373,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountSendEvent } /* Assert to show counter incremented */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdReset_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountSendEventAndAcceptCommand */ +} void Test_CF_CmdReset_tests_SWhenCommandByteIs_down_AndResetAllHkSentCountendEventAcceptCommand(void) { @@ -424,8 +415,7 @@ void Test_CF_CmdReset_tests_SWhenCommandByteIs_down_AndResetAllHkSentCountendEve } /* Assert to show counter incremented */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdReset_tests_SWhenCommandByteIs_down_AndResetAllHkSentCountendEventAcceptCommand */ +} void Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent(void) { @@ -502,9 +492,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent( sizeof(&CF_AppData.hk.channel_hk[i].counters.sent), "sent channel %d was completely cleared to 0", i); } -} /* end Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent */ - -/* end CF_CmdReset tests */ +} /******************************************************************************* ** @@ -578,8 +566,6 @@ void Test_CF_CmdTxFile(void) UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 5); } -/* end CF_CmdTxFile tests */ - /******************************************************************************* ** ** CF_CmdPlaybackDir tests @@ -646,8 +632,6 @@ void Test_CF_CmdPlaybackDir(void) UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 5); } -/* end CF_CmdPlaybackDir tests */ - /******************************************************************************* ** ** CF_DoChanAction tests @@ -682,8 +666,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAny_fn_returns_1_Return_1(void) UtAssert_STUB_COUNT(Dummy_chan_action_fn_t, CF_NUM_CHANNELS); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(local_result == 1, "CF_DoChanAction returned %d and should be 1 (an fn returned 1)", local_result); - -} /* end Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAny_fn_returns_1_Return_1 */ +} void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAll_fn_return_1_Return_1(void) { @@ -712,8 +695,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAll_fn_return_1_Return_1(void) UtAssert_STUB_COUNT(Dummy_chan_action_fn_t, CF_NUM_CHANNELS); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(local_result == 1, "CF_DoChanAction returned %d and should be 1 (an fn returned 1)", local_result); - -} /* end Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAll_fn_return_1_Return_1 */ +} void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0(void) { @@ -742,8 +724,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0(void) UtAssert_STUB_COUNT(Dummy_chan_action_fn_t, CF_NUM_CHANNELS); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(local_result == 0, "CF_DoChanAction returned %d and should be 0 (all fn returned 0)", local_result); - -} /* end Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0 */ +} void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1(void) { @@ -772,8 +753,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1(void) UtAssert_STUB_COUNT(Dummy_chan_action_fn_t, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(local_result == 1, "CF_DoChanAction returned %d and should be 1 (fn returned 1)", local_result); - -} /* end Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1 */ +} void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1(void) { @@ -802,8 +782,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1(void) UtAssert_STUB_COUNT(Dummy_chan_action_fn_t, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(local_result == 0, "CF_DoChanAction returned %d and should be 0 (fn returned 0)", local_result); - -} /* end Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1 */ +} void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendEvent_(void) { @@ -833,8 +812,7 @@ void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendE UtAssert_True(local_result == -1, "CF_DoChanAction returned %d and should be -1 (cmd->data.byte[0] >= CF_NUM_CHANNELS)", local_result); - -} /* end Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendEvent_ */ +} void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) { @@ -854,7 +832,7 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) arg_cmd->data.byte[0] = CF_ALL_CHANNELS; while (arg_cmd->data.byte[0] == CF_ALL_CHANNELS) { - if (catastrophe_count == 10) // 10 is arbitrary + if (catastrophe_count == 10) /* 10 is arbitrary */ { UtAssert_Message(UTASSERT_CASETYPE_ABORT, __FILE__, __LINE__, "CANNOT make arg_cmd->data.byte[0] != CF_ALL_CHANNELS in 10 tries"); @@ -877,10 +855,7 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) UtAssert_True(local_result == -1, "CF_DoChanAction returned %d and should be -1 (cmd->data.byte[0] >= CF_NUM_CHANNELS)", local_result); - -} /* end Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent */ - -/* end CF_DoChanAction tests */ +} /******************************************************************************* ** @@ -912,10 +887,7 @@ void Test_CF_DoFreezeThaw_Set_frozen_ToGiven_context_barg_AndReturn_0(void) "CF_DoFreezeThaw set frozen to %d and should be %d (context->barg))", CF_AppData.hk.channel_hk[arg_chan_num].frozen, dummy_context.barg); UtAssert_True(local_result == 0, "CF_DoFreezeThaw returned %d and should be 0 (only returns 0)", local_result); - -} /* end Test_CF_DoFreezeThaw_Set_frozen_ToGiven_context_barg_AndReturn_0 */ - -/* end CF_DoFreezeThaw tests */ +} /************************************************************************** ** @@ -954,7 +926,7 @@ void Test_CF_CmdFreeze_Set_frozen_To_1_AndAcceptCommand(void) initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_FREEZE); -} /* end Test_CF_CmdFreeze_Set_frozen_To_1_AndAcceptCommand */ +} void Test_CF_CmdFreeze_Set_frozen_To_1_AndRejectCommand(void) { @@ -978,7 +950,7 @@ void Test_CF_CmdFreeze_Set_frozen_To_1_AndRejectCommand(void) /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_FREEZE); -} /* end Test_CF_CmdFreeze_Set_frozen_To_1_AndRejectCommand */ +} /******************************************************************************* ** @@ -1017,7 +989,7 @@ void Test_CF_CmdThaw_Set_frozen_To_0_AndAcceptCommand(void) initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_THAW); -} /* end Test_CF_CmdThaw_Set_frozen_To_0_AndAcceptCommand */ +} void Test_CF_CmdThaw_Set_frozen_To_0_AndRejectCommand(void) { @@ -1041,7 +1013,7 @@ void Test_CF_CmdThaw_Set_frozen_To_0_AndRejectCommand(void) /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_THAW); -} /* end Test_CF_CmdThaw_Set_frozen_To_0_AndRejectCommand */ +} /******************************************************************************* ** @@ -1075,8 +1047,7 @@ void Test_CF_FindTransactionBySequenceNumberAllChannels_WhenNoTransactionFoundRe UtAssert_UINT32_EQ(context_CF_CFDP_FTBSN.transaction_sequence_number, arg_ts); UtAssert_UINT32_EQ(context_CF_CFDP_FTBSN.src_eid, arg_eid); UtAssert_ADDRESS_EQ(local_result, expected_result); - -} /* end Test_CF_FindTransactionBySequenceNumberAllChannels_WhenNoTransactionFoundReturn_NULL */ +} void Test_CF_FindTransactionBySequenceNumberAllChannels_Return_TransactionFound(void) { @@ -1119,8 +1090,7 @@ void Test_CF_FindTransactionBySequenceNumberAllChannels_Return_TransactionFound( UtAssert_UINT32_EQ(contexts_CF_CFDP_FTBSN[i].transaction_sequence_number, arg_ts); UtAssert_UINT32_EQ(contexts_CF_CFDP_FTBSN[i].src_eid, arg_eid); UtAssert_ADDRESS_EQ(local_result, expected_result); - -} /* end Test_CF_FindTransactionBySequenceNumberAllChannels_Return_TransactionFound */ +} /******************************************************************************* ** @@ -1168,7 +1138,7 @@ void Test_CF_TsnChanAction_SendEvent_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionNotF UT_CF_AssertEventID(CF_EID_ERR_CMD_TRANS_NOT_FOUND); UtAssert_STUB_COUNT(Dummy_CF_TsnChanAction_fn_t, 0); -} /* end Test_CF_TsnChanAction_SendEvent_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionNotFoundAndReturn_neg1_Fail */ +} void Test_CF_TsnChanAction_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionFoundRun_fn_AndReturn_CFE_SUCCESS(void) { @@ -1211,7 +1181,7 @@ void Test_CF_TsnChanAction_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionFoundRun_fn_An UtAssert_STUB_COUNT(Dummy_CF_TsnChanAction_fn_t, 1); UtAssert_ADDRESS_EQ(context_Dummy_CF_TsnChanAction_fn_t.t, &dummy_t); UtAssert_ADDRESS_EQ(context_Dummy_CF_TsnChanAction_fn_t.context, arg_context); -} /* end Test_CF_TsnChanAction_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionFoundRun_fn_AndReturn_CFE_SUCCESS */ +} void Test_CF_TsnChanAction_cmd_chan_Eq_CF_ALL_CHANNELS_Return_CF_TraverseAllTransactions_All_Channels(void) { @@ -1242,7 +1212,7 @@ void Test_CF_TsnChanAction_cmd_chan_Eq_CF_ALL_CHANNELS_Return_CF_TraverseAllTran /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_TsnChanAction_cmd_chan_Eq_CF_ALL_CHANNELS_Return_CF_TraverseAllTransactions_All_Channels */ +} void Test_CF_TsnChanAction_cmd_chan_IsASingleChannel(void) { @@ -1260,8 +1230,7 @@ void Test_CF_TsnChanAction_cmd_chan_IsASingleChannel(void) /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); - -} /* end Test_CF_TsnChanAction_cmd_chan_Eq_CF_ALL_CHANNELS_Return_CF_TraverseAllTransactions_All_Channels */ +} void Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid(void) { @@ -1282,8 +1251,7 @@ void Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid(void) /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_TSN_CHAN_INVALID); - -} /* end Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid */ +} /******************************************************************************* ** @@ -1312,7 +1280,7 @@ void Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action(void) /* Assert */ UtAssert_True(arg_context->same == 1, "CF_DoSuspRes_Txn set context->same to %d and should be 1 (direct set)", arg_context->same); -} /* end Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action */ +} void Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action(void) { @@ -1336,7 +1304,7 @@ void Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action UtAssert_True(arg_t->flags.com.suspended == arg_context->action, "CF_DoSuspRes_Txn set arg_t->flags.com.suspended to %d and should be %d (context->action)", arg_t->flags.com.suspended, arg_context->action); -} /* end Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action */ +} /******************************************************************************* ** @@ -1435,9 +1403,7 @@ void Test_CF_CmdSuspend_Call_CF_DoSuspRes_WithGiven_msg_And_action_1(void) /* Assert incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); -} /* end Test_CF_CmdSuspend_Call_CF_DoSuspRes_WithGiven_msg_And_action_1 */ - -/* end CF_CmdSuspend tests */ +} /******************************************************************************* ** @@ -1466,9 +1432,7 @@ void Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0(void) /* Assert incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); -} /* end Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0 */ - -/* end CF_CmdResume tests */ +} /******************************************************************************* ** @@ -1492,8 +1456,7 @@ void Test_CF_CmdCancel_Txn_Call_CF_CFDP_CancelTransaction_WithGiven_t(void) /* Assert */ UtAssert_ADDRESS_EQ(context_CF_CFDP_CancelTransaction, arg_t); - -} /* end Test_CF_CmdCancel_Txn_Call_CF_CFDP_CancelTransaction_WithGiven_t */ +} /******************************************************************************* ** @@ -1519,7 +1482,7 @@ void Test_CF_CmdCancel_Success(void) UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_CANCEL); -} /* end Test_CF_CmdCancel_Success */ +} void Test_CF_CmdCancel_Failure(void) { @@ -1538,7 +1501,7 @@ void Test_CF_CmdCancel_Failure(void) UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_CANCEL_CHAN); -} /* end Test_CF_CmdCancel_Failure */ +} /******************************************************************************* ** @@ -1565,8 +1528,7 @@ void Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void UtAssert_True(context_CF_CFDP_ResetTransaction.keep_history == 0, "CF_CFDP_CancelTransaction was called with int %d and should be 0 (constant in call)", context_CF_CFDP_ResetTransaction.keep_history); - -} /* end Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0 */ +} /******************************************************************************* ** @@ -1592,7 +1554,7 @@ void Test_CF_CmdAbandon_Success(void) UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_ABANDON); -} /* end Test_CF_CmdAbandon_Success */ +} void Test_CF_CmdAbandon_Failure(void) { @@ -1611,7 +1573,7 @@ void Test_CF_CmdAbandon_Failure(void) UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_ABANDON_CHAN); -} /* end Test_CF_CmdAbandon_Failure */ +} /******************************************************************************* ** @@ -1639,8 +1601,7 @@ void Test_CF_DoEnableDisableDequeue_Set_chan_num_EnabledFlagTo_context_barg(void UtAssert_True(CF_AppData.config_table->chan[arg_chan_num].dequeue_enabled == dummy_context.barg, "Channel %u dequeue_enabled is %u and should be %u (context->barg)", arg_chan_num, CF_AppData.config_table->chan[arg_chan_num].dequeue_enabled, dummy_context.barg); - -} /* end Test_CF_DoEnableDisableDequeue_Set_chan_num_EnabledFlagTo_context_barg */ +} /******************************************************************************* ** @@ -1685,7 +1646,7 @@ void Test_CF_CmdEnableDequeue_Success(void) CF_AppData.hk.counters.cmd, initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_ENABLE_DEQUEUE); -} /* end Test_CF_CmdEnableDequeue_Success */ +} void Test_CF_CmdEnableDequeue_Failure(void) { @@ -1714,7 +1675,7 @@ void Test_CF_CmdEnableDequeue_Failure(void) /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_ENABLE_DEQUEUE); -} /* end Test_CF_CmdEnableDequeue_Failure */ +} /******************************************************************************* ** @@ -1758,7 +1719,7 @@ void Test_CF_CmdDisableDequeue_Success(void) initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_DISABLE_DEQUEUE); -} /* end Test_CF_CmdDisableDequeue_Success */ +} void Test_CF_CmdDisableDequeue_Failure(void) { @@ -1787,7 +1748,7 @@ void Test_CF_CmdDisableDequeue_Failure(void) /* Assert for CF_DoFreezeThaw */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_DISABLE_DEQUEUE); -} /* end Test_CF_CmdDisableDequeue_Failure */ +} /******************************************************************************* ** @@ -1831,7 +1792,7 @@ void Test_CF_DoEnableDisablePolldir_When_CF_ALL_CHANNELS_SetAllPolldirsInChannel } UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(local_result == 0, "CF_DoEnableDisablePolldir returned %d and should be 0", local_result); -} /* end Test_CF_DoEnableDisablePolldir_When_CF_ALL_CHANNELS_SetAllPolldirsInChannelEnabledTo_context_barg */ +} void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_context_ChannelEnabledTo_context_barg(void) { @@ -1866,7 +1827,7 @@ void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_conte CF_AppData.config_table->chan[arg_chan_num].polldir[dummy_polldir].enabled, expected_enabled); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_True(local_result == 0, "CF_DoEnableDisablePolldir returned %d and should be 0", local_result); -} /* end Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_context_ChannelEnabledTo_context_barg */ +} void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_AndSendEvent(void) { @@ -1895,7 +1856,7 @@ void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_An UT_CF_AssertEventID(CF_EID_ERR_CMD_POLLDIR_INVALID); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_True(local_result == -1, "CF_DoEnableDisablePolldir returned %d and should be -1", local_result); -} /* end Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_AndSendEvent */ +} void Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent(void) { @@ -1924,7 +1885,7 @@ void Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent(void) UT_CF_AssertEventID(CF_EID_ERR_CMD_POLLDIR_INVALID); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_True(local_result == -1, "CF_DoEnableDisablePolldir returned %d and should be -1", local_result); -} /* end Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent */ +} /******************************************************************************* ** @@ -1969,7 +1930,7 @@ void Test_CF_CmdEnablePolldir_SuccessWhenActionSuccess(void) "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d", CF_AppData.hk.counters.cmd, initial_hk_cmd_counter); UT_CF_AssertEventID(CF_EID_INF_CMD_ENABLE_POLLDIR); -} /* end Test_CF_CmdEnablePolldir_SuccessWhenActionSuccess */ +} void Test_CF_CmdEnablePolldir_FailWhenActionFail(void) { @@ -2001,9 +1962,7 @@ void Test_CF_CmdEnablePolldir_FailWhenActionFail(void) "CF_AppData.hk.counters.err is %d and should be 1 more than %d", CF_AppData.hk.counters.err, initial_hk_err_counter); UT_CF_AssertEventID(CF_EID_ERR_CMD_ENABLE_POLLDIR); -} /* end Test_CF_CmdEnablePolldir_FailWhenActionFail */ - -/* end */ +} /******************************************************************************* ** @@ -2048,7 +2007,7 @@ void Test_CF_CmdDisablePolldir_SuccessWhenActionSuccess(void) "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d", CF_AppData.hk.counters.cmd, initial_hk_cmd_counter); UT_CF_AssertEventID(CF_EID_INF_CMD_DISABLE_POLLDIR); -} /* end Test_CF_CmdDisablePolldir_SuccessWhenActionSuccess */ +} void Test_CF_CmdDisablePolldir_FailWhenActionFail(void) { @@ -2080,7 +2039,7 @@ void Test_CF_CmdDisablePolldir_FailWhenActionFail(void) "CF_AppData.hk.counters.err is %d and should be 1 more than %d", CF_AppData.hk.counters.err, initial_hk_err_counter); UT_CF_AssertEventID(CF_EID_ERR_CMD_DISABLE_POLLDIR); -} /* end Test_CF_CmdDisablePolldir_FailWhenActionFail */ +} /******************************************************************************* ** @@ -2109,8 +2068,7 @@ void Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT(void) UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetHistory.h, &dummy_h); UtAssert_True(local_result == CF_CLIST_CONT, "CF_PurgeHistory returned %d and should be %d (CF_CLIST_CONT)", local_result, CF_CLIST_CONT); - -} /* end Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT */ +} /******************************************************************************* ** @@ -2141,8 +2099,7 @@ void Test_CF_PurgeTransaction_Call_CF_CFDP_ResetTransaction_AndReturn_CLIST_CONT context_CF_CFDP_ResetTransaction.keep_history); UtAssert_True(local_result == CF_CLIST_CONT, "CF_PurgeHistory returned %d and should be %d (CF_CLIST_CONT)", local_result, CF_CLIST_CONT); - -} /* end Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT */ +} /******************************************************************************* ** @@ -2183,7 +2140,7 @@ void Test_CF_DoPurgeQueue_PendOnly(void) "context_CF_CList_Traverse.fn == CF_PurgeTransaction"); UtAssert_ADDRESS_EQ(context_CF_CList_Traverse.context, NULL); UtAssert_True(local_result == 0, "CF_DoPurgeQueue returned %d and should be 0", local_result); -} /* end Test_CF_DoPurgeQueue_PendOnly */ +} void Test_CF_DoPurgeQueue_HistoryOnly(void) { @@ -2220,7 +2177,7 @@ void Test_CF_DoPurgeQueue_HistoryOnly(void) "context_CF_CList_Traverse.fn == (CF_CListFn_t )CF_PurgeHistory"); UtAssert_ADDRESS_EQ(context_CF_CList_Traverse.context, dummy_c); UtAssert_True(local_result == 0, "CF_DoPurgeQueue returned %d and should be 0", local_result); -} /* end Test_CF_DoPurgeQueue_HistoryOnly */ +} void Test_CF_DoPurgeQueue_Both(void) { @@ -2265,7 +2222,7 @@ void Test_CF_DoPurgeQueue_Both(void) "context_CF_CList_Traverse[1].fn == (CF_CListFn_t )CF_PurgeHistory"); UtAssert_ADDRESS_EQ(context_CF_CList_Traverse[1].context, dummy_c); UtAssert_True(local_result == 0, "CF_DoPurgeQueue returned %d and should be 0", local_result); -} /* end Test_CF_DoPurgeQueue_Both */ +} void Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1(void) { @@ -2289,7 +2246,7 @@ void Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_PURGE_ARG); UtAssert_STUB_COUNT(CF_CList_Traverse, 0); -} /* end Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1 */ +} void Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1(void) { @@ -2313,7 +2270,7 @@ void Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_PURGE_ARG); UtAssert_STUB_COUNT(CF_CList_Traverse, 0); -} /* end Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1 */ +} /******************************************************************************* ** @@ -2408,7 +2365,7 @@ void Test_CF_CmdWriteQueue_When_chan_Eq_CF_NUM_CAHNNELS_SendEventAndRejectComman UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_CHAN); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end Test_CF_CmdWriteQueue_When_chan_Eq_CF_NUM_CAHNNELS_SendEventAndRejectCommand */ +} void Test_CF_CmdWriteQueue_When_chan_GreaterThan_CF_NUM_CAHNNELS_SendEventAndRejectCommand(void) { @@ -2434,7 +2391,7 @@ void Test_CF_CmdWriteQueue_When_chan_GreaterThan_CF_NUM_CAHNNELS_SendEventAndRej /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end Test_CF_CmdWriteQueue_When_chan_GreaterThan_CF_NUM_CAHNNELS_SendEventAndRejectCommand */ +} void Test_CF_CmdWriteQueue_WhenUpAndPendingQueueSendEventAndRejectCommand(void) { @@ -2464,7 +2421,7 @@ void Test_CF_CmdWriteQueue_WhenUpAndPendingQueueSendEventAndRejectCommand(void) /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end Test_CF_CmdWriteQueue_WhenUpAndPendingQueueSendEventAndRejectCommand */ +} void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_Is_type_up_And_queue_IsNot_q_pend_SendEventAndRejectCommand( void) @@ -2506,9 +2463,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_Is_type_up_And_queue_ /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_Is_type_up_And_queue_IsNot_q_pend_SendEventAndRejectCommand - */ +} void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_IsNot_type_up_And_queue_Is_q_pend_SendEventAndRejectCommand( void) @@ -2550,9 +2505,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_IsNot_type_up_And_que /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_IsNot_type_up_And_queue_Is_q_pend_SendEventAndRejectCommand - */ +} void Test_CF_CmdWriteQueue_When_wq_IsAllAnd_queue_IsAll_fd_Is_0_Call_CF_WrappedClose_SendEventCloseAndRejectCommandWhen_CF_WriteTxnQueueDataToFile_Fails( void) @@ -2600,9 +2553,7 @@ void Test_CF_CmdWriteQueue_When_wq_IsAllAnd_queue_IsAll_fd_Is_0_Call_CF_WrappedC UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_wq_IsAllAnd_queue_IsAll_fd_Is_0_Call_CF_WrappedClose_SendEventCloseAndRejectCommandWhen_CF_WriteTxnQueueDataToFile_Fails - */ +} void Test_CF_CmdWriteQueue_When_CF_WriteTxnQueueDataToFile_FailsAnd_wq_IsUpAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventClosesAndRejectCommand( void) @@ -2653,9 +2604,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteTxnQueueDataToFile_FailsAnd_wq_IsUpAnd_q UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WriteTxnQueueDataToFile_FailsAnd_wq_IsUpAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventClosesAndRejectCommand - */ +} void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsUpAnd_queue_IsHistory_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( void) @@ -2706,9 +2655,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsUpA UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsUpAnd_queue_IsHistory_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand(void) - */ +} void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnFirstCallAnd_wq_IsDownAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( void) @@ -2759,9 +2706,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnFirstCallAnd_wq UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnFirstCallAnd_wq_IsDownAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand - */ +} void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnSecondCallAnd_wq_IsDownAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( void) @@ -2814,9 +2759,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnSecondCallAnd_w UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnSecondCallAnd_wq_IsDownAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand - */ +} void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDownAnd_queue_IsPend_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( void) @@ -2867,9 +2810,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDownAnd_queue_IsPend_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand(void) - */ +} void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDownAnd_queue_IsHistory_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( void) @@ -2920,9 +2861,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); -} /* end - Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDownAnd_queue_IsHistory_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand(void) - */ +} void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All(void) { @@ -2971,8 +2910,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All */ +} void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_History(void) { @@ -3017,8 +2955,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_History(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_AllAnd_q_History */ +} void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Active(void) { @@ -3063,8 +3000,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Active(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All */ +} void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Pend(void) { @@ -3109,8 +3045,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Pend(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Pend */ +} void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_All(void) { @@ -3159,8 +3094,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_All(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All */ +} void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_History(void) { @@ -3205,8 +3139,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_History(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_UpAnd_q_History */ +} void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Active(void) { @@ -3251,8 +3184,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Active(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Active */ +} /* Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Pend IS an error and is handled by a previous test */ @@ -3299,8 +3231,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_All(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active */ +} void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_History(void) { @@ -3345,8 +3276,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_History(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active */ +} void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active(void) { @@ -3391,8 +3321,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active */ +} void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend(void) { @@ -3437,10 +3366,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend(void) UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend */ - -/* end CF_CmdWriteQueue tests */ +} /******************************************************************************* ** @@ -3460,8 +3386,7 @@ void Test_CF_CmdValidateChunkSize_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1( /* Assert */ UtAssert_True(local_result == 1, "CF_CmdValidateChunkSize returned %d and should be 1 (failed)", local_result); - -} /* end Test_CF_CmdValidateChunkSize_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1 */ +} void Test_CF_CmdValidateChunkSize_Any_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1(void) { @@ -3475,8 +3400,7 @@ void Test_CF_CmdValidateChunkSize_Any_val_GreaterThan_pdu_fd_data_t_FailAndRetur /* Assert */ UtAssert_True(local_result == 1, "CF_CmdValidateChunkSize returned %d and should be 1 (failed)", local_result); - -} /* end Test_CF_CmdValidateChunkSize_Any_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1 */ +} void Test_CF_CmdValidateChunkSize_val_SizeOf_pdu_fd_data_t_SuccessAndReturn_0(void) { @@ -3490,8 +3414,7 @@ void Test_CF_CmdValidateChunkSize_val_SizeOf_pdu_fd_data_t_SuccessAndReturn_0(vo /* Assert */ UtAssert_True(local_result == 0, "CF_CmdValidateChunkSize returned %d and should be 0 (success)", local_result); - -} /* end Test_CF_CmdValidateChunkSize_val_SizeOf_pdu_fd_data_t_SuccessAndReturn_0 */ +} void Test_CF_CmdValidateChunkSize_val_LessThanOrEqSizeOf_pdu_fd_data_t_SuccessAndReturn_0(void) { @@ -3505,8 +3428,7 @@ void Test_CF_CmdValidateChunkSize_val_LessThanOrEqSizeOf_pdu_fd_data_t_SuccessAn /* Assert */ UtAssert_True(local_result == 0, "CF_CmdValidateChunkSize returned %d and should be 0 (success)", local_result); - -} /* end Test_CF_CmdValidateChunkSize_val_LessThanOrEqSizeOf_pdu_fd_data_t_SuccessAndReturn_0 */ +} /******************************************************************************* ** @@ -3521,16 +3443,12 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_IsNot_0_Return_0_Success(void) uint8 arg_chan_num = Any_uint8(); /* Any_uint8() used here because it shows value does not matter in this test */ int local_result; - // CF_AppData.config_table = &dummy_config_table; - // memcpy(CF_AppData.config_table->chan[arg_chan_num].sem_name, dummy_sem_name, 20); - /* Act */ local_result = CF_CmdValidateMaxOutgoing(arg_val, arg_chan_num); /* Assert */ UtAssert_True(local_result == 0, "CF_CmdValidateMaxOutgoing returned %d and should be 0 (Success)", local_result); - -} /* end Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_IsNot_0_Return_0_Success */ +} void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_But_sem_name_IsNot_NULL_Return_0_Success(void) { @@ -3548,8 +3466,7 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_But_sem_name_IsNot_NULL_R /* Assert */ UtAssert_True(local_result == 0, "CF_CmdValidateMaxOutgoing returned %d and should be 0 (Success)", local_result); - -} /* end Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_But_sem_name_IsNot_NULL_Return_0_Success */ +} void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Return_1_Fail(void) { @@ -3567,10 +3484,7 @@ void Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Retu /* Assert */ UtAssert_True(local_result == 1, "CF_CmdValidateMaxOutgoing returned %d and should be 1 (Success)", local_result); - -} /* end Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Return_1_Fail */ - -/* end CF_CmdValidateMaxOutgoing tests */ +} /******************************************************************************* ** @@ -3644,8 +3558,6 @@ void Test_CF_CmdGetSetParam(void) UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 3); } -/* end CF_CmdGetSetParam tests */ - /******************************************************************************* ** ** CF_CmdSetParam tests @@ -3676,10 +3588,7 @@ void Test_CF_CmdSetParam_Call_CF_CmdGetSetParam_With_cmd_key_And_cmd_value(void) UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_EID_INF_CMD_GETSET1); /* Assert for incremented counter() */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); - -} /* end Test_CF_CmdSetParam_Call_CF_CmdGetSetParam_With_cmd_key_And_cmd_value */ - -/* end CF_CmdSetParam tests */ +} /******************************************************************************* ** @@ -3710,8 +3619,7 @@ void Test_CF_CmdGetParam_Call_CF_CmdGetSetParam_With_cmd_data_byte_0_AndConstant UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_EID_INF_CMD_GETSET2); /* Assert for incremented counter() */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); - -} /* end Test_CF_CmdGetParam_Call_CF_CmdGetSetParam_With_cmd_data_byte_0_AndConstantValue_0 */ +} /******************************************************************************* ** @@ -3743,8 +3651,7 @@ void Test_CF_CmdEnableEngine_WithEngineNotEnableInitSuccessAndIncrementCmdCounte UT_CF_AssertEventID(CF_EID_INF_CMD_ENABLE_ENGINE); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdEnableEngine_WithEngineNotEnableInitSuccessAndIncrementCmdCounter */ +} void Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementErrCounter(void) { @@ -3770,8 +3677,7 @@ void Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementEr UT_CF_AssertEventID(CF_EID_ERR_CMD_ENABLE_ENGINE); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementErrCounter */ +} void Test_CF_CmdEnableEngine_WithEngineEnableFailsSendEventAndIncrementErrCounter(void) { @@ -3794,8 +3700,7 @@ void Test_CF_CmdEnableEngine_WithEngineEnableFailsSendEventAndIncrementErrCounte UT_CF_AssertEventID(CF_EID_ERR_CMD_ENG_ALREADY_ENA); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdEnableEngine_WithEngineEnableFailsSendEventAndIncrementErrCounter */ +} /******************************************************************************* ** @@ -3823,8 +3728,7 @@ void Test_CF_CmdDisableEngine_SuccessWhenEngineEnabledAndIncrementCmdCounter(voi /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdDisableEngine_SuccessWhenEngineEnabledAndIncrementCmdCounter */ +} void Test_CF_CmdDisableEngine_WhenEngineDisabledAndIncrementErrCounterThenFail(void) { @@ -3848,10 +3752,7 @@ void Test_CF_CmdDisableEngine_WhenEngineDisabledAndIncrementErrCounterThenFail(v UtAssert_True(CF_AppData.hk.counters.err == (uint16)(initial_hk_err_counter + 1), "CF_AppData.hk.counters.err is %d and should be 1 more than %d", CF_AppData.hk.counters.err, initial_hk_err_counter); - -} /* end Test_CF_CmdDisableEngine_WhenEngineDisabledAndIncrementErrCounterThenFail */ - -/* end CF_CmdDisableEngine tests */ +} /******************************************************************************* ** @@ -3882,8 +3783,7 @@ void Test_CF_ProcessGroundCommand_When_cmd_EqTo_CF_NUM_COMMANDS_FailAndSendEvent UT_CF_AssertEventID(CF_EID_ERR_CMD_GCMD_CC); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); - -} /* end Test_CF_ProcessGroundCommand_When_cmd_EqTo_CF_NUM_COMMANDS_FailAndSendEvent */ +} void Test_CF_ProcessGroundCommand_When_cmd_GreaterThan_CF_NUM_COMMANDS_FailAndSendEvent(void) { @@ -3908,8 +3808,7 @@ void Test_CF_ProcessGroundCommand_When_cmd_GreaterThan_CF_NUM_COMMANDS_FailAndSe UT_CF_AssertEventID(CF_EID_ERR_CMD_GCMD_CC); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); - -} /* end Test_CF_ProcessGroundCommand_When_cmd_GreaterThan_CF_NUM_COMMANDS_FailAndSendEvent */ +} void Test_CF_ProcessGroundCommand_Receives_cmd_AndLengthDoesNotMatchExpectedForThatCommandSendEventAndFailure(void) { @@ -3936,9 +3835,7 @@ void Test_CF_ProcessGroundCommand_Receives_cmd_AndLengthDoesNotMatchExpectedForT UT_CF_AssertEventID(CF_EID_ERR_CMD_GCMD_LEN); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); - -} /* end Test_CF_ProcessGroundCommand_Receives_cmd_AndLengthDoesNotMatchExpectedForThatCommandSendEventAndFailure - */ +} void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x00_AndCall_CF_CmdNoop_With_msg(void) { @@ -3966,8 +3863,7 @@ void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x00_AndCall_CF_CmdNoop_With_m UT_CF_AssertEventID(CF_EID_INF_CMD_NOOP); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); - -} /* end Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x00_AndCall_CF_CmdNoop_With_msg */ +} /* Hit a NULL entry to exercise that conditional and no action */ void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x0C_AndDoNothingBecause_fns_12_Is_NULL(void) @@ -3994,9 +3890,7 @@ void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x0C_AndDoNothingBecause_fns_1 /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 0); UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 0); -} /* end Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x0C_AndDoNothingBecause_fns_12_Is_NULL */ - -/* end CF_ProcessGroundCommand tests */ +} /******************************************************************************* ** @@ -4008,7 +3902,7 @@ void add_CF_CmdNoop_tests(void) { UtTest_Add(Test_CF_CmdNoop_SendNoopEventAndAcceptCommand, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdNoop_SendNoopEventAndAcceptCommand"); -} /* end add_CF_CmdNoop_tests */ +} void add_CF_CmdReset_tests(void) { @@ -4031,17 +3925,17 @@ void add_CF_CmdReset_tests(void) "Test_CF_CmdReset_tests_SWhenCommandByteIs_down_AndResetAllHkSentCountendEventAcceptCommand"); UtTest_Add(Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent"); -} /* end add_CF_CmdReset_tests */ +} void add_CF_CmdTxFile_tests(void) { UtTest_Add(Test_CF_CmdTxFile, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "CF_CmdTxFile"); -} /* end add_CF_CmdTxFile_tests */ +} void add_CF_CmdPlaybackDir_tests(void) { UtTest_Add(Test_CF_CmdPlaybackDir, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "CF_CmdPlaybackDir"); -} /* end add_CF_CmdPlaybackDir_tests */ +} void add_CF_DoChanAction_tests(void) { @@ -4060,13 +3954,13 @@ void add_CF_DoChanAction_tests(void) "Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendEvent_"); UtTest_Add(Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent"); -} /* end add_CF_DoChanAction_tests */ +} void add_CF_DoFreezeThaw_tests(void) { UtTest_Add(Test_CF_DoFreezeThaw_Set_frozen_ToGiven_context_barg_AndReturn_0, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_DoFreezeThaw_Set_frozen_ToGiven_context_barg_AndReturn_0"); -} /* end add_CF_DoFreezeThaw_tests */ +} void add_CF_CmdFreeze_tests(void) { @@ -4074,7 +3968,7 @@ void add_CF_CmdFreeze_tests(void) "Test_CF_CmdFreeze_Set_frozen_To_1_AndAcceptCommand"); UtTest_Add(Test_CF_CmdFreeze_Set_frozen_To_1_AndRejectCommand, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdFreeze_Set_frozen_To_1_AndRejectCommand"); -} /* end add_CF_CmdFreeze_tests */ +} void add_CF_CmdThaw_tests(void) { @@ -4082,7 +3976,7 @@ void add_CF_CmdThaw_tests(void) "Test_CF_CmdThaw_Set_frozen_To_0_AndAcceptCommand"); UtTest_Add(Test_CF_CmdThaw_Set_frozen_To_0_AndRejectCommand, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdThaw_Set_frozen_To_0_AndRejectCommand"); -} /* end add_CF_CmdThaw_tests */ +} void add_CF_FindTransactionBySequenceNumberAllChannels_tests(void) { @@ -4091,7 +3985,7 @@ void add_CF_FindTransactionBySequenceNumberAllChannels_tests(void) "Test_CF_FindTransactionBySequenceNumberAllChannels_WhenNoTransactionFoundReturn_NULL"); UtTest_Add(Test_CF_FindTransactionBySequenceNumberAllChannels_Return_TransactionFound, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_FindTransactionBySequenceNumberAllChannels_Return_TransactionFound"); -} /* end add_CF_FindTransactionBySequenceNumberAllChannels_tests */ +} void add_CF_TsnChanAction_tests(void) { @@ -4108,7 +4002,7 @@ void add_CF_TsnChanAction_tests(void) "Test_CF_TsnChanAction_cmd_chan_IsASingleChannel"); UtTest_Add(Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid"); -} /* end add_CF_TsnChanAction_tests */ +} void add_CF_DoSuspRes_Txn_tests(void) { @@ -4116,54 +4010,54 @@ void add_CF_DoSuspRes_Txn_tests(void) cf_cmd_tests_Teardown, "Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action"); UtTest_Add(Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action"); -} /* end add_CF_DoSuspRes_Txn_tests */ +} void add_CF_DoSuspRes_tests(void) { UtTest_Add(Test_CF_DoSuspRes, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "CF_DoSuspRes"); -} /* end add_CF_DoSuspRes_tests */ +} void add_CF_CmdSuspend_tests(void) { UtTest_Add(Test_CF_CmdSuspend_Call_CF_DoSuspRes_WithGiven_msg_And_action_1, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdSuspend_Call_CF_DoSuspRes_WithGiven_msg_And_action_1"); -} /* end add_CF_CmdSuspend_tests */ +} void add_CF_CmdResume_tests(void) { UtTest_Add(Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0"); -} /* end add_CF_CmdResume_tests */ +} void add_CF_CmdCancel_Txn_tests(void) { UtTest_Add(Test_CF_CmdCancel_Txn_Call_CF_CFDP_CancelTransaction_WithGiven_t, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdCancel_Txn_Call_CF_CFDP_CancelTransaction_WithGiven_t"); -} /* end add_CF_CF_CmdCancel_Txn_tests */ +} void add_CF_CmdCancel_tests(void) { UtTest_Add(Test_CF_CmdCancel_Failure, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdCancel_Failure"); UtTest_Add(Test_CF_CmdCancel_Success, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdCancel_Success"); -} /* end add_CF_CmdCancel_tests */ +} void add_CF_CmdAbandon_Txn_tests(void) { UtTest_Add(Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0"); -} /* end add_CF_CmdAbandon_Txn_tests */ +} void add_CF_CmdAbandon_tests(void) { UtTest_Add(Test_CF_CmdAbandon_Failure, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdAbandon_Failure"); UtTest_Add(Test_CF_CmdAbandon_Success, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdAbandon_Success"); -} /* end add_CF_CmdAbandon_Txn_tests */ +} void add_CF_DoEnableDisableDequeue_tests(void) { UtTest_Add(Test_CF_DoEnableDisableDequeue_Set_chan_num_EnabledFlagTo_context_barg, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_DoEnableDisableDequeue_Set_chan_num_EnabledFlagTo_context_barg"); -} /* end add_CF_DoEnableDisableDequeue_tests */ +} void add_CF_CmdEnableDequeue_tests(void) { @@ -4171,7 +4065,7 @@ void add_CF_CmdEnableDequeue_tests(void) "Test_CF_CmdEnableDequeue_Success"); UtTest_Add(Test_CF_CmdEnableDequeue_Failure, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdEnableDequeue_Failure"); -} /* end add_CF_CmdEnableDequeue_tests */ +} void add_CF_CmdDisableDequeue_tests(void) { @@ -4179,7 +4073,7 @@ void add_CF_CmdDisableDequeue_tests(void) "Test_CF_CmdDisableDequeue_Success"); UtTest_Add(Test_CF_CmdDisableDequeue_Failure, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdDisableDequeue_Failure"); -} /* end add_CF_CmdDisableDequeue_tests */ +} void add_CF_DoEnableDisablePolldir_tests(void) { @@ -4195,7 +4089,7 @@ void add_CF_DoEnableDisablePolldir_tests(void) "Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_AndSendEvent"); UtTest_Add(Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent"); -} /* end add_CF_DoEnableDisablePolldir_tests */ +} void add_CF_CmdEnablePolldir_tests(void) { @@ -4203,7 +4097,7 @@ void add_CF_CmdEnablePolldir_tests(void) "Test_CF_CmdEnablePolldir_SuccessWhenActionSuccess"); UtTest_Add(Test_CF_CmdEnablePolldir_FailWhenActionFail, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdEnablePolldir_FailWhenActionFail"); -} /* end add_CF_CmdEnablePolldir_tests */ +} void add_CF_CmdDisablePolldir_tests(void) { @@ -4211,19 +4105,19 @@ void add_CF_CmdDisablePolldir_tests(void) "Test_CF_CmdDisablePolldir_SuccessWhenActionSuccess"); UtTest_Add(Test_CF_CmdDisablePolldir_FailWhenActionFail, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdDisablePolldir_FailWhenActionFail"); -} /* end add_CF_CmdDisablePolldir_tests */ +} void add_CF_PurgeHistory_tests(void) { UtTest_Add(Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT"); -} /* end add_CF_PurgeHistory_tests */ +} void add_CF_PurgeTransaction_tests(void) { UtTest_Add(Test_CF_PurgeTransaction_Call_CF_CFDP_ResetTransaction_AndReturn_CLIST_CONT, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_PurgeTransaction_Call_CF_CFDP_ResetTransaction_AndReturn_CLIST_CONT"); -} /* end add_CF_PurgeTransaction_tests */ +} void add_CF_DoPurgeQueue_tests(void) { @@ -4236,7 +4130,7 @@ void add_CF_DoPurgeQueue_tests(void) cf_cmd_tests_Teardown, "Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1"); UtTest_Add(Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1"); -} /* end add_CF_DoPurgeQueue_tests */ +} void add_CF_CmdPurgeQueue_tests(void) { @@ -4244,7 +4138,7 @@ void add_CF_CmdPurgeQueue_tests(void) "Test_CF_CmdPurgeQueue_FailWhenActionFail"); UtTest_Add(Test_CF_CmdPurgeQueue_SuccessWhenActionSuccess, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdPurgeQueue_SuccessWhenActionSuccess"); -} /* end add_CF_CmdPurgeQueue_tests */ +} void add_CF_CmdWriteQueue_tests(void) { @@ -4324,7 +4218,7 @@ void add_CF_CmdWriteQueue_tests(void) "Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active"); UtTest_Add(Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend"); -} /* end add_CF_CmdWriteQueue_tests */ +} void add_CF_CmdValidateChunkSize_tests(void) { @@ -4337,7 +4231,7 @@ void add_CF_CmdValidateChunkSize_tests(void) UtTest_Add(Test_CF_CmdValidateChunkSize_val_LessThanOrEqSizeOf_pdu_fd_data_t_SuccessAndReturn_0, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdValidateChunkSize_val_LessThanOrEqSizeOf_pdu_fd_data_t_SuccessAndReturn_0"); -} /* end add_CF_CmdValidateChunkSize_tests */ +} void add_CF_CmdValidateMaxOutgoing_tests(void) { @@ -4349,25 +4243,25 @@ void add_CF_CmdValidateMaxOutgoing_tests(void) UtTest_Add(Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Return_1_Fail, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdValidateMaxOutgoing_WhenGiven_val_Is_0_And_sem_name_Is_NULL_Return_1_Fail"); -} /* end add_CF_CmdValidateMaxOutgoing_tests */ +} void add_CF_CmdGetSetParam_tests(void) { UtTest_Add(Test_CF_CmdGetSetParam, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "CF_CmdGetSetParam"); -} /* end add_CF_CmdGetSetParam_tests */ +} void add_CF_CmdSetParam_tests(void) { UtTest_Add(Test_CF_CmdSetParam_Call_CF_CmdGetSetParam_With_cmd_key_And_cmd_value, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdSetParam_Call_CF_CmdGetSetParam_With_cmd_key_And_cmd_value"); -} /* end add_CF_CmdSetParam_tests */ +} void add_CF_CmdGetParam_tests(void) { UtTest_Add(Test_CF_CmdGetParam_Call_CF_CmdGetSetParam_With_cmd_data_byte_0_AndConstantValue_0, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdGetParam_Call_CF_CmdGetSetParam_With_cmd_data_byte_0_AndConstantValue_0"); -} /* end add_CF_CmdGetParam_tests */ +} void add_CF_CmdEnableEngine_tests(void) { @@ -4378,7 +4272,7 @@ void add_CF_CmdEnableEngine_tests(void) "Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementErrCounter"); UtTest_Add(Test_CF_CmdEnableEngine_WithEngineEnableFailsSendEventAndIncrementErrCounter, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdEnableEngine_WithEngineEnableFailsSendEventAndIncrementErrCounter"); -} /* end add_CF_CmdEnableEngine_tests */ +} void add_CF_CmdDisableEngine_tests(void) { @@ -4386,7 +4280,7 @@ void add_CF_CmdDisableEngine_tests(void) cf_cmd_tests_Teardown, "Test_CF_CmdDisableEngine_SuccessWhenEngineEnabledAndIncrementCmdCounter"); UtTest_Add(Test_CF_CmdDisableEngine_WhenEngineDisabledAndIncrementErrCounterThenFail, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdDisableEngine_WhenEngineDisabledAndIncrementErrCounterThenFail"); -} /* end add_CF_CmdDisableEngine_tests */ +} void add_CF_ProcessGroundCommand_tests(void) { @@ -4404,9 +4298,7 @@ void add_CF_ProcessGroundCommand_tests(void) UtTest_Add(Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x0C_AndDoNothingBecause_fns_12_Is_NULL, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x0C_AndDoNothingBecause_fns_12_Is_NULL"); -} /* end add_CF_ProcessGroundCommand_tests */ - -/* end cf_cmd tests UtTest_Add groups */ +} /******************************************************************************* ** @@ -4491,7 +4383,4 @@ void UtTest_Setup(void) add_CF_CmdDisableEngine_tests(); add_CF_ProcessGroundCommand_tests(); - -} /* end UtTest_Setup for cf_cmd_tests.c */ - -/* end cf_cmd_tests.c */ +} \ No newline at end of file diff --git a/unit-test/cf_codec_tests.c b/unit-test/cf_codec_tests.c index 1b8b131a..781fda8c 100644 --- a/unit-test/cf_codec_tests.c +++ b/unit-test/cf_codec_tests.c @@ -200,6 +200,7 @@ void Test_CF_CFDP_EncodeFileDirectiveHeader(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeLV(void) { /* Test for: @@ -252,6 +253,7 @@ void Test_CF_CFDP_EncodeLV(void) UtAssert_UINT32_EQ(CF_CODEC_GET_POSITION(&state), sizeof(expected_nodata)); UtAssert_MemCmp(bytes, expected_nodata, sizeof(expected_nodata), "Encoded Bytes"); } + void Test_CF_CFDP_EncodeTLV(void) { /* Test for: @@ -316,6 +318,7 @@ void Test_CF_CFDP_EncodeTLV(void) UtAssert_UINT32_EQ(CF_CODEC_GET_POSITION(&state), sizeof(expected_nodata)); UtAssert_MemCmp(bytes, expected_nodata, sizeof(expected_nodata), "Encoded Bytes"); } + void Test_CF_CFDP_EncodeSegmentRequest(void) { /* Test for: @@ -347,6 +350,7 @@ void Test_CF_CFDP_EncodeSegmentRequest(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeAllTlv(void) { /* Test for: @@ -388,6 +392,7 @@ void Test_CF_CFDP_EncodeAllTlv(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeAllSegments(void) { /* Test for: @@ -428,6 +433,7 @@ void Test_CF_CFDP_EncodeAllSegments(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeMd(void) { /* Test for: @@ -462,6 +468,7 @@ void Test_CF_CFDP_EncodeMd(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeFileDataHeader(void) { /* Test for: @@ -508,6 +515,7 @@ void Test_CF_CFDP_EncodeFileDataHeader(void) UtAssert_UINT32_EQ(CF_CODEC_GET_POSITION(&state), sizeof(expected_meta)); UtAssert_MemCmp(bytes, expected_meta, sizeof(expected_meta), "Encoded Bytes"); } + void Test_CF_CFDP_EncodeEof(void) { /* Test for: @@ -544,6 +552,7 @@ void Test_CF_CFDP_EncodeEof(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeFin(void) { /* Test for: @@ -576,6 +585,7 @@ void Test_CF_CFDP_EncodeFin(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeAck(void) { /* Test for: @@ -609,6 +619,7 @@ void Test_CF_CFDP_EncodeAck(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeNak(void) { /* Test for: @@ -646,6 +657,7 @@ void Test_CF_CFDP_EncodeNak(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_CFDP_EncodeCrc(void) { /* Test for: @@ -676,6 +688,7 @@ void Test_CF_CFDP_EncodeCrc(void) UtAssert_MemCmp(bytes, expected, sizeof(expected), "Encoded Bytes"); UtAssert_MemCmpValue(bytes + sizeof(expected), 0xEE, sizeof(bytes) - sizeof(expected), "Remainder unchanged"); } + void Test_CF_DecodeIntegerInSize(void) { /* Test for: @@ -707,6 +720,7 @@ void Test_CF_DecodeIntegerInSize(void) UtAssert_BOOL_TRUE(CF_CODEC_IS_OK(&state)); UtAssert_UINT32_EQ(CF_CODEC_GET_POSITION(&state), sizeof(bytes_4)); } + void Test_CF_CFDP_DecodeHeader(void) { /* Test for: @@ -756,6 +770,7 @@ void Test_CF_CFDP_DecodeHeader(void) UT_CF_SetupDecodeState(&state, bad_tsn, sizeof(bad_tsn)); UtAssert_INT32_EQ(CF_CFDP_DecodeHeader(&state, &out), -1); } + void Test_CF_CFDP_DecodeFileDirectiveHeader(void) { /* Test for: @@ -781,6 +796,7 @@ void Test_CF_CFDP_DecodeFileDirectiveHeader(void) UtAssert_UINT32_EQ(CF_CODEC_GET_POSITION(&state), sizeof(bytes)); UtAssert_UINT32_EQ(out.directive_code, CF_CFDP_FileDirective_NAK); } + void Test_CF_CFDP_DecodeLV(void) { /* Test for: @@ -813,6 +829,7 @@ void Test_CF_CFDP_DecodeLV(void) CF_CFDP_DecodeLV(&state, &out); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(&state)); } + void Test_CF_CFDP_DecodeTLV(void) { /* Test for: @@ -856,6 +873,7 @@ void Test_CF_CFDP_DecodeTLV(void) CF_CFDP_DecodeTLV(&state, &out); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(&state)); } + void Test_CF_CFDP_DecodeSegmentRequest(void) { /* Test for: @@ -882,6 +900,7 @@ void Test_CF_CFDP_DecodeSegmentRequest(void) UtAssert_UINT32_EQ(out.offset_start, 0x11223344); UtAssert_UINT32_EQ(out.offset_end, 0x55667788); } + void Test_CF_CFDP_DecodeAllTlv(void) { /* Test for: @@ -936,6 +955,7 @@ void Test_CF_CFDP_DecodeAllTlv(void) CF_CFDP_DecodeAllTlv(&state, &out, 1 + CF_PDU_MAX_TLV); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(&state)); } + void Test_CF_CFDP_DecodeAllSegments(void) { /* Test for: @@ -982,6 +1002,7 @@ void Test_CF_CFDP_DecodeAllSegments(void) CF_CFDP_DecodeAllSegments(&state, &out, 1 + CF_PDU_MAX_SEGMENTS); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(&state)); } + void Test_CF_CFDP_DecodeMd(void) { /* Test for: @@ -1017,6 +1038,7 @@ void Test_CF_CFDP_DecodeMd(void) CF_CFDP_DecodeMd(&state, &out); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(&state)); } + void Test_CF_CFDP_DecodeFileDataHeader(void) { /* Test for: @@ -1071,6 +1093,7 @@ void Test_CF_CFDP_DecodeFileDataHeader(void) CF_CFDP_DecodeFileDataHeader(&state, true, &out); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(&state)); } + void Test_CF_CFDP_DecodeEof(void) { /* Test for: @@ -1108,6 +1131,7 @@ void Test_CF_CFDP_DecodeEof(void) CF_CFDP_DecodeEof(&state, &out); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(&state)); } + void Test_CF_CFDP_DecodeFin(void) { /* Test for: @@ -1135,6 +1159,7 @@ void Test_CF_CFDP_DecodeFin(void) UtAssert_UINT32_EQ(out.delivery_code, 1); UtAssert_UINT32_EQ(out.file_status, 2); } + void Test_CF_CFDP_DecodeAck(void) { /* Test for: @@ -1163,6 +1188,7 @@ void Test_CF_CFDP_DecodeAck(void) UtAssert_UINT32_EQ(out.cc, 2); UtAssert_UINT32_EQ(out.txn_status, 3); } + void Test_CF_CFDP_DecodeNak(void) { /* Test for: @@ -1195,6 +1221,7 @@ void Test_CF_CFDP_DecodeNak(void) UtAssert_UINT32_EQ(out.segment_list.segments[1].offset_start, 0x7); UtAssert_UINT32_EQ(out.segment_list.segments[1].offset_end, 0x8); } + void Test_CF_CFDP_DecodeCrc(void) { /* Test for: @@ -1278,7 +1305,4 @@ void UtTest_Setup(void) Add_CF_Encode_tests(); Add_CF_Decode_tests(); - -} /* end UtTest_Setup for cf_codec_tests.c */ - -/* end cf_codec_tests.c */ +} \ No newline at end of file diff --git a/unit-test/cf_timer_tests.c b/unit-test/cf_timer_tests.c index d1eb0b61..99b7b12a 100644 --- a/unit-test/cf_timer_tests.c +++ b/unit-test/cf_timer_tests.c @@ -30,14 +30,12 @@ void cf_timer_tests_Setup(void) { cf_tests_Setup(); -} /* end cf_timer_tests_Setup */ +} void cf_timer_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_timer_tests_Teardown */ - -/* end cf_timer_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -57,10 +55,7 @@ void Test_CF_Timer_Sec2Ticks_ReturnExpectedValue(void) /* Act */ UtAssert_UINT32_EQ(CF_Timer_Sec2Ticks(arg_sec), arg_sec * dummy_ticks_per_second); - -} /* end Test_CF_Timer_Sec2Ticks_ReturnExpectedValue */ - -/* end CF_Timer_Sec2Ticks tests */ +} /******************************************************************************* ** @@ -89,9 +84,7 @@ void Test_CF_Timer_InitRelSec_ReceiveExpectedValue(void) /* Assert */ UtAssert_UINT32_EQ(arg_t->tick, arg_rel_sec * dummy_ticks_per_second); -} /* end Test_CF_Timer_InitRelSec_ReceiveExpectedValue */ - -/* end CF_Timer_InitRelSec tests */ +} /******************************************************************************* ** @@ -109,8 +102,7 @@ void Test_CF_Timer_Expired_When_t_tick_Is_0_Return_1(void) /* Act */ UtAssert_INT32_EQ(CF_Timer_Expired(arg_t), expected_result); - -} /* end Test_CF_Timer_Expired_When_t_tick_Is_0_Return_1 */ +} void Test_CF_Timer_Expired_When_t_tick_Is_1_Return_0(void) { @@ -122,8 +114,7 @@ void Test_CF_Timer_Expired_When_t_tick_Is_1_Return_0(void) /* Act */ UtAssert_INT32_EQ(CF_Timer_Expired(arg_t), expected_result); - -} /* end Test_CF_Timer_Expired_When_t_tick_Is_1_Return_0 */ +} void Test_CF_Timer_Expired_When_t_tick_IsAnyIntegerExcept_0_Return_0(void) { @@ -135,9 +126,7 @@ void Test_CF_Timer_Expired_When_t_tick_IsAnyIntegerExcept_0_Return_0(void) /* Act */ UtAssert_INT32_EQ(CF_Timer_Expired(arg_t), expected_result); -} /* end Test_CF_Timer_Expired_When_t_tick_IsAnyIntegerExcept_0_Return_0 */ - -/* end CF_Timer_Expired tests */ +} /******************************************************************************* ** @@ -159,10 +148,7 @@ void Test_CF_Timer_Tick_When_t_tick_Is_non0_Decrement_t_tick(void) /* Assert */ UtAssert_UINT32_EQ(arg_t->tick, initial_tick - 1); - -} /* Test_CF_Timer_Tick_When_t_tick_Is_non0_Decrement_t_tick */ - -/* end CF_Timer_Tick tests */ +} /******************************************************************************* ** @@ -200,8 +186,6 @@ void add_CF_Timer_Tick_tests(void) "Test_CF_Timer_Tick_When_t_tick_Is_non0_Decrement_t_tick"); } -/* end cf_timer_tests UtTest_Add groups */ - /******************************************************************************* ** ** cf_timer_tests test UtTest_Setup @@ -219,7 +203,4 @@ void UtTest_Setup(void) add_CF_Timer_Expired_tests(); add_CF_Timer_Tick_tests(); - -} /* end UtTest_Setup cf_timer_tests.c */ - -/* end cf_timer_tests.c */ +} \ No newline at end of file diff --git a/unit-test/cf_utils_tests.c b/unit-test/cf_utils_tests.c index 97176d49..06490b1e 100644 --- a/unit-test/cf_utils_tests.c +++ b/unit-test/cf_utils_tests.c @@ -41,14 +41,12 @@ typedef struct void cf_utils_tests_Setup(void) { cf_tests_Setup(); -} /* end cf_utils_tests_Setup */ +} void cf_utils_tests_Teardown(void) { cf_tests_Teardown(); -} /* end cf_utils_tests_Teardown */ - -/* end cf_utils_tests Setup and Teardown */ +} /******************************************************************************* ** @@ -86,8 +84,6 @@ void local_handler_OS_close(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubC *******************************************************************************/ /*---------------------------------------------------------------- - * - * Function: UT_Callback_CF_TraverseAllTransactions * * A UT-specific callback that can be used with CF_TraverseAllTransactions * @@ -105,8 +101,6 @@ static void UT_Callback_CF_TraverseAllTransactions(CF_Transaction_t *t, void *co } /*---------------------------------------------------------------- - * - * Function: UT_AltHandler_CF_CList_Traverse_SeqArg_SetTxn * * A simple handler that just sets the "t" output in the state object * @@ -290,10 +284,7 @@ void Test_cf_dequeue_transaction_Call_CF_CList_Remove_AndDecrement_q_size(void) UtAssert_ADDRESS_EQ(context_clist_remove.node, expected_cl_node); UtAssert_True(updated_q_size == initial_q_size - 1, "q_size is %d and that is 1 less than initial value %d", updated_q_size, initial_q_size); - -} /* end Test_cf_dequeue_transaction_Call_CF_CList_Remove_AndDecrement_q_size */ - -/* end CF_DequeueTransaction tests */ +} /* CF_MoveTransaction tests */ @@ -341,9 +332,7 @@ void Test_cf_move_transaction_Call_CF_CList_InsertBack_AndSet_q_index_ToGiven_q( UtAssert_True(arg_t->flags.com.q_index == arg_q, "t->flags.com.q_index set to %u and should equal passed in q value %u", arg_t->flags.com.q_index, arg_q); -} /* end Test_cf_move_transaction_Call_CF_CList_InsertBack_AndSet_q_index_ToGiven_q */ - -/* end CF_MoveTransaction tests */ +} /* CF_CList_Remove_Ex tests */ @@ -379,9 +368,7 @@ void Test_CF_CList_Remove_Ex_Call_CF_CList_Remove_AndDecrement_q_size(void) UtAssert_ADDRESS_EQ(context_clist_remove.node, expected_remove_node); UtAssert_True(updated_q_size == initial_q_size - 1, "q_size is %d and that is 1 less than initial value %d", updated_q_size, initial_q_size); -} /* end Test_CF_CList_Remove_Ex_Call_CF_CList_Remove_AndDecrement_q_size */ - -/* end CF_CList_Remove_Ex tests */ +} /* CF_CList_InsertAfter_Ex tests */ @@ -417,10 +404,7 @@ void Test_CF_CList_InsertAfter_Ex_Call_CF_CList_InsertAfter_AndIncrement_q_size( UtAssert_ADDRESS_EQ(context_CF_CList_InsertAfter.after, arg_after); UtAssert_True(updated_q_size == (uint16)(initial_q_size + 1), "q_size is %d and that is 1 more than initial value %d", updated_q_size, initial_q_size); - -} /* end Test_CF_CList_InsertAfter_Ex_Call_CF_CList_InsertAfter_AndIncrement_q_size */ - -/* end CF_CList_InsertAfter_Ex tests */ +} /* CF_CList_InsertBack_Ex tests */ @@ -455,12 +439,7 @@ void Test_CF_CList_InsertBack_Ex_Call_CF_CList_InsertBack_AndIncrement_q_size(vo UtAssert_ADDRESS_EQ(context_clist_insert_back.node, expected_insert_back_node); UtAssert_True(updated_q_size == (uint16)(initial_q_size + 1), "q_size is %d and that is 1 more than initial value %d", updated_q_size, initial_q_size); - -} /* end Test_CF_CList_InsertBack_Ex_Call_CF_CList_InsertBack_AndIncrement_q_size */ - -/* end CF_CList_InsertBack_Ex tests */ - -/* end cf_utils.h function tests */ +} /******************************************************************************* ** @@ -508,7 +487,6 @@ void Test_CF_Traverse_WriteHistoryQueueEntryToFile(void) UtAssert_UINT32_EQ(args.counter, 2); /* no increment */ UtAssert_BOOL_TRUE(args.error); } -/* end CF_Traverse_WriteHistoryQueueEntryToFile tests */ /******************************************************************************* ** @@ -542,8 +520,6 @@ void Test_CF_Traverse_WriteTxnQueueEntryToFile(void) UtAssert_BOOL_TRUE(args.error); } -/* end CF_Traverse_WriteTxnQueueEntryToFile tests */ - /******************************************************************************* ** ** CF_WriteHistoryEntryToFile tests @@ -601,8 +577,6 @@ void Test_CF_WriteTxnQueueDataToFile(void) UtAssert_STUB_COUNT(CF_CList_Traverse, 1); } -/* end CF_WriteQueueDataToFile tests */ - /******************************************************************************* ** ** CF_WriteHistoryQueueDataToFile tests @@ -628,8 +602,6 @@ void Test_CF_WriteHistoryQueueDataToFile(void) UtAssert_STUB_COUNT(CF_CList_Traverse, 1); } -/* end CF_WriteHistoryQueueDataToFile tests */ - /******************************************************************************* ** ** CF_PrioSearch tests @@ -653,8 +625,7 @@ void Test_CF_PrioSearch_When_t_PrioIsGreaterThanContextPrioReturn_CLIST_CONT(voi /* Assert */ UtAssert_INT32_EQ(result, CF_CLIST_CONT); - -} /* end Test_CF_PrioSearch_When_t_PrioIsGreaterThanContextPrioReturn_CLIST_CONT */ +} void Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT(void) { @@ -677,8 +648,7 @@ void Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndRetur /* Assert */ UtAssert_INT32_EQ(result, CF_CLIST_EXIT); UtAssert_ADDRESS_EQ(dummy_p.t, &dummy_t); - -} /* end Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT */ +} void Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT(void) { @@ -701,10 +671,7 @@ void Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndR /* Assert */ UtAssert_INT32_EQ(result, CF_CLIST_EXIT); UtAssert_ADDRESS_EQ(dummy_p.t, &dummy_t); - -} /* end Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT */ - -/* end CF_PrioSearch tests */ +} /******************************************************************************* ** @@ -748,7 +715,7 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertBack_Ex_ListIsEmpty_AndSet_q_ind UtAssert_True(arg_t->flags.com.q_index == arg_q, "arg_t->flags.com.q_index set to %d and should be %d (CF_QueueIdx_t q)", arg_t->flags.com.q_index, arg_q); -} /* end Test_CF_InsertSortPrio_Call_CF_CList_InsertBack_Ex_ListIsEmpty_AndSet_q_index_To_q */ +} void Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q(void) { @@ -807,8 +774,7 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q(voi UtAssert_ADDRESS_EQ(context_CF_CList_InsertAfter.after, (CF_CListNode_t *)expected_insert_after_after); UtAssert_True(arg_t->flags.com.q_index == arg_q, "t->flags.com.q_index is %u and should be %u (q)", arg_t->flags.com.q_index, arg_q); - -} /* end Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q */ +} void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) { @@ -863,10 +829,7 @@ void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) UtAssert_ADDRESS_EQ(context_clist_insert_back.node, expected_insert_back_node); UtAssert_True(arg_t->flags.com.q_index == arg_q, "t->flags.com.q_index is %u and should be %u (q)", arg_t->flags.com.q_index, arg_q); - -} /* end Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex */ - -/* end CF_InsertSortPrio tests */ +} /******************************************************************************* ** @@ -913,8 +876,7 @@ void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_T "CF_TraverseAllTransactions_Impl set args->counter to %d which is 1 more than initial value %d", arg_args->counter, initial_args_counter); UtAssert_INT32_EQ(result, CF_CLIST_CONT); - -} /* end Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_ToCounter */ +} /******************************************************************************* ** @@ -968,7 +930,7 @@ void Test_CF_TraverseAllTransactions_CallOtherFunction_CF_Q_RX_TimesAndReturn_ar "CF_CList_Traverse context_counter[%u] is %d and should be %d (+1 from previous)", i, contexts_cf_clist_traverse[i].context_counter, i + 1); } -} /* end Test_CF_TraverseAllTransactions_CallOtherFunction_CF_Q_RX_TimesAndReturn_args_counter */ +} /******************************************************************************* ** @@ -989,10 +951,7 @@ void Test_CF_TraverseAllTransactions_All_Channels_ReturnTotalTraversals(void) /* Act */ UtAssert_INT32_EQ(CF_TraverseAllTransactions_All_Channels(arg_fn, arg_context), expected_result); - -} /* end Test_CF_TraverseAllTransactions_All_Channels_ReturnTotalTraversals */ - -/* end CF_TraverseAllTransactions_All_Channels tests */ +} /******************************************************************************* ** @@ -1016,12 +975,10 @@ void Test_CF_WrappedOpen_Call_OS_OpenCreate_WithGivenArgumentsAndReturnItsReturn /* Act */ UtAssert_INT32_EQ(CF_WrappedOpenCreate(arg_fd, arg_fname, arg_flags, arg_access), forced_return_OS_OpenCreate); - // /* Assert */ + /* Assert */ UtAssert_STUB_COUNT(CFE_ES_PerfLogAdd, 2); UtAssert_STUB_COUNT(OS_OpenCreate, 1); -} /* end Test_CF_WrappedOpen_Call_OS_OpenCreate_WithGivenArgumentsAndReturnItsReturnValue */ - -/* end CF_WrappedOpen tests */ +} /******************************************************************************* ** @@ -1041,7 +998,7 @@ void Test_CF_WrappedClose_DoNotReceive_OS_SUCCESS_From_OS_close_EventSent(void) UtAssert_STUB_COUNT(CFE_ES_PerfLogAdd, 2); UtAssert_STUB_COUNT(OS_close, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_WrappedClose_DoNotReceive_OS_SUCCESS_From_OS_close_EventSent */ +} void Test_CF_WrappedClose_Receive_OS_SUCCESS_From_OS_close_NoEventSent(void) { @@ -1056,9 +1013,7 @@ void Test_CF_WrappedClose_Receive_OS_SUCCESS_From_OS_close_NoEventSent(void) UtAssert_STUB_COUNT(CFE_ES_PerfLogAdd, 2); UtAssert_STUB_COUNT(OS_close, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_WrappedClose_Receive_OS_SUCCESS_From_OS_close_NoEventSent */ - -/* end CF_WrappedClose tests */ +} /******************************************************************************* ** @@ -1069,18 +1024,15 @@ void Test_CF_WrappedClose_Receive_OS_SUCCESS_From_OS_close_NoEventSent(void) void Test_CF_WrappedRead_CallsOS_read_WithGivenArgumentsAndReturnItsReturnValue(void) { /* Arrange */ - uint32 arg_read_size = Any_uint32_LessThan_or_EqualTo(10); // 10 is arbitrary to make test fast - uint8 dummy_buf[10] = {0}; // 10 to match max read size of 10 (arbitrary) + uint32 arg_read_size = Any_uint32_LessThan_or_EqualTo(10); /* 10 is arbitrary to make test fast */ + uint8 dummy_buf[10] = {0}; /* 10 to match max read size of 10 (arbitrary) */ void * arg_buf = &dummy_buf; UT_SetDefaultReturnValue(UT_KEY(OS_read), arg_read_size); /* Act */ UtAssert_INT32_EQ(CF_WrappedRead(UT_CF_OS_OBJID, arg_buf, arg_read_size), arg_read_size); - -} /* end Test_CF_WrappedRead_CallsOS_read_WithGivenArgumentsAndReturnItsReturnValue */ - -/* end CF_WrappedRead tests */ +} /******************************************************************************* ** @@ -1100,10 +1052,7 @@ void Test_CF_WrappedWrite_Call_OS_write_WithGivenArgumentsAndReturnItsReturnValu /* Act */ UtAssert_INT32_EQ(CF_WrappedWrite(UT_CF_OS_OBJID, arg_buf, test_write_size), expected_result); - -} /* end Test_CF_WrappedWrite_Call_OS_write_WithGivenArgumentsAndReturnItsReturnValue */ - -/* end CF_WrappedWrite tests */ +} /******************************************************************************* ** @@ -1122,10 +1071,78 @@ void Test_CF_WrappedLseek_Call_OS_lseek_WithGivenArgumentsAndReturnItsReturnValu /* Act */ UtAssert_INT32_EQ(CF_WrappedLseek(UT_CF_OS_OBJID, test_offset, test_mode), expected_result); +} -} /* end Test_CF_WrappedLseek_Call_OS_lseek_WithGivenArgumentsAndReturnItsReturnValue */ +void Test_CF_TxnStatus_IsError(void) +{ + /* Test function for: + * bool CF_TxnStatus_IsError(CF_TxnStatus_t txn_stat) + */ + UtAssert_BOOL_FALSE(CF_TxnStatus_IsError(CF_TxnStatus_UNDEFINED)); + UtAssert_BOOL_FALSE(CF_TxnStatus_IsError(CF_TxnStatus_NO_ERROR)); + UtAssert_BOOL_TRUE(CF_TxnStatus_IsError(CF_TxnStatus_INACTIVITY_DETECTED)); + UtAssert_BOOL_TRUE(CF_TxnStatus_IsError(CF_TxnStatus_MAX)); +} -/* end CF_WrappedLseek tests */ +void Test_CF_TxnStatus_To_ConditionCode(void) +{ + /* Test function for: + * CF_CFDP_ConditionCode_t CF_TxnStatus_To_ConditionCode(CF_TxnStatus_t txn_stat) + */ + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_UNDEFINED), CF_CFDP_ConditionCode_NO_ERROR); + + /* for the 4-bit condition codes these should be numerically equivalent to status codes */ + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_NO_ERROR), CF_CFDP_ConditionCode_NO_ERROR); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_POS_ACK_LIMIT_REACHED), + CF_CFDP_ConditionCode_POS_ACK_LIMIT_REACHED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_KEEP_ALIVE_LIMIT_REACHED), + CF_CFDP_ConditionCode_KEEP_ALIVE_LIMIT_REACHED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_INVALID_TRANSMISSION_MODE), + CF_CFDP_ConditionCode_INVALID_TRANSMISSION_MODE); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_FILESTORE_REJECTION), + CF_CFDP_ConditionCode_FILESTORE_REJECTION); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_FILE_CHECKSUM_FAILURE), + CF_CFDP_ConditionCode_FILE_CHECKSUM_FAILURE); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_FILE_SIZE_ERROR), + CF_CFDP_ConditionCode_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_NAK_LIMIT_REACHED), + CF_CFDP_ConditionCode_NAK_LIMIT_REACHED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_INACTIVITY_DETECTED), + CF_CFDP_ConditionCode_INACTIVITY_DETECTED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_INVALID_FILE_STRUCTURE), + CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_CHECK_LIMIT_REACHED), + CF_CFDP_ConditionCode_CHECK_LIMIT_REACHED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_UNSUPPORTED_CHECKSUM_TYPE), + CF_CFDP_ConditionCode_UNSUPPORTED_CHECKSUM_TYPE); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_SUSPEND_REQUEST_RECEIVED), + CF_CFDP_ConditionCode_SUSPEND_REQUEST_RECEIVED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_CANCEL_REQUEST_RECEIVED), + CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED); + + /* Other extended translations */ + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_ACK_LIMIT_NO_FIN), + CF_CFDP_ConditionCode_INACTIVITY_DETECTED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_ACK_LIMIT_NO_EOF), + CF_CFDP_ConditionCode_INACTIVITY_DETECTED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_PROTOCOL_ERROR), + CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED); + UtAssert_INT32_EQ(CF_TxnStatus_To_ConditionCode(CF_TxnStatus_MAX), CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED); +} + +void Test_CF_TxnStatus_From_ConditionCode(void) +{ + /* Test function for: + * CF_TxnStatus_t CF_TxnStatus_From_ConditionCode(CF_CFDP_ConditionCode_t cc) + */ + int32 i; + + /* for the 4-bit condition codes these should be numerically equivalent to status codes */ + for (i = 0; i <= 15; ++i) + { + UtAssert_INT32_EQ(CF_TxnStatus_From_ConditionCode(i), i); + } +} /******************************************************************************* ** @@ -1168,6 +1185,12 @@ void add_cf_utils_h_tests(void) UtTest_Add(Test_CF_CList_InsertBack_Ex_Call_CF_CList_InsertBack_AndIncrement_q_size, cf_utils_tests_Setup, cf_utils_tests_Teardown, "Test_CF_CList_InsertBack_Ex_Call_CF_CList_InsertBack_AndIncrement_q_size"); /* end CF_CList_InsertBack_Ex tests */ + + UtTest_Add(Test_CF_TxnStatus_IsError, cf_utils_tests_Setup, cf_utils_tests_Teardown, "CF_TxnStatus_IsError"); + UtTest_Add(Test_CF_TxnStatus_To_ConditionCode, cf_utils_tests_Setup, cf_utils_tests_Teardown, + "CF_TxnStatus_To_ConditionCode"); + UtTest_Add(Test_CF_TxnStatus_From_ConditionCode, cf_utils_tests_Setup, cf_utils_tests_Teardown, + "CF_TxnStatus_From_ConditionCode"); } void add_CF_Traverse_WriteHistoryToFile_tests(void) @@ -1309,7 +1332,4 @@ void UtTest_Setup(void) add_CF_WrappedWrite_tests(); add_CF_WrappedLseek_tests(); - -} /* end UtTest_Setup for cf_utils_tests.c */ - -/* end cf_utils_tests.c */ +} \ No newline at end of file diff --git a/unit-test/stubs/cf_app_stubs.c b/unit-test/stubs/cf_app_stubs.c index e3b87773..2bd9710e 100644 --- a/unit-test/stubs/cf_app_stubs.c +++ b/unit-test/stubs/cf_app_stubs.c @@ -33,7 +33,6 @@ */ void CF_AppMain(void) { - UT_GenStub_Execute(CF_AppMain, Basic, NULL); } @@ -44,7 +43,6 @@ void CF_AppMain(void) */ void CF_CheckTables(void) { - UT_GenStub_Execute(CF_CheckTables, Basic, NULL); } @@ -55,7 +53,6 @@ void CF_CheckTables(void) */ void CF_HkCmd(void) { - UT_GenStub_Execute(CF_HkCmd, Basic, NULL); } @@ -122,6 +119,5 @@ int32 CF_ValidateConfigTable(void *tbl_ptr) */ void CF_WakeUp(void) { - UT_GenStub_Execute(CF_WakeUp, Basic, NULL); } diff --git a/unit-test/stubs/cf_cfdp_handlers.c b/unit-test/stubs/cf_cfdp_handlers.c index 7544dca8..611a57c2 100644 --- a/unit-test/stubs/cf_cfdp_handlers.c +++ b/unit-test/stubs/cf_cfdp_handlers.c @@ -48,8 +48,6 @@ #include "cf_test_utils.h" /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_ConstructPduHeader * * Default always returns NULL, an alt handler can be registered for other pointer returns * @@ -64,8 +62,6 @@ void UT_DefaultHandler_CF_CFDP_ConstructPduHeader(void *UserObj, UT_EntryKey_t F } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_TxFile * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -91,8 +87,6 @@ void UT_DefaultHandler_CF_CFDP_TxFile(void *UserObj, UT_EntryKey_t FuncKey, cons } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_TxFile * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -118,8 +112,6 @@ void UT_DefaultHandler_CF_CFDP_PlaybackDir(void *UserObj, UT_EntryKey_t FuncKey, } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_ResetTransaction * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -137,8 +129,6 @@ void UT_DefaultHandler_CF_CFDP_ResetTransaction(void *UserObj, UT_EntryKey_t Fun } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_CancelTransaction * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. diff --git a/unit-test/stubs/cf_cfdp_r_stubs.c b/unit-test/stubs/cf_cfdp_r_stubs.c index 42a1bc2b..8048e021 100644 --- a/unit-test/stubs/cf_cfdp_r_stubs.c +++ b/unit-test/stubs/cf_cfdp_r_stubs.c @@ -173,15 +173,15 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *t) /* * ---------------------------------------------------- - * Generated stub function for CF_CFDP_R2_SetCc() + * Generated stub function for CF_CFDP_R2_SetFinTxnStatus() * ---------------------------------------------------- */ -void CF_CFDP_R2_SetCc(CF_Transaction_t *t, CF_CFDP_ConditionCode_t cc) +void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) { - UT_GenStub_AddParam(CF_CFDP_R2_SetCc, CF_Transaction_t *, t); - UT_GenStub_AddParam(CF_CFDP_R2_SetCc, CF_CFDP_ConditionCode_t, cc); + UT_GenStub_AddParam(CF_CFDP_R2_SetFinTxnStatus, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_SetFinTxnStatus, CF_TxnStatus_t, txn_stat); - UT_GenStub_Execute(CF_CFDP_R2_SetCc, Basic, NULL); + UT_GenStub_Execute(CF_CFDP_R2_SetFinTxnStatus, Basic, NULL); } /* diff --git a/unit-test/stubs/cf_cfdp_sbintf_handlers.c b/unit-test/stubs/cf_cfdp_sbintf_handlers.c index 66388237..14222b10 100644 --- a/unit-test/stubs/cf_cfdp_sbintf_handlers.c +++ b/unit-test/stubs/cf_cfdp_sbintf_handlers.c @@ -48,8 +48,6 @@ #include "cf_test_utils.h" /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_MsgOutGet * * Default always returns NULL, an alt handler can be registered for other pointer returns * diff --git a/unit-test/stubs/cf_cfdp_stubs.c b/unit-test/stubs/cf_cfdp_stubs.c index 5cf66cc8..8258acf0 100644 --- a/unit-test/stubs/cf_cfdp_stubs.c +++ b/unit-test/stubs/cf_cfdp_stubs.c @@ -135,7 +135,6 @@ int CF_CFDP_CopyStringFromLV(char *buf, size_t buf_maxsz, const CF_Logical_Lv_t */ void CF_CFDP_CycleEngine(void) { - UT_GenStub_Execute(CF_CFDP_CycleEngine, Basic, NULL); } @@ -192,7 +191,6 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical */ void CF_CFDP_DisableEngine(void) { - UT_GenStub_Execute(CF_CFDP_DisableEngine, Basic, NULL); } @@ -517,6 +515,18 @@ CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t) return UT_GenStub_GetReturnValue(CF_CFDP_SendEof, CF_SendRet_t); } +/* + * ---------------------------------------------------- + * Generated stub function for CF_CFDP_SendEotPkt() + * ---------------------------------------------------- + */ +void CF_CFDP_SendEotPkt(CF_Transaction_t *t) +{ + UT_GenStub_AddParam(CF_CFDP_SendEotPkt, CF_Transaction_t *, t); + + UT_GenStub_Execute(CF_CFDP_SendEotPkt, Basic, NULL); +} + /* * ---------------------------------------------------- * Generated stub function for CF_CFDP_SendFd() @@ -587,6 +597,19 @@ CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) return UT_GenStub_GetReturnValue(CF_CFDP_SendNak, CF_SendRet_t); } +/* + * ---------------------------------------------------- + * Generated stub function for CF_CFDP_SetTxnStatus() + * ---------------------------------------------------- + */ +void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) +{ + UT_GenStub_AddParam(CF_CFDP_SetTxnStatus, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SetTxnStatus, CF_TxnStatus_t, txn_stat); + + UT_GenStub_Execute(CF_CFDP_SetTxnStatus, Basic, NULL); +} + /* * ---------------------------------------------------- * Generated stub function for CF_CFDP_TickTransactions() diff --git a/unit-test/stubs/cf_chunk_handlers.c b/unit-test/stubs/cf_chunk_handlers.c index f4796bd1..e34e090b 100644 --- a/unit-test/stubs/cf_chunk_handlers.c +++ b/unit-test/stubs/cf_chunk_handlers.c @@ -41,8 +41,6 @@ #include "cf_test_utils.h" /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_ChunkList_GetFirstChunk * * Default always returns NULL, an alt handler can be registered for other pointer returns * diff --git a/unit-test/stubs/cf_clist_handlers.c b/unit-test/stubs/cf_clist_handlers.c index cd4a61f6..9a55ab49 100644 --- a/unit-test/stubs/cf_clist_handlers.c +++ b/unit-test/stubs/cf_clist_handlers.c @@ -40,8 +40,6 @@ #include "cf_cfdp.h" /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CList_InitNode * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -58,8 +56,6 @@ void UT_DefaultHandler_CF_CList_InitNode(void *UserObj, UT_EntryKey_t FuncKey, c } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CList_InsertBack * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -77,8 +73,6 @@ void UT_DefaultHandler_CF_CList_InsertBack(void *UserObj, UT_EntryKey_t FuncKey, } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CList_CF_CList_Pop * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -96,8 +90,6 @@ void UT_DefaultHandler_CF_CList_CF_CList_Pop(void *UserObj, UT_EntryKey_t FuncKe } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CList_Remove * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -115,8 +107,6 @@ void UT_DefaultHandler_CF_CList_Remove(void *UserObj, UT_EntryKey_t FuncKey, con } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CList_InsertAfter * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -135,8 +125,6 @@ void UT_DefaultHandler_CF_CList_InsertAfter(void *UserObj, UT_EntryKey_t FuncKey } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CList_Traverse * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -152,8 +140,6 @@ void UT_DefaultHandler_CF_CList_Traverse(void *UserObj, UT_EntryKey_t FuncKey, c } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CList_Traverse_R * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. diff --git a/unit-test/stubs/cf_cmd_handlers.c b/unit-test/stubs/cf_cmd_handlers.c index 3c948898..e8cacef4 100644 --- a/unit-test/stubs/cf_cmd_handlers.c +++ b/unit-test/stubs/cf_cmd_handlers.c @@ -35,8 +35,6 @@ #include "utstubs.h" /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_ProcessGroundCommand * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. diff --git a/unit-test/stubs/cf_cmd_stubs.c b/unit-test/stubs/cf_cmd_stubs.c index 943b31df..e3c56acd 100644 --- a/unit-test/stubs/cf_cmd_stubs.c +++ b/unit-test/stubs/cf_cmd_stubs.c @@ -249,18 +249,6 @@ void CF_CmdResume(CFE_SB_Buffer_t *msg) UT_GenStub_Execute(CF_CmdResume, Basic, NULL); } -/* - * ---------------------------------------------------- - * Generated stub function for CF_CmdSendCfgParams() - * ---------------------------------------------------- - */ -void CF_CmdSendCfgParams(CFE_SB_Buffer_t *msg) -{ - UT_GenStub_AddParam(CF_CmdSendCfgParams, CFE_SB_Buffer_t *, msg); - - UT_GenStub_Execute(CF_CmdSendCfgParams, Basic, NULL); -} - /* * ---------------------------------------------------- * Generated stub function for CF_CmdSetParam() diff --git a/unit-test/stubs/cf_codec_handlers.c b/unit-test/stubs/cf_codec_handlers.c index 87be969b..5ef0d421 100644 --- a/unit-test/stubs/cf_codec_handlers.c +++ b/unit-test/stubs/cf_codec_handlers.c @@ -30,8 +30,6 @@ #include "utstubs.h" /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_CodecCheckSize * * Translates return value into the correct size for returning * @@ -54,8 +52,6 @@ void UT_DefaultHandler_CF_CFDP_CodecCheckSize(void *UserObj, UT_EntryKey_t FuncK } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_DoEncodeChunk * * Default always returns NULL, an alt handler can be registered for other pointer returns * @@ -71,8 +67,6 @@ void UT_DefaultHandler_CF_CFDP_DoEncodeChunk(void *UserObj, UT_EntryKey_t FuncKe } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_DoDecodeChunk * * Default always returns NULL, an alt handler can be registered for other pointer returns * @@ -88,8 +82,6 @@ void UT_DefaultHandler_CF_CFDP_DoDecodeChunk(void *UserObj, UT_EntryKey_t FuncKe } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_CFDP_GetValueEncodedSize * * Translates return value into the correct size for returning * @@ -115,8 +107,6 @@ void UT_DefaultHandler_CF_CFDP_GetValueEncodedSize(void *UserObj, UT_EntryKey_t } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_DecodeIntegerInSize * * Translates return value into the correct size for returning * diff --git a/unit-test/stubs/cf_codec_stubs.c b/unit-test/stubs/cf_codec_stubs.c index eae74d28..bab28f07 100644 --- a/unit-test/stubs/cf_codec_stubs.c +++ b/unit-test/stubs/cf_codec_stubs.c @@ -95,10 +95,10 @@ void CF_CFDP_DecodeAllTlv(CF_DecoderState_t *state, CF_Logical_TlvList_t *pltlv, * Generated stub function for CF_CFDP_DecodeCrc() * ---------------------------------------------------- */ -void CF_CFDP_DecodeCrc(CF_DecoderState_t *state, uint32 *pcrc) +void CF_CFDP_DecodeCrc(CF_DecoderState_t *state, uint32 *plcrc) { UT_GenStub_AddParam(CF_CFDP_DecodeCrc, CF_DecoderState_t *, state); - UT_GenStub_AddParam(CF_CFDP_DecodeCrc, uint32 *, pcrc); + UT_GenStub_AddParam(CF_CFDP_DecodeCrc, uint32 *, plcrc); UT_GenStub_Execute(CF_CFDP_DecodeCrc, Basic, NULL); } @@ -164,6 +164,7 @@ void CF_CFDP_DecodeFin(CF_DecoderState_t *state, CF_Logical_PduFin_t *plfin) int32 CF_CFDP_DecodeHeader(CF_DecoderState_t *state, CF_Logical_PduHeader_t *plh) { UT_GenStub_SetupReturnBuffer(CF_CFDP_DecodeHeader, int32); + UT_GenStub_AddParam(CF_CFDP_DecodeHeader, CF_DecoderState_t *, state); UT_GenStub_AddParam(CF_CFDP_DecodeHeader, CF_Logical_PduHeader_t *, plh); diff --git a/unit-test/stubs/cf_utils_handlers.c b/unit-test/stubs/cf_utils_handlers.c index f4f2bc53..05af6e10 100644 --- a/unit-test/stubs/cf_utils_handlers.c +++ b/unit-test/stubs/cf_utils_handlers.c @@ -41,8 +41,6 @@ #include "cf_test_utils.h" /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_ResetHistory * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -60,8 +58,6 @@ void UT_DefaultHandler_CF_ResetHistory(void *UserObj, UT_EntryKey_t FuncKey, con } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_FindTransactionBySequenceNumber * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -92,8 +88,6 @@ void UT_DefaultHandler_CF_FindTransactionBySequenceNumber(void *UserObj, UT_Entr } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_FindUnusedTransaction * * Default always returns NULL, an alt handler can be registered for other pointer returns * @@ -108,8 +102,6 @@ void UT_DefaultHandler_CF_FindUnusedTransaction(void *UserObj, UT_EntryKey_t Fun } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_WriteTxnQueueDataToFile * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -128,8 +120,6 @@ void UT_DefaultHandler_CF_WriteTxnQueueDataToFile(void *UserObj, UT_EntryKey_t F } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_WriteHistoryQueueDataToFile * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -150,8 +140,6 @@ void UT_DefaultHandler_CF_WriteHistoryQueueDataToFile(void *UserObj, UT_EntryKey } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_TraverseAllTransactions * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -170,8 +158,6 @@ void UT_DefaultHandler_CF_TraverseAllTransactions(void *UserObj, UT_EntryKey_t F } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_TraverseAllTransactions_All_Channels * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -193,8 +179,6 @@ void UT_DefaultHandler_CF_TraverseAllTransactions_All_Channels(void *UserObj, UT } /*---------------------------------------------------------------- - * - * Function: UT_DefaultHandler_CF_WrappedOpenCreate * * For compatibility with other tests, this has a mechanism to save its * arguments to a test-provided context capture buffer. @@ -214,3 +198,19 @@ void UT_DefaultHandler_CF_WrappedOpenCreate(void *UserObj, UT_EntryKey_t FuncKey UT_Stub_SetReturnValue(FuncKey, ctxt->forced_return); } } + +/*---------------------------------------------------------------- + * + * Function: UT_DefaultHandler_CF_TxnStatus_IsError + * + * Translate the return value to a "bool" + * + *-----------------------------------------------------------------*/ +void UT_DefaultHandler_CF_TxnStatus_IsError(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + bool result; + + result = (bool)Context->Int32StatusCode; + + UT_Stub_SetReturnValue(FuncKey, result); +} \ No newline at end of file diff --git a/unit-test/stubs/cf_utils_stubs.c b/unit-test/stubs/cf_utils_stubs.c index 82c8e9ec..451163f1 100644 --- a/unit-test/stubs/cf_utils_stubs.c +++ b/unit-test/stubs/cf_utils_stubs.c @@ -31,6 +31,7 @@ void UT_DefaultHandler_CF_FindUnusedTransaction(void *, UT_EntryKey_t, const UT_ void UT_DefaultHandler_CF_ResetHistory(void *, UT_EntryKey_t, const UT_StubContext_t *); void UT_DefaultHandler_CF_TraverseAllTransactions(void *, UT_EntryKey_t, const UT_StubContext_t *); void UT_DefaultHandler_CF_TraverseAllTransactions_All_Channels(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CF_TxnStatus_IsError(void *, UT_EntryKey_t, const UT_StubContext_t *); void UT_DefaultHandler_CF_WrappedOpenCreate(void *, UT_EntryKey_t, const UT_StubContext_t *); void UT_DefaultHandler_CF_WriteHistoryQueueDataToFile(void *, UT_EntryKey_t, const UT_StubContext_t *); void UT_DefaultHandler_CF_WriteTxnQueueDataToFile(void *, UT_EntryKey_t, const UT_StubContext_t *); @@ -229,6 +230,54 @@ int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) return UT_GenStub_GetReturnValue(CF_Traverse_WriteTxnQueueEntryToFile, int); } +/* + * ---------------------------------------------------- + * Generated stub function for CF_TxnStatus_From_ConditionCode() + * ---------------------------------------------------- + */ +CF_TxnStatus_t CF_TxnStatus_From_ConditionCode(CF_CFDP_ConditionCode_t cc) +{ + UT_GenStub_SetupReturnBuffer(CF_TxnStatus_From_ConditionCode, CF_TxnStatus_t); + + UT_GenStub_AddParam(CF_TxnStatus_From_ConditionCode, CF_CFDP_ConditionCode_t, cc); + + UT_GenStub_Execute(CF_TxnStatus_From_ConditionCode, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_TxnStatus_From_ConditionCode, CF_TxnStatus_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_TxnStatus_IsError() + * ---------------------------------------------------- + */ +bool CF_TxnStatus_IsError(CF_TxnStatus_t txn_stat) +{ + UT_GenStub_SetupReturnBuffer(CF_TxnStatus_IsError, bool); + + UT_GenStub_AddParam(CF_TxnStatus_IsError, CF_TxnStatus_t, txn_stat); + + UT_GenStub_Execute(CF_TxnStatus_IsError, Basic, UT_DefaultHandler_CF_TxnStatus_IsError); + + return UT_GenStub_GetReturnValue(CF_TxnStatus_IsError, bool); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_TxnStatus_To_ConditionCode() + * ---------------------------------------------------- + */ +CF_CFDP_ConditionCode_t CF_TxnStatus_To_ConditionCode(CF_TxnStatus_t txn_stat) +{ + UT_GenStub_SetupReturnBuffer(CF_TxnStatus_To_ConditionCode, CF_CFDP_ConditionCode_t); + + UT_GenStub_AddParam(CF_TxnStatus_To_ConditionCode, CF_TxnStatus_t, txn_stat); + + UT_GenStub_Execute(CF_TxnStatus_To_ConditionCode, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_TxnStatus_To_ConditionCode, CF_CFDP_ConditionCode_t); +} + /* * ---------------------------------------------------- * Generated stub function for CF_WrappedClose() diff --git a/unit-test/utilities/cf_test_alt_handler.c b/unit-test/utilities/cf_test_alt_handler.c index 0448b9c9..2fb794cd 100644 --- a/unit-test/utilities/cf_test_alt_handler.c +++ b/unit-test/utilities/cf_test_alt_handler.c @@ -31,8 +31,6 @@ #include "cf_utils.h" /*---------------------------------------------------------------- - * - * Function: UT_AltHandler_CF_CList_Traverse_TRAVERSE_ALL_ARGS_T * * A handler for CF_CList_Traverse which saves its arguments * including the opaque context pointer as a CF_TraverseAll_Arg_t object. @@ -73,8 +71,6 @@ void UT_AltHandler_CF_CList_Traverse_TRAVERSE_ALL_ARGS_T(void *UserObj, UT_Entry } /*---------------------------------------------------------------- - * - * Function: UT_AltHandler_CF_CList_Traverse_POINTER * * A handler for CF_CList_Traverse which saves its arguments * to a CF_CList_Traverse_POINTER_context_t object. @@ -102,8 +98,6 @@ void UT_AltHandler_CF_CList_Traverse_POINTER(void *UserObj, UT_EntryKey_t FuncKe } /*---------------------------------------------------------------- - * - * Function: UT_AltHandler_CF_CList_Traverse_R_PRIO * * A handler for CF_CList_Traverse which saves its arguments * including the opaque context pointer as a CF_Traverse_PriorityArg_t object. @@ -137,8 +131,6 @@ void UT_AltHandler_CF_CList_Traverse_R_PRIO(void *UserObj, UT_EntryKey_t FuncKey } /*---------------------------------------------------------------- - * - * Function: UT_AltHandler_CF_TraverseAllTransactions_All_Channels_Set_Context * * A handler for CF_TraverseAllTransactions which _sets_ the opaque context * pointer as a int* object. The value is taken from the UserObj opaque pointer. @@ -158,8 +150,6 @@ void UT_AltHandler_CF_TraverseAllTransactions_All_Channels_Set_Context(void *Use } /*---------------------------------------------------------------- - * - * Function: UT_AltHandler_GenericPointerReturn * * A simple handler that can be used for any stub that returns a pointer. * it just forces the return value to be the object passed in as UserObj. @@ -169,3 +159,19 @@ void UT_AltHandler_GenericPointerReturn(void *UserObj, UT_EntryKey_t FuncKey, co { UT_Stub_SetReturnValue(FuncKey, UserObj); } + +/*---------------------------------------------------------------- + * + * Function: UT_AltHandler_CaptureTransactionStatus + * + * A handler for CF_CFDP_SetTxnStatus() and similar that captures the CF_TxnStatus_t + * value to the supplied storage location. + * + *-----------------------------------------------------------------*/ +void UT_AltHandler_CaptureTransactionStatus(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + CF_TxnStatus_t *p_txn_stat = UserObj; + CF_TxnStatus_t in_stat = UT_Hook_GetArgValueByName(Context, "txn_stat", CF_TxnStatus_t); + + *p_txn_stat = in_stat; +} diff --git a/unit-test/utilities/cf_test_alt_handler.h b/unit-test/utilities/cf_test_alt_handler.h index b98e6ac0..1cd7781c 100644 --- a/unit-test/utilities/cf_test_alt_handler.h +++ b/unit-test/utilities/cf_test_alt_handler.h @@ -39,4 +39,6 @@ void UT_AltHandler_CF_TraverseAllTransactions_All_Channels_Set_Context(void *Use void UT_AltHandler_GenericPointerReturn(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); +void UT_AltHandler_CaptureTransactionStatus(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); + #endif /* CF_TEST_ALT_HANDLER_H */ diff --git a/unit-test/utilities/cf_test_utils.c b/unit-test/utilities/cf_test_utils.c index 86bc25e5..207d1630 100644 --- a/unit-test/utilities/cf_test_utils.c +++ b/unit-test/utilities/cf_test_utils.c @@ -167,9 +167,11 @@ unsigned int Any_unsigned_int(void) return random_val; } -// AnyBufferOf_uint8_WithSize works, but name/design could use overhaul -// should it return a pointer? or should it be named different because it alters -// the buffer given? +/* + * AnyBufferOf_uint8_WithSize works, but name/design could use overhaul + * should it return a pointer? or should it be named different because it alters + * the buffer given? + */ void AnyBufferOf_uint8_WithSize(uint8 *buffer, size_t size) { int i; @@ -222,7 +224,6 @@ uint8 Any_uint8_ExceptUnsetBits(uint8 bits) while ((random_value | bits) == bits) { - if (num_tries == max_tries) { UtPrintf("Any_uint8_ExceptUnsetBits unable to get valid number in %u checks\n", num_tries); @@ -260,7 +261,7 @@ uint8 Any_uint8_BetweenExcludeMax(uint8 floor, uint8 ceiling) uint8 Any_uint8_BetweenInclusive(uint8 floor, uint8 ceiling) { uint8 random_val; - uint8 diff = ceiling - floor + 1; // +1 for inclusive + uint8 diff = ceiling - floor + 1; /* +1 for inclusive */ random_val = (rand() % diff) + floor; diff --git a/unit-test/utilities/cf_test_utils.h b/unit-test/utilities/cf_test_utils.h index 0db2a631..606afc9b 100644 --- a/unit-test/utilities/cf_test_utils.h +++ b/unit-test/utilities/cf_test_utils.h @@ -52,7 +52,6 @@ typedef enum UT_CF_Setup_NONE, UT_CF_Setup_TX, UT_CF_Setup_RX - } UT_CF_Setup_t; /*******************************************************************************