• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Copyright 2021 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  *  This file contains the Near Field Communication (UWB) API function
22  *  external definitions.
23  *
24  ******************************************************************************/
25 
26 #ifndef UWB_API_H
27 #define UWB_API_H
28 
29 #include "uci_defs.h"
30 #include "uwb_gki.h"
31 #include "uwb_hal_api.h"
32 #include "uwb_target.h"
33 #include "uwb_types.h"
34 
35 typedef uint8_t tUWB_STATUS;
36 
37 /* UWB application return status codes */
38 /* Command succeeded    */
39 #define UWB_STATUS_OK UCI_STATUS_OK
40 /* Command is rejected. */
41 #define UWB_STATUS_REJECTED UCI_STATUS_REJECTED
42 /* failed               */
43 #define UWB_STATUS_FAILED UCI_STATUS_FAILED
44 /* Syntax error         */
45 #define UWB_STATUS_SYNTAX_ERROR UCI_STATUS_SYNTAX_ERROR
46 /* Invalid Parameter    */
47 #define UWB_STATUS_INVALID_PARAM UCI_STATUS_INVALID_PARAM
48 /* Invalid Range    */
49 #define UWB_STATUS_INVALID_RANGE UCI_STATUS_INVALID_RANGE
50 /* Unknown UCI Group ID */
51 #define UWB_STATUS_UNKNOWN_GID UCI_STATUS_UNKNOWN_GID
52 /* Unknown UCI Opcode   */
53 #define UWB_STATUS_UNKNOWN_OID UCI_STATUS_UNKNOWN_OID
54 /* Read Only   */
55 #define UWB_STATUS_READ_ONLY UCI_STATUS_READ_ONLY
56 /* retry the command */
57 #define UWB_STATUS_COMMAND_RETRY UCI_STATUS_COMMAND_RETRY
58 
59 /* UWB session Specific status code */
60 /* session is not exist in UWBD */
61 #define UWB_STATUS_SESSSION_NOT_EXIST UCI_STATUS_SESSSION_NOT_EXIST
62 /* Session is already exist/duplicate */
63 #define UWB_STATUS_SESSSION_DUPLICATE UCI_STATUS_SESSSION_DUPLICATE
64 /* Session is in active state */
65 #define UWB_STATUS_SESSSION_ACTIVE UCI_STATUS_SESSSION_ACTIVE
66 /* Maximum sessions are reached */
67 #define UWB_STATUS_MAX_SESSSIONS_EXCEEDED UCI_STATUS_MAX_SESSSIONS_EXCEEDED
68 /*session not configured */
69 #define UWB_STATUS_SESSION_NOT_CONFIGURED UCI_STATUS_SESSION_NOT_CONFIGURED
70 
71 /* Ranging specific error code */
72 /* Ranging tx failed */
73 #define UWB_STATUS_RANGING_TX_FAILED UCI_STATUS_RANGING_TX_FAILED
74 /* Ranging rx timeout */
75 #define UWB_STATUS_RANGING_RX_TIMEOUT UCI_STATUS_RANGING_RX_TIMEOUT
76 /* Physical layer decoding failed */
77 #define UWB_STATUS_RANGING_RX_PHY_DEC_FAILED \
78   UCI_STATUS_RANGING_RX_PHY_DEC_FAILED
79 /* Physical layer TOA failed */
80 #define UWB_STATUS_RANGING_RX_PHY_TOA_FAILED \
81   UCI_STATUS_RANGING_RX_PHY_TOA_FAILED
82 /* Physical layer STS failed */
83 #define UWB_STATUS_RANGING_RX_PHY_STS_FAILED \
84   UCI_STATUS_RANGING_RX_PHY_STS_FAILED
85 /* MAC decoding failed */
86 #define UWB_STATUS_RANGING_RX_MAC_DEC_FAILED \
87   UCI_STATUS_RANGING_RX_MAC_DEC_FAILED
88 /* MAC information decoding failed */
89 #define UWB_STATUS_RANGING_RX_MAC_IE_DEC_FAILED \
90   UCI_STATUS_RANGING_RX_MAC_IE_DEC_FAILED
91 /* MAC information missing */
92 #define UWB_STATUS_RANGING_RX_MAC_IE_MISSING \
93   UCI_STATUS_RANGING_RX_MAC_IE_MISSING
94 
95 /* all UWB Manager Callback functions have prototype like void (cback) (uint8_t
96  * event, void *p_data)
97  * tUWB_RESPONSE_CBACK uses tNFC_RESPONSE_EVT; range  0x4000 ~
98  * tUWB_TEST_RESPONSE_CBACK uses tNFC_RESPONSE_EVT; range  0x5000 ~
99  */
100 
101 #define UWB_FIRST_REVT 0x4000
102 #define UWB_FIRST_TEVT 0x5000
103 
104 // RFU size for tdoa Ranging
105 
106 #define TDOA_RANGE_MEASR_RFU 12
107 #define TWR_RANGE_MEASR_RFU 12
108 
109 #define CONFORMANCE_TEST_MAX_UCI_PKT_LENGTH 260
110 
111 /* the events reported on tUWB_RESPONSE_CBACK */
112 enum {
113   UWB_ENABLE_REVT = UWB_FIRST_REVT, /* 0  Enable event                        */
114   UWB_DISABLE_REVT,                 /* 1  Disable event                       */
115   UWB_REGISTER_EXT_CB_REVT,         /* 2  Register Ext Callback               */
116   UWB_DEVICE_STATUS_REVT,           /* 3  device status notification          */
117   UWB_SET_CORE_CONFIG_REVT,         /* 4  Set Config Response                 */
118   UWB_GET_CORE_CONFIG_REVT,         /* 5  Get Config Response                 */
119   UWB_GET_DEVICE_INFO_REVT,         /* 6  Get Device Info response            */
120   UWB_DEVICE_RESET_REVT,            /* 7  device Reset response               */
121   UWB_CORE_GEN_ERR_STATUS_REVT,     /* 8  Generic Error Notification          */
122   UWB_SESSION_INIT_REVT,            /* 9  session Init  request               */
123   UWB_SESSION_STATUS_NTF_REVT,      /* 10 SESSION STATUS NTF response         */
124   UWB_SESSION_DEINIT_REVT,          /* 11 session DeInit request             */
125   UWB_SESSION_GET_COUNT_REVT,       /* 12 get session count response          */
126   UWB_GET_APP_CONFIG_REVT,          /* 13 Get App Config response            */
127   UWB_SET_APP_CONFIG_REVT,          /* 14 Get App Config response            */
128   UWB_START_RANGE_REVT,             /* 15 range start response                */
129   UWB_STOP_RANGE_REVT,              /* 16 range stop response                 */
130   UWB_RANGE_DATA_REVT,              /* 17 range data notofication             */
131   UWB_GET_RANGE_COUNT_REVT,         /* 23 get Range Count response           */
132   UWB_SESSION_GET_STATE_REVT,       /* 24 get session status response         */
133   UWB_UWBS_TRANSPORT_ERR_REVT,      /* 25 UCI Transport error                 */
134   UWB_UWBS_RESP_TIMEOUT_REVT,       /* 26 UWB device is not responding       */
135   UWB_CORE_GET_DEVICE_CAPABILITY_REVT,    /* 27 Get Device Capability    */
136   UWB_SESSION_UPDATE_MULTICAST_LIST_REVT, /* 28 Session Update Multicast List
137                                              resp  */
138   UWB_SESSION_UPDATE_MULTICAST_LIST_NTF_REVT, /* 29 Session Update Multicast
139                                                  List ntf   */
140   UWB_BLINK_DATA_TX_REVT,     /* 30 Blink Data Tx resp                  */
141   UWB_BLINK_DATA_TX_NTF_REVT, /* 31 Blink Data Tx ntf                   */
142   UWB_CONFORMANCE_TEST_DATA,  /* 32 Conformance test data ntf           */
143   UWB_SET_COUNTRY_CODE_REVT,  /* 33 Set country code resp */
144   UWB_VENDOR_SPECIFIC_UCI_NTF_EVT   /* 34 Proprietary ntf */
145 };
146 typedef uint16_t tUWB_RESPONSE_EVT;
147 
148 /* the events reported on tUWB_TEST_RESPONSE_CBACK */
149 enum {
150   UWB_TEST_GET_CONFIG_REVT =
151       UWB_FIRST_TEVT,             /* 0  Get test Config response......*/
152   UWB_TEST_SET_CONFIG_REVT,       /* 1  Set test Config response           */
153   UWB_TEST_PERIODIC_TX_DATA_REVT, /* 2  PERIODIC TX ntf results response   */
154   UWB_TEST_PER_RX_DATA_REVT,      /* 3  PER RX ntf results response        */
155   UWB_TEST_PERIODIC_TX_REVT,      /* 4  PERIODIC tx test results response  */
156   UWB_TEST_PER_RX_REVT,           /* 5  PER rx test results response       */
157   UWB_TEST_STOP_SESSION_REVT,     /* 6  Stop PER test Session              */
158   UWB_TEST_LOOPBACK_DATA_REVT,    /* 7  Test Rf loop back ntf              */
159   UWB_TEST_LOOPBACK_REVT,         /* 8  Test Rf loop back resp             */
160   UWB_TEST_RX_REVT,               /* 9  RX Test resp                        */
161   UWB_TEST_RX_DATA_REVT           /* 10  RX Test ntf                         */
162 };
163 typedef uint16_t tUWB_TEST_RESPONSE_EVT;
164 
165 typedef uint8_t tUWB_RAW_EVT; /* proprietary events */
166 typedef uint8_t tUWB_STATUS;
167 
168 typedef struct {
169   tUWB_STATUS status; /* The event status.                */
170 } tUWB_ENABLE_REVT;
171 
172 #define UWB_MAX_NUM_IDS 125
173 /* the data type associated with UWB_SET_CORE_CONFIG_REVT */
174 typedef struct {
175   tUWB_STATUS status;                 /* The event status.                */
176   uint8_t num_param_id;               /* Number of rejected UCI Param ID  */
177   uint8_t param_ids[UWB_MAX_NUM_IDS]; /* UCI Param ID          */
178   uint16_t tlv_size;                  /* The length of TLV    */
179 } tUWB_SET_CORE_CONFIG_REVT;
180 
181 typedef struct {
182   tUWB_STATUS status;                 /* The event status.                */
183   uint8_t num_param_id;               /* Number of rejected UCI Param ID  */
184   uint8_t param_ids[UWB_MAX_NUM_IDS]; /* UCI Param ID          */
185   uint16_t tlv_size;                  /* The length of TLV    */
186 } tUWB_SET_APP_CONFIG_REVT;
187 
188 /* the data type associated with UWB_GET_CORE_CONFIG_REVT */
189 typedef struct {
190   tUWB_STATUS status; /* The event status.    */
191   uint8_t no_of_ids;
192   uint8_t p_param_tlvs[UCI_MAX_PAYLOAD_SIZE]; /* TLV                  */
193   uint16_t tlv_size;                          /* The length of TLV    */
194 } tUWB_GET_CORE_CONFIG_REVT;
195 
196 /* the data type associated with UWB_GET_APP_CONFIG_REVT */
197 typedef struct {
198   tUWB_STATUS status; /* The event status.    */
199   uint8_t no_of_ids;
200   uint8_t p_param_tlvs[UCI_MAX_PAYLOAD_SIZE]; /* TLV                  */
201   uint16_t tlv_size;                          /* The length of TLV    */
202 } tUWB_GET_APP_CONFIG_REVT;
203 /* the data type associated with UWB_DEVICE_RESET_REVT */
204 typedef struct {
205   tUWB_STATUS status;  /* The event status.                */
206   uint8_t resetConfig; /* Vendor Specific Reset Config */
207 } tUWB_DEVICE_RESET_REVT;
208 
209 /* the data type associated with UWB_DEVICE_STATUS_REVT */
210 typedef struct {
211   uint8_t status;
212 } tUWB_DEVICE_STATUS_REVT;
213 
214 /* the data type associated with UWB_CORE_GEN_ERR_STATUS_REVT */
215 typedef struct {
216   uint8_t status;
217 } tUWB_CORE_GEN_ERR_STATUS_REVT;
218 
219 /* the data type associated with UWB_SESSION_GET_COUNT_REVT */
220 typedef struct {
221   uint8_t status; /* device status             */
222   uint8_t count;  /* active session count      */
223 } tUWB_SESSION_GET_COUNT_REVT;
224 
225 /* the data type associated with UWB_SESSION_GET_STATE_REVT */
226 typedef struct {
227   uint8_t status;        /* device status             */
228   uint8_t session_state; /* current session state */
229 } tUWB_SESSION_GET_STATE_REVT;
230 
231 /* the data type associated with UWB_SESSION_NTF_REVT */
232 typedef struct {
233   uint32_t session_id;
234   uint8_t state;
235   uint8_t reason_code;
236 } tUWB_SESSION_NTF_REVT;
237 
238 /* the data type associated with tUWB_GET_DEVICE_INFO_REVT */
239 typedef struct {
240   tUWB_STATUS status;       /* The event status.                  */
241   uint16_t uci_version;     /* UCI version                        */
242   uint16_t mac_version;     /* MAC version                        */
243   uint16_t phy_version;     /* PHY version                        */
244   uint16_t uciTest_version; /* UCI Test specification version     */
245   uint8_t vendor_info_len;  /* Device Information length          */
246   uint8_t vendor_info[UCI_VENDOR_INFO_MAX_SIZE]; /* Manufacturer specific
247                                                     information  */
248 } tUWB_GET_DEVICE_INFO_REVT;
249 
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[TWR_RANGE_MEASR_RFU];
265 } tUWB_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;          /* Time stamp */
276   uint32_t blink_frame_number; /* blink frame number received from tag/master
277                                   anchor */
278   uint8_t rfu[TDOA_RANGE_MEASR_RFU];
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 } tUWB_TDoA_RANGING_MEASR;
284 
285 typedef union {
286   tUWB_TWR_RANGING_MEASR twr_range_measr[MAX_NUM_RESPONDERS];
287   tUWB_TDoA_RANGING_MEASR tdoa_range_measr[MAX_NUM_OF_TDOA_MEASURES];
288 } tUWB_RANGING_MEASR;
289 
290 /* the data type associated with UWB_RANGE_DATA_REVT */
291 typedef struct {
292   uint16_t range_data_len;
293   uint32_t seq_counter;
294   uint32_t session_id;
295   uint8_t rcr_indication;
296   uint32_t curr_range_interval;
297   uint8_t ranging_measure_type;
298   uint8_t rfu;
299   uint8_t mac_addr_mode_indicator;
300   uint8_t reserved[8];
301   uint8_t no_of_measurements;
302   tUWB_RANGING_MEASR ranging_measures;
303 } tUWB_RANGE_DATA_REVT;
304 
305 /* the data type associated with UWB_CONFORMANCE_TEST_DATA */
306 typedef struct {
307   uint16_t length;
308   uint8_t data[CONFORMANCE_TEST_MAX_UCI_PKT_LENGTH];
309 } tUWB_CONFORMANCE_TEST_DATA;
310 
311 /* the data type associated with vendor notification */
312 typedef struct {
313   uint16_t len;
314   uint8_t data[UCI_VENDOR_INFO_MAX_SIZE];
315 } tUWB_VENDOR_SPECIFIC_REVT;
316 
317 /* the data type associated with UWB_RANGING_GET_COUNT_REVT */
318 typedef struct {
319   uint8_t status; /* response status */
320   uint32_t count; /* ranging count in particular session duration */
321 } tUWB_GET_RANGE_COUNT_REVT;
322 
323 /* the data type associated with UWB_CORE_GET_DEVICE_CAPABILITY_REVT */
324 typedef struct {
325   tUWB_STATUS status; /* The event status.    */
326   uint8_t no_of_tlvs;
327   uint8_t tlv_buffer[UCI_MAX_PAYLOAD_SIZE]; /* TLV                  */
328   uint16_t tlv_buffer_len;                  /* The length of TLV    */
329 } tUWB_CORE_GET_DEVICE_CAPABILITY_REVT;
330 
331 /* the data type associated with UWB_SESSION_UPDATE_MULTICAST_LIST_NTF_REVT */
332 typedef struct {
333   uint32_t session_id;
334   uint8_t remaining_list;
335   uint8_t no_of_controlees;
336   uint16_t controlee_mac_address_list[MAX_NUM_CONTROLLEES];
337   uint32_t subsession_id_list[MAX_NUM_CONTROLLEES];
338   uint8_t status_list[MAX_NUM_CONTROLLEES];
339 } tUWB_SESSION_UPDATE_MULTICAST_LIST_NTF_REVT;
340 
341 /* the data type associated with UWB_BLINK_DATA_TX_NTF_REVT */
342 typedef struct {
343   uint8_t repetition_count_status; /* repetition count status */
344 } tUWB_SEND_BLINK_DATA_NTF_REVT;
345 
346 typedef struct {
347   tUWB_STATUS status; /* The event status.                */
348 } tUWB_SET_COUNTRY_CODE_REVT;
349 
350 typedef union {
351   tUWB_STATUS status; /* The event status. */
352   tUWB_ENABLE_REVT enable;
353   tUWB_GET_DEVICE_INFO_REVT sGet_device_info;
354   tUWB_DEVICE_STATUS_REVT sDevice_status;
355   tUWB_CORE_GEN_ERR_STATUS_REVT sCore_gen_err_status;
356   tUWB_DEVICE_RESET_REVT sDevice_reset;
357   tUWB_SET_CORE_CONFIG_REVT sCore_set_config;
358   tUWB_GET_CORE_CONFIG_REVT sCore_get_config;
359   tUWB_SESSION_NTF_REVT sSessionStatus;
360   tUWB_GET_APP_CONFIG_REVT sApp_get_config;
361   tUWB_SET_APP_CONFIG_REVT sApp_set_config;
362   tUWB_SESSION_GET_COUNT_REVT sGet_session_cnt;
363   tUWB_SESSION_GET_STATE_REVT sGet_session_state;
364   tUWB_RANGE_DATA_REVT sRange_data;
365   tUWB_GET_RANGE_COUNT_REVT sGet_range_cnt;
366   tUWB_CORE_GET_DEVICE_CAPABILITY_REVT sGet_device_capability;
367   tUWB_SESSION_UPDATE_MULTICAST_LIST_NTF_REVT sMulticast_list_ntf;
368   tUWB_SET_COUNTRY_CODE_REVT sSet_country_code_status;
369   tUWB_SEND_BLINK_DATA_NTF_REVT sSend_blink_data_ntf;
370   tUWB_CONFORMANCE_TEST_DATA sConformance_test_data;
371   tUWB_VENDOR_SPECIFIC_REVT sVendor_specific_ntf;
372 } tUWB_RESPONSE;
373 
374 /* Data types associated with all RF test Events */
375 
376 /* the data type associated with UWB_GET_TEST_CONFIG_REVT */
377 typedef struct {
378   tUWB_STATUS status; /* The event status.    */
379   uint8_t no_of_ids;
380   uint8_t p_param_tlvs[UCI_MAX_PAYLOAD_SIZE]; /* TLV                  */
381   uint16_t tlv_size;                          /* The length of TLV    */
382 } tUWB_TEST_GET_CONFIG_REVT;
383 
384 typedef struct {
385   tUWB_STATUS status;                 /* The event status.                */
386   uint8_t num_param_id;               /* Number of rejected UCI Param ID  */
387   uint8_t param_ids[UWB_MAX_NUM_IDS]; /* UCI Param ID          */
388   uint16_t tlv_size;                  /* The length of TLV    */
389 } tUWB_TEST_SET_CONFIG_REVT;
390 
391 /* The data type associated with  UWB_RF_TEST_DATA_REVT*/
392 typedef struct {
393   uint16_t length;
394   uint8_t data[255];
395 } tUWB_RF_TEST_DATA;
396 
397 typedef union {
398   tUWB_STATUS status; /* The event status. */
399   tUWB_TEST_GET_CONFIG_REVT sTest_get_config;
400   tUWB_TEST_SET_CONFIG_REVT sTest_set_config;
401   tUWB_RF_TEST_DATA sRf_test_result;
402 } tUWB_TEST_RESPONSE;
403 
404 /*************************************
405 **  RESPONSE Callback Functions
406 **************************************/
407 typedef void(tUWB_RESPONSE_CBACK)(tUWB_RESPONSE_EVT event,
408                                   tUWB_RESPONSE* p_data);
409 typedef void(tUWB_TEST_RESPONSE_CBACK)(tUWB_TEST_RESPONSE_EVT event,
410                                        tUWB_TEST_RESPONSE* p_data);
411 typedef void(tUWB_RAW_CBACK)(tUWB_RAW_EVT event, uint16_t data_len,
412                              uint8_t* p_data);
413 
414 /*******************************************************************************
415 **
416 ** Function         UWB_Enable
417 **
418 ** Description      This function enables UWBS. Prior to calling UWB_Enable:
419 **                  - the UWBS must be powered up, and ready to receive
420 **                    commands.
421 **                  - GKI must be enabled
422 **                  - UWB_TASK must be started
423 **                  - UCIT_TASK must be started (if using dedicated UCI
424 **                    transport)
425 **
426 **                  This function opens the UCI transport (if applicable),
427 **                  resets the UWB controller, and initializes the UWB
428 **                  subsystem.
429 **
430 **                  When the UWB startup procedure is completed, an
431 **                  UWB_ENABLE_REVT is returned to the application using the
432 **                  tUWB_RESPONSE_CBACK.
433 **
434 ** Returns          tUWB_STATUS
435 **
436 *******************************************************************************/
437 extern tUWB_STATUS UWB_Enable(tUWB_RESPONSE_CBACK* p_cback,
438                               tUWB_TEST_RESPONSE_CBACK* p_test_cback);
439 
440 /*******************************************************************************
441 **
442 ** Function         UWB_Disable
443 **
444 ** Description      This function performs clean up routines for shutting down
445 **                  UWB subsystem and closes the UCI transport (if using
446 **                  dedicated UCI transport).
447 **
448 **                  When the UWB shutdown procedure is completed, an
449 **                  UWB_DISABLED_REVT is returned to the application using the
450 **                  tUWB_RESPONSE_CBACK.
451 **
452 ** Returns          nothing
453 **
454 *******************************************************************************/
455 extern void UWB_Disable(void);
456 
457 /*******************************************************************************
458 **
459 ** Function         UWB_Init
460 **
461 ** Description      This function initializes control blocks for UWB
462 **
463 ** Returns          nothing
464 **
465 *******************************************************************************/
466 
467 extern void UWB_Init(tHAL_UWB_CONTEXT* p_hal_entry_cntxt);
468 
469 /*******************************************************************************
470 **
471 ** Function         UWB_GetDeviceInfo
472 **
473 ** Description      This function is called to get Device Info
474 **                  The response from UWBS is reported with an
475 **                  UWB_GET_DEVICE_INFO_REVT
476 **                  in the tUWB_RESPONSE_CBACK callback.
477 **
478 ** Parameters       None
479 **
480 ** Returns          none
481 **
482 *******************************************************************************/
483 extern tUWB_STATUS UWB_GetDeviceInfo();
484 
485 /*******************************************************************************
486 **
487 ** Function         UWB_DeviceResetCommand
488 **
489 ** Description      This function is called to send Device Reset Command to
490 **                  UWBS.
491 **                  The response from UWBS is reported with an
492 **                  UWB_DEVICE_RESET_REVT
493 **                  in the tUWB_RESPONSE_CBACK callback.
494 **
495 ** Parameters       resetConfig - Vendor Specific Reset Config to be sent
496 **
497 ** Returns          tUWB_STATUS
498 **
499 *******************************************************************************/
500 extern tUWB_STATUS UWB_DeviceResetCommand(uint8_t resetConfig);
501 
502 /*******************************************************************************
503 **
504 ** Function         UWB_SetCoreConfig
505 **
506 ** Description      This function is called to send the configuration
507 **                  parameters.
508 **                  The response from UWBS is reported with an
509 **                  UWB_SET_CORE_CONFIG_REVT
510 **                  in the tUWB_RESPONSE_CBACK callback.
511 **
512 ** Parameters       tlv_size - the length of p_param_tlvs.
513 **                  p_param_tlvs - the parameter ID/Len/Value list
514 **
515 ** Returns          tUWB_STATUS
516 **
517 *******************************************************************************/
518 extern tUWB_STATUS UWB_SetCoreConfig(uint8_t tlv_size, uint8_t* p_param_tlvs);
519 
520 /*******************************************************************************
521 **
522 ** Function         UWB_GetCoreConfig
523 **
524 ** Description      This function is called to retrieve the configuration
525 **                  parameters from UWBS.
526 **                  The response from UWBS is reported with an
527 **                  UWB_GET_CORE_CONFIG_REVT
528 **                  in the tUWB_RESPONSE_CBACK callback.
529 **
530 ** Parameters       num_ids - the number of parameter IDs
531 **                  p_param_ids - the parameter ID list.
532 **
533 ** Returns          tUWB_STATUS
534 **
535 *******************************************************************************/
536 extern tUWB_STATUS UWB_GetCoreConfig(uint8_t num_ids, uint8_t* p_param_ids);
537 
538 /*******************************************************************************
539 **
540 ** Function         UWB_SessionInit
541 **
542 ** Description      This function is called to send session init command to
543 **                  UWBS.
544 **                  The response from UWBS is reported with an
545 **                  UWB_SESSION_INIT_REVT
546 **                  in the tUWB_RESPONSE_CBACK callback.
547 **
548 ** Returns          tUWB_STATUS
549 **
550 *******************************************************************************/
551 extern tUWB_STATUS UWB_SessionInit(uint32_t session_id, uint8_t sessionType);
552 
553 /*******************************************************************************
554 **
555 ** Function         UWB_HalSessionInit
556 **
557 ** Description      This function is called to send session init command to
558 **                  HAL.
559 ** Returns          tUWB_STATUS
560 **
561 *******************************************************************************/
562 extern tUWB_STATUS UWB_HalSessionInit(uint32_t session_id);
563 
564 /*******************************************************************************
565 **
566 ** Function         UWB_SessionDeInit
567 **
568 ** Description      This function is called to send session DeInit command to
569 **                  UWBS.
570 **                  The response from UWBS is reported with an
571 **                  UWB_SESSION_DEINIT_REVT
572 **                  in the tUWB_RESPONSE_CBACK callback.
573 **
574 ** Returns          tUWB_STATUS
575 **
576 *******************************************************************************/
577 extern tUWB_STATUS UWB_SessionDeInit(uint32_t session_id);
578 
579 /*******************************************************************************
580 **
581 ** Function         UWB_GetSessionCount
582 **
583 ** Description      This function is called to send get session count command to
584 **                  UWBS.
585 **                  The response from UWBS is reported with an
586 **                  UWB_SESSION_GET_COUNT_REVT
587 **                  in the tUWB_RESPONSE_CBACK callback.
588 **
589 ** Returns          tUWB_STATUS
590 **
591 *******************************************************************************/
592 extern tUWB_STATUS UWB_GetSessionCount();
593 
594 /*******************************************************************************
595 **
596 ** Function         UWB_GetAppConfig
597 **
598 ** Description      This function is called to retrieve the parameter TLV from
599 **                  UWBS.
600 **                  The response from UWBS is reported with an
601 **                  UWB_GET_APP_CONFIG_REVT
602 **                  in the tUWB_RESPONSE_CBACK callback.
603 **
604 ** Parameters       session_id - All APP configurations belonging to this
605 **                  Session ID
606 **                  num_ids - the number of parameter IDs
607 **                  length - Length of app parameter ID
608 **                  p_param_ids - the parameter ID list.
609 **
610 ** Returns          tUWB_STATUS
611 **
612 *******************************************************************************/
613 extern tUWB_STATUS UWB_GetAppConfig(uint32_t session_id, uint8_t num_ids,
614                                     uint8_t length, uint8_t* p_param_ids);
615 
616 /*******************************************************************************
617 **
618 ** Function       UWB_SetAppConfig
619 **
620 ** Description    This function is called to set the parameter TLV to UWBS.
621 **                The response from UWBS is reported with an
622 **                UWB_SET_APP_CONFIG_REVT
623 **                in the tUWB_RESPONSE_CBACK callback.
624 **
625 ** Parameters     session_id - All APP configurations belonging to this SessionID
626 **                num_ids - the number of parameter IDs
627 **                length - Length of app parameter data
628 **                p_data - SetAppConfig TLV data
629 **
630 ** Returns        tUWB_STATUS
631 **
632 *******************************************************************************/
633 extern tUWB_STATUS UWB_SetAppConfig(uint32_t session_id, uint8_t num_ids,
634                                     uint8_t length, uint8_t* p_data);
635 
636 /*******************************************************************************
637 **
638 ** Function       UWB_StartRanging
639 **
640 ** Description    This function is called to send the range start command to
641 **                UWBS.
642 **                The response from UWBS is reported with an
643 **                UWB_START_RANGE_REVT
644 **                in the tUWB_RESPONSE_CBACK callback.
645 **
646 ** Parameters     session_id -  Session ID for which ranging shall start
647 **
648 ** Returns        tUWB_STATUS
649 **
650 *******************************************************************************/
651 extern tUWB_STATUS UWB_StartRanging(uint32_t session_id);
652 
653 /*******************************************************************************
654 **
655 ** Function       UWB_StopRanging
656 **
657 ** Description    This function is called to send the range stop command to
658 **                UWBS.
659 **                The response from UWBS is reported with an UWB_STOP_RANGE_REVT
660 **                in the tUWB_RESPONSE_CBACK callback.
661 **
662 ** Parameters     session_id -  Session ID for which ranging shall stop
663 **
664 ** Returns        tUWB_STATUS
665 **
666 *******************************************************************************/
667 extern tUWB_STATUS UWB_StopRanging(uint32_t session_id);
668 
669 /*******************************************************************************
670 **
671 ** Function       UWB_GetRangingCount
672 **
673 ** Description    This function is called to send get ranging count command.
674 **                The response from UWBS is reported with an
675 **                UWB_GET_RANGE_COUNT_REVT
676 **                in the tUWB_RESPONSE_CBACK callback.
677 **
678 ** Parameters     session_id -  Session ID for which ranging round count is
679 **                required
680 **
681 ** Returns        tUWB_STATUS
682 **
683 *******************************************************************************/
684 extern tUWB_STATUS UWB_GetRangingCount(uint32_t session_id);
685 
686 /*******************************************************************************
687 **
688 ** Function       UWB_GetSessionStatus
689 **
690 ** Description    This function is called to send get session status command.
691 **                The response from UWBS is reported with an
692 **                UWB_SESSION_GET_STATE_REVT
693 **                in the tUWB_RESPONSE_CBACK callback.
694 **
695 ** Parameters     session_id -  Session ID for which session state is required
696 **
697 ** Returns        tUWB_STATUS
698 **
699 *******************************************************************************/
700 extern tUWB_STATUS UWB_GetSessionStatus(uint32_t session_id);
701 
702 /*******************************************************************************
703 **
704 ** Function       UWB_CoreGetDeviceCapability
705 **
706 ** Description    This function is called to send the Core Get Capability
707 **                The response from UWBS is reported with an
708 **                UWB_CORE_GET_DEVICE_CAPABILITY_REVT
709 **                in the tUWB_RESPONSE_CBACK callback.
710 **
711 ** Parameters     None
712 **
713 ** Returns        tUWB_STATUS
714 **
715 *******************************************************************************/
716 extern tUWB_STATUS UWB_CoreGetDeviceCapability(void);
717 
718 /*******************************************************************************
719 **
720 ** Function       UWB_MulticastListUpdate
721 **
722 ** Description    This function is called to send the Multicast list update
723 **                command
724 **                The response from UWBS is reported with an
725 **                UWB_SESSION_UPDATE_MULTICAST_LIST_REVT
726 **                in the tUWB_RESPONSE_CBACK callback.
727 **
728 ** Parameters     session_id - Session ID
729 **                action - action
730 **                noOfControlees - No Of Controlees
731 **                shortAddress - array of short address
732 **                subSessionId - array of sub session ID
733 **
734 ** Returns          tUWB_STATUS
735 **
736 *******************************************************************************/
737 extern tUWB_STATUS UWB_MulticastListUpdate(uint32_t session_id, uint8_t action,
738                                            uint8_t noOfControlees,
739                                            uint16_t* shortAddressList,
740                                            uint32_t* subSessionIdList);
741 
742 /*******************************************************************************
743 **
744 ** Function       UWB_SetCountryCode
745 **
746 ** Description    This function is called to send the country code set
747 **                command.
748 **                The response from UWBS is reported with an
749 **                UWB_SESSION_SET_COUNTRY_CODE_REVT
750 **                in the tUWB_RESPONSE_CBACK callback.
751 **
752 ** Parameters     country_code - ISO Country code
753 **
754 ** Returns          tUWB_STATUS
755 **
756 *******************************************************************************/
757 tUWB_STATUS UWB_SetCountryCode(uint8_t* countryCode);
758 
759 /*******************************************************************************
760 **
761 ** Function       UWB_SendBlinkData
762 **
763 ** Description    This function is called to send blink data tx  command
764 **                The response from UWBS is reported with an
765 **                UWB_BLINK_DATA_TX_REVT
766 **                in the tUWB_RESPONSE_CBACK callback.
767 **
768 ** Parameters     session_id - Session ID
769 **                repetition_count - repetition count
770 **                app_data_len - size of application data
771 **                app_data - application data
772 **
773 ** Returns        tUWB_STATUS
774 **
775 *******************************************************************************/
776 extern tUWB_STATUS UWB_SendBlinkData(uint32_t session_id,
777                                      uint8_t repetition_count,
778                                      uint8_t app_data_len, uint8_t* app_data);
779 
780 /*******************************************************************************
781 **
782 ** Function         UWB_SendRawCommand
783 **
784 ** Description      This function is called to send the given raw command to
785 **                  UWBS. The response from UWBC is reported to the given
786 **                  tUWB_RAW_CBACK.
787 **
788 ** Parameters       p_data - The command buffer
789 **
790 ** Returns          tUWB_STATUS
791 **
792 *******************************************************************************/
793 extern tUWB_STATUS UWB_SendRawCommand(UWB_HDR* p_data, tUWB_RAW_CBACK* p_cback);
794 
795 /*******************************************************************************
796 **
797 ** Function         UWB_EnableConformanceTest
798 **
799 ** Description      This function is called to set MCTT/PCTT mode.
800 **                  In this mode application is sending raw UCI packets.
801 **
802 ** Parameters       p_data - The data  buffer
803 **
804 ** Returns          None
805 **
806 *******************************************************************************/
807 void UWB_EnableConformanceTest(uint8_t enable);
808 
809 /*******************************************************************************
810 **
811 ** Function         UWB_GetStatusName
812 **
813 ** Description      This function returns the status name.
814 **
815 ** NOTE             conditionally compiled to save memory.
816 **
817 ** Returns          pointer to the name
818 **
819 *******************************************************************************/
820 extern const uint8_t* UWB_GetStatusName(tUWB_STATUS status);
821 
822 /****************** RF TEST
823  * FUNCTIONS********************************************/
824 
825 /*******************************************************************************
826 **
827 ** Function       UWB_TestGetConfig
828 **
829 ** Description    This function is called to retrieve the test configuration
830 **                parameter from UWBS.
831 **                The response from UWBS is reported with an
832 **                UWB_TEST_GET_CONFIG_REVT
833 **                in the tUWB_RESPONSE_CBACK callback.
834 **
835 ** Parameters     session_id - All TEST configurations belonging to this SessionId
836 **                num_ids - the number of parameter IDs
837 **                length - Length of test parameter ID
838 **                p_param_ids - the parameter ID list.
839 **
840 ** Returns        tUWB_STATUS
841 **
842 *******************************************************************************/
843 extern tUWB_STATUS UWB_TestGetConfig(uint32_t session_id, uint8_t num_ids,
844                                      uint8_t length, uint8_t* p_param_ids);
845 
846 /*******************************************************************************
847 **
848 ** Function       UWB_SetTestConfig
849 **
850 ** Description    This function is called to set the test configuration
851 **                parameters.
852 **                The response from UWBS is reported with an
853 **                UWB_TEST_SET_CONFIG_REVT
854 **                in the tUWB_RESPONSE_CBACK callback.
855 **
856 ** Parameters     session_id - All TEST configurations belonging to this SessionId
857 **                num_ids - the number of parameter IDs
858 **                length - Length of test parameter data
859 **                p_data - SetAppConfig TLV data
860 **
861 ** Returns        tUWB_STATUS
862 **
863 *******************************************************************************/
864 extern tUWB_STATUS UWB_SetTestConfig(uint32_t session_id, uint8_t num_ids,
865                                      uint8_t length, uint8_t* p_data);
866 
867 /*******************************************************************************
868 **
869 ** Function       UWB_TestPeriodicTx
870 **
871 ** Description    This function is called send periodic Tx test command
872 **                The response from UWBS is reported with an
873 **                UWB_TEST_PERIODIC_TX_REVT
874 **                in the tUWB_RESPONSE_CBACK callback.
875 **
876 ** Parameters     length - Length of psdu data.
877 **                p_data - psdu data
878 **
879 ** Returns        tUWB_STATUS
880 **
881 *******************************************************************************/
882 extern tUWB_STATUS UWB_TestPeriodicTx(uint16_t length, uint8_t* p_data);
883 
884 /*******************************************************************************
885 **
886 ** Function       UWB_TestPerRx
887 **
888 ** Description    This function is called send Packet Error Rate(PER) Rx test
889 **                command.
890 **                The response from UWBS is reported with an
891 **                UWB_TEST_PER_RX_REVT
892 **                in the tUWB_RESPONSE_CBACK callback.
893 **
894 ** Parameters     length - Length of psdu data.
895 **                p_data - psdu data
896 **
897 ** Returns        tUWB_STATUS
898 **
899 *******************************************************************************/
900 extern tUWB_STATUS UWB_TestPerRx(uint16_t length, uint8_t* p_data);
901 
902 /*******************************************************************************
903 **
904 ** Function       UWB_TestUwbLoopBack
905 **
906 ** Description    This function is called send Loop Back test command.
907 **                The response from UWBS is reported with an
908 **                UWB_TEST_LOOPBACK_REVT
909 **                in the tUWB_RESPONSE_CBACK callback.
910 **
911 ** Parameters     length - Length of psdu data.
912 **                p_data - psdu data
913 **
914 ** Returns        tUWB_STATUS
915 **
916 *******************************************************************************/
917 extern tUWB_STATUS UWB_TestUwbLoopBack(uint16_t length, uint8_t* p_data);
918 
919 /********************************************************************************
920 **
921 ** Function       UWB_TestRx
922 **
923 ** Description    This function is called send Rx Test command
924 **                The response from UWBS is reported with an UWB_TEST_RX_REVT
925 **                in the tUWB_RESPONSE_CBACK callback.
926 **
927 ** Parameters     None
928 **
929 ** Returns        tUWB_STATUS
930 **
931 *******************************************************************************/
932 extern tUWB_STATUS UWB_TestRx(void);
933 
934 /*******************************************************************************
935 **
936 ** Function      UWB_TestStopSession
937 **
938 ** Description   This function is called to send test session stop command.
939 **               The response from UWBS is reported with an
940 **               UWB_TEST_STOP_SESSION_REVT
941 **               in the tUWB_RESPONSE_CBACK callback.
942 **
943 ** Parameters    None
944 **
945 ** Returns       tUWB_STATUS
946 **
947 *******************************************************************************/
948 extern tUWB_STATUS UWB_TestStopSession(void);
949 
950 #endif /* UWB_API_H */
951