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>
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
#include "irq_internal.hpp"
|
|
namespace irqcycle {
|
|
Model::Model():impl_(new Impl) {}
|
|
Model::~Model()=default;
|
|
bool Model::Impl::valid_id(long long id) {
|
|
return id>=0 && id<8;
|
|
}
|
|
Result Model::Impl::access(const State& state,long long id,bool allow_closing) {
|
|
if (!valid_id(id)) return {1,0};
|
|
const auto entry=state.registrations.find(static_cast<int>(id));
|
|
if (entry==state.registrations.end()) return {3,0};
|
|
if (entry->second.state==3) return {4,0};
|
|
if (!allow_closing && entry->second.state==2) return {5,0};
|
|
return {};
|
|
}
|
|
Result Model::Impl::submit(const Event& event) {
|
|
State proposal=state;
|
|
Result result=reduce(proposal,event);
|
|
if (result.code==0) state=std::move(proposal);
|
|
return result;
|
|
}
|
|
Result Model::open(long long id,long long oneshot,long long priority,long long mode) {
|
|
return impl_->submit({Impl::Open,id,oneshot,priority,mode});
|
|
}
|
|
Result Model::set_mode(long long id,long long mode) {
|
|
return impl_->submit({Impl::Mode,id,mode});
|
|
}
|
|
Result Model::arrive(long long id,long long count) {
|
|
return impl_->submit({Impl::Arrive,id,count});
|
|
}
|
|
Result Model::begin(long long id) {
|
|
return impl_->submit({Impl::Begin,id});
|
|
}
|
|
Result Model::next() {
|
|
return impl_->submit({Impl::Next});
|
|
}
|
|
Result Model::end(long long id) {
|
|
return impl_->submit({Impl::End,id});
|
|
}
|
|
Result Model::free(long long id) {
|
|
return impl_->submit({Impl::Free,id});
|
|
}
|
|
Result Model::poll(long long token) const {
|
|
if (token<1 || token>10000) return {1,0};
|
|
auto entry=impl_->state.tokens.find(static_cast<std::uint64_t>(token));
|
|
if (entry==impl_->state.tokens.end()) return {9,0};
|
|
return {0,entry->second?1:0};
|
|
}
|
|
Result Model::inspect(long long id,View& out) const {
|
|
out=View{};
|
|
if (!Impl::valid_id(id)) return {1,0};
|
|
if (!impl_->state.registrations.count(static_cast<int>(id))) return {3,0};
|
|
out=Impl::project(impl_->state,static_cast<int>(id));
|
|
return {};
|
|
}
|
|
}
|