Beispiel #1
0
/*
** Action to be taken when the demo is to be driven via Ethernet
*/
static void ActionEnetInit(void)
{
    unsigned int linkFlag = FALSE;

    if(!EnetIfIsUp())
    {
        ContextReset();
        linkFlag = FALSE;
        EnetHttpServerInit();

        if(ipAddr)
        {
            linkFlag = TRUE;
        }
    }
    else
    {
        if(EnetLinkIsUp())
        {
            linkFlag = TRUE;
        }
        else
        {
            ContextReset();
            linkFlag = FALSE;
        }
    }

    if((TRUE == linkFlag) && (ipAddr != 0))
    {
        ConsoleUtilsPrintf("\n\rAccess the home page using http://");
        IpAddrDisplay();
        ConsoleUtilsPrintf("/index.html \n\r");
    }
    else
    {
        ConsoleUtilsPrintf("\n\rNetwork Connection failed.\n\r");
    }

    UpdateUartConsoleHelp();
}
Beispiel #2
0
/*
** Check for any change in ethernet link status. If so, update
** ip address
*/
static void EnetStatusCheckNUpdate(void)
{
    unsigned int linkFlag = FALSE;
    static unsigned int prevEnState = 0;
    static unsigned int nxtEnState = 1;

    if(prevEnState != nxtEnState)
    {
        if(!EnetIfIsUp())
        {
            ContextReset();
            linkFlag = FALSE;
            EnetHttpServerInit( IPAddress );

            if(ipAddr)
            {
                linkFlag = TRUE; 
                prevEnState = 1;
            }
        }
        else
        {
            if(EnetLinkIsUp())
            {
                linkFlag = TRUE;
                nxtEnState = 1;
            }
            else
            {
                ContextReset();
                linkFlag = FALSE;
                prevEnState = 0;
                nxtEnState = 0;
            }
        }

        if((TRUE == linkFlag) && (ipAddr != 0))
        {
            prevEnState = 1;
            UARTPuts("\n\rAccess the home page using http://", -1);
            IpAddrDisplay();
            UARTPuts("/index.html \n\r", -1);
            LedOn( USER_LED_4 );
        }
        else
        {
            UARTPuts("\n\rNetwork Connection failed.\n\r", -1);
            LedOff( USER_LED_4 );
        }
    }
    else
    {
        if(EnetLinkIsUp())
        {  
            nxtEnState = 1;
        }
        else
        {
            nxtEnState = 0;
        }
    }
}