Loading...
Searching...
No Matches
cb_mux.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Acutam Automation, LLC
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
29#ifndef CB_MUX_H
30#define CB_MUX_H
31
32#include <stdint.h>
33
34/* For alternate cb_mux_cbid_t */
35#include "periph_cpu.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41#ifndef HAVE_CB_MUX_CBID_T
45typedef unsigned int cb_mux_cbid_t;
46#endif
47
51typedef void (*cb_mux_cb_t)(void *);
52
63
67typedef void (*cb_mux_iter_t)(cb_mux_t *, void *);
68
75void cb_mux_add(cb_mux_t **head, cb_mux_t *entry);
76
83void cb_mux_del(cb_mux_t **head, cb_mux_t *entry);
84
94
105
116
127
135void cb_mux_iter(cb_mux_t *head, cb_mux_iter_t func, void *arg);
136
137#ifdef __cplusplus
138}
139#endif
140
143#endif /* CB_MUX_H */
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:51
unsigned int cb_mux_cbid_t
cb_mux identifier type
Definition cb_mux.h:45
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:67
cb_mux list entry structure
Definition cb_mux.h:56
struct cb_mux * next
next entry in the cb_mux list
Definition cb_mux.h:57
cb_mux_cbid_t cbid
identifier for this callback
Definition cb_mux.h:58
cb_mux_cb_t cb
callback function
Definition cb_mux.h:60
void * arg
argument for callback function
Definition cb_mux.h:61
void * info
optional extra information
Definition cb_mux.h:59