Esempio n. 1
0
/*----------------------------------------------------------------------------*/
int write_device(ASerialPort_t* aPort, ADeviceNXP_t* aDevice)
{
	int test = 0;
	if(!aDevice->hexfile_name)
	{
		printf("No HEX file selected!\n");
		return ERROR_NO_HEXFILE;
	}
	/* try to open file - check for existence @ open permission etc. */
	FILE *pfile = fopen(aDevice->hexfile_name,"r");
	if (!pfile)
	{
		printf("HEX file not found!\n");
		return ERROR_NO_HEXFILE;
	}
	fclose(pfile);
	if(erase_device(aPort, aDevice))
	{
		printf("Cannot erase device?!\n");
		return ERROR_GENERAL;
	}
	printf("Writing HEX file '%s'... ",aDevice->hexfile_name);
	fflush(stdout);
	if(!nxp_send_file(aPort, aDevice))
		printf("Done!\n");
	return test;
}
Esempio n. 2
0
static rtems_device_driver flashdisk_initialize(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void *arg
)
{
  erase_device();

  return rtems_fdisk_initialize(major, minor, arg);
}
Esempio n. 3
0
static int flashdisk_erase_device(
  const rtems_fdisk_device_desc *sd,
  uint32_t device
)
{
  int eno = 0;

  erase_device();

  return eno;
}