1 /****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 Broadcom Corporation 4 * Copyright 2018-2020 NXP 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at: 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 ******************************************************************************/ 19 20 /****************************************************************************** 21 * 22 * This is the public interface file for UWA, NXP's UWB application 23 * layer for mobile phones/IOT devices. 24 * 25 ******************************************************************************/ 26 #ifndef UWA_API_H 27 #define UWA_API_H 28 29 #include "uci_defs.h" 30 #include "uwb_api.h" 31 #include "uwb_gki.h" 32 #include "uwb_hal_api.h" 33 #include "uwb_target.h" 34 35 /***************************************************************************** 36 ** Constants and data types 37 *****************************************************************************/ 38 39 /* UWA API return status codes */ 40 /* Command succeeded */ 41 #define UWA_STATUS_OK UCI_STATUS_OK 42 /* Command is rejected. */ 43 #define UWA_STATUS_REJECTED UCI_STATUS_REJECTED 44 /* failed */ 45 #define UWA_STATUS_FAILED UCI_STATUS_FAILED 46 /* Syntax error */ 47 #define UWA_STATUS_SYNTAX_ERROR UCI_STATUS_SYNTAX_ERROR 48 /* Invalid Parameter */ 49 #define UWA_STATUS_INVALID_PARAM UCI_STATUS_INVALID_PARAM 50 /* Invalid Range */ 51 #define UWA_STATUS_INVALID_RANGE UCI_STATUS_INVALID_RANGE 52 /*Invalid payload size in UCI packet */ 53 #define UWA_STATUS_INVALID_MSG_SIZE UCI_STATUS_INVALID_MSG_SIZE 54 /* Unknown GID */ 55 #define UWA_STATUS_UNKNOWN_GID UCI_STATUS_UNKNOWN_GID 56 /* Unknown OID */ 57 #define UWA_STATUS_UNKNOWN_OID UCI_STATUS_UNKNOWN_OID 58 /* Read only */ 59 #define UWA_STATUS_READ_ONLY UCI_STATUS_READ_ONLY 60 /* retry the command */ 61 #define UWA_STATUS_COMMAND_RETRY UCI_STATUS_COMMAND_RETRY 62 63 /* UWA session Specific status code */ 64 /* session is not exist in UWBD */ 65 #define UWA_STATUS_SESSSION_NOT_EXIST UCI_STATUS_SESSSION_NOT_EXIST 66 /* Session is already exist/duplicate */ 67 #define UWA_STATUS_SESSSION_DUPLICATE UCI_STATUS_SESSSION_DUPLICATE 68 /* Session is in active state */ 69 #define UWA_STATUS_SESSSION_ACTIVE UCI_STATUS_SESSSION_ACTIVE 70 /* Maximum sessions are reached */ 71 #define UWA_STATUS_MAX_SESSSIONS_EXCEEDED UCI_STATUS_MAX_SESSSIONS_EXCEEDED 72 /*session not configured */ 73 #define UWA_STATUS_SESSION_NOT_CONFIGURED UCI_STATUS_SESSION_NOT_CONFIGURED 74 75 /* UWA Ranging Session Specific Status Codes */ 76 /* Ranging tx failed */ 77 #define UWA_STATUS_RANGING_TX_FAILED UCI_STATUS_RANGING_TX_FAILED 78 /* Ranging rx timeout */ 79 #define UWA_STATUS_RANGING_RX_TIMEOUT UCI_STATUS_RANGING_RX_TIMEOUT 80 /* Physical layer decoding failed */ 81 #define UWA_STATUS_RANGING_RX_PHY_DEC_FAILED \ 82 UCI_STATUS_RANGING_RX_PHY_DEC_FAILED 83 /* Physical layer TOA failed */ 84 #define UWA_STATUS_RANGING_RX_PHY_TOA_FAILED \ 85 UCI_STATUS_RANGING_RX_PHY_TOA_FAILED 86 /* Physical layer STS failed */ 87 #define UWA_STATUS_RANGING_RX_PHY_STS_FAILED \ 88 UCI_STATUS_RANGING_RX_PHY_STS_FAILED 89 /* MAC decoding failed */ 90 #define UWA_STATUS_RANGING_RX_MAC_DEC_FAILED \ 91 UCI_STATUS_RANGING_RX_MAC_DEC_FAILED 92 /* MAC information decoding failed */ 93 #define UWA_STATUS_RANGING_RX_MAC_IE_DEC_FAILED \ 94 UCI_STATUS_RANGING_RX_MAC_IE_DEC_FAILED 95 /* MAC information missing */ 96 #define UWA_STATUS_RANGING_RX_MAC_IE_MISSING \ 97 UCI_STATUS_RANGING_RX_MAC_IE_MISSING 98 99 /* UWA Data Session Specific Status Codes */ 100 #define UWA_STATUS_DATA_MAX_TX_PSDU_SIZE_EXCEEDED \ 101 UCI_STATUS_DATA_MAX_TX_PSDU_SIZE_EXCEEDED 102 #define UWA_STATUS_DATA_RX_CRC_ERROR UCI_STATUS_DATA_RX_CRC_ERROR 103 104 typedef uint8_t tUWA_STATUS; 105 106 /* Handle for UWA registrations and connections */ 107 typedef uint16_t tUWA_HANDLE; 108 #define UWA_HANDLE_INVALID (0xFFFF) 109 110 /* UWA_DM callback events */ 111 112 #define UWA_DM_EVENT 0x00 113 #define UWA_TEST_DM_EVENT 0xA0 114 115 enum { 116 UWA_DM_ENABLE_EVT = UWA_DM_EVENT, /* Result of UWA_Enable */ 117 UWA_DM_DISABLE_EVT, /* Result of UWA_Disable */ 118 UWA_DM_REGISTER_EXT_CB_EVT, /* Result of UWA Register Ext Callback */ 119 UWA_DM_UWBS_RESP_TIMEOUT_EVT, /* Result of command response timeout */ 120 UWA_DM_UWBS_ERROR_EVT, /* Result of UWB error ntf */ 121 UWA_DM_CORE_GET_DEVICE_INFO_RSP_EVT, /* Result of get device info */ 122 UWA_DM_CORE_SET_CONFIG_RSP_EVT, /* Result of UWA_SetCoreConfig */ 123 UWA_DM_CORE_GET_CONFIG_RSP_EVT, /* Result of UWA_GetCoreConfig */ 124 UWA_DM_DEVICE_RESET_RSP_EVT, /* Result of Core Dev Reset */ 125 UWA_DM_DEVICE_STATUS_NTF_EVT, /* Result of device status ntf */ 126 UWA_DM_CORE_GEN_ERR_STATUS_EVT, /* Result of core generic error status */ 127 UWA_DM_SESSION_INIT_RSP_EVT, /* Result of session Init cmd */ 128 UWA_DM_SESSION_DEINIT_RSP_EVT, /* Result of session Deinit cmd */ 129 UWA_DM_SESSION_STATUS_NTF_EVT, /* Result of session NTF */ 130 UWA_DM_SESSION_SET_CONFIG_RSP_EVT, /* Result of setAppConfig */ 131 UWA_DM_SESSION_GET_CONFIG_RSP_EVT, /* Result of getAppConfig */ 132 UWA_DM_SESSION_GET_COUNT_RSP_EVT, /* Result of get session count */ 133 UWA_DM_SESSION_GET_STATE_RSP_EVT, /* Result of get session count */ 134 UWA_DM_RANGE_START_RSP_EVT, /* Result of range start cmd */ 135 UWA_DM_RANGE_STOP_RSP_EVT, /* Result of range start cmd */ 136 UWA_DM_RANGE_DATA_NTF_EVT, /* Result of range data ntf */ 137 UWA_DM_GET_RANGE_COUNT_RSP_EVT, /* Result of range get count */ 138 UWA_DM_GET_CORE_DEVICE_CAP_RSP_EVT, /* Results of UWA_GetCoreDeviceCapability 139 */ 140 UWA_DM_SESSION_MC_LIST_UPDATE_RSP_EVT, /* Session Update Multicast List resp 141 event*/ 142 UWA_DM_SESSION_MC_LIST_UPDATE_NTF_EVT, /* Session Update Multicast List ntf 143 event*/ 144 UWA_DM_SEND_BLINK_DATA_RSP_EVT, /* Blink Data Tx event*/ 145 UWA_DM_SEND_BLINK_DATA_NTF_EVT, /* Blink Data Tx ntf event*/ 146 UWA_DM_CONFORMANCE_NTF_EVT, /* Conformance Test Ntf Event */ 147 UWA_DM_SET_COUNTRY_CODE_RSP_EVT, /* Country code update resp event */ 148 UWA_VENDOR_SPECIFIC_UCI_NTF_EVT, /* Proprietary Ntf Event */ 149 }; 150 151 /* UWA_DM callback events for UWB RF events */ 152 153 enum { 154 UWA_DM_TEST_SET_CONFIG_RSP_EVT = 155 UWA_TEST_DM_EVENT, /* Results of set test config event*/ 156 UWA_DM_TEST_GET_CONFIG_RSP_EVT, /* Results of get test config event*/ 157 UWA_DM_TEST_STOP_SESSION_RSP_EVT, /* Result of test session stop response */ 158 UWA_DM_TEST_PERIODIC_TX_RSP_EVT, /* Results of periodic tx response event*/ 159 UWA_DM_TEST_PERIODIC_TX_NTF_EVT, /* Results of periodic tx test NTF event*/ 160 UWA_DM_TEST_PER_RX_RSP_EVT, /* Results of per rx response event*/ 161 UWA_DM_TEST_PER_RX_NTF_EVT, /* Results of per rx test NTF event*/ 162 UWA_DM_TEST_LOOPBACK_RSP_EVT, /* Rf Loop Back Test resp event*/ 163 UWA_DM_TEST_LOOPBACK_NTF_EVT, /* Rf Loop Back Test NTF event*/ 164 UWA_DM_TEST_RX_RSP_EVT, /* Rf RX Test resp event*/ 165 UWA_DM_TEST_RX_NTF_EVT /* Rf RX Test ntf event*/ 166 }; 167 168 /* UCI Parameter IDs */ 169 typedef uint8_t tUWA_PMID; 170 171 /* Data for UWA_DM_DEVICE_STATUS_NTF_EVT */ 172 typedef struct { 173 uint8_t status; /* device status */ 174 } tUWA_DEVICE_STATUS_NTF; 175 176 /* Data for UWA_DM_CORE_GEN_ERR_STATUS_EVT */ 177 typedef struct { 178 uint8_t status; /* generic error */ 179 } tUWA_CORE_GEN_ERR_STATUS_NTF; 180 181 /* the data type associated with UWB_GET_DEVICE_INFO_REVT */ 182 typedef struct { 183 uint8_t status; 184 uint16_t uci_version; 185 uint16_t mac_version; 186 uint16_t phy_version; 187 uint16_t uciTest_version; 188 uint8_t vendor_info_len; 189 uint8_t vendor_info[UCI_VENDOR_INFO_MAX_SIZE]; 190 } tUWA_GET_DEVICE_INFO_REVT; 191 192 /* Data for UWA_DM_CORE_SET_CONFIG_RSP_EVT */ 193 typedef struct { 194 tUWA_STATUS status; /* UWA_STATUS_OK if successful */ 195 uint8_t num_param_id; /* Number of rejected Param ID */ 196 tUWA_PMID param_ids[UWB_MAX_NUM_IDS]; /* Rejected Param ID */ 197 uint16_t tlv_size; /* The length of TLV */ 198 } tUWA_SET_CORE_CONFIG; 199 200 /* Data for UWA_DM_CORE_GET_CONFIG_RSP_EVT */ 201 typedef struct { 202 tUWA_STATUS status; /* UWA_STATUS_OK if successful */ 203 uint8_t no_of_ids; 204 uint8_t param_tlvs[UCI_MAX_PAYLOAD_SIZE]; /* TLV (Parameter ID-Len-Value byte 205 stream) */ 206 uint16_t tlv_size; /* The length of TLV */ 207 } tUWA_GET_CORE_CONFIG; 208 209 /* Data for UWA_DM_DEVICE_RESET_RSP_EVT */ 210 typedef struct { 211 tUWA_STATUS status; /* UWA_STATUS_OK if successful */ 212 } tUWA_DEVICE_RESET; 213 214 /* Data for UWA_DM_SESSION_GET_COUNT_RSP_EVT */ 215 typedef struct { 216 tUWA_STATUS status; /* device status */ 217 uint8_t count; /* active session count */ 218 } tUWA_SESSION_GET_COUNT; 219 220 /* Data for UWA_DM_SESSION_GET_STATE_RSP_EVT */ 221 typedef struct { 222 tUWA_STATUS status; /* device status */ 223 uint8_t session_state; /* current session state */ 224 } tUWA_SESSION_GET_STATE; 225 226 /* Data for UWA_DM_SESSION_GET_CONFIG_RSP_EVT */ 227 typedef struct { 228 tUWA_STATUS status; /* UWA_STATUS_OK if successful */ 229 uint8_t tlv_size; /* The length of TLV */ 230 uint8_t param_tlvs[UCI_MAX_PAYLOAD_SIZE]; /* TLV (Parameter ID-Len-Value byte 231 stream) */ 232 } tUWA_GET_SESSION_APP_CONFIG; 233 234 /* Data for UWA_DM_SESSION_SET_CONFIG_RSP_EVT */ 235 typedef struct { 236 tUWA_STATUS status; /* UWA_STATUS_OK if successful */ 237 uint8_t num_param_id; /* Number of rejected Param ID */ 238 tUWA_PMID param_ids[UWB_MAX_NUM_IDS]; /* Rejected Param ID */ 239 } tUWA_SET_SESSION_APP_CONFIG; 240 241 /* the data type associated with UWB_SESSION_STATUS_NTF_REVT */ 242 typedef struct { 243 uint32_t session_id; 244 uint8_t state; 245 uint8_t reason_code; 246 } tUWA_SESSION_STATUS_NTF_REVT; 247 248 /* Data for UWA_DM_RANGE_DATA_NTF_EVT */ 249 /* the data type associated with UWB_RANGE_DATA_REVT */ 250 typedef struct { 251 uint8_t mac_addr[8]; 252 uint8_t status; 253 uint8_t nLos; /* non line of sight */ 254 uint16_t distance; 255 uint16_t aoa_azimuth; 256 uint8_t aoa_azimuth_FOM; 257 uint16_t aoa_elevation; 258 uint8_t aoa_elevation_FOM; 259 uint16_t aoa_dest_azimuth; 260 uint8_t aoa_dest_azimuth_FOM; 261 uint16_t aoa_dest_elevation; 262 uint8_t aoa_dest_elevation_FOM; 263 uint8_t slot_index; 264 uint8_t rfu[12]; 265 } tUWA_TWR_RANGING_MEASR; 266 267 typedef struct { 268 uint8_t mac_addr[8]; 269 uint8_t frame_type; 270 uint8_t nLos; /* non line of sight */ 271 uint16_t aoa_azimuth; 272 uint8_t aoa_azimuth_FOM; 273 uint16_t aoa_elevation; 274 uint8_t aoa_elevation_FOM; 275 uint64_t timeStamp; 276 uint32_t blink_frame_number; /* blink frame number received from tag/master 277 anchor */ 278 uint8_t rfu[12]; 279 uint8_t device_info_size; /* Size of Device Specific Information */ 280 uint8_t* device_info; /* Device Specific Information */ 281 uint8_t blink_payload_size; /* Size of Blink Payload Data */ 282 uint8_t* blink_payload_data; /* Blink Payload Data */ 283 } tUWA_TDoA_RANGING_MEASR; 284 285 typedef union { 286 tUWA_TWR_RANGING_MEASR twr_range_measr[MAX_NUM_RESPONDERS]; 287 tUWA_TDoA_RANGING_MEASR tdoa_range_measr[MAX_NUM_OF_TDOA_MEASURES]; 288 } tUWA_RANGING_MEASR; 289 290 typedef struct { 291 uint16_t ranging_data_len; 292 uint32_t seq_counter; 293 uint32_t session_id; 294 uint8_t rcr_indication; 295 uint32_t curr_range_interval; 296 uint8_t ranging_measure_type; 297 uint8_t rfu; 298 uint8_t mac_addr_mode_indicator; 299 uint8_t reserved[8]; 300 uint8_t no_of_measurements; 301 tUWA_RANGING_MEASR ranging_measures; 302 } tUWA_RANGE_DATA_NTF; 303 304 /* the data type associated with UWB_GET_RANGE_COUNT_REVT */ 305 typedef struct { 306 uint8_t status; 307 uint32_t count; 308 } tUWA_RANGE_GET_RNG_COUNT_REVT; 309 310 /* Data for UWA_DM_GET_CORE_DEVICE_CAP_RSP_EVT */ 311 typedef struct { 312 tUWA_STATUS status; /* UWA_STATUS_OK if successful */ 313 uint8_t no_of_tlvs; 314 uint8_t tlv_buffer[UCI_MAX_PAYLOAD_SIZE]; /* TLV (Parameter ID-Len-Value byte 315 stream) */ 316 uint16_t tlv_buffer_len; /* The length of TLV */ 317 } tUWA_GET_CORE_DEVICE_CAPABILITY; 318 319 /* the data type associated with UWB_SESSION_UPDATE_MULTICAST_LIST_NTF */ 320 typedef struct { 321 uint32_t session_id; 322 uint8_t remaining_list; 323 uint8_t no_of_controlees; 324 uint16_t controlee_mac_address_list[MAX_NUM_CONTROLLEES]; 325 uint32_t subsession_id_list[MAX_NUM_CONTROLLEES]; 326 uint8_t status_list[MAX_NUM_CONTROLLEES]; 327 } tUWA_SESSION_UPDATE_MULTICAST_LIST_NTF; 328 329 /* the data type associated with UWB_BLINK_DATA_TX_NTF */ 330 typedef struct { 331 uint8_t repetition_count_status; /* Status to indicate Repetition Count is 332 exhausted */ 333 } tUWA_SEND_BLINK_DATA_NTF; 334 335 /* the data type associated with UWB_CONFORMANCE_TEST_DATA */ 336 typedef struct { 337 uint16_t length; 338 uint8_t data[CONFORMANCE_TEST_MAX_UCI_PKT_LENGTH]; 339 } tUWA_CONFORMANCE_TEST_DATA; 340 341 /* the data type associated with vendor notification */ 342 typedef struct { 343 uint16_t len; 344 uint8_t data[UCI_VENDOR_INFO_MAX_SIZE]; 345 }tUWA_VENDOR_SPECIFIC_NTF; 346 347 /* Union of all DM callback structures */ 348 typedef union { 349 tUWA_STATUS status; /* UWA_DM_ENABLE_EVT */ 350 tUWA_DEVICE_STATUS_NTF dev_status; /*UWA_DM_DEVICE_STATUS_NTF_EVT */ 351 tUWA_CORE_GEN_ERR_STATUS_NTF 352 sCore_gen_err_status; /*UWA_DM_CORE_GEN_ERR_STATUS_EVT */ 353 tUWA_DEVICE_RESET sDevice_reset; /* UWA_DM_DEVICE_RESET_RSP_EVT */ 354 tUWA_GET_DEVICE_INFO_REVT 355 sGet_device_info; /* UWA_DM_CORE_GET_DEVICE_INFO_RSP_EVT */ 356 tUWA_SET_CORE_CONFIG sCore_set_config; /* UWA_DM_CORE_SET_CONFIG_RSP_EVT */ 357 tUWA_GET_CORE_CONFIG sCore_get_config; /* UWA_DM_CORE_GET_CONFIG_RSP_EVT */ 358 tUWA_GET_CORE_CONFIG 359 sApp_get_config; /* UWA_DM_SESSION_GET_CONFIG_RSP_EVT */ 360 tUWA_SET_CORE_CONFIG 361 sApp_set_config; /* UWA_DM_SESSION_SET_CONFIG_RSP_EVT */ 362 tUWA_SESSION_STATUS_NTF_REVT 363 sSessionStatus; /* UWA_DM_SESSION_STATUS_NTF_EVT */ 364 tUWA_SESSION_GET_COUNT 365 sGet_session_cnt; /* UWA_DM_SESSION_GET_COUNT_RSP_EVT */ 366 tUWA_SESSION_GET_STATE 367 sGet_session_state; /* UWA_DM_SESSION_GET_STATE_RSP_EVT */ 368 tUWA_RANGE_DATA_NTF sRange_data; /*UWA_DM_RANGE_DATA_NTF_EVT */ 369 tUWA_RANGE_GET_RNG_COUNT_REVT 370 sGet_range_cnt; /*UWA_DM_GET_RANGE_COUNT_RSP_EVT */ 371 tUWA_GET_CORE_DEVICE_CAPABILITY 372 sGet_device_capability; /*UWA_DM_GET_CORE_DEVICE_CAP_RSP_EVT*/ 373 tUWA_SESSION_UPDATE_MULTICAST_LIST_NTF 374 sMulticast_list_ntf; /*UWA_DM_SESSION_MC_LIST_UPDATE_NTF_EVT*/ 375 tUWA_SEND_BLINK_DATA_NTF sBlink_data_ntf; /*UWA_DM_SEND_BLINK_DATA_NTF_EVT*/ 376 tUWA_CONFORMANCE_TEST_DATA sConformance_ntf; /* UWA_DM_CONFORMANCE_NTF_EVT */ 377 tUWA_VENDOR_SPECIFIC_NTF sVendor_specific_ntf; /*Vendor Specific ntf data */ 378 void* p_vs_evt_data; /* Vendor-specific evt data */ 379 } tUWA_DM_CBACK_DATA; 380 381 /* Data for UWA_DM_RF_TEST_DATA_EVT */ 382 typedef struct { 383 uint16_t length; 384 uint8_t data[UCI_MAX_PAYLOAD_SIZE]; 385 } tUWA_RF_TEST_DATA; 386 387 /* Union of all DM callback structures */ 388 typedef union { 389 tUWA_STATUS status; /* Response status for RF Test commands */ 390 tUWA_GET_CORE_CONFIG sTest_get_config; /* UWA_DM_TEST_GET_CONFIG_RSP_EVT */ 391 tUWA_SET_CORE_CONFIG sTest_set_config; /* UWA_DM_TEST_SET_CONFIG_RSP_EVT */ 392 tUWA_RF_TEST_DATA rf_test_data; /*UWA_DM_RF_TEST_DATA_EVT*/ 393 } tUWA_DM_TEST_CBACK_DATA; 394 395 /* UWA_DM callback */ 396 typedef void(tUWA_DM_CBACK)(uint8_t event, tUWA_DM_CBACK_DATA* p_data); 397 typedef void(tUWA_DM_TEST_CBACK)(uint8_t event, 398 tUWA_DM_TEST_CBACK_DATA* p_data); 399 400 /* UWA_RAW_CMD callback */ 401 typedef void(tUWA_RAW_CMD_CBACK)(uint8_t event, uint16_t param_len, 402 uint8_t* p_param); 403 404 /***************************************************************************** 405 ** External Function Declarations 406 *****************************************************************************/ 407 408 /******************************************************************************* 409 ** 410 ** Function UWA_Init 411 ** 412 ** Description This function initializes control blocks for UWA 413 ** 414 ** p_hal_entry_tbl points to a table of HAL entry points 415 ** 416 ** NOTE: the buffer that p_hal_entry_tbl points must be 417 ** persistent until UWA is disabled. 418 ** 419 ** 420 ** Returns none 421 ** 422 *******************************************************************************/ 423 extern void UWA_Init(tHAL_UWB_ENTRY* p_hal_entry_tbl); 424 425 /******************************************************************************* 426 ** 427 ** Function UWA_Enable 428 ** 429 ** Description This function enables UWB. Prior to calling UWA_Enable, 430 ** the UWBC must be powered up, and ready to receive commands. 431 ** This function enables the tasks needed by UWB, opens the UCI 432 ** transport, resets the UWB Subsystem, downloads patches to 433 ** the UWBC (if necessary), and initializes the UWB subsystems. 434 **l 435 ** 436 ** Returns UWA_STATUS_OK if successfully initiated 437 ** UWA_STATUS_FAILED otherwise 438 ** 439 *******************************************************************************/ 440 extern tUWA_STATUS UWA_Enable(tUWA_DM_CBACK* p_dm_cback, 441 tUWA_DM_TEST_CBACK* p_dm_test_cback); 442 443 /******************************************************************************* 444 ** 445 ** Function UWA_Disable 446 ** 447 ** Description This function is called to shutdown UWB. The tasks for UWB 448 ** are terminated, and clean up routines are performed. This 449 ** function is typically called during platform shut-down, or 450 ** when UWB is disabled from a settings UI. When the UWB 451 ** shutdown procedure is completed, an UWA_DM_DISABLE_EVT is 452 ** returned to the application using the tUWA_DM_CBACK. 453 ** 454 ** Returns UWA_STATUS_OK if successfully initiated 455 ** UWA_STATUS_FAILED otherwise 456 ** 457 *******************************************************************************/ 458 extern tUWA_STATUS UWA_Disable(bool graceful); 459 460 /******************************************************************************* 461 ** 462 ** Function: UWA_GetDeviceInfo 463 ** 464 ** Description: This function gets the UWB Subsystem Information 465 ** 466 ** Returns: UCI version and manufacturer specific information 467 ** 468 *******************************************************************************/ 469 extern tUWA_STATUS UWA_GetDeviceInfo(); 470 471 /******************************************************************************* 472 ** 473 ** Function UWA_SetCoreConfig 474 ** 475 ** Description Set the configuration parameters to UWBS. The result is 476 ** reported with an UWA_DM_CORE_SET_CONFIG_RSP_EVT in the 477 ** tUWA_DM_CBACK callback. 478 ** 479 ** Returns UWA_STATUS_OK if command is sent successfully 480 ** UWA_STATUS_FAILED otherwise 481 ** 482 *******************************************************************************/ 483 extern tUWA_STATUS UWA_SetCoreConfig(tUWA_PMID param_id, uint8_t length, 484 uint8_t* p_data); 485 486 /******************************************************************************* 487 ** 488 ** Function UWA_GetCoreConfig 489 ** 490 ** Description Get the configuration parameters from UWBS. The result is 491 ** reported with an UWA_DM_CORE_GET_CONFIG_RSP_EVT in the 492 ** tUWA_DM_CBACK callback. 493 ** 494 ** Returns UWA_STATUS_OK if command is sent successfully 495 ** UWA_STATUS_FAILED otherwise 496 ** 497 *******************************************************************************/ 498 extern tUWA_STATUS UWA_GetCoreConfig(uint8_t num_ids, tUWA_PMID* p_param_ids); 499 500 /******************************************************************************* 501 ** 502 ** Function UWA_SendDeviceReset 503 ** 504 ** Description Send Device Reset Command to UWBS. The result is 505 ** reported with an UWA_DM_DEVICE_RESET_RSP_EVT in the 506 ** tUWA_DM_CBACK callback. 507 ** 508 ** Returns UWA_STATUS_OK if command is sent successfully 509 ** UWA_STATUS_FAILED otherwise 510 ** 511 *******************************************************************************/ 512 extern tUWA_STATUS UWA_SendDeviceReset(uint8_t resetConfig); 513 514 /******************************************************************************* 515 ** 516 ** Function UWA_SendSessionInit 517 ** 518 ** Description This function is called to send session init command. 519 ** The result is reported with an UWA_DM_SESSION_INIT_RSP_EVT 520 ** in the tUWA_DM_CBACK callback 521 ** 522 ** session id - value of particular session ID 523 ** session type - type of session to start ex: ranging,app etc 524 ** 525 ** Returns UWA_STATUS_OK if successfully initiated 526 ** UWA_STATUS_FAILED otherwise 527 ** 528 *******************************************************************************/ 529 extern tUWA_STATUS UWA_SendSessionInit(uint32_t session_id, 530 uint8_t sessionType); 531 532 /******************************************************************************* 533 ** 534 ** Function UWA_SendSessionDeInit 535 ** 536 ** Description This function is called to send session deinit command. 537 ** The result is reported with an UWA_DM_SESSION_DEINIT_RSP_EVT 538 ** in the tUWA_DM_CBACK callback 539 ** 540 ** session id - value of particular session ID 541 ** 542 ** Returns UWA_STATUS_OK if successfully initiated 543 ** UWA_STATUS_FAILED otherwise 544 ** 545 *******************************************************************************/ 546 extern tUWA_STATUS UWA_SendSessionDeInit(uint32_t session_id); 547 548 /******************************************************************************* 549 ** 550 ** Function UWA_GetSessionCount 551 ** 552 ** Description This function is called to send get session count command. 553 ** The result is reported with an 554 ** UWA_DM_SESSION_GET_COUNT_RSP_EVT 555 ** in the tUWA_DM_CBACK callback. 556 ** 557 ** Returns UWA_STATUS_OK if command is successfully sent 558 ** UWA_STATUS_FAILED otherwise 559 ** 560 *******************************************************************************/ 561 extern tUWA_STATUS UWA_GetSessionCount(); 562 563 /******************************************************************************* 564 ** 565 ** Function UWA_SetAppConfig 566 ** 567 ** Description Set the configuration parameters to UWBS. The result is 568 ** reported with an UWA_DM_SESSION_SET_CONFIG_RSP_EVT in the 569 ** tUWA_DM_CBACK callback. 570 ** 571 ** Returns UWA_STATUS_OK if command is sent successfully 572 ** UWA_STATUS_FAILED otherwise 573 ** 574 *******************************************************************************/ 575 extern tUWA_STATUS UWA_SetAppConfig(uint32_t session_id, uint8_t noOfParams, 576 uint8_t appConfigParamLen, 577 uint8_t AppConfigParmas[]); 578 579 /******************************************************************************* 580 ** 581 ** Function UWA_GetAppConfig 582 ** 583 ** Description Get the configuration parameters from UWBS. The result is 584 ** reported with an UWA_DM_SESSION_GET_CONFIG_RSP_EVT in the 585 ** tUWA_DM_CBACK callback. 586 ** 587 ** Returns UWA_STATUS_OK if command is sent successfully 588 ** UWA_STATUS_FAILED otherwise 589 ** 590 *******************************************************************************/ 591 extern tUWA_STATUS UWA_GetAppConfig(uint32_t session_id, uint8_t num_ids, 592 uint8_t paramLen, tUWA_PMID* p_param_ids); 593 594 /******************************************************************************* 595 ** 596 ** Function UWA_StartRangingSession 597 ** 598 ** Description start the ranging session. 599 ** The result is reported with an UWA_DM_RANGE_START_RSP_EVT in 600 ** the tUWA_DM_CBACK callback 601 ** 602 ** Returns UWA_STATUS_OK if ranging started successfully 603 ** UWA_STATUS_FAILED otherwise 604 ** 605 *******************************************************************************/ 606 extern tUWA_STATUS UWA_StartRangingSession(uint32_t session_id); 607 608 /******************************************************************************* 609 ** 610 ** Function UWA_StopRangingSession 611 ** 612 ** Description stop the ranging session. 613 ** The result is reported with an UWA_DM_RANGE_STOP_RSP_EVT 614 ** in the tUWA_DM_CBACK callback. 615 ** 616 ** Returns UWA_STATUS_OK if ranging is stopped successfully 617 ** UWA_STATUS_FAILED otherwise 618 ** 619 *******************************************************************************/ 620 extern tUWA_STATUS UWA_StopRangingSession(uint32_t session_id); 621 622 /******************************************************************************* 623 ** 624 ** Function UWA_GetRangingCount 625 ** 626 ** Description Get ranging count. 627 ** The result is reported with an 628 ** UWA_DM_GET_RANGE_COUNT_RSP_EVT 629 ** in the tUWA_DM_CBACK callback. 630 ** 631 ** Returns UWA_STATUS_OK if command is sent successfully 632 ** UWA_STATUS_FAILED otherwise 633 ** 634 *******************************************************************************/ 635 extern tUWA_STATUS UWA_GetRangingCount(uint32_t session_id); 636 637 /******************************************************************************* 638 ** 639 ** Function UWA_GetSessionStatus 640 ** 641 ** Description Get session status. 642 ** The result is reported with an 643 ** UWA_DM_SESSION_GET_STATE_RSP_EVT 644 ** in the tUWA_DM_CBACK callback. 645 ** 646 ** Returns UWA_STATUS_OK if command is sent successfully 647 ** UWA_STATUS_FAILED otherwise 648 ** 649 *******************************************************************************/ 650 extern tUWA_STATUS UWA_GetSessionStatus(uint32_t session_id); 651 652 /******************************************************************************* 653 ** 654 ** Function UWA_GetCoreGetDeviceCapability 655 ** 656 ** Description Get core device capability info command. 657 ** The result is reported with an 658 ** UWA_DM_GET_CORE_DEVICE_CAP_RSP_EVT 659 ** in the tUWA_DM_CBACK callback. 660 ** 661 ** Returns UWA_STATUS_OK if command is successfully initiated 662 ** UWA_STATUS_FAILED otherwise 663 ** 664 ** 665 *******************************************************************************/ 666 extern tUWA_STATUS UWA_GetCoreGetDeviceCapability(void); 667 668 /******************************************************************************* 669 ** 670 ** Function UWA_ControllerMulticastListUpdate 671 ** 672 ** Description This function is called to send Controller Multicast List 673 ** Update. 674 ** The result is reported with an 675 ** UWA_DM_SESSION_MC_LIST_UPDATE_RSP_EVT 676 ** in the tUWA_DM_CBACK callback. 677 ** 678 ** Returns UWA_STATUS_OK if command is successfully initiated 679 ** UWA_STATUS_FAILED otherwise 680 ** 681 *******************************************************************************/ 682 extern tUWA_STATUS UWA_ControllerMulticastListUpdate( 683 uint32_t session_id, uint8_t action, uint8_t noOfControlees, 684 uint16_t* shortAddressList, uint32_t* subSessionIdList); 685 686 /******************************************************************************* 687 ** 688 ** Function UWA_ControllerSetCountryCode 689 ** 690 ** Description This function is called to set country code. 691 ** The result is reported with an 692 ** UWA_DM_SET_COUNTRY_CODE_RSP_EVT 693 ** in the tUWA_DM_CBACK callback. 694 ** 695 ** Returns UWA_STATUS_OK if command is successfully initiated 696 ** UWA_STATUS_FAILED otherwise 697 ** 698 *******************************************************************************/ 699 extern tUWA_STATUS UWA_ControllerSetCountryCode(uint8_t* countryCodeArray); 700 701 /******************************************************************************* 702 ** 703 ** Function UWA_SendBlinkData 704 ** 705 ** Description This function is called to send Blink Data Tx. 706 ** The result is reported with an 707 ** UWA_DM_SEND_BLINK_DATA_RSP_EVT 708 ** in the tUWA_DM_CBACK callback. 709 ** 710 ** Returns UWA_STATUS_OK if command is successfully initiated 711 ** UWA_STATUS_FAILED otherwise 712 ** 713 *******************************************************************************/ 714 extern tUWA_STATUS UWA_SendBlinkData(uint32_t session_id, 715 uint8_t repetition_count, 716 uint8_t app_data_len, uint8_t* app_data); 717 718 /* UWA APIs for RF Test functionality */ 719 720 /******************************************************************************* 721 ** 722 ** Function UWA_TestSetConfig 723 ** 724 ** Description Set the configuration parameters to UWBS. 725 ** The result is reported with an 726 ** UWA_DM_TEST_SET_CONFIG_RSP_EVT 727 ** in the tUWA_DM_TEST_CBACK callback. 728 ** 729 ** Returns UWA_STATUS_OK if command is sent successfully 730 ** UWA_STATUS_FAILED otherwise 731 ** 732 *******************************************************************************/ 733 extern tUWA_STATUS UWA_TestSetConfig(uint32_t session_id, uint8_t noOfParams, 734 uint8_t testConfigParamLen, 735 uint8_t testConfigParmas[]); 736 737 /******************************************************************************* 738 ** 739 ** Function UWA_TestGetConfig 740 ** 741 ** Description Get the configuration parameters from UWBS. 742 ** The result is reported with an 743 ** UWA_DM_TEST_GET_CONFIG_RSP_EVT 744 ** in the tUWA_DM_TEST_CBACK callback. 745 ** 746 ** Returns UWA_STATUS_OK if command is sent successfully 747 ** UWA_STATUS_FAILED otherwise 748 ** 749 *******************************************************************************/ 750 extern tUWA_STATUS UWA_TestGetConfig(uint32_t session_id, uint8_t num_ids, 751 uint8_t paramLen, tUWA_PMID* p_param_ids); 752 753 /******************************************************************************* 754 ** 755 ** Function UWA_PeriodicTxTest 756 ** 757 ** Description This function is called to trigger the periodic Tx Test. 758 ** The result is reported with an 759 ** UWA_DM_TEST_PERIODIC_TX_RSP_EVT 760 ** in the tUWA_DM_TEST_CBACK callback. 761 ** 762 ** Returns UWA_STATUS_OK if command is sent successfully 763 ** UWA_STATUS_FAILED otherwise 764 ** 765 *******************************************************************************/ 766 extern tUWA_STATUS UWA_PeriodicTxTest(uint16_t psduLen, uint8_t psduData[]); 767 768 /******************************************************************************* 769 ** 770 ** Function UWA_PerRxTest 771 ** 772 ** Description This function is called to trigger the PER Rx Tx Test. 773 ** The result is reported with an UWA_DM_TEST_PER_RX_RSP_EVT 774 ** in the tUWA_DM_TEST_CBACK callback. 775 ** 776 ** Returns UWA_STATUS_OK if command is sent successfully 777 ** UWA_STATUS_FAILED otherwise 778 ** 779 *******************************************************************************/ 780 extern tUWA_STATUS UWA_PerRxTest(uint16_t psduLen, uint8_t psduData[]); 781 782 /******************************************************************************* 783 ** 784 ** Function UWA_UwbLoopBackTest 785 ** 786 ** Description This function is called to trigger the loop back Test. 787 ** The result is reported with an UWA_DM_TEST_LOOPBACK_RSP_EVT 788 *in the 789 ** tUWA_DM_TEST_CBACK callback. 790 ** 791 ** Returns UWA_STATUS_OK if command is sent successfully 792 ** UWA_STATUS_FAILED otherwise 793 ** 794 *******************************************************************************/ 795 extern tUWA_STATUS UWA_UwbLoopBackTest(uint16_t psduLen, uint8_t psduData[]); 796 797 /******************************************************************************* 798 ** 799 ** Function UWA_RxTest 800 ** 801 ** Description This function is called to trigger the loop back Test. 802 ** The result is reported with an UWA_DM_TEST_RX_EVT in the 803 ** tUWA_DM_TEST_CBACK callback. 804 ** 805 ** Returns UWA_STATUS_OK if Per Session stopped successfully 806 ** UWA_STATUS_FAILED otherwise 807 ** 808 *******************************************************************************/ 809 extern tUWA_STATUS UWA_RxTest(); 810 811 /******************************************************************************* 812 ** 813 ** Function UWA_TestStopSession 814 ** 815 ** Description This function is called to stop the ongoing test session 816 ** The result is reported with an 817 ** UWA_DM_TEST_STOP_SESSION_RSP_EVT in the 818 ** tUWA_DM_TEST_CBACK callback. 819 ** 820 ** Returns UWA_STATUS_OK if Per Session stopped successfully 821 ** UWA_STATUS_FAILED otherwise 822 ** 823 *******************************************************************************/ 824 extern tUWA_STATUS UWA_TestStopSession(void); 825 826 /******************************************************************************* 827 ** 828 ** Function UWA_SendRawCommand 829 ** 830 ** Description This function is called to send raw vendor specific 831 ** command to Helios. 832 ** 833 ** cmd_params_len - The command parameter len 834 ** p_cmd_params - The command parameter 835 ** p_cback - The callback function to receive the 836 ** command 837 ** 838 ** Returns UWA_STATUS_OK if successfully initiated 839 ** UWA_STATUS_FAILED otherwise 840 ** 841 *******************************************************************************/ 842 extern tUWA_STATUS UWA_SendRawCommand(uint16_t cmd_params_len, 843 uint8_t* p_cmd_params, 844 tUWA_RAW_CMD_CBACK* p_cback); 845 846 #endif /* UWA_API_H */ 847