|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
#include <stdarg.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "emmc_log.h"#include "fake_baro.h"#include "fake_gnss.h"#include "fake_regs.h"#include "gnss_core.h"#include "sensors_core.h"Go to the source code of this file.
Classes | |
| struct | card_t |
| struct | rec_t |
| struct | image_t |
| struct | faults_t |
| struct | world_t |
| struct | check_t |
Macros | |
| #define | FLIGHT_US 20000000U |
| #define | T_LAUNCH_US 2000000U /* ARMED -> LAUNCHED */ |
| #define | T_BURNOUT_US 4000000U /* boost ends */ |
| #define | T_RECOVERY_US 10000000U |
| #define | BS EMMC_BLOCK_SIZE |
| #define | DATA_START EMMC_LOG_DEFAULT_DATA_START |
| #define | CAPACITY (DATA_START + 8192U) |
| #define | MAX_RECS 40000U |
| #define | WAKE_LATENCY_US 37U |
| #define | EXPECT(cond, ...) |
Enumerations | |
| enum | { PAD , BOOST , COAST , DESCENT } |
Functions | |
| static int | phase_at (uint32_t t) |
| static void | imu_truth (uint32_t t, int16_t out[7]) |
| static void | highg_truth (uint32_t t, int8_t out[3]) |
| static void | gps_truth (uint32_t t, ubx_pvt_t *v) |
| static emmc_status_t | c_start (void *ctx, uint32_t *count) |
| static emmc_status_t | c_read (void *ctx, uint32_t lba, void *buf, uint32_t n, uint32_t budget) |
| static emmc_status_t | c_write (void *ctx, uint32_t lba, const void *buf, uint32_t n, uint32_t budget) |
| static uint32_t | crc32_ref (const uint8_t *p, size_t n) |
| static uint32_t | rd32 (const uint8_t *p) |
| static void | read_image (const card_t *card, image_t *img, unsigned max) |
| static void | sink (void *ctx, uint8_t type, const void *data, uint8_t len) |
| static void | set_chips (world_t *w, uint32_t t) |
| static void | change_state (world_t *w, flight_state_t to) |
| static void | world_init (world_t *w, const faults_t *faults) |
| static void | service_card (world_t *w) |
| static int32_t | diff (uint32_t a, uint32_t b) |
| static void | fly (world_t *w) |
| static void | world_free (world_t *w) |
| static void | note (const char *fmt,...) |
| static void | nominal (void) |
| static void | check_sensor_rates (void) |
| static void | check_sample_values (void) |
| static void | check_timestamps (void) |
| static void | check_conservation (void) |
| static void | check_emmc_roundtrip (void) |
| static void | check_emmc_stall (void) |
| static void | check_fault_imu_silent (void) |
| static void | check_gps (void) |
| int | main (int argc, char **argv) |
Variables | |
| struct { | |
| uint32_t d1 | |
| uint32_t d2 | |
| int32_t temp | |
| int32_t p | |
| } | kBaro [] |
| static char | detail [512] |
| static bool | ok |
| static world_t | W |
| static image_t | IMG |
| static bool | flown |
| static const check_t | checks [] |
| #define BS EMMC_BLOCK_SIZE |
Definition at line 104 of file flight_e2e.c.
Referenced by c_read(), c_write(), decode(), disk_new(), f_read(), f_write(), nominal(), read_image(), test_session_roundtrip(), test_torn_write_hole(), and world_init().
| #define CAPACITY (DATA_START + 8192U) |
Definition at line 106 of file flight_e2e.c.
Referenced by c_read(), c_start(), c_write(), read_image(), and world_init().
| #define DATA_START EMMC_LOG_DEFAULT_DATA_START |
Definition at line 105 of file flight_e2e.c.
Referenced by config(), decode(), nominal(), read_image(), test_backpressure(), test_flight_keeps_recording(), test_flush_interval(), test_full(), test_no_io_before_arm(), test_session_roundtrip(), test_sessions_and_remount(), test_stale_epoch(), test_start_failure(), test_torn_write(), test_torn_write_hole(), and test_write_retry().
| #define EXPECT | ( | cond, | |
| ... ) |
Definition at line 436 of file flight_e2e.c.
Referenced by check_conservation(), check_emmc_roundtrip(), check_emmc_stall(), check_fault_imu_silent(), check_gps(), check_sample_values(), check_sensor_rates(), and check_timestamps().
| #define FLIGHT_US 20000000U |
Definition at line 36 of file flight_e2e.c.
Referenced by check_sensor_rates(), and fly().
| #define MAX_RECS 40000U |
Definition at line 214 of file flight_e2e.c.
Referenced by check_emmc_stall(), nominal(), sink(), and world_init().
| #define T_BURNOUT_US 4000000U /* boost ends */ |
Definition at line 38 of file flight_e2e.c.
Referenced by phase_at().
| #define T_LAUNCH_US 2000000U /* ARMED -> LAUNCHED */ |
Definition at line 37 of file flight_e2e.c.
Referenced by phase_at().
| #define T_RECOVERY_US 10000000U |
Definition at line 39 of file flight_e2e.c.
Referenced by phase_at().
| #define WAKE_LATENCY_US 37U |
Definition at line 215 of file flight_e2e.c.
Referenced by fly().
| anonymous enum |
| Enumerator | |
|---|---|
| PAD | |
| BOOST | |
| COAST | |
| DESCENT | |
Definition at line 41 of file flight_e2e.c.
|
static |
Definition at line 120 of file flight_e2e.c.
References card_t::blocks, BS, CAPACITY, EMMC_ERR_PARAM, and EMMC_OK.
Referenced by world_init().
|
static |
Definition at line 115 of file flight_e2e.c.
References CAPACITY, count(), and EMMC_OK.
Referenced by world_init().
|
static |
Definition at line 129 of file flight_e2e.c.
References card_t::blocks, BS, CAPACITY, EMMC_ERR_PARAM, EMMC_ERR_TIMEOUT, EMMC_OK, card_t::fail_from_ms, card_t::fail_until_ms, card_t::failed_writes, card_t::now_ms, and card_t::writes.
Referenced by world_init().
|
static |
Definition at line 312 of file flight_e2e.c.
References emmc_log_on_state(), world_t::log, world_t::now, and world_t::state.
Referenced by fly(), and world_init().
|
static |
Definition at line 545 of file flight_e2e.c.
References rec_t::data, EMMC_REC_USER_FIRST, EXPECT, IMG, rec_t::len, nominal(), note(), rec_t::t_ms, rec_t::type, and W.
|
static |
Definition at line 567 of file flight_e2e.c.
References EMMC_DISK_MOUNTED, EMMC_REC_SESSION_END, EMMC_REC_SESSION_START, EMMC_REC_STATE, EXPECT, IMG, nominal(), note(), and W.
|
static |
Definition at line 586 of file flight_e2e.c.
References world_t::card, faults_t::card_fail_from_ms, emmc_log_stats_t::chunks_lost, emmc_log_t::disk, emmc_log_stats_t::dropped, EMMC_DISK_FAULT, EMMC_REC_USER_FIRST, EXPECT, card_t::failed_writes, fly(), img, world_t::log, MAX_RECS, world_t::n_produced, world_t::n_type, note(), world_t::produced, read_image(), world_t::sealed_before_stall_ms, world_t::stall_seen, emmc_log_t::stats, rec_t::t_ms, rec_t::type, world_free(), world_init(), and emmc_log_stats_t::write_errors.
|
static |
Definition at line 635 of file flight_e2e.c.
References world_t::core, rec_t::data, EXPECT, fly(), sensors_core_t::imu, sensors_device_t::inits, world_t::n_produced, world_t::n_type, note(), sensors_device_t::ok, world_t::produced, REC_IMU, SENSORS_IMU_PERIOD_US, SENSORS_RETRY_US, rec_t::type, world_free(), and world_init().
|
static |
Definition at line 664 of file flight_e2e.c.
References rec_t::data, gnss_core_t::detected_baud, fake_gnss_t::dynmodel, EXPECT, fly(), g, world_t::gnss, GNSS_RUN, world_t::gps, gps_truth(), ubx_pvt_t::hmsl_mm, ubx_pvt_t::itow_ms, ubx_pvt_t::lat_e7, ubx_pvt_t::lon_e7, fake_gnss_t::module_baud, world_t::n_gnss, world_t::n_produced, fake_gnss_t::nmea_on, note(), NULL, ubx_pvt_t::pdop_e2, world_t::produced, fake_gnss_t::rate_ms, REC_GNSS, rec_gnss_t, gnss_core_t::state, rec_t::type, UBX_DYNMODEL_AIR4, ubx_pvt_t::vel_d_mms, world_free(), and world_init().
|
static |
Definition at line 480 of file flight_e2e.c.
References EXPECT, g, highg_truth(), imu_truth(), kBaro, nominal(), note(), p, phase_at(), r, REC_BARO, rec_baro_t, REC_HIGHG, rec_highg_t, REC_IMU, rec_imu_t, SENSORS_BARO_STEP_US, and W.
|
static |
|
static |
Definition at line 525 of file flight_e2e.c.
References EXPECT, nominal(), note(), r, REC_HIGHG, REC_IMU, SENSORS_HIGHG_PERIOD_US, SENSORS_IMU_PERIOD_US, and W.
|
static |
|
static |
|
static |
Definition at line 369 of file flight_e2e.c.
References BOOST, change_state(), world_t::core, DESCENT, diff(), world_t::edge_highg, world_t::edge_imu, emmc_log_backlog(), fake_gnss_emit(), FLIGHT_ARMED, FLIGHT_IDLE, FLIGHT_LAUNCHED, FLIGHT_RECOVERY, FLIGHT_US, world_t::gnss, gnss_core_feed(), gnss_core_poll(), gnss_core_set_pps(), world_t::gps, world_t::log, world_t::next_gps_us, world_t::next_highg, world_t::next_imu, world_t::next_pps_us, world_t::next_service, world_t::now, phase_at(), sensors_core_step(), sensors_core_wait_us(), SENSORS_EV_HIGHG, SENSORS_EV_IMU, SENSORS_HIGHG_PERIOD_US, SENSORS_IMU_PERIOD_US, service_card(), set_chips(), world_t::state, and WAKE_LATENCY_US.
Referenced by check_emmc_stall(), check_fault_imu_silent(), check_gps(), nominal(), test_flight_launch_and_report::shipped_flight(), test_vehicle_drag::shipped_flight(), test_flight_ullage_and_depletion::test_a_tank_with_no_ullage_is_refused_by_name(), test_flight_ullage_and_depletion::test_apogee_is_continuous_in_the_load(), test_vehicle_drag::test_drag_grows_with_the_vehicle(), test_flight_ullage_and_depletion::test_impulse_is_the_curve_integral_at_the_edge(), test_flight_launch_and_report::test_launch_angle_costs_what_a_gravity_turn_says(), test_flight_launch_and_report::test_launch_comes_from_the_config(), test_layer2_required_impulse::test_layer2_and_the_flight_agree_on_the_shipped_vehicle(), test_flight_ullage_and_depletion::test_one_percent_short_loses_one_percent_of_impulse(), test_flight_ullage_and_depletion::test_pressurant_moved_into_the_ullage_stays_on_board(), test_flight_launch_and_report::test_requirement_checks_fire_only_when_declared(), test_vehicle_drag::test_rougher_skin_more_drag(), test_flight_ullage_and_depletion::test_small_tank_at_ninety_percent_flies(), test_flight_ullage_and_depletion::test_ullage_gas_fills_the_real_ullage_at_tank_pressure(), and test_vehicle_drag::test_user_table_is_flown_as_given().
|
static |
Definition at line 87 of file flight_e2e.c.
References DESCENT, ubx_pvt_t::fix_type, ubx_pvt_t::flags, ubx_pvt_t::hacc_mm, ubx_pvt_t::hmsl_mm, ubx_pvt_t::itow_ms, ubx_pvt_t::lat_e7, ubx_pvt_t::lon_e7, ubx_pvt_t::num_sv, ubx_pvt_t::pdop_e2, phase_at(), ubx_pvt_t::vacc_mm, and ubx_pvt_t::vel_d_mms.
Referenced by check_gps(), and world_init().
|
static |
Definition at line 67 of file flight_e2e.c.
References phase_at().
Referenced by check_sample_values(), and set_chips().
|
static |
Definition at line 55 of file flight_e2e.c.
References phase_at().
Referenced by check_sample_values(), and set_chips().
| int main | ( | int | argc, |
| char ** | argv ) |
|
static |
Definition at line 455 of file flight_e2e.c.
References BS, DATA_START, flown, fly(), IMG, MAX_RECS, NULL, read_image(), W, and world_init().
Referenced by check_conservation(), check_emmc_roundtrip(), check_sample_values(), check_sensor_rates(), and check_timestamps().
|
static |
Definition at line 444 of file flight_e2e.c.
Referenced by check_conservation(), check_emmc_roundtrip(), check_emmc_stall(), check_fault_imu_silent(), check_gps(), check_sample_values(), check_sensor_rates(), and check_timestamps().
|
static |
Definition at line 43 of file flight_e2e.c.
References BOOST, COAST, DESCENT, PAD, T_BURNOUT_US, T_LAUNCH_US, and T_RECOVERY_US.
Referenced by check_sample_values(), fly(), gps_truth(), highg_truth(), imu_truth(), and set_chips().
|
static |
Definition at line 169 of file flight_e2e.c.
References p.
Referenced by decode(), read_image(), and test_backpressure().
Definition at line 174 of file flight_e2e.c.
References b, BS, CAPACITY, card, crc32_ref(), DATA_START, img, max, o, r, and rd32().
Referenced by check_emmc_stall(), and nominal().
|
static |
Definition at line 356 of file flight_e2e.c.
References world_t::card, emmc_log_backlog(), emmc_log_service(), world_t::log, world_t::now, and card_t::now_ms.
Referenced by fly().
|
static |
Definition at line 289 of file flight_e2e.c.
References world_t::baro, fake_regs_t::clear_after_reads, fake_baro_t::d1, fake_baro_t::d2, fake_regs_t::fail_after, world_t::faults, g, world_t::highg, highg_truth(), world_t::imu, faults_t::imu_fail_from, faults_t::imu_fail_until, imu_truth(), kBaro, phase_at(), fake_regs_t::regs, fake_regs_t::self_clear_bits, fake_regs_t::self_clear_reg, and fake_regs_t::transfers.
Referenced by fly(), and world_init().
|
static |
Definition at line 246 of file flight_e2e.c.
References world_t::appended, world_t::backwards, faults_t::card_fail_from_ms, faults_t::card_fail_until_ms, world_t::chunk_start_ms, emmc_log_append(), world_t::faults, emmc_log_t::fill_block, emmc_log_t::fill_chunk, emmc_log_t::fill_offset, world_t::first_t, emmc_log_t::has_fill, world_t::last_t, world_t::log, MAX_RECS, world_t::n_gnss, world_t::n_produced, world_t::n_type, world_t::now, ok, world_t::produced, r, REC_GNSS, REC_IMU, world_t::refused, world_t::sealed_before_stall_ms, and world_t::stall_seen.
Referenced by shift(), and world_init().
|
static |
Definition at line 426 of file flight_e2e.c.
References card_t::blocks, world_t::card, and world_t::produced.
Referenced by check_emmc_stall(), check_fault_imu_silent(), and check_gps().
Definition at line 317 of file flight_e2e.c.
References world_t::baro, sensors_core_t::baro_bus, card_t::blocks, BS, c_read(), c_start(), c_write(), CAPACITY, world_t::card, faults_t::card_fail_from_ms, faults_t::card_fail_until_ms, change_state(), world_t::chunks, world_t::core, record_sink_t::ctx, emmc_log_default_config(), emmc_log_init(), card_t::fail_from_ms, card_t::fail_until_ms, fake_baro_bus(), fake_baro_datasheet_prom, fake_gnss_init(), fake_gnss_io(), fake_regs_bus(), fake_regs_init(), world_t::faults, FLIGHT_ARMED, FLIGHT_IDLE, world_t::gnss, gnss_core_init(), world_t::gps, gps_truth(), world_t::highg, sensors_core_t::highg_bus, world_t::imu, sensors_core_t::imu_bus, gnss_core_t::io, world_t::log, MAX_RECS, world_t::next_gps_us, world_t::next_highg, world_t::next_imu, world_t::next_pps_us, world_t::next_service, NULL, port, world_t::produced, fake_baro_t::prom, record_sink_t::record, fake_regs_t::regs, world_t::scratch, sensors_core_init(), SENSORS_HIGHG_PERIOD_US, SENSORS_IMU_PERIOD_US, set_chips(), gnss_core_t::sink, sensors_core_t::sink, sink(), and world_t::state.
Referenced by check_emmc_stall(), check_fault_imu_silent(), check_gps(), and nominal().
|
static |
Definition at line 710 of file flight_e2e.c.
Referenced by main().
| uint32_t d1 |
Definition at line 77 of file flight_e2e.c.
Referenced by compensate(), and ms5611_compensate().
| uint32_t d2 |
Definition at line 77 of file flight_e2e.c.
Referenced by compensate(), and ms5611_compensate().
|
static |
Definition at line 434 of file flight_e2e.c.
|
static |
Definition at line 453 of file flight_e2e.c.
Referenced by nominal().
|
static |
Definition at line 452 of file flight_e2e.c.
Referenced by check_conservation(), check_emmc_roundtrip(), and nominal().
| const struct { ... } kBaro[] |
Referenced by check_sample_values(), and set_chips().
|
static |
Definition at line 435 of file flight_e2e.c.
Referenced by ack(), app_start(), board_adc_read(), fsw::net::anonymous_namespace{DaqInterface.cpp}::canBind(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), check(), anonymous_namespace{test_capture_window.cpp}::clear_on_reconnect(), sequencer::SequencerService::commandLoop(), sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::describeCondition(), emmc_log_append(), emmc_log_on_state(), fsw::elodin::ElodinClient::flush_batch(), sequencer::is_valid_script_filename(), fsw::script::is_valid_slug(), fsw::calibration::SensorCalibrationManager::load_from_csv(), fsw::calibration::SensorCalibrationManager::load_from_json(), main(), main(), main(), fsw::config::detail::parse_t7_boards(), parser::parse_table_header(), refuses(), fsw::elodin::DatabaseConfig::register_ball_valve_calibrated_tables(), fsw::elodin::DatabaseConfig::register_ball_valve_cmd_tables(), fsw::elodin::DatabaseConfig::register_ball_valve_tables(), fsw::elodin::DatabaseConfig::register_environmental_tables(), fsw::elodin::DatabaseConfig::register_non_sensor_tables(), fsw::elodin::DatabaseConfig::register_t7_calibrated_tables(), fsw::elodin::DatabaseConfig::register_t7_raw_tables(), fsw::elodin::anonymous_namespace{DatabaseConfig.cpp}::register_t7_vtable(), sequencer::ActuatorCommander::sendSingleActuator(), setup(), sink(), copv.copv_solve::size_or_check_copv_for_polytropic_N2(), copv.copv_solve_both::size_or_check_copv_for_polytropic_N2(), fsw::elodin::ElodinClient::subscribe_tables(), and test_backpressure().
| int32_t p |
Definition at line 78 of file flight_e2e.c.
Referenced by test_layerx_stability::_ramp_series(), test_pid::_valve_with_one_side_open(), path::append(), path::append(), array_index(), path::assign(), path::assign(), fsw::calibration::PTCalibrationManager::calculate_pressure(), check_sample_values(), compensate(), fsw::calibration::CubicCalibrationStore::compute_fit(), crc32_ref(), anonymous_namespace{test_lc_linear_fit.cpp}::cubic_model_is_unchanged(), dma_reachable(), driveAllSolenoids(), emmc_log_crc32(), esp_ota_get_running_partition(), fsw::calibration::RobustCalibrationFramework::extrapolation_variance(), feed(), feed_str(), anonymous_namespace{test_lc_linear_fit.cpp}::fill(), fill_payload(), finish_probe(), fletcher(), flightStateInit(), detail::from_json(), detail::from_json(), detail::from_json(), detail::from_json_tuple_impl(), get16(), get32(), table_iterator< IsConst >::get_proxy(), radio_link::get_u16(), radio_link::get_u32(), detail::binary_reader< BasicJsonType, InputAdapterType, SAX >::get_ubjson_array(), gnss_frame_feed(), anonymous_namespace{idle_e2e.cpp}::ground_arm(), i32(), le16(), fsw::calibration::CubicCalibrationStore::load(), main(), main(), comms::math::matrix_multiply(), on_frame(), on_valset(), parser::parse_key_value_pair_and_insert(), fsw::config::detail::parse_t7_boards(), parser::parse_table_header(), fsw::t7::plan_stream(), port_valid(), fsw::script::anonymous_namespace{Parser.cpp}::printBlock(), fsw::script::anonymous_namespace{Parser.cpp}::printExpr(), fsw::script::anonymous_namespace{Parser.cpp}::printStmt(), probe_one(), fsw::config::pt_boards(), put16(), put32(), put_record(), radio_link::put_u16(), radio_link::put_u32(), pvt(), rd32(), rd32(), ref_crc(), reject(), fsw::calibration::CubicCalibrationStore::save(), fsw::calibration::LcTareStore::save(), anonymous_namespace{test_cubic_store_namespace.cpp}::scratch(), anonymous_namespace{test_lc_linear_fit.cpp}::scratch(), anonymous_namespace{test_lc_tare.cpp}::scratch(), anonymous_namespace{idle_e2e.cpp}::send_heartbeat(), fsw::calibration::CubicCalibrationStore::serialize(), fsw::calibration::RobustCalibrationFramework::set_rls_P_for_restore(), start(), test_backpressure(), test_corrupt_ubx(), test_datasheet_worked_example(), test_frame_roundtrip_through_parser(), test_init_rejects_bad_input(), test_lowercase_checksum(), test_nav_pvt_through_the_frame_parser(), test_noise_then_frame(), test_overlong_and_binary_nmea(), test_prom_crc_mismatch_and_blank_are_rejected(), test_prom_read_and_crc(), test_second_order_below_20c(), test_session_roundtrip(), test_ubx_length_limit(), test_valid_frames(), test_wrong_nmea_checksum(), detail::to_json(), u16(), u32(), ubx_parse_mon_rf(), ubx_parse_nav_pvt(), ubx_sat_summary(), and USBD_static_free().
| int32_t temp |
Definition at line 78 of file flight_e2e.c.
Referenced by loop(), and ms5611_compensate().
|
static |
Definition at line 451 of file flight_e2e.c.
Referenced by check_conservation(), check_emmc_roundtrip(), check_sample_values(), check_sensor_rates(), check_timestamps(), and nominal().