Home | History | Annotate | Download | only in int
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2009-2013 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 file contains the NCI transport internal definitions and functions.
     23  *
     24  ******************************************************************************/
     25 
     26 #ifndef NFC_HAL_INT_H
     27 #define NFC_HAL_INT_H
     28 
     29 #include "nfc_hal_target.h"
     30 #include "gki.h"
     31 #include "nci_defs.h"
     32 #include "nfc_brcm_defs.h"
     33 #include "nfc_hal_api.h"
     34 #include "nfc_hal_int_api.h"
     35 
     36 #ifdef __cplusplus
     37 extern "C" {
     38 #endif
     39 
     40 /****************************************************************************
     41 ** NFC HAL TASK transport definitions
     42 ****************************************************************************/
     43 /* NFC HAL Task event masks */
     44 #define NFC_HAL_TASK_EVT_DATA_RDY               EVENT_MASK (APPL_EVT_0)
     45 #define NFC_HAL_TASK_EVT_INITIALIZE             EVENT_MASK (APPL_EVT_5)
     46 #define NFC_HAL_TASK_EVT_TERMINATE              EVENT_MASK (APPL_EVT_6)
     47 #define NFC_HAL_TASK_EVT_POWER_CYCLE            EVENT_MASK (APPL_EVT_7)
     48 
     49 #define NFC_HAL_TASK_EVT_MBOX                   (TASK_MBOX_0_EVT_MASK)
     50 
     51 /* NFC HAL Task mailbox definitions */
     52 #define NFC_HAL_TASK_MBOX                       (TASK_MBOX_0)
     53 
     54 /* NFC HAL Task Timer events */
     55 #ifndef NFC_HAL_QUICK_TIMER_EVT_MASK
     56 #define NFC_HAL_QUICK_TIMER_EVT_MASK            (TIMER_0_EVT_MASK)
     57 #endif
     58 
     59 #ifndef NFC_HAL_QUICK_TIMER_ID
     60 #define NFC_HAL_QUICK_TIMER_ID                  (TIMER_0)
     61 #endif
     62 
     63 /* NFC HAL Task Timer types */
     64 #define NFC_HAL_TTYPE_NCI_WAIT_RSP              0
     65 #define NFC_HAL_TTYPE_POWER_CYCLE               1
     66 #define NFC_HAL_TTYPE_NFCC_ENABLE               2
     67 
     68 /* NFC HAL Task Wait Response flag */
     69 #define NFC_HAL_WAIT_RSP_CMD                    0x10    /* wait response on an NCI command                  */
     70 #define NFC_HAL_WAIT_RSP_VSC                    0x20    /* wait response on an NCI vendor specific command  */
     71 #define NFC_HAL_WAIT_RSP_PROP                   0x40    /* wait response on a proprietary command           */
     72 #define NFC_HAL_WAIT_RSP_NONE                   0x00    /* not waiting for anything                         */
     73 
     74 typedef UINT8 tNFC_HAL_WAIT_RSP;
     75 
     76 typedef UINT16 tNFC_HAL_HCI_EVT;
     77 
     78 
     79 #define NFC_HAL_HCI_DH_TARGET_HANDLE            0xF2
     80 #define NFC_HAL_HCI_UICC0_TARGET_HANDLE         0xF3
     81 #define NFC_HAL_HCI_UICC1_TARGET_HANDLE         0xF4
     82 
     83 #define NFC_HAL_HCI_SESSION_ID_LEN              0x08
     84 #define NFC_HAL_HCI_NETWK_INFO_SIZE             184
     85 #define NFC_HAL_HCI_DH_NETWK_INFO_SIZE          111
     86 #define NFC_HAL_HCI_MIN_NETWK_INFO_SIZE         12
     87 #define NFC_HAL_HCI_MIN_DH_NETWK_INFO_SIZE      11
     88 #define NFC_HAL_HCI_PIPE_INFO_SIZE              5
     89 
     90 #define NFC_HAL_HCI_ANY_SET_PARAMETER           0x01
     91 #define NFC_HAL_HCI_ANY_GET_PARAMETER           0x02
     92 #define NFC_HAL_HCI_ADM_NOTIFY_ALL_PIPE_CLEARED 0x15
     93 
     94 #define NFC_HAL_HCI_WHITELIST_INDEX             0x03
     95 
     96 #define NFC_HAL_HCI_ADMIN_PIPE                  0x01
     97 #define NFC_HAL_HCI_HOST_ID_UICC0               0x02        /* Host ID for UICC 0 */
     98 #define NFC_HAL_HCI_HOST_ID_UICC1               0x03        /* Host ID for UICC 1 */
     99 #define NFC_HAL_HCI_COMMAND_TYPE                0x00
    100 #define NFC_HAL_HCI_RESPONSE_TYPE               0x02
    101 
    102 /* NFC HAL HCI responses */
    103 #define NFC_HAL_HCI_ANY_OK                      0x00
    104 
    105 /* Flag defintions for tNFC_HAL_NVM */
    106 #define NFC_HAL_NVM_FLAGS_NO_NVM                0x01    /* No NVM available                     */
    107 #define NFC_HAL_NVM_FLAGS_LPM_BAD               0x02    /* FPM patch in NVM failed CRC check    */
    108 #define NFC_HAL_NVM_FLAGS_FPM_BAD               0x04    /* LPM patch in NVM failed CRC check    */
    109 #define NFC_HAL_NVM_FLAGS_PATCH_PRESENT         0x08    /* Patch is present in NVM              */
    110 
    111 /* NFC HAL transport configuration */
    112 typedef struct
    113 {
    114     BOOLEAN         shared_transport;           /* TRUE if using shared HCI/NCI transport */
    115     UINT8           userial_baud;
    116     UINT8           userial_fc;
    117 } tNFC_HAL_TRANS_CFG;
    118 
    119 #ifdef TESTER
    120 #define NFC_HAL_TRANS_CFG_QUALIFIER               /* For Insight, ncit_cfg is runtime-configurable */
    121 #else
    122 #define NFC_HAL_TRANS_CFG_QUALIFIER   const       /* For all other platforms, ncit_cfg is constant */
    123 #endif
    124 extern NFC_HAL_TRANS_CFG_QUALIFIER tNFC_HAL_TRANS_CFG nfc_hal_trans_cfg;
    125 
    126 /*****************************************************************************
    127 * BT HCI definitions
    128 *****************************************************************************/
    129 #define BT_HDR      NFC_HDR
    130 
    131 /* Tranport message type */
    132 #define HCIT_TYPE_COMMAND   0x01
    133 #define HCIT_TYPE_EVENT     0x04
    134 #define HCIT_TYPE_NFC       0x10
    135 
    136 /* Vendor-Specific BT HCI definitions */
    137 #define HCI_SUCCESS                         0x00
    138 #define HCI_GRP_VENDOR_SPECIFIC             (0x3F << 10)            /* 0xFC00 */
    139 #define HCI_BRCM_WRITE_SLEEP_MODE           (0x0027 | HCI_GRP_VENDOR_SPECIFIC)
    140 #define HCI_GRP_HOST_CONT_BASEBAND_CMDS     (0x03 << 10)            /* 0x0C00 */
    141 #define HCI_RESET                           (0x0003 | HCI_GRP_HOST_CONT_BASEBAND_CMDS)
    142 #define HCI_COMMAND_COMPLETE_EVT            0x0E
    143 #define HCI_BRCM_WRITE_SLEEP_MODE_LENGTH    12
    144 #define HCI_BRCM_UPDATE_BAUD_RATE_UNENCODED_LENGTH      0x06
    145 #define HCIE_PREAMBLE_SIZE                  2
    146 
    147 /****************************************************************************
    148 ** Internal constants and definitions
    149 ****************************************************************************/
    150 
    151 /* NFC HAL receiving states */
    152 enum
    153 {
    154     NFC_HAL_RCV_IDLE_ST,            /* waiting for packet type byte             */
    155     NFC_HAL_RCV_NCI_MSG_ST,         /* waiting for the first byte of NCI header */
    156     NFC_HAL_RCV_NCI_HDR_ST,         /* reading NCI header                       */
    157     NFC_HAL_RCV_NCI_PAYLOAD_ST,     /* reading NCI payload                      */
    158     NFC_HAL_RCV_BT_MSG_ST,          /* waiting for the first byte of BT header  */
    159     NFC_HAL_RCV_BT_HDR_ST,          /* reading BT HCI header                    */
    160     NFC_HAL_RCV_BT_PAYLOAD_ST       /* reading BT HCI payload                   */
    161 };
    162 
    163 /* errors during NCI packet reassembly process */
    164 #define NFC_HAL_NCI_RAS_TOO_BIG             0x01
    165 #define NFC_HAL_NCI_RAS_ERROR               0x02
    166 typedef UINT8 tNFC_HAL_NCI_RAS;
    167 
    168 /* NFC HAL power mode */
    169 enum
    170 {
    171     NFC_HAL_POWER_MODE_FULL,            /* NFCC is full power mode      */
    172     NFC_HAL_POWER_MODE_LAST
    173 };
    174 typedef UINT8 tNFC_HAL_POWER_MODE;
    175 
    176 
    177 /* NFC HAL event for low power mode */
    178 enum
    179 {
    180     NFC_HAL_LP_TX_DATA_EVT,                 /* DH is sending data to NFCC   */
    181     NFC_HAL_LP_RX_DATA_EVT,                 /* DH received data from NFCC   */
    182     NFC_HAL_LP_TIMEOUT_EVT,                 /* Timeout                      */
    183     NFC_HAL_LP_LAST_EVT
    184 };
    185 typedef UINT8 tNFC_HAL_LP_EVT;
    186 
    187 #define NFC_HAL_ASSERT_NFC_WAKE      0x00   /* assert NFC_WAKE      */
    188 #define NFC_HAL_DEASSERT_NFC_WAKE    0x01   /* deassert NFC_WAKE    */
    189 
    190 #define NFC_HAL_BT_HCI_CMD_HDR_SIZE     3   /* opcode (2) +  length (1)    */
    191 #define NFC_HAL_CMD_TOUT            (2000)  /* timeout for NCI CMD (in ms) */
    192 
    193 #define NFC_HAL_SAVED_HDR_SIZE          (2)
    194 #define NFC_HAL_SAVED_CMD_SIZE          (2)
    195 
    196 #ifndef NFC_HAL_DEBUG
    197 #define NFC_HAL_DEBUG  TRUE
    198 #endif
    199 
    200 #if (NFC_HAL_DEBUG == TRUE)
    201 extern const char * const nfc_hal_init_state_str[];
    202 #define NFC_HAL_SET_INIT_STATE(state)  HAL_TRACE_DEBUG3 ("init state: %d->%d(%s)", nfc_hal_cb.dev_cb.initializing_state, state, nfc_hal_init_state_str[state]); nfc_hal_cb.dev_cb.initializing_state = state;
    203 #else
    204 #define NFC_HAL_SET_INIT_STATE(state)  nfc_hal_cb.dev_cb.initializing_state = state;
    205 #endif
    206 
    207 
    208 /* NFC HAL - NFCC initializing state */
    209 enum
    210 {
    211     NFC_HAL_INIT_STATE_IDLE,               /* Initialization is done                */
    212     NFC_HAL_INIT_STATE_W4_XTAL_SET,        /* Waiting for crystal setting rsp       */
    213     NFC_HAL_INIT_STATE_POST_XTAL_SET,      /* Waiting for reset ntf after xtal set  */
    214     NFC_HAL_INIT_STATE_W4_NFCC_ENABLE,     /* Waiting for reset ntf atter REG_PU up */
    215     NFC_HAL_INIT_STATE_W4_BUILD_INFO,      /* Waiting for build info rsp            */
    216     NFC_HAL_INIT_STATE_W4_PATCH_INFO,      /* Waiting for patch info rsp            */
    217     NFC_HAL_INIT_STATE_W4_APP_COMPLETE,    /* Waiting for complete from application */
    218     NFC_HAL_INIT_STATE_W4_POST_INIT_DONE,  /* Waiting for complete of post init     */
    219     NFC_HAL_INIT_STATE_W4_CONTROL_DONE,    /* Waiting for control release           */
    220     NFC_HAL_INIT_STATE_W4_PREDISCOVER_DONE,/* Waiting for complete of prediscover   */
    221     NFC_HAL_INIT_STATE_CLOSING             /* Shutting down                         */
    222 };
    223 typedef UINT8 tNFC_HAL_INIT_STATE;
    224 
    225 /* NFC HAL - NFCC config items during post initialization */
    226 enum
    227 {
    228     NFC_HAL_DM_CONFIG_LPTD,
    229     NFC_HAL_DM_CONFIG_PLL_325,
    230     NFC_HAL_DM_CONFIG_START_UP,
    231     NFC_HAL_DM_CONFIG_I93_DATA_RATE,
    232     NFC_HAL_DM_CONFIG_FW_FSM,
    233     NFC_HAL_DM_CONFIG_START_UP_VSC,
    234     NFC_HAL_DM_CONFIG_NONE
    235 };
    236 typedef UINT8 tNFC_HAL_DM_CONFIG;
    237 
    238 /* callback function prototype */
    239 typedef struct
    240 {
    241     UINT16  opcode;
    242     UINT16  param_len;
    243     UINT8   *p_param_buf;
    244 } tNFC_HAL_BTVSC_CPLT;
    245 
    246 typedef void (tNFC_HAL_BTVSC_CPLT_CBACK) (tNFC_HAL_BTVSC_CPLT *p1);
    247 
    248 
    249 /* data type for NFC_HAL_HCI_RSP_NV_READ_EVT */
    250 typedef struct
    251 {
    252     NFC_HDR           hdr;
    253     UINT8             block;
    254     UINT16            size;
    255     tHAL_NFC_STATUS   status;
    256 } tNFC_HAL_HCI_RSP_NV_READ_EVT;
    257 
    258 /* data type for NFC_HAL_HCI_RSP_NV_WRITE_EVT */
    259 typedef struct
    260 {
    261     NFC_HDR           hdr;
    262     tHAL_NFC_STATUS   status;
    263 } tNFC_HAL_HCI_RSP_NV_WRITE_EVT;
    264 
    265 
    266 /* union of all event data types */
    267 typedef union
    268 {
    269     NFC_HDR                         hdr;
    270     /* Internal events */
    271     tNFC_HAL_HCI_RSP_NV_READ_EVT    nv_read;
    272     tNFC_HAL_HCI_RSP_NV_WRITE_EVT   nv_write;
    273 } tNFC_HAL_HCI_EVENT_DATA;
    274 
    275 /*****************************************************************************
    276 ** Control block for NFC HAL
    277 *****************************************************************************/
    278 
    279 /* Patch RAM Download Control block */
    280 
    281 /* PRM states */
    282 enum
    283 {
    284     NFC_HAL_PRM_ST_IDLE,
    285 
    286     /* Secure patch download stated */
    287     NFC_HAL_PRM_ST_SPD_COMPARE_VERSION,
    288     NFC_HAL_PRM_ST_SPD_GET_PATCH_HEADER,
    289     NFC_HAL_PRM_ST_SPD_DOWNLOADING,
    290     NFC_HAL_PRM_ST_SPD_AUTHENTICATING,
    291     NFC_HAL_PRM_ST_SPD_AUTH_DONE,
    292     NFC_HAL_PRM_ST_W4_GET_VERSION
    293 };
    294 typedef UINT8 tNFC_HAL_PRM_STATE;
    295 
    296 /* Maximum number of patches (currently 2: LPM and FPM) */
    297 #define NFC_HAL_PRM_MAX_PATCH_COUNT    2
    298 #define NFC_HAL_PRM_PATCH_MASK_ALL     0xFFFFFFFF
    299 
    300 /* Structures for PRM Control Block */
    301 typedef struct
    302 {
    303     UINT8               power_mode;
    304     UINT16              len;
    305 } tNFC_HAL_PRM_PATCHDESC;
    306 
    307 typedef struct
    308 {
    309     tNFC_HAL_PRM_STATE  state;                  /* download state */
    310     UINT32              flags;                  /* internal flags */
    311     UINT16              cur_patch_len_remaining;/* bytes remaining in patchfile to process     */
    312     const UINT8*        p_cur_patch_data;       /* pointer to patch currently being downloaded */
    313     UINT16              cur_patch_offset;       /* offset of next byte to process              */
    314     UINT32              dest_ram;
    315     TIMER_LIST_ENT      timer;                  /* Timer for patch download                    */
    316 
    317     /* Secure Patch Download */
    318     UINT32              spd_patch_needed_mask;  /* Mask of patches that need to be downloaded */
    319     UINT8               spd_patch_count;        /* Number of patches left to download */
    320     UINT8               spd_cur_patch_idx;      /* Current patch being downloaded */
    321 
    322     tNFC_HAL_PRM_PATCHDESC spd_patch_desc[NFC_HAL_PRM_MAX_PATCH_COUNT];
    323 
    324     /* I2C-patch */
    325     UINT8               *p_spd_patch;           /* pointer to spd patch             */
    326     UINT16              spd_patch_len_remaining;/* patch length                     */
    327     UINT16              spd_patch_offset;       /* offset of next byte to process   */
    328 
    329     tNFC_HAL_PRM_FORMAT format;                 /* format of patch ram              */
    330     tNFC_HAL_PRM_CBACK  *p_cback;               /* Callback for download status notifications */
    331     UINT32              patchram_delay;         /* the dealy after patch */
    332 } tNFC_HAL_PRM_CB;
    333 
    334 /* Information about current patch in NVM */
    335 typedef struct
    336 {
    337     UINT16              project_id;             /* Current project_id of patch in nvm       */
    338     UINT16              ver_major;              /* Current major version of patch in nvm    */
    339     UINT16              ver_minor;              /* Current minor version of patch in nvm    */
    340     UINT16              fpm_size;               /* Current size of FPM patch in nvm         */
    341     UINT16              lpm_size;               /* Current size of LPM patch in nvm         */
    342     UINT8               flags;                  /* See NFC_HAL_NVM_FLAGS_* flag definitions */
    343     UINT8               nvm_type;               /* Current NVM Type - UICC/EEPROM           */
    344 } tNFC_HAL_NVM;
    345 
    346 /* Patch for I2C fix */
    347 typedef struct
    348 {
    349     UINT8               *p_patch;               /* patch for i2c fix                */
    350     UINT32              prei2c_delay;           /* the dealy after preI2C patch */
    351     UINT16              len;                    /* i2c patch length                 */
    352 } tNFC_HAL_PRM_I2C_FIX_CB;
    353 
    354 /* Control block for NCI transport */
    355 typedef struct
    356 {
    357     UINT8               nci_ctrl_size;      /* Max size for NCI messages                              */
    358     UINT8               rcv_state;          /* current rx state                                       */
    359     UINT16              rcv_len;            /* bytes remaining to be received in current rx state     */
    360     NFC_HDR             *p_rcv_msg;         /* buffer to receive NCI message                          */
    361     NFC_HDR             *p_frag_msg;        /* fragmented NCI message; waiting for last fragment      */
    362     NFC_HDR             *p_pend_cmd;        /* pending NCI message; waiting for NFCC state to be free */
    363     tNFC_HAL_NCI_RAS    nci_ras;            /* nci reassembly error status                            */
    364     TIMER_LIST_ENT      nci_wait_rsp_timer; /* Timer for waiting for nci command response             */
    365     tNFC_HAL_WAIT_RSP   nci_wait_rsp;       /* nci wait response flag                                 */
    366     UINT8               last_hdr[NFC_HAL_SAVED_HDR_SIZE];/* part of last NCI command header           */
    367     UINT8               last_cmd[NFC_HAL_SAVED_CMD_SIZE];/* part of last NCI command payload          */
    368     void                *p_vsc_cback;       /* the callback function for last VSC command             */
    369 } tNFC_HAL_NCIT_CB;
    370 
    371 /* Control block for device initialization */
    372 typedef struct
    373 {
    374     tNFC_HAL_INIT_STATE     initializing_state;     /* state of initializing NFCC               */
    375 
    376     UINT32                  brcm_hw_id;             /* BRCM NFCC HW ID                          */
    377     tNFC_HAL_DM_CONFIG      next_dm_config;         /* next config in post initialization       */
    378     UINT8                   next_startup_vsc;       /* next start-up VSC offset in post init    */
    379 
    380     tNFC_HAL_POWER_MODE     power_mode;             /* NFCC power mode                          */
    381     UINT8                   snooze_mode;            /* current snooze mode                      */
    382     UINT8                   new_snooze_mode;        /* next snooze mode after receiving cmpl    */
    383     UINT8                   nfc_wake_active_mode;   /* NFC_HAL_LP_ACTIVE_LOW/HIGH               */
    384     TIMER_LIST_ENT          lp_timer;               /* timer for low power mode                 */
    385 
    386 
    387     tHAL_NFC_STATUS_CBACK   *p_prop_cback;          /* callback to notify complete of proprietary update */
    388 } tNFC_HAL_DEV_CB;
    389 
    390 /* data members for NFC_HAL-HCI */
    391 typedef struct
    392 {
    393     TIMER_LIST_ENT          hci_timer;                /* Timer to avoid indefinitely waiting for response */
    394     UINT8                   *p_hci_netwk_info_buf;    /* Buffer for reading HCI Network information */
    395     UINT8                   *p_hci_netwk_dh_info_buf; /* Buffer for reading HCI Network DH information */
    396     UINT8                   hci_netwk_config_block;   /* Rsp awaiting for hci network configuration block */
    397     BOOLEAN                 b_wait_hcp_conn_create_rsp; /* Waiting for hcp connection create response */
    398     BOOLEAN                 clear_all_pipes_to_uicc1; /* UICC1 was restarted for patch download */
    399     BOOLEAN                 hci_fw_workaround;        /* HAL HCI Workaround need */
    400     BOOLEAN                 hci_fw_validate_netwk_cmd;/* Flag to indicate if hci network ntf to validate */
    401     UINT8                   hcp_conn_id;              /* NCI Connection id for HCP */
    402 } tNFC_HAL_HCI_CB;
    403 
    404 typedef struct
    405 {
    406     tHAL_NFC_CBACK          *p_stack_cback;     /* Callback for HAL event notification  */
    407     tHAL_NFC_DATA_CBACK     *p_data_cback;      /* Callback for data event notification  */
    408 
    409     TIMER_LIST_Q            quick_timer_queue;  /* timer list queue                 */
    410     TIMER_LIST_ENT          timer;              /* timer for NCI transport task     */
    411 
    412     tNFC_HAL_NCIT_CB        ncit_cb;            /* NCI transport */
    413     tNFC_HAL_DEV_CB         dev_cb;             /* device initialization */
    414     tNFC_HAL_NVM            nvm_cb;             /* Information about current patch in NVM */
    415 
    416     /* Patchram control block */
    417     tNFC_HAL_PRM_CB         prm;
    418     tNFC_HAL_PRM_I2C_FIX_CB prm_i2c;
    419 
    420     /* data members for NFC_HAL-HCI */
    421     tNFC_HAL_HCI_CB         hci_cb;
    422 
    423     UINT8                   pre_discover_done;  /* TRUE, when the prediscover config is complete */
    424 
    425     UINT8                   max_rf_credits;     /* NFC Max RF data credits */
    426     UINT8                   trace_level;        /* NFC HAL trace level */
    427 } tNFC_HAL_CB;
    428 
    429 /* Global NCI data */
    430 #if NFC_DYNAMIC_MEMORY == FALSE
    431 extern tNFC_HAL_CB   nfc_hal_cb;
    432 #else
    433 #define nfc_hal_cb (*nfc_hal_cb_ptr)
    434 extern tNFC_HAL_CB *nfc_hal_cb_ptr;
    435 #endif
    436 extern UINT8 *p_nfc_hal_pre_discover_cfg;
    437 /****************************************************************************
    438 ** Internal nfc functions
    439 ****************************************************************************/
    440 
    441 /* From nfc_hal_main.c */
    442 UINT32 nfc_hal_main_task (UINT32 param);
    443 void   nfc_hal_main_init (void);
    444 void   nfc_hal_main_pre_init_done (tHAL_NFC_STATUS);
    445 void   nfc_hal_main_start_quick_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
    446 void   nfc_hal_main_stop_quick_timer (TIMER_LIST_ENT *p_tle);
    447 void   nfc_hal_main_send_error (tHAL_NFC_STATUS status);
    448 void   nfc_hal_send_nci_msg_to_nfc_task (NFC_HDR * p_msg);
    449 
    450 /* nfc_hal_nci.c */
    451 BOOLEAN nfc_hal_nci_receive_msg (UINT8 byte);
    452 BOOLEAN nfc_hal_nci_preproc_rx_nci_msg (NFC_HDR *p_msg);
    453 NFC_HDR* nfc_hal_nci_postproc_rx_nci_msg (void);
    454 void    nfc_hal_nci_assemble_nci_msg (void);
    455 void    nfc_hal_nci_add_nfc_pkt_type (NFC_HDR *p_msg);
    456 void    nfc_hal_nci_send_cmd (NFC_HDR *p_buf);
    457 void    nfc_hal_nci_cmd_timeout_cback (void *p_tle);
    458 
    459 /* nfc_hal_dm.c */
    460 void nfc_hal_dm_init (void);
    461 void nfc_hal_dm_set_xtal_freq_index (void);
    462 void nfc_hal_dm_send_get_build_info_cmd (void);
    463 void nfc_hal_dm_proc_msg_during_init (NFC_HDR *p_msg);
    464 void nfc_hal_dm_config_nfcc (void);
    465 void nfc_hal_dm_send_nci_cmd (const UINT8 *p_data, UINT16 len, tNFC_HAL_NCI_CBACK *p_cback);
    466 void nfc_hal_dm_send_bt_cmd (const UINT8 *p_data, UINT16 len, tNFC_HAL_BTVSC_CPLT_CBACK *p_cback);
    467 void nfc_hal_dm_set_nfc_wake (UINT8 cmd);
    468 void nfc_hal_dm_pre_init_nfcc (void);
    469 void nfc_hal_dm_shutting_down_nfcc (void);
    470 BOOLEAN nfc_hal_dm_power_mode_execute (tNFC_HAL_LP_EVT event);
    471 void nfc_hal_dm_send_pend_cmd (void);
    472 tHAL_NFC_STATUS nfc_hal_dm_set_config (UINT8 tlv_size, UINT8 *p_param_tlvs, tNFC_HAL_NCI_CBACK *p_cback);
    473 
    474 /* nfc_hal_prm.c */
    475 void nfc_hal_prm_spd_reset_ntf (UINT8 reset_reason, UINT8 reset_type);
    476 void nfc_hal_prm_nci_command_complete_cback (tNFC_HAL_NCI_EVT event, UINT16 data_len, UINT8 *p_data);
    477 void nfc_hal_prm_process_timeout (void *p_tle);
    478 
    479 /* nfc_hal_hci.c */
    480 void nfc_hal_hci_enable (void);
    481 void nfc_hal_hci_evt_hdlr (tNFC_HAL_HCI_EVENT_DATA *p_evt_data);
    482 void nfc_hal_hci_handle_hci_netwk_info (UINT8 *p_data);
    483 void nfc_hal_hci_handle_hcp_pkt_from_hc (UINT8 *p_data);
    484 NFC_HDR* nfc_hal_hci_postproc_hcp (void);
    485 BOOLEAN nfc_hal_hci_handle_hcp_pkt_to_hc (UINT8 *p_data);
    486 void nfc_hal_hci_timeout_cback (void *p_tle);
    487 
    488 
    489 /* Define default NCI protocol trace function (if protocol tracing is enabled) */
    490 #if (defined(NFC_HAL_TRACE_PROTOCOL) && (NFC_HAL_TRACE_PROTOCOL == TRUE))
    491 #if !defined (DISP_NCI)
    492 #define DISP_NCI    (DispNci)
    493 void DispNci (UINT8 *p, UINT16 len, BOOLEAN is_recv);
    494 #endif  /* DISP_NCI */
    495 
    496 /* For displaying vendor-specific HCI commands */
    497 void DispHciCmd (BT_HDR *p_buf);
    498 void DispHciEvt (BT_HDR *p_buf);
    499 #endif /* NFC_HAL_TRACE_PROTOCOL */
    500 
    501 #ifdef __cplusplus
    502 }
    503 #endif
    504 
    505 #endif /* NFC_HAL_INT_H */
    506