• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019-2021 NXP
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <phNxpNciHal_ext.h>
20 
21 #include "phNfcStatus.h"
22 
23 #define AUTONOMOUS_SCREEN_OFF_LOCK_MASK 0x20
24 #define SWITCH_OFF_MASK 0x02
25 #define NCI_GET_CONFI_MIN_LEN 0x04
26 #define NXP_MAX_RETRY_COUNT 0x03
27 typedef struct {
28   uint8_t autonomous_mode;
29   uint8_t guard_timer_value;
30 } nxp_nfc_config_ext_t;
31 extern nxp_nfc_config_ext_t config_ext;
32 
33 /******************************************************************************
34  * Function         phNxpNciHal_updateAutonomousPwrState
35  *
36  * Description      This function can be used to update autonomous pwr state.
37  *                  num: value to check  switch off bit is set or not.
38  *
39  * Returns          uint8_t
40  *
41  ******************************************************************************/
42 uint8_t phNxpNciHal_updateAutonomousPwrState(uint8_t num);
43 /******************************************************************************
44  * Function         phNxpNciHal_setAutonomousMode
45  *
46  * Description      This function can be used to set NFCC in autonomous mode
47  *
48  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS
49  *
50  ******************************************************************************/
51 NFCSTATUS phNxpNciHal_setAutonomousMode();
52 
53 /******************************************************************************
54  * Function         phNxpNciHal_setGuardTimer
55  *
56  * Description      This function can be used to set Guard timer
57  *
58  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS
59  *
60  ******************************************************************************/
61 NFCSTATUS phNxpNciHal_setGuardTimer();
62 
63 /*****************************************************************************
64  * Function         phNxpNciHal_send_get_cfg
65  *
66  * Description      This function is called to get the configurations from
67  * EEPROM
68  *
69  * Params           cmd_get_cfg, Buffer to GET command
70  *                  cmd_len,     Length of the command
71  * Returns          SUCCESS/FAILURE
72  *
73  *
74  *****************************************************************************/
75 NFCSTATUS phNxpNciHal_send_get_cfg(const uint8_t* cmd_get_cfg, long cmd_len);
76 
77 /*****************************************************************************
78  * Function         phNxpNciHal_configure_merge_sak
79  *
80  * Description      This function is called to apply iso_dep sak merge settings
81  *                  as per the config option NAME_NXP_ISO_DEP_MERGE_SAK
82  *
83  * Params           None
84 
85  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS
86  *
87  *****************************************************************************/
88 NFCSTATUS phNxpNciHal_configure_merge_sak();
89 /******************************************************************************
90  * Function         phNxpNciHal_setSrdtimeout
91  *
92  * Description      This function can be used to set srd SRD Timeout.
93  *
94  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS or
95  *                  NFCSTATUS_FEATURE_NOT_SUPPORTED
96  *
97  ******************************************************************************/
98 NFCSTATUS phNxpNciHal_setSrdtimeout();
99 /******************************************************************************
100  * Function         phNxpNciHal_set_uicc_hci_params
101  *
102  * Description      This will update value of uicc session status to store flag
103  *                  to eeprom
104  *
105  * Parameters       value - this value will be updated to eeprom flag.
106  *
107  * Returns          status of the write
108  *
109  ******************************************************************************/
110 NFCSTATUS
111 phNxpNciHal_set_uicc_hci_params(std::vector<uint8_t>& ptr, uint8_t bufflen,
112                                 phNxpNci_EEPROM_request_type_t uiccType);
113 /******************************************************************************
114  * Function         phNxpNciHal_get_uicc_hci_params
115  *
116  * Description      This will read the value of fw download status flag
117  *                  from eeprom
118  *
119  * Parameters       value - this parameter will be updated with the flag
120  *                  value from eeprom.
121  *
122  * Returns          status of the read
123  *
124  ******************************************************************************/
125 NFCSTATUS
126 phNxpNciHal_get_uicc_hci_params(std::vector<uint8_t>& ptr, uint8_t bufflen,
127                                 phNxpNci_EEPROM_request_type_t uiccType);
128 
129 /******************************************************************************
130  * Function         phNxpNciHal_setExtendedFieldMode
131  *
132  * Description      This function can be used to set nfcc extended field mode
133  *
134  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS or
135  *                  NFCSTATUS_FEATURE_NOT_SUPPORTED
136  *
137  ******************************************************************************/
138 NFCSTATUS phNxpNciHal_setExtendedFieldMode();
139