Skip to content

Commit

Permalink
Fix nasa#21, Add idle task while loop back in
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed May 25, 2022
1 parent c5ef5ac commit 8c07324
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions fsw/src/hs_custom.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,30 @@ void HS_IdleTask(void)
{
OS_time_t PSPTime = {0};

HS_CustomData.IdleTaskRunStatus = CFE_SUCCESS;

/* Check to see if we are to mark the time. */
if (((HS_CustomData.ThisIdleTaskExec & HS_CustomData.UtilMask) == HS_CustomData.UtilMask) &&
(HS_CustomData.ThisIdleTaskExec > HS_CustomData.UtilMask))
while (HS_CustomData.IdleTaskRunStatus == CFE_SUCCESS)
{
/* Entry and Exit markers are for easy time marking only; not performance */
CFE_ES_PerfLogEntry(HS_IDLETASK_PERF_ID);

/* Increment the child task Execution Counter */
CFE_ES_IncrementTaskCounter();
/* Check to see if we are to mark the time. */
if (((HS_CustomData.ThisIdleTaskExec & HS_CustomData.UtilMask) == HS_CustomData.UtilMask) &&
(HS_CustomData.ThisIdleTaskExec > HS_CustomData.UtilMask))
{
/* Entry and Exit markers are for easy time marking only; not performance */
CFE_ES_PerfLogEntry(HS_IDLETASK_PERF_ID);

/* update stamp and array */
CFE_PSP_GetTime(&PSPTime);
HS_CustomData.UtilArray[HS_CustomData.UtilArrayIndex & HS_CustomData.UtilArrayMask] = (uint32)PSPTime.ticks;
HS_CustomData.UtilArrayIndex++;
/* Increment the child task Execution Counter */
CFE_ES_IncrementTaskCounter();

CFE_ES_PerfLogExit(HS_IDLETASK_PERF_ID);
}
/* update stamp and array */
CFE_PSP_GetTime(&PSPTime);
HS_CustomData.UtilArray[HS_CustomData.UtilArrayIndex & HS_CustomData.UtilArrayMask] = (uint32)PSPTime.ticks;
HS_CustomData.UtilArrayIndex++;

/* Call the Utilization Tracking function */
HS_UtilizationIncrement();
CFE_ES_PerfLogExit(HS_IDLETASK_PERF_ID);
}

/* Call the Utilization Tracking function */
HS_UtilizationIncrement();
}

return;

Expand All @@ -92,8 +94,9 @@ int32 HS_CustomInit(void)
/*
** Spawn the Idle Task
*/
Status = CFE_ES_CreateChildTask(&HS_CustomData.IdleTaskID, HS_IDLE_TASK_NAME, HS_IdleTask, HS_IDLE_TASK_STACK_PTR,
HS_IDLE_TASK_STACK_SIZE, HS_IDLE_TASK_PRIORITY, HS_IDLE_TASK_FLAGS);
HS_CustomData.IdleTaskRunStatus =
CFE_ES_CreateChildTask(&HS_CustomData.IdleTaskID, HS_IDLE_TASK_NAME, HS_IdleTask, HS_IDLE_TASK_STACK_PTR,
HS_IDLE_TASK_STACK_SIZE, HS_IDLE_TASK_PRIORITY, HS_IDLE_TASK_FLAGS);

if (Status != CFE_SUCCESS)
{
Expand Down

0 comments on commit 8c07324

Please sign in to comment.