• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2024-2025 NXP
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 /* NCI GID index*/
18 #define NCI_GID_INDEX 0
19 /* NCI OID index*/
20 #define NCI_OID_INDEX 1
21 /* NCI message length index*/
22 #define NCI_MSG_LEN_INDEX 2
23 /* NCI message index for feature*/
24 #define NCI_MSG_INDEX_FOR_FEATURE 3
25 /* NCI message index feature value*/
26 #define NCI_MSG_INDEX_FEATURE_VALUE 4
27 #define NCI_GID_PROP 0x0F
28 #define NCI_HEADER_MIN_LEN 3  // GID + OID + LENGTH
29 #define RF_DISC_CMD_NO_OF_CONFIG_INDEX 3
30 #define RF_DISC_CMD_CONFIG_START_INDEX 4
31 // RF tech mode and Disc Frequency values
32 #define RF_DISC_CMD_EACH_CONFIG_LENGTH 2
33 #define NFCEE_MODE_SET_CMD_MODE_INDEX 4
34 
35 /* Android Parameters */
36 #define NCI_ANDROID_GET_CAPABILITY 0x00
37 #define NCI_ANDROID_POWER_SAVING 0x01
38 #define NCI_ANDROID_OBSERVER_MODE 0x02
39 #define NCI_ANDROID_GET_OBSERVER_MODE_STATUS 0x04
40 #define NCI_ANDROID_SET_PASSIVE_OBSERVER_TECH 0x05
41 
42 /* Android Power Saving Params */
43 #define NCI_ANDROID_POWER_SAVING_PARAM_SIZE 2
44 #define NCI_ANDROID_POWER_SAVING_PARAM_DISABLE 0
45 #define NCI_ANDROID_POWER_SAVING_PARAM_ENABLE 1
46 
47 #define NCI_RSP_SIZE 2
48 #define NCI_RSP_OK 0
49 #define NCI_RSP_FAIL 3
50 
51 #define NCI_PROP_NTF_GID 0x6F
52 #define NCI_PROP_LX_NTF_OID 0x36
53 #define NCI_PROP_NTF_ANDROID_OID 0x0C
54 
55 #define NCI_RF_DISC_COMMD_GID 0x21
56 #define NCI_RF_DISC_COMMAND_OID 0x03
57 #define NFC_A_PASSIVE_LISTEN_MODE 0x80
58 #define NFC_B_PASSIVE_LISTEN_MODE 0x81
59 #define NFC_F_PASSIVE_LISTEN_MODE 0x82
60 #define NFC_ACTIVE_LISTEN_MODE 0x83
61 #define OBSERVE_MODE_RF_TECH_AND_MODE 0xFF
62 #define OBSERVE_MODE_DISCOVERY_CYCLE 0x01
63 
64 // Observe mode constants
65 #define L2_EVT_TAG 0x01
66 #define CMA_EVT_TAG 0x0A
67 #define CMA_EVT_EXTRA_DATA_TAG 0x07
68 #define MIN_LEN_NON_CMA_EVT 7
69 #define MIN_LEN_CMA_EVT 6
70 #define INDEX_OF_L2_EVT_TYPE 6
71 #define INDEX_OF_L2_EVT_GAIN 5
72 #define INDEX_OF_CMA_EVT_TYPE 4
73 #define INDEX_OF_CMA_EVT_DATA 5
74 #define INDEX_OF_CMA_DATA 7
75 #define MIN_LEN_NON_CMA_EVT 7
76 #define MIN_LEN_CMA_EVT 6
77 #define MIN_LEN_CMA_EXTRA_DATA_EVT 1
78 #define L2_EVENT_TRIGGER_TYPE 0x1
79 #define CMA_EVENT_TRIGGER_TYPE 0x02
80 #define CMA_DATA_TRIGGER_TYPE 0x0E
81 // Event types to send upper layer
82 #define TYPE_RF_FLAG 0x00
83 #define TYPE_MOD_A 0x01
84 #define TYPE_MOD_B 0x02
85 #define TYPE_MOD_F 0x03
86 #define TYPE_UNKNOWN 0x07
87 #define EVENT_UNKNOWN 0x00
88 #define EVENT_MOD_A 0x01
89 #define EVENT_MOD_B 0x02
90 #define EVENT_MOD_F 0x03
91 #define EVENT_RF_ON 0x08
92 #define EVENT_RF_OFF 0x09
93 #define REQ_A 0x26
94 #define WUP_A 0x52
95 #define TYPE_B_APF 0x05
96 #define TYPE_F_CMD_LENGH 0x06
97 #define TYPE_F_ID 0xFF
98 #define OBSERVE_MODE_OP_CODE 0x03
99 #define GAIN_FIELD_LENGTH 1
100 #define OP_CODE_FIELD_LENGTH 1
101 #define EVENT_TYPE_FIELD_LENGTH 1
102 #define RF_STATE_FIELD_LENGTH 1
103 #define NCI_MESSAGE_OFFSET 3
104 #define LX_TYPE_MASK 0x0F
105 #define LX_EVENT_MASK 0xF0
106 #define LX_LENGTH_MASK 0x0F
107 #define LX_TAG_MASK 0xF0
108 #define SHORT_FLAG 0x00
109 #define TYPE_ALL_EVENTS 0x00
110 #define TYPE_ONLY_MOD_EVENTS 0x01
111 #define TYPE_ONLY_CMA_EVENTS 0x02
112 #define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_DISABLE 0x0
113 #define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A 0x1
114 #define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B 0x2
115 #define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_F 0x4
116 #define NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V 0x8
117 
118 #define OBSERVE_MODE_TECH_COMMAND_SUPPORT_FLAG  \
119   (NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A | \
120    NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B | \
121    NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V)
122 
123 #define OBSERVE_MODE_TECH_COMMAND_SUPPORT_FLAG_FOR_ALL_TECH \
124   (NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_A |             \
125    NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_B |             \
126    NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_F |             \
127    NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE_V)
128