Example #1
0
/*****************************************************************************
  Function:
	void DNSClientDeInit(const TCPIP_STACK_MODULE_CTRL* const stackData);

  Summary:
	De-Initializes the DNS module.
	
  Description:
	This function perform the de-initialization of the DNS client module.
    It is used to release all the resources that are in use by the DNS client.
    
  Precondition:
	Stack is initialized.

  Parameters:
	stackData   - interface to use
                Normally should be a default DNS interface
                
  Return Values:
  	None
  	
  Remarks:
	None
  ***************************************************************************/
void DNSClientDeInit(const TCPIP_STACK_MODULE_CTRL* const stackData)
{
    // interface going down
    if(pDNSNet == stackData->pNetIf)
    {   // my interface is shut down
        DNSEndUsage(0);
    }
        
    if(stackData->stackAction == TCPIP_STACK_ACTION_DEINIT)
    {   // stack shut down
        if(dnsInitCount > 0)
        {   // we're up and running

            if(--dnsInitCount == 0)
            {   // all closed
                // release resources
#if DNS_CLIENT_VERSION_NO >= 2
                if(dnsTimerHandle)
                {
                    SYS_TICK_TimerDelete(dnsTimerHandle);
                    dnsTimerHandle = 0;
                    dnsTickPending = 0;
                }
#endif  // DNS_CLIENT_VERSION_NO >= 2
            }
        }
    }


}
Example #2
0
// called from a system async event handler whenever g_easyConfigCtx.isWifiNeedToConfigure is true
void WiFi_EasyConfigTask(void)
{
    switch (g_easyConfigCtx.state)
    {
        case EZ_WAIT_FOR_START:
            SYS_CONSOLE_MESSAGE("EZ_WAIT_FOR_START\r\n");
            g_easyConfigCtx.isWifiNeedToConfigure = false;
            // first thing to do is delay one second so user can see on the web
            // page that disconnect is about occur in process of connecting to
            // designated AP.  So create and start timer.
            g_easyConfigCtx.timer = SYS_TICK_TimerCreate(EasyConfigTimerHandler);
            SYS_TICK_TimerSetRate(g_easyConfigCtx.timer, SYS_TICK_TicksPerSecondGet() * WF_EASY_CONFIG_DELAY_TIME);
            g_easyConfigCtx.state = EZ_WAIT_FOR_DELAY;
            break;

        case EZ_WAIT_FOR_DELAY:
            SYS_CONSOLE_MESSAGE("EZ_WAIT_FOR_DELAY\r\n");
            g_easyConfigCtx.isWifiNeedToConfigure = false;
            
            // delete timer now that delay has occurred
            SYS_TICK_TimerDelete(g_easyConfigCtx.timer);

            // connect to AP that user selected on web page
            EasyConfigConnect();
            g_easyConfigCtx.state = EZ_WAIT_FOR_START;

            break;
        }
}
Example #3
0
static void EasyConfigTimerHandler(SYS_TICK curSysTick)
{
    curSysTick = curSysTick;  // avoid warning

    // delete timer now that delay has occurred
    SYS_TICK_TimerDelete(g_easyConfigCtx.timer);

    // This function being called from timer interrupt, so don't do any work
    // here, but, schedule the async event handler to call EasyConfigStateMachine
    g_easyConfigCtx.isWifiNeedToConfigure = true;

    WifiAsyncSetEventPending(ASYNC_EASY_CONFIG_PENDING);


}
Example #4
0
void ARPDeinitialize(const TCPIP_STACK_MODULE_CTRL* const stackCtrl)
{
    int ix;
    ARP_CACHE_DCPT* pArpDcpt = arpCache + stackCtrl->netIx;

    // interface going down
    if(pArpDcpt->deleteOld)
    {
        _ARPRemoveCacheEntries(pArpDcpt);
    }

    // done
    pArpDcpt->inited = false;

    if(stackCtrl->stackAction == TCPIP_STACK_ACTION_DEINIT)
    {   // stack shut down
        pArpDcpt = arpCache;
        for(ix = 0; ix < stackCtrl->nIfs; ix++, pArpDcpt++)
        {
            if(pArpDcpt->inited)
            {
                return; // some interface still on
            }
        }

        for(ix = 0, pArpDcpt = arpCache; ix < stackCtrl->nIfs; ix++, pArpDcpt++)
        {
            _ARPCleanupCache(pArpDcpt);
        }

        // all interfaces down
        _ARPCleanupClients();
        if(arpTimerHandle)
        {
            SYS_TICK_TimerDelete(arpTimerHandle);
            arpTimerHandle = 0;
            arpTickPending = 0;
        }
    }
}