1 /******************************************************************************
2  *
3  *  Copyright (C) 1999-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 #ifndef __CONFIG_H
19 #define __CONFIG_H
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 int GetStrValue(const char* name, char* p_value, unsigned long len);
26 int GetNumValue(const char* name, void* p_value, unsigned long len);
27 
28 #ifdef __cplusplus
29 };
30 #endif
31 
32 #define NAME_POLLING_TECH_MASK "POLLING_TECH_MASK"
33 #define NAME_REGISTER_VIRTUAL_SE "REGISTER_VIRTUAL_SE"
34 #define NAME_APPL_TRACE_LEVEL "APPL_TRACE_LEVEL"
35 #define NAME_USE_RAW_NCI_TRACE "USE_RAW_NCI_TRACE"
36 #define NAME_LOGCAT_FILTER "LOGCAT_FILTER"
37 #define NAME_LPTD_CFG "LPTD_CFG"
38 #define NAME_SCREEN_OFF_POWER_STATE "SCREEN_OFF_POWER_STATE"
39 #define NAME_PREINIT_DSP_CFG "PREINIT_DSP_CFG"
40 #define NAME_DTA_START_CFG "DTA_START_CFG"
41 #define NAME_TRANSPORT_DRIVER "TRANSPORT_DRIVER"
42 #define NAME_POWER_CONTROL_DRIVER "POWER_CONTROL_DRIVER"
43 #define NAME_PROTOCOL_TRACE_LEVEL "PROTOCOL_TRACE_LEVEL"
44 #define NAME_UART_PORT "UART_PORT"
45 #define NAME_UART_BAUD "UART_BAUD"
46 #define NAME_UART_PARITY "UART_PARITY"
47 #define NAME_UART_STOPBITS "UART_STOPBITS"
48 #define NAME_UART_DATABITS "UART_DATABITS"
49 #define NAME_CLIENT_ADDRESS "BCMI2CNFC_ADDRESS"
50 #define NAME_NFA_DM_START_UP_CFG "NFA_DM_START_UP_CFG"
51 #define NAME_NFA_DM_CFG "NFA_DM_CFG"
52 #define NAME_NFA_DM_LP_CFG "NFA_DM_LP_CFG"
53 #define NAME_LOW_SPEED_TRANSPORT "LOW_SPEED_TRANSPORT"
54 #define NAME_NFC_WAKE_DELAY "NFC_WAKE_DELAY"
55 #define NAME_NFC_WRITE_DELAY "NFC_WRITE_DELAY"
56 #define NAME_PERF_MEASURE_FREQ "REPORT_PERFORMANCE_MEASURE"
57 #define NAME_READ_MULTI_PACKETS "READ_MULTIPLE_PACKETS"
58 #define NAME_POWER_ON_DELAY "POWER_ON_DELAY"
59 #define NAME_PRE_POWER_OFF_DELAY "PRE_POWER_OFF_DELAY"
60 #define NAME_POST_POWER_OFF_DELAY "POST_POWER_OFF_DELAY"
61 #define NAME_CE3_PRE_POWER_OFF_DELAY "CE3_PRE_POWER_OFF_DELAY"
62 #define NAME_NFA_STORAGE "NFA_STORAGE"
63 #define NAME_NFA_DM_START_UP_VSC_CFG "NFA_DM_START_UP_VSC_CFG"
64 #define NAME_NFA_DTA_START_UP_VSC_CFG "NFA_DTA_START_UP_VSC_CFG"
65 #define NAME_UICC_LISTEN_TECH_MASK "UICC_LISTEN_TECH_MASK"
66 #define NAME_UICC_LISTEN_TECH_EX_MASK "UICC_LISTEN_TECH_EXCLUDE_MASK"
67 #define NAME_SNOOZE_MODE_CFG "SNOOZE_MODE_CFG"
68 #define NAME_NFA_DM_DISC_DURATION_POLL "NFA_DM_DISC_DURATION_POLL"
69 #define NAME_SPD_DEBUG "SPD_DEBUG"
70 #define NAME_SPD_MAXRETRYCOUNT "SPD_MAX_RETRY_COUNT"
71 #define NAME_SPI_NEGOTIATION "SPI_NEGOTIATION"
72 #define NAME_AID_FOR_EMPTY_SELECT "AID_FOR_EMPTY_SELECT"
73 #define NAME_PRESERVE_STORAGE "PRESERVE_STORAGE"
74 #define NAME_NFA_MAX_EE_SUPPORTED "NFA_MAX_EE_SUPPORTED"
75 #define NAME_NFCC_ENABLE_TIMEOUT "NFCC_ENABLE_TIMEOUT"
76 #define NAME_NFA_DM_PRE_DISCOVERY_CFG "NFA_DM_PRE_DISCOVERY_CFG"
77 #define NAME_POLL_FREQUENCY "POLL_FREQUENCY"
78 #define NAME_XTAL_HARDWARE_ID "XTAL_HARDWARE_ID"
79 #define NAME_XTAL_FREQUENCY "XTAL_FREQUENCY"
80 #define NAME_XTAL_FREQ_INDEX "XTAL_FREQ_INDEX"
81 #define NAME_XTAL_PARAMS_CFG "XTAL_PARAMS_CFG"
82 #define NAME_EXCLUSIVE_SE_ACCESS "EXCLUSIVE_SE_ACCESS"
83 #define NAME_DBG_NO_UICC_IDLE_TIMEOUT_TOGGLING \
84   "DBG_NO_UICC_IDLE_TIMEOUT_TOGGLING"
85 #define NAME_PRESENCE_CHECK_ALGORITHM "PRESENCE_CHECK_ALGORITHM"
86 #define NAME_ALLOW_NO_NVM "ALLOW_NO_NVM"
87 #define NAME_DEVICE_HOST_WHITE_LIST "DEVICE_HOST_WHITE_LIST"
88 #define NAME_POWER_OFF_MODE "POWER_OFF_MODE"
89 #define NAME_GLOBAL_RESET "DO_GLOBAL_RESET"
90 #define NAME_NCI_HAL_MODULE "NCI_HAL_MODULE"
91 #define NAME_NFA_POLL_BAIL_OUT_MODE "NFA_POLL_BAIL_OUT_MODE"
92 #define NAME_NFA_PROPRIETARY_CFG "NFA_PROPRIETARY_CFG"
93 
94 #define LPTD_PARAM_LEN (40)
95 
96 // default configuration
97 #define default_transport "/dev/bcm2079x"
98 #define default_storage_location "/data/nfc"
99 
100 struct tUART_CONFIG {
101   int m_iBaudrate;  // 115200
102   int m_iDatabits;  // 8
103   int m_iParity;    // 0 - none, 1 = odd, 2 = even
104   int m_iStopbits;
105 };
106 
107 extern struct tUART_CONFIG uartConfig;
108 #define MAX_CHIPID_LEN (16)
109 void readOptionalConfig(const char* option);
110 
111 /* Snooze mode configuration structure */
112 typedef struct {
113   unsigned char snooze_mode;         /* Snooze Mode */
114   unsigned char idle_threshold_dh;   /* Idle Threshold Host */
115   unsigned char idle_threshold_nfcc; /* Idle Threshold NFCC   */
116   unsigned char
117       nfc_wake_active_mode; /* NFC_LP_ACTIVE_LOW or NFC_LP_ACTIVE_HIGH */
118   unsigned char
119       dh_wake_active_mode; /* NFC_LP_ACTIVE_LOW or NFC_LP_ACTIVE_HIGH */
120 } tSNOOZE_MODE_CONFIG;
121 #endif
122