Disk: Plasion: Fix bit-width issues
parent
ae1b8d342e
commit
caf5cca42f
|
|
@ -20,6 +20,11 @@ optional<uint64_t> PlasionDiskReadDriver::readLogicalDiskAligned(Communication&
|
||||||
return nullopt;
|
return nullopt;
|
||||||
|
|
||||||
if(cachePos != pos || std::chrono::steady_clock::now() > cachedAt + CacheTime) {
|
if(cachePos != pos || std::chrono::steady_clock::now() > cachedAt + CacheTime) {
|
||||||
|
uint64_t largeSector = pos / SectorSize;
|
||||||
|
uint32_t sector = uint32_t(largeSector);
|
||||||
|
if (largeSector != uint64_t(sector))
|
||||||
|
return nullopt;
|
||||||
|
|
||||||
// The cache does not have this data, go get it
|
// The cache does not have this data, go get it
|
||||||
std::mutex m;
|
std::mutex m;
|
||||||
std::condition_variable cv;
|
std::condition_variable cv;
|
||||||
|
|
@ -41,14 +46,13 @@ optional<uint64_t> PlasionDiskReadDriver::readLogicalDiskAligned(Communication&
|
||||||
cachedAt = std::chrono::steady_clock::time_point();
|
cachedAt = std::chrono::steady_clock::time_point();
|
||||||
|
|
||||||
memcpy(cache.data() + copied, sdmsg->data.data(), sdmsg->data.size());
|
memcpy(cache.data() + copied, sdmsg->data.data(), sdmsg->data.size());
|
||||||
copied += sdmsg->data.size();
|
copied += uint32_t(sdmsg->data.size());
|
||||||
if(copied == amount) {
|
if(copied == amount) {
|
||||||
lk.unlock();
|
lk.unlock();
|
||||||
cv.notify_all();
|
cv.notify_all();
|
||||||
}
|
}
|
||||||
}, NeoMemorySDRead));
|
}, NeoMemorySDRead));
|
||||||
|
|
||||||
uint32_t sector = pos / SectorSize;
|
|
||||||
com.rawWrite({
|
com.rawWrite({
|
||||||
uint8_t(MultiChannelCommunication::CommandType::HostPC_from_SDCC1),
|
uint8_t(MultiChannelCommunication::CommandType::HostPC_from_SDCC1),
|
||||||
uint8_t(sector & 0xFF),
|
uint8_t(sector & 0xFF),
|
||||||
|
|
@ -69,6 +73,6 @@ optional<uint64_t> PlasionDiskReadDriver::readLogicalDiskAligned(Communication&
|
||||||
cachePos = pos;
|
cachePos = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(into, cache.data(), amount);
|
memcpy(into, cache.data(), size_t(amount));
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue