First add
[adaptation/devices/nfc-plugin-nxp.git] / src / phHciNfc_RFReaderA.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_RFReaderA.h                                                 *\r
22 * \brief HCI Reader A Management Routines.                                    *\r
23 *                                                                             *\r
24 *                                                                             *\r
25 * Project: NFC-FRI-1.1                                                        *\r
26 *                                                                             *\r
27 * $Date: Fri Aug 14 17:01:27 2009 $                                           *\r
28 * $Author: ing04880 $                                                         *\r
29 * $Revision: 1.17 $                                                           *\r
30 * $Aliases: NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,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 \r
36 #ifndef PHHCINFC_RFREADERA_H\r
37 #define PHHCINFC_RFREADERA_H\r
38 \r
39 /*@}*/\r
40 \r
41 \r
42 /**\r
43  *  \name HCI\r
44  *\r
45  * File: \ref phHciNfc_ReaderA.h\r
46  *\r
47  */\r
48 /*@{*/\r
49 #define PHHCINFC_RFREADERA_FILEREVISION "$Revision: 1.17 $" /**< \ingroup grp_file_attributes */\r
50 #define PHHCINFC_RFREADERA_FILEALIASES  "$Aliases: NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,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
51 /*@}*/\r
52 \r
53 /*\r
54 ***************************** Header File Inclusion ****************************\r
55 */\r
56 \r
57 #include <phHciNfc_Generic.h>\r
58 \r
59 /*\r
60 ****************************** Macro Definitions *******************************\r
61 */\r
62 \r
63 /* Commands exposed to the upper layer */\r
64 #define NXP_WRA_CONTINUE_ACTIVATION         0x12U\r
65 #define NXP_MIFARE_RAW                      0x20U\r
66 #define NXP_MIFARE_CMD                      0x21U\r
67 #define DATA_RATE_MAX_DEFAULT_VALUE         0x00U\r
68 \r
69 /* Enable the reader A */\r
70 #define HCI_READER_A_ENABLE                 0x01U\r
71 #define HCI_READER_A_INFO_SEQ               0x02U\r
72 \r
73 #define RDR_A_TIMEOUT_MIN                   0x00U\r
74 #define RDR_A_TIMEOUT_MAX                   0x15U\r
75 /*\r
76 ******************** Enumeration and Structure Definition **********************\r
77 */\r
78 typedef enum phHciNfc_ReaderA_Seq{\r
79     RDR_A_DATA_RATE_MAX,\r
80     RDR_A_UID,\r
81     RDR_A_SAK,\r
82     RDR_A_ATQA,\r
83     RDR_A_APP_DATA,\r
84     RDR_A_FWI_SFGT,\r
85     RDR_A_END_SEQUENCE, \r
86     RDR_A_INVALID_SEQ\r
87 } phHciNfc_ReaderA_Seq_t;\r
88 \r
89 /* Information structure for the polling loop Gate */\r
90 typedef struct phHciNfc_ReaderA_Info{\r
91     /* Current running Sequence of the reader A Management */\r
92     phHciNfc_ReaderA_Seq_t          current_seq;\r
93     /* Next running Sequence of the reader A Management */\r
94     phHciNfc_ReaderA_Seq_t          next_seq;\r
95     /* Pointer to the reader A pipe information */\r
96     phHciNfc_Pipe_Info_t            *p_pipe_info;\r
97     uint8_t                         pipe_id;\r
98     /* Flag to say about the multiple targets */\r
99     uint8_t                         multiple_tgts_found;\r
100     /* Reader A information */\r
101     phHal_sRemoteDevInformation_t   reader_a_info;\r
102     /* Enable or disable reader gate */\r
103     uint8_t                         enable_rdr_a_gate;\r
104     /* UICC re-activation status */\r
105     uint8_t                         uicc_activation;\r
106 } phHciNfc_ReaderA_Info_t;\r
107 \r
108 /*\r
109 *********************** Function Prototype Declaration *************************\r
110 */\r
111 \r
112 /*!\r
113  * \brief Allocates the resources of reader A management gate.\r
114  *\r
115  * This function Allocates the resources of the reader A management\r
116  * gate Information Structure.\r
117  * \r
118  */\r
119 extern\r
120 NFCSTATUS\r
121 phHciNfc_ReaderA_Init_Resources(\r
122                                 phHciNfc_sContext_t     *psHciContext\r
123                          );\r
124 \r
125 /**\r
126 * \ingroup grp_hci_nfc\r
127 *\r
128 *   The phHciNfc_ReaderA_Get_PipeID function gives the pipe id of the reader A \r
129 *   gate\r
130 *\r
131 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
132 *                                       context Structure.\r
133 *   \param[in]  pHwRef                  pHwRef is the Information of\r
134 *                                       the Device Interface Link\r
135 *\r
136 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
137 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
138 *                                       could not be interpreted properly.\r
139 *\r
140 */\r
141 extern\r
142 NFCSTATUS\r
143 phHciNfc_ReaderA_Get_PipeID(\r
144                             phHciNfc_sContext_t     *psHciContext,\r
145                             uint8_t                 *ppipe_id\r
146                             );\r
147                  \r
148 /**\r
149 * \ingroup grp_hci_nfc\r
150 *\r
151 *   The phHciNfc_ReaderA_Sequence function executes the sequence of operations, to\r
152 *   get the UID, SAK, ATQA  etc.\r
153 *\r
154 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
155 *                                       context Structure.\r
156 *   \param[in]  pHwRef                  pHwRef is the Information of\r
157 *                                       the Device Interface Link\r
158 *\r
159 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
160 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
161 *                                       could not be interpreted properly.\r
162 *\r
163 */\r
164 extern\r
165 NFCSTATUS\r
166 phHciNfc_ReaderA_Info_Sequence (\r
167                        void             *psHciHandle,\r
168                        void             *pHwRef\r
169                        );\r
170 \r
171 \r
172 /**\r
173 * \ingroup grp_hci_nfc\r
174 *\r
175 *   The phHciNfc_ReaderA_App_Data function is to get the application data information.\r
176 *\r
177 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
178 *                                       context Structure.\r
179 *   \param[in]  pHwRef                  pHwRef is the Information of\r
180 *                                       the Device Interface Link\r
181 *\r
182 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
183 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
184 *                                       could not be interpreted properly.\r
185 *\r
186 */\r
187 extern\r
188 NFCSTATUS\r
189 phHciNfc_ReaderA_App_Data (\r
190                            void             *psHciHandle,\r
191                            void             *pHwRef\r
192                            );\r
193 \r
194 /**\r
195 * \ingroup grp_hci_nfc\r
196 *\r
197 *   The phHciNfc_ReaderA_Fwi_Sfgt function is to get the frame waiting time\r
198 *   information.\r
199 *\r
200 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
201 *                                       context Structure.\r
202 *   \param[in]  pHwRef                  pHwRef is the Information of\r
203 *                                       the Device Interface Link\r
204 *\r
205 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
206 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
207 *                                       could not be interpreted properly.\r
208 *\r
209 */\r
210 extern\r
211 NFCSTATUS\r
212 phHciNfc_ReaderA_Fwi_Sfgt (\r
213                            void             *psHciHandle,\r
214                            void             *pHwRef\r
215                            );\r
216 \r
217 /**\r
218 * \ingroup grp_hci_nfc\r
219 *\r
220 *  The phHciNfc_ReaderA_Update_PipeInfo function updates the pipe_id of the reader A\r
221 *  gate management Structure.\r
222 *\r
223 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
224 *                                      context Structure.\r
225 *  \param[in]  pipeID                  pipeID of the reader A gate\r
226 *  \param[in]  pPipeInfo               Update the pipe Information of the reader \r
227 *                                      A gate\r
228 *\r
229 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
230 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
231 *                                      could not be interpreted properly.\r
232 *\r
233 */\r
234 \r
235 extern\r
236 NFCSTATUS\r
237 phHciNfc_ReaderA_Update_PipeInfo(\r
238                                   phHciNfc_sContext_t     *psHciContext,\r
239                                   uint8_t                 pipeID,\r
240                                   phHciNfc_Pipe_Info_t    *pPipeInfo\r
241                                   );\r
242 \r
243 /**\r
244 * \ingroup grp_hci_nfc\r
245 *\r
246 *   The phHciNfc_Send_ReaderA_Command function executes the command sent by the \r
247 *   upper layer, depending on the commands defined.\r
248 *\r
249 *   \param[in]  psContext        psContext is the pointer to HCI Layer\r
250 *                                context Structure.\r
251 *   \param[in]  pHwRef           pHwRef is the Information of\r
252 *                                the Device Interface Link\r
253 *   \param[in]  pipe_id          pipeID of the reader A gate \r
254 *   \param[in]  cmd              command that needs to be sent to the device\r
255 *   \param[in]  length           information length sent by the caller\r
256 *   \param[in]  params           information related to the command\r
257 *\r
258 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
259 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
260 *                                       could not be interpreted properly.\r
261 *\r
262 */\r
263 extern\r
264 NFCSTATUS\r
265 phHciNfc_Send_ReaderA_Command(\r
266                               phHciNfc_sContext_t   *psContext,\r
267                               void                  *pHwRef,\r
268                               uint8_t               pipe_id,\r
269                               uint8_t               cmd\r
270                               );\r
271 \r
272 /**\r
273 * \ingroup grp_hci_nfc\r
274 *\r
275 *   The phHciNfc_ReaderA_Auto_Activate function updates auto activate register\r
276 *\r
277 *   \param[in]  psContext        psContext is the pointer to HCI Layer\r
278 *                                context Structure.\r
279 *   \param[in]  pHwRef           pHwRef is the Information of\r
280 *                                the Device Interface Link\r
281 *   \param[in] activate_enable   to enable or disable auto activation\r
282 *\r
283 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
284 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
285 *                                       could not be interpreted properly.\r
286 *\r
287 */\r
288 extern\r
289 NFCSTATUS\r
290 phHciNfc_ReaderA_Auto_Activate(\r
291                                void         *psContext,\r
292                                void         *pHwRef,\r
293                                uint8_t      activate_enable\r
294                                );\r
295 \r
296 /**\r
297 * \ingroup grp_hci_nfc\r
298 *\r
299 *   The phHciNfc_Send_ReaderA_Command function executes the command sent by the \r
300 *   upper layer, depending on the commands defined.\r
301 *\r
302 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer\r
303 *                                context Structure.\r
304 *   \param[in]  infotype         To enable the reader A gate\r
305 *   \param[in]  rdr_a_info       reader A gate info\r
306 *\r
307 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
308 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
309 *                                       could not be interpreted properly.\r
310 *\r
311 */\r
312 extern\r
313 NFCSTATUS\r
314 phHciNfc_ReaderA_Update_Info(\r
315                              phHciNfc_sContext_t        *psHciContext,\r
316                              uint8_t                    infotype,\r
317                              void                       *rdr_a_info\r
318                              );\r
319 \r
320 /**\r
321 * \ingroup grp_hci_nfc\r
322 *\r
323 *   The phHciNfc_ReaderA_Cont_Active function executes NXP_WRA_CONTINUE_ACTIVATION\r
324 *   command to inform the CLF Controller after having received the event\r
325 *   EVT_TARGET_DISCOVERED to continue activation in case activation has \r
326 *   been stopped after successful SAK response. The response to this command, sent \r
327 *   as soon as the activation is finished, indicates the result of the \r
328 *   activation procedure\r
329 *\r
330 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer\r
331 *                                context Structure.\r
332 *   \param[in]  pHwRef           pHwRef is the Information of\r
333 *                                the Device Interface Link\r
334 *   \param[in]  pipeID           pipeID of the reader A gate\r
335 *\r
336 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
337 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
338 *                                       could not be interpreted properly.\r
339 *\r
340 */\r
341 extern\r
342 NFCSTATUS\r
343 phHciNfc_ReaderA_Cont_Activate (\r
344                               phHciNfc_sContext_t       *psHciContext,\r
345                               void                      *pHwRef\r
346                               );\r
347 \r
348 /**\r
349 * \ingroup grp_hci_nfc\r
350 *\r
351 *  The phHciNfc_ReaderA_Set_DataRateMax function updates the data rate max value \r
352 *\r
353 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
354 *                                      context Structure.\r
355 *  \param[in]  pipeID                  pipeID of the reader A gate\r
356 *  \param[in]  pPipeInfo               Update the pipe Information of the reader \r
357 *                                      A gate\r
358 *\r
359 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
360 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
361 *                                      could not be interpreted properly.\r
362 *\r
363 */\r
364 extern\r
365 NFCSTATUS\r
366 phHciNfc_ReaderA_Set_DataRateMax(\r
367                                  void         *psContext,\r
368                                  void         *pHwRef,\r
369                                  uint8_t      data_rate_value\r
370                                  );\r
371 \r
372 #endif /* #ifndef PHHCINFC_RFREADERA_H */\r
373 \r