Add a flag for setting the drive to high density mode.
This commit is contained in:
parent
d013b0fe55
commit
7f9a85ff77
7 changed files with 16 additions and 12 deletions
Binary file not shown.
|
|
@ -22,7 +22,7 @@ static bool motor_on = false;
|
||||||
static uint32_t motor_on_time = 0;
|
static uint32_t motor_on_time = 0;
|
||||||
static bool homed = false;
|
static bool homed = false;
|
||||||
static int current_track = 0;
|
static int current_track = 0;
|
||||||
static int current_drive = 0;
|
static uint8_t current_drive_flags = 0;
|
||||||
|
|
||||||
#define BUFFER_COUNT 16
|
#define BUFFER_COUNT 16
|
||||||
#define BUFFER_SIZE 64
|
#define BUFFER_SIZE 64
|
||||||
|
|
@ -568,10 +568,10 @@ static void cmd_erase(struct erase_frame* f)
|
||||||
|
|
||||||
static void cmd_set_drive(struct set_drive_frame* f)
|
static void cmd_set_drive(struct set_drive_frame* f)
|
||||||
{
|
{
|
||||||
if (current_drive != f->drive)
|
if (current_drive_flags != f->drive)
|
||||||
{
|
{
|
||||||
current_drive = f->drive;
|
current_drive_flags = f->drive | (f->high_density<<1);
|
||||||
DRIVE_REG_Write(current_drive);
|
DRIVE_REG_Write(current_drive_flags);
|
||||||
homed = false;
|
homed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ static IntFlag revolutions(
|
||||||
"read this many revolutions of the disk",
|
"read this many revolutions of the disk",
|
||||||
1);
|
1);
|
||||||
|
|
||||||
|
static SettableFlag highDensity(
|
||||||
|
{ "--high-density", "-H" },
|
||||||
|
"sets the drive to high density mode");
|
||||||
|
|
||||||
class HardwareFluxReader : public FluxReader
|
class HardwareFluxReader : public FluxReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -24,7 +28,7 @@ public:
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<Fluxmap> readFlux(int track, int side)
|
std::unique_ptr<Fluxmap> readFlux(int track, int side)
|
||||||
{
|
{
|
||||||
usbSetDrive(_drive);
|
usbSetDrive(_drive, highDensity);
|
||||||
usbSeek(track);
|
usbSeek(track);
|
||||||
return usbRead(side, revolutions);
|
return usbRead(side, revolutions);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -245,13 +245,14 @@ void usbErase(int side)
|
||||||
await_reply<struct any_frame>(F_FRAME_ERASE_REPLY);
|
await_reply<struct any_frame>(F_FRAME_ERASE_REPLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usbSetDrive(int drive)
|
void usbSetDrive(int drive, bool high_density)
|
||||||
{
|
{
|
||||||
usb_init();
|
usb_init();
|
||||||
|
|
||||||
struct set_drive_frame f = {
|
struct set_drive_frame f = {
|
||||||
{ .type = F_FRAME_SET_DRIVE_CMD, .size = sizeof(f) },
|
{ .type = F_FRAME_SET_DRIVE_CMD, .size = sizeof(f) },
|
||||||
.drive = (uint8_t) drive
|
.drive = (uint8_t) drive,
|
||||||
|
.high_density = (uint8_t) high_density,
|
||||||
};
|
};
|
||||||
usb_cmd_send(&f, f.f.size);
|
usb_cmd_send(&f, f.f.size);
|
||||||
await_reply<struct any_frame>(F_FRAME_SET_DRIVE_REPLY);
|
await_reply<struct any_frame>(F_FRAME_SET_DRIVE_REPLY);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@ extern void usbTestBulkTransport();
|
||||||
extern std::unique_ptr<Fluxmap> usbRead(int side, int revolutions);
|
extern std::unique_ptr<Fluxmap> usbRead(int side, int revolutions);
|
||||||
extern void usbWrite(int side, const Fluxmap& fluxmap);
|
extern void usbWrite(int side, const Fluxmap& fluxmap);
|
||||||
extern void usbErase(int side);
|
extern void usbErase(int side);
|
||||||
extern void usbSetDrive(int drive);
|
extern void usbSetDrive(int drive, bool high_density);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
FLUXENGINE_VERSION = 4,
|
FLUXENGINE_VERSION = 5,
|
||||||
|
|
||||||
FLUXENGINE_VID = 0x1209,
|
FLUXENGINE_VID = 0x1209,
|
||||||
FLUXENGINE_PID = 0x6e00,
|
FLUXENGINE_PID = 0x6e00,
|
||||||
|
|
@ -22,8 +22,6 @@ enum
|
||||||
|
|
||||||
SIDE_SIDEA = 0<<0,
|
SIDE_SIDEA = 0<<0,
|
||||||
SIDE_SIDEB = 1<<0,
|
SIDE_SIDEB = 1<<0,
|
||||||
SIDE_LOWDENSITY = 1<<1,
|
|
||||||
SIDE_HIGHDENSITY = 0<<1,
|
|
||||||
|
|
||||||
FRAME_SIZE = 64,
|
FRAME_SIZE = 64,
|
||||||
TICK_FREQUENCY = 12000000,
|
TICK_FREQUENCY = 12000000,
|
||||||
|
|
@ -127,6 +125,7 @@ struct set_drive_frame
|
||||||
{
|
{
|
||||||
struct frame_header f;
|
struct frame_header f;
|
||||||
uint8_t drive;
|
uint8_t drive;
|
||||||
|
uint8_t high_density;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ int main(int argc, const char* argv[])
|
||||||
{
|
{
|
||||||
Flag::parseFlags(argc, argv);
|
Flag::parseFlags(argc, argv);
|
||||||
|
|
||||||
usbSetDrive(source.value.drive);
|
usbSetDrive(source.value.drive, false);
|
||||||
nanoseconds_t period = usbGetRotationalPeriod();
|
nanoseconds_t period = usbGetRotationalPeriod();
|
||||||
std::cout << "Rotational period is " << period/1000 << " ms (" << 60e6/period << " rpm)" << std::endl;
|
std::cout << "Rotational period is " << period/1000 << " ms (" << 60e6/period << " rpm)" << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue