Help me check if there is a hang in this code due to infinite loop

OP (Company: Infowave) #2199171
Rate this post
• ▲ useful
▼ not useful
The loophere fn is definitely an infinite loop..

just want to verify concepts: if the condition is true for the all the 
"if" case, will it end up in an infinite loop that causes a hang when 
LEDB and LEDC are toggled? Loophere fn is outside the main loop whereas 
the while(1) loop is inside the main loop.


int Main(void)
#endif
{
                   :
                   :
  if(ECFG_GetCentralAddress(&pGprsCenterAddr) != COM_SUCCESS)
  {
    LoopHere();
  }

                   :
                   :

         if (ECFG_GetUserAppConfig(&recEnable,
                              &recType,
                              &oneFixMaxIntervalSec,
                              &displacementThresholdMet,
                              &gprsMaxBytesPerSendToServer,
                              &gprsSendPeriodSec,
                              &pGprsRemoteIpAddr,
                              &gprsRemotePortNum)!= COM_SUCCESS){
        //ELOG_Printf0(LOG_CRITICAL, "GetUserAppConfig() failed!");
    LoopHere();
  }

                    :
                    :
        if (EFLASH_Open(COM_SPI_PORT0, MCK/DATAFLASH_SPI_CLOCK_MHZ, 600,
                 1, 
0,DATAFLASH_TOTAL_PAGES,DATAFLASH_TOTAL_BYTES_PER_PAGE,
          DATAFLASH_TOTAL_BITS_FOR_BYTE_FIELD_IN_COMMAND) != 
COM_SUCCESS)
     {
        ELOG_Printf0(LOG_CRITICAL, "FLASH_Open failed!");
        while(1)
        {
            ELED_Action(LEDB, LED_TOGGLE);
            ETIME_DelayMsec(50);
        }
     }
                         :
                         :
}




void LoopHere(void)
{
     while(1)
     {
         ELED_Action(LEDC, LED_TOGGLE);
         ETIME_DelayMsec(50);
     }

}

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.