1/******************************************************************************
2 *
3 *  Copyright (C) 2009-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 *  Post NCI reset routines
22 *
23 ******************************************************************************/
24#ifndef NFC_HAL_POST_RESET_H
25#define NFC_HAL_POST_RESET_H
26
27/*****************************************************************************
28** Application control block definitions
29******************************************************************************/
30#define NFA_APP_PATCHFILE_MAX_PATH 255
31#define NFA_APP_MAX_NUM_REINIT 5
32
33typedef struct {
34  uint8_t prm_file[NFA_APP_PATCHFILE_MAX_PATH + 1]; /* Filename of patchram */
35  uint8_t* p_prm_buf; /* Pointer to buffer for holding patchram data */
36
37  /* Patchfile for I2C fix */
38  uint8_t prm_i2c_patchfile[NFA_APP_PATCHFILE_MAX_PATH + 1];
39  uint8_t* p_prm_i2c_buf;
40
41  uint8_t userial_baud;
42
43  tNFC_HAL_DEV_INIT_CFG dev_init_config;
44
45  /* snooze mode setting */
46  uint8_t snooze_mode;
47  uint8_t idle_threshold_dh;
48  uint8_t idle_threshold_nfcc;
49  uint8_t nfc_wake_active_mode;
50  uint8_t dh_wake_active_mode;
51
52  /* NVM detection retry (some platforms require re-attempts to detect NVM) */
53  uint8_t spd_nvm_detection_max_count; /* max retry to get NVM type */
54  uint8_t spd_nvm_detection_cur_count; /* current retry count       */
55
56  /* handling for failure to download patch */
57  bool spd_debug_mode; /* debug mode for downloading patchram, report failure
58                          immediately and obviously */
59  bool spd_skip_on_power_cycle; /* skip downloading patchram after power cycle
60                                   because of patch download failure */
61} tNFC_POST_RESET_CB;
62extern tNFC_POST_RESET_CB nfc_post_reset_cb;
63
64/*
65** Post NCI reset handler
66**
67** This function is called to start device pre-initialization after
68** NCI CORE-RESET. When pre-initialization is completed,
69** HAL_NfcPreInitDone() must be called to proceed with stack start up.
70*/
71void nfc_hal_post_reset_init(uint32_t brcm_hw_id, uint8_t nvm_type);
72
73#endif /* NFC_HAL_POST_RESET_H */
74