0d4380aa3d7d65a4e130d988a74495ac48b8b712
[adaptation/devices/nfc-plugin-nxp.git] / inc / phNfcConfig.h
1 /*
2  * Copyright (C) 2010 NXP Semiconductors
3  * Copyright (C) 2012 Samsung Elevtronics Co., Ltd
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 * \file phNfcConfig.h
21 * \brief HAL Configurations
22 *
23 *
24 * \note This is the configuration header file of the HAL 4.0.All configurable parameters of the HAL 4.0
25 *       are provided in this file
26 *
27 * Project: NFC-FRI-1.1 / HAL4.0
28 *
29 * $Date: Thu Sep  9 14:56:35 2010 $
30 * $Author: ing04880 $
31 * $Revision: 1.39 $
32 * $Aliases:  $
33 *
34 */
35
36
37 /*@{*/
38 #ifndef PHNFC_CONFIG_H
39 #define PHNFC_CONFIG_H
40 /*@}*/
41
42
43 /**
44 *  \name Hal
45 *
46 * File: \ref phNfcConfig.h
47 *
48 */
49
50 /*@{*/
51 #define PH_NFC_CONFIG_FILEREVISION "$Revision: 1.39 $" /**< \ingroup grp_file_attributes */
52 #define PH_NFC_CONFIG_FILEALIASES  "$Aliases:  $"     /**< \ingroup grp_file_attributes */
53 /*@}*/
54
55
56 /* -----------------Include files ---------------------------------------*/
57
58 #ifdef NFC_CUSTOM_CONFIG_INCLUDE
59 #include<nfc_custom_config.h>
60 #endif
61
62 /* ---------------- Macros ----------------------------------------------*/
63
64
65
66 /*
67  *****************************************************************
68  **********************  DEFAULT MACROS **************************
69  *****************************************************************
70  */
71
72
73 /**<  External Clock Request Configuration for the NFC Device,
74       0x00U     No Clock Request,
75       0x01U     Clock Request through CLKREQ pin (GPIO pin 2),
76       0x02U     Clock Request through NXP_EVT_CLK_REQUEST Event,
77       */
78 #ifndef NXP_DEFAULT_CLK_REQUEST
79 #define NXP_DEFAULT_CLK_REQUEST         0x00U
80 #endif
81
82 /**<  External Input Clock Setting for the NFC Device,
83       0x00U     No Input Clock Required (Use the Xtal),
84       0x01U     13 MHZ,
85       0x02U     19.2 MHZ,
86       0x03U     26 MHZ,
87       0x04U     38.4 MHZ,
88       0x05U     Custom (Set the Custome Clock Registry),
89       */
90
91 #ifndef NXP_DEFAULT_INPUT_CLK
92 #define NXP_DEFAULT_INPUT_CLK           0x00U
93 #endif
94
95 /**<  UICC Power Request configuration for the NFC Device,
96       0x00U     No Power Request,
97       0x01U     Power Request through CLKREQ pin (GPIO pin 2),
98       0x02U     Power Request through PWR_REQUEST (GPIO Pin 3),
99       */
100
101 #ifndef NXP_UICC_PWR_REQUEST
102 #define NXP_UICC_PWR_REQUEST            0x00U
103 #endif
104
105 /**<  TX LDO Configuration
106        0x00     00b     3.0 V,
107        0x01     01b     3.0 V,
108        0x02     10b     2.7 V,
109        0x03     11b     3.3 V,
110       */
111
112 #ifndef NXP_DEFAULT_TX_LDO
113 #define NXP_DEFAULT_TX_LDO              0x00U
114 #endif
115
116 /**<  UICC Bit Rate Configuration
117        0x02     212Kbits/Sec
118        0x04     424Kbits/Sec
119        0x08     828Kbits/Sec
120  */
121
122 #ifndef NXP_UICC_BIT_RATE
123 #define NXP_UICC_BIT_RATE               0x08U
124 #endif
125
126
127 /**<  Indicates PN544 Power Modes Configuration for the NFC Device,
128       0x00U -> PN544 stays in active bat mode
129                (except when generating RF field)
130       0x01U -> PN544 goes in standby when possible otherwise
131                stays in active bat mode
132       0x02U -> PN544 goes in idle mode as soon as it can
133                (otherwise it is in active bat except when generating RF field)
134       0x03U -> PN544 goes in standby when possible otherwise goes in idle mode
135                as soon as it can (otherwise it is in active bat except when
136                generating RF field)
137       */
138
139 #ifndef NXP_SYSTEM_PWR_STATUS
140 #define NXP_SYSTEM_PWR_STATUS           0x01U
141 #endif
142
143 /**< Default Session ID for Initialisation */
144 #ifndef DEFAULT_SESSION
145 #define DEFAULT_SESSION           "android8"\r
146 #endif
147
148
149 /* The Other Integration Configuration Values */
150
151 /**< Max number of remote devices supported */
152
153 #ifndef MAX_REMOTE_DEVICES
154 #define MAX_REMOTE_DEVICES        0x0A
155 #endif
156
157 /**<  System Event Notification
158        0x01     Overcurrent
159        0x02     PMUVCC Switch
160        0x04     External RF Field
161        0x08     Memory Violation
162        0x10     Temperature Overheat
163  */
164
165 #ifndef NXP_SYSTEM_EVT_INFO
166 #define NXP_SYSTEM_EVT_INFO             0x3DU
167 #endif
168
169
170 #ifndef NFC_DEV_HWCONF_DEFAULT
171 #define NFC_DEV_HWCONF_DEFAULT          0xBCU
172 #endif
173
174
175 #ifndef NXP_ISO_XCHG_TIMEOUT
176 #define NXP_ISO_XCHG_TIMEOUT            0x1AU
177 #endif
178
179 #ifndef NXP_MIFARE_XCHG_TIMEOUT
180 #define NXP_MIFARE_XCHG_TIMEOUT         0x03U
181 #endif
182
183 #ifndef NXP_FELICA_XCHG_TIMEOUT
184 #define NXP_FELICA_XCHG_TIMEOUT         0xFFU
185 #endif
186
187
188 #ifndef NXP_NFCIP_PSL_BRS_DEFAULT
189 #define NXP_NFCIP_PSL_BRS_DEFAULT       0x00U
190 #endif
191
192
193
194 /**< ID For Invalid Timer */
195 #ifndef NXP_INVALID_TIMER_ID
196 #define NXP_INVALID_TIMER_ID              0xFFFFFFFFU
197 #endif
198
199 /**< Presence check interval in milliseconds */
200 #ifndef PRESENCE_CHECK_INTERVAL
201 #define PRESENCE_CHECK_INTERVAL   500U
202 #endif
203
204 /** Resolution value for the timer, here the
205     timer resolution is 500 milliseconds */
206 #ifndef TIMER_RESOLUTION
207 #define TIMER_RESOLUTION                500U
208 #endif
209
210 /* Kindly note that the below Timeout values should be
211  * in Multiples of the value provided to TIMER_RESOLUTION
212  */
213
214 /**< Defines guard time out value for LLC timer,
215     1000 is in milliseconds */
216 #ifndef LINK_GUARD_TIMEOUT
217 #define LINK_GUARD_TIMEOUT              1000U
218 #endif
219
220
221 /**< Defines connection time out value for LLC timer,
222     1000 is in milliseconds */
223 #ifndef LINK_CONNECTION_TIMEOUT
224 #define LINK_CONNECTION_TIMEOUT         1000U
225 #endif
226
227
228 /**< Defines Firmware Download Completion Timeout value ,
229     120000 is in milliseconds */
230
231
232 #ifndef NXP_DNLD_COMPLETE_TIMEOUT
233 #define NXP_DNLD_COMPLETE_TIMEOUT         120000U
234 #endif
235
236
237 /**< Define to configure the Active Mode Polling Guard Time-out
238   */
239
240 #ifndef DEV_MGMT_ACT_GRD_TO_DEFAULT
241 #define DEV_MGMT_ACT_GRD_TO_DEFAULT       0x20U
242 #endif
243
244 /**<  NFCIP Active Mode Default Configuration (when acting as Target)
245        0x01     106 kbps
246        0x02     212 kbps
247        0x04     424 kbps
248  */
249
250 #ifndef NXP_NFCIP_ACTIVE_DEFAULT
251 #define NXP_NFCIP_ACTIVE_DEFAULT        0x01U
252 #endif
253
254
255
256
257 #ifndef NXP_NFC_HCI_TIMER
258 #define NXP_NFC_HCI_TIMER       1
259 #define NXP_NFC_HCI_TIMEOUT     6000
260 #endif
261
262
263 /*
264  *****************************************************************
265   DO NOT MODIFY THE BELOW MACROS UNLESS OTHERWISE MENTIONED
266  *****************************************************************
267  */
268
269
270
271 #ifndef HOST_CE_A_SAK_DEFAULT
272 #define HOST_CE_A_SAK_DEFAULT           0x20U
273 #endif
274
275 #ifndef NXP_CE_A_ATQA_HIGH
276 #define NXP_CE_A_ATQA_HIGH              0x00U
277 #endif
278
279 #ifndef NXP_CE_A_ATQA_LOW
280 #define NXP_CE_A_ATQA_LOW               0x04U
281 #endif
282
283
284 #ifndef NXP_UICC_CE_RIGHTS
285 #define NXP_UICC_CE_RIGHTS              0x0FU
286 #endif
287
288 #ifndef NXP_UICC_RD_RIGHTS
289 #define NXP_UICC_RD_RIGHTS              0x00U
290 #endif
291
292
293 /*
294  *****************************************************************
295   DO NOT DISABLE/ENABLE BELOW MACROS UNLESS OTHERWISE MENTIONED
296  *****************************************************************
297  */
298
299 #define ES_HW_VER   32
300
301 /*
302  *****************************************************************
303  *************** FEATURE SPECIFIC MACROS *************************
304  *****************************************************************
305  */
306
307
308
309 /**< Macro to Enable SMX Feature During
310  * Initialisation */
311
312 #if !defined(NXP_SMX)
313 #define NXP_SMX 0
314 #endif
315
316 #if (NXP_SMX == 1)
317 #define NXP_HAL_ENABLE_SMX
318 #endif
319
320 /**< Macro to Enable the Host Session
321  * Initialisation */
322 #define ESTABLISH_SESSION
323
324 /**< Macro to Enable the Peer to Peer Feature */
325 #define ENABLE_P2P
326
327 #define DEFAULT_NFCIP_INITIATOR_MODE_SUPPORT   0x3FU\r
328 #define DEFAULT_NFCIP_TARGET_MODE_SUPPORT      0x0FU\r
329
330 /**< Macro to Enable the ISO14443-B Feature */
331 #define TYPE_B
332
333 /**< Macro to Enable the Felica Feature */
334 #define TYPE_FELICA
335
336 /**< Macro to Enable the JEWEL Feature */
337 #define TYPE_JEWEL
338
339 /**< Macro to Enable the ISO15693 Feature */
340 #define TYPE_ISO15693
341
342 /*< Macro to Verify the Poll Parameters Set */
343 /* #define ENABLE_VERIFY_PARAM */
344
345 /**< Macro to Enable ISO 18092 Protocol compliancy
346  *  SAK to be merged with the TYPE A Card RF Feature :3.1*/
347 #define TGT_MERGE_SAK
348
349
350 /**< Macro to Configure the default power status
351  * to allow the PN544 to enter into the Standby */
352 #define CFG_PWR_STATUS
353
354
355 /**< Macro to Enable the SWP Protocol
356  * to detect UICC During Initialisation */
357 #define ENABLE_UICC
358
359 /**< Macro to Enable the RAW Mode of Transaction
360  * for the ISO-14443-3A Compliant Targets */
361 #define ENABLE_MIFARE_RAW
362
363 /**< Macro to Enable the HOST List
364  * to allow the UICC Communication */
365 #define HOST_WHITELIST
366
367 /**< Support reconnecting to a different handle on the same tag */
368 #define RECONNECT_SUPPORT
369
370 /**< Macro to Enable the Card Emulation Feature */
371 /* #define HOST_EMULATION */
372
373 #define NXP_HAL_VERIFY_EEPROM_CRC  0x01U
374
375 /**< Macro to Enable the Download Mode Feature */
376 #define FW_DOWNLOAD
377
378 /**< Macro to Enable the Firmware Download Timer */
379 /* 0x01U to use overall timeout */
380 /* 0x02U to use per frame timeout */
381 #define FW_DOWNLOAD_TIMER   0x02U
382
383 /**< Macro to Verify the Firmware Download */
384 /* #define FW_DOWNLOAD_VERIFY */
385
386 #ifndef FW_DOWNLOAD_VERIFY
387 #define NXP_FW_INTEGRITY_CHK    1
388 #endif
389
390 /* To specify the Maximum TX/RX Len */
391 #define NXP_FW_MAX_TX_RX_LEN   0x200
392
393 #define UICC_CONNECTIVITY_PATCH
394
395 /* Work around to Delay the initiator activation */
396 /* #define NXP_NFCIP_ACTIVATE_DELAY */
397
398 /* Work around to Release the Discovered Target */
399 #define SW_RELEASE_TARGET
400
401 /* Macro to Allow the HCI Release in any state */
402 #define NXP_HCI_SHUTDOWN_OVERRIDE
403
404
405 /* Macro to Enable The P2P Transaction Timers */
406 #define P2P_TGT_TRANSACT_TIMER
407
408 #if (ES_HW_VER == 32)
409 /* Macro to Configure the Target Disable Register */
410 #define NFCIP_TGT_DISABLE_CFG
411
412 #endif
413
414 /*< Macro to Disable the Felica Mapping */
415 /* #define DISABLE_FELICA_MAPPING */
416
417 /*< Macro to Disable the Felica Mapping */
418 /* #define DISABLE_JEWEL_MAPPING */
419
420 /**< Macro to enable LLC timer */
421 #define LLC_TIMER_ENABLE
422
423 /**< Macro to enable HCI Response timer */
424 /* #define NXP_NFC_HCI_TIMER 1 */
425
426 /* A Workaround to Delay and obtain the UICC Status Information */
427 /* #define UICC_STATUS_DELAY */
428
429 #ifdef UICC_STATUS_DELAY
430 #define UICC_STATUS_DELAY_COUNT 0x00100000
431 #endif
432
433 /**< Macro to delay the LLC RESET response callback,
434     Value is in milli-seconds */
435 #define LLC_RESET_DELAY                 10
436
437 /* Macro to Enable the workaround for Tuning of
438  * RF for TYPE B and F
439  */
440 /* #define SW_TYPE_RF_TUNING_BF */
441
442 /* Workaround to update the Active Guard Timeout */
443 /* #define MAX_ACTIVATE_TIMEOUT */
444
445 /* #define ONE_BYTE_LEN */
446
447 #define NFC_RF_NOISE_SW
448
449 /**< Define to configure the PMOS Modulation Index value
450   */
451
452 #ifndef NFC_DEV_PMOS_MOD_DEFAULT
453 /* 0x3F -> 6%, 0x3A -> 10%, 0x3C -> 10%, 0x35 -> 15.8%,  0x28 -> 25.8% */
454 #define NFC_DEV_PMOS_MOD_DEFAULT          0x3CU
455 #endif
456
457
458 #ifndef SW_TYPE_RF_TUNING_BF
459 #define SW_TYPE_RF_TUNING_BF              0x80U
460 #endif
461
462
463 /* Reset the Default values of Host Link Timers */
464 /* Macro to Enable the Host Side Link Timeout Configuration
465  * 0x00 ----> Default Pre-defined Configuration;
466  * 0x01 ----> Update only the Host Link Guard Timeout Configuration;
467  * 0x03 ----> Update Both the Host Link Guard Timeout
468               and ACK Timeout Configuration;
469  */
470
471 #ifndef HOST_LINK_TIMEOUT
472 #define HOST_LINK_TIMEOUT              0x00U
473 #endif
474
475
476 #ifndef NXP_NFC_LINK_GRD_CFG_DEFAULT
477 #define NXP_NFC_LINK_GRD_CFG_DEFAULT   0x0032U
478 #endif
479
480 #ifndef NXP_NFC_LINK_ACK_CFG_DEFAULT
481 #define NXP_NFC_LINK_ACK_CFG_DEFAULT   0x0005U
482 #endif
483
484 /* Macro to Enable the Interface Character Timeout Configuration
485  * 0x00 ----> Default Pre-defined Configuration;
486  * 0x01 ----> Update the IFC Timeout Default Configuration;
487  */
488
489 #ifndef NXP_NFC_IFC_TIMEOUT
490 #define NXP_NFC_IFC_TIMEOUT            0x00
491 #endif
492
493
494 #ifndef NXP_NFC_IFC_CONFIG_DEFAULT
495 #define NXP_NFC_IFC_CONFIG_DEFAULT     0x203AU
496 #endif
497
498 #ifndef NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT
499 #define NFC_ISO_15693_MULTIPLE_TAGS_SUPPORT 0x00
500 #endif
501
502 /*
503  *****************************************************************
504  ***********  MACROS ENABLE EEPROM REGISTER WRITE ****************
505  *****************************************************************
506  */
507
508
509 /* Enable this to Disable the WI Notification */
510 /* #define DISABLE_WI_NOTIFICATION */
511
512 /* Macro to Enable the Configuration of Initiator
513  * speed during Discovery configuration
514  */
515 #define INITIATOR_SPEED
516
517
518 /**/
519 /* #define UICC_SESSION_RESET */
520
521 /* Macro to Enable the Configuration of UICC
522  * Timer and Bitrate during Initialisation
523  */
524
525
526
527
528 /* -----------------Structures and Enumerations -------------------------*/
529
530
531
532
533 /* -----------------Exported Functions----------------------------------*/
534
535
536 #endif /*PHNFC_CONFIG_H*/
537