acadia/sys/denali/client/denali_client.cpp

25 lines
610 B
C++
Raw Normal View History

2023-06-19 22:57:08 -07:00
#include "denali/denali_client.h"
#include <mammoth/debug.h>
#include "denali/denali.h"
glcr::ErrorOr<MappedMemoryRegion> DenaliClient::ReadSectors(
uint64_t device_id, uint64_t lba, uint64_t num_sectors) {
2023-06-19 22:57:08 -07:00
DenaliRead read{
.device_id = device_id,
.lba = lba,
.size = num_sectors,
};
auto pair_or = endpoint_.CallEndpoint<DenaliRead, DenaliReadResponse>(read);
if (!pair_or) {
return pair_or.error();
}
auto pair = pair_or.value();
2023-06-19 22:57:08 -07:00
DenaliReadResponse& resp = pair.first();
z_cap_t& mem_cap = pair.second();
2023-06-19 22:57:08 -07:00
return MappedMemoryRegion::FromCapability(mem_cap);
}