amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
One user-space repair task per eligible HWE debug-diag / compile-deploy base
ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content
filter. Each ships a public spec with a check-to-basis table, at least two
defects with single-fix fixtures, a symptom-masking fixture and an alternative
correct implementation. Claude re-checked all 320: structure, the HWE quality
items and trace6 Docker calibration receipts against current digests
(320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120
ad-hoc family names; the next batch maps them to the canonical list.
The batch's 1,256-line progress log stays in its factory report and the
36-local branch batch15-hwe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:55:56 +08:00

83 lines
2.2 KiB
C

#ifndef PHASE_H
#define PHASE_H
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#define TIMER_CHANNELS 16
#define TIMER_LIMIT INT64_C(1000000000)
#define TIMER_MAX_PERIOD INT64_C(1000000)
#define TIMER_LINE_SIZE 257
#define TIMER_WORDS 8
typedef enum {
TIMER_COUNT = 0,
TIMER_LATEST = 1
} TimerMode;
typedef enum {
TIMER_OK = 0,
TIMER_SYNTAX = -1,
TIMER_RANGE = -2,
TIMER_MISSING = -3,
TIMER_BACKWARD = -4
} TimerResult;
typedef struct {
int present;
int enabled;
int id;
int64_t period;
int64_t phase;
int64_t epoch;
TimerMode mode;
int64_t next;
int64_t fired;
int64_t skipped;
} TimerChannel;
typedef struct {
int64_t now;
TimerChannel channels[TIMER_CHANNELS];
} TimerBank;
typedef struct {
int id;
int64_t due;
int64_t first;
int64_t last;
int64_t skipped;
int64_t next;
} TimerEvent;
typedef struct {
int64_t now;
size_t configured;
size_t enabled;
int64_t fired;
int64_t skipped;
} TimerStats;
int timer_id_valid(int64_t id);
int timer_coord_valid(int64_t value);
int timer_period_valid(int64_t period);
int timer_mode_valid(TimerMode mode);
int64_t timer_residue(int64_t value, int64_t period);
int64_t timer_next(int64_t now, int64_t epoch, int64_t phase, int64_t period);
int64_t timer_due(int64_t next, int64_t target, int64_t period);
const char *timer_mode_name(TimerMode mode);
const char *timer_error_name(int code);
void timer_bank_reset(TimerBank *bank, int64_t now);
int timer_bank_put(TimerBank *bank, int id, int64_t period,
int64_t phase, int64_t epoch, TimerMode mode);
int timer_bank_peek(const TimerBank *bank, int id, TimerChannel *out);
int timer_bank_enable(TimerBank *bank, int id, int enabled);
int timer_bank_shift(TimerBank *bank, int id, int64_t delta);
int timer_bank_drop(TimerBank *bank, int id);
int timer_bank_tick(TimerBank *bank, int64_t target,
TimerEvent events[TIMER_CHANNELS], size_t *count);
size_t timer_bank_list(const TimerBank *bank, TimerChannel out[TIMER_CHANNELS]);
TimerStats timer_bank_stats(const TimerBank *bank);
int timer_wire(TimerBank *bank, const char *line, FILE *output);
int timer_cli(FILE *input, FILE *output);
#endif