Example #1
0
void test_running_insert_timer()
{
    cs_timer_add(5000,test_timer_proc, &data[0]);
    sleep(1); 
    util_timer_show();
    cs_timer_add(2000,test_timer_proc, &data[1]);
    util_timer_show();
    sleep(2);
    util_timer_show();
    cs_timer_add(1000,test_timer_proc, &data[2]);
    util_timer_show();
}
Example #2
0
void test_duplicate_timer()
{
    int i = 0; 

    for( i = 0; i <10; i++){
        cs_timer_add(data[i] * 1000,test_timer_proc, &data[i]);
    }

    item_data = 23;
    for( i = 9; i >=0; i--){
        cs_timer_add(5 * 1000,test_timer_proc, &item_data);
    }
}
Example #3
0
void test_stop_restart_timer()
{
    /*to avoid 64bit system issue, use util_timer_add*/
    util_timer_t * timer; 
    util_timer_t * timer2; 
    util_timer_t * timer3; 

    cs_timer_add(4000,test_timer_proc, &data[1]);

    timer = util_timer_add(TIMER_TYPE_ONCE,10000,test_timer_proc, &data[2]);
    timer2 = util_timer_add(TIMER_TYPE_ONCE,2000,test_timer_proc, &data[3]);
    timer3 = util_timer_add(TIMER_TYPE_ONCE,3000,test_timer_proc, &data[4]);
    util_timer_show();
    sleep(1);
    
   // util_timer_stop(timer);
    //util_timer_show();
    util_timer_stop(timer2);
    util_timer_show();
    util_timer_stop(timer3);

    util_timer_show();
    sleep(10);  /*wait for timeout, timer will not exe*/
    
    util_timer_show();
   // util_timer_restart(timer);  /*time will exe after 5s*/
    //util_timer_restart(timer2);  /*time will exe after 5s*/
    util_timer_restart(timer3);  /*time will exe after 5s*/
    util_timer_show();

    sleep(5);
}
Example #4
0
void test_timer_add_proc(void * data)
{
    int  * num = (int *) data;

    printf("add another timer %d \n",*num);
    cs_timer_add(5000,test_timer_add_proc, &data[0]);
}
Example #5
0
void test_large_to_small()
{
    int i = 0; 

    for( i = 9; i >=0; i--){
        cs_timer_add(data[i] * 1000,test_timer_proc, &data[i]);
    }
}
Example #6
0
void test_small_to_larger()
{
    int i = 0; 

    for( i = 0; i < 10; i++){
        cs_timer_add(data[i] * 1000,test_timer_proc, &data[i]);
    }
}
Example #7
0
void  test_timer_thread()
{
    int i = 0; 

    for( i = 0; i < 10; i++){
        cs_timer_add(data[i] * 1000,test_timer_proc, &data[i]);
    }
    util_timer_show();
}
Example #8
0
cs_int32 app_update_file_transfer_init()
{
    updateInProgress = EPON_TRUE;
    block_expected = 1;
    start = 1;
    retry = 0;
    //image_len = 0;

    l2ftp_record.timer = cs_timer_add(ONU_L2FTP_INTERVAL*1000,onu_tmfunc_l2ftp , NULL);

    return 1;
}
Example #9
0
void test_more_thread_add_delete()
{
    pthread_t pthread;
    pthread_attr_t attr;

    pthread_attr_init(&attr);

    pthread_create(&pthread, &attr, test_timer_thread, NULL);
    pthread_create(&pthread, &attr, test_timer_thread, NULL);

    int i = 0; 
    sleep(1);
    for( i = 0; i < 10; i++){
        cs_timer_add(data[i] * 1000,test_timer_proc, &data[i]);
    }
    util_timer_show();

}
Example #10
0
static void onu_tmfunc_l2ftp(void *data)
{
    if (retry < ONU_MAX_L2FTP_RETRY) {
        retry++;
        l2ftp_timeout();
    }
    else {
        IROS_LOG_CRI(IROS_MID_L2FTP,
                "l2ftp: max retry reached\n");
        l2ftp_send_error(CS_L2FTP_ERROR_MAX_RETRY);
        //image_len = 0;
        //app_update_file_transfer_done(image_len);
        updateInProgress = EPON_FALSE;
        active_update_port = 0;
        return;
    }

    l2ftp_record.timer = cs_timer_add(ONU_L2FTP_INTERVAL*1000,onu_tmfunc_l2ftp , NULL);
}
Example #11
0
void 
ppp_timeout(void *h, void *arg, cs_uint32 msecs)
{   
    g_fsm_timer = cs_timer_add(msecs, h, arg);
}	
Example #12
0
void test_one_once_timer()
{
    cs_timer_add(5000,test_timer_proc, &data[0]);
}
Example #13
0
void test_timer_add_in_timerout()
{
    cs_timer_add(5000,test_timer_add_proc, &data[0]);

}