• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2010-2014 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This is the private interface file for the NFA HCI.
22  *
23  ******************************************************************************/
24 #ifndef NFA_HCI_INT_H
25 #define NFA_HCI_INT_H
26 
27 #include <string>
28 #include "nfa_ee_api.h"
29 #include "nfa_hci_api.h"
30 #include "nfa_sys.h"
31 extern uint8_t HCI_LOOPBACK_DEBUG;
32 
33 /* NFA HCI DEBUG states */
34 #define NFA_HCI_DEBUG_ON 0x01
35 #define NFA_HCI_DEBUG_OFF 0x00
36 /*****************************************************************************
37 **  Constants and data types
38 *****************************************************************************/
39 
40 #define NFA_HCI_HOST_ID_UICC0 0x02 /* Host ID for UICC 0 */
41 /* Lost host specific gate */
42 #define NFA_HCI_LAST_HOST_SPECIFIC_GATE 0xEF
43 
44 #define NFA_HCI_SESSION_ID_LEN 8 /* HCI Session ID length */
45 
46 /* HCI SW Version number                       */
47 #define NFA_HCI_VERSION_SW 0x090000
48 /* HCI HW Version number                       */
49 #define NFA_HCI_VERSION_HW 0x000000
50 #define NFA_HCI_VENDOR_NAME \
51   "HCI" /* Vendor Name                                 */
52 /* Model ID                                    */
53 #define NFA_HCI_MODEL_ID 00
54 /* HCI Version                                 */
55 #define NFA_HCI_VERSION 90
56 
57 /* NFA HCI states */
58 #define NFA_HCI_STATE_DISABLED 0x00 /* HCI is disabled  */
59 /* HCI performing Initialization sequence */
60 #define NFA_HCI_STATE_STARTUP 0x01
61 /* HCI is waiting for initialization of other host in the network */
62 #define NFA_HCI_STATE_WAIT_NETWK_ENABLE 0x02
63 /* HCI is waiting to handle api commands  */
64 #define NFA_HCI_STATE_IDLE 0x03
65 /* HCI is waiting for response to command sent */
66 #define NFA_HCI_STATE_WAIT_RSP 0x04
67 /* Removing all pipes prior to removing the gate */
68 #define NFA_HCI_STATE_REMOVE_GATE 0x05
69 /* Removing all pipes and gates prior to deregistering the app */
70 #define NFA_HCI_STATE_APP_DEREGISTER 0x06
71 #define NFA_HCI_STATE_RESTORE 0x07 /* HCI restore */
72 /* HCI is waiting for initialization of other host in the network after restore
73  */
74 #define NFA_HCI_STATE_RESTORE_NETWK_ENABLE 0x08
75 
76 #define NFA_HCI_STATE_EE_RECOVERY 0x09
77 
78 typedef uint8_t tNFA_HCI_STATE;
79 
80 /* NFA HCI PIPE states */
81 #define NFA_HCI_PIPE_CLOSED 0x00 /* Pipe is closed */
82 #define NFA_HCI_PIPE_OPENED 0x01 /* Pipe is opened */
83 
84 typedef uint8_t tNFA_HCI_COMMAND;
85 typedef uint8_t tNFA_HCI_RESPONSE;
86 
87 /* NFA HCI Internal events */
88 enum {
89   NFA_HCI_API_REGISTER_APP_EVT =
90       NFA_SYS_EVT_START(NFA_ID_HCI), /* Register APP with HCI */
91   NFA_HCI_API_DEREGISTER_APP_EVT,    /* Deregister an app from HCI */
92   NFA_HCI_API_GET_APP_GATE_PIPE_EVT, /* Get the list of gate and pipe associated
93                                         to the application */
94   NFA_HCI_API_ALLOC_GATE_EVT, /* Allocate a dyanmic gate for the application */
95   NFA_HCI_API_DEALLOC_GATE_EVT, /* Deallocate a previously allocated gate to the
96                                    application */
97   NFA_HCI_API_GET_HOST_LIST_EVT,   /* Get the list of Host in the network */
98   NFA_HCI_API_GET_REGISTRY_EVT,    /* Get a registry entry from a host */
99   NFA_HCI_API_SET_REGISTRY_EVT,    /* Set a registry entry on a host */
100   NFA_HCI_API_CREATE_PIPE_EVT,     /* Create a pipe between two gates */
101   NFA_HCI_API_OPEN_PIPE_EVT,       /* Open a pipe */
102   NFA_HCI_API_CLOSE_PIPE_EVT,      /* Close a pipe */
103   NFA_HCI_API_DELETE_PIPE_EVT,     /* Delete a pipe */
104   NFA_HCI_API_ADD_STATIC_PIPE_EVT, /* Add a static pipe */
105   NFA_HCI_API_SEND_CMD_EVT,        /* Send command via pipe */
106   NFA_HCI_API_SEND_RSP_EVT,        /* Application Response to a command */
107   NFA_HCI_API_SEND_EVENT_EVT,      /* Send event via pipe */
108 
109   NFA_HCI_RSP_NV_READ_EVT,  /* Non volatile read complete event */
110   NFA_HCI_RSP_NV_WRITE_EVT, /* Non volatile write complete event */
111   NFA_HCI_RSP_TIMEOUT_EVT,  /* Timeout to response for the HCP Command packet */
112   NFA_HCI_CHECK_QUEUE_EVT
113 };
114 
115 #define NFA_HCI_FIRST_API_EVENT NFA_HCI_API_REGISTER_APP_EVT
116 #define NFA_HCI_LAST_API_EVENT NFA_HCI_API_SEND_EVENT_EVT
117 
118 /* Internal event structures.
119 **
120 ** Note, every internal structure starts with a NFC_HDR and an app handle
121 */
122 
123 /* data type for NFA_HCI_API_REGISTER_APP_EVT */
124 typedef struct {
125   NFC_HDR hdr;
126   tNFA_HANDLE hci_handle;
127   char app_name[NFA_MAX_HCI_APP_NAME_LEN + 1];
128   tNFA_HCI_CBACK* p_cback;
129   bool b_send_conn_evts;
130 } tNFA_HCI_API_REGISTER_APP;
131 
132 /* data type for NFA_HCI_API_DEREGISTER_APP_EVT */
133 typedef struct {
134   NFC_HDR hdr;
135   tNFA_HANDLE hci_handle;
136   char app_name[NFA_MAX_HCI_APP_NAME_LEN + 1];
137 } tNFA_HCI_API_DEREGISTER_APP;
138 
139 /* data type for NFA_HCI_API_GET_APP_GATE_PIPE_EVT */
140 typedef struct {
141   NFC_HDR hdr;
142   tNFA_HANDLE hci_handle;
143 } tNFA_HCI_API_GET_APP_GATE_PIPE;
144 
145 /* data type for NFA_HCI_API_ALLOC_GATE_EVT */
146 typedef struct {
147   NFC_HDR hdr;
148   tNFA_HANDLE hci_handle;
149   uint8_t gate;
150 } tNFA_HCI_API_ALLOC_GATE;
151 
152 /* data type for NFA_HCI_API_DEALLOC_GATE_EVT */
153 typedef struct {
154   NFC_HDR hdr;
155   tNFA_HANDLE hci_handle;
156   uint8_t gate;
157 } tNFA_HCI_API_DEALLOC_GATE;
158 
159 /* data type for NFA_HCI_API_GET_HOST_LIST_EVT */
160 typedef struct {
161   NFC_HDR hdr;
162   tNFA_HANDLE hci_handle;
163   tNFA_STATUS status;
164 } tNFA_HCI_API_GET_HOST_LIST;
165 
166 /* data type for NFA_HCI_API_GET_REGISTRY_EVT */
167 typedef struct {
168   NFC_HDR hdr;
169   tNFA_HANDLE hci_handle;
170   uint8_t pipe;
171   uint8_t reg_inx;
172 } tNFA_HCI_API_GET_REGISTRY;
173 
174 /* data type for NFA_HCI_API_SET_REGISTRY_EVT */
175 typedef struct {
176   NFC_HDR hdr;
177   tNFA_HANDLE hci_handle;
178   uint8_t pipe;
179   uint8_t reg_inx;
180   uint8_t size;
181   uint8_t data[NFA_MAX_HCI_CMD_LEN];
182 } tNFA_HCI_API_SET_REGISTRY;
183 
184 /* data type for NFA_HCI_API_CREATE_PIPE_EVT */
185 typedef struct {
186   NFC_HDR hdr;
187   tNFA_HANDLE hci_handle;
188   tNFA_STATUS status;
189   uint8_t source_gate;
190   uint8_t dest_host;
191   uint8_t dest_gate;
192 } tNFA_HCI_API_CREATE_PIPE_EVT;
193 
194 /* data type for NFA_HCI_API_OPEN_PIPE_EVT */
195 typedef struct {
196   NFC_HDR hdr;
197   tNFA_HANDLE hci_handle;
198   tNFA_STATUS status;
199   uint8_t pipe;
200 } tNFA_HCI_API_OPEN_PIPE_EVT;
201 
202 /* data type for NFA_HCI_API_CLOSE_PIPE_EVT */
203 typedef struct {
204   NFC_HDR hdr;
205   tNFA_HANDLE hci_handle;
206   tNFA_STATUS status;
207   uint8_t pipe;
208 } tNFA_HCI_API_CLOSE_PIPE_EVT;
209 
210 /* data type for NFA_HCI_API_DELETE_PIPE_EVT */
211 typedef struct {
212   NFC_HDR hdr;
213   tNFA_HANDLE hci_handle;
214   tNFA_STATUS status;
215   uint8_t pipe;
216 } tNFA_HCI_API_DELETE_PIPE_EVT;
217 
218 /* data type for NFA_HCI_API_ADD_STATIC_PIPE_EVT */
219 typedef struct {
220   NFC_HDR hdr;
221   tNFA_HANDLE hci_handle;
222   tNFA_STATUS status;
223   uint8_t host;
224   uint8_t gate;
225   uint8_t pipe;
226 } tNFA_HCI_API_ADD_STATIC_PIPE_EVT;
227 
228 /* data type for NFA_HCI_API_SEND_EVENT_EVT */
229 typedef struct {
230   NFC_HDR hdr;
231   tNFA_HANDLE hci_handle;
232   uint8_t pipe;
233   uint8_t evt_code;
234   uint16_t evt_len;
235   uint8_t* p_evt_buf;
236   uint16_t rsp_len;
237   uint8_t* p_rsp_buf;
238   uint16_t rsp_timeout;
239 } tNFA_HCI_API_SEND_EVENT_EVT;
240 
241 /* data type for NFA_HCI_API_SEND_CMD_EVT */
242 typedef struct {
243   NFC_HDR hdr;
244   tNFA_HANDLE hci_handle;
245   uint8_t pipe;
246   uint8_t cmd_code;
247   uint16_t cmd_len;
248   uint8_t data[NFA_MAX_HCI_CMD_LEN];
249 } tNFA_HCI_API_SEND_CMD_EVT;
250 
251 /* data type for NFA_HCI_RSP_NV_READ_EVT */
252 typedef struct {
253   NFC_HDR hdr;
254   uint8_t block;
255   uint16_t size;
256   tNFA_STATUS status;
257 } tNFA_HCI_RSP_NV_READ_EVT;
258 
259 /* data type for NFA_HCI_RSP_NV_WRITE_EVT */
260 typedef struct {
261   NFC_HDR hdr;
262   tNFA_STATUS status;
263 } tNFA_HCI_RSP_NV_WRITE_EVT;
264 
265 /* data type for NFA_HCI_API_SEND_RSP_EVT */
266 typedef struct {
267   NFC_HDR hdr;
268   tNFA_HANDLE hci_handle;
269   uint8_t pipe;
270   uint8_t response;
271   uint8_t size;
272   uint8_t data[NFA_MAX_HCI_RSP_LEN];
273 } tNFA_HCI_API_SEND_RSP_EVT;
274 
275 /* common data type for internal events */
276 typedef struct {
277   NFC_HDR hdr;
278   tNFA_HANDLE hci_handle;
279 } tNFA_HCI_COMM_DATA;
280 
281 /* union of all event data types */
282 typedef union {
283   NFC_HDR hdr;
284   tNFA_HCI_COMM_DATA comm;
285 
286   /* API events */
287   tNFA_HCI_API_REGISTER_APP app_info; /* Register/Deregister an application */
288   tNFA_HCI_API_GET_APP_GATE_PIPE get_gate_pipe_list; /* Get the list of gates
289                                                         and pipes created for
290                                                         the application */
291   tNFA_HCI_API_ALLOC_GATE
292       gate_info; /* Allocate a dynamic gate to the application */
293   tNFA_HCI_API_DEALLOC_GATE
294       gate_dealloc; /* Deallocate the gate allocated to the application */
295   tNFA_HCI_API_CREATE_PIPE_EVT create_pipe;         /* Create a pipe */
296   tNFA_HCI_API_OPEN_PIPE_EVT open_pipe;             /* Open a pipe */
297   tNFA_HCI_API_CLOSE_PIPE_EVT close_pipe;           /* Close a pipe */
298   tNFA_HCI_API_DELETE_PIPE_EVT delete_pipe;         /* Delete a pipe */
299   tNFA_HCI_API_ADD_STATIC_PIPE_EVT add_static_pipe; /* Add a static pipe */
300   tNFA_HCI_API_GET_HOST_LIST
301       get_host_list; /* Get the list of Host in the network */
302   tNFA_HCI_API_GET_REGISTRY get_registry; /* Get a registry entry on a host */
303   tNFA_HCI_API_SET_REGISTRY set_registry; /* Set a registry entry on a host */
304   tNFA_HCI_API_SEND_CMD_EVT send_cmd;     /* Send a event on a pipe to a host */
305   tNFA_HCI_API_SEND_RSP_EVT
306       send_rsp; /* Response to a command sent on a pipe to a host */
307   tNFA_HCI_API_SEND_EVENT_EVT send_evt; /* Send a command on a pipe to a host */
308 
309   /* Internal events */
310   tNFA_HCI_RSP_NV_READ_EVT nv_read;   /* Read Non volatile data */
311   tNFA_HCI_RSP_NV_WRITE_EVT nv_write; /* Write Non volatile data */
312 } tNFA_HCI_EVENT_DATA;
313 
314 /*****************************************************************************
315 **  control block
316 *****************************************************************************/
317 
318 /* Dynamic pipe control block */
319 typedef struct {
320   uint8_t pipe_id;                /* Pipe ID */
321   tNFA_HCI_PIPE_STATE pipe_state; /* State of the Pipe */
322   uint8_t local_gate;             /* local gate id */
323   uint8_t dest_host; /* Peer host to which this pipe is connected */
324   uint8_t dest_gate; /* Peer gate to which this pipe is connected */
325 } tNFA_HCI_DYN_PIPE;
326 
327 /* Dynamic gate control block */
328 typedef struct {
329   uint8_t gate_id;        /* local gate id */
330   tNFA_HANDLE gate_owner; /* NFA-HCI handle assigned to the application which
331                              owns the gate */
332   uint32_t pipe_inx_mask; /* Bit 0 == pipe inx 0, etc */
333 } tNFA_HCI_DYN_GATE;
334 
335 /* Admin gate control block */
336 typedef struct {
337   tNFA_HCI_PIPE_STATE pipe01_state; /* State of Pipe '01' */
338   uint8_t
339       session_id[NFA_HCI_SESSION_ID_LEN]; /* Session ID of the host network */
340 } tNFA_ADMIN_GATE_INFO;
341 
342 /* Link management gate control block */
343 typedef struct {
344   tNFA_HCI_PIPE_STATE pipe00_state; /* State of Pipe '00' */
345   uint16_t rec_errors;              /* Receive errors */
346 } tNFA_LINK_MGMT_GATE_INFO;
347 
348 /* Identity management gate control block */
349 typedef struct {
350   uint32_t pipe_inx_mask;  /* Bit 0 == pipe inx 0, etc */
351   uint16_t version_sw;     /* Software version number */
352   uint16_t version_hw;     /* Hardware version number */
353   uint8_t vendor_name[20]; /* Vendor name */
354   uint8_t model_id;        /* Model ID */
355   uint8_t hci_version;     /* HCI Version */
356 } tNFA_ID_MGMT_GATE_INFO;
357 
358 /* NFA HCI control block */
359 typedef struct {
360   tNFA_HCI_STATE hci_state; /* state of the HCI */
361   uint8_t num_nfcee;        /* Number of NFCEE ID Discovered */
362   tNFA_EE_INFO ee_info[NFA_HCI_MAX_HOST_IN_NETWORK]; /*NFCEE ID Info*/
363   uint8_t num_ee_dis_req_ntf; /* Number of ee discovery request ntf received */
364   uint8_t num_hot_plug_evts;  /* Number of Hot plug events received after ee
365                                  discovery disable ntf */
366   uint8_t inactive_host[NFA_HCI_MAX_HOST_IN_NETWORK]; /* Inactive host in the
367                                                          host network */
368   uint8_t reset_host[NFA_HCI_MAX_HOST_IN_NETWORK]; /* List of host reseting */
369   bool b_low_power_mode;  /* Host controller in low power mode */
370   bool b_hci_netwk_reset; /* Command sent to reset HCI Network */
371   bool w4_hci_netwk_init; /* Wait for other host in network to initialize */
372   TIMER_LIST_ENT timer;   /* Timer to avoid indefinitely waiting for response */
373   uint8_t conn_id;        /* Connection ID */
374   uint8_t buff_size;      /* Connection buffer size */
375   bool nv_read_cmplt;     /* NV Read completed */
376   bool nv_write_needed;   /* Something changed - NV write is needed */
377   bool assembling;        /* Set true if in process of assembling a message  */
378   bool assembly_failed;   /* Set true if Insufficient buffer to Reassemble
379                              incoming message */
380   bool w4_rsp_evt;        /* Application command sent on HCP Event */
381   tNFA_HANDLE
382       app_in_use; /* Index of the application that is waiting for response */
383   uint8_t local_gate_in_use;  /* Local gate currently working with */
384   uint8_t remote_gate_in_use; /* Remote gate currently working with */
385   uint8_t remote_host_in_use; /* The remote host to which a command is sent */
386   uint8_t pipe_in_use;        /* The pipe currently working with */
387   uint8_t param_in_use;      /* The registry parameter currently working with */
388   tNFA_HCI_COMMAND cmd_sent; /* The last command sent */
389   bool ee_disc_cmplt;        /* EE Discovery operation completed */
390   bool ee_disable_disc;      /* EE Discovery operation is disabled */
391   uint16_t msg_len;     /* For segmentation - length of the combined message */
392   uint16_t max_msg_len; /* Maximum reassembled message size */
393   uint8_t msg_data[NFA_MAX_HCI_EVENT_LEN]; /* For segmentation - the combined
394                                               message data */
395   uint8_t* p_msg_data; /* For segmentation - reassembled message */
396   uint8_t type;        /* Instruction type of incoming message */
397   uint8_t inst;        /* Instruction of incoming message */
398 
399   BUFFER_Q hci_api_q;            /* Buffer Q to hold incoming API commands */
400   BUFFER_Q hci_host_reset_api_q; /* Buffer Q to hold incoming API commands to a
401                                     host that is reactivating */
402   tNFA_HCI_CBACK* p_app_cback[NFA_HCI_MAX_APP_CB]; /* Callback functions
403                                                       registered by the
404                                                       applications */
405   uint16_t rsp_buf_size; /* Maximum size of APDU buffer */
406   uint8_t* p_rsp_buf;    /* Buffer to hold response to sent event */
407   struct                 /* Persistent information for Device Host */
408   {
409     char reg_app_names[NFA_HCI_MAX_APP_CB][NFA_MAX_HCI_APP_NAME_LEN + 1];
410 
411     tNFA_HCI_DYN_GATE dyn_gates[NFA_HCI_MAX_GATE_CB];
412     tNFA_HCI_DYN_PIPE dyn_pipes[NFA_HCI_MAX_PIPE_CB];
413 
414     bool b_send_conn_evts[NFA_HCI_MAX_APP_CB];
415     tNFA_ADMIN_GATE_INFO admin_gate;
416     tNFA_LINK_MGMT_GATE_INFO link_mgmt_gate;
417     tNFA_ID_MGMT_GATE_INFO id_mgmt_gate;
418   } cfg;
419 
420 } tNFA_HCI_CB;
421 
422 /*****************************************************************************
423 **  External variables
424 *****************************************************************************/
425 
426 /* NFA HCI control block */
427 extern tNFA_HCI_CB nfa_hci_cb;
428 
429 /*****************************************************************************
430 **  External functions
431 *****************************************************************************/
432 
433 /* Functions in nfa_hci_main.c
434 */
435 extern void nfa_hci_init(void);
436 extern void nfa_hci_proc_nfcc_power_mode(uint8_t nfcc_power_mode);
437 extern void nfa_hci_dh_startup_complete(void);
438 extern void nfa_hci_startup_complete(tNFA_STATUS status);
439 extern void nfa_hci_startup(void);
440 extern void nfa_hci_restore_default_config(uint8_t* p_session_id);
441 extern void nfa_hci_enable_one_nfcee(void);
442 
443 /* Action functions in nfa_hci_act.c
444 */
445 extern void nfa_hci_check_pending_api_requests(void);
446 extern void nfa_hci_check_api_requests(void);
447 extern void nfa_hci_handle_admin_gate_cmd(uint8_t* p_data);
448 extern void nfa_hci_handle_admin_gate_rsp(uint8_t* p_data, uint8_t data_len);
449 extern void nfa_hci_handle_admin_gate_evt();
450 extern void nfa_hci_handle_link_mgm_gate_cmd(uint8_t* p_data);
451 extern void nfa_hci_handle_dyn_pipe_pkt(uint8_t pipe, uint8_t* p_data,
452                                         uint16_t data_len);
453 extern void nfa_hci_handle_pipe_open_close_cmd(tNFA_HCI_DYN_PIPE* p_pipe);
454 extern void nfa_hci_api_dealloc_gate(tNFA_HCI_EVENT_DATA* p_evt_data);
455 extern void nfa_hci_api_deregister(tNFA_HCI_EVENT_DATA* p_evt_data);
456 
457 /* Utility functions in nfa_hci_utils.c
458 */
459 extern tNFA_HCI_DYN_GATE* nfa_hciu_alloc_gate(uint8_t gate_id,
460                                               tNFA_HANDLE app_handle);
461 extern tNFA_HCI_DYN_GATE* nfa_hciu_find_gate_by_gid(uint8_t gate_id);
462 extern tNFA_HCI_DYN_GATE* nfa_hciu_find_gate_by_owner(tNFA_HANDLE app_handle);
463 extern tNFA_HCI_DYN_GATE* nfa_hciu_find_gate_with_nopipes_by_owner(
464     tNFA_HANDLE app_handle);
465 extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_pipe_by_pid(uint8_t pipe_id);
466 extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_pipe_by_owner(tNFA_HANDLE app_handle);
467 extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_active_pipe_by_owner(
468     tNFA_HANDLE app_handle);
469 extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_pipe_on_gate(uint8_t gate_id);
470 extern tNFA_HANDLE nfa_hciu_get_gate_owner(uint8_t gate_id);
471 extern bool nfa_hciu_check_pipe_between_gates(uint8_t local_gate,
472                                               uint8_t dest_host,
473                                               uint8_t dest_gate);
474 extern bool nfa_hciu_is_active_host(uint8_t host_id);
475 extern bool nfa_hciu_is_host_reseting(uint8_t host_id);
476 extern bool nfa_hciu_is_no_host_resetting(void);
477 extern tNFA_HCI_DYN_PIPE* nfa_hciu_find_active_pipe_on_gate(uint8_t gate_id);
478 extern tNFA_HANDLE nfa_hciu_get_pipe_owner(uint8_t pipe_id);
479 extern uint8_t nfa_hciu_count_open_pipes_on_gate(tNFA_HCI_DYN_GATE* p_gate);
480 extern uint8_t nfa_hciu_count_pipes_on_gate(tNFA_HCI_DYN_GATE* p_gate);
481 
482 extern tNFA_HCI_RESPONSE nfa_hciu_add_pipe_to_gate(uint8_t pipe,
483                                                    uint8_t local_gate,
484                                                    uint8_t dest_host,
485                                                    uint8_t dest_gate);
486 extern tNFA_HCI_RESPONSE nfa_hciu_add_pipe_to_static_gate(uint8_t local_gate,
487                                                           uint8_t pipe_id,
488                                                           uint8_t dest_host,
489                                                           uint8_t dest_gate);
490 
491 extern tNFA_HCI_RESPONSE nfa_hciu_release_pipe(uint8_t pipe_id);
492 extern void nfa_hciu_release_gate(uint8_t gate);
493 extern void nfa_hciu_remove_all_pipes_from_host(uint8_t host);
494 extern uint8_t nfa_hciu_get_allocated_gate_list(uint8_t* p_gate_list);
495 
496 extern void nfa_hciu_send_to_app(tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* p_evt,
497                                  tNFA_HANDLE app_handle);
498 extern void nfa_hciu_send_to_all_apps(tNFA_HCI_EVT event,
499                                       tNFA_HCI_EVT_DATA* p_evt);
500 extern void nfa_hciu_send_to_apps_handling_connectivity_evts(
501     tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* p_evt);
502 
503 extern tNFA_STATUS nfa_hciu_send_close_pipe_cmd(uint8_t pipe);
504 extern tNFA_STATUS nfa_hciu_send_delete_pipe_cmd(uint8_t pipe);
505 extern tNFA_STATUS nfa_hciu_send_clear_all_pipe_cmd(void);
506 extern tNFA_STATUS nfa_hciu_send_open_pipe_cmd(uint8_t pipe);
507 extern tNFA_STATUS nfa_hciu_send_get_param_cmd(uint8_t pipe, uint8_t index);
508 extern tNFA_STATUS nfa_hciu_send_create_pipe_cmd(uint8_t source_gate,
509                                                  uint8_t dest_host,
510                                                  uint8_t dest_gate);
511 extern tNFA_STATUS nfa_hciu_send_set_param_cmd(uint8_t pipe, uint8_t index,
512                                                uint8_t length, uint8_t* p_data);
513 extern tNFA_STATUS nfa_hciu_send_msg(uint8_t pipe_id, uint8_t type,
514                                      uint8_t instruction, uint16_t pkt_len,
515                                      uint8_t* p_pkt);
516 
517 extern std::string nfa_hciu_instr_2_str(uint8_t type);
518 extern std::string nfa_hciu_get_event_name(uint16_t event);
519 extern std::string nfa_hciu_get_state_name(uint8_t state);
520 extern char* nfa_hciu_get_type_inst_names(uint8_t pipe, uint8_t type,
521                                           uint8_t inst, char* p_buff);
522 extern std::string nfa_hciu_evt_2_str(uint8_t pipe_id, uint8_t evt);
523 
524 #endif /* NFA_HCI_INT_H */
525