コード例 #1
0
ファイル: tcp_echo.c プロジェクト: LucidOne/Rovio
void
net_test(cyg_addrword_t param)
{
    cyg_serial_baud_rate_t old;    
    cyg_ppp_options_t options;
    cyg_ppp_handle_t ppp_handle;

    CYG_TEST_INIT();
    
    diag_printf("Start TCP test - ECHO mode\n");
    init_all_network_interfaces();
    calibrate_load(DESIRED_BACKGROUND_LOAD);
#ifdef CYGPKG_SNMPAGENT
    {
        extern void cyg_net_snmp_init(void);
        cyg_net_snmp_init();
    }
#endif

    old = ppp_test_set_baud( CYGNUM_SERIAL_BAUD_115200 );

    ppp_test_announce( "TCP_ECHO" );
    
    cyg_ppp_options_init( &options );

//    options.debug = 1;
//    options.kdebugflag = 1;
//    options.flowctl = CYG_PPP_FLOWCTL_SOFTWARE;

    ppp_handle = cyg_ppp_up( CYGPKG_PPP_TEST_DEVICE, &options );

    CYG_TEST_INFO( "Waiting for PPP to come up");
    
    cyg_ppp_wait_up( ppp_handle );

    echo_test(param);

    CYG_TEST_INFO( "Bringing PPP down");

    cyg_ppp_down( ppp_handle );
    
    CYG_TEST_INFO( "Waiting for PPP to go down");

    cyg_ppp_wait_down( ppp_handle );

    cyg_thread_delay( 200 );
    
    ppp_test_set_baud( old );

    ppp_test_finish();
    
    CYG_TEST_PASS_FINISH("TCP ECHO test OK");
}
コード例 #2
0
ファイル: chat.c プロジェクト: houzhenggang/mt7688_mips_ecos
void
chat_test(cyg_addrword_t p)
{
    cyg_serial_baud_rate_t old;
    cyg_int32 failures = 0;
    cyg_int32 result;
    struct test_info *test;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Start CHAT test");

    old = ppp_test_set_baud( CYGNUM_SERIAL_BAUD_115200 );

    for( test = &tests[0]; test->name != NULL; test++ )
    {
        CYG_TEST_INFO( test->name );
        ppp_test_announce( test->name );

        result = cyg_ppp_chat( CYGPKG_PPP_TEST_DEVICE, test->script );

        diag_printf("chat result %d expected %d\n",result,test->result );

        if( result != test->result )
        {
            CYG_TEST_FAIL( test->name );
            failures++;
        }
        else
            CYG_TEST_PASS( test->name );

        cyg_thread_delay( 300 );
    }

    ppp_test_set_baud( old );

    ppp_test_finish();

//    ppp_test_announce( "CHAT_TEST_1" );

//    success = cyg_ppp_chat( CYGPKG_PPP_TEST_DEVICE, script );

//    if( !success )
//        CYG_TEST_INFO("Chat script failed");

    CYG_TEST_FINISH("CHAT test done");
}
コード例 #3
0
ファイル: ppp_up.c プロジェクト: LucidOne/Rovio
void
ppp_test(cyg_addrword_t p)
{
    cyg_serial_baud_rate_t old;
    
    CYG_TEST_INIT();
    diag_printf("Start PPP test\n");

    init_all_network_interfaces();

//    old = ppp_test_set_baud( CYGNUM_SERIAL_BAUD_115200 );
//    do_test( CYGNUM_SERIAL_BAUD_115200 );

    old = ppp_test_set_baud( CYGNUM_SERIAL_BAUD_19200 );
    do_test( CYGNUM_SERIAL_BAUD_19200 );

#ifdef CYGPKG_PPP_TESTS_AUTOMATE

    {
        static cyg_serial_baud_rate_t test_rates[] =
            { CYGDAT_PPP_TEST_BAUD_RATES, 0 };

        int i;

        for( i = 0; test_rates[i] != 0; i++ )
        {
            ppp_test_set_baud( test_rates[i] );
            do_test( test_rates[i] );
        }

        ppp_test_set_baud( old );
    
        ppp_test_finish();
        
    }
           
#endif
    
    CYG_TEST_PASS_FINISH("PPP test OK");
}
コード例 #4
0
void
net_test(test_param_t param)
{
#ifdef __ECOS
    cyg_serial_baud_rate_t old;    
    cyg_ppp_options_t options;
    cyg_ppp_handle_t ppp_handle;

    CYG_TEST_INIT();
#endif

//    int i;
    if (param == 0) {
        test_printf("Start Network Characterization - SLAVE\n");
#ifdef __ECOS
        init_all_network_interfaces();
        calibrate_load(DESIRED_BACKGROUND_LOAD);
#if 0
// I can see what this is trying to do, but I get "bind: Address already in
// use" errors from the 2nd interface - and the parameter is not used
// anyway, so one thread does quite well enough (but only tests one i/f at
// once).

// Comment in the 'int i' above too.
        for (i = 1;  i < CYGHWR_NET_DRIVERS;  i++) {
            cyg_thread_resume(main_thread_handle[i]);   // Start other threads
        }
#endif
#endif
    }

#ifdef __ECOS

    old = ppp_test_set_baud( CYGNUM_SERIAL_BAUD_115200 );

    ppp_test_announce( "NC_TEST_SLAVE" );
    
    cyg_ppp_options_init( &options );

//    options.debug = 1;
//    options.kdebugflag = 1;

//    options.script = script;
//    options.flowctl = CYG_PPP_FLOWCTL_SOFTWARE;

    ppp_handle = cyg_ppp_up( CYGPKG_PPP_TEST_DEVICE, &options );

    CYG_TEST_INFO( "Waiting for PPP to come up");
    
    cyg_ppp_wait_up( ppp_handle );
#endif
    
    nc_slave(param);
#ifdef CYGDBG_NET_TIMING_STATS
    show_net_times();
#endif

#ifdef __ECOS
    CYG_TEST_INFO( "Bringing PPP down");

    cyg_ppp_down( ppp_handle );
    
    CYG_TEST_INFO( "Waiting for PPP to go down");

    cyg_ppp_wait_down( ppp_handle );

    cyg_thread_delay( 200 );

    ppp_test_set_baud( old );

    ppp_test_finish();

    CYG_TEST_PASS_FINISH( "Network Characterization - SLAVE" );
    
#endif
    
    cyg_test_exit();
}