ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
log_queue.c File Reference

Record queues (see log_queue.h). More...

#include "log_queue.h"
#include "spsc.h"
#include <string.h>
Include dependency graph for log_queue.c:

Go to the source code of this file.

Data Structures

struct  ring_t
 

Functions

uint8_t log_q_active (void)
 
void log_q_set_active (uint8_t on)
 
void log_q_reset (void)
 
int log_q_put (uint8_t src, uint8_t type, const void *p, uint8_t len)
 0 = queued
 
uint32_t log_q_get (uint8_t src, uint8_t *type, void *p, uint8_t cap)
 next record of 'src': returns payload length + 1, 0 if empty
 
uint16_t log_q_take_drops (uint8_t src)
 

Variables

static uint8_t s_b_imu [LOG_Q_IMU_SIZE]
 
static uint8_t s_b_batt [LOG_Q_BATT_SIZE]
 
static ring_t s_r [LOG_SRC_COUNT]
 
static volatile uint8_t s_active
 

Detailed Description

Record queues (see log_queue.h).

Definition in file log_queue.c.

Function Documentation

◆ log_q_active()

uint8_t log_q_active ( void  )

Definition at line 24 of file log_queue.c.

References s_active.

Referenced by log_records(), logf_att(), logf_est(), logf_event(), logf_flight(), logf_power(), and logf_vert().

Here is the caller graph for this function:

◆ log_q_set_active()

void log_q_set_active ( uint8_t  on)

Definition at line 25 of file log_queue.c.

References on, and s_active.

Referenced by recording().

Here is the caller graph for this function:

◆ log_q_reset()

void log_q_reset ( void  )

Definition at line 27 of file log_queue.c.

References ring_t::drops, ring_t::drops_seen, ring_t::head, LOG_SRC_COUNT, s_active, s_r, and ring_t::tail.

Referenced by log_task_init().

Here is the caller graph for this function:

◆ log_q_put()

int log_q_put ( uint8_t  src,
uint8_t  type,
const void *  p,
uint8_t  len 
)

0 = queued

Definition at line 33 of file log_queue.c.

References b, ring_t::buf, ring_t::drops, ring_t::head, LOG_SRC_COUNT, n, s_r, ring_t::size, SPSC_BARRIER, ring_t::tail, and used.

Referenced by logf_att(), logf_est(), logf_event(), logf_flight(), logf_power(), and logf_vert().

Here is the caller graph for this function:

◆ log_q_get()

uint32_t log_q_get ( uint8_t  src,
uint8_t *  type,
void *  p,
uint8_t  cap 
)

next record of 'src': returns payload length + 1, 0 if empty

Definition at line 52 of file log_queue.c.

References b, ring_t::buf, cap, ring_t::head, LOG_SRC_COUNT, s_r, ring_t::size, SPSC_BARRIER, and ring_t::tail.

Referenced by drain(), and log_task_step().

Here is the caller graph for this function:

◆ log_q_take_drops()

uint16_t log_q_take_drops ( uint8_t  src)

Definition at line 73 of file log_queue.c.

References ring_t::drops, ring_t::drops_seen, LOG_SRC_COUNT, n, and s_r.

Referenced by drain(), and log_task_step().

Here is the caller graph for this function:

Variable Documentation

◆ s_b_imu

uint8_t s_b_imu[LOG_Q_IMU_SIZE]
static

Definition at line 17 of file log_queue.c.

◆ s_b_batt

uint8_t s_b_batt[LOG_Q_BATT_SIZE]
static

Definition at line 17 of file log_queue.c.

◆ s_r

ring_t s_r[LOG_SRC_COUNT]
static
Initial value:
= {
{ s_b_imu, LOG_Q_IMU_SIZE, 0, 0, 0, 0 },
{ s_b_batt, LOG_Q_BATT_SIZE, 0, 0, 0, 0 },
}
static uint8_t s_b_batt[LOG_Q_BATT_SIZE]
Definition log_queue.c:17
static uint8_t s_b_imu[LOG_Q_IMU_SIZE]
Definition log_queue.c:17
#define LOG_Q_BATT_SIZE
Definition log_queue.h:21
#define LOG_Q_IMU_SIZE
~1.2 s of ImuTask records: covers a sector erase
Definition log_queue.h:20

Definition at line 18 of file log_queue.c.

Referenced by log_q_get(), log_q_put(), log_q_reset(), and log_q_take_drops().

◆ s_active

volatile uint8_t s_active
static

Definition at line 22 of file log_queue.c.

Referenced by log_q_active(), log_q_reset(), and log_q_set_active().