merge with master
[adaptation/devices/nfc-plugin-nxp.git] / src / phHciNfc_CE_B.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_CE_B.h                                             *\r
22 * \brief HCI card emulation management routines.                              *\r
23 *                                                                             *\r
24 *                                                                             *\r
25 * Project: NFC-FRI-1.1                                                        *\r
26 *                                                                             *\r
27 * $Date: Fri Aug 14 17:01:26 2009 $                                           *\r
28 * $Author: ing04880 $                                                         *\r
29 * $Revision: 1.4 $                                                            *\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_CE_B_H\r
37 #define PHHCINFC_CE_B_H\r
38 \r
39 /*@}*/\r
40 \r
41 \r
42 /**\r
43 *  \name HCI\r
44 *\r
45 * File: \ref phHciNfc_CE_B.h\r
46 *\r
47 */\r
48 /*@{*/\r
49 #define PHHCINFC_CE_B_FILEREVISION "$Revision: 1.4 $" /**< \ingroup grp_file_attributes */\r
50 #define PHHCINFC_CE_B_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 #define HOST_CE_B_MODE_INDEX                (0x01U)\r
63 #define HOST_CE_B_PUPI_INDEX                (0x02U)\r
64 #define HOST_CE_B_AFI_INDEX                 (0x03U)\r
65 #define HOST_CE_B_ATQB_INDEX                (0x04U)\r
66 #define HOST_CE_B_HIGH_LAYER_RESP_INDEX     (0x05U)\r
67 #define HOST_CE_B_DATA_RATE_MAX_INDEX       (0x05U)\r
68 \r
69 /*\r
70 ******************** Enumeration and Structure Definition **********************\r
71 */\r
72 \r
73 /* Sequence list */\r
74 typedef enum phHciNfc_CE_B_Seq{\r
75     HOST_CE_B_INVALID_SEQ,\r
76     HOST_CE_B_PIPE_OPEN,\r
77     HOST_CE_B_PUPI_SEQ,\r
78     HOST_CE_B_ATQB_SEQ,\r
79     HOST_CE_B_ENABLE_SEQ,\r
80     HOST_CE_B_DISABLE_SEQ,\r
81     HOST_CE_B_PIPE_CLOSE, \r
82     HOST_CE_B_PIPE_DELETE\r
83 }phHciNfc_CE_B_Seq_t;\r
84 \r
85 /* Information structure for the card emulation B gate */\r
86 typedef struct phHciNfc_CE_B_Info{\r
87     phHciNfc_CE_B_Seq_t         current_seq;\r
88     phHciNfc_CE_B_Seq_t         next_seq;\r
89     /* Pointer to the card emulation B pipe information */\r
90     phHciNfc_Pipe_Info_t        *p_pipe_info;\r
91     uint8_t                     pipe_id;\r
92     \r
93 } phHciNfc_CE_B_Info_t;\r
94 \r
95 /*\r
96 *********************** Function Prototype Declaration *************************\r
97 */\r
98 \r
99 /*!\r
100  * \brief Allocates the resources of card emulation B management gate.\r
101  *\r
102  * This function Allocates the resources of the card emulation B management\r
103  * gate Information Structure.\r
104  * \r
105  */\r
106 extern\r
107 NFCSTATUS\r
108 phHciNfc_CE_B_Init_Resources(\r
109                                 phHciNfc_sContext_t     *psHciContext\r
110                          );\r
111 \r
112 /**\r
113 * \ingroup grp_hci_nfc\r
114 *\r
115 *   The phHciNfc_CE_B_Get_PipeID function gives the pipe id of the card \r
116 *   emulation B gate\r
117 *\r
118 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
119 *                                       context Structure.\r
120 *   \param[in]  pHwRef                  pHwRef is the Information of\r
121 *                                       the Device Interface Link\r
122 *\r
123 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
124 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
125 *                                       could not be interpreted properly.\r
126 *\r
127 */\r
128 extern\r
129 NFCSTATUS\r
130 phHciNfc_CE_B_Get_PipeID(\r
131                             phHciNfc_sContext_t     *psHciContext,\r
132                             uint8_t                 *ppipe_id\r
133                             );\r
134 \r
135 /**\r
136 * \ingroup grp_hci_nfc\r
137 *\r
138 *  The phHciNfc_CE_B_Update_PipeInfo function updates the pipe_id of the card \r
139 *  emulation B gate management Structure.\r
140 *\r
141 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
142 *                                      context Structure.\r
143 *  \param[in]  pipeID                  pipeID of the card emulation A gate\r
144 *  \param[in]  pPipeInfo               Update the pipe Information of the reader \r
145 *                                      A gate\r
146 *\r
147 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
148 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
149 *                                      could not be interpreted properly.\r
150 *\r
151 */\r
152 \r
153 extern\r
154 NFCSTATUS\r
155 phHciNfc_CE_B_Update_PipeInfo(\r
156                                   phHciNfc_sContext_t     *psHciContext,\r
157                                   uint8_t                 pipeID,\r
158                                   phHciNfc_Pipe_Info_t    *pPipeInfo\r
159                                   );\r
160 \r
161 /**\r
162 * \ingroup grp_hci_nfc\r
163 *\r
164 *  The phHciNfc_CE_B_SendData_Event function sends data to the PN544\r
165 *\r
166 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
167 *                                      context Structure.\r
168 *  \param[in]  pHwRef                  pHwRef is the Information of\r
169 *                                      the Device Interface Link\r
170 *  \param[in]  pipeID                  pipeID of the card emulation B gate\r
171 *  \param[in]  pPipeInfo               Update the pipe Information of the card \r
172 *                                      emulation B gate\r
173 *\r
174 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
175 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
176 *                                      could not be interpreted properly.\r
177 *\r
178 */\r
179 #ifdef CE_B_SEND_EVENT\r
180 extern\r
181 NFCSTATUS\r
182 phHciNfc_CE_B_SendData_Event(\r
183                              void               *psContext,\r
184                              void               *pHwRef,\r
185                              uint8_t            *pEvent,\r
186                              uint8_t            length\r
187                        );\r
188 #endif /* #ifdef CE_B_SEND_EVENT */\r
189 \r
190 /**\r
191 * \ingroup grp_hci_nfc\r
192 *\r
193 *  The phHciNfc_CE_B_Mode function sends data to the set the card emulation mode\r
194 *\r
195 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
196 *                                      context Structure.\r
197 *  \param[in]  pHwRef                  pHwRef is the Information of\r
198 *                                      the Device Interface Link\r
199 *  \param[in]  enable_type             type to enable\r
200 *\r
201 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
202 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
203 *                                      could not be interpreted properly.\r
204 *\r
205 */\r
206 NFCSTATUS\r
207 phHciNfc_CE_B_Mode(\r
208                             void        *psHciHandle,\r
209                             void        *pHwRef,\r
210                             uint8_t     enable_type\r
211                   );\r
212 \r
213 /**\r
214 * \ingroup grp_hci_nfc\r
215 *\r
216 *  The phHciNfc_CE_B_Initialise function opens the CE B and set all the \r
217 *   required parameters for CE B\r
218 *\r
219 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
220 *                                      context Structure.\r
221 *  \param[in]  pHwRef                  pHwRef is the Information of\r
222 *                                      the Device Interface Link\r
223 *\r
224 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
225 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
226 *                                      could not be interpreted properly.\r
227 *\r
228 */\r
229 extern \r
230 NFCSTATUS\r
231 phHciNfc_CE_B_Initialise(\r
232                         phHciNfc_sContext_t     *psHciContext,\r
233                         void                    *pHwRef\r
234                         );\r
235 \r
236 /**\r
237 * \ingroup grp_hci_nfc\r
238 *\r
239 *  The phHciNfc_CE_B_Initialise function close the CE B and reset all the \r
240 *   required parameters to default value of CE B\r
241 *\r
242 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer\r
243 *                                      context Structure.\r
244 *  \param[in]  pHwRef                  pHwRef is the Information of\r
245 *                                      the Device Interface Link\r
246 *\r
247 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
248 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
249 *                                      could not be interpreted properly.\r
250 *\r
251 */\r
252 extern \r
253 NFCSTATUS\r
254 phHciNfc_CE_B_Release(\r
255                         phHciNfc_sContext_t     *psHciContext,\r
256                         void                    *pHwRef\r
257                         );\r
258 \r
259 /**\r
260 * \ingroup grp_hci_nfc\r
261 *\r
262 *  The phHciNfc_CE_B_Update_Seq function to update CE B sequence depending on the \r
263 *  specified \ref seq_type\r
264 *\r
265 *  \param[in]  psHciContext             psHciContext is the pointer to HCI Layer\r
266 *                                       context Structure.\r
267 *  \param[in]  seq_type                 sequence type specified in \r
268 *                                       \ref phHciNfc_eSeqType_t\r
269 *\r
270 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.\r
271 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters\r
272 *                                      could not be interpreted properly.\r
273 *\r
274 */\r
275 extern \r
276 NFCSTATUS\r
277 phHciNfc_CE_B_Update_Seq(\r
278                         phHciNfc_sContext_t     *psHciContext,\r
279                         phHciNfc_eSeqType_t     seq_type\r
280                     );\r
281 \r
282 #endif /* PHHCINFC_CE_B_H */\r
283 \r
284 \r