Skip to content

Commit

Permalink
Fix nasa#1069, Resolve mismatched types in SBR throttle
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jan 27, 2021
1 parent 4374482 commit 07721cb
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions modules/sbr/src/cfe_sbr_route_unsorted.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,39 +178,28 @@ CFE_MSG_SequenceCount_t CFE_SBR_GetSequenceCounter(CFE_SBR_RouteId_t RouteId)
}

/******************************************************************************
* Local helper function for throttling foreach routines
*
* Updates StartIdxPtr, EndIdxPtr and ThrottlePtr.NextIndex. Note EndIdxPtr
* must be set to maximum prior to calling.
* Interface function - see API for description
*/
void CFE_SBR_Throttle(uint32 *StartIdxPtr, uint32 *EndIdxPtr, CFE_SBR_Throttle_t *ThrottlePtr)
void CFE_SBR_ForEachRouteId(CFE_SBR_CallbackPtr_t CallbackPtr, void *ArgPtr, CFE_SBR_Throttle_t *ThrottlePtr)
{
CFE_SB_RouteId_Atom_t routeidx;
CFE_SB_RouteId_Atom_t startidx = 0;
CFE_SB_RouteId_Atom_t endidx = CFE_SBR_RDATA.RouteIdxTop;

/* Update throttle settings if needed */
if (ThrottlePtr != NULL)
{
*StartIdxPtr = ThrottlePtr->StartIndex;
startidx = ThrottlePtr->StartIndex;

/* Return next index of zero if full range is processed */
ThrottlePtr->NextIndex = 0;

if ((*StartIdxPtr + ThrottlePtr->MaxLoop) < *EndIdxPtr)
if ((startidx + ThrottlePtr->MaxLoop) < endidx)
{
*EndIdxPtr = *StartIdxPtr + ThrottlePtr->MaxLoop;
ThrottlePtr->NextIndex = *EndIdxPtr;
endidx = startidx + ThrottlePtr->MaxLoop;
ThrottlePtr->NextIndex = endidx;
}
}
}

/******************************************************************************
* Interface function - see API for description
*/
void CFE_SBR_ForEachRouteId(CFE_SBR_CallbackPtr_t CallbackPtr, void *ArgPtr, CFE_SBR_Throttle_t *ThrottlePtr)
{
CFE_SB_RouteId_Atom_t routeidx;
CFE_SB_MsgId_Atom_t startidx = 0;
CFE_SB_MsgId_Atom_t endidx = CFE_SBR_RDATA.RouteIdxTop;

/* Update throttle settings if needed */
CFE_SBR_Throttle(&startidx, &endidx, ThrottlePtr);

for (routeidx = startidx; routeidx < endidx; routeidx++)
{
Expand Down

0 comments on commit 07721cb

Please sign in to comment.