![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Lock-free single-producer single-consumer queue of fixed-size items. More...
#include <stdint.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | spsc_t |
Macros | |
| #define | SPSC_BARRIER() __sync_synchronize() |
| #define | SPSC_DEFINE(name, type, n) |
Functions | |
| static void | spsc_reset (spsc_t *q) |
| static int | spsc_push (spsc_t *q, const void *it) |
| static int | spsc_pop (spsc_t *q, void *it) |
| static uint32_t | spsc_count (const spsc_t *q) |
Lock-free single-producer single-consumer queue of fixed-size items.
One thread pushes, one thread pops; no mutex, no blocking, safe on Cortex-M (32-bit aligned index stores are atomic, barriers order data and index). Capacity N must be a power of 2.
Definition in file spsc.h.
| #define SPSC_DEFINE | ( | name, | |
| type, | |||
| n | |||
| ) |
|
inlinestatic |
Definition at line 33 of file spsc.h.
References spsc_t::head, and spsc_t::tail.
Referenced by batt_task_init(), ext_init(), fc_init(), fsh_reset(), and log_task_init().
|
inlinestatic |
< full
Definition at line 35 of file spsc.h.
References spsc_t::buf, spsc_t::head, spsc_t::item, spsc_t::mask, SPSC_BARRIER, and spsc_t::tail.
Referenced by batt_task_post_scales(), event(), ext_step(), fc_batt_signal(), fc_post(), fsh_apply_post(), fsh_cal_push(), log_task_ble_cmd(), port_send(), result(), and to_app().
|
inlinestatic |
< empty
Definition at line 45 of file spsc.h.
References spsc_t::buf, spsc_t::head, spsc_t::item, spsc_t::mask, SPSC_BARRIER, and spsc_t::tail.
Referenced by batt_task_step(), battery(), ext_take(), fc_service(), fc_take_event(), fc_take_result(), fsh_apply_take(), fsh_cal_pop(), log_task_ble_take(), log_task_step(), and log_task_usb_app_take().
|
inlinestatic |
Definition at line 56 of file spsc.h.
References spsc_t::head, and spsc_t::tail.
Referenced by port_room(), and port_room_ack().