Route D (real fixes in embedded open-source projects) keeps producing the hard tasks: of 64 measured so far, 15 are HARD and 4 MEDIUM, mostly because Qwen exhausts its context in the larger real workspaces. This adds CANopen SRDO and ASCII timing, FreeRTOS DHCP, lwIP MQTT fragments, printf extremal exponents, Zephyr packet buffers and heatshrink (HARD), plus lwjson, RFM9x, SFUD and nanopb proto3 (MEDIUM). From batch 27 (spec-dense implementation tasks) come one HARD and one MEDIUM; that batch is winding down after 30 tasks gave 1 HARD and 3 MEDIUM. Each task comes from the commit Qwen measured, its digest matches, and it is still present at the batch branch head. Agent timeouts stay excluded: a pyserial attempt timed out on Qwen's own blocking read yet graded PASS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.5 KiB
C
43 lines
1.5 KiB
C
/* SPDX-License-Identifier: Apache-2.0
|
|
* Deterministic, single-threaded host port of the Zephyr kernel primitives.
|
|
* Semaphore waits execute one pending scheduler action when no token exists.
|
|
*/
|
|
#ifndef HOST_KERNEL_H
|
|
#define HOST_KERNEL_H
|
|
#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
#define BIT(n) (1U << (n))
|
|
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
|
#define ALWAYS_INLINE inline
|
|
#define CONFIG_MULTITHREADING 1
|
|
#define CONFIG_MPSC_CLEAR_ALLOCATED 0
|
|
#define IS_ENABLED(x) (x)
|
|
#define ARG_UNUSED(x) (void)(x)
|
|
#define __ASSERT_NO_MSG(x) assert(x)
|
|
#define printk printf
|
|
static inline bool is_power_of_two(uint32_t n) { return n && !(n & (n-1)); }
|
|
typedef int k_timeout_t;
|
|
#define K_NO_WAIT 0
|
|
#define K_FOREVER (-1)
|
|
#define K_MSEC(n) (n)
|
|
#define K_TIMEOUT_EQ(a,b) ((a)==(b))
|
|
struct k_spinlock { int held; };
|
|
typedef struct { unsigned int key; } k_spinlock_key_t;
|
|
static inline k_spinlock_key_t k_spin_lock(struct k_spinlock *lock) {
|
|
k_spinlock_key_t key = {1}; lock->held = 1; return key;
|
|
}
|
|
static inline void k_spin_unlock(struct k_spinlock *lock, k_spinlock_key_t key) {
|
|
(void)key; lock->held = 0;
|
|
}
|
|
static inline bool k_is_in_isr(void) { return false; }
|
|
static inline bool arch_irq_unlocked(unsigned int key) { return key != 0; }
|
|
struct k_sem { unsigned int count, limit; };
|
|
int k_sem_init(struct k_sem *, unsigned int, unsigned int);
|
|
int k_sem_take(struct k_sem *, k_timeout_t);
|
|
void k_sem_give(struct k_sem *);
|
|
#endif
|