Skip to content

Commit

Permalink
Merge pull request #371 from thnkslprpt/fix-139-remove-use-of-message…
Browse files Browse the repository at this point in the history
…-storage-in-cf-global

Fix #139, Remove use of message storage in CF_AppData global
  • Loading branch information
dzbaker committed Apr 6, 2023
2 parents 0b0c643 + bb4ad62 commit b0269ef
Show file tree
Hide file tree
Showing 30 changed files with 203 additions and 209 deletions.
42 changes: 21 additions & 21 deletions docs/dox_src/cfs_cf.dox
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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
The document is intended primarily for users of the software (operations personnel, 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.
Expand Down Expand Up @@ -110,7 +110,7 @@

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.
time and space-efficient 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.
Expand All @@ -130,7 +130,7 @@
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
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
Expand All @@ -145,9 +145,9 @@
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
For simplicity, the examples throughout 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
ground. The CF application 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
Expand All @@ -164,7 +164,7 @@
<H2> Initialization </H2>

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

Expand All @@ -174,7 +174,7 @@

-# Send any pending message required for RX transaction
-# Re-send any message required for TX transaction if timer expired (for example,
send EOF, or re-send EOF if ack timer expired)
send EOF, or re-send EOF if ACK timer expired)
-# Send a filedata PDU in response to a NAK request. Per wakeup, one will be sent
per each transaction in the TX wait state.
-# Once all TX wait transactions have processed their needs to send, the currently
Expand All @@ -196,7 +196,7 @@
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
fails then attempts a copy/delete (slower). Due to this the most efficent
fails then attempts a copy/delete (slower). Due to this the most efficient
temporary directory configuration is for it to be on the same file system as the
destination. Note that currently this only impacts class 2 RX with an out
of order metadata packet, but there's future work being considered to
Expand All @@ -208,7 +208,7 @@

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
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
Expand Down Expand Up @@ -331,7 +331,7 @@
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
disabled at any time. 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
Expand Down Expand Up @@ -443,7 +443,7 @@
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
The history queue has a sliding window effect. 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.

Expand All @@ -452,7 +452,7 @@
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
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.

Expand Down Expand Up @@ -622,7 +622,7 @@ 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.
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,
Expand Down Expand Up @@ -823,7 +823,7 @@ CF_UnionArgs_Payload_t;
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.
effect until the transaction is resumed.

\verbatim
typedef struct CF_TransactionCmd
Expand Down Expand Up @@ -894,7 +894,7 @@ CF_UnionArgs_Payload_t;
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
is suspended, the cancel does not take effect until the transaction is
resumed.


Expand Down Expand Up @@ -1095,7 +1095,7 @@ CF_UnionArgs_Payload_t;
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
files that are waiting to be sent out by CF. This command has no effect on
incoming file transactions.

When the command is executed successfully, the command counter is incremented
Expand Down Expand Up @@ -1137,7 +1137,7 @@ CF_UnionArgs_Payload_t;


When the command is executed successfully, the command counter is incremented
and the an event message will be generated.
and then 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.
Expand Down Expand Up @@ -1227,7 +1227,7 @@ CF_UnionArgs_Payload_t;
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.
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.
Expand Down Expand Up @@ -1322,7 +1322,7 @@ CF_UnionArgs_Payload_t;
#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.
and when the engine is re-enabled the new configuration will take effect.

Prev: \ref cfscfcfgpg <BR>
Next: \ref cfscftlmpg
Expand Down Expand Up @@ -1390,7 +1390,7 @@ CF_UnionArgs_Payload_t;
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
CF utilizes 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.

Expand All @@ -1414,7 +1414,7 @@ CF_UnionArgs_Payload_t;

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
to be set higher than 16384. The stack size is specified in the 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
Expand Down
6 changes: 3 additions & 3 deletions fsw/inc/cf_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
*
* \par Cause:
*
* Condition that triggers a ACK occurred that would meet or exceed the ACK limit
* Condition that triggers an ACK occurred that would meet or exceed the ACK limit
*/
#define CF_EID_ERR_CFDP_R_ACK_LIMIT (73)

Expand Down Expand Up @@ -798,7 +798,7 @@
*
* \par Cause:
*
* Bad segment request values in recived NAK PDU relating
* Bad segment request values in received NAK PDU relating
* to a current transaction
*/
#define CF_EID_ERR_CFDP_S_INVALID_SR (100)
Expand All @@ -810,7 +810,7 @@
*
* \par Cause:
*
* Failure processing recived NAK PDU relating
* Failure processing received NAK PDU relating
* to a current transaction
*/
#define CF_EID_ERR_CFDP_S_PDU_NAK (101)
Expand Down
2 changes: 1 addition & 1 deletion fsw/inc/cf_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ typedef enum
* \par Description
* 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.
* re-enabled the new configuration will take effect.
*
* \par Command Structure
* #CF_NoArgsCmd_t
Expand Down
18 changes: 9 additions & 9 deletions fsw/inc/cf_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ typedef uint32 CF_TransactionSeq_t;
#define CF_NUM_CHANNELS (2)

