Пример #1
0
void bootloader(void)
{
	FSFILE* file;

	USBInitialize(0);

	if (!FSInit())
	{
		// File system failed - pretty much DISKmount didn't work
		AT45D_FormatFS();
		if (!FSInit())
		{
			error(ERR_FS_INIT);
		}
	}

	while (1)
	{
		USBTasks();
		BlinkBlueLED();

		// User Application USB tasks
		if ((USBDeviceState < CONFIGURED_STATE) || (USBSuspendControl == 1))
		{
			// do nothing
		}
		else
		{
			BlinkGreenLED();
			MSDTasks();
		}
		if (_T1IF)
		{
			_T1IF = 0;

			// check for MSD activity...
			if (MDD_AT45D_Write_Activity)
			{
				MDD_AT45D_Write_Activity = 0;
			}
			else
			{
				file = FSfopen("image.hex", "r");
				if (file != NULL)
				{
					file_flash(file);
					FSfclose(file);
					FSremove("image.hex");
					//AT45D_FormatFS();
					return;
				}
			}
		}
	}
}
Пример #2
0
// called at startup to initialise the telemetry log system
void log_init(void)
{
//	init_dataflash(); // this should now be getting device specific called from lower layers via FSInit()
	if (!FSInit())
	{
#ifdef USE_AT45D_FLASH
		AT45D_FormatFS();
#elif (WIN == 1) || (NIX == 1)
#else
#warning No Mass Storage Device Format Function Defined
#endif // USE_AT45D_FLASH
		if (!FSInit())
		{
			printf("File system initialisation failed\r\n");
			return;
		}
	}
	printf("File system initalised\r\n");
}
Пример #3
0
void cmd_format(void)
{
	printf("formatting dataflash\r\n");
	AT45D_FormatFS();
}