Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cFS-Caelum Review, CFS-43: Table Services & Time Services #1420

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Ignore everything
*

# ...even if they are in subdirectories
!*/

# But not these files...
!/.gitignore
!/README.md



# Table (TBL)
!modules/core_api/fsw/inc/cfe_tbl*

!modules/tbl/fsw/**
!modules/tbl/CMakeLists.txt

# Time Services (TIME)
!modules/core_private/fsw/inc/cfe_time*
!modules/core_api/fsw/inc/cfe_time*

!modules/time/fsw/**
!modules/time/CMakeLists.txt

25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# cFE
## cFS-Caelum Review: CFS-43

This branch is meant for the cFS-Caelum code review of Time Services and Table Services. The review designation is "CFS-43"


The corresponding, fully-working cFE instance matching the code in this branch can be found under the [cFE v7.0.0-rc1 tag](https://github.com/nasa/cFE/releases/tag/v7.0.0-rc1)

### How to add your review comments

Navigate to the ["files changed" tab](https://github.com/nasa/cFE/pull/1420/files) in the [nasa/cFE#1375](https://github.com/nasa/cFE/pull/1420) pull request.


<img width="820" alt="github-review-instructions-1of2" src="https://user-images.githubusercontent.com/59618057/113956688-dca76a00-97eb-11eb-99d4-9ec84b459dce.png">


You can add comments on any line of code by hovering on the line number and clicking on the plus "+" sign. Once you're finished with the comment click on the green "Start Review" button. To add more comments, just click on the relevant line number in any file, type your comment, and click on "Add review comment".


<img width="1229" alt="github-review-instructions-2of2" src="https://user-images.githubusercontent.com/59618057/113956482-8508fe80-97eb-11eb-8197-618d4e25fa51.png">

If you need to take a break, or if you're done, click the green "Finish Review" button on the top right corner of the
page, add any overall or summarizing comments and click on "Submit Review". You can always return and add new comments using the same process.

**Thank you!**
742 changes: 742 additions & 0 deletions modules/core_api/fsw/inc/cfe_tbl.h

Large diffs are not rendered by default.

126 changes: 126 additions & 0 deletions modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-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
*
* Title: Table Services API Application Library Header File
*
* Purpose:
* Unit specification for Table services library functions and macros.
*
* Design Notes:
*
* References:
* Flight Software Branch C Coding Standard Version 1.0a
*
* Notes:
*
*/

#ifndef CFE_TBL_API_TYPEDEFS_H
#define CFE_TBL_API_TYPEDEFS_H

/********************* Include Files ************************/
#include "common_types.h" /* Basic Data Types */
#include "cfe_tbl_extern_typedefs.h"
#include "cfe_time_extern_typedefs.h"

/** @defgroup CFETBLTypeOptions cFE Table Type Defines
* @{
*/
#define CFE_TBL_OPT_BUFFER_MSK (0x0001) /**< \brief Table buffer mask */
#define CFE_TBL_OPT_SNGL_BUFFER (0x0000) /**< \brief Single buffer table */
#define CFE_TBL_OPT_DBL_BUFFER (0x0001) /**< \brief Double buffer table */

#define CFE_TBL_OPT_LD_DMP_MSK (0x0002) /**< \brief Table load/dump mask */
#define CFE_TBL_OPT_LOAD_DUMP (0x0000) /**< \brief Load/Dump table */
#define CFE_TBL_OPT_DUMP_ONLY (0x0002) /**< \brief Dump only table */

#define CFE_TBL_OPT_USR_DEF_MSK (0x0004) /**< \brief Table user defined mask */
#define CFE_TBL_OPT_NOT_USR_DEF (0x0000) /**< \brief Not user defined table */
#define CFE_TBL_OPT_USR_DEF_ADDR \
(0x0006) /**< \brief User Defined table, @note Automatically includes #CFE_TBL_OPT_DUMP_ONLY option */

#define CFE_TBL_OPT_CRITICAL_MSK (0x0008) /**< \brief Table critical mask */
#define CFE_TBL_OPT_NOT_CRITICAL (0x0000) /**< \brief Not critical table */
#define CFE_TBL_OPT_CRITICAL (0x0008) /**< \brief Critical table */

/** @brief Default table options */
#define CFE_TBL_OPT_DEFAULT (CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP)
/**@}*/

/**
* \brief Table maximum full name length
*
* The full length of table names is defined at the mission scope.
* This is defined here to support applications that depend on cfe_tbl.h
* providing this value.
*/
#define CFE_TBL_MAX_FULL_NAME_LEN (CFE_MISSION_TBL_MAX_FULL_NAME_LEN)

/** \brief Bad table handle */
#define CFE_TBL_BAD_TABLE_HANDLE (CFE_TBL_Handle_t)0xFFFF

/****************** Data Type Definitions *********************/

/** \brief Table Callback Function */
typedef int32 (*CFE_TBL_CallbackFuncPtr_t)(void *TblPtr);

/** \brief Table Handle primitive */
typedef int16 CFE_TBL_Handle_t;

