Add the ability to erase tracks. The writer now erases tracks for which no data

is available.
This commit is contained in:
David Given
2019-01-10 23:51:47 +01:00
parent 564fb63685
commit 80cb1e7a81
5 changed files with 69 additions and 15 deletions

View File

@@ -511,6 +511,27 @@ static void cmd_write(struct write_frame* f)
send_reply((struct any_frame*) &r);
}
static void cmd_erase(struct erase_frame* f)
{
SIDE_REG_Write(f->side);
seek_to(current_track);
/* Disk is now spinning. */
print("start erasing\r");
index_irq = false;
while (!index_irq)
;
ERASE_REG_Write(1);
index_irq = false;
while (!index_irq)
;
ERASE_REG_Write(0);
print("stop erasing\r");
DECLARE_REPLY_FRAME(struct any_frame, F_FRAME_ERASE_REPLY);
send_reply((struct any_frame*) &r);
}
static void handle_command(void)
{
static uint8_t input_buffer[FRAME_SIZE];
@@ -543,6 +564,10 @@ static void handle_command(void)
cmd_write((struct write_frame*) f);
break;
case F_FRAME_ERASE_CMD:
cmd_erase((struct erase_frame*) f);
break;
default:
send_error(F_ERROR_BAD_COMMAND);
}