| | |
| | | #define SESSION_TYPE_RANGING_ONLY (0x03) |
| | | #define SESSION_TYPE_IN_BAND_DATA (0x04) |
| | | #define SESSION_TYPE_RANGING_WITH_DATA (0x05) |
| | | // 0xA0-0x9F Reserved for Vendor Specific use case |
| | | #define SESSION_TYPE_CCC_RANGING (0xA0) |
| | | // 0xA1-0x9F Reserved for Vendor Specific use case |
| | | // device test mode, 0xD1-0xDF RFU |
| | | #define SESSION_TYPE_DEVICE_TEST_MODE (0xD0) |
| | | // 0xE0-0xFE Vendor Specific use |
| | |
| | | #define SESSION_TYPE_VENDOR_ALONE_RADAR (0xFE) |
| | | |
| | | #define FREQ_OFFSET_SAMPLES_NUM 5 |
| | | |
| | | #define INITIATION_NUM (4) |
| | | |
| | | // In Fira spec the number of controlees 1~8 |
| | | #ifndef RESPONDER_NUM_MAX |
| | |
| | | #define UWB_MODE_VENDOR_RX 9 |
| | | #define UWB_MODE_VENDOR_CARRIER_TX 10 |
| | | #define UWB_MODE_TEST_SS_TWR 11 |
| | | #define UWB_MODE_TEST_DS_TWR 12 |
| | | |
| | | /** UWB status */ |
| | | enum UWB_STATUS_T |
| | |
| | | { |
| | | DEV_TYPE_CONTROLEE = 0, |
| | | DEV_TYPE_CONTROLLER = 1, |
| | | DEV_TYPE_DEVICE = 0xA0, |
| | | DEV_TYPE_VEHICLE = 0xA1, |
| | | }; |
| | | |
| | | /** UWB device role */ |
| | |
| | | /** UWB MAC address mode */ |
| | | enum MAC_ADDRESS_MODE_T |
| | | { |
| | | ARRD_SHORT_USE_SHORT = 0, // MAC address is 2 bytes and 2 bytes to be used in MAC header |
| | | ADDR_SHORT_USE_SHORT = 0, // MAC address is 2 bytes and 2 bytes to be used in MAC header |
| | | ADDR_LONG_USE_SHORT = 1, // MAC address is 8 bytes and 2 bytes to be used in MAC header (Not supported) |
| | | ADDR_LONG_USE_LONG = 2, // MAC address is 8 bytes and 8 bytes to be used in MAC header |
| | | }; |
| | |
| | | /* Reserved for Vendor Specific use 0xA0-0xDF */ |
| | | /* Additional configuration applicable only for CCC */ |
| | | uint32_t hop_mode_key; // 0xA0 |
| | | uint8_t ccc_responder_slot_idx; // 0xA2 |
| | | uint8_t pulseshape_combo; // 0xA5 |
| | | uint16_t ranging_proto_ver; // 0xA3 |
| | | uint16_t uwb_cfg_id; // 0xA4 |
| | | uint8_t pulseshape_combo; // 0xA5 |
| | | uint16_t ursk_ttl; // 0xA6 |
| | | uint32_t last_sts_index_used; // 0xA8 |
| | | uint8_t responder_participation_config; // 0xA7 |
| | | |
| | | /* Reserved for Vendor Specific Use */ |
| | | uint8_t tx_power_level; // 0xF2 |
| | |
| | | uint8_t *data; |
| | | }; |
| | | |
| | | /** UWB ranging measurement report */ |
| | | struct RANGING_MEASUREMENT_T |
| | | /** UWB two-way ranging measurement report */ |
| | | struct TWR_MEASUREMENT_T |
| | | { |
| | | uint8_t mac_addr[8]; |
| | | uint8_t status; |
| | |
| | | uint8_t aoa_dst_azimuth_fom; |
| | | uint8_t aoa_dst_elevation_fom; |
| | | uint8_t slot_idx; |
| | | uint8_t rfu[12]; |
| | | uint8_t reserved; |
| | | uint32_t rfu[3]; |
| | | }; |
| | | |
| | | /** UWB ranging data report */ |
| | |
| | | uint32_t session_id; |
| | | // unit: ms |
| | | uint32_t ranging_interval; |
| | | uint8_t rcr_ind; |
| | | uint8_t ranging_type; |
| | | uint8_t rfu; |
| | | uint8_t mac_addr_mode; |
| | | uint8_t measurements_num; |
| | | struct RANGING_MEASUREMENT_T measurements[MEASUREMENT_NUM_MAX]; |
| | | struct TWR_MEASUREMENT_T measurements[MEASUREMENT_NUM_MAX]; |
| | | }; |
| | | |
| | | /** CCC ranging measurement report */ |
| | | struct CCC_MEASUREMENT_T |
| | | { |
| | | uint8_t status; |
| | | uint8_t slot_index; |
| | | uint16_t rr_index; |
| | | uint32_t sts_index; |
| | | uint16_t distance; |
| | | uint8_t anchor_fom; |
| | | uint8_t initiator_fom; |
| | | int16_t aoa_azimuth; |
| | | int16_t aoa_elevation; |
| | | uint8_t aoa_azimuth_fom; |
| | | uint8_t aoa_elevation_fom; |
| | | }; |
| | | |
| | | /** UWB ranging data report */ |
| | | struct CCC_RANGE_DATA_T |
| | | { |
| | | uint32_t sequence_num; |
| | | uint32_t session_id; |
| | | // unit: ms |
| | | uint32_t ranging_interval; |
| | | uint8_t ranging_type; |
| | | uint8_t rfu; |
| | | uint8_t mac_addr_mode; |
| | | uint8_t measurements_num; |
| | | struct CCC_MEASUREMENT_T measurements[MEASUREMENT_NUM_MAX]; |
| | | }; |
| | | |
| | | /** UWB test environment variable */ |
| | |
| | | uint8_t *tx_pkt_data; |
| | | uint32_t trx_count_packet; /* This variable used to count how many packets were received or sent */ |
| | | uint32_t sync_time; /* This variable is used to record the timestamp of the synchronization moment (unit:8ns) */ |
| | | }; |
| | | |
| | | /** UWB data transfer report */ |
| | | struct DATA_TRANSFER_T |
| | | { |
| | | uint16_t length; |
| | | uint8_t data[256]; |
| | | }; |
| | | |
| | | /** UWB operations handler */ |
| | |
| | | uint8_t (*session_responder_num_get)(void); |
| | | uint16_t (*session_responder_addr_get)(uint8_t idx); |
| | | uint8_t (*session_dynamic_update_responder_list)(uint8_t action, uint16_t addr); |
| | | void (*session_set_ccc_ursk)(const uint8_t *ursk); |
| | | void (*session_initiator_addr_set)(uint16_t short_addr); |
| | | void (*session_controller_addr_set)(uint16_t short_addr); |
| | | bool (*session_set_ccc_ursk)(uint32_t session_id, const uint8_t *ursk); |
| | | void (*vendor_session_start)(void); |
| | | void (*vendor_session_stop)(void); |
| | | void (*vendor_session_configure)(void); |
| | |
| | | typedef void (*test_per_rx_report_cb_t)(struct TEST_PER_RX_T *report); |
| | | typedef void (*test_rx_report_cb_t)(struct TEST_RX_T *report); |
| | | typedef void (*test_ss_twr_report_cb_t)(uint8_t *, uint32_t); |
| | | typedef void (*test_ds_twr_report_cb_t)(uint8_t *, uint32_t); |
| | | typedef void (*vendor_rx_report_cb_t)(const uint16_t *data_len, const uint8_t *data); |
| | | typedef uint8_t (*vendor_user_defined_data_process_cb_t)(uint16_t cmd_len, const uint8_t *p_cmd); |
| | | |
| | |
| | | uint8_t uwbapi_test_ss_twr(test_ss_twr_report_cb_t func); |
| | | |
| | | /** |
| | | * @brief Start DS-TWR test, This API can be used to measure single DS-TWR ToF using SP0/SP3 packets. |
| | | * @param[in] func callback function to report result. |
| | | * @return UWB Status code @ref UWB_STATUS_T |
| | | */ |
| | | uint8_t uwbapi_test_ds_twr(test_ds_twr_report_cb_t func); |
| | | |
| | | /** |
| | | * @brief Stop the test session. |
| | | * @return UWB Status code @ref UWB_STATUS_T |
| | | */ |
| | |
| | | |
| | | /** |
| | | * @brief Set URSK for CCC work mode |
| | | * @param[in] session_id session id |
| | | * @param[in] ursk URSK data. |
| | | * @param[in] len URSK length. |
| | | * @return UWB Status code @ref UWB_STATUS_T |
| | | */ |
| | | uint8_t uwbapi_vendor_set_ccc_ursk(const uint8_t *ursk, uint16_t len); |
| | | uint8_t uwbapi_vendor_set_ccc_ursk(uint32_t session_id, const uint8_t *ursk, uint16_t len); |
| | | |
| | | /** |
| | | * @} |
| | |
| | | uint8_t uwbs_ccc_uwb_config_id_set(uint16_t uwb_cfg_id); |
| | | |
| | | /** |
| | | * @brief Set pulse shape combination for CCC. |
| | | * @param[in] pulseshape_combo pulse shape combination |
| | | */ |
| | | uint8_t uwbs_ccc_pulseshape_combo_set(uint8_t pulseshape_combo); |
| | | |
| | | /** |
| | | * @brief Clear RSSI statistical result in PER test procedure. |
| | | */ |
| | | void uwbs_clear_rssi(void); |