/** \brief Table Source */
typedef enum CFE_TBL_SrcEnum
{
CFE_TBL_SRC_FILE = 0, /**< \brief File source
When this option is selected, the \c SrcDataPtr
will be interpreted as a pointer to a null
terminated character string. The string should
specify the full path and filename of the file
containing the initial data contents of the table. */
CFE_TBL_SRC_ADDRESS /**< \brief Address source
When this option is selected, the \c SrcDataPtr will
be interpreted as a pointer to a memory location
that is the beginning of the initialization data
for loading the table OR, in the case of a "user defined"
dump only table, the address of the active table itself.
The block of memory is assumed to be of the same size
specified in the #CFE_TBL_Register function Size parameter. */
} CFE_TBL_SrcEnum_t;

/** \brief Table Info */
typedef struct CFE_TBL_Info
{
size_t Size; /**< \brief Size, in bytes, of Table */
uint32 NumUsers; /**< \brief Number of Apps with access to the table */
uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */
uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */
uint32 Crc; /**< \brief Most recently calculated CRC by TBL services on table contents */
CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */
bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */
bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */
bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */
bool UserDefAddr; /**< \brief Flag indicating Table address was defined by Owner Application */
bool Critical; /**< \brief Flag indicating Table contents are maintained in a CDS */
char LastFileLoaded[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */
} CFE_TBL_Info_t;

#endif /* CFE_TBL_API_TYPEDEFS_H */
100 changes: 100 additions & 0 deletions modules/core_api/fsw/inc/cfe_tbl_core_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-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
*
* Title: Table Services API Application Library Header File
*
* Purpose:
* Unit specification for Table services library functions and macros.
*
* Design Notes:
*
* References:
* Flight Software Branch C Coding Standard Version 1.0a
*
* Notes:
*
*/

#ifndef CFE_TBL_CORE_INTERNAL_H
#define CFE_TBL_CORE_INTERNAL_H

#include "common_types.h"
#include "cfe_es_extern_typedefs.h"

/*
* The internal APIs prototyped within this block are only intended to be invoked from
* other CFE core apps. They still need to be prototyped in the shared header such that
* they can be called from other core modules, but applications should not call these.
*/

/** @defgroup CFEAPITBLCoreInternal cFE Internal Table Service APIs, internal to CFE core
* @{
*/

/*****************************************************************************/
/**
** \brief Entry Point for cFE Table Services Core Application
**
** \par Description
** This is the entry point to the cFE Table Services Core Application.
** This Application provides the ground interface to the cFE Table
** Services.
**
** \par Assumptions, External Events, and Notes:
** None
**
******************************************************************************/
extern void CFE_TBL_TaskMain(void);

/*****************************************************************************/
/**
** \brief Initializes the Table Services API Library
**
** \par Description
** Initializes the Table Services API Library
**
** \par Assumptions, External Events, and Notes:
** -# This function MUST be called before any TBL API's are called.
**
******************************************************************************/
extern int32 CFE_TBL_EarlyInit(void);

/*****************************************************************************/
/**
** \brief Removes TBL resources associated with specified Application
**
** \par Description
** This function is called by cFE Executive Services to cleanup after
** an Application has been terminated. It frees TBL services resources
** that have been allocated to the specified Application.
**
** \par Assumptions, External Events, and Notes:
** -# This function DOES NOT remove any critical tables associated with
** the specified application from the Critical Data Store.
**
******************************************************************************/
extern int32 CFE_TBL_CleanUpApp(CFE_ES_AppId_t AppId);

/**@}*/

#endif /* CFE_TBL_CORE_INTERNAL_H */
83 changes: 83 additions & 0 deletions modules/core_api/fsw/inc/cfe_tbl_extern_typedefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-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 cfe_tbl_extern_typedefs module
*/

#ifndef CFE_TBL_EXTERN_TYPEDEFS_H
#define CFE_TBL_EXTERN_TYPEDEFS_H

/* This header may be generated from an EDS file,
* tools are available and the feature is enabled */
#ifdef CFE_EDS_ENABLED_BUILD

/* Use the EDS generated version of these types */
#include "cfe_tbl_eds_typedefs.h"

#else
/* Use the local definitions of these types */

#include "common_types.h"
#include "cfe_es_extern_typedefs.h"
#include "cfe_mission_cfg.h" /* for CFE_MISSION_TBL_MAX_FULL_NAME_LEN */

/**
* @brief Label definitions associated with CFE_TBL_BufferSelect_Enum_t
*/
enum CFE_TBL_BufferSelect
{

/**
* @brief Select the Inactive buffer for validate or dump
*/
CFE_TBL_BufferSelect_INACTIVE = 0,

/**
* @brief Select the Active buffer for validate or dump
*/
CFE_TBL_BufferSelect_ACTIVE = 1
};

/**
* @brief Selects the buffer to operate on for validate or dump commands
*
* @sa enum CFE_TBL_BufferSelect
*/
typedef uint16 CFE_TBL_BufferSelect_Enum_t;

/**
* @brief The definition of the header fields that are included in CFE Table Data files.
*
* This header follows the CFE_FS header and precedes the the actual table data.
*/
typedef struct CFE_TBL_File_Hdr
{
uint32 Reserved; /**< Future Use: NumTblSegments in File? */
CFE_ES_MemOffset_t Offset; /**< Byte Offset at which load should commence */
CFE_ES_MemOffset_t NumBytes; /**< Number of bytes to load into table */
char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< Fully qualified name of table to load */
} CFE_TBL_File_Hdr_t;

#endif /* CFE_EDS_ENABLED_BUILD */

#endif /* CFE_TBL_EXTERN_TYPEDEFS_H */
Loading