1 /*
2  * Copyright (C) 2019-2020 NXP Semiconductors
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 "phNfcStatus.h"
20 
21 #define AUTONOMOUS_SCREEN_OFF_LOCK_MASK 0x20
22 #define SWITCH_OFF_MASK 0x02
23 #define NCI_GET_CONFI_MIN_LEN 0x04
24 #define NXP_MAX_RETRY_COUNT 0x03
25 typedef struct {
26   uint8_t autonomous_mode;
27   uint8_t guard_timer_value;
28 } nxp_nfc_config_ext_t;
29 extern nxp_nfc_config_ext_t config_ext;
30 
31 /******************************************************************************
32  * Function         phNxpNciHal_updateAutonomousPwrState
33  *
34  * Description      This function can be used to update autonomous pwr state.
35  *                  num: value to check  switch off bit is set or not.
36  *
37  * Returns          uint8_t
38  *
39  ******************************************************************************/
40 uint8_t phNxpNciHal_updateAutonomousPwrState(uint8_t num);
41 /******************************************************************************
42  * Function         phNxpNciHal_setAutonomousMode
43  *
44  * Description      This function can be used to set NFCC in autonomous mode
45  *
46  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS
47  *
48  ******************************************************************************/
49 NFCSTATUS phNxpNciHal_setAutonomousMode();
50 
51 /******************************************************************************
52  * Function         phNxpNciHal_setGuardTimer
53  *
54  * Description      This function can be used to set Guard timer
55  *
56  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS
57  *
58  ******************************************************************************/
59 NFCSTATUS phNxpNciHal_setGuardTimer();
60 
61 /*****************************************************************************
62  * Function         phNxpNciHal_send_get_cfg
63  *
64  * Description      This function is called to get the configurations from
65  * EEPROM
66  *
67  * Params           cmd_get_cfg, Buffer to GET command
68  *                  cmd_len,     Length of the command
69  * Returns          SUCCESS/FAILURE
70  *
71  *
72  *****************************************************************************/
73 NFCSTATUS phNxpNciHal_send_get_cfg(const uint8_t* cmd_get_cfg, long cmd_len);
74 
75 /*****************************************************************************
76  * Function         phNxpNciHal_configure_merge_sak
77  *
78  * Description      This function is called to apply iso_dep sak merge settings
79  *                  as per the config option NAME_NXP_ISO_DEP_MERGE_SAK
80  *
81  * Params           None
82 
83  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS
84  *
85  *****************************************************************************/
86 NFCSTATUS phNxpNciHal_configure_merge_sak();
87 /******************************************************************************
88  * Function         phNxpNciHal_setSrdtimeout
89  *
90  * Description      This function can be used to set srd SRD Timeout.
91  *
92  * Returns          NFCSTATUS_FAILED or NFCSTATUS_SUCCESS or
93  *                  NFCSTATUS_FEATURE_NOT_SUPPORTED
94  *
95  ******************************************************************************/
96 NFCSTATUS phNxpNciHal_setSrdtimeout();
97