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