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>
90 lines
3.8 KiB
C++
90 lines
3.8 KiB
C++
#include "irq_router.hpp"
|
|
#include <charconv>
|
|
#include <cstdint>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <vector>
|
|
static bool integer(const std::string& token, std::int64_t& value)
|
|
{
|
|
if (token.empty()) return false;
|
|
const char* first = token.data();
|
|
const char* last = first + token.size();
|
|
auto result = std::from_chars(first, last, value);
|
|
return result.ec == std::errc{} && result.ptr == last;
|
|
}
|
|
static void observe(const irq::Snapshot& s, int result)
|
|
{
|
|
std::cout << result << ' ' << s.accepted << ' ' << s.rejected
|
|
<< ' ' << s.last_line << ' ' << s.last_result;
|
|
for (const auto& d : s.devices) {
|
|
std::cout << ' ' << d.present << ' ' << d.line << ' ' << d.shared
|
|
<< ' ' << d.enabled << ' ' << d.mask << ' ' << d.pending
|
|
<< ' ' << d.handled << ' ' << d.none << ' ' << d.ack_bits
|
|
<< ' ' << d.raises << ' ' << d.cleared_bits;
|
|
}
|
|
for (const auto& l : s.lines) {
|
|
std::cout << ' ' << l.cursor << ' ' << l.dispatches << ' ' << l.handled
|
|
<< ' ' << l.none << ' ' << l.visits << ' ' << l.ack_bits;
|
|
}
|
|
for (const auto& v : s.summaries) {
|
|
std::cout << ' ' << v.members << ' ' << v.enabled_members << ' ' << v.ready_members
|
|
<< ' ' << v.pending_union << ' ' << v.ready_union << ' ' << v.deferred_union
|
|
<< ' ' << v.pending_bits << ' ' << v.ready_bits << ' ' << v.deferred_bits;
|
|
}
|
|
std::cout << ' ' << s.deliveries.size();
|
|
for (const auto& d : s.deliveries) {
|
|
std::cout << ' ' << d.device << ' ' << d.result << ' ' << d.acknowledged;
|
|
}
|
|
std::cout << '\n';
|
|
}
|
|
int main()
|
|
{
|
|
irq::Router router;
|
|
std::string text;
|
|
while (std::getline(std::cin, text)) {
|
|
std::istringstream input(text);
|
|
std::string command, token;
|
|
if (!(input >> command)) return 2;
|
|
std::vector<std::int64_t> args;
|
|
while (input >> token) {
|
|
std::int64_t value;
|
|
if (!integer(token, value)) return 2;
|
|
args.push_back(value);
|
|
}
|
|
int result = 0;
|
|
if (command == "RESET" && args.empty()) {
|
|
router.reset();
|
|
} else if (command == "ATTACH" && args.size() == 4) {
|
|
result = router.attach(args[0], args[1], args[2], args[3]);
|
|
} else if (command == "DETACH" && args.size() == 1) {
|
|
result = router.detach(args[0]);
|
|
} else if (command == "MASK" && args.size() == 2) {
|
|
result = router.set_mask(args[0], args[1]);
|
|
} else if (command == "RAISE" && args.size() == 2) {
|
|
result = router.raise(args[0], args[1]);
|
|
} else if (command == "CLEAR" && args.size() == 2) {
|
|
result = router.clear(args[0], args[1]);
|
|
} else if (command == "ENABLE" && args.size() == 2) {
|
|
result = router.enable(args[0], args[1]);
|
|
} else if (command == "MOVE" && args.size() == 2) {
|
|
result = router.move(args[0], args[1]);
|
|
} else if (command == "TRANSFER" && args.size() == 3) {
|
|
result = router.transfer(args[0], args[1], args[2]);
|
|
} else if (command == "PULSE" && args.size() == 2) {
|
|
result = router.pulse(args[0], args[1]);
|
|
} else if ((command == "BATCH" || command == "REBIND") && !args.empty()) {
|
|
if (args[0] < 0 || args[0] > 16 || args.size() != 1 + 2 * static_cast<std::size_t>(args[0])) return 2;
|
|
std::vector<irq::Change> changes;
|
|
for (std::size_t i = 1; i < args.size(); i += 2) {
|
|
changes.push_back({args[i], args[i + 1]});
|
|
}
|
|
result = command == "BATCH" ? router.batch_raise(changes) : router.rebind(changes);
|
|
} else {
|
|
return 2;
|
|
}
|
|
observe(router.snapshot(), result);
|
|
}
|
|
return 0;
|
|
}
|