STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
records.h
Go to the documentation of this file.
1#ifndef STAR_RECORDS_H
2#define STAR_RECORDS_H
3
4/*
5 * Record types and payloads: the flight computer's data, as it goes into the
6 * eMMC log (emmc_log_append: types >= 0x10; 0x01-0x0F belong to the log) and
7 * the SD NAND mirror. Fixed little-endian layouts (Cortex-M7 and the host
8 * test machines are little-endian); sizes are pinned so a change is a
9 * deliberate format change. Every payload starts with t_us, the board_time
10 * microsecond stamp of the sample (TIM2, wraps every ~71.6 min).
11 */
12
13#include <stdint.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19enum {
20 REC_IMU = 0x10, /* rec_imu_t */
21 REC_HIGHG = 0x11, /* rec_highg_t */
22 REC_BARO = 0x12, /* rec_baro_t */
23 REC_GNSS = 0x13, /* rec_gnss_t (gnss_core) */
24 REC_HEALTH = 0x14,
25 REC_EVENT = 0x15,
26};
27
28/* Where a task core hands its records (eMMC log on the board, a list in
29 * tests). Called from task context only. */
30typedef struct {
31 void (*record)(void* ctx, uint8_t type, const void* data, uint8_t len);
32 void* ctx;
34
35typedef struct __attribute__((packed)) {
36 uint32_t t_us;
37 int16_t temp; /* ISM330DHCX raw: degC = 25 + temp / 256 */
38 int16_t gyro[3]; /* raw, 140 mdps/LSB */
39 int16_t accel[3]; /* raw, 0.488 mg/LSB */
41
42typedef struct __attribute__((packed)) {
43 uint32_t t_us;
44 int8_t accel[3]; /* H3LIS100DL raw, 780 mg/digit */
46
47typedef struct __attribute__((packed)) {
48 uint32_t t_us; /* end of the D1 (pressure) conversion */
49 int32_t temp_c100;
50 int32_t pressure_pa;
52
53typedef struct __attribute__((packed)) {
54 uint32_t t_us; /* arrival of the NAV-PVT frame (UART9 RX) */
55 uint32_t pps_us; /* latest GPS TIMEPULSE edge before it (0: none yet) */
56 uint32_t itow_ms;
57 int32_t lat_e7, lon_e7; /* 1e-7 deg */
58 int32_t hmsl_mm;
59 int32_t vel_n_mms, vel_e_mms, vel_d_mms;
60 uint32_t hacc_mm, vacc_mm;
61 uint16_t pdop_e2;
62 uint8_t fix_type, num_sv, flags;
64
65_Static_assert(sizeof(rec_imu_t) == 18, "rec_imu_t layout");
66_Static_assert(sizeof(rec_gnss_t) == 49, "rec_gnss_t layout");
67_Static_assert(sizeof(rec_highg_t) == 7, "rec_highg_t layout");
68_Static_assert(sizeof(rec_baro_t) == 12, "rec_baro_t layout");
69
70#ifdef __cplusplus
71}
72#endif
73#endif
int32_t temp
Definition flight_e2e.c:78
rec_gnss_t
Definition records.h:63
rec_baro_t
Definition records.h:51
rec_highg_t
Definition records.h:45
@ REC_HIGHG
Definition records.h:21
@ REC_GNSS
Definition records.h:23
@ REC_BARO
Definition records.h:22
@ REC_HEALTH
Definition records.h:24
@ REC_IMU
Definition records.h:20
@ REC_EVENT
Definition records.h:25
rec_imu_t
Definition records.h:40
void * ctx
Definition records.h:32
void(* record)(void *ctx, uint8_t type, const void *data, uint8_t len)
Definition records.h:31
__attribute__((weak))
Definition syscalls.c:67