1 /******************************************************************************
2  *
3  *  Copyright (C) 2011-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  *  This file contains compile-time configurable constants for NFA modules
22  *
23  ******************************************************************************/
24 #include "nfa_api.h"
25 
26 /* the SetConfig for CE T3T/T4T */
27 const uint8_t nfa_dm_ce_cfg[] = {
28     13,                  /* total length */
29     NFC_PMID_LF_T3T_PMM, /* Type-3 tag default PMM */
30     NCI_PARAM_LEN_LF_T3T_PMM,
31     0x01, /* This PAD0 is used to identify HCE-F on Android */
32     0xFE, /* This PAD0 is used to identify HCE-F on Android */
33     0xFF,
34     0xFF,
35     0xFF,
36     0xFF,
37     0xFF,
38     0xFF,
39     NFC_PMID_FWI, /* FWI for ISO-DEP */
40     1,
41     CE_T4T_ISO_DEP_FWI};
42 
43 uint8_t* p_nfa_dm_ce_cfg = (uint8_t*)nfa_dm_ce_cfg;
44 
45 /* the SetConfig for optional general NFC stack functions */
46 const uint8_t nfa_dm_gen_cfg[] = {
47     3, /* total length */
48     /* Instruct NFCC to report RF field generated by remote device (or not) */
49     NFC_PMID_RF_FIELD_INFO, 1, 0x01};
50 
51 uint8_t* p_nfa_dm_gen_cfg = NULL;
52 
53 /* the RF Discovery Frequency for each technology */
54 const tNFA_DM_DISC_FREQ_CFG nfa_dm_rf_disc_freq_cfg = {
55     1, /* Frequency for NFC Technology A               */
56     1, /* Frequency for NFC Technology B               */
57     1, /* Frequency for NFC Technology F               */
58     1, /* Frequency for Proprietary Technology/15693   */
59     1, /* Frequency for Proprietary Technology/B-Prime */
60     1, /* Frequency for Proprietary Technology/Kovio   */
61     1, /* Frequency for NFC Technology A active mode   */
62     1  /* Frequency for NFC Technology F active mode   */
63 };
64 
65 tNFA_DM_DISC_FREQ_CFG* p_nfa_dm_rf_disc_freq_cfg =
66     (tNFA_DM_DISC_FREQ_CFG*)&nfa_dm_rf_disc_freq_cfg;
67 
68 uint8_t nfa_ee_max_ee_cfg = NFA_EE_MAX_EE_SUPPORTED;
69 
70 const tNCI_DISCOVER_MAPS nfa_dm_interface_mapping[NFA_DM_NUM_INTERFACE_MAP] = {
71     /* Protocols that use Frame Interface do not need to be included in the
72        interface mapping */
73     {NCI_PROTOCOL_ISO_DEP, NCI_INTERFACE_MODE_POLL_N_LISTEN,
74      NCI_INTERFACE_ISO_DEP},
75     {NCI_PROTOCOL_NFC_DEP, NCI_INTERFACE_MODE_POLL_N_LISTEN,
76      NCI_INTERFACE_NFC_DEP}};
77 /* set to NULL to use the default mapping set by stack */
78 tNCI_DISCOVER_MAPS* p_nfa_dm_interface_mapping = NULL;
79 uint8_t nfa_dm_num_dm_interface_mapping = 0;
80 
81 const tNFA_DM_CFG nfa_dm_cfg = {
82     /* Automatic NDEF detection (when not in exclusive RF mode) */
83     NFA_DM_AUTO_DETECT_NDEF,
84     /* Automatic NDEF read (when not in exclusive RF mode) */
85     NFA_DM_AUTO_READ_NDEF,
86     /* Automatic presence check */
87     NFA_DM_AUTO_PRESENCE_CHECK,
88     /* Use sleep/wake(last interface) for ISODEP presence check */
89     NFA_DM_PRESENCE_CHECK_OPTION,
90     /* Maximum time to wait for presence check response */
91     NFA_DM_MAX_PRESENCE_CHECK_TIMEOUT};
92 
93 tNFA_DM_CFG* p_nfa_dm_cfg = (tNFA_DM_CFG*)&nfa_dm_cfg;
94 
95 const uint8_t nfa_hci_whitelist[] = {0x02, 0x03, 0x04};
96 
97 const tNFA_HCI_CFG nfa_hci_cfg = {
98     /* Max HCI Network IDLE time to wait for EE DISC REQ Ntf(s) */
99     NFA_HCI_NETWK_INIT_IDLE_TIMEOUT,
100     /* Maximum HCP Response time to any HCP Command */
101     NFA_HCI_RESPONSE_TIMEOUT,
102     /* Number of host in the whitelist of Terminal host */
103     0x03,
104     /* Pointer to the Whitelist of Terminal Host */
105     (uint8_t*)nfa_hci_whitelist};
106 
107 tNFA_HCI_CFG* p_nfa_hci_cfg = (tNFA_HCI_CFG*)&nfa_hci_cfg;
108 
109 bool nfa_poll_bail_out_mode = false;
110 const tNFA_PROPRIETARY_CFG nfa_proprietary_cfg = {
111     0x80, /* NCI_PROTOCOL_18092_ACTIVE */
112     0x81, /* NCI_PROTOCOL_B_PRIME */
113     0x82, /* NCI_PROTOCOL_DUAL */
114     0x83, /* NCI_PROTOCOL_15693 */
115     0x8A, /* NCI_PROTOCOL_KOVIO */
116     0xFF, /* NCI_PROTOCOL_MIFARE */
117     0x77, /* NCI_DISCOVERY_TYPE_POLL_KOVIO */
118     0x74, /* NCI_DISCOVERY_TYPE_POLL_B_PRIME */
119     0xF4, /* NCI_DISCOVERY_TYPE_LISTEN_B_PRIME */
120 };
121 
122 tNFA_PROPRIETARY_CFG* p_nfa_proprietary_cfg =
123     (tNFA_PROPRIETARY_CFG*)&nfa_proprietary_cfg;
124