int do_tftpd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
	gpio_init();

	if(DETECT())
	{
		printf(" \n## Enter Rescue Mode ##\n");
		printf("   \n3: System Boot system code via TFTP.\n");
		setenv("autostart", "no");
		/* Wait forever for an image */
		if (NetLoop(TFTPD) < 0)
			return 1;
	}
	else
	{
		if(check_image(0))
		{
			printf(" \nEnter Recuse Mode for image error\n");
			printf("   \n3: System Boot system code via TFTP.\n");
			if (NetLoop(TFTPD) < 0)
				return 1;
		}

		/* show LED POWER after success image integrity check */
		LEDON();
		
		printf("   \n3: System Boot system code via Flash.\n");
		do_bootm(cmdtp, 0, argc, argv);
	}

	return 0;
}
Пример #2
0
int do_tftpd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
	const int press_times = 1;
	int i = 0;

	asus_gpio_init();
	if (DETECT())		/* Reset button */
	{
		printf(" \n## Enter Rescue Mode ##\n");
		printf("   \n3: System Boot system code via TFTP.\n");
		setenv("autostart", "no");
		/* Wait forever for an image */
		if (NetLoop(TFTPD) < 0) 
			return 1;
	}
	else if (DETECT_WPS())	/* WPS button */
	{
		/* Make sure WPS button is pressed at least press_times * 0.01s. */
		while (DETECT_WPS() && i++ < press_times) {
			udelay(10000);
		}

		if (i >= press_times) {
			while (DETECT_WPS()) {
				udelay(90000);
				i++;
				if (i & 1)
					LEDON();
				else
					LEDOFF();
			}
			LEDOFF();
			asus_gpio_uninit();

			reset_to_default();
			do_reset (NULL, 0, 0, NULL);
		}
	}
	else
	{
		if(check_trx(argc, argv))
		{
			printf(" \nEnter Recuse Mode for trx error\n");
			printf("   \n3: System Boot system code via TFTP.\n");
			if (NetLoop(TFTPD) < 0) 
				return 1;
		}
		
		printf("   \n3: System Boot system code via Flash.\n");
		do_bootm(cmdtp, 0, argc, argv);
	}
	
	return 0;
}