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