Loading...
Searching...
No Matches
cb_mux.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Acutam Automation, LLC
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
27
28#include <stdint.h>
29
30/* For alternate cb_mux_cbid_t */
31#include "periph_cpu.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#ifndef HAVE_CB_MUX_CBID_T
41typedef unsigned int cb_mux_cbid_t;
42#endif
43
47typedef void (*cb_mux_cb_t)(void *);
48
59
63typedef void (*cb_mux_iter_t)(cb_mux_t *, void *);
64
71void cb_mux_add(cb_mux_t **head, cb_mux_t *entry);
72
79void cb_mux_del(cb_mux_t **head, cb_mux_t *entry);
80
90
101
112
123
131void cb_mux_iter(cb_mux_t *head, cb_mux_iter_t func, void *arg);
132
133#ifdef __cplusplus
134}
135#endif
136
void cb_mux_add(cb_mux_t **head, cb_mux_t *entry)
Add a new entry to the end of a cb_mux list.
struct cb_mux cb_mux_t
cb_mux list entry structure
cb_mux_t * cb_mux_find_low(cb_mux_t *head)
Find the entry with the lowest ID.
void cb_mux_del(cb_mux_t **head, cb_mux_t *entry)
Remove a entry from a cb_mux list.
void(* cb_mux_cb_t)(void *)
cb_mux callback type
Definition cb_mux.h:47
unsigned int cb_mux_cbid_t
cb_mux identifier type
Definition cb_mux.h:41
cb_mux_t * cb_mux_find_cbid(cb_mux_t *head, cb_mux_cbid_t cbid_val)
Find an entry in the list by ID.
cb_mux_cbid_t cb_mux_find_free_id(cb_mux_t *head)
Find the lowest unused ID.
cb_mux_t * cb_mux_find_high(cb_mux_t *head)
Find the entry with the highest ID.
void cb_mux_iter(cb_mux_t *head, cb_mux_iter_t func, void *arg)
Run a function on every item in the cb_mux list.
void(* cb_mux_iter_t)(cb_mux_t *, void *)
cb_mux iterate function callback type for cb_mux_iter
Definition cb_mux.h:63
cb_mux list entry structure
Definition cb_mux.h:52
struct cb_mux * next
next entry in the cb_mux list
Definition cb_mux.h:53
cb_mux_cbid_t cbid
identifier for this callback
Definition cb_mux.h:54
cb_mux_cb_t cb
callback function
Definition cb_mux.h:56
void * arg
argument for callback function
Definition cb_mux.h:57
void * info
optional extra information
Definition cb_mux.h:55