diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index 24ed0a28..ba61b575 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -47,9 +47,6 @@ #include #include "cf_assert.h" -const int CF_max_chunks[CF_Direction_NUM][CF_NUM_CHANNELS] = {CF_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION, - CF_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION}; - /** * @brief Initiate the process of encoding a new PDU to send * @@ -1093,6 +1090,9 @@ int32 CF_CFDP_InitEngine(void) CF_ChunkWrapper_t *c = CF_AppData.engine.chunks; int32 ret = CFE_SUCCESS; + static const int CF_DIR_MAX_CHUNKS[CF_Direction_NUM][CF_NUM_CHANNELS] = {CF_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION, + CF_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION}; + memset(&CF_AppData.engine, 0, sizeof(CF_AppData.engine)); for (i = 0; i < CF_NUM_CHANNELS; ++i) @@ -1139,9 +1139,9 @@ int32 CF_CFDP_InitEngine(void) for (k = 0; k < CF_Direction_NUM; ++k, ++c) { - CF_Assert((chunk_mem_offset + CF_max_chunks[k][i]) <= CF_NUM_CHUNKS_ALL_CHANNELS); - CF_ChunkListInit(&c->chunks, CF_max_chunks[k][i], &CF_AppData.engine.chunk_mem[chunk_mem_offset]); - chunk_mem_offset += CF_max_chunks[k][i]; + CF_Assert((chunk_mem_offset + CF_DIR_MAX_CHUNKS[k][i]) <= CF_NUM_CHUNKS_ALL_CHANNELS); + CF_ChunkListInit(&c->chunks, CF_DIR_MAX_CHUNKS[k][i], &CF_AppData.engine.chunk_mem[chunk_mem_offset]); + chunk_mem_offset += CF_DIR_MAX_CHUNKS[k][i]; CF_CList_InitNode(&c->cl_node); CF_CList_InsertBack(&CF_AppData.engine.channels[i].cs[k], &c->cl_node); } @@ -1178,7 +1178,7 @@ int32 CF_CFDP_InitEngine(void) ** \endreturns ** *************************************************************************/ -int CF_CFDP_CycleTx_(CF_CListNode_t *node, void *context) +int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) { CF_CFDP_CycleTx_args_t *args = (CF_CFDP_CycleTx_args_t *)context; CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node); @@ -1246,7 +1246,7 @@ void CF_CFDP_CycleTx(CF_Channel_t *c) CF_MoveTransaction(t, CF_QueueIdx_TXA); /* args is ok, still { c, 0 } */ entry_jump: - CF_CList_Traverse(c->qs[CF_QueueIdx_TXA], CF_CFDP_CycleTx_, &args); + CF_CList_Traverse(c->qs[CF_QueueIdx_TXA], CF_CFDP_CycleTxFirstActive, &args); } } @@ -1269,9 +1269,9 @@ void CF_CFDP_CycleTx(CF_Channel_t *c) *************************************************************************/ int CF_CFDP_DoTick(CF_CListNode_t *node, void *context) { - int ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */ - tick_args_t *args = (tick_args_t *)context; - CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node); + int ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */ + CF_CFDP_Tick_args_t *args = (CF_CFDP_Tick_args_t *)context; + CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node); if (!args->c->cur || (args->c->cur == t)) { /* found where we left off, so clear that and move on */ @@ -1321,7 +1321,7 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c) for (; c->tick_type < CF_TickType_NUM_TYPES; ++c->tick_type) { - tick_args_t args = {c, fns[c->tick_type], 0, 0}; + CF_CFDP_Tick_args_t args = {c, fns[c->tick_type], 0, 0}; do { @@ -1384,8 +1384,8 @@ void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint ** t must not be NULL. ** *************************************************************************/ -static void CF_CFDP_TxFile_(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, - CF_EntityId_t dest_id) +static void CF_CFDP_TxFile_Initiate(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, + uint8 priority, CF_EntityId_t dest_id) { CFE_EVS_SendEvent(CF_EID_INF_CFDP_S_START_SEND, CFE_EVS_EventType_INFORMATION, "CF: start class %d tx of file %d:%.*s -> %d:%.*s", cfdp_class + 1, @@ -1448,7 +1448,7 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP t->history->fnames.src_filename[sizeof(t->history->fnames.src_filename) - 1] = 0; strncpy(t->history->fnames.dst_filename, dst_filename, sizeof(t->history->fnames.dst_filename) - 1); t->history->fnames.dst_filename[sizeof(t->history->fnames.dst_filename) - 1] = 0; - CF_CFDP_TxFile_(t, cfdp_class, keep, chan, priority, dest_id); + CF_CFDP_TxFile_Initiate(t, cfdp_class, keep, chan, priority, dest_id); ++c->num_cmd_tx; t->flags.tx.cmd_tx = 1; @@ -1472,9 +1472,9 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP ** \endreturns ** *************************************************************************/ -static int32 CF_CFDP_PlaybackDir_(CF_Playback_t *p, const char *src_filename, const char *dst_filename, - CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, - CF_EntityId_t dest_id) +static int32 CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *src_filename, const char *dst_filename, + CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, + CF_EntityId_t dest_id) { int32 ret = CFE_SUCCESS; @@ -1544,7 +1544,7 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF return -1; } - return CF_CFDP_PlaybackDir_(p, src_filename, dst_filename, cfdp_class, keep, chan, priority, dest_id); + return CF_CFDP_PlaybackDir_Initiate(p, src_filename, dst_filename, cfdp_class, keep, chan, priority, dest_id); } /************************************************************************/ @@ -1598,7 +1598,8 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) 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_(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; @@ -1707,8 +1708,8 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) else if (CF_Timer_Expired(&p->interval_timer)) { /* the timer has expired */ - int ret = CF_CFDP_PlaybackDir_(&p->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0, chan_index, - pd->priority, pd->dest_eid); + int ret = CF_CFDP_PlaybackDir_Initiate(&p->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0, + chan_index, pd->priority, pd->dest_eid); if (!ret) { p->timer_set = 0; @@ -1716,7 +1717,7 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) else { /* error occured in playback directory, so reset the timer */ - /* an event is sent in CF_CFDP_PlaybackDir_ so there is no reason to + /* an event is sent in CF_CFDP_PlaybackDir_Initiate so there is no reason to * to have another here */ CF_Timer_InitRelSec(&p->interval_timer, pd->interval_sec); } diff --git a/fsw/src/cf_cfdp.h b/fsw/src/cf_cfdp.h index 25535d1b..1fb58e51 100644 --- a/fsw/src/cf_cfdp.h +++ b/fsw/src/cf_cfdp.h @@ -29,19 +29,19 @@ #include "cf_cfdp_types.h" -typedef struct CF_CFDP_CycleTx_args_t +typedef struct CF_CFDP_CycleTx_args { CF_Channel_t *c; int ran_one; } CF_CFDP_CycleTx_args_t; -typedef struct +typedef struct CF_CFDP_Tick_args { CF_Channel_t *c; /* IN param */ void (*fn)(CF_Transaction_t *, int *); /* IN param */ int early_exit; /* OUT param */ int cont; /* if 1, then re-traverse the list */ -} tick_args_t; +} CF_CFDP_Tick_args_t; void CF_CFDP_EncodeStart(CF_EncoderState_t *penc, void *msgbuf, CF_Logical_PduBuffer_t *ph, size_t encap_hdr_size, size_t total_size); @@ -100,8 +100,6 @@ void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint /* returns number of bytes copied, or -1 on error */ extern int CF_CFDP_CopyStringFromLV(char *buf, size_t buf_maxsz, const CF_Logical_Lv_t *src_lv); -extern const int CF_max_chunks[CF_Direction_NUM][CF_NUM_CHANNELS]; - extern void CF_CFDP_ArmAckTimer(CF_Transaction_t *t); void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); @@ -110,7 +108,7 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); int CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context); void CF_CFDP_CycleTx(CF_Channel_t *c); -int CF_CFDP_CycleTx_(CF_CListNode_t *node, void *context); +int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context); void CF_CFDP_TickTransactions(CF_Channel_t *c); void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p); void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c); diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index 457820fb..441a9895 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -571,9 +571,9 @@ int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) nak->scope_start = 0; cret = CF_ChunkList_ComputeGaps(&t->chunks->chunks, - (t->chunks->chunks.count < t->chunks->chunks.CF_max_chunks) - ? t->chunks->chunks.CF_max_chunks - : (t->chunks->chunks.CF_max_chunks - 1), + (t->chunks->chunks.count < t->chunks->chunks.max_chunks) + ? t->chunks->chunks.max_chunks + : (t->chunks->chunks.max_chunks - 1), t->fsize, 0, CF_CFDP_R2_GapCompute, &args); if (!cret) diff --git a/fsw/src/cf_chunk.c b/fsw/src/cf_chunk.c index 9a3fe997..5dec9b75 100644 --- a/fsw/src/cf_chunk.c +++ b/fsw/src/cf_chunk.c @@ -88,7 +88,7 @@ void CF_Chunks_EraseChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t erase_index) *************************************************************************/ void CF_Chunks_InsertChunk(CF_ChunkList_t *chunks, CF_ChunkIdx_t index_before, const CF_Chunk_t *chunk) { - CF_Assert(chunks->count < chunks->CF_max_chunks); + CF_Assert(chunks->count < chunks->max_chunks); CF_Assert(index_before <= chunks->count); if (chunks->count && (index_before != chunks->count)) @@ -155,7 +155,7 @@ CF_ChunkIdx_t CF_Chunks_FindInsertPosition(CF_ChunkList_t *chunks, const CF_Chun int CF_Chunks_CombinePrevious(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t *chunk) { int ret = 0; - CF_Assert(i <= chunks->CF_max_chunks); + CF_Assert(i <= chunks->max_chunks); CF_ChunkOffset_t chunk_end = chunk->offset + chunk->size; @@ -292,7 +292,7 @@ void CF_Chunks_Insert(CF_ChunkList_t *chunks, CF_ChunkIdx_t i, const CF_Chunk_t int combined = CF_Chunks_CombinePrevious(chunks, i, chunk); if (!combined) { - if (chunks->count < chunks->CF_max_chunks) + if (chunks->count < chunks->max_chunks) { CF_Chunks_InsertChunk(chunks, i, chunk); } @@ -395,11 +395,11 @@ const CF_Chunk_t *CF_ChunkList_GetFirstChunk(const CF_ChunkList_t *chunks) ** chunks must not be NULL. chunks_mem must not be NULL. ** *************************************************************************/ -void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem) +void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t max_chunks, CF_Chunk_t *chunks_mem) { - CF_Assert(CF_max_chunks > 0); - chunks->CF_max_chunks = CF_max_chunks; - chunks->chunks = chunks_mem; + CF_Assert(max_chunks > 0); + chunks->max_chunks = max_chunks; + chunks->chunks = chunks_mem; CF_ChunkListReset(chunks); } @@ -413,7 +413,7 @@ void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Ch void CF_ChunkListReset(CF_ChunkList_t *chunks) { chunks->count = 0; - memset(chunks->chunks, 0, sizeof(*chunks->chunks) * chunks->CF_max_chunks); + memset(chunks->chunks, 0, sizeof(*chunks->chunks) * chunks->max_chunks); } /************************************************************************/ diff --git a/fsw/src/cf_chunk.h b/fsw/src/cf_chunk.h index 5b326bd0..0ddb4980 100644 --- a/fsw/src/cf_chunk.h +++ b/fsw/src/cf_chunk.h @@ -45,7 +45,7 @@ typedef struct CF_Chunk typedef struct CF_ChunkList { CF_ChunkIdx_t count; - CF_ChunkIdx_t CF_max_chunks; + CF_ChunkIdx_t max_chunks; CF_Chunk_t *chunks; } CF_ChunkList_t; @@ -61,7 +61,7 @@ static inline CF_ChunkOffset_t CF_Chunk_MAX(CF_ChunkOffset_t a, CF_ChunkOffset_t } } -void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem); +void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t max_chunks, CF_Chunk_t *chunks_mem); void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSize_t size); void CF_ChunkListReset(CF_ChunkList_t *chunks); /* CF_ChunkList_RemoveFromFirst - diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index 54748e71..78f12d46 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -204,7 +204,7 @@ void CF_CmdPlaybackDir(CFE_SB_Buffer_t *msg) ** \endreturns ** *************************************************************************/ -int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t fn, void *context) +int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_ChanActionFn_t fn, void *context) { int ret = 0; @@ -244,7 +244,7 @@ int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t ** \endreturns ** *************************************************************************/ -int CF_DoFreezeThaw(uint8 chan_num, const bool_arg_t *context) +int CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) { /* no need to bounds check chan_num, done in caller */ CF_AppData.hk.channel_hk[chan_num].frozen = context->barg; @@ -260,8 +260,8 @@ int CF_DoFreezeThaw(uint8 chan_num, const bool_arg_t *context) *************************************************************************/ void CF_CmdFreeze(CFE_SB_Buffer_t *msg) { - bool_arg_t barg = {1}; /* param is frozen, so 1 means freeze */ - CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "freeze", (chan_action_fn_t)CF_DoFreezeThaw, &barg)); + CF_ChanAction_BoolArg_t barg = {1}; /* param is frozen, so 1 means freeze */ + CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "freeze", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg)); } /************************************************************************/ @@ -273,8 +273,8 @@ void CF_CmdFreeze(CFE_SB_Buffer_t *msg) *************************************************************************/ void CF_CmdThaw(CFE_SB_Buffer_t *msg) { - bool_arg_t barg = {0}; /* param is frozen, so 0 means thawed */ - CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "thaw", (chan_action_fn_t)CF_DoFreezeThaw, &barg)); + CF_ChanAction_BoolArg_t barg = {0}; /* param is frozen, so 0 means thawed */ + CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "thaw", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg)); } /************************************************************************/ @@ -374,7 +374,7 @@ int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAct ** t must not be NULL. context must not be NULL. ** *************************************************************************/ -void CF_DoSuspRes_(CF_Transaction_t *t, susp_res_arg_t *context) +void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context) { CF_Assert(t); if (t->flags.com.suspended == context->action) @@ -401,9 +401,9 @@ void CF_DoSuspRes_(CF_Transaction_t *t, susp_res_arg_t *context) void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action) { /* ok to not bounds check action, because the caller is using it in two places with constant values 0 or 1 */ - static const char *msgstr[] = {"resume", "suspend"}; - susp_res_arg_t args = {0, action}; - int ret = CF_TsnChanAction(cmd, msgstr[action], (CF_TsnChanAction_fn_t)CF_DoSuspRes_, &args); + static const char *msgstr[] = {"resume", "suspend"}; + CF_ChanAction_SuspResArg_t args = {0, action}; + int ret = CF_TsnChanAction(cmd, msgstr[action], (CF_TsnChanAction_fn_t)CF_DoSuspRes_Txn, &args); if (!ret && args.same) { @@ -454,7 +454,7 @@ void CF_CmdResume(CFE_SB_Buffer_t *msg) ** t must not be NULL. ** *************************************************************************/ -void CF_CmdCancel_(CF_Transaction_t *t, void *ignored) +void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored) { CF_CFDP_CancelTransaction(t); } @@ -468,7 +468,7 @@ void CF_CmdCancel_(CF_Transaction_t *t, void *ignored) *************************************************************************/ void CF_CmdCancel(CFE_SB_Buffer_t *msg) { - CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "cancel", CF_CmdCancel_, NULL)); + CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "cancel", CF_CmdCancel_Txn, NULL)); } /************************************************************************/ @@ -478,7 +478,7 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg) ** msg must not be NULL. ** *************************************************************************/ -void CF_CmdAbandon_(CF_Transaction_t *t, void *ignored) +void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored) { CF_CFDP_ResetTransaction(t, 0); } @@ -492,7 +492,7 @@ void CF_CmdAbandon_(CF_Transaction_t *t, void *ignored) *************************************************************************/ void CF_CmdAbandon(CFE_SB_Buffer_t *msg) { - CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "abandon", CF_CmdAbandon_, NULL)); + CF_CmdCond(CF_TsnChanAction((CF_TransactionCmd_t *)msg, "abandon", CF_CmdAbandon_Txn, NULL)); } /************************************************************************/ @@ -506,7 +506,7 @@ void CF_CmdAbandon(CFE_SB_Buffer_t *msg) ** \endreturns ** *************************************************************************/ -int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context) +int CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) { /* no need to bounds check chan_num, done in caller */ CF_AppData.config_table->chan[chan_num].dequeue_enabled = context->barg; @@ -522,8 +522,8 @@ int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context) *************************************************************************/ void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg) { - bool_arg_t barg = {1}; - CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_dequeue", (chan_action_fn_t)CF_DoEnableDisableDequeue, + CF_ChanAction_BoolArg_t barg = {1}; + CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_dequeue", (CF_ChanActionFn_t)CF_DoEnableDisableDequeue, &barg)); } @@ -536,9 +536,9 @@ void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg) *************************************************************************/ void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg) { - bool_arg_t barg = {0}; - CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_dequeue", (chan_action_fn_t)CF_DoEnableDisableDequeue, - &barg)); + CF_ChanAction_BoolArg_t barg = {0}; + CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_dequeue", + (CF_ChanActionFn_t)CF_DoEnableDisableDequeue, &barg)); } /************************************************************************/ @@ -548,7 +548,7 @@ void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg) ** context must not be NULL. ** *************************************************************************/ -int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context) +int CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context) { int ret = 0; /* no need to bounds check chan_num, done in caller */ @@ -583,8 +583,8 @@ int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context) *************************************************************************/ void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg) { - bool_msg_arg_t barg = {(CF_UnionArgsCmd_t *)msg, 1}; - CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_polldir", (chan_action_fn_t)CF_DoEnableDisablePolldir, + CF_ChanAction_BoolMsgArg_t barg = {(CF_UnionArgsCmd_t *)msg, 1}; + CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "enable_polldir", (CF_ChanActionFn_t)CF_DoEnableDisablePolldir, &barg)); } @@ -597,9 +597,9 @@ void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg) *************************************************************************/ void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg) { - bool_msg_arg_t barg = {(CF_UnionArgsCmd_t *)msg, 0}; - CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_polldir", (chan_action_fn_t)CF_DoEnableDisablePolldir, - &barg)); + CF_ChanAction_BoolMsgArg_t barg = {(CF_UnionArgsCmd_t *)msg, 0}; + CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "disable_polldir", + (CF_ChanActionFn_t)CF_DoEnableDisablePolldir, &barg)); } /************************************************************************/ @@ -698,7 +698,7 @@ int CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd) *************************************************************************/ void CF_CmdPurgeQueue(CFE_SB_Buffer_t *msg) { - CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "purge_queue", (chan_action_fn_t)CF_DoPurgeQueue, msg)); + CF_CmdCond(CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "purge_queue", (CF_ChanActionFn_t)CF_DoPurgeQueue, msg)); } /************************************************************************/ diff --git a/fsw/src/cf_cmd.h b/fsw/src/cf_cmd.h index 8fec7a60..37ec12c7 100644 --- a/fsw/src/cf_cmd.h +++ b/fsw/src/cf_cmd.h @@ -26,26 +26,26 @@ #include "cf_app.h" #include "cf_utils.h" -typedef int (*chan_action_fn_t)(uint8 chan_num, void *context); +typedef int (*CF_ChanActionFn_t)(uint8 chan_num, void *context); -typedef struct +typedef struct CF_ChanAction_BoolArg { - uint8 barg; -} bool_arg_t; + bool barg; +} CF_ChanAction_BoolArg_t; typedef CF_TraverseAllTransactions_fn_t CF_TsnChanAction_fn_t; -typedef struct +typedef struct CF_ChanAction_SuspResArg { - int same; /* out param -- indicates at least one action was set to its current value */ - uint8 action; -} susp_res_arg_t; + int same; /* out param -- indicates at least one action was set to its current value */ + bool action; +} CF_ChanAction_SuspResArg_t; -typedef struct +typedef struct CF_ChanAction_BoolMsgArg { const CF_UnionArgsCmd_t *msg; - uint8 barg; -} bool_msg_arg_t; + bool barg; +} CF_ChanAction_BoolMsgArg_t; /************************************************************************/ /** \brief Increment the command accepted counter. @@ -88,24 +88,24 @@ void CF_CmdNoop(CFE_SB_Buffer_t *msg); void CF_CmdReset(CFE_SB_Buffer_t *msg); void CF_CmdTxFile(CFE_SB_Buffer_t *msg); void CF_CmdPlaybackDir(CFE_SB_Buffer_t *msg); -int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t fn, void *context); -int CF_DoFreezeThaw(uint8 chan_num, const bool_arg_t *context); +int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_ChanActionFn_t fn, void *context); +int CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context); void CF_CmdFreeze(CFE_SB_Buffer_t *msg); void CF_CmdThaw(CFE_SB_Buffer_t *msg); CF_Transaction_t *CF_FindTransactionBySequenceNumberAllChannels(CF_TransactionSeq_t ts, CF_EntityId_t eid); int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAction_fn_t fn, void *context); -void CF_DoSuspRes_(CF_Transaction_t *t, susp_res_arg_t *context); +void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context); void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action); void CF_CmdSuspend(CFE_SB_Buffer_t *msg); void CF_CmdResume(CFE_SB_Buffer_t *msg); -void CF_CmdCancel_(CF_Transaction_t *t, void *ignored); +void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored); void CF_CmdCancel(CFE_SB_Buffer_t *msg); -void CF_CmdAbandon_(CF_Transaction_t *t, void *ignored); +void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored); void CF_CmdAbandon(CFE_SB_Buffer_t *msg); -int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context); +int CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context); void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg); void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg); -int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context); +int CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context); void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg); void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg); int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c); diff --git a/fsw/src/cf_utils.c b/fsw/src/cf_utils.c index dc5ef79c..f214b076 100644 --- a/fsw/src/cf_utils.c +++ b/fsw/src/cf_utils.c @@ -138,7 +138,7 @@ void CF_FreeTransaction(CF_Transaction_t *t) ** \endreturns ** *************************************************************************/ -int CF_FindTransactionBySequenceNumber_(CF_CListNode_t *n, trans_seq_arg_t *context) +int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context) { CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); int ret = 0; @@ -174,15 +174,15 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac * or on Q_TX or Q_RX. Once a transaction moves to history, then it's done. * * Let's put CF_QueueIdx_RX up front, because most RX packets will be file data PDUs */ - trans_seq_arg_t ctx = {transaction_sequence_number, src_eid, NULL}; - CF_CListNode_t *ptrs[] = {c->qs[CF_QueueIdx_RX], c->qs[CF_QueueIdx_PEND], c->qs[CF_QueueIdx_TXA], + CF_Traverse_TransSeqArg_t ctx = {transaction_sequence_number, src_eid, NULL}; + CF_CListNode_t *ptrs[] = {c->qs[CF_QueueIdx_RX], c->qs[CF_QueueIdx_PEND], c->qs[CF_QueueIdx_TXA], c->qs[CF_QueueIdx_TXW]}; - int i; - CF_Transaction_t *ret = NULL; + int i; + CF_Transaction_t *ret = NULL; for (i = 0; i < (sizeof(ptrs) / sizeof(ptrs[0])); ++i) { - CF_CList_Traverse(ptrs[i], (CF_CListFn_t)CF_FindTransactionBySequenceNumber_, &ctx); + CF_CList_Traverse(ptrs[i], (CF_CListFn_t)CF_FindTransactionBySequenceNumber_Impl, &ctx); if (ctx.t) { ret = ctx.t; @@ -209,7 +209,7 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac ** \endreturns ** *************************************************************************/ -int CF_TraverseHistory(CF_CListNode_t *n, trav_arg_t *context) +int CF_TraverseHistory(CF_CListNode_t *n, CF_Traverse_WriteFileArg_t *context) { static const char *dstr[] = {"RX", "TX"}; int i; @@ -251,7 +251,7 @@ int CF_TraverseHistory(CF_CListNode_t *n, trav_arg_t *context) ** \endreturns ** *************************************************************************/ -int CF_TraverseTransactions(CF_CListNode_t *n, trav_arg_t *context) +int CF_TraverseTransactions(CF_CListNode_t *n, CF_Traverse_WriteFileArg_t *context) { CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); @@ -282,7 +282,7 @@ int CF_TraverseTransactions(CF_CListNode_t *n, trav_arg_t *context) *************************************************************************/ int32 CF_WriteQueueDataToFile(int32 fd, CF_Channel_t *c, CF_QueueIdx_t q) { - trav_arg_t arg = {fd, 0, 0}; + CF_Traverse_WriteFileArg_t arg = {fd, 0, 0}; CF_CList_Traverse(c->qs[q], (CF_CListFn_t)CF_TraverseTransactions, &arg); return arg.result; } @@ -300,7 +300,7 @@ int32 CF_WriteQueueDataToFile(int32 fd, CF_Channel_t *c, CF_QueueIdx_t q) *************************************************************************/ int32 CF_WriteHistoryQueueDataToFile(int32 fd, CF_Channel_t *c, CF_Direction_t dir) { - trav_arg_t arg = {fd, 0, 0}; + CF_Traverse_WriteFileArg_t arg = {fd, 0, 0}; CF_CList_Traverse(c->qs[CF_QueueIdx_HIST], (CF_CListFn_t)CF_TraverseHistory, &arg); return arg.result; } @@ -322,8 +322,8 @@ int32 CF_WriteHistoryQueueDataToFile(int32 fd, CF_Channel_t *c, CF_Direction_t d *************************************************************************/ int CF_PrioSearch(CF_CListNode_t *node, void *context) { - CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node); - priority_arg_t *p = (priority_arg_t *)context; + CF_Transaction_t *t = container_of(node, CF_Transaction_t, cl_node); + CF_Traverse_PriorityArg_t *p = (CF_Traverse_PriorityArg_t *)context; if (t->priority <= p->priority) { @@ -368,7 +368,7 @@ void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) } else { - priority_arg_t p = {NULL, t->priority}; + CF_Traverse_PriorityArg_t p = {NULL, t->priority}; CF_CList_Traverse_R(c->qs[q], CF_PrioSearch, &p); if (p.t) { @@ -402,7 +402,7 @@ void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) ** \endreturns ** *************************************************************************/ -int CF_TraverseAllTransactions_(CF_CListNode_t *n, traverse_all_args_t *args) +int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args) { CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); args->fn(t, args->context); @@ -423,10 +423,10 @@ int CF_TraverseAllTransactions_(CF_CListNode_t *n, traverse_all_args_t *args) *************************************************************************/ int CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context) { - traverse_all_args_t args = {fn, context, 0}; - CF_QueueIdx_t index; + CF_TraverseAll_Arg_t args = {fn, context, 0}; + CF_QueueIdx_t index; for (index = CF_QueueIdx_PEND; index <= CF_QueueIdx_RX; ++index) - CF_CList_Traverse(c->qs[index], (CF_CListFn_t)CF_TraverseAllTransactions_, &args); + CF_CList_Traverse(c->qs[index], (CF_CListFn_t)CF_TraverseAllTransactions_Impl, &args); return args.counter; } diff --git a/fsw/src/cf_utils.h b/fsw/src/cf_utils.h index 981dfb5d..9a98c13f 100644 --- a/fsw/src/cf_utils.h +++ b/fsw/src/cf_utils.h @@ -31,34 +31,34 @@ #include "cf_app.h" #include "cf_assert.h" -typedef struct trans_seq_arg_t +typedef struct CF_Traverse_TransSeqArg { CF_TransactionSeq_t transaction_sequence_number; CF_EntityId_t src_eid; CF_Transaction_t *t; /* out param */ -} trans_seq_arg_t; +} CF_Traverse_TransSeqArg_t; -typedef struct +typedef struct CF_Traverse_WriteFileArg { osal_id_t fd; int32 result; int32 counter; -} trav_arg_t; +} CF_Traverse_WriteFileArg_t; typedef void (*CF_TraverseAllTransactions_fn_t)(CF_Transaction_t *t, void *context); -typedef struct +typedef struct CF_TraverseAll_Arg { CF_TraverseAllTransactions_fn_t fn; void *context; int counter; -} traverse_all_args_t; +} CF_TraverseAll_Arg_t; -typedef struct priority_arg_t +typedef struct CF_Traverse_PriorityArg { CF_Transaction_t *t; /* OUT: holds value of transaction with which to call CF_CList_InsertAfter on */ uint8 priority; /* seeking this priority */ -} priority_arg_t; +} CF_Traverse_PriorityArg_t; /* free a transaction from the queue it's on. * NOTE: this leaves the transaction in a bad state, @@ -162,7 +162,7 @@ void CF_FreeTransaction(CF_Transaction_t *t); CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_TransactionSeq_t transaction_sequence_number, CF_EntityId_t src_eid); -int CF_FindTransactionBySequenceNumber_(CF_CListNode_t *n, trans_seq_arg_t *context); +int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context); int32 CF_WriteQueueDataToFile(int32 fd, CF_Channel_t *c, CF_QueueIdx_t q); int32 CF_WriteHistoryQueueDataToFile(int32 fd, CF_Channel_t *c, CF_Direction_t dir); @@ -173,9 +173,9 @@ void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q); int CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context); int CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context); -int CF_TraverseAllTransactions_(CF_CListNode_t *n, traverse_all_args_t *args); -int CF_TraverseHistory(CF_CListNode_t *n, trav_arg_t *context); -int CF_TraverseTransactions(CF_CListNode_t *n, trav_arg_t *context); +int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args); +int CF_TraverseHistory(CF_CListNode_t *n, CF_Traverse_WriteFileArg_t *context); +int CF_TraverseTransactions(CF_CListNode_t *n, CF_Traverse_WriteFileArg_t *context); int32 CF_WriteQueueDataToFile(int32 fd, CF_Channel_t *c, CF_QueueIdx_t q); int32 CF_WriteHistoryQueueDataToFile(int32 fd, CF_Channel_t *c, CF_Direction_t dir); diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index 957b837e..a2e409a6 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -848,10 +848,10 @@ void Test_CF_CFDP_R_SubstateSendNak(void) /* this requires the chunks list to be set up, and by default compute_gaps will return 0 (no gaps) so the transaction goes to complete */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); - t->flags.rx.md_recv = true; - t->chunks = &chunks; - chunks.chunks.count = 1; - chunks.chunks.CF_max_chunks = 2; + t->flags.rx.md_recv = true; + t->chunks = &chunks; + chunks.chunks.count = 1; + chunks.chunks.max_chunks = 2; UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), 0); UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 1); UtAssert_STUB_COUNT(CF_CFDP_SendNak, 2); /* did not increment */ @@ -861,10 +861,10 @@ void Test_CF_CFDP_R_SubstateSendNak(void) /* this also should use the max chunks instead of count */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); UT_SetDeferredRetcode(UT_KEY(CF_ChunkList_ComputeGaps), 1, 1); - t->flags.rx.md_recv = true; - t->chunks = &chunks; - chunks.chunks.count = 3; - chunks.chunks.CF_max_chunks = 2; + t->flags.rx.md_recv = true; + t->chunks = &chunks; + chunks.chunks.count = 3; + chunks.chunks.max_chunks = 2; UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), 0); UtAssert_STUB_COUNT(CF_CFDP_SendNak, 3); UtAssert_BOOL_TRUE(t->flags.rx.fd_nak_sent); diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index 242fceff..39ad5a0e 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -979,10 +979,10 @@ static int32 Ut_Hook_StateHandler_SetQIndex(void *UserObj, int32 StubRetcode, ui return StubRetcode; } -void Test_CF_CFDP_CycleTx_(void) +void Test_CF_CFDP_CycleTxFirstActive(void) { /* Test case for: - int CF_CFDP_CycleTx_(CF_CListNode_t *node, void *context); + int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context); */ CF_CFDP_CycleTx_args_t args; CF_Transaction_t *t; @@ -992,13 +992,13 @@ void Test_CF_CFDP_CycleTx_(void) /* suspended, should return 0 */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); t->flags.com.suspended = 1; - UtAssert_INT32_EQ(CF_CFDP_CycleTx_(&t->cl_node, &args), 0); + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&t->cl_node, &args), 0); /* nominal, with c->cur set non-null, should skip loop and return 1 */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.c, NULL, &t, NULL); t->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ args.c->cur = t; - UtAssert_INT32_EQ(CF_CFDP_CycleTx_(&t->cl_node, &args), 1); + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&t->cl_node, &args), 1); UtAssert_BOOL_TRUE(args.ran_one); /* nominal, with c->cur set null, should do loop and return 1 */ @@ -1009,7 +1009,7 @@ void Test_CF_CFDP_CycleTx_(void) t->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ args.c->cur = NULL; UT_SetHookFunction(UT_KEY(CF_CFDP_TxStateDispatch), Ut_Hook_StateHandler_SetQIndex, NULL); - UtAssert_INT32_EQ(CF_CFDP_CycleTx_(&t->cl_node, &args), 1); + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&t->cl_node, &args), 1); } static void DoTickFnClearCont(CF_Transaction_t *t, int *cont) @@ -1027,9 +1027,9 @@ void Test_CF_CFDP_DoTick(void) /* Test case for: * int CF_CFDP_DoTick(CF_CListNode_t *node, void *context); */ - CF_Transaction_t *t; - CF_Transaction_t t2; - tick_args_t args; + CF_Transaction_t *t; + CF_Transaction_t t2; + CF_CFDP_Tick_args_t args; memset(&args, 0, sizeof(args)); memset(&t2, 0, sizeof(t2)); @@ -1101,7 +1101,7 @@ void Test_CF_CFDP_ProcessPollingDirectories(void) UtAssert_BOOL_TRUE(poll->pb.busy); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); - /* make an error occur in CF_CFDP_PlaybackDir_() */ + /* make an error occur in CF_CFDP_PlaybackDir_Initiate() */ poll->pb.busy = false; /* above would have set it true */ poll->timer_set = true; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, true); @@ -1203,7 +1203,7 @@ void Test_CF_CFDP_ProcessPlaybackDirectory(void) static int32 Ut_Hook_TickTransactions_SetEarlyExit(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { - tick_args_t *args = UT_Hook_GetArgValueByName(Context, "context", tick_args_t *); + CF_CFDP_Tick_args_t *args = UT_Hook_GetArgValueByName(Context, "context", CF_CFDP_Tick_args_t *); /* set flag on the second call */ if ((CallCount & 1) == 1) @@ -1217,7 +1217,7 @@ static int32 Ut_Hook_TickTransactions_SetEarlyExit(void *UserObj, int32 StubRetc static int32 Ut_Hook_TickTransactions_SetCont(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { - tick_args_t *args = UT_Hook_GetArgValueByName(Context, "context", tick_args_t *); + CF_CFDP_Tick_args_t *args = UT_Hook_GetArgValueByName(Context, "context", CF_CFDP_Tick_args_t *); /* every other call do not set "cont" flag */ if ((CallCount & 1) == 0) @@ -1414,7 +1414,8 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_ProcessPollingDirectories, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "Test_CF_CFDP_ProcessPollingDirectories"); UtTest_Add(Test_CF_CFDP_CycleTx, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "Test_CF_CFDP_CycleTx"); - UtTest_Add(Test_CF_CFDP_CycleTx_, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "Test_CF_CFDP_CycleTx_"); + UtTest_Add(Test_CF_CFDP_CycleTxFirstActive, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, + "Test_CF_CFDP_CycleTxFirstActive"); 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"); diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index a9ef2fe4..ddf83712 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -934,7 +934,7 @@ void Test_CF_DoChanAction_ALL_CHANNELS_WhenAny_fn_returns_1_Return_1(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t *arg_cmd = &utbuf.ua; const char *arg_errstr = "CANNOT TEST SENT TO SEND EVENT"; - chan_action_fn_t arg_fn = &Dummy_chan_action_fn_t; + CF_ChanActionFn_t arg_fn = &Dummy_chan_action_fn_t; int dummy_context; void *arg_context = &dummy_context; uint8 random_fn_call = Any_uint8_LessThan(CF_NUM_CHANNELS) + 1; @@ -965,7 +965,7 @@ void Test_CF_DoChanAction_ALL_CHANNELS_WhenAll_fn_return_1_Return_1(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t *arg_cmd = &utbuf.ua; const char *arg_errstr = "CANNOT TEST SENT TO SEND EVENT"; - chan_action_fn_t arg_fn = &Dummy_chan_action_fn_t; + CF_ChanActionFn_t arg_fn = &Dummy_chan_action_fn_t; int dummy_context; void *arg_context = &dummy_context; int local_result; @@ -995,7 +995,7 @@ void Test_CF_DoChanAction_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t *arg_cmd = &utbuf.ua; const char *arg_errstr = "CANNOT TEST SENT TO SEND EVENT"; - chan_action_fn_t arg_fn = &Dummy_chan_action_fn_t; + CF_ChanActionFn_t arg_fn = &Dummy_chan_action_fn_t; int dummy_context; void *arg_context = &dummy_context; int local_result; @@ -1025,7 +1025,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t *arg_cmd = &utbuf.ua; const char *arg_errstr = "CANNOT TEST SENT TO SEND EVENT"; - chan_action_fn_t arg_fn = &Dummy_chan_action_fn_t; + CF_ChanActionFn_t arg_fn = &Dummy_chan_action_fn_t; int dummy_context; void *arg_context = &dummy_context; int local_result; @@ -1055,7 +1055,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t *arg_cmd = &utbuf.ua; const char *arg_errstr = "CANNOT TEST SENT TO SEND EVENT"; - chan_action_fn_t arg_fn = &Dummy_chan_action_fn_t; + CF_ChanActionFn_t arg_fn = &Dummy_chan_action_fn_t; int dummy_context; void *arg_context = &dummy_context; int local_result; @@ -1085,7 +1085,7 @@ void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendE CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t *arg_cmd = &utbuf.ua; const char *arg_errstr = "CANNOT TEST SENT TO SEND EVENT"; - chan_action_fn_t arg_fn = &Dummy_chan_action_fn_t; + CF_ChanActionFn_t arg_fn = &Dummy_chan_action_fn_t; int dummy_context; void *arg_context = &dummy_context; int local_result; @@ -1118,7 +1118,7 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t *arg_cmd = &utbuf.ua; const char *arg_errstr = "CANNOT TEST SENT TO SEND EVENT"; - chan_action_fn_t arg_fn = &Dummy_chan_action_fn_t; + CF_ChanActionFn_t arg_fn = &Dummy_chan_action_fn_t; int dummy_context; void *arg_context = &dummy_context; int local_result; @@ -1169,10 +1169,10 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) void Test_CF_DoFreezeThaw_Set_frozen_ToGiven_context_barg_AndReturn_0(void) { /* Arrange */ - uint8 arg_chan_num = Any_cf_channel(); - bool_arg_t dummy_context; - const bool_arg_t *arg_context; - int local_result; + uint8 arg_chan_num = Any_cf_channel(); + CF_ChanAction_BoolArg_t dummy_context; + const CF_ChanAction_BoolArg_t *arg_context; + int local_result; dummy_context.barg = Any_bool_arg_t_barg(); @@ -1564,11 +1564,11 @@ void Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid(void) /******************************************************************************* ** -** CF_DoSuspRes_ tests +** CF_DoSuspRes_Txn tests ** *******************************************************************************/ -void Test_CF_DoSuspRes__Asserts_t_Is_NULL(void) +void Test_CF_DoSuspRes_Txn_Asserts_t_Is_NULL(void) { // /* Arrange */ @@ -1576,15 +1576,15 @@ void Test_CF_DoSuspRes__Asserts_t_Is_NULL(void) // /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert"); -} /* end Test_CF_DoSuspRes__Asserts_t_Is_NULL */ +} /* end Test_CF_DoSuspRes_Txn_Asserts_t_Is_NULL */ -void Test_CF_DoSuspRes__Set_context_same_To_1_suspended_Eq_action(void) +void Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action(void) { /* Arrange */ - CF_Transaction_t dummy_t; - CF_Transaction_t *arg_t = &dummy_t; - susp_res_arg_t dummy_context; - susp_res_arg_t *arg_context = &dummy_context; + CF_Transaction_t dummy_t; + CF_Transaction_t *arg_t = &dummy_t; + CF_ChanAction_SuspResArg_t dummy_context; + CF_ChanAction_SuspResArg_t *arg_context = &dummy_context; /* set same to 0 to ensure change was done - not required for test, * but it is helpful for verification that the function did the change */ @@ -1594,20 +1594,20 @@ void Test_CF_DoSuspRes__Set_context_same_To_1_suspended_Eq_action(void) arg_t->flags.com.suspended = arg_context->action; /* Act */ - CF_DoSuspRes_(arg_t, arg_context); + CF_DoSuspRes_Txn(arg_t, arg_context); /* Assert */ - UtAssert_True(arg_context->same == 1, "CF_DoSuspRes_ set context->same to %d and should be 1 (direct set)", + 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__Set_context_same_To_1_suspended_Eq_action */ +} /* end Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action */ -void Test_CF_DoSuspRes__When_suspended_NotEqTo_action_Set_suspended_To_action(void) +void Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action(void) { /* Arrange */ - CF_Transaction_t dummy_t; - CF_Transaction_t *arg_t = &dummy_t; - susp_res_arg_t dummy_context; - susp_res_arg_t *arg_context = &dummy_context; + CF_Transaction_t dummy_t; + CF_Transaction_t *arg_t = &dummy_t; + CF_ChanAction_SuspResArg_t dummy_context; + CF_ChanAction_SuspResArg_t *arg_context = &dummy_context; /* set same to 0 to ensure change was done - not required for test, * but it is helpful for verification that the function did the change */ @@ -1617,13 +1617,13 @@ void Test_CF_DoSuspRes__When_suspended_NotEqTo_action_Set_suspended_To_action(vo arg_t->flags.com.suspended = !arg_context->action; /* Act */ - CF_DoSuspRes_(arg_t, arg_context); + CF_DoSuspRes_Txn(arg_t, arg_context); /* Assert */ UtAssert_True(arg_t->flags.com.suspended == arg_context->action, - "CF_DoSuspRes_ set arg_t->flags.com.suspended to %d and should be %d (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__When_suspended_NotEqTo_action_Set_suspended_To_action */ +} /* end Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action */ /******************************************************************************* ** @@ -1653,7 +1653,7 @@ void Test_CF_DoSuspRes_CallTo_CF_TsnChanAction_Returns_0_And_args_same_WasChange UT_SetDataBuffer(UT_KEY(CF_FindTransactionBySequenceNumber), &context_CF_FindTransactionBySequenceNumber, sizeof(context_CF_FindTransactionBySequenceNumber), false); - /* Arrange unstubbable: CF_DoSuspRes_ */ + /* Arrange unstubbable: CF_DoSuspRes_Txn */ dummy_t->flags.com.suspended = arg_action; /* Arrange unstubbable: CF_CmdRej */ @@ -1777,7 +1777,7 @@ void Test_CF_DoSuspRes_CallTo_CF_TsnChanAction_Returns_0_And_args_same_WasNotCha UT_SetDataBuffer(UT_KEY(CF_TraverseAllTransactions_All_Channels), &context_CF_TraverseAllTransactions_All_Channels, sizeof(context_CF_TraverseAllTransactions_All_Channels), false); - /* Arrange unstubbable: CF_DoSuspRes_ */ + /* Arrange unstubbable: CF_DoSuspRes_Txn */ dummy_t->flags.com.suspended = arg_action; /* Arrange unstubbable: CF_CmdAcc */ @@ -1884,11 +1884,11 @@ void Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0(void) /******************************************************************************* ** -** CF_CmdCancel_ tests +** CF_CmdCancel_Txn tests ** *******************************************************************************/ -void Test_CF_CmdCancel__Call_CF_CFDP_CancelTransaction_WithGiven_t(void) +void Test_CF_CmdCancel_Txn_Call_CF_CFDP_CancelTransaction_WithGiven_t(void) { /* Arrange */ CF_Transaction_t dummy_t; @@ -1900,12 +1900,12 @@ void Test_CF_CmdCancel__Call_CF_CFDP_CancelTransaction_WithGiven_t(void) sizeof(context_CF_CFDP_CancelTransaction), false); /* Act */ - CF_CmdCancel_(arg_t, arg_ignored); + CF_CmdCancel_Txn(arg_t, arg_ignored); /* Assert */ UtAssert_ADDRESS_EQ(context_CF_CFDP_CancelTransaction, arg_t); -} /* end Test_CF_CmdCancel__Call_CF_CFDP_CancelTransaction_WithGiven_t */ +} /* end Test_CF_CmdCancel_Txn_Call_CF_CFDP_CancelTransaction_WithGiven_t */ /******************************************************************************* ** @@ -1945,8 +1945,8 @@ void Test_CF_CmdCancel_Call_CF_CmdCond_WithNotted_CF_TsnChanAction(void) /* Assert for CF_TsnChanAction */ UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); UtAssert_ADDRESS_EQ(context_CF_TraverseAllTransactions.c, CF_AppData.engine.channels + dummy_msg->chan); - UtAssert_True(context_CF_TraverseAllTransactions.fn == CF_CmdCancel_, - "context_CF_TraverseAllTransactions.fn == CF_CmdCancel_"); + UtAssert_True(context_CF_TraverseAllTransactions.fn == CF_CmdCancel_Txn, + "context_CF_TraverseAllTransactions.fn == CF_CmdCancel_Txn"); UtAssert_ADDRESS_EQ(context_CF_TraverseAllTransactions.context, NULL); /* Assert for CF_CmdRej */ UtAssert_True(CF_AppData.hk.counters.err == (uint16)(initial_hk_err_counter + 1), @@ -1956,11 +1956,11 @@ void Test_CF_CmdCancel_Call_CF_CmdCond_WithNotted_CF_TsnChanAction(void) /******************************************************************************* ** -** CF_CmdAbandon_ tests +** CF_CmdAbandon_Txn tests ** *******************************************************************************/ -void Test_CF_CmdAbandon__Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void) +void Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void) { /* Arrange */ CF_Transaction_t dummy_t; @@ -1972,7 +1972,7 @@ void Test_CF_CmdAbandon__Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void) sizeof(context_CF_CFDP_ResetTransaction), false); /* Act */ - CF_CmdAbandon_(arg_t, arg_ignored); + CF_CmdAbandon_Txn(arg_t, arg_ignored); /* Assert */ UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.t, arg_t); @@ -1980,7 +1980,7 @@ void Test_CF_CmdAbandon__Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void) "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__Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0 */ +} /* end Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0 */ /******************************************************************************* ** @@ -2020,8 +2020,8 @@ void Test_CF_CmdAbandon_Call_CF_CmdCond_WithNotted_CF_TsnChanAction(void) /* Assert for CF_TsnChanAction */ UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); UtAssert_ADDRESS_EQ(context_CF_TraverseAllTransactions.c, CF_AppData.engine.channels + dummy_msg->chan); - UtAssert_True(context_CF_TraverseAllTransactions.fn == CF_CmdAbandon_, - "context_CF_TraverseAllTransactions.fn == CF_CmdAbandon_"); + UtAssert_True(context_CF_TraverseAllTransactions.fn == CF_CmdAbandon_Txn, + "context_CF_TraverseAllTransactions.fn == CF_CmdAbandon_Txn"); UtAssert_ADDRESS_EQ(context_CF_TraverseAllTransactions.context, NULL); /* Assert for CF_CmdRej */ UtAssert_True(CF_AppData.hk.counters.err == (uint16)(initial_hk_err_counter + 1), @@ -2038,10 +2038,10 @@ void Test_CF_CmdAbandon_Call_CF_CmdCond_WithNotted_CF_TsnChanAction(void) void Test_CF_DoEnableDisableDequeue_Set_chan_num_EnabledFlagTo_context_barg(void) { /* Arrange */ - CF_ConfigTable_t dummy_config_table; - uint8 arg_chan_num = Any_cf_channel(); - bool_arg_t dummy_context; - bool_arg_t *arg_context = &dummy_context; + CF_ConfigTable_t dummy_config_table; + uint8 arg_chan_num = Any_cf_channel(); + CF_ChanAction_BoolArg_t dummy_context; + CF_ChanAction_BoolArg_t *arg_context = &dummy_context; CF_AppData.config_table = &dummy_config_table; dummy_context.barg = Any_bool_arg_t_barg(); @@ -2152,14 +2152,14 @@ void Test_CF_CmdDisableDequeue_Call_CmdCond_WithResultsOf_CF_DoChanAction(void) void Test_CF_DoEnableDisablePolldir_When_ALL_CHANNELS_SetAllPolldirsInChannelEnabledTo_context_barg(void) { /* Arrange */ - uint8 arg_chan_num = Any_cf_channel(); - CF_UT_cmd_unionargs_buf_t utbuf; - CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; - bool_msg_arg_t dummy_context; - bool_msg_arg_t *arg_context = &dummy_context; - CF_ConfigTable_t dummy_config_table; - uint8 expected_enabled; - int local_result; + uint8 arg_chan_num = Any_cf_channel(); + CF_UT_cmd_unionargs_buf_t utbuf; + CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; + CF_ChanAction_BoolMsgArg_t dummy_context; + CF_ChanAction_BoolMsgArg_t *arg_context = &dummy_context; + CF_ConfigTable_t dummy_config_table; + uint8 expected_enabled; + int local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -2190,15 +2190,15 @@ void Test_CF_DoEnableDisablePolldir_When_ALL_CHANNELS_SetAllPolldirsInChannelEna void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_context_ChannelEnabledTo_context_barg(void) { /* Arrange */ - uint8 arg_chan_num = Any_cf_channel(); - uint8 dummy_polldir = Any_cf_polldir(); - CF_UT_cmd_unionargs_buf_t utbuf; - CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; - bool_msg_arg_t dummy_context; - bool_msg_arg_t *arg_context = &dummy_context; - CF_ConfigTable_t dummy_config_table; - uint8 expected_enabled; - int local_result; + uint8 arg_chan_num = Any_cf_channel(); + uint8 dummy_polldir = Any_cf_polldir(); + CF_UT_cmd_unionargs_buf_t utbuf; + CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; + CF_ChanAction_BoolMsgArg_t dummy_context; + CF_ChanAction_BoolMsgArg_t *arg_context = &dummy_context; + CF_ConfigTable_t dummy_config_table; + uint8 expected_enabled; + int local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -2224,13 +2224,13 @@ void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_conte void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_AndSendEvent(void) { /* Arrange */ - uint8 arg_chan_num = Any_cf_channel(); - CF_UT_cmd_unionargs_buf_t utbuf; - CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; - bool_msg_arg_t dummy_context; - bool_msg_arg_t *arg_context = &dummy_context; - CF_ConfigTable_t dummy_config_table; - int local_result; + uint8 arg_chan_num = Any_cf_channel(); + CF_UT_cmd_unionargs_buf_t utbuf; + CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; + CF_ChanAction_BoolMsgArg_t dummy_context; + CF_ChanAction_BoolMsgArg_t *arg_context = &dummy_context; + CF_ConfigTable_t dummy_config_table; + int local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -2255,13 +2255,13 @@ void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_An void Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent(void) { /* Arrange */ - uint8 arg_chan_num = Any_cf_channel(); - CF_UT_cmd_unionargs_buf_t utbuf; - CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; - bool_msg_arg_t dummy_context; - bool_msg_arg_t *arg_context = &dummy_context; - CF_ConfigTable_t dummy_config_table; - int local_result; + uint8 arg_chan_num = Any_cf_channel(); + CF_UT_cmd_unionargs_buf_t utbuf; + CF_UnionArgsCmd_t *dummy_msg = &utbuf.ua; + CF_ChanAction_BoolMsgArg_t dummy_context; + CF_ChanAction_BoolMsgArg_t *arg_context = &dummy_context; + CF_ConfigTable_t dummy_config_table; + int local_result; memset(&utbuf, 0, sizeof(utbuf)); @@ -5085,15 +5085,15 @@ void add_CF_TsnChanAction_tests(void) "Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid"); } /* end add_CF_TsnChanAction_tests */ -void add_CF_DoSuspRes__tests(void) +void add_CF_DoSuspRes_Txn_tests(void) { - UtTest_Add(Test_CF_DoSuspRes__Asserts_t_Is_NULL, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, - "Test_CF_DoSuspRes__Asserts_t_Is_NULL"); - UtTest_Add(Test_CF_DoSuspRes__Set_context_same_To_1_suspended_Eq_action, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, - "Test_CF_DoSuspRes__Set_context_same_To_1_suspended_Eq_action"); - UtTest_Add(Test_CF_DoSuspRes__When_suspended_NotEqTo_action_Set_suspended_To_action, cf_cmd_tests_Setup, - cf_cmd_tests_Teardown, "Test_CF_DoSuspRes__When_suspended_NotEqTo_action_Set_suspended_To_action"); -} /* end add_CF_DoSuspRes__tests */ + UtTest_Add(Test_CF_DoSuspRes_Txn_Asserts_t_Is_NULL, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, + "Test_CF_DoSuspRes_Txn_Asserts_t_Is_NULL"); + UtTest_Add(Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action, cf_cmd_tests_Setup, + 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) { @@ -5127,11 +5127,11 @@ void add_CF_CmdResume_tests(void) cf_cmd_tests_Teardown, "Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0"); } /* end add_CF_CmdResume_tests */ -void add_CF_CmdCancel__tests(void) +void add_CF_CmdCancel_Txn_tests(void) { - UtTest_Add(Test_CF_CmdCancel__Call_CF_CFDP_CancelTransaction_WithGiven_t, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, - "Test_CF_CmdCancel__Call_CF_CFDP_CancelTransaction_WithGiven_t"); -} /* end add_CF_CF_CmdCancel__tests */ + 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) { @@ -5139,17 +5139,17 @@ void add_CF_CmdCancel_tests(void) "Test_CF_CmdCancel_Call_CF_CmdCond_WithNotted_CF_TsnChanAction"); } /* end add_CF_CmdCancel_tests */ -void add_CF_CmdAbandon__tests(void) +void add_CF_CmdAbandon_Txn_tests(void) { - UtTest_Add(Test_CF_CmdAbandon__Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0, cf_cmd_tests_Setup, - cf_cmd_tests_Teardown, "Test_CF_CmdAbandon__Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0"); -} /* end add_CF_CmdAbandon__tests */ + 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_Call_CF_CmdCond_WithNotted_CF_TsnChanAction, cf_cmd_tests_Setup, cf_cmd_tests_Teardown, "Test_CF_CmdAbandon_Call_CF_CmdCond_WithNotted_CF_TsnChanAction"); -} /* end add_CF_CmdAbandon__tests */ +} /* end add_CF_CmdAbandon_Txn_tests */ void add_CF_DoEnableDisableDequeue_tests(void) { @@ -5467,7 +5467,7 @@ void UtTest_Setup(void) add_CF_TsnChanAction_tests(); - add_CF_DoSuspRes__tests(); + add_CF_DoSuspRes_Txn_tests(); add_CF_DoSuspRes_tests(); @@ -5475,11 +5475,11 @@ void UtTest_Setup(void) add_CF_CmdResume_tests(); - add_CF_CmdCancel__tests(); + add_CF_CmdCancel_Txn_tests(); add_CF_CmdCancel_tests(); - add_CF_CmdAbandon__tests(); + add_CF_CmdAbandon_Txn_tests(); add_CF_CmdAbandon_tests(); diff --git a/unit-test/cf_utils_tests.c b/unit-test/cf_utils_tests.c index a0952742..edfb53a4 100644 --- a/unit-test/cf_utils_tests.c +++ b/unit-test/cf_utils_tests.c @@ -92,8 +92,8 @@ static void UT_Callback_CF_TraverseAllTransactions(CF_Transaction_t *t, void *co static void UT_AltHandler_CF_CList_Traverse_SeqArg_SetTxn(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { - trans_seq_arg_t *arg = UT_Hook_GetArgValueByName(Context, "context", trans_seq_arg_t *); - arg->t = UserObj; + CF_Traverse_TransSeqArg_t *arg = UT_Hook_GetArgValueByName(Context, "context", CF_Traverse_TransSeqArg_t *); + arg->t = UserObj; } /******************************************************************************* @@ -165,14 +165,14 @@ void Test_CF_FreeTransaction(void) UtAssert_UINT32_EQ(t->flags.com.q_index, CF_QueueIdx_FREE); } -void Test_CF_FindTransactionBySequenceNumber_(void) +void Test_CF_FindTransactionBySequenceNumber_Impl(void) { /* Test case for: - * int CF_FindTransactionBySequenceNumber_(CF_CListNode_t *n, trans_seq_arg_t *context) + * int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context) */ - trans_seq_arg_t ctxt; - CF_Transaction_t txn; - CF_History_t hist; + CF_Traverse_TransSeqArg_t ctxt; + CF_Transaction_t txn; + CF_History_t hist; memset(&txn, 0, sizeof(txn)); memset(&hist, 0, sizeof(hist)); @@ -185,7 +185,7 @@ void Test_CF_FindTransactionBySequenceNumber_(void) ctxt.src_eid = 34; hist.seq_num = 56; ctxt.transaction_sequence_number = 78; - UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_(&txn.cl_node, &ctxt), 0); + UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 0); UtAssert_NULL(ctxt.t); /* matching eid and non-matching sequence */ @@ -193,7 +193,7 @@ void Test_CF_FindTransactionBySequenceNumber_(void) ctxt.src_eid = 13; hist.seq_num = 56; ctxt.transaction_sequence_number = 78; - UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_(&txn.cl_node, &ctxt), 0); + UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 0); UtAssert_NULL(ctxt.t); /* non-matching eid and matching sequence */ @@ -201,7 +201,7 @@ void Test_CF_FindTransactionBySequenceNumber_(void) ctxt.src_eid = 34; hist.seq_num = 57; ctxt.transaction_sequence_number = 57; - UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_(&txn.cl_node, &ctxt), 0); + UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 0); UtAssert_NULL(ctxt.t); /* matching eid and matching sequence */ @@ -209,7 +209,7 @@ void Test_CF_FindTransactionBySequenceNumber_(void) ctxt.src_eid = 23; hist.seq_num = 67; ctxt.transaction_sequence_number = 67; - UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_(&txn.cl_node, &ctxt), 1); + UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 1); UtAssert_ADDRESS_EQ(ctxt.t, &txn); } @@ -544,8 +544,8 @@ void Test_CF_TraverseHistory_AssertsBecause_h_dir_GreaterThan_CF_DIR_NUM(void) // /* Arrange */ // CF_History_t dummy_h; // CF_CListNode_t * arg_n = &dummy_h.cl_node; - // trav_arg_t dummy_context; - // trav_arg_t* arg_context = &dummy_context; + // CF_Traverse_WriteFileArg_t dummy_context; + // CF_Traverse_WriteFileArg_t* arg_context = &dummy_context; // // dummy_h.src_eid = Any_uint8(); // dummy_h.seq_num = Any_uint32(); @@ -564,13 +564,13 @@ void Test_CF_TraverseHistory_AssertsBecause_h_dir_GreaterThan_CF_DIR_NUM(void) void Test_CF_TraverseHistory_When_CF_WrappedWrite_FailsFirstCallReturn_CLIST_EXIT(void) { /* Arrange */ - CF_History_t dummy_h; - CF_CListNode_t *arg_n = &dummy_h.cl_node; - trav_arg_t dummy_context; - trav_arg_t *arg_context = &dummy_context; - char src_colon_str[6] = "SRC: "; /* duplicates function value */ - uint8 dummy_len; - int local_result; + CF_History_t dummy_h; + CF_CListNode_t *arg_n = &dummy_h.cl_node; + CF_Traverse_WriteFileArg_t dummy_context; + CF_Traverse_WriteFileArg_t *arg_context = &dummy_context; + char src_colon_str[6] = "SRC: "; /* duplicates function value */ + uint8 dummy_len; + int local_result; dummy_h.src_eid = Any_uint8(); dummy_h.seq_num = Any_uint32(); @@ -603,15 +603,15 @@ void Test_CF_TraverseHistory_When_CF_WrappedWrite_FailsFirstCallReturn_CLIST_EXI void Test_CF_TraverseHistory_When_CF_WrappedWrite_FailsSecondCallReturn_CLIST_EXIT(void) { /* Arrange */ - CF_History_t dummy_h; - CF_CListNode_t *arg_n = &dummy_h.cl_node; - trav_arg_t dummy_context; - trav_arg_t *arg_context = &dummy_context; - char src_colon_str[6] = "SRC: "; /* duplicates function value */ - char dst_colon_str[6] = "DST: "; /* duplicates function value */ - uint8 dummy_len_src; - uint8 dummy_len_dst; - int local_result; + CF_History_t dummy_h; + CF_CListNode_t *arg_n = &dummy_h.cl_node; + CF_Traverse_WriteFileArg_t dummy_context; + CF_Traverse_WriteFileArg_t *arg_context = &dummy_context; + char src_colon_str[6] = "SRC: "; /* duplicates function value */ + char dst_colon_str[6] = "DST: "; /* duplicates function value */ + uint8 dummy_len_src; + uint8 dummy_len_dst; + int local_result; dummy_h.src_eid = Any_uint8(); dummy_h.seq_num = Any_uint32(); @@ -646,15 +646,15 @@ void Test_CF_TraverseHistory_When_CF_WrappedWrite_FailsSecondCallReturn_CLIST_EX void Test_CF_TraverseHistory_WhenBothWrappedWritesSuccessfulReturn_CLIST_CONT(void) { /* Arrange */ - CF_History_t dummy_h; - CF_CListNode_t *arg_n = &dummy_h.cl_node; - trav_arg_t dummy_context; - trav_arg_t *arg_context = &dummy_context; - char src_colon_str[6] = "SRC: "; /* duplicates function value */ - char dst_colon_str[6] = "DST: "; /* duplicates function value */ - uint8 dummy_len_src; - uint8 dummy_len_dst; - int local_result; + CF_History_t dummy_h; + CF_CListNode_t *arg_n = &dummy_h.cl_node; + CF_Traverse_WriteFileArg_t dummy_context; + CF_Traverse_WriteFileArg_t *arg_context = &dummy_context; + char src_colon_str[6] = "SRC: "; /* duplicates function value */ + char dst_colon_str[6] = "DST: "; /* duplicates function value */ + uint8 dummy_len_src; + uint8 dummy_len_dst; + int local_result; dummy_h.src_eid = Any_uint8(); dummy_h.seq_num = Any_uint32(); @@ -697,12 +697,12 @@ void Test_CF_TraverseHistory_WhenBothWrappedWritesSuccessfulReturn_CLIST_CONT(vo void Test_CF_TraverseTransactions_When_context_result_Is_1_Return_CLIST_EXIT(void) { /* Arrange */ - CF_History_t dummy_history; - CF_Transaction_t dummy_t; - CF_CListNode_t *arg_n = &dummy_t.cl_node; - trav_arg_t dummy_context; - trav_arg_t *arg_context = &dummy_context; - int local_result; + CF_History_t dummy_history; + CF_Transaction_t dummy_t; + CF_CListNode_t *arg_n = &dummy_t.cl_node; + CF_Traverse_WriteFileArg_t dummy_context; + CF_Traverse_WriteFileArg_t *arg_context = &dummy_context; + int local_result; /* Arrange for CF_TraverseHistory in same file as CF_TraverseTransactions */ @@ -732,12 +732,12 @@ void Test_CF_TraverseTransactions_When_context_result_Is_1_Return_CLIST_EXIT(voi void Test_CF_TraverseTransactions_When_context_result_Is_0_Return_CLIST_CONT(void) { /* Arrange */ - CF_History_t dummy_history; - CF_Transaction_t dummy_t; - CF_CListNode_t *arg_n = &dummy_t.cl_node; - trav_arg_t dummy_context; - trav_arg_t *arg_context = &dummy_context; - int local_result; + CF_History_t dummy_history; + CF_Transaction_t dummy_t; + CF_CListNode_t *arg_n = &dummy_t.cl_node; + CF_Traverse_WriteFileArg_t dummy_context; + CF_Traverse_WriteFileArg_t *arg_context = &dummy_context; + int local_result; arg_context->result = 0; /* ensures arg_context->result starts at 0 */ @@ -870,11 +870,11 @@ void Test_CF_WriteHistoryQueueDataToFile_Call_CF_CList_Traverse_AndReturn_arg_re void Test_CF_PrioSearch_When_t_PrioIsGreaterThanContextPrioReturn_CLIST_CONT(void) { /* Arrange */ - CF_Transaction_t dummy_t; - CF_CListNode_t *arg_node = &dummy_t.cl_node; - priority_arg_t dummy_p; - void *arg_context = (void *)&dummy_p; - int32 result; + CF_Transaction_t dummy_t; + CF_CListNode_t *arg_node = &dummy_t.cl_node; + CF_Traverse_PriorityArg_t dummy_p; + void *arg_context = (void *)&dummy_p; + int32 result; dummy_t.priority = Any_uint8_Except(0); dummy_p.priority = Any_uint8_LessThan(dummy_t.priority); @@ -891,11 +891,11 @@ void Test_CF_PrioSearch_When_t_PrioIsGreaterThanContextPrioReturn_CLIST_CONT(voi void Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT(void) { /* Arrange */ - CF_Transaction_t dummy_t; - CF_CListNode_t *arg_node = &dummy_t.cl_node; - priority_arg_t dummy_p; - void *arg_context = (void *)&dummy_p; - int32 result; + CF_Transaction_t dummy_t; + CF_CListNode_t *arg_node = &dummy_t.cl_node; + CF_Traverse_PriorityArg_t dummy_p; + void *arg_context = (void *)&dummy_p; + int32 result; /* NOTE: these are inverted from previous test! */ dummy_t.priority = Any_uint8_Except(0); @@ -914,11 +914,11 @@ void Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndRetur void Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT(void) { /* Arrange */ - CF_Transaction_t dummy_t; - CF_CListNode_t *arg_node = &dummy_t.cl_node; - priority_arg_t dummy_p; - void *arg_context = (void *)&dummy_p; - int32 result; + CF_Transaction_t dummy_t; + CF_CListNode_t *arg_node = &dummy_t.cl_node; + CF_Traverse_PriorityArg_t dummy_p; + void *arg_context = (void *)&dummy_p; + int32 result; /* NOTE: these are inverted from previous test! */ dummy_p.priority = Any_uint8_Except(0); @@ -1027,7 +1027,7 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q(voi dummy_c = &CF_AppData.engine.channels[arg_t->chan_num]; dummy_c->qs[arg_q] = (CF_CListNode_t *)&dummy_qs; - /* setup priority_arg_t altered value */ + /* setup CF_Traverse_PriorityArg_t altered value */ context_cf_clist_traverse_r.context_t = &dummy_p_t; /* Arrange for CF_CList_InsertAfter_Ex */ @@ -1084,7 +1084,7 @@ void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) dummy_c = &CF_AppData.engine.channels[arg_t->chan_num]; dummy_c->qs[arg_q] = (CF_CListNode_t *)&dummy_qs; - /* setup priority_arg_t altered value */ + /* setup CF_Traverse_PriorityArg_t altered value */ context_cf_clist_traverse_r.context_t = NULL; /* set expected values */ @@ -1117,23 +1117,23 @@ void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) /******************************************************************************* ** -** CF_TraverseAllTransactions_ tests +** CF_TraverseAllTransactions_Impl tests ** *******************************************************************************/ -void Test_CF_TraverseAllTransactions__GetContainer_t_Call_args_fn_AndAdd_1_ToCounter(void) +void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_ToCounter(void) { /* Arrange */ - CF_Transaction_t dummy_t; - CF_CListNode_t *arg_n = &dummy_t.cl_node; - traverse_all_args_t dummy_args; - traverse_all_args_t *arg_args; - int dummy_context_val; - void *dummy_context = &dummy_context_val; - int initial_args_counter = Any_int(); - CF_Transaction_t *expected_t; - void *expected_context; - int32 result; + CF_Transaction_t dummy_t; + CF_CListNode_t *arg_n = &dummy_t.cl_node; + CF_TraverseAll_Arg_t dummy_args; + CF_TraverseAll_Arg_t *arg_args; + int dummy_context_val; + void *dummy_context = &dummy_context_val; + int initial_args_counter = Any_int(); + CF_Transaction_t *expected_t; + void *expected_context; + int32 result; dummy_args.fn = UT_Callback_CF_TraverseAllTransactions; dummy_args.context = dummy_context; @@ -1150,18 +1150,19 @@ void Test_CF_TraverseAllTransactions__GetContainer_t_Call_args_fn_AndAdd_1_ToCou false); /* Act */ - result = CF_TraverseAllTransactions_(arg_n, arg_args); + result = CF_TraverseAllTransactions_Impl(arg_n, arg_args); /* Assert */ UtAssert_ADDRESS_EQ(func_ptr_context.t, expected_t); UtAssert_ADDRESS_EQ(func_ptr_context.context, expected_context); UtAssert_True(arg_args->counter == initial_args_counter + 1, - "CF_TraverseAllTransactions_ set args->counter to %d which is 1 more than initial value %d", + "CF_TraverseAllTransactions_Impl set args->counter to %d which is 1 more than initial value %d", arg_args->counter, initial_args_counter); - UtAssert_True(result == CF_CLIST_CONT, "CF_TraverseAllTransactions_ returned %d and should be %d (CF_CLIST_CONT)", - result, CF_CLIST_CONT); + UtAssert_True(result == CF_CLIST_CONT, + "CF_TraverseAllTransactions_Impl returned %d and should be %d (CF_CLIST_CONT)", result, + CF_CLIST_CONT); -} /* end Test_CF_TraverseAllTransactions__GetContainer_t_Call_args_fn_AndAdd_1_ToCounter */ +} /* end Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_ToCounter */ /******************************************************************************* ** @@ -1205,8 +1206,8 @@ void Test_CF_TraverseAllTransactions_CallOtherFunction_CF_Q_RX_TimesAndReturn_ar for (i = 0; i < expected_count; ++i) { UtAssert_ADDRESS_EQ(contexts_cf_clist_traverse[i].start, (CF_CListNode_t *)&expected_qs_nodes[i]); - UtAssert_True(contexts_cf_clist_traverse[i].fn == (CF_CListFn_t)CF_TraverseAllTransactions_, - "contexts_cf_clist_traverse[i].fn == (CF_CListFn_t ) CF_TraverseAllTransactions_"); + UtAssert_True(contexts_cf_clist_traverse[i].fn == (CF_CListFn_t)CF_TraverseAllTransactions_Impl, + "contexts_cf_clist_traverse[i].fn == (CF_CListFn_t ) CF_TraverseAllTransactions_Impl"); UtAssert_True(contexts_cf_clist_traverse[i].context_fn == UT_Callback_CF_TraverseAllTransactions, "contexts_cf_clist_traverse[i].context_fn == UT_Callback_CF_TraverseAllTransactions"); UtAssert_ADDRESS_EQ(contexts_cf_clist_traverse[i].context_context, arg_context); @@ -1421,8 +1422,8 @@ void add_cf_utils_h_tests(void) UtTest_Add(Test_CF_FindUnusedTransaction, cf_utils_tests_Setup, cf_utils_tests_Teardown, "CF_FindUnusedTransaction"); UtTest_Add(Test_CF_FreeTransaction, cf_utils_tests_Setup, cf_utils_tests_Teardown, "CF_FreeTransaction"); - UtTest_Add(Test_CF_FindTransactionBySequenceNumber_, cf_utils_tests_Setup, cf_utils_tests_Teardown, - "Test_CF_FindTransactionBySequenceNumber_"); + UtTest_Add(Test_CF_FindTransactionBySequenceNumber_Impl, cf_utils_tests_Setup, cf_utils_tests_Teardown, + "CF_FindTransactionBySequenceNumber_Impl"); UtTest_Add(Test_CF_FindTransactionBySequenceNumber, cf_utils_tests_Setup, cf_utils_tests_Teardown, "CF_FindTransactionBySequenceNumber"); @@ -1528,11 +1529,11 @@ void add_CF_InsertSortPrio_tests(void) cf_utils_tests_Teardown, "Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex"); } -void add_CF_TraverseAllTransactions__tests(void) +void add_CF_TraverseAllTransactions_Impl_tests(void) { - UtTest_Add(Test_CF_TraverseAllTransactions__GetContainer_t_Call_args_fn_AndAdd_1_ToCounter, cf_utils_tests_Setup, - cf_utils_tests_Teardown, - "Test_CF_TraverseAllTransactions__GetContainer_t_Call_args_fn_AndAdd_1_ToCounter"); + UtTest_Add(Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_ToCounter, + cf_utils_tests_Setup, cf_utils_tests_Teardown, + "Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_ToCounter"); } void add_CF_TraverseAllTransactions_tests(void) @@ -1605,7 +1606,7 @@ void UtTest_Setup(void) add_CF_InsertSortPrio_tests(); - add_CF_TraverseAllTransactions__tests(); + add_CF_TraverseAllTransactions_Impl_tests(); add_CF_TraverseAllTransactions_tests(); diff --git a/unit-test/stubs/cf_cfdp_stubs.c b/unit-test/stubs/cf_cfdp_stubs.c index 457346ce..691d36b6 100644 --- a/unit-test/stubs/cf_cfdp_stubs.c +++ b/unit-test/stubs/cf_cfdp_stubs.c @@ -160,19 +160,19 @@ void CF_CFDP_CycleTx(CF_Channel_t *c) /* * ---------------------------------------------------- - * Generated stub function for CF_CFDP_CycleTx_() + * Generated stub function for CF_CFDP_CycleTxFirstActive() * ---------------------------------------------------- */ -int CF_CFDP_CycleTx_(CF_CListNode_t *node, void *context) +int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) { - UT_GenStub_SetupReturnBuffer(CF_CFDP_CycleTx_, int); + UT_GenStub_SetupReturnBuffer(CF_CFDP_CycleTxFirstActive, int); - UT_GenStub_AddParam(CF_CFDP_CycleTx_, CF_CListNode_t *, node); - UT_GenStub_AddParam(CF_CFDP_CycleTx_, void *, context); + UT_GenStub_AddParam(CF_CFDP_CycleTxFirstActive, CF_CListNode_t *, node); + UT_GenStub_AddParam(CF_CFDP_CycleTxFirstActive, void *, context); - UT_GenStub_Execute(CF_CFDP_CycleTx_, Basic, NULL); + UT_GenStub_Execute(CF_CFDP_CycleTxFirstActive, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_CFDP_CycleTx_, int); + return UT_GenStub_GetReturnValue(CF_CFDP_CycleTxFirstActive, int); } /* diff --git a/unit-test/stubs/cf_chunk_stubs.c b/unit-test/stubs/cf_chunk_stubs.c index 5fc91ff5..13c26cc7 100644 --- a/unit-test/stubs/cf_chunk_stubs.c +++ b/unit-test/stubs/cf_chunk_stubs.c @@ -54,10 +54,10 @@ void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSi * Generated stub function for CF_ChunkListInit() * ---------------------------------------------------- */ -void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t CF_max_chunks, CF_Chunk_t *chunks_mem) +void CF_ChunkListInit(CF_ChunkList_t *chunks, CF_ChunkIdx_t max_chunks, CF_Chunk_t *chunks_mem) { UT_GenStub_AddParam(CF_ChunkListInit, CF_ChunkList_t *, chunks); - UT_GenStub_AddParam(CF_ChunkListInit, CF_ChunkIdx_t, CF_max_chunks); + UT_GenStub_AddParam(CF_ChunkListInit, CF_ChunkIdx_t, max_chunks); UT_GenStub_AddParam(CF_ChunkListInit, CF_Chunk_t *, chunks_mem); UT_GenStub_Execute(CF_ChunkListInit, Basic, NULL); diff --git a/unit-test/stubs/cf_cmd_stubs.c b/unit-test/stubs/cf_cmd_stubs.c index e3721df3..855197ca 100644 --- a/unit-test/stubs/cf_cmd_stubs.c +++ b/unit-test/stubs/cf_cmd_stubs.c @@ -44,15 +44,15 @@ void CF_CmdAbandon(CFE_SB_Buffer_t *msg) /* * ---------------------------------------------------- - * Generated stub function for CF_CmdAbandon_() + * Generated stub function for CF_CmdAbandon_Txn() * ---------------------------------------------------- */ -void CF_CmdAbandon_(CF_Transaction_t *t, void *ignored) +void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored) { - UT_GenStub_AddParam(CF_CmdAbandon_, CF_Transaction_t *, t); - UT_GenStub_AddParam(CF_CmdAbandon_, void *, ignored); + UT_GenStub_AddParam(CF_CmdAbandon_Txn, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CmdAbandon_Txn, void *, ignored); - UT_GenStub_Execute(CF_CmdAbandon_, Basic, NULL); + UT_GenStub_Execute(CF_CmdAbandon_Txn, Basic, NULL); } /* @@ -69,15 +69,15 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg) /* * ---------------------------------------------------- - * Generated stub function for CF_CmdCancel_() + * Generated stub function for CF_CmdCancel_Txn() * ---------------------------------------------------- */ -void CF_CmdCancel_(CF_Transaction_t *t, void *ignored) +void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored) { - UT_GenStub_AddParam(CF_CmdCancel_, CF_Transaction_t *, t); - UT_GenStub_AddParam(CF_CmdCancel_, void *, ignored); + UT_GenStub_AddParam(CF_CmdCancel_Txn, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CmdCancel_Txn, void *, ignored); - UT_GenStub_Execute(CF_CmdCancel_, Basic, NULL); + UT_GenStub_Execute(CF_CmdCancel_Txn, Basic, NULL); } /* @@ -362,13 +362,13 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) * Generated stub function for CF_DoChanAction() * ---------------------------------------------------- */ -int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t fn, void *context) +int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_ChanActionFn_t fn, void *context) { UT_GenStub_SetupReturnBuffer(CF_DoChanAction, int); UT_GenStub_AddParam(CF_DoChanAction, CF_UnionArgsCmd_t *, cmd); UT_GenStub_AddParam(CF_DoChanAction, const char *, errstr); - UT_GenStub_AddParam(CF_DoChanAction, chan_action_fn_t, fn); + UT_GenStub_AddParam(CF_DoChanAction, CF_ChanActionFn_t, fn); UT_GenStub_AddParam(CF_DoChanAction, void *, context); UT_GenStub_Execute(CF_DoChanAction, Basic, NULL); @@ -381,12 +381,12 @@ int CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, chan_action_fn_t * Generated stub function for CF_DoEnableDisableDequeue() * ---------------------------------------------------- */ -int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context) +int CF_DoEnableDisableDequeue(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) { UT_GenStub_SetupReturnBuffer(CF_DoEnableDisableDequeue, int); UT_GenStub_AddParam(CF_DoEnableDisableDequeue, uint8, chan_num); - UT_GenStub_AddParam(CF_DoEnableDisableDequeue, const bool_arg_t *, context); + UT_GenStub_AddParam(CF_DoEnableDisableDequeue, const CF_ChanAction_BoolArg_t *, context); UT_GenStub_Execute(CF_DoEnableDisableDequeue, Basic, NULL); @@ -398,12 +398,12 @@ int CF_DoEnableDisableDequeue(uint8 chan_num, const bool_arg_t *context) * Generated stub function for CF_DoEnableDisablePolldir() * ---------------------------------------------------- */ -int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context) +int CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolMsgArg_t *context) { UT_GenStub_SetupReturnBuffer(CF_DoEnableDisablePolldir, int); UT_GenStub_AddParam(CF_DoEnableDisablePolldir, uint8, chan_num); - UT_GenStub_AddParam(CF_DoEnableDisablePolldir, const bool_msg_arg_t *, context); + UT_GenStub_AddParam(CF_DoEnableDisablePolldir, const CF_ChanAction_BoolMsgArg_t *, context); UT_GenStub_Execute(CF_DoEnableDisablePolldir, Basic, NULL); @@ -415,12 +415,12 @@ int CF_DoEnableDisablePolldir(uint8 chan_num, const bool_msg_arg_t *context) * Generated stub function for CF_DoFreezeThaw() * ---------------------------------------------------- */ -int CF_DoFreezeThaw(uint8 chan_num, const bool_arg_t *context) +int CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) { UT_GenStub_SetupReturnBuffer(CF_DoFreezeThaw, int); UT_GenStub_AddParam(CF_DoFreezeThaw, uint8, chan_num); - UT_GenStub_AddParam(CF_DoFreezeThaw, const bool_arg_t *, context); + UT_GenStub_AddParam(CF_DoFreezeThaw, const CF_ChanAction_BoolArg_t *, context); UT_GenStub_Execute(CF_DoFreezeThaw, Basic, NULL); @@ -459,15 +459,15 @@ void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action) /* * ---------------------------------------------------- - * Generated stub function for CF_DoSuspRes_() + * Generated stub function for CF_DoSuspRes_Txn() * ---------------------------------------------------- */ -void CF_DoSuspRes_(CF_Transaction_t *t, susp_res_arg_t *context) +void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context) { - UT_GenStub_AddParam(CF_DoSuspRes_, CF_Transaction_t *, t); - UT_GenStub_AddParam(CF_DoSuspRes_, susp_res_arg_t *, context); + UT_GenStub_AddParam(CF_DoSuspRes_Txn, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_DoSuspRes_Txn, CF_ChanAction_SuspResArg_t *, context); - UT_GenStub_Execute(CF_DoSuspRes_, Basic, NULL); + UT_GenStub_Execute(CF_DoSuspRes_Txn, Basic, NULL); } /* diff --git a/unit-test/stubs/cf_utils_stubs.c b/unit-test/stubs/cf_utils_stubs.c index 758820d2..ad055ff1 100644 --- a/unit-test/stubs/cf_utils_stubs.c +++ b/unit-test/stubs/cf_utils_stubs.c @@ -63,19 +63,19 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac /* * ---------------------------------------------------- - * Generated stub function for CF_FindTransactionBySequenceNumber_() + * Generated stub function for CF_FindTransactionBySequenceNumber_Impl() * ---------------------------------------------------- */ -int CF_FindTransactionBySequenceNumber_(CF_CListNode_t *n, trans_seq_arg_t *context) +int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context) { - UT_GenStub_SetupReturnBuffer(CF_FindTransactionBySequenceNumber_, int); + UT_GenStub_SetupReturnBuffer(CF_FindTransactionBySequenceNumber_Impl, int); - UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber_, CF_CListNode_t *, n); - UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber_, trans_seq_arg_t *, context); + UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber_Impl, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber_Impl, CF_Traverse_TransSeqArg_t *, context); - UT_GenStub_Execute(CF_FindTransactionBySequenceNumber_, Basic, NULL); + UT_GenStub_Execute(CF_FindTransactionBySequenceNumber_Impl, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_FindTransactionBySequenceNumber_, int); + return UT_GenStub_GetReturnValue(CF_FindTransactionBySequenceNumber_Impl, int); } /* @@ -169,37 +169,37 @@ int CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t /* * ---------------------------------------------------- - * Generated stub function for CF_TraverseAllTransactions_() + * Generated stub function for CF_TraverseAllTransactions_All_Channels() * ---------------------------------------------------- */ -int CF_TraverseAllTransactions_(CF_CListNode_t *n, traverse_all_args_t *args) +int CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context) { - UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_, int); + UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_All_Channels, int); - UT_GenStub_AddParam(CF_TraverseAllTransactions_, CF_CListNode_t *, n); - UT_GenStub_AddParam(CF_TraverseAllTransactions_, traverse_all_args_t *, args); + UT_GenStub_AddParam(CF_TraverseAllTransactions_All_Channels, CF_TraverseAllTransactions_fn_t, fn); + UT_GenStub_AddParam(CF_TraverseAllTransactions_All_Channels, void *, context); - UT_GenStub_Execute(CF_TraverseAllTransactions_, Basic, NULL); + UT_GenStub_Execute(CF_TraverseAllTransactions_All_Channels, Basic, + UT_DefaultHandler_CF_TraverseAllTransactions_All_Channels); - return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_, int); + return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_All_Channels, int); } /* * ---------------------------------------------------- - * Generated stub function for CF_TraverseAllTransactions_All_Channels() + * Generated stub function for CF_TraverseAllTransactions_Impl() * ---------------------------------------------------- */ -int CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, void *context) +int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args) { - UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_All_Channels, int); + UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_Impl, int); - UT_GenStub_AddParam(CF_TraverseAllTransactions_All_Channels, CF_TraverseAllTransactions_fn_t, fn); - UT_GenStub_AddParam(CF_TraverseAllTransactions_All_Channels, void *, context); + UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, CF_TraverseAll_Arg_t *, args); - UT_GenStub_Execute(CF_TraverseAllTransactions_All_Channels, Basic, - UT_DefaultHandler_CF_TraverseAllTransactions_All_Channels); + UT_GenStub_Execute(CF_TraverseAllTransactions_Impl, Basic, NULL); - return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_All_Channels, int); + return UT_GenStub_GetReturnValue(CF_TraverseAllTransactions_Impl, int); } /* @@ -207,12 +207,12 @@ int CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, * Generated stub function for CF_TraverseHistory() * ---------------------------------------------------- */ -int CF_TraverseHistory(CF_CListNode_t *n, trav_arg_t *context) +int CF_TraverseHistory(CF_CListNode_t *n, CF_Traverse_WriteFileArg_t *context) { UT_GenStub_SetupReturnBuffer(CF_TraverseHistory, int); UT_GenStub_AddParam(CF_TraverseHistory, CF_CListNode_t *, n); - UT_GenStub_AddParam(CF_TraverseHistory, trav_arg_t *, context); + UT_GenStub_AddParam(CF_TraverseHistory, CF_Traverse_WriteFileArg_t *, context); UT_GenStub_Execute(CF_TraverseHistory, Basic, NULL); @@ -224,12 +224,12 @@ int CF_TraverseHistory(CF_CListNode_t *n, trav_arg_t *context) * Generated stub function for CF_TraverseTransactions() * ---------------------------------------------------- */ -int CF_TraverseTransactions(CF_CListNode_t *n, trav_arg_t *context) +int CF_TraverseTransactions(CF_CListNode_t *n, CF_Traverse_WriteFileArg_t *context) { UT_GenStub_SetupReturnBuffer(CF_TraverseTransactions, int); UT_GenStub_AddParam(CF_TraverseTransactions, CF_CListNode_t *, n); - UT_GenStub_AddParam(CF_TraverseTransactions, trav_arg_t *, context); + UT_GenStub_AddParam(CF_TraverseTransactions, CF_Traverse_WriteFileArg_t *, context); UT_GenStub_Execute(CF_TraverseTransactions, Basic, NULL); diff --git a/unit-test/utilities/cf_test_alt_handler.c b/unit-test/utilities/cf_test_alt_handler.c index cfa6d419..cac832e5 100644 --- a/unit-test/utilities/cf_test_alt_handler.c +++ b/unit-test/utilities/cf_test_alt_handler.c @@ -16,13 +16,13 @@ * Function: UT_AltHandler_CF_CList_Traverse_TRAV_ARG_T * * A handler for CF_CList_Traverse which saves its arguments - * including the opaque context pointer as a trav_arg_t object. + * including the opaque context pointer as a CF_Traverse_WriteFileArg_t object. * *-----------------------------------------------------------------*/ void UT_AltHandler_CF_CList_Traverse_TRAV_ARG_T(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { CF_CList_Traverse_TRAV_ARG_T_context_t *ctxt; - trav_arg_t *arg = UT_Hook_GetArgValueByName(Context, "context", trav_arg_t *); + CF_Traverse_WriteFileArg_t *arg = UT_Hook_GetArgValueByName(Context, "context", CF_Traverse_WriteFileArg_t *); if (UserObj) { @@ -51,14 +51,14 @@ void UT_AltHandler_CF_CList_Traverse_TRAV_ARG_T(void *UserObj, UT_EntryKey_t Fun * 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 traverse_all_args_t object. + * including the opaque context pointer as a CF_TraverseAll_Arg_t object. * *-----------------------------------------------------------------*/ void UT_AltHandler_CF_CList_Traverse_TRAVERSE_ALL_ARGS_T(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { CF_CList_Traverse_TRAVERSE_ALL_ARGS_T_context_t *ctxt; - traverse_all_args_t *arg = UT_Hook_GetArgValueByName(Context, "context", traverse_all_args_t *); + CF_TraverseAll_Arg_t *arg = UT_Hook_GetArgValueByName(Context, "context", CF_TraverseAll_Arg_t *); if (UserObj) { @@ -122,13 +122,13 @@ 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 priority_arg_t object. + * including the opaque context pointer as a CF_Traverse_PriorityArg_t object. * *-----------------------------------------------------------------*/ void UT_AltHandler_CF_CList_Traverse_R_PRIO(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { CF_CList_Traverse_R_context_t *ctxt; - priority_arg_t *arg = UT_Hook_GetArgValueByName(Context, "context", priority_arg_t *); + CF_Traverse_PriorityArg_t *arg = UT_Hook_GetArgValueByName(Context, "context", CF_Traverse_PriorityArg_t *); if (UserObj) {