amos 2f32624d3b Batch 18 (20261026-C-hwe-codegen-18): add 100 calibrated HWE code-gen tasks; pause production for rollout
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>
2026-10-27 17:52:13 +08:00

96 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 完整公开 C++ API
以下声明是API合同;私有实现可替换。所有方法在namespace irq内。行为、范围、优先级和输出顺序同时受contract.md约束。
```cpp
#ifndef IRQ_ROUTER_HPP
#define IRQ_ROUTER_HPP
#include <array>
#include <cstdint>
#include <memory>
#include <vector>
namespace irq {
constexpr int device_count = 8;
constexpr int line_count = 4;
constexpr std::int64_t valid_bits = 65535;
enum Status { OK = 0, RANGE = 1, EXISTS = 2, NOENT = 3, BUSY = 4, DUP = 5 };
struct Device {
bool present = false;
int line = -1;
bool shared = false;
bool enabled = false;
std::uint32_t mask = 0;
std::uint32_t pending = 0;
std::uint64_t handled = 0;
std::uint64_t none = 0;
std::uint64_t ack_bits = 0;
std::uint64_t raises = 0;
std::uint64_t cleared_bits = 0;
};
struct Line {
int cursor = 0;
std::uint64_t dispatches = 0;
std::uint64_t handled = 0;
std::uint64_t none = 0;
std::uint64_t visits = 0;
std::uint64_t ack_bits = 0;
};
struct Summary {
std::uint32_t members = 0;
std::uint32_t enabled_members = 0;
std::uint32_t ready_members = 0;
std::uint32_t pending_union = 0;
std::uint32_t ready_union = 0;
std::uint32_t deferred_union = 0;
std::uint64_t pending_bits = 0;
std::uint64_t ready_bits = 0;
std::uint64_t deferred_bits = 0;
};
struct Delivery {
int device = 0;
int result = 0;
std::uint32_t acknowledged = 0;
};
struct Change {
std::int64_t device;
std::int64_t value;
};
struct Snapshot {
std::array<Device, device_count> devices;
std::array<Line, line_count> lines;
std::array<Summary, line_count> summaries;
std::uint64_t accepted = 0;
std::uint64_t rejected = 0;
int last_line = -1;
int last_result = 0;
std::vector<Delivery> deliveries;
};
class Router {
public:
Router();
~Router();
Router(const Router&) = delete;
Router& operator=(const Router&) = delete;
void reset();
Status attach(std::int64_t device, std::int64_t line,
std::int64_t shared, std::int64_t mask);
Status detach(std::int64_t device);
Status set_mask(std::int64_t device, std::int64_t mask);
Status raise(std::int64_t device, std::int64_t bits);
Status clear(std::int64_t device, std::int64_t bits);
Status enable(std::int64_t device, std::int64_t enabled);
Status move(std::int64_t device, std::int64_t line);
Status batch_raise(const std::vector<Change>& changes);
Status rebind(const std::vector<Change>& changes);
Status transfer(std::int64_t source, std::int64_t target,
std::int64_t bits);
Status pulse(std::int64_t line, std::int64_t budget);
Snapshot snapshot() const;
private:
struct Impl;
std::unique_ptr<Impl> impl;
};
}
#endif
```