21 __atomic_fetch_add(&dev->refcount.counter, 1,
52 __atomic_store_n(&n->refcount.counter, 1, __ATOMIC_RELAXED);
68 existing = existing->next;
87 new_notifier->callback = n->
callback;
88 new_notifier->context = n->
context;
89 new_notifier->priority = n->
priority;
90 new_notifier->flags = n->
flags;
94 auto curr_chain = ¤t_dev->chain.head;
95 while (*curr_chain && (*curr_chain)->priority >= new_notifier->priority)
96 curr_chain = &(*curr_chain)->next;
100 new_notifier->next = *curr_chain;
101 *curr_chain = new_notifier;
102 __atomic_fetch_add(¤t_dev->chain.size, 1, __ATOMIC_RELAXED);
115#define MAX_SNAPSHOT 64
120 auto current = current_dev->chain.head;
122 snapshot[
count++] = current;
123 current = current->
next;
128 for (
int i = 0; i <
count; i++) {
133 __atomic_fetch_add(¤t_dev->event_received, 1, __ATOMIC_RELEASE);
149 while (timeout_count < timeout) {
150 uint64_t current_gen = __atomic_load_n(
152 if (current_gen != initial) {
void serial2_printf(const char *fmt,...)
static void irq_restore(uintptr_t flags)
static uintptr_t irq_save(void)
void * kalloc(size_t size)
void notify_dev_create(kstring name)
int notify_call(char *name, uint32_t event, void *data)
int notify_register(char *name, struct notifier *n)
static struct notify_dev_table notify_table
static void notify_dev_put(struct notify_dev *dev)
int wait_until_receive_notify(const char *name, uint64_t timeout)
static struct notify_dev * find_dev(const char *name)
#define NOTIFY_DEV_HASH_MASK
#define NOTIFY_DEV_HASH_SIZE
void spin_acquire(spinlock_t *lock)
void spin_release(spinlock_t *lock)
int strncmp(const char *s1, const char *s2, size_t n)
size_t strlen(const char *s)
void memset(void *ptr, int value, size_t num)
notify_callback_t callback
volatile uint64_t event_received
void usleep(const uint64_t time_ns)