| | |
| | | #include "mk_mac.h" |
| | | #include "uwb_api.h" |
| | | |
| | | #if defined(XTAL32K_CALIBRATED) && (XTAL32K_CALIBRATED == 1) |
| | | // Event prefetch time for event program - 180us |
| | | #define UWB_EVT_PREFETCH_TIME US_TO_PHY_TIMER_COUNT(180) |
| | | |
| | | // RX window open in advance time - 10us |
| | | #define UWB_RX_OPEN_IN_ADVANCE US_TO_PHY_TIMER_COUNT(10) |
| | | #else |
| | | // Event prefetch time for event program - 250us |
| | | #define UWB_EVT_PREFETCH_TIME US_TO_PHY_TIMER_COUNT(250) |
| | | |
| | | // RX window open in advance time - 80us |
| | | #define UWB_RX_OPEN_IN_ADVANCE US_TO_PHY_TIMER_COUNT(80) |
| | | #endif |
| | | |
| | | // RX window - 375us |
| | | #define UWB_RX_WINDOW US_TO_PHY_TIMER_COUNT(375) |
| | | |
| | | /* CCC hopping mode */ |
| | | enum HOPPING_MODE_T |
| | | { |
| | | HOPPING_MODE_NO_HOPPING = 0, |
| | | HOPPING_MODE_FIRA, |
| | | HOPPING_MODE_CONT_DEF_SEQ = 0xA0, |
| | | HOPPING_MODE_ADAP_DEF_SEQ, |
| | | HOPPING_MODE_CONT_AES_SEQ, |
| | | HOPPING_MODE_CONT_AES_SEQ = 0xA0, |
| | | HOPPING_MODE_CONT_DEF_SEQ, |
| | | HOPPING_MODE_ADAP_AES_SEQ, |
| | | HOPPING_MODE_ADAP_DEF_SEQ, |
| | | }; |
| | | |
| | | /* CCC timestamp structure */ |
| | |
| | | uint8_t hopping_mode; |
| | | uint8_t count; |
| | | uint8_t count_last; |
| | | |
| | | 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; |
| | | |
| | | uint32_t session_id; |
| | | uint32_t sts_index0; |
| | |
| | | |
| | | uint8_t main_ant_id[RESPONDER_NUM_MAX]; |
| | | struct TIMESTAMP_T timstamp[RESPONDER_NUM_MAX]; |
| | | struct RANGE_DATA_T range_data; |
| | | struct CCC_RANGE_DATA_T range_data; |
| | | }; |
| | | |
| | | #ifdef __cplusplus |
| | |
| | | |
| | | /** |
| | | * @brief Set CCC URSK. |
| | | * @param[in] session_id session id |
| | | * @param[in] ursk Pointer of URSK buffer |
| | | * @return true if session id matched otherwise false |
| | | */ |
| | | void ranging_set_ccc_ursk(const uint8_t *ursk); |
| | | bool ranging_set_ccc_ursk(uint32_t session_id, const uint8_t *ursk); |
| | | |
| | | /** |
| | | * @brief Update ranging keys. |
| | | * @param[in] sts_idx STS index |
| | | * @param[in] key_type key type |
| | | */ |
| | | void ranging_update_keys(uint32_t sts_idx, uint8_t key_type); |
| | | void ranging_update_keys(uint32_t sts_idx); |
| | | |
| | | #ifdef __cplusplus |
| | | } |