nfc_hal_dm_cfg.c revision 5c65c3a0f42e174e47fecd4e569606003217ff4e
1/******************************************************************************
2 *
3 *  Copyright (C) 2011-2013 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 *  This file contains compile-time configurable constants for BRCM HAL
23 *  modules
24 *
25 ******************************************************************************/
26#include "nfc_hal_int.h"
27#include "nci_defs.h"
28#include "nfc_brcm_defs.h"
29
30/* the SetConfig at start up*/
31UINT8 nfc_hal_start_up_cfg[] = {
32    /* TLV len */   31,
33    /* B0 */        NCI_PARAM_ID_EMVCO_ENABLE,
34    /* B1 */        1,
35    /* B2 */        1,     /* (1 = enable emvco mode, 0 = disable emvco mode) Default = 0.*/
36    /* B3 */        NCI_PARAM_ID_CONTINUE_MODE, /* NFCC will restart discovery after deactivated */
37    /* B4 */        1,
38    /* B5 */        1,     /* (1 = enable, 0 = disable) Default = 0.*/
39    /* B6 */        NCI_PARAM_ID_RFU_CONFIG,
40    /* B7 */        0x14,
41    /* B8 */        0x00,
42    /* B9 */        0x00,
43    /* B10*/        0x00,
44    /* B11*/        0x00,
45    /* B12*/        0x0E,
46    /* B13*/        0xE8,
47    /* B14*/        0xF0,
48    /* B15*/        0x55,
49    /* B16*/        0x00,
50    /* B17*/        0x0F, /* CE3 SO delay in sec */
51    /* B18*/        0x00,
52    /* B19*/        0x00,
53    /* B20*/        0x00,
54    /* B21*/        0x00,
55    /* B22*/        0x00,
56    /* B23*/        0x00,
57    /* B24*/        0x00,
58    /* B25*/        0x00,
59    /* B26*/        0x00,
60    /* B27*/        0x00,
61    /* B28*/        NCI_PARAM_ID_ACT_ORDER, /* polling sequence */
62    /* B29*/        1,
63    /* B30*/        1,     /* (1 = active mode polling before passive, 0 = passive polling first) Default = 0.*/
64};
65
66UINT8 *p_nfc_hal_dm_start_up_cfg = (UINT8 *) nfc_hal_start_up_cfg;
67
68/* the VSCs at start up:
69 * The VSCs are specified in TLV format similar to nfa_start_up_cfg[]
70 * first byte is the TLV total len.
71 * B0 is the first T; i.e. the opcode for the VSC
72 * B1 is the len of the VSC parameters/payload
73 * */
74UINT8 nfc_hal_dm_start_up_vsc_cfg[] = {
75    /* TLV len */   5,
76    /* B0 */        NCI_MTS_CMD|NCI_GID_PROP,
77    /* B1 */        NCI_MSG_FRAME_LOG,
78    /* B2 */        2,
79    /* B3 */        0,  /* 1 to enable RF frames */
80    /* B4 */        1   /* 1 to enable SWP frames */
81};
82
83UINT8 *p_nfc_hal_dm_start_up_vsc_cfg = NULL;
84
85/* LPTD parameters (LowPowerTagDetection)
86 * This is typical values for 20791B2
87 * The timing and threshold parameters used for a customer handset/hardware may vary
88 * depending on antenna and should be verified during a customer testing phase.
89 * the data fields without comments are too complicated. Please see ""
90 * */
91const UINT8 nfc_hal_dm_lptd_cfg[] =
92{
93    21,             /* total TLV length excluding itself */
94    NCI_PARAM_ID_TAGSNIFF_CFG,  /* type */
95    19,             /* length */
96    0x01,           /* B0 enable: 0/disable, 1/enable*/
97    0x02,           /* B1 poll count: number of full power poll before starting lptd poll */
98    0xFF,           /* B2 sniff count lsb: number of lptd poll before switching to full power poll */
99    0xFF,           /* B3 sniff count msb */
100    0x80,           /* B4 threshold: Bigger thresholds give a smaller LPTD range but more immunity to false detections. Smaller thresholds increase LPTD range at the cost of greater likelihood of false detections. */
101    0x40,           /* B5 delay lsb: delay (us) to sampling power */
102    0x00,           /* B6 delay msb */
103    0x40,           /* B7 carrier threshold lsb */
104    0x00,           /* B8 carrier threshold msb */
105    0x80,           /* B9 mode: Bitwise variable used to enable various algorithm modes.*/
106    0x80,           /* B10 0-offset lsb */
107    0x00,           /* B11 0-offset msb */
108    0x10,           /* B12 field sense time lsb */
109    0x00,           /* B13 field sense time msb */
110    0x00,           /* B14 false detect threshold lsb: 0x00 to disable LPTD NTF. The number of false tag detections to resport LPTD NTF. */
111    0x00,           /* B15 false detect threshold msb. A false tag detect - full poll results in no tag being detected.*/
112    0x75,           /* B16 mode1; Bitwise variable used to enable various algorithm modes. */
113    0x0D,           /* B17 lptd ant cfg rx */
114    0x30,           /* B18 lptd rdr cfg ve */
115};
116
117UINT8 *p_nfc_hal_dm_lptd_cfg = (UINT8 *) &nfc_hal_dm_lptd_cfg[0];
118
119/*
120** NFCC has a table which has 9 XTAL frequencies: 9.6, 13, 16.2,  19.2, 24, 26, 38.4, 52 and 37.4 in MHz.
121** For these 9 xtal frequencies, host doesn't need to configure PLL325.
122** For 43341, host doesn't need to configure it at all.
123*/
124UINT8 *p_nfc_hal_dm_pll_325_cfg = NULL;
125
126tNFC_HAL_CFG nfc_hal_cfg =
127{
128    FALSE,                                  /* set nfc_hal_prm_nvm_required to TRUE, if the platform wants to abort PRM process without NVM */
129    (UINT16) NFC_HAL_NFCC_ENABLE_TIMEOUT,   /* max time to wait for RESET NTF after setting REG_PU to high
130                                            ** If NFCC doesn't have NVM or cannot load patch from NVM without Xtal setting
131                                            ** then set it to short to optimize bootup time because NFCC cannot send RESET NTF.
132                                            ** Otherwise, it depends on NVM type and size of patchram.
133                                            */
134    (UINT16) NFC_HAL_NFCC_ENABLE_TIMEOUT,   /* max time to wait for RESET NTF after setting Xtal frequency
135                                            ** It depends on NVM type and size of patchram.
136                                            */
137    (HAL_NFC_HCI_UICC0_HOST | HAL_NFC_HCI_UICC1_HOST)  /* Set bit(s) for supported UICC(s) */
138};
139
140tNFC_HAL_CFG *p_nfc_hal_cfg= (tNFC_HAL_CFG *) &nfc_hal_cfg;
141