Beispiel #1
0
static void
tftp_test(struct bootp *bp)
{
    int res;
    int server1_id = 0;
    int server2_id = 0;
    int server3_id = 0;

    extern struct tftpd_fileops dummy_fileops;

    server1_id = tftpd_start(0, &dummy_fileops);
    if (server1_id > 0) {
      diag_printf("TFTP server created - id: %x\n", server1_id);
    } else {
      diag_printf("Couldn't create first server!\n");
    }

#ifdef CYGSEM_NET_TFTPD_MULTITHREADED
    server2_id = tftpd_start(0, &dummy_fileops);
    if (server2_id > 0) {
      diag_printf("Second TFTP server created - id: %x\n", server2_id);
    } else {
      diag_printf("Couldn't create a second server!\n");
    }
#if CYGNUM_NET_TFTPD_MULTITHREADED_PORTS > 1
    server3_id = tftpd_start(1025, &dummy_fileops);
    if (server3_id > 0) {
      diag_printf("Third TFTP server created - id: %x\n", server3_id);
    } else {
      diag_printf("Couldn't create a third server!\n");
    }
#endif //CYGNUM_NET_TFTPD_MULTITHREADED_PORTS > 1
#else  //CYGSEM_NET_TFTPD_MULTITHREADED
    server2_id = tftpd_start(1025, &dummy_fileops);
    if (server2_id > 0) {
      diag_printf("Second TFTP server created - id: %x\n", server2_id);
    } else {
      diag_printf("Couldn't create a second server!\n");
    }
#endif //!CYGSEM_NET_TFTPD_MULTITHREADED
    
    // Only let the server run for 5 minutes
    cyg_thread_delay(2*100); // let the tftpd start up first
    TNR_ON();
    cyg_thread_delay(5*60*100);
    TNR_OFF();
    
    if (server1_id > 0) {
      res = tftpd_stop(server1_id);
      diag_printf("TFTP server - id: %x stopped - res: %d\n", server1_id, res);
    }
    if (server2_id > 0) {
      res = tftpd_stop(server2_id);
      diag_printf("TFTP server - id: %x stopped - res: %d\n", server2_id, res);
    }
    if (server3_id > 0) {
      res = tftpd_stop(server2_id);
      diag_printf("TFTP server - id: %x stopped - res: %d\n", server2_id, res);
    }
} 
Beispiel #2
0
static void
tftp_test(struct bootp *bp)
{
    int server_id, res;
    extern struct tftpd_fileops dummy_fileops;
    server_id = tftpd_start(0, &dummy_fileops);
    if (server_id > 0) {
        diag_printf("TFTP server created - id: %x\n", server_id);
        // Only let the server run for 5 minutes
        cyg_thread_delay(2*100); // let the tftpd start up first
        TNR_ON();
        cyg_thread_delay(5*60*100);
        TNR_OFF();
        res = tftpd_stop(server_id);
        diag_printf("TFTP server stopped - res: %d\n", res);
    } else {
        diag_printf("Couldn't create a server!\n");
    }
}
Beispiel #3
0
int main(int argc, char ** argv)
{
	int ret;

	DCC_LOG_INIT();
	DCC_LOG_CONNECT();

	stdio_init();
	printf("\n---\n");

	cm3_udelay_calibrate();
	thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(0));
	trace_init();

	tracef("## YARD-ICE " VERSION_NUM " - " VERSION_DATE " ##");

	stm32f_nvram_env_init();

	bsp_io_ini();

	rtc_init();

	supervisor_init();
	__os_sleep(10);

#if ENABLE_NETWORK
	DCC_LOG(LOG_TRACE, "network_config().");
	network_config();
#endif

	DCC_LOG(LOG_TRACE, "modules_init().");
	modules_init();

	tracef("* Starting system module ...");
	DCC_LOG(LOG_TRACE, "sys_start().");
	sys_start();

	tracef("* Initializing YARD-ICE debugger...");
	DCC_LOG(LOG_TRACE, "debugger_init().");
	debugger_init();

	tracef("* Initializing JTAG module ...");
	DCC_LOG(LOG_TRACE, "jtag_start().");
	if ((ret = jtag_start()) < 0) {
		tracef("jtag_start() failed! [ret=%d]", ret);
		debugger_except("JTAG driver fault");
	}

#if (ENABLE_NAND)
	tracef("* Initializing NAND module...");
	if (mod_nand_start() < 0) {
		tracef("mod_nand_start() failed!");
		return 0;
	}
#endif

#if (ENABLE_I2C)
	tracef("* starting I2C module ... ");
	i2c_init();
#endif

	tracef("* configuring initial target ... ");
	init_target();

#if (ENABLE_VCOM)
	tracef("* starting VCOM daemon ... ");
	/* connect the UART to the JTAG auxiliary pins */
	jtag3ctrl_aux_uart(true);
	vcom_start();
#endif

#if (ENABLE_COMM)
	tracef("* starting COMM daemon ... ");
	comm_tcp_start(&debugger.comm);
#endif

#if (ENABLE_TFTP)
	tracef("* starting TFTP server ... ");
	tftpd_start();
#endif

#if (ENABLE_GDB)
	tracef("* starting GDB daemon ... ");
	gdb_rspd_start();
#endif

#if ENABLE_USB
	tracef("* starting USB shell ... ");
	usb_shell();
#endif

#if ENABLE_TELNET
	tracef("* starting TELNET server ... ");
	telnet_shell();
#endif

	return console_shell();
}