![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
BLE telemetry queues and link state (see tlm_ble.h). More...
Go to the source code of this file.
Data Structures | |
| struct | ring_t |
Macros | |
| #define | APP_BLE_STATE_DECIM_DEFAULT APP_BLE_STATE_DECIM |
| #define | TLM_BARRIER() __sync_synchronize() |
| #define | RING_MASK (TLM_BLE_RING_SIZE - 1u) |
Enumerations | |
| enum | { RHI = 0 , RLO = 1 , NRING = 2 } |
Functions | |
| void | tlm_ble_reset (void) |
| static uint32_t | level_pct (uint8_t type) |
| static int | push (ring_t *r, const uint8_t *frame, uint16_t len) |
| int | tlm_ble_push (const uint8_t *frame, uint16_t len) |
| Queue a whole frame or nothing. | |
| int | tlm_ble_push_hi (const uint8_t *frame, uint16_t len) |
| HI: AppTask | |
| uint16_t | tlm_ble_hi_free (void) |
| bytes free in HI | |
| int | tlm_ble_want_state (uint16_t seq) |
| 1 if a STATE frame with this sequence number must go over BLE (decimation) | |
| int | tlm_ble_take_init_request (void) |
| 1 once after the legacy [0x01] command: send INIT now (TelemetryTask) | |
| int | tlm_ble_take_subscribe (void) |
| 1 once after a client enabled notifications (AppTask: CAPS, INIT, CHECKS) | |
| void | tlm_ble_open_streams (void) |
| static uint32_t | avail (int i, const uint32_t *t) |
| uint16_t | tlm_ble_queued (void) |
| uint16_t | tlm_ble_peek (uint8_t *dst, uint16_t max) |
| Copies up to max bytes of the next notification into dst without removing them; tlm_ble_consume(n) with the same n removes exactly those bytes. | |
| void | tlm_ble_consume (uint16_t n) |
| void | tlm_ble_discard (void) |
| drop everything queued (consumer side) | |
| void | tlm_ble_set_state (tlm_ble_state_t st) |
| void | tlm_ble_set_mtu (uint16_t att_mtu) |
| void | tlm_ble_set_error (uint8_t ble_status) |
| last non-recoverable stack error | |
| void | tlm_ble_on_command (const uint8_t *data, uint16_t len) |
| legacy 0x01/0x02 | |
| tlm_ble_state_t | tlm_ble_state (void) |
| uint16_t | tlm_ble_mtu (void) |
| uint16_t | tlm_ble_chunk_max (void) |
| ATT_MTU - 3. | |
| uint32_t | tlm_ble_dropped (void) |
| uint8_t | tlm_ble_error (void) |
| uint8_t | tlm_ble_state_decim (void) |
Variables | |
| static ring_t | s_r [NRING] |
| static volatile uint32_t | s_dropped |
| static volatile uint8_t | s_state |
| static volatile uint16_t | s_mtu = TLM_BLE_MTU_DEFAULT |
| static volatile uint8_t | s_err |
| static volatile uint8_t | s_initReq |
| static volatile uint8_t | s_subReq |
| static volatile uint8_t | s_open |
| static volatile uint8_t | s_decim = APP_BLE_STATE_DECIM_DEFAULT |
| static uint16_t | s_lastSeq |
| static uint8_t | s_haveSeq |
| volatile uint8_t | g_dbg_ble_stall |
| Bench test of HANDOVER_FW.md §6 / §16.12 (debugger Live Expression): 1 = the BLE path stops on purpose (CMD writes ignored, TX thread idle). | |
| static int8_t | s_cur = -1 |
| static uint16_t | s_curRem |
| static uint32_t | s_planTail [NRING] |
| static int8_t | s_planCur |
| static uint16_t | s_planRem |
| static uint16_t | s_planTotal |
| static uint8_t | s_planValid |
| #define APP_BLE_STATE_DECIM_DEFAULT APP_BLE_STATE_DECIM |
| #define RING_MASK (TLM_BLE_RING_SIZE - 1u) |
| void tlm_ble_reset | ( | void | ) |
Definition at line 53 of file tlm_ble.c.
References APP_BLE_STATE_DECIM_DEFAULT, g_dbg_ble_stall, NRING, s_cur, s_curRem, s_decim, s_dropped, s_err, s_haveSeq, s_initReq, s_mtu, s_open, s_planValid, s_r, s_state, s_subReq, TLM_BLE_MTU_DEFAULT, and TLM_BLE_OFF.
|
static |
Definition at line 69 of file tlm_ble.c.
References PV2_FT_ACK, PV2_FT_CALIB, PV2_FT_CAPS, PV2_FT_CHECKS, PV2_FT_EVENT, PV2_FT_FLIGHT, PV2_FT_INIT, PV2_FT_LOG_DATA, PV2_FT_LOG_ENTRY, PV2_FT_NAV, PV2_FT_PARAM, PV2_FT_POWER, PV2_FT_STATE, and PV2_FT_STATUS.
Referenced by push().
|
static |
Definition at line 83 of file tlm_ble.c.
References ring_t::buf, ring_t::head, level_pct(), pos, RING_MASK, s_dropped, ring_t::tail, TLM_BARRIER, TLM_BLE_RING_SIZE, and used.
Referenced by tlm_ble_push(), and tlm_ble_push_hi().
| int tlm_ble_push | ( | const uint8_t * | frame, |
| uint16_t | len | ||
| ) |
Queue a whole frame or nothing.
0 = queued, 1 = no client streaming (or streams not open yet, LO only), -1 = refused (priority level or full, counted). LO: TelemetryTask
Definition at line 98 of file tlm_ble.c.
References push(), RLO, s_open, s_r, s_state, and TLM_BLE_STREAMING.
Referenced by TelemetryTask(), and tx_frame().
| int tlm_ble_push_hi | ( | const uint8_t * | frame, |
| uint16_t | len | ||
| ) |
HI: AppTask
Definition at line 104 of file tlm_ble.c.
References push(), RHI, s_r, s_state, and TLM_BLE_STREAMING.
Referenced by log_ble_out(), and tx().
| uint16_t tlm_ble_hi_free | ( | void | ) |
bytes free in HI
Definition at line 110 of file tlm_ble.c.
References ring_t::head, RHI, s_r, ring_t::tail, and TLM_BLE_RING_SIZE.
Referenced by list_pace(), and log_ble_out().
| int tlm_ble_want_state | ( | uint16_t | seq | ) |
| int tlm_ble_take_init_request | ( | void | ) |
1 once after the legacy [0x01] command: send INIT now (TelemetryTask)
Definition at line 128 of file tlm_ble.c.
References s_initReq.
Referenced by TelemetryTask().
| int tlm_ble_take_subscribe | ( | void | ) |
1 once after a client enabled notifications (AppTask: CAPS, INIT, CHECKS)
Definition at line 135 of file tlm_ble.c.
References s_subReq.
Referenced by app_step().
| void tlm_ble_open_streams | ( | void | ) |
Definition at line 142 of file tlm_ble.c.
References s_open.
Referenced by app_step().
|
static |
Definition at line 145 of file tlm_ble.c.
References ring_t::head, and s_r.
Referenced by tlm_ble_peek().
| uint16_t tlm_ble_queued | ( | void | ) |
Definition at line 147 of file tlm_ble.c.
References ring_t::head, RHI, RLO, s_r, and ring_t::tail.
| uint16_t tlm_ble_peek | ( | uint8_t * | dst, |
| uint16_t | max | ||
| ) |
Copies up to max bytes of the next notification into dst without removing them; tlm_ble_consume(n) with the same n removes exactly those bytes.
Definition at line 152 of file tlm_ble.c.
References avail(), ring_t::buf, n, NRING, pos, RHI, RING_MASK, RLO, s_cur, s_curRem, s_planCur, s_planRem, s_planTail, s_planTotal, s_planValid, s_r, ring_t::tail, TLM_BARRIER, and TLM_BLE_RING_SIZE.
| void tlm_ble_consume | ( | uint16_t | n | ) |
Definition at line 180 of file tlm_ble.c.
References n, RHI, RLO, s_cur, s_curRem, s_planCur, s_planRem, s_planTail, s_planTotal, s_planValid, s_r, ring_t::tail, and TLM_BARRIER.
| void tlm_ble_discard | ( | void | ) |
drop everything queued (consumer side)
Definition at line 190 of file tlm_ble.c.
References ring_t::head, RHI, RLO, s_cur, s_curRem, s_planValid, s_r, and ring_t::tail.
| void tlm_ble_set_state | ( | tlm_ble_state_t | st | ) |
Definition at line 198 of file tlm_ble.c.
References s_haveSeq, s_mtu, s_open, s_state, s_subReq, st(), TLM_BLE_CONNECTED, TLM_BLE_MTU_DEFAULT, and TLM_BLE_STREAMING.
| void tlm_ble_set_mtu | ( | uint16_t | att_mtu | ) |
Definition at line 211 of file tlm_ble.c.
References s_mtu, and TLM_BLE_MTU_DEFAULT.
| void tlm_ble_set_error | ( | uint8_t | ble_status | ) |
| void tlm_ble_on_command | ( | const uint8_t * | data, |
| uint16_t | len | ||
| ) |
legacy 0x01/0x02
Definition at line 219 of file tlm_ble.c.
References s_decim, s_haveSeq, s_initReq, TLM_BLE_CMD_SEND_INIT, and TLM_BLE_CMD_STATE_DECIM.
| tlm_ble_state_t tlm_ble_state | ( | void | ) |
Definition at line 235 of file tlm_ble.c.
References s_state.
Referenced by app_step(), log_ble_out(), send_status(), and streams().
| uint16_t tlm_ble_mtu | ( | void | ) |
Definition at line 236 of file tlm_ble.c.
References s_mtu.
Referenced by send_status().
| uint16_t tlm_ble_chunk_max | ( | void | ) |
| uint32_t tlm_ble_dropped | ( | void | ) |
Definition at line 238 of file tlm_ble.c.
References s_dropped.
Referenced by send_status().
| uint8_t tlm_ble_error | ( | void | ) |
Definition at line 239 of file tlm_ble.c.
References s_err.
Referenced by send_status().
Definition at line 33 of file tlm_ble.c.
Referenced by avail(), tlm_ble_consume(), tlm_ble_discard(), tlm_ble_hi_free(), tlm_ble_peek(), tlm_ble_push(), tlm_ble_push_hi(), tlm_ble_queued(), and tlm_ble_reset().
|
static |
Definition at line 34 of file tlm_ble.c.
Referenced by push(), tlm_ble_dropped(), and tlm_ble_reset().
|
static |
Definition at line 35 of file tlm_ble.c.
Referenced by tlm_ble_push(), tlm_ble_push_hi(), tlm_ble_reset(), tlm_ble_set_state(), tlm_ble_state(), and tlm_ble_want_state().
|
static |
Definition at line 36 of file tlm_ble.c.
Referenced by tlm_ble_chunk_max(), tlm_ble_mtu(), tlm_ble_reset(), tlm_ble_set_mtu(), and tlm_ble_set_state().
|
static |
Definition at line 37 of file tlm_ble.c.
Referenced by tlm_ble_error(), tlm_ble_reset(), and tlm_ble_set_error().
|
static |
Definition at line 38 of file tlm_ble.c.
Referenced by tlm_ble_on_command(), tlm_ble_reset(), and tlm_ble_take_init_request().
|
static |
Definition at line 38 of file tlm_ble.c.
Referenced by tlm_ble_reset(), tlm_ble_set_state(), and tlm_ble_take_subscribe().
|
static |
Definition at line 38 of file tlm_ble.c.
Referenced by tlm_ble_open_streams(), tlm_ble_push(), tlm_ble_reset(), tlm_ble_set_state(), and tlm_ble_want_state().
|
static |
Definition at line 39 of file tlm_ble.c.
Referenced by tlm_ble_on_command(), tlm_ble_reset(), tlm_ble_state_decim(), and tlm_ble_want_state().
|
static |
Definition at line 40 of file tlm_ble.c.
Referenced by tlm_ble_want_state().
|
static |
Definition at line 41 of file tlm_ble.c.
Referenced by tlm_ble_on_command(), tlm_ble_reset(), tlm_ble_set_state(), and tlm_ble_want_state().
| volatile uint8_t g_dbg_ble_stall |
Bench test of HANDOVER_FW.md §6 / §16.12 (debugger Live Expression): 1 = the BLE path stops on purpose (CMD writes ignored, TX thread idle).
The app-link failsafe must still fire at 1 s and 3 s.
Definition at line 43 of file tlm_ble.c.
Referenced by tlm_ble_reset().
|
static |
Definition at line 46 of file tlm_ble.c.
Referenced by tlm_ble_consume(), tlm_ble_discard(), tlm_ble_peek(), and tlm_ble_reset().
|
static |
Definition at line 47 of file tlm_ble.c.
Referenced by tlm_ble_consume(), tlm_ble_discard(), tlm_ble_peek(), and tlm_ble_reset().
|
static |
Definition at line 48 of file tlm_ble.c.
Referenced by tlm_ble_consume(), and tlm_ble_peek().
|
static |
Definition at line 49 of file tlm_ble.c.
Referenced by tlm_ble_consume(), and tlm_ble_peek().
|
static |
Definition at line 50 of file tlm_ble.c.
Referenced by tlm_ble_consume(), and tlm_ble_peek().
|
static |
Definition at line 50 of file tlm_ble.c.
Referenced by tlm_ble_consume(), and tlm_ble_peek().
|
static |
Definition at line 51 of file tlm_ble.c.
Referenced by tlm_ble_consume(), tlm_ble_discard(), tlm_ble_peek(), and tlm_ble_reset().