From adfc7e798b9cbdd022bf8df971843436912a0fe5 Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期日, 20 七月 2025 16:58:30 +0800 Subject: [PATCH] 成功移植g_com_map表逻辑,初步测试能读能写,并且TDOA效果和官方一致 --- keil/include/components/uwb/inc/lib_fira.h | 74 ++++++++++++++++++++++--------------- 1 files changed, 44 insertions(+), 30 deletions(-) diff --git a/keil/include/components/uwb/inc/lib_fira.h b/keil/include/components/uwb/inc/lib_fira.h index 6537aad..8f22cf3 100644 --- a/keil/include/components/uwb/inc/lib_fira.h +++ b/keil/include/components/uwb/inc/lib_fira.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023 Beijing Hanwei Innovation Technology Ltd. Co. and + * Copyright (c) 2019-2025 Beijing Hanwei Innovation Technology Ltd. Co. and * its subsidiaries and affiliates (collectly called MKSEMI). * * All rights reserved. @@ -62,6 +62,11 @@ #define SLOT_FINAL 1 #define SLOT_REPORT 2 #define SLOT_RESULT 3 + +#define RESPONSE_SLOT_IDX(x, n) (2 + (x)) +#define FINAL_SLOT_IDX(x, n) (2 + (n)) +#define REPORT_SLOT_IDX(x, n) (3 + (n)) +#define RESULT_SLOT_IDX(x, n) (4 + (n) + (x)) /** STS config definition */ enum FIRA_STS_CFG_T @@ -155,10 +160,10 @@ uint32_t phy_sts_index; uint32_t tof; - uint32_t uwb_period_prefetch_time; uint32_t uwb_evt_prefetch_time; uint32_t uwb_rx_open_in_advance; uint32_t uwb_rx_window; + uint32_t uwb_period_prefetch_time; uint32_t uwb_rx_open_in_advance_wakeup; uint32_t uwb_rx_window_wakeup; @@ -173,8 +178,9 @@ uint8_t responder_slot_idx[4]; uint32_t responder_response_flag; uint16_t result_flag; // responder_idx || status (1: update, 2: complete) - uint8_t rcm_flag; - uint8_t repeat; + uint16_t repeat; // audio + uint16_t controller_addr; + uint16_t initiator_addr; uint16_t slots_per_block; uint8_t count; uint8_t count_last; @@ -184,9 +190,8 @@ uint16_t curr_round_index; uint16_t next_round_index; uint16_t nround_inblock; -#if FIRA_TEST_EN uint16_t num_of_measure; -#endif + uint8_t rrrm_is_scheduled_flag; struct RANGE_DATA_T range_data; }; @@ -194,10 +199,6 @@ struct UWB_PKT_TX_DONE_IND_T { wsfMsgHdr_t hdr; -#if MCTT_TEST_EN - uint32_t timestamp; - uint32_t phy_shr_duration; -#endif uint8_t ranging_stage; uint8_t slot_idx; uint16_t status; @@ -209,10 +210,6 @@ struct UWB_PKT_RX_DONE_IND_T { wsfMsgHdr_t hdr; -#if MCTT_TEST_EN - uint32_t timestamp; - uint32_t phy_header; -#endif uint8_t slot_idx; uint8_t ranging_stage; uint16_t status; @@ -234,14 +231,6 @@ extern uint8_t *tx_msg; extern uint16_t tx_msg_len; - -/** - * @brief Calculate timestamp difference. - * @param[in] ts_a Ranging timestamp a - * @param[in] ts_b Ranging timestamp b - * @return ts_a - ts_b - */ -int64_t ranging_timestamp_diff(int64_t ts_a, int64_t ts_b); /** * @brief Calculate ranging Tround. @@ -272,10 +261,9 @@ void ranging_peer_addr_set(uint16_t short_addr); /** - * @brief Get initiator short address. - * @return short address of initiator + * @brief Clear responder list. */ -uint16_t ranging_initiator_addr_get(void); +void ranging_responder_list_clr(void); /** * @brief Add responder device into responder device list for one-to-many case. @@ -283,11 +271,6 @@ * @return 1: successful, 0: fail */ uint8_t ranging_responder_addr_add(uint16_t addr); - -/** - * @brief Clear responder list. - */ -void ranging_responder_list_clr(void); /** * @brief Dynamic Update of Multicast List for Controlees @@ -306,12 +289,43 @@ uint16_t ranging_responder_addr_get(uint8_t idx); /** + * @brief Get responder index. + * @param[in] addr Responder device address + * @return index of responder + */ +uint8_t ranging_responder_idx_get(uint16_t addr); + +/** * @brief Get responder devices number. * @return number of responder */ uint8_t ranging_responder_num_get(void); /** + * @brief Set initiator short address. + * @param[in] short_addr Device short address + */ +void ranging_initiator_addr_set(uint16_t short_addr); + +/** + * @brief Get initiator short address. + * @return short address of initiator + */ +uint16_t ranging_initiator_addr_get(void); + +/** + * @brief Set controller short address. + * @param[in] short_addr Device short address + */ +void ranging_controller_addr_set(uint16_t short_addr); + +/** + * @brief Get controller short address. + * @return short address of controller + */ +uint16_t ranging_controller_addr_get(void); + +/** * @brief Update ranging slot index, based on this informantion to generate STS or encryted packet every slot. * @param[in] slot_idx Slot index */ -- Gitblit v1.9.3