Skip to content

Commit

Permalink
Partial #42, naming convention for platform_inc headers
Browse files Browse the repository at this point in the history
Updates names of all identifiers in platform_inc to follow naming
conventions from CFE.
  • Loading branch information
jphickey committed Dec 8, 2021
1 parent f9c81d6 commit b42f0f5
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 238 deletions.
17 changes: 9 additions & 8 deletions fsw/platform_inc/cf_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ typedef struct
char src_dir[CF_FILENAME_MAX_PATH]; /* path to source dir */
char dst_dir[CF_FILENAME_MAX_PATH]; /* path to destination dir */
uint8 enabled;
} polldir_t;
} CF_PollDir_t;

typedef struct
{
Expand All @@ -52,11 +52,11 @@ typedef struct

uint16 pipe_depth_input; /* depth of pipe to receive incoming pdu */

polldir_t polldir[CF_MAX_POLLING_DIR_PER_CHAN];
CF_PollDir_t polldir[CF_MAX_POLLING_DIR_PER_CHAN];

char sem_name[OS_MAX_API_NAME]; /* name of throttling semaphore in TO */
uint8 dequeue_enabled; /* if 1, then the channel will make pending transactions active */
} cf_channel_t;
} CF_ChannelConfig_t;

typedef struct
{
Expand All @@ -66,16 +66,17 @@ typedef struct

CF_EntityId_t local_eid; /* the local entity ID of the CF app */

cf_channel_t chan[CF_NUM_CHANNELS];
uint32 ack_timer_s; /* in seconds */
uint32 nak_timer_s; /* in seconds */
uint32 inactivity_timer_s; /* in seconds */
CF_ChannelConfig_t chan[CF_NUM_CHANNELS];

uint32 ack_timer_s; /* in seconds */
uint32 nak_timer_s; /* in seconds */
uint32 inactivity_timer_s; /* in seconds */

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 */

uint16 outgoing_file_chunk_size; /* size of outgoing file data PDUs */
char tmp_dir[CF_FILENAME_MAX_PATH]; /* temp directory to put temp files */
} cf_config_table_t;
} CF_ConfigTable_t;

