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