예제 #1
0
파일: W7500x_it.c 프로젝트: embeddist/W7500
/**
  * @brief  This function handles DUALTIMER0 Handler.
  * @param  None
  * @retval None
  */
void DUALTIMER0_Handler(void)
{
	   if(DUALTIMER_GetIntStatus(DUALTIMER0_0))
    {
        DUALTIMER_IntClear(DUALTIMER0_0);
        // LED red is toggled 
        if(GPIO_ReadOutputDataBit(GPIOC,GPIO_Pin_8) != (uint32_t)Bit_RESET)
            GPIO_ResetBits(GPIOC, GPIO_Pin_8);
        else
            GPIO_SetBits(GPIOC, GPIO_Pin_8);
    }
    
        if(DUALTIMER_GetIntStatus(DUALTIMER0_1))
    {
        DUALTIMER_IntClear(DUALTIMER0_1);
    }
}
예제 #2
0
파일: us_ticker.c 프로젝트: Babody/mbed
void DUALTIMER0_Handler(void)
{
   if(DUALTIMER_GetIntStatus(DUALTIMER0_0))
    {
        DUALTIMER_IntClear(DUALTIMER0_0);
        us_ticker_irq_handler();
    }
}
void DUALTIMER0_Handler(void)
{
    struct __network_info *net = (struct __network_info *)get_S2E_Packet_pointer()->network_info;
    struct __options *option = (struct __options *)&(get_S2E_Packet_pointer()->options);
    uint32_t count = 0;

    if(DUALTIMER_GetIntStatus(DUALTIMER0_0))
    {
        DUALTIMER_IntClear(DUALTIMER0_0);

        mill_cnt++;

        /* UART Packing Timer Process */
        if(!nagle_flag && net->packing_time) {
            count = RingBuffer_GetCount(&rxring);

            if(count != 0 && count == uart_recv_count)
                nagle_time++;
            else {
                nagle_time = 0;
                uart_recv_count = count;
            }

            if(nagle_time >= net->packing_time) {
                nagle_flag = 1;
                nagle_time = 0;
            }
        }

        /* Reconnection Process */
        if(reconn_flag)
            reconn_time++;

        if(net->reconnection <= reconn_time) {
            reconn_flag = 0;
            reconn_time = 0;
        }

        /* Factory Reset Process */
        if(factory_flag) {
            factory_time++;

            if(Board_factory_get()) {
                factory_time = factory_flag = 0;
                NVIC_EnableIRQ(EXTI_IRQn);
            }

            if(factory_time >= 5000) {
                /* Factory Reset */
                set_S2E_Packet_to_factory_value();
                save_S2E_Packet_to_storage();

                NVIC_SystemReset();
            }
        }

        /* Serial Trigger Timer Process */
        if(trigger_flag == 1)
            trigger_time++;

        if(trigger_time >= 500) {
            trigger_flag = 2;
            trigger_time = 0;
        }

        /* Second Process */
        if((mill_cnt % 1000) == 0) {
            LED_Toggle(LED2);
            mill_cnt = 0;
            sec_cnt++;

            /* DHCP Process */
            if(option->dhcp_use)
                DHCP_time_handler();

            /* DNS Process */
            if(option->dns_use) {
                DNS_time_handler();
            }

            /* Inactive Time Process */
            if(inactive_flag == 1) {
                if((ether_recv_cnt == ether_recv_prev) && (ether_send_cnt == ether_send_prev))
                    inactive_time++;
                else {
                    ether_send_prev = ether_send_cnt;
                    ether_recv_prev = ether_recv_cnt;
                    inactive_time = 0;
                }
            }

            if(net->inactivity && (net->inactivity <= inactive_time)) {
                inactive_flag = 2;
                inactive_time = 0;
            }

            /* Connect Password Process */
            if(auth_flag)
                auth_time++;

            /* Minute Process */
            if((sec_cnt % 60) == 0) {
                sec_cnt = 0;

                /* DNS Process */
                if(option->dns_use) {
                    run_dns = 1;
                }
            }
        }

        mill_sec++;

        //if((mill_sec % 100) == 0) {
        //	LED_Toggle(LED1);
        //	LED_Toggle(LED2);
        //}

        if((mill_sec % 1000) == 0) {
            mill_sec = 0;
            tftp_timeout_handler();
        }

    }
}