stellaris.c 28.2 KB
Newer Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
}

int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
	flash_bank_t *bank;
	int i;
	
	if (argc < 1)
	{
		command_print(cmd_ctx, "stellaris mass_erase <bank>");
		return ERROR_OK;	
	}
	
	bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
	if (!bank)
	{
		command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]);
		return ERROR_OK;
	}
	
	stellaris_mass_erase(bank);
	
	/* set all sectors as erased */
	for (i = 0; i < bank->num_sectors; i++)
	{
		bank->sectors[i].is_erased = 1;
	}
	
	command_print(cmd_ctx, "stellaris mass erase complete");
	
	return ERROR_OK;
}
For faster browsing, not all history is shown. View entire blame