#endif /* !CF_TBLDEFS__H */
4 changes: 2 additions & 2 deletions fsw/src/cf_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void CF_CheckTables(void)
*************************************************************************/
static int32 CF_ValidateConfigTable(void *tbl_ptr)
{
cf_config_table_t *tbl = (cf_config_table_t *)tbl_ptr;
CF_ConfigTable_t *tbl = (CF_ConfigTable_t *)tbl_ptr;
int32 ret; /* initialized below */
static const int32 no_ticks_per_second = -1;
static const int32 crc_alignment = -2;
Expand Down Expand Up @@ -159,7 +159,7 @@ static int32 CF_TableInit(void)
{
int32 status = CFE_SUCCESS;

status = CFE_TBL_Register(&CF_AppData.config_handle, CF_CONFIG_TABLE_NAME, sizeof(cf_config_table_t),
status = CFE_TBL_Register(&CF_AppData.config_handle, CF_CONFIG_TABLE_NAME, sizeof(CF_ConfigTable_t),
CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP, CF_ValidateConfigTable);
if (status != CFE_SUCCESS)
{
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/cf_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ typedef struct

CFE_SB_PipeId_t cmd_pipe;

CFE_TBL_Handle_t config_handle;
cf_config_table_t *config_table;
CFE_TBL_Handle_t config_handle;
CF_ConfigTable_t *config_table;

CF_Engine_t engine;
} CF_AppData_t;
Expand Down
10 changes: 5 additions & 5 deletions fsw/src/cf_cfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1993,11 +1993,11 @@ static void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c)

for (i = 0; i < CF_MAX_POLLING_DIR_PER_CHAN; ++i)
{
CF_Poll_t *p = &c->poll[i];
int chan_index = (c - CF_AppData.engine.channels);
cf_channel_t *cc = &CF_AppData.config_table->chan[chan_index];
polldir_t *pd = &cc->polldir[i];
int count_check = 0;
CF_Poll_t *p = &c->poll[i];
int chan_index = (c - CF_AppData.engine.channels);
CF_ChannelConfig_t *cc = &CF_AppData.config_table->chan[chan_index];
CF_PollDir_t *pd = &cc->polldir[i];
int count_check = 0;

if (pd->enabled && pd->interval_sec)
{
Expand Down
2 changes: 1 addition & 1 deletion fsw/tables/cf_def_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "cfe_tbl_filedef.h"
#include "cf_tbldefs.h"

cf_config_table_t CF_config_table = {
CF_ConfigTable_t CF_config_table = {
10, /* ticks_per_second */
16384, /* max number of bytes per wakeup to calculate r2 recv file crc */
25, /* temp local id */
Expand Down
12 changes: 6 additions & 6 deletions unit-test/cf_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void Test_CF_CheckTables_CallTo_CFE_TBL_GetAddress_Returns_CFE_TBL_INFO_UPDATED(
/* CF_ValidateConfigTable tests specific items */

/* CF_ValidateConfigTable tests specific global variables */
cf_config_table_t dummy_table;
CF_ConfigTable_t dummy_table;

/* CF_ValidateConfigTable tests specific functions */
void cf_config_table_tests_set_dummy_table_to_nominal(void)
Expand All @@ -230,7 +230,7 @@ void Setup_cf_config_table_tests(void)
void Test_CF_ValidateConfigTable_FailBecauseTableTicksPerSecondIs0(void)
{
/* Arrange */
cf_config_table_t *arg_table = &dummy_table;
CF_ConfigTable_t *arg_table = &dummy_table;

arg_table->ticks_per_second = 0;

Expand All @@ -244,7 +244,7 @@ void Test_CF_ValidateConfigTable_FailBecauseTableTicksPerSecondIs0(void)
void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIs0(void)
{
/* Arrange */
cf_config_table_t *arg_table = &dummy_table;
CF_ConfigTable_t *arg_table = &dummy_table;

arg_table->ticks_per_second = 1;
arg_table->rx_crc_calc_bytes_per_wakeup = 0;
Expand All @@ -259,7 +259,7 @@ void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIs0(void)
void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIsNot1024ByteAligned(void)
{
/* Arrange */
cf_config_table_t *arg_table = &dummy_table;
CF_ConfigTable_t *arg_table = &dummy_table;

arg_table->ticks_per_second = 1;
arg_table->rx_crc_calc_bytes_per_wakeup =
Expand All @@ -277,7 +277,7 @@ void Test_CF_ValidateConfigTable_FailBecauseCalcBytesPerWakeupIsNot1024ByteAlign
void Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArray(void)
{
/* Arrange */
cf_config_table_t *arg_table = &dummy_table;
CF_ConfigTable_t *arg_table = &dummy_table;

// outgoing_file_chunk_size set to greater than sizeof(CF_CFDP_PduFileDataContent_t)
arg_table->ticks_per_second = 1;
Expand All @@ -294,7 +294,7 @@ void Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArra
void Test_CF_ValidateConfigTable_Success(void)
{
/* Arange */
cf_config_table_t *arg_table = &dummy_table;
CF_ConfigTable_t *arg_table = &dummy_table;

arg_table->ticks_per_second = 1;
arg_table->rx_crc_calc_bytes_per_wakeup = 0x0400; /* 1024 aligned */
Expand Down
40 changes: 20 additions & 20 deletions unit-test/cf_cfdp_r_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is
uint8 initial_sub_state =
Any_uint8_Except(CF_RxSubState_FILEDATA); /* uint8 used for CF_RxSubState_t because it is a small valuation
right now, TODO: create any_cf_rx_sub_state */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->history = &dummy_history;
arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR;
Expand Down Expand Up @@ -462,7 +462,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is
uint8 initial_sub_state =
Any_uint8_Except(CF_RxSubState_FILEDATA); /* uint8 used for CF_RxSubState_t because it is a small valuation
right now, TODO: create any_cf_rx_sub_state */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->history = &dummy_history;
arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR;
Expand Down Expand Up @@ -501,7 +501,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_
uint8 initial_sub_state =
Any_uint8_Except(CF_RxSubState_FILEDATA); /* uint8 used for CF_RxSubState_t because it is a small valuation
right now, TODO: create any_cf_rx_sub_state */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->history = &dummy_history;
arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR;
Expand Down Expand Up @@ -542,7 +542,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_
uint8 initial_sub_state =
Any_uint8_Except(CF_RxSubState_FILEDATA); /* uint8 used for CF_RxSubState_t because it is a small valuation
right now, TODO: create any_cf_rx_sub_state */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->history = &dummy_history;
arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR;
Expand Down Expand Up @@ -584,7 +584,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_
uint8 initial_sub_state =
Any_uint8_Except(CF_RxSubState_FILEDATA); /* uint8 used for CF_RxSubState_t because it is a small valuation
right now, TODO: create any_cf_rx_sub_state */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->history = &dummy_history;
arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR;
Expand Down Expand Up @@ -1299,8 +1299,8 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_
arg_t->fsize = ((CF_CFDP_PduEof_t *)arg_ph)->size;

/* Arrange for CF_CFDP_R2_Complete */
CF_History_t dummy_history;
cf_config_table_t dummy_config_table;
CF_History_t dummy_history;
CF_ConfigTable_t dummy_config_table;

arg_t->history = &dummy_history;
arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR;
Expand Down Expand Up @@ -2321,7 +2321,7 @@ void Test_CF_CFDP_R_Init_StateIs_CFDP_R2_And_t_flags_rx_md_recv_Is_0_SendEventTh
void)
{
/* Arrange */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
CF_History_t dummy_history;
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
Expand Down Expand Up @@ -2386,7 +2386,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_r2_rx_crc_calc_bytes_Is_N
/* Arrange */
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
int local_result;

arg_t->state_data.r.r2.rx_crc_calc_bytes = Any_uint32_Except(0);
Expand All @@ -2412,7 +2412,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_r2_rx_crc_calc_bytes_Is_0
/* Arrange */
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
int local_result;

arg_t->state_data.r.r2.rx_crc_calc_bytes = 0;
Expand All @@ -2438,7 +2438,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_r2_rx_crc_calc_bytes_Is_N
/* Arrange */
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
int local_result;

arg_t->state_data.r.r2.rx_crc_calc_bytes = Any_uint32_Except(0);
Expand Down Expand Up @@ -2484,7 +2484,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_r2_rx_crc_calc_bytes_Is_N
/* Arrange */
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
int local_result;

arg_t->state_data.r.r2.rx_crc_calc_bytes = Any_uint32_Except(0);
Expand Down Expand Up @@ -2536,7 +2536,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueNotEqTo_RXC
CF_History_t dummy_history;
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
uint16 initial_file_seek = Any_uint16();
int local_result;

Expand Down Expand Up @@ -2586,7 +2586,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueEqTo_RXC_cr
CF_History_t dummy_history;
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
uint16 initial_file_read = Any_uint16();
int local_result;

Expand Down Expand Up @@ -2638,7 +2638,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_cached_pos_IsEqTo_RXC_Cal
CF_History_t dummy_history;
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
uint32 forced_return_CF_WrappedRead = (sizeof(uint8) * CF_R2_CRC_CHUNK_SIZE);
uint32 initial_RXC = Any_uint32_BetweenExcludeMax(1, UINT8_MAX); /* UINT8_MAX used for reasonable test size */
int local_result;
Expand Down Expand Up @@ -2710,7 +2710,7 @@ void Test_CF_CFDP_R2_SubstateSendFin_Given_t_history_cc_IsEqTo_CC_NO_ERROR_And_t
arg_t->flags.rx.crc_calc = 0;

/* Arrange for CF_CFDP_R2_CalcCrcChunk */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->state_data.r.r2.rx_crc_calc_bytes = Any_uint32_Except(0);

Expand Down Expand Up @@ -2831,7 +2831,7 @@ void Test_CF_CFDP_R2_SubstateSendFin_CallTo_CF_CFDP_R2_CalcCrcChunk_Returns_0_Gi
arg_t->state_data.r.sub_state = Any_uint8_Except(CF_RxSubState_WAIT_FOR_FIN_ACK);

/* Arrange for CF_CFDP_R2_CalcCrcChunk */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->state_data.r.r2.rx_crc_calc_bytes = Any_uint32_Except(0);

Expand Down Expand Up @@ -4141,7 +4141,7 @@ void Test_CF_CFDP_R_Tick_Given_t_state_IsEqTo_CFDP_R2_And_inactivity_fired_Is_1_
arg_t->flags.rx.ack_timer_armed = 0;

/* Arrange for CF_CFDP_R_SubstateSendNak */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
CF_ChunkWrapper_t dummy_chunks;
CF_History_t dummy_history;
CF_CFDP_PduNak_t dummy_nak;
Expand Down Expand Up @@ -4260,7 +4260,7 @@ void Test_CF_CFDP_R_Tick_Given_t_state_IsEqTo_CFDP_R2_And_inactivity_fired_Is_1_
arg_t->flags.rx.crc_calc = 0;

/* Arrange for CF_CFDP_R2_CalcCrcChunk */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;

arg_t->state_data.r.r2.rx_crc_calc_bytes = Any_uint32_Except(0);

Expand Down Expand Up @@ -4530,7 +4530,7 @@ void Test_CF_CFDP_R_Tick_NothingElseSet_ack_timer_armed_Is_1_CAllTo_CF_Timer_Exp
void)
{
/* Arrange */
cf_config_table_t dummy_config_table;
CF_ConfigTable_t dummy_config_table;
CF_History_t dummy_history;
CF_Transaction_t dummy_t;
CF_Transaction_t *arg_t = &dummy_t;
Expand Down
Loading

0 comments on commit b42f0f5

Please sign in to comment.