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