/src/barebox/include/bthread.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | | /* |
3 | | * Copyright (C) 2021 Ahmad Fatoum, Pengutronix |
4 | | */ |
5 | | |
6 | | #ifndef __BTHREAD_H_ |
7 | | #define __BTHREAD_H_ |
8 | | |
9 | | #include <linux/stddef.h> |
10 | | #include <linux/compiler.h> |
11 | | |
12 | | struct bthread; |
13 | | |
14 | | extern struct bthread *current; |
15 | | |
16 | | struct bthread *bthread_create(void (*threadfn)(void *), void *data, const char *namefmt, ...) |
17 | | __printf(3, 4); |
18 | | void bthread_cancel(struct bthread *bthread); |
19 | | |
20 | | void bthread_schedule(struct bthread *); |
21 | | void bthread_wake(struct bthread *bthread); |
22 | | void bthread_suspend(struct bthread *bthread); |
23 | | int bthread_should_stop(void); |
24 | | void __bthread_stop(struct bthread *bthread); |
25 | | void *bthread_data(struct bthread *bthread); |
26 | | void bthread_info(void); |
27 | | const char *bthread_name(struct bthread *bthread); |
28 | | bool bthread_is_main(struct bthread *bthread); |
29 | | |
30 | | /** |
31 | | * bthread_run - create and wake a thread. |
32 | | * @threadfn: the function to run for coming reschedule cycles |
33 | | * @data: data ptr for @threadfn. |
34 | | * @namefmt: printf-style name for the thread. |
35 | | * |
36 | | * Description: Convenient wrapper for bthread_create() followed by |
37 | | * bthread_wakeup(). Returns the bthread or NULL |
38 | | */ |
39 | | #define bthread_run(threadfn, data, namefmt, ...) \ |
40 | | ({ \ |
41 | | struct bthread *__b \ |
42 | | = bthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \ |
43 | | if (__b) \ |
44 | | bthread_wake(__b); \ |
45 | | __b; \ |
46 | | }) |
47 | | |
48 | | #ifdef CONFIG_BTHREAD |
49 | | void bthread_reschedule(void); |
50 | | #else |
51 | | static inline void bthread_reschedule(void) |
52 | 0 | { |
53 | 0 | } Unexecuted instantiation: startup.c:bthread_reschedule Unexecuted instantiation: slice.c:bthread_reschedule Unexecuted instantiation: menu.c:bthread_reschedule Unexecuted instantiation: oftree.c:bthread_reschedule Unexecuted instantiation: sched.c:bthread_reschedule Unexecuted instantiation: hush.c:bthread_reschedule Unexecuted instantiation: state_variables.c:bthread_reschedule Unexecuted instantiation: parser.c:bthread_reschedule Unexecuted instantiation: barebox.c:bthread_reschedule Unexecuted instantiation: boot.c:bthread_reschedule Unexecuted instantiation: fastboot.c:bthread_reschedule Unexecuted instantiation: ddr_spd.c:bthread_reschedule Unexecuted instantiation: ddr1_dimm_params.c:bthread_reschedule Unexecuted instantiation: ddr2_dimm_params.c:bthread_reschedule Unexecuted instantiation: ddr3_dimm_params.c:bthread_reschedule Unexecuted instantiation: ddr4_dimm_params.c:bthread_reschedule Unexecuted instantiation: m25p80.c:bthread_reschedule Unexecuted instantiation: usb.c:bthread_reschedule Unexecuted instantiation: hub.c:bthread_reschedule Unexecuted instantiation: of.c:bthread_reschedule Unexecuted instantiation: spi.c:bthread_reschedule Unexecuted instantiation: spi-mem.c:bthread_reschedule Unexecuted instantiation: gpio_spi.c:bthread_reschedule Unexecuted instantiation: i2c-gpio.c:bthread_reschedule Unexecuted instantiation: i2c.c:bthread_reschedule Unexecuted instantiation: i2c-smbus.c:bthread_reschedule Unexecuted instantiation: i2c-algo-bit.c:bthread_reschedule Unexecuted instantiation: led-gpio.c:bthread_reschedule Unexecuted instantiation: at25.c:bthread_reschedule Unexecuted instantiation: at24.c:bthread_reschedule Unexecuted instantiation: gpiolib.c:bthread_reschedule Unexecuted instantiation: of_gpio.c:bthread_reschedule Unexecuted instantiation: of_net.c:bthread_reschedule Unexecuted instantiation: rtc-ds1307.c:bthread_reschedule Unexecuted instantiation: loads.c:bthread_reschedule Unexecuted instantiation: readline.c:bthread_reschedule Unexecuted instantiation: bfetch.c:bthread_reschedule Unexecuted instantiation: gpio.c:bthread_reschedule Unexecuted instantiation: tftp.c:bthread_reschedule Unexecuted instantiation: dhcp.c:bthread_reschedule Unexecuted instantiation: spd_decode.c:bthread_reschedule Unexecuted instantiation: ip-route-get.c:bthread_reschedule Unexecuted instantiation: host.c:bthread_reschedule Unexecuted instantiation: parameter.c:bthread_reschedule Unexecuted instantiation: lib.c:bthread_reschedule Unexecuted instantiation: eth.c:bthread_reschedule Unexecuted instantiation: skbuff.c:bthread_reschedule Unexecuted instantiation: net.c:bthread_reschedule Unexecuted instantiation: sntp.c:bthread_reschedule Unexecuted instantiation: ping.c:bthread_reschedule Unexecuted instantiation: dns.c:bthread_reschedule Unexecuted instantiation: ifup.c:bthread_reschedule Unexecuted instantiation: fs.c:bthread_reschedule Unexecuted instantiation: nfs.c:bthread_reschedule |
54 | | #endif |
55 | | |
56 | | #endif |