Skip to content

Commit

Permalink
Merge pull request nasa#1116 from skliper/fix1069-sbr_throttle_types
Browse files Browse the repository at this point in the history
Fix nasa#1069, Resolve mismatched types in SBR throttle
  • Loading branch information
astrogeco authored Feb 3, 2021
2 parents d9f3fa4 + 07721cb commit 3a1b9e1
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 3a1b9e1

Please sign in to comment.