100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth range given to batch 22), each with at least one independent contract-edge defect and plain public docs. Claude reviewed 100/100 USABLE against current digests; no ID or source overlap with main or batch 22. Difficulty is unmeasured. progress.md records the wrap-up: all Codex sessions and Qwen schedulers stopped for the user's rollout, Qwen results so far (57 HARD of 373), and what is left on each batch branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
2.5 KiB
C++
104 lines
2.5 KiB
C++
#ifndef RESOURCE_MAP_PUBLIC_HPP
|
|
#define RESOURCE_MAP_PUBLIC_HPP
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace resource_map {
|
|
enum class Code : int {
|
|
OK = 0,
|
|
ARG = 1,
|
|
STATE = 2,
|
|
MISSING = 3,
|
|
BUSY = 4,
|
|
MAPFAIL = 5,
|
|
STALE = 6,
|
|
RANGE = 7,
|
|
VALUE = 8
|
|
};
|
|
enum class Kind : int {
|
|
MEM = 1,
|
|
IO = 2
|
|
};
|
|
struct Resource {
|
|
int kind = 0;
|
|
std::uint64_t start = 0;
|
|
int size = 0;
|
|
};
|
|
struct ProbeResult {
|
|
Code code = Code::OK;
|
|
std::uint64_t token = 0;
|
|
};
|
|
struct ReadResult {
|
|
Code code = Code::OK;
|
|
std::uint64_t value = 0;
|
|
};
|
|
struct BytesResult {
|
|
Code code = Code::OK;
|
|
std::vector<unsigned int> bytes;
|
|
};
|
|
struct DeviceInfo {
|
|
Code code = Code::OK;
|
|
bool configured = false;
|
|
bool active = false;
|
|
unsigned int resource_count = 0;
|
|
std::uint64_t token = 0;
|
|
int mem_ordinal = -1;
|
|
};
|
|
struct ResourceInfo {
|
|
Code code = Code::OK;
|
|
int kind = 0;
|
|
std::uint64_t start = 0;
|
|
int size = 0;
|
|
};
|
|
struct MappingInfo {
|
|
Code code = Code::OK;
|
|
std::uint64_t token = 0;
|
|
int owner = 0;
|
|
unsigned int resource_index = 0;
|
|
std::uint64_t start = 0;
|
|
int size = 0;
|
|
std::uint64_t reads = 0;
|
|
std::uint64_t writes = 0;
|
|
std::uint64_t fills = 0;
|
|
};
|
|
struct Statistics {
|
|
std::uint64_t created = 0;
|
|
std::uint64_t released = 0;
|
|
std::uint64_t probe_success = 0;
|
|
std::uint64_t probe_faults = 0;
|
|
std::uint64_t read_ops = 0;
|
|
std::uint64_t write_ops = 0;
|
|
std::uint64_t fill_ops = 0;
|
|
std::uint64_t live = 0;
|
|
std::uint64_t live_bytes = 0;
|
|
};
|
|
class Manager {
|
|
public:
|
|
Manager();
|
|
~Manager();
|
|
Manager(const Manager&) = delete;
|
|
Manager& operator=(const Manager&) = delete;
|
|
Manager(Manager&&) = delete;
|
|
Manager& operator=(Manager&&) = delete;
|
|
void reset();
|
|
Code configure(int id, const std::vector<Resource>& resources);
|
|
ProbeResult probe(int id, int mem_ordinal, int fault);
|
|
Code remove(int id);
|
|
ReadResult read(std::uint64_t token, std::uint64_t offset, int width);
|
|
Code write(std::uint64_t token, std::uint64_t offset, int width,
|
|
std::uint64_t value);
|
|
Code fill(std::uint64_t token, std::uint64_t offset, int count, int value);
|
|
BytesResult dump(std::uint64_t token, std::uint64_t offset, int count) const;
|
|
DeviceInfo device(int id) const;
|
|
ResourceInfo resource(int id, int index) const;
|
|
MappingInfo mapping(std::uint64_t token) const;
|
|
std::vector<MappingInfo> snapshot() const;
|
|
Statistics statistics() const;
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
}
|
|
#endif
|