Beispiel #1
0
int itc_dm_main(int argc, char *argv[])
#endif
{
	if (tc_handler(TC_START, "DeviceManagement ITC") == ERROR) {
		return ERROR;
	}

#ifndef CONFIG_EXAMPLES_TESTCASE_DM_WIFI
	printf("=== Please Setup WiFi Info ===\n");
	return 0;
#endif
	if (wifiAutoConnect() == 1) {
		itc_dm_lwm2m_testcase_main();
#ifdef CONFIG_ITC_DM_CONN_GET_RSSI
		itc_dm_conn_get_rssi_main();
#endif
#ifdef CONFIG_ITC_DM_CONN_GET_ADDRESS
		itc_dm_conn_get_address_main();
#endif
#ifdef CONFIG_ITC_DM_CONN_GET_INTERFACE
		itc_dm_conn_get_interface_main();
#endif
#ifdef CONFIG_ITC_DM_CONN_GET_CHANNEL
		itc_dm_conn_get_channel_main();
#endif
#ifdef CONFIG_ITC_DM_CONN_GET_TX_POWER
#ifdef CONFIG_ITC_DM_CONN_SET_TX_POWER
		itc_dm_conn_set_get_tx_power_main();
#endif
#endif

#ifdef CONFIG_ITC_DM_CONN_REGI_LINKUP
#ifdef CONFIG_ITC_DM_CONN_UNREGI_LINKUP
		itc_dm_conn_regi_unreg_linkup_main();
#endif
#endif
#ifdef CONFIG_ITC_DM_CONN_REGI_LINKDOWN
#ifdef CONFIG_ITC_DM_CONN_UNREGI_LINKDOWN
		itc_dm_conn_regi_unreg_linkdown_main();
#endif
#endif
		wifiAutoConnectDeInit_itc();
	}

	(void)tc_handler(TC_END, "DeviceManagement ITC");

	return 0;
}
int utc_taskmanager_main(int argc, char *argv[])
#endif
{
	int status;

	if (tc_handler(TC_START, "TaskManager UTC") == ERROR) {
		return ERROR;
	}

	handle_tm_utc = task_manager_register_builtin("tm_utc", TM_APP_PERMISSION_DEDICATE, TM_RESPONSE_WAIT_INF);
	(void)task_manager_start(handle_tm_utc, TM_NO_RESPONSE);
	sleep(5);	//wait for starting tm_utc

	(void)waitpid(pid_tm_utc, &status, 0);

	(void)task_manager_unregister(handle_tm_utc, TM_NO_RESPONSE);

	(void)tc_handler(TC_END, "TaskManager UTC");

	return 0;
}
Beispiel #3
0
tc_counter_t
tc_counter_get (tc_t tc)
{
    tc_counter_t overflows;
    uint16_t counter_value;

    /* Unfortunately the hardware counter is only 16 bits.  We try to
       synthesise a 64 bit counter by counting overflows.  The
       implementation gets tricky due two different race conditions.

       The first is due to non-atomic reading of the 64 bit
       tc->overflows.  This is avoided by reading tc->overflows in a
       critical section.

       The second is due to the non-atomic reading of the counter
       value and reading of the status register to determine an
       overflow.  This could be avoided by pausing the counter but
       this will drop counts every time this function is read.  */

    /* Disable interrupts to ensure that reading tc->overflows is atomic.  */
    irq_global_disable ();
    overflows = tc->overflows;

    /* Read counter value.  */
    counter_value = tc->base->TC_CV;

    /* Check for overflows and service pending interrups.  */
    tc_handler (tc);

    if (overflows != tc->overflows)
    {
        /* An overflow has occurred since disabling of interrupts.
           There are three cases:
           Case 1.  The overflow occured before reading the counter
           value.  This case can be detected by reading a small value.

           Case 2.  The overflow occured after reading the counter.
           This case can be detected by reading a large value. 

           Case 3.  Another interrupt handler has hogged the CPU
           for at least half the counter rollover period.   This 
           is avoided by globally disabling interrupts.
        */
        if (counter_value < 32768)
            overflows++;
    }

    irq_global_enable ();

    return (overflows << 16) | counter_value;
}
Beispiel #4
0
void handle_int()
{
    /**read irq source**/
    unsigned long irq_source = INTOFFSET;
    switch(irq_source)
    {
        case (1<<8):
        	led_on();
        	break;
        case (1<<11):
        	led_off();
        	break;        		
        case (1<<13):
        	led_on();
        	break; 
        case (1<<14):
        	led_off();
        	break;
        case (1<<15):
        	led_on();
        	break; 
        case (1<<19):
        	led_off();
        	break;  
        case 31:
        	tc_handler();
        	break;  
        default:
        	break;  
    }
    /**clear irq source**/
    EINTPEND = irq_source;
    SRCPND |= 1<<31;
    INTPND |= 1<<31;
    	
}
Beispiel #5
0
static
void tc_handler1 (void)
{
    tc_handler (&tc_devices[1]);
}
Beispiel #6
0
static
void tc_handler0 (void)
{
    tc_handler (&tc_devices[0]);
}
Beispiel #7
0
static
void tc_handler2 (void)
{
    tc_handler (&tc_devices[2]);
}
int wifi_manager_itc(int argc, FAR char *argv[])
{
	if (tc_handler(TC_START, "WiFiManager ITC") == ERROR) {
		return ERROR;
	}

	itc_wifimanager_init_deinit_p();

	itc_wifimanager_set_mode_p();

	itc_wifimanager_get_mode_p(); // set softap mode inside this function
	itc_wifimanager_connect_disconnect_ap_p(); // change to station mode and try to connect to ap

	itc_wifimanager_scan_ap_p(); // Reinitialized wifi manager with the callback hander for scan results

	itc_wifimanager_reinit_p();

	itc_wifimanager_redeinit_p();

	itc_wifimanager_redisconnect_p();

	itc_wifimanager_connect_long_ssid_p();
	itc_wifimanager_average_joining_ap(); // Disable DoS preventation from Access Point

	itc_wifimanager_average_leaving_ap(); // Disable DoS preventation from Access Point

	itc_wifimanager_average_stoping_ap(); // Disable DoS preventation from Access Point

	itc_wifimanager_success_ratio_ap();
	itc_wifimanager_init_deinit_n();

	itc_wifimanager_connect_ap_n();

	itc_wifimanager_connect_set_mode_n();

	itc_wifimanager_connect_ap_config_p();

	itc_wifimanager_save_get_config_p();

	itc_wifimanager_remove_get_config_p();

	itc_wifimanager_get_config_n();

	itc_wifimanager_connect_ap_config_n();

	itc_wifimanager_reremove_n();

	itc_wifimanager_get_connected_config_n();
	itc_wifimanager_connect_ap_config_p();//To make correct connection
	itc_wifimanager_get_stats_p();
	itc_wifimanager_get_stats_n();
	itc_wifimanager_get_connected_config_p();
	//itc_wifimanager_get_connected_config_n();



	itc_wifimanager_reconnect_p(); // System is crashing tested manually

	(void)tc_handler(TC_END, "WiFiManager ITC");

	return 0;
}