/**
* @brief Max NAK segments supported in a NAK pdu
* @brief Max NAK segments supported in a NAK PDU
*
* @par Description:
* When a NAK pdu is sent or received, this is the max number of
* When a NAK PDU is sent or received, this is the max number of
* segment requests supported. This number should match the ground
* cfdp engine configuration as well.
* CFDP engine configuration as well.
*
* @par Limits:
*
Expand All @@ -123,14 +123,14 @@ typedef uint32 CF_TransactionSeq_t;
* Number of chunks per transaction per channel (RX).
*
* CHUNKS -
* A chunk is a representation of a range range (offset, size) of data received by a receiver.
* A chunk is a representation of a range (offset, size) of data received by a receiver.
*
* Class 2 CFDP deals with NAK, so received data must be tracked for receivers in order to generate
* the NAK. The sender must also keep track of NAK requests and send new file data PDUs as a result.
* (array size must be CF_NUM_CHANNELS)
* CF_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION is an array for each channel indicating the number of chunks per transaction
* CF_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION is an array for each channel indicate the number of chunks to keep track of
* NAK requests from the receiver per transaction
* CF_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION is an array for each channel indicating the number of chunks to keep track
* of NAK requests from the receiver per transaction
*
* @par Limits:
*
Expand Down Expand Up @@ -244,7 +244,7 @@ typedef uint32 CF_TransactionSeq_t;
*
* @par Description:
* The max PDU size across all channels in the system. Keep in mind that
* the max filedata pdu will be smaller than this. This size includes
* the max filedata PDU will be smaller than this. This size includes
* the PDU headers and everything. While this is the max value for all
* channels, the outgoing_file_chunk_size in the configuration table
* is different for each channel so a smaller size can be used.
Expand Down Expand Up @@ -304,10 +304,10 @@ typedef uint32 CF_TransactionSeq_t;
#define CF_FILENAME_MAX_LEN (CF_FILENAME_MAX_NAME + CF_FILENAME_MAX_PATH)

/**
* @brief R2 crc calc chunk size
* @brief R2 CRC calc chunk size
*
* @par Description
* R2 performs crc calculation upon file completion in chunks. This is the size
* R2 performs CRC calculation upon file completion in chunks. This is the size
* of the buffer. The larger the size the more stack will be used, but
* the faster it can go. The overall number of bytes calculated per wakeup
* is set in the configuration table.
Expand Down
8 changes: 4 additions & 4 deletions fsw/inc/cf_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ typedef struct CF_ChannelConfig
uint32 nak_timer_s; /**< \brief Non-acknowledge timer in seconds */
uint32 inactivity_timer_s; /**< \brief Inactivity timer in seconds */

uint8 ack_limit; /**< number of times to retry ACK (for ex, send fin and wait for fin-ack) */
uint8 ack_limit; /**< number of times to retry ACK (for ex, send FIN and wait for fin-ack) */
uint8 nak_limit; /**< number of times to retry NAK before giving up (resets on a single response */

CFE_SB_MsgId_Atom_t mid_input; /**< \brief msgid integer value for incoming messages */
CFE_SB_MsgId_Atom_t mid_output; /**< \brief msgid integer value for outgoing messages */

uint16 pipe_depth_input; /**< \brief depth of pipe to receive incoming pdu */
uint16 pipe_depth_input; /**< \brief depth of pipe to receive incoming PDU */

CF_PollDir_t polldir[CF_MAX_POLLING_DIR_PER_CHAN]; /**< \brief Configuration for polled directories */

Expand All @@ -81,9 +81,9 @@ typedef struct CF_ChannelConfig
*/
typedef struct CF_ConfigTable
{
uint32 ticks_per_second; /**< \brief expected ticks per second to cfdp app */
uint32 ticks_per_second; /**< \brief expected ticks per second to CFDP app */
uint32 rx_crc_calc_bytes_per_wakeup; /**< \brief max number of bytes per wakeup to calculate
* r2 crc for recvd file (must be 1024-byte aligned)
* r2 CRC for recvd file (must be 1024-byte aligned)
*/

CF_EntityId_t local_eid; /**< \brief the local entity ID of the CF app */
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cf_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ CFE_Status_t CF_ValidateConfigTable(void *tbl_ptr)
else if (!tbl->rx_crc_calc_bytes_per_wakeup || (tbl->rx_crc_calc_bytes_per_wakeup & 0x3ff))
{
CFE_EVS_SendEvent(CF_EID_ERR_INIT_CRC_ALIGN, CFE_EVS_EventType_ERROR,
"CF: config table has rx crc size not aligned with 1024");
"CF: config table has rx CRC size not aligned with 1024");
ret = crc_alignment; /* must be 1024-byte aligned */
}
else if (tbl->outgoing_file_chunk_size > sizeof(CF_CFDP_PduFileDataContent_t))
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cf_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ CFE_Status_t CF_TableInit(void);
*
* @par Description
* Initializes all aspects of the CF application. Messages,
* pipes, events, table, and the cfdp engine.
* pipes, events, table, and the CFDP engine.
*
* @par Assumptions, External Events, and Notes:
* This must only be called once.
Expand Down
Loading

0 comments on commit b0269ef

Please sign in to comment.