merge with master
[adaptation/devices/nfc-plugin-nxp.git] / src / phHciNfc_Jewel.h
1 /*\r
2  * Copyright (C) 2010 NXP Semiconductors\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *      http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 /*!\r
18 * =========================================================================== *\r
19 *                                                                             *\r
20 *                                                                             *\r
21 * \file  phHciNfc_Jewel.h                                                 *\r
22 * \brief HCI Jewel Management Routines.                                    *\r
23 *                                                                             *\r
24 *                                                                             *\r
25 * Project: NFC-FRI-1.1                                                        *\r
26 *                                                                             *\r
27 * $Date: Mon Mar 29 17:34:50 2010 $                                           *\r
28 * $Author: ing04880 $                                                         *\r
29 * $Revision: 1.3 $                                                            *\r
30 * $Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $                                                                *\r
31 *                                                                             *\r
32 * =========================================================================== *\r
33 */\r
34 \r
35 #ifndef PHHCINFC_JEWEL_H\r
36 #define PHHCINFC_JEWEL_H\r
37 \r
38 /*@}*/\r
39 \r
40 \r
41 /**\r
42 *  \name HCI\r
43 *\r
44 * File: \ref phHciNfc_Jewel.h\r
45 *\r
46 */\r
47 /*@{*/\r
48 #define PHHCINFC_JEWEL_FILEREVISION "$Revision: 1.3 $" /**< \ingroup grp_file_attributes */\r
49 #define PHHCINFC_JEWEL_FILEALIASES  "$Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $"   /**< \ingroup grp_file_attributes */\r
50 /*@}*/\r
51 \r
52 /*\r
53 ***************************** Header File Inclusion ****************************\r
54 */\r
55 \r
56 #include <phHciNfc_Generic.h>\r
57 \r
58 /*\r
59 ****************************** Macro Definitions *******************************\r
60 */\r
61 \r
62 /* Commands exposed to the upper layer */\r
63 \r
64 /* Enable the Jewel */\r
65 #define HCI_JEWEL_ENABLE                    0x01U\r
66 #define HCI_JEWEL_INFO_SEQ                  0x02U\r
67 \r
68 /* Jewel read write commands */\r
69 #define NXP_JEWEL_RAW                       0x23U\r
70 \r
71 /*\r
72 ******************** Enumeration and Structure Definition **********************\r
73 */\r
74 typedef enum phHciNfc_Jewel_Seq{\r
75     JEWEL_READID_SEQUENCE,\r
76     JEWEL_END_SEQUENCE,\r
77     JEWEL_INVALID_SEQ\r
78 } phHciNfc_Jewel_Seq_t;\r
79 \r
80 /* Information structure for the Jewel Gate */\r
81 typedef struct phHciNfc_Jewel_Info{\r
82     /* Current running Sequence of the Jewel Management */\r
83     phHciNfc_Jewel_Seq_t            current_seq;\r
84     /* Next running Sequence of the Jewel Management */\r
85     phHciNfc_Jewel_Seq_t            next_seq;\r
86     /* Pointer to the Jewel pipe information */\r
87     phHciNfc_Pipe_Info_t            *p_pipe_info;\r
88     uint8_t                         pipe_id;\r
89     /* Flag to say about the multiple targets */\r
90     uint8_t                         multiple_tgts_found;\r
91     /* Jewel information */\r
92     phHal_sRemoteDevInformation_t   s_jewel_info;\r
93     /* Enable or disable reader gate */\r
94     uint8_t                         enable_jewel_gate;\r
95     /* UICC re-activation status */\r
96     uint8_t                         uicc_activation;\r
97 } phHciNfc_Jewel_Info_t;\r
98 \r
99 /*\r
100 *********************** Function Prototype Declaration *************************\r
101 */\r
102 \r
103 /*!\r
104 * \brief Allocates the resources of Jewel management gate.\r
105 *\r
106 * This function Allocates the resources of the Jewel management\r
107 * gate Information Structure.\r
108\r
109 */\r
110 extern\r
111 NFCSTATUS\r
112 phHciNfc_Jewel_Init_Resources(\r
113                                 phHciNfc_sContext_t     *psHciContext\r
114                                 );\r
115 \r
116 /**\r
117 * \ingroup grp_hci_nfc\r
118 *\r
119 *   The phHciNfc_Jewel_Get_PipeID function gives the pipe id of the Jewel \r
120 *   gate\r
121 *\r
122 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
123 *                                       context Structure.\r
124 *   \param[in]  pHwRef                  pHwRef is the Information of\r
125 *                                       the Device Interface Link\r
126 *\r
127 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
128 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
129 *                                       could not be interpreted properly.\r
130 *\r
131 */\r
132 extern\r
133 NFCSTATUS\r
134 phHciNfc_Jewel_Get_PipeID(\r
135                             phHciNfc_sContext_t     *psHciContext,\r
136                             uint8_t                 *ppipe_id\r
137                             );\r
138 \r
139 \r
140 /**\r
141 * \ingroup grp_hci_nfc\r
142 *\r
143 *  The phHciNfc_Jewel_Update_PipeInfo function updates the pipe_id of the Jewel\r
144 *  gate management Structure.\r
145 *\r
146 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
147 *                                      context Structure.\r
148 *  \param[in]  pipeID                  pipeID of the Jewel gate\r
149 *  \param[in]  pPipeInfo               Update the pipe Information of the reader \r
150 *                                      A gate\r
151 *\r
152 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
153 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
154 *                                      could not be interpreted properly.\r
155 *\r
156 */\r
157 \r
158 extern\r
159 NFCSTATUS\r
160 phHciNfc_Jewel_Update_PipeInfo(\r
161                                  phHciNfc_sContext_t     *psHciContext,\r
162                                  uint8_t                 pipeID,\r
163                                  phHciNfc_Pipe_Info_t    *pPipeInfo\r
164                                  );\r
165 \r
166 /**\r
167 * \ingroup grp_hci_nfc\r
168 *\r
169 *   The phHciNfc_Jewel_Update_Info function updated the jewel gate info.\r
170 *\r
171 *   \param[in]  psHciContext        psHciContext is the pointer to HCI Layer\r
172 *                                   context Structure.\r
173 *   \param[in]  infotype            To enable the jewel gate\r
174 *   \param[in]  jewel_info          Jewel gate info\r
175 *\r
176 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
177 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
178 *                                       could not be interpreted properly.\r
179 */\r
180 extern \r
181 NFCSTATUS\r
182 phHciNfc_Jewel_Update_Info(\r
183                              phHciNfc_sContext_t        *psHciContext,\r
184                              uint8_t                    infotype,\r
185                              void                       *jewel_info\r
186                              );\r
187 \r
188 /**\r
189 * \ingroup grp_hci_nfc\r
190 *\r
191 *   The phHciNfc_Jewel_Info_Sequence function executes the sequence of operations, to\r
192 *   get the ID.\r
193 *\r
194 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
195 *                                       context Structure.\r
196 *   \param[in]  pHwRef                  pHwRef is the Information of\r
197 *                                       the Device Interface Link\r
198 *\r
199 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
200 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
201 *                                       could not be interpreted properly.\r
202 *\r
203 */\r
204 extern\r
205 NFCSTATUS\r
206 phHciNfc_Jewel_Info_Sequence (\r
207                                 void             *psHciHandle,\r
208                                 void             *pHwRef\r
209                                 );\r
210 \r
211 /**\r
212 * \ingroup grp_hci_nfc\r
213 *\r
214 *   The phHciNfc_Send_Jewel_Command function executes the command sent by the \r
215 *   upper layer, depending on the commands defined.\r
216 *\r
217 *   \param[in]  psContext        psContext is the pointer to HCI Layer\r
218 *                                context Structure.\r
219 *   \param[in]  pHwRef           pHwRef is the Information of\r
220 *                                the Device Interface Link\r
221 *   \param[in]  pipe_id          pipeID of the jewel gate \r
222 *   \param[in]  cmd              command that needs to be sent to the device\r
223 *   \param[in]  length           information length sent by the caller\r
224 *   \param[in]  params           information related to the command\r
225 *\r
226 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
227 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
228 *                                       could not be interpreted properly.\r
229 */\r
230 extern\r
231 NFCSTATUS\r
232 phHciNfc_Send_Jewel_Command(\r
233                              phHciNfc_sContext_t   *psContext,\r
234                              void                  *pHwRef,\r
235                              uint8_t               pipe_id,\r
236                              uint8_t               cmd\r
237                              );\r
238 \r
239 /**\r
240 * \ingroup grp_hci_nfc\r
241 *\r
242 *   The phHciNfc_Jewel_GetRID function executes the command to read the ID\r
243 *\r
244 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer\r
245 *                                context Structure.\r
246 *   \param[in]  pHwRef           pHwRef is the Information of\r
247 *                                the Device Interface Link\r
248 *\r
249 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
250 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
251 *                                       could not be interpreted properly.\r
252 */\r
253 extern \r
254 NFCSTATUS \r
255 phHciNfc_Jewel_GetRID(\r
256                 phHciNfc_sContext_t   *psHciContext,\r
257                 void                  *pHwRef);\r
258 \r
259 #endif /* #ifndef PHHCINFC_JEWEL_H */\r
260 \r
261 \r