mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Remove the rest of the mapper.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "crc.h"
|
||||
#include "readerwriter.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "arch/amiga/amiga.pb.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
|
||||
@@ -156,7 +155,7 @@ public:
|
||||
|
||||
auto fluxmap = std::make_unique<Fluxmap>();
|
||||
fluxmap->appendBits(bits,
|
||||
Mapper::calculatePhysicalClockPeriod(
|
||||
calculatePhysicalClockPeriod(
|
||||
_config.clock_rate_us() * 1e3, 200e6));
|
||||
return fluxmap;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "sector.h"
|
||||
#include "readerwriter.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "fmt/format.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
#include <ctype.h>
|
||||
@@ -75,7 +74,7 @@ public:
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(bits,
|
||||
Mapper::calculatePhysicalClockPeriod(
|
||||
calculatePhysicalClockPeriod(
|
||||
_config.clock_period_us() * 1e3,
|
||||
_config.rotational_period_ms() * 1e6));
|
||||
return fluxmap;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "sector.h"
|
||||
#include "readerwriter.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "fmt/format.h"
|
||||
#include "arch/c64/c64.pb.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
@@ -229,7 +228,7 @@ public:
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(bits,
|
||||
Mapper::calculatePhysicalClockPeriod(clockRateUs*1e3, 200e6));
|
||||
calculatePhysicalClockPeriod(clockRateUs*1e3, 200e6));
|
||||
return fluxmap;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "crc.h"
|
||||
#include "readerwriter.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "arch/ibm/ibm.pb.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
#include "fmt/format.h"
|
||||
@@ -286,7 +285,7 @@ public:
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(_bits,
|
||||
Mapper::calculatePhysicalClockPeriod(clockRateUs * 1e3,
|
||||
calculatePhysicalClockPeriod(clockRateUs * 1e3,
|
||||
trackdata.target_rotational_period_ms() * 1e6));
|
||||
return fluxmap;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "crc.h"
|
||||
#include "readerwriter.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "fmt/format.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
#include "arch/macintosh/macintosh.pb.h"
|
||||
@@ -266,7 +265,7 @@ public:
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(bits,
|
||||
Mapper::calculatePhysicalClockPeriod(clockRateUs * 1e3, 200e6));
|
||||
calculatePhysicalClockPeriod(clockRateUs * 1e3, 200e6));
|
||||
return fluxmap;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "decoders/decoders.h"
|
||||
#include "encoders/encoders.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
|
||||
static void write_sector(std::vector<bool>& bits,
|
||||
@@ -115,7 +114,7 @@ public:
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(bits,
|
||||
Mapper::calculatePhysicalClockPeriod(
|
||||
calculatePhysicalClockPeriod(
|
||||
_config.clock_period_us() * 1e3,
|
||||
_config.rotational_period_ms() * 1e6));
|
||||
return fluxmap;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "decoders/decoders.h"
|
||||
#include "encoders/encoders.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
|
||||
#define GAP_FILL_SIZE_SD 30
|
||||
@@ -172,7 +171,7 @@ public:
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(bits,
|
||||
Mapper::calculatePhysicalClockPeriod(
|
||||
calculatePhysicalClockPeriod(
|
||||
clockRateUs * 1e3, _config.rotational_period_ms() * 1e6));
|
||||
return fluxmap;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "crc.h"
|
||||
#include "readerwriter.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "arch/tids990/tids990.pb.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
#include <fmt/format.h>
|
||||
@@ -151,7 +150,7 @@ public:
|
||||
|
||||
auto fluxmap = std::make_unique<Fluxmap>();
|
||||
fluxmap->appendBits(_bits,
|
||||
Mapper::calculatePhysicalClockPeriod(clockRateUs * 1e3,
|
||||
calculatePhysicalClockPeriod(clockRateUs * 1e3,
|
||||
_config.rotational_period_ms() * 1e6));
|
||||
return fluxmap;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "sector.h"
|
||||
#include "readerwriter.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "fmt/format.h"
|
||||
#include "arch/victor9k/victor9k.pb.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
@@ -194,7 +193,7 @@ public:
|
||||
unsigned bitsPerRevolution = (trackdata.rotational_period_ms() * 1e3) /
|
||||
trackdata.clock_period_us();
|
||||
std::vector<bool> bits(bitsPerRevolution);
|
||||
nanoseconds_t clockPeriod = Mapper::calculatePhysicalClockPeriod(
|
||||
nanoseconds_t clockPeriod = calculatePhysicalClockPeriod(
|
||||
trackdata.clock_period_us() * 1e3,
|
||||
trackdata.rotational_period_ms() * 1e6);
|
||||
unsigned cursor = 0;
|
||||
|
||||
@@ -55,7 +55,6 @@ LIBFLUXENGINE_SRCS = \
|
||||
lib/layout.cc \
|
||||
lib/ldbs.cc \
|
||||
lib/logger.cc \
|
||||
lib/mapper.cc \
|
||||
lib/proto.cc \
|
||||
lib/readerwriter.cc \
|
||||
lib/sector.cc \
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "arch/tids990/tids990.h"
|
||||
#include "arch/victor9k/victor9k.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
#include "lib/proto.h"
|
||||
#include "protocol.h"
|
||||
|
||||
std::unique_ptr<AbstractEncoder> AbstractEncoder::create(
|
||||
@@ -40,6 +41,19 @@ std::unique_ptr<AbstractEncoder> AbstractEncoder::create(
|
||||
return (encoder->second)(config);
|
||||
}
|
||||
|
||||
nanoseconds_t AbstractEncoder::calculatePhysicalClockPeriod(
|
||||
nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod)
|
||||
{
|
||||
nanoseconds_t currentRotationalPeriod =
|
||||
config.drive().rotational_period_ms() * 1e6;
|
||||
if (currentRotationalPeriod == 0)
|
||||
Error() << "you must set --drive.rotational_period_ms as it can't be "
|
||||
"autodetected";
|
||||
|
||||
return targetClockPeriod *
|
||||
(currentRotationalPeriod / targetRotationalPeriod);
|
||||
}
|
||||
|
||||
Fluxmap& Fluxmap::appendBits(const std::vector<bool>& bits, nanoseconds_t clock)
|
||||
{
|
||||
nanoseconds_t now = duration();
|
||||
|
||||
@@ -14,7 +14,6 @@ public:
|
||||
virtual ~AbstractEncoder() {}
|
||||
|
||||
static std::unique_ptr<AbstractEncoder> create(const EncoderProto& config);
|
||||
|
||||
public:
|
||||
virtual std::vector<std::shared_ptr<const Sector>> collectSectors(
|
||||
const Location& location, const Image& image) = 0;
|
||||
@@ -22,6 +21,9 @@ public:
|
||||
virtual std::unique_ptr<Fluxmap> encode(const Location& location,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||
const Image& image) = 0;
|
||||
|
||||
nanoseconds_t calculatePhysicalClockPeriod(
|
||||
nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "lib/sector.h"
|
||||
#include "lib/image.h"
|
||||
#include "lib/layout.h"
|
||||
#include "lib/mapper.h"
|
||||
|
||||
Image::Image() {}
|
||||
|
||||
@@ -69,7 +68,7 @@ std::shared_ptr<Sector> Image::put(
|
||||
sector->logicalTrack = track;
|
||||
sector->logicalSide = side;
|
||||
sector->logicalSector = sectorid;
|
||||
sector->physicalTrack = Mapper::remapTrackLogicalToPhysical(track);
|
||||
sector->physicalTrack = Layout::remapTrackLogicalToPhysical(track);
|
||||
sector->physicalHead = side;
|
||||
sector->physicalSector = trackLayout.logicalSectorToPhysical(sectorid);
|
||||
_sectors[key] = sector;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "fmt/format.h"
|
||||
#include "image.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "proto.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
@@ -56,7 +55,6 @@ public:
|
||||
for (int track = 0; track < 40; track++)
|
||||
{
|
||||
int numSectors = sectorsPerTrack(track);
|
||||
int physicalTrack = Mapper::remapTrackLogicalToPhysical(track);
|
||||
for (int head = 0; head < numHeads; head++)
|
||||
{
|
||||
for (int sectorId = 0; sectorId < numSectors; sectorId++)
|
||||
@@ -69,14 +67,12 @@ public:
|
||||
offset += 256;
|
||||
|
||||
sector->status = Sector::OK;
|
||||
sector->physicalTrack = physicalTrack;
|
||||
sector->data.writer().append(payload);
|
||||
}
|
||||
else
|
||||
{ // no more data in input file. Write sectors with status:
|
||||
// DATA_MISSING
|
||||
sector->status = Sector::DATA_MISSING;
|
||||
sector->physicalTrack = physicalTrack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "image.h"
|
||||
#include "proto.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "imagereader/imagereader.h"
|
||||
#include "image.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "proto.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "imagereader/imagereader.h"
|
||||
#include "image.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "image.h"
|
||||
#include "proto.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "image.h"
|
||||
#include "proto.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "layout.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
#include <algorithm>
|
||||
@@ -372,14 +372,14 @@ public:
|
||||
if (blnOptionalCylinderMap) //there was een optional cylinder map. write it to the sector
|
||||
//The Sector Cylinder Map has one entry for each sector, and contains the logical Cylinder ID for the corresponding sector in the Sector Numbering Map.
|
||||
{
|
||||
sector->physicalTrack = Mapper::remapTrackLogicalToPhysical(header.track);
|
||||
sector->physicalTrack = Layout::remapTrackLogicalToPhysical(header.track);
|
||||
sector->logicalTrack = optionalsector_map[s];
|
||||
blnOptionalCylinderMap = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector->logicalTrack = header.track;
|
||||
sector->physicalTrack = Mapper::remapTrackLogicalToPhysical(header.track);
|
||||
sector->physicalTrack = Layout::remapTrackLogicalToPhysical(header.track);
|
||||
}
|
||||
if (blnOptionalHeadMap) //there was een optional head map. write it to the sector
|
||||
//The Sector Head Map has one entry for each sector, and contains the logical Head ID for the corresponding sector in the Sector Numbering Map.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "imagereader/imagereader.h"
|
||||
#include "image.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "lib/layout.pb.h"
|
||||
#include "lib/proto.h"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "sector.h"
|
||||
#include "imagereader/imagereader.h"
|
||||
#include "image.h"
|
||||
#include "mapper.h"
|
||||
#include "logger.h"
|
||||
#include "fmt/format.h"
|
||||
#include "lib/config.pb.h"
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "image.h"
|
||||
#include "proto.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "image.h"
|
||||
#include "fmt/format.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "lib/imagereader/imagereader.pb.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "image.h"
|
||||
#include "crc.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "fmt/format.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
@@ -7,6 +7,71 @@
|
||||
static Local<std::map<std::pair<int, int>, std::unique_ptr<Layout>>>
|
||||
layoutCache;
|
||||
|
||||
unsigned Layout::remapTrackPhysicalToLogical(unsigned ptrack)
|
||||
{
|
||||
return (ptrack - config.drive().head_bias()) / config.drive().head_width();
|
||||
}
|
||||
|
||||
static unsigned getTrackStep()
|
||||
{
|
||||
unsigned track_step =
|
||||
(config.tpi() == 0) ? 1 : (config.drive().tpi() / config.tpi());
|
||||
|
||||
if (track_step == 0)
|
||||
Error()
|
||||
<< "this drive can't write this image, because the head is too big";
|
||||
return track_step;
|
||||
}
|
||||
|
||||
unsigned Layout::remapTrackLogicalToPhysical(unsigned ltrack)
|
||||
{
|
||||
return config.drive().head_bias() + ltrack * getTrackStep();
|
||||
}
|
||||
|
||||
std::set<Location> Layout::computeLocations()
|
||||
{
|
||||
std::set<Location> locations;
|
||||
|
||||
std::set<unsigned> tracks;
|
||||
if (config.has_tracks())
|
||||
tracks = iterate(config.tracks());
|
||||
else
|
||||
tracks = iterate(0, config.layout().tracks());
|
||||
|
||||
std::set<unsigned> heads;
|
||||
if (config.has_heads())
|
||||
heads = iterate(config.heads());
|
||||
else
|
||||
heads = iterate(0, config.layout().sides());
|
||||
|
||||
for (unsigned logicalTrack : tracks)
|
||||
{
|
||||
for (unsigned head : heads)
|
||||
locations.insert(computeLocationFor(logicalTrack, head));
|
||||
}
|
||||
|
||||
return locations;
|
||||
}
|
||||
|
||||
Location Layout::computeLocationFor(unsigned logicalTrack, unsigned logicalHead)
|
||||
{
|
||||
if ((logicalTrack < config.layout().tracks()) &&
|
||||
(logicalHead < config.layout().sides()))
|
||||
{
|
||||
unsigned track_step = getTrackStep();
|
||||
unsigned physicalTrack =
|
||||
config.drive().head_bias() + logicalTrack * track_step;
|
||||
|
||||
return {.physicalTrack = physicalTrack,
|
||||
.logicalTrack = logicalTrack,
|
||||
.head = logicalHead,
|
||||
.groupSize = track_step};
|
||||
}
|
||||
|
||||
Error() << fmt::format(
|
||||
"track {}.{} is not part of the image", logicalTrack, logicalHead);
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, int>> Layout::getTrackOrdering(
|
||||
unsigned guessedTracks, unsigned guessedSides)
|
||||
{
|
||||
|
||||
22
lib/layout.h
22
lib/layout.h
@@ -1,7 +1,7 @@
|
||||
#ifndef LAYOUT_H
|
||||
#define LAYOUT_H
|
||||
|
||||
#include "lib/layout.pb.h"
|
||||
#include "lib/flux.h"
|
||||
|
||||
class Layout
|
||||
{
|
||||
@@ -14,9 +14,29 @@ private:
|
||||
Layout& operator=(const Layout&);
|
||||
|
||||
public:
|
||||
/* Translates logical track numbering (filesystem numbering) to
|
||||
* the track numbering on the actual drive, taking into account tpi
|
||||
* settings.
|
||||
*/
|
||||
static unsigned remapTrackPhysicalToLogical(unsigned physicalTrack);
|
||||
static unsigned remapTrackLogicalToPhysical(unsigned logicalTrack);
|
||||
|
||||
/* Computes a Location for a given logical track and side, which
|
||||
* contains the physical drive location and group size. */
|
||||
static Location computeLocationFor(
|
||||
unsigned logicalTrack, unsigned logicalSide);
|
||||
|
||||
/* Uses the layout and current track and heads settings to determine
|
||||
* which Locations are going to be read from or written to. 8/
|
||||
*/
|
||||
static std::set<Location> computeLocations();
|
||||
|
||||
/* Returns a series of <track, side> pairs representing the filesystem
|
||||
* ordering of the disk, in logical numbers. */
|
||||
static std::vector<std::pair<int, int>> getTrackOrdering(
|
||||
unsigned guessedTracks = 0, unsigned guessedSides = 0);
|
||||
|
||||
/* Returns the layout of a given track. */
|
||||
static const Layout& getLayoutOfTrack(
|
||||
unsigned logicalTrack, unsigned logicalHead);
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
#include "globals.h"
|
||||
#include "sector.h"
|
||||
#include "image.h"
|
||||
#include "fmt/format.h"
|
||||
#include "logger.h"
|
||||
#include "proto.h"
|
||||
#include "mapper.h"
|
||||
#include "flux.h"
|
||||
|
||||
unsigned Mapper::remapTrackPhysicalToLogical(unsigned ptrack)
|
||||
{
|
||||
return (ptrack - config.drive().head_bias()) / config.drive().head_width();
|
||||
}
|
||||
|
||||
static unsigned getTrackStep()
|
||||
{
|
||||
unsigned track_step =
|
||||
(config.tpi() == 0) ? 1 : (config.drive().tpi() / config.tpi());
|
||||
|
||||
if (track_step == 0)
|
||||
Error()
|
||||
<< "this drive can't write this image, because the head is too big";
|
||||
return track_step;
|
||||
}
|
||||
|
||||
unsigned Mapper::remapTrackLogicalToPhysical(unsigned ltrack)
|
||||
{
|
||||
return config.drive().head_bias() + ltrack * getTrackStep();
|
||||
}
|
||||
|
||||
std::set<Location> Mapper::computeLocations()
|
||||
{
|
||||
std::set<Location> locations;
|
||||
|
||||
std::set<unsigned> tracks;
|
||||
if (config.has_tracks())
|
||||
tracks = iterate(config.tracks());
|
||||
else
|
||||
tracks = iterate(0, config.layout().tracks());
|
||||
|
||||
std::set<unsigned> heads;
|
||||
if (config.has_heads())
|
||||
heads = iterate(config.heads());
|
||||
else
|
||||
heads = iterate(0, config.layout().sides());
|
||||
|
||||
for (unsigned logicalTrack : tracks)
|
||||
{
|
||||
for (unsigned head : heads)
|
||||
locations.insert(computeLocationFor(logicalTrack, head));
|
||||
}
|
||||
|
||||
return locations;
|
||||
}
|
||||
|
||||
Location Mapper::computeLocationFor(unsigned logicalTrack, unsigned logicalHead)
|
||||
{
|
||||
if ((logicalTrack < config.layout().tracks()) &&
|
||||
(logicalHead < config.layout().sides()))
|
||||
{
|
||||
unsigned track_step = getTrackStep();
|
||||
unsigned physicalTrack =
|
||||
config.drive().head_bias() + logicalTrack * track_step;
|
||||
|
||||
return {.physicalTrack = physicalTrack,
|
||||
.logicalTrack = logicalTrack,
|
||||
.head = logicalHead,
|
||||
.groupSize = track_step};
|
||||
}
|
||||
|
||||
Error() << fmt::format(
|
||||
"track {}.{} is not part of the image", logicalTrack, logicalHead);
|
||||
}
|
||||
|
||||
nanoseconds_t Mapper::calculatePhysicalClockPeriod(
|
||||
nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod)
|
||||
{
|
||||
nanoseconds_t currentRotationalPeriod =
|
||||
config.drive().rotational_period_ms() * 1e6;
|
||||
if (currentRotationalPeriod == 0)
|
||||
Error() << "you must set --drive.rotational_period_ms as it can't be "
|
||||
"autodetected";
|
||||
|
||||
return targetClockPeriod *
|
||||
(currentRotationalPeriod / targetRotationalPeriod);
|
||||
}
|
||||
21
lib/mapper.h
21
lib/mapper.h
@@ -1,21 +0,0 @@
|
||||
#ifndef MAPPER_H
|
||||
#define MAPPER_H
|
||||
|
||||
class SectorMappingProto;
|
||||
class DriveProto;
|
||||
class Location;
|
||||
|
||||
class Mapper
|
||||
{
|
||||
public:
|
||||
static unsigned remapTrackPhysicalToLogical(unsigned track);
|
||||
static unsigned remapTrackLogicalToPhysical(unsigned track);
|
||||
|
||||
static std::set<Location> computeLocations();
|
||||
static Location computeLocationFor(unsigned track, unsigned side);
|
||||
|
||||
static nanoseconds_t calculatePhysicalClockPeriod(
|
||||
nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "sector.h"
|
||||
#include "image.h"
|
||||
#include "logger.h"
|
||||
#include "mapper.h"
|
||||
#include "layout.h"
|
||||
#include "utils.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include "proto.h"
|
||||
@@ -398,7 +398,7 @@ void writeDiskCommand(const Image& image,
|
||||
AbstractDecoder* decoder,
|
||||
FluxSource* fluxSource)
|
||||
{
|
||||
auto locations = Mapper::computeLocations();
|
||||
auto locations = Layout::computeLocations();
|
||||
writeDiskCommand(image, encoder, fluxSink, decoder, fluxSource, locations);
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ void writeRawDiskCommand(FluxSource& fluxSource, FluxSink& fluxSink)
|
||||
->next();
|
||||
},
|
||||
dontVerify,
|
||||
Mapper::computeLocations());
|
||||
Layout::computeLocations());
|
||||
}
|
||||
|
||||
std::shared_ptr<TrackFlux> readAndDecodeTrack(
|
||||
@@ -461,7 +461,7 @@ std::shared_ptr<const DiskFlux> readDiskCommand(
|
||||
auto diskflux = std::make_shared<DiskFlux>();
|
||||
|
||||
Logger() << BeginOperationLogMessage{"Reading and decoding disk"};
|
||||
auto locations = Mapper::computeLocations();
|
||||
auto locations = Layout::computeLocations();
|
||||
unsigned index = 0;
|
||||
for (const auto& location : locations)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "lib/fluxsource/fluxsource.h"
|
||||
#include "lib/layout.h"
|
||||
#include "lib/proto.h"
|
||||
#include "lib/mapper.h"
|
||||
|
||||
class FluxSectorInterface : public SectorInterface
|
||||
{
|
||||
@@ -64,7 +63,7 @@ public:
|
||||
unsigned track = trackid.first;
|
||||
unsigned side = trackid.second;
|
||||
auto& trackLayout = Layout::getLayoutOfTrack(track, side);
|
||||
locations.insert(Mapper::computeLocationFor(track, side));
|
||||
locations.insert(Layout::computeLocationFor(track, side));
|
||||
|
||||
/* If we don't have all the sectors of this track, we may need to
|
||||
* populate any non-changed sectors as we can only write a track at
|
||||
@@ -127,7 +126,7 @@ private:
|
||||
|
||||
void populateSectors(unsigned track, unsigned side)
|
||||
{
|
||||
auto location = Mapper::computeLocationFor(track, side);
|
||||
auto location = Layout::computeLocationFor(track, side);
|
||||
auto trackdata = readAndDecodeTrack(*_fluxSource, *_decoder, location);
|
||||
|
||||
for (const auto& sector : trackdata->sectors)
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "decoders/decoders.h"
|
||||
#include "lib/usb/usbfinder.h"
|
||||
#include "fmt/format.h"
|
||||
#include "mapper.h"
|
||||
#include "utils.h"
|
||||
#include "fluxviewerwindow.h"
|
||||
#include "textviewerwindow.h"
|
||||
|
||||
Reference in New Issue
Block a user