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
9#pragma once
10
30
31#include <stdint.h>
32
33/* For alternate cb_mux_cbid_t */
34#include "periph_cpu.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#ifndef HAVE_CB_MUX_CBID_T
44typedef unsigned int cb_mux_cbid_t;
45#endif
46
50typedef void (*cb_mux_cb_t)(void *);
51
62
66typedef void (*cb_mux_iter_t)(cb_mux_t *, void *);
67
74void cb_mux_add(cb_mux_t **head, cb_mux_t *entry);
75
82void cb_mux_del(cb_mux_t **head, cb_mux_t *entry);
83
93
104
115
126
134void cb_mux_iter(cb_mux_t *head, cb_mux_iter_t func, void *arg);
135
136#ifdef __cplusplus
137}
138#endif
139
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:50
unsigned int cb_mux_cbid_t
cb_mux identifier type
Definition cb_mux.h:44
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:66
cb_mux list entry structure
Definition cb_mux.h:55
struct cb_mux * next
next entry in the cb_mux list
Definition cb_mux.h:56
cb_mux_cbid_t cbid
identifier for this callback
Definition cb_mux.h:57
cb_mux_cb_t cb
callback function
Definition cb_mux.h:59
void * arg
argument for callback function
Definition cb_mux.h:60
void * info
optional extra information
Definition cb_mux.h:58