| | |
| | | #define CHEST_DUMP_EN (1) |
| | | #endif |
| | | |
| | | #ifndef CHEST_DUMP_STS_EN |
| | | #define CHEST_DUMP_STS_EN (1) |
| | | #endif |
| | | |
| | | /* When debugging offline channel estimation, enable this macro */ |
| | | #ifndef OFFLINE_CHEST_EN |
| | | #define OFFLINE_CHEST_EN (0) |
| | |
| | | int16_t azimuth; |
| | | uint8_t ranging_fom; |
| | | uint8_t azimuth_fom; |
| | | uint8_t antenna; |
| | | uint8_t frame_idx; |
| | | uint8_t rframe_idx; |
| | | uint16_t reserved; |
| | | uint8_t reserved[2]; |
| | | |
| | | // pre-poll | poll | final | final-data |
| | | // poll | final |
| | | // RCM | RIM | RFM | MRM |
| | | struct FRAME_INF_T |
| | | { |
| | | int8_t rssi; |
| | |
| | | uint8_t bb_gain; |
| | | uint16_t bd_cnt; |
| | | uint16_t sfd_cnt; |
| | | uint16_t error_code; |
| | | } frame[4]; |
| | | |
| | | // poll | final |
| | | struct RFRAME_INF_T |
| | | { |
| | | int32_t freq_offset; |
| | | float kfactor; |
| | | uint32_t channel_power; |
| | | uint32_t noise_power; |
| | | int8_t main_tap_power; |
| | | int8_t first_tap_power; |
| | | int16_t main_tap_power; |
| | | int16_t first_tap_power; |
| | | uint8_t main_tap; |
| | | uint8_t first_tap; |
| | | uint8_t sts_main_tap; |
| | | uint8_t sts_first_tap; |
| | | uint16_t error_code; |
| | | uint8_t nlos; |
| | | uint8_t fom; |
| | | int8_t cir[128][2]; |
| | | float sts_taps[11]; |
| | | } rframe[2]; |
| | | } frame[4]; |
| | | }; |
| | | |
| | | typedef struct |
| | |
| | | |
| | | extern struct RANGING_CSI_T debug_csi; |
| | | uint8_t first_path_align(uint8_t *ce_chest_gaps, uint8_t *ce_chest_gaps_num, int8_t ce_chest[CIR_LEN][2], uint8_t ce_fap, uint8_t th, uint8_t margin); |
| | | uint8_t ranging_fom_calculate(struct RANGING_CSI_T *csi, uint8_t response_fom, uint8_t *response_tap_gaps, uint8_t response_tap_gaps_num); |
| | | uint8_t ranging_fom_calculate(struct RANGING_CSI_T *csi, uint8_t frame_start, uint8_t response_fom, uint8_t *response_tap_gaps, uint8_t response_tap_gaps_num); |
| | | void dump_preamble_cir(uint8_t idx, uint8_t taps_num); |
| | | void dump_sts_cir(uint8_t idx); |
| | | void print_preamble_chest(uint8_t rx_pkt_num, uint8_t rframe_num); |
| | | void print_sts_ch_taps(uint8_t rframe_num); |
| | | void calculate_first_tap_power(uint8_t rx_pkt_num, uint8_t rframe_num); |
| | | void print_preamble_chest(uint32_t seq_num, uint8_t frame_start, uint8_t frame_num); |
| | | int8_t correct_rssi(int8_t rssi); |
| | | int8_t correct_snr(int8_t snr); |
| | | void calculate_first_tap_power(uint8_t frame_start, uint8_t frame_num); |
| | | int8_t calculate_noise_floor(uint8_t rf_gain, uint8_t bb_gain); |
| | | uint32_t auto_adjust_filter_coeff(uint8_t idx); |
| | | |
| | | #if CHEST_DUMP_STS_EN |
| | | void dump_sts_cir(uint8_t idx); |
| | | void print_sts_ch_taps(uint8_t frame_start, uint8_t frame_num); |
| | | #endif |
| | | #endif |
| | | |
| | | /** |
| | |
| | | * @return RX timestamp (unit: 15.65ps) |
| | | */ |
| | | int64_t ranging_rx_time(const struct MAC_HW_REPORT_T *ind); |
| | | |
| | | /** |
| | | * @brief Calculate TX timestamp of the ranging frame. |
| | | * |
| | | * @param[in] timestamp PHY timer count of TX |
| | | * @return TX timestamp (unit: 2ns) |
| | | */ |
| | | int64_t ranging_tx_time_in_2ns(uint32_t timestamp); |
| | | |
| | | /** |
| | | * @brief Calculate RX timestamp of the ranging frame. |
| | | * |
| | | * @param[in] ind MAC RX report |
| | | * @return RX timestamp (unit: 2ns) |
| | | */ |
| | | int64_t ranging_rx_time_in_2ns(const struct MAC_HW_REPORT_T *ind); |
| | | |
| | | /** |
| | | * @brief Get ranging FAP FoM. |
| | |
| | | int8_t ranging_expected_rssi_get(int8_t uwb_tx_power, uint16_t distance, uint8_t path_loss_exp, int8_t ant_gain_loss); |
| | | |
| | | /** |
| | | * @brief Function to compute 10*log10 of a number |
| | | * This function takes in 32-bit integer and outputs 10*log10 in floating point |
| | | * |
| | | * @param[in] num Input number |
| | | * @return the result of 10*log10(num) |
| | | */ |
| | | float fast_10log10(uint32_t num); |
| | | |
| | | /** |
| | | * @brief Get ranging library version. |
| | | * |
| | | * @return String of ranging library version |