Skip to content

Commit e94c450

Browse files
CDKnightNASAGerardo E. Cruz-Ortiz
authored and
Gerardo E. Cruz-Ortiz
committed
fix nasa#70 - reorg the table file
1 parent 0e0c71c commit e94c450

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ include_directories(${sample_lib_MISSION_DIR}/fsw/public_inc)
1212
add_cfe_app(sample_app fsw/src/sample_app.c)
1313

1414
# Add table
15-
add_cfe_tables(sampleTable fsw/src/sample_table.c)
15+
add_cfe_tables(sampleAppTable fsw/tables/sample_app_tbl.c)
1616

1717
# If UT is enabled, then add the tests from the subdirectory
1818
# Note that this is an app, and therefore does not provide
@@ -21,4 +21,3 @@ add_cfe_tables(sampleTable fsw/src/sample_table.c)
2121
if (ENABLE_UNIT_TESTS)
2222
add_subdirectory(unit-test)
2323
endif (ENABLE_UNIT_TESTS)
24-

fsw/src/sample_table.h renamed to fsw/platform_inc/sample_app_table.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
** See the License for the specific language governing permissions and
1919
** limitations under the License.
2020
**
21-
** File: sample_table.h
21+
** File: sample_app_table.h
2222
**
2323
** Purpose:
24-
** Define sample table
24+
** Define sample app table
2525
**
2626
** Notes:
2727
**
2828
**
2929
*******************************************************************************/
30-
#ifndef _sample_table_h_
31-
#define _sample_table_h_
30+
#ifndef _sample_app_table_h_
31+
#define _sample_app_table_h_
3232

3333
/*
3434
** Table structure
@@ -38,9 +38,9 @@ typedef struct
3838
uint16 Int1;
3939
uint16 Int2;
4040

41-
} SAMPLE_Table_t;
41+
} SAMPLE_APP_Table_t;
4242

43-
#endif /* _sample_table_h_ */
43+
#endif /* _sample_app_table_h_ */
4444

4545
/************************/
4646
/* End of File Comment */

fsw/src/sample_app.c

+11-12
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "sample_app_events.h"
3232
#include "sample_app_version.h"
3333
#include "sample_app.h"
34-
#include "sample_table.h"
34+
#include "sample_app_table.h"
3535

3636
/* The sample_lib module provides the SAMPLE_Function() prototype */
3737
#include <string.h>
@@ -220,22 +220,21 @@ int32 SAMPLE_AppInit( void )
220220
** Register Table(s)
221221
*/
222222
status = CFE_TBL_Register(&SAMPLE_AppData.TblHandles[0],
223-
"SampleTable",
224-
sizeof(SAMPLE_Table_t),
223+
"SampleAppTable",
224+
sizeof(SAMPLE_APP_Table_t),
225225
CFE_TBL_OPT_DEFAULT,
226226
SAMPLE_TblValidationFunc);
227227
if ( status != CFE_SUCCESS )
228228
{
229-
CFE_ES_WriteToSysLog("Sample App: Error Registering \
230-
Table, RC = 0x%08lX\n", (unsigned long)status);
229+
CFE_ES_WriteToSysLog("Sample App: Error Registering Table, RC = 0x%08lX\n", (unsigned long)status);
231230

232231
return ( status );
233232
}
234233
else
235234
{
236235
status = CFE_TBL_Load(SAMPLE_AppData.TblHandles[0],
237236
CFE_TBL_SRC_FILE,
238-
SAMPLE_TABLE_FILE);
237+
SAMPLE_APP_TABLE_FILE);
239238
}
240239

241240
CFE_EVS_SendEvent (SAMPLE_STARTUP_INF_EID,
@@ -430,8 +429,8 @@ int32 SAMPLE_ResetCounters( const SAMPLE_ResetCounters_t *Msg )
430429
int32 SAMPLE_Process( const SAMPLE_Process_t *Msg )
431430
{
432431
int32 status;
433-
SAMPLE_Table_t *TblPtr;
434-
const char *TableName = "SAMPLE_APP.SampleTable";
432+
SAMPLE_APP_Table_t *TblPtr;
433+
const char *TableName = "SAMPLE_APP.SampleAppTable";
435434

436435
/* Sample Use of Table */
437436

@@ -511,20 +510,20 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength )
511510
int32 SAMPLE_TblValidationFunc( void *TblData )
512511
{
513512
int32 ReturnCode = CFE_SUCCESS;
514-
SAMPLE_Table_t *TblDataPtr = (SAMPLE_Table_t *)TblData;
513+
SAMPLE_APP_Table_t *TblDataPtr = (SAMPLE_APP_Table_t *)TblData;
515514

516515
/*
517516
** Sample Table Validation
518517
*/
519-
if (TblDataPtr->Int1 > SAMPLE_TBL_ELEMENT_1_MAX)
518+
if (TblDataPtr->Int1 > SAMPLE_APP_TBL_ELEMENT_1_MAX)
520519
{
521520
/* First element is out of range, return an appropriate error code */
522-
ReturnCode = SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE;
521+
ReturnCode = SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE;
523522
}
524523

525524
return ReturnCode;
526525

527-
} /* End of Sample_TblValidationFunc*/
526+
} /* End of SAMPLE_TBLValidationFunc() */
528527

529528
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
530529
/* */

fsw/src/sample_app.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
#define SAMPLE_NUMBER_OF_TABLES 1 /* Number of Table(s) */
4949

5050
/* Define filenames of default data images for tables */
51-
#define SAMPLE_TABLE_FILE "/cf/sample_table.tbl"
51+
#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl"
5252

53-
#define SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE -1
53+
#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1
5454

55-
#define SAMPLE_TBL_ELEMENT_1_MAX 10
55+
#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10
5656
/************************************************************************
5757
** Type Definitions
5858
*************************************************************************/

fsw/src/sample_table.c renamed to fsw/tables/sample_app_tbl.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
*/
2222

2323
#include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */
24-
#include "sample_table.h"
24+
#include "sample_app_table.h"
2525

2626
/*
2727
** The following is an example of the declaration statement that defines the desired
2828
** contents of the table image.
2929
*/
30-
SAMPLE_Table_t sampleTable = { 1, 2};
30+
SAMPLE_APP_Table_t SampleAppTable = {1, 2};
3131

3232
/*
3333
** The macro below identifies:
@@ -36,4 +36,5 @@ SAMPLE_Table_t sampleTable = { 1, 2};
3636
** 3) a brief description of the contents of the file image
3737
** 4) the desired name of the table image binary file that is cFE compatible
3838
*/
39-
CFE_TBL_FILEDEF(sampleTable, SAMPLE_APP.SampleTable, Table Utility Test Table, sample_table.tbl )
39+
CFE_TBL_FILEDEF( SampleAppTable, SAMPLE_APP.SampleAppTable, Table Utility Test Table, sample_app_tbl.tbl )
40+

0 commit comments

Comments
 (0)