• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2011-2012 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 BRCM HAL
22  *  modules
23  *
24  ******************************************************************************/
25 #include "nfc_hal_int.h"
26 #include "nci_defs.h"
27 #include "nfc_brcm_defs.h"
28 
29 /* the SetConfig at start up*/
30 UINT8 nfc_hal_start_up_cfg[] = {
31     /* TLV len */   28,
32     /* B0 */        NCI_PARAM_ID_EMVCO_ENABLE,
33     /* B1 */        1,
34     /* B2 */        1,     /* (1 = enable emvco mode, 0 = disable emvco mode) Default = 0.*/
35     /* B3 */        NCI_PARAM_ID_CONTINUE_MODE, /* NFCC will restart discovery after deactivated */
36     /* B4 */        1,
37     /* B5 */        1,     /* (1 = enable, 0 = disable) Default = 0.*/
38     /* B6 */        NCI_PARAM_ID_RFU_CONFIG,
39     /* B7 */        0x14,
40     /* B8 */        0x00,
41     /* B9 */        0x00,
42     /* B10*/        0x00,
43     /* B11*/        0x00,
44     /* B12*/        0x02,
45     /* B13*/        0xE8,
46     /* B14*/        0x03,
47     /* B15*/        0x00,
48     /* B16*/        0x00,
49     /* B17*/        0x00,
50     /* B18*/        0x00,
51     /* B19*/        0x00,
52     /* B20*/        0x00,
53     /* B21*/        0x00,
54     /* B22*/        0x00,
55     /* B23*/        0x00,
56     /* B24*/        0x00,
57     /* B25*/        0x00,
58     /* B26*/        0x00,
59     /* B27*/        0x00
60 };
61 
62 UINT8 *p_nfc_hal_dm_start_up_cfg = (UINT8 *) nfc_hal_start_up_cfg;
63 
64 /* the VSCs at start up:
65  * The VSCs are specified in TLV format similar to nfa_start_up_cfg[]
66  * first byte is the TLV total len.
67  * B0 is the first T; i.e. the opcode for the VSC
68  * B1 is the len of the VSC parameters/payload
69  * */
70 UINT8 nfc_hal_dm_start_up_vsc_cfg[] = {
71     /* TLV len */   5,
72     /* B0 */        NCI_MTS_CMD|NCI_GID_PROP,
73     /* B1 */        NCI_MSG_FRAME_LOG,
74     /* B2 */        2,
75     /* B3 */        0,  /* 1 to enable RF frames */
76     /* B4 */        1   /* 1 to enable SWP frames */
77 };
78 
79 UINT8 *p_nfc_hal_dm_start_up_vsc_cfg = NULL;
80 
81 /* LPTD parameters (LowPowerTagDetection)
82  * This is typical values for 20791B2
83  * The timing and threshold parameters used for a customer handset/hardware may vary
84  * depending on antenna and should be verified during a customer testing phase.
85  * the data fields without comments are too complicated. Please see ""
86  * */
87 const UINT8 nfc_hal_dm_lptd_cfg[] =
88 {
89     21,             /* total TLV length excluding itself */
90     NCI_PARAM_ID_TAGSNIFF_CFG,  /* type */
91     19,             /* length */
92     0x01,           /* B0 enable: 0/disable, 1/enable*/
93     0x02,           /* B1 poll count: number of full power poll before starting lptd poll */
94     0xFF,           /* B2 sniff count lsb: number of lptd poll before switching to full power poll */
95     0xFF,           /* B3 sniff count msb */
96     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. */
97     0x40,           /* B5 delay lsb: delay (us) to sampling power */
98     0x00,           /* B6 delay msb */
99     0x40,           /* B7 carrier threshold lsb */
100     0x00,           /* B8 carrier threshold msb */
101     0x80,           /* B9 mode: Bitwise variable used to enable various algorithm modes.*/
102     0x80,           /* B10 0-offset lsb */
103     0x00,           /* B11 0-offset msb */
104     0x10,           /* B12 field sense time lsb */
105     0x00,           /* B13 field sense time msb */
106     0x00,           /* B14 false detect threshold lsb: 0x00 to disable LPTD NTF. The number of false tag detections to resport LPTD NTF. */
107     0x00,           /* B15 false detect threshold msb. A false tag detect - full poll results in no tag being detected.*/
108     0x75,           /* B16 mode1; Bitwise variable used to enable various algorithm modes. */
109     0x0D,           /* B17 lptd ant cfg rx */
110     0x30,           /* B18 lptd rdr cfg ve */
111 };
112 
113 UINT8 *p_nfc_hal_dm_lptd_cfg = (UINT8 *) &nfc_hal_dm_lptd_cfg[0];
114 
115 /* This must be configured before setting reader mode for 20791. No need to configure for 43341. */
116 const UINT8 nfc_hal_dm_pll_325_cfg[NFC_HAL_XTAL_INDEX_MAX][NFC_HAL_PLL_325_SETCONFIG_PARAM_LEN] =
117 {
118     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0x9A, 0x99, 0x99, 0x99, 0xD7, 0x03, 0x00, 0x87, 0x04, 0x1C, 0x0F, 0x00, 0x0B, FALSE}, /*  9.6 MHz */
119     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0xEF, 0x90, 0xA8, 0x22, 0xD0, 0x03, 0x00, 0x64, 0x06, 0x26, 0x0F, 0x00, 0x08, FALSE}, /* 13.0 MHz */
120     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0x5B, 0xB0, 0x05, 0x5B, 0xD8, 0x03, 0x00, 0x50, 0x07, 0x30, 0x0F, 0x00, 0x06, FALSE}, /* 16.2 MHz */
121     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0xCD, 0xCC, 0xCC, 0xCC, 0xD7, 0x03, 0x00, 0x43, 0x09, 0x39, 0x0F, 0x00, 0x04, FALSE}, /* 19.2 MHz */
122     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0xD7, 0xA3, 0x70, 0x3D, 0xD0, 0x03, 0x00, 0x36, 0x0B, 0x47, 0x0F, 0x00, 0x03, FALSE}, /* 24.0 MHz */
123     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0x78, 0x48, 0x54, 0x11, 0xD0, 0x03, 0x00, 0x32, 0x0C, 0x4D, 0x0F, 0x00, 0x02, FALSE}, /* 26.0 MHz */
124     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0xCD, 0xCC, 0xCC, 0xCC, 0xD7, 0x03, 0x00, 0x43, 0x09, 0x39, 0x0F, 0x00, 0x04, TRUE},  /* 38.4 MHz */
125     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0x78, 0x48, 0x54, 0x11, 0xD0, 0x03, 0x00, 0x32, 0x0C, 0x4D, 0x0F, 0x00, 0x02, TRUE},  /* 52.0 MHz */
126     {NCI_PARAM_ID_PLL325_CFG_PARAM, NCI_PARAM_LEN_PLL325_CFG_PARAM, 0x29, 0xB4, 0xE2, 0x9C, 0xCF, 0x03, 0x00, 0x45, 0x08, 0x37, 0x0F, 0x00, 0x04, TRUE}   /* 37.4 MHz */
127 };
128 
129 UINT8 *p_nfc_hal_dm_pll_325_cfg = (UINT8 *) nfc_hal_dm_pll_325_cfg;
130 
131 
132 /* set nfc_hal_prm_nvm_required to TRUE, if the platform wants to abort PRM process without NVM */
133 BOOLEAN nfc_hal_prm_nvm_required = FALSE;
134