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